hexsha stringlengths 40 40 | size int64 7 1.05M | ext stringclasses 13
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 269 | max_stars_repo_name stringlengths 5 108 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 9 | max_stars_count int64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 269 | max_issues_repo_name stringlengths 5 116 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 9 | max_issues_count int64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 269 | max_forks_repo_name stringlengths 5 116 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 9 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 7 1.05M | avg_line_length float64 1.21 330k | max_line_length int64 6 990k | alphanum_fraction float64 0.01 0.99 | author_id stringlengths 2 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f1c4fb0cc2981c28751ffb928d48cb8dec47d8f9 | 180 | cpp | C++ | chapter-04/recipe-01/cxx-example/test.cpp | istupsm/cmake-cookbook | 342d0171802153619ea124c5b8e792ce45178895 | [
"MIT"
] | 1,600 | 2018-05-24T01:32:44.000Z | 2022-03-31T09:24:11.000Z | chapter-04/recipe-01/cxx-example/test.cpp | istupsm/cmake-cookbook | 342d0171802153619ea124c5b8e792ce45178895 | [
"MIT"
] | 280 | 2017-08-27T13:10:51.000Z | 2018-05-23T15:09:58.000Z | chapter-04/recipe-01/cxx-example/test.cpp | istupsm/cmake-cookbook | 342d0171802153619ea124c5b8e792ce45178895 | [
"MIT"
] | 475 | 2018-05-23T15:26:27.000Z | 2022-03-31T07:28:19.000Z | #include "sum_integers.hpp"
#include <vector>
int main() {
auto integers = {1, 2, 3, 4, 5};
if (sum_integers(integers) == 15) {
return 0;
} else {
return 1;
}
}
| 12.857143 | 37 | 0.561111 | istupsm |
f1c7013995cc7c140d693bf45d299634baa971a0 | 19,718 | cpp | C++ | source/LibFgBase/src/FgTopology.cpp | SingularInversions/FaceGenBaseLibrary | e928b482fa78597cfcf3923f7252f7902ec0dfa9 | [
"MIT"
] | 41 | 2016-04-09T07:48:10.000Z | 2022-03-01T15:46:08.000Z | source/LibFgBase/src/FgTopology.cpp | SingularInversions/FaceGenBaseLibrary | e928b482fa78597cfcf3923f7252f7902ec0dfa9 | [
"MIT"
] | 9 | 2015-09-23T10:54:50.000Z | 2020-01-04T21:16:57.000Z | source/LibFgBase/src/FgTopology.cpp | SingularInversions/FaceGenBaseLibrary | e928b482fa78597cfcf3923f7252f7902ec0dfa9 | [
"MIT"
] | 29 | 2015-10-01T14:44:42.000Z | 2022-01-05T01:28:43.000Z | //
// Coypright (c) 2021 Singular Inversions Inc. (facegen.com)
// Use, modification and distribution is subject to the MIT License,
// see accompanying file LICENSE.txt or facegen.com/base_library_license.txt
//
#include "stdafx.h"
#include "FgStdSet.hpp"
#include "FgTopology.hpp"
#include "FgOpt.hpp"
#include "FgStdVector.hpp"
#include "FgCommand.hpp"
#include "Fg3dMeshIo.hpp"
#include "Fg3dDisplay.hpp"
#include "FgImgDisplay.hpp"
using namespace std;
namespace Fg {
Vec2UI
directEdgeVertInds(Vec2UI vertInds,Vec3UI tri)
{
uint idx0 = findFirstIdx(tri,vertInds[0]),
idx1 = findFirstIdx(tri,vertInds[1]),
del = (idx1+3-idx0) % 3;
if (del == 2)
swap(vertInds[0],vertInds[1]);
else if (del != 1)
FGASSERT_FALSE;
return vertInds;
}
Vec2UI
SurfTopo::Tri::edge(uint relIdx) const
{
if (relIdx == 0)
return Vec2UI(vertInds[0],vertInds[1]);
else if (relIdx == 1)
return Vec2UI(vertInds[1],vertInds[2]);
else if (relIdx == 2)
return Vec2UI(vertInds[2],vertInds[0]);
else
FGASSERT_FALSE;
return Vec2UI();
}
uint
SurfTopo::Edge::otherVertIdx(uint vertIdx) const
{
if (vertIdx == vertInds[0])
return vertInds[1];
else if (vertIdx == vertInds[1])
return vertInds[0];
else
FGASSERT_FALSE;
return 0; // make compiler happy
}
struct EdgeVerts
{
uint loIdx;
uint hiIdx;
EdgeVerts(uint i0,uint i1)
{
if (i0 < i1) {
loIdx = i0;
hiIdx = i1;
}
else {
loIdx = i1;
hiIdx = i0;
}
FGASSERT(i0 != i1);
}
// Comparison operator to use as a key for std::map:
bool operator<(const EdgeVerts & rhs) const
{
if (loIdx < rhs.loIdx)
return true;
else if (loIdx == rhs.loIdx)
return (hiIdx < rhs.hiIdx);
else
return false;
}
bool
contains(uint idx) const
{return ((idx == loIdx) || (idx == hiIdx)); }
};
struct TriVerts
{
Vec3UI inds;
TriVerts(Vec3UI i)
{
if (i[1] < i[0])
std::swap(i[0],i[1]);
if (i[2] < i[1])
std::swap(i[1],i[2]);
if (i[1] < i[0])
std::swap(i[0],i[1]);
inds = i;
}
bool operator<(const TriVerts & rhs) const
{
for (uint ii=0; ii<3; ++ii) {
if (inds[ii] < rhs.inds[ii])
return true;
else if (inds[ii] == rhs.inds[ii])
continue;
else
return false;
}
return false;
}
};
SurfTopo::SurfTopo(Vec3UIs const & tris)
{
setup(0,tris); // 0 means just use max reference
}
SurfTopo::SurfTopo(size_t numVerts,Vec3UIs const & tris)
{
setup(uint(numVerts),tris);
}
void
SurfTopo::setup(uint numVerts,Vec3UIs const & tris)
{
uint maxVertReferenced = 0;
for (Vec3UI const & tri : tris)
for (uint idx : tri.m)
updateMax_(maxVertReferenced,idx);
if (numVerts == 0)
numVerts = maxVertReferenced + 1;
else if (numVerts < maxVertReferenced+1)
fgThrow("SurfTopo called with vertex count smaller than max index reference");
// Detect null or duplicate tris:
uint duplicates = 0,
nulls = 0;
set<TriVerts> vset;
for (size_t ii=0; ii<tris.size(); ++ii) {
Vec3UI vis = tris[ii];
if ((vis[0] == vis[1]) || (vis[1] == vis[2]) || (vis[2] == vis[0]))
++nulls;
else {
TriVerts tv(vis);
if (vset.find(tv) == vset.end()) {
vset.insert(tv);
Tri tri;
tri.vertInds = vis;
m_tris.push_back(tri);
}
else
++duplicates;
}
}
if (duplicates > 0)
fgout << fgnl << "WARNING Ignored " << duplicates << " duplicate tris";
if (nulls > 0)
fgout << fgnl << "WARNING Ignored " << nulls << " null tris.";
m_verts.resize(numVerts);
std::map<EdgeVerts,Uints > edgesToTris;
for (size_t ii=0; ii<m_tris.size(); ++ii) {
Vec3UI vertInds = m_tris[ii].vertInds;
m_tris[ii].edgeInds = Vec3UI(std::numeric_limits<uint>::max());
for (uint jj=0; jj<3; ++jj) {
m_verts[vertInds[jj]].triInds.push_back(uint(ii));
EdgeVerts edge(vertInds[jj],vertInds[(jj+1)%3]);
edgesToTris[edge].push_back(uint(ii));
}
}
for (map<EdgeVerts,Uints >::const_iterator it=edgesToTris.begin(); it!=edgesToTris.end(); ++it) {
EdgeVerts edgeVerts = it->first;
Edge edge;
edge.vertInds = Vec2UI(edgeVerts.loIdx,edgeVerts.hiIdx);
edge.triInds = it->second;
m_edges.push_back(edge);
}
for (size_t ii=0; ii<m_edges.size(); ++ii) {
Vec2UI vts = m_edges[ii].vertInds;
m_verts[vts[0]].edgeInds.push_back(uint(ii));
m_verts[vts[1]].edgeInds.push_back(uint(ii));
EdgeVerts edge(vts[0],vts[1]);
Uints const & triInds = edgesToTris.find(edge)->second;
for (size_t jj=0; jj<triInds.size(); ++jj) {
uint triIdx = triInds[jj];
Vec3UI tri = m_tris[triIdx].vertInds;
for (uint ee=0; ee<3; ++ee)
if ((edge.contains(tri[ee]) && edge.contains(tri[(ee+1)%3])))
m_tris[triIdx].edgeInds[ee] = uint(ii);
}
}
// validate:
for (size_t ii=0; ii<m_verts.size(); ++ii) {
Uints const & edgeInds = m_verts[ii].edgeInds;
if (edgeInds.size() > 1)
for (size_t jj=0; jj<edgeInds.size(); ++jj)
m_edges[edgeInds[jj]].otherVertIdx(uint(ii)); // throws if index ii not found in edge verts
}
for (size_t ii=0; ii<m_tris.size(); ++ii)
for (uint jj=0; jj<3; ++jj)
FGASSERT(m_tris[ii].edgeInds[jj] != std::numeric_limits<uint>::max());
for (size_t ii=0; ii<m_edges.size(); ++ii)
FGASSERT(m_edges[ii].triInds.size() > 0);
}
Vec2UI
SurfTopo::edgeFacingVertInds(uint edgeIdx) const
{
Uints const & triInds = m_edges[edgeIdx].triInds;
FGASSERT(triInds.size() == 2);
uint ov0 = oppositeVert(triInds[0],edgeIdx),
ov1 = oppositeVert(triInds[1],edgeIdx);
return Vec2UI(ov0,ov1);
}
bool
SurfTopo::vertOnBoundary(uint vertIdx) const
{
Uints const & eis = m_verts[vertIdx].edgeInds;
// If this vert is unused it is not on a boundary:
for (size_t ii=0; ii<eis.size(); ++ii)
if (m_edges[eis[ii]].triInds.size() == 1)
return true;
return false;
}
Uints
SurfTopo::vertBoundaryNeighbours(uint vertIdx) const
{
Uints neighs;
Uints const & edgeInds = m_verts[vertIdx].edgeInds;
for (size_t ee=0; ee<edgeInds.size(); ++ee) {
Edge edge = m_edges[edgeInds[ee]];
if (edge.triInds.size() == 1)
neighs.push_back(edge.otherVertIdx(vertIdx));
}
return neighs;
}
Uints
SurfTopo::vertNeighbours(uint vertIdx) const
{
Uints ret;
Uints const & edgeInds = m_verts[vertIdx].edgeInds;
for (size_t ee=0; ee<edgeInds.size(); ++ee)
ret.push_back(m_edges[edgeInds[ee]].otherVertIdx(vertIdx));
return ret;
}
SurfTopo::BoundEdges
SurfTopo::boundaryContainingEdgeP(uint boundEdgeIdx) const
{
BoundEdges boundEdges;
bool moreEdges = false;
do {
Edge const & boundEdge = m_edges[boundEdgeIdx];
Tri const & tri = m_tris[boundEdge.triInds[0]]; // Every boundary edge has exactly 1
Vec2UI vertInds = directEdgeVertInds(boundEdge.vertInds,tri.vertInds);
boundEdges.push_back({boundEdgeIdx,vertInds[1]});
Vert const & vert = m_verts[vertInds[1]]; // Follow edge direction to vert
moreEdges = false;
for (uint edgeIdx : vert.edgeInds) {
if (edgeIdx != boundEdgeIdx) {
if (m_edges[edgeIdx].triInds.size() == 1) { // Another boundary edge
if (!containsMember(boundEdges,&BoundEdge::edgeIdx,edgeIdx)) {
boundEdgeIdx = edgeIdx;
moreEdges = true;
continue;
}
}
}
}
} while (moreEdges);
return boundEdges;
}
SurfTopo::BoundEdges
SurfTopo::boundaryContainingVert(uint vertIdx) const
{
FGASSERT(vertIdx < m_verts.size());
Vert const & vert = m_verts[vertIdx];
for (uint edgeIdx : vert.edgeInds) {
Edge const & edge = m_edges[edgeIdx];
if (edge.triInds.size() == 1) // boundary
return boundaryContainingEdgeP(edgeIdx);
}
return SurfTopo::BoundEdges{};
}
Svec<SurfTopo::BoundEdges>
SurfTopo::boundaries() const
{
Svec<BoundEdges> ret;
auto alreadyAdded = [&ret](uint edgeIdx)
{
for (BoundEdges const & bes : ret)
if (containsMember(bes,&BoundEdge::edgeIdx,edgeIdx))
return true;
return false;
};
for (uint ee=0; ee<m_edges.size(); ++ee) {
if (m_edges[ee].triInds.size() == 1) // Boundary edge
if (!alreadyAdded(ee))
ret.push_back(boundaryContainingEdgeP(ee));
}
return ret;
}
Bools
SurfTopo::boundaryVertFlags() const
{
Svec<BoundEdges> bess = boundaries();
Bools ret (m_verts.size(),false);
for (BoundEdges const & bes : bess) {
for (BoundEdge const & be : bes) {
Edge const & edge = m_edges[be.edgeIdx];
ret[edge.vertInds[0]] = true;
ret[edge.vertInds[1]] = true;
}
}
return ret;
}
set<uint>
SurfTopo::traceFold(
MeshNormals const & norms,
vector<FatBool> & done,
uint vertIdx)
const
{
set<uint> ret;
if (done[vertIdx])
return ret;
done[vertIdx] = true;
Uints const & edgeInds = m_verts[vertIdx].edgeInds;
for (size_t ii=0; ii<edgeInds.size(); ++ii) {
const Edge & edge = m_edges[edgeInds[ii]];
if (edge.triInds.size() == 2) { // Can not be part of a fold otherwise
const FacetNormals & facetNorms = norms.facet[0];
float dot = cDot(facetNorms.tri[edge.triInds[0]],facetNorms.tri[edge.triInds[1]]);
if (dot < 0.5f) { // > 60 degrees
ret.insert(vertIdx);
cUnion_(ret,traceFold(norms,done,edge.otherVertIdx(vertIdx)));
}
}
}
return ret;
}
uint
SurfTopo::oppositeVert(uint triIdx,uint edgeIdx) const
{
Vec3UI tri = m_tris[triIdx].vertInds;
Vec2UI vertInds = m_edges[edgeIdx].vertInds;
for (uint ii=0; ii<3; ++ii)
if ((tri[ii] != vertInds[0]) && (tri[ii] != vertInds[1]))
return tri[ii];
FGASSERT_FALSE;
return 0;
}
Vec3UI
SurfTopo::isManifold() const
{
Vec3UI ret(0);
for (size_t ee=0; ee<m_edges.size(); ++ee) {
const Edge & edge = m_edges[ee];
if (edge.triInds.size() == 1)
++ret[0];
else if (edge.triInds.size() > 2)
++ret[1];
else {
// Check that winding directions of the two facets are opposite on this edge:
Tri tri0 = m_tris[edge.triInds[0]],
tri1 = m_tris[edge.triInds[1]];
uint edgeIdx0 = findFirstIdx(tri0.edgeInds,uint(ee)),
edgeIdx1 = findFirstIdx(tri1.edgeInds,uint(ee));
if (tri0.edge(edgeIdx0) == tri1.edge(edgeIdx1))
++ret[2];
// Worked on all 3DP meshes but doesn't work for some screwy input (eg. frameforge base):
// FGASSERT(tri0.edge(edgeIdx0)[0] == tri1.edge(edgeIdx1)[1]);
// FGASSERT(tri0.edge(edgeIdx0)[1] == tri1.edge(edgeIdx1)[0]);
}
}
return ret;
}
size_t
SurfTopo::unusedVerts() const
{
size_t ret = 0;
for (size_t ii=0; ii<m_verts.size(); ++ii)
if (m_verts[ii].triInds.empty())
++ret;
return ret;
}
Floats
SurfTopo::edgeDistanceMap(Vec3Fs const & verts,size_t vertIdx) const
{
Floats ret(verts.size(),floatMax());
FGASSERT(vertIdx < verts.size());
ret[vertIdx] = 0;
edgeDistanceMap(verts,ret);
return ret;
}
void
SurfTopo::edgeDistanceMap(Vec3Fs const & verts,Floats & vertDists) const
{
FGASSERT(verts.size() == m_verts.size());
FGASSERT(vertDists.size() == verts.size());
bool done = false;
while (!done) {
done = true;
for (size_t vv=0; vv<vertDists.size(); ++vv) {
// Important: check each vertex each time since the topology will often result in
// the first such assignment not being the optimal:
if (vertDists[vv] < floatMax()) {
Uints const & edges = m_verts[vv].edgeInds;
for (size_t ee=0; ee<edges.size(); ++ee) {
uint neighVertIdx = m_edges[edges[ee]].otherVertIdx(uint(vv));
float neighDist = vertDists[vv] + (verts[neighVertIdx]-verts[vv]).len();
if (neighDist < vertDists[neighVertIdx]) {
vertDists[neighVertIdx] = neighDist;
done = false;
}
}
}
}
}
}
Vec3Ds
SurfTopo::boundaryVertNormals(BoundEdges const & boundary,Vec3Ds const & verts) const
{
Vec3Ds edgeNorms; edgeNorms.reserve(boundary.size());
Vec3D v0 = verts[boundary.back().vertIdx];
for (BoundEdge const & be : boundary) {
Vec3D v1 = verts[be.vertIdx];
Edge const & edge = m_edges[be.edgeIdx];
Tri const & tri = m_tris[edge.triInds[0]]; // must be exactly 1 tri
Vec3D triNorm = cTriNorm(tri.vertInds,verts),
xp = crossProduct(v1-v0,triNorm);
edgeNorms.push_back(normalize(xp));
v0 = v1;
}
Vec3Ds vertNorms; vertNorms.reserve(boundary.size());
for (size_t e0=0; e0<boundary.size(); ++e0) {
size_t e1 = (e0 + 1) % boundary.size();
Vec3D dir = edgeNorms[e0] + edgeNorms[e1];
vertNorms.push_back(normalize(dir));
}
return vertNorms;
}
set<uint>
cFillMarkedVertRegion(Mesh const & mesh,SurfTopo const & topo,uint seedIdx)
{
FGASSERT(seedIdx < topo.m_verts.size());
set<uint> ret;
for (MarkedVert const & mv : mesh.markedVerts)
ret.insert(uint(mv.idx));
set<uint> todo;
todo.insert(seedIdx);
while (!todo.empty()) {
set<uint> next;
for (uint idx : todo) {
if (!contains(ret,idx)) {
for (uint n : topo.vertNeighbours(idx))
next.insert(n);
ret.insert(idx);
}
}
todo = next;
}
return ret;
}
void
testmSurfTopo(CLArgs const & args)
{
// Test boundary vert normals by adding marked verts along normals and viewing:
Mesh mesh = loadTri(dataDir()+"base/JaneLoresFace.tri");
TriSurf triSurf = mesh.asTriSurf();
Vec3Ds verts = mapCast<Vec3D>(triSurf.verts);
double scale = cMax(cDims(verts).m) * 0.01; // Extend norms 1% of max dim
SurfTopo topo {triSurf.verts.size(),triSurf.tris};
Svec<SurfTopo::BoundEdges> boundaries = topo.boundaries();
for (auto const & boundary : boundaries) {
Vec3Ds vertNorms = topo.boundaryVertNormals(boundary,verts);
for (size_t bb=0; bb<boundary.size(); ++bb) {
auto const & be = boundary[bb];
Vec3D vert = verts[be.vertIdx] + vertNorms[bb] * scale;
mesh.addMarkedVert(Vec3F(vert),"");
}
}
if (!isAutomated(args))
viewMesh(mesh);
}
void
testmEdgeDist(CLArgs const & args)
{
Mesh mesh = loadTri(dataDir()+"base/Jane.tri");
Surf surf = mergeSurfaces(mesh.surfaces).convertToTris();
SurfTopo topo {mesh.verts.size(),surf.tris.posInds};
size_t vertIdx = 0; // Randomly choose the first
Floats edgeDists = topo.edgeDistanceMap(mesh.verts,vertIdx);
float distMax = 0;
for (size_t ii=0; ii<edgeDists.size(); ++ii)
if (edgeDists[ii] < floatMax())
updateMax_(distMax,edgeDists[ii]);
float distToCol = 255.99f / distMax;
Uchars colVal(edgeDists.size(),255);
for (size_t ii=0; ii<colVal.size(); ++ii)
if (edgeDists[ii] < floatMax())
colVal[ii] = uint(distToCol * edgeDists[ii]);
mesh.surfaces[0].setAlbedoMap(ImgRgba8(128,128,Rgba8(255)));
AffineEw2F otcsToIpcs = cOtcsToIpcs(Vec2UI(128));
for (size_t tt=0; tt<surf.tris.size(); ++tt) {
Vec3UI vertInds = surf.tris.posInds[tt];
Vec3UI uvInds = surf.tris.uvInds[tt];
for (uint ii=0; ii<3; ++ii) {
Rgba8 col(255);
col.red() = colVal[vertInds[ii]];
col.green() = 255 - col.red();
mesh.surfaces[0].material.albedoMap->paint(Vec2UI(otcsToIpcs*mesh.uvs[uvInds[ii]]),col);
}
}
if (!isAutomated(args))
viewMesh(mesh);
}
void
testmBoundVertFlags(CLArgs const & args)
{
Mesh mesh = loadTri(dataDir()+"base/JaneLoresFace.tri"); // 1 surface, all tris
Tris const & tris = mesh.surfaces[0].tris;
SurfTopo topo {mesh.verts.size(),tris.posInds};
Bools boundVertFlags = topo.boundaryVertFlags();
Vec2UI sz {64};
ImgRgba8 map {sz,Rgba8{255}};
AffineEw2F otcsToIpcs = cOtcsToIpcs(sz);
auto paintFn = [&](uint uvIdx)
{
Vec2F otcs = mesh.uvs[uvIdx];
Vec2UI ircs = Vec2UI(otcsToIpcs * otcs);
map.paint(ircs,{255,0,0,255});
};
for (size_t tt=0; tt<tris.size(); ++tt) {
Vec3UI uv = tris.uvInds[tt],
tri = tris.posInds[tt];
for (uint vv=0; vv<3; ++vv)
if (boundVertFlags[tri[vv]])
paintFn(uv[vv]);
}
//viewImage(map);
mesh.surfaces[0].setAlbedoMap(map);
if (!isAutomated(args))
viewMesh(mesh);
}
void
testSurfTopo(CLArgs const & args)
{
Cmds cmds {
{testmSurfTopo,"bnorm","view boundary vertex normals"},
{testmEdgeDist,"edist","view edge distances"},
{testmBoundVertFlags,"bvf","view boundary vertex flags"},
};
return doMenu(args,cmds,true);
}
}
// */
| 33.534014 | 110 | 0.522822 | SingularInversions |
f1c9d4d9e0a0cf0f02ce00b588e2cdbd1cd424e7 | 7,333 | cpp | C++ | apps/mtcnn/test/detect_alignment.cpp | fireae/caffe_latte | a28559481c2864c79d4b393e91869eb77c0a75fe | [
"Intel",
"BSD-2-Clause"
] | 7 | 2018-02-06T13:48:17.000Z | 2019-04-08T13:56:22.000Z | apps/mtcnn/test/detect_alignment.cpp | fireae/caffe_latte | a28559481c2864c79d4b393e91869eb77c0a75fe | [
"Intel",
"BSD-2-Clause"
] | null | null | null | apps/mtcnn/test/detect_alignment.cpp | fireae/caffe_latte | a28559481c2864c79d4b393e91869eb77c0a75fe | [
"Intel",
"BSD-2-Clause"
] | null | null | null | // caffe
#include "mtcnn.h"
//#include "LBFRegressor.h"
#include "lbf/lbf.hpp"
using namespace cv;
using namespace std;
using namespace lbf;
// // parameters
// Params global_params;
// string modelPath ="../model/";
// string dataPath = "./../../Datasets/";
// string cascadeName = "../model/haarcascade_frontalface_alt.xml";
// // set the parameters when training models.
// void InitializeGlobalParam(){
// global_params.bagging_overlap = 0.4;
// global_params.max_numtrees = 10;
// global_params.max_depth = 5;
// global_params.landmark_num = 68;
// global_params.initial_num = 5;
// global_params.max_numstage = 7;
// double m_max_radio_radius[10] = {0.4,0.3,0.2,0.15, 0.12, 0.10, 0.08,
// 0.06, 0.06,0.05};
// double m_max_numfeats[10] = {500, 500, 500, 300, 300, 200,
// 200,200,100,100};
// for (int i=0;i<10;i++){
// global_params.max_radio_radius[i] = m_max_radio_radius[i];
// }
// for (int i=0;i<10;i++){
// global_params.max_numfeats[i] = m_max_numfeats[i];
// }
// global_params.max_numthreshs = 500;
// }
// void ReadGlobalParamFromFile(string path){
// cout << "Loading GlobalParam..." << endl;
// ifstream fin;
// fin.open(path);
// fin >> global_params.bagging_overlap;
// fin >> global_params.max_numtrees;
// fin >> global_params.max_depth;
// fin >> global_params.max_numthreshs;
// fin >> global_params.landmark_num;
// fin >> global_params.initial_num;
// fin >> global_params.max_numstage;
// for (int i = 0; i< global_params.max_numstage; i++){
// fin >> global_params.max_radio_radius[i];
// }
// for (int i = 0; i < global_params.max_numstage; i++){
// fin >> global_params.max_numfeats[i];
// }
// cout << "Loading GlobalParam end"<<endl;
// fin.close();
// }
// void FaceAlignment(cv::Mat& image, vector<cv::Rect>& faces) {
// ReadGlobalParamFromFile("../model/LBF.model");
// LBFRegressor regressor;
// regressor.Load("../model/LBF.model");
// const static Scalar colors[] = { CV_RGB(0,0,255),
// CV_RGB(0,128,255),
// CV_RGB(0,255,255),
// CV_RGB(0,255,0),
// CV_RGB(255,128,0),
// CV_RGB(255,255,0),
// CV_RGB(255,0,0),
// CV_RGB(255,0,255)} ;
// double scale = 1;
// cv::Mat gray;
// cvtColor( image, gray, CV_BGR2GRAY );
// double t = (double)cvGetTickCount();
// int i = 0;
// for (vector<Rect>::const_iterator r = faces.begin(); r != faces.end();
// r++, i++) {
// Point center;
// Scalar color = colors[i%8];
// BoundingBox boundingbox;
// boundingbox.start_x = r->x*scale;
// boundingbox.start_y = r->y*scale;
// boundingbox.width = (r->width-1)*scale;
// boundingbox.height = (r->height-1)*scale;
// boundingbox.centroid_x = boundingbox.start_x + boundingbox.width/2.0;
// boundingbox.centroid_y = boundingbox.start_y +
// boundingbox.height/2.0;
// t =(double)cvGetTickCount();
// Mat_<double> current_shape = regressor.Predict(gray,boundingbox,1);
// t = (double)cvGetTickCount() - t;
// printf( "alignment time = %g ms\n",
// t/((double)cvGetTickFrequency()*1000.) );
// for(int i = 0;i < global_params.landmark_num;i++){
// circle(image,Point2d(current_shape(i,0),current_shape(i,1)),3,Scalar(255,255,255),-1,8,0);
// }
// }
// imwrite("121.jpg", image);
// }
int main(int argc, char **argv) {
if (argc != 3) {
std::cout << "MTMain.bin [model dir] [imagePath]" << std::endl;
return 0;
}
::caffe::InitLogging(argv[0]);
double threshold[3] = {0.6, 0.7, 0.7};
double factor = 0.709;
int minSize = 40;
std::string proto_model_dir = argv[1];
MTCNN detector(proto_model_dir);
std::string imageName = argv[2];
cv::Mat image = cv::imread(imageName);
cv::Mat image2 = image.clone();
std::vector<FaceInfo> faceInfo;
clock_t t1 = clock();
std::cout << "Detect " << image.rows << "X" << image.cols;
cv::Mat image_left = image2.clone();
cv::transpose(image2, image_left);
cv::flip(image_left, image_left, 1);
cv::Mat image_b = image2.clone();
cv::transpose(image_left, image_b);
cv::flip(image_b, image_b, 1);
cv::Mat image_r = image2.clone();
cv::transpose(image_b, image_r);
cv::flip(image_r, image_r, 1);
vector<Mat> images;
images.push_back(image2);
images.push_back(image_left);
images.push_back(image_b);
images.push_back(image_r);
vector<vector<FaceInfo> > faceinfos;
detector.Detect(images, faceinfos);
detector.Detect(image2, faceInfo);
#ifndef USE_CUDA
std::cout << " Time Using CPU: " << (clock() - t1) * 1.0 / 1000 << std::endl;
#else
std::cout << " Time Using GPU-CUDNN: " << (clock() - t1) * 1.0 / 1000
<< std::endl;
#endif
LbfCascador lbf_cascador;
FILE *fd = fopen("../model/LBF.model", "rb");
lbf_cascador.Read(fd);
for (int j = 0; j < faceinfos.size(); j++) {
vector<FaceInfo> &faceInfo = faceinfos[j];
cv::Mat image = images[j];
cv::Mat gray;
cvtColor(image, gray, CV_BGR2GRAY);
vector<Rect> face_rects;
for (int i = 0; i < faceInfo.size(); i++) {
float x = faceInfo[i].bbox.x1;
float y = faceInfo[i].bbox.y1;
float h = faceInfo[i].bbox.x2 - faceInfo[i].bbox.x1 + 1;
float w = faceInfo[i].bbox.y2 - faceInfo[i].bbox.y1 + 1;
cv::rectangle(image, cv::Rect(y, x, w, h), cv::Scalar(255, 0, 0), 1);
face_rects.push_back(cv::Rect(y, x, w, h));
FacePts facePts = faceInfo[i].facePts;
for (int j = 0; j < 5; j++)
cv::circle(image, cv::Point(facePts.y[j], facePts.x[j]), 1,
cv::Scalar(255, 255, 0), 1);
BBox facebox(std::max<int>(0, y), std::max<int>(0, x), w, h);
Mat myshape = lbf_cascador.Predict(gray, facebox);
for (int ipt = 0; ipt < 68; ipt++) {
int xpt = myshape.at<double>(ipt, 0);
int ypt = myshape.at<double>(ipt, 1);
cv::circle(image, cv::Point(xpt, ypt), 1, cv::Scalar(255, 0, 255), 1);
}
}
char new_name_[512];
sprintf(new_name_, "a_%d.jpg", j);
cv::imwrite(new_name_, image);
}
cv::Mat gray;
cvtColor(image, gray, CV_BGR2GRAY);
vector<Rect> face_rects;
for (int i = 0; i < faceInfo.size(); i++) {
float x = faceInfo[i].bbox.x1;
float y = faceInfo[i].bbox.y1;
float h = faceInfo[i].bbox.x2 - faceInfo[i].bbox.x1 + 1;
float w = faceInfo[i].bbox.y2 - faceInfo[i].bbox.y1 + 1;
cv::rectangle(image, cv::Rect(y, x, w, h), cv::Scalar(255, 0, 0), 1);
face_rects.push_back(cv::Rect(y, x, w, h));
FacePts facePts = faceInfo[i].facePts;
for (int j = 0; j < 5; j++)
cv::circle(image, cv::Point(facePts.y[j], facePts.x[j]), 1,
cv::Scalar(255, 255, 0), 1);
BBox facebox(std::max<int>(0, y), std::max<int>(0, x), w, h);
Mat myshape = lbf_cascador.Predict(gray, facebox);
for (int ipt = 0; ipt < 68; ipt++) {
int xpt = myshape.at<double>(ipt, 0);
int ypt = myshape.at<double>(ipt, 1);
cv::circle(image, cv::Point(xpt, ypt), 1, cv::Scalar(255, 0, 255), 1);
}
}
// FaceAlignment(image, face_rects);
cv::imwrite("c.jpg", image);
// cv::imshow("a",image);
// cv::waitKey(0);
return 1;
}
| 33.484018 | 106 | 0.586527 | fireae |
f1cb5b1626768011a4584d1cbb285257a1230516 | 242 | cpp | C++ | Source/FSD/Private/CarvedResourceData.cpp | trumank/DRG-Mods | 2febc879f2ffe83498ac913c114d0e933427e93e | [
"MIT"
] | 8 | 2021-07-10T20:06:05.000Z | 2022-03-04T19:03:50.000Z | Source/FSD/Private/CarvedResourceData.cpp | trumank/DRG-Mods | 2febc879f2ffe83498ac913c114d0e933427e93e | [
"MIT"
] | 9 | 2022-01-13T20:49:44.000Z | 2022-03-27T22:56:48.000Z | Source/FSD/Private/CarvedResourceData.cpp | trumank/DRG-Mods | 2febc879f2ffe83498ac913c114d0e933427e93e | [
"MIT"
] | 2 | 2021-07-10T20:05:42.000Z | 2022-03-14T17:05:35.000Z | #include "CarvedResourceData.h"
class UCarvedResourceCreator;
UCarvedResourceCreator* UCarvedResourceData::LoadResourceCreator() const {
return NULL;
}
UCarvedResourceData::UCarvedResourceData() {
this->UnitsPerCarver = 10.00f;
}
| 18.615385 | 74 | 0.780992 | trumank |
f1cc621494fd23264216a95089079289bf867b7e | 2,741 | cpp | C++ | BlackVision/Applications/LibBVLogic/Source/EndUserAPI/EventHandlers/GizmoEventsHandlers.cpp | black-vision-engine/bv-engine | 85089d41bb22afeaa9de070646e12aa1777ecedf | [
"MIT"
] | 1 | 2022-01-28T11:43:47.000Z | 2022-01-28T11:43:47.000Z | BlackVision/Applications/LibBVLogic/Source/EndUserAPI/EventHandlers/GizmoEventsHandlers.cpp | black-vision-engine/bv-engine | 85089d41bb22afeaa9de070646e12aa1777ecedf | [
"MIT"
] | null | null | null | BlackVision/Applications/LibBVLogic/Source/EndUserAPI/EventHandlers/GizmoEventsHandlers.cpp | black-vision-engine/bv-engine | 85089d41bb22afeaa9de070646e12aa1777ecedf | [
"MIT"
] | null | null | null | #include "stdafxBVApp.h"
#include "GizmoEventsHandlers.h"
#include "Engine/Editors/BVProjectEditor.h"
#include "BVAppLogic.h"
namespace bv
{
// ***********************
//
GizmoHandlers::GizmoHandlers( BVAppLogic * logic )
: m_appLogic( logic )
{}
// ***********************
//
GizmoHandlers::~GizmoHandlers()
{}
// ***********************
//
void GizmoHandlers::GizmoHandler ( IEventPtr evt )
{
if( evt->GetEventType() != GizmoEvent::Type() )
return;
GizmoEventPtr gizmoEvent = std::static_pointer_cast< GizmoEvent >( evt );
GizmoEvent::Command command = gizmoEvent->CommandName;
model::GizmoType gizmoType = gizmoEvent->Address.GizmoType;
std::string & sceneName = gizmoEvent->Address.SceneName;
std::string & nodeName = gizmoEvent->Address.NodeName;
std::string & elementName = gizmoEvent->Address.ElementName;
std::string & functionName = gizmoEvent->Address.FunctionalityName;
auto editor = m_appLogic->GetBVProject()->GetProjectEditor();
bool result = false;
switch( command )
{
case GizmoEvent::Command::CreateGizmo:
result = editor->CreateGizmo( sceneName, nodeName, gizmoType, elementName, functionName );
break;
case GizmoEvent::Command::RemoveGizmo:
result = editor->DeleteGizmo( sceneName, nodeName, functionName );
break;
case GizmoEvent::Command::ListGizmos:
ListGizmos( gizmoEvent, sceneName, nodeName, gizmoType, elementName );
return;
default:
break;
}
SendSimpleResponse( command, gizmoEvent->EventID, gizmoEvent->SocketID, result );
}
// ***********************
//
void GizmoHandlers::ListGizmos ( GizmoEventPtr gizmoEvt, const std::string & sceneName, const std::string nodeName, model::GizmoType type, const std::string & elementName )
{
assert( !"Implement in future" );
elementName;
auto editor = m_appLogic->GetBVProject()->GetProjectEditor();
auto node = std::static_pointer_cast< model::BasicNode >( editor->GetNode( sceneName, nodeName ) );
if( node )
{
switch( type )
{
case model::GizmoType::Scene:
break;
case model::GizmoType::Node:
break;
case model::GizmoType::Logic:
break;
case model::GizmoType::Plugin:
break;
case model::GizmoType::Effect:
break;
default:
break;
}
}
else
{
SendSimpleErrorResponse( GizmoEvent::Command::ListGizmos, gizmoEvt->EventID, gizmoEvt->SocketID, "Node not found" );
}
}
} // bv
| 26.61165 | 190 | 0.590296 | black-vision-engine |
f1ce0e7856384222730a9ca3d4ea779478b2460c | 1,872 | cpp | C++ | src/_leetcode/leet_740.cpp | turesnake/leetPractice | a87b9b90eb8016038d7e5d3ad8e50e4ceb54d69b | [
"MIT"
] | null | null | null | src/_leetcode/leet_740.cpp | turesnake/leetPractice | a87b9b90eb8016038d7e5d3ad8e50e4ceb54d69b | [
"MIT"
] | null | null | null | src/_leetcode/leet_740.cpp | turesnake/leetPractice | a87b9b90eb8016038d7e5d3ad8e50e4ceb54d69b | [
"MIT"
] | null | null | null | /*
* ====================== leet_740.cpp ==========================
* -- tpr --
* CREATE -- 2020.06.29
* MODIFY --
* ----------------------------------------------------------
* 740. 删除与获得点数
*/
#include "innLeet.h"
namespace leet_740 {//~
// dp,思路上类似 “打家劫舍” 题
// 47% 100%
class S{
struct Elem{
int val {};
int num {};
};
public:
// nums 的长度最大为 20000
// 每个整数 nums[i] 的大小都在 [1, 10000] 范围内
int deleteAndEarn( std::vector<int>& nums ){
if( nums.empty() ){ return 0; }
// 整理原始数据
std::sort( nums.begin(), nums.end() );
std::vector<Elem> elems {};
int tval = nums[0];
int tnum = 1;
for( size_t i=1; i<nums.size(); i++ ){
if( nums[i] == tval ){
tnum++;
}else{
elems.push_back(Elem{ tval, tnum });
tval = nums[i];
tnum = 1;
}
}
elems.push_back(Elem{ tval, tnum });
// 正式 dp
int N = static_cast<int>(elems.size());
std::vector<std::vector<int>> dp (N, std::vector<int>(2,0));
dp[0][1] = elems[0].val * elems[0].num;
for( int i=1; i<N; i++ ){// [i-1], [i]
// [0]
dp[i][0] = std::max( dp[i-1][0], dp[i-1][1] );
// [1]
int val = elems[i].val*elems[i].num;
if( elems[i].val-elems[i-1].val == 1 ){// 相邻
dp[i][1] = dp[i-1][0] + val;
}else{// 不相邻
dp[i][1] = std::max(dp[i-1][0], dp[i-1][1]) + val;
}
}
return std::max( dp[N-1][0], dp[N-1][1] );
}
};
//=========================================================//
void main_(){
debug::log( "\n~~~~ leet: 740 :end ~~~~\n" );
}
}//~
| 23.4 | 68 | 0.350427 | turesnake |
f1cf8fc105c5da9f00cf2059bff4bf5b0abb3815 | 2,293 | hpp | C++ | test/svscan/mock_service.hpp | taylorb-microsoft/winss | ede93f84a5d9585502db5190f2ec6365858f695a | [
"Apache-2.0"
] | 52 | 2017-01-05T23:39:38.000Z | 2020-06-04T03:00:11.000Z | test/svscan/mock_service.hpp | morganstanley/winss | ede93f84a5d9585502db5190f2ec6365858f695a | [
"Apache-2.0"
] | 24 | 2017-01-05T05:07:34.000Z | 2018-03-09T00:50:58.000Z | test/svscan/mock_service.hpp | morganstanley/winss | ede93f84a5d9585502db5190f2ec6365858f695a | [
"Apache-2.0"
] | 7 | 2016-12-27T20:55:20.000Z | 2018-03-09T00:32:19.000Z | /*
* Copyright 2016-2017 Morgan Stanley
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef TEST_SVSCAN_MOCK_SERVICE_HPP_
#define TEST_SVSCAN_MOCK_SERVICE_HPP_
#include <filesystem>
#include <utility>
#include <string>
#include "gmock/gmock.h"
#include "winss/svscan/service.hpp"
namespace fs = std::experimental::filesystem;
using ::testing::NiceMock;
using ::testing::ReturnRef;
namespace winss {
class MockService : public virtual winss::Service {
public:
MockService() {
ON_CALL(*this, GetName()).WillByDefault(ReturnRef(name));
}
explicit MockService(std::string name) :
winss::Service::ServiceTmpl(name) {}
MockService(const MockService&) = delete;
MockService(MockService&& s) :
winss::Service::ServiceTmpl(std::move(s)) {}
MOCK_CONST_METHOD0(GetName, const std::string&());
MOCK_CONST_METHOD0(IsFlagged, bool());
MOCK_METHOD0(Reset, void());
MOCK_METHOD0(Check, void());
MOCK_METHOD1(Close, bool(bool ignore_flagged));
MockService& operator=(const MockService&) = delete;
MockService& operator=(MockService&& p) {
winss::Service::operator=(std::move(p));
return *this;
}
};
class NiceMockService : public NiceMock<MockService> {
public:
NiceMockService() {}
explicit NiceMockService(std::string name) :
winss::Service::ServiceTmpl(name) {}
NiceMockService(const NiceMockService&) = delete;
NiceMockService(NiceMockService&& p) :
winss::Service::ServiceTmpl(std::move(p)) {}
NiceMockService& operator=(const NiceMockService&) = delete;
NiceMockService& operator=(NiceMockService&& p) {
winss::Service::operator=(std::move(p));
return *this;
}
};
} // namespace winss
#endif // TEST_SVSCAN_MOCK_SERVICE_HPP_
| 27.963415 | 74 | 0.703009 | taylorb-microsoft |
f1d011a2fe42fefb77af20b866d9d3c4a7caa75c | 1,705 | cpp | C++ | euryale/src/org/cracs/euryale/qos/medusa/medusa.cpp | rolandomar/stheno | 6b41f56f25be1e7d56c8be4973203bf943e4f041 | [
"Apache-2.0"
] | 7 | 2015-08-17T16:24:22.000Z | 2022-03-16T15:54:19.000Z | euryale/src/org/cracs/euryale/qos/medusa/medusa.cpp | rolandomar/stheno | 6b41f56f25be1e7d56c8be4973203bf943e4f041 | [
"Apache-2.0"
] | null | null | null | euryale/src/org/cracs/euryale/qos/medusa/medusa.cpp | rolandomar/stheno | 6b41f56f25be1e7d56c8be4973203bf943e4f041 | [
"Apache-2.0"
] | null | null | null | /*
* Copyright 2012 Rolando Martins, CRACS & INESC-TEC, DCC/FCUP
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#include <euryale/qos/medusa/MedusadCore.h>
#include <malloc.h>
#include <euryale/common/Backtrace.h>
int main(int argc, char** argv) {
try {
bool remove = false;
if (argc > 1) {
if (strcmp(argv[1], "-r") == 0) {
remove = true;
}else{
ACE_DEBUG((LM_DEBUG, ACE_TEXT("Error starting medusad, wrong argument! ('medusad -r' for removal, or 'medusad' for server startup)\n")));
exit(-1);
}
}
MedusadCore hadesd;
hadesd.init(remove);
if (!remove) {
ACE_DEBUG((LM_DEBUG, ACE_TEXT("Starting medusad...\n")));
hadesd.start();
} else {
ACE_DEBUG((LM_DEBUG, ACE_TEXT("Removing cgroup files...\n")));
hadesd.remove();
}
} catch (CgroupException& ex) {
ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%t|%T)Ex=%s\n"), ex.toString().c_str()));
ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%t|%T)End\n")));
Backtrace::backstrace();
}
return 0;
}
| 32.788462 | 153 | 0.588856 | rolandomar |
f1d2a4ec75071259ebd008038add87d789a82d5b | 66 | hpp | C++ | libs/output.hpp | smagill/go-libsass | b93b53d9b499fcc367be848c279c9be54ac59598 | [
"Apache-2.0"
] | 196 | 2015-04-20T17:55:29.000Z | 2022-01-28T09:33:33.000Z | libs/output.hpp | wellington/libsass | 90bbc073a203841de40b17109cf6e47b87b91a6e | [
"Apache-2.0"
] | 60 | 2015-05-06T13:27:28.000Z | 2020-10-23T17:42:36.000Z | libs/output.hpp | wellington/libsass | 90bbc073a203841de40b17109cf6e47b87b91a6e | [
"Apache-2.0"
] | 39 | 2015-04-27T18:15:56.000Z | 2021-12-01T22:00:39.000Z | #ifndef USE_LIBSASS
#include "../libsass-build/output.hpp"
#endif
| 16.5 | 38 | 0.757576 | smagill |
f1d2d99b83907db95eec04464c88c92e8df9f47b | 3,146 | cpp | C++ | ros/src/cam/src/capture_image/node.cpp | whymatter/albatross | 9e5455c8186d2cba9d5a5afdbb234c695200a5b4 | [
"Unlicense"
] | 1 | 2021-06-11T08:01:23.000Z | 2021-06-11T08:01:23.000Z | ros/src/cam/src/capture_image/node.cpp | whymatter/albatross | 9e5455c8186d2cba9d5a5afdbb234c695200a5b4 | [
"Unlicense"
] | null | null | null | ros/src/cam/src/capture_image/node.cpp | whymatter/albatross | 9e5455c8186d2cba9d5a5afdbb234c695200a5b4 | [
"Unlicense"
] | null | null | null | //
// Created by whymatter on 15.09.18.
//
#include "opencv2/opencv.hpp"
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <unistd.h>
#include <sys/types.h>
using namespace cv;
int main(int argc, char **argv) {
int opt_w = 640;
int opt_h = 480;
int opt_z = 100;
int opt_a = 0;
int opt_f = 0;
char *opt_d;
char c;
while ((c = getopt(argc, argv, "w:h:z:af:d:")) != -1) {
switch (c) {
case 'w':
opt_w = atoi(optarg);
break;
case 'h':
opt_h = atoi(optarg);
break;
case 'z':
opt_z = atoi(optarg);
break;
case 'a':
opt_a = 1;
break;
case 'f':
opt_f = atoi(optarg);
break;
case 'd':
opt_d = optarg;
break;
case '?':
if (optopt == 'w' || optopt == 'h' || optopt == 'z' || optopt == 'f' || optopt == 'd')
fprintf(stderr, "Options -%c require arguments.\n", optopt);
else if (isprint(optopt))
fprintf(stderr, "Unknown option `-%c'.\n", optopt);
else
fprintf(stderr, "Unknown option character `\\x%x'.\n", optopt);
return 1;
default:
abort();
}
}
VideoCapture cap(0); // open the default camera
if (!cap.isOpened()) // check if we succeeded
return -1;
cap.set(CV_CAP_PROP_FRAME_WIDTH, opt_w);
cap.set(CV_CAP_PROP_FRAME_HEIGHT, opt_h);
// cap.set(CV_CAP_PROP_ZOOM, opt_z); Not Working
// cap.set(CV_CAP_PROP_AUTOFOCUS, opt_a); Not Working
// cap.set(CV_CAP_PROP_FOCUS, opt_f); Not working
std::ostringstream stringStream;
stringStream << "v4l2-ctl -c focus_auto=" << opt_a;
system(stringStream.str().c_str());
if (opt_f >= 0 && opt_f <= 250) {
std::ostringstream stringStream;
stringStream << "v4l2-ctl -c focus_absolute=" << opt_f;
system(stringStream.str().c_str());
}
if (opt_z >= 100 && opt_z <= 500) {
std::ostringstream stringStream;
stringStream << "v4l2-ctl -c zoom_absolute=" << opt_z;
system(stringStream.str().c_str());
}
mkdir(opt_d, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
Mat edges;
namedWindow("preview", 1);
bool loop = true;
int img_nbr = 0;
while (loop) {
Mat frame;
cap >> frame; // get a new frame from camera
imshow("preview", frame);
std::stringstream ss;
switch (waitKey(10)) {
case 32:
ss << "/" << opt_d << "/" << img_nbr++ << ".png";
std::cout << ss.str().c_str() << std::endl;
imwrite(ss.str().c_str(), frame);
break;
case -1:
break;
default:
loop = false;
break;
}
}
// the camera will be deinitialized automatically in VideoCapture destructor
return 0;
} | 28.342342 | 102 | 0.4911 | whymatter |
f1d46f6d7bfaaa38d694a6603570339e00480468 | 638 | cpp | C++ | 3rdparty/GPSTk/core/lib/NavFilter/LNavParityFilter.cpp | mfkiwl/ICE | e660d031bb1bcea664db1de4946fd8781be5b627 | [
"MIT"
] | 50 | 2019-10-12T01:22:20.000Z | 2022-02-15T23:28:26.000Z | 3rdparty/GPSTk/core/lib/NavFilter/LNavParityFilter.cpp | wuyou33/Enabling-Robust-State-Estimation-through-Measurement-Error-Covariance-Adaptation | 2f1ff054b7c5059da80bb3b2f80c05861a02cc36 | [
"MIT"
] | null | null | null | 3rdparty/GPSTk/core/lib/NavFilter/LNavParityFilter.cpp | wuyou33/Enabling-Robust-State-Estimation-through-Measurement-Error-Covariance-Adaptation | 2f1ff054b7c5059da80bb3b2f80c05861a02cc36 | [
"MIT"
] | 14 | 2019-11-05T01:50:29.000Z | 2021-08-06T06:23:44.000Z | #include "LNavParityFilter.hpp"
#include "LNavFilterData.hpp"
#include "EngNav.hpp"
namespace gpstk
{
LNavParityFilter ::
LNavParityFilter()
{
}
void LNavParityFilter ::
validate(NavMsgList& msgBitsIn, NavMsgList& msgBitsOut)
{
NavMsgList::iterator i;
// check parity of each subframe and put the valid ones in
// the output
for (i = msgBitsIn.begin(); i != msgBitsIn.end(); i++)
{
LNavFilterData *fd = dynamic_cast<LNavFilterData*>(*i);
if (EngNav::checkParity(fd->sf))
accept(*i, msgBitsOut);
else
reject(*i);
}
}
}
| 22 | 67 | 0.592476 | mfkiwl |
f1da495c55dca34d529f8248b1990f02491ea1c7 | 3,330 | hpp | C++ | source/include/coffee/http/HttpResponse.hpp | ciscoruiz/wepa | e6d922157543c91b6804f11073424a0a9c6e8f51 | [
"MIT"
] | 2 | 2018-02-03T06:56:29.000Z | 2021-04-20T10:28:32.000Z | source/include/coffee/http/HttpResponse.hpp | ciscoruiz/wepa | e6d922157543c91b6804f11073424a0a9c6e8f51 | [
"MIT"
] | 8 | 2018-02-18T21:00:07.000Z | 2018-02-20T15:31:24.000Z | source/include/coffee/http/HttpResponse.hpp | ciscoruiz/wepa | e6d922157543c91b6804f11073424a0a9c6e8f51 | [
"MIT"
] | 1 | 2018-02-09T07:09:26.000Z | 2018-02-09T07:09:26.000Z | // MIT License
//
// Copyright (c) 2018 Francisco Ruiz (francisco.ruiz.rayo@gmail.com)
//
// 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 _coffee_http_HttpResponse_hpp_
#define _coffee_http_HttpResponse_hpp_
#include <coffee/http/HttpMessage.hpp>
namespace coffee {
namespace http {
namespace protocol {
namespace state {
class HttpProtocolWaitingMessage;
}
}
class HttpRequest;
/**
* General definition for HTTP requests following RFC 2616.
*
* The first line of any HTTP-request will be:
* /code
* <METHOD> <URI> HTTP/<MAYOR VERSION>.<MINOR VERSION>
* /endcode
*
* \author francisco.ruiz.rayo@gmail.com
*/
class HttpResponse : public HttpMessage {
public:
static std::shared_ptr<HttpResponse> instantiate(const std::shared_ptr<HttpRequest>& request)
noexcept
{
std::shared_ptr<HttpResponse> result(new HttpResponse(request));
return result;
}
static std::shared_ptr<HttpResponse> instantiate(const uint16_t majorVersion, const uint16_t minorVersion, const int statusCode, const std::string& errorDescription)
noexcept
{
std::shared_ptr<HttpResponse> result(new HttpResponse(majorVersion, minorVersion, statusCode, errorDescription));
return result;
}
HttpResponse& setStatusCode(const int statusCode) noexcept { m_statusCode = statusCode; return *this; }
HttpResponse& setErrorDescription(const std::string& errorDescription) noexcept { m_errorDescription = errorDescription; return *this; }
bool isOk() const noexcept { return m_statusCode == 200; }
int getStatusCode() const noexcept { return m_statusCode; }
const std::string& getErrorDescription() const noexcept { return m_errorDescription; }
protected:
/**
* Constructor.
*/
explicit HttpResponse(const std::shared_ptr<HttpRequest>& request);
HttpResponse(const uint16_t majorVersion, const uint16_t minorVersion, const int statusCode, const std::string& errorDescription);
/**
* @return the first line in the HTTP message.
*/
std::string encodeFirstLine() const throw(basis::RuntimeException);
private:
int m_statusCode;
std::shared_ptr<HttpRequest> m_request;
std::string m_errorDescription;
friend class protocol::state::HttpProtocolWaitingMessage;
};
}
}
#endif // _coffee_http_HttpResponse_hpp_
| 35.052632 | 168 | 0.751351 | ciscoruiz |
f1dadbf93397efe46ebd99f83d1ef7e58722b6cb | 718 | cpp | C++ | src/output/ArduinoSerialLogging.cpp | Sapfir0/meteostation | efd97d36cea44c926cda6302064b1e684cf1102c | [
"MIT"
] | null | null | null | src/output/ArduinoSerialLogging.cpp | Sapfir0/meteostation | efd97d36cea44c926cda6302064b1e684cf1102c | [
"MIT"
] | 9 | 2019-03-27T15:01:23.000Z | 2019-11-30T14:22:07.000Z | src/output/ArduinoSerialLogging.cpp | Sapfir0/meteostation | efd97d36cea44c926cda6302064b1e684cf1102c | [
"MIT"
] | 1 | 2019-08-06T09:30:34.000Z | 2019-08-06T09:30:34.000Z | //
// Created by avdosev on 05.09.2019.
//
#include "ArduinoSerialLogging.h"
#include <Arduino.h>
void arduinoOutput(Logger::MsgType msgType, String msg) {
switch (msgType) {
case Logger::MsgType::DebugMsg:
Serial.print("");
break;
case Logger::MsgType::InfoMsg:
Serial.print("");
break;
case Logger::MsgType::WarningMsg:
Serial.print("Warning: ");
break;
case Logger::MsgType::CriticalMsg:
Serial.print("Critical: ");
break;
case Logger::MsgType::FatalMsg:
Serial.print("Fatal: ");
break;
}
Serial.println(msg);
}
Logger logs(arduinoOutput); | 23.933333 | 57 | 0.551532 | Sapfir0 |
f1dcfc71d8f2c95c9c6ea60ffe75c4ce9f0d5254 | 1,206 | cpp | C++ | CSipSimple/jni/csipsimple-wrapper/src/zrtp_android_callback.cpp | dmfr/CSipSimple-mirror | f2f2b8efcb739090a45b205690a0fb5b74bce343 | [
"OpenSSL",
"Unlicense"
] | 4 | 2016-09-29T00:04:31.000Z | 2021-12-02T08:39:51.000Z | CSipSimple/jni/csipsimple-wrapper/src/zrtp_android_callback.cpp | dmfr/CSipSimple-mirror | f2f2b8efcb739090a45b205690a0fb5b74bce343 | [
"OpenSSL",
"Unlicense"
] | null | null | null | CSipSimple/jni/csipsimple-wrapper/src/zrtp_android_callback.cpp | dmfr/CSipSimple-mirror | f2f2b8efcb739090a45b205690a0fb5b74bce343 | [
"OpenSSL",
"Unlicense"
] | null | null | null | /**
* Copyright (C) 2010 Regis Montoya (aka r3gis - www.r3gis.fr)
* This file is part of pjsip_android.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "zrtp_android_callback.h"
static ZrtpCallback* registeredCallbackObject = NULL;
extern "C" {
void on_zrtp_show_sas_wrapper(pjsua_call_id call_id, char* sas, int verified){
pj_str_t sas_string = pj_str(sas);
registeredCallbackObject->on_zrtp_show_sas(call_id, &sas_string, verified);
}
void on_zrtp_update_transport_wrapper(pjsua_call_id call_id){
registeredCallbackObject->on_zrtp_update_transport(call_id);
}
void setZrtpCallbackObject(ZrtpCallback* callback) {
registeredCallbackObject = callback;
}
}
| 30.923077 | 79 | 0.760365 | dmfr |
f1de45a3fbe4bbbbc6097c1095eb0a2c14f47b53 | 2,305 | cpp | C++ | POJ/10 - 13/poj1185.cpp | bilibiliShen/CodeBank | 49a69b2b2c3603bf105140a9d924946ed3193457 | [
"MIT"
] | 1 | 2017-08-19T16:02:15.000Z | 2017-08-19T16:02:15.000Z | POJ/10 - 13/poj1185.cpp | bilibiliShen/CodeBank | 49a69b2b2c3603bf105140a9d924946ed3193457 | [
"MIT"
] | null | null | null | POJ/10 - 13/poj1185.cpp | bilibiliShen/CodeBank | 49a69b2b2c3603bf105140a9d924946ed3193457 | [
"MIT"
] | 1 | 2018-01-05T23:37:23.000Z | 2018-01-05T23:37:23.000Z | #include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long int64;
template<class T>inline bool updateMin(T& a, T b){ return a > b ? a = b, 1: 0; }
template<class T>inline bool updateMax(T& a, T b){ return a < b ? a = b, 1: 0; }
int n, m;
char map[101][11];
int s[101][1024];
int num[101], v[1024];
int maxx;
int ok(int s, int t)
{
for (int i = 0, j = 0; i < m; )
{
j = t & (1 << i);
if (j)
{
if (map[s][i + 1] == 'H') return 0;
if (i + 1 < m && (t & (1 << (i + 1)))) return 0;
if (i + 2 < m && (t & (1 << (i + 2)))) return 0;
i += 3;
}
else i++;
}
return 1;
}
void init(){
for (int i = 1; i <= n; i++) for (int j = 0; j < maxx; j++)
if (ok (i, j))
{
s[i][num[i]] = j;
num[i]++;
}
for (int i = 0; i < maxx; i++) for (int j = 0; j < m; j++)
if (i & (1 << j)) v[i]++;
}
int ok2(int s, int t)
{
for (int i = 0, j = 0, k = 0; i < m; i++)
{
j = s & (1 << i);
k = t & (1 << i);
if (j && k) return 0;
}
return 1;
}
int dp[101][1024][1024];
void solve (){
int i, j, k, t;
char c;
cin >> n >> m;
for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++)
cin >> map[i][j];
maxx = pow(2.0, m);
init();
if (n == 1)
{
int ans = 0;
for (int i = 0; i < num[1]; i++)
ans = max(ans, v[s[1][i]]);
cout << ans << endl;
return;
}
for (int i = 0; i < num[1]; i++) for (int j = 0; j < num[2]; j++)
if (ok2(s[1][i], s[2][j]))
dp[2][j][i] = v[s[1][i]] + v[s[2][j]];
for (int i = 3; i <= n; i++) for (int j = 0; j < num[i]; j++)
for (int k = 0; k < num[i - 1]; k++)
if (ok2(s[i][j], s[i - 1][k]))
{
for (int t = 0; t < num[i - 2]; t++)
if (ok2(s[i][j], s[i - 2][t]) && ok2(s[i - 1][k], s[i - 2][t]))
updateMax(dp[i][j][k], dp[i - 1][k][t] + v[s[i][j]]);
}
int ans = 0;
for (int i = 0; i < num[n]; i++)
for (int j = 0; j < num[n - 1]; j++)
updateMax(ans, dp[n][i][j]);
cout << ans << endl;
}
int main()
{
solve();
return 0;
} | 23.282828 | 80 | 0.390889 | bilibiliShen |
f1e07af3cb00c29e622d43fef704df02a835263e | 821 | cpp | C++ | src/classwork/03_assign/main.cpp | IrvinBeltranACC/acc-cosc-1337-spring-2021-IrvinBeltranACC | 379a48eb330bd00b307a67fca182d588a13b00ff | [
"MIT"
] | null | null | null | src/classwork/03_assign/main.cpp | IrvinBeltranACC/acc-cosc-1337-spring-2021-IrvinBeltranACC | 379a48eb330bd00b307a67fca182d588a13b00ff | [
"MIT"
] | null | null | null | src/classwork/03_assign/main.cpp | IrvinBeltranACC/acc-cosc-1337-spring-2021-IrvinBeltranACC | 379a48eb330bd00b307a67fca182d588a13b00ff | [
"MIT"
] | 1 | 2021-02-05T03:03:49.000Z | 2021-02-05T03:03:49.000Z | //Write the include statement for decisions.h here
#include <iostream>
#include "decision.h"
//Write namespace using statements for cout and cin
using std:: cout; using std::cin ;
int main()
{
int grade;
std::string letter_grade_if;
std::string letter_grade_switch;
cout<<"\nEnter a numerical grade between 0-100 and I will tell you what letter grade it is! Grade: ";
cin>> grade;
if (grade >= 0 && grade <= 100)
{
letter_grade_if = get_letter_grade_using_if(grade);
letter_grade_switch = get_letter_grade_using_switch(grade);
cout<<"\nYour numerical grade of "<<grade<<" turned into a letter grade is: "<<letter_grade_if<<"! Congrats on the "<<letter_grade_switch<<"!\n\nHope you are happy with your grade.\n";
}
else
cout<<"\nThe numbered you entered was out of range.\n";
return 0;
}
| 22.805556 | 186 | 0.711328 | IrvinBeltranACC |
f1e536af449a94bfcb37487fbb4d120d8c96090c | 848 | cpp | C++ | Group-Video/OpenVideoCall-Linux/sample/OpenVideoCall/OpenVideoCallApp.cpp | 635342478/Basic-Video-Call | d4013342e176df268c7b5030bf8168f95cf664c2 | [
"MIT"
] | 666 | 2018-10-03T19:51:47.000Z | 2022-03-29T04:27:02.000Z | Group-Video/OpenVideoCall-Linux/sample/OpenVideoCall/OpenVideoCallApp.cpp | 635342478/Basic-Video-Call | d4013342e176df268c7b5030bf8168f95cf664c2 | [
"MIT"
] | 180 | 2018-10-09T23:17:10.000Z | 2022-03-31T13:21:42.000Z | Group-Video/OpenVideoCall-Linux/sample/OpenVideoCall/OpenVideoCallApp.cpp | 635342478/Basic-Video-Call | d4013342e176df268c7b5030bf8168f95cf664c2 | [
"MIT"
] | 1,128 | 2018-10-01T05:50:12.000Z | 2022-03-24T09:13:33.000Z | #include "AgoraDefs.h"
#include "OpenVideoCallApp.h"
#include "View/CommandLineView.h"
#include "Controller/EngineController.h"
#include "EngineModel/AGEngineModel.h"
OpenVideoCallApp::OpenVideoCallApp() {
m_view = new CommandLineView();
m_controller = new EngineController();
m_controller->setView(m_view);
m_controller->setModel(AGEngineModel::Get());
}
OpenVideoCallApp::~OpenVideoCallApp() {
if(m_view) {
delete m_view;
m_view = NULL;
}
if(m_controller) {
m_controller->setView(NULL);
m_controller->setModel(NULL);
delete m_controller;
m_controller = NULL;
}
}
void OpenVideoCallApp::loadConfig(const AppConfig& cfg) {
m_view->configure(cfg);
}
void OpenVideoCallApp::run(bool open) {
AGEngineModel::Get()->initialize();
m_view->run(open);
}
| 21.74359 | 57 | 0.676887 | 635342478 |
f1effaa9a7ee21e4822ea94125ca78227be51f4c | 1,125 | cpp | C++ | Actions/SaveByTypeAction.cpp | D4rk1n/Project | c2dcfd0fc52cb0c7d755e5fc387171fc09bc3aae | [
"Apache-2.0"
] | 2 | 2019-06-15T21:46:56.000Z | 2019-06-22T02:20:28.000Z | Actions/SaveByTypeAction.cpp | D4rk1n/Project | c2dcfd0fc52cb0c7d755e5fc387171fc09bc3aae | [
"Apache-2.0"
] | 1 | 2019-06-22T03:31:52.000Z | 2019-06-22T03:44:14.000Z | Actions/SaveByTypeAction.cpp | D4rk1n/Paint-For-Kids-Project | c2dcfd0fc52cb0c7d755e5fc387171fc09bc3aae | [
"Apache-2.0"
] | 1 | 2018-12-30T09:47:25.000Z | 2018-12-30T09:47:25.000Z | #include "SaveByTypeAction.h"
#include "..\ApplicationManager.h"
#include "..\Figures\CElipse.h"
#include "..\Figures\CRectangle.h"
#include "..\Figures\CTriangle.h"
#include "..\Figures\CRhombus.h"
#include "..\Figures\CLine.h"
#include "..\GUI\UI_Info.h"
#include "..\GUI\input.h"
#include "..\GUI\Output.h"
#include "..\DEFS.h"
SaveByTypeAction::SaveByTypeAction(ApplicationManager *pApp):Action(pApp)
{
}
void SaveByTypeAction::ReadActionParameters(){
pOut = pManager->GetOutput();
pOut->PrintMessage("Choose the type of the figure you want to save");
pIn = pManager->GetInput();
ActionType a;
do{
a=pIn->GetUserAction();
switch(a){
case DRAW_RECT:
type=1;
break;
case DRAW_LINE:
type=2;
break;
case DRAW_TRI:
type=3;
break;
case DRAW_ELLIPSE:
type=5;
break;
case DRAW_RHOMBUS:
type=4;
break;
default:
break;
}
}
while(type!=1&&type!=2&&type!=3&&type!=4&&type!=5);
FileName = pIn->GetSrting(pOut);
OutFile.open(FileName);
}
void SaveByTypeAction::Execute(){
ReadActionParameters();
pManager->SaveType(type,OutFile,colors, figures);
OutFile.close();
}
| 19.396552 | 73 | 0.68 | D4rk1n |
f1f0988903330c50b3fb1741fb200cce3e243f83 | 2,171 | hpp | C++ | Support/Modules/PointCloud/IPointCloudRenderer.hpp | graphisoft-python/TextEngine | 20c2ff53877b20fdfe2cd51ce7abdab1ff676a70 | [
"Apache-2.0"
] | 3 | 2019-07-15T10:54:54.000Z | 2020-01-25T08:24:51.000Z | Support/Modules/PointCloud/IPointCloudRenderer.hpp | graphisoft-python/GSRoot | 008fac2c6bf601ca96e7096705e25b10ba4d3e75 | [
"Apache-2.0"
] | null | null | null | Support/Modules/PointCloud/IPointCloudRenderer.hpp | graphisoft-python/GSRoot | 008fac2c6bf601ca96e7096705e25b10ba4d3e75 | [
"Apache-2.0"
] | 1 | 2020-09-26T03:17:22.000Z | 2020-09-26T03:17:22.000Z | // *****************************************************************************
// File: IPointCloudRenderer.hpp
//
// Description: Pointcloud renderer object interface
// Conditionally threadsafe (no per instance threadsafety)
//
// Project: GRAPHISOFT PointCloud
//
// Contact person: DG
//
// SG compatible
// *****************************************************************************
#ifndef IPOINTCLOUDRENDERER_HPP
#define IPOINTCLOUDRENDERER_HPP
// --- Includes ----------------------------------------------------------------
#include "PointCloudRenderingEffects.hpp"
// --- Predeclaratinos ---------------------------------------------------------
class IPointCloud;
class IPointCloudClip;
class IPointCloudRendererDDI;
// --- IPointCloudRenderer -----------------------------------------------------
class POINTCLOUD_DLL_EXPORT IPointCloudRenderer
{
public:
struct Plane
{
double a;
double b;
double c;
double d;
};
protected:
virtual void InvokeDrawFromCallback (void* renderData) = 0;
public:
virtual ~IPointCloudRenderer ();
// --- Factory functions
static IPointCloudRenderer* Create ();
// --- Setting rendering properties
virtual void SetViewProjectionMatrices (const float (&viewMatrix)[4*4], const float (&projMatrix)[4*4]) = 0;
virtual void SetWorldMatrix (const float (&worldMatrix)[4*4]) = 0;
virtual void SetClipPlanes (const GS::Array<Plane>& clipPlanes) = 0;
virtual void SetPointSize (float size, float resolutionFactor) = 0;
virtual void SetRenderingEffect (PC::IRenderingEffect* effect) = 0;
virtual void SetConstantColor (float r, float g, float b, float a) = 0;
virtual void SetColorBlendFactor (float factor) = 0;
// --- Rendering methods
virtual void Draw (IPointCloud* pointCloud, IPointCloudRendererDDI* pDDIImpl) = 0;
virtual void Draw (IPointCloudClip* pcClip, IPointCloudRendererDDI* pDDIImpl) = 0;
virtual void DrawBoundBox (IPointCloud* pointCloud, IPointCloudRendererDDI* pDDIImpl) = 0;
virtual void DrawBoundBox (IPointCloudClip* pcClip, IPointCloudRendererDDI* pDDIImpl) = 0;
};
#endif // IPOINTCLOUDRENDERER_HPP | 29.739726 | 113 | 0.614924 | graphisoft-python |
f1f226b7679f8e35dd4ad10646256f600e1a1c0f | 5,101 | cpp | C++ | rdf3x/src/rts/GroupBy.cpp | dkw-aau/trident-clone | 18f896db2be05870069ae7b3aa6b4837c74fff0f | [
"Apache-2.0"
] | 20 | 2018-10-17T21:39:40.000Z | 2021-11-10T11:07:23.000Z | rdf3x/src/rts/GroupBy.cpp | dkw-aau/trident-clone | 18f896db2be05870069ae7b3aa6b4837c74fff0f | [
"Apache-2.0"
] | 5 | 2020-07-06T22:50:04.000Z | 2022-03-17T10:34:15.000Z | rdf3x/src/rts/GroupBy.cpp | dkw-aau/trident-clone | 18f896db2be05870069ae7b3aa6b4837c74fff0f | [
"Apache-2.0"
] | 9 | 2018-09-18T11:37:35.000Z | 2022-03-29T07:46:41.000Z | #include <algorithm>
#include <rts/operator/GroupBy.hpp>
#include <rts/operator/PlanPrinter.hpp>
#include <algorithm>
GroupBy::GroupBy(Operator* child,
std::map<unsigned, Register*> bindings,
std::vector<unsigned> regs,
bool distinct,
double expectedOutputCardinality) : Operator(expectedOutputCardinality), child(child), bindings(bindings), regs(regs), distinct(distinct) {
// initialize keys: index is position number, value is register number
for (auto v = bindings.begin(); v != bindings.end(); v++) {
keys.push_back(v->first);
}
}
/// Destructor
GroupBy::~GroupBy() {
delete child;
}
std::vector<unsigned> GroupBy::calculateFieldsToCompare(
std::vector<unsigned> &keys,
std::vector<unsigned> ®s) {
std::vector<unsigned> fields;
// regs contains the register numbers on which to sort, in order.
// We need to find them in the keys vector, and remember the index.
for (auto v = regs.begin(); v != regs.end(); v++) {
bool found = false;
for (unsigned i = 0; i < keys.size(); i++) {
if (keys[i] == *v) {
// Found it, remember the index
fields.push_back(i);
found = true;
break;
}
}
if (! found) {
// This should not happen, obviously. Trying to sort on a register that is not
// present???
throw 10;
}
}
return fields;
}
struct ValueSorter {
// The sorter requires a list of indices in sort-field order
std::vector<unsigned> fields;
ValueSorter(std::vector<unsigned> &fields) : fields(fields) {
}
bool operator() (const std::unique_ptr<std::vector<uint64_t>> &v1,
const std::unique_ptr<std::vector<uint64_t>> &v2) {
for (auto v = fields.begin(); v != fields.end(); v++) {
if ((*v1)[*v] < (*v2)[*v]) {
return true;
}
if ((*v1)[*v] > (*v2)[*v]) {
return false;
}
}
// Don't care ...
return false;
}
};
bool GroupBy::sameThanPrevious(uint64_t index) {
for(uint8_t i = 0; i < fields.size(); ++i) {
unsigned fieldId = fields[i];
if (values[index-1]->at(fieldId) != values[index]->at(fieldId)) {
return false;
}
}
return true;
}
/// Produce the first tuple
uint64_t GroupBy::first() {
observedOutputCardinality=0;
uint64_t cnt = child->first();
while (cnt > 0) {
std::unique_ptr<std::vector<uint64_t>> tuple = std::unique_ptr<
std::vector<uint64_t>>(new std::vector<uint64_t>());
// Get value from bindings
for (int i = 0; i < bindings.size(); i++) {
tuple->push_back(bindings[keys[i]]->value);
}
// And save count if needed
if (!distinct) {
tuple->push_back(cnt);
}
// Store into values vector
values.push_back(std::move(tuple));
// Get next value from child
cnt = child->next();
}
// sort values vector according to regs
fields = calculateFieldsToCompare(keys, regs);
std::sort(values.begin(), values.end(), ValueSorter(fields));
// initialize
index = 1;
// Restore first value into bindings
if (!values.empty()) {
for (int i = 0; i < bindings.size(); i++) {
bindings[keys[i]]->value = (*values[0])[i];
}
// Restore count if needed
cnt = distinct ? 1 : (*values[0])[bindings.size()];
// Destroy saved value, it is no longer needed
//delete values[0];
//values[0] = NULL;
observedOutputCardinality += cnt;
return cnt;
} else {
return 0;
}
}
/// Produce the next tuple
uint64_t GroupBy::next() {
//if "distinct == 1" then move to the first row with a different key
while (distinct && index < values.size() && sameThanPrevious(index)) {
index++;
}
if (index >= values.size()) {
// No more values available
return 0;
}
// Restore count if needed
uint64_t sz = distinct ? 1 : (*values[index])[bindings.size()];
// Restore value into bindings
for (int i = 0; i < bindings.size(); i++) {
bindings[keys[i]]->value = (*values[index])[i];
}
// Destroy saved value, it is no longer needed
//delete values[index];
//values[index] = NULL;
// Prepare for next next() call.
index++;
// and return
observedOutputCardinality += sz;
return sz;
}
/// Print the operator tree. Debugging only.
void GroupBy::print(PlanPrinter& out) {
out.beginOperator("GroupBy",expectedOutputCardinality, observedOutputCardinality);
child->print(out);
out.endOperator();
}
/// Add a merge join hint
void GroupBy::addMergeHint(Register* reg1,Register* reg2) {
child->addMergeHint(reg1, reg2);
}
/// Register parts of the tree that can be executed asynchronous
void GroupBy::getAsyncInputCandidates(Scheduler& scheduler) {
child->getAsyncInputCandidates(scheduler);
}
| 29.148571 | 147 | 0.576162 | dkw-aau |
f1f352db6ab0c500449329784bba26c1366981f4 | 1,689 | hpp | C++ | Platform.hpp | ceerRep/cRsToolkit | db66ff291c5f9ac3a1cec03c9da710a15c9e45d7 | [
"MIT"
] | null | null | null | Platform.hpp | ceerRep/cRsToolkit | db66ff291c5f9ac3a1cec03c9da710a15c9e45d7 | [
"MIT"
] | null | null | null | Platform.hpp | ceerRep/cRsToolkit | db66ff291c5f9ac3a1cec03c9da710a15c9e45d7 | [
"MIT"
] | null | null | null | #ifndef PLATFORM_HPP
#define PLATFORM_HPP
#include <exception>
#include <QUrl>
#include <QEventLoop>
#include <QNetworkReply>
#include <QNetworkAccessManager>
#include <QMessageBox>
#include <Broadcaster.hpp>
class Platform
{
public:
virtual QString getName() const = 0;
virtual QString getLiveURL(const Broadcaster& broadcaster) const = 0;
virtual int getLiveState(const Broadcaster& broadcaster) const = 0;
static inline QByteArray getURL(QUrl url) {
QEventLoop loop;
QNetworkAccessManager manager;
QObject::connect(&manager, &QNetworkAccessManager::finished,
[&loop](QNetworkReply *p) -> void { loop.quit(); });
auto request = QNetworkRequest(url);
request.setRawHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0");
request.setRawHeader("accept", "*/*");
auto *reply = manager.get(request);
QObject::connect(reply, &QNetworkReply::redirected,
[reply](auto url) -> void {
qDebug() << "Redirect: " << url;
emit reply->redirectAllowed();
});
loop.exec();
if (reply->error() != reply->NoError)
{
auto errorString = QString("Error: ") + reply->errorString();
auto utf8 = errorString.toStdString();
qDebug() << "Error: " << reply->url() << ' ' << reply->error() << ' ' << reply->errorString();
reply->deleteLater();
throw std::exception(utf8.c_str());
}
auto ret = reply->readAll();
reply->deleteLater();
return ret;
}
};
#endif // PLATFORM_HPP
| 28.15 | 124 | 0.590882 | ceerRep |
f1f648541f3a019381e4b8b0d6c122f60d994379 | 2,645 | hpp | C++ | se_core/include/se/io/point_cloud_io.hpp | hexagon-geo-surv/supereight-public | 29a978956d2b169a3f34eed9bc374e325551c10b | [
"MIT"
] | null | null | null | se_core/include/se/io/point_cloud_io.hpp | hexagon-geo-surv/supereight-public | 29a978956d2b169a3f34eed9bc374e325551c10b | [
"MIT"
] | null | null | null | se_core/include/se/io/point_cloud_io.hpp | hexagon-geo-surv/supereight-public | 29a978956d2b169a3f34eed9bc374e325551c10b | [
"MIT"
] | null | null | null | // SPDX-FileCopyrightText: 2018-2020 Smart Robotics Lab, Imperial College London
// SPDX-FileCopyrightText: 2016 Emanuele Vespa, ETH Zürich
// SPDX-FileCopyrightText: 2019-2020 Nils Funk, Imperial College London
// SPDX-FileCopyrightText: 2019-2020 Sotiris Papatheodorou, Imperial College London
// SPDX-License-Identifier: BSD-3-Clause
#ifndef __POINT_CLOUD_IO_HPP
#define __POINT_CLOUD_IO_HPP
#include <string>
#include <vector>
#include <Eigen/Dense>
#include "se/algorithms/meshing.hpp"
namespace se {
/**
* \brief Save the mesh vertices as a PCD file.
*
* Documentation for the PCD file format available here
* https://pcl-tutorials.readthedocs.io/en/latest/pcd_file_format.html.
*
* \param[in] mesh The mesh in map frame to be saved as a point cloud.
* \param[in] filename The name of the PCD file to create.
* \param[in] T_WM The transformation from map to world frame.
* \return 0 on success, nonzero on error.
*/
static int save_point_cloud_pcd(const std::vector<Triangle>& mesh,
const std::string filename,
const Eigen::Matrix4f& T_WM);
/**
* \brief Save the mesh vertices as a PLY file.
*
* Documentation for the PLY polygon file format available here
* https://web.archive.org/web/20161204152348/http://www.dcs.ed.ac.uk/teaching/cs4/www/graphics/Web/ply.html.
*
* \param[in] mesh The mesh in map frame to be saved as a point cloud.
* \param[in] filename The name of the PLY file to create.
* \param[in] T_WM The transformation from map to world frame.
* \return 0 on success, nonzero on error.
*/
static int save_point_cloud_ply(const std::vector<Triangle>& mesh,
const std::string filename,
const Eigen::Matrix4f& T_WM);
/**
* \brief Save the mesh vertices as a VTK file.
*
* Documentation for the VTK file format available here
* https://vtk.org/wp-content/uploads/2015/04/file-formats.pdf.
*
* \param[in] mesh The mesh in map frame to be saved as a point cloud.
* \param[in] filename The name of the VTK file to create.
* \param[in] T_WM The transformation from map to world frame.
* \return 0 on success, nonzero on error.
*/
static int save_point_cloud_vtk(const std::vector<Triangle>& mesh,
const std::string filename,
const Eigen::Matrix4f& T_WM);
} // namespace se
#include "point_cloud_io_impl.hpp"
#endif // __POINT_CLOUD_IO_HPP
| 37.253521 | 111 | 0.645369 | hexagon-geo-surv |
f1f95ab7ceac4f70a394d48d6d8be9dcbcd6ccd6 | 2,668 | cpp | C++ | source/language/scope.cpp | ThatGuyMike7/masonc | 43a3a69cd64f52fda8a629360c52a222549d6368 | [
"BSL-1.0"
] | 3 | 2020-08-10T13:37:48.000Z | 2021-07-06T10:14:39.000Z | source/language/scope.cpp | ThatGuyMike7/masonc | 43a3a69cd64f52fda8a629360c52a222549d6368 | [
"BSL-1.0"
] | null | null | null | source/language/scope.cpp | ThatGuyMike7/masonc | 43a3a69cd64f52fda8a629360c52a222549d6368 | [
"BSL-1.0"
] | null | null | null | #include <scope.hpp>
#include <logger.hpp>
#include <common.hpp>
#include <mod.hpp>
#include <iostream>
#include <optional>
namespace masonc
{
scope_index scope::index()
{
return m_index;
}
const mod& scope::get_module()
{
return *m_module;
}
const char* scope::name()
{
if (name_handle)
return m_module->scope_names.at(name_handle.value());
else
return nullptr;
}
void scope::set_name(const char* name, u16 name_length)
{
if (name_handle)
return;
name_handle = m_module->scope_names.copy_back(name, name_length);
}
// TODO: Instead of doing this, just keep a vector of pointers to parents in the scope.
std::vector<scope*> scope::parents()
{
scope* current_scope = &m_module->module_scope;
std::vector<scope*> parents = { current_scope };
for (u64 i = 0; i < m_index.size(); i += 1) {
current_scope = ¤t_scope->children[m_index[i]];
parents.push_back(current_scope);
}
return parents;
}
scope_index scope::add_child(const scope& child)
{
u64 added_child_index = children.size();
scope* added_child = &children.emplace_back(child);
added_child->m_index = m_index;
added_child->m_index.push_back(added_child_index);
added_child->m_module = m_module;
return added_child->m_index;
}
scope* scope::get_child(const scope_index& index)
{
scope* child = this;
for (u64 i = child->m_index.size(); i < index.size(); i += 1) {
child = &child->children[index[i]];
}
return child;
}
bool scope::add_symbol(symbol element)
{
if (is_symbol_defined(element))
return false;
symbols.insert(element);
return true;
}
bool scope::find_symbol(symbol element, u64 offset)
{
auto parent_scopes = parents();
// TODO: Look at imported modules as well.
if (parent_scopes.size() <= offset)
return false;
for (u64 i = parent_scopes.size() - offset; i >= 0; i -= 1) {
scope* current_parent_scope = parent_scopes[i];
auto symbol_search = current_parent_scope->symbols.find(element);
if (symbol_search != current_parent_scope->symbols.end())
return true;
}
return false;
}
bool scope::is_symbol_defined(symbol element)
{
return (symbols.find(element) != symbols.end());
//return (symbols_lookup.find(element) != symbols_lookup.end());
}
} | 24.036036 | 91 | 0.583958 | ThatGuyMike7 |
f1fadb7d0fdf8d7f5326fda99653732f2199563c | 5,795 | cpp | C++ | src/animation_runner/animation_runner.cpp | Mercotui/truncated-cube-lamp | 0fbccd0f5189b0c6aed530569c77e22cdfec92cd | [
"MIT"
] | 1 | 2021-11-30T16:20:29.000Z | 2021-11-30T16:20:29.000Z | src/animation_runner/animation_runner.cpp | Mercotui/truncated-cube-lamp | 0fbccd0f5189b0c6aed530569c77e22cdfec92cd | [
"MIT"
] | 1 | 2022-02-27T13:27:44.000Z | 2022-02-27T13:27:44.000Z | src/animation_runner/animation_runner.cpp | Mercotui/truncated-cube-lamp | 0fbccd0f5189b0c6aed530569c77e22cdfec92cd | [
"MIT"
] | null | null | null | #include "animation_runner.hpp"
#include <QtCore/QCoreApplication>
#include <QtCore/QDir>
#include <QtCore/QDirIterator>
#include <QtCore/QLoggingCategory>
#include <QtCore/QThread>
#include <algorithm>
#include <utility>
Q_LOGGING_CATEGORY(AnimationRunnerLog, "animation.runner", QtInfoMsg)
namespace {
constexpr int kMinimumFrameIntervalMS = 16; // for max 60 fps
constexpr std::string_view kLibrariesResourceDir = ":/libraries";
constexpr auto kClearColor = "black";
QJSValue createAnimationContext(QJSEngine *engine,
const QDateTime &previous_frame_time,
const QDateTime ¤t_frame_time,
ScreenInterfaceJs *screen) {
auto context = engine->newObject();
auto libs = engine->newObject();
libs.setProperty("chroma", engine->globalObject().property("chroma"));
context.setProperty("libs", libs);
context.setProperty("current_frame_time",
engine->toScriptValue(current_frame_time));
context.setProperty("previous_frame_time",
engine->toScriptValue(previous_frame_time));
context.setProperty("screen", engine->newQObject(screen));
return context;
}
} // namespace
AnimationRunner::AnimationRunner(
std::unique_ptr<ScreenControllerInterface> screen_controller)
: QObject(),
do_loop_(false),
loop_timer_(new QTimer(this)),
engine_(new QJSEngine(this)),
screen_interface_js_(
new ScreenInterfaceJs(screen_controller->getResolution(), this)),
screen_(std::move(screen_controller)) {
Q_INIT_RESOURCE(libraries);
loadLibraries();
engine_->installExtensions(QJSEngine::ConsoleExtension);
loop_timer_->setSingleShot(true);
connect(loop_timer_, &QTimer::timeout, this, &AnimationRunner::loop);
connect(screen_interface_js_, &ScreenInterfaceJs::draw,
[this]() { screen_->draw(screen_interface_js_->pixels()); });
}
AnimationRunner::~AnimationRunner() { Q_CLEANUP_RESOURCE(libraries); }
void AnimationRunner::loadLibraries() {
auto website_dir = QDir(kLibrariesResourceDir.data());
QDirIterator dir_it(website_dir.path(), {}, QDir::Files,
QDirIterator::Subdirectories);
while (dir_it.hasNext()) {
auto file_path = dir_it.next();
auto file_path_without_resource =
file_path.mid(kLibrariesResourceDir.size());
QFile scriptFile(file_path);
if (!scriptFile.open(QIODevice::ReadOnly)) {
qCWarning(AnimationRunnerLog) << "Tried to load library" << file_path
<< "but could not open the file";
continue;
}
qCInfo(AnimationRunnerLog)
<< "Loading library" << file_path_without_resource << "from"
<< file_path;
QTextStream stream(&scriptFile);
QString contents = stream.readAll();
scriptFile.close();
auto result = engine_->evaluate(contents, file_path);
if (result.isError()) {
qCWarning(AnimationRunnerLog)
<< "Loading" << file_path_without_resource << "failed at line"
<< result.property("lineNumber").toInt() << ":" << result.toString();
}
}
}
void AnimationRunner::stopScript() {
engine_->setInterrupted(true);
do_loop_ = false;
loop_timer_->stop();
}
void AnimationRunner::runScript(QString animation_script) {
// reset screen
screen_interface_js_->setAllPixels(kClearColor);
screen_->clear();
// reset runner
stopScript();
engine_->setInterrupted(false);
previous_frame_time_ = QDateTime::currentDateTime();
animation_obj_ = QJSValue();
// create new animation runner from script
auto eval_result = engine_->evaluate("\"use strict\";\n" + animation_script +
"\nnew Animation();");
if (eval_result.isError()) {
// this error can be caused by the user, so it's only logged in debug mode
qCDebug(AnimationRunnerLog)
<< "eval error at line" << eval_result.property("lineNumber").toInt()
<< ":" << eval_result.toString();
} else if (eval_result.property("update").isCallable()) {
// everything seems fine, start loop
animation_obj_ = eval_result;
do_loop_ = true;
loop();
} else {
qCDebug(AnimationRunnerLog)
<< "Created instance does not have update function:"
<< eval_result.toString();
}
}
void AnimationRunner::loop() {
qCDebug(AnimationRunnerLog)
<< "looping on thread:" << QThread::currentThread()
<< "application thread is:" << QCoreApplication::instance()->thread();
// create context
auto current_frame_time = QDateTime::currentDateTime();
auto animation_params = createAnimationContext(
engine_, previous_frame_time_, current_frame_time, screen_interface_js_);
previous_frame_time_ = current_frame_time;
// run animation fucntion
auto animation_function = animation_obj_.property("update");
auto result =
animation_function.callWithInstance(animation_obj_, {animation_params});
// handle result
if (result.isDate()) {
int requested_interval =
QDateTime::currentDateTime().msecsTo(result.toDateTime());
int corrected_interval =
std::max(requested_interval, kMinimumFrameIntervalMS);
qCDebug(AnimationRunnerLog)
<< "loop sleeping for " << corrected_interval << "ms";
// start timer for next loop itteration
if (do_loop_) {
loop_timer_->start(corrected_interval);
}
} else if (result.isUndefined()) {
qCDebug(AnimationRunnerLog) << "got \"undefined\" loop ending";
do_loop_ = false;
} else {
qCDebug(AnimationRunnerLog)
<< "loop error at line" << result.property("lineNumber").toInt() << ":"
<< result.toString();
do_loop_ = false;
}
}
QSize AnimationRunner::getResolution() { return screen_->getResolution(); }
| 34.909639 | 79 | 0.679034 | Mercotui |
f1fd08670f58b9ec04eaa0c75e096215f8ad1993 | 1,773 | hpp | C++ | libs/network/include/network/generics/callbacks.hpp | devjsc/ledger-1 | 2aa68e05b9f9c10a9971fc8ddf4848695511af3c | [
"Apache-2.0"
] | 3 | 2019-07-11T08:49:27.000Z | 2021-09-07T16:49:15.000Z | libs/network/include/network/generics/callbacks.hpp | devjsc/ledger-1 | 2aa68e05b9f9c10a9971fc8ddf4848695511af3c | [
"Apache-2.0"
] | null | null | null | libs/network/include/network/generics/callbacks.hpp | devjsc/ledger-1 | 2aa68e05b9f9c10a9971fc8ddf4848695511af3c | [
"Apache-2.0"
] | 2 | 2019-11-13T10:55:24.000Z | 2019-11-13T11:37:09.000Z | #pragma once
//------------------------------------------------------------------------------
//
// Copyright 2018-2019 Fetch.AI Limited
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//------------------------------------------------------------------------------
#include <utility>
#include <vector>
namespace fetch {
namespace generics {
template <typename FUNC>
class Callbacks
{
public:
Callbacks(const Callbacks &rhs) = delete;
Callbacks(Callbacks &&rhs) = delete;
Callbacks &operator=(const Callbacks &rhs) = delete;
Callbacks &operator=(Callbacks &&rhs) = delete;
bool operator==(const Callbacks &rhs) const = delete;
bool operator<(const Callbacks &rhs) const = delete;
Callbacks &operator=(FUNC func)
{
callbacks_.push_back(func);
return *this;
}
operator bool() const
{
return !callbacks_.empty();
}
template <class... U>
void operator()(U &&... u)
{
for (auto func : callbacks_)
{
func(std::forward<U>(u)...);
}
}
void clear(void)
{
callbacks_.clear();
}
explicit Callbacks() = default;
virtual ~Callbacks() = default;
private:
std::vector<FUNC> callbacks_;
};
} // namespace generics
} // namespace fetch
| 24.625 | 80 | 0.601241 | devjsc |
f1fd13a93c76aceb08367dc6c847f907e4153722 | 4,197 | cc | C++ | components/services/leveldb/leveldb_service_impl.cc | zipated/src | 2b8388091c71e442910a21ada3d97ae8bc1845d3 | [
"BSD-3-Clause"
] | 2,151 | 2020-04-18T07:31:17.000Z | 2022-03-31T08:39:18.000Z | components/services/leveldb/leveldb_service_impl.cc | cangulcan/src | 2b8388091c71e442910a21ada3d97ae8bc1845d3 | [
"BSD-3-Clause"
] | 395 | 2020-04-18T08:22:18.000Z | 2021-12-08T13:04:49.000Z | components/services/leveldb/leveldb_service_impl.cc | cangulcan/src | 2b8388091c71e442910a21ada3d97ae8bc1845d3 | [
"BSD-3-Clause"
] | 338 | 2020-04-18T08:03:10.000Z | 2022-03-29T12:33:22.000Z | // Copyright 2016 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/services/leveldb/leveldb_service_impl.h"
#include <memory>
#include <utility>
#include "base/sequenced_task_runner.h"
#include "components/services/leveldb/env_mojo.h"
#include "components/services/leveldb/leveldb_database_impl.h"
#include "components/services/leveldb/public/cpp/util.h"
#include "mojo/public/cpp/bindings/strong_associated_binding.h"
#include "third_party/leveldatabase/leveldb_chrome.h"
#include "third_party/leveldatabase/src/include/leveldb/db.h"
#include "third_party/leveldatabase/src/include/leveldb/filter_policy.h"
#include "third_party/leveldatabase/src/include/leveldb/slice.h"
namespace leveldb {
LevelDBServiceImpl::LevelDBServiceImpl(
scoped_refptr<base::SequencedTaskRunner> file_task_runner)
: thread_(new LevelDBMojoProxy(std::move(file_task_runner))) {}
LevelDBServiceImpl::~LevelDBServiceImpl() {}
void LevelDBServiceImpl::Open(
filesystem::mojom::DirectoryPtr directory,
const std::string& dbname,
const base::Optional<base::trace_event::MemoryAllocatorDumpGuid>&
memory_dump_id,
leveldb::mojom::LevelDBDatabaseAssociatedRequest database,
OpenCallback callback) {
leveldb_env::Options options;
// the default here to 80 instead of leveldb's default 1000 because we don't
// want to consume all file descriptors. See
// https://code.google.com/p/chromium/issues/detail?id=227313#c11 for
// details.)
options.max_open_files = 80;
OpenWithOptions(options, std::move(directory), dbname, memory_dump_id,
std::move(database), std::move(callback));
}
void LevelDBServiceImpl::OpenWithOptions(
const leveldb_env::Options& options,
filesystem::mojom::DirectoryPtr directory,
const std::string& dbname,
const base::Optional<base::trace_event::MemoryAllocatorDumpGuid>&
memory_dump_id,
leveldb::mojom::LevelDBDatabaseAssociatedRequest database,
OpenCallback callback) {
// Register our directory with the file thread.
LevelDBMojoProxy::OpaqueDir* dir =
thread_->RegisterDirectory(std::move(directory));
std::unique_ptr<MojoEnv> env_mojo(new MojoEnv(thread_, dir));
leveldb_env::Options open_options = options;
open_options.env = env_mojo.get();
std::unique_ptr<leveldb::DB> db;
leveldb::Status s = leveldb_env::OpenDB(open_options, dbname, &db);
if (s.ok()) {
mojo::MakeStrongAssociatedBinding(
std::make_unique<LevelDBDatabaseImpl>(
std::move(env_mojo), std::move(db), nullptr, memory_dump_id),
std::move(database));
}
std::move(callback).Run(LeveldbStatusToError(s));
}
void LevelDBServiceImpl::OpenInMemory(
const base::Optional<base::trace_event::MemoryAllocatorDumpGuid>&
memory_dump_id,
const std::string& tracking_name,
leveldb::mojom::LevelDBDatabaseAssociatedRequest database,
OpenCallback callback) {
leveldb_env::Options options;
options.create_if_missing = true;
options.max_open_files = 0; // Use minimum.
auto env = leveldb_chrome::NewMemEnv(tracking_name);
options.env = env.get();
std::unique_ptr<leveldb::DB> db;
leveldb::Status s = leveldb_env::OpenDB(options, "", &db);
if (s.ok()) {
mojo::MakeStrongAssociatedBinding(
std::make_unique<LevelDBDatabaseImpl>(std::move(env), std::move(db),
nullptr, memory_dump_id),
std::move(database));
}
std::move(callback).Run(LeveldbStatusToError(s));
}
void LevelDBServiceImpl::Destroy(filesystem::mojom::DirectoryPtr directory,
const std::string& dbname,
DestroyCallback callback) {
leveldb_env::Options options;
// Register our directory with the file thread.
LevelDBMojoProxy::OpaqueDir* dir =
thread_->RegisterDirectory(std::move(directory));
std::unique_ptr<MojoEnv> env_mojo(new MojoEnv(thread_, dir));
options.env = env_mojo.get();
std::move(callback).Run(
LeveldbStatusToError(leveldb::DestroyDB(dbname, options)));
}
} // namespace leveldb
| 36.495652 | 78 | 0.722659 | zipated |
f1fd9de1155d653a44ccb0e04cf7767249e9a536 | 2,493 | cpp | C++ | src/LG/lg-P1175.cpp | krishukr/cpp-code | 1c94401682227bd86c0d9295134d43582247794e | [
"MIT"
] | 1 | 2021-08-13T14:27:39.000Z | 2021-08-13T14:27:39.000Z | src/LG/lg-P1175.cpp | krishukr/cpp-code | 1c94401682227bd86c0d9295134d43582247794e | [
"MIT"
] | null | null | null | src/LG/lg-P1175.cpp | krishukr/cpp-code | 1c94401682227bd86c0d9295134d43582247794e | [
"MIT"
] | null | null | null | #include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <list>
#include <stack>
void out(std::string s);
int pri(char x);
int num(int a, int b, char op);
std::string trans(std::string s);
void calc(std::string s);
int main() {
std::ios::sync_with_stdio(false);
std::string s;
std::cin >> s;
calc(trans(s));
return 0;
}
void out(std::string s) {
for (auto i : s) {
std::cout << i << ' ';
}
std::cout << '\n';
}
int pri(char x) {
switch (x) {
case '(':
case ')':
return 0;
case '+':
case '-':
return 1;
case '*':
case '/':
return 2;
case '^':
return 3;
default:
return -1;
}
}
std::string trans(std::string s) {
std::string res{};
std::stack<char> stk;
for (auto i : s) {
if (isdigit(i)) {
res.push_back(i);
} else if (i == '(') {
stk.push(i);
} else if (i == ')') {
while (!stk.empty() and stk.top() != '(') {
res.push_back(stk.top());
stk.pop();
}
stk.pop();
} else {
while (!stk.empty() and pri(stk.top()) >= pri(i)) {
res.push_back(stk.top());
stk.pop();
}
stk.push(i);
}
}
while (!stk.empty()) {
res.push_back(stk.top());
stk.pop();
}
return res;
}
int num(int a, int b, char op) {
switch (op) {
case '+':
return a + b;
case '-':
return a - b;
case '*':
return a * b;
case '/':
return a / b;
case '^':
return std::pow(a, b);
default:
return -1;
}
}
void calc(std::string s) {
out(s);
std::list<int> stk;
for (auto it = s.begin(); it != s.end(); it++) {
auto i = *it;
if (isdigit(i)) {
stk.push_back(i - 48);
} else {
int b = stk.back();
stk.pop_back();
int a = stk.back();
stk.pop_back();
stk.push_back(num(a, b, i));
for (auto j : stk) {
std::cout << j << ' ';
}
for (auto jt = it + 1; jt != s.end(); jt++) {
auto j = *jt;
std::cout << j << ' ';
}
std::cout << '\n';
}
}
}
| 19.629921 | 63 | 0.384276 | krishukr |
f1ff1dd453499abb5396b20b59f4a38318c663a1 | 419 | cpp | C++ | Chapter01/philosophy/time/good_time.cpp | gbellizio/Software-Architecture-with-Cpp | eb0f7a52ef1253d9b0091714eee9c94c156b02bc | [
"MIT"
] | 193 | 2021-03-27T00:46:13.000Z | 2022-03-29T07:25:00.000Z | Chapter01/philosophy/time/good_time.cpp | gbellizio/Software-Architecture-with-Cpp | eb0f7a52ef1253d9b0091714eee9c94c156b02bc | [
"MIT"
] | 6 | 2021-03-26T05:48:17.000Z | 2022-02-15T12:16:54.000Z | Chapter01/philosophy/time/good_time.cpp | gbellizio/Software-Architecture-with-Cpp | eb0f7a52ef1253d9b0091714eee9c94c156b02bc | [
"MIT"
] | 64 | 2021-04-01T02:18:55.000Z | 2022-03-14T12:32:29.000Z | #include <chrono>
using namespace std::literals::chrono_literals;
struct Duration {
std::chrono::milliseconds millis_;
};
void example() {
auto d = Duration{};
// d.millis_ = 100; // compilation error, as 100 could mean anything
d.millis_ = 100ms; // okay
auto timeout = 1s; // or std::chrono::seconds(1);
d.millis_ =
timeout; // okay, seconds will be converted automatically to milliseconds
}
| 23.277778 | 80 | 0.680191 | gbellizio |
7b010d971fe81aec02fecae2fe71b65978b4a14f | 3,150 | cpp | C++ | test-validationtool.cpp | clean-code-craft-tcq-1/ms1snippet-cpp-akashbhasker | b80133d9f36dc44aed8cb2a78b77cd62bf57f1d3 | [
"MIT"
] | null | null | null | test-validationtool.cpp | clean-code-craft-tcq-1/ms1snippet-cpp-akashbhasker | b80133d9f36dc44aed8cb2a78b77cd62bf57f1d3 | [
"MIT"
] | null | null | null | test-validationtool.cpp | clean-code-craft-tcq-1/ms1snippet-cpp-akashbhasker | b80133d9f36dc44aed8cb2a78b77cd62bf57f1d3 | [
"MIT"
] | null | null | null | #define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one cpp file
#include "test/catch.hpp"
#include "sensor-validate.h"
/*----------------------------------------------------------------------------------
* SoC Sensor Tests
*/
TEST_CASE("Reports ERROR when SoC readings JUMP ABRUPBTLY - Upward Spike")
{
double socReadings[] = {0.0, 0.01, 0.5, 0.51, 0.6};
int numOfSocReadings = sizeof(socReadings) / sizeof(socReadings[0]);
REQUIRE(isSOCReadingsValid(socReadings, numOfSocReadings) == false);
}
TEST_CASE("Reports ERROR when SoC readings JUMP ABRUPBTLY - Downward Spike")
{
double socReadings[] = {0.51, 0.01, 0.5, 0.1};
int numOfSocReadings = sizeof(socReadings) / sizeof(socReadings[0]);
REQUIRE(isSOCReadingsValid(socReadings, numOfSocReadings) == false);
}
TEST_CASE("Reports ERROR when SoC readings are EMPTY")
{
double socReadings[] = {};
REQUIRE(isSOCReadingsValid(socReadings, 0) == false);
}
TEST_CASE("Reports ERROR when SoC Readings are passed as NULL")
{
REQUIRE(isSOCReadingsValid(NULL, 0) == false);
}
TEST_CASE("Reports NO ERROR when ONLY ONE SoC reading is passed")
{
double socReadings[] = {0.01};
int numOfSocReadings = sizeof(socReadings) / sizeof(socReadings[0]);
REQUIRE(isSOCReadingsValid(socReadings, numOfSocReadings) == true);
}
TEST_CASE("Reports NO ERROR when VALID SoC readings are passed")
{
double socReadings[] = {0.01, 0.02, 0.03, 0.04};
int numOfSocReadings = sizeof(socReadings) / sizeof(socReadings[0]);
REQUIRE(isSOCReadingsValid(socReadings, numOfSocReadings) == true);
}
/*----------------------------------------------------------------------------------
* Current Sensor Tests
*/
TEST_CASE("Reports ERROR when Current readings JUMP ABRUPBTLY - Upward Spike")
{
double currentReadings[] = {0.03, 0.03, 0.03, 0.33};
int numOfCurReadings = sizeof(currentReadings) / sizeof(currentReadings[0]);
REQUIRE(isCurrentReadingsValid(currentReadings, numOfCurReadings) == false);
}
TEST_CASE("Reports ERROR when Current readings JUMP ABRUPBTLY - Downward Spike")
{
double currentReadings[] = {0.33, 0.03, 0.03};
int numOfCurReadings = sizeof(currentReadings) / sizeof(currentReadings[0]);
REQUIRE(isCurrentReadingsValid(currentReadings, numOfCurReadings) == false);
}
TEST_CASE("Reports ERROR when Empty Current reading is passed")
{
double currentReadings[] = {};
REQUIRE(isCurrentReadingsValid(currentReadings, 0) == false);
}
TEST_CASE("Reports ERROR when NULL Current reading is passed") {
REQUIRE(isCurrentReadingsValid(NULL, 0) == false);
}
TEST_CASE("Reports NO ERROR when ONLY ONE Current reading is passed")
{
double currentReadings[] = {0.03};
int numOfCurReadings = sizeof(currentReadings) / sizeof(currentReadings[0]);
REQUIRE(isCurrentReadingsValid(currentReadings, numOfCurReadings) == true);
}
TEST_CASE("Reports NO ERROR when VALID Current readings are passed")
{
double currentReadings[] = {0.03, 0.04, 0.05, 0.06};
int numOfCurReadings = sizeof(currentReadings) / sizeof(currentReadings[0]);
REQUIRE(isCurrentReadingsValid(currentReadings, numOfCurReadings) == true);
}
| 28.636364 | 97 | 0.694921 | clean-code-craft-tcq-1 |
7b02d0cfd49fa5a663c0e2ba782f3ead058c2813 | 2,116 | cpp | C++ | library/cpp/coroutine/engine/stack/ut/stack_ut.cpp | wikman/catboost | 984989d556a92f4978df193b835dfe98afa77bc2 | [
"Apache-2.0"
] | null | null | null | library/cpp/coroutine/engine/stack/ut/stack_ut.cpp | wikman/catboost | 984989d556a92f4978df193b835dfe98afa77bc2 | [
"Apache-2.0"
] | null | null | null | library/cpp/coroutine/engine/stack/ut/stack_ut.cpp | wikman/catboost | 984989d556a92f4978df193b835dfe98afa77bc2 | [
"Apache-2.0"
] | null | null | null | #include <library/cpp/coroutine/engine/stack/stack.h>
#include <library/cpp/coroutine/engine/stack/stack_common.h>
#include <library/cpp/coroutine/engine/stack/stack_guards.h>
#include <library/cpp/coroutine/engine/stack/stack_utils.h>
#include <library/cpp/testing/gtest/gtest.h>
using namespace testing;
namespace NCoro::NStack::Tests {
constexpr size_t StackSizeInPages = 4;
template <class TGuard>
class TStackFixture : public Test {
protected: // methods
TStackFixture()
: Guard_(GetGuard<TGuard>())
, StackSize_(StackSizeInPages * PageSize)
{}
void SetUp() override {
ASSERT_TRUE(GetAlignedMemory(StackSizeInPages, RawMemory_, AlignedMemory_));
Stack_ = MakeHolder<NDetails::TStack>(RawMemory_, AlignedMemory_, StackSize_, "test_stack");
Guard_.Protect(AlignedMemory_, StackSize_, false);
}
void TearDown() override {
Guard_.RemoveProtection(AlignedMemory_, StackSize_);
free(Stack_->GetRawMemory());
Stack_->Reset();
EXPECT_EQ(Stack_->GetRawMemory(), nullptr);
}
protected: // data
const TGuard& Guard_;
const size_t StackSize_ = 0;
char* RawMemory_ = nullptr;
char* AlignedMemory_ = nullptr;
THolder<NDetails::TStack> Stack_;
};
typedef Types<TCanaryGuard, TPageGuard> Implementations;
TYPED_TEST_SUITE(TStackFixture, Implementations);
TYPED_TEST(TStackFixture, PointersAndSize) {
EXPECT_EQ(this->Stack_->GetRawMemory(), this->RawMemory_);
EXPECT_EQ(this->Stack_->GetAlignedMemory(), this->AlignedMemory_);
EXPECT_EQ(this->Stack_->GetSize(), this->StackSize_);
}
TYPED_TEST(TStackFixture, WriteStack) {
auto workspace = this->Guard_.GetWorkspace(this->Stack_->GetAlignedMemory(), this->Stack_->GetSize());
for (size_t i = 0; i < workspace.size(); i += 512) {
workspace[i] = 42;
}
EXPECT_TRUE(this->Guard_.CheckOverride(this->Stack_->GetAlignedMemory(), this->Stack_->GetSize()));
}
}
| 34.688525 | 110 | 0.657372 | wikman |
7b07547ad7b4180dfbaa511d588ca12b4486c2a5 | 1,204 | inl | C++ | components/system/include/syslib/platform/detail/android.inl | untgames/funner | c91614cda55fd00f5631d2bd11c4ab91f53573a3 | [
"MIT"
] | 7 | 2016-03-30T17:00:39.000Z | 2017-03-27T16:04:04.000Z | components/system/include/syslib/platform/detail/android.inl | untgames/Funner | c91614cda55fd00f5631d2bd11c4ab91f53573a3 | [
"MIT"
] | 4 | 2017-11-21T11:25:49.000Z | 2018-09-20T17:59:27.000Z | components/system/include/syslib/platform/detail/android.inl | untgames/Funner | c91614cda55fd00f5631d2bd11c4ab91f53573a3 | [
"MIT"
] | 4 | 2016-11-29T15:18:40.000Z | 2017-03-27T16:04:08.000Z | /*
Поиск методов и полей
*/
inline jmethodID find_static_method (JNIEnv* env, jclass class_, const char* name, const char* signature)
{
jmethodID result = env->GetStaticMethodID (class_, name, signature);
if (!result)
{
if (env->ExceptionOccurred ())
env->ExceptionClear ();
throw xtl::format_operation_exception ("JNIEnv::GetStaticMethodID", "Static method '%s %s' not found", name, signature);
}
return result;
}
inline jmethodID find_method (JNIEnv* env, jclass class_, const char* name, const char* signature)
{
jmethodID result = env->GetMethodID (class_, name, signature);
if (!result)
{
if (env->ExceptionOccurred ())
env->ExceptionClear ();
throw xtl::format_operation_exception ("JNIEnv::GetMethodID", "Method '%s %s' not found", name, signature);
}
return result;
}
inline jfieldID find_field (JNIEnv* env, jclass class_, const char* name, const char* type)
{
jfieldID result = env->GetFieldID (class_, name, type);
if (!result)
{
if (env->ExceptionOccurred ())
env->ExceptionClear ();
throw xtl::format_operation_exception ("JNIEnv::GetFieldID", "Field '%s %s' not found", type, name);
}
return result;
}
| 24.571429 | 124 | 0.678571 | untgames |
7b0894ccc6c79bd4a7ccce8881253bc547da3658 | 4,223 | cc | C++ | garbage_collector.cc | jkominek/fdbfs | 0a347cc63f99428ff37348486a29b11ea13d9292 | [
"0BSD"
] | 12 | 2019-09-11T09:32:31.000Z | 2022-01-14T05:26:38.000Z | garbage_collector.cc | jkominek/fdbfs | 0a347cc63f99428ff37348486a29b11ea13d9292 | [
"0BSD"
] | 18 | 2019-12-17T22:32:01.000Z | 2022-03-14T06:03:15.000Z | garbage_collector.cc | jkominek/fdbfs | 0a347cc63f99428ff37348486a29b11ea13d9292 | [
"0BSD"
] | null | null | null |
#define FUSE_USE_VERSION 26
#include <fuse_lowlevel.h>
#define FDB_API_VERSION 630
#include <foundationdb/fdb_c.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <assert.h>
#include <time.h>
#include "util.h"
#include "inflight.h"
/*************************************************************
* garbage collector
*************************************************************
* scan the garbage key space
* TODO we need another thread to regularly refresh our local
* copy of the PID table, and 'ping' any other processes which
* appear to be dead. we should also regularly check that our
* entry in the PID table hasn't been marked with a flag telling
* us to die. and if we haven't been able to check that for
* awhile, we should die.
*/
void *garbage_scanner(void *ignore)
{
uint8_t scan_spot = random() & 0xF;
struct timespec ts;
ts.tv_sec = 1;
ts.tv_nsec = 0;
#if DEBUG
printf("gc starting\n");
#endif
while(database != NULL) {
// TODO vary this or do something to slow things down.
ts.tv_sec = 1; nanosleep(&ts, NULL);
unique_transaction t = make_transaction();
// we'll pick a random spot in the garbage space, and
// then we'll scan a bit past that.
auto start = key_prefix;
start.push_back('g');
auto stop = start;
uint8_t b = (scan_spot & 0xF) << 4;
start.push_back(b);
stop.push_back(b | 0x0F);
//printf("starting gc at %02x\n", b);
scan_spot = (scan_spot + 1) % 16;
FDBFuture *f =
fdb_transaction_get_range(t.get(),
start.data(), start.size(), 0, 1,
stop.data(), stop.size(), 0, 1,
1, 0,
FDB_STREAMING_MODE_SMALL, 0,
0,
// flip between forwards and backwards
// scanning of our randomly chosen range
random() & 0x1);
const FDBKeyValue *kvs;
int kvcount;
fdb_bool_t more;
if(fdb_future_block_until_ready(f) ||
fdb_future_get_keyvalue_array(f, &kvs, &kvcount, &more) ||
(kvcount <= 0)) {
// errors, or nothing to do. take a longer break.
fdb_future_destroy(f);
// sleep extra, though.
ts.tv_sec = 3; nanosleep(&ts, NULL);
continue;
}
if(kvs[0].key_length != inode_key_length) {
// we found malformed junk in the garbage space. ironic.
fdb_transaction_clear(t.get(),
kvs[0].key,
kvs[0].key_length);
FDBFuture *g = fdb_transaction_commit(t.get());
// if it fails, it fails, we'll try again the next time we
// stumble across it.
(void)fdb_future_block_until_ready(g);
fdb_future_destroy(f);
fdb_future_destroy(g);
continue;
}
// ok we found a garbage-collectible inode.
// fetch the in-use records for it.
fuse_ino_t ino;
bcopy(kvs[0].key + key_prefix.size() + 1,
&ino, sizeof(fuse_ino_t));
ino = be64toh(ino);
#if DEBUG
printf("found garbage inode %lx\n", ino);
#endif
start = pack_inode_key(ino);
start.push_back(0x01);
stop = pack_inode_key(ino);
stop.push_back(0x02);
// scan the use range of the inode
// TODO we actually need to pull all use records, and compare
// them against
f = fdb_transaction_get_range(t.get(),
start.data(), start.size(), 0, 1,
stop.data(), stop.size(), 0, 1,
1, 0,
FDB_STREAMING_MODE_SMALL, 0,
0, 0);
if(fdb_future_block_until_ready(f) ||
fdb_future_get_keyvalue_array(f, &kvs, &kvcount, &more) ||
kvcount>0) {
// welp. nothing to do.
#if DEBUG
printf("nothing to do on the garbage inode\n");
#endif
fdb_future_destroy(f);
continue;
}
// wooo no usage, we get to erase it.
#if DEBUG
printf("cleaning garbage inode\n");
#endif
auto garbagekey = pack_garbage_key(ino);
fdb_transaction_clear(t.get(), garbagekey.data(), garbagekey.size());
erase_inode(t.get(), ino);
f = fdb_transaction_commit(t.get());
// if the commit fails, it doesn't matter. we'll try again
// later.
if(fdb_future_block_until_ready(f)) {
printf("error when commiting a garbage collection transaction\n");
}
fdb_future_destroy(f);
}
#if DEBUG
printf("gc done\n");
#endif
return NULL;
}
| 27.966887 | 73 | 0.621596 | jkominek |
7b09f0886cd8473cc9d9089adf2fb616e3ade3d4 | 2,926 | cpp | C++ | source/interactables/nodeController.cpp | theKlanc/Z3 | 97c28f31483d1d5c8c7d1aa61155b256b3d4094a | [
"MIT"
] | 4 | 2020-08-09T20:34:28.000Z | 2021-07-22T23:30:40.000Z | source/interactables/nodeController.cpp | theKlanc/Z3 | 97c28f31483d1d5c8c7d1aa61155b256b3d4094a | [
"MIT"
] | 5 | 2020-02-18T23:19:14.000Z | 2020-02-18T23:26:24.000Z | source/interactables/nodeController.cpp | theKlanc/Z3 | 97c28f31483d1d5c8c7d1aa61155b256b3d4094a | [
"MIT"
] | null | null | null | #include "interactables/nodeController.hpp"
#include "services.hpp"
#include "components/brain.hpp"
#include "jsonTools.hpp"
#include "universeNode.hpp"
#include "icecream.hpp"
#include "components/velocity.hpp"
nodeController::nodeController()
{
_thrustViewer = std::make_shared<fddDisplay>(fddDisplay({},240,{},{-1,-1,-1,-1},{1,1,1,1},5,5,10));
_thrustViewer->setPosition({HI2::getScreenWidth()-_thrustViewer->getSize().x,0});
_scene.addGadget(_thrustViewer);
_spdViewer = std::make_shared<fddDisplay>(fddDisplay({0,HI2::getScreenHeight()-240},240,{},{-1,-1,-1,-1},{1,1,1,1},5,5,10));
_spdViewer->setPosition({HI2::getScreenWidth()-_spdViewer->getSize().x,HI2::getScreenHeight()-240});
_scene.addGadget(_spdViewer);
}
nodeController::~nodeController()
{
}
void nodeController::interact(entt::entity e)
{
Services::enttRegistry->get<std::unique_ptr<brain>>(e)->setControlling(this);
Services::enttRegistry->get<velocity>(e).spd = {};
}
nlohmann::json nodeController::getJson() const
{
return nlohmann::json{{"type",interactableType::NODE_CONTROLLER},{"interactable",{
{"positions",_positions},{"thrustTarget",_thrustTarget}
}}};
}
void nodeController::fix(point3Di dist)
{
for(fdd& pos : _positions){
pos+=fdd(dist);
}
}
void nodeController::update(double dt, const std::bitset<HI2::BUTTON_SIZE> &down, const std::bitset<HI2::BUTTON_SIZE> &up, const std::bitset<HI2::BUTTON_SIZE> &held)
{
if((down[HI2::BUTTON::KEY_BACKSPACE] || down[HI2::BUTTON::BUTTON_B]) && _exitCallback)
_exitCallback();
else{
if(held[HI2::BUTTON::KEY_W] || held[HI2::BUTTON::UP]){
_thrustTarget.y-=dt*agility;
if(_thrustTarget.y < -1)
_thrustTarget.y=-1;
}
if(held[HI2::BUTTON::KEY_A] || held[HI2::BUTTON::LEFT]){
_thrustTarget.x-=dt*agility;
if(_thrustTarget.x < -1)
_thrustTarget.x=-1;
}
if(held[HI2::BUTTON::KEY_S] || held[HI2::BUTTON::DOWN]){
_thrustTarget.y+=dt*agility;
if(_thrustTarget.y > 1)
_thrustTarget.y=1;
}
if(held[HI2::BUTTON::KEY_D] || held[HI2::BUTTON::RIGHT]){
_thrustTarget.x+=dt*agility;
if(_thrustTarget.x > 1)
_thrustTarget.x=1;
}
if(held[HI2::BUTTON::KEY_R] || held[HI2::BUTTON::BUTTON_L]){
_thrustTarget.z+=dt*agility;
if(_thrustTarget.z > 1)
_thrustTarget.z=1;
}
if(held[HI2::BUTTON::KEY_F] || held[HI2::BUTTON::BUTTON_ZL]){
_thrustTarget.z-=dt*agility;
if(_thrustTarget.z < -1)
_thrustTarget.z=-1;
}
if(held[HI2::BUTTON::KEY_X] || held[HI2::BUTTON::BUTTON_X]){
_thrustTarget = {};
}
}
_parent->getThrustSystem()->setThrustTarget(_thrustTarget);
}
void nodeController::drawUI()
{
_thrustViewer->setFdd({_thrustTarget.x,_thrustTarget.y,_thrustTarget.z,0});
_spdViewer->setFdd(_parent->getVelocity());
_scene.draw();
}
void from_json(const nlohmann::json &j, nodeController &nc)
{
nc._positions = j.at("positions").get<std::vector<fdd>>();
nc._thrustTarget = j.at("thrustTarget").get<point3Dd>();
}
| 29.26 | 165 | 0.692413 | theKlanc |
7b12d455de1f5d8b472347b620a284b77b4de2b2 | 1,359 | cpp | C++ | boboleetcode/Play-Leetcode-master/0987-Vertical-Order-Traversal-of-a-Binary-Tree/cpp-0987/main.cpp | yaominzh/CodeLrn2019 | adc727d92904c5c5d445a2621813dfa99474206d | [
"Apache-2.0"
] | 2 | 2021-03-25T05:26:55.000Z | 2021-04-20T03:33:24.000Z | boboleetcode/Play-Leetcode-master/0987-Vertical-Order-Traversal-of-a-Binary-Tree/cpp-0987/main.cpp | mcuallen/CodeLrn2019 | adc727d92904c5c5d445a2621813dfa99474206d | [
"Apache-2.0"
] | 6 | 2019-12-04T06:08:32.000Z | 2021-05-10T20:22:47.000Z | boboleetcode/Play-Leetcode-master/0987-Vertical-Order-Traversal-of-a-Binary-Tree/cpp-0987/main.cpp | mcuallen/CodeLrn2019 | adc727d92904c5c5d445a2621813dfa99474206d | [
"Apache-2.0"
] | null | null | null | /// Source : https://leetcode.com/problems/vertical-order-traversal-of-a-binary-tree/
/// Author : liuyubobobo
/// Time : 2019-02-02
#include <iostream>
#include <vector>
#include <map>
using namespace std;
/// DFS
/// Time Complexity: O(nlogn)
/// Space Complexity: O(n)
/// Definition for a binary tree node.
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
class Solution {
public:
vector<vector<int>> verticalTraversal(TreeNode* root) {
map<int, vector<pair<int, int>>> pos;
dfs(root, 0, 0, pos);
vector<vector<int>> res;
for(pair<int, vector<pair<int, int>>> p: pos){
sort(p.second.begin(), p.second.end());
vector<int> r;
for(const pair<int, int>& e: p.second)
r.push_back(e.second);
res.push_back(r);
}
return res;
}
private:
void dfs(TreeNode* node, int x, int y, map<int, vector<pair<int, int>>>& pos){
if(!node)
return;
pos[x].push_back(make_pair(y, node->val));
dfs(node->left, x - 1, y + 1, pos);
dfs(node->right, x + 1, y + 1, pos);
}
};
int main() {
// [0,5,1,9,null,2,null,null,null,null,3,4,8,6,null,null,null,7]
// [[9,7],[5,6],[0,2,4],[1,3],[8]]
return 0;
} | 22.278689 | 85 | 0.550405 | yaominzh |
7b137d262e1112bb8b7e846f8c61bacc10b28aec | 2,480 | cpp | C++ | ProceduralTerrainGen/Plugins/RuntimeMeshComponent/Intermediate/Build/Win64/UE4/Shipping/RuntimeMeshComponent/Module.RuntimeMeshComponent.gen.3_of_4.cpp | RFornalik/ProceduralTerrain | 017b8df6606eef242a399192518dcd9ebd3bbcc9 | [
"MIT"
] | null | null | null | ProceduralTerrainGen/Plugins/RuntimeMeshComponent/Intermediate/Build/Win64/UE4/Shipping/RuntimeMeshComponent/Module.RuntimeMeshComponent.gen.3_of_4.cpp | RFornalik/ProceduralTerrain | 017b8df6606eef242a399192518dcd9ebd3bbcc9 | [
"MIT"
] | null | null | null | ProceduralTerrainGen/Plugins/RuntimeMeshComponent/Intermediate/Build/Win64/UE4/Shipping/RuntimeMeshComponent/Module.RuntimeMeshComponent.gen.3_of_4.cpp | RFornalik/ProceduralTerrain | 017b8df6606eef242a399192518dcd9ebd3bbcc9 | [
"MIT"
] | null | null | null | // This file is automatically generated at compile-time to include some subset of the user-created cpp files.
#include "C:/Users/rufus/Documents/ProceduralTerrainDemo/ProceduralTerrainGen/Plugins/RuntimeMeshComponent/Intermediate/Build/Win64/UE4/Inc/RuntimeMeshComponent/RuntimeMeshModifierAdjacency.gen.cpp"
#include "C:/Users/rufus/Documents/ProceduralTerrainDemo/ProceduralTerrainGen/Plugins/RuntimeMeshComponent/Intermediate/Build/Win64/UE4/Inc/RuntimeMeshComponent/RuntimeMeshModifierNormals.gen.cpp"
#include "C:/Users/rufus/Documents/ProceduralTerrainDemo/ProceduralTerrainGen/Plugins/RuntimeMeshComponent/Intermediate/Build/Win64/UE4/Inc/RuntimeMeshComponent/RuntimeMeshProvider.gen.cpp"
#include "C:/Users/rufus/Documents/ProceduralTerrainDemo/ProceduralTerrainGen/Plugins/RuntimeMeshComponent/Intermediate/Build/Win64/UE4/Inc/RuntimeMeshComponent/RuntimeMeshProviderBox.gen.cpp"
#include "C:/Users/rufus/Documents/ProceduralTerrainDemo/ProceduralTerrainGen/Plugins/RuntimeMeshComponent/Intermediate/Build/Win64/UE4/Inc/RuntimeMeshComponent/RuntimeMeshProviderCollision.gen.cpp"
#include "C:/Users/rufus/Documents/ProceduralTerrainDemo/ProceduralTerrainGen/Plugins/RuntimeMeshComponent/Intermediate/Build/Win64/UE4/Inc/RuntimeMeshComponent/RuntimeMeshProviderMemoryCache.gen.cpp"
#include "C:/Users/rufus/Documents/ProceduralTerrainDemo/ProceduralTerrainGen/Plugins/RuntimeMeshComponent/Intermediate/Build/Win64/UE4/Inc/RuntimeMeshComponent/RuntimeMeshProviderModifiers.gen.cpp"
#include "C:/Users/rufus/Documents/ProceduralTerrainDemo/ProceduralTerrainGen/Plugins/RuntimeMeshComponent/Intermediate/Build/Win64/UE4/Inc/RuntimeMeshComponent/RuntimeMeshProviderPlane.gen.cpp"
#include "C:/Users/rufus/Documents/ProceduralTerrainDemo/ProceduralTerrainGen/Plugins/RuntimeMeshComponent/Intermediate/Build/Win64/UE4/Inc/RuntimeMeshComponent/RuntimeMeshProviderSphere.gen.cpp"
#include "C:/Users/rufus/Documents/ProceduralTerrainDemo/ProceduralTerrainGen/Plugins/RuntimeMeshComponent/Intermediate/Build/Win64/UE4/Inc/RuntimeMeshComponent/RuntimeMeshProviderStatic.gen.cpp"
#include "C:/Users/rufus/Documents/ProceduralTerrainDemo/ProceduralTerrainGen/Plugins/RuntimeMeshComponent/Intermediate/Build/Win64/UE4/Inc/RuntimeMeshComponent/RuntimeMeshProviderStaticMesh.gen.cpp"
#include "C:/Users/rufus/Documents/ProceduralTerrainDemo/ProceduralTerrainGen/Plugins/RuntimeMeshComponent/Intermediate/Build/Win64/UE4/Inc/RuntimeMeshComponent/RuntimeMeshProviderTargetInterface.gen.cpp"
| 177.142857 | 204 | 0.884677 | RFornalik |
7b18a5b9cab88caa641aeac19317067a14e6b57e | 6,523 | cpp | C++ | Source/exercise35/PlusITK/ITK-MFCDlg.cpp | InsightSoftwareConsortium/ITKTutorialExercises | 9047c3d51f62ce7c486f88810cf1e071a0922a4e | [
"Apache-2.0"
] | 3 | 2016-01-06T00:03:44.000Z | 2021-06-16T12:32:29.000Z | Source/exercise35/PlusITK/ITK-MFCDlg.cpp | wangjun456/ITKTutorialExercises | 9047c3d51f62ce7c486f88810cf1e071a0922a4e | [
"Apache-2.0"
] | null | null | null | Source/exercise35/PlusITK/ITK-MFCDlg.cpp | wangjun456/ITKTutorialExercises | 9047c3d51f62ce7c486f88810cf1e071a0922a4e | [
"Apache-2.0"
] | 4 | 2016-05-02T06:02:49.000Z | 2021-01-28T09:01:09.000Z | // ITK-MFCDlg.cpp : implementation file
//
#include "stdafx.h"
#include "ITK-MFC.h"
#include "ITK-MFCDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
enum { IDD = IDD_ABOUTBOX };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
// Implementation
protected:
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
END_MESSAGE_MAP()
// CITKMFCDlg dialog
CITKMFCDlg::CITKMFCDlg(CWnd* pParent /*=NULL*/)
: CDialog(CITKMFCDlg::IDD, pParent)
{
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
m_Reader = ReaderType::New();
m_Writer = WriterType::New();
m_Filter = FilterType::New();
m_Filter->SetInput( m_Reader->GetOutput() );
m_Writer->SetInput( m_Filter->GetOutput() );
m_Filter->SetTimeStep( 0.1 ); // for 2D images
m_Filter->SetNumberOfIterations( 5 );
this->m_ReceptorCommand = ReceptorCommandType::New();
this->m_ReceptorCommand->SetCallbackFunction(
this, & CITKMFCDlg::UpdateProgressBar );
this->m_Filter->AddObserver(
itk::ProgressEvent(), this->m_ReceptorCommand );
}
void CITKMFCDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_SLIDER1, m_NumberOfIterationsSlider);
DDX_Control(pDX, IDC_PROGRESS1, m_ProgressBar);
}
BEGIN_MESSAGE_MAP(CITKMFCDlg, CDialog)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_BUTTON1, LoadInputImage)
ON_BN_CLICKED(IDC_BUTTON3, RunImageFilter)
ON_BN_CLICKED(IDC_BUTTON4, SaveOutputImage)
ON_BN_CLICKED(IDCANCEL, CancelFiltering)
ON_WM_HSCROLL()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// CITKMFCDlg message handlers
BOOL CITKMFCDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
m_NumberOfIterationsSlider.SetRange( 1, 50 );
m_NumberOfIterationsSlider.SetPos( 5 );
m_NumberOfIterationsSlider.SetTic(true);
m_NumberOfIterationsSlider.SetTicFreq(5);
m_ProgressBar.SetRange( 0, 100 );
m_ProgressBar.SetStep( 1 );
m_ProgressBar.SetPos( 0 );
return TRUE; // return TRUE unless you set the focus to a control
}
void CITKMFCDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CITKMFCDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// The system calls this function to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CITKMFCDlg::OnQueryDragIcon()
{
return static_cast<HCURSOR>(m_hIcon);
}
void CITKMFCDlg::LoadInputImage()
{
CString strFilter = "*.png";
CFileDialog fileDialog( TRUE, NULL, NULL, OFN_FILEMUSTEXIST, strFilter );
HRESULT hResult = (int)fileDialog.DoModal();
if( FAILED( hResult ) )
{
return;
}
m_Reader->SetFileName( fileDialog.GetFileName() );
try
{
m_Reader->Update();
}
catch( itk::ExceptionObject & excp )
{
MessageBox( _T( excp.GetDescription() ), 0, 0 );
}
}
void CITKMFCDlg::RunImageFilter()
{
this->m_CancelFilter = false;
try
{
m_ProgressBar.SetPos( 0 );
m_Filter->Update();
m_ProgressBar.SetPos( 100 );
}
catch( itk::ExceptionObject & excp )
{
m_ProgressBar.SetPos( 0 );
MessageBox( _T( excp.GetDescription() ), 0, 0 );
}
}
void CITKMFCDlg::SaveOutputImage()
{
CString strFilter = "*.png";
CFileDialog fileDialog( FALSE, NULL, NULL, OFN_PATHMUSTEXIST, strFilter );
HRESULT hResult = (int)fileDialog.DoModal();
if( FAILED( hResult ) )
{
return;
}
m_Writer->SetFileName( fileDialog.GetFileName() );
try
{
m_Writer->Update();
}
catch( itk::ExceptionObject & excp )
{
MessageBox( _T( excp.GetDescription() ), 0, 0 );
}
}
void CITKMFCDlg::OnHScroll(
UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
CSliderCtrl * slider =
dynamic_cast< CSliderCtrl * >( pScrollBar );
if( slider == &m_NumberOfIterationsSlider )
{
m_Filter->SetNumberOfIterations(
m_NumberOfIterationsSlider.GetPos() );
}
}
void CITKMFCDlg::UpdateProgressBar( const itk::EventObject & event )
{
const itk::ProgressEvent * progressEvent =
dynamic_cast< const itk::ProgressEvent * >( & event );
if( progressEvent )
{
float progress = m_Filter->GetProgress();
int integerProgess = static_cast<int>( progress * 100.0 );
this->m_ProgressBar.SetPos( integerProgess );
}
// Check if the Cancel button has been pressed
MSG message;
if( ::PeekMessage( &message, NULL, 0, 0, PM_NOREMOVE ) )
{
AfxGetApp()->PumpMessage();
if( this->m_CancelFilter )
{
// Aborting filter execution
this->m_Filter->AbortGenerateDataOn();
this->m_ProgressBar.SetPos( 0 );
}
}
}
void CITKMFCDlg::CancelFiltering()
{
this->m_CancelFilter = true;
}
| 22.262799 | 86 | 0.683888 | InsightSoftwareConsortium |
7b1b5667e6390299e7c6ddc1399ff49ab1e52527 | 338 | hpp | C++ | src/utility/test_coroutine.hpp | RamchandraApte/OmniTemplate | f150f451871b0ab43ac39a798186278106da1527 | [
"MIT"
] | 14 | 2019-04-23T21:44:12.000Z | 2022-03-04T22:48:59.000Z | src/utility/test_coroutine.hpp | RamchandraApte/OmniTemplate | f150f451871b0ab43ac39a798186278106da1527 | [
"MIT"
] | 3 | 2019-04-25T10:45:32.000Z | 2020-08-05T22:40:39.000Z | src/utility/test_coroutine.hpp | RamchandraApte/OmniTemplate | f150f451871b0ab43ac39a798186278106da1527 | [
"MIT"
] | 1 | 2020-07-16T22:16:33.000Z | 2020-07-16T22:16:33.000Z | #pragma once
#include "coroutine.hpp"
namespace coroutine::test {
void test_coroutine() {
const ll a = 4;
vector<ll> v;
try {
while (true) {
v.push_back(coro(a));
}
} catch (out_of_range &) {
}
assert((v == vector<ll>{404, 0 * 0, 1 * 1, 2 * 2, 3 * 3, 505}));
}
} // namespace coroutine::test
using namespace coroutine::test;
| 19.882353 | 65 | 0.618343 | RamchandraApte |
7b1c3682fec0d8ff87ee6b8c1783386a0af01b4b | 12,390 | cc | C++ | solvers/test/scs_solver_test.cc | RobotLocomotion/drake-python3.7 | ae397a4c6985262d23e9675b9bf3927c08d027f5 | [
"BSD-3-Clause"
] | 2 | 2021-02-25T02:01:02.000Z | 2021-03-17T04:52:04.000Z | solvers/test/scs_solver_test.cc | RobotLocomotion/drake-python3.7 | ae397a4c6985262d23e9675b9bf3927c08d027f5 | [
"BSD-3-Clause"
] | null | null | null | solvers/test/scs_solver_test.cc | RobotLocomotion/drake-python3.7 | ae397a4c6985262d23e9675b9bf3927c08d027f5 | [
"BSD-3-Clause"
] | 1 | 2021-06-13T12:05:39.000Z | 2021-06-13T12:05:39.000Z | #include "drake/solvers/scs_solver.h"
#include <gtest/gtest.h>
#include "drake/common/test_utilities/eigen_matrix_compare.h"
#include "drake/solvers/mathematical_program.h"
#include "drake/solvers/test/exponential_cone_program_examples.h"
#include "drake/solvers/test/linear_program_examples.h"
#include "drake/solvers/test/mathematical_program_test_util.h"
#include "drake/solvers/test/quadratic_program_examples.h"
#include "drake/solvers/test/second_order_cone_program_examples.h"
#include "drake/solvers/test/semidefinite_program_examples.h"
#include "drake/solvers/test/sos_examples.h"
namespace drake {
namespace solvers {
namespace test {
namespace {
// SCS uses `eps = 1e-5` by default. For testing, we'll allow for some
// small cumulative error beyond that.
constexpr double kTol = 1e-4;
} // namespace
GTEST_TEST(LinearProgramTest, Test0) {
// Test a linear program with only equality constraint.
// min x(0) + 2 * x(1)
// s.t x(0) + x(1) = 2
// The problem is unbounded.
MathematicalProgram prog;
const auto x = prog.NewContinuousVariables<2>("x");
prog.AddLinearCost(x(0) + 2 * x(1));
prog.AddLinearConstraint(x(0) + x(1) == 2);
ScsSolver solver;
if (solver.available()) {
auto result = solver.Solve(prog, {}, {});
EXPECT_EQ(result.get_solution_result(), SolutionResult::kUnbounded);
}
// Now add the constraint x(1) <= 1. The problem is
// min x(0) + 2 * x(1)
// s.t x(0) + x(1) = 2
// x(1) <= 1
// the problem should still be unbounded.
prog.AddBoundingBoxConstraint(-std::numeric_limits<double>::infinity(), 1,
x(1));
if (solver.available()) {
auto result = solver.Solve(prog, {}, {});
EXPECT_EQ(result.get_solution_result(), SolutionResult::kUnbounded);
}
// Now add the constraint x(0) <= 5. The problem is
// min x(0) + 2x(1)
// s.t x(0) + x(1) = 2
// x(1) <= 1
// x(0) <= 5
// the problem should be feasible. The optimal cost is -1, with x = (5, -3)
prog.AddBoundingBoxConstraint(-std::numeric_limits<double>::infinity(), 5,
x(0));
if (solver.available()) {
auto result = solver.Solve(prog, {}, {});
EXPECT_TRUE(result.is_success());
EXPECT_NEAR(result.get_optimal_cost(), -1, kTol);
const Eigen::Vector2d x_expected(5, -3);
EXPECT_TRUE(CompareMatrices(result.GetSolution(x), x_expected, kTol,
MatrixCompareType::absolute));
}
// Now change the cost to 3x(0) - x(1) + 5, and add the constraint 2 <= x(0)
// The problem is
// min 3x(0) - x(1) + 5
// s.t x(0) + x(1) = 2
// 2 <= x(0) <= 5
// x(1) <= 1
// The optimal cost is 11, the optimal solution is x = (2, 0)
prog.AddLinearCost(2 * x(0) - 3 * x(1) + 5);
prog.AddBoundingBoxConstraint(2, 6, x(0));
if (solver.available()) {
auto result = solver.Solve(prog, {}, {});
EXPECT_TRUE(result.is_success());
EXPECT_NEAR(result.get_optimal_cost(), 11, kTol);
const Eigen::Vector2d x_expected(2, 0);
EXPECT_TRUE(CompareMatrices(result.GetSolution(x), x_expected, kTol,
MatrixCompareType::absolute));
}
}
GTEST_TEST(LinearProgramTest, Test1) {
// Test a linear program with only equality constraints
// min x(0) + 2 * x(1)
// s.t x(0) + x(1) = 1
// 2x(0) + x(1) = 2
// x(0) - 2x(1) = 3
// This problem is infeasible.
MathematicalProgram prog;
const auto x = prog.NewContinuousVariables<2>("x");
prog.AddLinearCost(x(0) + 2 * x(1));
prog.AddLinearEqualityConstraint(x(0) + x(1) == 1 && 2 * x(0) + x(1) == 2);
prog.AddLinearEqualityConstraint(x(0) - 2 * x(1) == 3);
ScsSolver scs_solver;
if (scs_solver.available()) {
auto result = scs_solver.Solve(prog, {}, {});
EXPECT_EQ(result.get_solution_result(),
SolutionResult::kInfeasibleConstraints);
}
}
GTEST_TEST(LinearProgramTest, Test2) {
// Test a linear program with bounding box, linear equality and inequality
// constraints
// min x(0) + 2 * x(1) + 3 * x(2) + 2
// s.t x(0) + x(1) = 2
// x(0) + 2x(2) = 3
// -2 <= x(0) + 4x(1) <= 10
// -5 <= x(1) + 2x(2) <= 9
// -x(0) + 2x(2) <= 7
// -x(1) + 3x(2) >= -10
// x(0) <= 10
// 1 <= x(2) <= 9
// The optimal cost is 8, with x = (1, 1, 1)
MathematicalProgram prog;
const auto x = prog.NewContinuousVariables<3>();
prog.AddLinearCost(x(0) + 2 * x(1) + 3 * x(2) + 2);
prog.AddLinearEqualityConstraint(x(0) + x(1) == 2 && x(0) + 2 * x(2) == 3);
Eigen::Matrix<double, 3, 3> A;
// clang-format off
A << 1, 4, 0,
0, 1, 2,
-1, 0, 2;
// clang-format on
prog.AddLinearConstraint(
A, Eigen::Vector3d(-2, -5, -std::numeric_limits<double>::infinity()),
Eigen::Vector3d(10, 9, 7), x);
prog.AddLinearConstraint(-x(1) + 3 * x(2) >= -10);
prog.AddBoundingBoxConstraint(-std::numeric_limits<double>::infinity(), 10,
x(0));
prog.AddBoundingBoxConstraint(1, 9, x(2));
ScsSolver scs_solver;
if (scs_solver.available()) {
auto result = scs_solver.Solve(prog, {}, {});
EXPECT_TRUE(result.is_success());
EXPECT_NEAR(result.get_optimal_cost(), 8, kTol);
EXPECT_TRUE(CompareMatrices(result.GetSolution(x), Eigen::Vector3d(1, 1, 1),
kTol, MatrixCompareType::absolute));
}
}
TEST_P(LinearProgramTest, TestLP) {
ScsSolver solver;
prob()->RunProblem(&solver);
}
INSTANTIATE_TEST_SUITE_P(
SCSTest, LinearProgramTest,
::testing::Combine(::testing::ValuesIn(linear_cost_form()),
::testing::ValuesIn(linear_constraint_form()),
::testing::ValuesIn(linear_problems())));
TEST_F(InfeasibleLinearProgramTest0, TestInfeasible) {
ScsSolver solver;
if (solver.available()) {
auto result = solver.Solve(*prog_, {}, {});
EXPECT_EQ(result.get_solution_result(),
SolutionResult::kInfeasibleConstraints);
EXPECT_EQ(result.get_optimal_cost(),
MathematicalProgram::kGlobalInfeasibleCost);
}
}
TEST_F(UnboundedLinearProgramTest0, TestUnbounded) {
ScsSolver solver;
if (solver.available()) {
auto result = solver.Solve(*prog_, {}, {});
EXPECT_EQ(result.get_solution_result(), SolutionResult::kUnbounded);
EXPECT_EQ(result.get_optimal_cost(), MathematicalProgram::kUnboundedCost);
}
}
TEST_P(TestEllipsoidsSeparation, TestSOCP) {
ScsSolver scs_solver;
if (scs_solver.available()) {
SolveAndCheckSolution(scs_solver, kTol);
}
}
INSTANTIATE_TEST_SUITE_P(SCSTest, TestEllipsoidsSeparation,
::testing::ValuesIn(GetEllipsoidsSeparationProblems()));
TEST_P(TestQPasSOCP, TestSOCP) {
ScsSolver scs_solver;
if (scs_solver.available()) {
SolveAndCheckSolution(scs_solver, kTol);
}
}
INSTANTIATE_TEST_SUITE_P(SCSTest, TestQPasSOCP,
::testing::ValuesIn(GetQPasSOCPProblems()));
TEST_P(TestFindSpringEquilibrium, TestSOCP) {
ScsSolver scs_solver;
if (scs_solver.available()) {
SolveAndCheckSolution(scs_solver, kTol);
}
}
INSTANTIATE_TEST_SUITE_P(
SCSTest, TestFindSpringEquilibrium,
::testing::ValuesIn(GetFindSpringEquilibriumProblems()));
GTEST_TEST(TestSOCP, MaximizeGeometricMeanTrivialProblem1) {
MaximizeGeometricMeanTrivialProblem1 prob;
ScsSolver solver;
if (solver.available()) {
const auto result = solver.Solve(prob.prog(), {}, {});
prob.CheckSolution(result, 4E-6);
}
}
GTEST_TEST(TestSOCP, MaximizeGeometricMeanTrivialProblem2) {
MaximizeGeometricMeanTrivialProblem2 prob;
ScsSolver solver;
if (solver.available()) {
const auto result = solver.Solve(prob.prog(), {}, {});
// On Mac the accuracy is about 2.1E-6. On Linux it is about 2E-6.
prob.CheckSolution(result, 2.1E-6);
}
}
GTEST_TEST(TestSOCP, SmallestEllipsoidCoveringProblem) {
ScsSolver solver;
SolveAndCheckSmallestEllipsoidCoveringProblems(solver, 4E-6);
}
TEST_P(QuadraticProgramTest, TestQP) {
ScsSolver solver;
if (solver.available()) {
prob()->prog()->SetSolverOption(ScsSolver::id(), "verbose", 0);
prob()->RunProblem(&solver);
}
}
INSTANTIATE_TEST_SUITE_P(
ScsTest, QuadraticProgramTest,
::testing::Combine(::testing::ValuesIn(quadratic_cost_form()),
::testing::ValuesIn(linear_constraint_form()),
::testing::ValuesIn(quadratic_problems())));
GTEST_TEST(QPtest, TestUnitBallExample) {
ScsSolver solver;
if (solver.available()) {
TestQPonUnitBallExample(solver);
}
}
GTEST_TEST(TestSemidefiniteProgram, TrivialSDP) {
ScsSolver scs_solver;
if (scs_solver.available()) {
TestTrivialSDP(scs_solver, kTol);
}
}
GTEST_TEST(TestSemidefiniteProgram, CommonLyapunov) {
ScsSolver scs_solver;
if (scs_solver.available()) {
FindCommonLyapunov(scs_solver, kTol);
}
}
GTEST_TEST(TestSemidefiniteProgram, OuterEllipsoid) {
ScsSolver scs_solver;
if (scs_solver.available()) {
FindOuterEllipsoid(scs_solver, kTol);
}
}
GTEST_TEST(TestSemidefiniteProgram, EigenvalueProblem) {
ScsSolver scs_solver;
if (scs_solver.available()) {
SolveEigenvalueProblem(scs_solver, kTol);
}
}
GTEST_TEST(TestSemidefiniteProgram, SolveSDPwithSecondOrderConeExample1) {
ScsSolver scs_solver;
if (scs_solver.available()) {
SolveSDPwithSecondOrderConeExample1(scs_solver, kTol);
}
}
GTEST_TEST(TestSemidefiniteProgram, SolveSDPwithSecondOrderConeExample2) {
ScsSolver scs_solver;
if (scs_solver.available()) {
SolveSDPwithSecondOrderConeExample2(scs_solver, kTol);
}
}
GTEST_TEST(TestSemidefiniteProgram, SolveSDPwithOverlappingVariables) {
ScsSolver scs_solver;
if (scs_solver.available()) {
SolveSDPwithOverlappingVariables(scs_solver, kTol);
}
}
GTEST_TEST(TestExponentialConeProgram, ExponentialConeTrivialExample) {
ScsSolver solver;
if (solver.available()) {
// Currently we don't support retrieving dual solution from SCS yet.
ExponentialConeTrivialExample(solver, kTol, false);
}
}
GTEST_TEST(TestExponentialConeProgram, MinimizeKLDivengence) {
ScsSolver scs_solver;
if (scs_solver.available()) {
MinimizeKLDivergence(scs_solver, kTol);
}
}
GTEST_TEST(TestExponentialConeProgram, MinimalEllipsoidConveringPoints) {
ScsSolver scs_solver;
if (scs_solver.available()) {
MinimalEllipsoidCoveringPoints(scs_solver, kTol);
}
}
GTEST_TEST(TestScs, SetOptions) {
MathematicalProgram prog;
auto x = prog.NewContinuousVariables<2>();
prog.AddLinearConstraint(x(0) + x(1) >= 1);
prog.AddQuadraticCost(x(0) * x(0) + x(1) * x(1));
ScsSolver solver;
if (solver.available()) {
auto result = solver.Solve(prog, {}, {});
const int iter_solve = result.get_solver_details<ScsSolver>().iter;
const int solved_status =
result.get_solver_details<ScsSolver>().scs_status;
DRAKE_DEMAND(iter_solve >= 2);
SolverOptions solver_options;
// Now we require that SCS can only take half of the iterations before
// termination. We expect now SCS cannot solve the problem.
solver_options.SetOption(solver.solver_id(), "max_iters", iter_solve / 2);
solver.Solve(prog, {}, solver_options, &result);
EXPECT_NE(result.get_solver_details<ScsSolver>().scs_status,
solved_status);
}
}
GTEST_TEST(TestScs, UnivariateQuarticSos) {
UnivariateQuarticSos dut;
ScsSolver solver;
if (solver.available()) {
const auto result = solver.Solve(dut.prog());
dut.CheckResult(result, 1E-6);
}
}
GTEST_TEST(TestScs, BivariateQuarticSos) {
BivariateQuarticSos dut;
ScsSolver solver;
if (solver.available()) {
const auto result = solver.Solve(dut.prog());
dut.CheckResult(result, 1E-6);
}
}
GTEST_TEST(TestScs, SimpleSos1) {
SimpleSos1 dut;
ScsSolver solver;
if (solver.available()) {
const auto result = solver.Solve(dut.prog());
dut.CheckResult(result, 1E-6);
}
}
GTEST_TEST(TestScs, MotzkinPolynomial) {
MotzkinPolynomial dut;
ScsSolver solver;
if (solver.is_available()) {
const auto result = solver.Solve(dut.prog());
dut.CheckResult(result, 1E-6);
}
}
GTEST_TEST(TestScs, UnivariateNonnegative1) {
UnivariateNonnegative1 dut;
ScsSolver solver;
if (solver.is_available()) {
const auto result = solver.Solve(dut.prog());
dut.CheckResult(result, 1E-6);
}
}
} // namespace test
} // namespace solvers
} // namespace drake
| 31.052632 | 80 | 0.670299 | RobotLocomotion |
7b1cb9a6cdf4f2590e1b54256b90137a810d8242 | 1,091 | hpp | C++ | saga/saga/replica.hpp | saga-project/saga-cpp | 7376c0de0529e7d7b80cf08b94ec484c2e56d38e | [
"BSL-1.0"
] | 5 | 2015-09-15T16:24:14.000Z | 2021-08-12T11:05:55.000Z | saga/saga/replica.hpp | saga-project/saga-cpp | 7376c0de0529e7d7b80cf08b94ec484c2e56d38e | [
"BSL-1.0"
] | null | null | null | saga/saga/replica.hpp | saga-project/saga-cpp | 7376c0de0529e7d7b80cf08b94ec484c2e56d38e | [
"BSL-1.0"
] | 3 | 2016-11-17T04:38:38.000Z | 2021-04-10T17:23:52.000Z | // Copyright (c) 2005-2008 Hartmut Kaiser
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef SAGA_SAGA_REPLICA_HPP
#define SAGA_SAGA_REPLICA_HPP
#include <saga/saga-defs.hpp>
# ifdef SAGA_HAVE_PACKAGE_REPLICA
// logicalfile comes from the data package
#include <saga/saga/packages/replica/version.hpp>
#include <saga/saga/packages/replica/logical_file.hpp>
#include <saga/saga/packages/replica/logical_directory.hpp>
#if !defined(SAGA_REPLICA_PACKAGE_EXPORTS) || defined(SAGA_USE_AUTO_LINKING)
#define SAGA_AUTOLINK_LIB_NAME "replica"
#include <saga/saga/autolink.hpp>
#endif
#else
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__DMC__)
# pragma message ("Warning: The saga-replica package has been disabled at configuration time.")
#elif defined(__GNUC__) || defined(__HP_aCC) || defined(__SUNPRO_CC) || defined(__IBMCPP__)
# warning "The saga-replica package has been disabled at configuration time."
#endif
#endif
#endif // SAGA_SAGA_REPLICA_HPP
| 32.088235 | 96 | 0.780018 | saga-project |
7b1f6d4d45b0f4b1131204d17f536ded7e9d97c1 | 493,240 | cc | C++ | protobufs/dota_gcmessages_client_tournament.pb.cc | devilesk/dota-replay-parser | e83b96ee513a7193e6703615df4f676e27b1b8a0 | [
"0BSD"
] | 2 | 2017-02-03T16:57:17.000Z | 2020-10-28T21:13:12.000Z | protobufs/dota_gcmessages_client_tournament.pb.cc | invokr/dota-replay-parser | 6260aa834fb47f0f1a8c713f4edada6baeb9dcfa | [
"0BSD"
] | 1 | 2017-02-03T22:44:17.000Z | 2017-02-04T08:58:13.000Z | protobufs/dota_gcmessages_client_tournament.pb.cc | invokr/dota-replay-parser | 6260aa834fb47f0f1a8c713f4edada6baeb9dcfa | [
"0BSD"
] | 2 | 2017-02-03T17:51:57.000Z | 2021-05-22T02:40:00.000Z | // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: dota_gcmessages_client_tournament.proto
#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
#include "dota_gcmessages_client_tournament.pb.h"
#include <algorithm>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/once.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/wire_format_lite_inl.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format.h>
// @@protoc_insertion_point(includes)
namespace {
const ::google::protobuf::Descriptor* CMsgDOTATournamentInfo_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTATournamentInfo_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgDOTATournamentInfo_PhaseGroup_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTATournamentInfo_PhaseGroup_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgDOTATournamentInfo_Phase_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTATournamentInfo_Phase_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgDOTATournamentInfo_Team_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTATournamentInfo_Team_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgDOTATournamentInfo_UpcomingMatch_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTATournamentInfo_UpcomingMatch_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgDOTATournamentInfo_News_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTATournamentInfo_News_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgRequestWeekendTourneySchedule_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgRequestWeekendTourneySchedule_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgWeekendTourneySchedule_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgWeekendTourneySchedule_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgWeekendTourneySchedule_Division_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgWeekendTourneySchedule_Division_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgWeekendTourneyOpts_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgWeekendTourneyOpts_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgWeekendTourneyLeave_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgWeekendTourneyLeave_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgDOTATournament_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTATournament_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgDOTATournament_Team_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTATournament_Team_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgDOTATournament_Game_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTATournament_Game_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgDOTATournament_Node_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTATournament_Node_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgDOTATournamentStateChange_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTATournamentStateChange_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgDOTATournamentStateChange_GameChange_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTATournamentStateChange_GameChange_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgDOTATournamentStateChange_TeamChange_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTATournamentStateChange_TeamChange_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgDOTATournamentRequest_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTATournamentRequest_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgDOTATournamentResponse_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTATournamentResponse_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgDOTAClearTournamentGame_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTAClearTournamentGame_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgDOTAWeekendTourneyPlayerSkillLevelStats_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTAWeekendTourneyPlayerSkillLevelStats_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgDOTAWeekendTourneyPlayerStats_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTAWeekendTourneyPlayerStats_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgDOTAWeekendTourneyPlayerStatsRequest_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTAWeekendTourneyPlayerStatsRequest_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgDOTAWeekendTourneyPlayerHistoryRequest_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTAWeekendTourneyPlayerHistoryRequest_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgDOTAWeekendTourneyPlayerHistory_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTAWeekendTourneyPlayerHistory_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgDOTAWeekendTourneyPlayerHistory_Tournament_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTAWeekendTourneyPlayerHistory_Tournament_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgDOTAWeekendTourneyParticipationDetails_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTAWeekendTourneyParticipationDetails_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgDOTAWeekendTourneyParticipationDetails_Tier_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTAWeekendTourneyParticipationDetails_Tier_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgDOTAWeekendTourneyParticipationDetails_Division_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTAWeekendTourneyParticipationDetails_Division_reflection_ = NULL;
const ::google::protobuf::EnumDescriptor* ETournamentEvent_descriptor_ = NULL;
} // namespace
void protobuf_AssignDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto() {
protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
const ::google::protobuf::FileDescriptor* file =
::google::protobuf::DescriptorPool::generated_pool()->FindFileByName(
"dota_gcmessages_client_tournament.proto");
GOOGLE_CHECK(file != NULL);
CMsgDOTATournamentInfo_descriptor_ = file->message_type(0);
static const int CMsgDOTATournamentInfo_offsets_[5] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo, league_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo, phase_list_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo, teams_list_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo, upcoming_matches_list_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo, news_list_),
};
CMsgDOTATournamentInfo_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTATournamentInfo_descriptor_,
CMsgDOTATournamentInfo::default_instance_,
CMsgDOTATournamentInfo_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTATournamentInfo));
CMsgDOTATournamentInfo_PhaseGroup_descriptor_ = CMsgDOTATournamentInfo_descriptor_->nested_type(0);
static const int CMsgDOTATournamentInfo_PhaseGroup_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_PhaseGroup, group_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_PhaseGroup, group_name_),
};
CMsgDOTATournamentInfo_PhaseGroup_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTATournamentInfo_PhaseGroup_descriptor_,
CMsgDOTATournamentInfo_PhaseGroup::default_instance_,
CMsgDOTATournamentInfo_PhaseGroup_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_PhaseGroup, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_PhaseGroup, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTATournamentInfo_PhaseGroup));
CMsgDOTATournamentInfo_Phase_descriptor_ = CMsgDOTATournamentInfo_descriptor_->nested_type(1);
static const int CMsgDOTATournamentInfo_Phase_offsets_[7] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_Phase, phase_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_Phase, phase_name_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_Phase, type_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_Phase, iterations_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_Phase, min_start_time_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_Phase, max_start_time_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_Phase, group_list_),
};
CMsgDOTATournamentInfo_Phase_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTATournamentInfo_Phase_descriptor_,
CMsgDOTATournamentInfo_Phase::default_instance_,
CMsgDOTATournamentInfo_Phase_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_Phase, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_Phase, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTATournamentInfo_Phase));
CMsgDOTATournamentInfo_Team_descriptor_ = CMsgDOTATournamentInfo_descriptor_->nested_type(2);
static const int CMsgDOTATournamentInfo_Team_offsets_[5] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_Team, team_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_Team, name_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_Team, tag_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_Team, team_logo_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_Team, eliminated_),
};
CMsgDOTATournamentInfo_Team_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTATournamentInfo_Team_descriptor_,
CMsgDOTATournamentInfo_Team::default_instance_,
CMsgDOTATournamentInfo_Team_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_Team, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_Team, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTATournamentInfo_Team));
CMsgDOTATournamentInfo_UpcomingMatch_descriptor_ = CMsgDOTATournamentInfo_descriptor_->nested_type(3);
static const int CMsgDOTATournamentInfo_UpcomingMatch_offsets_[26] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, series_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, team1_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, team2_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, bo_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, stage_name_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, start_time_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, winner_stage_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, loser_stage_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, team1_tag_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, team2_tag_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, team1_prev_opponent_tag_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, team2_prev_opponent_tag_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, team1_logo_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, team2_logo_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, team1_prev_opponent_logo_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, team2_prev_opponent_logo_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, team1_prev_opponent_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, team2_prev_opponent_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, team1_prev_match_score_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, team1_prev_match_opponent_score_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, team2_prev_match_score_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, team2_prev_match_opponent_score_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, phase_type_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, team1_score_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, team2_score_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, phase_id_),
};
CMsgDOTATournamentInfo_UpcomingMatch_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTATournamentInfo_UpcomingMatch_descriptor_,
CMsgDOTATournamentInfo_UpcomingMatch::default_instance_,
CMsgDOTATournamentInfo_UpcomingMatch_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTATournamentInfo_UpcomingMatch));
CMsgDOTATournamentInfo_News_descriptor_ = CMsgDOTATournamentInfo_descriptor_->nested_type(4);
static const int CMsgDOTATournamentInfo_News_offsets_[4] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_News, link_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_News, title_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_News, image_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_News, timestamp_),
};
CMsgDOTATournamentInfo_News_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTATournamentInfo_News_descriptor_,
CMsgDOTATournamentInfo_News::default_instance_,
CMsgDOTATournamentInfo_News_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_News, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_News, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTATournamentInfo_News));
CMsgRequestWeekendTourneySchedule_descriptor_ = file->message_type(1);
static const int CMsgRequestWeekendTourneySchedule_offsets_[1] = {
};
CMsgRequestWeekendTourneySchedule_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgRequestWeekendTourneySchedule_descriptor_,
CMsgRequestWeekendTourneySchedule::default_instance_,
CMsgRequestWeekendTourneySchedule_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgRequestWeekendTourneySchedule, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgRequestWeekendTourneySchedule, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgRequestWeekendTourneySchedule));
CMsgWeekendTourneySchedule_descriptor_ = file->message_type(2);
static const int CMsgWeekendTourneySchedule_offsets_[1] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgWeekendTourneySchedule, divisions_),
};
CMsgWeekendTourneySchedule_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgWeekendTourneySchedule_descriptor_,
CMsgWeekendTourneySchedule::default_instance_,
CMsgWeekendTourneySchedule_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgWeekendTourneySchedule, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgWeekendTourneySchedule, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgWeekendTourneySchedule));
CMsgWeekendTourneySchedule_Division_descriptor_ = CMsgWeekendTourneySchedule_descriptor_->nested_type(0);
static const int CMsgWeekendTourneySchedule_Division_offsets_[4] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgWeekendTourneySchedule_Division, division_code_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgWeekendTourneySchedule_Division, time_window_open_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgWeekendTourneySchedule_Division, time_window_close_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgWeekendTourneySchedule_Division, time_window_open_next_),
};
CMsgWeekendTourneySchedule_Division_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgWeekendTourneySchedule_Division_descriptor_,
CMsgWeekendTourneySchedule_Division::default_instance_,
CMsgWeekendTourneySchedule_Division_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgWeekendTourneySchedule_Division, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgWeekendTourneySchedule_Division, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgWeekendTourneySchedule_Division));
CMsgWeekendTourneyOpts_descriptor_ = file->message_type(3);
static const int CMsgWeekendTourneyOpts_offsets_[8] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgWeekendTourneyOpts, participating_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgWeekendTourneyOpts, division_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgWeekendTourneyOpts, buyin_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgWeekendTourneyOpts, skill_level_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgWeekendTourneyOpts, match_groups_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgWeekendTourneyOpts, team_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgWeekendTourneyOpts, pickup_team_name_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgWeekendTourneyOpts, pickup_team_logo_),
};
CMsgWeekendTourneyOpts_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgWeekendTourneyOpts_descriptor_,
CMsgWeekendTourneyOpts::default_instance_,
CMsgWeekendTourneyOpts_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgWeekendTourneyOpts, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgWeekendTourneyOpts, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgWeekendTourneyOpts));
CMsgWeekendTourneyLeave_descriptor_ = file->message_type(4);
static const int CMsgWeekendTourneyLeave_offsets_[1] = {
};
CMsgWeekendTourneyLeave_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgWeekendTourneyLeave_descriptor_,
CMsgWeekendTourneyLeave::default_instance_,
CMsgWeekendTourneyLeave_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgWeekendTourneyLeave, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgWeekendTourneyLeave, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgWeekendTourneyLeave));
CMsgDOTATournament_descriptor_ = file->message_type(5);
static const int CMsgDOTATournament_offsets_[11] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament, tournament_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament, division_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament, schedule_time_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament, skill_level_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament, tournament_template_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament, state_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament, state_seq_num_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament, season_trophy_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament, teams_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament, games_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament, nodes_),
};
CMsgDOTATournament_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTATournament_descriptor_,
CMsgDOTATournament::default_instance_,
CMsgDOTATournament_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTATournament));
CMsgDOTATournament_Team_descriptor_ = CMsgDOTATournament_descriptor_->nested_type(0);
static const int CMsgDOTATournament_Team_offsets_[11] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Team, team_gid_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Team, node_or_state_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Team, players_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Team, player_buyin_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Team, player_skill_level_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Team, match_group_mask_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Team, team_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Team, team_name_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Team, team_base_logo_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Team, team_ui_logo_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Team, team_date_),
};
CMsgDOTATournament_Team_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTATournament_Team_descriptor_,
CMsgDOTATournament_Team::default_instance_,
CMsgDOTATournament_Team_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Team, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Team, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTATournament_Team));
CMsgDOTATournament_Game_descriptor_ = CMsgDOTATournament_descriptor_->nested_type(1);
static const int CMsgDOTATournament_Game_offsets_[6] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Game, node_idx_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Game, lobby_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Game, match_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Game, team_a_good_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Game, state_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Game, start_time_),
};
CMsgDOTATournament_Game_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTATournament_Game_descriptor_,
CMsgDOTATournament_Game::default_instance_,
CMsgDOTATournament_Game_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Game, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Game, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTATournament_Game));
CMsgDOTATournament_Node_descriptor_ = CMsgDOTATournament_descriptor_->nested_type(2);
static const int CMsgDOTATournament_Node_offsets_[4] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Node, node_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Node, team_idx_a_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Node, team_idx_b_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Node, node_state_),
};
CMsgDOTATournament_Node_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTATournament_Node_descriptor_,
CMsgDOTATournament_Node::default_instance_,
CMsgDOTATournament_Node_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Node, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Node, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTATournament_Node));
CMsgDOTATournamentStateChange_descriptor_ = file->message_type(6);
static const int CMsgDOTATournamentStateChange_offsets_[7] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentStateChange, new_tournament_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentStateChange, event_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentStateChange, new_tournament_state_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentStateChange, game_changes_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentStateChange, team_changes_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentStateChange, merged_tournament_ids_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentStateChange, state_seq_num_),
};
CMsgDOTATournamentStateChange_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTATournamentStateChange_descriptor_,
CMsgDOTATournamentStateChange::default_instance_,
CMsgDOTATournamentStateChange_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentStateChange, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentStateChange, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTATournamentStateChange));
CMsgDOTATournamentStateChange_GameChange_descriptor_ = CMsgDOTATournamentStateChange_descriptor_->nested_type(0);
static const int CMsgDOTATournamentStateChange_GameChange_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentStateChange_GameChange, match_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentStateChange_GameChange, new_state_),
};
CMsgDOTATournamentStateChange_GameChange_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTATournamentStateChange_GameChange_descriptor_,
CMsgDOTATournamentStateChange_GameChange::default_instance_,
CMsgDOTATournamentStateChange_GameChange_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentStateChange_GameChange, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentStateChange_GameChange, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTATournamentStateChange_GameChange));
CMsgDOTATournamentStateChange_TeamChange_descriptor_ = CMsgDOTATournamentStateChange_descriptor_->nested_type(1);
static const int CMsgDOTATournamentStateChange_TeamChange_offsets_[3] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentStateChange_TeamChange, team_gid_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentStateChange_TeamChange, new_node_or_state_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentStateChange_TeamChange, old_node_or_state_),
};
CMsgDOTATournamentStateChange_TeamChange_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTATournamentStateChange_TeamChange_descriptor_,
CMsgDOTATournamentStateChange_TeamChange::default_instance_,
CMsgDOTATournamentStateChange_TeamChange_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentStateChange_TeamChange, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentStateChange_TeamChange, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTATournamentStateChange_TeamChange));
CMsgDOTATournamentRequest_descriptor_ = file->message_type(7);
static const int CMsgDOTATournamentRequest_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentRequest, tournament_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentRequest, client_tournament_gid_),
};
CMsgDOTATournamentRequest_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTATournamentRequest_descriptor_,
CMsgDOTATournamentRequest::default_instance_,
CMsgDOTATournamentRequest_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentRequest, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentRequest, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTATournamentRequest));
CMsgDOTATournamentResponse_descriptor_ = file->message_type(8);
static const int CMsgDOTATournamentResponse_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentResponse, result_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentResponse, tournament_),
};
CMsgDOTATournamentResponse_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTATournamentResponse_descriptor_,
CMsgDOTATournamentResponse::default_instance_,
CMsgDOTATournamentResponse_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentResponse, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentResponse, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTATournamentResponse));
CMsgDOTAClearTournamentGame_descriptor_ = file->message_type(9);
static const int CMsgDOTAClearTournamentGame_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAClearTournamentGame, tournament_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAClearTournamentGame, game_id_),
};
CMsgDOTAClearTournamentGame_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTAClearTournamentGame_descriptor_,
CMsgDOTAClearTournamentGame::default_instance_,
CMsgDOTAClearTournamentGame_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAClearTournamentGame, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAClearTournamentGame, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTAClearTournamentGame));
CMsgDOTAWeekendTourneyPlayerSkillLevelStats_descriptor_ = file->message_type(10);
static const int CMsgDOTAWeekendTourneyPlayerSkillLevelStats_offsets_[9] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerSkillLevelStats, skill_level_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerSkillLevelStats, times_won_0_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerSkillLevelStats, times_won_1_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerSkillLevelStats, times_won_2_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerSkillLevelStats, times_won_3_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerSkillLevelStats, times_bye_and_lost_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerSkillLevelStats, times_bye_and_won_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerSkillLevelStats, total_games_won_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerSkillLevelStats, score_),
};
CMsgDOTAWeekendTourneyPlayerSkillLevelStats_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTAWeekendTourneyPlayerSkillLevelStats_descriptor_,
CMsgDOTAWeekendTourneyPlayerSkillLevelStats::default_instance_,
CMsgDOTAWeekendTourneyPlayerSkillLevelStats_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerSkillLevelStats, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerSkillLevelStats, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTAWeekendTourneyPlayerSkillLevelStats));
CMsgDOTAWeekendTourneyPlayerStats_descriptor_ = file->message_type(11);
static const int CMsgDOTAWeekendTourneyPlayerStats_offsets_[4] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerStats, account_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerStats, season_trophy_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerStats, skill_levels_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerStats, current_tier_),
};
CMsgDOTAWeekendTourneyPlayerStats_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTAWeekendTourneyPlayerStats_descriptor_,
CMsgDOTAWeekendTourneyPlayerStats::default_instance_,
CMsgDOTAWeekendTourneyPlayerStats_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerStats, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerStats, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTAWeekendTourneyPlayerStats));
CMsgDOTAWeekendTourneyPlayerStatsRequest_descriptor_ = file->message_type(12);
static const int CMsgDOTAWeekendTourneyPlayerStatsRequest_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerStatsRequest, account_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerStatsRequest, season_trophy_id_),
};
CMsgDOTAWeekendTourneyPlayerStatsRequest_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTAWeekendTourneyPlayerStatsRequest_descriptor_,
CMsgDOTAWeekendTourneyPlayerStatsRequest::default_instance_,
CMsgDOTAWeekendTourneyPlayerStatsRequest_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerStatsRequest, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerStatsRequest, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTAWeekendTourneyPlayerStatsRequest));
CMsgDOTAWeekendTourneyPlayerHistoryRequest_descriptor_ = file->message_type(13);
static const int CMsgDOTAWeekendTourneyPlayerHistoryRequest_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerHistoryRequest, account_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerHistoryRequest, season_trophy_id_),
};
CMsgDOTAWeekendTourneyPlayerHistoryRequest_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTAWeekendTourneyPlayerHistoryRequest_descriptor_,
CMsgDOTAWeekendTourneyPlayerHistoryRequest::default_instance_,
CMsgDOTAWeekendTourneyPlayerHistoryRequest_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerHistoryRequest, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerHistoryRequest, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTAWeekendTourneyPlayerHistoryRequest));
CMsgDOTAWeekendTourneyPlayerHistory_descriptor_ = file->message_type(14);
static const int CMsgDOTAWeekendTourneyPlayerHistory_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerHistory, account_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerHistory, tournaments_),
};
CMsgDOTAWeekendTourneyPlayerHistory_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTAWeekendTourneyPlayerHistory_descriptor_,
CMsgDOTAWeekendTourneyPlayerHistory::default_instance_,
CMsgDOTAWeekendTourneyPlayerHistory_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerHistory, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerHistory, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTAWeekendTourneyPlayerHistory));
CMsgDOTAWeekendTourneyPlayerHistory_Tournament_descriptor_ = CMsgDOTAWeekendTourneyPlayerHistory_descriptor_->nested_type(0);
static const int CMsgDOTAWeekendTourneyPlayerHistory_Tournament_offsets_[9] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerHistory_Tournament, tournament_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerHistory_Tournament, start_time_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerHistory_Tournament, tournament_tier_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerHistory_Tournament, team_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerHistory_Tournament, team_date_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerHistory_Tournament, team_result_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerHistory_Tournament, account_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerHistory_Tournament, team_name_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerHistory_Tournament, season_trophy_id_),
};
CMsgDOTAWeekendTourneyPlayerHistory_Tournament_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTAWeekendTourneyPlayerHistory_Tournament_descriptor_,
CMsgDOTAWeekendTourneyPlayerHistory_Tournament::default_instance_,
CMsgDOTAWeekendTourneyPlayerHistory_Tournament_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerHistory_Tournament, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerHistory_Tournament, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTAWeekendTourneyPlayerHistory_Tournament));
CMsgDOTAWeekendTourneyParticipationDetails_descriptor_ = file->message_type(15);
static const int CMsgDOTAWeekendTourneyParticipationDetails_offsets_[1] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyParticipationDetails, divisions_),
};
CMsgDOTAWeekendTourneyParticipationDetails_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTAWeekendTourneyParticipationDetails_descriptor_,
CMsgDOTAWeekendTourneyParticipationDetails::default_instance_,
CMsgDOTAWeekendTourneyParticipationDetails_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyParticipationDetails, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyParticipationDetails, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTAWeekendTourneyParticipationDetails));
CMsgDOTAWeekendTourneyParticipationDetails_Tier_descriptor_ = CMsgDOTAWeekendTourneyParticipationDetails_descriptor_->nested_type(0);
static const int CMsgDOTAWeekendTourneyParticipationDetails_Tier_offsets_[8] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyParticipationDetails_Tier, tier_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyParticipationDetails_Tier, players_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyParticipationDetails_Tier, teams_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyParticipationDetails_Tier, winning_teams_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyParticipationDetails_Tier, players_streak_2_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyParticipationDetails_Tier, players_streak_3_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyParticipationDetails_Tier, players_streak_4_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyParticipationDetails_Tier, players_streak_5_),
};
CMsgDOTAWeekendTourneyParticipationDetails_Tier_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTAWeekendTourneyParticipationDetails_Tier_descriptor_,
CMsgDOTAWeekendTourneyParticipationDetails_Tier::default_instance_,
CMsgDOTAWeekendTourneyParticipationDetails_Tier_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyParticipationDetails_Tier, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyParticipationDetails_Tier, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTAWeekendTourneyParticipationDetails_Tier));
CMsgDOTAWeekendTourneyParticipationDetails_Division_descriptor_ = CMsgDOTAWeekendTourneyParticipationDetails_descriptor_->nested_type(1);
static const int CMsgDOTAWeekendTourneyParticipationDetails_Division_offsets_[3] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyParticipationDetails_Division, division_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyParticipationDetails_Division, schedule_time_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyParticipationDetails_Division, tiers_),
};
CMsgDOTAWeekendTourneyParticipationDetails_Division_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTAWeekendTourneyParticipationDetails_Division_descriptor_,
CMsgDOTAWeekendTourneyParticipationDetails_Division::default_instance_,
CMsgDOTAWeekendTourneyParticipationDetails_Division_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyParticipationDetails_Division, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyParticipationDetails_Division, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTAWeekendTourneyParticipationDetails_Division));
ETournamentEvent_descriptor_ = file->enum_type(0);
}
namespace {
GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_);
inline void protobuf_AssignDescriptorsOnce() {
::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_,
&protobuf_AssignDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto);
}
void protobuf_RegisterTypes(const ::std::string&) {
protobuf_AssignDescriptorsOnce();
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTATournamentInfo_descriptor_, &CMsgDOTATournamentInfo::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTATournamentInfo_PhaseGroup_descriptor_, &CMsgDOTATournamentInfo_PhaseGroup::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTATournamentInfo_Phase_descriptor_, &CMsgDOTATournamentInfo_Phase::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTATournamentInfo_Team_descriptor_, &CMsgDOTATournamentInfo_Team::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTATournamentInfo_UpcomingMatch_descriptor_, &CMsgDOTATournamentInfo_UpcomingMatch::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTATournamentInfo_News_descriptor_, &CMsgDOTATournamentInfo_News::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgRequestWeekendTourneySchedule_descriptor_, &CMsgRequestWeekendTourneySchedule::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgWeekendTourneySchedule_descriptor_, &CMsgWeekendTourneySchedule::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgWeekendTourneySchedule_Division_descriptor_, &CMsgWeekendTourneySchedule_Division::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgWeekendTourneyOpts_descriptor_, &CMsgWeekendTourneyOpts::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgWeekendTourneyLeave_descriptor_, &CMsgWeekendTourneyLeave::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTATournament_descriptor_, &CMsgDOTATournament::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTATournament_Team_descriptor_, &CMsgDOTATournament_Team::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTATournament_Game_descriptor_, &CMsgDOTATournament_Game::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTATournament_Node_descriptor_, &CMsgDOTATournament_Node::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTATournamentStateChange_descriptor_, &CMsgDOTATournamentStateChange::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTATournamentStateChange_GameChange_descriptor_, &CMsgDOTATournamentStateChange_GameChange::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTATournamentStateChange_TeamChange_descriptor_, &CMsgDOTATournamentStateChange_TeamChange::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTATournamentRequest_descriptor_, &CMsgDOTATournamentRequest::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTATournamentResponse_descriptor_, &CMsgDOTATournamentResponse::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTAClearTournamentGame_descriptor_, &CMsgDOTAClearTournamentGame::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTAWeekendTourneyPlayerSkillLevelStats_descriptor_, &CMsgDOTAWeekendTourneyPlayerSkillLevelStats::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTAWeekendTourneyPlayerStats_descriptor_, &CMsgDOTAWeekendTourneyPlayerStats::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTAWeekendTourneyPlayerStatsRequest_descriptor_, &CMsgDOTAWeekendTourneyPlayerStatsRequest::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTAWeekendTourneyPlayerHistoryRequest_descriptor_, &CMsgDOTAWeekendTourneyPlayerHistoryRequest::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTAWeekendTourneyPlayerHistory_descriptor_, &CMsgDOTAWeekendTourneyPlayerHistory::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTAWeekendTourneyPlayerHistory_Tournament_descriptor_, &CMsgDOTAWeekendTourneyPlayerHistory_Tournament::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTAWeekendTourneyParticipationDetails_descriptor_, &CMsgDOTAWeekendTourneyParticipationDetails::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTAWeekendTourneyParticipationDetails_Tier_descriptor_, &CMsgDOTAWeekendTourneyParticipationDetails_Tier::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTAWeekendTourneyParticipationDetails_Division_descriptor_, &CMsgDOTAWeekendTourneyParticipationDetails_Division::default_instance());
}
} // namespace
void protobuf_ShutdownFile_dota_5fgcmessages_5fclient_5ftournament_2eproto() {
delete CMsgDOTATournamentInfo::default_instance_;
delete CMsgDOTATournamentInfo_reflection_;
delete CMsgDOTATournamentInfo_PhaseGroup::default_instance_;
delete CMsgDOTATournamentInfo_PhaseGroup_reflection_;
delete CMsgDOTATournamentInfo_Phase::default_instance_;
delete CMsgDOTATournamentInfo_Phase_reflection_;
delete CMsgDOTATournamentInfo_Team::default_instance_;
delete CMsgDOTATournamentInfo_Team_reflection_;
delete CMsgDOTATournamentInfo_UpcomingMatch::default_instance_;
delete CMsgDOTATournamentInfo_UpcomingMatch_reflection_;
delete CMsgDOTATournamentInfo_News::default_instance_;
delete CMsgDOTATournamentInfo_News_reflection_;
delete CMsgRequestWeekendTourneySchedule::default_instance_;
delete CMsgRequestWeekendTourneySchedule_reflection_;
delete CMsgWeekendTourneySchedule::default_instance_;
delete CMsgWeekendTourneySchedule_reflection_;
delete CMsgWeekendTourneySchedule_Division::default_instance_;
delete CMsgWeekendTourneySchedule_Division_reflection_;
delete CMsgWeekendTourneyOpts::default_instance_;
delete CMsgWeekendTourneyOpts_reflection_;
delete CMsgWeekendTourneyLeave::default_instance_;
delete CMsgWeekendTourneyLeave_reflection_;
delete CMsgDOTATournament::default_instance_;
delete CMsgDOTATournament_reflection_;
delete CMsgDOTATournament_Team::default_instance_;
delete CMsgDOTATournament_Team_reflection_;
delete CMsgDOTATournament_Game::default_instance_;
delete CMsgDOTATournament_Game_reflection_;
delete CMsgDOTATournament_Node::default_instance_;
delete CMsgDOTATournament_Node_reflection_;
delete CMsgDOTATournamentStateChange::default_instance_;
delete CMsgDOTATournamentStateChange_reflection_;
delete CMsgDOTATournamentStateChange_GameChange::default_instance_;
delete CMsgDOTATournamentStateChange_GameChange_reflection_;
delete CMsgDOTATournamentStateChange_TeamChange::default_instance_;
delete CMsgDOTATournamentStateChange_TeamChange_reflection_;
delete CMsgDOTATournamentRequest::default_instance_;
delete CMsgDOTATournamentRequest_reflection_;
delete CMsgDOTATournamentResponse::default_instance_;
delete CMsgDOTATournamentResponse_reflection_;
delete CMsgDOTAClearTournamentGame::default_instance_;
delete CMsgDOTAClearTournamentGame_reflection_;
delete CMsgDOTAWeekendTourneyPlayerSkillLevelStats::default_instance_;
delete CMsgDOTAWeekendTourneyPlayerSkillLevelStats_reflection_;
delete CMsgDOTAWeekendTourneyPlayerStats::default_instance_;
delete CMsgDOTAWeekendTourneyPlayerStats_reflection_;
delete CMsgDOTAWeekendTourneyPlayerStatsRequest::default_instance_;
delete CMsgDOTAWeekendTourneyPlayerStatsRequest_reflection_;
delete CMsgDOTAWeekendTourneyPlayerHistoryRequest::default_instance_;
delete CMsgDOTAWeekendTourneyPlayerHistoryRequest_reflection_;
delete CMsgDOTAWeekendTourneyPlayerHistory::default_instance_;
delete CMsgDOTAWeekendTourneyPlayerHistory_reflection_;
delete CMsgDOTAWeekendTourneyPlayerHistory_Tournament::default_instance_;
delete CMsgDOTAWeekendTourneyPlayerHistory_Tournament_reflection_;
delete CMsgDOTAWeekendTourneyParticipationDetails::default_instance_;
delete CMsgDOTAWeekendTourneyParticipationDetails_reflection_;
delete CMsgDOTAWeekendTourneyParticipationDetails_Tier::default_instance_;
delete CMsgDOTAWeekendTourneyParticipationDetails_Tier_reflection_;
delete CMsgDOTAWeekendTourneyParticipationDetails_Division::default_instance_;
delete CMsgDOTAWeekendTourneyParticipationDetails_Division_reflection_;
}
void protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto() {
static bool already_here = false;
if (already_here) return;
already_here = true;
GOOGLE_PROTOBUF_VERIFY_VERSION;
::protobuf_AddDesc_dota_5fclient_5fenums_2eproto();
::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
"\n\'dota_gcmessages_client_tournament.prot"
"o\032\027dota_client_enums.proto\"\270\n\n\026CMsgDOTAT"
"ournamentInfo\022\021\n\tleague_id\030\001 \001(\r\0221\n\nphas"
"e_list\030\002 \003(\0132\035.CMsgDOTATournamentInfo.Ph"
"ase\0220\n\nteams_list\030\003 \003(\0132\034.CMsgDOTATourna"
"mentInfo.Team\022D\n\025upcoming_matches_list\030\004"
" \003(\0132%.CMsgDOTATournamentInfo.UpcomingMa"
"tch\022/\n\tnews_list\030\005 \003(\0132\034.CMsgDOTATournam"
"entInfo.News\0322\n\nPhaseGroup\022\020\n\010group_id\030\001"
" \001(\r\022\022\n\ngroup_name\030\002 \001(\t\032\272\001\n\005Phase\022\020\n\010ph"
"ase_id\030\001 \001(\r\022\022\n\nphase_name\030\002 \001(\t\022\017\n\007type"
"_id\030\003 \001(\r\022\022\n\niterations\030\004 \001(\r\022\026\n\016min_sta"
"rt_time\030\005 \001(\r\022\026\n\016max_start_time\030\006 \001(\r\0226\n"
"\ngroup_list\030\007 \003(\0132\".CMsgDOTATournamentIn"
"fo.PhaseGroup\032Y\n\004Team\022\017\n\007team_id\030\001 \001(\r\022\014"
"\n\004name\030\002 \001(\t\022\013\n\003tag\030\003 \001(\t\022\021\n\tteam_logo\030\004"
" \001(\004\022\022\n\neliminated\030\005 \001(\010\032\233\005\n\rUpcomingMat"
"ch\022\021\n\tseries_id\030\001 \001(\r\022\020\n\010team1_id\030\002 \001(\r\022"
"\020\n\010team2_id\030\003 \001(\r\022\n\n\002bo\030\004 \001(\r\022\022\n\nstage_n"
"ame\030\005 \001(\t\022\022\n\nstart_time\030\006 \001(\r\022\024\n\014winner_"
"stage\030\007 \001(\t\022\023\n\013loser_stage\030\010 \001(\t\022\021\n\tteam"
"1_tag\030\t \001(\t\022\021\n\tteam2_tag\030\n \001(\t\022\037\n\027team1_"
"prev_opponent_tag\030\013 \001(\t\022\037\n\027team2_prev_op"
"ponent_tag\030\014 \001(\t\022\022\n\nteam1_logo\030\r \001(\004\022\022\n\n"
"team2_logo\030\016 \001(\004\022 \n\030team1_prev_opponent_"
"logo\030\017 \001(\004\022 \n\030team2_prev_opponent_logo\030\020"
" \001(\004\022\036\n\026team1_prev_opponent_id\030\021 \001(\r\022\036\n\026"
"team2_prev_opponent_id\030\022 \001(\r\022\036\n\026team1_pr"
"ev_match_score\030\023 \001(\r\022\'\n\037team1_prev_match"
"_opponent_score\030\024 \001(\r\022\036\n\026team2_prev_matc"
"h_score\030\025 \001(\r\022\'\n\037team2_prev_match_oppone"
"nt_score\030\026 \001(\r\022\022\n\nphase_type\030\027 \001(\r\022\023\n\013te"
"am1_score\030\030 \001(\r\022\023\n\013team2_score\030\031 \001(\r\022\020\n\010"
"phase_id\030\032 \001(\r\032E\n\004News\022\014\n\004link\030\001 \001(\t\022\r\n\005"
"title\030\002 \001(\t\022\r\n\005image\030\003 \001(\t\022\021\n\ttimestamp\030"
"\004 \001(\r\"#\n!CMsgRequestWeekendTourneySchedu"
"le\"\314\001\n\032CMsgWeekendTourneySchedule\0227\n\tdiv"
"isions\030\001 \003(\0132$.CMsgWeekendTourneySchedul"
"e.Division\032u\n\010Division\022\025\n\rdivision_code\030"
"\001 \001(\r\022\030\n\020time_window_open\030\002 \001(\r\022\031\n\021time_"
"window_close\030\003 \001(\r\022\035\n\025time_window_open_n"
"ext\030\004 \001(\r\"\303\001\n\026CMsgWeekendTourneyOpts\022\025\n\r"
"participating\030\001 \001(\010\022\023\n\013division_id\030\002 \001(\r"
"\022\r\n\005buyin\030\003 \001(\r\022\023\n\013skill_level\030\004 \001(\r\022\024\n\014"
"match_groups\030\005 \001(\r\022\017\n\007team_id\030\006 \001(\r\022\030\n\020p"
"ickup_team_name\030\007 \001(\t\022\030\n\020pickup_team_log"
"o\030\010 \001(\004\"\031\n\027CMsgWeekendTourneyLeave\"\340\007\n\022C"
"MsgDOTATournament\022\025\n\rtournament_id\030\001 \001(\r"
"\022\023\n\013division_id\030\002 \001(\r\022\025\n\rschedule_time\030\003"
" \001(\r\022\023\n\013skill_level\030\004 \001(\r\022M\n\023tournament_"
"template\030\005 \001(\0162\024.ETournamentTemplate:\032k_"
"ETournamentTemplate_None\022<\n\005state\030\006 \001(\0162"
"\021.ETournamentState:\032k_ETournamentState_U"
"nknown\022\025\n\rstate_seq_num\030\n \001(\r\022\030\n\020season_"
"trophy_id\030\013 \001(\r\022\'\n\005teams\030\007 \003(\0132\030.CMsgDOT"
"ATournament.Team\022\'\n\005games\030\010 \003(\0132\030.CMsgDO"
"TATournament.Game\022\'\n\005nodes\030\t \003(\0132\030.CMsgD"
"OTATournament.Node\032\375\001\n\004Team\022\020\n\010team_gid\030"
"\001 \001(\006\022\025\n\rnode_or_state\030\002 \001(\r\022\023\n\007players\030"
"\003 \003(\rB\002\020\001\022\030\n\014player_buyin\030\t \003(\rB\002\020\001\022\036\n\022p"
"layer_skill_level\030\n \003(\rB\002\020\001\022\030\n\020match_gro"
"up_mask\030\014 \001(\r\022\017\n\007team_id\030\004 \001(\r\022\021\n\tteam_n"
"ame\030\005 \001(\t\022\026\n\016team_base_logo\030\007 \001(\004\022\024\n\014tea"
"m_ui_logo\030\010 \001(\004\022\021\n\tteam_date\030\013 \001(\r\032\253\001\n\004G"
"ame\022\020\n\010node_idx\030\001 \001(\r\022\020\n\010lobby_id\030\002 \001(\006\022"
"\020\n\010match_id\030\003 \001(\004\022\023\n\013team_a_good\030\004 \001(\010\022D"
"\n\005state\030\005 \001(\0162\025.ETournamentGameState:\036k_"
"ETournamentGameState_Unknown\022\022\n\nstart_ti"
"me\030\006 \001(\r\032\212\001\n\004Node\022\017\n\007node_id\030\001 \001(\r\022\022\n\nte"
"am_idx_a\030\002 \001(\r\022\022\n\nteam_idx_b\030\003 \001(\r\022I\n\nno"
"de_state\030\004 \001(\0162\025.ETournamentNodeState:\036k"
"_ETournamentNodeState_Unknown\"\276\004\n\035CMsgDO"
"TATournamentStateChange\022\031\n\021new_tournamen"
"t_id\030\001 \001(\r\0229\n\005event\030\002 \001(\0162\021.ETournamentE"
"vent:\027k_ETournamentEvent_None\022K\n\024new_tou"
"rnament_state\030\003 \001(\0162\021.ETournamentState:\032"
"k_ETournamentState_Unknown\022\?\n\014game_chang"
"es\030\004 \003(\0132).CMsgDOTATournamentStateChange"
".GameChange\022\?\n\014team_changes\030\005 \003(\0132).CMsg"
"DOTATournamentStateChange.TeamChange\022!\n\025"
"merged_tournament_ids\030\006 \003(\rB\002\020\001\022\025\n\rstate"
"_seq_num\030\007 \001(\r\032h\n\nGameChange\022\020\n\010match_id"
"\030\001 \001(\004\022H\n\tnew_state\030\002 \001(\0162\025.ETournamentG"
"ameState:\036k_ETournamentGameState_Unknown"
"\032T\n\nTeamChange\022\020\n\010team_gid\030\001 \001(\004\022\031\n\021new_"
"node_or_state\030\002 \001(\r\022\031\n\021old_node_or_state"
"\030\003 \001(\r\"Q\n\031CMsgDOTATournamentRequest\022\025\n\rt"
"ournament_id\030\001 \001(\r\022\035\n\025client_tournament_"
"gid\030\002 \001(\004\"X\n\032CMsgDOTATournamentResponse\022"
"\021\n\006result\030\001 \001(\r:\0012\022\'\n\ntournament\030\002 \001(\0132\023"
".CMsgDOTATournament\"E\n\033CMsgDOTAClearTour"
"namentGame\022\025\n\rtournament_id\030\001 \001(\r\022\017\n\007gam"
"e_id\030\002 \001(\r\"\365\001\n+CMsgDOTAWeekendTourneyPla"
"yerSkillLevelStats\022\023\n\013skill_level\030\001 \001(\r\022"
"\023\n\013times_won_0\030\002 \001(\r\022\023\n\013times_won_1\030\003 \001("
"\r\022\023\n\013times_won_2\030\004 \001(\r\022\023\n\013times_won_3\030\005 "
"\001(\r\022\032\n\022times_bye_and_lost\030\006 \001(\r\022\031\n\021times"
"_bye_and_won\030\007 \001(\r\022\027\n\017total_games_won\030\010 "
"\001(\r\022\r\n\005score\030\t \001(\r\"\253\001\n!CMsgDOTAWeekendTo"
"urneyPlayerStats\022\022\n\naccount_id\030\001 \001(\r\022\030\n\020"
"season_trophy_id\030\002 \001(\r\022B\n\014skill_levels\030\003"
" \003(\0132,.CMsgDOTAWeekendTourneyPlayerSkill"
"LevelStats\022\024\n\014current_tier\030\004 \001(\r\"X\n(CMsg"
"DOTAWeekendTourneyPlayerStatsRequest\022\022\n\n"
"account_id\030\001 \001(\r\022\030\n\020season_trophy_id\030\002 \001"
"(\r\"Z\n*CMsgDOTAWeekendTourneyPlayerHistor"
"yRequest\022\022\n\naccount_id\030\001 \001(\r\022\030\n\020season_t"
"rophy_id\030\002 \001(\r\"\314\002\n#CMsgDOTAWeekendTourne"
"yPlayerHistory\022\022\n\naccount_id\030\001 \001(\r\022D\n\013to"
"urnaments\030\003 \003(\0132/.CMsgDOTAWeekendTourney"
"PlayerHistory.Tournament\032\312\001\n\nTournament\022"
"\025\n\rtournament_id\030\001 \001(\r\022\022\n\nstart_time\030\002 \001"
"(\r\022\027\n\017tournament_tier\030\003 \001(\r\022\017\n\007team_id\030\004"
" \001(\r\022\021\n\tteam_date\030\005 \001(\r\022\023\n\013team_result\030\006"
" \001(\r\022\022\n\naccount_id\030\007 \003(\r\022\021\n\tteam_name\030\010 "
"\001(\t\022\030\n\020season_trophy_id\030\t \001(\r\"\244\003\n*CMsgDO"
"TAWeekendTourneyParticipationDetails\022G\n\t"
"divisions\030\001 \003(\01324.CMsgDOTAWeekendTourney"
"ParticipationDetails.Division\032\263\001\n\004Tier\022\014"
"\n\004tier\030\001 \001(\r\022\017\n\007players\030\002 \001(\r\022\r\n\005teams\030\003"
" \001(\r\022\025\n\rwinning_teams\030\004 \001(\r\022\030\n\020players_s"
"treak_2\030\005 \001(\r\022\030\n\020players_streak_3\030\006 \001(\r\022"
"\030\n\020players_streak_4\030\007 \001(\r\022\030\n\020players_str"
"eak_5\030\010 \001(\r\032w\n\010Division\022\023\n\013division_id\030\001"
" \001(\r\022\025\n\rschedule_time\030\002 \001(\r\022\?\n\005tiers\030\003 \003"
"(\01320.CMsgDOTAWeekendTourneyParticipation"
"Details.Tier*\365\003\n\020ETournamentEvent\022\033\n\027k_E"
"TournamentEvent_None\020\000\022(\n$k_ETournamentE"
"vent_TournamentCreated\020\001\022(\n$k_ETournamen"
"tEvent_TournamentsMerged\020\002\022\"\n\036k_ETournam"
"entEvent_GameOutcome\020\003\022#\n\037k_ETournamentE"
"vent_TeamGivenBye\020\004\0220\n,k_ETournamentEven"
"t_TournamentCanceledByAdmin\020\005\022$\n k_ETour"
"namentEvent_TeamAbandoned\020\006\022+\n\'k_ETourna"
"mentEvent_ScheduledGameStarted\020\007\022\037\n\033k_ET"
"ournamentEvent_Canceled\020\010\022\?\n;k_ETourname"
"ntEvent_TeamParticipationTimedOut_EntryF"
"eeRefund\020\t\022@\n<k_ETournamentEvent_TeamPar"
"ticipationTimedOut_EntryFeeForfeit\020\nB\005H\001"
"\200\001\000", 5563);
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"dota_gcmessages_client_tournament.proto", &protobuf_RegisterTypes);
CMsgDOTATournamentInfo::default_instance_ = new CMsgDOTATournamentInfo();
CMsgDOTATournamentInfo_PhaseGroup::default_instance_ = new CMsgDOTATournamentInfo_PhaseGroup();
CMsgDOTATournamentInfo_Phase::default_instance_ = new CMsgDOTATournamentInfo_Phase();
CMsgDOTATournamentInfo_Team::default_instance_ = new CMsgDOTATournamentInfo_Team();
CMsgDOTATournamentInfo_UpcomingMatch::default_instance_ = new CMsgDOTATournamentInfo_UpcomingMatch();
CMsgDOTATournamentInfo_News::default_instance_ = new CMsgDOTATournamentInfo_News();
CMsgRequestWeekendTourneySchedule::default_instance_ = new CMsgRequestWeekendTourneySchedule();
CMsgWeekendTourneySchedule::default_instance_ = new CMsgWeekendTourneySchedule();
CMsgWeekendTourneySchedule_Division::default_instance_ = new CMsgWeekendTourneySchedule_Division();
CMsgWeekendTourneyOpts::default_instance_ = new CMsgWeekendTourneyOpts();
CMsgWeekendTourneyLeave::default_instance_ = new CMsgWeekendTourneyLeave();
CMsgDOTATournament::default_instance_ = new CMsgDOTATournament();
CMsgDOTATournament_Team::default_instance_ = new CMsgDOTATournament_Team();
CMsgDOTATournament_Game::default_instance_ = new CMsgDOTATournament_Game();
CMsgDOTATournament_Node::default_instance_ = new CMsgDOTATournament_Node();
CMsgDOTATournamentStateChange::default_instance_ = new CMsgDOTATournamentStateChange();
CMsgDOTATournamentStateChange_GameChange::default_instance_ = new CMsgDOTATournamentStateChange_GameChange();
CMsgDOTATournamentStateChange_TeamChange::default_instance_ = new CMsgDOTATournamentStateChange_TeamChange();
CMsgDOTATournamentRequest::default_instance_ = new CMsgDOTATournamentRequest();
CMsgDOTATournamentResponse::default_instance_ = new CMsgDOTATournamentResponse();
CMsgDOTAClearTournamentGame::default_instance_ = new CMsgDOTAClearTournamentGame();
CMsgDOTAWeekendTourneyPlayerSkillLevelStats::default_instance_ = new CMsgDOTAWeekendTourneyPlayerSkillLevelStats();
CMsgDOTAWeekendTourneyPlayerStats::default_instance_ = new CMsgDOTAWeekendTourneyPlayerStats();
CMsgDOTAWeekendTourneyPlayerStatsRequest::default_instance_ = new CMsgDOTAWeekendTourneyPlayerStatsRequest();
CMsgDOTAWeekendTourneyPlayerHistoryRequest::default_instance_ = new CMsgDOTAWeekendTourneyPlayerHistoryRequest();
CMsgDOTAWeekendTourneyPlayerHistory::default_instance_ = new CMsgDOTAWeekendTourneyPlayerHistory();
CMsgDOTAWeekendTourneyPlayerHistory_Tournament::default_instance_ = new CMsgDOTAWeekendTourneyPlayerHistory_Tournament();
CMsgDOTAWeekendTourneyParticipationDetails::default_instance_ = new CMsgDOTAWeekendTourneyParticipationDetails();
CMsgDOTAWeekendTourneyParticipationDetails_Tier::default_instance_ = new CMsgDOTAWeekendTourneyParticipationDetails_Tier();
CMsgDOTAWeekendTourneyParticipationDetails_Division::default_instance_ = new CMsgDOTAWeekendTourneyParticipationDetails_Division();
CMsgDOTATournamentInfo::default_instance_->InitAsDefaultInstance();
CMsgDOTATournamentInfo_PhaseGroup::default_instance_->InitAsDefaultInstance();
CMsgDOTATournamentInfo_Phase::default_instance_->InitAsDefaultInstance();
CMsgDOTATournamentInfo_Team::default_instance_->InitAsDefaultInstance();
CMsgDOTATournamentInfo_UpcomingMatch::default_instance_->InitAsDefaultInstance();
CMsgDOTATournamentInfo_News::default_instance_->InitAsDefaultInstance();
CMsgRequestWeekendTourneySchedule::default_instance_->InitAsDefaultInstance();
CMsgWeekendTourneySchedule::default_instance_->InitAsDefaultInstance();
CMsgWeekendTourneySchedule_Division::default_instance_->InitAsDefaultInstance();
CMsgWeekendTourneyOpts::default_instance_->InitAsDefaultInstance();
CMsgWeekendTourneyLeave::default_instance_->InitAsDefaultInstance();
CMsgDOTATournament::default_instance_->InitAsDefaultInstance();
CMsgDOTATournament_Team::default_instance_->InitAsDefaultInstance();
CMsgDOTATournament_Game::default_instance_->InitAsDefaultInstance();
CMsgDOTATournament_Node::default_instance_->InitAsDefaultInstance();
CMsgDOTATournamentStateChange::default_instance_->InitAsDefaultInstance();
CMsgDOTATournamentStateChange_GameChange::default_instance_->InitAsDefaultInstance();
CMsgDOTATournamentStateChange_TeamChange::default_instance_->InitAsDefaultInstance();
CMsgDOTATournamentRequest::default_instance_->InitAsDefaultInstance();
CMsgDOTATournamentResponse::default_instance_->InitAsDefaultInstance();
CMsgDOTAClearTournamentGame::default_instance_->InitAsDefaultInstance();
CMsgDOTAWeekendTourneyPlayerSkillLevelStats::default_instance_->InitAsDefaultInstance();
CMsgDOTAWeekendTourneyPlayerStats::default_instance_->InitAsDefaultInstance();
CMsgDOTAWeekendTourneyPlayerStatsRequest::default_instance_->InitAsDefaultInstance();
CMsgDOTAWeekendTourneyPlayerHistoryRequest::default_instance_->InitAsDefaultInstance();
CMsgDOTAWeekendTourneyPlayerHistory::default_instance_->InitAsDefaultInstance();
CMsgDOTAWeekendTourneyPlayerHistory_Tournament::default_instance_->InitAsDefaultInstance();
CMsgDOTAWeekendTourneyParticipationDetails::default_instance_->InitAsDefaultInstance();
CMsgDOTAWeekendTourneyParticipationDetails_Tier::default_instance_->InitAsDefaultInstance();
CMsgDOTAWeekendTourneyParticipationDetails_Division::default_instance_->InitAsDefaultInstance();
::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_dota_5fgcmessages_5fclient_5ftournament_2eproto);
}
// Force AddDescriptors() to be called at static initialization time.
struct StaticDescriptorInitializer_dota_5fgcmessages_5fclient_5ftournament_2eproto {
StaticDescriptorInitializer_dota_5fgcmessages_5fclient_5ftournament_2eproto() {
protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
}
} static_descriptor_initializer_dota_5fgcmessages_5fclient_5ftournament_2eproto_;
const ::google::protobuf::EnumDescriptor* ETournamentEvent_descriptor() {
protobuf_AssignDescriptorsOnce();
return ETournamentEvent_descriptor_;
}
bool ETournamentEvent_IsValid(int value) {
switch(value) {
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
case 10:
return true;
default:
return false;
}
}
// ===================================================================
#ifndef _MSC_VER
const int CMsgDOTATournamentInfo_PhaseGroup::kGroupIdFieldNumber;
const int CMsgDOTATournamentInfo_PhaseGroup::kGroupNameFieldNumber;
#endif // !_MSC_VER
CMsgDOTATournamentInfo_PhaseGroup::CMsgDOTATournamentInfo_PhaseGroup()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTATournamentInfo.PhaseGroup)
}
void CMsgDOTATournamentInfo_PhaseGroup::InitAsDefaultInstance() {
}
CMsgDOTATournamentInfo_PhaseGroup::CMsgDOTATournamentInfo_PhaseGroup(const CMsgDOTATournamentInfo_PhaseGroup& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTATournamentInfo.PhaseGroup)
}
void CMsgDOTATournamentInfo_PhaseGroup::SharedCtor() {
::google::protobuf::internal::GetEmptyString();
_cached_size_ = 0;
group_id_ = 0u;
group_name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTATournamentInfo_PhaseGroup::~CMsgDOTATournamentInfo_PhaseGroup() {
// @@protoc_insertion_point(destructor:CMsgDOTATournamentInfo.PhaseGroup)
SharedDtor();
}
void CMsgDOTATournamentInfo_PhaseGroup::SharedDtor() {
if (group_name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete group_name_;
}
if (this != default_instance_) {
}
}
void CMsgDOTATournamentInfo_PhaseGroup::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTATournamentInfo_PhaseGroup::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTATournamentInfo_PhaseGroup_descriptor_;
}
const CMsgDOTATournamentInfo_PhaseGroup& CMsgDOTATournamentInfo_PhaseGroup::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTATournamentInfo_PhaseGroup* CMsgDOTATournamentInfo_PhaseGroup::default_instance_ = NULL;
CMsgDOTATournamentInfo_PhaseGroup* CMsgDOTATournamentInfo_PhaseGroup::New() const {
return new CMsgDOTATournamentInfo_PhaseGroup;
}
void CMsgDOTATournamentInfo_PhaseGroup::Clear() {
if (_has_bits_[0 / 32] & 3) {
group_id_ = 0u;
if (has_group_name()) {
if (group_name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
group_name_->clear();
}
}
}
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTATournamentInfo_PhaseGroup::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTATournamentInfo.PhaseGroup)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint32 group_id = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &group_id_)));
set_has_group_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_group_name;
break;
}
// optional string group_name = 2;
case 2: {
if (tag == 18) {
parse_group_name:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_group_name()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->group_name().data(), this->group_name().length(),
::google::protobuf::internal::WireFormat::PARSE,
"group_name");
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTATournamentInfo.PhaseGroup)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTATournamentInfo.PhaseGroup)
return false;
#undef DO_
}
void CMsgDOTATournamentInfo_PhaseGroup::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTATournamentInfo.PhaseGroup)
// optional uint32 group_id = 1;
if (has_group_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->group_id(), output);
}
// optional string group_name = 2;
if (has_group_name()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->group_name().data(), this->group_name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"group_name");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
2, this->group_name(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTATournamentInfo.PhaseGroup)
}
::google::protobuf::uint8* CMsgDOTATournamentInfo_PhaseGroup::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTATournamentInfo.PhaseGroup)
// optional uint32 group_id = 1;
if (has_group_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->group_id(), target);
}
// optional string group_name = 2;
if (has_group_name()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->group_name().data(), this->group_name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"group_name");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
2, this->group_name(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTATournamentInfo.PhaseGroup)
return target;
}
int CMsgDOTATournamentInfo_PhaseGroup::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional uint32 group_id = 1;
if (has_group_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->group_id());
}
// optional string group_name = 2;
if (has_group_name()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->group_name());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTATournamentInfo_PhaseGroup::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTATournamentInfo_PhaseGroup* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTATournamentInfo_PhaseGroup*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTATournamentInfo_PhaseGroup::MergeFrom(const CMsgDOTATournamentInfo_PhaseGroup& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_group_id()) {
set_group_id(from.group_id());
}
if (from.has_group_name()) {
set_group_name(from.group_name());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTATournamentInfo_PhaseGroup::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTATournamentInfo_PhaseGroup::CopyFrom(const CMsgDOTATournamentInfo_PhaseGroup& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTATournamentInfo_PhaseGroup::IsInitialized() const {
return true;
}
void CMsgDOTATournamentInfo_PhaseGroup::Swap(CMsgDOTATournamentInfo_PhaseGroup* other) {
if (other != this) {
std::swap(group_id_, other->group_id_);
std::swap(group_name_, other->group_name_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTATournamentInfo_PhaseGroup::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTATournamentInfo_PhaseGroup_descriptor_;
metadata.reflection = CMsgDOTATournamentInfo_PhaseGroup_reflection_;
return metadata;
}
// -------------------------------------------------------------------
#ifndef _MSC_VER
const int CMsgDOTATournamentInfo_Phase::kPhaseIdFieldNumber;
const int CMsgDOTATournamentInfo_Phase::kPhaseNameFieldNumber;
const int CMsgDOTATournamentInfo_Phase::kTypeIdFieldNumber;
const int CMsgDOTATournamentInfo_Phase::kIterationsFieldNumber;
const int CMsgDOTATournamentInfo_Phase::kMinStartTimeFieldNumber;
const int CMsgDOTATournamentInfo_Phase::kMaxStartTimeFieldNumber;
const int CMsgDOTATournamentInfo_Phase::kGroupListFieldNumber;
#endif // !_MSC_VER
CMsgDOTATournamentInfo_Phase::CMsgDOTATournamentInfo_Phase()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTATournamentInfo.Phase)
}
void CMsgDOTATournamentInfo_Phase::InitAsDefaultInstance() {
}
CMsgDOTATournamentInfo_Phase::CMsgDOTATournamentInfo_Phase(const CMsgDOTATournamentInfo_Phase& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTATournamentInfo.Phase)
}
void CMsgDOTATournamentInfo_Phase::SharedCtor() {
::google::protobuf::internal::GetEmptyString();
_cached_size_ = 0;
phase_id_ = 0u;
phase_name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
type_id_ = 0u;
iterations_ = 0u;
min_start_time_ = 0u;
max_start_time_ = 0u;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTATournamentInfo_Phase::~CMsgDOTATournamentInfo_Phase() {
// @@protoc_insertion_point(destructor:CMsgDOTATournamentInfo.Phase)
SharedDtor();
}
void CMsgDOTATournamentInfo_Phase::SharedDtor() {
if (phase_name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete phase_name_;
}
if (this != default_instance_) {
}
}
void CMsgDOTATournamentInfo_Phase::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTATournamentInfo_Phase::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTATournamentInfo_Phase_descriptor_;
}
const CMsgDOTATournamentInfo_Phase& CMsgDOTATournamentInfo_Phase::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTATournamentInfo_Phase* CMsgDOTATournamentInfo_Phase::default_instance_ = NULL;
CMsgDOTATournamentInfo_Phase* CMsgDOTATournamentInfo_Phase::New() const {
return new CMsgDOTATournamentInfo_Phase;
}
void CMsgDOTATournamentInfo_Phase::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<CMsgDOTATournamentInfo_Phase*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
if (_has_bits_[0 / 32] & 63) {
ZR_(phase_id_, min_start_time_);
if (has_phase_name()) {
if (phase_name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
phase_name_->clear();
}
}
max_start_time_ = 0u;
}
#undef OFFSET_OF_FIELD_
#undef ZR_
group_list_.Clear();
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTATournamentInfo_Phase::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTATournamentInfo.Phase)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint32 phase_id = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &phase_id_)));
set_has_phase_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_phase_name;
break;
}
// optional string phase_name = 2;
case 2: {
if (tag == 18) {
parse_phase_name:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_phase_name()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->phase_name().data(), this->phase_name().length(),
::google::protobuf::internal::WireFormat::PARSE,
"phase_name");
} else {
goto handle_unusual;
}
if (input->ExpectTag(24)) goto parse_type_id;
break;
}
// optional uint32 type_id = 3;
case 3: {
if (tag == 24) {
parse_type_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &type_id_)));
set_has_type_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(32)) goto parse_iterations;
break;
}
// optional uint32 iterations = 4;
case 4: {
if (tag == 32) {
parse_iterations:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &iterations_)));
set_has_iterations();
} else {
goto handle_unusual;
}
if (input->ExpectTag(40)) goto parse_min_start_time;
break;
}
// optional uint32 min_start_time = 5;
case 5: {
if (tag == 40) {
parse_min_start_time:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &min_start_time_)));
set_has_min_start_time();
} else {
goto handle_unusual;
}
if (input->ExpectTag(48)) goto parse_max_start_time;
break;
}
// optional uint32 max_start_time = 6;
case 6: {
if (tag == 48) {
parse_max_start_time:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &max_start_time_)));
set_has_max_start_time();
} else {
goto handle_unusual;
}
if (input->ExpectTag(58)) goto parse_group_list;
break;
}
// repeated .CMsgDOTATournamentInfo.PhaseGroup group_list = 7;
case 7: {
if (tag == 58) {
parse_group_list:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_group_list()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(58)) goto parse_group_list;
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTATournamentInfo.Phase)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTATournamentInfo.Phase)
return false;
#undef DO_
}
void CMsgDOTATournamentInfo_Phase::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTATournamentInfo.Phase)
// optional uint32 phase_id = 1;
if (has_phase_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->phase_id(), output);
}
// optional string phase_name = 2;
if (has_phase_name()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->phase_name().data(), this->phase_name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"phase_name");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
2, this->phase_name(), output);
}
// optional uint32 type_id = 3;
if (has_type_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(3, this->type_id(), output);
}
// optional uint32 iterations = 4;
if (has_iterations()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(4, this->iterations(), output);
}
// optional uint32 min_start_time = 5;
if (has_min_start_time()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(5, this->min_start_time(), output);
}
// optional uint32 max_start_time = 6;
if (has_max_start_time()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(6, this->max_start_time(), output);
}
// repeated .CMsgDOTATournamentInfo.PhaseGroup group_list = 7;
for (int i = 0; i < this->group_list_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
7, this->group_list(i), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTATournamentInfo.Phase)
}
::google::protobuf::uint8* CMsgDOTATournamentInfo_Phase::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTATournamentInfo.Phase)
// optional uint32 phase_id = 1;
if (has_phase_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->phase_id(), target);
}
// optional string phase_name = 2;
if (has_phase_name()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->phase_name().data(), this->phase_name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"phase_name");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
2, this->phase_name(), target);
}
// optional uint32 type_id = 3;
if (has_type_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(3, this->type_id(), target);
}
// optional uint32 iterations = 4;
if (has_iterations()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(4, this->iterations(), target);
}
// optional uint32 min_start_time = 5;
if (has_min_start_time()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(5, this->min_start_time(), target);
}
// optional uint32 max_start_time = 6;
if (has_max_start_time()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(6, this->max_start_time(), target);
}
// repeated .CMsgDOTATournamentInfo.PhaseGroup group_list = 7;
for (int i = 0; i < this->group_list_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
7, this->group_list(i), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTATournamentInfo.Phase)
return target;
}
int CMsgDOTATournamentInfo_Phase::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional uint32 phase_id = 1;
if (has_phase_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->phase_id());
}
// optional string phase_name = 2;
if (has_phase_name()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->phase_name());
}
// optional uint32 type_id = 3;
if (has_type_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->type_id());
}
// optional uint32 iterations = 4;
if (has_iterations()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->iterations());
}
// optional uint32 min_start_time = 5;
if (has_min_start_time()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->min_start_time());
}
// optional uint32 max_start_time = 6;
if (has_max_start_time()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->max_start_time());
}
}
// repeated .CMsgDOTATournamentInfo.PhaseGroup group_list = 7;
total_size += 1 * this->group_list_size();
for (int i = 0; i < this->group_list_size(); i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->group_list(i));
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTATournamentInfo_Phase::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTATournamentInfo_Phase* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTATournamentInfo_Phase*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTATournamentInfo_Phase::MergeFrom(const CMsgDOTATournamentInfo_Phase& from) {
GOOGLE_CHECK_NE(&from, this);
group_list_.MergeFrom(from.group_list_);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_phase_id()) {
set_phase_id(from.phase_id());
}
if (from.has_phase_name()) {
set_phase_name(from.phase_name());
}
if (from.has_type_id()) {
set_type_id(from.type_id());
}
if (from.has_iterations()) {
set_iterations(from.iterations());
}
if (from.has_min_start_time()) {
set_min_start_time(from.min_start_time());
}
if (from.has_max_start_time()) {
set_max_start_time(from.max_start_time());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTATournamentInfo_Phase::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTATournamentInfo_Phase::CopyFrom(const CMsgDOTATournamentInfo_Phase& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTATournamentInfo_Phase::IsInitialized() const {
return true;
}
void CMsgDOTATournamentInfo_Phase::Swap(CMsgDOTATournamentInfo_Phase* other) {
if (other != this) {
std::swap(phase_id_, other->phase_id_);
std::swap(phase_name_, other->phase_name_);
std::swap(type_id_, other->type_id_);
std::swap(iterations_, other->iterations_);
std::swap(min_start_time_, other->min_start_time_);
std::swap(max_start_time_, other->max_start_time_);
group_list_.Swap(&other->group_list_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTATournamentInfo_Phase::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTATournamentInfo_Phase_descriptor_;
metadata.reflection = CMsgDOTATournamentInfo_Phase_reflection_;
return metadata;
}
// -------------------------------------------------------------------
#ifndef _MSC_VER
const int CMsgDOTATournamentInfo_Team::kTeamIdFieldNumber;
const int CMsgDOTATournamentInfo_Team::kNameFieldNumber;
const int CMsgDOTATournamentInfo_Team::kTagFieldNumber;
const int CMsgDOTATournamentInfo_Team::kTeamLogoFieldNumber;
const int CMsgDOTATournamentInfo_Team::kEliminatedFieldNumber;
#endif // !_MSC_VER
CMsgDOTATournamentInfo_Team::CMsgDOTATournamentInfo_Team()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTATournamentInfo.Team)
}
void CMsgDOTATournamentInfo_Team::InitAsDefaultInstance() {
}
CMsgDOTATournamentInfo_Team::CMsgDOTATournamentInfo_Team(const CMsgDOTATournamentInfo_Team& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTATournamentInfo.Team)
}
void CMsgDOTATournamentInfo_Team::SharedCtor() {
::google::protobuf::internal::GetEmptyString();
_cached_size_ = 0;
team_id_ = 0u;
name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
tag_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
team_logo_ = GOOGLE_ULONGLONG(0);
eliminated_ = false;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTATournamentInfo_Team::~CMsgDOTATournamentInfo_Team() {
// @@protoc_insertion_point(destructor:CMsgDOTATournamentInfo.Team)
SharedDtor();
}
void CMsgDOTATournamentInfo_Team::SharedDtor() {
if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete name_;
}
if (tag_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete tag_;
}
if (this != default_instance_) {
}
}
void CMsgDOTATournamentInfo_Team::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTATournamentInfo_Team::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTATournamentInfo_Team_descriptor_;
}
const CMsgDOTATournamentInfo_Team& CMsgDOTATournamentInfo_Team::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTATournamentInfo_Team* CMsgDOTATournamentInfo_Team::default_instance_ = NULL;
CMsgDOTATournamentInfo_Team* CMsgDOTATournamentInfo_Team::New() const {
return new CMsgDOTATournamentInfo_Team;
}
void CMsgDOTATournamentInfo_Team::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<CMsgDOTATournamentInfo_Team*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
if (_has_bits_[0 / 32] & 31) {
ZR_(team_id_, team_logo_);
if (has_name()) {
if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
name_->clear();
}
}
if (has_tag()) {
if (tag_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
tag_->clear();
}
}
}
#undef OFFSET_OF_FIELD_
#undef ZR_
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTATournamentInfo_Team::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTATournamentInfo.Team)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint32 team_id = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &team_id_)));
set_has_team_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_name;
break;
}
// optional string name = 2;
case 2: {
if (tag == 18) {
parse_name:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_name()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::PARSE,
"name");
} else {
goto handle_unusual;
}
if (input->ExpectTag(26)) goto parse_tag;
break;
}
// optional string tag = 3;
case 3: {
if (tag == 26) {
parse_tag:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_tag()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->tag().data(), this->tag().length(),
::google::protobuf::internal::WireFormat::PARSE,
"tag");
} else {
goto handle_unusual;
}
if (input->ExpectTag(32)) goto parse_team_logo;
break;
}
// optional uint64 team_logo = 4;
case 4: {
if (tag == 32) {
parse_team_logo:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &team_logo_)));
set_has_team_logo();
} else {
goto handle_unusual;
}
if (input->ExpectTag(40)) goto parse_eliminated;
break;
}
// optional bool eliminated = 5;
case 5: {
if (tag == 40) {
parse_eliminated:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &eliminated_)));
set_has_eliminated();
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTATournamentInfo.Team)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTATournamentInfo.Team)
return false;
#undef DO_
}
void CMsgDOTATournamentInfo_Team::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTATournamentInfo.Team)
// optional uint32 team_id = 1;
if (has_team_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->team_id(), output);
}
// optional string name = 2;
if (has_name()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"name");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
2, this->name(), output);
}
// optional string tag = 3;
if (has_tag()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->tag().data(), this->tag().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"tag");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
3, this->tag(), output);
}
// optional uint64 team_logo = 4;
if (has_team_logo()) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(4, this->team_logo(), output);
}
// optional bool eliminated = 5;
if (has_eliminated()) {
::google::protobuf::internal::WireFormatLite::WriteBool(5, this->eliminated(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTATournamentInfo.Team)
}
::google::protobuf::uint8* CMsgDOTATournamentInfo_Team::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTATournamentInfo.Team)
// optional uint32 team_id = 1;
if (has_team_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->team_id(), target);
}
// optional string name = 2;
if (has_name()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"name");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
2, this->name(), target);
}
// optional string tag = 3;
if (has_tag()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->tag().data(), this->tag().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"tag");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
3, this->tag(), target);
}
// optional uint64 team_logo = 4;
if (has_team_logo()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(4, this->team_logo(), target);
}
// optional bool eliminated = 5;
if (has_eliminated()) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(5, this->eliminated(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTATournamentInfo.Team)
return target;
}
int CMsgDOTATournamentInfo_Team::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional uint32 team_id = 1;
if (has_team_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->team_id());
}
// optional string name = 2;
if (has_name()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->name());
}
// optional string tag = 3;
if (has_tag()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->tag());
}
// optional uint64 team_logo = 4;
if (has_team_logo()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->team_logo());
}
// optional bool eliminated = 5;
if (has_eliminated()) {
total_size += 1 + 1;
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTATournamentInfo_Team::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTATournamentInfo_Team* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTATournamentInfo_Team*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTATournamentInfo_Team::MergeFrom(const CMsgDOTATournamentInfo_Team& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_team_id()) {
set_team_id(from.team_id());
}
if (from.has_name()) {
set_name(from.name());
}
if (from.has_tag()) {
set_tag(from.tag());
}
if (from.has_team_logo()) {
set_team_logo(from.team_logo());
}
if (from.has_eliminated()) {
set_eliminated(from.eliminated());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTATournamentInfo_Team::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTATournamentInfo_Team::CopyFrom(const CMsgDOTATournamentInfo_Team& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTATournamentInfo_Team::IsInitialized() const {
return true;
}
void CMsgDOTATournamentInfo_Team::Swap(CMsgDOTATournamentInfo_Team* other) {
if (other != this) {
std::swap(team_id_, other->team_id_);
std::swap(name_, other->name_);
std::swap(tag_, other->tag_);
std::swap(team_logo_, other->team_logo_);
std::swap(eliminated_, other->eliminated_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTATournamentInfo_Team::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTATournamentInfo_Team_descriptor_;
metadata.reflection = CMsgDOTATournamentInfo_Team_reflection_;
return metadata;
}
// -------------------------------------------------------------------
#ifndef _MSC_VER
const int CMsgDOTATournamentInfo_UpcomingMatch::kSeriesIdFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kTeam1IdFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kTeam2IdFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kBoFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kStageNameFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kStartTimeFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kWinnerStageFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kLoserStageFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kTeam1TagFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kTeam2TagFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kTeam1PrevOpponentTagFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kTeam2PrevOpponentTagFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kTeam1LogoFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kTeam2LogoFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kTeam1PrevOpponentLogoFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kTeam2PrevOpponentLogoFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kTeam1PrevOpponentIdFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kTeam2PrevOpponentIdFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kTeam1PrevMatchScoreFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kTeam1PrevMatchOpponentScoreFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kTeam2PrevMatchScoreFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kTeam2PrevMatchOpponentScoreFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kPhaseTypeFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kTeam1ScoreFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kTeam2ScoreFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kPhaseIdFieldNumber;
#endif // !_MSC_VER
CMsgDOTATournamentInfo_UpcomingMatch::CMsgDOTATournamentInfo_UpcomingMatch()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTATournamentInfo.UpcomingMatch)
}
void CMsgDOTATournamentInfo_UpcomingMatch::InitAsDefaultInstance() {
}
CMsgDOTATournamentInfo_UpcomingMatch::CMsgDOTATournamentInfo_UpcomingMatch(const CMsgDOTATournamentInfo_UpcomingMatch& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTATournamentInfo.UpcomingMatch)
}
void CMsgDOTATournamentInfo_UpcomingMatch::SharedCtor() {
::google::protobuf::internal::GetEmptyString();
_cached_size_ = 0;
series_id_ = 0u;
team1_id_ = 0u;
team2_id_ = 0u;
bo_ = 0u;
stage_name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
start_time_ = 0u;
winner_stage_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
loser_stage_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
team1_tag_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
team2_tag_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
team1_prev_opponent_tag_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
team2_prev_opponent_tag_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
team1_logo_ = GOOGLE_ULONGLONG(0);
team2_logo_ = GOOGLE_ULONGLONG(0);
team1_prev_opponent_logo_ = GOOGLE_ULONGLONG(0);
team2_prev_opponent_logo_ = GOOGLE_ULONGLONG(0);
team1_prev_opponent_id_ = 0u;
team2_prev_opponent_id_ = 0u;
team1_prev_match_score_ = 0u;
team1_prev_match_opponent_score_ = 0u;
team2_prev_match_score_ = 0u;
team2_prev_match_opponent_score_ = 0u;
phase_type_ = 0u;
team1_score_ = 0u;
team2_score_ = 0u;
phase_id_ = 0u;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTATournamentInfo_UpcomingMatch::~CMsgDOTATournamentInfo_UpcomingMatch() {
// @@protoc_insertion_point(destructor:CMsgDOTATournamentInfo.UpcomingMatch)
SharedDtor();
}
void CMsgDOTATournamentInfo_UpcomingMatch::SharedDtor() {
if (stage_name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete stage_name_;
}
if (winner_stage_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete winner_stage_;
}
if (loser_stage_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete loser_stage_;
}
if (team1_tag_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete team1_tag_;
}
if (team2_tag_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete team2_tag_;
}
if (team1_prev_opponent_tag_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete team1_prev_opponent_tag_;
}
if (team2_prev_opponent_tag_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete team2_prev_opponent_tag_;
}
if (this != default_instance_) {
}
}
void CMsgDOTATournamentInfo_UpcomingMatch::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTATournamentInfo_UpcomingMatch::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTATournamentInfo_UpcomingMatch_descriptor_;
}
const CMsgDOTATournamentInfo_UpcomingMatch& CMsgDOTATournamentInfo_UpcomingMatch::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTATournamentInfo_UpcomingMatch* CMsgDOTATournamentInfo_UpcomingMatch::default_instance_ = NULL;
CMsgDOTATournamentInfo_UpcomingMatch* CMsgDOTATournamentInfo_UpcomingMatch::New() const {
return new CMsgDOTATournamentInfo_UpcomingMatch;
}
void CMsgDOTATournamentInfo_UpcomingMatch::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<CMsgDOTATournamentInfo_UpcomingMatch*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
if (_has_bits_[0 / 32] & 255) {
ZR_(series_id_, bo_);
if (has_stage_name()) {
if (stage_name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
stage_name_->clear();
}
}
start_time_ = 0u;
if (has_winner_stage()) {
if (winner_stage_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
winner_stage_->clear();
}
}
if (has_loser_stage()) {
if (loser_stage_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
loser_stage_->clear();
}
}
}
if (_has_bits_[8 / 32] & 65280) {
ZR_(team1_logo_, team2_prev_opponent_logo_);
if (has_team1_tag()) {
if (team1_tag_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
team1_tag_->clear();
}
}
if (has_team2_tag()) {
if (team2_tag_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
team2_tag_->clear();
}
}
if (has_team1_prev_opponent_tag()) {
if (team1_prev_opponent_tag_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
team1_prev_opponent_tag_->clear();
}
}
if (has_team2_prev_opponent_tag()) {
if (team2_prev_opponent_tag_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
team2_prev_opponent_tag_->clear();
}
}
}
if (_has_bits_[16 / 32] & 16711680) {
ZR_(team2_prev_opponent_id_, team1_score_);
team1_prev_opponent_id_ = 0u;
}
ZR_(team2_score_, phase_id_);
#undef OFFSET_OF_FIELD_
#undef ZR_
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTATournamentInfo_UpcomingMatch::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTATournamentInfo.UpcomingMatch)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(16383);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint32 series_id = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &series_id_)));
set_has_series_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_team1_id;
break;
}
// optional uint32 team1_id = 2;
case 2: {
if (tag == 16) {
parse_team1_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &team1_id_)));
set_has_team1_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(24)) goto parse_team2_id;
break;
}
// optional uint32 team2_id = 3;
case 3: {
if (tag == 24) {
parse_team2_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &team2_id_)));
set_has_team2_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(32)) goto parse_bo;
break;
}
// optional uint32 bo = 4;
case 4: {
if (tag == 32) {
parse_bo:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &bo_)));
set_has_bo();
} else {
goto handle_unusual;
}
if (input->ExpectTag(42)) goto parse_stage_name;
break;
}
// optional string stage_name = 5;
case 5: {
if (tag == 42) {
parse_stage_name:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_stage_name()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->stage_name().data(), this->stage_name().length(),
::google::protobuf::internal::WireFormat::PARSE,
"stage_name");
} else {
goto handle_unusual;
}
if (input->ExpectTag(48)) goto parse_start_time;
break;
}
// optional uint32 start_time = 6;
case 6: {
if (tag == 48) {
parse_start_time:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &start_time_)));
set_has_start_time();
} else {
goto handle_unusual;
}
if (input->ExpectTag(58)) goto parse_winner_stage;
break;
}
// optional string winner_stage = 7;
case 7: {
if (tag == 58) {
parse_winner_stage:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_winner_stage()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->winner_stage().data(), this->winner_stage().length(),
::google::protobuf::internal::WireFormat::PARSE,
"winner_stage");
} else {
goto handle_unusual;
}
if (input->ExpectTag(66)) goto parse_loser_stage;
break;
}
// optional string loser_stage = 8;
case 8: {
if (tag == 66) {
parse_loser_stage:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_loser_stage()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->loser_stage().data(), this->loser_stage().length(),
::google::protobuf::internal::WireFormat::PARSE,
"loser_stage");
} else {
goto handle_unusual;
}
if (input->ExpectTag(74)) goto parse_team1_tag;
break;
}
// optional string team1_tag = 9;
case 9: {
if (tag == 74) {
parse_team1_tag:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_team1_tag()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->team1_tag().data(), this->team1_tag().length(),
::google::protobuf::internal::WireFormat::PARSE,
"team1_tag");
} else {
goto handle_unusual;
}
if (input->ExpectTag(82)) goto parse_team2_tag;
break;
}
// optional string team2_tag = 10;
case 10: {
if (tag == 82) {
parse_team2_tag:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_team2_tag()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->team2_tag().data(), this->team2_tag().length(),
::google::protobuf::internal::WireFormat::PARSE,
"team2_tag");
} else {
goto handle_unusual;
}
if (input->ExpectTag(90)) goto parse_team1_prev_opponent_tag;
break;
}
// optional string team1_prev_opponent_tag = 11;
case 11: {
if (tag == 90) {
parse_team1_prev_opponent_tag:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_team1_prev_opponent_tag()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->team1_prev_opponent_tag().data(), this->team1_prev_opponent_tag().length(),
::google::protobuf::internal::WireFormat::PARSE,
"team1_prev_opponent_tag");
} else {
goto handle_unusual;
}
if (input->ExpectTag(98)) goto parse_team2_prev_opponent_tag;
break;
}
// optional string team2_prev_opponent_tag = 12;
case 12: {
if (tag == 98) {
parse_team2_prev_opponent_tag:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_team2_prev_opponent_tag()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->team2_prev_opponent_tag().data(), this->team2_prev_opponent_tag().length(),
::google::protobuf::internal::WireFormat::PARSE,
"team2_prev_opponent_tag");
} else {
goto handle_unusual;
}
if (input->ExpectTag(104)) goto parse_team1_logo;
break;
}
// optional uint64 team1_logo = 13;
case 13: {
if (tag == 104) {
parse_team1_logo:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &team1_logo_)));
set_has_team1_logo();
} else {
goto handle_unusual;
}
if (input->ExpectTag(112)) goto parse_team2_logo;
break;
}
// optional uint64 team2_logo = 14;
case 14: {
if (tag == 112) {
parse_team2_logo:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &team2_logo_)));
set_has_team2_logo();
} else {
goto handle_unusual;
}
if (input->ExpectTag(120)) goto parse_team1_prev_opponent_logo;
break;
}
// optional uint64 team1_prev_opponent_logo = 15;
case 15: {
if (tag == 120) {
parse_team1_prev_opponent_logo:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &team1_prev_opponent_logo_)));
set_has_team1_prev_opponent_logo();
} else {
goto handle_unusual;
}
if (input->ExpectTag(128)) goto parse_team2_prev_opponent_logo;
break;
}
// optional uint64 team2_prev_opponent_logo = 16;
case 16: {
if (tag == 128) {
parse_team2_prev_opponent_logo:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &team2_prev_opponent_logo_)));
set_has_team2_prev_opponent_logo();
} else {
goto handle_unusual;
}
if (input->ExpectTag(136)) goto parse_team1_prev_opponent_id;
break;
}
// optional uint32 team1_prev_opponent_id = 17;
case 17: {
if (tag == 136) {
parse_team1_prev_opponent_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &team1_prev_opponent_id_)));
set_has_team1_prev_opponent_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(144)) goto parse_team2_prev_opponent_id;
break;
}
// optional uint32 team2_prev_opponent_id = 18;
case 18: {
if (tag == 144) {
parse_team2_prev_opponent_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &team2_prev_opponent_id_)));
set_has_team2_prev_opponent_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(152)) goto parse_team1_prev_match_score;
break;
}
// optional uint32 team1_prev_match_score = 19;
case 19: {
if (tag == 152) {
parse_team1_prev_match_score:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &team1_prev_match_score_)));
set_has_team1_prev_match_score();
} else {
goto handle_unusual;
}
if (input->ExpectTag(160)) goto parse_team1_prev_match_opponent_score;
break;
}
// optional uint32 team1_prev_match_opponent_score = 20;
case 20: {
if (tag == 160) {
parse_team1_prev_match_opponent_score:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &team1_prev_match_opponent_score_)));
set_has_team1_prev_match_opponent_score();
} else {
goto handle_unusual;
}
if (input->ExpectTag(168)) goto parse_team2_prev_match_score;
break;
}
// optional uint32 team2_prev_match_score = 21;
case 21: {
if (tag == 168) {
parse_team2_prev_match_score:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &team2_prev_match_score_)));
set_has_team2_prev_match_score();
} else {
goto handle_unusual;
}
if (input->ExpectTag(176)) goto parse_team2_prev_match_opponent_score;
break;
}
// optional uint32 team2_prev_match_opponent_score = 22;
case 22: {
if (tag == 176) {
parse_team2_prev_match_opponent_score:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &team2_prev_match_opponent_score_)));
set_has_team2_prev_match_opponent_score();
} else {
goto handle_unusual;
}
if (input->ExpectTag(184)) goto parse_phase_type;
break;
}
// optional uint32 phase_type = 23;
case 23: {
if (tag == 184) {
parse_phase_type:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &phase_type_)));
set_has_phase_type();
} else {
goto handle_unusual;
}
if (input->ExpectTag(192)) goto parse_team1_score;
break;
}
// optional uint32 team1_score = 24;
case 24: {
if (tag == 192) {
parse_team1_score:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &team1_score_)));
set_has_team1_score();
} else {
goto handle_unusual;
}
if (input->ExpectTag(200)) goto parse_team2_score;
break;
}
// optional uint32 team2_score = 25;
case 25: {
if (tag == 200) {
parse_team2_score:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &team2_score_)));
set_has_team2_score();
} else {
goto handle_unusual;
}
if (input->ExpectTag(208)) goto parse_phase_id;
break;
}
// optional uint32 phase_id = 26;
case 26: {
if (tag == 208) {
parse_phase_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &phase_id_)));
set_has_phase_id();
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTATournamentInfo.UpcomingMatch)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTATournamentInfo.UpcomingMatch)
return false;
#undef DO_
}
void CMsgDOTATournamentInfo_UpcomingMatch::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTATournamentInfo.UpcomingMatch)
// optional uint32 series_id = 1;
if (has_series_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->series_id(), output);
}
// optional uint32 team1_id = 2;
if (has_team1_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->team1_id(), output);
}
// optional uint32 team2_id = 3;
if (has_team2_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(3, this->team2_id(), output);
}
// optional uint32 bo = 4;
if (has_bo()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(4, this->bo(), output);
}
// optional string stage_name = 5;
if (has_stage_name()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->stage_name().data(), this->stage_name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"stage_name");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
5, this->stage_name(), output);
}
// optional uint32 start_time = 6;
if (has_start_time()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(6, this->start_time(), output);
}
// optional string winner_stage = 7;
if (has_winner_stage()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->winner_stage().data(), this->winner_stage().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"winner_stage");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
7, this->winner_stage(), output);
}
// optional string loser_stage = 8;
if (has_loser_stage()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->loser_stage().data(), this->loser_stage().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"loser_stage");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
8, this->loser_stage(), output);
}
// optional string team1_tag = 9;
if (has_team1_tag()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->team1_tag().data(), this->team1_tag().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"team1_tag");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
9, this->team1_tag(), output);
}
// optional string team2_tag = 10;
if (has_team2_tag()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->team2_tag().data(), this->team2_tag().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"team2_tag");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
10, this->team2_tag(), output);
}
// optional string team1_prev_opponent_tag = 11;
if (has_team1_prev_opponent_tag()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->team1_prev_opponent_tag().data(), this->team1_prev_opponent_tag().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"team1_prev_opponent_tag");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
11, this->team1_prev_opponent_tag(), output);
}
// optional string team2_prev_opponent_tag = 12;
if (has_team2_prev_opponent_tag()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->team2_prev_opponent_tag().data(), this->team2_prev_opponent_tag().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"team2_prev_opponent_tag");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
12, this->team2_prev_opponent_tag(), output);
}
// optional uint64 team1_logo = 13;
if (has_team1_logo()) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(13, this->team1_logo(), output);
}
// optional uint64 team2_logo = 14;
if (has_team2_logo()) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(14, this->team2_logo(), output);
}
// optional uint64 team1_prev_opponent_logo = 15;
if (has_team1_prev_opponent_logo()) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(15, this->team1_prev_opponent_logo(), output);
}
// optional uint64 team2_prev_opponent_logo = 16;
if (has_team2_prev_opponent_logo()) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(16, this->team2_prev_opponent_logo(), output);
}
// optional uint32 team1_prev_opponent_id = 17;
if (has_team1_prev_opponent_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(17, this->team1_prev_opponent_id(), output);
}
// optional uint32 team2_prev_opponent_id = 18;
if (has_team2_prev_opponent_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(18, this->team2_prev_opponent_id(), output);
}
// optional uint32 team1_prev_match_score = 19;
if (has_team1_prev_match_score()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(19, this->team1_prev_match_score(), output);
}
// optional uint32 team1_prev_match_opponent_score = 20;
if (has_team1_prev_match_opponent_score()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(20, this->team1_prev_match_opponent_score(), output);
}
// optional uint32 team2_prev_match_score = 21;
if (has_team2_prev_match_score()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(21, this->team2_prev_match_score(), output);
}
// optional uint32 team2_prev_match_opponent_score = 22;
if (has_team2_prev_match_opponent_score()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(22, this->team2_prev_match_opponent_score(), output);
}
// optional uint32 phase_type = 23;
if (has_phase_type()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(23, this->phase_type(), output);
}
// optional uint32 team1_score = 24;
if (has_team1_score()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(24, this->team1_score(), output);
}
// optional uint32 team2_score = 25;
if (has_team2_score()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(25, this->team2_score(), output);
}
// optional uint32 phase_id = 26;
if (has_phase_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(26, this->phase_id(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTATournamentInfo.UpcomingMatch)
}
::google::protobuf::uint8* CMsgDOTATournamentInfo_UpcomingMatch::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTATournamentInfo.UpcomingMatch)
// optional uint32 series_id = 1;
if (has_series_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->series_id(), target);
}
// optional uint32 team1_id = 2;
if (has_team1_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->team1_id(), target);
}
// optional uint32 team2_id = 3;
if (has_team2_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(3, this->team2_id(), target);
}
// optional uint32 bo = 4;
if (has_bo()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(4, this->bo(), target);
}
// optional string stage_name = 5;
if (has_stage_name()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->stage_name().data(), this->stage_name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"stage_name");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
5, this->stage_name(), target);
}
// optional uint32 start_time = 6;
if (has_start_time()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(6, this->start_time(), target);
}
// optional string winner_stage = 7;
if (has_winner_stage()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->winner_stage().data(), this->winner_stage().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"winner_stage");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
7, this->winner_stage(), target);
}
// optional string loser_stage = 8;
if (has_loser_stage()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->loser_stage().data(), this->loser_stage().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"loser_stage");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
8, this->loser_stage(), target);
}
// optional string team1_tag = 9;
if (has_team1_tag()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->team1_tag().data(), this->team1_tag().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"team1_tag");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
9, this->team1_tag(), target);
}
// optional string team2_tag = 10;
if (has_team2_tag()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->team2_tag().data(), this->team2_tag().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"team2_tag");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
10, this->team2_tag(), target);
}
// optional string team1_prev_opponent_tag = 11;
if (has_team1_prev_opponent_tag()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->team1_prev_opponent_tag().data(), this->team1_prev_opponent_tag().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"team1_prev_opponent_tag");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
11, this->team1_prev_opponent_tag(), target);
}
// optional string team2_prev_opponent_tag = 12;
if (has_team2_prev_opponent_tag()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->team2_prev_opponent_tag().data(), this->team2_prev_opponent_tag().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"team2_prev_opponent_tag");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
12, this->team2_prev_opponent_tag(), target);
}
// optional uint64 team1_logo = 13;
if (has_team1_logo()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(13, this->team1_logo(), target);
}
// optional uint64 team2_logo = 14;
if (has_team2_logo()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(14, this->team2_logo(), target);
}
// optional uint64 team1_prev_opponent_logo = 15;
if (has_team1_prev_opponent_logo()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(15, this->team1_prev_opponent_logo(), target);
}
// optional uint64 team2_prev_opponent_logo = 16;
if (has_team2_prev_opponent_logo()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(16, this->team2_prev_opponent_logo(), target);
}
// optional uint32 team1_prev_opponent_id = 17;
if (has_team1_prev_opponent_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(17, this->team1_prev_opponent_id(), target);
}
// optional uint32 team2_prev_opponent_id = 18;
if (has_team2_prev_opponent_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(18, this->team2_prev_opponent_id(), target);
}
// optional uint32 team1_prev_match_score = 19;
if (has_team1_prev_match_score()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(19, this->team1_prev_match_score(), target);
}
// optional uint32 team1_prev_match_opponent_score = 20;
if (has_team1_prev_match_opponent_score()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(20, this->team1_prev_match_opponent_score(), target);
}
// optional uint32 team2_prev_match_score = 21;
if (has_team2_prev_match_score()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(21, this->team2_prev_match_score(), target);
}
// optional uint32 team2_prev_match_opponent_score = 22;
if (has_team2_prev_match_opponent_score()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(22, this->team2_prev_match_opponent_score(), target);
}
// optional uint32 phase_type = 23;
if (has_phase_type()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(23, this->phase_type(), target);
}
// optional uint32 team1_score = 24;
if (has_team1_score()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(24, this->team1_score(), target);
}
// optional uint32 team2_score = 25;
if (has_team2_score()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(25, this->team2_score(), target);
}
// optional uint32 phase_id = 26;
if (has_phase_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(26, this->phase_id(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTATournamentInfo.UpcomingMatch)
return target;
}
int CMsgDOTATournamentInfo_UpcomingMatch::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional uint32 series_id = 1;
if (has_series_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->series_id());
}
// optional uint32 team1_id = 2;
if (has_team1_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->team1_id());
}
// optional uint32 team2_id = 3;
if (has_team2_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->team2_id());
}
// optional uint32 bo = 4;
if (has_bo()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->bo());
}
// optional string stage_name = 5;
if (has_stage_name()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->stage_name());
}
// optional uint32 start_time = 6;
if (has_start_time()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->start_time());
}
// optional string winner_stage = 7;
if (has_winner_stage()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->winner_stage());
}
// optional string loser_stage = 8;
if (has_loser_stage()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->loser_stage());
}
}
if (_has_bits_[8 / 32] & (0xffu << (8 % 32))) {
// optional string team1_tag = 9;
if (has_team1_tag()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->team1_tag());
}
// optional string team2_tag = 10;
if (has_team2_tag()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->team2_tag());
}
// optional string team1_prev_opponent_tag = 11;
if (has_team1_prev_opponent_tag()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->team1_prev_opponent_tag());
}
// optional string team2_prev_opponent_tag = 12;
if (has_team2_prev_opponent_tag()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->team2_prev_opponent_tag());
}
// optional uint64 team1_logo = 13;
if (has_team1_logo()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->team1_logo());
}
// optional uint64 team2_logo = 14;
if (has_team2_logo()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->team2_logo());
}
// optional uint64 team1_prev_opponent_logo = 15;
if (has_team1_prev_opponent_logo()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->team1_prev_opponent_logo());
}
// optional uint64 team2_prev_opponent_logo = 16;
if (has_team2_prev_opponent_logo()) {
total_size += 2 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->team2_prev_opponent_logo());
}
}
if (_has_bits_[16 / 32] & (0xffu << (16 % 32))) {
// optional uint32 team1_prev_opponent_id = 17;
if (has_team1_prev_opponent_id()) {
total_size += 2 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->team1_prev_opponent_id());
}
// optional uint32 team2_prev_opponent_id = 18;
if (has_team2_prev_opponent_id()) {
total_size += 2 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->team2_prev_opponent_id());
}
// optional uint32 team1_prev_match_score = 19;
if (has_team1_prev_match_score()) {
total_size += 2 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->team1_prev_match_score());
}
// optional uint32 team1_prev_match_opponent_score = 20;
if (has_team1_prev_match_opponent_score()) {
total_size += 2 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->team1_prev_match_opponent_score());
}
// optional uint32 team2_prev_match_score = 21;
if (has_team2_prev_match_score()) {
total_size += 2 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->team2_prev_match_score());
}
// optional uint32 team2_prev_match_opponent_score = 22;
if (has_team2_prev_match_opponent_score()) {
total_size += 2 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->team2_prev_match_opponent_score());
}
// optional uint32 phase_type = 23;
if (has_phase_type()) {
total_size += 2 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->phase_type());
}
// optional uint32 team1_score = 24;
if (has_team1_score()) {
total_size += 2 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->team1_score());
}
}
if (_has_bits_[24 / 32] & (0xffu << (24 % 32))) {
// optional uint32 team2_score = 25;
if (has_team2_score()) {
total_size += 2 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->team2_score());
}
// optional uint32 phase_id = 26;
if (has_phase_id()) {
total_size += 2 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->phase_id());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTATournamentInfo_UpcomingMatch::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTATournamentInfo_UpcomingMatch* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTATournamentInfo_UpcomingMatch*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTATournamentInfo_UpcomingMatch::MergeFrom(const CMsgDOTATournamentInfo_UpcomingMatch& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_series_id()) {
set_series_id(from.series_id());
}
if (from.has_team1_id()) {
set_team1_id(from.team1_id());
}
if (from.has_team2_id()) {
set_team2_id(from.team2_id());
}
if (from.has_bo()) {
set_bo(from.bo());
}
if (from.has_stage_name()) {
set_stage_name(from.stage_name());
}
if (from.has_start_time()) {
set_start_time(from.start_time());
}
if (from.has_winner_stage()) {
set_winner_stage(from.winner_stage());
}
if (from.has_loser_stage()) {
set_loser_stage(from.loser_stage());
}
}
if (from._has_bits_[8 / 32] & (0xffu << (8 % 32))) {
if (from.has_team1_tag()) {
set_team1_tag(from.team1_tag());
}
if (from.has_team2_tag()) {
set_team2_tag(from.team2_tag());
}
if (from.has_team1_prev_opponent_tag()) {
set_team1_prev_opponent_tag(from.team1_prev_opponent_tag());
}
if (from.has_team2_prev_opponent_tag()) {
set_team2_prev_opponent_tag(from.team2_prev_opponent_tag());
}
if (from.has_team1_logo()) {
set_team1_logo(from.team1_logo());
}
if (from.has_team2_logo()) {
set_team2_logo(from.team2_logo());
}
if (from.has_team1_prev_opponent_logo()) {
set_team1_prev_opponent_logo(from.team1_prev_opponent_logo());
}
if (from.has_team2_prev_opponent_logo()) {
set_team2_prev_opponent_logo(from.team2_prev_opponent_logo());
}
}
if (from._has_bits_[16 / 32] & (0xffu << (16 % 32))) {
if (from.has_team1_prev_opponent_id()) {
set_team1_prev_opponent_id(from.team1_prev_opponent_id());
}
if (from.has_team2_prev_opponent_id()) {
set_team2_prev_opponent_id(from.team2_prev_opponent_id());
}
if (from.has_team1_prev_match_score()) {
set_team1_prev_match_score(from.team1_prev_match_score());
}
if (from.has_team1_prev_match_opponent_score()) {
set_team1_prev_match_opponent_score(from.team1_prev_match_opponent_score());
}
if (from.has_team2_prev_match_score()) {
set_team2_prev_match_score(from.team2_prev_match_score());
}
if (from.has_team2_prev_match_opponent_score()) {
set_team2_prev_match_opponent_score(from.team2_prev_match_opponent_score());
}
if (from.has_phase_type()) {
set_phase_type(from.phase_type());
}
if (from.has_team1_score()) {
set_team1_score(from.team1_score());
}
}
if (from._has_bits_[24 / 32] & (0xffu << (24 % 32))) {
if (from.has_team2_score()) {
set_team2_score(from.team2_score());
}
if (from.has_phase_id()) {
set_phase_id(from.phase_id());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTATournamentInfo_UpcomingMatch::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTATournamentInfo_UpcomingMatch::CopyFrom(const CMsgDOTATournamentInfo_UpcomingMatch& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTATournamentInfo_UpcomingMatch::IsInitialized() const {
return true;
}
void CMsgDOTATournamentInfo_UpcomingMatch::Swap(CMsgDOTATournamentInfo_UpcomingMatch* other) {
if (other != this) {
std::swap(series_id_, other->series_id_);
std::swap(team1_id_, other->team1_id_);
std::swap(team2_id_, other->team2_id_);
std::swap(bo_, other->bo_);
std::swap(stage_name_, other->stage_name_);
std::swap(start_time_, other->start_time_);
std::swap(winner_stage_, other->winner_stage_);
std::swap(loser_stage_, other->loser_stage_);
std::swap(team1_tag_, other->team1_tag_);
std::swap(team2_tag_, other->team2_tag_);
std::swap(team1_prev_opponent_tag_, other->team1_prev_opponent_tag_);
std::swap(team2_prev_opponent_tag_, other->team2_prev_opponent_tag_);
std::swap(team1_logo_, other->team1_logo_);
std::swap(team2_logo_, other->team2_logo_);
std::swap(team1_prev_opponent_logo_, other->team1_prev_opponent_logo_);
std::swap(team2_prev_opponent_logo_, other->team2_prev_opponent_logo_);
std::swap(team1_prev_opponent_id_, other->team1_prev_opponent_id_);
std::swap(team2_prev_opponent_id_, other->team2_prev_opponent_id_);
std::swap(team1_prev_match_score_, other->team1_prev_match_score_);
std::swap(team1_prev_match_opponent_score_, other->team1_prev_match_opponent_score_);
std::swap(team2_prev_match_score_, other->team2_prev_match_score_);
std::swap(team2_prev_match_opponent_score_, other->team2_prev_match_opponent_score_);
std::swap(phase_type_, other->phase_type_);
std::swap(team1_score_, other->team1_score_);
std::swap(team2_score_, other->team2_score_);
std::swap(phase_id_, other->phase_id_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTATournamentInfo_UpcomingMatch::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTATournamentInfo_UpcomingMatch_descriptor_;
metadata.reflection = CMsgDOTATournamentInfo_UpcomingMatch_reflection_;
return metadata;
}
// -------------------------------------------------------------------
#ifndef _MSC_VER
const int CMsgDOTATournamentInfo_News::kLinkFieldNumber;
const int CMsgDOTATournamentInfo_News::kTitleFieldNumber;
const int CMsgDOTATournamentInfo_News::kImageFieldNumber;
const int CMsgDOTATournamentInfo_News::kTimestampFieldNumber;
#endif // !_MSC_VER
CMsgDOTATournamentInfo_News::CMsgDOTATournamentInfo_News()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTATournamentInfo.News)
}
void CMsgDOTATournamentInfo_News::InitAsDefaultInstance() {
}
CMsgDOTATournamentInfo_News::CMsgDOTATournamentInfo_News(const CMsgDOTATournamentInfo_News& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTATournamentInfo.News)
}
void CMsgDOTATournamentInfo_News::SharedCtor() {
::google::protobuf::internal::GetEmptyString();
_cached_size_ = 0;
link_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
title_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
image_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
timestamp_ = 0u;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTATournamentInfo_News::~CMsgDOTATournamentInfo_News() {
// @@protoc_insertion_point(destructor:CMsgDOTATournamentInfo.News)
SharedDtor();
}
void CMsgDOTATournamentInfo_News::SharedDtor() {
if (link_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete link_;
}
if (title_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete title_;
}
if (image_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete image_;
}
if (this != default_instance_) {
}
}
void CMsgDOTATournamentInfo_News::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTATournamentInfo_News::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTATournamentInfo_News_descriptor_;
}
const CMsgDOTATournamentInfo_News& CMsgDOTATournamentInfo_News::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTATournamentInfo_News* CMsgDOTATournamentInfo_News::default_instance_ = NULL;
CMsgDOTATournamentInfo_News* CMsgDOTATournamentInfo_News::New() const {
return new CMsgDOTATournamentInfo_News;
}
void CMsgDOTATournamentInfo_News::Clear() {
if (_has_bits_[0 / 32] & 15) {
if (has_link()) {
if (link_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
link_->clear();
}
}
if (has_title()) {
if (title_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
title_->clear();
}
}
if (has_image()) {
if (image_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
image_->clear();
}
}
timestamp_ = 0u;
}
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTATournamentInfo_News::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTATournamentInfo.News)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional string link = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_link()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->link().data(), this->link().length(),
::google::protobuf::internal::WireFormat::PARSE,
"link");
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_title;
break;
}
// optional string title = 2;
case 2: {
if (tag == 18) {
parse_title:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_title()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->title().data(), this->title().length(),
::google::protobuf::internal::WireFormat::PARSE,
"title");
} else {
goto handle_unusual;
}
if (input->ExpectTag(26)) goto parse_image;
break;
}
// optional string image = 3;
case 3: {
if (tag == 26) {
parse_image:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_image()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->image().data(), this->image().length(),
::google::protobuf::internal::WireFormat::PARSE,
"image");
} else {
goto handle_unusual;
}
if (input->ExpectTag(32)) goto parse_timestamp;
break;
}
// optional uint32 timestamp = 4;
case 4: {
if (tag == 32) {
parse_timestamp:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, ×tamp_)));
set_has_timestamp();
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTATournamentInfo.News)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTATournamentInfo.News)
return false;
#undef DO_
}
void CMsgDOTATournamentInfo_News::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTATournamentInfo.News)
// optional string link = 1;
if (has_link()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->link().data(), this->link().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"link");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
1, this->link(), output);
}
// optional string title = 2;
if (has_title()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->title().data(), this->title().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"title");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
2, this->title(), output);
}
// optional string image = 3;
if (has_image()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->image().data(), this->image().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"image");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
3, this->image(), output);
}
// optional uint32 timestamp = 4;
if (has_timestamp()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(4, this->timestamp(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTATournamentInfo.News)
}
::google::protobuf::uint8* CMsgDOTATournamentInfo_News::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTATournamentInfo.News)
// optional string link = 1;
if (has_link()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->link().data(), this->link().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"link");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
1, this->link(), target);
}
// optional string title = 2;
if (has_title()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->title().data(), this->title().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"title");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
2, this->title(), target);
}
// optional string image = 3;
if (has_image()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->image().data(), this->image().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"image");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
3, this->image(), target);
}
// optional uint32 timestamp = 4;
if (has_timestamp()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(4, this->timestamp(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTATournamentInfo.News)
return target;
}
int CMsgDOTATournamentInfo_News::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional string link = 1;
if (has_link()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->link());
}
// optional string title = 2;
if (has_title()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->title());
}
// optional string image = 3;
if (has_image()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->image());
}
// optional uint32 timestamp = 4;
if (has_timestamp()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->timestamp());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTATournamentInfo_News::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTATournamentInfo_News* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTATournamentInfo_News*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTATournamentInfo_News::MergeFrom(const CMsgDOTATournamentInfo_News& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_link()) {
set_link(from.link());
}
if (from.has_title()) {
set_title(from.title());
}
if (from.has_image()) {
set_image(from.image());
}
if (from.has_timestamp()) {
set_timestamp(from.timestamp());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTATournamentInfo_News::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTATournamentInfo_News::CopyFrom(const CMsgDOTATournamentInfo_News& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTATournamentInfo_News::IsInitialized() const {
return true;
}
void CMsgDOTATournamentInfo_News::Swap(CMsgDOTATournamentInfo_News* other) {
if (other != this) {
std::swap(link_, other->link_);
std::swap(title_, other->title_);
std::swap(image_, other->image_);
std::swap(timestamp_, other->timestamp_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTATournamentInfo_News::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTATournamentInfo_News_descriptor_;
metadata.reflection = CMsgDOTATournamentInfo_News_reflection_;
return metadata;
}
// -------------------------------------------------------------------
#ifndef _MSC_VER
const int CMsgDOTATournamentInfo::kLeagueIdFieldNumber;
const int CMsgDOTATournamentInfo::kPhaseListFieldNumber;
const int CMsgDOTATournamentInfo::kTeamsListFieldNumber;
const int CMsgDOTATournamentInfo::kUpcomingMatchesListFieldNumber;
const int CMsgDOTATournamentInfo::kNewsListFieldNumber;
#endif // !_MSC_VER
CMsgDOTATournamentInfo::CMsgDOTATournamentInfo()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTATournamentInfo)
}
void CMsgDOTATournamentInfo::InitAsDefaultInstance() {
}
CMsgDOTATournamentInfo::CMsgDOTATournamentInfo(const CMsgDOTATournamentInfo& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTATournamentInfo)
}
void CMsgDOTATournamentInfo::SharedCtor() {
_cached_size_ = 0;
league_id_ = 0u;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTATournamentInfo::~CMsgDOTATournamentInfo() {
// @@protoc_insertion_point(destructor:CMsgDOTATournamentInfo)
SharedDtor();
}
void CMsgDOTATournamentInfo::SharedDtor() {
if (this != default_instance_) {
}
}
void CMsgDOTATournamentInfo::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTATournamentInfo::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTATournamentInfo_descriptor_;
}
const CMsgDOTATournamentInfo& CMsgDOTATournamentInfo::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTATournamentInfo* CMsgDOTATournamentInfo::default_instance_ = NULL;
CMsgDOTATournamentInfo* CMsgDOTATournamentInfo::New() const {
return new CMsgDOTATournamentInfo;
}
void CMsgDOTATournamentInfo::Clear() {
league_id_ = 0u;
phase_list_.Clear();
teams_list_.Clear();
upcoming_matches_list_.Clear();
news_list_.Clear();
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTATournamentInfo::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTATournamentInfo)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint32 league_id = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &league_id_)));
set_has_league_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_phase_list;
break;
}
// repeated .CMsgDOTATournamentInfo.Phase phase_list = 2;
case 2: {
if (tag == 18) {
parse_phase_list:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_phase_list()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_phase_list;
if (input->ExpectTag(26)) goto parse_teams_list;
break;
}
// repeated .CMsgDOTATournamentInfo.Team teams_list = 3;
case 3: {
if (tag == 26) {
parse_teams_list:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_teams_list()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(26)) goto parse_teams_list;
if (input->ExpectTag(34)) goto parse_upcoming_matches_list;
break;
}
// repeated .CMsgDOTATournamentInfo.UpcomingMatch upcoming_matches_list = 4;
case 4: {
if (tag == 34) {
parse_upcoming_matches_list:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_upcoming_matches_list()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(34)) goto parse_upcoming_matches_list;
if (input->ExpectTag(42)) goto parse_news_list;
break;
}
// repeated .CMsgDOTATournamentInfo.News news_list = 5;
case 5: {
if (tag == 42) {
parse_news_list:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_news_list()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(42)) goto parse_news_list;
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTATournamentInfo)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTATournamentInfo)
return false;
#undef DO_
}
void CMsgDOTATournamentInfo::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTATournamentInfo)
// optional uint32 league_id = 1;
if (has_league_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->league_id(), output);
}
// repeated .CMsgDOTATournamentInfo.Phase phase_list = 2;
for (int i = 0; i < this->phase_list_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, this->phase_list(i), output);
}
// repeated .CMsgDOTATournamentInfo.Team teams_list = 3;
for (int i = 0; i < this->teams_list_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, this->teams_list(i), output);
}
// repeated .CMsgDOTATournamentInfo.UpcomingMatch upcoming_matches_list = 4;
for (int i = 0; i < this->upcoming_matches_list_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
4, this->upcoming_matches_list(i), output);
}
// repeated .CMsgDOTATournamentInfo.News news_list = 5;
for (int i = 0; i < this->news_list_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
5, this->news_list(i), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTATournamentInfo)
}
::google::protobuf::uint8* CMsgDOTATournamentInfo::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTATournamentInfo)
// optional uint32 league_id = 1;
if (has_league_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->league_id(), target);
}
// repeated .CMsgDOTATournamentInfo.Phase phase_list = 2;
for (int i = 0; i < this->phase_list_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
2, this->phase_list(i), target);
}
// repeated .CMsgDOTATournamentInfo.Team teams_list = 3;
for (int i = 0; i < this->teams_list_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
3, this->teams_list(i), target);
}
// repeated .CMsgDOTATournamentInfo.UpcomingMatch upcoming_matches_list = 4;
for (int i = 0; i < this->upcoming_matches_list_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
4, this->upcoming_matches_list(i), target);
}
// repeated .CMsgDOTATournamentInfo.News news_list = 5;
for (int i = 0; i < this->news_list_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
5, this->news_list(i), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTATournamentInfo)
return target;
}
int CMsgDOTATournamentInfo::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional uint32 league_id = 1;
if (has_league_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->league_id());
}
}
// repeated .CMsgDOTATournamentInfo.Phase phase_list = 2;
total_size += 1 * this->phase_list_size();
for (int i = 0; i < this->phase_list_size(); i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->phase_list(i));
}
// repeated .CMsgDOTATournamentInfo.Team teams_list = 3;
total_size += 1 * this->teams_list_size();
for (int i = 0; i < this->teams_list_size(); i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->teams_list(i));
}
// repeated .CMsgDOTATournamentInfo.UpcomingMatch upcoming_matches_list = 4;
total_size += 1 * this->upcoming_matches_list_size();
for (int i = 0; i < this->upcoming_matches_list_size(); i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->upcoming_matches_list(i));
}
// repeated .CMsgDOTATournamentInfo.News news_list = 5;
total_size += 1 * this->news_list_size();
for (int i = 0; i < this->news_list_size(); i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->news_list(i));
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTATournamentInfo::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTATournamentInfo* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTATournamentInfo*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTATournamentInfo::MergeFrom(const CMsgDOTATournamentInfo& from) {
GOOGLE_CHECK_NE(&from, this);
phase_list_.MergeFrom(from.phase_list_);
teams_list_.MergeFrom(from.teams_list_);
upcoming_matches_list_.MergeFrom(from.upcoming_matches_list_);
news_list_.MergeFrom(from.news_list_);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_league_id()) {
set_league_id(from.league_id());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTATournamentInfo::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTATournamentInfo::CopyFrom(const CMsgDOTATournamentInfo& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTATournamentInfo::IsInitialized() const {
return true;
}
void CMsgDOTATournamentInfo::Swap(CMsgDOTATournamentInfo* other) {
if (other != this) {
std::swap(league_id_, other->league_id_);
phase_list_.Swap(&other->phase_list_);
teams_list_.Swap(&other->teams_list_);
upcoming_matches_list_.Swap(&other->upcoming_matches_list_);
news_list_.Swap(&other->news_list_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTATournamentInfo::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTATournamentInfo_descriptor_;
metadata.reflection = CMsgDOTATournamentInfo_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
#endif // !_MSC_VER
CMsgRequestWeekendTourneySchedule::CMsgRequestWeekendTourneySchedule()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgRequestWeekendTourneySchedule)
}
void CMsgRequestWeekendTourneySchedule::InitAsDefaultInstance() {
}
CMsgRequestWeekendTourneySchedule::CMsgRequestWeekendTourneySchedule(const CMsgRequestWeekendTourneySchedule& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgRequestWeekendTourneySchedule)
}
void CMsgRequestWeekendTourneySchedule::SharedCtor() {
_cached_size_ = 0;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgRequestWeekendTourneySchedule::~CMsgRequestWeekendTourneySchedule() {
// @@protoc_insertion_point(destructor:CMsgRequestWeekendTourneySchedule)
SharedDtor();
}
void CMsgRequestWeekendTourneySchedule::SharedDtor() {
if (this != default_instance_) {
}
}
void CMsgRequestWeekendTourneySchedule::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgRequestWeekendTourneySchedule::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgRequestWeekendTourneySchedule_descriptor_;
}
const CMsgRequestWeekendTourneySchedule& CMsgRequestWeekendTourneySchedule::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgRequestWeekendTourneySchedule* CMsgRequestWeekendTourneySchedule::default_instance_ = NULL;
CMsgRequestWeekendTourneySchedule* CMsgRequestWeekendTourneySchedule::New() const {
return new CMsgRequestWeekendTourneySchedule;
}
void CMsgRequestWeekendTourneySchedule::Clear() {
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgRequestWeekendTourneySchedule::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgRequestWeekendTourneySchedule)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
}
success:
// @@protoc_insertion_point(parse_success:CMsgRequestWeekendTourneySchedule)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgRequestWeekendTourneySchedule)
return false;
#undef DO_
}
void CMsgRequestWeekendTourneySchedule::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgRequestWeekendTourneySchedule)
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgRequestWeekendTourneySchedule)
}
::google::protobuf::uint8* CMsgRequestWeekendTourneySchedule::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgRequestWeekendTourneySchedule)
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgRequestWeekendTourneySchedule)
return target;
}
int CMsgRequestWeekendTourneySchedule::ByteSize() const {
int total_size = 0;
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgRequestWeekendTourneySchedule::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgRequestWeekendTourneySchedule* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgRequestWeekendTourneySchedule*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgRequestWeekendTourneySchedule::MergeFrom(const CMsgRequestWeekendTourneySchedule& from) {
GOOGLE_CHECK_NE(&from, this);
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgRequestWeekendTourneySchedule::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgRequestWeekendTourneySchedule::CopyFrom(const CMsgRequestWeekendTourneySchedule& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgRequestWeekendTourneySchedule::IsInitialized() const {
return true;
}
void CMsgRequestWeekendTourneySchedule::Swap(CMsgRequestWeekendTourneySchedule* other) {
if (other != this) {
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgRequestWeekendTourneySchedule::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgRequestWeekendTourneySchedule_descriptor_;
metadata.reflection = CMsgRequestWeekendTourneySchedule_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int CMsgWeekendTourneySchedule_Division::kDivisionCodeFieldNumber;
const int CMsgWeekendTourneySchedule_Division::kTimeWindowOpenFieldNumber;
const int CMsgWeekendTourneySchedule_Division::kTimeWindowCloseFieldNumber;
const int CMsgWeekendTourneySchedule_Division::kTimeWindowOpenNextFieldNumber;
#endif // !_MSC_VER
CMsgWeekendTourneySchedule_Division::CMsgWeekendTourneySchedule_Division()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgWeekendTourneySchedule.Division)
}
void CMsgWeekendTourneySchedule_Division::InitAsDefaultInstance() {
}
CMsgWeekendTourneySchedule_Division::CMsgWeekendTourneySchedule_Division(const CMsgWeekendTourneySchedule_Division& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgWeekendTourneySchedule.Division)
}
void CMsgWeekendTourneySchedule_Division::SharedCtor() {
_cached_size_ = 0;
division_code_ = 0u;
time_window_open_ = 0u;
time_window_close_ = 0u;
time_window_open_next_ = 0u;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgWeekendTourneySchedule_Division::~CMsgWeekendTourneySchedule_Division() {
// @@protoc_insertion_point(destructor:CMsgWeekendTourneySchedule.Division)
SharedDtor();
}
void CMsgWeekendTourneySchedule_Division::SharedDtor() {
if (this != default_instance_) {
}
}
void CMsgWeekendTourneySchedule_Division::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgWeekendTourneySchedule_Division::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgWeekendTourneySchedule_Division_descriptor_;
}
const CMsgWeekendTourneySchedule_Division& CMsgWeekendTourneySchedule_Division::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgWeekendTourneySchedule_Division* CMsgWeekendTourneySchedule_Division::default_instance_ = NULL;
CMsgWeekendTourneySchedule_Division* CMsgWeekendTourneySchedule_Division::New() const {
return new CMsgWeekendTourneySchedule_Division;
}
void CMsgWeekendTourneySchedule_Division::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<CMsgWeekendTourneySchedule_Division*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
ZR_(division_code_, time_window_open_next_);
#undef OFFSET_OF_FIELD_
#undef ZR_
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgWeekendTourneySchedule_Division::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgWeekendTourneySchedule.Division)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint32 division_code = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &division_code_)));
set_has_division_code();
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_time_window_open;
break;
}
// optional uint32 time_window_open = 2;
case 2: {
if (tag == 16) {
parse_time_window_open:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &time_window_open_)));
set_has_time_window_open();
} else {
goto handle_unusual;
}
if (input->ExpectTag(24)) goto parse_time_window_close;
break;
}
// optional uint32 time_window_close = 3;
case 3: {
if (tag == 24) {
parse_time_window_close:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &time_window_close_)));
set_has_time_window_close();
} else {
goto handle_unusual;
}
if (input->ExpectTag(32)) goto parse_time_window_open_next;
break;
}
// optional uint32 time_window_open_next = 4;
case 4: {
if (tag == 32) {
parse_time_window_open_next:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &time_window_open_next_)));
set_has_time_window_open_next();
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgWeekendTourneySchedule.Division)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgWeekendTourneySchedule.Division)
return false;
#undef DO_
}
void CMsgWeekendTourneySchedule_Division::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgWeekendTourneySchedule.Division)
// optional uint32 division_code = 1;
if (has_division_code()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->division_code(), output);
}
// optional uint32 time_window_open = 2;
if (has_time_window_open()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->time_window_open(), output);
}
// optional uint32 time_window_close = 3;
if (has_time_window_close()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(3, this->time_window_close(), output);
}
// optional uint32 time_window_open_next = 4;
if (has_time_window_open_next()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(4, this->time_window_open_next(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgWeekendTourneySchedule.Division)
}
::google::protobuf::uint8* CMsgWeekendTourneySchedule_Division::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgWeekendTourneySchedule.Division)
// optional uint32 division_code = 1;
if (has_division_code()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->division_code(), target);
}
// optional uint32 time_window_open = 2;
if (has_time_window_open()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->time_window_open(), target);
}
// optional uint32 time_window_close = 3;
if (has_time_window_close()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(3, this->time_window_close(), target);
}
// optional uint32 time_window_open_next = 4;
if (has_time_window_open_next()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(4, this->time_window_open_next(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgWeekendTourneySchedule.Division)
return target;
}
int CMsgWeekendTourneySchedule_Division::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional uint32 division_code = 1;
if (has_division_code()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->division_code());
}
// optional uint32 time_window_open = 2;
if (has_time_window_open()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->time_window_open());
}
// optional uint32 time_window_close = 3;
if (has_time_window_close()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->time_window_close());
}
// optional uint32 time_window_open_next = 4;
if (has_time_window_open_next()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->time_window_open_next());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgWeekendTourneySchedule_Division::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgWeekendTourneySchedule_Division* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgWeekendTourneySchedule_Division*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgWeekendTourneySchedule_Division::MergeFrom(const CMsgWeekendTourneySchedule_Division& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_division_code()) {
set_division_code(from.division_code());
}
if (from.has_time_window_open()) {
set_time_window_open(from.time_window_open());
}
if (from.has_time_window_close()) {
set_time_window_close(from.time_window_close());
}
if (from.has_time_window_open_next()) {
set_time_window_open_next(from.time_window_open_next());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgWeekendTourneySchedule_Division::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgWeekendTourneySchedule_Division::CopyFrom(const CMsgWeekendTourneySchedule_Division& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgWeekendTourneySchedule_Division::IsInitialized() const {
return true;
}
void CMsgWeekendTourneySchedule_Division::Swap(CMsgWeekendTourneySchedule_Division* other) {
if (other != this) {
std::swap(division_code_, other->division_code_);
std::swap(time_window_open_, other->time_window_open_);
std::swap(time_window_close_, other->time_window_close_);
std::swap(time_window_open_next_, other->time_window_open_next_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgWeekendTourneySchedule_Division::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgWeekendTourneySchedule_Division_descriptor_;
metadata.reflection = CMsgWeekendTourneySchedule_Division_reflection_;
return metadata;
}
// -------------------------------------------------------------------
#ifndef _MSC_VER
const int CMsgWeekendTourneySchedule::kDivisionsFieldNumber;
#endif // !_MSC_VER
CMsgWeekendTourneySchedule::CMsgWeekendTourneySchedule()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgWeekendTourneySchedule)
}
void CMsgWeekendTourneySchedule::InitAsDefaultInstance() {
}
CMsgWeekendTourneySchedule::CMsgWeekendTourneySchedule(const CMsgWeekendTourneySchedule& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgWeekendTourneySchedule)
}
void CMsgWeekendTourneySchedule::SharedCtor() {
_cached_size_ = 0;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgWeekendTourneySchedule::~CMsgWeekendTourneySchedule() {
// @@protoc_insertion_point(destructor:CMsgWeekendTourneySchedule)
SharedDtor();
}
void CMsgWeekendTourneySchedule::SharedDtor() {
if (this != default_instance_) {
}
}
void CMsgWeekendTourneySchedule::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgWeekendTourneySchedule::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgWeekendTourneySchedule_descriptor_;
}
const CMsgWeekendTourneySchedule& CMsgWeekendTourneySchedule::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgWeekendTourneySchedule* CMsgWeekendTourneySchedule::default_instance_ = NULL;
CMsgWeekendTourneySchedule* CMsgWeekendTourneySchedule::New() const {
return new CMsgWeekendTourneySchedule;
}
void CMsgWeekendTourneySchedule::Clear() {
divisions_.Clear();
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgWeekendTourneySchedule::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgWeekendTourneySchedule)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// repeated .CMsgWeekendTourneySchedule.Division divisions = 1;
case 1: {
if (tag == 10) {
parse_divisions:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_divisions()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(10)) goto parse_divisions;
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgWeekendTourneySchedule)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgWeekendTourneySchedule)
return false;
#undef DO_
}
void CMsgWeekendTourneySchedule::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgWeekendTourneySchedule)
// repeated .CMsgWeekendTourneySchedule.Division divisions = 1;
for (int i = 0; i < this->divisions_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, this->divisions(i), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgWeekendTourneySchedule)
}
::google::protobuf::uint8* CMsgWeekendTourneySchedule::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgWeekendTourneySchedule)
// repeated .CMsgWeekendTourneySchedule.Division divisions = 1;
for (int i = 0; i < this->divisions_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
1, this->divisions(i), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgWeekendTourneySchedule)
return target;
}
int CMsgWeekendTourneySchedule::ByteSize() const {
int total_size = 0;
// repeated .CMsgWeekendTourneySchedule.Division divisions = 1;
total_size += 1 * this->divisions_size();
for (int i = 0; i < this->divisions_size(); i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->divisions(i));
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgWeekendTourneySchedule::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgWeekendTourneySchedule* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgWeekendTourneySchedule*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgWeekendTourneySchedule::MergeFrom(const CMsgWeekendTourneySchedule& from) {
GOOGLE_CHECK_NE(&from, this);
divisions_.MergeFrom(from.divisions_);
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgWeekendTourneySchedule::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgWeekendTourneySchedule::CopyFrom(const CMsgWeekendTourneySchedule& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgWeekendTourneySchedule::IsInitialized() const {
return true;
}
void CMsgWeekendTourneySchedule::Swap(CMsgWeekendTourneySchedule* other) {
if (other != this) {
divisions_.Swap(&other->divisions_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgWeekendTourneySchedule::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgWeekendTourneySchedule_descriptor_;
metadata.reflection = CMsgWeekendTourneySchedule_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int CMsgWeekendTourneyOpts::kParticipatingFieldNumber;
const int CMsgWeekendTourneyOpts::kDivisionIdFieldNumber;
const int CMsgWeekendTourneyOpts::kBuyinFieldNumber;
const int CMsgWeekendTourneyOpts::kSkillLevelFieldNumber;
const int CMsgWeekendTourneyOpts::kMatchGroupsFieldNumber;
const int CMsgWeekendTourneyOpts::kTeamIdFieldNumber;
const int CMsgWeekendTourneyOpts::kPickupTeamNameFieldNumber;
const int CMsgWeekendTourneyOpts::kPickupTeamLogoFieldNumber;
#endif // !_MSC_VER
CMsgWeekendTourneyOpts::CMsgWeekendTourneyOpts()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgWeekendTourneyOpts)
}
void CMsgWeekendTourneyOpts::InitAsDefaultInstance() {
}
CMsgWeekendTourneyOpts::CMsgWeekendTourneyOpts(const CMsgWeekendTourneyOpts& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgWeekendTourneyOpts)
}
void CMsgWeekendTourneyOpts::SharedCtor() {
::google::protobuf::internal::GetEmptyString();
_cached_size_ = 0;
participating_ = false;
division_id_ = 0u;
buyin_ = 0u;
skill_level_ = 0u;
match_groups_ = 0u;
team_id_ = 0u;
pickup_team_name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
pickup_team_logo_ = GOOGLE_ULONGLONG(0);
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgWeekendTourneyOpts::~CMsgWeekendTourneyOpts() {
// @@protoc_insertion_point(destructor:CMsgWeekendTourneyOpts)
SharedDtor();
}
void CMsgWeekendTourneyOpts::SharedDtor() {
if (pickup_team_name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete pickup_team_name_;
}
if (this != default_instance_) {
}
}
void CMsgWeekendTourneyOpts::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgWeekendTourneyOpts::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgWeekendTourneyOpts_descriptor_;
}
const CMsgWeekendTourneyOpts& CMsgWeekendTourneyOpts::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgWeekendTourneyOpts* CMsgWeekendTourneyOpts::default_instance_ = NULL;
CMsgWeekendTourneyOpts* CMsgWeekendTourneyOpts::New() const {
return new CMsgWeekendTourneyOpts;
}
void CMsgWeekendTourneyOpts::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<CMsgWeekendTourneyOpts*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
if (_has_bits_[0 / 32] & 255) {
ZR_(participating_, team_id_);
if (has_pickup_team_name()) {
if (pickup_team_name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
pickup_team_name_->clear();
}
}
pickup_team_logo_ = GOOGLE_ULONGLONG(0);
}
#undef OFFSET_OF_FIELD_
#undef ZR_
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgWeekendTourneyOpts::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgWeekendTourneyOpts)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional bool participating = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &participating_)));
set_has_participating();
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_division_id;
break;
}
// optional uint32 division_id = 2;
case 2: {
if (tag == 16) {
parse_division_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &division_id_)));
set_has_division_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(24)) goto parse_buyin;
break;
}
// optional uint32 buyin = 3;
case 3: {
if (tag == 24) {
parse_buyin:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &buyin_)));
set_has_buyin();
} else {
goto handle_unusual;
}
if (input->ExpectTag(32)) goto parse_skill_level;
break;
}
// optional uint32 skill_level = 4;
case 4: {
if (tag == 32) {
parse_skill_level:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &skill_level_)));
set_has_skill_level();
} else {
goto handle_unusual;
}
if (input->ExpectTag(40)) goto parse_match_groups;
break;
}
// optional uint32 match_groups = 5;
case 5: {
if (tag == 40) {
parse_match_groups:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &match_groups_)));
set_has_match_groups();
} else {
goto handle_unusual;
}
if (input->ExpectTag(48)) goto parse_team_id;
break;
}
// optional uint32 team_id = 6;
case 6: {
if (tag == 48) {
parse_team_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &team_id_)));
set_has_team_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(58)) goto parse_pickup_team_name;
break;
}
// optional string pickup_team_name = 7;
case 7: {
if (tag == 58) {
parse_pickup_team_name:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_pickup_team_name()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->pickup_team_name().data(), this->pickup_team_name().length(),
::google::protobuf::internal::WireFormat::PARSE,
"pickup_team_name");
} else {
goto handle_unusual;
}
if (input->ExpectTag(64)) goto parse_pickup_team_logo;
break;
}
// optional uint64 pickup_team_logo = 8;
case 8: {
if (tag == 64) {
parse_pickup_team_logo:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &pickup_team_logo_)));
set_has_pickup_team_logo();
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgWeekendTourneyOpts)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgWeekendTourneyOpts)
return false;
#undef DO_
}
void CMsgWeekendTourneyOpts::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgWeekendTourneyOpts)
// optional bool participating = 1;
if (has_participating()) {
::google::protobuf::internal::WireFormatLite::WriteBool(1, this->participating(), output);
}
// optional uint32 division_id = 2;
if (has_division_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->division_id(), output);
}
// optional uint32 buyin = 3;
if (has_buyin()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(3, this->buyin(), output);
}
// optional uint32 skill_level = 4;
if (has_skill_level()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(4, this->skill_level(), output);
}
// optional uint32 match_groups = 5;
if (has_match_groups()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(5, this->match_groups(), output);
}
// optional uint32 team_id = 6;
if (has_team_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(6, this->team_id(), output);
}
// optional string pickup_team_name = 7;
if (has_pickup_team_name()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->pickup_team_name().data(), this->pickup_team_name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"pickup_team_name");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
7, this->pickup_team_name(), output);
}
// optional uint64 pickup_team_logo = 8;
if (has_pickup_team_logo()) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(8, this->pickup_team_logo(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgWeekendTourneyOpts)
}
::google::protobuf::uint8* CMsgWeekendTourneyOpts::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgWeekendTourneyOpts)
// optional bool participating = 1;
if (has_participating()) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(1, this->participating(), target);
}
// optional uint32 division_id = 2;
if (has_division_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->division_id(), target);
}
// optional uint32 buyin = 3;
if (has_buyin()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(3, this->buyin(), target);
}
// optional uint32 skill_level = 4;
if (has_skill_level()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(4, this->skill_level(), target);
}
// optional uint32 match_groups = 5;
if (has_match_groups()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(5, this->match_groups(), target);
}
// optional uint32 team_id = 6;
if (has_team_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(6, this->team_id(), target);
}
// optional string pickup_team_name = 7;
if (has_pickup_team_name()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->pickup_team_name().data(), this->pickup_team_name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"pickup_team_name");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
7, this->pickup_team_name(), target);
}
// optional uint64 pickup_team_logo = 8;
if (has_pickup_team_logo()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(8, this->pickup_team_logo(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgWeekendTourneyOpts)
return target;
}
int CMsgWeekendTourneyOpts::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional bool participating = 1;
if (has_participating()) {
total_size += 1 + 1;
}
// optional uint32 division_id = 2;
if (has_division_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->division_id());
}
// optional uint32 buyin = 3;
if (has_buyin()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->buyin());
}
// optional uint32 skill_level = 4;
if (has_skill_level()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->skill_level());
}
// optional uint32 match_groups = 5;
if (has_match_groups()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->match_groups());
}
// optional uint32 team_id = 6;
if (has_team_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->team_id());
}
// optional string pickup_team_name = 7;
if (has_pickup_team_name()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->pickup_team_name());
}
// optional uint64 pickup_team_logo = 8;
if (has_pickup_team_logo()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->pickup_team_logo());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgWeekendTourneyOpts::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgWeekendTourneyOpts* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgWeekendTourneyOpts*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgWeekendTourneyOpts::MergeFrom(const CMsgWeekendTourneyOpts& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_participating()) {
set_participating(from.participating());
}
if (from.has_division_id()) {
set_division_id(from.division_id());
}
if (from.has_buyin()) {
set_buyin(from.buyin());
}
if (from.has_skill_level()) {
set_skill_level(from.skill_level());
}
if (from.has_match_groups()) {
set_match_groups(from.match_groups());
}
if (from.has_team_id()) {
set_team_id(from.team_id());
}
if (from.has_pickup_team_name()) {
set_pickup_team_name(from.pickup_team_name());
}
if (from.has_pickup_team_logo()) {
set_pickup_team_logo(from.pickup_team_logo());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgWeekendTourneyOpts::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgWeekendTourneyOpts::CopyFrom(const CMsgWeekendTourneyOpts& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgWeekendTourneyOpts::IsInitialized() const {
return true;
}
void CMsgWeekendTourneyOpts::Swap(CMsgWeekendTourneyOpts* other) {
if (other != this) {
std::swap(participating_, other->participating_);
std::swap(division_id_, other->division_id_);
std::swap(buyin_, other->buyin_);
std::swap(skill_level_, other->skill_level_);
std::swap(match_groups_, other->match_groups_);
std::swap(team_id_, other->team_id_);
std::swap(pickup_team_name_, other->pickup_team_name_);
std::swap(pickup_team_logo_, other->pickup_team_logo_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgWeekendTourneyOpts::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgWeekendTourneyOpts_descriptor_;
metadata.reflection = CMsgWeekendTourneyOpts_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
#endif // !_MSC_VER
CMsgWeekendTourneyLeave::CMsgWeekendTourneyLeave()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgWeekendTourneyLeave)
}
void CMsgWeekendTourneyLeave::InitAsDefaultInstance() {
}
CMsgWeekendTourneyLeave::CMsgWeekendTourneyLeave(const CMsgWeekendTourneyLeave& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgWeekendTourneyLeave)
}
void CMsgWeekendTourneyLeave::SharedCtor() {
_cached_size_ = 0;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgWeekendTourneyLeave::~CMsgWeekendTourneyLeave() {
// @@protoc_insertion_point(destructor:CMsgWeekendTourneyLeave)
SharedDtor();
}
void CMsgWeekendTourneyLeave::SharedDtor() {
if (this != default_instance_) {
}
}
void CMsgWeekendTourneyLeave::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgWeekendTourneyLeave::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgWeekendTourneyLeave_descriptor_;
}
const CMsgWeekendTourneyLeave& CMsgWeekendTourneyLeave::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgWeekendTourneyLeave* CMsgWeekendTourneyLeave::default_instance_ = NULL;
CMsgWeekendTourneyLeave* CMsgWeekendTourneyLeave::New() const {
return new CMsgWeekendTourneyLeave;
}
void CMsgWeekendTourneyLeave::Clear() {
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgWeekendTourneyLeave::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgWeekendTourneyLeave)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
}
success:
// @@protoc_insertion_point(parse_success:CMsgWeekendTourneyLeave)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgWeekendTourneyLeave)
return false;
#undef DO_
}
void CMsgWeekendTourneyLeave::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgWeekendTourneyLeave)
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgWeekendTourneyLeave)
}
::google::protobuf::uint8* CMsgWeekendTourneyLeave::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgWeekendTourneyLeave)
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgWeekendTourneyLeave)
return target;
}
int CMsgWeekendTourneyLeave::ByteSize() const {
int total_size = 0;
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgWeekendTourneyLeave::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgWeekendTourneyLeave* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgWeekendTourneyLeave*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgWeekendTourneyLeave::MergeFrom(const CMsgWeekendTourneyLeave& from) {
GOOGLE_CHECK_NE(&from, this);
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgWeekendTourneyLeave::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgWeekendTourneyLeave::CopyFrom(const CMsgWeekendTourneyLeave& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgWeekendTourneyLeave::IsInitialized() const {
return true;
}
void CMsgWeekendTourneyLeave::Swap(CMsgWeekendTourneyLeave* other) {
if (other != this) {
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgWeekendTourneyLeave::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgWeekendTourneyLeave_descriptor_;
metadata.reflection = CMsgWeekendTourneyLeave_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int CMsgDOTATournament_Team::kTeamGidFieldNumber;
const int CMsgDOTATournament_Team::kNodeOrStateFieldNumber;
const int CMsgDOTATournament_Team::kPlayersFieldNumber;
const int CMsgDOTATournament_Team::kPlayerBuyinFieldNumber;
const int CMsgDOTATournament_Team::kPlayerSkillLevelFieldNumber;
const int CMsgDOTATournament_Team::kMatchGroupMaskFieldNumber;
const int CMsgDOTATournament_Team::kTeamIdFieldNumber;
const int CMsgDOTATournament_Team::kTeamNameFieldNumber;
const int CMsgDOTATournament_Team::kTeamBaseLogoFieldNumber;
const int CMsgDOTATournament_Team::kTeamUiLogoFieldNumber;
const int CMsgDOTATournament_Team::kTeamDateFieldNumber;
#endif // !_MSC_VER
CMsgDOTATournament_Team::CMsgDOTATournament_Team()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTATournament.Team)
}
void CMsgDOTATournament_Team::InitAsDefaultInstance() {
}
CMsgDOTATournament_Team::CMsgDOTATournament_Team(const CMsgDOTATournament_Team& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTATournament.Team)
}
void CMsgDOTATournament_Team::SharedCtor() {
::google::protobuf::internal::GetEmptyString();
_cached_size_ = 0;
team_gid_ = GOOGLE_ULONGLONG(0);
node_or_state_ = 0u;
match_group_mask_ = 0u;
team_id_ = 0u;
team_name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
team_base_logo_ = GOOGLE_ULONGLONG(0);
team_ui_logo_ = GOOGLE_ULONGLONG(0);
team_date_ = 0u;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTATournament_Team::~CMsgDOTATournament_Team() {
// @@protoc_insertion_point(destructor:CMsgDOTATournament.Team)
SharedDtor();
}
void CMsgDOTATournament_Team::SharedDtor() {
if (team_name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete team_name_;
}
if (this != default_instance_) {
}
}
void CMsgDOTATournament_Team::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTATournament_Team::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTATournament_Team_descriptor_;
}
const CMsgDOTATournament_Team& CMsgDOTATournament_Team::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTATournament_Team* CMsgDOTATournament_Team::default_instance_ = NULL;
CMsgDOTATournament_Team* CMsgDOTATournament_Team::New() const {
return new CMsgDOTATournament_Team;
}
void CMsgDOTATournament_Team::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<CMsgDOTATournament_Team*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
if (_has_bits_[0 / 32] & 227) {
ZR_(node_or_state_, match_group_mask_);
team_gid_ = GOOGLE_ULONGLONG(0);
team_id_ = 0u;
if (has_team_name()) {
if (team_name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
team_name_->clear();
}
}
}
if (_has_bits_[8 / 32] & 1792) {
ZR_(team_date_, team_ui_logo_);
team_base_logo_ = GOOGLE_ULONGLONG(0);
}
#undef OFFSET_OF_FIELD_
#undef ZR_
players_.Clear();
player_buyin_.Clear();
player_skill_level_.Clear();
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTATournament_Team::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTATournament.Team)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional fixed64 team_gid = 1;
case 1: {
if (tag == 9) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_FIXED64>(
input, &team_gid_)));
set_has_team_gid();
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_node_or_state;
break;
}
// optional uint32 node_or_state = 2;
case 2: {
if (tag == 16) {
parse_node_or_state:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &node_or_state_)));
set_has_node_or_state();
} else {
goto handle_unusual;
}
if (input->ExpectTag(26)) goto parse_players;
break;
}
// repeated uint32 players = 3 [packed = true];
case 3: {
if (tag == 26) {
parse_players:
DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, this->mutable_players())));
} else if (tag == 24) {
DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
1, 26, input, this->mutable_players())));
} else {
goto handle_unusual;
}
if (input->ExpectTag(32)) goto parse_team_id;
break;
}
// optional uint32 team_id = 4;
case 4: {
if (tag == 32) {
parse_team_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &team_id_)));
set_has_team_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(42)) goto parse_team_name;
break;
}
// optional string team_name = 5;
case 5: {
if (tag == 42) {
parse_team_name:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_team_name()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->team_name().data(), this->team_name().length(),
::google::protobuf::internal::WireFormat::PARSE,
"team_name");
} else {
goto handle_unusual;
}
if (input->ExpectTag(56)) goto parse_team_base_logo;
break;
}
// optional uint64 team_base_logo = 7;
case 7: {
if (tag == 56) {
parse_team_base_logo:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &team_base_logo_)));
set_has_team_base_logo();
} else {
goto handle_unusual;
}
if (input->ExpectTag(64)) goto parse_team_ui_logo;
break;
}
// optional uint64 team_ui_logo = 8;
case 8: {
if (tag == 64) {
parse_team_ui_logo:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &team_ui_logo_)));
set_has_team_ui_logo();
} else {
goto handle_unusual;
}
if (input->ExpectTag(74)) goto parse_player_buyin;
break;
}
// repeated uint32 player_buyin = 9 [packed = true];
case 9: {
if (tag == 74) {
parse_player_buyin:
DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, this->mutable_player_buyin())));
} else if (tag == 72) {
DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
1, 74, input, this->mutable_player_buyin())));
} else {
goto handle_unusual;
}
if (input->ExpectTag(82)) goto parse_player_skill_level;
break;
}
// repeated uint32 player_skill_level = 10 [packed = true];
case 10: {
if (tag == 82) {
parse_player_skill_level:
DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, this->mutable_player_skill_level())));
} else if (tag == 80) {
DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
1, 82, input, this->mutable_player_skill_level())));
} else {
goto handle_unusual;
}
if (input->ExpectTag(88)) goto parse_team_date;
break;
}
// optional uint32 team_date = 11;
case 11: {
if (tag == 88) {
parse_team_date:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &team_date_)));
set_has_team_date();
} else {
goto handle_unusual;
}
if (input->ExpectTag(96)) goto parse_match_group_mask;
break;
}
// optional uint32 match_group_mask = 12;
case 12: {
if (tag == 96) {
parse_match_group_mask:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &match_group_mask_)));
set_has_match_group_mask();
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTATournament.Team)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTATournament.Team)
return false;
#undef DO_
}
void CMsgDOTATournament_Team::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTATournament.Team)
// optional fixed64 team_gid = 1;
if (has_team_gid()) {
::google::protobuf::internal::WireFormatLite::WriteFixed64(1, this->team_gid(), output);
}
// optional uint32 node_or_state = 2;
if (has_node_or_state()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->node_or_state(), output);
}
// repeated uint32 players = 3 [packed = true];
if (this->players_size() > 0) {
::google::protobuf::internal::WireFormatLite::WriteTag(3, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output);
output->WriteVarint32(_players_cached_byte_size_);
}
for (int i = 0; i < this->players_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteUInt32NoTag(
this->players(i), output);
}
// optional uint32 team_id = 4;
if (has_team_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(4, this->team_id(), output);
}
// optional string team_name = 5;
if (has_team_name()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->team_name().data(), this->team_name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"team_name");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
5, this->team_name(), output);
}
// optional uint64 team_base_logo = 7;
if (has_team_base_logo()) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(7, this->team_base_logo(), output);
}
// optional uint64 team_ui_logo = 8;
if (has_team_ui_logo()) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(8, this->team_ui_logo(), output);
}
// repeated uint32 player_buyin = 9 [packed = true];
if (this->player_buyin_size() > 0) {
::google::protobuf::internal::WireFormatLite::WriteTag(9, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output);
output->WriteVarint32(_player_buyin_cached_byte_size_);
}
for (int i = 0; i < this->player_buyin_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteUInt32NoTag(
this->player_buyin(i), output);
}
// repeated uint32 player_skill_level = 10 [packed = true];
if (this->player_skill_level_size() > 0) {
::google::protobuf::internal::WireFormatLite::WriteTag(10, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output);
output->WriteVarint32(_player_skill_level_cached_byte_size_);
}
for (int i = 0; i < this->player_skill_level_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteUInt32NoTag(
this->player_skill_level(i), output);
}
// optional uint32 team_date = 11;
if (has_team_date()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(11, this->team_date(), output);
}
// optional uint32 match_group_mask = 12;
if (has_match_group_mask()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(12, this->match_group_mask(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTATournament.Team)
}
::google::protobuf::uint8* CMsgDOTATournament_Team::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTATournament.Team)
// optional fixed64 team_gid = 1;
if (has_team_gid()) {
target = ::google::protobuf::internal::WireFormatLite::WriteFixed64ToArray(1, this->team_gid(), target);
}
// optional uint32 node_or_state = 2;
if (has_node_or_state()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->node_or_state(), target);
}
// repeated uint32 players = 3 [packed = true];
if (this->players_size() > 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray(
3,
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
target);
target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray(
_players_cached_byte_size_, target);
}
for (int i = 0; i < this->players_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteUInt32NoTagToArray(this->players(i), target);
}
// optional uint32 team_id = 4;
if (has_team_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(4, this->team_id(), target);
}
// optional string team_name = 5;
if (has_team_name()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->team_name().data(), this->team_name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"team_name");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
5, this->team_name(), target);
}
// optional uint64 team_base_logo = 7;
if (has_team_base_logo()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(7, this->team_base_logo(), target);
}
// optional uint64 team_ui_logo = 8;
if (has_team_ui_logo()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(8, this->team_ui_logo(), target);
}
// repeated uint32 player_buyin = 9 [packed = true];
if (this->player_buyin_size() > 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray(
9,
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
target);
target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray(
_player_buyin_cached_byte_size_, target);
}
for (int i = 0; i < this->player_buyin_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteUInt32NoTagToArray(this->player_buyin(i), target);
}
// repeated uint32 player_skill_level = 10 [packed = true];
if (this->player_skill_level_size() > 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray(
10,
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
target);
target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray(
_player_skill_level_cached_byte_size_, target);
}
for (int i = 0; i < this->player_skill_level_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteUInt32NoTagToArray(this->player_skill_level(i), target);
}
// optional uint32 team_date = 11;
if (has_team_date()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(11, this->team_date(), target);
}
// optional uint32 match_group_mask = 12;
if (has_match_group_mask()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(12, this->match_group_mask(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTATournament.Team)
return target;
}
int CMsgDOTATournament_Team::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional fixed64 team_gid = 1;
if (has_team_gid()) {
total_size += 1 + 8;
}
// optional uint32 node_or_state = 2;
if (has_node_or_state()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->node_or_state());
}
// optional uint32 match_group_mask = 12;
if (has_match_group_mask()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->match_group_mask());
}
// optional uint32 team_id = 4;
if (has_team_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->team_id());
}
// optional string team_name = 5;
if (has_team_name()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->team_name());
}
}
if (_has_bits_[8 / 32] & (0xffu << (8 % 32))) {
// optional uint64 team_base_logo = 7;
if (has_team_base_logo()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->team_base_logo());
}
// optional uint64 team_ui_logo = 8;
if (has_team_ui_logo()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->team_ui_logo());
}
// optional uint32 team_date = 11;
if (has_team_date()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->team_date());
}
}
// repeated uint32 players = 3 [packed = true];
{
int data_size = 0;
for (int i = 0; i < this->players_size(); i++) {
data_size += ::google::protobuf::internal::WireFormatLite::
UInt32Size(this->players(i));
}
if (data_size > 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::Int32Size(data_size);
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_players_cached_byte_size_ = data_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
total_size += data_size;
}
// repeated uint32 player_buyin = 9 [packed = true];
{
int data_size = 0;
for (int i = 0; i < this->player_buyin_size(); i++) {
data_size += ::google::protobuf::internal::WireFormatLite::
UInt32Size(this->player_buyin(i));
}
if (data_size > 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::Int32Size(data_size);
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_player_buyin_cached_byte_size_ = data_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
total_size += data_size;
}
// repeated uint32 player_skill_level = 10 [packed = true];
{
int data_size = 0;
for (int i = 0; i < this->player_skill_level_size(); i++) {
data_size += ::google::protobuf::internal::WireFormatLite::
UInt32Size(this->player_skill_level(i));
}
if (data_size > 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::Int32Size(data_size);
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_player_skill_level_cached_byte_size_ = data_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
total_size += data_size;
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTATournament_Team::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTATournament_Team* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTATournament_Team*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTATournament_Team::MergeFrom(const CMsgDOTATournament_Team& from) {
GOOGLE_CHECK_NE(&from, this);
players_.MergeFrom(from.players_);
player_buyin_.MergeFrom(from.player_buyin_);
player_skill_level_.MergeFrom(from.player_skill_level_);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_team_gid()) {
set_team_gid(from.team_gid());
}
if (from.has_node_or_state()) {
set_node_or_state(from.node_or_state());
}
if (from.has_match_group_mask()) {
set_match_group_mask(from.match_group_mask());
}
if (from.has_team_id()) {
set_team_id(from.team_id());
}
if (from.has_team_name()) {
set_team_name(from.team_name());
}
}
if (from._has_bits_[8 / 32] & (0xffu << (8 % 32))) {
if (from.has_team_base_logo()) {
set_team_base_logo(from.team_base_logo());
}
if (from.has_team_ui_logo()) {
set_team_ui_logo(from.team_ui_logo());
}
if (from.has_team_date()) {
set_team_date(from.team_date());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTATournament_Team::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTATournament_Team::CopyFrom(const CMsgDOTATournament_Team& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTATournament_Team::IsInitialized() const {
return true;
}
void CMsgDOTATournament_Team::Swap(CMsgDOTATournament_Team* other) {
if (other != this) {
std::swap(team_gid_, other->team_gid_);
std::swap(node_or_state_, other->node_or_state_);
players_.Swap(&other->players_);
player_buyin_.Swap(&other->player_buyin_);
player_skill_level_.Swap(&other->player_skill_level_);
std::swap(match_group_mask_, other->match_group_mask_);
std::swap(team_id_, other->team_id_);
std::swap(team_name_, other->team_name_);
std::swap(team_base_logo_, other->team_base_logo_);
std::swap(team_ui_logo_, other->team_ui_logo_);
std::swap(team_date_, other->team_date_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTATournament_Team::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTATournament_Team_descriptor_;
metadata.reflection = CMsgDOTATournament_Team_reflection_;
return metadata;
}
// -------------------------------------------------------------------
#ifndef _MSC_VER
const int CMsgDOTATournament_Game::kNodeIdxFieldNumber;
const int CMsgDOTATournament_Game::kLobbyIdFieldNumber;
const int CMsgDOTATournament_Game::kMatchIdFieldNumber;
const int CMsgDOTATournament_Game::kTeamAGoodFieldNumber;
const int CMsgDOTATournament_Game::kStateFieldNumber;
const int CMsgDOTATournament_Game::kStartTimeFieldNumber;
#endif // !_MSC_VER
CMsgDOTATournament_Game::CMsgDOTATournament_Game()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTATournament.Game)
}
void CMsgDOTATournament_Game::InitAsDefaultInstance() {
}
CMsgDOTATournament_Game::CMsgDOTATournament_Game(const CMsgDOTATournament_Game& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTATournament.Game)
}
void CMsgDOTATournament_Game::SharedCtor() {
_cached_size_ = 0;
node_idx_ = 0u;
lobby_id_ = GOOGLE_ULONGLONG(0);
match_id_ = GOOGLE_ULONGLONG(0);
team_a_good_ = false;
state_ = 0;
start_time_ = 0u;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTATournament_Game::~CMsgDOTATournament_Game() {
// @@protoc_insertion_point(destructor:CMsgDOTATournament.Game)
SharedDtor();
}
void CMsgDOTATournament_Game::SharedDtor() {
if (this != default_instance_) {
}
}
void CMsgDOTATournament_Game::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTATournament_Game::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTATournament_Game_descriptor_;
}
const CMsgDOTATournament_Game& CMsgDOTATournament_Game::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTATournament_Game* CMsgDOTATournament_Game::default_instance_ = NULL;
CMsgDOTATournament_Game* CMsgDOTATournament_Game::New() const {
return new CMsgDOTATournament_Game;
}
void CMsgDOTATournament_Game::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<CMsgDOTATournament_Game*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
if (_has_bits_[0 / 32] & 63) {
ZR_(lobby_id_, start_time_);
}
#undef OFFSET_OF_FIELD_
#undef ZR_
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTATournament_Game::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTATournament.Game)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint32 node_idx = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &node_idx_)));
set_has_node_idx();
} else {
goto handle_unusual;
}
if (input->ExpectTag(17)) goto parse_lobby_id;
break;
}
// optional fixed64 lobby_id = 2;
case 2: {
if (tag == 17) {
parse_lobby_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_FIXED64>(
input, &lobby_id_)));
set_has_lobby_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(24)) goto parse_match_id;
break;
}
// optional uint64 match_id = 3;
case 3: {
if (tag == 24) {
parse_match_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &match_id_)));
set_has_match_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(32)) goto parse_team_a_good;
break;
}
// optional bool team_a_good = 4;
case 4: {
if (tag == 32) {
parse_team_a_good:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &team_a_good_)));
set_has_team_a_good();
} else {
goto handle_unusual;
}
if (input->ExpectTag(40)) goto parse_state;
break;
}
// optional .ETournamentGameState state = 5 [default = k_ETournamentGameState_Unknown];
case 5: {
if (tag == 40) {
parse_state:
int value;
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
input, &value)));
if (::ETournamentGameState_IsValid(value)) {
set_state(static_cast< ::ETournamentGameState >(value));
} else {
mutable_unknown_fields()->AddVarint(5, value);
}
} else {
goto handle_unusual;
}
if (input->ExpectTag(48)) goto parse_start_time;
break;
}
// optional uint32 start_time = 6;
case 6: {
if (tag == 48) {
parse_start_time:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &start_time_)));
set_has_start_time();
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTATournament.Game)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTATournament.Game)
return false;
#undef DO_
}
void CMsgDOTATournament_Game::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTATournament.Game)
// optional uint32 node_idx = 1;
if (has_node_idx()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->node_idx(), output);
}
// optional fixed64 lobby_id = 2;
if (has_lobby_id()) {
::google::protobuf::internal::WireFormatLite::WriteFixed64(2, this->lobby_id(), output);
}
// optional uint64 match_id = 3;
if (has_match_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(3, this->match_id(), output);
}
// optional bool team_a_good = 4;
if (has_team_a_good()) {
::google::protobuf::internal::WireFormatLite::WriteBool(4, this->team_a_good(), output);
}
// optional .ETournamentGameState state = 5 [default = k_ETournamentGameState_Unknown];
if (has_state()) {
::google::protobuf::internal::WireFormatLite::WriteEnum(
5, this->state(), output);
}
// optional uint32 start_time = 6;
if (has_start_time()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(6, this->start_time(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTATournament.Game)
}
::google::protobuf::uint8* CMsgDOTATournament_Game::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTATournament.Game)
// optional uint32 node_idx = 1;
if (has_node_idx()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->node_idx(), target);
}
// optional fixed64 lobby_id = 2;
if (has_lobby_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteFixed64ToArray(2, this->lobby_id(), target);
}
// optional uint64 match_id = 3;
if (has_match_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(3, this->match_id(), target);
}
// optional bool team_a_good = 4;
if (has_team_a_good()) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(4, this->team_a_good(), target);
}
// optional .ETournamentGameState state = 5 [default = k_ETournamentGameState_Unknown];
if (has_state()) {
target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
5, this->state(), target);
}
// optional uint32 start_time = 6;
if (has_start_time()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(6, this->start_time(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTATournament.Game)
return target;
}
int CMsgDOTATournament_Game::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional uint32 node_idx = 1;
if (has_node_idx()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->node_idx());
}
// optional fixed64 lobby_id = 2;
if (has_lobby_id()) {
total_size += 1 + 8;
}
// optional uint64 match_id = 3;
if (has_match_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->match_id());
}
// optional bool team_a_good = 4;
if (has_team_a_good()) {
total_size += 1 + 1;
}
// optional .ETournamentGameState state = 5 [default = k_ETournamentGameState_Unknown];
if (has_state()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::EnumSize(this->state());
}
// optional uint32 start_time = 6;
if (has_start_time()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->start_time());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTATournament_Game::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTATournament_Game* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTATournament_Game*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTATournament_Game::MergeFrom(const CMsgDOTATournament_Game& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_node_idx()) {
set_node_idx(from.node_idx());
}
if (from.has_lobby_id()) {
set_lobby_id(from.lobby_id());
}
if (from.has_match_id()) {
set_match_id(from.match_id());
}
if (from.has_team_a_good()) {
set_team_a_good(from.team_a_good());
}
if (from.has_state()) {
set_state(from.state());
}
if (from.has_start_time()) {
set_start_time(from.start_time());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTATournament_Game::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTATournament_Game::CopyFrom(const CMsgDOTATournament_Game& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTATournament_Game::IsInitialized() const {
return true;
}
void CMsgDOTATournament_Game::Swap(CMsgDOTATournament_Game* other) {
if (other != this) {
std::swap(node_idx_, other->node_idx_);
std::swap(lobby_id_, other->lobby_id_);
std::swap(match_id_, other->match_id_);
std::swap(team_a_good_, other->team_a_good_);
std::swap(state_, other->state_);
std::swap(start_time_, other->start_time_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTATournament_Game::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTATournament_Game_descriptor_;
metadata.reflection = CMsgDOTATournament_Game_reflection_;
return metadata;
}
// -------------------------------------------------------------------
#ifndef _MSC_VER
const int CMsgDOTATournament_Node::kNodeIdFieldNumber;
const int CMsgDOTATournament_Node::kTeamIdxAFieldNumber;
const int CMsgDOTATournament_Node::kTeamIdxBFieldNumber;
const int CMsgDOTATournament_Node::kNodeStateFieldNumber;
#endif // !_MSC_VER
CMsgDOTATournament_Node::CMsgDOTATournament_Node()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTATournament.Node)
}
void CMsgDOTATournament_Node::InitAsDefaultInstance() {
}
CMsgDOTATournament_Node::CMsgDOTATournament_Node(const CMsgDOTATournament_Node& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTATournament.Node)
}
void CMsgDOTATournament_Node::SharedCtor() {
_cached_size_ = 0;
node_id_ = 0u;
team_idx_a_ = 0u;
team_idx_b_ = 0u;
node_state_ = 0;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTATournament_Node::~CMsgDOTATournament_Node() {
// @@protoc_insertion_point(destructor:CMsgDOTATournament.Node)
SharedDtor();
}
void CMsgDOTATournament_Node::SharedDtor() {
if (this != default_instance_) {
}
}
void CMsgDOTATournament_Node::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTATournament_Node::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTATournament_Node_descriptor_;
}
const CMsgDOTATournament_Node& CMsgDOTATournament_Node::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTATournament_Node* CMsgDOTATournament_Node::default_instance_ = NULL;
CMsgDOTATournament_Node* CMsgDOTATournament_Node::New() const {
return new CMsgDOTATournament_Node;
}
void CMsgDOTATournament_Node::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<CMsgDOTATournament_Node*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
ZR_(node_id_, node_state_);
#undef OFFSET_OF_FIELD_
#undef ZR_
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTATournament_Node::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTATournament.Node)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint32 node_id = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &node_id_)));
set_has_node_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_team_idx_a;
break;
}
// optional uint32 team_idx_a = 2;
case 2: {
if (tag == 16) {
parse_team_idx_a:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &team_idx_a_)));
set_has_team_idx_a();
} else {
goto handle_unusual;
}
if (input->ExpectTag(24)) goto parse_team_idx_b;
break;
}
// optional uint32 team_idx_b = 3;
case 3: {
if (tag == 24) {
parse_team_idx_b:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &team_idx_b_)));
set_has_team_idx_b();
} else {
goto handle_unusual;
}
if (input->ExpectTag(32)) goto parse_node_state;
break;
}
// optional .ETournamentNodeState node_state = 4 [default = k_ETournamentNodeState_Unknown];
case 4: {
if (tag == 32) {
parse_node_state:
int value;
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
input, &value)));
if (::ETournamentNodeState_IsValid(value)) {
set_node_state(static_cast< ::ETournamentNodeState >(value));
} else {
mutable_unknown_fields()->AddVarint(4, value);
}
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTATournament.Node)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTATournament.Node)
return false;
#undef DO_
}
void CMsgDOTATournament_Node::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTATournament.Node)
// optional uint32 node_id = 1;
if (has_node_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->node_id(), output);
}
// optional uint32 team_idx_a = 2;
if (has_team_idx_a()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->team_idx_a(), output);
}
// optional uint32 team_idx_b = 3;
if (has_team_idx_b()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(3, this->team_idx_b(), output);
}
// optional .ETournamentNodeState node_state = 4 [default = k_ETournamentNodeState_Unknown];
if (has_node_state()) {
::google::protobuf::internal::WireFormatLite::WriteEnum(
4, this->node_state(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTATournament.Node)
}
::google::protobuf::uint8* CMsgDOTATournament_Node::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTATournament.Node)
// optional uint32 node_id = 1;
if (has_node_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->node_id(), target);
}
// optional uint32 team_idx_a = 2;
if (has_team_idx_a()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->team_idx_a(), target);
}
// optional uint32 team_idx_b = 3;
if (has_team_idx_b()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(3, this->team_idx_b(), target);
}
// optional .ETournamentNodeState node_state = 4 [default = k_ETournamentNodeState_Unknown];
if (has_node_state()) {
target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
4, this->node_state(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTATournament.Node)
return target;
}
int CMsgDOTATournament_Node::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional uint32 node_id = 1;
if (has_node_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->node_id());
}
// optional uint32 team_idx_a = 2;
if (has_team_idx_a()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->team_idx_a());
}
// optional uint32 team_idx_b = 3;
if (has_team_idx_b()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->team_idx_b());
}
// optional .ETournamentNodeState node_state = 4 [default = k_ETournamentNodeState_Unknown];
if (has_node_state()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::EnumSize(this->node_state());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTATournament_Node::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTATournament_Node* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTATournament_Node*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTATournament_Node::MergeFrom(const CMsgDOTATournament_Node& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_node_id()) {
set_node_id(from.node_id());
}
if (from.has_team_idx_a()) {
set_team_idx_a(from.team_idx_a());
}
if (from.has_team_idx_b()) {
set_team_idx_b(from.team_idx_b());
}
if (from.has_node_state()) {
set_node_state(from.node_state());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTATournament_Node::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTATournament_Node::CopyFrom(const CMsgDOTATournament_Node& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTATournament_Node::IsInitialized() const {
return true;
}
void CMsgDOTATournament_Node::Swap(CMsgDOTATournament_Node* other) {
if (other != this) {
std::swap(node_id_, other->node_id_);
std::swap(team_idx_a_, other->team_idx_a_);
std::swap(team_idx_b_, other->team_idx_b_);
std::swap(node_state_, other->node_state_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTATournament_Node::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTATournament_Node_descriptor_;
metadata.reflection = CMsgDOTATournament_Node_reflection_;
return metadata;
}
// -------------------------------------------------------------------
#ifndef _MSC_VER
const int CMsgDOTATournament::kTournamentIdFieldNumber;
const int CMsgDOTATournament::kDivisionIdFieldNumber;
const int CMsgDOTATournament::kScheduleTimeFieldNumber;
const int CMsgDOTATournament::kSkillLevelFieldNumber;
const int CMsgDOTATournament::kTournamentTemplateFieldNumber;
const int CMsgDOTATournament::kStateFieldNumber;
const int CMsgDOTATournament::kStateSeqNumFieldNumber;
const int CMsgDOTATournament::kSeasonTrophyIdFieldNumber;
const int CMsgDOTATournament::kTeamsFieldNumber;
const int CMsgDOTATournament::kGamesFieldNumber;
const int CMsgDOTATournament::kNodesFieldNumber;
#endif // !_MSC_VER
CMsgDOTATournament::CMsgDOTATournament()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTATournament)
}
void CMsgDOTATournament::InitAsDefaultInstance() {
}
CMsgDOTATournament::CMsgDOTATournament(const CMsgDOTATournament& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTATournament)
}
void CMsgDOTATournament::SharedCtor() {
_cached_size_ = 0;
tournament_id_ = 0u;
division_id_ = 0u;
schedule_time_ = 0u;
skill_level_ = 0u;
tournament_template_ = 0;
state_ = 0;
state_seq_num_ = 0u;
season_trophy_id_ = 0u;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTATournament::~CMsgDOTATournament() {
// @@protoc_insertion_point(destructor:CMsgDOTATournament)
SharedDtor();
}
void CMsgDOTATournament::SharedDtor() {
if (this != default_instance_) {
}
}
void CMsgDOTATournament::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTATournament::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTATournament_descriptor_;
}
const CMsgDOTATournament& CMsgDOTATournament::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTATournament* CMsgDOTATournament::default_instance_ = NULL;
CMsgDOTATournament* CMsgDOTATournament::New() const {
return new CMsgDOTATournament;
}
void CMsgDOTATournament::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<CMsgDOTATournament*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
if (_has_bits_[0 / 32] & 255) {
ZR_(tournament_id_, season_trophy_id_);
}
#undef OFFSET_OF_FIELD_
#undef ZR_
teams_.Clear();
games_.Clear();
nodes_.Clear();
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTATournament::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTATournament)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint32 tournament_id = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &tournament_id_)));
set_has_tournament_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_division_id;
break;
}
// optional uint32 division_id = 2;
case 2: {
if (tag == 16) {
parse_division_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &division_id_)));
set_has_division_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(24)) goto parse_schedule_time;
break;
}
// optional uint32 schedule_time = 3;
case 3: {
if (tag == 24) {
parse_schedule_time:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &schedule_time_)));
set_has_schedule_time();
} else {
goto handle_unusual;
}
if (input->ExpectTag(32)) goto parse_skill_level;
break;
}
// optional uint32 skill_level = 4;
case 4: {
if (tag == 32) {
parse_skill_level:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &skill_level_)));
set_has_skill_level();
} else {
goto handle_unusual;
}
if (input->ExpectTag(40)) goto parse_tournament_template;
break;
}
// optional .ETournamentTemplate tournament_template = 5 [default = k_ETournamentTemplate_None];
case 5: {
if (tag == 40) {
parse_tournament_template:
int value;
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
input, &value)));
if (::ETournamentTemplate_IsValid(value)) {
set_tournament_template(static_cast< ::ETournamentTemplate >(value));
} else {
mutable_unknown_fields()->AddVarint(5, value);
}
} else {
goto handle_unusual;
}
if (input->ExpectTag(48)) goto parse_state;
break;
}
// optional .ETournamentState state = 6 [default = k_ETournamentState_Unknown];
case 6: {
if (tag == 48) {
parse_state:
int value;
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
input, &value)));
if (::ETournamentState_IsValid(value)) {
set_state(static_cast< ::ETournamentState >(value));
} else {
mutable_unknown_fields()->AddVarint(6, value);
}
} else {
goto handle_unusual;
}
if (input->ExpectTag(58)) goto parse_teams;
break;
}
// repeated .CMsgDOTATournament.Team teams = 7;
case 7: {
if (tag == 58) {
parse_teams:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_teams()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(58)) goto parse_teams;
if (input->ExpectTag(66)) goto parse_games;
break;
}
// repeated .CMsgDOTATournament.Game games = 8;
case 8: {
if (tag == 66) {
parse_games:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_games()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(66)) goto parse_games;
if (input->ExpectTag(74)) goto parse_nodes;
break;
}
// repeated .CMsgDOTATournament.Node nodes = 9;
case 9: {
if (tag == 74) {
parse_nodes:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_nodes()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(74)) goto parse_nodes;
if (input->ExpectTag(80)) goto parse_state_seq_num;
break;
}
// optional uint32 state_seq_num = 10;
case 10: {
if (tag == 80) {
parse_state_seq_num:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &state_seq_num_)));
set_has_state_seq_num();
} else {
goto handle_unusual;
}
if (input->ExpectTag(88)) goto parse_season_trophy_id;
break;
}
// optional uint32 season_trophy_id = 11;
case 11: {
if (tag == 88) {
parse_season_trophy_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &season_trophy_id_)));
set_has_season_trophy_id();
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTATournament)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTATournament)
return false;
#undef DO_
}
void CMsgDOTATournament::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTATournament)
// optional uint32 tournament_id = 1;
if (has_tournament_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->tournament_id(), output);
}
// optional uint32 division_id = 2;
if (has_division_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->division_id(), output);
}
// optional uint32 schedule_time = 3;
if (has_schedule_time()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(3, this->schedule_time(), output);
}
// optional uint32 skill_level = 4;
if (has_skill_level()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(4, this->skill_level(), output);
}
// optional .ETournamentTemplate tournament_template = 5 [default = k_ETournamentTemplate_None];
if (has_tournament_template()) {
::google::protobuf::internal::WireFormatLite::WriteEnum(
5, this->tournament_template(), output);
}
// optional .ETournamentState state = 6 [default = k_ETournamentState_Unknown];
if (has_state()) {
::google::protobuf::internal::WireFormatLite::WriteEnum(
6, this->state(), output);
}
// repeated .CMsgDOTATournament.Team teams = 7;
for (int i = 0; i < this->teams_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
7, this->teams(i), output);
}
// repeated .CMsgDOTATournament.Game games = 8;
for (int i = 0; i < this->games_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
8, this->games(i), output);
}
// repeated .CMsgDOTATournament.Node nodes = 9;
for (int i = 0; i < this->nodes_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
9, this->nodes(i), output);
}
// optional uint32 state_seq_num = 10;
if (has_state_seq_num()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(10, this->state_seq_num(), output);
}
// optional uint32 season_trophy_id = 11;
if (has_season_trophy_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(11, this->season_trophy_id(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTATournament)
}
::google::protobuf::uint8* CMsgDOTATournament::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTATournament)
// optional uint32 tournament_id = 1;
if (has_tournament_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->tournament_id(), target);
}
// optional uint32 division_id = 2;
if (has_division_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->division_id(), target);
}
// optional uint32 schedule_time = 3;
if (has_schedule_time()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(3, this->schedule_time(), target);
}
// optional uint32 skill_level = 4;
if (has_skill_level()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(4, this->skill_level(), target);
}
// optional .ETournamentTemplate tournament_template = 5 [default = k_ETournamentTemplate_None];
if (has_tournament_template()) {
target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
5, this->tournament_template(), target);
}
// optional .ETournamentState state = 6 [default = k_ETournamentState_Unknown];
if (has_state()) {
target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
6, this->state(), target);
}
// repeated .CMsgDOTATournament.Team teams = 7;
for (int i = 0; i < this->teams_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
7, this->teams(i), target);
}
// repeated .CMsgDOTATournament.Game games = 8;
for (int i = 0; i < this->games_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
8, this->games(i), target);
}
// repeated .CMsgDOTATournament.Node nodes = 9;
for (int i = 0; i < this->nodes_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
9, this->nodes(i), target);
}
// optional uint32 state_seq_num = 10;
if (has_state_seq_num()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(10, this->state_seq_num(), target);
}
// optional uint32 season_trophy_id = 11;
if (has_season_trophy_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(11, this->season_trophy_id(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTATournament)
return target;
}
int CMsgDOTATournament::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional uint32 tournament_id = 1;
if (has_tournament_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->tournament_id());
}
// optional uint32 division_id = 2;
if (has_division_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->division_id());
}
// optional uint32 schedule_time = 3;
if (has_schedule_time()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->schedule_time());
}
// optional uint32 skill_level = 4;
if (has_skill_level()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->skill_level());
}
// optional .ETournamentTemplate tournament_template = 5 [default = k_ETournamentTemplate_None];
if (has_tournament_template()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::EnumSize(this->tournament_template());
}
// optional .ETournamentState state = 6 [default = k_ETournamentState_Unknown];
if (has_state()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::EnumSize(this->state());
}
// optional uint32 state_seq_num = 10;
if (has_state_seq_num()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->state_seq_num());
}
// optional uint32 season_trophy_id = 11;
if (has_season_trophy_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->season_trophy_id());
}
}
// repeated .CMsgDOTATournament.Team teams = 7;
total_size += 1 * this->teams_size();
for (int i = 0; i < this->teams_size(); i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->teams(i));
}
// repeated .CMsgDOTATournament.Game games = 8;
total_size += 1 * this->games_size();
for (int i = 0; i < this->games_size(); i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->games(i));
}
// repeated .CMsgDOTATournament.Node nodes = 9;
total_size += 1 * this->nodes_size();
for (int i = 0; i < this->nodes_size(); i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->nodes(i));
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTATournament::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTATournament* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTATournament*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTATournament::MergeFrom(const CMsgDOTATournament& from) {
GOOGLE_CHECK_NE(&from, this);
teams_.MergeFrom(from.teams_);
games_.MergeFrom(from.games_);
nodes_.MergeFrom(from.nodes_);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_tournament_id()) {
set_tournament_id(from.tournament_id());
}
if (from.has_division_id()) {
set_division_id(from.division_id());
}
if (from.has_schedule_time()) {
set_schedule_time(from.schedule_time());
}
if (from.has_skill_level()) {
set_skill_level(from.skill_level());
}
if (from.has_tournament_template()) {
set_tournament_template(from.tournament_template());
}
if (from.has_state()) {
set_state(from.state());
}
if (from.has_state_seq_num()) {
set_state_seq_num(from.state_seq_num());
}
if (from.has_season_trophy_id()) {
set_season_trophy_id(from.season_trophy_id());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTATournament::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTATournament::CopyFrom(const CMsgDOTATournament& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTATournament::IsInitialized() const {
return true;
}
void CMsgDOTATournament::Swap(CMsgDOTATournament* other) {
if (other != this) {
std::swap(tournament_id_, other->tournament_id_);
std::swap(division_id_, other->division_id_);
std::swap(schedule_time_, other->schedule_time_);
std::swap(skill_level_, other->skill_level_);
std::swap(tournament_template_, other->tournament_template_);
std::swap(state_, other->state_);
std::swap(state_seq_num_, other->state_seq_num_);
std::swap(season_trophy_id_, other->season_trophy_id_);
teams_.Swap(&other->teams_);
games_.Swap(&other->games_);
nodes_.Swap(&other->nodes_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTATournament::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTATournament_descriptor_;
metadata.reflection = CMsgDOTATournament_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int CMsgDOTATournamentStateChange_GameChange::kMatchIdFieldNumber;
const int CMsgDOTATournamentStateChange_GameChange::kNewStateFieldNumber;
#endif // !_MSC_VER
CMsgDOTATournamentStateChange_GameChange::CMsgDOTATournamentStateChange_GameChange()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTATournamentStateChange.GameChange)
}
void CMsgDOTATournamentStateChange_GameChange::InitAsDefaultInstance() {
}
CMsgDOTATournamentStateChange_GameChange::CMsgDOTATournamentStateChange_GameChange(const CMsgDOTATournamentStateChange_GameChange& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTATournamentStateChange.GameChange)
}
void CMsgDOTATournamentStateChange_GameChange::SharedCtor() {
_cached_size_ = 0;
match_id_ = GOOGLE_ULONGLONG(0);
new_state_ = 0;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTATournamentStateChange_GameChange::~CMsgDOTATournamentStateChange_GameChange() {
// @@protoc_insertion_point(destructor:CMsgDOTATournamentStateChange.GameChange)
SharedDtor();
}
void CMsgDOTATournamentStateChange_GameChange::SharedDtor() {
if (this != default_instance_) {
}
}
void CMsgDOTATournamentStateChange_GameChange::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTATournamentStateChange_GameChange::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTATournamentStateChange_GameChange_descriptor_;
}
const CMsgDOTATournamentStateChange_GameChange& CMsgDOTATournamentStateChange_GameChange::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTATournamentStateChange_GameChange* CMsgDOTATournamentStateChange_GameChange::default_instance_ = NULL;
CMsgDOTATournamentStateChange_GameChange* CMsgDOTATournamentStateChange_GameChange::New() const {
return new CMsgDOTATournamentStateChange_GameChange;
}
void CMsgDOTATournamentStateChange_GameChange::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<CMsgDOTATournamentStateChange_GameChange*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
ZR_(match_id_, new_state_);
#undef OFFSET_OF_FIELD_
#undef ZR_
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTATournamentStateChange_GameChange::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTATournamentStateChange.GameChange)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint64 match_id = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &match_id_)));
set_has_match_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_new_state;
break;
}
// optional .ETournamentGameState new_state = 2 [default = k_ETournamentGameState_Unknown];
case 2: {
if (tag == 16) {
parse_new_state:
int value;
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
input, &value)));
if (::ETournamentGameState_IsValid(value)) {
set_new_state(static_cast< ::ETournamentGameState >(value));
} else {
mutable_unknown_fields()->AddVarint(2, value);
}
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTATournamentStateChange.GameChange)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTATournamentStateChange.GameChange)
return false;
#undef DO_
}
void CMsgDOTATournamentStateChange_GameChange::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTATournamentStateChange.GameChange)
// optional uint64 match_id = 1;
if (has_match_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(1, this->match_id(), output);
}
// optional .ETournamentGameState new_state = 2 [default = k_ETournamentGameState_Unknown];
if (has_new_state()) {
::google::protobuf::internal::WireFormatLite::WriteEnum(
2, this->new_state(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTATournamentStateChange.GameChange)
}
::google::protobuf::uint8* CMsgDOTATournamentStateChange_GameChange::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTATournamentStateChange.GameChange)
// optional uint64 match_id = 1;
if (has_match_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(1, this->match_id(), target);
}
// optional .ETournamentGameState new_state = 2 [default = k_ETournamentGameState_Unknown];
if (has_new_state()) {
target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
2, this->new_state(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTATournamentStateChange.GameChange)
return target;
}
int CMsgDOTATournamentStateChange_GameChange::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional uint64 match_id = 1;
if (has_match_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->match_id());
}
// optional .ETournamentGameState new_state = 2 [default = k_ETournamentGameState_Unknown];
if (has_new_state()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::EnumSize(this->new_state());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTATournamentStateChange_GameChange::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTATournamentStateChange_GameChange* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTATournamentStateChange_GameChange*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTATournamentStateChange_GameChange::MergeFrom(const CMsgDOTATournamentStateChange_GameChange& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_match_id()) {
set_match_id(from.match_id());
}
if (from.has_new_state()) {
set_new_state(from.new_state());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTATournamentStateChange_GameChange::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTATournamentStateChange_GameChange::CopyFrom(const CMsgDOTATournamentStateChange_GameChange& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTATournamentStateChange_GameChange::IsInitialized() const {
return true;
}
void CMsgDOTATournamentStateChange_GameChange::Swap(CMsgDOTATournamentStateChange_GameChange* other) {
if (other != this) {
std::swap(match_id_, other->match_id_);
std::swap(new_state_, other->new_state_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTATournamentStateChange_GameChange::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTATournamentStateChange_GameChange_descriptor_;
metadata.reflection = CMsgDOTATournamentStateChange_GameChange_reflection_;
return metadata;
}
// -------------------------------------------------------------------
#ifndef _MSC_VER
const int CMsgDOTATournamentStateChange_TeamChange::kTeamGidFieldNumber;
const int CMsgDOTATournamentStateChange_TeamChange::kNewNodeOrStateFieldNumber;
const int CMsgDOTATournamentStateChange_TeamChange::kOldNodeOrStateFieldNumber;
#endif // !_MSC_VER
CMsgDOTATournamentStateChange_TeamChange::CMsgDOTATournamentStateChange_TeamChange()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTATournamentStateChange.TeamChange)
}
void CMsgDOTATournamentStateChange_TeamChange::InitAsDefaultInstance() {
}
CMsgDOTATournamentStateChange_TeamChange::CMsgDOTATournamentStateChange_TeamChange(const CMsgDOTATournamentStateChange_TeamChange& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTATournamentStateChange.TeamChange)
}
void CMsgDOTATournamentStateChange_TeamChange::SharedCtor() {
_cached_size_ = 0;
team_gid_ = GOOGLE_ULONGLONG(0);
new_node_or_state_ = 0u;
old_node_or_state_ = 0u;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTATournamentStateChange_TeamChange::~CMsgDOTATournamentStateChange_TeamChange() {
// @@protoc_insertion_point(destructor:CMsgDOTATournamentStateChange.TeamChange)
SharedDtor();
}
void CMsgDOTATournamentStateChange_TeamChange::SharedDtor() {
if (this != default_instance_) {
}
}
void CMsgDOTATournamentStateChange_TeamChange::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTATournamentStateChange_TeamChange::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTATournamentStateChange_TeamChange_descriptor_;
}
const CMsgDOTATournamentStateChange_TeamChange& CMsgDOTATournamentStateChange_TeamChange::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTATournamentStateChange_TeamChange* CMsgDOTATournamentStateChange_TeamChange::default_instance_ = NULL;
CMsgDOTATournamentStateChange_TeamChange* CMsgDOTATournamentStateChange_TeamChange::New() const {
return new CMsgDOTATournamentStateChange_TeamChange;
}
void CMsgDOTATournamentStateChange_TeamChange::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<CMsgDOTATournamentStateChange_TeamChange*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
ZR_(team_gid_, old_node_or_state_);
#undef OFFSET_OF_FIELD_
#undef ZR_
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTATournamentStateChange_TeamChange::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTATournamentStateChange.TeamChange)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint64 team_gid = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &team_gid_)));
set_has_team_gid();
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_new_node_or_state;
break;
}
// optional uint32 new_node_or_state = 2;
case 2: {
if (tag == 16) {
parse_new_node_or_state:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &new_node_or_state_)));
set_has_new_node_or_state();
} else {
goto handle_unusual;
}
if (input->ExpectTag(24)) goto parse_old_node_or_state;
break;
}
// optional uint32 old_node_or_state = 3;
case 3: {
if (tag == 24) {
parse_old_node_or_state:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &old_node_or_state_)));
set_has_old_node_or_state();
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTATournamentStateChange.TeamChange)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTATournamentStateChange.TeamChange)
return false;
#undef DO_
}
void CMsgDOTATournamentStateChange_TeamChange::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTATournamentStateChange.TeamChange)
// optional uint64 team_gid = 1;
if (has_team_gid()) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(1, this->team_gid(), output);
}
// optional uint32 new_node_or_state = 2;
if (has_new_node_or_state()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->new_node_or_state(), output);
}
// optional uint32 old_node_or_state = 3;
if (has_old_node_or_state()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(3, this->old_node_or_state(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTATournamentStateChange.TeamChange)
}
::google::protobuf::uint8* CMsgDOTATournamentStateChange_TeamChange::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTATournamentStateChange.TeamChange)
// optional uint64 team_gid = 1;
if (has_team_gid()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(1, this->team_gid(), target);
}
// optional uint32 new_node_or_state = 2;
if (has_new_node_or_state()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->new_node_or_state(), target);
}
// optional uint32 old_node_or_state = 3;
if (has_old_node_or_state()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(3, this->old_node_or_state(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTATournamentStateChange.TeamChange)
return target;
}
int CMsgDOTATournamentStateChange_TeamChange::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional uint64 team_gid = 1;
if (has_team_gid()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->team_gid());
}
// optional uint32 new_node_or_state = 2;
if (has_new_node_or_state()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->new_node_or_state());
}
// optional uint32 old_node_or_state = 3;
if (has_old_node_or_state()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->old_node_or_state());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTATournamentStateChange_TeamChange::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTATournamentStateChange_TeamChange* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTATournamentStateChange_TeamChange*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTATournamentStateChange_TeamChange::MergeFrom(const CMsgDOTATournamentStateChange_TeamChange& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_team_gid()) {
set_team_gid(from.team_gid());
}
if (from.has_new_node_or_state()) {
set_new_node_or_state(from.new_node_or_state());
}
if (from.has_old_node_or_state()) {
set_old_node_or_state(from.old_node_or_state());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTATournamentStateChange_TeamChange::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTATournamentStateChange_TeamChange::CopyFrom(const CMsgDOTATournamentStateChange_TeamChange& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTATournamentStateChange_TeamChange::IsInitialized() const {
return true;
}
void CMsgDOTATournamentStateChange_TeamChange::Swap(CMsgDOTATournamentStateChange_TeamChange* other) {
if (other != this) {
std::swap(team_gid_, other->team_gid_);
std::swap(new_node_or_state_, other->new_node_or_state_);
std::swap(old_node_or_state_, other->old_node_or_state_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTATournamentStateChange_TeamChange::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTATournamentStateChange_TeamChange_descriptor_;
metadata.reflection = CMsgDOTATournamentStateChange_TeamChange_reflection_;
return metadata;
}
// -------------------------------------------------------------------
#ifndef _MSC_VER
const int CMsgDOTATournamentStateChange::kNewTournamentIdFieldNumber;
const int CMsgDOTATournamentStateChange::kEventFieldNumber;
const int CMsgDOTATournamentStateChange::kNewTournamentStateFieldNumber;
const int CMsgDOTATournamentStateChange::kGameChangesFieldNumber;
const int CMsgDOTATournamentStateChange::kTeamChangesFieldNumber;
const int CMsgDOTATournamentStateChange::kMergedTournamentIdsFieldNumber;
const int CMsgDOTATournamentStateChange::kStateSeqNumFieldNumber;
#endif // !_MSC_VER
CMsgDOTATournamentStateChange::CMsgDOTATournamentStateChange()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTATournamentStateChange)
}
void CMsgDOTATournamentStateChange::InitAsDefaultInstance() {
}
CMsgDOTATournamentStateChange::CMsgDOTATournamentStateChange(const CMsgDOTATournamentStateChange& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTATournamentStateChange)
}
void CMsgDOTATournamentStateChange::SharedCtor() {
_cached_size_ = 0;
new_tournament_id_ = 0u;
event_ = 0;
new_tournament_state_ = 0;
state_seq_num_ = 0u;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTATournamentStateChange::~CMsgDOTATournamentStateChange() {
// @@protoc_insertion_point(destructor:CMsgDOTATournamentStateChange)
SharedDtor();
}
void CMsgDOTATournamentStateChange::SharedDtor() {
if (this != default_instance_) {
}
}
void CMsgDOTATournamentStateChange::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTATournamentStateChange::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTATournamentStateChange_descriptor_;
}
const CMsgDOTATournamentStateChange& CMsgDOTATournamentStateChange::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTATournamentStateChange* CMsgDOTATournamentStateChange::default_instance_ = NULL;
CMsgDOTATournamentStateChange* CMsgDOTATournamentStateChange::New() const {
return new CMsgDOTATournamentStateChange;
}
void CMsgDOTATournamentStateChange::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<CMsgDOTATournamentStateChange*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
ZR_(new_tournament_id_, event_);
ZR_(new_tournament_state_, state_seq_num_);
#undef OFFSET_OF_FIELD_
#undef ZR_
game_changes_.Clear();
team_changes_.Clear();
merged_tournament_ids_.Clear();
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTATournamentStateChange::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTATournamentStateChange)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint32 new_tournament_id = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &new_tournament_id_)));
set_has_new_tournament_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_event;
break;
}
// optional .ETournamentEvent event = 2 [default = k_ETournamentEvent_None];
case 2: {
if (tag == 16) {
parse_event:
int value;
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
input, &value)));
if (::ETournamentEvent_IsValid(value)) {
set_event(static_cast< ::ETournamentEvent >(value));
} else {
mutable_unknown_fields()->AddVarint(2, value);
}
} else {
goto handle_unusual;
}
if (input->ExpectTag(24)) goto parse_new_tournament_state;
break;
}
// optional .ETournamentState new_tournament_state = 3 [default = k_ETournamentState_Unknown];
case 3: {
if (tag == 24) {
parse_new_tournament_state:
int value;
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
input, &value)));
if (::ETournamentState_IsValid(value)) {
set_new_tournament_state(static_cast< ::ETournamentState >(value));
} else {
mutable_unknown_fields()->AddVarint(3, value);
}
} else {
goto handle_unusual;
}
if (input->ExpectTag(34)) goto parse_game_changes;
break;
}
// repeated .CMsgDOTATournamentStateChange.GameChange game_changes = 4;
case 4: {
if (tag == 34) {
parse_game_changes:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_game_changes()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(34)) goto parse_game_changes;
if (input->ExpectTag(42)) goto parse_team_changes;
break;
}
// repeated .CMsgDOTATournamentStateChange.TeamChange team_changes = 5;
case 5: {
if (tag == 42) {
parse_team_changes:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_team_changes()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(42)) goto parse_team_changes;
if (input->ExpectTag(50)) goto parse_merged_tournament_ids;
break;
}
// repeated uint32 merged_tournament_ids = 6 [packed = true];
case 6: {
if (tag == 50) {
parse_merged_tournament_ids:
DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, this->mutable_merged_tournament_ids())));
} else if (tag == 48) {
DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
1, 50, input, this->mutable_merged_tournament_ids())));
} else {
goto handle_unusual;
}
if (input->ExpectTag(56)) goto parse_state_seq_num;
break;
}
// optional uint32 state_seq_num = 7;
case 7: {
if (tag == 56) {
parse_state_seq_num:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &state_seq_num_)));
set_has_state_seq_num();
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTATournamentStateChange)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTATournamentStateChange)
return false;
#undef DO_
}
void CMsgDOTATournamentStateChange::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTATournamentStateChange)
// optional uint32 new_tournament_id = 1;
if (has_new_tournament_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->new_tournament_id(), output);
}
// optional .ETournamentEvent event = 2 [default = k_ETournamentEvent_None];
if (has_event()) {
::google::protobuf::internal::WireFormatLite::WriteEnum(
2, this->event(), output);
}
// optional .ETournamentState new_tournament_state = 3 [default = k_ETournamentState_Unknown];
if (has_new_tournament_state()) {
::google::protobuf::internal::WireFormatLite::WriteEnum(
3, this->new_tournament_state(), output);
}
// repeated .CMsgDOTATournamentStateChange.GameChange game_changes = 4;
for (int i = 0; i < this->game_changes_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
4, this->game_changes(i), output);
}
// repeated .CMsgDOTATournamentStateChange.TeamChange team_changes = 5;
for (int i = 0; i < this->team_changes_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
5, this->team_changes(i), output);
}
// repeated uint32 merged_tournament_ids = 6 [packed = true];
if (this->merged_tournament_ids_size() > 0) {
::google::protobuf::internal::WireFormatLite::WriteTag(6, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output);
output->WriteVarint32(_merged_tournament_ids_cached_byte_size_);
}
for (int i = 0; i < this->merged_tournament_ids_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteUInt32NoTag(
this->merged_tournament_ids(i), output);
}
// optional uint32 state_seq_num = 7;
if (has_state_seq_num()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(7, this->state_seq_num(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTATournamentStateChange)
}
::google::protobuf::uint8* CMsgDOTATournamentStateChange::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTATournamentStateChange)
// optional uint32 new_tournament_id = 1;
if (has_new_tournament_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->new_tournament_id(), target);
}
// optional .ETournamentEvent event = 2 [default = k_ETournamentEvent_None];
if (has_event()) {
target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
2, this->event(), target);
}
// optional .ETournamentState new_tournament_state = 3 [default = k_ETournamentState_Unknown];
if (has_new_tournament_state()) {
target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
3, this->new_tournament_state(), target);
}
// repeated .CMsgDOTATournamentStateChange.GameChange game_changes = 4;
for (int i = 0; i < this->game_changes_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
4, this->game_changes(i), target);
}
// repeated .CMsgDOTATournamentStateChange.TeamChange team_changes = 5;
for (int i = 0; i < this->team_changes_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
5, this->team_changes(i), target);
}
// repeated uint32 merged_tournament_ids = 6 [packed = true];
if (this->merged_tournament_ids_size() > 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray(
6,
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
target);
target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray(
_merged_tournament_ids_cached_byte_size_, target);
}
for (int i = 0; i < this->merged_tournament_ids_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteUInt32NoTagToArray(this->merged_tournament_ids(i), target);
}
// optional uint32 state_seq_num = 7;
if (has_state_seq_num()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(7, this->state_seq_num(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTATournamentStateChange)
return target;
}
int CMsgDOTATournamentStateChange::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional uint32 new_tournament_id = 1;
if (has_new_tournament_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->new_tournament_id());
}
// optional .ETournamentEvent event = 2 [default = k_ETournamentEvent_None];
if (has_event()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::EnumSize(this->event());
}
// optional .ETournamentState new_tournament_state = 3 [default = k_ETournamentState_Unknown];
if (has_new_tournament_state()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::EnumSize(this->new_tournament_state());
}
// optional uint32 state_seq_num = 7;
if (has_state_seq_num()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->state_seq_num());
}
}
// repeated .CMsgDOTATournamentStateChange.GameChange game_changes = 4;
total_size += 1 * this->game_changes_size();
for (int i = 0; i < this->game_changes_size(); i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->game_changes(i));
}
// repeated .CMsgDOTATournamentStateChange.TeamChange team_changes = 5;
total_size += 1 * this->team_changes_size();
for (int i = 0; i < this->team_changes_size(); i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->team_changes(i));
}
// repeated uint32 merged_tournament_ids = 6 [packed = true];
{
int data_size = 0;
for (int i = 0; i < this->merged_tournament_ids_size(); i++) {
data_size += ::google::protobuf::internal::WireFormatLite::
UInt32Size(this->merged_tournament_ids(i));
}
if (data_size > 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::Int32Size(data_size);
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_merged_tournament_ids_cached_byte_size_ = data_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
total_size += data_size;
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTATournamentStateChange::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTATournamentStateChange* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTATournamentStateChange*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTATournamentStateChange::MergeFrom(const CMsgDOTATournamentStateChange& from) {
GOOGLE_CHECK_NE(&from, this);
game_changes_.MergeFrom(from.game_changes_);
team_changes_.MergeFrom(from.team_changes_);
merged_tournament_ids_.MergeFrom(from.merged_tournament_ids_);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_new_tournament_id()) {
set_new_tournament_id(from.new_tournament_id());
}
if (from.has_event()) {
set_event(from.event());
}
if (from.has_new_tournament_state()) {
set_new_tournament_state(from.new_tournament_state());
}
if (from.has_state_seq_num()) {
set_state_seq_num(from.state_seq_num());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTATournamentStateChange::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTATournamentStateChange::CopyFrom(const CMsgDOTATournamentStateChange& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTATournamentStateChange::IsInitialized() const {
return true;
}
void CMsgDOTATournamentStateChange::Swap(CMsgDOTATournamentStateChange* other) {
if (other != this) {
std::swap(new_tournament_id_, other->new_tournament_id_);
std::swap(event_, other->event_);
std::swap(new_tournament_state_, other->new_tournament_state_);
game_changes_.Swap(&other->game_changes_);
team_changes_.Swap(&other->team_changes_);
merged_tournament_ids_.Swap(&other->merged_tournament_ids_);
std::swap(state_seq_num_, other->state_seq_num_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTATournamentStateChange::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTATournamentStateChange_descriptor_;
metadata.reflection = CMsgDOTATournamentStateChange_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int CMsgDOTATournamentRequest::kTournamentIdFieldNumber;
const int CMsgDOTATournamentRequest::kClientTournamentGidFieldNumber;
#endif // !_MSC_VER
CMsgDOTATournamentRequest::CMsgDOTATournamentRequest()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTATournamentRequest)
}
void CMsgDOTATournamentRequest::InitAsDefaultInstance() {
}
CMsgDOTATournamentRequest::CMsgDOTATournamentRequest(const CMsgDOTATournamentRequest& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTATournamentRequest)
}
void CMsgDOTATournamentRequest::SharedCtor() {
_cached_size_ = 0;
tournament_id_ = 0u;
client_tournament_gid_ = GOOGLE_ULONGLONG(0);
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTATournamentRequest::~CMsgDOTATournamentRequest() {
// @@protoc_insertion_point(destructor:CMsgDOTATournamentRequest)
SharedDtor();
}
void CMsgDOTATournamentRequest::SharedDtor() {
if (this != default_instance_) {
}
}
void CMsgDOTATournamentRequest::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTATournamentRequest::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTATournamentRequest_descriptor_;
}
const CMsgDOTATournamentRequest& CMsgDOTATournamentRequest::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTATournamentRequest* CMsgDOTATournamentRequest::default_instance_ = NULL;
CMsgDOTATournamentRequest* CMsgDOTATournamentRequest::New() const {
return new CMsgDOTATournamentRequest;
}
void CMsgDOTATournamentRequest::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<CMsgDOTATournamentRequest*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
ZR_(client_tournament_gid_, tournament_id_);
#undef OFFSET_OF_FIELD_
#undef ZR_
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTATournamentRequest::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTATournamentRequest)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint32 tournament_id = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &tournament_id_)));
set_has_tournament_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_client_tournament_gid;
break;
}
// optional uint64 client_tournament_gid = 2;
case 2: {
if (tag == 16) {
parse_client_tournament_gid:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &client_tournament_gid_)));
set_has_client_tournament_gid();
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTATournamentRequest)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTATournamentRequest)
return false;
#undef DO_
}
void CMsgDOTATournamentRequest::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTATournamentRequest)
// optional uint32 tournament_id = 1;
if (has_tournament_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->tournament_id(), output);
}
// optional uint64 client_tournament_gid = 2;
if (has_client_tournament_gid()) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(2, this->client_tournament_gid(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTATournamentRequest)
}
::google::protobuf::uint8* CMsgDOTATournamentRequest::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTATournamentRequest)
// optional uint32 tournament_id = 1;
if (has_tournament_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->tournament_id(), target);
}
// optional uint64 client_tournament_gid = 2;
if (has_client_tournament_gid()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(2, this->client_tournament_gid(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTATournamentRequest)
return target;
}
int CMsgDOTATournamentRequest::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional uint32 tournament_id = 1;
if (has_tournament_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->tournament_id());
}
// optional uint64 client_tournament_gid = 2;
if (has_client_tournament_gid()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->client_tournament_gid());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTATournamentRequest::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTATournamentRequest* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTATournamentRequest*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTATournamentRequest::MergeFrom(const CMsgDOTATournamentRequest& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_tournament_id()) {
set_tournament_id(from.tournament_id());
}
if (from.has_client_tournament_gid()) {
set_client_tournament_gid(from.client_tournament_gid());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTATournamentRequest::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTATournamentRequest::CopyFrom(const CMsgDOTATournamentRequest& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTATournamentRequest::IsInitialized() const {
return true;
}
void CMsgDOTATournamentRequest::Swap(CMsgDOTATournamentRequest* other) {
if (other != this) {
std::swap(tournament_id_, other->tournament_id_);
std::swap(client_tournament_gid_, other->client_tournament_gid_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTATournamentRequest::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTATournamentRequest_descriptor_;
metadata.reflection = CMsgDOTATournamentRequest_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int CMsgDOTATournamentResponse::kResultFieldNumber;
const int CMsgDOTATournamentResponse::kTournamentFieldNumber;
#endif // !_MSC_VER
CMsgDOTATournamentResponse::CMsgDOTATournamentResponse()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTATournamentResponse)
}
void CMsgDOTATournamentResponse::InitAsDefaultInstance() {
tournament_ = const_cast< ::CMsgDOTATournament*>(&::CMsgDOTATournament::default_instance());
}
CMsgDOTATournamentResponse::CMsgDOTATournamentResponse(const CMsgDOTATournamentResponse& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTATournamentResponse)
}
void CMsgDOTATournamentResponse::SharedCtor() {
_cached_size_ = 0;
result_ = 2u;
tournament_ = NULL;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTATournamentResponse::~CMsgDOTATournamentResponse() {
// @@protoc_insertion_point(destructor:CMsgDOTATournamentResponse)
SharedDtor();
}
void CMsgDOTATournamentResponse::SharedDtor() {
if (this != default_instance_) {
delete tournament_;
}
}
void CMsgDOTATournamentResponse::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTATournamentResponse::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTATournamentResponse_descriptor_;
}
const CMsgDOTATournamentResponse& CMsgDOTATournamentResponse::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTATournamentResponse* CMsgDOTATournamentResponse::default_instance_ = NULL;
CMsgDOTATournamentResponse* CMsgDOTATournamentResponse::New() const {
return new CMsgDOTATournamentResponse;
}
void CMsgDOTATournamentResponse::Clear() {
if (_has_bits_[0 / 32] & 3) {
result_ = 2u;
if (has_tournament()) {
if (tournament_ != NULL) tournament_->::CMsgDOTATournament::Clear();
}
}
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTATournamentResponse::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTATournamentResponse)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint32 result = 1 [default = 2];
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &result_)));
set_has_result();
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_tournament;
break;
}
// optional .CMsgDOTATournament tournament = 2;
case 2: {
if (tag == 18) {
parse_tournament:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_tournament()));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTATournamentResponse)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTATournamentResponse)
return false;
#undef DO_
}
void CMsgDOTATournamentResponse::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTATournamentResponse)
// optional uint32 result = 1 [default = 2];
if (has_result()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->result(), output);
}
// optional .CMsgDOTATournament tournament = 2;
if (has_tournament()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, this->tournament(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTATournamentResponse)
}
::google::protobuf::uint8* CMsgDOTATournamentResponse::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTATournamentResponse)
// optional uint32 result = 1 [default = 2];
if (has_result()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->result(), target);
}
// optional .CMsgDOTATournament tournament = 2;
if (has_tournament()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
2, this->tournament(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTATournamentResponse)
return target;
}
int CMsgDOTATournamentResponse::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional uint32 result = 1 [default = 2];
if (has_result()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->result());
}
// optional .CMsgDOTATournament tournament = 2;
if (has_tournament()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->tournament());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTATournamentResponse::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTATournamentResponse* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTATournamentResponse*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTATournamentResponse::MergeFrom(const CMsgDOTATournamentResponse& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_result()) {
set_result(from.result());
}
if (from.has_tournament()) {
mutable_tournament()->::CMsgDOTATournament::MergeFrom(from.tournament());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTATournamentResponse::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTATournamentResponse::CopyFrom(const CMsgDOTATournamentResponse& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTATournamentResponse::IsInitialized() const {
return true;
}
void CMsgDOTATournamentResponse::Swap(CMsgDOTATournamentResponse* other) {
if (other != this) {
std::swap(result_, other->result_);
std::swap(tournament_, other->tournament_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTATournamentResponse::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTATournamentResponse_descriptor_;
metadata.reflection = CMsgDOTATournamentResponse_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int CMsgDOTAClearTournamentGame::kTournamentIdFieldNumber;
const int CMsgDOTAClearTournamentGame::kGameIdFieldNumber;
#endif // !_MSC_VER
CMsgDOTAClearTournamentGame::CMsgDOTAClearTournamentGame()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTAClearTournamentGame)
}
void CMsgDOTAClearTournamentGame::InitAsDefaultInstance() {
}
CMsgDOTAClearTournamentGame::CMsgDOTAClearTournamentGame(const CMsgDOTAClearTournamentGame& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTAClearTournamentGame)
}
void CMsgDOTAClearTournamentGame::SharedCtor() {
_cached_size_ = 0;
tournament_id_ = 0u;
game_id_ = 0u;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTAClearTournamentGame::~CMsgDOTAClearTournamentGame() {
// @@protoc_insertion_point(destructor:CMsgDOTAClearTournamentGame)
SharedDtor();
}
void CMsgDOTAClearTournamentGame::SharedDtor() {
if (this != default_instance_) {
}
}
void CMsgDOTAClearTournamentGame::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTAClearTournamentGame::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTAClearTournamentGame_descriptor_;
}
const CMsgDOTAClearTournamentGame& CMsgDOTAClearTournamentGame::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTAClearTournamentGame* CMsgDOTAClearTournamentGame::default_instance_ = NULL;
CMsgDOTAClearTournamentGame* CMsgDOTAClearTournamentGame::New() const {
return new CMsgDOTAClearTournamentGame;
}
void CMsgDOTAClearTournamentGame::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<CMsgDOTAClearTournamentGame*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
ZR_(tournament_id_, game_id_);
#undef OFFSET_OF_FIELD_
#undef ZR_
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTAClearTournamentGame::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTAClearTournamentGame)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint32 tournament_id = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &tournament_id_)));
set_has_tournament_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_game_id;
break;
}
// optional uint32 game_id = 2;
case 2: {
if (tag == 16) {
parse_game_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &game_id_)));
set_has_game_id();
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTAClearTournamentGame)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTAClearTournamentGame)
return false;
#undef DO_
}
void CMsgDOTAClearTournamentGame::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTAClearTournamentGame)
// optional uint32 tournament_id = 1;
if (has_tournament_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->tournament_id(), output);
}
// optional uint32 game_id = 2;
if (has_game_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->game_id(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTAClearTournamentGame)
}
::google::protobuf::uint8* CMsgDOTAClearTournamentGame::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTAClearTournamentGame)
// optional uint32 tournament_id = 1;
if (has_tournament_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->tournament_id(), target);
}
// optional uint32 game_id = 2;
if (has_game_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->game_id(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTAClearTournamentGame)
return target;
}
int CMsgDOTAClearTournamentGame::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional uint32 tournament_id = 1;
if (has_tournament_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->tournament_id());
}
// optional uint32 game_id = 2;
if (has_game_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->game_id());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTAClearTournamentGame::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTAClearTournamentGame* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTAClearTournamentGame*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTAClearTournamentGame::MergeFrom(const CMsgDOTAClearTournamentGame& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_tournament_id()) {
set_tournament_id(from.tournament_id());
}
if (from.has_game_id()) {
set_game_id(from.game_id());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTAClearTournamentGame::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTAClearTournamentGame::CopyFrom(const CMsgDOTAClearTournamentGame& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTAClearTournamentGame::IsInitialized() const {
return true;
}
void CMsgDOTAClearTournamentGame::Swap(CMsgDOTAClearTournamentGame* other) {
if (other != this) {
std::swap(tournament_id_, other->tournament_id_);
std::swap(game_id_, other->game_id_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTAClearTournamentGame::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTAClearTournamentGame_descriptor_;
metadata.reflection = CMsgDOTAClearTournamentGame_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int CMsgDOTAWeekendTourneyPlayerSkillLevelStats::kSkillLevelFieldNumber;
const int CMsgDOTAWeekendTourneyPlayerSkillLevelStats::kTimesWon0FieldNumber;
const int CMsgDOTAWeekendTourneyPlayerSkillLevelStats::kTimesWon1FieldNumber;
const int CMsgDOTAWeekendTourneyPlayerSkillLevelStats::kTimesWon2FieldNumber;
const int CMsgDOTAWeekendTourneyPlayerSkillLevelStats::kTimesWon3FieldNumber;
const int CMsgDOTAWeekendTourneyPlayerSkillLevelStats::kTimesByeAndLostFieldNumber;
const int CMsgDOTAWeekendTourneyPlayerSkillLevelStats::kTimesByeAndWonFieldNumber;
const int CMsgDOTAWeekendTourneyPlayerSkillLevelStats::kTotalGamesWonFieldNumber;
const int CMsgDOTAWeekendTourneyPlayerSkillLevelStats::kScoreFieldNumber;
#endif // !_MSC_VER
CMsgDOTAWeekendTourneyPlayerSkillLevelStats::CMsgDOTAWeekendTourneyPlayerSkillLevelStats()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTAWeekendTourneyPlayerSkillLevelStats)
}
void CMsgDOTAWeekendTourneyPlayerSkillLevelStats::InitAsDefaultInstance() {
}
CMsgDOTAWeekendTourneyPlayerSkillLevelStats::CMsgDOTAWeekendTourneyPlayerSkillLevelStats(const CMsgDOTAWeekendTourneyPlayerSkillLevelStats& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTAWeekendTourneyPlayerSkillLevelStats)
}
void CMsgDOTAWeekendTourneyPlayerSkillLevelStats::SharedCtor() {
_cached_size_ = 0;
skill_level_ = 0u;
times_won_0_ = 0u;
times_won_1_ = 0u;
times_won_2_ = 0u;
times_won_3_ = 0u;
times_bye_and_lost_ = 0u;
times_bye_and_won_ = 0u;
total_games_won_ = 0u;
score_ = 0u;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTAWeekendTourneyPlayerSkillLevelStats::~CMsgDOTAWeekendTourneyPlayerSkillLevelStats() {
// @@protoc_insertion_point(destructor:CMsgDOTAWeekendTourneyPlayerSkillLevelStats)
SharedDtor();
}
void CMsgDOTAWeekendTourneyPlayerSkillLevelStats::SharedDtor() {
if (this != default_instance_) {
}
}
void CMsgDOTAWeekendTourneyPlayerSkillLevelStats::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTAWeekendTourneyPlayerSkillLevelStats::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTAWeekendTourneyPlayerSkillLevelStats_descriptor_;
}
const CMsgDOTAWeekendTourneyPlayerSkillLevelStats& CMsgDOTAWeekendTourneyPlayerSkillLevelStats::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTAWeekendTourneyPlayerSkillLevelStats* CMsgDOTAWeekendTourneyPlayerSkillLevelStats::default_instance_ = NULL;
CMsgDOTAWeekendTourneyPlayerSkillLevelStats* CMsgDOTAWeekendTourneyPlayerSkillLevelStats::New() const {
return new CMsgDOTAWeekendTourneyPlayerSkillLevelStats;
}
void CMsgDOTAWeekendTourneyPlayerSkillLevelStats::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<CMsgDOTAWeekendTourneyPlayerSkillLevelStats*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
if (_has_bits_[0 / 32] & 255) {
ZR_(skill_level_, total_games_won_);
}
score_ = 0u;
#undef OFFSET_OF_FIELD_
#undef ZR_
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTAWeekendTourneyPlayerSkillLevelStats::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTAWeekendTourneyPlayerSkillLevelStats)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint32 skill_level = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &skill_level_)));
set_has_skill_level();
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_times_won_0;
break;
}
// optional uint32 times_won_0 = 2;
case 2: {
if (tag == 16) {
parse_times_won_0:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, ×_won_0_)));
set_has_times_won_0();
} else {
goto handle_unusual;
}
if (input->ExpectTag(24)) goto parse_times_won_1;
break;
}
// optional uint32 times_won_1 = 3;
case 3: {
if (tag == 24) {
parse_times_won_1:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, ×_won_1_)));
set_has_times_won_1();
} else {
goto handle_unusual;
}
if (input->ExpectTag(32)) goto parse_times_won_2;
break;
}
// optional uint32 times_won_2 = 4;
case 4: {
if (tag == 32) {
parse_times_won_2:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, ×_won_2_)));
set_has_times_won_2();
} else {
goto handle_unusual;
}
if (input->ExpectTag(40)) goto parse_times_won_3;
break;
}
// optional uint32 times_won_3 = 5;
case 5: {
if (tag == 40) {
parse_times_won_3:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, ×_won_3_)));
set_has_times_won_3();
} else {
goto handle_unusual;
}
if (input->ExpectTag(48)) goto parse_times_bye_and_lost;
break;
}
// optional uint32 times_bye_and_lost = 6;
case 6: {
if (tag == 48) {
parse_times_bye_and_lost:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, ×_bye_and_lost_)));
set_has_times_bye_and_lost();
} else {
goto handle_unusual;
}
if (input->ExpectTag(56)) goto parse_times_bye_and_won;
break;
}
// optional uint32 times_bye_and_won = 7;
case 7: {
if (tag == 56) {
parse_times_bye_and_won:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, ×_bye_and_won_)));
set_has_times_bye_and_won();
} else {
goto handle_unusual;
}
if (input->ExpectTag(64)) goto parse_total_games_won;
break;
}
// optional uint32 total_games_won = 8;
case 8: {
if (tag == 64) {
parse_total_games_won:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &total_games_won_)));
set_has_total_games_won();
} else {
goto handle_unusual;
}
if (input->ExpectTag(72)) goto parse_score;
break;
}
// optional uint32 score = 9;
case 9: {
if (tag == 72) {
parse_score:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &score_)));
set_has_score();
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTAWeekendTourneyPlayerSkillLevelStats)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTAWeekendTourneyPlayerSkillLevelStats)
return false;
#undef DO_
}
void CMsgDOTAWeekendTourneyPlayerSkillLevelStats::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTAWeekendTourneyPlayerSkillLevelStats)
// optional uint32 skill_level = 1;
if (has_skill_level()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->skill_level(), output);
}
// optional uint32 times_won_0 = 2;
if (has_times_won_0()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->times_won_0(), output);
}
// optional uint32 times_won_1 = 3;
if (has_times_won_1()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(3, this->times_won_1(), output);
}
// optional uint32 times_won_2 = 4;
if (has_times_won_2()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(4, this->times_won_2(), output);
}
// optional uint32 times_won_3 = 5;
if (has_times_won_3()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(5, this->times_won_3(), output);
}
// optional uint32 times_bye_and_lost = 6;
if (has_times_bye_and_lost()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(6, this->times_bye_and_lost(), output);
}
// optional uint32 times_bye_and_won = 7;
if (has_times_bye_and_won()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(7, this->times_bye_and_won(), output);
}
// optional uint32 total_games_won = 8;
if (has_total_games_won()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(8, this->total_games_won(), output);
}
// optional uint32 score = 9;
if (has_score()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(9, this->score(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTAWeekendTourneyPlayerSkillLevelStats)
}
::google::protobuf::uint8* CMsgDOTAWeekendTourneyPlayerSkillLevelStats::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTAWeekendTourneyPlayerSkillLevelStats)
// optional uint32 skill_level = 1;
if (has_skill_level()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->skill_level(), target);
}
// optional uint32 times_won_0 = 2;
if (has_times_won_0()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->times_won_0(), target);
}
// optional uint32 times_won_1 = 3;
if (has_times_won_1()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(3, this->times_won_1(), target);
}
// optional uint32 times_won_2 = 4;
if (has_times_won_2()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(4, this->times_won_2(), target);
}
// optional uint32 times_won_3 = 5;
if (has_times_won_3()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(5, this->times_won_3(), target);
}
// optional uint32 times_bye_and_lost = 6;
if (has_times_bye_and_lost()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(6, this->times_bye_and_lost(), target);
}
// optional uint32 times_bye_and_won = 7;
if (has_times_bye_and_won()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(7, this->times_bye_and_won(), target);
}
// optional uint32 total_games_won = 8;
if (has_total_games_won()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(8, this->total_games_won(), target);
}
// optional uint32 score = 9;
if (has_score()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(9, this->score(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTAWeekendTourneyPlayerSkillLevelStats)
return target;
}
int CMsgDOTAWeekendTourneyPlayerSkillLevelStats::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional uint32 skill_level = 1;
if (has_skill_level()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->skill_level());
}
// optional uint32 times_won_0 = 2;
if (has_times_won_0()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->times_won_0());
}
// optional uint32 times_won_1 = 3;
if (has_times_won_1()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->times_won_1());
}
// optional uint32 times_won_2 = 4;
if (has_times_won_2()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->times_won_2());
}
// optional uint32 times_won_3 = 5;
if (has_times_won_3()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->times_won_3());
}
// optional uint32 times_bye_and_lost = 6;
if (has_times_bye_and_lost()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->times_bye_and_lost());
}
// optional uint32 times_bye_and_won = 7;
if (has_times_bye_and_won()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->times_bye_and_won());
}
// optional uint32 total_games_won = 8;
if (has_total_games_won()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->total_games_won());
}
}
if (_has_bits_[8 / 32] & (0xffu << (8 % 32))) {
// optional uint32 score = 9;
if (has_score()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->score());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTAWeekendTourneyPlayerSkillLevelStats::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTAWeekendTourneyPlayerSkillLevelStats* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTAWeekendTourneyPlayerSkillLevelStats*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTAWeekendTourneyPlayerSkillLevelStats::MergeFrom(const CMsgDOTAWeekendTourneyPlayerSkillLevelStats& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_skill_level()) {
set_skill_level(from.skill_level());
}
if (from.has_times_won_0()) {
set_times_won_0(from.times_won_0());
}
if (from.has_times_won_1()) {
set_times_won_1(from.times_won_1());
}
if (from.has_times_won_2()) {
set_times_won_2(from.times_won_2());
}
if (from.has_times_won_3()) {
set_times_won_3(from.times_won_3());
}
if (from.has_times_bye_and_lost()) {
set_times_bye_and_lost(from.times_bye_and_lost());
}
if (from.has_times_bye_and_won()) {
set_times_bye_and_won(from.times_bye_and_won());
}
if (from.has_total_games_won()) {
set_total_games_won(from.total_games_won());
}
}
if (from._has_bits_[8 / 32] & (0xffu << (8 % 32))) {
if (from.has_score()) {
set_score(from.score());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTAWeekendTourneyPlayerSkillLevelStats::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTAWeekendTourneyPlayerSkillLevelStats::CopyFrom(const CMsgDOTAWeekendTourneyPlayerSkillLevelStats& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTAWeekendTourneyPlayerSkillLevelStats::IsInitialized() const {
return true;
}
void CMsgDOTAWeekendTourneyPlayerSkillLevelStats::Swap(CMsgDOTAWeekendTourneyPlayerSkillLevelStats* other) {
if (other != this) {
std::swap(skill_level_, other->skill_level_);
std::swap(times_won_0_, other->times_won_0_);
std::swap(times_won_1_, other->times_won_1_);
std::swap(times_won_2_, other->times_won_2_);
std::swap(times_won_3_, other->times_won_3_);
std::swap(times_bye_and_lost_, other->times_bye_and_lost_);
std::swap(times_bye_and_won_, other->times_bye_and_won_);
std::swap(total_games_won_, other->total_games_won_);
std::swap(score_, other->score_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTAWeekendTourneyPlayerSkillLevelStats::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTAWeekendTourneyPlayerSkillLevelStats_descriptor_;
metadata.reflection = CMsgDOTAWeekendTourneyPlayerSkillLevelStats_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int CMsgDOTAWeekendTourneyPlayerStats::kAccountIdFieldNumber;
const int CMsgDOTAWeekendTourneyPlayerStats::kSeasonTrophyIdFieldNumber;
const int CMsgDOTAWeekendTourneyPlayerStats::kSkillLevelsFieldNumber;
const int CMsgDOTAWeekendTourneyPlayerStats::kCurrentTierFieldNumber;
#endif // !_MSC_VER
CMsgDOTAWeekendTourneyPlayerStats::CMsgDOTAWeekendTourneyPlayerStats()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTAWeekendTourneyPlayerStats)
}
void CMsgDOTAWeekendTourneyPlayerStats::InitAsDefaultInstance() {
}
CMsgDOTAWeekendTourneyPlayerStats::CMsgDOTAWeekendTourneyPlayerStats(const CMsgDOTAWeekendTourneyPlayerStats& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTAWeekendTourneyPlayerStats)
}
void CMsgDOTAWeekendTourneyPlayerStats::SharedCtor() {
_cached_size_ = 0;
account_id_ = 0u;
season_trophy_id_ = 0u;
current_tier_ = 0u;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTAWeekendTourneyPlayerStats::~CMsgDOTAWeekendTourneyPlayerStats() {
// @@protoc_insertion_point(destructor:CMsgDOTAWeekendTourneyPlayerStats)
SharedDtor();
}
void CMsgDOTAWeekendTourneyPlayerStats::SharedDtor() {
if (this != default_instance_) {
}
}
void CMsgDOTAWeekendTourneyPlayerStats::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTAWeekendTourneyPlayerStats::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTAWeekendTourneyPlayerStats_descriptor_;
}
const CMsgDOTAWeekendTourneyPlayerStats& CMsgDOTAWeekendTourneyPlayerStats::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTAWeekendTourneyPlayerStats* CMsgDOTAWeekendTourneyPlayerStats::default_instance_ = NULL;
CMsgDOTAWeekendTourneyPlayerStats* CMsgDOTAWeekendTourneyPlayerStats::New() const {
return new CMsgDOTAWeekendTourneyPlayerStats;
}
void CMsgDOTAWeekendTourneyPlayerStats::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<CMsgDOTAWeekendTourneyPlayerStats*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
if (_has_bits_[0 / 32] & 11) {
ZR_(account_id_, season_trophy_id_);
current_tier_ = 0u;
}
#undef OFFSET_OF_FIELD_
#undef ZR_
skill_levels_.Clear();
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTAWeekendTourneyPlayerStats::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTAWeekendTourneyPlayerStats)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint32 account_id = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &account_id_)));
set_has_account_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_season_trophy_id;
break;
}
// optional uint32 season_trophy_id = 2;
case 2: {
if (tag == 16) {
parse_season_trophy_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &season_trophy_id_)));
set_has_season_trophy_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(26)) goto parse_skill_levels;
break;
}
// repeated .CMsgDOTAWeekendTourneyPlayerSkillLevelStats skill_levels = 3;
case 3: {
if (tag == 26) {
parse_skill_levels:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_skill_levels()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(26)) goto parse_skill_levels;
if (input->ExpectTag(32)) goto parse_current_tier;
break;
}
// optional uint32 current_tier = 4;
case 4: {
if (tag == 32) {
parse_current_tier:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, ¤t_tier_)));
set_has_current_tier();
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTAWeekendTourneyPlayerStats)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTAWeekendTourneyPlayerStats)
return false;
#undef DO_
}
void CMsgDOTAWeekendTourneyPlayerStats::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTAWeekendTourneyPlayerStats)
// optional uint32 account_id = 1;
if (has_account_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->account_id(), output);
}
// optional uint32 season_trophy_id = 2;
if (has_season_trophy_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->season_trophy_id(), output);
}
// repeated .CMsgDOTAWeekendTourneyPlayerSkillLevelStats skill_levels = 3;
for (int i = 0; i < this->skill_levels_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, this->skill_levels(i), output);
}
// optional uint32 current_tier = 4;
if (has_current_tier()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(4, this->current_tier(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTAWeekendTourneyPlayerStats)
}
::google::protobuf::uint8* CMsgDOTAWeekendTourneyPlayerStats::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTAWeekendTourneyPlayerStats)
// optional uint32 account_id = 1;
if (has_account_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->account_id(), target);
}
// optional uint32 season_trophy_id = 2;
if (has_season_trophy_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->season_trophy_id(), target);
}
// repeated .CMsgDOTAWeekendTourneyPlayerSkillLevelStats skill_levels = 3;
for (int i = 0; i < this->skill_levels_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
3, this->skill_levels(i), target);
}
// optional uint32 current_tier = 4;
if (has_current_tier()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(4, this->current_tier(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTAWeekendTourneyPlayerStats)
return target;
}
int CMsgDOTAWeekendTourneyPlayerStats::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional uint32 account_id = 1;
if (has_account_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->account_id());
}
// optional uint32 season_trophy_id = 2;
if (has_season_trophy_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->season_trophy_id());
}
// optional uint32 current_tier = 4;
if (has_current_tier()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->current_tier());
}
}
// repeated .CMsgDOTAWeekendTourneyPlayerSkillLevelStats skill_levels = 3;
total_size += 1 * this->skill_levels_size();
for (int i = 0; i < this->skill_levels_size(); i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->skill_levels(i));
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTAWeekendTourneyPlayerStats::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTAWeekendTourneyPlayerStats* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTAWeekendTourneyPlayerStats*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTAWeekendTourneyPlayerStats::MergeFrom(const CMsgDOTAWeekendTourneyPlayerStats& from) {
GOOGLE_CHECK_NE(&from, this);
skill_levels_.MergeFrom(from.skill_levels_);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_account_id()) {
set_account_id(from.account_id());
}
if (from.has_season_trophy_id()) {
set_season_trophy_id(from.season_trophy_id());
}
if (from.has_current_tier()) {
set_current_tier(from.current_tier());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTAWeekendTourneyPlayerStats::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTAWeekendTourneyPlayerStats::CopyFrom(const CMsgDOTAWeekendTourneyPlayerStats& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTAWeekendTourneyPlayerStats::IsInitialized() const {
return true;
}
void CMsgDOTAWeekendTourneyPlayerStats::Swap(CMsgDOTAWeekendTourneyPlayerStats* other) {
if (other != this) {
std::swap(account_id_, other->account_id_);
std::swap(season_trophy_id_, other->season_trophy_id_);
skill_levels_.Swap(&other->skill_levels_);
std::swap(current_tier_, other->current_tier_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTAWeekendTourneyPlayerStats::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTAWeekendTourneyPlayerStats_descriptor_;
metadata.reflection = CMsgDOTAWeekendTourneyPlayerStats_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int CMsgDOTAWeekendTourneyPlayerStatsRequest::kAccountIdFieldNumber;
const int CMsgDOTAWeekendTourneyPlayerStatsRequest::kSeasonTrophyIdFieldNumber;
#endif // !_MSC_VER
CMsgDOTAWeekendTourneyPlayerStatsRequest::CMsgDOTAWeekendTourneyPlayerStatsRequest()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTAWeekendTourneyPlayerStatsRequest)
}
void CMsgDOTAWeekendTourneyPlayerStatsRequest::InitAsDefaultInstance() {
}
CMsgDOTAWeekendTourneyPlayerStatsRequest::CMsgDOTAWeekendTourneyPlayerStatsRequest(const CMsgDOTAWeekendTourneyPlayerStatsRequest& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTAWeekendTourneyPlayerStatsRequest)
}
void CMsgDOTAWeekendTourneyPlayerStatsRequest::SharedCtor() {
_cached_size_ = 0;
account_id_ = 0u;
season_trophy_id_ = 0u;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTAWeekendTourneyPlayerStatsRequest::~CMsgDOTAWeekendTourneyPlayerStatsRequest() {
// @@protoc_insertion_point(destructor:CMsgDOTAWeekendTourneyPlayerStatsRequest)
SharedDtor();
}
void CMsgDOTAWeekendTourneyPlayerStatsRequest::SharedDtor() {
if (this != default_instance_) {
}
}
void CMsgDOTAWeekendTourneyPlayerStatsRequest::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTAWeekendTourneyPlayerStatsRequest::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTAWeekendTourneyPlayerStatsRequest_descriptor_;
}
const CMsgDOTAWeekendTourneyPlayerStatsRequest& CMsgDOTAWeekendTourneyPlayerStatsRequest::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTAWeekendTourneyPlayerStatsRequest* CMsgDOTAWeekendTourneyPlayerStatsRequest::default_instance_ = NULL;
CMsgDOTAWeekendTourneyPlayerStatsRequest* CMsgDOTAWeekendTourneyPlayerStatsRequest::New() const {
return new CMsgDOTAWeekendTourneyPlayerStatsRequest;
}
void CMsgDOTAWeekendTourneyPlayerStatsRequest::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<CMsgDOTAWeekendTourneyPlayerStatsRequest*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
ZR_(account_id_, season_trophy_id_);
#undef OFFSET_OF_FIELD_
#undef ZR_
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTAWeekendTourneyPlayerStatsRequest::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTAWeekendTourneyPlayerStatsRequest)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint32 account_id = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &account_id_)));
set_has_account_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_season_trophy_id;
break;
}
// optional uint32 season_trophy_id = 2;
case 2: {
if (tag == 16) {
parse_season_trophy_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &season_trophy_id_)));
set_has_season_trophy_id();
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTAWeekendTourneyPlayerStatsRequest)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTAWeekendTourneyPlayerStatsRequest)
return false;
#undef DO_
}
void CMsgDOTAWeekendTourneyPlayerStatsRequest::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTAWeekendTourneyPlayerStatsRequest)
// optional uint32 account_id = 1;
if (has_account_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->account_id(), output);
}
// optional uint32 season_trophy_id = 2;
if (has_season_trophy_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->season_trophy_id(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTAWeekendTourneyPlayerStatsRequest)
}
::google::protobuf::uint8* CMsgDOTAWeekendTourneyPlayerStatsRequest::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTAWeekendTourneyPlayerStatsRequest)
// optional uint32 account_id = 1;
if (has_account_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->account_id(), target);
}
// optional uint32 season_trophy_id = 2;
if (has_season_trophy_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->season_trophy_id(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTAWeekendTourneyPlayerStatsRequest)
return target;
}
int CMsgDOTAWeekendTourneyPlayerStatsRequest::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional uint32 account_id = 1;
if (has_account_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->account_id());
}
// optional uint32 season_trophy_id = 2;
if (has_season_trophy_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->season_trophy_id());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTAWeekendTourneyPlayerStatsRequest::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTAWeekendTourneyPlayerStatsRequest* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTAWeekendTourneyPlayerStatsRequest*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTAWeekendTourneyPlayerStatsRequest::MergeFrom(const CMsgDOTAWeekendTourneyPlayerStatsRequest& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_account_id()) {
set_account_id(from.account_id());
}
if (from.has_season_trophy_id()) {
set_season_trophy_id(from.season_trophy_id());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTAWeekendTourneyPlayerStatsRequest::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTAWeekendTourneyPlayerStatsRequest::CopyFrom(const CMsgDOTAWeekendTourneyPlayerStatsRequest& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTAWeekendTourneyPlayerStatsRequest::IsInitialized() const {
return true;
}
void CMsgDOTAWeekendTourneyPlayerStatsRequest::Swap(CMsgDOTAWeekendTourneyPlayerStatsRequest* other) {
if (other != this) {
std::swap(account_id_, other->account_id_);
std::swap(season_trophy_id_, other->season_trophy_id_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTAWeekendTourneyPlayerStatsRequest::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTAWeekendTourneyPlayerStatsRequest_descriptor_;
metadata.reflection = CMsgDOTAWeekendTourneyPlayerStatsRequest_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int CMsgDOTAWeekendTourneyPlayerHistoryRequest::kAccountIdFieldNumber;
const int CMsgDOTAWeekendTourneyPlayerHistoryRequest::kSeasonTrophyIdFieldNumber;
#endif // !_MSC_VER
CMsgDOTAWeekendTourneyPlayerHistoryRequest::CMsgDOTAWeekendTourneyPlayerHistoryRequest()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTAWeekendTourneyPlayerHistoryRequest)
}
void CMsgDOTAWeekendTourneyPlayerHistoryRequest::InitAsDefaultInstance() {
}
CMsgDOTAWeekendTourneyPlayerHistoryRequest::CMsgDOTAWeekendTourneyPlayerHistoryRequest(const CMsgDOTAWeekendTourneyPlayerHistoryRequest& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTAWeekendTourneyPlayerHistoryRequest)
}
void CMsgDOTAWeekendTourneyPlayerHistoryRequest::SharedCtor() {
_cached_size_ = 0;
account_id_ = 0u;
season_trophy_id_ = 0u;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTAWeekendTourneyPlayerHistoryRequest::~CMsgDOTAWeekendTourneyPlayerHistoryRequest() {
// @@protoc_insertion_point(destructor:CMsgDOTAWeekendTourneyPlayerHistoryRequest)
SharedDtor();
}
void CMsgDOTAWeekendTourneyPlayerHistoryRequest::SharedDtor() {
if (this != default_instance_) {
}
}
void CMsgDOTAWeekendTourneyPlayerHistoryRequest::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTAWeekendTourneyPlayerHistoryRequest::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTAWeekendTourneyPlayerHistoryRequest_descriptor_;
}
const CMsgDOTAWeekendTourneyPlayerHistoryRequest& CMsgDOTAWeekendTourneyPlayerHistoryRequest::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTAWeekendTourneyPlayerHistoryRequest* CMsgDOTAWeekendTourneyPlayerHistoryRequest::default_instance_ = NULL;
CMsgDOTAWeekendTourneyPlayerHistoryRequest* CMsgDOTAWeekendTourneyPlayerHistoryRequest::New() const {
return new CMsgDOTAWeekendTourneyPlayerHistoryRequest;
}
void CMsgDOTAWeekendTourneyPlayerHistoryRequest::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<CMsgDOTAWeekendTourneyPlayerHistoryRequest*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
ZR_(account_id_, season_trophy_id_);
#undef OFFSET_OF_FIELD_
#undef ZR_
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTAWeekendTourneyPlayerHistoryRequest::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTAWeekendTourneyPlayerHistoryRequest)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint32 account_id = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &account_id_)));
set_has_account_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_season_trophy_id;
break;
}
// optional uint32 season_trophy_id = 2;
case 2: {
if (tag == 16) {
parse_season_trophy_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &season_trophy_id_)));
set_has_season_trophy_id();
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTAWeekendTourneyPlayerHistoryRequest)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTAWeekendTourneyPlayerHistoryRequest)
return false;
#undef DO_
}
void CMsgDOTAWeekendTourneyPlayerHistoryRequest::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTAWeekendTourneyPlayerHistoryRequest)
// optional uint32 account_id = 1;
if (has_account_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->account_id(), output);
}
// optional uint32 season_trophy_id = 2;
if (has_season_trophy_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->season_trophy_id(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTAWeekendTourneyPlayerHistoryRequest)
}
::google::protobuf::uint8* CMsgDOTAWeekendTourneyPlayerHistoryRequest::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTAWeekendTourneyPlayerHistoryRequest)
// optional uint32 account_id = 1;
if (has_account_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->account_id(), target);
}
// optional uint32 season_trophy_id = 2;
if (has_season_trophy_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->season_trophy_id(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTAWeekendTourneyPlayerHistoryRequest)
return target;
}
int CMsgDOTAWeekendTourneyPlayerHistoryRequest::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional uint32 account_id = 1;
if (has_account_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->account_id());
}
// optional uint32 season_trophy_id = 2;
if (has_season_trophy_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->season_trophy_id());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTAWeekendTourneyPlayerHistoryRequest::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTAWeekendTourneyPlayerHistoryRequest* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTAWeekendTourneyPlayerHistoryRequest*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTAWeekendTourneyPlayerHistoryRequest::MergeFrom(const CMsgDOTAWeekendTourneyPlayerHistoryRequest& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_account_id()) {
set_account_id(from.account_id());
}
if (from.has_season_trophy_id()) {
set_season_trophy_id(from.season_trophy_id());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTAWeekendTourneyPlayerHistoryRequest::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTAWeekendTourneyPlayerHistoryRequest::CopyFrom(const CMsgDOTAWeekendTourneyPlayerHistoryRequest& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTAWeekendTourneyPlayerHistoryRequest::IsInitialized() const {
return true;
}
void CMsgDOTAWeekendTourneyPlayerHistoryRequest::Swap(CMsgDOTAWeekendTourneyPlayerHistoryRequest* other) {
if (other != this) {
std::swap(account_id_, other->account_id_);
std::swap(season_trophy_id_, other->season_trophy_id_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTAWeekendTourneyPlayerHistoryRequest::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTAWeekendTourneyPlayerHistoryRequest_descriptor_;
metadata.reflection = CMsgDOTAWeekendTourneyPlayerHistoryRequest_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int CMsgDOTAWeekendTourneyPlayerHistory_Tournament::kTournamentIdFieldNumber;
const int CMsgDOTAWeekendTourneyPlayerHistory_Tournament::kStartTimeFieldNumber;
const int CMsgDOTAWeekendTourneyPlayerHistory_Tournament::kTournamentTierFieldNumber;
const int CMsgDOTAWeekendTourneyPlayerHistory_Tournament::kTeamIdFieldNumber;
const int CMsgDOTAWeekendTourneyPlayerHistory_Tournament::kTeamDateFieldNumber;
const int CMsgDOTAWeekendTourneyPlayerHistory_Tournament::kTeamResultFieldNumber;
const int CMsgDOTAWeekendTourneyPlayerHistory_Tournament::kAccountIdFieldNumber;
const int CMsgDOTAWeekendTourneyPlayerHistory_Tournament::kTeamNameFieldNumber;
const int CMsgDOTAWeekendTourneyPlayerHistory_Tournament::kSeasonTrophyIdFieldNumber;
#endif // !_MSC_VER
CMsgDOTAWeekendTourneyPlayerHistory_Tournament::CMsgDOTAWeekendTourneyPlayerHistory_Tournament()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTAWeekendTourneyPlayerHistory.Tournament)
}
void CMsgDOTAWeekendTourneyPlayerHistory_Tournament::InitAsDefaultInstance() {
}
CMsgDOTAWeekendTourneyPlayerHistory_Tournament::CMsgDOTAWeekendTourneyPlayerHistory_Tournament(const CMsgDOTAWeekendTourneyPlayerHistory_Tournament& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTAWeekendTourneyPlayerHistory.Tournament)
}
void CMsgDOTAWeekendTourneyPlayerHistory_Tournament::SharedCtor() {
::google::protobuf::internal::GetEmptyString();
_cached_size_ = 0;
tournament_id_ = 0u;
start_time_ = 0u;
tournament_tier_ = 0u;
team_id_ = 0u;
team_date_ = 0u;
team_result_ = 0u;
team_name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
season_trophy_id_ = 0u;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTAWeekendTourneyPlayerHistory_Tournament::~CMsgDOTAWeekendTourneyPlayerHistory_Tournament() {
// @@protoc_insertion_point(destructor:CMsgDOTAWeekendTourneyPlayerHistory.Tournament)
SharedDtor();
}
void CMsgDOTAWeekendTourneyPlayerHistory_Tournament::SharedDtor() {
if (team_name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete team_name_;
}
if (this != default_instance_) {
}
}
void CMsgDOTAWeekendTourneyPlayerHistory_Tournament::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTAWeekendTourneyPlayerHistory_Tournament::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTAWeekendTourneyPlayerHistory_Tournament_descriptor_;
}
const CMsgDOTAWeekendTourneyPlayerHistory_Tournament& CMsgDOTAWeekendTourneyPlayerHistory_Tournament::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTAWeekendTourneyPlayerHistory_Tournament* CMsgDOTAWeekendTourneyPlayerHistory_Tournament::default_instance_ = NULL;
CMsgDOTAWeekendTourneyPlayerHistory_Tournament* CMsgDOTAWeekendTourneyPlayerHistory_Tournament::New() const {
return new CMsgDOTAWeekendTourneyPlayerHistory_Tournament;
}
void CMsgDOTAWeekendTourneyPlayerHistory_Tournament::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<CMsgDOTAWeekendTourneyPlayerHistory_Tournament*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
if (_has_bits_[0 / 32] & 191) {
ZR_(tournament_id_, team_result_);
if (has_team_name()) {
if (team_name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
team_name_->clear();
}
}
}
season_trophy_id_ = 0u;
#undef OFFSET_OF_FIELD_
#undef ZR_
account_id_.Clear();
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTAWeekendTourneyPlayerHistory_Tournament::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTAWeekendTourneyPlayerHistory.Tournament)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint32 tournament_id = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &tournament_id_)));
set_has_tournament_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_start_time;
break;
}
// optional uint32 start_time = 2;
case 2: {
if (tag == 16) {
parse_start_time:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &start_time_)));
set_has_start_time();
} else {
goto handle_unusual;
}
if (input->ExpectTag(24)) goto parse_tournament_tier;
break;
}
// optional uint32 tournament_tier = 3;
case 3: {
if (tag == 24) {
parse_tournament_tier:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &tournament_tier_)));
set_has_tournament_tier();
} else {
goto handle_unusual;
}
if (input->ExpectTag(32)) goto parse_team_id;
break;
}
// optional uint32 team_id = 4;
case 4: {
if (tag == 32) {
parse_team_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &team_id_)));
set_has_team_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(40)) goto parse_team_date;
break;
}
// optional uint32 team_date = 5;
case 5: {
if (tag == 40) {
parse_team_date:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &team_date_)));
set_has_team_date();
} else {
goto handle_unusual;
}
if (input->ExpectTag(48)) goto parse_team_result;
break;
}
// optional uint32 team_result = 6;
case 6: {
if (tag == 48) {
parse_team_result:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &team_result_)));
set_has_team_result();
} else {
goto handle_unusual;
}
if (input->ExpectTag(56)) goto parse_account_id;
break;
}
// repeated uint32 account_id = 7;
case 7: {
if (tag == 56) {
parse_account_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
1, 56, input, this->mutable_account_id())));
} else if (tag == 58) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitiveNoInline<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, this->mutable_account_id())));
} else {
goto handle_unusual;
}
if (input->ExpectTag(56)) goto parse_account_id;
if (input->ExpectTag(66)) goto parse_team_name;
break;
}
// optional string team_name = 8;
case 8: {
if (tag == 66) {
parse_team_name:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_team_name()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->team_name().data(), this->team_name().length(),
::google::protobuf::internal::WireFormat::PARSE,
"team_name");
} else {
goto handle_unusual;
}
if (input->ExpectTag(72)) goto parse_season_trophy_id;
break;
}
// optional uint32 season_trophy_id = 9;
case 9: {
if (tag == 72) {
parse_season_trophy_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &season_trophy_id_)));
set_has_season_trophy_id();
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTAWeekendTourneyPlayerHistory.Tournament)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTAWeekendTourneyPlayerHistory.Tournament)
return false;
#undef DO_
}
void CMsgDOTAWeekendTourneyPlayerHistory_Tournament::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTAWeekendTourneyPlayerHistory.Tournament)
// optional uint32 tournament_id = 1;
if (has_tournament_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->tournament_id(), output);
}
// optional uint32 start_time = 2;
if (has_start_time()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->start_time(), output);
}
// optional uint32 tournament_tier = 3;
if (has_tournament_tier()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(3, this->tournament_tier(), output);
}
// optional uint32 team_id = 4;
if (has_team_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(4, this->team_id(), output);
}
// optional uint32 team_date = 5;
if (has_team_date()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(5, this->team_date(), output);
}
// optional uint32 team_result = 6;
if (has_team_result()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(6, this->team_result(), output);
}
// repeated uint32 account_id = 7;
for (int i = 0; i < this->account_id_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(
7, this->account_id(i), output);
}
// optional string team_name = 8;
if (has_team_name()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->team_name().data(), this->team_name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"team_name");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
8, this->team_name(), output);
}
// optional uint32 season_trophy_id = 9;
if (has_season_trophy_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(9, this->season_trophy_id(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTAWeekendTourneyPlayerHistory.Tournament)
}
::google::protobuf::uint8* CMsgDOTAWeekendTourneyPlayerHistory_Tournament::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTAWeekendTourneyPlayerHistory.Tournament)
// optional uint32 tournament_id = 1;
if (has_tournament_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->tournament_id(), target);
}
// optional uint32 start_time = 2;
if (has_start_time()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->start_time(), target);
}
// optional uint32 tournament_tier = 3;
if (has_tournament_tier()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(3, this->tournament_tier(), target);
}
// optional uint32 team_id = 4;
if (has_team_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(4, this->team_id(), target);
}
// optional uint32 team_date = 5;
if (has_team_date()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(5, this->team_date(), target);
}
// optional uint32 team_result = 6;
if (has_team_result()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(6, this->team_result(), target);
}
// repeated uint32 account_id = 7;
for (int i = 0; i < this->account_id_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteUInt32ToArray(7, this->account_id(i), target);
}
// optional string team_name = 8;
if (has_team_name()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->team_name().data(), this->team_name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"team_name");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
8, this->team_name(), target);
}
// optional uint32 season_trophy_id = 9;
if (has_season_trophy_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(9, this->season_trophy_id(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTAWeekendTourneyPlayerHistory.Tournament)
return target;
}
int CMsgDOTAWeekendTourneyPlayerHistory_Tournament::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional uint32 tournament_id = 1;
if (has_tournament_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->tournament_id());
}
// optional uint32 start_time = 2;
if (has_start_time()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->start_time());
}
// optional uint32 tournament_tier = 3;
if (has_tournament_tier()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->tournament_tier());
}
// optional uint32 team_id = 4;
if (has_team_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->team_id());
}
// optional uint32 team_date = 5;
if (has_team_date()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->team_date());
}
// optional uint32 team_result = 6;
if (has_team_result()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->team_result());
}
// optional string team_name = 8;
if (has_team_name()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->team_name());
}
}
if (_has_bits_[8 / 32] & (0xffu << (8 % 32))) {
// optional uint32 season_trophy_id = 9;
if (has_season_trophy_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->season_trophy_id());
}
}
// repeated uint32 account_id = 7;
{
int data_size = 0;
for (int i = 0; i < this->account_id_size(); i++) {
data_size += ::google::protobuf::internal::WireFormatLite::
UInt32Size(this->account_id(i));
}
total_size += 1 * this->account_id_size() + data_size;
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTAWeekendTourneyPlayerHistory_Tournament::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTAWeekendTourneyPlayerHistory_Tournament* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTAWeekendTourneyPlayerHistory_Tournament*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTAWeekendTourneyPlayerHistory_Tournament::MergeFrom(const CMsgDOTAWeekendTourneyPlayerHistory_Tournament& from) {
GOOGLE_CHECK_NE(&from, this);
account_id_.MergeFrom(from.account_id_);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_tournament_id()) {
set_tournament_id(from.tournament_id());
}
if (from.has_start_time()) {
set_start_time(from.start_time());
}
if (from.has_tournament_tier()) {
set_tournament_tier(from.tournament_tier());
}
if (from.has_team_id()) {
set_team_id(from.team_id());
}
if (from.has_team_date()) {
set_team_date(from.team_date());
}
if (from.has_team_result()) {
set_team_result(from.team_result());
}
if (from.has_team_name()) {
set_team_name(from.team_name());
}
}
if (from._has_bits_[8 / 32] & (0xffu << (8 % 32))) {
if (from.has_season_trophy_id()) {
set_season_trophy_id(from.season_trophy_id());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTAWeekendTourneyPlayerHistory_Tournament::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTAWeekendTourneyPlayerHistory_Tournament::CopyFrom(const CMsgDOTAWeekendTourneyPlayerHistory_Tournament& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTAWeekendTourneyPlayerHistory_Tournament::IsInitialized() const {
return true;
}
void CMsgDOTAWeekendTourneyPlayerHistory_Tournament::Swap(CMsgDOTAWeekendTourneyPlayerHistory_Tournament* other) {
if (other != this) {
std::swap(tournament_id_, other->tournament_id_);
std::swap(start_time_, other->start_time_);
std::swap(tournament_tier_, other->tournament_tier_);
std::swap(team_id_, other->team_id_);
std::swap(team_date_, other->team_date_);
std::swap(team_result_, other->team_result_);
account_id_.Swap(&other->account_id_);
std::swap(team_name_, other->team_name_);
std::swap(season_trophy_id_, other->season_trophy_id_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTAWeekendTourneyPlayerHistory_Tournament::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTAWeekendTourneyPlayerHistory_Tournament_descriptor_;
metadata.reflection = CMsgDOTAWeekendTourneyPlayerHistory_Tournament_reflection_;
return metadata;
}
// -------------------------------------------------------------------
#ifndef _MSC_VER
const int CMsgDOTAWeekendTourneyPlayerHistory::kAccountIdFieldNumber;
const int CMsgDOTAWeekendTourneyPlayerHistory::kTournamentsFieldNumber;
#endif // !_MSC_VER
CMsgDOTAWeekendTourneyPlayerHistory::CMsgDOTAWeekendTourneyPlayerHistory()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTAWeekendTourneyPlayerHistory)
}
void CMsgDOTAWeekendTourneyPlayerHistory::InitAsDefaultInstance() {
}
CMsgDOTAWeekendTourneyPlayerHistory::CMsgDOTAWeekendTourneyPlayerHistory(const CMsgDOTAWeekendTourneyPlayerHistory& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTAWeekendTourneyPlayerHistory)
}
void CMsgDOTAWeekendTourneyPlayerHistory::SharedCtor() {
_cached_size_ = 0;
account_id_ = 0u;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTAWeekendTourneyPlayerHistory::~CMsgDOTAWeekendTourneyPlayerHistory() {
// @@protoc_insertion_point(destructor:CMsgDOTAWeekendTourneyPlayerHistory)
SharedDtor();
}
void CMsgDOTAWeekendTourneyPlayerHistory::SharedDtor() {
if (this != default_instance_) {
}
}
void CMsgDOTAWeekendTourneyPlayerHistory::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTAWeekendTourneyPlayerHistory::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTAWeekendTourneyPlayerHistory_descriptor_;
}
const CMsgDOTAWeekendTourneyPlayerHistory& CMsgDOTAWeekendTourneyPlayerHistory::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTAWeekendTourneyPlayerHistory* CMsgDOTAWeekendTourneyPlayerHistory::default_instance_ = NULL;
CMsgDOTAWeekendTourneyPlayerHistory* CMsgDOTAWeekendTourneyPlayerHistory::New() const {
return new CMsgDOTAWeekendTourneyPlayerHistory;
}
void CMsgDOTAWeekendTourneyPlayerHistory::Clear() {
account_id_ = 0u;
tournaments_.Clear();
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTAWeekendTourneyPlayerHistory::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTAWeekendTourneyPlayerHistory)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint32 account_id = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &account_id_)));
set_has_account_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(26)) goto parse_tournaments;
break;
}
// repeated .CMsgDOTAWeekendTourneyPlayerHistory.Tournament tournaments = 3;
case 3: {
if (tag == 26) {
parse_tournaments:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_tournaments()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(26)) goto parse_tournaments;
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTAWeekendTourneyPlayerHistory)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTAWeekendTourneyPlayerHistory)
return false;
#undef DO_
}
void CMsgDOTAWeekendTourneyPlayerHistory::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTAWeekendTourneyPlayerHistory)
// optional uint32 account_id = 1;
if (has_account_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->account_id(), output);
}
// repeated .CMsgDOTAWeekendTourneyPlayerHistory.Tournament tournaments = 3;
for (int i = 0; i < this->tournaments_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, this->tournaments(i), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTAWeekendTourneyPlayerHistory)
}
::google::protobuf::uint8* CMsgDOTAWeekendTourneyPlayerHistory::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTAWeekendTourneyPlayerHistory)
// optional uint32 account_id = 1;
if (has_account_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->account_id(), target);
}
// repeated .CMsgDOTAWeekendTourneyPlayerHistory.Tournament tournaments = 3;
for (int i = 0; i < this->tournaments_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
3, this->tournaments(i), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTAWeekendTourneyPlayerHistory)
return target;
}
int CMsgDOTAWeekendTourneyPlayerHistory::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional uint32 account_id = 1;
if (has_account_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->account_id());
}
}
// repeated .CMsgDOTAWeekendTourneyPlayerHistory.Tournament tournaments = 3;
total_size += 1 * this->tournaments_size();
for (int i = 0; i < this->tournaments_size(); i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->tournaments(i));
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTAWeekendTourneyPlayerHistory::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTAWeekendTourneyPlayerHistory* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTAWeekendTourneyPlayerHistory*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTAWeekendTourneyPlayerHistory::MergeFrom(const CMsgDOTAWeekendTourneyPlayerHistory& from) {
GOOGLE_CHECK_NE(&from, this);
tournaments_.MergeFrom(from.tournaments_);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_account_id()) {
set_account_id(from.account_id());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTAWeekendTourneyPlayerHistory::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTAWeekendTourneyPlayerHistory::CopyFrom(const CMsgDOTAWeekendTourneyPlayerHistory& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTAWeekendTourneyPlayerHistory::IsInitialized() const {
return true;
}
void CMsgDOTAWeekendTourneyPlayerHistory::Swap(CMsgDOTAWeekendTourneyPlayerHistory* other) {
if (other != this) {
std::swap(account_id_, other->account_id_);
tournaments_.Swap(&other->tournaments_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTAWeekendTourneyPlayerHistory::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTAWeekendTourneyPlayerHistory_descriptor_;
metadata.reflection = CMsgDOTAWeekendTourneyPlayerHistory_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int CMsgDOTAWeekendTourneyParticipationDetails_Tier::kTierFieldNumber;
const int CMsgDOTAWeekendTourneyParticipationDetails_Tier::kPlayersFieldNumber;
const int CMsgDOTAWeekendTourneyParticipationDetails_Tier::kTeamsFieldNumber;
const int CMsgDOTAWeekendTourneyParticipationDetails_Tier::kWinningTeamsFieldNumber;
const int CMsgDOTAWeekendTourneyParticipationDetails_Tier::kPlayersStreak2FieldNumber;
const int CMsgDOTAWeekendTourneyParticipationDetails_Tier::kPlayersStreak3FieldNumber;
const int CMsgDOTAWeekendTourneyParticipationDetails_Tier::kPlayersStreak4FieldNumber;
const int CMsgDOTAWeekendTourneyParticipationDetails_Tier::kPlayersStreak5FieldNumber;
#endif // !_MSC_VER
CMsgDOTAWeekendTourneyParticipationDetails_Tier::CMsgDOTAWeekendTourneyParticipationDetails_Tier()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTAWeekendTourneyParticipationDetails.Tier)
}
void CMsgDOTAWeekendTourneyParticipationDetails_Tier::InitAsDefaultInstance() {
}
CMsgDOTAWeekendTourneyParticipationDetails_Tier::CMsgDOTAWeekendTourneyParticipationDetails_Tier(const CMsgDOTAWeekendTourneyParticipationDetails_Tier& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTAWeekendTourneyParticipationDetails.Tier)
}
void CMsgDOTAWeekendTourneyParticipationDetails_Tier::SharedCtor() {
_cached_size_ = 0;
tier_ = 0u;
players_ = 0u;
teams_ = 0u;
winning_teams_ = 0u;
players_streak_2_ = 0u;
players_streak_3_ = 0u;
players_streak_4_ = 0u;
players_streak_5_ = 0u;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTAWeekendTourneyParticipationDetails_Tier::~CMsgDOTAWeekendTourneyParticipationDetails_Tier() {
// @@protoc_insertion_point(destructor:CMsgDOTAWeekendTourneyParticipationDetails.Tier)
SharedDtor();
}
void CMsgDOTAWeekendTourneyParticipationDetails_Tier::SharedDtor() {
if (this != default_instance_) {
}
}
void CMsgDOTAWeekendTourneyParticipationDetails_Tier::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTAWeekendTourneyParticipationDetails_Tier::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTAWeekendTourneyParticipationDetails_Tier_descriptor_;
}
const CMsgDOTAWeekendTourneyParticipationDetails_Tier& CMsgDOTAWeekendTourneyParticipationDetails_Tier::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTAWeekendTourneyParticipationDetails_Tier* CMsgDOTAWeekendTourneyParticipationDetails_Tier::default_instance_ = NULL;
CMsgDOTAWeekendTourneyParticipationDetails_Tier* CMsgDOTAWeekendTourneyParticipationDetails_Tier::New() const {
return new CMsgDOTAWeekendTourneyParticipationDetails_Tier;
}
void CMsgDOTAWeekendTourneyParticipationDetails_Tier::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<CMsgDOTAWeekendTourneyParticipationDetails_Tier*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
if (_has_bits_[0 / 32] & 255) {
ZR_(tier_, players_streak_5_);
}
#undef OFFSET_OF_FIELD_
#undef ZR_
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTAWeekendTourneyParticipationDetails_Tier::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTAWeekendTourneyParticipationDetails.Tier)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint32 tier = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &tier_)));
set_has_tier();
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_players;
break;
}
// optional uint32 players = 2;
case 2: {
if (tag == 16) {
parse_players:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &players_)));
set_has_players();
} else {
goto handle_unusual;
}
if (input->ExpectTag(24)) goto parse_teams;
break;
}
// optional uint32 teams = 3;
case 3: {
if (tag == 24) {
parse_teams:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &teams_)));
set_has_teams();
} else {
goto handle_unusual;
}
if (input->ExpectTag(32)) goto parse_winning_teams;
break;
}
// optional uint32 winning_teams = 4;
case 4: {
if (tag == 32) {
parse_winning_teams:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &winning_teams_)));
set_has_winning_teams();
} else {
goto handle_unusual;
}
if (input->ExpectTag(40)) goto parse_players_streak_2;
break;
}
// optional uint32 players_streak_2 = 5;
case 5: {
if (tag == 40) {
parse_players_streak_2:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &players_streak_2_)));
set_has_players_streak_2();
} else {
goto handle_unusual;
}
if (input->ExpectTag(48)) goto parse_players_streak_3;
break;
}
// optional uint32 players_streak_3 = 6;
case 6: {
if (tag == 48) {
parse_players_streak_3:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &players_streak_3_)));
set_has_players_streak_3();
} else {
goto handle_unusual;
}
if (input->ExpectTag(56)) goto parse_players_streak_4;
break;
}
// optional uint32 players_streak_4 = 7;
case 7: {
if (tag == 56) {
parse_players_streak_4:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &players_streak_4_)));
set_has_players_streak_4();
} else {
goto handle_unusual;
}
if (input->ExpectTag(64)) goto parse_players_streak_5;
break;
}
// optional uint32 players_streak_5 = 8;
case 8: {
if (tag == 64) {
parse_players_streak_5:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &players_streak_5_)));
set_has_players_streak_5();
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTAWeekendTourneyParticipationDetails.Tier)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTAWeekendTourneyParticipationDetails.Tier)
return false;
#undef DO_
}
void CMsgDOTAWeekendTourneyParticipationDetails_Tier::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTAWeekendTourneyParticipationDetails.Tier)
// optional uint32 tier = 1;
if (has_tier()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->tier(), output);
}
// optional uint32 players = 2;
if (has_players()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->players(), output);
}
// optional uint32 teams = 3;
if (has_teams()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(3, this->teams(), output);
}
// optional uint32 winning_teams = 4;
if (has_winning_teams()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(4, this->winning_teams(), output);
}
// optional uint32 players_streak_2 = 5;
if (has_players_streak_2()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(5, this->players_streak_2(), output);
}
// optional uint32 players_streak_3 = 6;
if (has_players_streak_3()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(6, this->players_streak_3(), output);
}
// optional uint32 players_streak_4 = 7;
if (has_players_streak_4()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(7, this->players_streak_4(), output);
}
// optional uint32 players_streak_5 = 8;
if (has_players_streak_5()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(8, this->players_streak_5(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTAWeekendTourneyParticipationDetails.Tier)
}
::google::protobuf::uint8* CMsgDOTAWeekendTourneyParticipationDetails_Tier::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTAWeekendTourneyParticipationDetails.Tier)
// optional uint32 tier = 1;
if (has_tier()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->tier(), target);
}
// optional uint32 players = 2;
if (has_players()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->players(), target);
}
// optional uint32 teams = 3;
if (has_teams()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(3, this->teams(), target);
}
// optional uint32 winning_teams = 4;
if (has_winning_teams()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(4, this->winning_teams(), target);
}
// optional uint32 players_streak_2 = 5;
if (has_players_streak_2()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(5, this->players_streak_2(), target);
}
// optional uint32 players_streak_3 = 6;
if (has_players_streak_3()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(6, this->players_streak_3(), target);
}
// optional uint32 players_streak_4 = 7;
if (has_players_streak_4()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(7, this->players_streak_4(), target);
}
// optional uint32 players_streak_5 = 8;
if (has_players_streak_5()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(8, this->players_streak_5(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTAWeekendTourneyParticipationDetails.Tier)
return target;
}
int CMsgDOTAWeekendTourneyParticipationDetails_Tier::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional uint32 tier = 1;
if (has_tier()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->tier());
}
// optional uint32 players = 2;
if (has_players()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->players());
}
// optional uint32 teams = 3;
if (has_teams()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->teams());
}
// optional uint32 winning_teams = 4;
if (has_winning_teams()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->winning_teams());
}
// optional uint32 players_streak_2 = 5;
if (has_players_streak_2()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->players_streak_2());
}
// optional uint32 players_streak_3 = 6;
if (has_players_streak_3()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->players_streak_3());
}
// optional uint32 players_streak_4 = 7;
if (has_players_streak_4()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->players_streak_4());
}
// optional uint32 players_streak_5 = 8;
if (has_players_streak_5()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->players_streak_5());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTAWeekendTourneyParticipationDetails_Tier::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTAWeekendTourneyParticipationDetails_Tier* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTAWeekendTourneyParticipationDetails_Tier*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTAWeekendTourneyParticipationDetails_Tier::MergeFrom(const CMsgDOTAWeekendTourneyParticipationDetails_Tier& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_tier()) {
set_tier(from.tier());
}
if (from.has_players()) {
set_players(from.players());
}
if (from.has_teams()) {
set_teams(from.teams());
}
if (from.has_winning_teams()) {
set_winning_teams(from.winning_teams());
}
if (from.has_players_streak_2()) {
set_players_streak_2(from.players_streak_2());
}
if (from.has_players_streak_3()) {
set_players_streak_3(from.players_streak_3());
}
if (from.has_players_streak_4()) {
set_players_streak_4(from.players_streak_4());
}
if (from.has_players_streak_5()) {
set_players_streak_5(from.players_streak_5());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTAWeekendTourneyParticipationDetails_Tier::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTAWeekendTourneyParticipationDetails_Tier::CopyFrom(const CMsgDOTAWeekendTourneyParticipationDetails_Tier& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTAWeekendTourneyParticipationDetails_Tier::IsInitialized() const {
return true;
}
void CMsgDOTAWeekendTourneyParticipationDetails_Tier::Swap(CMsgDOTAWeekendTourneyParticipationDetails_Tier* other) {
if (other != this) {
std::swap(tier_, other->tier_);
std::swap(players_, other->players_);
std::swap(teams_, other->teams_);
std::swap(winning_teams_, other->winning_teams_);
std::swap(players_streak_2_, other->players_streak_2_);
std::swap(players_streak_3_, other->players_streak_3_);
std::swap(players_streak_4_, other->players_streak_4_);
std::swap(players_streak_5_, other->players_streak_5_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTAWeekendTourneyParticipationDetails_Tier::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTAWeekendTourneyParticipationDetails_Tier_descriptor_;
metadata.reflection = CMsgDOTAWeekendTourneyParticipationDetails_Tier_reflection_;
return metadata;
}
// -------------------------------------------------------------------
#ifndef _MSC_VER
const int CMsgDOTAWeekendTourneyParticipationDetails_Division::kDivisionIdFieldNumber;
const int CMsgDOTAWeekendTourneyParticipationDetails_Division::kScheduleTimeFieldNumber;
const int CMsgDOTAWeekendTourneyParticipationDetails_Division::kTiersFieldNumber;
#endif // !_MSC_VER
CMsgDOTAWeekendTourneyParticipationDetails_Division::CMsgDOTAWeekendTourneyParticipationDetails_Division()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTAWeekendTourneyParticipationDetails.Division)
}
void CMsgDOTAWeekendTourneyParticipationDetails_Division::InitAsDefaultInstance() {
}
CMsgDOTAWeekendTourneyParticipationDetails_Division::CMsgDOTAWeekendTourneyParticipationDetails_Division(const CMsgDOTAWeekendTourneyParticipationDetails_Division& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTAWeekendTourneyParticipationDetails.Division)
}
void CMsgDOTAWeekendTourneyParticipationDetails_Division::SharedCtor() {
_cached_size_ = 0;
division_id_ = 0u;
schedule_time_ = 0u;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTAWeekendTourneyParticipationDetails_Division::~CMsgDOTAWeekendTourneyParticipationDetails_Division() {
// @@protoc_insertion_point(destructor:CMsgDOTAWeekendTourneyParticipationDetails.Division)
SharedDtor();
}
void CMsgDOTAWeekendTourneyParticipationDetails_Division::SharedDtor() {
if (this != default_instance_) {
}
}
void CMsgDOTAWeekendTourneyParticipationDetails_Division::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTAWeekendTourneyParticipationDetails_Division::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTAWeekendTourneyParticipationDetails_Division_descriptor_;
}
const CMsgDOTAWeekendTourneyParticipationDetails_Division& CMsgDOTAWeekendTourneyParticipationDetails_Division::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTAWeekendTourneyParticipationDetails_Division* CMsgDOTAWeekendTourneyParticipationDetails_Division::default_instance_ = NULL;
CMsgDOTAWeekendTourneyParticipationDetails_Division* CMsgDOTAWeekendTourneyParticipationDetails_Division::New() const {
return new CMsgDOTAWeekendTourneyParticipationDetails_Division;
}
void CMsgDOTAWeekendTourneyParticipationDetails_Division::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<CMsgDOTAWeekendTourneyParticipationDetails_Division*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
ZR_(division_id_, schedule_time_);
#undef OFFSET_OF_FIELD_
#undef ZR_
tiers_.Clear();
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTAWeekendTourneyParticipationDetails_Division::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTAWeekendTourneyParticipationDetails.Division)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint32 division_id = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &division_id_)));
set_has_division_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_schedule_time;
break;
}
// optional uint32 schedule_time = 2;
case 2: {
if (tag == 16) {
parse_schedule_time:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &schedule_time_)));
set_has_schedule_time();
} else {
goto handle_unusual;
}
if (input->ExpectTag(26)) goto parse_tiers;
break;
}
// repeated .CMsgDOTAWeekendTourneyParticipationDetails.Tier tiers = 3;
case 3: {
if (tag == 26) {
parse_tiers:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_tiers()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(26)) goto parse_tiers;
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTAWeekendTourneyParticipationDetails.Division)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTAWeekendTourneyParticipationDetails.Division)
return false;
#undef DO_
}
void CMsgDOTAWeekendTourneyParticipationDetails_Division::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTAWeekendTourneyParticipationDetails.Division)
// optional uint32 division_id = 1;
if (has_division_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->division_id(), output);
}
// optional uint32 schedule_time = 2;
if (has_schedule_time()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->schedule_time(), output);
}
// repeated .CMsgDOTAWeekendTourneyParticipationDetails.Tier tiers = 3;
for (int i = 0; i < this->tiers_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, this->tiers(i), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTAWeekendTourneyParticipationDetails.Division)
}
::google::protobuf::uint8* CMsgDOTAWeekendTourneyParticipationDetails_Division::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTAWeekendTourneyParticipationDetails.Division)
// optional uint32 division_id = 1;
if (has_division_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->division_id(), target);
}
// optional uint32 schedule_time = 2;
if (has_schedule_time()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->schedule_time(), target);
}
// repeated .CMsgDOTAWeekendTourneyParticipationDetails.Tier tiers = 3;
for (int i = 0; i < this->tiers_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
3, this->tiers(i), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTAWeekendTourneyParticipationDetails.Division)
return target;
}
int CMsgDOTAWeekendTourneyParticipationDetails_Division::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional uint32 division_id = 1;
if (has_division_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->division_id());
}
// optional uint32 schedule_time = 2;
if (has_schedule_time()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->schedule_time());
}
}
// repeated .CMsgDOTAWeekendTourneyParticipationDetails.Tier tiers = 3;
total_size += 1 * this->tiers_size();
for (int i = 0; i < this->tiers_size(); i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->tiers(i));
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTAWeekendTourneyParticipationDetails_Division::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTAWeekendTourneyParticipationDetails_Division* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTAWeekendTourneyParticipationDetails_Division*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTAWeekendTourneyParticipationDetails_Division::MergeFrom(const CMsgDOTAWeekendTourneyParticipationDetails_Division& from) {
GOOGLE_CHECK_NE(&from, this);
tiers_.MergeFrom(from.tiers_);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_division_id()) {
set_division_id(from.division_id());
}
if (from.has_schedule_time()) {
set_schedule_time(from.schedule_time());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTAWeekendTourneyParticipationDetails_Division::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTAWeekendTourneyParticipationDetails_Division::CopyFrom(const CMsgDOTAWeekendTourneyParticipationDetails_Division& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTAWeekendTourneyParticipationDetails_Division::IsInitialized() const {
return true;
}
void CMsgDOTAWeekendTourneyParticipationDetails_Division::Swap(CMsgDOTAWeekendTourneyParticipationDetails_Division* other) {
if (other != this) {
std::swap(division_id_, other->division_id_);
std::swap(schedule_time_, other->schedule_time_);
tiers_.Swap(&other->tiers_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTAWeekendTourneyParticipationDetails_Division::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTAWeekendTourneyParticipationDetails_Division_descriptor_;
metadata.reflection = CMsgDOTAWeekendTourneyParticipationDetails_Division_reflection_;
return metadata;
}
// -------------------------------------------------------------------
#ifndef _MSC_VER
const int CMsgDOTAWeekendTourneyParticipationDetails::kDivisionsFieldNumber;
#endif // !_MSC_VER
CMsgDOTAWeekendTourneyParticipationDetails::CMsgDOTAWeekendTourneyParticipationDetails()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTAWeekendTourneyParticipationDetails)
}
void CMsgDOTAWeekendTourneyParticipationDetails::InitAsDefaultInstance() {
}
CMsgDOTAWeekendTourneyParticipationDetails::CMsgDOTAWeekendTourneyParticipationDetails(const CMsgDOTAWeekendTourneyParticipationDetails& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTAWeekendTourneyParticipationDetails)
}
void CMsgDOTAWeekendTourneyParticipationDetails::SharedCtor() {
_cached_size_ = 0;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTAWeekendTourneyParticipationDetails::~CMsgDOTAWeekendTourneyParticipationDetails() {
// @@protoc_insertion_point(destructor:CMsgDOTAWeekendTourneyParticipationDetails)
SharedDtor();
}
void CMsgDOTAWeekendTourneyParticipationDetails::SharedDtor() {
if (this != default_instance_) {
}
}
void CMsgDOTAWeekendTourneyParticipationDetails::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTAWeekendTourneyParticipationDetails::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTAWeekendTourneyParticipationDetails_descriptor_;
}
const CMsgDOTAWeekendTourneyParticipationDetails& CMsgDOTAWeekendTourneyParticipationDetails::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTAWeekendTourneyParticipationDetails* CMsgDOTAWeekendTourneyParticipationDetails::default_instance_ = NULL;
CMsgDOTAWeekendTourneyParticipationDetails* CMsgDOTAWeekendTourneyParticipationDetails::New() const {
return new CMsgDOTAWeekendTourneyParticipationDetails;
}
void CMsgDOTAWeekendTourneyParticipationDetails::Clear() {
divisions_.Clear();
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTAWeekendTourneyParticipationDetails::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTAWeekendTourneyParticipationDetails)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// repeated .CMsgDOTAWeekendTourneyParticipationDetails.Division divisions = 1;
case 1: {
if (tag == 10) {
parse_divisions:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_divisions()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(10)) goto parse_divisions;
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTAWeekendTourneyParticipationDetails)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTAWeekendTourneyParticipationDetails)
return false;
#undef DO_
}
void CMsgDOTAWeekendTourneyParticipationDetails::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTAWeekendTourneyParticipationDetails)
// repeated .CMsgDOTAWeekendTourneyParticipationDetails.Division divisions = 1;
for (int i = 0; i < this->divisions_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, this->divisions(i), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTAWeekendTourneyParticipationDetails)
}
::google::protobuf::uint8* CMsgDOTAWeekendTourneyParticipationDetails::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTAWeekendTourneyParticipationDetails)
// repeated .CMsgDOTAWeekendTourneyParticipationDetails.Division divisions = 1;
for (int i = 0; i < this->divisions_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
1, this->divisions(i), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTAWeekendTourneyParticipationDetails)
return target;
}
int CMsgDOTAWeekendTourneyParticipationDetails::ByteSize() const {
int total_size = 0;
// repeated .CMsgDOTAWeekendTourneyParticipationDetails.Division divisions = 1;
total_size += 1 * this->divisions_size();
for (int i = 0; i < this->divisions_size(); i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->divisions(i));
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTAWeekendTourneyParticipationDetails::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTAWeekendTourneyParticipationDetails* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTAWeekendTourneyParticipationDetails*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTAWeekendTourneyParticipationDetails::MergeFrom(const CMsgDOTAWeekendTourneyParticipationDetails& from) {
GOOGLE_CHECK_NE(&from, this);
divisions_.MergeFrom(from.divisions_);
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTAWeekendTourneyParticipationDetails::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTAWeekendTourneyParticipationDetails::CopyFrom(const CMsgDOTAWeekendTourneyParticipationDetails& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTAWeekendTourneyParticipationDetails::IsInitialized() const {
return true;
}
void CMsgDOTAWeekendTourneyParticipationDetails::Swap(CMsgDOTAWeekendTourneyParticipationDetails* other) {
if (other != this) {
divisions_.Swap(&other->divisions_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTAWeekendTourneyParticipationDetails::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTAWeekendTourneyParticipationDetails_descriptor_;
metadata.reflection = CMsgDOTAWeekendTourneyParticipationDetails_reflection_;
return metadata;
}
// @@protoc_insertion_point(namespace_scope)
// @@protoc_insertion_point(global_scope)
| 37.253776 | 169 | 0.704239 | devilesk |
7b2001aacb01d0b26889271774c177ab0c2a1d50 | 2,969 | cc | C++ | gnuradio-3.7.13.4/gr-dtv/lib/atsc/atsc_deinterleaver_impl.cc | v1259397/cosmic-gnuradio | 64c149520ac6a7d44179c3f4a38f38add45dd5dc | [
"BSD-3-Clause"
] | 1 | 2021-03-09T07:32:37.000Z | 2021-03-09T07:32:37.000Z | gnuradio-3.7.13.4/gr-dtv/lib/atsc/atsc_deinterleaver_impl.cc | v1259397/cosmic-gnuradio | 64c149520ac6a7d44179c3f4a38f38add45dd5dc | [
"BSD-3-Clause"
] | null | null | null | gnuradio-3.7.13.4/gr-dtv/lib/atsc/atsc_deinterleaver_impl.cc | v1259397/cosmic-gnuradio | 64c149520ac6a7d44179c3f4a38f38add45dd5dc | [
"BSD-3-Clause"
] | null | null | null | /* -*- c++ -*- */
/*
* Copyright 2014 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* GNU Radio is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* GNU Radio is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "atsc_deinterleaver_impl.h"
#include "gnuradio/dtv/atsc_consts.h"
#include <gnuradio/io_signature.h>
namespace gr {
namespace dtv {
atsc_deinterleaver::sptr
atsc_deinterleaver::make()
{
return gnuradio::get_initial_sptr
(new atsc_deinterleaver_impl());
}
atsc_deinterleaver_impl::atsc_deinterleaver_impl()
: gr::sync_block("atsc_deinterleaver",
io_signature::make(1, 1, sizeof(atsc_mpeg_packet_rs_encoded)),
io_signature::make(1, 1, sizeof(atsc_mpeg_packet_rs_encoded))),
alignment_fifo (156)
{
m_fifo.resize(52);
for (int i = 0; i < 52; i++)
m_fifo[52 - 1 - i] = new interleaver_fifo<unsigned char>(i * 4);
sync();
}
atsc_deinterleaver_impl::~atsc_deinterleaver_impl()
{
for (int i = 0; i < 52; i++)
delete m_fifo[i];
}
void atsc_deinterleaver_impl::reset()
{
sync();
for (int i = 0; i < 52; i++)
m_fifo[i]->reset();
}
int
atsc_deinterleaver_impl::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
const atsc_mpeg_packet_rs_encoded *in = (const atsc_mpeg_packet_rs_encoded *)input_items[0];
atsc_mpeg_packet_rs_encoded *out = (atsc_mpeg_packet_rs_encoded *)output_items[0];
for (int i = 0; i < noutput_items; i++) {
assert (in[i].pli.regular_seg_p());
plinfo::sanity_check(in[i].pli);
// reset commutator if required using INPUT pipeline info
if (in[i].pli.first_regular_seg_p())
sync();
// remap OUTPUT pipeline info to reflect 52 data segment end-to-end delay
plinfo::delay (out[i].pli, in[i].pli, 52);
// now do the actual deinterleaving
for (unsigned int j = 0; j < sizeof(in[i].data); j++) {
out[i].data[j] = alignment_fifo.stuff(transform (in[i].data[j]));
}
}
return noutput_items;
}
} /* namespace dtv */
} /* namespace gr */
| 30.295918 | 98 | 0.633547 | v1259397 |
7b23219fe75d1827b0eabdad7f5136eb52a067cb | 12,913 | cpp | C++ | sfizz/Synth.cpp | falkTX/sfizz | 7f26b53cb3878065e83f424001be8b2ded3c5306 | [
"BSD-2-Clause"
] | 1 | 2020-01-06T20:56:21.000Z | 2020-01-06T20:56:21.000Z | sfizz/Synth.cpp | falkTX/sfizz | 7f26b53cb3878065e83f424001be8b2ded3c5306 | [
"BSD-2-Clause"
] | null | null | null | sfizz/Synth.cpp | falkTX/sfizz | 7f26b53cb3878065e83f424001be8b2ded3c5306 | [
"BSD-2-Clause"
] | null | null | null | // Copyright (c) 2019, Paul Ferrand
// 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.
#include "Synth.h"
#include "Debug.h"
#include "ScopedFTZ.h"
#include "StringViewHelpers.h"
#include "absl/algorithm/container.h"
#include <algorithm>
#include <iostream>
#include <utility>
sfz::Synth::Synth()
{
for (int i = 0; i < config::numVoices; ++i)
voices.push_back(std::make_unique<Voice>(ccState));
}
void sfz::Synth::callback(std::string_view header, const std::vector<Opcode>& members)
{
switch (hash(header)) {
case hash("global"):
// We shouldn't have multiple global headers in file
ASSERT(!hasGlobal);
globalOpcodes = members;
handleGlobalOpcodes(members);
hasGlobal = true;
break;
case hash("control"):
// We shouldn't have multiple control headers in file
ASSERT(!hasControl)
hasControl = true;
handleControlOpcodes(members);
break;
case hash("master"):
masterOpcodes = members;
numMasters++;
break;
case hash("group"):
groupOpcodes = members;
numGroups++;
break;
case hash("region"):
buildRegion(members);
break;
case hash("curve"):
// TODO: implement curves
numCurves++;
break;
case hash("effect"):
// TODO: implement effects
break;
default:
std::cerr << "Unknown header: " << header << '\n';
}
}
void sfz::Synth::buildRegion(const std::vector<Opcode>& regionOpcodes)
{
auto lastRegion = std::make_unique<Region>();
auto parseOpcodes = [&](const auto& opcodes) {
for (auto& opcode : opcodes) {
const auto unknown = absl::c_find_if(unknownOpcodes, [&](std::string_view sv) { return sv.compare(opcode.opcode) == 0; });
if (unknown != unknownOpcodes.end()) {
continue;
}
if (!lastRegion->parseOpcode(opcode))
unknownOpcodes.insert(opcode.opcode);
}
};
parseOpcodes(globalOpcodes);
parseOpcodes(masterOpcodes);
parseOpcodes(groupOpcodes);
parseOpcodes(regionOpcodes);
regions.push_back(std::move(lastRegion));
}
void sfz::Synth::clear()
{
hasGlobal = false;
hasControl = false;
numGroups = 0;
numMasters = 0;
numCurves = 0;
fileTicket = -1;
defaultSwitch = std::nullopt;
for (auto& state : ccState)
state = 0;
ccNames.clear();
globalOpcodes.clear();
masterOpcodes.clear();
groupOpcodes.clear();
regions.clear();
}
void sfz::Synth::handleGlobalOpcodes(const std::vector<Opcode>& members)
{
for (auto& member : members) {
switch (hash(member.opcode)) {
case hash("sw_default"):
setValueFromOpcode(member, defaultSwitch, Default::keyRange);
break;
}
}
}
void sfz::Synth::handleControlOpcodes(const std::vector<Opcode>& members)
{
for (auto& member : members) {
switch (hash(member.opcode)) {
case hash("set_cc"):
if (member.parameter && Default::ccRange.containsWithEnd(*member.parameter))
setValueFromOpcode(member, ccState[*member.parameter], Default::ccRange);
break;
case hash("label_cc"):
if (member.parameter && Default::ccRange.containsWithEnd(*member.parameter))
ccNames.emplace_back(*member.parameter, member.value);
break;
case hash("default_path"):
if (auto newPath = std::filesystem::path(member.value); std::filesystem::exists(newPath))
rootDirectory = newPath;
break;
default:
// Unsupported control opcode
ASSERTFALSE;
}
}
}
void addEndpointsToVelocityCurve(sfz::Region& region)
{
if (region.velocityPoints.size() > 0) {
absl::c_sort(region.velocityPoints, [](auto& lhs, auto& rhs) { return lhs.first < rhs.first; });
if (region.ampVeltrack > 0) {
if (region.velocityPoints.back().first != sfz::Default::velocityRange.getEnd())
region.velocityPoints.push_back(std::make_pair<int, float>(127, 1.0f));
if (region.velocityPoints.front().first != sfz::Default::velocityRange.getStart())
region.velocityPoints.insert(region.velocityPoints.begin(), std::make_pair<int, float>(0, 0.0f));
} else {
if (region.velocityPoints.front().first != sfz::Default::velocityRange.getEnd())
region.velocityPoints.insert(region.velocityPoints.begin(), std::make_pair<int, float>(127, 0.0f));
if (region.velocityPoints.back().first != sfz::Default::velocityRange.getStart())
region.velocityPoints.push_back(std::make_pair<int, float>(0, 1.0f));
}
}
}
bool sfz::Synth::loadSfzFile(const std::filesystem::path& filename)
{
clear();
auto parserReturned = sfz::Parser::loadSfzFile(filename);
if (!parserReturned)
return false;
if (regions.empty())
return false;
filePool.setRootDirectory(this->rootDirectory);
auto lastRegion = regions.end() - 1;
auto currentRegion = regions.begin();
while (currentRegion <= lastRegion) {
auto region = currentRegion->get();
if (!region->isGenerator()) {
auto fileInformation = filePool.getFileInformation(region->sample);
if (!fileInformation) {
DBG("Removing the region with sample " << region->sample);
std::iter_swap(currentRegion, lastRegion);
lastRegion--;
continue;
}
region->sampleEnd = std::min(region->sampleEnd, fileInformation->end);
region->loopRange.shrinkIfSmaller(fileInformation->loopBegin, fileInformation->loopEnd);
region->preloadedData = fileInformation->preloadedData;
region->sampleRate = fileInformation->sampleRate;
}
for (auto note = region->keyRange.getStart(); note <= region->keyRange.getEnd(); note++)
noteActivationLists[note].push_back(region);
for (auto cc = region->keyRange.getStart(); cc <= region->keyRange.getEnd(); cc++)
ccActivationLists[cc].push_back(region);
// Defaults
for (int ccIndex = 1; ccIndex < 128; ccIndex++)
region->registerCC(region->channelRange.getStart(), ccIndex, ccState[ccIndex]);
if (defaultSwitch) {
region->registerNoteOn(region->channelRange.getStart(), *defaultSwitch, 127, 1.0);
region->registerNoteOff(region->channelRange.getStart(), *defaultSwitch, 0, 1.0);
}
addEndpointsToVelocityCurve(*region);
region->registerPitchWheel(region->channelRange.getStart(), 0);
region->registerAftertouch(region->channelRange.getStart(), 0);
region->registerTempo(2.0f);
currentRegion++;
}
DBG("Removed " << regions.size() - std::distance(regions.begin(), lastRegion) - 1 << " out of " << regions.size() << " regions.");
regions.resize(std::distance(regions.begin(), lastRegion) + 1);
return parserReturned;
}
sfz::Voice* sfz::Synth::findFreeVoice() noexcept
{
auto freeVoice = absl::c_find_if(voices, [](const auto& voice) { return voice->isFree(); });
if (freeVoice == voices.end()) {
DBG("Voices are overloaded, can't start a new note");
return {};
}
return freeVoice->get();
}
void sfz::Synth::getNumActiveVoices() const noexcept
{
auto activeVoices { 0 };
for (const auto& voice : voices) {
if (!voice->isFree())
activeVoices++;
}
}
void sfz::Synth::garbageCollect() noexcept
{
for (auto& voice : voices) {
voice->garbageCollect();
}
}
void sfz::Synth::setSamplesPerBlock(int samplesPerBlock) noexcept
{
this->samplesPerBlock = samplesPerBlock;
this->tempBuffer.resize(samplesPerBlock);
for (auto& voice : voices)
voice->setSamplesPerBlock(samplesPerBlock);
}
void sfz::Synth::setSampleRate(float sampleRate) noexcept
{
this->sampleRate = sampleRate;
for (auto& voice : voices)
voice->setSampleRate(sampleRate);
}
void sfz::Synth::renderBlock(AudioSpan<float> buffer) noexcept
{
ScopedFTZ ftz;
buffer.fill(0.0f);
auto tempSpan = AudioSpan<float>(tempBuffer).first(buffer.getNumFrames());
for (auto& voice : voices) {
voice->renderBlock(tempSpan);
buffer.add(tempSpan);
}
}
void sfz::Synth::noteOn(int delay, int channel, int noteNumber, uint8_t velocity) noexcept
{
auto randValue = randNoteDistribution(Random::randomGenerator);
for (auto& region : regions) {
if (region->registerNoteOn(channel, noteNumber, velocity, randValue)) {
for (auto& voice : voices) {
if (voice->checkOffGroup(delay, region->group))
noteOff(delay, voice->getTriggerChannel(), voice->getTriggerNumber(), 0);
}
auto voice = findFreeVoice();
if (voice == nullptr)
continue;
voice->startVoice(region.get(), delay, channel, noteNumber, velocity, Voice::TriggerType::NoteOn);
if (!region->isGenerator()) {
voice->expectFileData(fileTicket);
filePool.enqueueLoading(voice, region->sample, region->trueSampleEnd(), fileTicket++);
}
}
}
}
void sfz::Synth::noteOff(int delay, int channel, int noteNumber, uint8_t velocity) noexcept
{
auto randValue = randNoteDistribution(Random::randomGenerator);
for (auto& voice : voices)
voice->registerNoteOff(delay, channel, noteNumber, velocity);
for (auto& region : regions) {
if (region->registerNoteOff(channel, noteNumber, velocity, randValue)) {
auto voice = findFreeVoice();
if (voice == nullptr)
continue;
voice->startVoice(region.get(), delay, channel, noteNumber, velocity, Voice::TriggerType::NoteOff);
if (!region->isGenerator()) {
voice->expectFileData(fileTicket);
filePool.enqueueLoading(voice, region->sample, region->trueSampleEnd(), fileTicket++);
}
}
}
}
void sfz::Synth::cc(int delay, int channel, int ccNumber, uint8_t ccValue) noexcept
{
for (auto& voice : voices)
voice->registerCC(delay, channel, ccNumber, ccValue);
ccState[ccNumber] = ccValue;
for (auto& region : regions) {
if (region->registerCC(channel, ccNumber, ccValue)) {
auto voice = findFreeVoice();
if (voice == nullptr)
continue;
voice->startVoice(region.get(), delay, channel, ccNumber, ccValue, Voice::TriggerType::CC);
if (!region->isGenerator()) {
voice->expectFileData(fileTicket);
filePool.enqueueLoading(voice, region->sample, region->trueSampleEnd(), fileTicket++);
}
}
}
}
int sfz::Synth::getNumRegions() const noexcept
{
return static_cast<int>(regions.size());
}
int sfz::Synth::getNumGroups() const noexcept
{
return numGroups;
}
int sfz::Synth::getNumMasters() const noexcept
{
return numMasters;
}
int sfz::Synth::getNumCurves() const noexcept
{
return numCurves;
}
const sfz::Region* sfz::Synth::getRegionView(int idx) const noexcept
{
return (size_t)idx < regions.size() ? regions[idx].get() : nullptr;
}
std::set<std::string_view> sfz::Synth::getUnknownOpcodes() const noexcept
{
return unknownOpcodes;
}
size_t sfz::Synth::getNumPreloadedSamples() const noexcept
{
return filePool.getNumPreloadedSamples();
} | 34.251989 | 134 | 0.634167 | falkTX |
7b2469274eda5b2588c614afb4a3ab43384b1721 | 1,940 | cpp | C++ | third_party/WebKit/Source/core/paint/FloatClipRecorder.cpp | wenfeifei/miniblink49 | 2ed562ff70130485148d94b0e5f4c343da0c2ba4 | [
"Apache-2.0"
] | 5,964 | 2016-09-27T03:46:29.000Z | 2022-03-31T16:25:27.000Z | third_party/WebKit/Source/core/paint/FloatClipRecorder.cpp | w4454962/miniblink49 | b294b6eacb3333659bf7b94d670d96edeeba14c0 | [
"Apache-2.0"
] | 459 | 2016-09-29T00:51:38.000Z | 2022-03-07T14:37:46.000Z | third_party/WebKit/Source/core/paint/FloatClipRecorder.cpp | w4454962/miniblink49 | b294b6eacb3333659bf7b94d670d96edeeba14c0 | [
"Apache-2.0"
] | 1,006 | 2016-09-27T05:17:27.000Z | 2022-03-30T02:46:51.000Z | // Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "config.h"
#include "core/paint/FloatClipRecorder.h"
#include "platform/RuntimeEnabledFeatures.h"
#include "platform/graphics/GraphicsContext.h"
#include "platform/graphics/paint/DisplayItemList.h"
#include "platform/graphics/paint/FloatClipDisplayItem.h"
namespace blink {
FloatClipRecorder::FloatClipRecorder(GraphicsContext& context, const DisplayItemClientWrapper& client, PaintPhase paintPhase, const FloatRect& clipRect)
: m_context(context)
, m_client(client)
, m_clipType(DisplayItem::paintPhaseToFloatClipType(paintPhase))
{
if (RuntimeEnabledFeatures::slimmingPaintEnabled()) {
ASSERT(m_context.displayItemList());
if (m_context.displayItemList()->displayItemConstructionIsDisabled())
return;
m_context.displayItemList()->createAndAppend<FloatClipDisplayItem>(m_client, m_clipType, clipRect);
} else {
FloatClipDisplayItem floatClipDisplayItem(m_client, m_clipType, clipRect);
floatClipDisplayItem.replay(m_context);
}
}
FloatClipRecorder::~FloatClipRecorder()
{
DisplayItem::Type endType = DisplayItem::floatClipTypeToEndFloatClipType(m_clipType);
if (RuntimeEnabledFeatures::slimmingPaintEnabled()) {
ASSERT(m_context.displayItemList());
if (!m_context.displayItemList()->displayItemConstructionIsDisabled()) {
if (m_context.displayItemList()->lastDisplayItemIsNoopBegin())
m_context.displayItemList()->removeLastDisplayItem();
else
m_context.displayItemList()->createAndAppend<EndFloatClipDisplayItem>(m_client, endType);
}
} else {
EndFloatClipDisplayItem endClipDisplayItem(m_client, endType);
endClipDisplayItem.replay(m_context);
}
}
} // namespace blink
| 39.591837 | 152 | 0.737629 | wenfeifei |
7b26e3280f8242fbe9f3651b430ff51416aa3468 | 599 | cpp | C++ | CodeForces/Complete/400-499/429D-TrickyFunction.cpp | Ashwanigupta9125/code-DS-ALGO | 49f6cf7d0c682da669db23619aef3f80697b352b | [
"MIT"
] | 36 | 2019-12-27T08:23:08.000Z | 2022-01-24T20:35:47.000Z | CodeForces/Complete/400-499/429D-TrickyFunction.cpp | Ashwanigupta9125/code-DS-ALGO | 49f6cf7d0c682da669db23619aef3f80697b352b | [
"MIT"
] | 10 | 2019-11-13T02:55:18.000Z | 2021-10-13T23:28:09.000Z | CodeForces/Complete/400-499/429D-TrickyFunction.cpp | Ashwanigupta9125/code-DS-ALGO | 49f6cf7d0c682da669db23619aef3f80697b352b | [
"MIT"
] | 53 | 2020-08-15T11:08:40.000Z | 2021-10-09T15:51:38.000Z | #include <cstdio>
#include <vector>
#include <algorithm>
int main() {
const long M = 1002;
long n; scanf("%ld", &n);
std::vector<long> s(n + 1);
std::vector<long> b(M + 1, 10000);
for(long p = 1; p <= n; p++) {
long a; scanf("%ld", &a);
s[p] = s[p - 1] + a;
for(long q = 1; q < p && q <= M; q++){
long diff = s[p] - s[p - q]; diff = (diff < 0) ? (-diff) : diff;
b[q] = b[q] < diff ? b[q] : diff;
}
}
long r(2e9);
for(long p = 1; p <= M; p++){long cand = p * p + b[p] * b[p]; r = (cand < r) ? cand : r;}
printf("%ld\n",r);
return 0;
}
| 22.185185 | 90 | 0.440735 | Ashwanigupta9125 |
7b26f763bba7afe41dc842e3779820c4dc3feff7 | 391 | cpp | C++ | GameObject/Component/componentRenderer.cpp | XZelnar/GameEngine | cb28f6046249e77e30d5e3526f9f0a1fe7f3ef8f | [
"MIT"
] | 1 | 2016-10-05T13:58:54.000Z | 2016-10-05T13:58:54.000Z | GameObject/Component/componentRenderer.cpp | XZelnar/GameEngine | cb28f6046249e77e30d5e3526f9f0a1fe7f3ef8f | [
"MIT"
] | null | null | null | GameObject/Component/componentRenderer.cpp | XZelnar/GameEngine | cb28f6046249e77e30d5e3526f9f0a1fe7f3ef8f | [
"MIT"
] | null | null | null | #include "componentRenderer.h"
#include "../gameObject.h"
#include "transformation.h"
void ComponentRenderer::Initialize(GameObject* _parent)
{
parent = _parent;
transform = parent->GetTransformation();
}
void ComponentRenderer::Render()
{
Render(transform->GetTransformationMatrix());
}
void ComponentRenderer::GUI()
{
GUI(transform->GetTransformationMatrix());
} | 19.55 | 56 | 0.721228 | XZelnar |
7b289c94ccbe9a02a16951a9cf476bef736b457d | 8,936 | cc | C++ | psdaq/psdaq/dti/PVStats.cc | JBlaschke/lcls2 | 30523ef069e823535475d68fa283c6387bcf817b | [
"BSD-3-Clause-LBNL"
] | 16 | 2017-11-09T17:10:56.000Z | 2022-03-09T23:03:10.000Z | psdaq/psdaq/dti/PVStats.cc | JBlaschke/lcls2 | 30523ef069e823535475d68fa283c6387bcf817b | [
"BSD-3-Clause-LBNL"
] | 6 | 2017-12-12T19:30:05.000Z | 2020-07-09T00:28:33.000Z | psdaq/psdaq/dti/PVStats.cc | JBlaschke/lcls2 | 30523ef069e823535475d68fa283c6387bcf817b | [
"BSD-3-Clause-LBNL"
] | 25 | 2017-09-18T20:02:43.000Z | 2022-03-27T22:27:42.000Z | #include "psdaq/dti/PVStats.hh"
#include "psdaq/dti/Module.hh"
#include "psdaq/epicstools/EpicsPVA.hh"
#include <sstream>
#include <string>
#include <vector>
#include <stdio.h>
using Pds_Epics::EpicsPVA;
enum { _TimLinkUp,
_TimRefClk,
_TimFrRate,
_UsLinkUp,
_BpLinkUp,
_DsLinkUp,
_UsRxErrs,
_dUsRxErrs,
_UsRxFull,
_dUsRxFull,
_UsRxInh,
_dUsRxInh,
_UsWrFifoD,
_dUsWrFifoD,
_UsRdFifoD,
_dUsRdFifoD,
_UsIbEvt,
_dUsIbEvt,
_UsObRecv,
_dUsObRecv,
_UsObSent,
_dUsObSent,
_BpObSent,
_dBpObSent,
_DsRxErrs,
_dDsRxErrs,
_DsRxFull,
_dDsRxFull,
_DsObSent,
_dDsObSent,
_QpllLock,
_MonClkRate,
// _MonClkSlow,
// _MonClkFast,
// _MonClkLock,
_UsLinkObL0,
_dUsLinkObL0,
_UsLinkObL1A,
_dUsLinkObL1A,
_UsLinkObL1R,
_dUsLinkObL1R,
_UsLinkMsgDelay,
_PartMsgDelay,
_NumberOf,
};
namespace Pds {
namespace Dti {
PVStats::PVStats() : _pv(_NumberOf) {}
PVStats::~PVStats() {}
void PVStats::allocate(const std::string& title) {
for(unsigned i=0; i<_NumberOf; i++)
if (_pv[i]) {
delete _pv[i];
_pv[i]=0;
}
std::ostringstream o;
o << title << ":";
std::string pvbase = o.str();
#define PV_ADD(name ) { _pv[_##name] = new EpicsPVA((pvbase + #name).c_str()); }
#define PV_ADDV(name,n) { _pv[_##name] = new EpicsPVA((pvbase + #name).c_str(), n); }
PV_ADD (TimLinkUp);
PV_ADD (TimRefClk);
PV_ADD (TimFrRate);
PV_ADD (UsLinkUp);
PV_ADD (BpLinkUp);
PV_ADD (DsLinkUp);
PV_ADDV(UsRxErrs ,Module::NUsLinks);
PV_ADDV(dUsRxErrs ,Module::NUsLinks);
PV_ADDV(UsRxFull ,Module::NUsLinks);
PV_ADDV(dUsRxFull ,Module::NUsLinks);
// PV_ADDV(UsIbRecv ,Module::NUsLinks);
// PV_ADDV(dUsIbRecv ,Module::NUsLinks);
PV_ADDV(UsRxInh ,Module::NUsLinks);
PV_ADDV(dUsRxInh ,Module::NUsLinks);
PV_ADDV(UsWrFifoD ,Module::NUsLinks);
PV_ADDV(dUsWrFifoD,Module::NUsLinks);
PV_ADDV(UsRdFifoD ,Module::NUsLinks);
PV_ADDV(dUsRdFifoD,Module::NUsLinks);
PV_ADDV(UsIbEvt ,Module::NUsLinks);
PV_ADDV(dUsIbEvt ,Module::NUsLinks);
PV_ADDV(UsObRecv ,Module::NUsLinks);
PV_ADDV(dUsObRecv ,Module::NUsLinks);
PV_ADDV(UsObSent ,Module::NUsLinks);
PV_ADDV(dUsObSent ,Module::NUsLinks);
PV_ADD (BpObSent );
PV_ADD (dBpObSent );
PV_ADDV(DsRxErrs ,Module::NDsLinks);
PV_ADDV(dDsRxErrs ,Module::NDsLinks);
PV_ADDV(DsRxFull ,Module::NDsLinks);
PV_ADDV(dDsRxFull ,Module::NDsLinks);
PV_ADDV(DsObSent ,Module::NDsLinks);
PV_ADDV(dDsObSent ,Module::NDsLinks);
PV_ADD (QpllLock);
PV_ADDV(MonClkRate,4);
PV_ADDV(UsLinkObL0 ,Module::NUsLinks);
PV_ADDV(dUsLinkObL0 ,Module::NUsLinks);
PV_ADDV(UsLinkObL1A ,Module::NUsLinks);
PV_ADDV(dUsLinkObL1A,Module::NUsLinks);
PV_ADDV(UsLinkObL1R ,Module::NUsLinks);
PV_ADDV(dUsLinkObL1R,Module::NUsLinks);
PV_ADDV(UsLinkMsgDelay,Module::NUsLinks);
PV_ADDV(PartMsgDelay ,8);
#undef PV_ADD
#undef PV_ADDV
printf("PVs allocated\n");
}
void PVStats::update(const Stats& ns, const Stats& os, double dt)
{
#define PVPUTU(i,v) { _pv[i]->putFrom<unsigned>(unsigned(v+0.5)); }
#define PVPUTD(i,v) { _pv[i]->putFrom<double>(double(v)); }
#define PVPUTAU(p,m,v) { pvd::shared_vector<unsigned> vec(m); \
for (unsigned i = 0; i < m; ++i) vec[i] = unsigned(v+0.5); \
_pv[p]->putFromVector<unsigned>(freeze(vec)); \
}
#define PVPUTAD(p,m,v) { pvd::shared_vector<double> vec(m); \
for (unsigned i = 0; i < m; ++i) vec[i] = double (v); \
_pv[p]->putFromVector<double>(freeze(vec)); \
}
PVPUTU ( _TimLinkUp, ns.timLinkUp);
PVPUTD ( _TimRefClk, ((ns.timRefCount-os.timRefCount)*16/dt));
PVPUTD ( _TimFrRate, (ns.timFrCount -os.timFrCount) / dt);
PVPUTU ( _UsLinkUp, ns.usLinkUp);
PVPUTU ( _BpLinkUp, ns.bpLinkUp);
PVPUTU ( _DsLinkUp, ns.dsLinkUp);
#define PVPUT_ABS( idx, elm ) { \
pvd::shared_vector<unsigned> vec(Module::NUsLinks); \
for(unsigned i=0; i<Module::NUsLinks; i++) vec[i] = ns.us[i].elm; \
_pv[idx]->putFromVector<unsigned>(freeze(vec)); }
#define PVPUT_DEL( idx, elm ) { \
pvd::shared_vector<unsigned> vec(Module::NUsLinks); \
for(unsigned i=0; i<Module::NUsLinks; i++) vec[i] = ns.us[i].elm-os.us[i].elm; \
_pv[idx]->putFromVector<unsigned>(freeze(vec)); }
PVPUT_ABS( _UsRxErrs , rxErrs);
PVPUT_DEL( _dUsRxErrs, rxErrs);
PVPUT_ABS( _UsRxFull , rxFull);
// PVPUT_DEL( _dUsRxFull, rxFull);
{
pvd::shared_vector<double> vec(Module::NUsLinks);
for(unsigned i=0; i<Module::NUsLinks; i++) vec[i] = (ns.us[i].rxFull-os.us[i].rxFull)/156.25e6;
_pv[_dDsRxFull]->putFromVector<double>(freeze(vec));
}
// PVPUTAU( 7, Module::NUsLinks, ns.us[i].ibRecv);
// PVPUTAD( 8, Module::NUsLinks, double(ns.us[i].ibRecv - os.us[i].ibRecv) / dt);
PVPUT_ABS( _UsRxInh , rxInh);
PVPUT_DEL( _dUsRxInh , rxInh);
PVPUT_ABS( _UsWrFifoD , wrFifoD);
PVPUT_DEL( _dUsWrFifoD , wrFifoD);
PVPUT_ABS( _UsRdFifoD , rdFifoD);
PVPUT_DEL( _dUsRdFifoD , rdFifoD);
PVPUT_ABS( _UsIbEvt , ibEvt);
PVPUT_DEL( _dUsIbEvt , ibEvt);
PVPUT_ABS( _UsObRecv , obRecv);
PVPUT_DEL( _dUsObRecv, obRecv);
PVPUT_ABS( _UsObSent , obSent);
PVPUT_DEL( _dUsObSent, obSent);
/*
PVPUTU ( _UsLinkObL0 , ns.usLinkObL0);
PVPUTU ( _dUsLinkObL0 , double(ns.usLinkObL0 - os.usLinkObL0) / dt);
PVPUTU ( _UsLinkObL1A , ns.usLinkObL1A);
PVPUTU ( _dUsLinkObL1A, double(ns.usLinkObL1A - os.usLinkObL1A) / dt);
PVPUTU ( _UsLinkObL1R , ns.usLinkObL1R);
PVPUTU ( _dUsLinkObL1R, double(ns.usLinkObL1R - os.usLinkObL1R) / dt);
*/
PVPUTU ( _BpObSent , ns.bpObSent);
PVPUTU ( _dBpObSent, double(ns.bpObSent - os.bpObSent) / dt);
#undef PVPUT_ABS
#undef PVPUT_DEL
#define PVPUT_ABS( idx, elm ) { \
pvd::shared_vector<unsigned> vec(Module::NDsLinks); \
for(unsigned i=0; i<Module::NDsLinks; i++) vec[i] = ns.ds[i].elm; \
_pv[idx]->putFromVector<unsigned>(freeze(vec)); \
}
#define PVPUT_DEL( idx, elm ) { \
pvd::shared_vector<unsigned> vec(Module::NDsLinks); \
for(unsigned i=0; i<Module::NDsLinks; i++) vec[i] = ns.ds[i].elm-os.ds[i].elm; \
_pv[idx]->putFromVector<unsigned>(freeze(vec)); \
}
PVPUT_ABS( _DsRxErrs , rxErrs);
PVPUT_DEL( _dDsRxErrs, rxErrs);
PVPUT_ABS( _DsRxFull , rxFull);
// PVPUT_DEL( _dDsRxFull, rxFull);
{
pvd::shared_vector<double> vec(Module::NDsLinks);
for(unsigned i=0; i<Module::NDsLinks; i++)
vec[i] = (ns.ds[i].rxFull-os.ds[i].rxFull)/156.25e6;
_pv[_dDsRxFull]->putFromVector<double>(freeze(vec));
}
PVPUT_ABS( _DsObSent , obSent);
// PVPUT_DEL( _dDsObSent, obSent);
{
pvd::shared_vector<double> vec(Module::NDsLinks);
for(unsigned i=0; i<Module::NDsLinks; i++)
vec[i] = double(ns.ds[i].obSent-os.ds[i].obSent)*8.e-6;
_pv[_dDsObSent]->putFromVector<double>(freeze(vec));
}
PVPUTU ( _QpllLock , ns.qpllLock);
PVPUTAU( _MonClkRate, 4, ns.monClk[i].rate);
{
pvd::shared_vector<unsigned> vec(Module::NUsLinks);
for(unsigned i=0; i<Module::NUsLinks; i++) vec[i] = ns.usLinkMsgDelay[i];
_pv[_UsLinkMsgDelay]->putFromVector<unsigned>(freeze(vec));
}
{
pvd::shared_vector<unsigned> vec(8);
for(unsigned i=0; i<8; i++) vec[i] = ns.partMsgDelay[i];
_pv[_PartMsgDelay]->putFromVector<unsigned>(freeze(vec));
}
#undef PVPUT_ABS
#undef PVPUT_DEL
#undef PVPUTU
#undef PVPUTD
#undef PVPUTAU
#undef PVPUTAD
}
};
};
| 33.977186 | 109 | 0.550806 | JBlaschke |
7b29d70114567f4906d9f32e01b10f63a4a8f971 | 1,393 | hpp | C++ | command/rakp34.hpp | openbmc/phosphor-net-ipmid | af23add2a2cf73226cdc72af4793fde6357e8932 | [
"Apache-2.0"
] | 12 | 2017-12-01T19:14:38.000Z | 2021-08-20T06:07:07.000Z | command/rakp34.hpp | openbmc/phosphor-net-ipmid | af23add2a2cf73226cdc72af4793fde6357e8932 | [
"Apache-2.0"
] | 19 | 2019-02-02T11:50:05.000Z | 2021-08-17T19:05:49.000Z | command/rakp34.hpp | openbmc/phosphor-net-ipmid | af23add2a2cf73226cdc72af4793fde6357e8932 | [
"Apache-2.0"
] | 11 | 2016-12-21T00:37:49.000Z | 2019-10-21T02:28:58.000Z | #pragma once
#include "comm_module.hpp"
#include "message_handler.hpp"
#include <vector>
namespace command
{
/**
* @struct RAKP3request
*
* IPMI Payload for RAKP Message 3
*/
struct RAKP3request
{
uint8_t messageTag;
uint8_t rmcpStatusCode;
uint16_t reserved;
uint32_t managedSystemSessionID;
} __attribute__((packed));
/**
* @struct RAKP4response
*
* IPMI Payload for RAKP Message 4
*/
struct RAKP4response
{
uint8_t messageTag;
uint8_t rmcpStatusCode;
uint16_t reserved;
uint32_t remoteConsoleSessionID;
} __attribute__((packed));
/**
* @brief RAKP Message 3, RAKP Message 4
*
* The session activation process is completed by the remote console and BMC
* exchanging messages that are signed according to the Authentication Algorithm
* that was negotiated, and the parameters that were passed in the earlier
* messages. RAKP Message 3 is the signed message from the remote console to the
* BMC. After receiving RAKP Message 3, the BMC returns RAKP Message 4 - a
* signed message from BMC to the remote console.
*
* @param[in] inPayload - Request Data for the command
* @param[in] handler - Reference to the Message Handler
*
* @return Response data for the command
*/
std::vector<uint8_t> RAKP34(const std::vector<uint8_t>& inPayload,
std::shared_ptr<message::Handler>& handler);
} // namespace command
| 24.875 | 80 | 0.722182 | openbmc |
7b32a25bf67fb77fa18c115825f2556b98464d20 | 664 | hpp | C++ | lib/Croissant/Tags.hpp | Baduit/Croissant | 913ed121f6605314178dd231b5678f974993f99e | [
"MIT"
] | 4 | 2020-12-04T06:46:09.000Z | 2020-12-10T21:37:59.000Z | lib/Croissant/Tags.hpp | Baduit/Croissant | 913ed121f6605314178dd231b5678f974993f99e | [
"MIT"
] | null | null | null | lib/Croissant/Tags.hpp | Baduit/Croissant | 913ed121f6605314178dd231b5678f974993f99e | [
"MIT"
] | null | null | null | #pragma once
#include <concepts>
#include <type_traits>
#include <utility>
namespace Croissant
{
struct EqualityTag {};
struct LessTag {};
struct MoreTag {};
template <typename T>
concept ComparisonTag = std::same_as<T, EqualityTag> || std::same_as<T, LessTag> || std::same_as<T, MoreTag>;
struct ResultTag {};
template <typename T>
concept NotResult = (!std::is_base_of<ResultTag, T>::value);
struct ValueTag {};
template <typename T>
concept IsValue = (std::is_base_of<ValueTag, T>::value);
template <typename T>
concept NotValue = (!IsValue<T>);
template <typename T>
concept NotValueNorResult = NotValue<T> && NotResult<T>;
} // namespace Croissant | 19.529412 | 109 | 0.721386 | Baduit |
7b33a7a0b9e4cd7a2ac9d4a216d250c57e2895cb | 2,270 | hpp | C++ | rectilinear_grid.hpp | RaphaelPoncet/2016-macs2-projet-hpc | 1ae8936113ee24f0b49a303627d4fd5bc045f78d | [
"Apache-2.0"
] | 2 | 2017-07-19T09:14:20.000Z | 2017-09-17T11:39:52.000Z | rectilinear_grid.hpp | RaphaelPoncet/2016-macs2-projet-hpc | 1ae8936113ee24f0b49a303627d4fd5bc045f78d | [
"Apache-2.0"
] | null | null | null | rectilinear_grid.hpp | RaphaelPoncet/2016-macs2-projet-hpc | 1ae8936113ee24f0b49a303627d4fd5bc045f78d | [
"Apache-2.0"
] | null | null | null | // Copyright 2016 Raphael Poncet.
// 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 RECTILINEAR_GRID_HPP
#define RECTILINEAR_GRID_HPP
#include <fstream>
#include <vector>
// Rectilinear 3D grid (also handles 2D as a particular case).
class RectilinearGrid3D {
public:
RectilinearGrid3D();
RectilinearGrid3D(RealT x_fast_min, RealT x_fast_max, int n_fast,
RealT x_medium_min, RealT x_medium_max, int n_medium,
RealT x_slow_min, RealT x_slow_max, int n_slow);
int n_fast() const { return m_n_fast; }
int n_medium() const { return m_n_medium; }
int n_slow() const { return m_n_slow; }
int x_fast_min() const {return m_x_fast_min; }
int x_fast_max() const {return m_x_fast_max; }
int x_medium_min() const {return m_x_medium_min; }
int x_medium_max() const {return m_x_medium_max; }
int x_slow_min() const {return m_x_slow_min; }
int x_slow_max() const {return m_x_slow_max; }
RealT dx_fast() const;
RealT dx_medium() const;
RealT dx_slow() const;
std::vector<RealT>fast_coordinates() const {return m_fast_coordinates;}
std::vector<RealT>medium_coordinates() const {return m_medium_coordinates;}
std::vector<RealT>slow_coordinates() const {return m_slow_coordinates;}
void WriteHeaderVTKXml(std::ofstream* os_ptr) const;
void WriteFooterVTKXml(std::ofstream* os_ptr) const;
void WriteVTKXmlAscii(std::ofstream* os_ptr) const;
private:
int m_n_fast;
int m_n_medium;
int m_n_slow;
RealT m_x_fast_min;
RealT m_x_fast_max;
RealT m_x_medium_min;
RealT m_x_medium_max;
RealT m_x_slow_min;
RealT m_x_slow_max;
std::vector<RealT> m_fast_coordinates;
std::vector<RealT> m_medium_coordinates;
std::vector<RealT> m_slow_coordinates;
};
#endif // RECTILINEAR_GRID_HPP
| 36.612903 | 77 | 0.748018 | RaphaelPoncet |
7b360adfe7ca4a74e1e03533a59b7d42467e4c75 | 1,813 | cpp | C++ | RenSharp/RenSharpHostControl.cpp | mpforums/RenSharp | 5b3fb8bff2a1772a82a4148bcf3e1265a11aa097 | [
"Apache-2.0"
] | 1 | 2021-10-04T02:34:33.000Z | 2021-10-04T02:34:33.000Z | RenSharp/RenSharpHostControl.cpp | TheUnstoppable/RenSharp | 2a123c6018c18f3fc73501737d600e291ac3afa7 | [
"Apache-2.0"
] | 9 | 2019-07-03T19:19:59.000Z | 2020-03-02T22:00:21.000Z | RenSharp/RenSharpHostControl.cpp | TheUnstoppable/RenSharp | 2a123c6018c18f3fc73501737d600e291ac3afa7 | [
"Apache-2.0"
] | 2 | 2019-08-14T08:37:36.000Z | 2020-09-29T06:44:26.000Z | /*
Copyright 2020 Neijwiert
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "General.h"
#include "RenSharpHostControl.h"
RenSharpHostControl::RenSharpHostControl()
: refCount(0), defaultDomainManager(nullptr)
{
}
RenSharpHostControl::~RenSharpHostControl()
{
if (defaultDomainManager != nullptr)
{
defaultDomainManager->Release();
defaultDomainManager = nullptr;
}
}
HRESULT RenSharpHostControl::GetHostManager(REFIID id, void **ppHostManager)
{
*ppHostManager = nullptr;
return E_NOINTERFACE;
}
HRESULT RenSharpHostControl::SetAppDomainManager(DWORD dwAppDomainID, IUnknown *pUnkAppDomainManager)
{
HRESULT hr = pUnkAppDomainManager->QueryInterface(__uuidof(RenSharpInterface), reinterpret_cast<PVOID *>(&defaultDomainManager));
return hr;
}
RenSharpInterface *RenSharpHostControl::GetRenSharpInterface()
{
if (defaultDomainManager != nullptr)
{
defaultDomainManager->AddRef();
}
return defaultDomainManager;
}
HRESULT RenSharpHostControl::QueryInterface(const IID &iid, void **ppv)
{
if (ppv == nullptr)
{
return E_POINTER;
}
*ppv = this;
AddRef();
return S_OK;
}
ULONG RenSharpHostControl::AddRef()
{
return InterlockedIncrement(&refCount);
}
ULONG RenSharpHostControl::Release()
{
if (InterlockedDecrement(&refCount) == 0)
{
delete this;
return 0;
}
return refCount;
} | 20.83908 | 130 | 0.766133 | mpforums |
7b3660a00916f4938b3cf90c5f2ddc6acd1da73e | 4,008 | cpp | C++ | Map.cpp | aleksha/electronic-signal | 158b09a4bd9cc9760f94110042c0405a11795e98 | [
"MIT"
] | null | null | null | Map.cpp | aleksha/electronic-signal | 158b09a4bd9cc9760f94110042c0405a11795e98 | [
"MIT"
] | null | null | null | Map.cpp | aleksha/electronic-signal | 158b09a4bd9cc9760f94110042c0405a11795e98 | [
"MIT"
] | null | null | null | // function to calculate induced charge at a ring (radius r) with
// step_size width induced by an electron placed at a distance h from anode.
double sigma(double h, double r){
double sigma = 0.;
double term = 1.;
int k=Nsum;
if(h<0.2) k = 10*Nsum;
for(int n=1;n<k;n++){
term = 1.;
term *= TMath::BesselK0(n*pi*r/grid_anode_distance)*n ;
term *= TMath::Sin (n*pi*h/grid_anode_distance);
sigma += term;
}
sigma *= 2.*pi*r*step_size / pow(grid_anode_distance,2);
return sigma;
}
int MapR(){
// Create maps of charge and currtent for thin rings (width=step_size)
// arount zero point/ This map will be later used to create a
// current mup with a givaen anode segmentetion
std::cout << "STATUS : Creating induced charge distribution\n";
int Nch = 0;
double current_time=0;
int Nr;
for(double h=10.; h>0 ; h-=drift_velocity*channel_width ){
std::cout << "\t Channel=" << Nch << " Time=" << current_time
<< " h=" << h << std::endl;
Nr=0;
for(double r=step_size*0.5; r<r_map; r+=step_size ){
charge[Nr][Nch] = sigma(h,r);
Nr++;
}
c_time[Nch] = current_time;
current_time += channel_width;
Nch++;
}
for(int bin=0;bin<Nch-1;bin++){
i_time[bin] = 0.5*(c_time[bin]+c_time[bin+1]);
for(int rbin=0;rbin<Nr;rbin++){
current[rbin][bin] = (charge[rbin][bin+1] - charge[rbin][bin]) / channel_width;
}
}
return Nch;
}
void WriteMapR(int Nch){
ofstream file_charge;
file_charge.open ("CHARGE_MapR.txt");
file_charge << Nch << "\n";
file_charge << r_map << "\n";
file_charge << step_size << "\n";
file_charge << channel_width << "\n";
file_charge << grid_anode_distance << "\n";
file_charge << drift_velocity << "\n";
for(int bin=0;bin<Nch;bin++){
file_charge << c_time[bin];
for(int rbin=0;rbin<N_R;rbin++){
file_charge << " " << charge[rbin][bin] ;
}
file_charge << "\n";
}
file_charge.close();
}
int ReadMapR(){
std::ifstream file_charge("CHARGE_MapR.txt" , std::ios::in);
int Nch ; file_charge >> Nch ;
double f_r_map ; file_charge >> f_r_map ;
double f_step_size ; file_charge >> f_step_size ;
double f_channel_width ; file_charge >> f_channel_width ;
double f_grid_anode_distance ; file_charge >> f_grid_anode_distance ;
double f_drift_velocity ; file_charge >> f_drift_velocity ;
bool AbortIt = false;
if (f_r_map != r_map) AbortIt = true ;
if (f_step_size != step_size) AbortIt = true ;
if (f_channel_width != channel_width) AbortIt = true ;
if (f_grid_anode_distance != grid_anode_distance) AbortIt = true ;
if (f_drift_velocity != drift_velocity) AbortIt = true ;
if( AbortIt ){
std::cout << "ABORTED: Parameters in CHARGE_MapR.txt DON'T FIT ones in Parameters.h\n";
gSystem->Exit(1);
}
for(int bin=0;bin<Nch;bin++){
file_charge >> c_time[bin];
for(int rbin=0;rbin<N_R;rbin++){
file_charge >> charge[rbin][bin] ;
}
}
file_charge.close();
for(int bin=0;bin<Nch-1;bin++){
i_time[bin] = 0.5*(c_time[bin]+c_time[bin+1]);
for(int rbin=0;rbin<N_R;rbin++){
current[rbin][bin] = (charge[rbin][bin+1] - charge[rbin][bin]) / channel_width;
}
}
return Nch;
}
void DrawMapR(int Nch, int to_draw=0){
TGraph* gr = new TGraph(Nch , c_time, charge [ to_draw ] );
TGraph* gc = new TGraph(Nch-1, i_time, current[ to_draw ] );
gr->SetMarkerStyle(20);
gc->SetMarkerStyle(24);
gr->SetMinimum(0);
gr->SetTitle(" ");
gc->SetTitle(" ");
gr->GetXaxis()->SetTitle("time, ns");
gc->GetXaxis()->SetTitle("time, ns");
gr->GetYaxis()->SetTitle("induced charge, a.u.");
gc->GetYaxis()->SetTitle("current, a.u.");
TCanvas* canv = new TCanvas("canv","canv",800,800);
gr->Draw("APL");
canv->Print("TEMP.png");
gc->Draw("APL");
canv->Print("TEMP2.png");
canv->Close();
}
| 28.834532 | 91 | 0.601796 | aleksha |
7b3721b60bb3eafd820c518daab7e36b1002edd0 | 5,781 | cpp | C++ | native/cocos/base/StringUtil.cpp | SteveLau-GameDeveloper/engine | 159e5acd0f5115a878d59ed59f924ce7627a5466 | [
"Apache-2.0",
"MIT"
] | null | null | null | native/cocos/base/StringUtil.cpp | SteveLau-GameDeveloper/engine | 159e5acd0f5115a878d59ed59f924ce7627a5466 | [
"Apache-2.0",
"MIT"
] | null | null | null | native/cocos/base/StringUtil.cpp | SteveLau-GameDeveloper/engine | 159e5acd0f5115a878d59ed59f924ce7627a5466 | [
"Apache-2.0",
"MIT"
] | null | null | null | /****************************************************************************
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "StringUtil.h"
#include <algorithm>
#include <cctype>
#include <cstdarg>
#include "base/ZipUtils.h"
#include "base/base64.h"
#include "base/std/container/string.h"
#include "memory/Memory.h"
#if (CC_PLATFORM == CC_PLATFORM_WINDOWS)
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <Windows.h>
#endif
namespace cc {
#if defined(_WIN32)
int StringUtil::vprintf(char *buf, const char *last, const char *fmt, va_list args) {
if (last <= buf) return 0;
int count = (int)(last - buf);
int ret = _vsnprintf_s(buf, count, _TRUNCATE, fmt, args);
if (ret < 0) {
if (errno == 0) {
return count - 1;
} else {
return 0;
}
} else {
return ret;
}
}
#else
int StringUtil::vprintf(char *buf, const char *last, const char *fmt, va_list args) {
if (last <= buf) {
return 0;
}
auto count = static_cast<int>(last - buf);
int ret = vsnprintf(buf, count, fmt, args);
if (ret >= count - 1) {
return count - 1;
}
if (ret < 0) {
return 0;
}
return ret;
}
#endif
int StringUtil::printf(char *buf, const char *last, const char *fmt, ...) {
va_list args;
va_start(args, fmt);
int ret = vprintf(buf, last, fmt, args);
va_end(args);
return ret;
}
ccstd::string StringUtil::format(const char *fmt, ...) {
char sz[4096];
va_list args;
va_start(args, fmt);
vprintf(sz, sz + sizeof(sz) - 1, fmt, args);
va_end(args);
return sz;
}
ccstd::vector<ccstd::string> StringUtil::split(const ccstd::string &str, const ccstd::string &delims, uint maxSplits) {
ccstd::vector<ccstd::string> strs;
if (str.empty()) {
return strs;
}
// Pre-allocate some space for performance
strs.reserve(maxSplits ? maxSplits + 1 : 16); // 16 is guessed capacity for most case
uint numSplits = 0;
// Use STL methods
size_t start;
size_t pos;
start = 0;
do {
pos = str.find_first_of(delims, start);
if (pos == start) {
// Do nothing
start = pos + 1;
} else if (pos == ccstd::string::npos || (maxSplits && numSplits == maxSplits)) {
// Copy the rest of the string
strs.push_back(str.substr(start));
break;
} else {
// Copy up to delimiter
strs.push_back(str.substr(start, pos - start));
start = pos + 1;
}
// parse up to next real data
start = str.find_first_not_of(delims, start);
++numSplits;
} while (pos != ccstd::string::npos);
return strs;
}
ccstd::string &StringUtil::replace(ccstd::string &str, const ccstd::string &findStr, const ccstd::string &replaceStr) {
size_t startPos = str.find(findStr);
if (startPos == ccstd::string::npos) {
return str;
}
str.replace(startPos, findStr.length(), replaceStr);
return str;
}
ccstd::string &StringUtil::replaceAll(ccstd::string &str, const ccstd::string &findStr, const ccstd::string &replaceStr) {
if (findStr.empty()) {
return str;
}
size_t startPos = 0;
while ((startPos = str.find(findStr, startPos)) != ccstd::string::npos) {
str.replace(startPos, findStr.length(), replaceStr);
startPos += replaceStr.length();
}
return str;
}
ccstd::string &StringUtil::tolower(ccstd::string &str) {
std::transform(str.begin(), str.end(), str.begin(),
[](unsigned char c) { return std::tolower(c); });
return str;
}
ccstd::string &StringUtil::toupper(ccstd::string &str) {
std::transform(str.begin(), str.end(), str.begin(),
[](unsigned char c) { return std::toupper(c); });
return str;
}
ccstd::string GzipedString::value() const { // NOLINT(readability-convert-member-functions-to-static)
uint8_t * outGzip{nullptr};
uint8_t * outBase64{nullptr};
auto * input = reinterpret_cast<unsigned char *>(const_cast<char *>(_str.c_str()));
auto lenOfBase64 = base64Decode(input, static_cast<unsigned int>(_str.size()), &outBase64);
auto lenofUnzip = ZipUtils::inflateMemory(outBase64, static_cast<ssize_t>(lenOfBase64), &outGzip);
ccstd::string ret(outGzip, outGzip + lenofUnzip);
free(outGzip);
free(outBase64);
return ret;
}
} // namespace cc
| 32.296089 | 122 | 0.621346 | SteveLau-GameDeveloper |
7b399e639c1bd498deb946063aadbe56aafbd97e | 1,570 | cpp | C++ | encoder/vaapiencoder_host.cpp | zhongcong/libyami | 0118c0c78cd5a0208da67024cb9c26b61af67851 | [
"Intel"
] | null | null | null | encoder/vaapiencoder_host.cpp | zhongcong/libyami | 0118c0c78cd5a0208da67024cb9c26b61af67851 | [
"Intel"
] | null | null | null | encoder/vaapiencoder_host.cpp | zhongcong/libyami | 0118c0c78cd5a0208da67024cb9c26b61af67851 | [
"Intel"
] | null | null | null | /*
* vaapiencoder_host.cpp - create specific type of video encoder
*
* Copyright (C) 2013-2014 Intel Corporation
* Author: Xu Guangxin <guangxin.xu@intel.com>
*
* 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 Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
#include "common/log.h"
#include "interface/VideoEncoderHost.h"
#include "vaapiencoder_factory.h"
using namespace YamiMediaCodec;
extern "C" {
IVideoEncoder* createVideoEncoder(const char* mimeType) {
yamiTraceInit();
if (!mimeType) {
ERROR("NULL mime type.");
return NULL;
}
VaapiEncoderFactory::Type enc = VaapiEncoderFactory::create(mimeType);
if (!enc)
ERROR("Failed to create encoder for mimeType: '%s'", mimeType);
else
INFO("Created encoder for mimeType: '%s'", mimeType);
return enc;
}
void releaseVideoEncoder(IVideoEncoder* p) {
delete p;
}
} // extern "C"
| 29.074074 | 74 | 0.703822 | zhongcong |
7b39b29f96a2e4e7d48ab934b8e4691fc66f23a4 | 1,865 | cpp | C++ | src/circle_midpoint.cpp | MangoMaster/raster_graphics | b40b2731b295ed2d743b59ff2872c81a9faf5130 | [
"MIT"
] | null | null | null | src/circle_midpoint.cpp | MangoMaster/raster_graphics | b40b2731b295ed2d743b59ff2872c81a9faf5130 | [
"MIT"
] | null | null | null | src/circle_midpoint.cpp | MangoMaster/raster_graphics | b40b2731b295ed2d743b59ff2872c81a9faf5130 | [
"MIT"
] | null | null | null | // encoding: utf-8
#include <opencv2/opencv.hpp>
#include "main.h"
// 利用圆的八对称性并平移,一次显示圆上8个点
// (x, y)为以原点为圆心、半径为radius的圆弧上一点的坐标
void circle8Translation(cv::Mat &image, int x, int y, cv::Point center, const cv::Scalar &color)
{
drawPixel(image, center.x + x, center.y + y, color);
drawPixel(image, center.x + y, center.y + x, color);
drawPixel(image, center.x - x, center.y + y, color);
drawPixel(image, center.x + y, center.y - x, color);
drawPixel(image, center.x + x, center.y - y, color);
drawPixel(image, center.x - y, center.y + x, color);
drawPixel(image, center.x - x, center.y - y, color);
drawPixel(image, center.x - y, center.y - x, color);
// drawPixel(image, x, y, color);
// drawPixel(image, y - center.y + center.x, x - center.x + center.y, color);
// drawPixel(image, 2 * center.x - x, y, color);
// drawPixel(image, y - center.y + center.x, center.x - x + center.y, color);
// drawPixel(image, x, 2 * center.y - y, color);
// drawPixel(image, center.y - y + center.x, x - center.x + center.y, color);
// drawPixel(image, 2 * center.x - x, 2 * center.y - y, color);
// drawPixel(image, center.y - y + center.x, center.x - x + center.y, color);
}
// 中点画圆算法
void circleMidPoint(cv::Mat &image, cv::Point center, int radius, const cv::Scalar &color)
{
assert(image.type() == CV_8UC3);
assert(radius >= 0);
// (x, y)在以原点为圆心、半径为radius的圆上
int x = 0;
int y = radius;
// e = 4 * d, d = (x+1)^2 + (y-0.5)^2 - radius^2
// 改用整数以加速
int e = 5 - 4 * radius;
while (x <= y)
{
// Draw pixel
circle8Translation(image, x, y, center, color);
// Update x, y and d
if (e < 0)
{
e += 8 * x + 12;
}
else
{
e += 8 * (x - y) + 20;
--y;
}
++x;
}
}
| 32.719298 | 96 | 0.549062 | MangoMaster |
7b3b0128a18e4243161b60398afdbb5c4f922abf | 2,998 | hpp | C++ | mc/rtm.hpp | Juelin-Liu/GraphSetIntersection | 359fc0a377d9b760a5198e2f7a14eab814e48961 | [
"MIT"
] | null | null | null | mc/rtm.hpp | Juelin-Liu/GraphSetIntersection | 359fc0a377d9b760a5198e2f7a14eab814e48961 | [
"MIT"
] | null | null | null | mc/rtm.hpp | Juelin-Liu/GraphSetIntersection | 359fc0a377d9b760a5198e2f7a14eab814e48961 | [
"MIT"
] | null | null | null | #ifndef _RTM_H_
#define _RTM_H_
#include "util.hpp"
#include "table.h"
namespace RTM_AVX2
{
typedef uint8_t Bitmap;
const Bitmap BITMASK = 0xff;
using namespace AVX2_DECODE_TABLE;
/**
* @param deg number of neighbors
* @return size of the bitmap vector (bytes)
* */
int get_vector_size(int deg);
/**
* @param bitmap triangle intersection vector to be expanded
* @param out output index place
* @param vector_size of length of the bitmap
* */
int expandToIndex(uint8_t *bitmap, int *out, int vector_size);
/**
* @param bitmap triangle intersection vector to be expanded
* @param out output vertex id place
* @param vector_size of length of the bitmap
* @param id_list start of the adjacancy list
* */
int expandToID(uint8_t *bitmap, int *out, int vector_size, int *id_list);
/**
*
* @note set intersection of two list, vec_a and vec_b
* @return number common vertex
* @return bitvec the position of common vertex in bitmap format relative to vec_a
* @param vec_a first list
* @param size_a size of first list
* @param vec_b second lsit
* @param size_b size of the second list
* */
int mark_intersect(int *vec_a, int size_a, int *vec_b, int size_b, uint8_t *bitvec);
/**
*
* @note bitwise and operation of two bitstream
* @return out the result of two intersection
* */
void intersect(uint8_t *bitmap_a, uint8_t *bitmap_b, uint8_t *out, int vector_size); // bitwise and operation
void mask_intersect(uint8_t *bitmap_a, uint8_t *bitmap_b, uint8_t mask, int pos, uint8_t *out); // bitwise and operation with mask applied
/**
* @param bitmap the coming bitstream
* @param out place that holds the indices in the bitmap
* @param start starting point of the bitmap (bits)
* @param end end place of the bitmap (bits)
* @return number of indices
* */
int expandToIndex(uint8_t *bitmap, int *out, int start, int end);
/**
* @param bitmap the coming bitstream
* @param out place that holds the vertex ids in the bitmap
* @param start starting point of the bitmap (bits)
* @param end end place of the bitmap (bits)
* @param id_list the id_list corresponds to the bitmap
* @return number of indices
* */
int expandToID(uint8_t *bitmap, int *out, int *id_list, int start, int end);
/**
* @param bitmap coming bitstream
* @param vector_size length of the bitstream
* @return number of 1s in the bitstream
* */
int count_bitmap(uint8_t *bitmap, int vector_size);
/**
* @param bitmap coming bitstream
* @param vector_size length of the bitstream
* @param start starting point of the bitmap (bits)
* @param end end place of the bitmap (bits)
* @return number of 1s in the bitstream
* */
int count_bitmap(uint8_t *bitmap, int start, int end);
/**
* @param bitmap coming bitstream
* @param vector_size number of bitmap to exam
* @return true if all the bits are zero, false otherwise
* */
bool all_zero(Bitmap *bitmap, int vector_size);
}
#endif | 31.893617 | 142 | 0.700467 | Juelin-Liu |
7b3bc756304ab7549d628e655f6ab6c917217949 | 10,245 | hpp | C++ | src/percept/mesh/geometry/volume/sierra_only/FiniteVolumeMesh.hpp | jrood-nrel/percept | 363cdd0050443760d54162f140b2fb54ed9decf0 | [
"BSD-2-Clause"
] | 3 | 2017-08-08T21:06:02.000Z | 2020-01-08T13:23:36.000Z | src/percept/mesh/geometry/volume/sierra_only/FiniteVolumeMesh.hpp | jrood-nrel/percept | 363cdd0050443760d54162f140b2fb54ed9decf0 | [
"BSD-2-Clause"
] | 2 | 2016-12-17T00:18:56.000Z | 2019-08-09T15:29:25.000Z | src/percept/mesh/geometry/volume/sierra_only/FiniteVolumeMesh.hpp | jrood-nrel/percept | 363cdd0050443760d54162f140b2fb54ed9decf0 | [
"BSD-2-Clause"
] | 2 | 2017-11-30T07:02:41.000Z | 2019-08-05T17:07:04.000Z | // Copyright 2002 - 2008, 2010, 2011 National Technology Engineering
// Solutions of Sandia, LLC (NTESS). Under the terms of Contract
// DE-NA0003525 with NTESS, the U.S. Government retains certain rights
// in this software.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#ifndef percept_FiniteVolumeMesh_h
#define percept_FiniteVolumeMesh_h
#include <iostream>
#include <vector> // for vector
#include <stddef.h> // for size_t
#include "stk_mesh/base/BulkData.hpp" // for BulkData
#include "stk_mesh/base/Field.hpp" // for Field
#include "stk_mesh/base/Selector.hpp" // for BulkData
namespace percept {
// taken and modified from Sierra/Aero DualMesh
/*
* CellFaceAndEdgeNodes.h
*
* Created on: Apr 10, 2014
* Author: swbova
*/
const int QuadEdgeNodeOrder[4][2] = // [edge][edge_node]
{ {0,1}, {1,2}, {2,3}, {0, 3} };
const int QuadSubcontrolNodeTable[4][4] = {
{0, 4, 8, 7},
{4, 1, 5, 8},
{8, 5, 2, 6},
{7, 8, 6, 3}
};
const int TriEdgeNodeOrder[3][2] = // [edge][edge_node]
{ {0,1}, {1,2}, {0, 2} };
const int TriSubcontrolNodeTable[3][4] = {
{0, 3, 6, 5},
{3, 1, 4, 6},
{5, 6, 4, 2}
};
// four nodes for each of six faces
const int HexFaceTable[6][4] = {
{0, 1, 2, 3},
{4, 5, 6, 7},
{0, 1, 5, 4},
{3, 7, 6, 2},
{1, 2, 6, 5},
{0, 3, 7, 4} };
//8 nodes for each of 8 subcontrol volumes
const int HexSubcontrolNodeTable[8][8] = {
{0, 8, 12, 11, 19, 20, 26, 25},
{8, 1, 9, 12, 20, 18, 24, 26},
{12, 9, 2, 10, 26, 24, 22, 23},
{11, 12, 10, 3, 25, 26, 23, 21},
{19, 20, 26, 25, 4, 13, 17, 16},
{20, 18, 24, 26, 13, 5, 14, 17},
{26, 24, 22, 23, 17, 14, 6, 15},
{25, 26, 23, 21, 16, 17, 15, 7} };
const int HexEdgeFacetTable[12][4] = {
{20, 8, 12, 26},
{24, 9, 12, 26},
{10, 12, 26, 23},
{11, 25, 26, 12},
{13, 20, 26, 17},
{17, 14, 24, 26},
{17, 15, 23, 26},
{16, 17, 26, 25},
{19, 20, 26, 25},
{20, 18, 24, 26},
{22, 23, 26, 24},
{21, 25, 26, 23}
};
const int HexEdgeNodeOrder[12][2] = // [edge][edge_node]
{ {0,1}, {1,2}, {2,3}, {3, 0},
{4,5}, {5,6}, {6,7}, {7, 4},
{0,4}, {1,5}, {2,6}, {3,7} };
const int TetFaceTable[4][3] = { {0, 1, 2},
{1, 2, 3},
{0, 2, 3},
{0, 1, 3} };
// 8 nodes for each of four subcontrol hex volumes
const int TetSubcontrolNodeTable[4][8] = {
{0, 4, 7, 6, 11, 13, 14, 12},
{1, 5, 7, 4, 9, 10, 14, 13},
{2, 6, 7, 5, 8, 12, 14, 10},
{3, 9, 13, 11, 8, 10, 14, 12} };
const int TetEdgeFacetTable[6][4] = { // [edge][subcontrol facet node]
{4, 7, 14, 13},
{7, 14, 10, 5},
{6, 12, 14, 7},
{11, 13, 14, 12},
{13, 9, 10, 14},
{10, 8, 12, 14} };
const int TetEdgeNodeOrder[6][2] = // [edge][edge_node]
{ {0,1}, {1,2}, {2,0}, {0,3}, {1,3}, {2,3} };
const int WedgeFaceTable[5][4] = {
{0, 2, 1, -1},
{3, 5, 4, -1},
{0, 1, 4, 3},
{1, 4, 5, 2},
{5, 3, 0, 2} };
// 8 nodes for each of six subcontrol hex volumes
const int WedgeSubcontrolNodeTable[6][8] = {
{0, 15, 16, 6, 8, 19, 20, 9}, //node 0
{9, 6, 1, 7, 20, 16, 14, 18}, //node 1
{8, 9, 7, 2, 19, 20, 18, 17}, // node 2
{19, 15, 16, 20, 12, 3, 10, 13}, //node 3
{20, 16, 14, 18, 13, 10, 4, 11}, //node 4
{19, 20, 18, 17, 12, 13, 11, 5} }; //node 5
const int WedgeEdgeFacetTable[9][4] = { //[edge][subcontrol facet node]
{6, 9, 20, 16},
{7, 9, 20, 18},
{9, 8, 19, 20},
{10, 16, 20, 13},
{13, 11, 18, 20},
{12, 13, 20, 19},
{15, 16, 20, 19},
{16, 14, 18, 20},
{19, 20, 18, 17} };
const int WedgeEdgeNodeOrder[9][2] = // [edge][edge_node]
{ {0,1}, {1,2}, {2,0},
{3,4}, {4,5}, {5,3},
{0,3}, {1,4}, {2,5} };
const int PyramidFaceTable[5][4] = {
{0, 1, 2, 3},
{0, 1, 4, -1},
{1, 2, 4, -1},
{3, 4, 2, -1},
{0, 4, 3, -1} };
// 8 nodes for each of four subcontrol hex volumes plus the apex octohedron
const int PyramidSubcontrolNodeTable[5][10] = {
{0, 5, 9, 8, 11, 12, 18, 17, -1, -1}, //node 0
{5, 1, 6, 9, 12, 10, 14, 18, -1, -1}, //node 1
{6, 2, 7, 9, 14, 13, 16, 18, -1, -1},// node 2
{8, 9, 7, 3, 17, 18, 16, 15, -1, -1}, //node 3
{ 4, 18, 15 , 17, 11, 12, 10, 14, 13, 16 } }; //node 4
const int PyramidEdgeFacetTable[8][4] = { //[edge][subcontrol face node]
{5, 9, 18, 12}, //edge 0,1
{6, 9, 18, 14}, //edge 1,2
{7, 9, 18, 16}, //edge 2,3
{8, 17, 18, 9}, //edge 3.0
{11, 12, 18, 17}, //edge 0, 4
{10, 14, 18, 12}, //edge 1,4
{13, 16, 18, 14}, //edge 2,4
{15, 17, 18, 16} };//edge 3,4
const int PyramidEdgeNodeOrder[8][2] = // [edge][edge_node]
{ {0,1}, {1,2}, {2,3}, {3,0},
{0,4}, {1,4}, {2,4}, {3,4},
};
class FiniteVolumeMesh {
public:
std::ofstream myfile;
FiniteVolumeMesh(const int d, stk::mesh::BulkData & r, stk::mesh::FieldBase *coordinatesField_ = 0,
stk::mesh::FieldBase *controlVolumeField_ = 0, stk::mesh::FieldBase *scVolumeField_ = 0);
virtual ~FiniteVolumeMesh();
virtual void computeAreaAndVolume() = 0;
// defaults to universal_part
stk::mesh::Selector active_part_selector() { return active_part_selector_ ; }
void set_active_part_selector(stk::mesh::Selector s ) { active_part_selector_ = s; }
//returns 0 for a volume that passes
int check_subcontrol_volume(const double volume, const double * centroid,
const stk::mesh::Entity elem, const stk::mesh::Entity * nodes);
void getMinAndMaxVolume();
void zero_area_and_volume();
//double check_area_closure();
struct MeshStatistics {
size_t globalNumNodes;
size_t globalNumEdges;
size_t globalNumElements;
int localNumNodes;
int localNumEdges;
int localNumElements;
int minLocalNumNodes;
int minLocalNumEdges;
int minLocalNumElements;
int maxLocalNumNodes;
int maxLocalNumEdges;
int maxLocalNumElements;
double minCellVolume;
double maxCellVolume;
double totalMeshVolume;
double minEdgeLength;
double minEdgeArea;
double maxAreaClosureError;
std::vector<double> minCoordinates;
std::vector<double> maxCoordinates;
void print(std::ostream & outStream);
MeshStatistics(int nDim) :
globalNumNodes(0),
globalNumEdges(0),
globalNumElements(0),
localNumNodes(0),
localNumEdges(0),
localNumElements(0),
totalMeshVolume(0){
minCoordinates.resize(nDim);
maxCoordinates.resize(nDim);
}
private:
MeshStatistics();
};
MeshStatistics meshStats;
protected:
int nDim_;
stk::mesh::BulkData & bulkData_;
stk::mesh::FieldBase * coordinatesField_;
stk::mesh::FieldBase * controlVolumeField_;
stk::mesh::FieldBase * scVolumeField_;
stk::mesh::Selector active_part_selector_;
typedef std::map<stk::mesh::Entity, double> NodeVolumeMap;
typedef std::map<stk::mesh::Entity, std::vector<double> > ElementSCVolumeMap;
NodeVolumeMap nodalVolume_;
ElementSCVolumeMap scVolumeMap_;
void collectCellsWithNegativeSubElements();
struct BadCell {
size_t global_id;
size_t node_ids[8];
double centroid[3];
BadCell() : global_id(-1) {
for(int i = 0; i < 8; ++i)
node_ids[i] = -1;
for(int i = 0; i < 3; ++i)
centroid[i] = 0;
}
};
std::vector<BadCell> badCellList;
};
class FiniteVolumeMesh2D : public FiniteVolumeMesh{
public:
FiniteVolumeMesh2D(stk::mesh::BulkData & r, stk::mesh::FieldBase *coordinatesField_ = 0,
stk::mesh::FieldBase *controlVolumeField_ = 0, stk::mesh::FieldBase *scVolumeField_ = 0);
virtual ~FiniteVolumeMesh2D() {}
virtual void computeAreaAndVolume();
//virtual void computeBoundaryArea();
private:
void getCentroidAndEdgeMidpoints(int numNodes,
const stk::mesh::Entity * nodes,
double centroid[3],
double edge_midpoints[4][2]);
};
class FiniteVolumeMesh3D : public FiniteVolumeMesh{
public:
FiniteVolumeMesh3D(stk::mesh::BulkData & r, stk::mesh::FieldBase *coordinatesField_ = 0,
stk::mesh::FieldBase *controlVolumeField_ = 0, stk::mesh::FieldBase *scVolumeField_ = 0);
virtual ~FiniteVolumeMesh3D() {}
virtual void computeAreaAndVolume();
//virtual EdgeListType & buildEdgeList();
//virtual void computeBoundaryArea();
virtual bool elementVolume(stk::mesh::Entity elem, double *sc_volume);
private:
void hexSubcontrolCoords(const double *centroid,
double subcontrol_coords[][3]);
void tetSubcontrolCoords(const double *centroid,
double subcontrol_coords[][3]);
void wedgeSubcontrolCoords(const double *centroid,
double subcontrol_coords[][3]);
double hexVolume(const double coords[][3]); //look below at HexFaceTable to see how the nodes are numbered
void pyramidSubcontrolCoords(const double *centroid,
double subcontrol_coords[][3]);
double pyramidTipVolume(const double coords[][3]); //look below at HexFaceTable to see how the nodes are numbered
double polyhedralVolume(const int numCoords,
const double x[][3], const int numTriangles, const int triangularFaceTable[][3]);
void elemCoordsAndCentroid(stk::mesh::Entity elem,
const int numNodes,
double centroid[3],
double elem_coords[][3]);
void accumulateSubcontrolAreaVectors(stk::mesh::Entity elem,
const double subcontrol_elem_coords[][3],
const int edgeFacetTable[][4],
const int edgeNodeOrder[][2],
const int numEdges);
void quadFaceAreaVector(const double faceCoords[4][3], double * areaVector);
};
}
#endif
| 28.617318 | 116 | 0.562909 | jrood-nrel |
7b3f8627923ce5ae183f137280f13dd556e8e217 | 2,408 | cpp | C++ | engine/src/Scripting/Transformation.cpp | BigETI/NoLifeNoCry | 70ac2498b5e740b2b348771ef9617dea1eed7f9c | [
"MIT"
] | 5 | 2020-11-07T23:38:48.000Z | 2021-12-07T11:03:22.000Z | engine/src/Scripting/Transformation.cpp | BigETI/NoLifeNoCry | 70ac2498b5e740b2b348771ef9617dea1eed7f9c | [
"MIT"
] | null | null | null | engine/src/Scripting/Transformation.cpp | BigETI/NoLifeNoCry | 70ac2498b5e740b2b348771ef9617dea1eed7f9c | [
"MIT"
] | null | null | null | #include <glm/gtx/matrix_decompose.hpp>
#include <Scripting/Transformation.hpp>
DirtMachine::Scripting::Transformation::Transformation(DirtMachine::Scripting::Transformation* parent) :
DirtMachine::Scripting::Behaviour(false),
parent(parent),
transformation()
{
// ...
}
DirtMachine::Scripting::Transformation::~Transformation()
{
// ...
}
glm::mat4x4 DirtMachine::Scripting::Transformation::GetLocalTransformation() const
{
return transformation;
}
void DirtMachine::Scripting::Transformation::SetLocalTransformation(const glm::mat4x4& newLocalTransformation)
{
transformation = newLocalTransformation;
}
glm::mat4x4 DirtMachine::Scripting::Transformation::GetLocalSpaceToWorldSpaceTransformation() const
{
return (parent ? parent->GetLocalSpaceToWorldSpaceTransformation() : glm::mat4x4()) * transformation;
}
glm::mat4x4 DirtMachine::Scripting::Transformation::GetWorldSpaceToLocalSpaceTransformation() const
{
return transformation / (parent ? parent->GetWorldSpaceToLocalSpaceTransformation() : glm::mat4x4());
}
glm::vec3 DirtMachine::Scripting::Transformation::GetLocalPosition() const
{
glm::vec3 scale;
glm::quat orientation;
glm::vec3 translation;
glm::vec3 skew;
glm::vec4 perspective;
glm::decompose(transformation, scale, orientation, translation, skew, perspective);
return translation;
}
void DirtMachine::Scripting::Transformation::SetLocalPosition(const glm::vec3& newLocalPosition)
{
// TODO
}
glm::vec3 DirtMachine::Scripting::Transformation::GetGlobalPosition() const
{
// TODO
return glm::vec3();
}
void DirtMachine::Scripting::Transformation::SetGlobalPosition(const glm::vec3& newGlobalPosition)
{
// TODO
}
glm::quat DirtMachine::Scripting::Transformation::GetLocalRotation() const
{
glm::vec3 scale;
glm::quat orientation;
glm::vec3 translation;
glm::vec3 skew;
glm::vec4 perspective;
glm::decompose(transformation, scale, orientation, translation, skew, perspective);
return orientation;
}
void DirtMachine::Scripting::Transformation::SetLocalRotation(const glm::quat& newLocalRotation)
{
// TODO
}
glm::quat DirtMachine::Scripting::Transformation::GetGlobalRotation() const
{
// TODO
return glm::quat();
}
void DirtMachine::Scripting::Transformation::SetGlobalRotation(const glm::quat& newGlobalRotation)
{
// TODO
}
DirtMachine::Scripting::Transformation* DirtMachine::Scripting::Transformation::GetParent() const
{
return parent;
}
| 25.347368 | 110 | 0.775332 | BigETI |
7b3fef06175087c36a514c0e64aa6e4c24cc12c5 | 11,232 | cc | C++ | simulation/exampleB1.cc | rlalik/mapt2-framework | 8c63c643e38c215ea0e02b6396b229e2391e46c2 | [
"MIT"
] | null | null | null | simulation/exampleB1.cc | rlalik/mapt2-framework | 8c63c643e38c215ea0e02b6396b229e2391e46c2 | [
"MIT"
] | null | null | null | simulation/exampleB1.cc | rlalik/mapt2-framework | 8c63c643e38c215ea0e02b6396b229e2391e46c2 | [
"MIT"
] | 1 | 2020-02-20T12:37:41.000Z | 2020-02-20T12:37:41.000Z | //
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: exampleB1.cc 86065 2014-11-07 08:51:15Z gcosmo $
//
/// \file exampleB1.cc
/// \brief Main program of the B1 example
#include "B1DetectorConstruction.hh"
#include "B1ActionInitialization.hh"
#include "B1Config.hh"
#include "B1PhysicsList.hh"
#include "MMAPTManager.h"
#include "MDetectorManager.h"
#include "MFibersStackDetector.h"
#include <string>
#ifdef G4MULTITHREADED
#include "G4MTRunManager.hh"
#else
#include "G4RunManager.hh"
#endif
#include "G4UImanager.hh"
#include "QBBC.hh"
#include "FTFP_BERT.hh"
#include "QGSP_BERT.hh"
#include "G4StepLimiterPhysics.hh"
#include "G4VisExecutive.hh"
#include "G4UIExecutive.hh"
#include "Randomize.hh"
#include <getopt.h>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
struct sim_config {
enum SimModel { NOMODEL = 0, QGSP, FTFP, EM }
sim_model = NOMODEL;
};
int main(int argc, char** argv)
{
B1Config* config = new B1Config ();
sim_config cfg;
G4UIExecutive* ui = 0; // UI
string config_file = ""; // Config file name
int modus = 0; // no arguments: modus = 0 ------> default
// one argument, config mode = 1: modus = 1
// one argument, config mode = 2: modus = 2
int c;
while(1)
{
static struct option long_options[] = {
{ "model", required_argument, 0, 'm' },
{ 0, 0, 0, 0 }
};
int option_index = 0;
c = getopt_long(argc, argv, "m:", long_options, &option_index);
if (c == -1)
break;
switch (c)
{
case 'm':
{
std::string model = optarg;
if (model == "qgsp")
cfg.sim_model = sim_config::SimModel::QGSP;
else if (model == "ftfp")
cfg.sim_model = sim_config::SimModel::FTFP;
else
{
std::cerr << "Unknown model " << model << std::endl;
cfg.sim_model = sim_config::SimModel::NOMODEL;
}
}
break;
default:
break;
}
}
if (cfg.sim_model == sim_config::SimModel::NOMODEL)
cfg.sim_model = sim_config::SimModel::QGSP;
if (optind < argc)
{
while (optind < argc)
{
config_file = argv[optind];
// set the file name of the config name
config->SetConfigFileName (config_file);
// load the config file and read it. Return if there is an error
if (!config->ReadConfigFile())
{
printf("Problems reading Config file\n");
return -1;
}
// check for mode defined in config file: 1 = batch mode ; 2 = interactive mode
if (config->Get_mode() == 1)
modus = 1;
else if (config->Get_mode() == 2)
{
ui = new G4UIExecutive(1, argv);
modus = 2;
}
else if (config->Get_mode() == 3)
modus = 3;
++optind;
break;
}
}
// Choose the Random engine
G4Random::setTheEngine(new CLHEP::RanecuEngine);
// Construct the default run manager
//
#ifdef G4MULTITHREADED
G4MTRunManager* runManager = new G4MTRunManager;
#else
G4RunManager* runManager = new G4RunManager;
#endif
// Set mandatory initialization classes
//
// Detector construction
B1DetectorConstruction* detector_construction = new B1DetectorConstruction(config);
runManager->SetUserInitialization(detector_construction);
// DataManager
MMAPTManager* data_manager = MMAPTManager::instance();
data_manager->setSimulation(true);
// initialize detectors
MDetectorManager * detm = MDetectorManager::instance();
detm->addDetector(new MFibersStackDetector("FibersStack"));
// detm->initParameterContainers();
detm->initCategories();
data_manager->setOutputFileName (config->Get_filename() );
bool res = data_manager->book();
if (!res)
{
std::cerr << "Output file cannot be created" << std::endl;
exit(1);
}
data_manager->buildCategory(MCategory::CatGeantTrack);
data_manager->buildCategory(MCategory::CatGeantFibersRaw);
// data_manager->setOutputTreeName ("M");
// data_manager->setOutputTreeTitle (config->Get_tree_title() );
// Physics list
G4VModularPhysicsList* physicsList = nullptr;
if (cfg.sim_model == sim_config::SimModel::FTFP)
{
std::cout << "Using FTFP model" << std::endl;
physicsList = new FTFP_BERT;
}
else if (cfg.sim_model == sim_config::SimModel::QGSP)
{
std::cout << "Using QGSP model" << std::endl;
physicsList = new QGSP_BERT;
}
else
{
physicsList = new B1PhysicsList(config);
}
// B1PhysicsList* physicsList = new B1PhysicsList(config);
// G4VModularPhysicsList* physicsList = new QGSP_BERT;
// G4VModularPhysicsList* physicsList = new FTFP_BERT;
physicsList->SetVerboseLevel(0);
physicsList->RegisterPhysics(new G4StepLimiterPhysics());
runManager->SetUserInitialization(physicsList);
// B1PhysicsList* physicsList = new B1PhysicsList(config);
// // G4VModularPhysicsList* physicsList = new QGSP_BERT;
// // G4VModularPhysicsList* physicsList = new FTFP_BERT;
// physicsList->SetVerboseLevel(0);
// physicsList->RegisterPhysics(new G4StepLimiterPhysics());
// runManager->SetUserInitialization(physicsList);
// User action initialization
runManager->SetUserInitialization(new B1ActionInitialization(data_manager,config,detector_construction));
// Initialize visualization
//
G4VisManager* visManager = new G4VisExecutive;
visManager->Initialize();
// Get the pointer to the User Interface manager
G4UImanager* UImanager = G4UImanager::GetUIpointer();
// Process macro or start UI session
//
if (modus == 0) // default interactive mode
{
// init vis
string command_init_vis = "/control/execute init_vis.mac";
UImanager->ApplyCommand(command_init_vis);
// vis mac
string command_vis = "/control/execute vis.mac" ;
UImanager->ApplyCommand(command_vis);
if (!config->Get_useRootHistoForGun ())
{
// Load default GPS mac
G4String command = "/control/execute run_gps.mac";
UImanager->ApplyCommand(command);
}
ui->SessionStart();
delete ui;
}
else if (modus > 0) // batch mode
{
if ((modus == 1) || (modus == 3))
printf("\nBatch mode: %d\n", modus);
// inititalize
string command_init_vis = "/control/execute " + config->Get_init_vis_file();
UImanager->ApplyCommand(command_init_vis);
if ((modus == 1) || (modus == 3))
UImanager->ApplyCommand("/process/msc/verbose 1");
if (config->getFlagMsc() == false)
{
// disable multiple scattering
printf("* Diable multiple scattering\n");
UImanager->ApplyCommand("/process/msc/inactivate");
}
// If this simulation is executed on the cluster, set the random seeds to job_number, job_number
if(config->Get_cluster_job())
{
// int to string
int job_number = config->Get_job_number();
stringstream ss;
ss << job_number;
string str = ss.str();
// create command
string command_random = "/random/setSeeds " + str + " " + str ;
UImanager->ApplyCommand(command_random);
}
if (modus == 2) // interactive mode
{
// vis mac
string command_vis = "/control/execute " + config->Get_vis_file();
UImanager->ApplyCommand(command_vis);
}
if (!config->Get_useRootHistoForGun ())
{
// load gun mac
string command_gun_mac = "/control/execute " + config->Get_gun_mac_file();
UImanager->ApplyCommand(command_gun_mac);
}
// start run (only in mode = 1)
// int to string
if(modus == 1)
{
int number = config->Get_number_of_events();
stringstream ss;
ss << number;
string str = ss.str();
string command_run_beamOn = "/run/beamOn " + str;
printf("\nBeamOn command: %s\n", command_run_beamOn.c_str());
UImanager->ApplyCommand(command_run_beamOn);
}
else if (modus == 2) // interactive mode
{
// start ui session
ui->SessionStart();
delete ui;
}
else if (modus == 3)
{
}
}
bool status = data_manager->save();
printf("\nTree saved with status=%d\n", status);
// Job termination
// Free the store: user actions, physics_list and detector_description are
// owned and deleted by the run manager, so they should not be deleted
// in the main() program !
delete visManager;
delete runManager;
delete config;
}
| 32.651163 | 109 | 0.553241 | rlalik |
7b444d9256199464c7999447ece2d312b6752943 | 264 | cpp | C++ | Source/IVoxel/Private/WorldGenerator/FlatWorldGenerator.cpp | kpqi5858/IVoxel | 421324dd840fcf27f9da668e1c4d4e7af9c2a983 | [
"MIT"
] | 1 | 2018-03-11T12:26:58.000Z | 2018-03-11T12:26:58.000Z | Source/IVoxel/Private/WorldGenerator/FlatWorldGenerator.cpp | kpqi5858/IVoxel | 421324dd840fcf27f9da668e1c4d4e7af9c2a983 | [
"MIT"
] | null | null | null | Source/IVoxel/Private/WorldGenerator/FlatWorldGenerator.cpp | kpqi5858/IVoxel | 421324dd840fcf27f9da668e1c4d4e7af9c2a983 | [
"MIT"
] | 1 | 2021-11-13T17:55:49.000Z | 2021-11-13T17:55:49.000Z | #include "FlatWorldGenerator.h"
UFlatWorldGenerator::UFlatWorldGenerator()
{
}
void UFlatWorldGenerator::GetValueAndColor(FIntVector Location, bool &Value, FColor &Color)
{
if (Location.Z < 10)
{
Value = true;
Color = FColor(1, 0, 0, 1);
}
else
{
}
} | 14.666667 | 91 | 0.689394 | kpqi5858 |
7b452e06138221a3af923eb35fd936814eddee65 | 2,026 | cpp | C++ | Developments/solidity-develop/test/boostTest.cpp | jansenbarabona/NFT-Game-Development | 49bf6593925123f0212dac13badd609be3866561 | [
"MIT"
] | null | null | null | Developments/solidity-develop/test/boostTest.cpp | jansenbarabona/NFT-Game-Development | 49bf6593925123f0212dac13badd609be3866561 | [
"MIT"
] | null | null | null | Developments/solidity-develop/test/boostTest.cpp | jansenbarabona/NFT-Game-Development | 49bf6593925123f0212dac13badd609be3866561 | [
"MIT"
] | null | null | null | /*
This file is part of solidity.
solidity is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
solidity is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file boostTest.cpp
* @author Marko Simovic <markobarko@gmail.com>
* @date 2014
* Stub for generating main boost.test module.
* Original code taken from boost sources.
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable:4535) // calling _set_se_translator requires /EHa
#endif
#include <boost/test/included/unit_test.hpp>
#if defined(_MSC_VER)
#pragma warning(pop)
#endif
#pragma GCC diagnostic pop
#include <test/TestHelper.h>
using namespace boost::unit_test;
namespace
{
void removeTestSuite(std::string const& _name)
{
master_test_suite_t& master = framework::master_test_suite();
auto id = master.get(_name);
assert(id != INV_TEST_UNIT_ID);
master.remove(id);
}
}
test_suite* init_unit_test_suite( int /*argc*/, char* /*argv*/[] )
{
master_test_suite_t& master = framework::master_test_suite();
master.p_name.value = "SolidityTests";
if (dev::test::Options::get().disableIPC)
{
for (auto suite: {
"ABIEncoderTest",
"SolidityAuctionRegistrar",
"SolidityFixedFeeRegistrar",
"SolidityWallet",
"LLLERC20",
"LLLENS",
"LLLEndToEndTest",
"GasMeterTests",
"SolidityEndToEndTest",
"SolidityOptimizer"
})
removeTestSuite(suite);
}
if (dev::test::Options::get().disableSMT)
removeTestSuite("SMTChecker");
return 0;
}
| 25.974359 | 73 | 0.740375 | jansenbarabona |
0da1d46ca7b890eb03bb0a30d554c087f5ab9995 | 9,558 | cc | C++ | test/unit/core/grid_test.cc | geektoni/biodynamo | 09e3673043a7b1888b8e8a47c7b98a393b9d9d29 | [
"Apache-2.0"
] | null | null | null | test/unit/core/grid_test.cc | geektoni/biodynamo | 09e3673043a7b1888b8e8a47c7b98a393b9d9d29 | [
"Apache-2.0"
] | null | null | null | test/unit/core/grid_test.cc | geektoni/biodynamo | 09e3673043a7b1888b8e8a47c7b98a393b9d9d29 | [
"Apache-2.0"
] | null | null | null | // -----------------------------------------------------------------------------
//
// Copyright (C) The BioDynaMo Project.
// All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
//
// See the LICENSE file distributed with this work for details.
// See the NOTICE file distributed with this work for additional information
// regarding copyright ownership.
//
// -----------------------------------------------------------------------------
#include "core/grid.h"
#include "core/sim_object/cell.h"
#include "gtest/gtest.h"
#include "unit/test_util/test_util.h"
namespace bdm {
void CellFactory(ResourceManager* rm, size_t cells_per_dim) {
const double space = 20;
rm->Reserve(cells_per_dim * cells_per_dim * cells_per_dim);
for (size_t i = 0; i < cells_per_dim; i++) {
for (size_t j = 0; j < cells_per_dim; j++) {
for (size_t k = 0; k < cells_per_dim; k++) {
Cell* cell = new Cell({k * space, j * space, i * space});
cell->SetDiameter(30);
rm->push_back(cell);
}
}
}
}
TEST(GridTest, SetupGrid) {
Simulation simulation(TEST_NAME);
auto* rm = simulation.GetResourceManager();
auto* grid = simulation.GetGrid();
auto ref_uid = SoUidGenerator::Get()->GetLastId();
CellFactory(rm, 4);
grid->Initialize();
std::unordered_map<SoUid, std::vector<SoUid>> neighbors;
neighbors.reserve(rm->GetNumSimObjects());
// Lambda that fills a vector of neighbors for each cell (excluding itself)
rm->ApplyOnAllElements([&](SimObject* so) {
auto uid = so->GetUid();
auto fill_neighbor_list = [&](const SimObject* neighbor) {
auto nuid = neighbor->GetUid();
if (uid != nuid) {
neighbors[uid].push_back(nuid);
}
};
grid->ForEachNeighborWithinRadius(fill_neighbor_list, *so, 1201);
});
std::vector<SoUid> expected_0 = {1, 4, 5, 16, 17, 20, 21};
std::vector<SoUid> expected_4 = {0, 1, 5, 8, 9, 16, 17, 20, 21, 24, 25};
std::vector<SoUid> expected_42 = {21, 22, 23, 25, 26, 27, 29, 30, 31,
37, 38, 39, 41, 43, 45, 46, 47, 53,
54, 55, 57, 58, 59, 61, 62, 63};
std::vector<SoUid> expected_63 = {42, 43, 46, 47, 58, 59, 62};
for (auto& el : expected_0) {
el += ref_uid;
}
for (auto& el : expected_4) {
el += ref_uid;
}
for (auto& el : expected_42) {
el += ref_uid;
}
for (auto& el : expected_63) {
el += ref_uid;
}
std::sort(neighbors[ref_uid].begin(), neighbors[ref_uid].end());
std::sort(neighbors[ref_uid + 4].begin(), neighbors[ref_uid + 4].end());
std::sort(neighbors[ref_uid + 42].begin(), neighbors[ref_uid + 42].end());
std::sort(neighbors[ref_uid + 63].begin(), neighbors[ref_uid + 63].end());
EXPECT_EQ(expected_0, neighbors[ref_uid]);
EXPECT_EQ(expected_4, neighbors[ref_uid + 4]);
EXPECT_EQ(expected_42, neighbors[ref_uid + 42]);
EXPECT_EQ(expected_63, neighbors[ref_uid + 63]);
}
void RunUpdateGridTest(Simulation* simulation, SoUid ref_uid) {
auto* rm = simulation->GetResourceManager();
auto* grid = simulation->GetGrid();
// Update the grid
grid->UpdateGrid();
std::unordered_map<SoUid, std::vector<SoUid>> neighbors;
neighbors.reserve(rm->GetNumSimObjects());
// Lambda that fills a vector of neighbors for each cell (excluding itself)
rm->ApplyOnAllElements([&](SimObject* so) {
auto uid = so->GetUid();
auto fill_neighbor_list = [&](const SimObject* neighbor) {
auto nuid = neighbor->GetUid();
if (uid != nuid) {
neighbors[uid].push_back(nuid);
}
};
grid->ForEachNeighborWithinRadius(fill_neighbor_list, *so, 1201);
});
std::vector<SoUid> expected_0 = {4, 5, 16, 17, 20, 21};
std::vector<SoUid> expected_5 = {0, 2, 4, 6, 8, 9, 10, 16,
17, 18, 20, 21, 22, 24, 25, 26};
std::vector<SoUid> expected_41 = {20, 21, 22, 24, 25, 26, 28, 29, 30,
36, 37, 38, 40, 44, 45, 46, 52, 53,
54, 56, 57, 58, 60, 61, 62};
std::vector<SoUid> expected_61 = {40, 41, 44, 45, 46, 56, 57, 58, 60, 62};
for (auto& el : expected_0) {
el += ref_uid;
}
for (auto& el : expected_5) {
el += ref_uid;
}
for (auto& el : expected_41) {
el += ref_uid;
}
for (auto& el : expected_61) {
el += ref_uid;
}
std::sort(neighbors[ref_uid].begin(), neighbors[ref_uid].end());
std::sort(neighbors[ref_uid + 5].begin(), neighbors[ref_uid + 5].end());
std::sort(neighbors[ref_uid + 41].begin(), neighbors[ref_uid + 41].end());
std::sort(neighbors[ref_uid + 61].begin(), neighbors[ref_uid + 61].end());
EXPECT_EQ(expected_0, neighbors[ref_uid]);
EXPECT_EQ(expected_5, neighbors[ref_uid + 5]);
EXPECT_EQ(expected_41, neighbors[ref_uid + 41]);
EXPECT_EQ(expected_61, neighbors[ref_uid + 61]);
}
// TODO(lukas) Add tests for Grid::ForEachNeighbor
TEST(GridTest, UpdateGrid) {
Simulation simulation(TEST_NAME);
auto* rm = simulation.GetResourceManager();
auto* grid = simulation.GetGrid();
auto ref_uid = SoUidGenerator::Get()->GetLastId();
CellFactory(rm, 4);
grid->Initialize();
// Remove cells 1 and 42
rm->Remove(ref_uid + 1);
rm->Remove(ref_uid + 42);
EXPECT_EQ(62u, rm->GetNumSimObjects());
RunUpdateGridTest(&simulation, ref_uid);
}
TEST(GridTest, NoRaceConditionDuringUpdate) {
Simulation simulation(TEST_NAME);
auto* rm = simulation.GetResourceManager();
auto* grid = simulation.GetGrid();
auto ref_uid = SoUidGenerator::Get()->GetLastId();
CellFactory(rm, 4);
// make sure that there are multiple cells per box
rm->GetSimObject(ref_uid)->SetDiameter(60);
grid->Initialize();
// Remove cells 1 and 42
rm->Remove(ref_uid + 1);
rm->Remove(ref_uid + 42);
// run 100 times to increase possibility of race condition due to different
// scheduling of threads
for (uint16_t i = 0; i < 100; i++) {
RunUpdateGridTest(&simulation, ref_uid);
}
}
TEST(GridTest, GetBoxIndex) {
Simulation simulation(TEST_NAME);
auto* rm = simulation.GetResourceManager();
auto* grid = simulation.GetGrid();
CellFactory(rm, 3);
grid->Initialize();
Double3 position_0 = {{0, 0, 0}};
Double3 position_1 = {{1e-15, 1e-15, 1e-15}};
Double3 position_2 = {{-1e-15, 1e-15, 1e-15}};
size_t expected_idx_0 = 21;
size_t expected_idx_1 = 21;
size_t expected_idx_2 = 20;
size_t idx_0 = grid->GetBoxIndex(position_0);
size_t idx_1 = grid->GetBoxIndex(position_1);
size_t idx_2 = grid->GetBoxIndex(position_2);
EXPECT_EQ(expected_idx_0, idx_0);
EXPECT_EQ(expected_idx_1, idx_1);
EXPECT_EQ(expected_idx_2, idx_2);
}
TEST(GridTest, GridDimensions) {
Simulation simulation(TEST_NAME);
auto* rm = simulation.GetResourceManager();
auto* grid = simulation.GetGrid();
auto ref_uid = SoUidGenerator::Get()->GetLastId();
CellFactory(rm, 3);
grid->Initialize();
std::array<int32_t, 6> expected_dim_0 = {{-30, 90, -30, 90, -30, 90}};
auto& dim_0 = grid->GetDimensions();
EXPECT_EQ(expected_dim_0, dim_0);
rm->GetSimObject(ref_uid)->SetPosition({{100, 0, 0}});
grid->UpdateGrid();
std::array<int32_t, 6> expected_dim_1 = {{-30, 150, -30, 90, -30, 90}};
auto& dim_1 = grid->GetDimensions();
EXPECT_EQ(expected_dim_1, dim_1);
}
TEST(GridTest, GetBoxCoordinates) {
Simulation simulation(TEST_NAME);
auto* rm = simulation.GetResourceManager();
auto* grid = simulation.GetGrid();
CellFactory(rm, 3);
// expecting a 4 * 4 * 4 grid
grid->Initialize();
EXPECT_ARR_EQ({3, 0, 0}, grid->GetBoxCoordinates(3));
EXPECT_ARR_EQ({1, 2, 0}, grid->GetBoxCoordinates(9));
EXPECT_ARR_EQ({1, 2, 3}, grid->GetBoxCoordinates(57));
}
TEST(GridTest, NonEmptyBoundedTestThresholdDimensions) {
auto set_param = [](auto* param) {
param->bound_space_ = true;
param->min_bound_ = 1;
param->max_bound_ = 99;
};
Simulation simulation(TEST_NAME, set_param);
auto* rm = simulation.GetResourceManager();
auto* grid = simulation.GetGrid();
rm->push_back(new Cell(10));
grid->Initialize();
auto max_dimensions = grid->GetDimensionThresholds();
EXPECT_EQ(1, max_dimensions[0]);
EXPECT_EQ(99, max_dimensions[1]);
}
TEST(GridTest, IterateZOrder) {
Simulation simulation(TEST_NAME);
auto* rm = simulation.GetResourceManager();
auto* grid = simulation.GetGrid();
auto ref_uid = SoUidGenerator::Get()->GetLastId();
CellFactory(rm, 3);
// expecting a 4 * 4 * 4 grid
grid->Initialize();
std::vector<std::set<SoUid>> zorder;
zorder.resize(8);
uint64_t box_cnt = 0;
uint64_t cnt = 0;
auto lambda = [&](const SoHandle& soh) {
if (cnt == 8 || cnt == 12 || cnt == 16 || cnt == 18 || cnt == 22 ||
cnt == 24 || cnt == 26) {
box_cnt++;
}
auto* so = rm->GetSimObjectWithSoHandle(soh);
zorder[box_cnt].insert(so->GetUid() - ref_uid);
cnt++;
};
grid->IterateZOrder(lambda);
ASSERT_EQ(27u, cnt);
// check each box; no order within a box
std::vector<std::set<SoUid>> expected(8);
expected[0] = std::set<SoUid>{0, 1, 3, 4, 9, 10, 12, 13};
expected[1] = std::set<SoUid>{2, 5, 11, 14};
expected[2] = std::set<SoUid>{6, 7, 15, 16};
expected[3] = std::set<SoUid>{8, 17};
expected[4] = std::set<SoUid>{18, 19, 21, 22};
expected[5] = std::set<SoUid>{20, 23};
expected[6] = std::set<SoUid>{24, 25};
expected[7] = std::set<SoUid>{26};
for (int i = 0; i < 8; i++) {
EXPECT_EQ(expected[i], zorder[i]);
}
}
} // namespace bdm
| 29.5 | 80 | 0.628165 | geektoni |
0da55752e6a110c78d40f596f41d7fa00bfbb951 | 342 | cpp | C++ | lib/scopy.cpp | langou/latl | df838fb44a1ef5c77b57bf60bd46eaeff8db3492 | [
"BSD-3-Clause-Open-MPI"
] | 6 | 2015-12-13T09:10:11.000Z | 2022-02-09T23:18:22.000Z | lib/scopy.cpp | langou/latl | df838fb44a1ef5c77b57bf60bd46eaeff8db3492 | [
"BSD-3-Clause-Open-MPI"
] | null | null | null | lib/scopy.cpp | langou/latl | df838fb44a1ef5c77b57bf60bd46eaeff8db3492 | [
"BSD-3-Clause-Open-MPI"
] | 2 | 2019-02-01T06:46:36.000Z | 2022-02-09T23:18:24.000Z | //
// scopy.cpp
// Linear Algebra Template Library
//
// Created by Rodney James on 1/1/13.
// Copyright (c) 2013 University of Colorado Denver. All rights reserved.
//
#include "blas.h"
#include "copy.h"
using LATL::COPY;
int scopy_(int &n, float *x, int& incx, float *y, int& incy)
{
COPY<float>(n,x,incx,y,incy);
return 0;
}
| 17.1 | 74 | 0.649123 | langou |
0da794c492fd771ae15daadded850a6c0ddb4975 | 3,665 | hpp | C++ | tapl/common/ringBuffer.hpp | towardsautonomy/TAPL | 4d065b2250483bf2ea118bafa312ca893a25ca87 | [
"MIT"
] | 1 | 2021-01-05T12:53:17.000Z | 2021-01-05T12:53:17.000Z | tapl/common/ringBuffer.hpp | towardsautonomy/TAPL | 4d065b2250483bf2ea118bafa312ca893a25ca87 | [
"MIT"
] | null | null | null | tapl/common/ringBuffer.hpp | towardsautonomy/TAPL | 4d065b2250483bf2ea118bafa312ca893a25ca87 | [
"MIT"
] | null | null | null | /**
* @file ringBuffer.hpp
* @brief This file provides an implementation of a ring buffer
* @author Shubham Shrivastava
*/
#ifndef RING_BUFFER_H_
#define RING_BUFFER_H_
#include <iostream>
#include <algorithm>
#include "tapl/common/taplLog.hpp"
namespace tapl
{
/**
* @brief Ring Buffer
*/
template <typename T>
class RingBuffer {
private:
// size of the buffer
uint16_t size;
// maximum size of buffer
uint16_t max_size;
// real index of the ring buffer head
int16_t head;
// real index of the ring buffer tail
int16_t tail;
// buffer to store data
std::vector<T> buffer;
public:
// constructor
RingBuffer(uint16_t max_size)
{
// allocate memory
buffer.resize(max_size);
// set buffer size to zero
size = 0;
// set maximum size
this->max_size = max_size;
// set head and tail to zero
head = 0;
tail = 0;
}
// deconstructor
~RingBuffer() {}
// method for getting the size of the rung buffer
uint16_t getSize() {
return size;
}
// method for pushing the data at the front of the ring buffer
void push(T const data) {
buffer[head] = data;
// increment the header in circular manner
head++;
if(head >= max_size) head = 0;
// increment size
size = std::min((uint16_t)(size+1), max_size);
// setup the tail index
if(size == max_size)
{
tail = head - max_size;
if(tail < 0) tail += max_size;
}
}
// method for popping the data at the front of the ring buffer
T pop() {
// make sure atleast one data exists
if(size == 0)
{
TLOG_ERROR << "no data available to pop";
return T();
}
else
{
// decrement the head and return the data pointed by head
head--;
if(head < 0) head+= max_size;
size--;
return buffer[head];
}
}
// method for getting data at a certain index
T get(uint16_t index) {
// make sure that data requested at index exists
if(index >= size)
{
TLOG_ERROR << "index out of range";
return T();
}
else
{
// get the actual index and return data
int16_t idx = tail + index;
if(idx >= max_size)
{
idx = idx - max_size;
}
return buffer[idx];
}
}
// method for getting data pointer at a certain index
T * get_ptr(uint16_t index) {
// make sure that data requested at index exists
if(index >= size)
{
TLOG_INFO << "index = " << index << "; size = " << size;
TLOG_ERROR << "index out of range";
return (T *)NULL;
}
else
{
// get the actual index and return data pointer
int16_t idx = tail + index;
if(idx >= max_size)
{
idx = idx - max_size;
}
return &buffer[idx];
}
}
};
}
#endif /* RING_BUFFER_H_ */ | 26.366906 | 73 | 0.454843 | towardsautonomy |
0dabe41d911e9a7765ced4e33458313dc54e23cf | 5,038 | cpp | C++ | samples/cpp/mpeg1as/main.cpp | sergeyrachev/flavor | 40e141bd78a5882b1240cb0d7ac324312e3228e3 | [
"Artistic-1.0"
] | 5 | 2016-11-25T08:43:00.000Z | 2021-06-20T19:30:35.000Z | samples/cpp/mpeg1as/main.cpp | sergeyrachev/flavor | 40e141bd78a5882b1240cb0d7ac324312e3228e3 | [
"Artistic-1.0"
] | 3 | 2017-02-13T21:22:16.000Z | 2017-09-25T20:42:12.000Z | samples/cpp/mpeg1as/main.cpp | sergeyrachev/flavor | 40e141bd78a5882b1240cb0d7ac324312e3228e3 | [
"Artistic-1.0"
] | 1 | 2019-12-03T05:15:01.000Z | 2019-12-03T05:15:01.000Z | /*
* Copyright (c) 1997-2004 Alexandros Eleftheriadis, Danny Hong and
* Yuntai Kyong.
*
* This file is part of Flavor, developed at Columbia University
* (http://flavor.sourceforge.net).
*
* Flavor is free software; you can redistribute it and/or modify
* it under the terms of the Flavor Artistic License as described in
* the file COPYING.txt.
*
*/
/*
* Authors:
* Danny Hong <danny@ee.columbia.edu>
*
*/
#include <stdio.h>
#include <flavormp3.h>
#include "mpeg1as.h"
int main(int argc, char *argv[])
{
if (argc != 2) {
fprintf(stderr, "Usage: %s mpeg1as_file\n", argv[0]);
exit(1);
}
BuffBitstream bs(argv[1], BS_INPUT);
// Create our MPEG-1 Audio frame object
Frame frame;
// Main data for Layer III
MainData md;
#ifdef USE_EXCEPTION
// Get the data
try {
int i, N;
// Read first 15 frames only
for (i=0; i<15; i++) {
frame.get(bs);
if (frame.h->layer == LAYER1) {
N = (12 * frame.h->bitrate * 1000) / frame.h->frequency;
if (frame.h->padding_bit) N += 1;
}
else {
// TBD: must take care of the free bitrate case
N = (144 * frame.h->bitrate * 1000) / frame.h->frequency;
if (frame.h->padding_bit) N += 1;
if (frame.h->layer == LAYER3) {
/* In the case of Layer III, frame.size indicates not the size of the
* whole frame, rather only the size of the header. N-(frame.size>>3)
* bytes are the data bytes and we buffer them into the data buffer.
*/
bs.buffer(N-(frame.size>>3));
bs.swap(); // Once the header is read, we switch to the data buffer
fprintf(stdout, "dsize = %d, N = %d, frame.size = %d, main_data_begin = %d\n", bs.getdsize(), N, (frame.size>>3), frame.adl3->main_data_begin);
/* Start reading from the data buffer at -(main_data_begin) bytes from the
* beginning of the last header
*/
bs.skipbits((bs.getdsize() - (N-(frame.size>>3)+frame.adl3->main_data_begin))*8);
// Get the main data
md.get(bs, frame.h, frame.adl3);
bs.swap(); // Switch back to the i/o buffer
}
}
if (frame.h->layer == LAYER3)
fprintf(stdout, "The size of frame(%d) header = %d bits, N = %d\n", i, frame.size, N);
else
fprintf(stdout, "The size of frame(%d) = %d bits, N = %d\n", i, frame.size, N);
}
}
catch (BuffBitstream::EndOfData e) {
fprintf(stdout, "%s: %s\n", argv[0], e.getmsg());
exit(1);
}
catch (BuffBitstream::Error e) {
fprintf(stderr, "%s: Error: %s\n", argv[0], e.getmsg());
exit(1);
}
#else
// Get the data
int i, N;
// Read first 15 frames only
for (i=0; i<15; i++) {
frame.get(bs);
if (frame.h->layer == LAYER1) {
N = (12 * frame.h->bitrate * 1000) / frame.h->frequency;
if (frame.h->padding_bit) N += 1;
}
else {
// TBD: must take care of the free bitrate case
N = (144 * frame.h->bitrate * 1000) / frame.h->frequency;
if (frame.h->padding_bit) N += 1;
if (frame.h->layer == LAYER3) {
/* In the case of Layer III, frame.size indicates not the size of the
* whole frame, rather only the size of the header. N-(frame.size>>3)
* bytes are the data bytes and we buffer them into the data buffer.
*/
bs.buffer(N-(frame.size>>3));
bs.swap(); // Once the header is read, we switch to the data buffer
fprintf(stdout, "dsize = %d, N = %d, frame.size = %d, main_data_begin = %d\n", bs.getdsize(), N, (frame.size>>3), frame.adl3->main_data_begin);
/* Start reading from the data buffer at -(main_data_begin) bytes from the
* beginning of the last header
*/
bs.skipbits((bs.getdsize() - (N-(frame.size>>3)+frame.adl3->main_data_begin))*8);
// Get the main data
md.get(bs, frame.h, frame.adl3);
bs.swap(); // Switch back to the i/o buffer
}
}
if (frame.h->layer == LAYER3)
fprintf(stdout, "The size of frame(%d) header = %d bits, N = %d\n", i, frame.size, N);
else
fprintf(stdout, "The size of frame(%d) = %d bits, N = %d\n", i, frame.size, N);
if (bs.geterror() == E_END_OF_DATA) {
fprintf(stdout, "End of file\n");
exit(1);
}
else if (bs.geterror() != E_NONE) {
fprintf(stderr, "%s: Error: %s\n", argv[2], bs.getmsg());
exit(1);
}
}
#endif
return 0;
} | 35.478873 | 163 | 0.506153 | sergeyrachev |
0daf07099af730edd6bd0fb722f9b7548bd27815 | 19,141 | cpp | C++ | examples/new-window/new-window-example.cpp | tizenorg/platform.core.uifw.dali-demo | 0d87f90af43262533fed3a39dfac5e197c634f00 | [
"Apache-2.0"
] | null | null | null | examples/new-window/new-window-example.cpp | tizenorg/platform.core.uifw.dali-demo | 0d87f90af43262533fed3a39dfac5e197c634f00 | [
"Apache-2.0"
] | null | null | null | examples/new-window/new-window-example.cpp | tizenorg/platform.core.uifw.dali-demo | 0d87f90af43262533fed3a39dfac5e197c634f00 | [
"Apache-2.0"
] | null | null | null | /*
* Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
* 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.
*/
// EXTERNAL INCLUDES
#include <dali/devel-api/images/texture-set-image.h>
#include <dali/public-api/rendering/renderer.h>
#include <dali-toolkit/dali-toolkit.h>
#include <dali-toolkit/devel-api/controls/bubble-effect/bubble-emitter.h>
#include <cstdio>
#include <iostream>
// INTERNAL INCLUDES
#include "shared/view.h"
#include "shared/utility.h"
using namespace Dali;
using namespace Dali::Toolkit;
class NewWindowController;
namespace
{
const char * const BACKGROUND_IMAGE( DEMO_IMAGE_DIR "background-2.jpg" );
const char * const TOOLBAR_IMAGE( DEMO_IMAGE_DIR "top-bar.png" );
const char * const LOSE_CONTEXT_IMAGE( DEMO_IMAGE_DIR "icon-cluster-wobble.png" );
const char * const LOSE_CONTEXT_IMAGE_SELECTED( DEMO_IMAGE_DIR "icon-cluster-wobble-selected.png" );
const char * const BASE_IMAGE( DEMO_IMAGE_DIR "gallery-large-14.jpg" );
const char * const EFFECT_IMAGE( DEMO_IMAGE_DIR "gallery-large-18.jpg" );
const char * const LOGO_IMAGE(DEMO_IMAGE_DIR "dali-logo.png");
const float EXPLOSION_DURATION(1.2f);
const unsigned int EMIT_INTERVAL_IN_MS(40);
const float TRACK_DURATION_IN_MS(970);
Application gApplication;
NewWindowController* gNewWindowController(NULL);
#define MAKE_SHADER(A)#A
const char* VERTEX_COLOR_MESH = MAKE_SHADER(
attribute mediump vec3 aPosition;\n
attribute lowp vec3 aColor;\n
uniform mediump mat4 uMvpMatrix;\n
uniform mediump vec3 uSize;\n
varying lowp vec3 vColor;\n
\n
void main()\n
{\n
gl_Position = uMvpMatrix * vec4( aPosition*uSize, 1.0 );\n
vColor = aColor;\n
}\n
);
const char* FRAGMENT_COLOR_MESH = MAKE_SHADER(
uniform lowp vec4 uColor;\n
varying lowp vec3 vColor;\n
\n
void main()\n
{\n
gl_FragColor = vec4(vColor,1.0)*uColor;
}\n
);
const char* VERTEX_TEXTURE_MESH = MAKE_SHADER(
attribute mediump vec3 aPosition;\n
attribute highp vec2 aTexCoord;\n
uniform mediump mat4 uMvpMatrix;\n
uniform mediump vec3 uSize;\n
varying mediump vec2 vTexCoord;\n
\n
void main()\n
{\n
gl_Position = uMvpMatrix * vec4( aPosition*uSize, 1.0 );\n
vTexCoord = aTexCoord;\n
}\n
);
const char* FRAGMENT_TEXTURE_MESH = MAKE_SHADER(
varying mediump vec2 vTexCoord;\n
uniform lowp vec4 uColor;\n
uniform sampler2D sTexture;\n
\n
void main()\n
{\n
gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor;
}\n
);
const char* FRAGMENT_BLEND_SHADER = MAKE_SHADER(
varying mediump vec2 vTexCoord;\n
uniform sampler2D sTexture;\n
uniform sampler2D sEffect;\n
uniform mediump float alpha;\n
\n
void main()\n
{\n
mediump vec4 fragColor = texture2D(sTexture, vTexCoord);\n
mediump vec4 fxColor = texture2D(sEffect, vTexCoord);\n
gl_FragColor = mix(fragColor,fxColor, alpha);\n
}\n
);
}; // anonymous namespace
class NewWindowController : public ConnectionTracker
{
public:
NewWindowController( Application& app );
void Create( Application& app );
void Destroy( Application& app );
void AddBubbles( Actor& parentActor, const Vector2& stageSize);
void AddMeshActor( Actor& parentActor );
void AddBlendingImageActor( Actor& parentActor );
void AddTextLabel( Actor& parentActor );
ImageView CreateBlurredMirrorImage(const char* imageName);
FrameBufferImage CreateFrameBufferForImage( const char* imageName, Property::Map& shaderEffect, const Vector3& rgbDelta );
void SetUpBubbleEmission( const Vector2& emitPosition, const Vector2& direction );
Geometry CreateMeshGeometry();
Dali::Property::Map CreateColorModifierer();
static void NewWindow(void);
bool OnTrackTimerTick();
void OnKeyEvent(const KeyEvent& event);
bool OnLoseContextButtonClicked( Toolkit::Button button );
void OnContextLost();
void OnContextRegained();
private:
Application mApplication;
TextLabel mTextActor;
Toolkit::Control mView; ///< The View instance.
Toolkit::ToolBar mToolBar; ///< The View's Toolbar.
TextLabel mTitleActor; ///< The Toolbar's Title.
Layer mContentLayer; ///< Content layer (scrolling cluster content)
Toolkit::PushButton mLoseContextButton;
Toolkit::BubbleEmitter mEmitter;
Timer mEmitTrackTimer;
bool mNeedNewAnimation;
unsigned int mAnimateComponentCount;
Animation mEmitAnimation;
};
NewWindowController::NewWindowController( Application& application )
: mApplication(application),
mNeedNewAnimation(true)
{
mApplication.InitSignal().Connect(this, &NewWindowController::Create);
mApplication.TerminateSignal().Connect(this, &NewWindowController::Destroy);
}
void NewWindowController::Create( Application& app )
{
Stage stage = Stage::GetCurrent();
stage.SetBackgroundColor(Color::YELLOW);
stage.KeyEventSignal().Connect(this, &NewWindowController::OnKeyEvent);
// The Init signal is received once (only) during the Application lifetime
// Hide the indicator bar
mApplication.GetWindow().ShowIndicator( Dali::Window::INVISIBLE );
mContentLayer = DemoHelper::CreateView( app,
mView,
mToolBar,
"",
TOOLBAR_IMAGE,
"Context recovery" );
Size stageSize = stage.GetSize();
ImageView backgroundActor = ImageView::New( BACKGROUND_IMAGE, Dali::ImageDimensions( stageSize.x, stageSize.y ) );
backgroundActor.SetParentOrigin( ParentOrigin::CENTER );
mContentLayer.Add(backgroundActor);
// Point the default render task at the view
RenderTaskList taskList = stage.GetRenderTaskList();
RenderTask defaultTask = taskList.GetTask( 0u );
if ( defaultTask )
{
defaultTask.SetSourceActor( mView );
}
mLoseContextButton = Toolkit::PushButton::New();
mLoseContextButton.SetUnselectedImage( LOSE_CONTEXT_IMAGE );
mLoseContextButton.SetSelectedImage( LOSE_CONTEXT_IMAGE_SELECTED );
mLoseContextButton.ClickedSignal().Connect( this, &NewWindowController::OnLoseContextButtonClicked );
mToolBar.AddControl( mLoseContextButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
Actor logoLayoutActor = Actor::New();
logoLayoutActor.SetParentOrigin(ParentOrigin::CENTER);
logoLayoutActor.SetPosition(0.0f, -200.0f, 0.0f);
logoLayoutActor.SetScale(0.5f);
backgroundActor.Add(logoLayoutActor);
ImageView imageView = ImageView::New( LOGO_IMAGE );
imageView.SetName("daliLogo");
imageView.SetParentOrigin(ParentOrigin::CENTER);
imageView.SetAnchorPoint(AnchorPoint::BOTTOM_CENTER);
logoLayoutActor.Add(imageView);
ImageView mirrorImageView = CreateBlurredMirrorImage(LOGO_IMAGE);
mirrorImageView.SetParentOrigin(ParentOrigin::TOP_CENTER);
mirrorImageView.SetAnchorPoint(AnchorPoint::BOTTOM_CENTER);
logoLayoutActor.Add(mirrorImageView);
AddBubbles( backgroundActor, stage.GetSize());
AddMeshActor( backgroundActor );
AddBlendingImageActor( backgroundActor );
AddTextLabel( backgroundActor );
stage.ContextLostSignal().Connect(this, &NewWindowController::OnContextLost);
stage.ContextRegainedSignal().Connect(this, &NewWindowController::OnContextRegained);
}
void NewWindowController::Destroy( Application& app )
{
UnparentAndReset(mTextActor);
}
void NewWindowController::AddBubbles( Actor& parentActor, const Vector2& stageSize)
{
mEmitter = Toolkit::BubbleEmitter::New( stageSize,
DemoHelper::LoadImage( DEMO_IMAGE_DIR "bubble-ball.png" ),
200, Vector2( 5.0f, 5.0f ) );
Image background = DemoHelper::LoadImage(BACKGROUND_IMAGE);
mEmitter.SetBackground( background, Vector3(0.5f, 0.f,0.5f) );
mEmitter.SetBubbleDensity( 9.f );
Actor bubbleRoot = mEmitter.GetRootActor();
parentActor.Add( bubbleRoot );
bubbleRoot.SetParentOrigin(ParentOrigin::CENTER);
bubbleRoot.SetZ(0.1f);
mEmitTrackTimer = Timer::New( EMIT_INTERVAL_IN_MS );
mEmitTrackTimer.TickSignal().Connect(this, &NewWindowController::OnTrackTimerTick);
mEmitTrackTimer.Start();
}
void NewWindowController::AddMeshActor( Actor& parentActor )
{
Geometry meshGeometry = CreateMeshGeometry();
// Create a coloured mesh
Shader shaderColorMesh = Shader::New( VERTEX_COLOR_MESH, FRAGMENT_COLOR_MESH );
Renderer colorMeshRenderer = Renderer::New( meshGeometry, shaderColorMesh );
Actor colorMeshActor = Actor::New();
colorMeshActor.AddRenderer( colorMeshRenderer );
colorMeshActor.SetSize( 175.f,175.f, 175.f );
colorMeshActor.SetParentOrigin( ParentOrigin::CENTER );
colorMeshActor.SetAnchorPoint(AnchorPoint::TOP_CENTER);
colorMeshActor.SetPosition(Vector3(0.0f, 50.0f, 0.0f));
colorMeshActor.SetOrientation( Degree(75.f), Vector3::XAXIS );
colorMeshActor.SetName("ColorMeshActor");
// Create a textured mesh
Texture effectTexture = DemoHelper::LoadTexture(EFFECT_IMAGE);
Shader shaderTextureMesh = Shader::New( VERTEX_TEXTURE_MESH, FRAGMENT_TEXTURE_MESH );
TextureSet textureSet = TextureSet::New();
textureSet.SetTexture( 0u, effectTexture );
Renderer textureMeshRenderer = Renderer::New( meshGeometry, shaderTextureMesh );
textureMeshRenderer.SetTextures( textureSet );
Actor textureMeshActor = Actor::New();
textureMeshActor.AddRenderer( textureMeshRenderer );
textureMeshActor.SetSize( 175.f,175.f, 175.f );
textureMeshActor.SetParentOrigin( ParentOrigin::CENTER );
textureMeshActor.SetAnchorPoint(AnchorPoint::TOP_CENTER);
textureMeshActor.SetPosition(Vector3(0.0f, 200.0f, 0.0f));
textureMeshActor.SetOrientation( Degree(75.f), Vector3::XAXIS );
textureMeshActor.SetName("TextureMeshActor");
Layer layer3d = Layer::New();
layer3d.SetParentOrigin( ParentOrigin::CENTER );
layer3d.SetAnchorPoint( AnchorPoint::CENTER );
layer3d.SetBehavior(Layer::LAYER_3D);
layer3d.Add( colorMeshActor );
layer3d.Add( textureMeshActor );
parentActor.Add(layer3d);
}
void NewWindowController::AddBlendingImageActor( Actor& parentActor )
{
Property::Map colorModifier = CreateColorModifierer();
FrameBufferImage fb2 = CreateFrameBufferForImage( EFFECT_IMAGE, colorModifier, Vector3( 0.5f, 0.5f, 0.5f ) );
ImageView tmpActor = ImageView::New(fb2);
parentActor.Add(tmpActor);
tmpActor.SetParentOrigin(ParentOrigin::CENTER_RIGHT);
tmpActor.SetAnchorPoint(AnchorPoint::TOP_RIGHT);
tmpActor.SetPosition(Vector3(0.0f, 150.0f, 0.0f));
tmpActor.SetScale(0.25f);
// create blending shader effect
Property::Map customShader;
customShader[ "fragmentShader" ] = FRAGMENT_BLEND_SHADER;
Property::Map map;
map[ "shader" ] = customShader;
ImageView blendActor = ImageView::New( BASE_IMAGE );
blendActor.SetProperty( ImageView::Property::IMAGE, map );
blendActor.RegisterProperty( "alpha", 0.5f );
blendActor.SetParentOrigin(ParentOrigin::CENTER_RIGHT);
blendActor.SetAnchorPoint(AnchorPoint::BOTTOM_RIGHT);
blendActor.SetPosition(Vector3(0.0f, 100.0f, 0.0f));
blendActor.SetSize(140, 140);
parentActor.Add(blendActor);
TextureSet textureSet = blendActor.GetRendererAt(0u).GetTextures();
TextureSetImage( textureSet, 1u, fb2 );
}
void NewWindowController::AddTextLabel( Actor& parentActor )
{
mTextActor = TextLabel::New("Some text");
mTextActor.SetParentOrigin(ParentOrigin::CENTER);
mTextActor.SetColor(Color::RED);
mTextActor.SetName("PushMe text");
parentActor.Add( mTextActor );
}
ImageView NewWindowController::CreateBlurredMirrorImage(const char* imageName)
{
Image image = DemoHelper::LoadImage(imageName);
Vector2 FBOSize = Vector2( image.GetWidth(), image.GetHeight() );
FrameBufferImage fbo = FrameBufferImage::New( FBOSize.width, FBOSize.height, Pixel::RGBA8888);
GaussianBlurView gbv = GaussianBlurView::New(5, 2.0f, Pixel::RGBA8888, 0.5f, 0.5f, true);
gbv.SetBackgroundColor(Color::TRANSPARENT);
gbv.SetUserImageAndOutputRenderTarget( image, fbo );
gbv.SetSize(FBOSize);
Stage::GetCurrent().Add(gbv);
gbv.ActivateOnce();
ImageView blurredActor = ImageView::New(fbo);
blurredActor.SetSize(FBOSize);
blurredActor.SetScale(1.0f, -1.0f, 1.0f);
return blurredActor;
}
FrameBufferImage NewWindowController::CreateFrameBufferForImage(const char* imageName, Property::Map& shaderEffect, const Vector3& rgbDelta )
{
Stage stage = Stage::GetCurrent();
Uint16Pair intFboSize = ResourceImage::GetImageSize( imageName );
Vector2 FBOSize = Vector2(intFboSize.GetWidth(), intFboSize.GetHeight());
FrameBufferImage framebuffer = FrameBufferImage::New(FBOSize.x, FBOSize.y );
RenderTask renderTask = stage.GetRenderTaskList().CreateTask();
ImageView imageView = ImageView::New( imageName );
imageView.SetName("Source image actor");
imageView.SetProperty( ImageView::Property::IMAGE, shaderEffect );
imageView.RegisterProperty( "uRGBDelta", rgbDelta );
imageView.SetParentOrigin(ParentOrigin::CENTER);
imageView.SetAnchorPoint(AnchorPoint::CENTER);
imageView.SetScale(1.0f, -1.0f, 1.0f);
stage.Add(imageView); // Not in default image view
CameraActor cameraActor = CameraActor::New(FBOSize);
cameraActor.SetParentOrigin(ParentOrigin::CENTER);
cameraActor.SetFieldOfView(Math::PI*0.25f);
cameraActor.SetNearClippingPlane(1.0f);
cameraActor.SetAspectRatio(FBOSize.width / FBOSize.height);
cameraActor.SetType(Dali::Camera::FREE_LOOK); // camera orientation based solely on actor
cameraActor.SetPosition(0.0f, 0.0f, ((FBOSize.height * 0.5f) / tanf(Math::PI * 0.125f)));
stage.Add(cameraActor);
renderTask.SetSourceActor(imageView);
renderTask.SetInputEnabled(false);
renderTask.SetTargetFrameBuffer(framebuffer);
renderTask.SetCameraActor( cameraActor );
renderTask.SetClearColor( Color::TRANSPARENT );
renderTask.SetClearEnabled( true );
renderTask.SetRefreshRate(RenderTask::REFRESH_ONCE);
return framebuffer;
}
void NewWindowController::SetUpBubbleEmission( const Vector2& emitPosition, const Vector2& direction)
{
if( mNeedNewAnimation )
{
float duration = Random::Range(1.f, 1.5f);
mEmitAnimation = Animation::New( duration );
mNeedNewAnimation = false;
mAnimateComponentCount = 0;
}
mEmitter.EmitBubble( mEmitAnimation, emitPosition, direction, Vector2(10,10) );
mAnimateComponentCount++;
if( mAnimateComponentCount % 6 ==0 )
{
mEmitAnimation.Play();
mNeedNewAnimation = true;
}
}
Geometry NewWindowController::CreateMeshGeometry()
{
// Create vertices and specify their color
struct Vertex
{
Vector3 position;
Vector2 textureCoordinates;
Vector3 color;
};
Vertex vertexData[5] = {
{ Vector3( 0.0f, 0.0f, 0.5f ), Vector2(0.5f, 0.5f), Vector3(1.0f, 1.0f, 1.0f) },
{ Vector3( -0.5f, -0.5f, 0.0f ), Vector2(0.0f, 0.0f), Vector3(1.0f, 0.0f, 0.0f) },
{ Vector3( 0.5f, -0.5f, 0.0f ), Vector2(1.0f, 0.0f), Vector3(1.0f, 1.0f, 0.0f) },
{ Vector3( -0.5f, 0.5f, 0.0f ), Vector2(0.0f, 1.0f), Vector3(0.0f, 1.0f, 0.0f) },
{ Vector3( 0.5f, 0.5f, 0.0f ), Vector2(1.0f, 1.0f), Vector3(0.0f, 0.0f, 1.0f) } };
Property::Map vertexFormat;
vertexFormat["aPosition"] = Property::VECTOR3;
vertexFormat["aTexCoord"] = Property::VECTOR2;
vertexFormat["aColor"] = Property::VECTOR3;
PropertyBuffer vertices = PropertyBuffer::New( vertexFormat );
vertices.SetData( vertexData, 5 );
// Specify all the faces
unsigned short indexData[12] = { 0,1,3,0,2,4,0,3,4,0,2,1 };
// Create the geometry object
Geometry geometry = Geometry::New();
geometry.AddVertexBuffer( vertices );
geometry.SetIndexBuffer( &indexData[0], 12 );
return geometry;
}
Dali::Property::Map NewWindowController::CreateColorModifierer()
{
const char* fragmentShader ( DALI_COMPOSE_SHADER (
precision highp float;\n
uniform vec3 uRGBDelta;\n
uniform float uIgnoreAlpha;\n
\n
varying mediump vec2 vTexCoord;\n
uniform sampler2D sTexture;\n
\n
float rand(vec2 co) \n
{\n
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453); \n}
\n
void main() {\n
vec4 color = texture2D(sTexture, vTexCoord); \n
// modify the hsv Value
color.rgb += uRGBDelta * rand(vTexCoord); \n
// if the new vale exceeds one, then decrease it
color.rgb -= max(color.rgb*2.0 - vec3(2.0), 0.0);\n
// if the new vale drops below zero, then increase it
color.rgb -= min(color.rgb*2.0, 0.0);\n
gl_FragColor = color; \n
}\n
) );
Property::Map map;
Property::Map customShader;
customShader[ "fragmentShader" ] = fragmentShader;
map[ "shader" ] = customShader;
return map;
}
void NewWindowController::NewWindow(void)
{
PositionSize posSize(0, 0, 720, 1280);
gApplication.ReplaceWindow(posSize, "NewWindow"); // Generates a new window
}
bool NewWindowController::OnLoseContextButtonClicked( Toolkit::Button button )
{
// Add as an idle callback to avoid ProcessEvents being recursively called.
mApplication.AddIdle( MakeCallback( NewWindowController::NewWindow ) );
return true;
}
bool NewWindowController::OnTrackTimerTick()
{
static int time=0;
const float radius(250.0f);
time += EMIT_INTERVAL_IN_MS;
float modTime = time / TRACK_DURATION_IN_MS;
float angle = 2.0f*Math::PI*modTime;
Vector2 position(radius*cosf(angle), radius*-sinf(angle));
Vector2 aimPos(radius*2*sinf(angle), radius*2*-cosf(angle));
Vector2 direction = aimPos-position;
Vector2 stageSize = Stage::GetCurrent().GetSize();
SetUpBubbleEmission( stageSize*0.5f+position, direction );
SetUpBubbleEmission( stageSize*0.5f+position*0.75f, direction );
SetUpBubbleEmission( stageSize*0.5f+position*0.7f, direction );
return true;
}
void NewWindowController::OnKeyEvent(const KeyEvent& event)
{
if(event.state == KeyEvent::Down)
{
if( IsKey( event, Dali::DALI_KEY_ESCAPE) || IsKey( event, Dali::DALI_KEY_BACK) )
{
mApplication.Quit();
}
}
}
void NewWindowController::OnContextLost()
{
printf("Stage reporting context loss\n");
}
void NewWindowController::OnContextRegained()
{
printf("Stage reporting context regain\n");
}
void RunTest(Application& app)
{
gNewWindowController = new NewWindowController(app);
app.MainLoop(Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS);
}
// Entry point for Linux & Tizen applications
//
int DALI_EXPORT_API main(int argc, char **argv)
{
gApplication = Application::New(&argc, &argv, DEMO_THEME_PATH);
RunTest(gApplication);
return 0;
}
| 33.818021 | 179 | 0.725667 | tizenorg |
0db1fb3968b40f77ea6baae37e0e7695221d3e8b | 1,747 | cpp | C++ | CsUserInterface/Source/CsUIEditor/Public/GraphEditor/EnumStruct/UserWidget/SCsGraphPin_ECsUserWidgetPooled.cpp | closedsum/core | c3cae44a177b9684585043a275130f9c7b67fef0 | [
"Unlicense"
] | 2 | 2019-03-17T10:43:53.000Z | 2021-04-20T21:24:19.000Z | CsUserInterface/Source/CsUIEditor/Public/GraphEditor/EnumStruct/UserWidget/SCsGraphPin_ECsUserWidgetPooled.cpp | closedsum/core | c3cae44a177b9684585043a275130f9c7b67fef0 | [
"Unlicense"
] | null | null | null | CsUserInterface/Source/CsUIEditor/Public/GraphEditor/EnumStruct/UserWidget/SCsGraphPin_ECsUserWidgetPooled.cpp | closedsum/core | c3cae44a177b9684585043a275130f9c7b67fef0 | [
"Unlicense"
] | null | null | null | // Copyright 2017-2021 Closed Sum Games, LLC. All Rights Reserved.
#include "GraphEditor/EnumStruct/UserWidget/SCsGraphPin_ECsUserWidgetPooled.h"
#include "CsUIEditor.h"
#include "Managers/UserWidget/CsTypes_UserWidget.h"
// Cached
#pragma region
namespace NCsGraphPinUserWidgetPooledCached
{
namespace Str
{
const FString CustomPopulateEnumMap = TEXT("SCsGraphPin_ECsUserWidgetPooled::CustomPopulateEnumMap");
}
}
#pragma endregion Cached
void SCsGraphPin_ECsUserWidgetPooled::Construct(const FArguments& InArgs, UEdGraphPin* InGraphPinObj)
{
SGraphPin::Construct(SGraphPin::FArguments(), InGraphPinObj);
Construct_Internal<EMCsUserWidgetPooled, FECsUserWidgetPooled>();
}
void SCsGraphPin_ECsUserWidgetPooled::CustomPopulateEnumMap()
{
using namespace NCsGraphPinUserWidgetPooledCached;
NCsUserWidgetPooled::PopulateEnumMapFromSettings(Str::CustomPopulateEnumMap, nullptr);
}
void SCsGraphPin_ECsUserWidgetPooled::GenerateComboBoxIndexes(TArray<TSharedPtr<int32>>& OutComboBoxIndexes)
{
GenenerateComboBoxIndexes_Internal<EMCsUserWidgetPooled>(OutComboBoxIndexes);
}
FString SCsGraphPin_ECsUserWidgetPooled::OnGetText() const
{
return OnGetText_Internal<EMCsUserWidgetPooled, FECsUserWidgetPooled>();
}
void SCsGraphPin_ECsUserWidgetPooled::ComboBoxSelectionChanged(TSharedPtr<int32> NewSelection, ESelectInfo::Type SelectInfo)
{
ComboBoxSelectionChanged_Internal<EMCsUserWidgetPooled, FECsUserWidgetPooled>(NewSelection, SelectInfo);
}
FText SCsGraphPin_ECsUserWidgetPooled::OnGetFriendlyName(int32 EnumIndex)
{
return OnGetFriendlyName_Internal<EMCsUserWidgetPooled>(EnumIndex);
}
FText SCsGraphPin_ECsUserWidgetPooled::OnGetTooltip(int32 EnumIndex)
{
return OnGetTooltip_Internal<EMCsUserWidgetPooled>(EnumIndex);
} | 30.649123 | 124 | 0.846594 | closedsum |
0db2edf1d6ff302406ae69048ccd85208a5f1378 | 590 | hpp | C++ | include/dna_library.hpp | dyigitpolat/relaxase | bb183197b48ca448afe71cb801c9cdafb8d418a1 | [
"MIT"
] | 1 | 2020-10-22T11:27:51.000Z | 2020-10-22T11:27:51.000Z | include/dna_library.hpp | dyigitpolat/relaxase | bb183197b48ca448afe71cb801c9cdafb8d418a1 | [
"MIT"
] | null | null | null | include/dna_library.hpp | dyigitpolat/relaxase | bb183197b48ca448afe71cb801c9cdafb8d418a1 | [
"MIT"
] | null | null | null | #pragma once
#include <vector>
#include <string>
#include "dna_pool.hpp"
#include "dna_strand.hpp"
struct FileAttributes
{
int pool_id;
LogicalAttributes logical_attributes;
};
class DNALibrary
{
public:
DNALibrary(); // default constructor
FileAttributes add_file(const std::vector<DNAStrand> &strands);
std::vector<DNAStrand> retrieve_file(const FileAttributes &fa) const;
int add_patch(const FileAttributes &fa, const std::vector<DNAStrand> &strands, int num_attrib_strands);
std::vector<DNAPool> pools;
private:
int next_available_pool;
}; | 21.071429 | 107 | 0.730508 | dyigitpolat |
0db5c77ff02f34844ca8838241ee77099fc80d4c | 64,007 | cpp | C++ | trick_source/data_products/DPX/APPS/GXPLOT/gp_colors.cpp | gilbertguoze/trick | f0537efb0fa3cb5c0c84e36b60f055c1d1c60d21 | [
"NASA-1.3"
] | 647 | 2015-05-07T16:08:16.000Z | 2022-03-30T02:33:21.000Z | trick_source/data_products/DPX/APPS/GXPLOT/gp_colors.cpp | gilbertguoze/trick | f0537efb0fa3cb5c0c84e36b60f055c1d1c60d21 | [
"NASA-1.3"
] | 995 | 2015-04-30T19:44:31.000Z | 2022-03-31T20:14:44.000Z | trick_source/data_products/DPX/APPS/GXPLOT/gp_colors.cpp | gilbertguoze/trick | f0537efb0fa3cb5c0c84e36b60f055c1d1c60d21 | [
"NASA-1.3"
] | 251 | 2015-05-15T09:24:34.000Z | 2022-03-22T20:39:05.000Z |
#include <stdio.h>
#include <string>
#include <iostream>
#include <sstream>
#include <fstream>
#include <stdlib.h>
#include <string.h>
#include "gp_colors.hh"
#include "gp_version.hh"
using namespace std;
const COLOR_TRANS color_trans[] = {
{"AliceBlue" , "xf0f8ff" , 0.941176 , 0.972549 , 1.000000} ,
{"AntiqueWhite" , "xfaebd7" , 0.980392 , 0.921569 , 0.843137} ,
{"AntiqueWhite1" , "xffefdb" , 1.000000 , 0.937255 , 0.858824} ,
{"AntiqueWhite2" , "xeedfcc" , 0.933333 , 0.874510 , 0.800000} ,
{"AntiqueWhite3" , "xcdc0b0" , 0.803922 , 0.752941 , 0.690196} ,
{"AntiqueWhite4" , "x8b8378" , 0.545098 , 0.513725 , 0.470588} ,
{"BlanchedAlmond" , "xffebcd" , 1.000000 , 0.921569 , 0.803922} ,
{"BlueViolet" , "x8a2be2" , 0.541176 , 0.168627 , 0.886275} ,
{"CadetBlue" , "x5f9ea0" , 0.372549 , 0.619608 , 0.627451} ,
{"CadetBlue1" , "x98f5ff" , 0.596078 , 0.960784 , 1.000000} ,
{"CadetBlue2" , "x8ee5ee" , 0.556863 , 0.898039 , 0.933333} ,
{"CadetBlue3" , "x7ac5cd" , 0.478431 , 0.772549 , 0.803922} ,
{"CadetBlue4" , "x53868b" , 0.325490 , 0.525490 , 0.545098} ,
{"CornflowerBlue" , "x6495ed" , 0.392157 , 0.584314 , 0.929412} ,
{"DarkBlue" , "x00008b" , 0.000000 , 0.000000 , 0.545098} ,
{"DarkCyan" , "x008b8b" , 0.000000 , 0.545098 , 0.545098} ,
{"DarkGoldenrod" , "xb8860b" , 0.721569 , 0.525490 , 0.043137} ,
{"DarkGoldenrod1" , "xffb90f" , 1.000000 , 0.725490 , 0.058824} ,
{"DarkGoldenrod2" , "xeead0e" , 0.933333 , 0.678431 , 0.054902} ,
{"DarkGoldenrod3" , "xcd950c" , 0.803922 , 0.584314 , 0.047059} ,
{"DarkGoldenrod4" , "x8b6508" , 0.545098 , 0.396078 , 0.031373} ,
{"DarkGray" , "xa9a9a9" , 0.662745 , 0.662745 , 0.662745} ,
{"DarkGreen" , "x006400" , 0.000000 , 0.392157 , 0.000000} ,
{"DarkGrey" , "xa9a9a9" , 0.662745 , 0.662745 , 0.662745} ,
{"DarkKhaki" , "xbdb76b" , 0.741176 , 0.717647 , 0.419608} ,
{"DarkMagenta" , "x8b008b" , 0.545098 , 0.000000 , 0.545098} ,
{"DarkOliveGreen" , "x556b2f" , 0.333333 , 0.419608 , 0.184314} ,
{"DarkOliveGreen1" , "xcaff70" , 0.792157 , 1.000000 , 0.439216} ,
{"DarkOliveGreen2" , "xbcee68" , 0.737255 , 0.933333 , 0.407843} ,
{"DarkOliveGreen3" , "xa2cd5a" , 0.635294 , 0.803922 , 0.352941} ,
{"DarkOliveGreen4" , "x6e8b3d" , 0.431373 , 0.545098 , 0.239216} ,
{"DarkOrange" , "xff8c00" , 1.000000 , 0.549020 , 0.000000} ,
{"DarkOrange1" , "xff7f00" , 1.000000 , 0.498039 , 0.000000} ,
{"DarkOrange2" , "xee7600" , 0.933333 , 0.462745 , 0.000000} ,
{"DarkOrange3" , "xcd6600" , 0.803922 , 0.400000 , 0.000000} ,
{"DarkOrange4" , "x8b4500" , 0.545098 , 0.270588 , 0.000000} ,
{"DarkOrchid" , "x9932cc" , 0.600000 , 0.196078 , 0.800000} ,
{"DarkOrchid1" , "xbf3eff" , 0.749020 , 0.243137 , 1.000000} ,
{"DarkOrchid2" , "xb23aee" , 0.698039 , 0.227451 , 0.933333} ,
{"DarkOrchid3" , "x9a32cd" , 0.603922 , 0.196078 , 0.803922} ,
{"DarkOrchid4" , "x68228b" , 0.407843 , 0.133333 , 0.545098} ,
{"DarkRed" , "x8b0000" , 0.545098 , 0.000000 , 0.000000} ,
{"DarkSalmon" , "xe9967a" , 0.913725 , 0.588235 , 0.478431} ,
{"DarkSeaGreen" , "x8fbc8f" , 0.560784 , 0.737255 , 0.560784} ,
{"DarkSeaGreen1" , "xc1ffc1" , 0.756863 , 1.000000 , 0.756863} ,
{"DarkSeaGreen2" , "xb4eeb4" , 0.705882 , 0.933333 , 0.705882} ,
{"DarkSeaGreen3" , "x9bcd9b" , 0.607843 , 0.803922 , 0.607843} ,
{"DarkSeaGreen4" , "x698b69" , 0.411765 , 0.545098 , 0.411765} ,
{"DarkSlateBlue" , "x483d8b" , 0.282353 , 0.239216 , 0.545098} ,
{"DarkSlateGray" , "x2f4f4f" , 0.184314 , 0.309804 , 0.309804} ,
{"DarkSlateGray1" , "x97ffff" , 0.592157 , 1.000000 , 1.000000} ,
{"DarkSlateGray2" , "x8deeee" , 0.552941 , 0.933333 , 0.933333} ,
{"DarkSlateGray3" , "x79cdcd" , 0.474510 , 0.803922 , 0.803922} ,
{"DarkSlateGray4" , "x528b8b" , 0.321569 , 0.545098 , 0.545098} ,
{"DarkSlateGrey" , "x2f4f4f" , 0.184314 , 0.309804 , 0.309804} ,
{"DarkTurquoise" , "x00ced1" , 0.000000 , 0.807843 , 0.819608} ,
{"DarkViolet" , "x9400d3" , 0.580392 , 0.000000 , 0.827451} ,
{"DeepPink" , "xff1493" , 1.000000 , 0.078431 , 0.576471} ,
{"DeepPink1" , "xff1493" , 1.000000 , 0.078431 , 0.576471} ,
{"DeepPink2" , "xee1289" , 0.933333 , 0.070588 , 0.537255} ,
{"DeepPink3" , "xcd1076" , 0.803922 , 0.062745 , 0.462745} ,
{"DeepPink4" , "x8b0a50" , 0.545098 , 0.039216 , 0.313725} ,
{"DeepSkyBlue" , "x00bfff" , 0.000000 , 0.749020 , 1.000000} ,
{"DeepSkyBlue1" , "x00bfff" , 0.000000 , 0.749020 , 1.000000} ,
{"DeepSkyBlue2" , "x00b2ee" , 0.000000 , 0.698039 , 0.933333} ,
{"DeepSkyBlue3" , "x009acd" , 0.000000 , 0.603922 , 0.803922} ,
{"DeepSkyBlue4" , "x00688b" , 0.000000 , 0.407843 , 0.545098} ,
{"DimGray" , "x696969" , 0.411765 , 0.411765 , 0.411765} ,
{"DimGrey" , "x696969" , 0.411765 , 0.411765 , 0.411765} ,
{"DodgerBlue" , "x1e90ff" , 0.117647 , 0.564706 , 1.000000} ,
{"DodgerBlue1" , "x1e90ff" , 0.117647 , 0.564706 , 1.000000} ,
{"DodgerBlue2" , "x1c86ee" , 0.109804 , 0.525490 , 0.933333} ,
{"DodgerBlue3" , "x1874cd" , 0.094118 , 0.454902 , 0.803922} ,
{"DodgerBlue4" , "x104e8b" , 0.062745 , 0.305882 , 0.545098} ,
{"FloralWhite" , "xfffaf0" , 1.000000 , 0.980392 , 0.941176} ,
{"ForestGreen" , "x228b22" , 0.133333 , 0.545098 , 0.133333} ,
{"GhostWhite" , "xf8f8ff" , 0.972549 , 0.972549 , 1.000000} ,
{"GreenYellow" , "xadff2f" , 0.678431 , 1.000000 , 0.184314} ,
{"HotPink" , "xff69b4" , 1.000000 , 0.411765 , 0.705882} ,
{"HotPink1" , "xff6eb4" , 1.000000 , 0.431373 , 0.705882} ,
{"HotPink2" , "xee6aa7" , 0.933333 , 0.415686 , 0.654902} ,
{"HotPink3" , "xcd6090" , 0.803922 , 0.376471 , 0.564706} ,
{"HotPink4" , "x8b3a62" , 0.545098 , 0.227451 , 0.384314} ,
{"IndianRed" , "xcd5c5c" , 0.803922 , 0.360784 , 0.360784} ,
{"IndianRed1" , "xff6a6a" , 1.000000 , 0.415686 , 0.415686} ,
{"IndianRed2" , "xee6363" , 0.933333 , 0.388235 , 0.388235} ,
{"IndianRed3" , "xcd5555" , 0.803922 , 0.333333 , 0.333333} ,
{"IndianRed4" , "x8b3a3a" , 0.545098 , 0.227451 , 0.227451} ,
{"LavenderBlush" , "xfff0f5" , 1.000000 , 0.941176 , 0.960784} ,
{"LavenderBlush1" , "xfff0f5" , 1.000000 , 0.941176 , 0.960784} ,
{"LavenderBlush2" , "xeee0e5" , 0.933333 , 0.878431 , 0.898039} ,
{"LavenderBlush3" , "xcdc1c5" , 0.803922 , 0.756863 , 0.772549} ,
{"LavenderBlush4" , "x8b8386" , 0.545098 , 0.513725 , 0.525490} ,
{"LawnGreen" , "x7cfc00" , 0.486275 , 0.988235 , 0.000000} ,
{"LemonChiffon" , "xfffacd" , 1.000000 , 0.980392 , 0.803922} ,
{"LemonChiffon1" , "xfffacd" , 1.000000 , 0.980392 , 0.803922} ,
{"LemonChiffon2" , "xeee9bf" , 0.933333 , 0.913725 , 0.749020} ,
{"LemonChiffon3" , "xcdc9a5" , 0.803922 , 0.788235 , 0.647059} ,
{"LemonChiffon4" , "x8b8970" , 0.545098 , 0.537255 , 0.439216} ,
{"LightBlue" , "xadd8e6" , 0.678431 , 0.847059 , 0.901961} ,
{"LightBlue1" , "xbfefff" , 0.749020 , 0.937255 , 1.000000} ,
{"LightBlue2" , "xb2dfee" , 0.698039 , 0.874510 , 0.933333} ,
{"LightBlue3" , "x9ac0cd" , 0.603922 , 0.752941 , 0.803922} ,
{"LightBlue4" , "x68838b" , 0.407843 , 0.513725 , 0.545098} ,
{"LightCoral" , "xf08080" , 0.941176 , 0.501961 , 0.501961} ,
{"LightCyan" , "xe0ffff" , 0.878431 , 1.000000 , 1.000000} ,
{"LightCyan1" , "xe0ffff" , 0.878431 , 1.000000 , 1.000000} ,
{"LightCyan2" , "xd1eeee" , 0.819608 , 0.933333 , 0.933333} ,
{"LightCyan3" , "xb4cdcd" , 0.705882 , 0.803922 , 0.803922} ,
{"LightCyan4" , "x7a8b8b" , 0.478431 , 0.545098 , 0.545098} ,
{"LightGoldenrod" , "xeedd82" , 0.933333 , 0.866667 , 0.509804} ,
{"LightGoldenrod1" , "xffec8b" , 1.000000 , 0.925490 , 0.545098} ,
{"LightGoldenrod2" , "xeedc82" , 0.933333 , 0.862745 , 0.509804} ,
{"LightGoldenrod3" , "xcdbe70" , 0.803922 , 0.745098 , 0.439216} ,
{"LightGoldenrod4" , "x8b814c" , 0.545098 , 0.505882 , 0.298039} ,
{"LightGoldenrodYellow" , "xfafad2" , 0.980392 , 0.980392 , 0.823529} ,
{"LightGray" , "xd3d3d3" , 0.827451 , 0.827451 , 0.827451} ,
{"LightGreen" , "x90ee90" , 0.564706 , 0.933333 , 0.564706} ,
{"LightGrey" , "xd3d3d3" , 0.827451 , 0.827451 , 0.827451} ,
{"LightPink" , "xffb6c1" , 1.000000 , 0.713725 , 0.756863} ,
{"LightPink1" , "xffaeb9" , 1.000000 , 0.682353 , 0.725490} ,
{"LightPink2" , "xeea2ad" , 0.933333 , 0.635294 , 0.678431} ,
{"LightPink3" , "xcd8c95" , 0.803922 , 0.549020 , 0.584314} ,
{"LightPink4" , "x8b5f65" , 0.545098 , 0.372549 , 0.396078} ,
{"LightSalmon" , "xffa07a" , 1.000000 , 0.627451 , 0.478431} ,
{"LightSalmon1" , "xffa07a" , 1.000000 , 0.627451 , 0.478431} ,
{"LightSalmon2" , "xee9572" , 0.933333 , 0.584314 , 0.447059} ,
{"LightSalmon3" , "xcd8162" , 0.803922 , 0.505882 , 0.384314} ,
{"LightSalmon4" , "x8b5742" , 0.545098 , 0.341176 , 0.258824} ,
{"LightSeaGreen" , "x20b2aa" , 0.125490 , 0.698039 , 0.666667} ,
{"LightSkyBlue" , "x87cefa" , 0.529412 , 0.807843 , 0.980392} ,
{"LightSkyBlue1" , "xb0e2ff" , 0.690196 , 0.886275 , 1.000000} ,
{"LightSkyBlue2" , "xa4d3ee" , 0.643137 , 0.827451 , 0.933333} ,
{"LightSkyBlue3" , "x8db6cd" , 0.552941 , 0.713725 , 0.803922} ,
{"LightSkyBlue4" , "x607b8b" , 0.376471 , 0.482353 , 0.545098} ,
{"LightSlateBlue" , "x8470ff" , 0.517647 , 0.439216 , 1.000000} ,
{"LightSlateGray" , "x778899" , 0.466667 , 0.533333 , 0.600000} ,
{"LightSlateGrey" , "x778899" , 0.466667 , 0.533333 , 0.600000} ,
{"LightSteelBlue" , "xb0c4de" , 0.690196 , 0.768627 , 0.870588} ,
{"LightSteelBlue1" , "xcae1ff" , 0.792157 , 0.882353 , 1.000000} ,
{"LightSteelBlue2" , "xbcd2ee" , 0.737255 , 0.823529 , 0.933333} ,
{"LightSteelBlue3" , "xa2b5cd" , 0.635294 , 0.709804 , 0.803922} ,
{"LightSteelBlue4" , "x6e7b8b" , 0.431373 , 0.482353 , 0.545098} ,
{"LightYellow" , "xffffe0" , 1.000000 , 1.000000 , 0.878431} ,
{"LightYellow1" , "xffffe0" , 1.000000 , 1.000000 , 0.878431} ,
{"LightYellow2" , "xeeeed1" , 0.933333 , 0.933333 , 0.819608} ,
{"LightYellow3" , "xcdcdb4" , 0.803922 , 0.803922 , 0.705882} ,
{"LightYellow4" , "x8b8b7a" , 0.545098 , 0.545098 , 0.478431} ,
{"LimeGreen" , "x32cd32" , 0.196078 , 0.803922 , 0.196078} ,
{"MediumAquamarine" , "x66cdaa" , 0.400000 , 0.803922 , 0.666667} ,
{"MediumBlue" , "x0000cd" , 0.000000 , 0.000000 , 0.803922} ,
{"MediumOrchid" , "xba55d3" , 0.729412 , 0.333333 , 0.827451} ,
{"MediumOrchid1" , "xe066ff" , 0.878431 , 0.400000 , 1.000000} ,
{"MediumOrchid2" , "xd15fee" , 0.819608 , 0.372549 , 0.933333} ,
{"MediumOrchid3" , "xb452cd" , 0.705882 , 0.321569 , 0.803922} ,
{"MediumOrchid4" , "x7a378b" , 0.478431 , 0.215686 , 0.545098} ,
{"MediumPurple" , "x9370db" , 0.576471 , 0.439216 , 0.858824} ,
{"MediumPurple1" , "xab82ff" , 0.670588 , 0.509804 , 1.000000} ,
{"MediumPurple2" , "x9f79ee" , 0.623529 , 0.474510 , 0.933333} ,
{"MediumPurple3" , "x8968cd" , 0.537255 , 0.407843 , 0.803922} ,
{"MediumPurple4" , "x5d478b" , 0.364706 , 0.278431 , 0.545098} ,
{"MediumSeaGreen" , "x3cb371" , 0.235294 , 0.701961 , 0.443137} ,
{"MediumSlateBlue" , "x7b68ee" , 0.482353 , 0.407843 , 0.933333} ,
{"MediumSpringGreen" , "x00fa9a" , 0.000000 , 0.980392 , 0.603922} ,
{"MediumTurquoise" , "x48d1cc" , 0.282353 , 0.819608 , 0.800000} ,
{"MediumVioletRed" , "xc71585" , 0.780392 , 0.082353 , 0.521569} ,
{"MidnightBlue" , "x191970" , 0.098039 , 0.098039 , 0.439216} ,
{"MintCream" , "xf5fffa" , 0.960784 , 1.000000 , 0.980392} ,
{"MistyRose" , "xffe4e1" , 1.000000 , 0.894118 , 0.882353} ,
{"MistyRose1" , "xffe4e1" , 1.000000 , 0.894118 , 0.882353} ,
{"MistyRose2" , "xeed5d2" , 0.933333 , 0.835294 , 0.823529} ,
{"MistyRose3" , "xcdb7b5" , 0.803922 , 0.717647 , 0.709804} ,
{"MistyRose4" , "x8b7d7b" , 0.545098 , 0.490196 , 0.482353} ,
{"NavajoWhite" , "xffdead" , 1.000000 , 0.870588 , 0.678431} ,
{"NavajoWhite1" , "xffdead" , 1.000000 , 0.870588 , 0.678431} ,
{"NavajoWhite2" , "xeecfa1" , 0.933333 , 0.811765 , 0.631373} ,
{"NavajoWhite3" , "xcdb38b" , 0.803922 , 0.701961 , 0.545098} ,
{"NavajoWhite4" , "x8b795e" , 0.545098 , 0.474510 , 0.368627} ,
{"NavyBlue" , "x000080" , 0.000000 , 0.000000 , 0.501961} ,
{"OldLace" , "xfdf5e6" , 0.992157 , 0.960784 , 0.901961} ,
{"OliveDrab" , "x6b8e23" , 0.419608 , 0.556863 , 0.137255} ,
{"OliveDrab1" , "xc0ff3e" , 0.752941 , 1.000000 , 0.243137} ,
{"OliveDrab2" , "xb3ee3a" , 0.701961 , 0.933333 , 0.227451} ,
{"OliveDrab3" , "x9acd32" , 0.603922 , 0.803922 , 0.196078} ,
{"OliveDrab4" , "x698b22" , 0.411765 , 0.545098 , 0.133333} ,
{"OrangeRed" , "xff4500" , 1.000000 , 0.270588 , 0.000000} ,
{"OrangeRed1" , "xff4500" , 1.000000 , 0.270588 , 0.000000} ,
{"OrangeRed2" , "xee4000" , 0.933333 , 0.250980 , 0.000000} ,
{"OrangeRed3" , "xcd3700" , 0.803922 , 0.215686 , 0.000000} ,
{"OrangeRed4" , "x8b2500" , 0.545098 , 0.145098 , 0.000000} ,
{"PaleGoldenrod" , "xeee8aa" , 0.933333 , 0.909804 , 0.666667} ,
{"PaleGreen" , "x98fb98" , 0.596078 , 0.984314 , 0.596078} ,
{"PaleGreen1" , "x9aff9a" , 0.603922 , 1.000000 , 0.603922} ,
{"PaleGreen2" , "x90ee90" , 0.564706 , 0.933333 , 0.564706} ,
{"PaleGreen3" , "x7ccd7c" , 0.486275 , 0.803922 , 0.486275} ,
{"PaleGreen4" , "x548b54" , 0.329412 , 0.545098 , 0.329412} ,
{"PaleTurquoise" , "xafeeee" , 0.686275 , 0.933333 , 0.933333} ,
{"PaleTurquoise1" , "xbbffff" , 0.733333 , 1.000000 , 1.000000} ,
{"PaleTurquoise2" , "xaeeeee" , 0.682353 , 0.933333 , 0.933333} ,
{"PaleTurquoise3" , "x96cdcd" , 0.588235 , 0.803922 , 0.803922} ,
{"PaleTurquoise4" , "x668b8b" , 0.400000 , 0.545098 , 0.545098} ,
{"PaleVioletRed" , "xdb7093" , 0.858824 , 0.439216 , 0.576471} ,
{"PaleVioletRed1" , "xff82ab" , 1.000000 , 0.509804 , 0.670588} ,
{"PaleVioletRed2" , "xee799f" , 0.933333 , 0.474510 , 0.623529} ,
{"PaleVioletRed3" , "xcd6889" , 0.803922 , 0.407843 , 0.537255} ,
{"PaleVioletRed4" , "x8b475d" , 0.545098 , 0.278431 , 0.364706} ,
{"PapayaWhip" , "xffefd5" , 1.000000 , 0.937255 , 0.835294} ,
{"PeachPuff" , "xffdab9" , 1.000000 , 0.854902 , 0.725490} ,
{"PeachPuff1" , "xffdab9" , 1.000000 , 0.854902 , 0.725490} ,
{"PeachPuff2" , "xeecbad" , 0.933333 , 0.796078 , 0.678431} ,
{"PeachPuff3" , "xcdaf95" , 0.803922 , 0.686275 , 0.584314} ,
{"PeachPuff4" , "x8b7765" , 0.545098 , 0.466667 , 0.396078} ,
{"PowderBlue" , "xb0e0e6" , 0.690196 , 0.878431 , 0.901961} ,
{"RosyBrown" , "xbc8f8f" , 0.737255 , 0.560784 , 0.560784} ,
{"RosyBrown1" , "xffc1c1" , 1.000000 , 0.756863 , 0.756863} ,
{"RosyBrown2" , "xeeb4b4" , 0.933333 , 0.705882 , 0.705882} ,
{"RosyBrown3" , "xcd9b9b" , 0.803922 , 0.607843 , 0.607843} ,
{"RosyBrown4" , "x8b6969" , 0.545098 , 0.411765 , 0.411765} ,
{"RoyalBlue" , "x4169e1" , 0.254902 , 0.411765 , 0.882353} ,
{"RoyalBlue1" , "x4876ff" , 0.282353 , 0.462745 , 1.000000} ,
{"RoyalBlue2" , "x436eee" , 0.262745 , 0.431373 , 0.933333} ,
{"RoyalBlue3" , "x3a5fcd" , 0.227451 , 0.372549 , 0.803922} ,
{"RoyalBlue4" , "x27408b" , 0.152941 , 0.250980 , 0.545098} ,
{"SaddleBrown" , "x8b4513" , 0.545098 , 0.270588 , 0.074510} ,
{"SandyBrown" , "xf4a460" , 0.956863 , 0.643137 , 0.376471} ,
{"SeaGreen" , "x2e8b57" , 0.180392 , 0.545098 , 0.341176} ,
{"SeaGreen1" , "x54ff9f" , 0.329412 , 1.000000 , 0.623529} ,
{"SeaGreen2" , "x4eee94" , 0.305882 , 0.933333 , 0.580392} ,
{"SeaGreen3" , "x43cd80" , 0.262745 , 0.803922 , 0.501961} ,
{"SeaGreen4" , "x2e8b57" , 0.180392 , 0.545098 , 0.341176} ,
{"SkyBlue" , "x87ceeb" , 0.529412 , 0.807843 , 0.921569} ,
{"SkyBlue1" , "x87ceff" , 0.529412 , 0.807843 , 1.000000} ,
{"SkyBlue2" , "x7ec0ee" , 0.494118 , 0.752941 , 0.933333} ,
{"SkyBlue3" , "x6ca6cd" , 0.423529 , 0.650980 , 0.803922} ,
{"SkyBlue4" , "x4a708b" , 0.290196 , 0.439216 , 0.545098} ,
{"SlateBlue" , "x6a5acd" , 0.415686 , 0.352941 , 0.803922} ,
{"SlateBlue1" , "x836fff" , 0.513725 , 0.435294 , 1.000000} ,
{"SlateBlue2" , "x7a67ee" , 0.478431 , 0.403922 , 0.933333} ,
{"SlateBlue3" , "x6959cd" , 0.411765 , 0.349020 , 0.803922} ,
{"SlateBlue4" , "x473c8b" , 0.278431 , 0.235294 , 0.545098} ,
{"SlateGray" , "x708090" , 0.439216 , 0.501961 , 0.564706} ,
{"SlateGray1" , "xc6e2ff" , 0.776471 , 0.886275 , 1.000000} ,
{"SlateGray2" , "xb9d3ee" , 0.725490 , 0.827451 , 0.933333} ,
{"SlateGray3" , "x9fb6cd" , 0.623529 , 0.713725 , 0.803922} ,
{"SlateGray4" , "x6c7b8b" , 0.423529 , 0.482353 , 0.545098} ,
{"SlateGrey" , "x708090" , 0.439216 , 0.501961 , 0.564706} ,
{"SpringGreen" , "x00ff7f" , 0.000000 , 1.000000 , 0.498039} ,
{"SpringGreen1" , "x00ff7f" , 0.000000 , 1.000000 , 0.498039} ,
{"SpringGreen2" , "x00ee76" , 0.000000 , 0.933333 , 0.462745} ,
{"SpringGreen3" , "x00cd66" , 0.000000 , 0.803922 , 0.400000} ,
{"SpringGreen4" , "x008b45" , 0.000000 , 0.545098 , 0.270588} ,
{"SteelBlue" , "x4682b4" , 0.274510 , 0.509804 , 0.705882} ,
{"SteelBlue1" , "x63b8ff" , 0.388235 , 0.721569 , 1.000000} ,
{"SteelBlue2" , "x5cacee" , 0.360784 , 0.674510 , 0.933333} ,
{"SteelBlue3" , "x4f94cd" , 0.309804 , 0.580392 , 0.803922} ,
{"SteelBlue4" , "x36648b" , 0.211765 , 0.392157 , 0.545098} ,
{"VioletRed" , "xd02090" , 0.815686 , 0.125490 , 0.564706} ,
{"VioletRed1" , "xff3e96" , 1.000000 , 0.243137 , 0.588235} ,
{"VioletRed2" , "xee3a8c" , 0.933333 , 0.227451 , 0.549020} ,
{"VioletRed3" , "xcd3278" , 0.803922 , 0.196078 , 0.470588} ,
{"VioletRed4" , "x8b2252" , 0.545098 , 0.133333 , 0.321569} ,
{"WhiteSmoke" , "xf5f5f5" , 0.960784 , 0.960784 , 0.960784} ,
{"YellowGreen" , "x9acd32" , 0.603922 , 0.803922 , 0.196078} ,
{"alice blue" , "xf0f8ff" , 0.941176 , 0.972549 , 1.000000} ,
{"antique white" , "xfaebd7" , 0.980392 , 0.921569 , 0.843137} ,
{"aquamarine" , "x7fffd4" , 0.498039 , 1.000000 , 0.831373} ,
{"aquamarine1" , "x7fffd4" , 0.498039 , 1.000000 , 0.831373} ,
{"aquamarine2" , "x76eec6" , 0.462745 , 0.933333 , 0.776471} ,
{"aquamarine3" , "x66cdaa" , 0.400000 , 0.803922 , 0.666667} ,
{"aquamarine4" , "x458b74" , 0.270588 , 0.545098 , 0.454902} ,
{"azure" , "xf0ffff" , 0.941176 , 1.000000 , 1.000000} ,
{"azure1" , "xf0ffff" , 0.941176 , 1.000000 , 1.000000} ,
{"azure2" , "xe0eeee" , 0.878431 , 0.933333 , 0.933333} ,
{"azure3" , "xc1cdcd" , 0.756863 , 0.803922 , 0.803922} ,
{"azure4" , "x838b8b" , 0.513725 , 0.545098 , 0.545098} ,
{"beige" , "xf5f5dc" , 0.960784 , 0.960784 , 0.862745} ,
{"bisque" , "xffe4c4" , 1.000000 , 0.894118 , 0.768627} ,
{"bisque1" , "xffe4c4" , 1.000000 , 0.894118 , 0.768627} ,
{"bisque2" , "xeed5b7" , 0.933333 , 0.835294 , 0.717647} ,
{"bisque3" , "xcdb79e" , 0.803922 , 0.717647 , 0.619608} ,
{"bisque4" , "x8b7d6b" , 0.545098 , 0.490196 , 0.419608} ,
{"black" , "x000000" , 0.000000 , 0.000000 , 0.000000} ,
{"blanched almond" , "xffebcd" , 1.000000 , 0.921569 , 0.803922} ,
{"blue violet" , "x8a2be2" , 0.541176 , 0.168627 , 0.886275} ,
{"blue" , "x0000ff" , 0.000000 , 0.000000 , 1.000000} ,
{"blue1" , "x0000ff" , 0.000000 , 0.000000 , 1.000000} ,
{"blue2" , "x0000ee" , 0.000000 , 0.000000 , 0.933333} ,
{"blue3" , "x0000cd" , 0.000000 , 0.000000 , 0.803922} ,
{"blue4" , "x00008b" , 0.000000 , 0.000000 , 0.545098} ,
{"brown" , "xa52a2a" , 0.647059 , 0.164706 , 0.164706} ,
{"brown1" , "xff4040" , 1.000000 , 0.250980 , 0.250980} ,
{"brown2" , "xee3b3b" , 0.933333 , 0.231373 , 0.231373} ,
{"brown3" , "xcd3333" , 0.803922 , 0.200000 , 0.200000} ,
{"brown4" , "x8b2323" , 0.545098 , 0.137255 , 0.137255} ,
{"burlywood" , "xdeb887" , 0.870588 , 0.721569 , 0.529412} ,
{"burlywood1" , "xffd39b" , 1.000000 , 0.827451 , 0.607843} ,
{"burlywood2" , "xeec591" , 0.933333 , 0.772549 , 0.568627} ,
{"burlywood3" , "xcdaa7d" , 0.803922 , 0.666667 , 0.490196} ,
{"burlywood4" , "x8b7355" , 0.545098 , 0.450980 , 0.333333} ,
{"cadet blue" , "x5f9ea0" , 0.372549 , 0.619608 , 0.627451} ,
{"chartreuse" , "x7fff00" , 0.498039 , 1.000000 , 0.000000} ,
{"chartreuse1" , "x7fff00" , 0.498039 , 1.000000 , 0.000000} ,
{"chartreuse2" , "x76ee00" , 0.462745 , 0.933333 , 0.000000} ,
{"chartreuse3" , "x66cd00" , 0.400000 , 0.803922 , 0.000000} ,
{"chartreuse4" , "x458b00" , 0.270588 , 0.545098 , 0.000000} ,
{"chocolate" , "xd2691e" , 0.823529 , 0.411765 , 0.117647} ,
{"chocolate1" , "xff7f24" , 1.000000 , 0.498039 , 0.141176} ,
{"chocolate2" , "xee7621" , 0.933333 , 0.462745 , 0.129412} ,
{"chocolate3" , "xcd661d" , 0.803922 , 0.400000 , 0.113725} ,
{"chocolate4" , "x8b4513" , 0.545098 , 0.270588 , 0.074510} ,
{"coral" , "xff7f50" , 1.000000 , 0.498039 , 0.313725} ,
{"coral1" , "xff7256" , 1.000000 , 0.447059 , 0.337255} ,
{"coral2" , "xee6a50" , 0.933333 , 0.415686 , 0.313725} ,
{"coral3" , "xcd5b45" , 0.803922 , 0.356863 , 0.270588} ,
{"coral4" , "x8b3e2f" , 0.545098 , 0.243137 , 0.184314} ,
{"cornflower blue" , "x6495ed" , 0.392157 , 0.584314 , 0.929412} ,
{"cornsilk" , "xfff8dc" , 1.000000 , 0.972549 , 0.862745} ,
{"cornsilk1" , "xfff8dc" , 1.000000 , 0.972549 , 0.862745} ,
{"cornsilk2" , "xeee8cd" , 0.933333 , 0.909804 , 0.803922} ,
{"cornsilk3" , "xcdc8b1" , 0.803922 , 0.784314 , 0.694118} ,
{"cornsilk4" , "x8b8878" , 0.545098 , 0.533333 , 0.470588} ,
{"cyan" , "x00ffff" , 0.000000 , 1.000000 , 1.000000} ,
{"cyan1" , "x00ffff" , 0.000000 , 1.000000 , 1.000000} ,
{"cyan2" , "x00eeee" , 0.000000 , 0.933333 , 0.933333} ,
{"cyan3" , "x00cdcd" , 0.000000 , 0.803922 , 0.803922} ,
{"cyan4" , "x008b8b" , 0.000000 , 0.545098 , 0.545098} ,
{"dark blue" , "x00008b" , 0.000000 , 0.000000 , 0.545098} ,
{"dark cyan" , "x008b8b" , 0.000000 , 0.545098 , 0.545098} ,
{"dark goldenrod" , "xb8860b" , 0.721569 , 0.525490 , 0.043137} ,
{"dark gray" , "xa9a9a9" , 0.662745 , 0.662745 , 0.662745} ,
{"dark green" , "x006400" , 0.000000 , 0.392157 , 0.000000} ,
{"dark grey" , "xa9a9a9" , 0.662745 , 0.662745 , 0.662745} ,
{"dark khaki" , "xbdb76b" , 0.741176 , 0.717647 , 0.419608} ,
{"dark magenta" , "x8b008b" , 0.545098 , 0.000000 , 0.545098} ,
{"dark olive green" , "x556b2f" , 0.333333 , 0.419608 , 0.184314} ,
{"dark orange" , "xff8c00" , 1.000000 , 0.549020 , 0.000000} ,
{"dark orchid" , "x9932cc" , 0.600000 , 0.196078 , 0.800000} ,
{"dark red" , "x8b0000" , 0.545098 , 0.000000 , 0.000000} ,
{"dark salmon" , "xe9967a" , 0.913725 , 0.588235 , 0.478431} ,
{"dark sea green" , "x8fbc8f" , 0.560784 , 0.737255 , 0.560784} ,
{"dark slate blue" , "x483d8b" , 0.282353 , 0.239216 , 0.545098} ,
{"dark slate gray" , "x2f4f4f" , 0.184314 , 0.309804 , 0.309804} ,
{"dark slate grey" , "x2f4f4f" , 0.184314 , 0.309804 , 0.309804} ,
{"dark turquoise" , "x00ced1" , 0.000000 , 0.807843 , 0.819608} ,
{"dark violet" , "x9400d3" , 0.580392 , 0.000000 , 0.827451} ,
{"deep pink" , "xff1493" , 1.000000 , 0.078431 , 0.576471} ,
{"deep sky blue" , "x00bfff" , 0.000000 , 0.749020 , 1.000000} ,
{"dim gray" , "x696969" , 0.411765 , 0.411765 , 0.411765} ,
{"dim grey" , "x696969" , 0.411765 , 0.411765 , 0.411765} ,
{"dodger blue" , "x1e90ff" , 0.117647 , 0.564706 , 1.000000} ,
{"firebrick" , "xb22222" , 0.698039 , 0.133333 , 0.133333} ,
{"firebrick1" , "xff3030" , 1.000000 , 0.188235 , 0.188235} ,
{"firebrick2" , "xee2c2c" , 0.933333 , 0.172549 , 0.172549} ,
{"firebrick3" , "xcd2626" , 0.803922 , 0.149020 , 0.149020} ,
{"firebrick4" , "x8b1a1a" , 0.545098 , 0.101961 , 0.101961} ,
{"floral white" , "xfffaf0" , 1.000000 , 0.980392 , 0.941176} ,
{"forest green" , "x228b22" , 0.133333 , 0.545098 , 0.133333} ,
{"gainsboro" , "xdcdcdc" , 0.862745 , 0.862745 , 0.862745} ,
{"ghost white" , "xf8f8ff" , 0.972549 , 0.972549 , 1.000000} ,
{"gold" , "xffd700" , 1.000000 , 0.843137 , 0.000000} ,
{"gold1" , "xffd700" , 1.000000 , 0.843137 , 0.000000} ,
{"gold2" , "xeec900" , 0.933333 , 0.788235 , 0.000000} ,
{"gold3" , "xcdad00" , 0.803922 , 0.678431 , 0.000000} ,
{"gold4" , "x8b7500" , 0.545098 , 0.458824 , 0.000000} ,
{"goldenrod" , "xdaa520" , 0.854902 , 0.647059 , 0.125490} ,
{"goldenrod1" , "xffc125" , 1.000000 , 0.756863 , 0.145098} ,
{"goldenrod2" , "xeeb422" , 0.933333 , 0.705882 , 0.133333} ,
{"goldenrod3" , "xcd9b1d" , 0.803922 , 0.607843 , 0.113725} ,
{"goldenrod4" , "x8b6914" , 0.545098 , 0.411765 , 0.078431} ,
{"gray" , "xbebebe" , 0.745098 , 0.745098 , 0.745098} ,
{"gray0" , "x000000" , 0.000000 , 0.000000 , 0.000000} ,
{"gray1" , "x030303" , 0.011765 , 0.011765 , 0.011765} ,
{"gray10" , "x1a1a1a" , 0.101961 , 0.101961 , 0.101961} ,
{"gray100" , "xffffff" , 1.000000 , 1.000000 , 1.000000} ,
{"gray11" , "x1c1c1c" , 0.109804 , 0.109804 , 0.109804} ,
{"gray12" , "x1f1f1f" , 0.121569 , 0.121569 , 0.121569} ,
{"gray13" , "x212121" , 0.129412 , 0.129412 , 0.129412} ,
{"gray14" , "x242424" , 0.141176 , 0.141176 , 0.141176} ,
{"gray15" , "x262626" , 0.149020 , 0.149020 , 0.149020} ,
{"gray16" , "x292929" , 0.160784 , 0.160784 , 0.160784} ,
{"gray17" , "x2b2b2b" , 0.168627 , 0.168627 , 0.168627} ,
{"gray18" , "x2e2e2e" , 0.180392 , 0.180392 , 0.180392} ,
{"gray19" , "x303030" , 0.188235 , 0.188235 , 0.188235} ,
{"gray2" , "x050505" , 0.019608 , 0.019608 , 0.019608} ,
{"gray20" , "x333333" , 0.200000 , 0.200000 , 0.200000} ,
{"gray21" , "x363636" , 0.211765 , 0.211765 , 0.211765} ,
{"gray22" , "x383838" , 0.219608 , 0.219608 , 0.219608} ,
{"gray23" , "x3b3b3b" , 0.231373 , 0.231373 , 0.231373} ,
{"gray24" , "x3d3d3d" , 0.239216 , 0.239216 , 0.239216} ,
{"gray25" , "x404040" , 0.250980 , 0.250980 , 0.250980} ,
{"gray26" , "x424242" , 0.258824 , 0.258824 , 0.258824} ,
{"gray27" , "x454545" , 0.270588 , 0.270588 , 0.270588} ,
{"gray28" , "x474747" , 0.278431 , 0.278431 , 0.278431} ,
{"gray29" , "x4a4a4a" , 0.290196 , 0.290196 , 0.290196} ,
{"gray3" , "x080808" , 0.031373 , 0.031373 , 0.031373} ,
{"gray30" , "x4d4d4d" , 0.301961 , 0.301961 , 0.301961} ,
{"gray31" , "x4f4f4f" , 0.309804 , 0.309804 , 0.309804} ,
{"gray32" , "x525252" , 0.321569 , 0.321569 , 0.321569} ,
{"gray33" , "x545454" , 0.329412 , 0.329412 , 0.329412} ,
{"gray34" , "x575757" , 0.341176 , 0.341176 , 0.341176} ,
{"gray35" , "x595959" , 0.349020 , 0.349020 , 0.349020} ,
{"gray36" , "x5c5c5c" , 0.360784 , 0.360784 , 0.360784} ,
{"gray37" , "x5e5e5e" , 0.368627 , 0.368627 , 0.368627} ,
{"gray38" , "x616161" , 0.380392 , 0.380392 , 0.380392} ,
{"gray39" , "x636363" , 0.388235 , 0.388235 , 0.388235} ,
{"gray4" , "x0a0a0a" , 0.039216 , 0.039216 , 0.039216} ,
{"gray40" , "x666666" , 0.400000 , 0.400000 , 0.400000} ,
{"gray41" , "x696969" , 0.411765 , 0.411765 , 0.411765} ,
{"gray42" , "x6b6b6b" , 0.419608 , 0.419608 , 0.419608} ,
{"gray43" , "x6e6e6e" , 0.431373 , 0.431373 , 0.431373} ,
{"gray44" , "x707070" , 0.439216 , 0.439216 , 0.439216} ,
{"gray45" , "x737373" , 0.450980 , 0.450980 , 0.450980} ,
{"gray46" , "x757575" , 0.458824 , 0.458824 , 0.458824} ,
{"gray47" , "x787878" , 0.470588 , 0.470588 , 0.470588} ,
{"gray48" , "x7a7a7a" , 0.478431 , 0.478431 , 0.478431} ,
{"gray49" , "x7d7d7d" , 0.490196 , 0.490196 , 0.490196} ,
{"gray5" , "x0d0d0d" , 0.050980 , 0.050980 , 0.050980} ,
{"gray50" , "x7f7f7f" , 0.498039 , 0.498039 , 0.498039} ,
{"gray51" , "x828282" , 0.509804 , 0.509804 , 0.509804} ,
{"gray52" , "x858585" , 0.521569 , 0.521569 , 0.521569} ,
{"gray53" , "x878787" , 0.529412 , 0.529412 , 0.529412} ,
{"gray54" , "x8a8a8a" , 0.541176 , 0.541176 , 0.541176} ,
{"gray55" , "x8c8c8c" , 0.549020 , 0.549020 , 0.549020} ,
{"gray56" , "x8f8f8f" , 0.560784 , 0.560784 , 0.560784} ,
{"gray57" , "x919191" , 0.568627 , 0.568627 , 0.568627} ,
{"gray58" , "x949494" , 0.580392 , 0.580392 , 0.580392} ,
{"gray59" , "x969696" , 0.588235 , 0.588235 , 0.588235} ,
{"gray6" , "x0f0f0f" , 0.058824 , 0.058824 , 0.058824} ,
{"gray60" , "x999999" , 0.600000 , 0.600000 , 0.600000} ,
{"gray61" , "x9c9c9c" , 0.611765 , 0.611765 , 0.611765} ,
{"gray62" , "x9e9e9e" , 0.619608 , 0.619608 , 0.619608} ,
{"gray63" , "xa1a1a1" , 0.631373 , 0.631373 , 0.631373} ,
{"gray64" , "xa3a3a3" , 0.639216 , 0.639216 , 0.639216} ,
{"gray65" , "xa6a6a6" , 0.650980 , 0.650980 , 0.650980} ,
{"gray66" , "xa8a8a8" , 0.658824 , 0.658824 , 0.658824} ,
{"gray67" , "xababab" , 0.670588 , 0.670588 , 0.670588} ,
{"gray68" , "xadadad" , 0.678431 , 0.678431 , 0.678431} ,
{"gray69" , "xb0b0b0" , 0.690196 , 0.690196 , 0.690196} ,
{"gray7" , "x121212" , 0.070588 , 0.070588 , 0.070588} ,
{"gray70" , "xb3b3b3" , 0.701961 , 0.701961 , 0.701961} ,
{"gray71" , "xb5b5b5" , 0.709804 , 0.709804 , 0.709804} ,
{"gray72" , "xb8b8b8" , 0.721569 , 0.721569 , 0.721569} ,
{"gray73" , "xbababa" , 0.729412 , 0.729412 , 0.729412} ,
{"gray74" , "xbdbdbd" , 0.741176 , 0.741176 , 0.741176} ,
{"gray75" , "xbfbfbf" , 0.749020 , 0.749020 , 0.749020} ,
{"gray76" , "xc2c2c2" , 0.760784 , 0.760784 , 0.760784} ,
{"gray77" , "xc4c4c4" , 0.768627 , 0.768627 , 0.768627} ,
{"gray78" , "xc7c7c7" , 0.780392 , 0.780392 , 0.780392} ,
{"gray79" , "xc9c9c9" , 0.788235 , 0.788235 , 0.788235} ,
{"gray8" , "x141414" , 0.078431 , 0.078431 , 0.078431} ,
{"gray80" , "xcccccc" , 0.800000 , 0.800000 , 0.800000} ,
{"gray81" , "xcfcfcf" , 0.811765 , 0.811765 , 0.811765} ,
{"gray82" , "xd1d1d1" , 0.819608 , 0.819608 , 0.819608} ,
{"gray83" , "xd4d4d4" , 0.831373 , 0.831373 , 0.831373} ,
{"gray84" , "xd6d6d6" , 0.839216 , 0.839216 , 0.839216} ,
{"gray85" , "xd9d9d9" , 0.850980 , 0.850980 , 0.850980} ,
{"gray86" , "xdbdbdb" , 0.858824 , 0.858824 , 0.858824} ,
{"gray87" , "xdedede" , 0.870588 , 0.870588 , 0.870588} ,
{"gray88" , "xe0e0e0" , 0.878431 , 0.878431 , 0.878431} ,
{"gray89" , "xe3e3e3" , 0.890196 , 0.890196 , 0.890196} ,
{"gray9" , "x171717" , 0.090196 , 0.090196 , 0.090196} ,
{"gray90" , "xe5e5e5" , 0.898039 , 0.898039 , 0.898039} ,
{"gray91" , "xe8e8e8" , 0.909804 , 0.909804 , 0.909804} ,
{"gray92" , "xebebeb" , 0.921569 , 0.921569 , 0.921569} ,
{"gray93" , "xededed" , 0.929412 , 0.929412 , 0.929412} ,
{"gray94" , "xf0f0f0" , 0.941176 , 0.941176 , 0.941176} ,
{"gray95" , "xf2f2f2" , 0.949020 , 0.949020 , 0.949020} ,
{"gray96" , "xf5f5f5" , 0.960784 , 0.960784 , 0.960784} ,
{"gray97" , "xf7f7f7" , 0.968627 , 0.968627 , 0.968627} ,
{"gray98" , "xfafafa" , 0.980392 , 0.980392 , 0.980392} ,
{"gray99" , "xfcfcfc" , 0.988235 , 0.988235 , 0.988235} ,
{"green yellow" , "xadff2f" , 0.678431 , 1.000000 , 0.184314} ,
{"green" , "x00ff00" , 0.000000 , 1.000000 , 0.000000} ,
{"green1" , "x00ff00" , 0.000000 , 1.000000 , 0.000000} ,
{"green2" , "x00ee00" , 0.000000 , 0.933333 , 0.000000} ,
{"green3" , "x00cd00" , 0.000000 , 0.803922 , 0.000000} ,
{"green4" , "x008b00" , 0.000000 , 0.545098 , 0.000000} ,
{"grey" , "xbebebe" , 0.745098 , 0.745098 , 0.745098} ,
{"grey0" , "x000000" , 0.000000 , 0.000000 , 0.000000} ,
{"grey1" , "x030303" , 0.011765 , 0.011765 , 0.011765} ,
{"grey10" , "x1a1a1a" , 0.101961 , 0.101961 , 0.101961} ,
{"grey100" , "xffffff" , 1.000000 , 1.000000 , 1.000000} ,
{"grey11" , "x1c1c1c" , 0.109804 , 0.109804 , 0.109804} ,
{"grey12" , "x1f1f1f" , 0.121569 , 0.121569 , 0.121569} ,
{"grey13" , "x212121" , 0.129412 , 0.129412 , 0.129412} ,
{"grey14" , "x242424" , 0.141176 , 0.141176 , 0.141176} ,
{"grey15" , "x262626" , 0.149020 , 0.149020 , 0.149020} ,
{"grey16" , "x292929" , 0.160784 , 0.160784 , 0.160784} ,
{"grey17" , "x2b2b2b" , 0.168627 , 0.168627 , 0.168627} ,
{"grey18" , "x2e2e2e" , 0.180392 , 0.180392 , 0.180392} ,
{"grey19" , "x303030" , 0.188235 , 0.188235 , 0.188235} ,
{"grey2" , "x050505" , 0.019608 , 0.019608 , 0.019608} ,
{"grey20" , "x333333" , 0.200000 , 0.200000 , 0.200000} ,
{"grey21" , "x363636" , 0.211765 , 0.211765 , 0.211765} ,
{"grey22" , "x383838" , 0.219608 , 0.219608 , 0.219608} ,
{"grey23" , "x3b3b3b" , 0.231373 , 0.231373 , 0.231373} ,
{"grey24" , "x3d3d3d" , 0.239216 , 0.239216 , 0.239216} ,
{"grey25" , "x404040" , 0.250980 , 0.250980 , 0.250980} ,
{"grey26" , "x424242" , 0.258824 , 0.258824 , 0.258824} ,
{"grey27" , "x454545" , 0.270588 , 0.270588 , 0.270588} ,
{"grey28" , "x474747" , 0.278431 , 0.278431 , 0.278431} ,
{"grey29" , "x4a4a4a" , 0.290196 , 0.290196 , 0.290196} ,
{"grey3" , "x080808" , 0.031373 , 0.031373 , 0.031373} ,
{"grey30" , "x4d4d4d" , 0.301961 , 0.301961 , 0.301961} ,
{"grey31" , "x4f4f4f" , 0.309804 , 0.309804 , 0.309804} ,
{"grey32" , "x525252" , 0.321569 , 0.321569 , 0.321569} ,
{"grey33" , "x545454" , 0.329412 , 0.329412 , 0.329412} ,
{"grey34" , "x575757" , 0.341176 , 0.341176 , 0.341176} ,
{"grey35" , "x595959" , 0.349020 , 0.349020 , 0.349020} ,
{"grey36" , "x5c5c5c" , 0.360784 , 0.360784 , 0.360784} ,
{"grey37" , "x5e5e5e" , 0.368627 , 0.368627 , 0.368627} ,
{"grey38" , "x616161" , 0.380392 , 0.380392 , 0.380392} ,
{"grey39" , "x636363" , 0.388235 , 0.388235 , 0.388235} ,
{"grey4" , "x0a0a0a" , 0.039216 , 0.039216 , 0.039216} ,
{"grey40" , "x666666" , 0.400000 , 0.400000 , 0.400000} ,
{"grey41" , "x696969" , 0.411765 , 0.411765 , 0.411765} ,
{"grey42" , "x6b6b6b" , 0.419608 , 0.419608 , 0.419608} ,
{"grey43" , "x6e6e6e" , 0.431373 , 0.431373 , 0.431373} ,
{"grey44" , "x707070" , 0.439216 , 0.439216 , 0.439216} ,
{"grey45" , "x737373" , 0.450980 , 0.450980 , 0.450980} ,
{"grey46" , "x757575" , 0.458824 , 0.458824 , 0.458824} ,
{"grey47" , "x787878" , 0.470588 , 0.470588 , 0.470588} ,
{"grey48" , "x7a7a7a" , 0.478431 , 0.478431 , 0.478431} ,
{"grey49" , "x7d7d7d" , 0.490196 , 0.490196 , 0.490196} ,
{"grey5" , "x0d0d0d" , 0.050980 , 0.050980 , 0.050980} ,
{"grey50" , "x7f7f7f" , 0.498039 , 0.498039 , 0.498039} ,
{"grey51" , "x828282" , 0.509804 , 0.509804 , 0.509804} ,
{"grey52" , "x858585" , 0.521569 , 0.521569 , 0.521569} ,
{"grey53" , "x878787" , 0.529412 , 0.529412 , 0.529412} ,
{"grey54" , "x8a8a8a" , 0.541176 , 0.541176 , 0.541176} ,
{"grey55" , "x8c8c8c" , 0.549020 , 0.549020 , 0.549020} ,
{"grey56" , "x8f8f8f" , 0.560784 , 0.560784 , 0.560784} ,
{"grey57" , "x919191" , 0.568627 , 0.568627 , 0.568627} ,
{"grey58" , "x949494" , 0.580392 , 0.580392 , 0.580392} ,
{"grey59" , "x969696" , 0.588235 , 0.588235 , 0.588235} ,
{"grey6" , "x0f0f0f" , 0.058824 , 0.058824 , 0.058824} ,
{"grey60" , "x999999" , 0.600000 , 0.600000 , 0.600000} ,
{"grey61" , "x9c9c9c" , 0.611765 , 0.611765 , 0.611765} ,
{"grey62" , "x9e9e9e" , 0.619608 , 0.619608 , 0.619608} ,
{"grey63" , "xa1a1a1" , 0.631373 , 0.631373 , 0.631373} ,
{"grey64" , "xa3a3a3" , 0.639216 , 0.639216 , 0.639216} ,
{"grey65" , "xa6a6a6" , 0.650980 , 0.650980 , 0.650980} ,
{"grey66" , "xa8a8a8" , 0.658824 , 0.658824 , 0.658824} ,
{"grey67" , "xababab" , 0.670588 , 0.670588 , 0.670588} ,
{"grey68" , "xadadad" , 0.678431 , 0.678431 , 0.678431} ,
{"grey69" , "xb0b0b0" , 0.690196 , 0.690196 , 0.690196} ,
{"grey7" , "x121212" , 0.070588 , 0.070588 , 0.070588} ,
{"grey70" , "xb3b3b3" , 0.701961 , 0.701961 , 0.701961} ,
{"grey71" , "xb5b5b5" , 0.709804 , 0.709804 , 0.709804} ,
{"grey72" , "xb8b8b8" , 0.721569 , 0.721569 , 0.721569} ,
{"grey73" , "xbababa" , 0.729412 , 0.729412 , 0.729412} ,
{"grey74" , "xbdbdbd" , 0.741176 , 0.741176 , 0.741176} ,
{"grey75" , "xbfbfbf" , 0.749020 , 0.749020 , 0.749020} ,
{"grey76" , "xc2c2c2" , 0.760784 , 0.760784 , 0.760784} ,
{"grey77" , "xc4c4c4" , 0.768627 , 0.768627 , 0.768627} ,
{"grey78" , "xc7c7c7" , 0.780392 , 0.780392 , 0.780392} ,
{"grey79" , "xc9c9c9" , 0.788235 , 0.788235 , 0.788235} ,
{"grey8" , "x141414" , 0.078431 , 0.078431 , 0.078431} ,
{"grey80" , "xcccccc" , 0.800000 , 0.800000 , 0.800000} ,
{"grey81" , "xcfcfcf" , 0.811765 , 0.811765 , 0.811765} ,
{"grey82" , "xd1d1d1" , 0.819608 , 0.819608 , 0.819608} ,
{"grey83" , "xd4d4d4" , 0.831373 , 0.831373 , 0.831373} ,
{"grey84" , "xd6d6d6" , 0.839216 , 0.839216 , 0.839216} ,
{"grey85" , "xd9d9d9" , 0.850980 , 0.850980 , 0.850980} ,
{"grey86" , "xdbdbdb" , 0.858824 , 0.858824 , 0.858824} ,
{"grey87" , "xdedede" , 0.870588 , 0.870588 , 0.870588} ,
{"grey88" , "xe0e0e0" , 0.878431 , 0.878431 , 0.878431} ,
{"grey89" , "xe3e3e3" , 0.890196 , 0.890196 , 0.890196} ,
{"grey9" , "x171717" , 0.090196 , 0.090196 , 0.090196} ,
{"grey90" , "xe5e5e5" , 0.898039 , 0.898039 , 0.898039} ,
{"grey91" , "xe8e8e8" , 0.909804 , 0.909804 , 0.909804} ,
{"grey92" , "xebebeb" , 0.921569 , 0.921569 , 0.921569} ,
{"grey93" , "xededed" , 0.929412 , 0.929412 , 0.929412} ,
{"grey94" , "xf0f0f0" , 0.941176 , 0.941176 , 0.941176} ,
{"grey95" , "xf2f2f2" , 0.949020 , 0.949020 , 0.949020} ,
{"grey96" , "xf5f5f5" , 0.960784 , 0.960784 , 0.960784} ,
{"grey97" , "xf7f7f7" , 0.968627 , 0.968627 , 0.968627} ,
{"grey98" , "xfafafa" , 0.980392 , 0.980392 , 0.980392} ,
{"grey99" , "xfcfcfc" , 0.988235 , 0.988235 , 0.988235} ,
{"honeydew" , "xf0fff0" , 0.941176 , 1.000000 , 0.941176} ,
{"honeydew1" , "xf0fff0" , 0.941176 , 1.000000 , 0.941176} ,
{"honeydew2" , "xe0eee0" , 0.878431 , 0.933333 , 0.878431} ,
{"honeydew3" , "xc1cdc1" , 0.756863 , 0.803922 , 0.756863} ,
{"honeydew4" , "x838b83" , 0.513725 , 0.545098 , 0.513725} ,
{"hot pink" , "xff69b4" , 1.000000 , 0.411765 , 0.705882} ,
{"indian red" , "xcd5c5c" , 0.803922 , 0.360784 , 0.360784} ,
{"ivory" , "xfffff0" , 1.000000 , 1.000000 , 0.941176} ,
{"ivory1" , "xfffff0" , 1.000000 , 1.000000 , 0.941176} ,
{"ivory2" , "xeeeee0" , 0.933333 , 0.933333 , 0.878431} ,
{"ivory3" , "xcdcdc1" , 0.803922 , 0.803922 , 0.756863} ,
{"ivory4" , "x8b8b83" , 0.545098 , 0.545098 , 0.513725} ,
{"khaki" , "xf0e68c" , 0.941176 , 0.901961 , 0.549020} ,
{"khaki1" , "xfff68f" , 1.000000 , 0.964706 , 0.560784} ,
{"khaki2" , "xeee685" , 0.933333 , 0.901961 , 0.521569} ,
{"khaki3" , "xcdc673" , 0.803922 , 0.776471 , 0.450980} ,
{"khaki4" , "x8b864e" , 0.545098 , 0.525490 , 0.305882} ,
{"lavender blush" , "xfff0f5" , 1.000000 , 0.941176 , 0.960784} ,
{"lavender" , "xe6e6fa" , 0.901961 , 0.901961 , 0.980392} ,
{"lawn green" , "x7cfc00" , 0.486275 , 0.988235 , 0.000000} ,
{"lemon chiffon" , "xfffacd" , 1.000000 , 0.980392 , 0.803922} ,
{"light blue" , "xadd8e6" , 0.678431 , 0.847059 , 0.901961} ,
{"light coral" , "xf08080" , 0.941176 , 0.501961 , 0.501961} ,
{"light cyan" , "xe0ffff" , 0.878431 , 1.000000 , 1.000000} ,
{"light goldenrod yellow" , "xfafad2" , 0.980392 , 0.980392 , 0.823529} ,
{"light goldenrod" , "xeedd82" , 0.933333 , 0.866667 , 0.509804} ,
{"light gray" , "xd3d3d3" , 0.827451 , 0.827451 , 0.827451} ,
{"light green" , "x90ee90" , 0.564706 , 0.933333 , 0.564706} ,
{"light grey" , "xd3d3d3" , 0.827451 , 0.827451 , 0.827451} ,
{"light pink" , "xffb6c1" , 1.000000 , 0.713725 , 0.756863} ,
{"light salmon" , "xffa07a" , 1.000000 , 0.627451 , 0.478431} ,
{"light sea green" , "x20b2aa" , 0.125490 , 0.698039 , 0.666667} ,
{"light sky blue" , "x87cefa" , 0.529412 , 0.807843 , 0.980392} ,
{"light slate blue" , "x8470ff" , 0.517647 , 0.439216 , 1.000000} ,
{"light slate gray" , "x778899" , 0.466667 , 0.533333 , 0.600000} ,
{"light slate grey" , "x778899" , 0.466667 , 0.533333 , 0.600000} ,
{"light steel blue" , "xb0c4de" , 0.690196 , 0.768627 , 0.870588} ,
{"light yellow" , "xffffe0" , 1.000000 , 1.000000 , 0.878431} ,
{"lime green" , "x32cd32" , 0.196078 , 0.803922 , 0.196078} ,
{"linen" , "xfaf0e6" , 0.980392 , 0.941176 , 0.901961} ,
{"magenta" , "xff00ff" , 1.000000 , 0.000000 , 1.000000} ,
{"magenta1" , "xff00ff" , 1.000000 , 0.000000 , 1.000000} ,
{"magenta2" , "xee00ee" , 0.933333 , 0.000000 , 0.933333} ,
{"magenta3" , "xcd00cd" , 0.803922 , 0.000000 , 0.803922} ,
{"magenta4" , "x8b008b" , 0.545098 , 0.000000 , 0.545098} ,
{"maroon" , "xb03060" , 0.690196 , 0.188235 , 0.376471} ,
{"maroon1" , "xff34b3" , 1.000000 , 0.203922 , 0.701961} ,
{"maroon2" , "xee30a7" , 0.933333 , 0.188235 , 0.654902} ,
{"maroon3" , "xcd2990" , 0.803922 , 0.160784 , 0.564706} ,
{"maroon4" , "x8b1c62" , 0.545098 , 0.109804 , 0.384314} ,
{"medium aquamarine" , "x66cdaa" , 0.400000 , 0.803922 , 0.666667} ,
{"medium blue" , "x0000cd" , 0.000000 , 0.000000 , 0.803922} ,
{"medium orchid" , "xba55d3" , 0.729412 , 0.333333 , 0.827451} ,
{"medium purple" , "x9370db" , 0.576471 , 0.439216 , 0.858824} ,
{"medium sea green" , "x3cb371" , 0.235294 , 0.701961 , 0.443137} ,
{"medium slate blue" , "x7b68ee" , 0.482353 , 0.407843 , 0.933333} ,
{"medium spring green" , "x00fa9a" , 0.000000 , 0.980392 , 0.603922} ,
{"medium turquoise" , "x48d1cc" , 0.282353 , 0.819608 , 0.800000} ,
{"medium violet red" , "xc71585" , 0.780392 , 0.082353 , 0.521569} ,
{"midnight blue" , "x191970" , 0.098039 , 0.098039 , 0.439216} ,
{"mint cream" , "xf5fffa" , 0.960784 , 1.000000 , 0.980392} ,
{"misty rose" , "xffe4e1" , 1.000000 , 0.894118 , 0.882353} ,
{"moccasin" , "xffe4b5" , 1.000000 , 0.894118 , 0.709804} ,
{"navajo white" , "xffdead" , 1.000000 , 0.870588 , 0.678431} ,
{"navy blue" , "x000080" , 0.000000 , 0.000000 , 0.501961} ,
{"navy" , "x000080" , 0.000000 , 0.000000 , 0.501961} ,
{"old lace" , "xfdf5e6" , 0.992157 , 0.960784 , 0.901961} ,
{"olive drab" , "x6b8e23" , 0.419608 , 0.556863 , 0.137255} ,
{"orange red" , "xff4500" , 1.000000 , 0.270588 , 0.000000} ,
{"orange" , "xffa500" , 1.000000 , 0.647059 , 0.000000} ,
{"orange1" , "xffa500" , 1.000000 , 0.647059 , 0.000000} ,
{"orange2" , "xee9a00" , 0.933333 , 0.603922 , 0.000000} ,
{"orange3" , "xcd8500" , 0.803922 , 0.521569 , 0.000000} ,
{"orange4" , "x8b5a00" , 0.545098 , 0.352941 , 0.000000} ,
{"orchid" , "xda70d6" , 0.854902 , 0.439216 , 0.839216} ,
{"orchid1" , "xff83fa" , 1.000000 , 0.513725 , 0.980392} ,
{"orchid2" , "xee7ae9" , 0.933333 , 0.478431 , 0.913725} ,
{"orchid3" , "xcd69c9" , 0.803922 , 0.411765 , 0.788235} ,
{"orchid4" , "x8b4789" , 0.545098 , 0.278431 , 0.537255} ,
{"pale goldenrod" , "xeee8aa" , 0.933333 , 0.909804 , 0.666667} ,
{"pale green" , "x98fb98" , 0.596078 , 0.984314 , 0.596078} ,
{"pale turquoise" , "xafeeee" , 0.686275 , 0.933333 , 0.933333} ,
{"pale violet red" , "xdb7093" , 0.858824 , 0.439216 , 0.576471} ,
{"papaya whip" , "xffefd5" , 1.000000 , 0.937255 , 0.835294} ,
{"peach puff" , "xffdab9" , 1.000000 , 0.854902 , 0.725490} ,
{"peru" , "xcd853f" , 0.803922 , 0.521569 , 0.247059} ,
{"pink" , "xffc0cb" , 1.000000 , 0.752941 , 0.796078} ,
{"pink1" , "xffb5c5" , 1.000000 , 0.709804 , 0.772549} ,
{"pink2" , "xeea9b8" , 0.933333 , 0.662745 , 0.721569} ,
{"pink3" , "xcd919e" , 0.803922 , 0.568627 , 0.619608} ,
{"pink4" , "x8b636c" , 0.545098 , 0.388235 , 0.423529} ,
{"plum" , "xdda0dd" , 0.866667 , 0.627451 , 0.866667} ,
{"plum1" , "xffbbff" , 1.000000 , 0.733333 , 1.000000} ,
{"plum2" , "xeeaeee" , 0.933333 , 0.682353 , 0.933333} ,
{"plum3" , "xcd96cd" , 0.803922 , 0.588235 , 0.803922} ,
{"plum4" , "x8b668b" , 0.545098 , 0.400000 , 0.545098} ,
{"powder blue" , "xb0e0e6" , 0.690196 , 0.878431 , 0.901961} ,
{"purple" , "xa020f0" , 0.627451 , 0.125490 , 0.941176} ,
{"purple1" , "x9b30ff" , 0.607843 , 0.188235 , 1.000000} ,
{"purple2" , "x912cee" , 0.568627 , 0.172549 , 0.933333} ,
{"purple3" , "x7d26cd" , 0.490196 , 0.149020 , 0.803922} ,
{"purple4" , "x551a8b" , 0.333333 , 0.101961 , 0.545098} ,
{"red" , "xff0000" , 1.000000 , 0.000000 , 0.000000} ,
{"red1" , "xff0000" , 1.000000 , 0.000000 , 0.000000} ,
{"red2" , "xee0000" , 0.933333 , 0.000000 , 0.000000} ,
{"red3" , "xcd0000" , 0.803922 , 0.000000 , 0.000000} ,
{"red4" , "x8b0000" , 0.545098 , 0.000000 , 0.000000} ,
{"rosy brown" , "xbc8f8f" , 0.737255 , 0.560784 , 0.560784} ,
{"royal blue" , "x4169e1" , 0.254902 , 0.411765 , 0.882353} ,
{"saddle brown" , "x8b4513" , 0.545098 , 0.270588 , 0.074510} ,
{"salmon" , "xfa8072" , 0.980392 , 0.501961 , 0.447059} ,
{"salmon1" , "xff8c69" , 1.000000 , 0.549020 , 0.411765} ,
{"salmon2" , "xee8262" , 0.933333 , 0.509804 , 0.384314} ,
{"salmon3" , "xcd7054" , 0.803922 , 0.439216 , 0.329412} ,
{"salmon4" , "x8b4c39" , 0.545098 , 0.298039 , 0.223529} ,
{"sandy brown" , "xf4a460" , 0.956863 , 0.643137 , 0.376471} ,
{"sea green" , "x2e8b57" , 0.180392 , 0.545098 , 0.341176} ,
{"seashell" , "xfff5ee" , 1.000000 , 0.960784 , 0.933333} ,
{"seashell1" , "xfff5ee" , 1.000000 , 0.960784 , 0.933333} ,
{"seashell2" , "xeee5de" , 0.933333 , 0.898039 , 0.870588} ,
{"seashell3" , "xcdc5bf" , 0.803922 , 0.772549 , 0.749020} ,
{"seashell4" , "x8b8682" , 0.545098 , 0.525490 , 0.509804} ,
{"sienna" , "xa0522d" , 0.627451 , 0.321569 , 0.176471} ,
{"sienna1" , "xff8247" , 1.000000 , 0.509804 , 0.278431} ,
{"sienna2" , "xee7942" , 0.933333 , 0.474510 , 0.258824} ,
{"sienna3" , "xcd6839" , 0.803922 , 0.407843 , 0.223529} ,
{"sienna4" , "x8b4726" , 0.545098 , 0.278431 , 0.149020} ,
{"sky blue" , "x87ceeb" , 0.529412 , 0.807843 , 0.921569} ,
{"slate blue" , "x6a5acd" , 0.415686 , 0.352941 , 0.803922} ,
{"slate gray" , "x708090" , 0.439216 , 0.501961 , 0.564706} ,
{"slate grey" , "x708090" , 0.439216 , 0.501961 , 0.564706} ,
{"snow" , "xfffafa" , 1.000000 , 0.980392 , 0.980392} ,
{"snow1" , "xfffafa" , 1.000000 , 0.980392 , 0.980392} ,
{"snow2" , "xeee9e9" , 0.933333 , 0.913725 , 0.913725} ,
{"snow3" , "xcdc9c9" , 0.803922 , 0.788235 , 0.788235} ,
{"snow4" , "x8b8989" , 0.545098 , 0.537255 , 0.537255} ,
{"spring green" , "x00ff7f" , 0.000000 , 1.000000 , 0.498039} ,
{"steel blue" , "x4682b4" , 0.274510 , 0.509804 , 0.705882} ,
{"tan" , "xd2b48c" , 0.823529 , 0.705882 , 0.549020} ,
{"tan1" , "xffa54f" , 1.000000 , 0.647059 , 0.309804} ,
{"tan2" , "xee9a49" , 0.933333 , 0.603922 , 0.286275} ,
{"tan3" , "xcd853f" , 0.803922 , 0.521569 , 0.247059} ,
{"tan4" , "x8b5a2b" , 0.545098 , 0.352941 , 0.168627} ,
{"thistle" , "xd8bfd8" , 0.847059 , 0.749020 , 0.847059} ,
{"thistle1" , "xffe1ff" , 1.000000 , 0.882353 , 1.000000} ,
{"thistle2" , "xeed2ee" , 0.933333 , 0.823529 , 0.933333} ,
{"thistle3" , "xcdb5cd" , 0.803922 , 0.709804 , 0.803922} ,
{"thistle4" , "x8b7b8b" , 0.545098 , 0.482353 , 0.545098} ,
{"tomato" , "xff6347" , 1.000000 , 0.388235 , 0.278431} ,
{"tomato1" , "xff6347" , 1.000000 , 0.388235 , 0.278431} ,
{"tomato2" , "xee5c42" , 0.933333 , 0.360784 , 0.258824} ,
{"tomato3" , "xcd4f39" , 0.803922 , 0.309804 , 0.223529} ,
{"tomato4" , "x8b3626" , 0.545098 , 0.211765 , 0.149020} ,
{"turquoise" , "x40e0d0" , 0.250980 , 0.878431 , 0.815686} ,
{"turquoise1" , "x00f5ff" , 0.000000 , 0.960784 , 1.000000} ,
{"turquoise2" , "x00e5ee" , 0.000000 , 0.898039 , 0.933333} ,
{"turquoise3" , "x00c5cd" , 0.000000 , 0.772549 , 0.803922} ,
{"turquoise4" , "x00868b" , 0.000000 , 0.525490 , 0.545098} ,
{"violet red" , "xd02090" , 0.815686 , 0.125490 , 0.564706} ,
{"violet" , "xee82ee" , 0.933333 , 0.509804 , 0.933333} ,
{"wheat" , "xf5deb3" , 0.960784 , 0.870588 , 0.701961} ,
{"wheat1" , "xffe7ba" , 1.000000 , 0.905882 , 0.729412} ,
{"wheat2" , "xeed8ae" , 0.933333 , 0.847059 , 0.682353} ,
{"wheat3" , "xcdba96" , 0.803922 , 0.729412 , 0.588235} ,
{"wheat4" , "x8b7e66" , 0.545098 , 0.494118 , 0.400000} ,
{"white smoke" , "xf5f5f5" , 0.960784 , 0.960784 , 0.960784} ,
{"white" , "xffffff" , 1.000000 , 1.000000 , 1.000000} ,
{"yellow green" , "x9acd32" , 0.603922 , 0.803922 , 0.196078} ,
{"yellow" , "xffff00" , 1.000000 , 1.000000 , 0.000000} ,
{"yellow1" , "xffff00" , 1.000000 , 1.000000 , 0.000000} ,
{"yellow2" , "xeeee00" , 0.933333 , 0.933333 , 0.000000} ,
{"yellow3" , "xcdcd00" , 0.803922 , 0.803922 , 0.000000} ,
{"yellow4" , "x8b8b00" , 0.545098 , 0.545098 , 0.000000}
} ;
const int num_colors = sizeof(color_trans)/sizeof(color_trans[0]);
/*!
* A <color> is either a keyword or a numerical RGB specification.
*/
int color_is_valid( string* color ) {
string color_orig = *color;
string gnuplot_cmd_file_name = "/tmp/dpx_gp_commands.txt";
string my_colors_file_name = "/tmp/dpx_gp_colornames.txt";
ofstream tmp_file;
ifstream known_color_names;
string copy_of_txt_file_line;
string tmp_string;
stringstream tmp_stream;
stringstream color_stream;
//! Create a tmp file with gnuplot commands that find colornames.
tmp_file.open( gnuplot_cmd_file_name.c_str() );
tmp_file << "show palette colornames" ;
tmp_file.close();
//! Run gnuplot, save output to file
tmp_stream.str("");
tmp_stream << "gnuplot " << gnuplot_cmd_file_name << " >& " << my_colors_file_name ;
system( tmp_stream.str().c_str() );
//! Delete tmp file
tmp_stream.str("");
tmp_stream << "rm -f " << gnuplot_cmd_file_name << " &" ;
system( tmp_stream.str().c_str() );
//! Create a list of defined color names
known_color_names.open( my_colors_file_name.c_str() );
if ( known_color_names.is_open() ) {
color_stream.str(""); //clear
while (! known_color_names.eof() )
{
getline( known_color_names, copy_of_txt_file_line );
color_stream << copy_of_txt_file_line << endl;
}
known_color_names.close() ;
}
//! Delete results file
tmp_stream.str("");
tmp_stream << "rm -f " << my_colors_file_name << " &" ;
system( tmp_stream.str().c_str() );
/*!
* Verify that the given color is in RGB format (i.e. begins
* with a pound "#"), or by determining if the name
* (e.g. "salmon") is recognizable by the gnuplot application.
*/
tmp_string = color_orig;
tmp_string += ' '; // prevent false finds
if ( color_stream.str().find(tmp_string) != string::npos ||
tmp_string.compare(0, 1, "#") == 0 ) {
//! This is a valid color name.
return(1) ;
} else if ( convert_to_hexcolor(color) != -1 ) {
//! Color name changed to a HEX color code.
return(1) ;
} else {
cout << "warning: \"" << color_orig
<< "\" is not a known color name in Gnuplot." << endl;
cout << "Please select another color, or use a hexadecimal "
<< "color code instead" << endl;
cout << "(e.g. #FF0000 for red)." << endl;
return(0) ;
}
}
int color_is_valid( char* color ) {
string str_ = color;
return( color_is_valid(&str_) );
}
/*!
* Pass a pointer to a color variable, and have the function change
* the variable's value from a colorname to a hexadeciaml color code.
*/
int convert_to_hexcolor( string* color ) {
string color_orig = *color;
string duplicate = color_orig;
string tmp_string;
//! Remove spaces from string
while ( duplicate.find(" ") != string::npos ) {
duplicate.erase(duplicate.find(" "),1);
}
for ( int i = 0; i < num_colors; i++ ) {
if ( strcasecmp(duplicate.c_str(), (const char*)color_trans[i].color) == 0 ) {
//! copy hexadecimal color code
tmp_string = color_trans[i].hex_color;
if ( tmp_string.find("x", 0, 1) != string::npos ) {
//! replace "x" with pound "#"
tmp_string.replace(0, 1, "#");
}
cout << "gp_colors.cpp: converting \"" << color_orig
<< "\" to \"" << tmp_string << "\"." << endl;
*color = tmp_string;
return(0) ;
}
}
return(-1) ;
}
int convert_to_hexcolor( char* color ) {
string str_ = color;
return( convert_to_hexcolor(&str_) );
}
/*!
* Pass a pointer to a color variable, and have the function change the
* variable's value from a colorname to a RGB value where colors are
* specified as triples of floating point numbers between 0.0 and 1.0.
*/
int convert_to_rgbcolor( string* color ) {
string color_orig = *color;
string duplicate = color_orig;
string tmp_string;
stringstream tmp_stream;
string delim = " ";
//! Remove spaces from string
while ( duplicate.find(" ") != string::npos ) {
duplicate.erase(duplicate.find(" "),1);
}
for ( int i = 0; i < num_colors; i++ ) {
if ( strcasecmp(duplicate.c_str(), (const char*)color_trans[i].color) == 0 ) {
tmp_stream.str(""); tmp_stream << color_trans[i].red ;
tmp_string = tmp_stream.str();
tmp_string += delim;
tmp_stream.str(""); tmp_stream << color_trans[i].green ;
tmp_string += tmp_stream.str();
tmp_string += delim;
tmp_stream.str(""); tmp_stream << color_trans[i].blue ;
tmp_string += tmp_stream.str();
*color = tmp_string;
return(0) ;
}
}
return(-1) ;
}
int convert_to_rgbcolor( char* color ) {
string str_ = color;
return( convert_to_rgbcolor(&str_) );
}
| 68.750806 | 88 | 0.479573 | gilbertguoze |
0db610941a9dfa0de06b5ff4ce6426bc8133915d | 4,854 | hpp | C++ | Lexer/Parser.hpp | Pyxxil/LC3 | 7a2b201745846cd0f188648bfcc93f35d7ac711b | [
"MIT"
] | 2 | 2020-08-18T01:04:58.000Z | 2022-02-21T19:46:59.000Z | Lexer/Parser.hpp | Pyxxil/LC3 | 7a2b201745846cd0f188648bfcc93f35d7ac711b | [
"MIT"
] | null | null | null | Lexer/Parser.hpp | Pyxxil/LC3 | 7a2b201745846cd0f188648bfcc93f35d7ac711b | [
"MIT"
] | null | null | null | #ifndef PARSER_HPP
#define PARSER_HPP
#include <map>
#include "Lexer.hpp"
#include "Tokens.hpp"
namespace Parser {
class Parser {
public:
explicit Parser(std::vector<std::unique_ptr<Lexer::Token::Token>> tokens)
: m_tokens(std::move(tokens)) {}
void parse() {
uint16_t current_address{0};
bool origin_seen{false};
bool end_seen{false};
if (m_tokens.front()->token_type() != Lexer::TokenType::ORIG) {
error();
return;
}
for (auto &token : m_tokens) {
switch (token->token_type()) {
case Lexer::TokenType::LABEL: {
if (!origin_seen) {
error();
break;
} else if (end_seen) {
Notification::warning_notifications << Diagnostics::Diagnostic(
std::make_unique<Diagnostics::DiagnosticHighlighter>(
token->column(), token->get_token().length(), std::string{}),
"Label found after .END directive, ignoring.", token->file(),
token->line());
break;
}
for (auto &&[_, symbol] : m_symbols) {
if (symbol.address() == current_address) {
Notification::error_notifications << Diagnostics::Diagnostic(
std::make_unique<Diagnostics::DiagnosticHighlighter>(
token->column(), token->get_token().length(),
std::string{}),
"Multiple labels found for address", token->file(),
token->line());
Notification::error_notifications << Diagnostics::Diagnostic(
std::make_unique<Diagnostics::DiagnosticHighlighter>(
symbol.column(), symbol.name().length(), std::string{}),
"Previous label found here", symbol.file(), symbol.line());
}
}
auto &&[symbol, inserted] = m_symbols.try_emplace(
token->get_token(),
Lexer::Symbol(token->get_token(), current_address, token->file(),
token->column(), token->line()));
if (!inserted) {
// TODO: Fix the way these are handled. At the moment, any errors
// TODO: thrown here from labels that have been included (from the
// TODO: same file) won't actually be useful due to the fact that it
// TODO: doesn't tell the user where the .include was found.
auto &&sym = symbol->second;
Notification::error_notifications
<< Diagnostics::Diagnostic(
std::make_unique<Diagnostics::DiagnosticHighlighter>(
token->column(), token->get_token().length(),
std::string{}),
"Multiple definitions of label", token->file(),
token->line())
<< Diagnostics::Diagnostic(
std::make_unique<Diagnostics::DiagnosticHighlighter>(
sym.column(), sym.name().length(), std::string{}),
"Previous definition found here", sym.file(), sym.line());
} else {
longest_symbol_length =
std::max(longest_symbol_length,
static_cast<int>(token->get_token().length()));
}
break;
}
case Lexer::TokenType::ORIG:
if (origin_seen) {
error();
} else {
current_address =
static_cast<uint16_t>(static_cast<Lexer::Token::Immediate *>(
token->operands().front().get())
->value());
origin_seen = true;
}
break;
case Lexer::TokenType::END:
end_seen = true;
break;
default:
if (!origin_seen) {
error();
} else if (end_seen) {
Notification::warning_notifications << Diagnostics::Diagnostic(
std::make_unique<Diagnostics::DiagnosticHighlighter>(
token->column(), token->get_token().length(), std::string{}),
"Extra .END directive found.", token->file(), token->line());
} else {
if (const word memory_required = token->memory_required();
memory_required == -1) {
error();
} else if (memory_required > 0) {
current_address += static_cast<uint16_t>(memory_required);
}
}
break;
}
}
}
void error() { ++error_count; }
void warning() {}
const auto &tokens() const { return m_tokens; }
const auto &symbols() const { return m_symbols; }
auto is_okay() const { return error_count == 0; }
private:
std::vector<std::unique_ptr<Lexer::Token::Token>> m_tokens{};
std::map<std::string, Lexer::Symbol> m_symbols{};
size_t error_count{0};
int longest_symbol_length{20};
}; // namespace Parser
} // namespace Parser
#endif
| 35.691176 | 79 | 0.542851 | Pyxxil |
0db6eb55ac05d670df2bea07aff74e1b57852f19 | 6,491 | ipp | C++ | include/detail/system_state.ipp | twesterhout/percolation | f82358ce628c2b48cf7f8435673af17eab08c527 | [
"BSD-3-Clause"
] | null | null | null | include/detail/system_state.ipp | twesterhout/percolation | f82358ce628c2b48cf7f8435673af17eab08c527 | [
"BSD-3-Clause"
] | null | null | null | include/detail/system_state.ipp | twesterhout/percolation | f82358ce628c2b48cf7f8435673af17eab08c527 | [
"BSD-3-Clause"
] | null | null | null | // Copyright (c) 2019, Tom Westerhout
// 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 of the copyright holder 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "system_state.hpp"
#include "lattice.hpp"
TCM_NAMESPACE_BEGIN
// Callbacks {{{
constexpr auto
system_base_t::on_size_changed(geometric_cluster_base_t const& cluster) noexcept
-> system_base_t&
{
auto const size = cluster.size();
if (size > _max_cluster_size) { _max_cluster_size = size; }
return *this;
}
constexpr auto system_base_t::on_size_changed(
magnetic_cluster_base_t const& /*unused*/) noexcept -> system_base_t&
{
return *this;
}
constexpr auto system_base_t::on_boundaries_changed(
geometric_cluster_base_t const& cluster) noexcept -> system_base_t&
{
detail::update_has_wrapped(_has_wrapped, cluster.boundaries());
return *this;
}
constexpr auto system_base_t::on_cluster_created(
geometric_cluster_base_t const& /*unused*/) noexcept -> system_base_t&
{
++_number_clusters;
return *this;
}
constexpr auto
system_base_t::on_cluster_created(magnetic_cluster_base_t& cluster,
uint32_t site, angle_t /*phase*/) noexcept
-> system_base_t&
{
TCM_ASSERT(_clusters[site] == nullptr, "cluster already exists");
_clusters[site] = std::addressof(cluster);
return *this;
}
constexpr auto system_base_t::on_cluster_destroyed(
geometric_cluster_base_t const& /*cluster*/) TCM_NOEXCEPT -> system_base_t&
{
TCM_ASSERT(_number_clusters > 0, "there are no clusters to destroy");
--_number_clusters;
return *this;
}
constexpr auto
system_base_t::on_cluster_merged(geometric_cluster_base_t& big,
geometric_cluster_base_t& small) noexcept
-> system_base_t&
{
TCM_ASSERT(std::addressof(big) != std::addressof(small),
"can't merge a cluster with itself");
auto const big_root = big.root_index();
auto const small_root = small.root_index();
_particles[small_root] =
particle_base_t{std::addressof(_particles[big_root])};
return *this;
}
// }}}
/*constexpr*/ auto system_base_t::max_number_sites() const noexcept -> size_t
{
return _particles.size();
}
constexpr auto system_base_t::number_sites() const noexcept -> uint32_t
{
return _number_sites;
}
constexpr auto system_base_t::number_clusters() const noexcept -> uint32_t
{
return _number_clusters;
}
constexpr auto system_base_t::max_cluster_size() const noexcept -> uint32_t
{
return _max_cluster_size;
}
constexpr auto system_base_t::has_wrapped() const
& noexcept -> gsl::span<bool const>
{
return _has_wrapped;
}
constexpr auto system_base_t::is_empty(uint32_t const site) const TCM_NOEXCEPT
-> bool
{
TCM_ASSERT(site < max_number_sites(), "index out of bounds");
return _particles[site].is_empty();
}
constexpr auto system_base_t::get_angle(uint32_t const site) const TCM_NOEXCEPT
-> angle_t
{
TCM_ASSERT(!is_empty(site), "index out of bounds");
return _angles[site];
}
auto system_base_t::set_angle(uint32_t const site,
angle_t const angle) TCM_NOEXCEPT
-> system_base_t&
{
TCM_ASSERT(site < max_number_sites(), "index out of bounds");
_angles[site] = angle;
return *this;
}
#if 0
template <class RAIter>
auto system_base_t::set_angle(RAIter first, RAIter last,
angle_t angle) TCM_NOEXCEPT -> system_base_t&
{
std::for_each(first, last,
[angle, this](auto const site) { set_angle(site, angle); });
return *this;
}
#endif
constexpr auto system_base_t::rotate(uint32_t const site,
angle_t const angle) TCM_NOEXCEPT -> void
{
TCM_ASSERT(!is_empty(site), "site is empty");
set_angle(site, get_angle(site) + angle);
}
#if 0
template <class RAIter>
auto rotate(RAIter first, RAIter last, angle_t angle) TCM_NOEXCEPT -> void;
#endif
constexpr auto
system_base_t::get_magnetic_cluster(uint32_t const site) TCM_NOEXCEPT
-> magnetic_cluster_base_t&
{
TCM_ASSERT(!is_empty(site), "site is empty");
TCM_ASSERT(_clusters[site] != nullptr, "");
return *_clusters[site];
}
constexpr auto
system_base_t::get_magnetic_cluster(uint32_t site) const TCM_NOEXCEPT
-> magnetic_cluster_base_t const&
{
TCM_ASSERT(!is_empty(site), "site is empty");
TCM_ASSERT(_clusters[site] != nullptr, "");
return *_clusters[site];
}
constexpr auto system_base_t::set_magnetic_cluster(
uint32_t site, magnetic_cluster_base_t& cluster) TCM_NOEXCEPT
-> system_base_t&
{
TCM_ASSERT(site < max_number_sites(), "index out of bounds");
// TCM_ASSERT(!_particles[i].is_empty(), "Site is empty");
_clusters[site] = std::addressof(cluster);
return *this;
}
auto system_base_t::get_geometric_cluster(
magnetic_cluster_base_t const& cluster) -> geometric_cluster_base_t&
{
TCM_ASSERT(cluster.number_sites() > 0, "magnetic cluster can't be empty");
return find_root(_particles[cluster.sites()[0]]).cluster();
}
TCM_NAMESPACE_END
| 31.509709 | 81 | 0.717917 | twesterhout |
0dba848b3567e0dd938cb7c6cee647f7df7ccd04 | 304 | hh | C++ | src/client/human/human.hh | TheBenPerson/Game | 824b2240e95529b735b4d8055a541c77102bb5dc | [
"MIT"
] | null | null | null | src/client/human/human.hh | TheBenPerson/Game | 824b2240e95529b735b4d8055a541c77102bb5dc | [
"MIT"
] | null | null | null | src/client/human/human.hh | TheBenPerson/Game | 824b2240e95529b735b4d8055a541c77102bb5dc | [
"MIT"
] | null | null | null | #ifndef GAME_CLIENT_HUMAN
#define GAME_CLIENT_HUMAN
#include <stdint.h>
#include "entity.hh"
class Human: public Entity {
public:
Human(uint8_t *datat);
~Human();
void draw();
private:
typedef enum {LEFT, DOWN, RIGHT, UP} direction;
direction lastDir = UP;
char *name;
};
#endif
| 11.259259 | 49 | 0.677632 | TheBenPerson |
0dbfa5cbb4e323a24bc19ea294c57c248621219f | 10,749 | cpp | C++ | rack/main/products.cpp | fmidev/rack | 95c39ef610637e8068253efc36aab40177caff03 | [
"MIT"
] | 20 | 2018-03-21T10:58:00.000Z | 2022-02-11T14:43:03.000Z | rack/main/products.cpp | fmidev/rack | 95c39ef610637e8068253efc36aab40177caff03 | [
"MIT"
] | null | null | null | rack/main/products.cpp | fmidev/rack | 95c39ef610637e8068253efc36aab40177caff03 | [
"MIT"
] | 6 | 2018-07-04T04:55:56.000Z | 2021-04-15T19:25:13.000Z | /*
MIT License
Copyright (c) 2017 FMI Open Development / Markus Peura, first.last@fmi.fi
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.
*/
/*
Part of Rack development has been done in the BALTRAD projects part-financed
by the European Union (European Regional Development Fund and European
Neighbourhood Partnership Instrument, Baltic Sea Region Programme 2007-2013)
*/
#include <drain/prog/CommandInstaller.h>
#include "data/Quantity.h"
#include "product/BeamAltitudeOp.h"
#include "product/CappiOp.h"
#include "product/EchoTopOp.h"
#include "product/MaxEchoOp.h"
#include "product/PolarSlidingWindowOp.h"
#include "product/DopplerOp.h"
#include "product/DopplerAvgExpOp.h"
#include "product/DopplerWindowOp.h"
#include "product/DopplerDevOp.h"
#include "product/DopplerInversionOp.h"
#include "product/DopplerSamplerOp.h"
#include "product/ConvOp.h"
#include "product/RainRateOp.h"
#include "product/RainRateDPOp.h"
//#include "product/RainRateDPSimpleOp.h"
//#include "product/RainRateZDROp.h"
#include "product/DrawingOp.h"
#include "product/SunShineOp.h"
#include "product/PseudoRhiOp.h"
#include "product/VerticalProfileOp.h"
#include "radar/Precipitation.h"
#include "andre/BirdOp.h"
#include "product/FunctorOp.h"
#include "products.h"
#include "resources.h"
namespace rack {
/// "Virtual" command extracting one sweep - actually only modifying selector
class CmdSweep : public drain::BasicCommand {
public:
CmdSweep() : drain::BasicCommand(__FUNCTION__, "Return a single sweep") {
parameters.link("quantity", quantity = "DBZH");
parameters.link("index", elevIndex = 0);
};
CmdSweep(const CmdSweep &cmd) : drain::BasicCommand(cmd){
parameters.copyStruct(cmd.parameters, cmd, *this);
}
// COnsider selector
std::string quantity;
size_t elevIndex;
void exec() const {
RackContext & ctx = getContext<RackContext>();
// ODIMPathElem elem(ODIMPathElem::DATASET, 1+elevIndex);
drain::Logger mout(ctx.log, __FUNCTION__, __FILE__);
//ctx.select = drain::sprinter(parameters.getMap(), "", ",", "=").str();
std::stringstream sstr;
sstr << "dataset" << (1+elevIndex) << ',' << "quantity=" << quantity;
ctx.select = sstr.str();
mout.note() << ctx.select << mout;
ctx.currentHi5 = ctx.currentPolarHi5;
ctx.unsetCurrentImages();
}
};
// Special command for bookkeeping of products and outputQUantities.
class CmdOutputQuantity : public drain::SimpleCommand<> {
public:
CmdOutputQuantity() : drain::SimpleCommand<>(__FUNCTION__, "Return default outout quantity","productCmd") {
};
typedef std::map<std::string,std::string> map_t;
static
map_t quantityMap;
void exec() const {
RackContext & ctx = getContext<RackContext>();
drain::Logger mout(ctx.log, __FUNCTION__, __FILE__);
/*
std::vector<std::string> s;
drain::StringTools::split(value, s, ",");
if (s[0] == "pSweep"){
if (s.size() > 1)
ctx.getStatusMap()["what:quantity"] = "";
else
ctx.getStatusMap()["what:quantity"] = "";
}
else {
map_t::const_iterator it = quantityMap.find(s[0]);
*/
map_t::const_iterator it = quantityMap.find(value.substr(0, value.find(',')));
if (it != quantityMap.end()){
mout.note() << "found '" << it->first << "' " << mout;
mout.note() << "setting what:quantity: " << it->second << " " << mout;
ctx.getStatusMap()["what:quantity"] = it->second;
}
else {
mout.note() << drain::sprinter(quantityMap) << mout;
mout.error() << "meteorological product '" << value << "' does not exist " << mout;
}
}
};
CmdOutputQuantity::map_t CmdOutputQuantity::quantityMap;
/// Wrapper for meteorological products derived from VolumeOp.
/**
* \tparam T - product operator, like CappiOp.
*/
template <class OP>
class ProductCommand : public drain::BeanCommand<OP>{
public:
ProductCommand(){
};
ProductCommand(const ProductCommand & cmd){
this->bean.getParameters().copyStruct(cmd.bean.getParameters(), cmd, *this);
};
/// Returns a description for help functions.
/*
const std::string & getType() const {
return this->bean.getOutputQuantity();
}
*/
virtual
void update() {
///this->bean.setParameters(params);
RackContext & ctx = this->template getContext<RackContext>(); // OMP
drain::Logger mout(ctx.log, __FUNCTION__, this->bean.getName());
mout.debug() << "Applying data selector and targetEncoding " << mout.endl;
if (this->bean.dataSelector.consumeParameters(ctx.select)){
mout.special() << "User defined select: " << this->bean.getDataSelector() << mout.endl;
}
if (!ctx.targetEncoding.empty()){
mout.debug() << "Setting target parameters: " << ctx.targetEncoding << mout.endl;
this->bean.setEncodingRequest(ctx.targetEncoding);
//mout.debug2() << "New values: " << this->bean.odim << mout.endl;
ctx.targetEncoding.clear();
}
this->bean.appendResults = ctx.appendResults;
this->bean.outputDataVerbosity = ctx.outputDataVerbosity;
/// Determines if also intermediate results (1) are saved. See --aStore
}
void exec() const {
RackContext & ctx = this->template getContext<RackContext>(); // OMP
drain::Logger mout(ctx.log, __FUNCTION__, this->bean.getName());
mout.timestamp("BEGIN_PRODUCT");
mout.debug() << "Running: " << this->bean.getName() << mout.endl;
//op.filter(getResources().inputHi5, getResources().polarHi5);
//const Hi5Tree & src = ctx.getCurrentInputHi5();
// RackContext::CURRENT not ok, it can be another polar product
const Hi5Tree & src = ctx.getHi5(RackContext::INPUT); // what about ANDRE processing?
// if (only if) ctx.append, then ctx? shared?
Hi5Tree & dst = ctx.polarHi5; //getTarget(); //For AnDRe ops, src serves also as dst.
if (&src == &dst){
mout.warn() << "src=dst" << mout.endl;
}
//mout.warn() << dst << mout.endl;
this->bean.processVolume(src, dst);
// hi5::Writer::writeFile("test1.h5", dst);
DataTools::updateCoordinatePolicy(dst, RackResources::polarLeft);
DataTools::updateInternalAttributes(dst);
ctx.currentPolarHi5 = & dst; // if cartesian, be careful with this...
ctx.currentHi5 = & dst;
mout.timestamp("END_PRODUCT");
// hi5::Writer::writeFile("test2.h5", dst);
};
virtual
inline
std::ostream & toOstream(std::ostream & ostr) const {
ostr << "adapterName" << ": " << this->bean;
return ostr;
}
protected:
// mutable std::string descriptionFull;
};
/*! Connects meteorological products to program core.
*
*/
/// Wraps OP of class ProductOp to a Command of class ProductCommand<OP>
template <class OP>
drain::Command & ProductModule::install(char alias){ // = 0 TODO: EMBED "install2"
static const OP op;
std::string name = op.getName(); // OP()
drain::CommandBank::deriveCmdName(name, getPrefix());
drain::Command & cmd = cmdBank.add<ProductCommand<OP> >(name);
cmd.section = getSection().index;
// drain::Logger mout(__FUNCTION__, __FILE__);
// mout.special() << name << "\n -> " << op.getOutputQuantity() << "\t test:" << op.getOutputQuantity("TEST") << mout;
CmdOutputQuantity::quantityMap[name] = op.getOutputQuantity();
return cmd;
}
//CmdSweep sweepCmd;
ProductModule::ProductModule(drain::CommandBank & cmdBank) : module_t(cmdBank){
drain::CommandBank::trimWords().insert("Op");
//std::cerr << __FUNCTION__ << std::endl;
//return;
//ProductInstaller installer(drain::getCommandBank());
//ProductModule & installer = *this;
// Visualization of geometry etc
install<BeamAltitudeOp>(); // beamAltitude;
install<DrawingOp>();// draw;
// Polar coord met.product based on dBZ
install<CappiOp>(); // cappi;
install<EchoTopOp>(); // echoTop;
install<MaxEchoOp>(); // maxEcho;
//install<PolarSlidingWindowOp<RadarWindowAvg> > test;
//PolarSlidingWindowOp<RadarWindowAvg<drain::FuzzyStep<double,double> > test;
//RadarWindowAvg<drain::FuzzyStep<double,double> > test;rack::RadarWindowConfig
//DopplerDevWindow test;
//install<PolarSlidingWindowOp<RadarWindowAvg<RadarWindowConfig> > > test;
install<PolarSlidingAvgOp>(); // test;
// Polar coord met.product based on VRAD
install<DopplerSamplerOp>(); // dopplerSampler; // circles
install<DopplerAvgOp> (); // dopplerAvg;
//install<DopplerAvg2Op> dopplerAvg2;
install<DopplerDevOp> (); // dopplerDev;
install<DopplerInversionOp> (); // dopplerInversion;
install<DopplerReprojectOp>(); // dopplerRealias;
install<DopplerCrawlerOp>(); // dopplerCrawler;
install<DopplerDiffPlotterOp>(); // dopplerDiffPlotter;
install<DopplerDiffOp>(); // dopplerDiff;
install<DopplerAvgExpOp>(); // dopplerAvgExp;
install<DopplerEccentricityOp>(); // dopplerEccentricity;
// Vertical met.products
install<VerticalProfileOp>(); // verticalProfile;
install<PseudoRhiOp>(); // pseudoRhi;
install<BirdOp>(); // bird;
install<ConvOp>(); // conv;
install<RainRateOp>(); // rainRate;
install<RainRateDPOp>(); // rainRateDP;
// install<RainRateDPSimpleOp> rainRateDPSimple;
install<rack::FunctorOp>(); // ftor;
// Geographical products
install<SunShineOp>(); // sun;
const drain::Flagger::value_t SECTION = getSection().index;
const char PREFIX = getPrefix();
// std::cerr << __FUNCTION__ << SECTION << ':' << PREFIX << std::endl;
/*
//cmdBank.addExternal(PREFIX, sweepCmd).section = SECTION;
std::cerr << __FUNCTION__ << sweepCmd.getName() << '\n';
std::string key(sweepCmd.getName());
std::cerr << __FUNCTION__ << key << '\n';
drain::CommandBank::deriveCmdName(key, PREFIX);
std::cerr << __FUNCTION__ << key << '\n';
cmdBank.addExternal(sweepCmd, key);
*/
static CmdSweep sweepCmd;
cmdBank.addExternal(PREFIX, sweepCmd).section = SECTION;
// Special command
static CmdOutputQuantity outputQuantityCmd;
cmdBank.addExternal(PREFIX, outputQuantityCmd).section = SECTION;
}
} // namespace rack::
// Rack
| 27.420918 | 119 | 0.703879 | fmidev |
0dc2420ad4ac54d89a0fefe26df9221255024c8c | 6,227 | cpp | C++ | Base/PLPhysics/src/SceneNodes/RagdollBody.cpp | ktotheoz/pixellight | 43a661e762034054b47766d7e38d94baf22d2038 | [
"MIT"
] | 83 | 2015-01-08T15:06:14.000Z | 2021-07-20T17:07:00.000Z | Base/PLPhysics/src/SceneNodes/RagdollBody.cpp | PixelLightFoundation/pixellight | 43a661e762034054b47766d7e38d94baf22d2038 | [
"MIT"
] | 27 | 2019-06-18T06:46:07.000Z | 2020-02-02T11:11:28.000Z | Base/PLPhysics/src/SceneNodes/RagdollBody.cpp | naetherm/PixelLight | d7666f5b49020334cbb5debbee11030f34cced56 | [
"MIT"
] | 40 | 2015-02-25T18:24:34.000Z | 2021-03-06T09:01:48.000Z | /*********************************************************\
* File: RagdollBody.cpp *
*
* Copyright (C) 2002-2013 The PixelLight Team (http://www.pixellight.org/)
*
* This file is part of PixelLight.
*
* 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.
\*********************************************************/
//[-------------------------------------------------------]
//[ Includes ]
//[-------------------------------------------------------]
#include <PLMath/Matrix3x4.h>
#include <PLMath/Matrix4x4.h>
#include <PLRenderer/Renderer/Renderer.h>
#include <PLRenderer/Renderer/DrawHelpers.h>
#include <PLScene/Visibility/VisNode.h>
#include "PLPhysics/Body.h"
#include "PLPhysics/World.h"
#include "PLPhysics/ElementHandler.h"
#include "PLPhysics/SceneNodes/SNRagdoll.h"
#include "PLPhysics/SceneNodes/SCPhysicsWorld.h"
#include "PLPhysics/SceneNodes/RagdollBody.h"
//[-------------------------------------------------------]
//[ Namespace ]
//[-------------------------------------------------------]
using namespace PLCore;
using namespace PLMath;
using namespace PLGraphics;
using namespace PLRenderer;
using namespace PLScene;
namespace PLPhysics {
//[-------------------------------------------------------]
//[ Public functions ]
//[-------------------------------------------------------]
/**
* @brief
* Constructor
*/
RagdollBody::RagdollBody(SNRagdoll *pParent) :
bEnabled(true),
fMass(0.1f),
m_pParentRagdoll(pParent),
m_pBodyHandler(new ElementHandler())
{
}
/**
* @brief
* Destructor
*/
RagdollBody::~RagdollBody()
{
DestroyPhysicsBody();
delete m_pBodyHandler;
}
/**
* @brief
* Returns the PL physics body
*/
Body *RagdollBody::GetBody() const
{
return static_cast<Body*>(m_pBodyHandler->GetElement());
}
/**
* @brief
* Sets the name of the body
*/
bool RagdollBody::SetName(const String &sName)
{
// Is this the current name?
if (this->sName != sName) {
// Is there a parent ragdoll and is this body name already used within the ragdoll?
if (!m_pParentRagdoll || m_pParentRagdoll->m_mapBodies.Get(sName))
return false; // Error!
// Set the new name
m_pParentRagdoll->m_mapBodies.Remove(this->sName);
this->sName = sName;
m_pParentRagdoll->m_mapBodies.Add(this->sName, this);
}
// Done
return true;
}
/**
* @brief
* Draws the physics body
*/
void RagdollBody::Draw(Renderer &cRenderer, const Color4 &cColor, const VisNode &cVisNode) const
{
// Calculate the world view projection matrix
Matrix3x4 mTrans;
GetTransformMatrix(mTrans);
const Matrix4x4 mWorldViewProjection = cVisNode.GetViewProjectionMatrix()*mTrans;
// Draw
const Vector3 &vNodeScale = m_pParentRagdoll->GetTransform().GetScale();
const Vector3 vRealSize = vSize*vNodeScale;
cRenderer.GetDrawHelpers().DrawBox(cColor,
Vector3(-vRealSize.x*0.5f, -vRealSize.y*0.5f, -vRealSize.z*0.5f),
Vector3( vRealSize.x*0.5f, vRealSize.y*0.5f, vRealSize.z*0.5f),
mWorldViewProjection, 0.0f);
}
/**
* @brief
* Creates the physics body
*/
void RagdollBody::CreatePhysicsBody()
{
// Is there a parent ragdoll?
if (m_pParentRagdoll) {
// Destroy the old physics body
DestroyPhysicsBody();
// Create the PL physics body
SCPhysicsWorld *pWorldContainer = m_pParentRagdoll->GetWorldContainer();
if (pWorldContainer && pWorldContainer->GetWorld()) {
const Vector3 &vNodePosition = m_pParentRagdoll->GetTransform().GetPosition();
const Quaternion &qNodeRotation = m_pParentRagdoll->GetTransform().GetRotation();
const Vector3 &vNodeScale = m_pParentRagdoll->GetTransform().GetScale();
const Vector3 vRealSize = vSize*vNodeScale;
Body *pBody = pWorldContainer->GetWorld()->CreateBodyBox(vRealSize);
if (pBody) {
m_pBodyHandler->SetElement(pBody);
// Setup body
pBody->SetMass(fMass);
pBody->SetPosition(qNodeRotation*(vPos*vNodeScale) + vNodePosition);
pBody->SetRotation(qNodeRotation*qRot);
}
}
}
}
/**
* @brief
* Destroys the physics body
*/
void RagdollBody::DestroyPhysicsBody()
{
if (m_pBodyHandler->GetElement())
delete m_pBodyHandler->GetElement();
}
/**
* @brief
* Returns the current rotation of the physics body
*/
void RagdollBody::GetRotation(Quaternion &qQ) const
{
const Body *pBody = static_cast<const Body*>(m_pBodyHandler->GetElement());
if (pBody)
pBody->GetRotation(qQ);
}
/**
* @brief
* Returns the current transform matrix of the physics body
*/
void RagdollBody::GetTransformMatrix(Matrix3x4 &mTrans) const
{
const Body *pBody = static_cast<const Body*>(m_pBodyHandler->GetElement());
if (pBody) {
Quaternion qQ;
pBody->GetRotation(qQ);
Vector3 vPos;
pBody->GetPosition(vPos);
mTrans.FromQuatTrans(qQ, vPos);
}
}
/**
* @brief
* Adds a force to the body
*/
void RagdollBody::AddForce(const Vector3 &vForce)
{
// Nothing do to in here
}
//[-------------------------------------------------------]
//[ Namespace ]
//[-------------------------------------------------------]
} // PLPhysics
| 29.372642 | 97 | 0.629517 | ktotheoz |
0dc8dfe6616447b40d9c0cfb0eaefd51633cfc31 | 15,238 | cc | C++ | lib/wam_ntiles.cc | fbsamples/wamquery | d772b10adb5ff7979212b0b2d6197c06c4553478 | [
"Apache-2.0"
] | 1 | 2021-09-12T13:28:40.000Z | 2021-09-12T13:28:40.000Z | lib/wam_ntiles.cc | fbsamples/wamquery | d772b10adb5ff7979212b0b2d6197c06c4553478 | [
"Apache-2.0"
] | null | null | null | lib/wam_ntiles.cc | fbsamples/wamquery | d772b10adb5ff7979212b0b2d6197c06c4553478 | [
"Apache-2.0"
] | 1 | 2021-09-12T12:36:55.000Z | 2021-09-12T12:36:55.000Z | /*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* 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.
*/
/* numeric quantiles
*
* This implementation uses base-2 logarithmic binning with base-2 linear
* sub-binning over the full IEEE 754 double value range including subnormals
* and infinities.
*
* This approach guarantees an upper bound for relative error for estimated
* quantile values as 1/2^precision. In other words, the maximum difference
* between real and estimated quantile value never exceeds a factor of
* 1/2^precision. For example, for binary precision 10, the relative error is
* 1/2^10 which approximately equals to 0.001
*
* The implementation is based on a hash table. Updates are O(1) in time. Space
* used is O(|<input double values trimmed to specified precicision>|).
*
* Returning quantiles is logarithmic to the size of the state.
*
* TODO: unify with wam_hist.cc when used with non-fixed bins
*
*
* 1. Overview
*
* You can read an overview of this approach at "High Dynamic Range (HDR)
* Histogram":
*
* https://github.com/HdrHistogram/HdrHistogram
*
* They also have a direct C port:
*
* https://github.com/HdrHistogram/HdrHistogram_c
*
* Their main implementation is in Java. It is 3 orders of magnitude more
* complex than ours (a lot of its complexity is incidental, i.e. code is not
* very good), doesn't work on a full double range, and has an ennormous
* space overhead for real-life distributions we are dealing with. It was
* originally written for histogramming integer values with ranges known
* upfront, e.g. for server-side request latencies.
*
* Potentially, the HDR implementation can have smaller constant factors for
* O(1) updates that ours as it is array-based, but with large arrays for
* wide value order ranges it really depends on an the overall cache usage
* profile.
*
* The HDR memory footprint can be improved using various approaches. Here's
* one of them: https://github.com/HdrHistogram/HdrHistogram/issues/54
*
* Another approach would be to allocate memory regions (e.g. linear
* sub-bins) dynamically as soon as we get at least one value falling in the
* logarithmic bin.
*
* In our implementation, we minimize memory usage by using hashtable for
* storing unique bins.
*
*
* 2. Alternative methods
*
* Approximate quantiles is a heavily researched topic. Here's a overiew of
* what is relevant to our user case.
*
* Most scientific approaches tend to focus on estimating quantiles with a
* relative error bound on rank and not on input values. For example, when
* asked for a 99-th percentile, with a 0.1 precision, they may return a
* value for any percentile in the 89.1 and 99.1 range. This doesn't say
* anything about how far the returned percentile value is from the true one.
* On the other hand, most algorithms from this category work on all
* histograms, not limited to numeric histograms we are dealing with here.
*
* These methods vary in accuracy, space and time-complexity. State of the
* art algorithms tend to require space log-linear or worse to the 1/error,
* and their update complexity is logarithmic or worse to the size of the
* space.
*
* It took at least several decades to come up with modern-day practical
* algorithms and provide theoretically optimal bounds for the problem.
* Overall, these results represent an ennormous improvement over ad-hoc
* approaches based on a random sampling (used, for example, in Cloudera
* Impala) and some earlier algorithms (used, for example, in Google's
* open-sourced Sawzall).
*
* 2.1. Best in class randomized algorithm is described in this paper. The paper
* provides an overview and comparative evaluation of various methods and
* describes a new randomized algorithm called Random. The newly presented
* algorithm provides optimal theoretical performance and it is relatively
* simple to implement.
*
* "Quantiles over Data Streams: An Experimental Study" (SIGMOD 2013) by Lu
* Wang et al.
* (http://dimacs.rutgers.edu/~graham/pubs/papers/nquantiles.pdf)
*
* Presentation slides and implementation (not-production quality) for the
* Random algorithm are available here:
*
* https://github.com/coolwanglu/quantile-alg
*
*
* 2.2. Efficient and very popular method for so called "biased quantiles",
* providing higher accuracy for higher quantile ranks (e.g. estimate for
* 99.9 perentile would be a lot more accurate than for 50-th percentile):
*
* Effective computation of biased quantiles over data streams (2005) by by
* Graham Cormode, S. Muthukrishnan, et al.
* (http://dimacs.rutgers.edu/~graham/pubs/papers/bquant-icde.pdf)
*
* Some practical implementations:
*
* in C: https://github.com/armon/statsite
*
* -- there may be some problems with this implementation , e.g. it may
* not offer higher accuracy for higher ranks in pracice
*
* in Go: https://github.com/bmizerany/perks
*
*
* 2.3. A bit dated but still very helpful survey of various algorithms:
*
* "Quantiles on Streams" (https://www.cs.ucsb.edu/~suri/psdir/ency.pdf)
*
*
* 2.4. Practically none of the papers suggest ways to distribute described
* algorithms in a practical way and with error bounds. This paper pretty
* much solves this problem:
*
* Holistic Aggregates in a Networked World: Distributed Tracking of
* Approximate Quantiles (2005) by Graham Cormode, Minos Garofalakis
* (http://dimacs.rutgers.edu/~graham/pubs/papers/cdquant.pdf)
*
* Note that there is a more modern method that further minimizes
* communication overhead for online distributed streaming quantiles by
* using 2-way communication between coordinator and leaf nodes, but this
* is not relevant for us, because our computation is a) offline b) can't
* take advantage of 2-way communication which would be impractical for a
* MPP query system. But here's a reference just in case:
*
* Optimal tracking of distributed heavy hitters and quantiles (2009)
* by Ke Yi, Qin Zhang (https://www.cse.ust.hk/~yike/pods09-hhquan.pdf)
*
*
* 2.5. Finally, a lot of people use a heuristics-based method described in the
* following paper:
*
* A streaming parallel decision tree algorithm (2008) by Yael
* Ben-haim , Elad Yom-tov
* (http://jmlr.csail.mit.edu/papers/volume11/ben-haim10a/ben-haim10a.pdf)
*
* Users include:
*
* - Hadoop/Hive (NumericHistogram.java)
* - hive/udf/lib/NumericHistogramImproved.java (and its C ports)
* - Metamarkets Druid:
* They actually store distribution summaries and came up with
* substantial optimizations for the merge stage. Description
* along with some empirical evaluation is available at
* https://metamarkets.com/2013/histograms/
*
* - Go: https://github.com/VividCortex/gohistogram
* - Clojure/Java: https://github.com/bigmlcom/histogram
*
* Main advantages:
*
* - convenient: you just need to specify the number of bins (max size
* of algorithm's state), and implementation will take care of the
* rest.
*
* - compact state: this number for a lot of practical use-cases can be
* as low as 100, which is suitable for storing aggregates.
*
* - reasonably fast: updates are something in the order of log(size of
* the state), which is strictly bounded
*
* - relatively simple to implement
*
*
* Main disadvantages:
*
* - absolutely no guarantee on accuracy. Can be 5% off, can be 20% off,
* there is no way to tell. Using higher number of bins (e.g. 10000
* instead of 100), seem to help in practice, but still no guarantee.
*
* - updated are still slower than O(1)
*/
#include <stdlib.h>
#include <math.h> // isnan
#include <algorithm> // min, max, sort, lower_bound
#include "wam.h"
#include "wam_ntiles.h"
#include "wam_hashtbl.h"
// 2^10 = 1024; which roughly corresponds to 1/1024 =~ 0.001 relative error in
// decimal
//
// TODO: make it configurable from the queries
#define BINARY_PRECISION 10
struct wam_ntiles {
wam_hashtbl_t *hashtbl;
uint64_t total_count;
double min, max;
// lazily allocated array of pointers to unique values stored in hashtbl
unique_value_t **unique_values;
};
wam_ntiles_t *wam_ntiles_init(void)
{
wam_ntiles_t *nt = new wam_ntiles;
/* TODO, XXX: to provide better data locality, we can preallocate
* anticipated frequent bins so that their counters are laid down closer to
* each other. For example, we can preallocate bins for values in
* [0--2^precision) range, or extend it even further
*
* To make it generic, we can periodically recalculate most frequently
* updated buckets and reshuffle them in the allocated memory. We could even
* do it online, but this could result in a lot higher overhead which would
* negate the benefit of doing something like that in the first place */
nt->hashtbl = wam_hashtbl_init_unique_values();
nt->total_count = 0;
nt->min = INFINITY;
nt->max = -INFINITY;
// allocated lazily below
nt->unique_values = NULL;
return nt;
}
/*
#include <stdio.h>
#include <stdint.h>
#include <math.h> // isnan
static inline
double trim_double_to_precision(double value, unsigned precision);
int main()
{
double bin = 0;
double d;
for (d = 127; d <= 1025; d++) {
double t = trim_double_to_precision(d, 7);
if (t == bin) {
printf(" %.17g", d);
}
else {
int exp;
frexp(d, &exp);
bin = t;
printf("\nexp = %d, bin = %.17g: %.17g", exp, bin, d);
}
}
return 0;
}
*/
static inline
double trim_double_to_precision(double value, unsigned precision)
{
union {
double d;
uint64_t i;
} u;
// trim the double value's mantissa to the specified binary precision:
//
// keep leading sign(1 bit), exponent(11 bits), and precision bits
// and zero all the lower bits beyond that
const uint64_t mask = ~(~0ULL >> (1 + 11 + precision));
u.d = value;
u.i &= mask;
return u.d;
}
void wam_ntiles_update(wam_ntiles_t *nt, double value, int weight)
{
// discarding NaNs as there's no way to interpret them
// XXX: should we at least count them and print a warning?
//
// NOTE: infinities and subnormals are OK
if (isnan(value)) return;
nt->total_count += weight;
nt->min = std::min(nt->min, value);
nt->max = std::max(nt->max, value);
value = trim_double_to_precision(value, BINARY_PRECISION);
wam_hashtbl_update_unique_values(nt->hashtbl, value, weight);
}
static inline
bool compare_unique_value(unique_value_t *a, unique_value_t *b)
{
return a->value < b->value;
}
static inline
bool compare_unique_value_count(unique_value_t *a, double b)
{
return a->count < b;
}
/* return n-th percentile; NOTE: n is from [0, 100] range */
double wam_ntile(wam_ntiles_t *nt, double n)
{
uint64_t i;
uint64_t unique_value_count = wam_hashtbl_get_unique_item_count(nt->hashtbl);
// check no values -- NOTE: NaN will be formatted as JSON null by
// format_float() in wam_query.c
if (!unique_value_count) return NAN;
// created and array of (value, count) pairs and sort it by value (this is
// only done once, subsequent wam_ntile invocations will be reusing it)
unique_value_t **unique_values = nt->unique_values;
if (!unique_values) {
nt->unique_values = unique_values = new unique_value_t*[unique_value_count];
wam_hashtbl_iterator_t *it = wam_hashtbl_first(nt->hashtbl);
for (i = 0; it; i++, it = wam_hashtbl_next(it)) {
unique_value_t *v = (unique_value_t *)wam_hashtbl_get_item(it);
unique_values[i] = v;
}
std::sort(unique_values, unique_values + unique_value_count, compare_unique_value);
/* make a cumulative histogram */
uint64_t count = 0;
for (i = 0; i < unique_value_count; i++) {
count += unique_values[i]->count;
unique_values[i]->count = count;
}
}
// now, calculate the ntile itself
// special cases -- min() and max() are known upfront
if (n == 0.0) return nt->min;
if (n == 100.0) return nt->max;
double target_count = nt->total_count * n / 100.0;
/* older version that doesn't use binary search */
/*
uint64_t count = 0;
for (i = 0; i < unique_value_count; i++) {
count += unique_values[i]->count;
if (target_count <= count) break;
}
*/
/* binary search: return the lowest bin such that target_count <= cumulative
* bin count
*
* TODO: optimize subsequent wam_ntile() calls if requested ntile is greater
* than the previously requested one, in which case we can use the new
* lower_bound as the left starting point
*/
unique_value_t **lower_bound = std::lower_bound(unique_values, unique_values + unique_value_count, target_count, compare_unique_value_count);
i = lower_bound - unique_values;
/* returnining an upper bound for all percentiles in (0, 100) range */
if (i < unique_value_count - 1)
return unique_values[i + 1]->value;
else
return nt->max;
}
void wam_ntiles_store(wam_ntiles_t *nt, FILE *f)
{
if (fwrite(&nt->total_count, sizeof(nt->total_count), 1, f) != 1)
handle_io_error("storing ntiles", f);
if (fwrite(&nt->min, sizeof(nt->min), 1, f) != 1)
handle_io_error("storing ntiles", f);
if (fwrite(&nt->max, sizeof(nt->max), 1, f) != 1)
handle_io_error("storing ntiles", f);
wam_hashtbl_store_unique_values(nt->hashtbl, f);
}
void wam_ntiles_load(wam_ntiles_t *nt, FILE *f)
{
uint64_t total_count;
double min, max;
if (fread(&total_count, sizeof(nt->total_count), 1, f) != 1)
handle_io_error("loading ntiles", f);
if (fread(&min, sizeof(nt->min), 1, f) != 1)
handle_io_error("loading ntiles", f);
if (fread(&max, sizeof(nt->max), 1, f) != 1)
handle_io_error("loading ntiles", f);
nt->total_count += total_count;
nt->min = std::min(nt->min, min);
nt->max = std::max(nt->max, max);
wam_hashtbl_load_unique_values(nt->hashtbl, f);
}
| 35.029885 | 145 | 0.669445 | fbsamples |
0dcd62c4eac3d1cec80ba7690df119bc9d4dfa46 | 3,595 | cpp | C++ | Practical_5_Pacman/components/cmp_ghost_movement.cpp | CarlosMiraGarcia/Pong_Practical-2 | ba26587fb2b538b9c3cceec98f1026112b2c6413 | [
"MIT"
] | null | null | null | Practical_5_Pacman/components/cmp_ghost_movement.cpp | CarlosMiraGarcia/Pong_Practical-2 | ba26587fb2b538b9c3cceec98f1026112b2c6413 | [
"MIT"
] | null | null | null | Practical_5_Pacman/components/cmp_ghost_movement.cpp | CarlosMiraGarcia/Pong_Practical-2 | ba26587fb2b538b9c3cceec98f1026112b2c6413 | [
"MIT"
] | null | null | null | #include "cmp_ghost_movement.h"
#include "cmp_player_movement.h"
#include "..\game.h"
#include <deque>
#include "../Pacman.h"
using namespace std;
using namespace sf;
static const Vector2i directions[] = { {1, 0}, {0, 1}, {0, -1}, {-1, 0} };
GhostMovementComponent::GhostMovementComponent(Entity* p)
: ActorMovementComponent(p) {
_speed = 100.f;
_state = ROAMING;
_direction = Vector2f(0.f, -1.f);
// srand is the seed to create a random number
srand(time(NULL));
}
void GhostMovementComponent::update(double dt) {
//amount to move
const auto movementValue = (float)(_speed * dt);
//Curent position
const Vector2f position = _parent->getPosition();
//Next position
const Vector2f newPosition = position + _direction * movementValue;
//Inverse of our current direction
const Vector2i badDirection = -1 * Vector2i(_direction);
//Random new direction
Vector2i newDirection = directions[(rand() % 4)];
const Vector2f inFront = _direction * _ghostSize;
switch (_state) {
case ROAMING:
// Wall in front or at waypoint
if (LevelSystem::getTileAt(position - inFront) == LevelSystem::INTERSECTION ||
LevelSystem::getTileAt(position + inFront) == LevelSystem::WALL) {
_state = ROTATING;
}
else {
move(_direction * movementValue);
}
break;
case ROTATING:
while (newDirection == badDirection ||
LevelSystem::getTileAt(position + (Vector2f(newDirection) * _ghostSize)) == LevelSystem::WALL) {
auto dir = findPlayer(position);
newDirection = dir;
}
_direction = Vector2f(newDirection);
_state = ROTATED;
break;
case ROTATED:
//have we left the waypoint?
if (LevelSystem::getTileAt(position - (_direction * _ghostSize)) != LevelSystem::INTERSECTION) {
_state = ROAMING; //yes
}
move(_direction * movementValue); //No
break;
}
}
Vector2i GhostMovementComponent::findPlayer(Vector2f ghostPosition) {
for (auto& e : _ents.list) {
auto comps = e->GetCompatibleComponent<PlayerMovementComponent>();
if (comps.size() > 0) {
auto actComp = comps[0];
const Vector2f playerPosition = e->getPosition();
const Vector2f wherePlayer = ghostPosition - playerPosition;
vector<Vector2f> newDirections;
if (wherePlayer.x > 0) {
newDirections.push_back(Vector2f(-1, 0));
}
if (wherePlayer.x < 0) {
newDirections.push_back(Vector2f(1, 0));
}
if (wherePlayer.y > 0) {
newDirections.push_back(Vector2f(0, -1));
}
if (wherePlayer.y < 0) {
newDirections.push_back(Vector2f(0, 1));
}
auto ran = rand() % 2;
auto returnDirection = Vector2i(newDirections[ran]);
if (LevelSystem::getTileAt(ghostPosition + (Vector2f(returnDirection) * _ghostSize)) == LevelSystem::WALL) {
if (ran == 0) {
if (!LevelSystem::getTileAt(ghostPosition + (Vector2f(newDirections[1]) * _ghostSize)) == LevelSystem::WALL) {
returnDirection = Vector2i(newDirections[1]);
}
if (!LevelSystem::getTileAt(ghostPosition + (Vector2f(newDirections[0]) * _ghostSize)) == LevelSystem::WALL) {
returnDirection = Vector2i(newDirections[0]);
}
else {
returnDirection = returnDirection * -1;
}
}
else {
if (!LevelSystem::getTileAt(ghostPosition + (Vector2f(newDirections[0]) * _ghostSize)) == LevelSystem::WALL) {
returnDirection = Vector2i(newDirections[0]);
}
if (!LevelSystem::getTileAt(ghostPosition + (Vector2f(newDirections[1]) * _ghostSize)) == LevelSystem::WALL) {
returnDirection = Vector2i(newDirections[1]);
}
else {
returnDirection = returnDirection * -1;
}
}
}
return returnDirection;
}
}
} | 30.466102 | 115 | 0.680111 | CarlosMiraGarcia |
0dd06ac6c8470055e16435adce6c34910f1a20e5 | 147 | cpp | C++ | fArco.cpp | mikymaione/KCammini | 50c3c3601fa937c340effa675847f54d3f31f83b | [
"MIT"
] | 1 | 2019-10-28T13:53:28.000Z | 2019-10-28T13:53:28.000Z | fArco.cpp | mikymaione/KCammini | 50c3c3601fa937c340effa675847f54d3f31f83b | [
"MIT"
] | null | null | null | fArco.cpp | mikymaione/KCammini | 50c3c3601fa937c340effa675847f54d3f31f83b | [
"MIT"
] | null | null | null | /*
* File: fArco.cpp
* Author: Michele
*
* Created on 27 luglio 2015, 15.07
*/
#include "fArco.h"
fArco::fArco()
{
ui.setupUi(this);
} | 11.307692 | 35 | 0.585034 | mikymaione |
0dd3affa561d35d1136c891171c922d1c3c29fb2 | 3,370 | cc | C++ | src/application/singlestream/Application.cc | nicmcd/slimsupersim | f73ce6b01fb7723e835665c55d45b8e582a6ba4e | [
"Apache-2.0"
] | null | null | null | src/application/singlestream/Application.cc | nicmcd/slimsupersim | f73ce6b01fb7723e835665c55d45b8e582a6ba4e | [
"Apache-2.0"
] | null | null | null | src/application/singlestream/Application.cc | nicmcd/slimsupersim | f73ce6b01fb7723e835665c55d45b8e582a6ba4e | [
"Apache-2.0"
] | null | null | null | /*
* Copyright 2016 Hewlett Packard Enterprise Development LP
*
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "application/singlestream/Application.h"
#include <cassert>
#include <vector>
#include "application/singlestream/StreamTerminal.h"
#include "event/Simulator.h"
#include "network/Network.h"
namespace SingleStream {
Application::Application(const std::string& _name, const Component* _parent,
MetadataHandler* _metadataHandler,
Json::Value _settings)
: ::Application(_name, _parent, _metadataHandler, _settings),
doMonitoring_(true) {
// the index of the pair of communicating terminals
s32 src = _settings["source_terminal"].asInt();
if (src < 0) {
sourceTerminal_ = gSim->rnd.nextU64(0, numTerminals() - 1);
} else {
sourceTerminal_ = src;
}
dbgprintf("source terminal is %u", sourceTerminal_);
s32 dst = _settings["destination_terminal"].asInt();
if (dst < 0) {
do {
destinationTerminal_ = gSim->rnd.nextU64(0, numTerminals() - 1);
} while ((numTerminals() != 1) &&
(destinationTerminal_ == sourceTerminal_));
} else {
destinationTerminal_ = dst;
}
dbgprintf("destination terminal is %u", destinationTerminal_);
assert(sourceTerminal_ < numTerminals());
assert(destinationTerminal_ < numTerminals());
// all terminals are the same
for (u32 t = 0; t < numTerminals(); t++) {
std::string tname = "Terminal_" + std::to_string(t);
std::vector<u32> address;
gSim->getNetwork()->translateIdToAddress(t, &address);
StreamTerminal* terminal = new StreamTerminal(
tname, this, t, address, this, _settings["terminal"]);
setTerminal(t, terminal);
}
}
Application::~Application() {}
f64 Application::percentComplete() const {
StreamTerminal* t = reinterpret_cast<StreamTerminal*>(
getTerminal(destinationTerminal_));
return t->percentComplete();
}
u32 Application::getSource() const {
return sourceTerminal_;
}
u32 Application::getDestination() const {
return destinationTerminal_;
}
void Application::receivedFirst(u32 _id) {
dbgprintf("receivedFirst(%u)", _id);
assert(_id == destinationTerminal_);
// upon first received, start monitoring
printf("starting monitoring\n");
if (doMonitoring_) {
gSim->startMonitoring();
}
}
void Application::sentLast(u32 _id) {
dbgprintf("sentLast(%u)", _id);
assert(_id == sourceTerminal_);
// after last sent message, stop monitoring
printf("ending monitoring\n");
if (gSim->getMonitoring() == false) {
doMonitoring_ = false;
printf("*** monitoring attempted to end before starting.\n"
"*** you need to have a larger num_messages value.\n"
"*** simulation will continue without monitoring.\n");
} else {
gSim->endMonitoring();
}
}
} // namespace SingleStream
| 30.636364 | 76 | 0.689911 | nicmcd |
0dd83497440071a37d3959b721008b3782f0b2dd | 631 | hpp | C++ | include/Keyboard.hpp | EmilyEclipse/Breakout | 9a5ef518464e02d6cb1f39e4c3011d52ec62fef2 | [
"MIT"
] | null | null | null | include/Keyboard.hpp | EmilyEclipse/Breakout | 9a5ef518464e02d6cb1f39e4c3011d52ec62fef2 | [
"MIT"
] | 2 | 2020-12-26T10:46:31.000Z | 2021-01-28T19:25:22.000Z | include/Keyboard.hpp | EmilyEclipse/Breakout | 9a5ef518464e02d6cb1f39e4c3011d52ec62fef2 | [
"MIT"
] | null | null | null | #ifndef KEYBOARD_HPP
#define KEYBOARD_HPP
#include <SDL2/SDL.h>
#include "Paddle.hpp"
class Keyboard
{
public:
static void handleInput();
static void setPaddle(Paddle* paddle);
class Key{
public:
Key(int inputScancode){
scancode = inputScancode;
state_p = &keyboardState[scancode];
}
Uint8 getState(){
return *state_p;
}
private:
Uint8 scancode;
const Uint8* state_p;
};
private:
static Paddle* paddle;
static const Uint8* keyboardState;
};
#endif //KEYBOARD_HPP | 19.71875 | 51 | 0.561014 | EmilyEclipse |
0dd8fa7ef4bf829f60fe332290190cad11a36a76 | 32,717 | hpp | C++ | include/nil/crypto3/zk/snark/schemes/ppzksnark/r1cs_gg_ppzksnark/ipp2/prove.hpp | NoamDev/crypto3-zk | 5f03e49b737994a3cecf673b029a4e32a2a8aaa5 | [
"MIT"
] | null | null | null | include/nil/crypto3/zk/snark/schemes/ppzksnark/r1cs_gg_ppzksnark/ipp2/prove.hpp | NoamDev/crypto3-zk | 5f03e49b737994a3cecf673b029a4e32a2a8aaa5 | [
"MIT"
] | null | null | null | include/nil/crypto3/zk/snark/schemes/ppzksnark/r1cs_gg_ppzksnark/ipp2/prove.hpp | NoamDev/crypto3-zk | 5f03e49b737994a3cecf673b029a4e32a2a8aaa5 | [
"MIT"
] | null | null | null | //---------------------------------------------------------------------------//
// Copyright (c) 2018-2020 Mikhail Komarov <nemo@nil.foundation>
// Copyright (c) 2020 Nikita Kaskov <nbering@nil.foundation>
//
// MIT License
//
// 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 CRYPTO3_R1CS_GG_PPZKSNARK_IPP2_PROVE_HPP
#define CRYPTO3_R1CS_GG_PPZKSNARK_IPP2_PROVE_HPP
#include <algorithm>
#include <memory>
#include <vector>
#include <tuple>
#include <boost/iterator/zip_iterator.hpp>
#include <nil/crypto3/detail/pack_numeric.hpp>
#include <nil/crypto3/hash/algorithm/hash.hpp>
#include <nil/crypto3/hash/sha2.hpp>
#include <nil/crypto3/algebra/multiexp/multiexp.hpp>
#include <nil/crypto3/algebra/multiexp/policies.hpp>
#include <nil/crypto3/zk/snark/schemes/ppzksnark/r1cs_gg_ppzksnark/ipp2/proof.hpp>
#include <nil/crypto3/zk/snark/schemes/ppzksnark/r1cs_gg_ppzksnark/ipp2/srs.hpp>
namespace nil {
namespace crypto3 {
namespace zk {
namespace snark {
/// Returns the vector used for the linear combination fo the inner pairing product
/// between A and B for the Groth16 aggregation: A^r * B. It is required as it
/// is not enough to simply prove the ipp of A*B, we need a random linear
/// combination of those.
template<typename FieldType>
std::vector<typename FieldType::value_type>
structured_scalar_power(std::size_t num, const typename FieldType::value_type &s) {
std::vector<typename FieldType::value_type> powers = {FieldType::value_type::one()};
for (int i = 1; i < num; i++) {
powers.emplace_back(powers[i - 1] * s);
}
return powers;
}
/// compress is similar to commit::{V,W}KEY::compress: it modifies the `vec`
/// vector by setting the value at index $i:0 -> split$ $vec[i] = vec[i] +
/// vec[i+split]^scaler$. The `vec` vector is half of its size after this call.
template<typename CurveAffine>
void compress(std::vector<typename CurveAffine::value_type> &vec, std::size_t split,
const typename CurveAffine::scalar &scaler) {
std::vector<typename CurveAffine::value_type> left = {vec.begin(), vec.begin() + split},
right = {vec.begin() + split, vec.end()};
std::for_each(boost::make_zip_iterator(std::make_tuple(left.begin(), right.begin())),
boost::make_zip_iterator(std::make_tuple(left.end(), right.end())),
[&](const std::tuple<const typename CurveAffine::value_type &,
const typename CurveAffine::value_type &> &t) {
auto x = std::get<1>(t).to_projective() * scaler;
x += std::get<0>(t);
std::get<0>(t) = x.to_affine();
});
vec.resize(left.size());
}
/// Aggregate `n` zkSnark proofs, where `n` must be a power of two.
template<typename CurveType, typename InputProofIterator, typename Hash = hashes::sha2<256>>
typename std::enable_if<std::is_same<typename std::iterator_traits<InputProofIterator>::value_type,
r1cs_gg_ppzksnark_aggregate_proof<CurveType>>::value,
r1cs_gg_ppzksnark_aggregate_proof<CurveType>>::type
aggregate_proofs(const r1cs_gg_ppzksnark_proving_srs<CurveType> &srs, InputProofIterator first,
InputProofIterator last) {
std::size_t size = std::distance(first, last);
BOOST_ASSERT((size & (size - 1)) == 0);
BOOST_ASSERT(srs.valid(size));
std::vector<typename CurveType::g1_type::value_type> a, c;
std::vector<typename CurveType::g2_type::value_type> b;
// We first commit to A B and C - these commitments are what the verifier
// will use later to verify the TIPP and MIPP proofs
while (first != last) {
a.emplace_back(*first.g_A);
b.emplace_back(*first.g_B);
c.emplace_back(*first.g_C);
++first;
}
// A and B are committed together in this scheme
// we need to take the reference so the macro doesn't consume the value
// first
r1cs_gg_ppzksnark_ipp2_commitment_output<CurveType> com_ab =
r1cs_gg_ppzksnark_ipp2_commitment<CurveType>::pair(srs.vkey, srs.wkey, a.begin(), a.end(),
b.begin(), b.end());
r1cs_gg_ppzksnark_ipp2_commitment_output<CurveType> com_c =
r1cs_gg_ppzksnark_ipp2_commitment<CurveType>::pair(srs.vkey, c.begin(), c.end());
// Random linear combination of proofs
std::size_t counter_nonce = 1;
std::array<std::uint8_t, sizeof(std::size_t)> counter_nonce_bytes;
detail::pack<stream_endian::big_byte_big_bit>({counter_nonce}, counter_nonce_bytes);
accumulator_set<Hash> acc;
hash<Hash>(counter_nonce_bytes, acc);
hash<Hash>(std::get<0>(com_ab), acc);
hash<Hash>(std::get<1>(com_ab), acc);
hash<Hash>(std::get<0>(com_c), acc);
hash<Hash>(std::get<1>(com_c), acc);
typename Hash::digest_type d = accumulators::extract::hash<Hash>(acc);
typename CurveType::scalar_field_type::value_type r;
detail::pack(d, r.data);
r = r.inversed();
// r, r^2, r^3, r^4 ...
std::vector<typename CurveType::scalar_field_type::value_type> r_vec =
structured_scalar_power<typename CurveType::scalar_field_type>(std::distance(first, last), r);
// r^-1, r^-2, r^-3
std::vector<typename CurveType::scalar_field_type::value_type> r_inv;
for (const typename CurveType::scalar_field_type::value_type &ri : r_vec) {
r_inv.emplace_back(ri.inversed());
}
// B^{r}
std::vector<typename CurveType::scalar_field_type::value_type> b_r;
std::for_each(boost::make_zip_iterator(std::make_tuple(b.begin(), r_vec.begin())),
boost::make_zip_iterator(std::make_tuple(b.end(), r_vec.end())),
[&](const std::tuple<const typename CurveType::g2_type::value_type &,
const typename CurveType::scalar_field_type::value_type &> &t) {
b_r.emplace_back((std::get<0>(t).to_projective() * std::get<1>(t)).to_affine());
});
// w^{r^{-1}}
auto wkey_r_inv = srs.wkey.scale(r_inv);
// we prove tipp and mipp using the same recursive loop
tipp_mipp_proof<CurveType> proof =
prove_tipp_mipp(srs, wkey_r_inv, a.begin(), a.end(), b_r.begin(), b_r.end(), c.begin(), c.end(),
r_vec.begin(), r_vec.end());
// compute A * B^r for the verifier
auto ip_ab = algebra::pair<CurveType>(a, b_r);
// compute C^r for the verifier
auto agg_c = algebra::multiexp<algebra::policies::multiexp_method_bos_coster>(c, r_vec);
// debug assert
auto computed_com_ab = r1cs_gg_ppzksnark_ipp2_commitment<CurveType>::pair(
srs.vkey, wkey_r_inv, a.begin(), a.end(), b_r.begin(), b_r.end());
BOOST_ASSERT(com_ab == computed_com_ab);
return {com_ab, com_c, ip_ab, agg_c, proof};
}
/// Proves a TIPP relation between A and B as well as a MIPP relation with C and
/// r. Commitment keys must be of size of A, B and C. In the context of Groth16
/// aggregation, we have that B = B^r and wkey is scaled by r^{-1}. The
/// commitment key v is used to commit to A and C recursively in GIPA such that
/// only one KZG proof is needed for v. In the original paper version, since the
/// challenges of GIPA would be different, two KZG proofs would be needed.
template<typename CurveType, typename InputG1Iterator, typename InputG2Iterator,
typename InputScalarIterator, typename Hash = hashes::sha2<256>>
tipp_mipp_proof<CurveType> prove_tipp_mipp(const r1cs_gg_ppzksnark_proving_srs<CurveType> &srs,
const r1cs_gg_ppzksnark_ipp2_wkey<CurveType> &wkey,
InputG1Iterator afirst, InputG1Iterator alast,
InputG2Iterator bfirst, InputG2Iterator blast,
InputG1Iterator cfirst, InputG1Iterator clast,
InputScalarIterator rfirst, InputScalarIterator rlast) {
std::size_t asize = std::distance(afirst, alast);
std::size_t bsize = std::distance(bfirst, blast);
BOOST_ASSERT((asize & (asize - 1)) == 0 || asize == bsize);
typename std::iterator_traits<InputScalarIterator>::value_type r_shift = *rfirst + 1;
// Run GIPA
std::tuple<gipa_proof<CurveType>, std::vector<typename CurveType::scalar_field_type::value_type>,
std::vector<typename CurveType::scalar_field_type::value_type>>
gtm =
gipa_tipp_mipp(afirst, alast, bfirst, blast, cfirst, clast, rfirst, rlast, srs.vkey, wkey);
// Prove final commitment keys are wellformed
// we reverse the transcript so the polynomial in kzg opening is constructed
// correctly - the formula indicates x_{l-j}. Also for deriving KZG
// challenge point, input must be the last challenge.
std::reverse(std::get<1>(gtm).begin(), std::get<1>(gtm).end());
std::reverse(std::get<2>(gtm).begin(), std::get<2>(gtm).end());
typename std::iterator_traits<InputScalarIterator>::value_type r_inverse = r_shift.inverse();
// KZG challenge point
std::size_t counter_nonce = 1;
std::array<std::uint8_t, sizeof(std::size_t)> counter_nonce_bytes;
detail::pack<stream_endian::big_byte_big_bit>({counter_nonce}, counter_nonce_bytes);
accumulator_set<Hash> acc;
hash<Hash>(counter_nonce_bytes, acc);
hash<Hash>(*std::get<1>(gtm).begin(), acc);
hash<Hash>(std::get<0>(std::get<0>(gtm).final_vkey), acc);
hash<Hash>(std::get<1>(std::get<0>(gtm).final_vkey), acc);
hash<Hash>(std::get<0>(std::get<0>(gtm).final_wkey), acc);
hash<Hash>(std::get<1>(std::get<0>(gtm).final_wkey), acc);
typename Hash::digest_type d = accumulators::extract::hash<Hash>(acc);
typename CurveType::scalar_field_type::value_type z;
multiprecision::import_bits(z.data, d);
z = z.inversed();
// Complete KZG proofs
kzg_opening<typename CurveType::g2_type> vkey_opening = prove_commitment_key_kzg_opening(
srs.h_alpha_powers_table, srs.h_beta_powers_table, srs.n, std::get<2>(gtm),
CurveType::scalar_field_type::value_type::one(), z);
kzg_opening<typename CurveType::g1_type> wkey_opening = prove_commitment_key_kzg_opening(
srs.g_alpha_powers_table, srs.g_beta_powers_table, srs.n, std::get<1>(gtm), r_inverse, z);
return {std::get<0>(gtm), vkey_opening, wkey_opening};
}
/*
* @brief gipa_tipp_mipp peforms the recursion of the GIPA protocol for TIPP and MIPP.
* It returns a proof containing all intermdiate committed values, as well as
* the challenges generated necessary to do the polynomial commitment proof
* later in TIPP.
* @param wkey scaled key w^r^-1
*/
template<typename CurveType, typename InputG1Iterator, typename InputG2Iterator,
typename InputScalarIterator, typename Hash = hashes::sha2<256>>
std::tuple<gipa_proof<CurveType>, std::vector<typename CurveType::scalar_field_type::value_type>,
std::vector<typename CurveType::scalar_field_type::value_type>>
gipa_tipp_mipp(InputG1Iterator afirst, InputG1Iterator alast, InputG2Iterator bfirst,
InputG2Iterator blast, InputG1Iterator cfirst, InputG1Iterator clast,
InputScalarIterator rfirst, InputScalarIterator rlast,
const r1cs_gg_ppzksnark_ipp2_vkey<CurveType> &vkey,
const r1cs_gg_ppzksnark_ipp2_wkey<CurveType> &wkey) {
std::vector<typename std::iterator_traits<InputG1Iterator>::value_type> m_a = {afirst, alast},
m_c = {cfirst, clast};
std::vector<typename std::iterator_traits<InputG2Iterator>::value_type> m_b = {bfirst, blast};
std::vector<typename std::iterator_traits<InputScalarIterator>::value_type> m_r = {rfirst, rlast};
r1cs_gg_ppzksnark_ipp2_vkey<CurveType> vkey = vkey;
r1cs_gg_ppzksnark_ipp2_wkey<CurveType> wkey = wkey;
// storing the values for including in the proof
std::vector<std::tuple<typename r1cs_gg_ppzksnark_ipp2_commitment<CurveType>::output_type,
typename r1cs_gg_ppzksnark_ipp2_commitment<CurveType>::output_type>>
comms_ab;
std::vector<std::tuple<typename r1cs_gg_ppzksnark_ipp2_commitment<CurveType>::output_type,
typename r1cs_gg_ppzksnark_ipp2_commitment<CurveType>::output_type>>
comms_c;
std::vector<typename CurveType::pairing::gt_type::value_type> z_ab;
std::vector<typename std::iterator_traits<InputG1Iterator>::value_type> z_c;
std::vector<typename CurveType::scalar_field_type::value_type> challenges, challenges_inv;
while (m_a.size() > 1) {
// recursive step
// Recurse with problem of half size
std::size_t split = m_a.size() / 2;
// TIPP ///
std::vector<typename std::iterator_traits<InputG1Iterator>::value_type>
a_left = {m_a.begin(), m_a.begin() + split},
a_right = {m_a.begin() + split, m_a.end()};
std::vector<typename std::iterator_traits<InputG2Iterator>::value_type>
b_left = {m_b.begin(), m_b.begin() + split},
b_right = {m_b.begin() + split, m_b.end()};
// MIPP ///
// c[:n'] c[n':]
std::vector<typename std::iterator_traits<InputG1Iterator>::value_type>
c_left = {m_c.begin() + m_c.begin() + split},
c_right = {m_c.begin() + split, m_c.end()};
// r[:n'] r[:n']
std::vector<typename std::iterator_traits<InputScalarIterator>::value_type>
r_left = {m_r.begin(), m_r.begin() + split},
r_right = {m_r.begin() + split, m_r.end()};
r1cs_gg_ppzksnark_ipp2_vkey<CurveType> vk_left = {{vkey.a.begin(), vkey.a.begin() + split},
{vkey.b.begin(), vkey.b.begin() + split}},
vk_right = {{vkey.a.begin() + split, vkey.a.end()},
{vkey.b.begin() + split, vkey.b.end()}};
r1cs_gg_ppzksnark_ipp2_wkey<CurveType> wk_left = {{wkey.a.begin(), wkey.a.begin() + split},
{wkey.b.begin(), wkey.b.begin() + split}},
wk_right = {{wkey.a.begin() + split, wkey.a.end()},
{wkey.b.begin() + split, wkey.b.end()}};
// See section 3.3 for paper version with equivalent names
typename r1cs_gg_ppzksnark_ipp2_commitment<CurveType>::output_type tab_l =
r1cs_gg_ppzksnark_ipp2_commitment<CurveType>::pair(vk_left, wk_right, a_right, b_left);
typename r1cs_gg_ppzksnark_ipp2_commitment<CurveType>::output_type tab_r =
r1cs_gg_ppzksnark_ipp2_commitment<CurveType>::pair(vk_right, wk_left, a_left, b_right);
// TIPP part
typename CurveType::pairing::gt_type::value_type zab_l =
algebra::pair<CurveType>(a_right, b_left);
typename CurveType::pairing::gt_type::value_type zab_r =
algebra::pair<CurveType>(a_left, b_right);
// MIPP part
// z_l = c[n':] ^ r[:n']
typename std::iterator_traits<InputG1Iterator>::value_type zc_l =
algebra::multiexp<algebra::policies::multiexp_method_bos_coster>(c_right, r_left);
// Z_r = c[:n'] ^ r[n':]
typename std::iterator_traits<InputG1Iterator>::value_type zc_r =
algebra::multiexp<algebra::policies::multiexp_method_bos_coster>(c_left, r_right);
// u_l = c[n':] * v[:n']
typename r1cs_gg_ppzksnark_ipp2_commitment<CurveType>::output_type tuc_l =
r1cs_gg_ppzksnark_ipp2_commitment<CurveType>::pair(vk_left, c_right);
// u_r = c[:n'] * v[n':]
typename r1cs_gg_ppzksnark_ipp2_commitment<CurveType>::output_type tuc_r =
r1cs_gg_ppzksnark_ipp2_commitment<CurveType>::pair(vk_right, c_left);
// Fiat-Shamir challenge
typename CurveType::scalar_field_type::value_type default_transcript =
CurveType::scalar_field_type::value_type::zero();
auto transcript = challenges.empty() ? default_transcript : *(challenges.end() - 1);
// combine both TIPP and MIPP transcript
std::size_t counter_nonce = 1;
std::array<std::uint8_t, sizeof(std::size_t)> counter_nonce_bytes;
detail::pack<stream_endian::big_byte_big_bit>({counter_nonce}, counter_nonce_bytes);
accumulator_set<Hash> acc;
hash<Hash>(counter_nonce_bytes, acc);
hash<Hash>(transcript, acc);
hash<Hash>(std::get<0>(tab_l), acc);
hash<Hash>(std::get<1>(tab_l), acc);
hash<Hash>(std::get<0>(tab_r), acc);
hash<Hash>(std::get<1>(tab_r), acc);
hash<Hash>(zab_l, acc);
hash<Hash>(zab_r, acc);
hash<Hash>(zc_l, acc);
hash<Hash>(zc_r, acc);
hash<Hash>(std::get<0>(tuc_l), acc);
hash<Hash>(std::get<1>(tuc_l), acc);
hash<Hash>(std::get<0>(tuc_r), acc);
hash<Hash>(std::get<1>(tuc_r), acc);
typename hashes::sha2<256>::digest_type d = accumulators::extract::hash<hashes::sha2<256>>(acc);
typename CurveType::scalar_field_type::value_type c_inv;
detail::pack(d, c_inv.data);
c_inv = c_inv.inversed();
// Optimization for multiexponentiation to rescale G2 elements with
// 128-bit challenge Swap 'c' and 'c_inv' since can't control bit size
// of c_inv
typename CurveType::scalar_field_type::value_type c = c_inv.inversed();
// Set up values for next step of recursion
// A[:n'] + A[n':] ^ x
compress(m_a, split, c);
// B[:n'] + B[n':] ^ x^-1
compress(m_b, split, c_inv);
// c[:n'] + c[n':]^x
compress(m_c, split, c);
std::for_each(
boost::make_zip_iterator(std::make_tuple(r_left.begin(), r_right.begin())),
boost::make_zip_iterator(std::make_tuple(r_left.end(), r_right.end())),
[&](const std::tuple<typename std::iterator_traits<InputScalarIterator>::value_type &,
typename std::iterator_traits<InputScalarIterator>::value_type &> &t) {
// r[:n'] + r[n':]^x^-1
std::get<1>(t) *= c_inv;
std::get<0>(t) += std::get<1>(t);
});
std::size_t len = r_left.size();
m_r.resize(len); // shrink to new size
// v_left + v_right^x^-1
vkey = vk_left.compress(vk_right, c_inv);
// w_left + w_right^x
wkey = wk_left.compress(wk_right, c);
comms_ab.emplace_back({tab_l, tab_r});
comms_c.emplace_back({tuc_l, tuc_r});
z_ab.emplace_back({zab_l, zab_r});
z_c.emplace_back({zc_l, zc_r});
challenges.emplace_back(c);
challenges_inv.emplace_back(c_inv);
}
BOOST_ASSERT(m_a.size() == 1 && m_b.size() == 1);
BOOST_ASSERT(m_c.size() == 1 && m_r.size() == 1);
BOOST_ASSERT(vkey.a.size() == 1 && vkey.b.size() == 1);
BOOST_ASSERT(wkey.a.size() == 1 && wkey.b.size() == 1);
return std::make_tuple({a.size(), comms_ab, comms_c, z_ab, z_c, m_a[0], m_b[0], m_c[0], m_r[0],
*vkey.begin(), *wkey.begin()},
challenges, challenges_inv);
}
/// It returns the evaluation of the polynomial $\prod (1 + x_{l-j}(rX)^{2j}$ at
/// the point z, where transcript contains the reversed order of all challenges (the x).
/// The challenges must be in reversed order for the correct evaluation of the
/// polynomial in O(logn)
template<typename FieldType, typename InputFieldValueIterator>
typename std::enable_if<std::is_same<typename std::iterator_traits<InputFieldIterator>::value_type,
typename FieldType::value_type>::value,
typename FieldType::value_type>::type
polynomial_evaluation_product_form_from_transcript(InputFieldValueIterator transcript_first,
InputFieldValueIterator transcript_last,
const typename FieldType::value_type &z,
const typename FieldType::value_type &r_shift) {
// this is the term (rz) that will get squared at each step to produce the
// $(rz)^{2j}$ of the formula
typename FieldType::value_type power_zr = z;
power_zr *= r_shift;
// 0 iteration
typename FieldType::value_type res =
FieldType::value_type::one() + (*transcript_first * power_zr);
power_zr *= power_zr;
++transcript_first;
// the rest
while (transcript_first != transcript_last) {
res *= FieldType::value_type::one() + (*transcript_first * power_zr);
power_zr *= power_zr;
++transcript_first;
}
return res;
}
// Compute the coefficients of the polynomial $\prod_{j=0}^{l-1} (1 + x_{l-j}(rX)^{2j})$
// It does this in logarithmic time directly; here is an example with 2
// challenges:
//
// We wish to compute $(1+x_1ra)(1+x_0(ra)^2) = 1 + x_1ra + x_0(ra)^2 + x_0x_1(ra)^3$
// Algorithm: $c_{-1} = [1]$; $c_j = c_{i-1} \| (x_{l-j} * c_{i-1})$; $r = r*r$
// $c_0 = c_{-1} \| (x_1 * r * c_{-1}) = [1] \| [rx_1] = [1, rx_1]$, $r = r^2$
// $c_1 = c_0 \| (x_0 * r^2c_0) = [1, rx_1] \| [x_0r^2, x_0x_1r^3] = [1, x_1r, x_0r^2, x_0x_1r^3]$
// which is equivalent to $f(a) = 1 + x_1ra + x_0(ra)^2 + x_0x_1r^2a^3$
//
// This method expects the coefficients in reverse order so transcript[i] =
// x_{l-j}.
template<typename FieldType, typename InputFieldValueIterator>
typename std::enable_if<std::is_same<typename std::iterator_traits<InputFieldValueIterator>::value_type,
typename FieldType::value_type>::value,
std::vector<typename FieldType::value_type>>::type
polynomial_coefficients_from_transcript(InputFieldValueIterator transcript_first,
InputFieldValueIterator transcript_last,
const typename FieldType::value_type &r_shift) {
std::vector<typename FieldType::value_type> coefficients = {FieldType::value_type::one()};
typename FieldType::value_type power_2_r = r_shift;
while (transcript_first != transcript_last) {
std::size_t n = coefficients.size();
for (int j = 0; j < n; j++) {
coefficients.emplace_back(coefficients[j] * (*transcript_first * power_2_r));
}
power_2_r *= power_2_r;
++transcript_first;
}
return coefficients;
}
/// Returns the KZG opening proof for the given commitment key. Specifically, it
/// returns $g^{f(alpha) - f(z) / (alpha - z)}$ for $a$ and $b$.
template<typename CurveAffine, typename InputScalarIterator>
kzg_opening<CurveAffine> prove_commitment_key_kzg_opening(
MultiscalarPrecomp<CurveAffine> &srs_powers_alpha_table,
MultiscalarPrecomp<CurveAffine> &srs_powers_beta_table, std::size_t srs_powers_len,
InputScalarIterator transcript_first, InputScalarIterator transcript_last,
const typename std::iterator_traits<InputScalarIterator>::value_type &r_shift,
const typename std::iterator_traits<InputScalarIterator>::value_type &kzg_challenge) {
// f_v
DensePolynomial vkey_poly(
polynomial_coefficients_from_transcript(transcript_first, transcript_last, r_shift));
BOOST_ASSERT_MSG(srs_powers_len != vkey_poly.coeffs().size(), "Malformed SRS");
// f_v(z)
std::vector<typename std::iterator_traits<InputScalarIterator>::value_type> vkey_poly_z =
polynomial_evaluation_product_form_from_transcript(transcript_first, transcript_last,
kzg_challenge, r_shift);
typename std::iterator_traits<InputScalarIterator>::value_type neg_kzg_challenge =
kzg_challenge.negate();
// f_v(X) - f_v(z) / (X - z)
DensePolynomial quotient_polynomial =
(vkey_poly - DensePolynomial(vkey_poly_z)) /
(DensePolynomial({neg_kzg_challenge,
std::iterator_traits<InputScalarIterator>::value_type::one()}));
std::vector<typename std::iterator_traits<InputScalarIterator>::value_type>
quotient_polynomial_coeffs = quotient_polynomial.into_coeffs();
// multiexponentiation inner_product, inlined to optimize
std::size_t quotient_polynomial_coeffs_len = quotient_polynomial_coeffs.size();
auto getter = [&](std::size_t i) -> typename CurveAffine::scalar_field_type::value_type {
return i >= quotient_polynomial_coeffs_len ?
std::iterator_traits<InputScalarIterator>::value_type::zero() :
quotient_polynomial_coeffs[i];
};
}
} // namespace snark
} // namespace zk
} // namespace crypto3
} // namespace nil
#endif // CRYPTO3_R1CS_GG_PPZKSNARK_TYPES_POLICY_HPP
| 62.917308 | 120 | 0.511783 | NoamDev |
0dda6b731d1eea56fa30cfc06950916b486e0106 | 4,095 | cpp | C++ | homework4/rb-tree/rb-tree.cpp | hermesespinola/algorithms | 903328171af2e909dd1f5e33712e442c5d74567a | [
"Apache-2.0"
] | null | null | null | homework4/rb-tree/rb-tree.cpp | hermesespinola/algorithms | 903328171af2e909dd1f5e33712e442c5d74567a | [
"Apache-2.0"
] | null | null | null | homework4/rb-tree/rb-tree.cpp | hermesespinola/algorithms | 903328171af2e909dd1f5e33712e442c5d74567a | [
"Apache-2.0"
] | null | null | null | #include <iostream>
#include <random>
#include <limits.h>
#include <cmath>
#include <time.h>
using namespace std;
bool RED = 0;
bool BLACK = 1;
struct rbnode {
int key;
rbnode *p;
rbnode *left;
rbnode *right;
bool color;
rbnode(int k) {
key = k;
left = right = p = NULL;
color = RED;
}
rbnode() {
left = right = p = NULL;
color = BLACK;
}
};
class RedBlackTree {
private:
int size;
rbnode *root;
rbnode *nil;
public:
RedBlackTree() {
this->size = 0;
this->nil = new rbnode();
this->root = this->nil;
this->nil->p = this->nil;
}
int get_size() {
return this->size;
}
void print_inorder_inverse() {
print_inorder_inverse(this->root, 1);
}
void print_inorder_inverse(rbnode *node, int mult) {
if(node->right != NULL) {
print_inorder_inverse(node->right, mult+1);
}
for(int i = 1; i < mult; i++) {
cout << "\t";
}
cout << "[" << node->key << ", ";
if(node->color) {
cout << "B";
}
else cout << "R";
cout << "]" << endl;
if(node->left != NULL) {
print_inorder_inverse(node->left, mult+1);
}
}
void insert(int key) {
rbnode *z = new rbnode(key);
rbnode *y = this->nil;
rbnode *x = this->root;
while(x != this->nil) {
y = x;
if(z->key < x->key)
x = x->left;
else
x = x->right;
}
z->p = y;
if(y == this->nil) {
this->root = z;
}
else if(z->key < y->key)
y->left = z;
else
y->right = z;
z->left = this->nil;
z->right = this->nil;
z->color = RED;
this->size++;
rb_insert_fixup(z);
}
void left_rotate(rbnode *x) {
rbnode *y = x->right;
x->right = y->left;
if(y->left != this->nil) {
y->left->p = x;
}
y->p = x->p;
if(x->p == this->nil) {
this->root = y;
}
else if(x == x->p->left) {
x->p->left = y;
}
else {
x->p->right = y;
}
y->left = x;
x->p = y;
}
void right_rotate(rbnode *x) {
rbnode *y = x->left;
x->left = y->right;
if(y->right != this->nil) {
y->right->p = x;
}
y->p = x->p;
if(x->p == this->nil) {
this->root = y;
}
else if(x == x->p->right) {
x->p->right = y;
}
else {
x->p->left = y;
}
y->right = x;
x->p = y;
}
void rb_insert_fixup(rbnode *z) {
rbnode *y;
while(z->p->color == RED) {
if(z->p == z->p->p->left) {
y = z->p->p->right;
if(y->color == RED) {
z->p->color = BLACK;
y->color = BLACK;
z->p->p->color = RED;
z = z->p->p;
}
else {
if(z == z->p->right) {
z = z->p;
left_rotate(z);
}
z->p->color = BLACK;
z->p->p->color = RED;
right_rotate(z->p->p);
}
}
else {
y = z->p->p->left;
if(y->color == RED) {
z->p->color = BLACK;
y->color = BLACK;
z->p->p->color = RED;
z = z->p->p;
}
else {
if(z == z->p->left) {
z = z->p;
right_rotate(z);
}
z->p->color = BLACK;
z->p->p->color = RED;
left_rotate(z->p->p);
}
}
}
this->root->color = BLACK;
}
};
void generate_random_array(int *a, int n, bool silence) {
random_device rd;
mt19937 gen(rd());
uniform_int_distribution<> dis(1,100);
for(int i = 0; i < n; i++){
a[i] = dis(gen);
if(!silence)
cout << a[i] << " ";
}
if(!silence)
cout << endl;
}
int main() {
cout << "RBTreeTime = [" << endl;
for (int n = 1; n < 10000; n ++) {
int values[n];
generate_random_array(values, n, true);
// Start timer
clock_t start = clock();
RedBlackTree *tree = new RedBlackTree();
for (int i = 0; i < n; i++) {
tree->insert(values[i]);
}
// stop timer
cout << n << ' ' << clock() - start << ' ' << log(n) / log(2) << ';' << endl;
delete(tree);
}
cout << "];" << endl;
return 0;
}
| 18.784404 | 81 | 0.445421 | hermesespinola |
0ddb91d059af2569ad63df072bd714533dad8a2a | 7,913 | cpp | C++ | blades/xbmc/xbmc/cores/dvdplayer/DVDClock.cpp | krattai/AEBL | a7b12c97479e1236d5370166b15ca9f29d7d4265 | [
"BSD-2-Clause"
] | 4 | 2016-04-26T03:43:54.000Z | 2016-11-17T08:09:04.000Z | blades/xbmc/xbmc/cores/dvdplayer/DVDClock.cpp | krattai/AEBL | a7b12c97479e1236d5370166b15ca9f29d7d4265 | [
"BSD-2-Clause"
] | 17 | 2015-01-05T21:06:22.000Z | 2015-12-07T20:45:44.000Z | blades/xbmc/xbmc/cores/dvdplayer/DVDClock.cpp | krattai/AEBL | a7b12c97479e1236d5370166b15ca9f29d7d4265 | [
"BSD-2-Clause"
] | 3 | 2016-04-26T03:43:55.000Z | 2020-11-06T11:02:08.000Z | /*
* Copyright (C) 2005-2013 Team XBMC
* http://xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XBMC; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*
*/
#include "DVDClock.h"
#include "video/VideoReferenceClock.h"
#include <math.h>
#include "utils/MathUtils.h"
#include "threads/SingleLock.h"
#include "utils/log.h"
int64_t CDVDClock::m_systemOffset;
int64_t CDVDClock::m_systemFrequency;
CCriticalSection CDVDClock::m_systemsection;
CDVDClock *CDVDClock::m_playerclock = NULL;
CDVDClock::CDVDClock()
: m_master(MASTER_CLOCK_NONE)
{
CSingleLock lock(m_systemsection);
CheckSystemClock();
m_systemUsed = m_systemFrequency;
m_pauseClock = 0;
m_bReset = true;
m_iDisc = 0;
m_maxspeedadjust = 0.0;
m_lastSystemTime = g_VideoReferenceClock.GetTime();
m_systemAdjust = 0;
m_speedAdjust = 0;
m_startClock = 0;
m_playerclock = this;
}
CDVDClock::~CDVDClock()
{
CSingleLock lock(m_systemsection);
m_playerclock = NULL;
}
// Returns the current absolute clock in units of DVD_TIME_BASE (usually microseconds).
double CDVDClock::GetAbsoluteClock(bool interpolated /*= true*/)
{
CSingleLock lock(m_systemsection);
CheckSystemClock();
int64_t current;
current = g_VideoReferenceClock.GetTime(interpolated);
#if _DEBUG
if (interpolated) //only compare interpolated time, clock might go backwards otherwise
{
static int64_t old;
if(old > current)
CLog::Log(LOGWARNING, "CurrentHostCounter() moving backwords by %" PRId64" ticks with freq of %" PRId64, old - current, m_systemFrequency);
old = current;
}
#endif
return SystemToAbsolute(current);
}
double CDVDClock::WaitAbsoluteClock(double target)
{
CSingleLock lock(m_systemsection);
CheckSystemClock();
int64_t systemtarget, freq, offset;
freq = m_systemFrequency;
offset = m_systemOffset;
lock.Leave();
systemtarget = (int64_t)(target / DVD_TIME_BASE * (double)freq);
systemtarget += offset;
systemtarget = g_VideoReferenceClock.Wait(systemtarget);
systemtarget -= offset;
return (double)systemtarget / freq * DVD_TIME_BASE;
}
CDVDClock* CDVDClock::GetMasterClock()
{
CSingleLock lock(m_systemsection);
return m_playerclock;
}
double CDVDClock::GetClock(bool interpolated /*= true*/)
{
CSharedLock lock(m_critSection);
int64_t current = g_VideoReferenceClock.GetTime(interpolated);
m_systemAdjust += m_speedAdjust * (current - m_lastSystemTime);
m_lastSystemTime = current;
return SystemToPlaying(current);
}
double CDVDClock::GetClock(double& absolute, bool interpolated /*= true*/)
{
int64_t current = g_VideoReferenceClock.GetTime(interpolated);
{
CSingleLock lock(m_systemsection);
CheckSystemClock();
absolute = SystemToAbsolute(current);
}
return GetClock(interpolated);
}
void CDVDClock::SetSpeed(int iSpeed)
{
// this will sometimes be a little bit of due to rounding errors, ie clock might jump abit when changing speed
CExclusiveLock lock(m_critSection);
if(iSpeed == DVD_PLAYSPEED_PAUSE)
{
if(!m_pauseClock)
m_pauseClock = g_VideoReferenceClock.GetTime();
return;
}
int64_t current;
int64_t newfreq = m_systemFrequency * DVD_PLAYSPEED_NORMAL / iSpeed;
current = g_VideoReferenceClock.GetTime();
if( m_pauseClock )
{
m_startClock += current - m_pauseClock;
m_pauseClock = 0;
}
m_startClock = current - (int64_t)((double)(current - m_startClock) * newfreq / m_systemUsed);
m_systemUsed = newfreq;
}
void CDVDClock::SetSpeedAdjust(double adjust)
{
CExclusiveLock lock(m_critSection);
m_speedAdjust = adjust;
}
double CDVDClock::GetSpeedAdjust()
{
CExclusiveLock lock(m_critSection);
return m_speedAdjust;
}
bool CDVDClock::Update(double clock, double absolute, double limit, const char* log)
{
CExclusiveLock lock(m_critSection);
double was_absolute = SystemToAbsolute(m_startClock);
double was_clock = m_iDisc + absolute - was_absolute;
lock.Leave();
double error = std::abs(clock - was_clock);
// skip minor updates while speed adjust is active
// -> adjusting buffer levels
if (m_speedAdjust != 0 && error < DVD_MSEC_TO_TIME(100))
{
return false;
}
else if (error > limit)
{
Discontinuity(clock, absolute);
CLog::Log(LOGDEBUG, "CDVDClock::Discontinuity - %s - was:%f, should be:%f, error:%f"
, log
, was_clock
, clock
, clock - was_clock);
return true;
}
else
return false;
}
void CDVDClock::Discontinuity(double clock, double absolute)
{
CExclusiveLock lock(m_critSection);
m_startClock = AbsoluteToSystem(absolute);
if(m_pauseClock)
m_pauseClock = m_startClock;
m_iDisc = clock;
m_bReset = false;
m_systemAdjust = 0;
m_speedAdjust = 0;
}
void CDVDClock::SetMaxSpeedAdjust(double speed)
{
CSingleLock lock(m_speedsection);
m_maxspeedadjust = speed;
}
//returns the refreshrate if the videoreferenceclock is running, -1 otherwise
int CDVDClock::UpdateFramerate(double fps, double* interval /*= NULL*/)
{
//sent with fps of 0 means we are not playing video
if(fps == 0.0)
return -1;
//check if the videoreferenceclock is running, will return -1 if not
double rate = g_VideoReferenceClock.GetRefreshRate(interval);
if (rate <= 0)
return -1;
CSingleLock lock(m_speedsection);
double weight = MathUtils::round_int(rate) / (double)MathUtils::round_int(fps);
//set the speed of the videoreferenceclock based on fps, refreshrate and maximum speed adjust set by user
if (m_maxspeedadjust > 0.05)
{
if (weight / MathUtils::round_int(weight) < 1.0 + m_maxspeedadjust / 100.0
&& weight / MathUtils::round_int(weight) > 1.0 - m_maxspeedadjust / 100.0)
weight = MathUtils::round_int(weight);
}
double speed = rate / (fps * weight);
lock.Leave();
g_VideoReferenceClock.SetSpeed(speed);
return rate;
}
void CDVDClock::CheckSystemClock()
{
if(!m_systemFrequency)
m_systemFrequency = g_VideoReferenceClock.GetFrequency();
if(!m_systemOffset)
m_systemOffset = g_VideoReferenceClock.GetTime();
}
double CDVDClock::SystemToAbsolute(int64_t system)
{
return DVD_TIME_BASE * (double)(system - m_systemOffset) / m_systemFrequency;
}
int64_t CDVDClock::AbsoluteToSystem(double absolute)
{
return (int64_t)(absolute / DVD_TIME_BASE * m_systemFrequency) + m_systemOffset;
}
double CDVDClock::SystemToPlaying(int64_t system)
{
int64_t current;
if (m_bReset)
{
m_startClock = system;
m_systemUsed = m_systemFrequency;
if(m_pauseClock)
m_pauseClock = m_startClock;
m_iDisc = 0;
m_systemAdjust = 0;
m_speedAdjust = 0;
m_bReset = false;
}
if (m_pauseClock)
current = m_pauseClock;
else
current = system;
return DVD_TIME_BASE * (double)(current - m_startClock + m_systemAdjust) / m_systemUsed + m_iDisc;
}
EMasterClock CDVDClock::GetMaster()
{
CSharedLock lock(m_critSection);
return m_master;
}
void CDVDClock::SetMaster(EMasterClock master)
{
CExclusiveLock lock(m_critSection);
if(m_master != master)
{
/* if we switched from video ref clock, we need to normalize speed */
if(m_master == MASTER_CLOCK_AUDIO_VIDEOREF)
g_VideoReferenceClock.SetSpeed(1.0);
}
m_master = master;
}
double CDVDClock::GetClockSpeed()
{
return g_VideoReferenceClock.GetSpeed();
}
| 25.200637 | 145 | 0.717553 | krattai |
0de062257aa3611530a2176aae174d21b43e255c | 13,401 | cpp | C++ | source/OLD_EACopyRsync.cpp | electronicarts/EACopy | 74e061abdaaa128cb20120ed452c27752689dfc5 | [
"BSD-3-Clause"
] | 186 | 2019-07-23T21:48:25.000Z | 2022-03-22T07:11:31.000Z | source/OLD_EACopyRsync.cpp | electronicarts/EACopy | 74e061abdaaa128cb20120ed452c27752689dfc5 | [
"BSD-3-Clause"
] | 3 | 2020-01-09T21:57:42.000Z | 2021-09-29T16:33:10.000Z | source/OLD_EACopyRsync.cpp | electronicarts/EACopy | 74e061abdaaa128cb20120ed452c27752689dfc5 | [
"BSD-3-Clause"
] | 28 | 2019-08-03T16:24:18.000Z | 2021-10-31T02:49:54.000Z | // (c) Electronic Arts. All Rights Reserved.
#include <EACopyRsync.h>
#include "librsync/src/librsync.h"
#include "librsync/src/fileutil.h"
#include "librsync/src/util.h"
#include "librsync/src/buf.h"
#include "librsync/src/job.h"
#include "librsync/src/sumset.h"
#include <assert.h>
struct rs_filebuf {
FILE *f;
char *buf;
size_t buf_len;
};
namespace eacopy
{
enum : uint { DefaultRSyncBlockLen = 4*1024 };//RS_DEFAULT_BLOCK_LEN };
enum : uint { SocketBlockSize = 512 * 1024 };
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
struct ReadInfo
{
const wchar_t* ident;
RsyncStats& outStats;
HANDLE file = INVALID_HANDLE_VALUE;
SOCKET socket = INVALID_SOCKET;
size_t readPosition = 0;
uint bufferSize = 0;
bool lastBlock = false;
bool readFromSocket(DWORD& bytesRead, int& eof, char* buf, size_t buf_len)
{
u64 startReceiveMs = getTimeMs();
while (true)
{
if (!bufferSize)
{
if (lastBlock)
{
eof = 1;
break;
}
if (!receiveData(socket, &bufferSize, sizeof(bufferSize)))
return false;
if (!bufferSize)
{
eof = 1;
break;
}
else if (bufferSize < SocketBlockSize)
lastBlock = true;
}
uint toRead = min(buf_len - bytesRead, bufferSize);
if (!receiveData(socket, buf + bytesRead, toRead))
return false;
bufferSize -= toRead;
readPosition += toRead;
bytesRead += toRead;
if (bytesRead == buf_len)
break;
}
outStats.receiveTimeMs += getTimeMs() - startReceiveMs;
return true;
}
};
struct WriteInfo
{
const wchar_t* ident;
RsyncStats& outStats;
HANDLE file = INVALID_HANDLE_VALUE;
SOCKET socket = INVALID_SOCKET;
char* buffer = nullptr;
uint bufferSize = 0;
bool flush()
{
u64 startSendMs = getTimeMs();
if (!sendData(socket, &bufferSize, sizeof(bufferSize)))
return false;
if (!sendData(socket, buffer, bufferSize))
return false;
outStats.sendSize += sizeof(bufferSize) + bufferSize;
outStats.sendTimeMs += getTimeMs() - startSendMs;
return true;
}
};
/* If the stream has no more data available, read some from F into BUF, and let
the stream use that. On return, SEEN_EOF is true if the end of file has
passed into the stream. */
rs_result rs_infilebuf_fill2(rs_job_t *job, rs_buffers_t *buf, void *opaque)
{
rs_filebuf_t *fb = (rs_filebuf_t *)opaque;
/* This is only allowed if either the buf has no input buffer yet, or that
buffer could possibly be BUF. */
if (buf->next_in != NULL) {
assert(buf->avail_in <= fb->buf_len);
assert(buf->next_in >= fb->buf);
assert(buf->next_in <= fb->buf + fb->buf_len);
} else {
assert(buf->avail_in == 0);
}
if (buf->eof_in == 1)
return RS_DONE;
if (buf->avail_in != 0)
return RS_DONE;
ReadInfo& readInfo = *(ReadInfo*)fb->f;
DWORD bytesRead = 0;
if (readInfo.file != INVALID_HANDLE_VALUE)
{
u64 startReadMs = getTimeMs();
if (!ReadFile(readInfo.file, fb->buf, fb->buf_len, &bytesRead, NULL))
{
DWORD error = GetLastError();
if (error == ERROR_HANDLE_EOF)
{
buf->eof_in = 1;
return RS_DONE;
}
logErrorf(L"Fail reading file %s: %s", readInfo.ident, getErrorText(error).c_str());
return RS_IO_ERROR;
}
readInfo.outStats.readTimeMs += getTimeMs() - startReadMs;
readInfo.outStats.readSize += bytesRead;
if (bytesRead == 0)
{
buf->eof_in = 1;
return RS_DONE;
}
readInfo.readPosition += bytesRead;
}
else if (readInfo.socket != INVALID_SOCKET)
{
if (!readInfo.readFromSocket(bytesRead, buf->eof_in, fb->buf, fb->buf_len))
return RS_IO_ERROR;
}
buf->avail_in = bytesRead;
buf->next_in = fb->buf;
job->stats.in_bytes += bytesRead;
return RS_DONE;
}
/* The buf is already using BUF for an output buffer, and probably contains
some buffered output now. Write this out to F, and reset the buffer cursor. */
rs_result rs_outfilebuf_drain2(rs_job_t *job, rs_buffers_t *buf, void *opaque)
{
int present;
rs_filebuf_t *fb = (rs_filebuf_t *)opaque;
WriteInfo& writeInfo = *(WriteInfo*)fb->f;
// This is only allowed if either the buf has no output buffer yet, or that
// buffer could possibly be BUF.
if (buf->next_out == NULL) {
assert(buf->avail_out == 0);
buf->next_out = fb->buf;
buf->avail_out = fb->buf_len;
return RS_DONE;
}
assert(buf->avail_out <= fb->buf_len);
assert(buf->next_out >= fb->buf);
assert(buf->next_out <= fb->buf + fb->buf_len);
present = buf->next_out - fb->buf;
if (present > 0) {
assert(present > 0);
if (writeInfo.file != INVALID_HANDLE_VALUE)
{
u64 startWriteMs = getTimeMs();
DWORD written;
if (!WriteFile(writeInfo.file, fb->buf, present, &written, NULL))
{
logErrorf(L"Fail writing file %s: %s", writeInfo.ident, getLastErrorText().c_str());
return RS_IO_ERROR;
}
present = written;
writeInfo.outStats.writeTimeMs += getTimeMs() - startWriteMs;
}
else
{
u64 startSendMs = getTimeMs();
size_t left = present;
size_t readPos = 0;
if (writeInfo.bufferSize && writeInfo.bufferSize + left >= SocketBlockSize)
{
size_t toCopy = SocketBlockSize - writeInfo.bufferSize;
memcpy(writeInfo.buffer + writeInfo.bufferSize, fb->buf, toCopy);
uint blockSize = SocketBlockSize;
if (!sendData(writeInfo.socket, &blockSize, sizeof(blockSize)))
return RS_IO_ERROR;
if (!sendData(writeInfo.socket, writeInfo.buffer, blockSize))
return RS_IO_ERROR;
writeInfo.bufferSize = 0;
left = present - toCopy;
readPos += toCopy;
}
while (left >= SocketBlockSize)
{
uint blockSize = SocketBlockSize;
if (!sendData(writeInfo.socket, &blockSize, sizeof(blockSize)))
return RS_IO_ERROR;
if (!sendData(writeInfo.socket, fb->buf + readPos, blockSize))
return RS_IO_ERROR;
left -= SocketBlockSize;
readPos += SocketBlockSize;
}
memcpy(writeInfo.buffer + writeInfo.bufferSize, fb->buf + readPos, left);
writeInfo.bufferSize += left;
writeInfo.outStats.sendTimeMs += getTimeMs() - startSendMs;
writeInfo.outStats.sendSize += readPos; // Not fully accurate but good enough
}
buf->next_out = fb->buf;
buf->avail_out = fb->buf_len;
job->stats.out_bytes += present;
}
return RS_DONE;
}
rs_result rs_file_copy_cb2(void *arg, rs_long_t pos, size_t *len, void **buf)
{
ReadInfo& readInfo = *(ReadInfo*)arg;
assert(readInfo.file != INVALID_HANDLE_VALUE);
u64 startReadMs = getTimeMs();
if (!setFilePosition(readInfo.ident, readInfo.file, pos))
return RS_IO_ERROR;
readInfo.readPosition = pos;
DWORD bytesRead;
if (!ReadFile(readInfo.file, *buf, *len, &bytesRead, NULL))
{
logErrorf(L"Fail reading file %s: %s", readInfo.ident, getLastErrorText().c_str());
return RS_IO_ERROR;
}
readInfo.outStats.readTimeMs += getTimeMs() - startReadMs;
readInfo.outStats.readSize += bytesRead;
readInfo.readPosition += bytesRead;
*len = bytesRead;
return RS_DONE;
}
rs_result rs_whole_run2(rs_job_t *job, FILE *in_file, FILE *out_file,
int inbuflen, int outbuflen)
{
rs_buffers_t buf;
rs_result result;
rs_filebuf_t *in_fb = NULL, *out_fb = NULL;
/* Override buffer sizes if rs_inbuflen or rs_outbuflen are set. */
inbuflen = rs_inbuflen ? rs_inbuflen : inbuflen;
outbuflen = rs_outbuflen ? rs_outbuflen : outbuflen;
if (in_file)
in_fb = rs_filebuf_new(in_file, inbuflen);
if (out_file)
out_fb = rs_filebuf_new(out_file, outbuflen);
result =
rs_job_drive(job, &buf, in_fb ? rs_infilebuf_fill2 : NULL, in_fb,
out_fb ? rs_outfilebuf_drain2 : NULL, out_fb);
if (in_fb)
rs_filebuf_free(in_fb);
if (out_fb)
rs_filebuf_free(out_fb);
return result;
}
rs_result rs_sig_file2(FILE *old_file, FILE *sig_file, size_t new_block_len,
size_t strong_len, rs_magic_number sig_magic,
rs_stats_t *stats)
{
rs_job_t *job;
rs_result r;
job = rs_sig_begin(new_block_len, strong_len, sig_magic);
/* Size inbuf for 4 blocks, outbuf for header + 4 blocksums. */
r = rs_whole_run2(job, old_file, sig_file, 4 * new_block_len,
12 + 4 * (4 + strong_len));
if (stats)
memcpy(stats, &job->stats, sizeof *stats);
rs_job_free(job);
return r;
}
rs_result rs_delta_file2(rs_signature_t *sig, FILE *new_file, FILE *delta_file,
rs_stats_t *stats)
{
rs_job_t *job;
rs_result r;
job = rs_delta_begin(sig);
/* Size inbuf for 1 block, outbuf for literal cmd + 4 blocks. */
r = rs_whole_run2(job, new_file, delta_file, sig->block_len,
10 + 4 * sig->block_len);
if (stats)
memcpy(stats, &job->stats, sizeof *stats);
rs_job_free(job);
return r;
}
rs_result rs_patch_file2(FILE *basis_file, FILE *delta_file, FILE *new_file,
rs_stats_t *stats)
{
rs_job_t *job;
rs_result r;
job = rs_patch_begin(rs_file_copy_cb2, basis_file);
/* Default size inbuf and outbuf 64K. */
r = rs_whole_run2(job, delta_file, new_file, 64 * 1024, 64 * 1024);
if (stats)
memcpy(stats, &job->stats, sizeof *stats);
rs_job_free(job);
return r;
}
bool serverHandleRsync(SOCKET socket, const wchar_t* baseFileName, const wchar_t* newFileName, FILETIME lastWriteTime, RsyncStats& outStats)
{
//rs_inbuflen = 512*1024;
//rs_outbuflen = 512*1024;
u64 startMs = getTimeMs();
HANDLE baseFile;
if (!openFileRead(baseFileName, baseFile, true))
return false;
ScopeGuard fileGuard([&] { CloseHandle(baseFile); });
// Send signature data to client
{
WriteInfo writeInfo { L"RsyncSignatureMem", outStats };
writeInfo.socket = socket;
char buffer[SocketBlockSize];
writeInfo.buffer = buffer;
size_t block_len = DefaultRSyncBlockLen;
size_t strong_len = 0;
ReadInfo readInfo { baseFileName, outStats };
readInfo.file = baseFile;
FILE* basis_file = (FILE*)&readInfo;
FILE* sig_file = (FILE*)&writeInfo;
rs_result result = rs_sig_file2(basis_file, sig_file, block_len, strong_len, RS_BLAKE2_SIG_MAGIC, nullptr);
if (result != RS_DONE)
return false;
if (!writeInfo.flush())
return false;
}
// Receive delta data from client and combine with base file to create new file
{
if (!setFilePosition(baseFileName, baseFile, 0))
return false;
HANDLE newFile;
if (!openFileWrite(newFileName, newFile, true))
return false;
ScopeGuard newFileGuard([&] { CloseHandle(newFile); });
ReadInfo basisReadInfo { baseFileName, outStats };
basisReadInfo.file = baseFile;
ReadInfo deltaReadInfo { L"RSyncDeltaPatch", outStats };
deltaReadInfo.socket = socket;
WriteInfo writeInfo { newFileName, outStats };
writeInfo.file = newFile;
rs_result result = rs_patch_file2((FILE*)&basisReadInfo, (FILE*)&deltaReadInfo, (FILE*)&writeInfo, nullptr);
if (result != RS_DONE)
return false;
if (!setFileLastWriteTime(newFileName, newFile, lastWriteTime))
return false;
}
outStats.rsyncTimeMs = getTimeMs() - startMs - outStats.readTimeMs - outStats.receiveTimeMs - outStats.sendTimeMs - outStats.writeTimeMs;
return true;
}
bool clientHandleRsync(SOCKET socket, const wchar_t* fileName, RsyncStats& outStats)
{
u64 startMs = getTimeMs();
rs_signature_t* sumset = nullptr;
ScopeGuard cleanSumset([&]() { rs_free_sumset(sumset); });
{
ReadInfo readInfo { L"RsyncSignature", outStats };
readInfo.socket = socket;
rs_job_t* job = rs_loadsig_begin(&sumset);
// We read 0 bytes which will read first blocks size (which is very likely that it is the entire file)
DWORD bytesRead = 0;
int eof;
if (!readInfo.readFromSocket(bytesRead, eof, nullptr, 0))
return false;
job->sig_fsize = readInfo.bufferSize < SocketBlockSize ? readInfo.bufferSize : 0; // If bufferSize is more than SocketBlockSize we don't know how big the signature data is
// Size inbuf for 1024x 16 byte blocksums.
rs_result result = rs_whole_run2(job, (FILE*)&readInfo, NULL, 1024 * 16, 0);
rs_job_free(job);
if (result != RS_DONE)
{
logErrorf(L"Rsync failed while receiving signature data");
return false;
}
}
{
rs_result result = rs_build_hash_table(sumset);
if (result != RS_DONE)
{
logErrorf(L"Rsync failed while building hashtable");
return false;
}
}
{
HANDLE newFileHandle;
if (!openFileRead(fileName, newFileHandle, true))
return false;
ScopeGuard fileGuard([&] { CloseHandle(newFileHandle); });
ReadInfo readInfo = { fileName, outStats };
readInfo.file = newFileHandle;
WriteInfo writeInfo = { L"RSyncDeltaPatchMemory", outStats };
writeInfo.socket = socket;
char buffer[SocketBlockSize];
writeInfo.buffer = buffer;
u64 startMs = getTimeMs();
rs_result result = rs_delta_file2(sumset, (FILE*)&readInfo, (FILE*)&writeInfo, nullptr);
logInfof(L"BUILD DELTA: %s\r\n", toHourMinSec(getTimeMs() - startMs).c_str());
if (!writeInfo.flush())
return false;
}
outStats.rsyncTimeMs = getTimeMs() - startMs - outStats.readTimeMs - outStats.receiveTimeMs - outStats.sendTimeMs - outStats.writeTimeMs;
return true;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}
| 27.293279 | 173 | 0.66204 | electronicarts |
0de75e396b14fa9292bd65c2d7066cdb73a0fda7 | 30,576 | cpp | C++ | Tools/BtnST.cpp | vanch3d/DEMIST | f49e3409cf5eca8df6b03f1a1bbc0f9f4ca44521 | [
"MIT"
] | null | null | null | Tools/BtnST.cpp | vanch3d/DEMIST | f49e3409cf5eca8df6b03f1a1bbc0f9f4ca44521 | [
"MIT"
] | null | null | null | Tools/BtnST.cpp | vanch3d/DEMIST | f49e3409cf5eca8df6b03f1a1bbc0f9f4ca44521 | [
"MIT"
] | 1 | 2021-01-11T09:52:21.000Z | 2021-01-11T09:52:21.000Z | #include "stdafx.h"
#include "BtnST.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CButtonST
CButtonST::CButtonST()
{
m_bIsPressed = FALSE;
m_bIsFocused = FALSE;
m_bIsDisabled = FALSE;
m_bMouseOnButton = FALSE;
FreeResources(FALSE);
// Default type is "flat" button
m_bIsFlat = TRUE;
// By default draw border in "flat" button
m_bDrawBorder = TRUE;
// By default icon is aligned horizontally
m_nAlign = ST_ALIGN_HORIZ;
// By default show the text button
m_bShowText = TRUE;
// By default, for "flat" button, don't draw the focus rect
m_bDrawFlatFocus = FALSE;
// By default the button is not the default button
m_bIsDefault = FALSE;
// By default the button is not a checkbox
m_bIsCheckBox = FALSE;
m_nCheck = 0;
// Set default colors
SetDefaultColors(FALSE);
// No tooltip created
m_ToolTip.m_hWnd = NULL;
// Do not draw as a transparent button
m_bDrawTransparent = FALSE;
m_pbmpOldBk = NULL;
// No URL defined
::ZeroMemory(&m_szURL, sizeof(m_szURL));
// No cursor defined
m_hCursor = NULL; // Fix by kawasaki@us.dnttm.ro
// No autorepeat
m_bAutoRepeat = FALSE;
m_hWndAutoRepeat = NULL;
m_nMsgAutoRepeat = WM_APP;
m_dwPeriodAutoRepeat = 100;
} // End of CButtonST
CButtonST::~CButtonST()
{
// Restore old bitmap (if any)
if (m_dcBk.m_hDC != NULL && m_pbmpOldBk != NULL)
{
m_dcBk.SelectObject(m_pbmpOldBk);
}
FreeResources();
// Destroy the cursor (if any)
if (m_hCursor != NULL) ::DestroyCursor(m_hCursor);
} // End of ~CButtonST
BEGIN_MESSAGE_MAP(CButtonST, CButton)
//{{AFX_MSG_MAP(CButtonST)
ON_WM_CAPTURECHANGED()
ON_WM_SETCURSOR()
ON_WM_KILLFOCUS()
ON_WM_MOUSEMOVE()
ON_WM_SYSCOLORCHANGE()
ON_CONTROL_REFLECT_EX(BN_CLICKED, OnClicked)
ON_WM_ACTIVATE()
ON_WM_ENABLE()
ON_WM_CANCELMODE()
ON_WM_CTLCOLOR_REFLECT()
ON_WM_LBUTTONDOWN()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
DWORD CButtonST::SetIcon(int nIconInId, int nIconOutId)
{
HICON hIconIn;
HICON hIconOut;
HINSTANCE hInstResource;
// Find correct resource handle
hInstResource = AfxFindResourceHandle(MAKEINTRESOURCE(nIconInId), RT_GROUP_ICON);
// Set icon when the mouse is IN the button
hIconIn = (HICON)::LoadImage(hInstResource, MAKEINTRESOURCE(nIconInId), IMAGE_ICON, 0, 0, 0);
// Set icon when the mouse is OUT the button
hIconOut = (HICON)::LoadImage(hInstResource, MAKEINTRESOURCE(nIconOutId), IMAGE_ICON, 0, 0, 0);
return SetIcon(hIconIn, hIconOut);
} // End of SetIcon
DWORD CButtonST::SetIcon(HICON hIconIn, HICON hIconOut)
{
BOOL bRetValue;
ICONINFO ii;
// Free any loaded resource
FreeResources();
if (hIconIn != NULL)
{
m_csIcons[0].hIcon = hIconIn;
// Get icon dimension
ZeroMemory(&ii, sizeof(ICONINFO));
bRetValue = ::GetIconInfo(hIconIn, &ii);
if (bRetValue == FALSE)
{
FreeResources();
return BTNST_INVALIDRESOURCE;
} // if
m_csIcons[0].dwWidth = (DWORD)(ii.xHotspot * 2);
m_csIcons[0].dwHeight = (DWORD)(ii.yHotspot * 2);
::DeleteObject(ii.hbmMask);
::DeleteObject(ii.hbmColor);
if (hIconOut != NULL)
{
m_csIcons[1].hIcon = hIconOut;
// Get icon dimension
ZeroMemory(&ii, sizeof(ICONINFO));
bRetValue = ::GetIconInfo(hIconOut, &ii);
if (bRetValue == FALSE)
{
FreeResources();
return BTNST_INVALIDRESOURCE;
} // if
m_csIcons[1].dwWidth = (DWORD)(ii.xHotspot * 2);
m_csIcons[1].dwHeight = (DWORD)(ii.yHotspot * 2);
::DeleteObject(ii.hbmMask);
::DeleteObject(ii.hbmColor);
} // if
} // if
RedrawWindow();
return BTNST_OK;
} // End of SetIcon
BOOL CButtonST::SetBtnCursor(int nCursorId)
{
HINSTANCE hInstResource;
// Destroy any previous cursor
if (m_hCursor != NULL) ::DestroyCursor(m_hCursor);
m_hCursor = NULL;
// If we want a cursor
if (nCursorId != NULL)
{
hInstResource = AfxFindResourceHandle(MAKEINTRESOURCE(nCursorId),
RT_GROUP_CURSOR);
// Load icon resource
m_hCursor = (HCURSOR)::LoadImage(hInstResource/*AfxGetApp()->m_hInstance*/, MAKEINTRESOURCE(nCursorId), IMAGE_CURSOR, 0, 0, 0);
// If something wrong then return FALSE
if (m_hCursor == NULL) return FALSE;
}
return TRUE;
} // End of SetBtnCursor
void CButtonST::SetFlat(BOOL bState)
{
m_bIsFlat = bState;
Invalidate();
} // End of SetFlat
BOOL CButtonST::GetFlat()
{
return m_bIsFlat;
} // End of GetFlat
void CButtonST::SetAlign(int nAlign)
{
switch (nAlign)
{
case ST_ALIGN_HORIZ:
case ST_ALIGN_HORIZ_RIGHT:
case ST_ALIGN_VERT:
m_nAlign = nAlign;
break;
}
Invalidate();
} // End of SetAlign
int CButtonST::GetAlign()
{
return m_nAlign;
} // End of GetAlign
void CButtonST::DrawBorder(BOOL bEnable)
{
m_bDrawBorder = bEnable;
} // End of DrawBorder
void CButtonST::SetShowText(BOOL bShow)
{
m_bShowText = bShow;
Invalidate();
} // End of SetShowText
BOOL CButtonST::GetShowText()
{
return m_bShowText;
} // End of GetShowText
void CButtonST::OnMouseMove(UINT nFlags, CPoint point)
{
CWnd* pWnd; // Active window
CWnd* pParent; // Window that owns the button
CButton::OnMouseMove(nFlags, point);
// If the mouse enter the button with the left button pressed then do nothing
if (nFlags & MK_LBUTTON && m_bMouseOnButton == FALSE) return;
// If our button is not flat then do nothing
if (m_bIsFlat == FALSE) return;
pWnd = GetActiveWindow();
pParent = GetOwner();
if ((GetCapture() != this) &&
(
#ifndef ST_LIKEIE
pWnd != NULL &&
#endif
pParent != NULL))
{
m_bMouseOnButton = TRUE;
//SetFocus(); // Thanks Ralph!
SetCapture();
Invalidate();
} // if
else
{
/*
CRect rc;
GetClientRect(&rc);
if (!rc.PtInRect(point))
{
*/
POINT p2 = point;
ClientToScreen(&p2);
CWnd* wndUnderMouse = WindowFromPoint(p2);
// if (wndUnderMouse != this)
if (wndUnderMouse && wndUnderMouse->m_hWnd != this->m_hWnd)
{
// Redraw only if mouse goes out
if (m_bMouseOnButton == TRUE)
{
m_bMouseOnButton = FALSE;
Invalidate();
} // if
// If user is NOT pressing left button then release capture!
if (!(nFlags & MK_LBUTTON)) ReleaseCapture();
} // if
} // else
} // End of OnMouseMove
void CButtonST::OnKillFocus(CWnd * pNewWnd)
{
CButton::OnKillFocus(pNewWnd);
CancelHover();
} // End of OnKillFocus
void CButtonST::OnLButtonDown(UINT nFlags, CPoint point)
{
CButton::OnLButtonDown(nFlags, point);
if (m_bAutoRepeat == TRUE)
{
MSG csMsg;
int nButtonID;
HWND hWndParent;
BOOL bInitialState = TRUE;
nButtonID = GetDlgCtrlID();
hWndParent = GetParent()->GetSafeHwnd();
SetCapture();
while (PeekMessage(&csMsg, m_hWnd, WM_LBUTTONUP, WM_LBUTTONUP, PM_REMOVE) == FALSE)
{
::SendMessage(hWndParent, WM_COMMAND, MAKEWPARAM((WORD)nButtonID, BN_CLICKED), (LPARAM)m_hWnd);
::Sleep(m_dwPeriodAutoRepeat);
bInitialState = !bInitialState;
} // while
if (!bInitialState)
{
::SendMessage(hWndParent, WM_COMMAND, MAKEWPARAM((WORD)nButtonID, BN_CLICKED), (LPARAM)m_hWnd);
} // if
ReleaseCapture();
SendMessage(WM_LBUTTONUP);
CPoint ptCursor;
GetCursorPos(&ptCursor);
ScreenToClient(&ptCursor);
SendMessage(WM_MOUSEMOVE, 0, MAKELPARAM(ptCursor.x, ptCursor.y));
} // if
} // End of OnLButtonDown
void CButtonST::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized)
{
CButton::OnActivate(nState, pWndOther, bMinimized);
if (nState == WA_INACTIVE) CancelHover();
} // End of OnActivate
void CButtonST::OnEnable(BOOL bEnable)
{
CButton::OnEnable(bEnable);
if (bEnable == FALSE) CancelHover();
} // End of OnEnable
void CButtonST::OnCancelMode()
{
CButton::OnCancelMode();
CancelHover();
} // End of OnCancelMode
void CButtonST::OnCaptureChanged(CWnd *pWnd)
{
if (m_bMouseOnButton == TRUE)
{
ReleaseCapture();
Invalidate();
} // if
CButton::OnCaptureChanged(pWnd);
} // End of OnCaptureChanged
void CButtonST::DrawItem(LPDRAWITEMSTRUCT lpDIS)
{
CDC* pDC = CDC::FromHandle(lpDIS->hDC);
CPen *pOldPen;
// Checkbox or Radiobutton style ?
if (m_bIsCheckBox == TRUE)
{
m_bIsPressed = (lpDIS->itemState & ODS_SELECTED)
|| (m_nCheck != 0);
//m_bIsPressed = TRUE;
}
// Normal button OR other button style ...
else
{
m_bIsPressed = (lpDIS->itemState & ODS_SELECTED);
}
m_bIsFocused = (lpDIS->itemState & ODS_FOCUS);
m_bIsDisabled = (lpDIS->itemState & ODS_DISABLED);
CRect itemRect = lpDIS->rcItem;
pDC->SetBkMode(TRANSPARENT);
if (m_bIsFlat == FALSE)
{
if (m_bIsFocused || (GetDefault() == TRUE))
{
CBrush br(RGB(0,0,0));
pDC->FrameRect(&itemRect, &br);
itemRect.DeflateRect(1, 1);
} // if
} // if
// Prepare draw... paint button background
// Draw transparent?
if (m_bDrawTransparent == TRUE)
PaintBk(pDC);
else
OnDrawBackground(pDC, &itemRect);
// Draw pressed button
if (m_bIsPressed)
{
if (m_bIsFlat == TRUE)
{
if (m_bDrawBorder)
OnDrawBorder(pDC, &itemRect);
}
else
{
CBrush brBtnShadow(GetSysColor(COLOR_BTNSHADOW));
pDC->FrameRect(&itemRect, &brBtnShadow);
}
}
else // ...else draw non pressed button
{
CPen penBtnHiLight(PS_SOLID, 0, GetSysColor(COLOR_BTNHILIGHT)); // White
CPen pen3DLight(PS_SOLID, 0, GetSysColor(COLOR_3DLIGHT)); // Light gray
CPen penBtnShadow(PS_SOLID, 0, GetSysColor(COLOR_BTNSHADOW)); // Dark gray
CPen pen3DDKShadow(PS_SOLID, 0, GetSysColor(COLOR_3DDKSHADOW)); // Black
if (m_bIsFlat == TRUE)
{
if (m_bMouseOnButton && m_bDrawBorder)
OnDrawBorder(pDC, &itemRect);
}
else
{
// Draw top-left borders
// White line
pOldPen = pDC->SelectObject(&penBtnHiLight);
pDC->MoveTo(itemRect.left, itemRect.bottom-1);
pDC->LineTo(itemRect.left, itemRect.top);
pDC->LineTo(itemRect.right, itemRect.top);
// Light gray line
pDC->SelectObject(pen3DLight);
pDC->MoveTo(itemRect.left+1, itemRect.bottom-1);
pDC->LineTo(itemRect.left+1, itemRect.top+1);
pDC->LineTo(itemRect.right, itemRect.top+1);
// Draw bottom-right borders
// Black line
pDC->SelectObject(pen3DDKShadow);
pDC->MoveTo(itemRect.left, itemRect.bottom-1);
pDC->LineTo(itemRect.right-1, itemRect.bottom-1);
pDC->LineTo(itemRect.right-1, itemRect.top-1);
// Dark gray line
pDC->SelectObject(penBtnShadow);
pDC->MoveTo(itemRect.left+1, itemRect.bottom-2);
pDC->LineTo(itemRect.right-2, itemRect.bottom-2);
pDC->LineTo(itemRect.right-2, itemRect.top);
//
pDC->SelectObject(pOldPen);
}
}
// Read the button's title
CString sTitle;
GetWindowText(sTitle);
// If we don't want the title displayed
if (m_bShowText == FALSE) sTitle.Empty();
CRect captionRect = lpDIS->rcItem;
// Draw the icon
if (m_csIcons[0].hIcon != NULL)
{
DrawTheIcon(pDC, !sTitle.IsEmpty(), &lpDIS->rcItem, &captionRect, m_bIsPressed, m_bIsDisabled);
}
if (m_csBitmaps[0].hBitmap != NULL)
{
pDC->SetBkColor(RGB(255,255,255));
DrawTheBitmap(pDC, !sTitle.IsEmpty(), &lpDIS->rcItem, &captionRect, m_bIsPressed, m_bIsDisabled);
} // if
// Write the button title (if any)
if (sTitle.IsEmpty() == FALSE)
{
// Draw the button's title
// If button is pressed then "press" title also
if (m_bIsPressed && m_bIsCheckBox == FALSE)
captionRect.OffsetRect(1, 1);
// ONLY FOR DEBUG
//CBrush brBtnShadow(RGB(255, 0, 0));
//pDC->FrameRect(&captionRect, &brBtnShadow);
/*
if ((m_bMouseOnButton == TRUE) || (bIsPressed))
{
pDC->SetTextColor(GetActiveFgColor());
pDC->SetBkColor(GetActiveBgColor());
}
else
{
pDC->SetTextColor(GetInactiveFgColor());
pDC->SetBkColor(GetInactiveBgColor());
}
*/
// Center text
CRect centerRect = captionRect;
pDC->DrawText(sTitle, -1, captionRect, DT_WORDBREAK | DT_CENTER | DT_CALCRECT);
captionRect.OffsetRect((centerRect.Width() - captionRect.Width())/2, (centerRect.Height() - captionRect.Height())/2);
/* RFU
captionRect.OffsetRect(0, (centerRect.Height() - captionRect.Height())/2);
captionRect.OffsetRect((centerRect.Width() - captionRect.Width())-4, (centerRect.Height() - captionRect.Height())/2);
*/
pDC->SetBkMode(TRANSPARENT);
/*
pDC->DrawState(captionRect.TopLeft(), captionRect.Size(), (LPCTSTR)sTitle, (bIsDisabled ? DSS_DISABLED : DSS_NORMAL),
TRUE, 0, (CBrush*)NULL);
*/
if (m_bIsDisabled)
{
captionRect.OffsetRect(1, 1);
pDC->SetTextColor(::GetSysColor(COLOR_3DHILIGHT));
pDC->DrawText(sTitle, -1, captionRect, DT_WORDBREAK | DT_CENTER);
captionRect.OffsetRect(-1, -1);
pDC->SetTextColor(::GetSysColor(COLOR_3DSHADOW));
pDC->DrawText(sTitle, -1, captionRect, DT_WORDBREAK | DT_CENTER);
} // if
else
{
if (m_bMouseOnButton || m_bIsPressed)
{
pDC->SetTextColor(m_crColors[BTNST_COLOR_FG_IN]);
pDC->SetBkColor(m_crColors[BTNST_COLOR_BK_IN]);
} // if
else
{
pDC->SetTextColor(m_crColors[BTNST_COLOR_FG_OUT]);
pDC->SetBkColor(m_crColors[BTNST_COLOR_BK_OUT]);
} // else
pDC->DrawText(sTitle, -1, captionRect, DT_WORDBREAK | DT_CENTER);
} // if
} // if
if (m_bIsFlat == FALSE || (m_bIsFlat == TRUE && m_bDrawFlatFocus == TRUE))
{
// Draw the focus rect
if (m_bIsFocused)
{
CRect focusRect = itemRect;
focusRect.DeflateRect(3, 3);
pDC->DrawFocusRect(&focusRect);
} // if
} // if
} // End of DrawItem
void CButtonST::DrawTheIcon(CDC* pDC, BOOL bHasTitle, RECT* rpItem, CRect* rpTitle, BOOL bIsPressed, BOOL bIsDisabled)
{
BYTE byIndex = 0;
// Select the icon to use
if (m_bIsCheckBox == TRUE)
{
if (bIsPressed == TRUE)
byIndex = 0;
else
byIndex = (m_csIcons[1].hIcon == NULL ? 0 : 1);
} // if
else
{
if (m_bMouseOnButton == TRUE || bIsPressed == TRUE)
byIndex = 0;
else
byIndex = (m_csIcons[1].hIcon == NULL ? 0 : 1);
} // else
CRect rImage;
PrepareImageRect(bHasTitle, rpItem, rpTitle, bIsPressed, m_csIcons[byIndex].dwWidth, m_csIcons[byIndex].dwHeight, &rImage);
// Ole'!
pDC->DrawState( rImage.TopLeft(),
rImage.Size(),
m_csIcons[byIndex].hIcon,
(bIsDisabled ? DSS_DISABLED : DSS_NORMAL),
(CBrush*)NULL);
} // End of DrawTheIcon
void CButtonST::PreSubclassWindow()
{
UINT nBS;
nBS = GetButtonStyle();
// Check if this is the default button
if (nBS & BS_DEFPUSHBUTTON) m_bIsDefault = TRUE;
// Check if this is a checkbox
if (nBS & BS_CHECKBOX) m_bIsCheckBox = TRUE;
// Add BS_OWNERDRAW style
SetButtonStyle(nBS | BS_OWNERDRAW);
CButton::PreSubclassWindow();
} // End of PreSubclassWindow
BOOL CButtonST::PreTranslateMessage(MSG* pMsg)
{
InitToolTip();
m_ToolTip.RelayEvent(pMsg);
return CButton::PreTranslateMessage(pMsg);
} // End of PreTranslateMessage
LRESULT CButtonST::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
if (message == WM_LBUTTONDBLCLK)
{
message = WM_LBUTTONDOWN;
} // if
return CButton::DefWindowProc(message, wParam, lParam);
} // End of DefWindowProc
void CButtonST::SetFlatFocus(BOOL bDrawFlatFocus, BOOL bRepaint)
{
m_bDrawFlatFocus = bDrawFlatFocus;
// Repaint the button
if (bRepaint == TRUE) Invalidate();
} // End of SetFlatFocus
BOOL CButtonST::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
// If a cursor was specified then use it!
if (m_hCursor != NULL)
{
::SetCursor(m_hCursor);
return TRUE;
} // if
return CButton::OnSetCursor(pWnd, nHitTest, message);
} // End of OnSetCursor
void CButtonST::SetTooltipText(LPCTSTR lpszText, BOOL bActivate)
{
// We cannot accept NULL pointer
if (lpszText == NULL) return;
// Initialize ToolTip
InitToolTip();
// If there is no tooltip defined then add it
if (m_ToolTip.GetToolCount() == 0)
{
CRect rectBtn;
GetClientRect(rectBtn);
m_ToolTip.AddTool(this, lpszText, rectBtn, 1);
}
// Set text for tooltip
m_ToolTip.UpdateTipText(lpszText, this, 1);
m_ToolTip.Activate(bActivate);
} // End of SetTooltipText
void CButtonST::SetTooltipText(int nId, BOOL bActivate)
{
CString sText;
// load string resource
sText.LoadString(nId);
// If string resource is not empty
if (sText.IsEmpty() == FALSE) SetTooltipText((LPCTSTR)sText, bActivate);
} // End of SetTooltipText
void CButtonST::ActivateTooltip(BOOL bActivate)
{
// If there is no tooltip then do nothing
if (m_ToolTip.GetToolCount() == 0) return;
// Activate tooltip
m_ToolTip.Activate(bActivate);
} // End of EnableTooltip
BOOL CButtonST::GetDefault()
{
return m_bIsDefault;
} // End of GetDefault
void CButtonST::DrawTransparent(BOOL bRepaint)
{
m_bDrawTransparent = TRUE;
// Restore old bitmap (if any)
if (m_dcBk.m_hDC != NULL && m_pbmpOldBk != NULL)
{
m_dcBk.SelectObject(m_pbmpOldBk);
} // if
m_bmpBk.DeleteObject();
m_dcBk.DeleteDC();
// Repaint the button
if (bRepaint == TRUE) Invalidate();
} // End of DrawTransparent
void CButtonST::InitToolTip()
{
if (m_ToolTip.m_hWnd == NULL)
{
// Create ToolTip control
m_ToolTip.Create(this);
// Create inactive
m_ToolTip.Activate(FALSE);
// Enable multiline
m_ToolTip.SendMessage(TTM_SETMAXTIPWIDTH, 0, 400);
} // if
} // End of InitToolTip
void CButtonST::PaintBk(CDC* pDC)
{
CClientDC clDC(GetParent());
CRect rect;
CRect rect1;
GetClientRect(rect);
GetWindowRect(rect1);
GetParent()->ScreenToClient(rect1);
if (m_dcBk.m_hDC == NULL)
{
m_dcBk.CreateCompatibleDC(&clDC);
m_bmpBk.CreateCompatibleBitmap(&clDC, rect.Width(), rect.Height());
m_pbmpOldBk = m_dcBk.SelectObject(&m_bmpBk);
m_dcBk.BitBlt(0, 0, rect.Width(), rect.Height(), &clDC, rect1.left, rect1.top, SRCCOPY);
} // if
pDC->BitBlt(0, 0, rect.Width(), rect.Height(), &m_dcBk, 0, 0, SRCCOPY);
} // End of PaintBk
HBRUSH CButtonST::CtlColor(CDC* pDC, UINT nCtlColor)
{
return (HBRUSH)::GetStockObject(NULL_BRUSH);
} // End of CtlColor
void CButtonST::OnSysColorChange()
{
CButton::OnSysColorChange();
m_dcBk.DeleteDC();
m_bmpBk.DeleteObject();
} // End of OnSysColorChange
BOOL CButtonST::OnClicked()
{
if (m_bIsCheckBox == TRUE)
{
m_nCheck = !m_nCheck;
Invalidate();
} // if
else
{
// Handle the URL (if any)
if (::lstrlen(m_szURL) > 0)
::ShellExecute(NULL, _T("open"), m_szURL, NULL,NULL, SW_SHOWMAXIMIZED);
} // else
return FALSE;
} // End of OnClicked
void CButtonST::SetCheck(int nCheck, BOOL bRepaint)
{
if (m_bIsCheckBox == TRUE)
{
if (nCheck == 0) m_nCheck = 0;
else m_nCheck = 1;
if (bRepaint == TRUE) Invalidate();
} // if
} // End of SetCheck
int CButtonST::GetCheck()
{
return m_nCheck;
} // End of GetCheck
void CButtonST::FreeResources(BOOL bCheckForNULL)
{
if (bCheckForNULL == TRUE)
{
// Destroy icons
// Note: the following two lines MUST be here! even if
// BoundChecker says they are unnecessary!
if (m_csIcons[0].hIcon != NULL) ::DeleteObject(m_csIcons[0].hIcon);
if (m_csIcons[1].hIcon != NULL) ::DeleteObject(m_csIcons[1].hIcon);
// Destroy bitmaps
if (m_csBitmaps[0].hBitmap != NULL) ::DeleteObject(m_csBitmaps[0].hBitmap);
if (m_csBitmaps[1].hBitmap != NULL) ::DeleteObject(m_csBitmaps[1].hBitmap);
// Destroy mask bitmaps
if (m_csBitmaps[0].hMask != NULL) ::DeleteObject(m_csBitmaps[0].hMask);
if (m_csBitmaps[1].hMask != NULL) ::DeleteObject(m_csBitmaps[1].hMask);
} // if
::ZeroMemory(&m_csIcons, sizeof(m_csIcons));
::ZeroMemory(&m_csBitmaps, sizeof(m_csBitmaps));
} // End of FreeResources
DWORD CButtonST::SetBitmaps(HBITMAP hBitmapIn, COLORREF crTransColorIn, HBITMAP hBitmapOut, COLORREF crTransColorOut)
{
int nRetValue;
BITMAP csBitmapSize;
// Free any loaded resource
FreeResources();
if (hBitmapIn != NULL)
{
m_csBitmaps[0].hBitmap = hBitmapIn;
m_csBitmaps[0].crTransparent = crTransColorIn;
// Get bitmap size
nRetValue = ::GetObject(hBitmapIn, sizeof(csBitmapSize), &csBitmapSize);
if (nRetValue == 0)
{
FreeResources();
return BTNST_INVALIDRESOURCE;
} // if
m_csBitmaps[0].dwWidth = (DWORD)csBitmapSize.bmWidth;
m_csBitmaps[0].dwHeight = (DWORD)csBitmapSize.bmHeight;
// Create mask for bitmap In
m_csBitmaps[0].hMask = CreateBitmapMask(hBitmapIn, m_csBitmaps[0].dwWidth, m_csBitmaps[0].dwHeight, crTransColorIn);
if (m_csBitmaps[0].hMask == NULL)
{
FreeResources();
return BTNST_FAILEDMASK;
} // if
if (hBitmapOut != NULL)
{
m_csBitmaps[1].hBitmap = hBitmapOut;
m_csBitmaps[1].crTransparent = crTransColorOut;
// Get bitmap size
nRetValue = ::GetObject(hBitmapOut, sizeof(csBitmapSize), &csBitmapSize);
if (nRetValue == 0)
{
FreeResources();
return BTNST_INVALIDRESOURCE;
} // if
m_csBitmaps[1].dwWidth = (DWORD)csBitmapSize.bmWidth;
m_csBitmaps[1].dwHeight = (DWORD)csBitmapSize.bmHeight;
// Create mask for bitmap Out
m_csBitmaps[1].hMask = CreateBitmapMask(hBitmapOut, m_csBitmaps[1].dwWidth, m_csBitmaps[1].dwHeight, crTransColorOut);
if (m_csBitmaps[1].hMask == NULL)
{
FreeResources();
return BTNST_FAILEDMASK;
} // if
} // if
} // if
RedrawWindow();
return BTNST_OK;
} // End of SetBitmaps
DWORD CButtonST::SetBitmaps(int nBitmapIn, COLORREF crTransColorIn, int nBitmapOut, COLORREF crTransColorOut)
{
HBITMAP hBitmapIn = NULL;
HBITMAP hBitmapOut = NULL;
HINSTANCE hInstResource = NULL;
// Find correct resource handle
hInstResource = AfxFindResourceHandle(MAKEINTRESOURCE(nBitmapIn), RT_BITMAP);
// Load bitmap In
hBitmapIn = (HBITMAP)::LoadImage(hInstResource, MAKEINTRESOURCE(nBitmapIn), IMAGE_BITMAP, 0, 0, 0);
// Load bitmap Out
hBitmapOut = (HBITMAP)::LoadImage(hInstResource, MAKEINTRESOURCE(nBitmapOut), IMAGE_BITMAP, 0, 0, 0);
return SetBitmaps(hBitmapIn, crTransColorIn, hBitmapOut, crTransColorOut);
} // End of SetBitmaps
void CButtonST::DrawTheBitmap(CDC* pDC, BOOL bHasTitle, RECT* rItem, CRect *rCaption, BOOL bIsPressed, BOOL bIsDisabled)
{
HDC hdcBmpMem = NULL;
HBITMAP hbmOldBmp = NULL;
HDC hdcMem = NULL;
HBITMAP hbmT = NULL;
BYTE byIndex = 0;
// Select the bitmap to use
if (m_bIsCheckBox == TRUE)
{
if (bIsPressed == TRUE)
byIndex = 0;
else
byIndex = (m_csBitmaps[1].hBitmap == NULL ? 0 : 1);
} // if
else
{
if (m_bMouseOnButton == TRUE || bIsPressed == TRUE)
byIndex = 0;
else
byIndex = (m_csBitmaps[1].hBitmap == NULL ? 0 : 1);
} // else
CRect rImage;
PrepareImageRect(bHasTitle, rItem, rCaption, bIsPressed, m_csBitmaps[byIndex].dwWidth, m_csBitmaps[byIndex].dwHeight, &rImage);
hdcBmpMem = ::CreateCompatibleDC(pDC->m_hDC);
hbmOldBmp = (HBITMAP)::SelectObject(hdcBmpMem, m_csBitmaps[byIndex].hBitmap);
hdcMem = ::CreateCompatibleDC(NULL);
hbmT = (HBITMAP)::SelectObject(hdcMem, m_csBitmaps[byIndex].hMask);
::BitBlt(pDC->m_hDC, rImage.left, rImage.top, m_csBitmaps[byIndex].dwWidth, m_csBitmaps[byIndex].dwHeight, hdcMem, 0, 0, SRCAND);
::BitBlt(pDC->m_hDC, rImage.left, rImage.top, m_csBitmaps[byIndex].dwWidth, m_csBitmaps[byIndex].dwHeight, hdcBmpMem, 0, 0, SRCPAINT);
::SelectObject(hdcMem, hbmT);
::DeleteDC(hdcMem);
::SelectObject(hdcBmpMem, hbmOldBmp);
::DeleteDC(hdcBmpMem);
} // End of DrawTheBitmap
HBITMAP CButtonST::CreateBitmapMask(HBITMAP hSourceBitmap, DWORD dwWidth, DWORD dwHeight, COLORREF crTransColor)
{
HBITMAP hMask = NULL;
HDC hdcSrc = NULL;
HDC hdcDest = NULL;
HBITMAP hbmSrcT = NULL;
HBITMAP hbmDestT = NULL;
COLORREF crSaveBk;
COLORREF crSaveDestText;
hMask = ::CreateBitmap(dwWidth, dwHeight, 1, 1, NULL);
if (hMask == NULL) return NULL;
hdcSrc = ::CreateCompatibleDC(NULL);
hdcDest = ::CreateCompatibleDC(NULL);
hbmSrcT = (HBITMAP)::SelectObject(hdcSrc, hSourceBitmap);
hbmDestT = (HBITMAP)::SelectObject(hdcDest, hMask);
crSaveBk = ::SetBkColor(hdcSrc, crTransColor);
::BitBlt(hdcDest, 0, 0, dwWidth, dwHeight, hdcSrc, 0, 0, SRCCOPY);
crSaveDestText = ::SetTextColor(hdcSrc, RGB(255, 255, 255));
::SetBkColor(hdcSrc,RGB(0, 0, 0));
::BitBlt(hdcSrc, 0, 0, dwWidth, dwHeight, hdcDest, 0, 0, SRCAND);
SetTextColor(hdcDest, crSaveDestText);
::SetBkColor(hdcSrc, crSaveBk);
::SelectObject(hdcSrc, hbmSrcT);
::SelectObject(hdcDest, hbmDestT);
::DeleteDC(hdcSrc);
::DeleteDC(hdcDest);
return hMask;
} // End of CreateBitmapMask
//
// Parameters:
// [IN] bHasTitle
// TRUE if the button has a text
// [IN] rpItem
// A pointer to a RECT structure indicating the allowed paint area
// [IN/OUT]rpTitle
// A pointer to a CRect object indicating the paint area reserved for the
// text. This structure will be modified if necessary.
// [IN] bIsPressed
// TRUE if the button is currently pressed
// [IN] dwWidth
// Width of the image (icon or bitmap)
// [IN] dwHeight
// Height of the image (icon or bitmap)
// [OUT] rpImage
// A pointer to a CRect object that will receive the area available to the image
//
void CButtonST::PrepareImageRect(BOOL bHasTitle, RECT* rpItem, CRect* rpTitle, BOOL bIsPressed, DWORD dwWidth, DWORD dwHeight, CRect* rpImage)
{
CRect rBtn;
rpImage->CopyRect(rpItem);
switch (m_nAlign)
{
case ST_ALIGN_HORIZ:
if (bHasTitle == FALSE /*spTitle->IsEmpty()*/)
{
// Center image horizontally
rpImage->left += ((rpImage->Width() - dwWidth)/2);
}
else
{
// Image must be placed just inside the focus rect
rpImage->left += 3;
rpTitle->left += dwWidth + 3;
}
// Center image vertically
rpImage->top += ((rpImage->Height() - dwHeight)/2);
break;
case ST_ALIGN_HORIZ_RIGHT:
GetClientRect(&rBtn);
if (bHasTitle == FALSE /*spTitle->IsEmpty()*/)
{
// Center image horizontally
rpImage->left += ((rpImage->Width() - dwWidth)/2);
}
else
{
// Image must be placed just inside the focus rect
rpTitle->right = rpTitle->Width() - dwWidth - 3;
rpTitle->left = 3;
rpImage->left = rBtn.right - dwWidth - 3;
// Center image vertically
rpImage->top += ((rpImage->Height() - dwHeight)/2);
}
break;
case ST_ALIGN_VERT:
// Center image horizontally
rpImage->left += ((rpImage->Width() - dwWidth)/2);
if (bHasTitle == FALSE /*spTitle->IsEmpty()*/)
{
// Center image vertically
rpImage->top += ((rpImage->Height() - dwHeight)/2);
}
else
{
rpImage->top = 3;
rpTitle->top += dwHeight;
}
break;
}
// If button is pressed then press image also
if (bIsPressed == TRUE && m_bIsCheckBox == FALSE)
rpImage->OffsetRect(1, 1);
} // End of PrepareImageRect
//
// Parameters:
// [IN] bRepaint
// If TRUE the control will be repainted.
// Return value:
// BTNST_OK
// Function executed successfully.
//
DWORD CButtonST::SetDefaultColors(BOOL bRepaint)
{
m_crColors[BTNST_COLOR_BK_IN] = ::GetSysColor(COLOR_BTNFACE);
m_crColors[BTNST_COLOR_FG_IN] = ::GetSysColor(COLOR_BTNTEXT);
m_crColors[BTNST_COLOR_BK_OUT] = ::GetSysColor(COLOR_BTNFACE);
m_crColors[BTNST_COLOR_FG_OUT] = ::GetSysColor(COLOR_BTNTEXT);
if (bRepaint == TRUE) Invalidate();
return BTNST_OK;
} // End of SetDefaultColors
//
// Parameters:
// [IN] byColorIndex
// Index of the color to set. This index is zero-based.
// [IN] crColor
// New color.
// [IN] bRepaint
// If TRUE the control will be repainted.
//
// Return value:
// BTNST_OK
// Function executed successfully.
// BTNST_INVALIDINDEX
// Invalid color index.
//
DWORD CButtonST::SetColor(BYTE byColorIndex, COLORREF crColor, BOOL bRepaint)
{
if (byColorIndex >= BTNST_MAX_COLORS) return BTNST_INVALIDINDEX;
// Set new color
m_crColors[byColorIndex] = crColor;
if (bRepaint == TRUE) Invalidate();
return BTNST_OK;
} // End of SetColor
//
// Parameters:
// [IN] byColorIndex
// Index of the color to get. This index is zero-based.
// [OUT] crpColor
// A pointer to a COLORREF that will receive the color.
//
// Return value:
// BTNST_OK
// Function executed successfully.
// BTNST_INVALIDINDEX
// Invalid color index.
//
DWORD CButtonST::GetColor(BYTE byColorIndex, COLORREF* crpColor)
{
if (byColorIndex >= BTNST_MAX_COLORS) return BTNST_INVALIDINDEX;
// Get color
*crpColor = m_crColors[byColorIndex];
return BTNST_OK;
} // End of GetColor
//
// Parameters:
// [IN] lpszURL
// Pointer to a null-terminated string that contains the URL.
//
// Return value:
// BTNST_OK
// Function executed successfully.
//
DWORD CButtonST::SetURL(LPCTSTR lpszURL)
{
if (lpszURL != NULL)
{
// Store the URL
::lstrcpyn(m_szURL, lpszURL, _MAX_PATH);
} // if
else
{
// Remove any existing URL
::ZeroMemory(&m_szURL, sizeof(m_szURL));
} // else
return BTNST_OK;
} // End of SetURL
void CButtonST::CancelHover()
{
// If our button is not flat then do nothing
if (m_bIsFlat == FALSE) return;
if (m_bMouseOnButton == TRUE)
{
m_bMouseOnButton = FALSE;
Invalidate();
} // if
} // End of CancelHover
// This function enable or disable the autorepeat feature.
//
// Parameters:
// [IN] bSet
// TRUE to enable autorepeat. FALSE to disable.
// [IN] dwMilliseconds
// Time (in milliseconds) between each button click.
// If bSet is FALSE this parameter is ignored.
//
// Return value:
// BTNST_OK
// Function executed successfully.
//
DWORD CButtonST::SetAutoRepeat(BOOL bSet, DWORD dwMilliseconds)
{
m_bAutoRepeat = bSet;
m_dwPeriodAutoRepeat = dwMilliseconds;
return BTNST_OK;
} // End of SetAutoRepeat
// This function is called every time the button background needs to be painted.
// If the button is in transparent mode this function will NOT be called.
//
// Parameters:
// [IN] pDC
// Pointer to a CDC object that indicates the device context.
// [IN] pRect
// Pointer to a CRect object that indicates the bounds of the
// area to be painted.
//
// Return value:
// BTNST_OK
// Function executed successfully.
//
DWORD CButtonST::OnDrawBackground(CDC* pDC, LPCRECT pRect)
{
COLORREF crColor;
if (m_bMouseOnButton || m_bIsPressed)
crColor = m_crColors[BTNST_COLOR_BK_IN];
else
crColor = m_crColors[BTNST_COLOR_BK_OUT];
CBrush brBackground(crColor);
pDC->FillRect(pRect, &brBackground);
return BTNST_OK;
} // End of OnDrawBackground
// This function is called every time the button border needs to be painted.
// If the button is in standard (not flat) mode this function will NOT be called.
//
// Parameters:
// [IN] pDC
// Pointer to a CDC object that indicates the device context.
// [IN] pRect
// Pointer to a CRect object that indicates the bounds of the
// area to be painted.
//
// Return value:
// BTNST_OK
// Function executed successfully.
//
DWORD CButtonST::OnDrawBorder(CDC* pDC, LPCRECT pRect)
{
if (m_bIsPressed)
pDC->Draw3dRect(pRect, ::GetSysColor(COLOR_BTNSHADOW), ::GetSysColor(COLOR_BTNHILIGHT));
else
pDC->Draw3dRect(pRect, ::GetSysColor(COLOR_BTNHILIGHT), ::GetSysColor(COLOR_BTNSHADOW));
return BTNST_OK;
} // End of OnDrawBorder
#undef ST_LIKEIE
| 24.441247 | 142 | 0.691098 | vanch3d |
0de877a75279b08ba679f88aae91e54295c876f8 | 4,254 | cpp | C++ | Source/ChilliSource/UI/Base/UIComponentFactory.cpp | angelahnicole/ChilliSource_ParticleOpt | 6bee7e091c7635384d6aefbf730a69bbb5b55721 | [
"MIT"
] | null | null | null | Source/ChilliSource/UI/Base/UIComponentFactory.cpp | angelahnicole/ChilliSource_ParticleOpt | 6bee7e091c7635384d6aefbf730a69bbb5b55721 | [
"MIT"
] | null | null | null | Source/ChilliSource/UI/Base/UIComponentFactory.cpp | angelahnicole/ChilliSource_ParticleOpt | 6bee7e091c7635384d6aefbf730a69bbb5b55721 | [
"MIT"
] | null | null | null | //
// UIComponentFactory.cpp
// Chilli Source
// Created by Ian Copland on 14/11/2014.
//
// The MIT License (MIT)
//
// Copyright (c) 2014 Tag Games Limited
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#include <ChilliSource/UI/Base/UIComponentFactory.h>
#include <ChilliSource/UI/Button/HighlightUIComponent.h>
#include <ChilliSource/UI/Button/ToggleHighlightUIComponent.h>
#include <ChilliSource/UI/Drawable/DrawableUIComponent.h>
#include <ChilliSource/UI/Layout/LayoutUIComponent.h>
#include <ChilliSource/UI/ProgressBar/ProgressBarUIComponent.h>
#include <ChilliSource/UI/Slider/SliderUIComponent.h>
#include <ChilliSource/UI/Text/TextUIComponent.h>
namespace ChilliSource
{
CS_DEFINE_NAMEDTYPE(UIComponentFactory);
//-----------------------------------------------------------------
//-----------------------------------------------------------------
UIComponentFactoryUPtr UIComponentFactory::Create()
{
return UIComponentFactoryUPtr(new UIComponentFactory());
}
//-----------------------------------------------------------------
//-----------------------------------------------------------------
bool UIComponentFactory::IsA(InterfaceIDType in_interfaceId) const
{
return (UIComponentFactory::InterfaceID == in_interfaceId);
}
//-----------------------------------------------------------------
//-----------------------------------------------------------------
std::vector<PropertyMap::PropertyDesc> UIComponentFactory::GetPropertyDescs(const std::string& in_componentTypeName) const
{
auto descsIt = m_descsMap.find(in_componentTypeName);
CS_ASSERT(descsIt != m_descsMap.end(), "Could not get property descs for component with name: " + in_componentTypeName);
return descsIt->second;
}
//-----------------------------------------------------------------
//-----------------------------------------------------------------
UIComponentUPtr UIComponentFactory::CreateComponent(const std::string& in_componentTypeName, const std::string& in_name, const PropertyMap& in_propertyMap) const
{
auto delegateIt = m_creatorDelegateMap.find(in_componentTypeName);
CS_ASSERT(delegateIt != m_creatorDelegateMap.end(), "Could not create component with name: " + in_componentTypeName);
return delegateIt->second(in_name, in_propertyMap);
}
//-----------------------------------------------------------------
//-----------------------------------------------------------------
void UIComponentFactory::OnInit()
{
Register<DrawableUIComponent>("Drawable");
Register<LayoutUIComponent>("Layout");
Register<HighlightUIComponent>("Highlight");
Register<ToggleHighlightUIComponent>("ToggleHighlight");
Register<TextUIComponent>("Text");
Register<ProgressBarUIComponent>("ProgressBar");
Register<SliderUIComponent>("Slider");
}
//-----------------------------------------------------------------
//-----------------------------------------------------------------
void UIComponentFactory::OnDestroy()
{
m_creatorDelegateMap.clear();
}
} | 47.266667 | 165 | 0.588622 | angelahnicole |
0de8ebf64a3432db25b61a81fce305efc09195b8 | 2,325 | cpp | C++ | mmcv/ops/csrc/pytorch/scatter_points.cpp | BIGWangYuDong/mmcv | c46deb0576edaff5cd5a7d384c617478c7a73a70 | [
"Apache-2.0"
] | 1 | 2021-08-22T14:47:13.000Z | 2021-08-22T14:47:13.000Z | mmcv/ops/csrc/pytorch/scatter_points.cpp | BIGWangYuDong/mmcv | c46deb0576edaff5cd5a7d384c617478c7a73a70 | [
"Apache-2.0"
] | 2 | 2021-04-26T08:32:50.000Z | 2021-05-10T06:42:57.000Z | mmcv/ops/csrc/pytorch/scatter_points.cpp | BIGWangYuDong/mmcv | c46deb0576edaff5cd5a7d384c617478c7a73a70 | [
"Apache-2.0"
] | 1 | 2020-12-10T08:35:35.000Z | 2020-12-10T08:35:35.000Z | // Copyright (c) OpenMMLab. All rights reserved.
#include "pytorch_cpp_helper.hpp"
#include "pytorch_device_registry.hpp"
typedef enum { SUM = 0, MEAN = 1, MAX = 2 } reduce_t;
std::vector<torch::Tensor> dynamic_point_to_voxel_forward_impl(
const torch::Tensor &feats, const torch::Tensor &coors,
const reduce_t reduce_type) {
return DISPATCH_DEVICE_IMPL(dynamic_point_to_voxel_forward_impl, feats, coors,
reduce_type);
}
void dynamic_point_to_voxel_backward_impl(
torch::Tensor &grad_feats, const torch::Tensor &grad_reduced_feats,
const torch::Tensor &feats, const torch::Tensor &reduced_feats,
const torch::Tensor &coors_idx, const torch::Tensor &reduce_count,
const reduce_t reduce_type) {
DISPATCH_DEVICE_IMPL(dynamic_point_to_voxel_backward_impl, grad_feats,
grad_reduced_feats, feats, reduced_feats, coors_idx,
reduce_count, reduce_type);
}
inline reduce_t convert_reduce_type(const std::string &reduce_type) {
if (reduce_type == "max")
return reduce_t::MAX;
else if (reduce_type == "sum")
return reduce_t::SUM;
else if (reduce_type == "mean")
return reduce_t::MEAN;
else
TORCH_CHECK(false, "do not support reduce type " + reduce_type)
return reduce_t::SUM;
}
std::vector<torch::Tensor> dynamic_point_to_voxel_forward(
const torch::Tensor &feats, const torch::Tensor &coors,
const std::string &reduce_type) {
return dynamic_point_to_voxel_forward_impl(feats, coors,
convert_reduce_type(reduce_type));
}
void dynamic_point_to_voxel_backward(torch::Tensor &grad_feats,
const torch::Tensor &grad_reduced_feats,
const torch::Tensor &feats,
const torch::Tensor &reduced_feats,
const torch::Tensor &coors_idx,
const torch::Tensor &reduce_count,
const std::string &reduce_type) {
dynamic_point_to_voxel_backward_impl(grad_feats, grad_reduced_feats, feats,
reduced_feats, coors_idx, reduce_count,
convert_reduce_type(reduce_type));
}
| 43.055556 | 80 | 0.633978 | BIGWangYuDong |
0ded6b82ae3a7dfb659211f8157be0a0defcf1c9 | 3,060 | cpp | C++ | 17_gpsanta.cpp | risteon/IEEE_SB_Passau_advent_2016 | 138bc4b90e55cc444e4c740d1641281bfe058e31 | [
"MIT"
] | null | null | null | 17_gpsanta.cpp | risteon/IEEE_SB_Passau_advent_2016 | 138bc4b90e55cc444e4c740d1641281bfe058e31 | [
"MIT"
] | null | null | null | 17_gpsanta.cpp | risteon/IEEE_SB_Passau_advent_2016 | 138bc4b90e55cc444e4c740d1641281bfe058e31 | [
"MIT"
] | null | null | null | // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
// -- BEGIN LICENSE BLOCK ----------------------------------------------
// -- END LICENSE BLOCK ------------------------------------------------
//----------------------------------------------------------------------
/*!\file
*
* \author Christoph Rist <rist.christoph@gmail.com>
* \date 2016-12-28
*
*/
//----------------------------------------------------------------------
/***********************************
* IEEE SB Passau Adventskalender
* Problem 17
*/
#include <memory>
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <cmath>
#include <algorithm>
//#define TEST
#ifdef TEST
#include "io_redirect.h"
#endif
using namespace std;
class Graph
{
public:
using Node = pair<uint8_t, uint8_t>;
void addEdge(const Node& first_node, const Node& second_node)
{
addNode(first_node);
addNode(second_node);
nodes_[first_node].insert(second_node);
}
uint32_t nbSimplePaths(const Node& start, const Node& end)
{
set<Node> visited{};
uint32_t nb_paths = 0;
stack<pair<Node, set<Node>::const_iterator>> s;
s.emplace(start, nodes_[start].cbegin());
while(!s.empty())
{
auto& n = s.top();
if (n.first == end || n.second == nodes_[n.first].cend())
{
if (n.first == end)
++nb_paths;
visited.erase(n.first);
s.pop();
}
else
{
const Node& v = *n.second;
++n.second;
if (visited.find(v) == visited.cend())
{
s.emplace(v, nodes_.at(v).cbegin());
visited.insert(v);
}
}
}
return nb_paths;
}
private:
void addNode(const Node& n)
{
if (nodes_.find(n) == nodes_.cend())
{
nodes_.emplace(n, set<Node>{});
}
}
map<Node, set<Node>> nodes_;
};
Graph buildGraph(uint8_t size)
{
Graph g{};
for (uint8_t x = 1; x < size; ++x)
{
for (uint8_t y = 0; y < x; ++y)
{
g.addEdge({x - 1, y}, {x, y});
g.addEdge({x, y}, {x, y + 1});
}
}
return g;
}
int main(int argc, char* argv[])
{
#ifdef TEST
//////////////////////// INPUT/OUTPUT //////////////////////////
if (!redirect_io(argc, argv))
return 0;
#endif
uint32_t nb_testcases;
cin >> nb_testcases;
vector<uint8_t> sizes{};
// parse
string l;
getline(cin, l);
for (uint32_t i = 0; i < nb_testcases; ++i)
{
getline(cin, l);
const auto it = std::find(l.cbegin(), l.cend(), 'x');
if (it == l.cend())
throw runtime_error("Invalid input");
const int32_t first = stoi(string(l.cbegin(), it));
const int32_t second = stoi(string(it + 1, l.cend()));
if (first < 0 || first != second || first > 255)
throw runtime_error("Invalid input");
sizes.push_back(static_cast<uint8_t>(first));
}
for (uint8_t s : sizes)
{
auto g = buildGraph(s + 1);
cout <<g.nbSimplePaths({0, 0}, {s, s}) <<endl;
}
#ifdef TEST
cleanup_io();
#endif
return 0;
}
| 20.264901 | 75 | 0.508497 | risteon |
0df18d37a458cb900cf31f5bb56826ded09b2262 | 3,993 | cpp | C++ | tests/integral_tests.cpp | gridem/ReplobPrototype | 8c1f7ac46c9c46e7f02b402b8bbc5febaa152c90 | [
"Apache-2.0"
] | 3 | 2016-01-11T11:42:02.000Z | 2016-12-21T14:54:44.000Z | tests/integral_tests.cpp | gridem/ReplobPrototype | 8c1f7ac46c9c46e7f02b402b8bbc5febaa152c90 | [
"Apache-2.0"
] | null | null | null | tests/integral_tests.cpp | gridem/ReplobPrototype | 8c1f7ac46c9c46e7f02b402b8bbc5febaa152c90 | [
"Apache-2.0"
] | null | null | null | /*
* Copyright 2015 Grigory Demchenko (aka gridem)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <synca/synca.h>
#include <synca/log.h>
using namespace synca;
void f(){}
void addLocalNodePort(NodeId id, Port port)
{
JLOG("add node " << id << " with port " << port);
single<Nodes>().add(id, Endpoint{port, "127.0.0.1", Endpoint::Type::V4});
}
void broadcastTest()
{
if (thisNode() == 1)
{
go([] {
JLOG("broadcasting");
broadcast([] {
RJLOG("----- hello from node: " << thisNode());
});
});
}
}
void replobTest()
{
if (thisNode() != 1)
return;
go([] {
single<Replob>().apply([] {
RJLOG("--- commited for: " << thisNode());
if (thisNode() != 2)
return;
single<Replob>().apply([] {
RJLOG("--- commited from node 2 for: " << thisNode());
});
});
});
}
int counter = 0;
void applyCounterAsync()
{
go([] {
single<Replob>().apply([] {
++ counter;
if (thisNode() == 1)
{
applyCounterAsync();
}
});
});
}
void perfTest()
{
if (thisNode() == 1)
{
applyCounterAsync();
applyCounterAsync();
applyCounterAsync();
applyCounterAsync();
applyCounterAsync();
applyCounterAsync();
applyCounterAsync();
applyCounterAsync();
applyCounterAsync();
applyCounterAsync();
applyCounterAsync();
applyCounterAsync();
}
sleepFor(1000);
RLOG("Counter: " << counter);
}
void consistencyTest()
{
using L = std::vector<int>;
static int val = 0;
if (thisNode() <= 3)
{
for (int i = 0; i < 10; ++ i)
go([] {
NodeId src = thisNode();
int v = val++;
if (src == 3 && v == 5)
sleepFor(1000);
single<Replob>().apply([src, v] {
single<L>().push_back(int(v*10 + src));
});
});
}
sleepFor(1000);
int i = 0;
//VERIFY(single<L>().size() == 1000, "Invalid size");
for (int v: single<L>())
{
RJLOG("l[" << i++ << "] = " << v);
//VERIFY(v == i++, "Invalid value");
}
}
auto tests = {&broadcastTest, &replobTest, &perfTest, &consistencyTest};
int main(int argc, const char* argv[])
{
try
{
RLOG("address: " << (void*)&f);
VERIFY(argc == 4, "Invalid args");
NodeId id = std::stoi(argv[1]);
int nodes = std::stoi(argv[2]);
size_t nTest = std::stoi(argv[3]);
VERIFY(nTest < tests.size(), "Invalid test number");
RLOG("starting service with node " << id << " of " << nodes << ", test: " << nTest);
ThreadPool tp(1, "net");
scheduler<DefaultTag>().attach(tp);
service<NetworkTag>().attach(tp);
service<TimeoutTag>().attach(tp);
single<NodesConfig>().setThisNode(id);
MCleanup {
cleanupAll();
};
for (int i = 1; i <= nodes; ++ i)
addLocalNodePort(i, 8800 + i);
MsgListener msg;
msg.listen();
tests.begin()[nTest]();
sleepFor(2000);
//single<Nodes>().cleanup();
//msg.cancel();
//waitForAll();
}
catch (std::exception& e)
{
RLOG("Error: " << e.what());
return 1;
}
return 0;
}
| 23.91018 | 92 | 0.506136 | gridem |
0df1d1da1b576bcf10fcc2dcf1458ec893232fc5 | 1,844 | hpp | C++ | src/app/AuxGpios.hpp | uwmisl/purpledrop-stm32 | 7e40314f244e27fed04379774f00b4659ece3381 | [
"MIT"
] | 1 | 2022-03-27T02:32:01.000Z | 2022-03-27T02:32:01.000Z | src/app/AuxGpios.hpp | uwmisl/purpledrop-stm32 | 7e40314f244e27fed04379774f00b4659ece3381 | [
"MIT"
] | null | null | null | src/app/AuxGpios.hpp | uwmisl/purpledrop-stm32 | 7e40314f244e27fed04379774f00b4659ece3381 | [
"MIT"
] | null | null | null | #include <tuple>
#include "Events.hpp"
/** Run-time accessible list of Gpio types
*/
template<typename... Gpios>
class GpioArray {
public:
static void setOutput(uint32_t n, bool value) {
if(n >= size) {
return;
}
setOutputTable[n](value);
}
static void setInput(uint32_t n) {
if(n >= size) {
return;
}
setInputTable[n]();
}
static bool read(uint32_t n) {
if(n >= size) {
return false;
}
return readTable[n]();
}
static constexpr uint32_t size = sizeof...(Gpios);
private:
typedef void(*setOutputFn)(bool);
static constexpr setOutputFn setOutputTable[] = {&Gpios::setOutput...};
typedef void(*setInputFn)();
static constexpr setInputFn setInputTable[] = {&Gpios::setInput...};
typedef bool(*readFn)();
static constexpr readFn readTable[] = {&Gpios::read...};
};
template <typename GpioArrayType>
class AuxGpios {
public:
AuxGpios() {}
void init(EventBroker *broker)
{
mBroker = broker;
mGpioControlHandler.setFunction([this](auto &e) { HandleGpioControl(e); });
mBroker->registerHandler(&mGpioControlHandler);
}
private:
EventBroker *mBroker;
EventHandlerFunction<events::GpioControl> mGpioControlHandler;
void HandleGpioControl(events::GpioControl &e) {
if(e.pin >= GpioArrayType::size) {
return;
}
if(e.write) {
if(e.outputEnable) {
GpioArrayType::setOutput(e.pin, e.value);
} else {
GpioArrayType::setInput(e.pin);
}
}
bool readValue = GpioArrayType::read(e.pin);
// Return the value even on write; it can serve as an acknowledgement
e.callback(e.pin, readValue);
}
};
| 24.586667 | 83 | 0.58026 | uwmisl |
0df5c58634006e4f202d4d1db66b584a36c8ee69 | 2,735 | hpp | C++ | TurbulentArena/Map.hpp | doodlemeat/Turbulent-Arena | 9030f291693e670f7751e23538e649cc24dc929f | [
"MIT"
] | 2 | 2017-02-03T04:30:29.000Z | 2017-03-27T19:33:38.000Z | TurbulentArena/Map.hpp | doodlemeat/Turbulent-Arena | 9030f291693e670f7751e23538e649cc24dc929f | [
"MIT"
] | null | null | null | TurbulentArena/Map.hpp | doodlemeat/Turbulent-Arena | 9030f291693e670f7751e23538e649cc24dc929f | [
"MIT"
] | null | null | null | #pragma once
#include "Physics.hpp"
namespace bjoernligan
{
class Map : public sf::Drawable
{
public:
enum Orientation
{
ORIENTATION_ORTHOGONAL,
ORIENTATION_ISOMETRIC,
ORIENTATION_STAGGERED
};
enum RenderOrder
{
RENDERORDER_RIGHT_DOWN,
RENDERORDER_RIGHT_UP,
RENDERORDER_LEFT_DOWN,
RENDERORDER_LEFT_UP
};
struct Tileset
{
sf::Texture m_texture;
};
class Properties
{
friend class Map;
public:
std::string getProperty(const std::string& key);
bool hasProperty(const std::string& key);
protected:
std::map<std::string, std::string> m_propertySet;
void parseProperties(tinyxml2::XMLElement* propertiesNode);
};
struct TileInfo
{
std::array<sf::Vector2f, 4> m_textureCoordinates;
Tileset* m_tileset;
Properties m_properties;
};
class Tile
{
friend class Map;
public:
sf::Vector2i getPosition() const;
TileInfo* getTileInfo() const;
private:
TileInfo* m_tileInfo;
sf::Vertex* m_vertices;
};
struct LayerSet
{
sf::VertexArray m_vertices;
std::vector<std::unique_ptr<Tile>> m_tiles;
};
struct TileLayer
{
std::string m_name;
sf::Vector2i m_size;
std::map<Tileset*, std::unique_ptr<LayerSet>> m_layerSets;
Tile* getTile(int x, int y);
};
struct Object : public Properties
{
virtual ~Object();
int m_ID;
sf::Vector2f m_position;
std::vector<sf::Vector2f> m_points;
};
struct Polygon : public Object
{
};
class ObjectGroup
{
friend class Map;
public:
std::vector<Object*> getObjects() const;
private:
std::vector<std::unique_ptr<Object>> m_objects;
std::string m_name;
};
Map(const std::string& path);
bool load(const std::string& file);
TileLayer* getLayer(const std::string& name) const;
Tile* getTopmostTileAt(int x, int y);
Tile* getTopmostTileAt(const sf::Vector2i& position);
ObjectGroup* getObjectGroup(const std::string& name) const;
sf::Vector2i getSize() const;
sf::Vector2i getTilePosition(const sf::Vector2f& position) const;
int getWidth() const;
int getHeight() const;
sf::Vector2f getTileSize() const;
void draw(sf::RenderTarget& target, sf::RenderStates states) const;
bool GetRandomTopmostWalkableTile(const sf::Vector2i &p_xSearchStart, sf::Vector2i &p_xTarget, sf::Vector2i p_xSearchAreaSize);
private:
sf::Vector2i m_size;
sf::Vector2f m_tileSize;
std::string m_path;
sf::Color m_backgroundColor;
Orientation m_orientation;
RenderOrder m_renderOrder;
std::vector<std::unique_ptr<TileLayer>> m_tileLayers;
std::vector<std::unique_ptr<ObjectGroup>> m_objectGroups;
std::vector<std::unique_ptr<TileInfo>> m_tileInfo;
std::vector<std::unique_ptr<Tileset>> m_tilesets;
};
} | 21.367188 | 129 | 0.702742 | doodlemeat |
0df7b7d2c4de9228714f1fb13aca90ccdbae12fb | 5,674 | cpp | C++ | blast/src/objtools/blast/seqdb_writer/seqidlist_writer.cpp | mycolab/ncbi-blast | e59746cec78044d2bf6d65de644717c42f80b098 | [
"Apache-2.0"
] | null | null | null | blast/src/objtools/blast/seqdb_writer/seqidlist_writer.cpp | mycolab/ncbi-blast | e59746cec78044d2bf6d65de644717c42f80b098 | [
"Apache-2.0"
] | null | null | null | blast/src/objtools/blast/seqdb_writer/seqidlist_writer.cpp | mycolab/ncbi-blast | e59746cec78044d2bf6d65de644717c42f80b098 | [
"Apache-2.0"
] | null | null | null | /*
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
* Author: Amelia Fong
*
*/
#include <ncbi_pch.hpp>
#include <objtools/blast/seqdb_writer/seqidlist_writer.hpp>
#include <objtools/blast/seqdb_reader/seqdbcommon.hpp>
#include <objtools/blast/seqdb_reader/impl/seqdbgeneral.hpp>
#include <objects/seqloc/Seq_id.hpp>
BEGIN_NCBI_SCOPE
USING_SCOPE(objects);
/*
* This function creates v5 seqidlist file
* File Format:
* Header
* ------------------------------------------------------------------------------------
* char NULL byte
* Uint8 File Size
* Uint8 Total Num of Ids
* Uint4 Title Length (in bytes)
* char[] Title
* char Seqidlist create date string size (in bytes)
* char[] Seqidlist Create Date
* Uint8 Totol db length (0 if seqid list not associated with a specific db)
*
* If seqidlist is associated with a particular db:-
* char DB create date string size (in bytes)
* char[] DB create date
* Uint4 DB vol names string size (in bytes)
* char[] DB vol names
*
* Data
* ------------------------------------------------------------------------------------
* char ID string size (in bytes) if size >= byte max then byte set to 0xFF
* Uint4 ID string size if id size >= byte max
* char[] ID string
*
*/
int WriteBlastSeqidlistFile(const vector<string> & idlist, CNcbiOstream & os, const string & title, const CSeqDB * seqdb)
{
const char null_byte = 0;
Uint8 file_size = 0;
Uint8 total_num_ids = 0;
string create_date = kEmptyStr;
char create_date_size = 0;
Uint8 total_length = 0;
string vol_names = kEmptyStr;
Uint4 vol_names_size = 0;
Uint4 title_size = title.size();
string db_date = kEmptyStr;
char db_date_size = 0;
const unsigned char byte_max = 0xFF;
vector<string> tmplist;
tmplist.reserve(idlist.size());
if(seqdb != NULL) {
if (seqdb->GetBlastDbVersion() < eBDB_Version5) {
NCBI_THROW(CSeqDBException, eArgErr, "Seqidlist requires v5 database ");
}
total_length = seqdb->GetVolumeLength();
vector<string> vols;
seqdb->FindVolumePaths(vols, true);
ITERATE(vector<string>, itr, vols) {
if(itr != vols.begin()) {
vol_names += " ";
}
string v = kEmptyStr;
CSeqDB_Path(*itr).FindBaseName().GetString(v);
vol_names += v;
}
vol_names_size = vol_names.size();
db_date = seqdb->GetDate();
db_date_size = db_date.size();
}
for(unsigned int i=0; i < idlist.size(); i++) {
try {
CSeq_id seqid(idlist[i], CSeq_id::fParse_RawText | CSeq_id::fParse_AnyLocal | CSeq_id::fParse_PartialOK);
if(seqid.IsGi()) {
continue;
}
if(seqid.IsPir() || seqid.IsPrf()) {
string id = seqid.AsFastaString();
tmplist.push_back(id);
continue;
}
tmplist.push_back(seqid.GetSeqIdString(true));
} catch (CException & e) {
ERR_POST(e.GetMsg());
NCBI_THROW(CSeqDBException, eArgErr, "Invalid seq id: " + idlist[i]);
}
}
if (tmplist.size() == 0) {
ERR_POST("Empty seqid list");
return -1;
}
sort(tmplist.begin(), tmplist.end());
vector<string>::iterator it = unique (tmplist.begin(), tmplist.end());
tmplist.resize(distance(tmplist.begin(),it));
if(seqdb != NULL) {
vector<blastdb::TOid> oids;
vector<string> check_ids(tmplist);
seqdb->AccessionsToOids(check_ids, oids);
tmplist.clear();
for(unsigned int i=0; i < check_ids.size(); i++) {
if(oids[i] != kSeqDBEntryNotFound){
tmplist.push_back(check_ids[i]);
}
}
}
total_num_ids = tmplist.size();
CTime now(CTime::eCurrent);
create_date = now.AsString("b d, Y H:m P");
create_date_size = create_date.size();
os.write(&null_byte, 1);
os.write((char *)&file_size, 8);
os.write((char *)&total_num_ids, 8);
os.write((char *) &title_size, 4);
os.write(title.c_str(), title_size);
os.write(&create_date_size, 1);
os.write(create_date.c_str(), create_date_size);
os.write((char *)&total_length, 8);
if(vol_names != kEmptyStr) {
os.write(&db_date_size, 1);
os.write(db_date.c_str(), db_date_size);
os.write((char *) &vol_names_size, 4);
os.write(vol_names.c_str(), vol_names_size);
}
for(unsigned int i=0; i < tmplist.size(); i++) {
Uint4 id_len = tmplist[i].size();
if(id_len >= byte_max) {
os.write((char *)&byte_max, 1);
os.write((char *)&id_len, 4);
}
else {
char l = byte_max & id_len;
os.write(&l,1);
}
os.write(tmplist[i].c_str(), id_len);
}
os.flush();
file_size = (Uint8) os.tellp();
os.seekp(1);
os.write((char *)&file_size, 8);
os.flush();
return 0;
}
END_NCBI_SCOPE
| 29.863158 | 121 | 0.641699 | mycolab |
0dfc6de979a1680ac026f288ea4ac1f5eaa6e42c | 1,942 | hpp | C++ | modules/boost/simd/base/include/boost/simd/arithmetic/functions/min.hpp | feelpp/nt2 | 4d121e2c7450f24b735d6cff03720f07b4b2146c | [
"BSL-1.0"
] | 34 | 2017-05-19T18:10:17.000Z | 2022-01-04T02:18:13.000Z | modules/boost/simd/base/include/boost/simd/arithmetic/functions/min.hpp | feelpp/nt2 | 4d121e2c7450f24b735d6cff03720f07b4b2146c | [
"BSL-1.0"
] | null | null | null | modules/boost/simd/base/include/boost/simd/arithmetic/functions/min.hpp | feelpp/nt2 | 4d121e2c7450f24b735d6cff03720f07b4b2146c | [
"BSL-1.0"
] | 7 | 2017-12-02T12:59:17.000Z | 2021-07-31T12:46:14.000Z | //==============================================================================
// Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II
// Copyright 2009 - 2012 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 BOOST_SIMD_ARITHMETIC_FUNCTIONS_MIN_HPP_INCLUDED
#define BOOST_SIMD_ARITHMETIC_FUNCTIONS_MIN_HPP_INCLUDED
#include <boost/simd/include/functor.hpp>
#include <boost/dispatch/include/functor.hpp>
namespace boost { namespace simd { namespace tag
{
/*!
@brief min generic tag
Represents the min function in generic contexts.
@par Models:
Hierarchy
**/
struct min_ : ext::elementwise_<min_>
{
/// @brief Parent hierarchy
typedef ext::elementwise_<min_> parent;
template<class... Args>
static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args)
BOOST_AUTO_DECLTYPE_BODY( dispatching_min_( ext::adl_helper(), static_cast<Args&&>(args)... ) )
};
}
namespace ext
{
template<class Site>
BOOST_FORCEINLINE generic_dispatcher<tag::min_, Site> dispatching_min_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...)
{
return generic_dispatcher<tag::min_, Site>();
}
template<class... Args>
struct impl_min_;
}
/*!
Computes the smallest of its parameter.
@par semantic:
For any given value @c x and @c y of type @c T:
@code
T r = min(x, y);
@endcode
is similar to:
@code
T r = if (x < y) ? x : y;
@endcode
@param a0
@param a1
@return an value of the same type as the input.
**/
BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::min_, min, 2)
} }
#endif
| 27.352113 | 129 | 0.593718 | feelpp |
0dfcc7e07a50dfe95fa699c7a27836233ef39a85 | 1,886 | cpp | C++ | Hacker Blocks/Smart Keypad - Advanced.cpp | Shubhrmcf07/Competitive-Coding-and-Interview-Problems | 7281ea3163c0cf6938a3af7b54a8a14f97c97c0e | [
"MIT"
] | 51 | 2020-02-24T11:14:00.000Z | 2022-03-24T09:32:18.000Z | Hacker Blocks/Smart Keypad - Advanced.cpp | Shubhrmcf07/Competitive-Coding-and-Interview-Problems | 7281ea3163c0cf6938a3af7b54a8a14f97c97c0e | [
"MIT"
] | 3 | 2020-10-02T08:16:09.000Z | 2021-04-17T16:32:38.000Z | Hacker Blocks/Smart Keypad - Advanced.cpp | Shubhrmcf07/Competitive-Coding-and-Interview-Problems | 7281ea3163c0cf6938a3af7b54a8a14f97c97c0e | [
"MIT"
] | 18 | 2020-04-24T15:33:36.000Z | 2022-03-24T09:32:20.000Z | /* Hacker Blocks */
/* Title - Smart Keypad - Advanced */
/* Created By - Akash Modak */
/* Date - 14/07/2020 */
// Given a long vector of strings, print the strings that contain the strings generated by numeric string str.
// string searchIn [] = {
// "prateek", "sneha", "deepak", "arnav", "shikha", "palak",
// "utkarsh", "divyam", "vidhi", "sparsh", "akku"
// };
// For example, if the input is 26 and the string is coding, then output should be coding since 26 can produce co which is contained in coding.
// Input Format
// A numeric string str
// Constraints
// len(str) < 10
// No of strings in the vector < 10
// Output Format
// Each matched string from the given vector.
// Sample Input
// 34
// Sample Output
// vidhi
// divyam
// sneha
// Explanation
// 34 will result into combinations :
// *dg *eg *fg
// *dh *eh *fh
// *di *ei *fi
// Corresponding strings are output.
// vidhi contains dh
// divyam contains di
// sneha contains eh
#include<iostream>
#include <string>
using namespace std;
string table[]={" ",".+@$","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};
string searchIn [] = {
"prateek", "sneha", "deepak", "arnav", "shikha", "palak",
"utkarsh", "divyam", "vidhi", "sparsh", "akku"
};
void generate(char *inp,char *out, int i, int j){
if(inp[i]=='\0'){
out[j]='\0';
for(int k=0;k<11;k++){
size_t found = searchIn[k].find(out);
if(found!=string::npos)
cout<<searchIn[k]<<endl;
}
return;
}
int key = inp[i]-'0';
if(key==0)
generate(inp,out,i+1,j);
for(int m=0;table[key][m]!='\0';m++){
out[j]=table[key][m];
generate(inp,out,i+1,j+1);
}
return;
}
int main() {
char a[100000],out[100000];
cin>>a;
generate(a,out,0,0);
return 0;
} | 24.815789 | 144 | 0.560976 | Shubhrmcf07 |
0dff851ffc028fc2eebcad183e10ebac4f183a78 | 676 | hpp | C++ | Source/Generator.hpp | Myles-Trevino/Resonance | 47ff7c51caa8fc15862818f56a232c3e71dd7e0a | [
"Apache-2.0"
] | 1 | 2020-09-07T13:03:34.000Z | 2020-09-07T13:03:34.000Z | Source/Generator.hpp | Myles-Trevino/Resonance | 47ff7c51caa8fc15862818f56a232c3e71dd7e0a | [
"Apache-2.0"
] | null | null | null | Source/Generator.hpp | Myles-Trevino/Resonance | 47ff7c51caa8fc15862818f56a232c3e71dd7e0a | [
"Apache-2.0"
] | null | null | null | /*
Copyright 2020 Myles Trevino
Licensed under the Apache License, Version 2.0
https://www.apache.org/licenses/LICENSE-2.0
*/
#pragma once
#include <string>
#include <vector>
#include <glm/glm.hpp>
namespace LV
{
struct Mesh
{
std::vector<glm::fvec3> vertices;
std::vector<unsigned> indices;
};
}
namespace LV::Generator
{
void configure(float dft_window_duration, float sample_interval,
float harmonic_smoothing, float temporal_smoothing,
float height_multiplier, const std::string& logarithmic);
void generate(const std::string& file_name);
// Getters.
glm::ivec2 get_size();
float get_height();
Mesh get_dft_mesh();
Mesh get_base_mesh();
}
| 16.095238 | 65 | 0.732249 | Myles-Trevino |
0dff8a9ca53b74b92f0c31b57917793ef5887015 | 6,838 | cc | C++ | fastcap/fc_accs/lstpack.cc | wrcad/xictools | f46ba6d42801426739cc8b2940a809b74f1641e2 | [
"Apache-2.0"
] | 73 | 2017-10-26T12:40:24.000Z | 2022-03-02T16:59:43.000Z | fastcap/fc_accs/lstpack.cc | chris-ayala/xictools | 4ea72c118679caed700dab3d49a8d36445acaec3 | [
"Apache-2.0"
] | 12 | 2017-11-01T10:18:22.000Z | 2022-03-20T19:35:36.000Z | fastcap/fc_accs/lstpack.cc | chris-ayala/xictools | 4ea72c118679caed700dab3d49a8d36445acaec3 | [
"Apache-2.0"
] | 34 | 2017-10-06T17:04:21.000Z | 2022-02-18T16:22:03.000Z |
/*========================================================================*
* *
* Distributed by Whiteley Research Inc., Sunnyvale, California, USA *
* http://wrcad.com *
* Copyright (C) 2017 Whiteley Research Inc., all rights reserved. *
* Author: Stephen R. Whiteley, except as indicated. *
* *
* As fully as possible recognizing licensing terms and conditions *
* imposed by earlier work from which this work was derived, if any, *
* this work is released under the Apache License, Version 2.0 (the *
* "License"). You may not use this file except in compliance with *
* the License, and compliance with inherited licenses which are *
* specified in a sub-header below this one if applicable. A copy *
* of the License is provided with this distribution, or you may *
* obtain a copy of the License at *
* *
* http://www.apache.org/licenses/LICENSE-2.0 *
* *
* See the License for the specific language governing permissions *
* and limitations under the License. *
* *
* 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 NON- *
* INFRINGEMENT. IN NO EVENT SHALL WHITELEY RESEARCH INCORPORATED *
* OR STEPHEN R. WHITELEY 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. *
* *
*========================================================================*
* XicTools Integrated Circuit Design System *
* *
* lstpack -- Fast[er]Cap list file packer. *
* *
*========================================================================*
$Id:$
*========================================================================*/
#include "miscutil/lstring.h"
#include "miscutil/symtab.h"
#include "miscutil/pathlist.h"
// This program will assemble a unified list file from separate files.
// The unified format is supported by FasterCap from
// FastFieldSolvers.com, and by the Whiteley Research version of
// FastCap. It is not supported in the original MIT FastCap, or in
// FastCap2 from FastFieldSolvers.com.
//
// The argument is a path to a non-unified list file. The unified
// file is created in the current directory. If the original list
// file is named filename.lst, the new packed list file is named
// filename_p.lst. All referenced files are expected to be found in
// the same directory as the original list file.
namespace {
struct elt_t
{
const char *tab_name() { return (e_name); }
elt_t *tab_next() { return (e_next); }
void set_tab_next(elt_t *n) { e_next = n; }
elt_t *tgen_next(bool) { return (e_next); }
elt_t *e_next;
char *e_name;
};
table_t<elt_t> *hash_tab;
void hash(const char *str)
{
if (!hash_tab)
hash_tab = new table_t<elt_t>;
if (hash_tab->find(str))
return;
elt_t *e = new elt_t;
e->e_next = 0;
e->e_name = lstring::copy(str);
hash_tab->link(e);
hash_tab = hash_tab->check_rehash();
}
FILE *myopen(const char *dir, const char *fn)
{
if (!dir)
return (fopen(fn, "r"));
char *p = pathlist::mk_path(dir, fn);
FILE *fp = fopen(p, "r");
delete [] p;
return (fp);
}
}
int main(int argc, char **argv)
{
if (argc != 2) {
printf("Usage: %s filename\n", argv[0]);
printf(
"This creates a FasterCap unified list file from old-style separate\n"
"FastCap files, created in the current directory.\n\n");
return (1);
}
FILE *fpin = fopen(argv[1], "r");
if (!fpin) {
printf("Unable to open %s.\n\n", argv[1]);
return (2);
}
char buf[256];
strcpy(buf, lstring::strip_path(argv[1]));
char *e = strrchr(buf, '.');
if (e)
*e = 0;
strcat(buf, "_p.lst");
FILE *fpout =fopen(buf, "w");
if (!fpout) {
printf("Unable to open %s.\n\n", buf);
return (3);
}
// Path assumed for all input.
char *srcdir = 0;
if (lstring::strrdirsep(argv[1])) {
srcdir = lstring::copy(argv[1]);
*lstring::strrdirsep(srcdir) = 0;
}
// Hash the file names.
int lcnt = 0;
while (fgets(buf, 256, fpin) != 0) {
lcnt++;
if (buf[0] == 'C' || buf[0] == 'c') {
char *s = buf;
lstring::advtok(&s);
char *tok = lstring::getqtok(&s);
if (!tok) {
printf("Warning: C line without file name on line %d.\n",
lcnt);
continue;
}
hash(tok);
delete [] tok;
}
else if (buf[0] == 'D' || buf[0] == 'd') {
char *s = buf;
lstring::advtok(&s);
char *tok = lstring::getqtok(&s);
if (!tok) {
printf("Warning: D line without file name on line %d.\n",
lcnt);
continue;
}
hash(tok);
delete [] tok;
}
fputs(buf, fpout);
}
fclose(fpin);
fputs("End\n\n", fpout);
// Open and add the files we've hashed.
tgen_t<elt_t> gen(hash_tab);
elt_t *elt;
while ((elt = gen.next()) != 0) {
fpin = myopen(srcdir, elt->tab_name());
if (!fpin) {
printf("Warning: can't open %s, not packed.\n", elt->tab_name());
continue;
}
sprintf(buf, "File %s\n", elt->tab_name());
fputs(buf, fpout);
while (fgets(buf, 256, fpin) != 0)
fputs(buf, fpout);
fputs("End\n", fpout);
fclose(fpin);
}
return (0);
}
| 37.163043 | 78 | 0.463001 | wrcad |
df0029871f28b104ec97d43c21f17eacb65bacf3 | 2,295 | cpp | C++ | middleware/domain/source/discovery/main.cpp | casualcore/casual | 047a4eaabbba52ad3ce63dc698a9325ad5fcec6d | [
"MIT"
] | null | null | null | middleware/domain/source/discovery/main.cpp | casualcore/casual | 047a4eaabbba52ad3ce63dc698a9325ad5fcec6d | [
"MIT"
] | null | null | null | middleware/domain/source/discovery/main.cpp | casualcore/casual | 047a4eaabbba52ad3ce63dc698a9325ad5fcec6d | [
"MIT"
] | 1 | 2022-02-21T18:30:25.000Z | 2022-02-21T18:30:25.000Z | //!
//! Copyright (c) 2021, The casual project
//!
//! This software is licensed under the MIT license, https://opensource.org/licenses/MIT
//!
#include "domain/discovery/state.h"
#include "domain/discovery/instance.h"
#include "domain/discovery/handle.h"
#include "domain/discovery/common.h"
#include "common/exception/guard.h"
#include "common/argument.h"
#include "common/communication/instance.h"
namespace casual
{
using namespace common;
namespace domain::discovery
{
namespace local
{
namespace
{
struct Settings
{
};
auto initialize( Settings settings)
{
Trace trace{ "domain::discovery::local::initialize"};
communication::instance::whitelist::connect( discovery::instance::identity);
return State{};
}
auto condition( State& state)
{
return common::message::dispatch::condition::compose(
common::message::dispatch::condition::done( [&state]() { return state.done();})
);
}
void start( State state)
{
Trace trace{ "domain::discovery::local::start"};
log::line( verbose::log, "state: ", state);
auto handler = handle::create( state);
common::message::dispatch::pump(
local::condition( state),
handler,
common::communication::ipc::inbound::device());
}
void main( int argc, char** argv)
{
Trace trace{ "domain::discovery::local::main"};
Settings settings;
{
using namespace casual::common::argument;
Parse{ R"(responsible for orchestrating discoveries to and from other domains.)",
}( argc, argv);
}
start( initialize( std::move( settings)));
}
} // <unnamed>
} // local
} // domain::discovery
} // casual
int main( int argc, char** argv)
{
casual::common::exception::main::log::guard( [=]()
{
casual::domain::discovery::local::main( argc, argv);
});
} | 26.686047 | 99 | 0.518954 | casualcore |
df05ee58525d29d1927e3eeb1764f72b1fca9ad9 | 286 | cpp | C++ | test/quantity_test.cpp | horance-liu/cquantity | 27c0e60087cd9650e154eb527c20be4d7114228a | [
"Apache-2.0"
] | null | null | null | test/quantity_test.cpp | horance-liu/cquantity | 27c0e60087cd9650e154eb527c20be4d7114228a | [
"Apache-2.0"
] | null | null | null | test/quantity_test.cpp | horance-liu/cquantity | 27c0e60087cd9650e154eb527c20be4d7114228a | [
"Apache-2.0"
] | null | null | null | #include "quantity.h"
#include <gtest/gtest.h>
struct QuantityTest : testing::Test {
};
TEST_F(QuantityTest, 3_mile_not_equals_4_mile)
{
Length mile3 = {.amount = 3, .unit = MILE};
Length mile4 = {.amount = 4, .unit = MILE};
ASSERT_FALSE(length_equals(&mile3, &mile4));
} | 22 | 48 | 0.671329 | horance-liu |
df061b7261a8d87f2dde5e73691dab6a086bf953 | 46,492 | hpp | C++ | DemoFramework/FslGraphics/include/FslGraphics/Render/GenericBatch2D_fwd.hpp | alexvonduar/gtec-demo-framework | 6f8a7e429d0e15242ba64eb4cb41bfc2dd7dc749 | [
"MIT",
"BSD-3-Clause"
] | null | null | null | DemoFramework/FslGraphics/include/FslGraphics/Render/GenericBatch2D_fwd.hpp | alexvonduar/gtec-demo-framework | 6f8a7e429d0e15242ba64eb4cb41bfc2dd7dc749 | [
"MIT",
"BSD-3-Clause"
] | null | null | null | DemoFramework/FslGraphics/include/FslGraphics/Render/GenericBatch2D_fwd.hpp | alexvonduar/gtec-demo-framework | 6f8a7e429d0e15242ba64eb4cb41bfc2dd7dc749 | [
"MIT",
"BSD-3-Clause"
] | null | null | null | #ifndef FSLGRAPHICS_RENDER_GENERICBATCH2D_FWD_HPP
#define FSLGRAPHICS_RENDER_GENERICBATCH2D_FWD_HPP
/****************************************************************************************************************************************************
* Copyright (c) 2014 Freescale Semiconductor, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * 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 of the Freescale Semiconductor, Inc. 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************************************************************************************/
#include <FslBase/BasicTypes.hpp>
#include <FslBase/Math/Pixel/PxRectangle.hpp>
#include <FslGraphics/Font/FontGlyphPosition.hpp>
#include <FslGraphics/Render/BatchEffect.hpp>
#include <FslGraphics/Render/BatchSdfRenderConfig.hpp>
#include <FslGraphics/Render/BlendState.hpp>
#include <FslGraphics/Render/Stats/Batch2DStats.hpp>
#include <FslGraphics/Render/Stats/GenericBatch2DStats.hpp>
#include <FslGraphics/Render/Strategy/StrategyBatchByState.hpp>
#include <FslGraphics/TextureAtlas/AtlasTextureInfo.hpp>
#include <FslGraphics/Vertices/VertexPositionColorTexture.hpp>
#include <string>
#include <vector>
namespace Fsl
{
struct BitmapFontConfig;
struct Color;
struct Point2;
struct NativeTextureArea;
struct PxClipRectangle;
struct PxAreaRectangleF;
struct PxExtent2D;
struct PxRectangle;
struct PxRectangleU;
class StringViewLite;
struct Vector2;
struct Vector4;
class TextureAtlasBitmapFont;
template <typename T>
struct GenericBatch2DAtlasTexture
{
T Texture;
AtlasTextureInfo Info;
GenericBatch2DAtlasTexture(T texture, AtlasTextureInfo info)
: Texture(texture)
, Info(info)
{
}
};
namespace GenericBatch2DFormat
{
struct Normal
{
inline static constexpr float Format(const float v)
{
return v;
}
};
struct Flipped
{
inline static constexpr float Format(const float v)
{
return 1.0f - v;
}
};
}
const uint32_t GenericBatch2D_DEFAULT_CAPACITY = 2048;
//! @brief A really simple API independent way to draw some graphics
//! All methods operate in screen coordinate pixel mode where 0,0 is the top left corner and
//! the bottom right corner is equal to the display width-1,height-1
//! @note This API provides a form of batched immediate mode, so it will be slower than properly
// optimized graphics, but its faster to get something running and good for debugging.
template <typename TNativeBatch, typename TTexture, typename TVFormatter = GenericBatch2DFormat::Flipped>
class GenericBatch2D
{
static const uint32_t VERTICES_PER_QUAD = 4;
static const uint32_t EXPAND_QUAD_GROWTH = 1024;
public:
using texture_type = TTexture;
using atlas_texture_type = GenericBatch2DAtlasTexture<texture_type>;
using native_batch_type = TNativeBatch;
using stategy_type = StrategyBatchByState<texture_type>;
private:
stategy_type m_batchStrategy;
native_batch_type m_native;
PxRectangle m_screenRect;
bool m_inBegin;
bool m_restoreState;
std::vector<Vector2> m_posScratchpad;
std::vector<FontGlyphPosition> m_glyphScratchpad;
GenericBatch2DStats m_stats;
public:
GenericBatch2D(const native_batch_type& nativeBatchType, const PxExtent2D& currentExtent);
virtual ~GenericBatch2D();
void SetScreenExtent(const PxExtent2D& extentPx);
//! @brief Begin drawing. Defaults to blendState == BlendState::AlphaBlend, restoreState == false
void Begin();
//! @brief Begin drawing
//! @param blendState the BlendState to use
void Begin(const BlendState blendState);
//! @brief Begin drawing
//! @param blendState the BlendState to use
//! @param restoreState if true all native state that is modified by Batch2D will be restored to their initial setting
void Begin(const BlendState blendState, const bool restoreState);
//! @brief If in a begin/end block this switches the blend state to the requested state
void ChangeTo(const BlendState blendState);
void End();
// ---------- 0
//! @brief draw the texture at dstRect using the native texture area
//! @note Low level draw access (almost a passthrough function)
void Draw(const texture_type& srcTexture, const NativeTextureArea& srcArea, const PxAreaRectangleF& dstRectanglePxf, const Color& color);
//! @brief draw the texture at dstRect using the native texture area
//! @note Low level draw access (almost a passthrough function)
void Draw(const texture_type& srcTexture, const NativeTextureArea& srcArea, const PxAreaRectangleF& dstRectanglePxf, const Vector4& color);
//! @brief draw the texture at dstRect using the native texture area
//! @note Low level draw access (almost a passthrough function)
void Draw(const texture_type& srcTexture, const NativeQuadTextureCoords& srcArea, const PxAreaRectangleF& dstRectanglePxf, const Color& color);
//! @brief draw the texture at dstRect using the native texture area
//! @note Low level draw access (almost a passthrough function)
void Draw(const texture_type& srcTexture, const NativeQuadTextureCoords& srcArea, const PxAreaRectangleF& dstRectanglePxf, const Vector4& color);
// ---------- 0 with clip
//! @brief draw the texture at dstRect using the native texture area
//! @note Low level draw access (almost a passthrough function)
void Draw(const texture_type& srcTexture, const NativeTextureArea& srcArea, const PxAreaRectangleF& dstRectanglePxf, const Color& color,
const PxClipRectangle& clipRectPx);
//! @brief draw the texture at dstRect using the native texture area
//! @note Low level draw access (almost a passthrough function)
void Draw(const texture_type& srcTexture, const NativeTextureArea& srcArea, const PxAreaRectangleF& dstRectanglePxf, const Vector4& color,
const PxClipRectangle& clipRectPx);
//! @brief draw the texture at dstRect using the native texture area
//! @note Low level draw access (almost a passthrough function)
void Draw(const texture_type& srcTexture, const NativeQuadTextureCoords& srcArea, const PxAreaRectangleF& dstRectanglePxf, const Color& color,
const PxClipRectangle& clipRectPx);
//! @brief draw the texture at dstRect using the native texture area
//! @note Low level draw access (almost a passthrough function)
void Draw(const texture_type& srcTexture, const NativeQuadTextureCoords& srcArea, const PxAreaRectangleF& dstRectanglePxf, const Vector4& color,
const PxClipRectangle& clipRectPx);
// ---------- 1
//! @brief Draw the full texture at dstPosition
//! @note Do not invalidate the srcTexture before End() is called.
void Draw(const atlas_texture_type& srcTexture, const Vector2& dstPositionPxf, const Color& color);
//! @brief Draw the full texture at dstPosition
//! @note Do not invalidate the srcTexture before End() is called.
void Draw(const texture_type& srcTexture, const Vector2& dstPositionPxf, const Color& color);
//! @brief Scale the full texture to fit inside the dstRectangle
//! @note Do not invalidate the srcTexture before End() is called.
void Draw(const atlas_texture_type& srcTexture, const PxRectangle& dstRectanglePx, const Color& color);
//! @brief Scale the full texture to fit inside the dstRectangle
//! @note Do not invalidate the srcTexture before End() is called.
void Draw(const texture_type& srcTexture, const PxRectangle& dstRectanglePx, const Color& color);
//! @brief Scale the full texture to fit inside the dstRectangle
//! @note Do not invalidate the srcTexture before End() is called.
void Draw(const atlas_texture_type& srcTexture, const PxAreaRectangleF& dstRectanglePxf, const Color& color);
//! @brief Scale the full texture to fit inside the dstRectangle
//! @note Do not invalidate the srcTexture before End() is called.
void Draw(const texture_type& srcTexture, const PxAreaRectangleF& dstRectanglePxf, const Color& color);
void Draw(const atlas_texture_type& srcTexture, const PxAreaRectangleF& dstRectanglePxf, const Color& color, const BatchEffect effect);
void Draw(const texture_type& srcTexture, const PxAreaRectangleF& dstRectanglePxf, const Color& color, const BatchEffect effect);
// ---------- 2
//! @brief Draw the texture area at dstPosition
//! @note Do not invalidate the srcTexture before End() is called.
void Draw(const atlas_texture_type& srcTexture, const Vector2& dstPositionPxf, const PxRectangleU& srcRectanglePx, const Color& color);
//! @brief Draw the texture area at dstPosition
//! @note Do not invalidate the srcTexture before End() is called.
void Draw(const texture_type& srcTexture, const Vector2& dstPositionPxf, const PxRectangleU& srcRectanglePx, const Color& color);
//! @brief Draw the texture area at dstPosition
//! @note Do not invalidate the srcTexture before End() is called.
void Draw(const atlas_texture_type& srcTexture, const Vector2& dstPositionPxf, const PxRectangle& srcRectanglePx, const Color& color)
{
Draw(srcTexture, dstPositionPxf, ClampConvertToPxRectangleU(srcRectanglePx), color);
}
//! @brief Draw the texture area at dstPosition
//! @note Do not invalidate the srcTexture before End() is called.
void Draw(const texture_type& srcTexture, const Vector2& dstPositionPxf, const PxRectangle& srcRectanglePx, const Color& color)
{
Draw(srcTexture, dstPositionPxf, ClampConvertToPxRectangleU(srcRectanglePx), color);
}
// ---------- 2 with clip
//! @brief Draw the texture area at dstPosition
//! @note Do not invalidate the srcTexture before End() is called.
void Draw(const atlas_texture_type& srcTexture, const Vector2& dstPositionPxf, const PxRectangleU& srcRectanglePx, const Color& color,
const PxClipRectangle& clipRectPx);
//! @brief Draw the texture area at dstPosition
//! @note Do not invalidate the srcTexture before End() is called.
void Draw(const texture_type& srcTexture, const Vector2& dstPositionPxf, const PxRectangleU& srcRectanglePx, const Color& color,
const PxClipRectangle& clipRectPx);
//! @brief Draw the texture area at dstPosition
//! @note Do not invalidate the srcTexture before End() is called.
void Draw(const atlas_texture_type& srcTexture, const Vector2& dstPositionPxf, const PxRectangle& srcRectanglePx, const Color& color,
const PxClipRectangle& clipRectPx)
{
Draw(srcTexture, dstPositionPxf, ClampConvertToPxRectangleU(srcRectanglePx), color, clipRectPx);
}
//! @brief Draw the texture area at dstPosition
//! @note Do not invalidate the srcTexture before End() is called.
void Draw(const texture_type& srcTexture, const Vector2& dstPositionPxf, const PxRectangle& srcRectanglePx, const Color& color,
const PxClipRectangle& clipRectPx)
{
Draw(srcTexture, dstPositionPxf, ClampConvertToPxRectangleU(srcRectanglePx), color, clipRectPx);
}
// ---------- 2A
void Draw(const atlas_texture_type& srcTexture, const Vector2& dstPositionPxf, const PxRectangleU& srcRectanglePx, const Color& color,
const BatchEffect effect);
void Draw(const texture_type& srcTexture, const Vector2& dstPositionPxf, const PxRectangleU& srcRectanglePx, const Color& color,
const BatchEffect effect);
// ---------- 3
//! @brief Scale the texture area so it fits inside the dstRectangle
//! @note Do not invalidate the srcTexture before End() is called.
void Draw(const atlas_texture_type& srcTexture, const PxRectangle& dstRectanglePx, const PxRectangleU& srcRectanglePx, const Color& color);
//! @brief Scale the texture area so it fits inside the dstRectangle
//! @note Do not invalidate the srcTexture before End() is called.
void Draw(const texture_type& srcTexture, const PxRectangle& dstRectanglePx, const PxRectangleU& srcRectanglePx, const Color& color);
//! @brief Scale the texture area so it fits inside the dstRectangle
//! @note Do not invalidate the srcTexture before End() is called.
void Draw(const atlas_texture_type& srcTexture, const PxRectangle& dstRectanglePx, const PxRectangle& srcRectanglePx, const Color& color)
{
Draw(srcTexture, dstRectanglePx, ClampConvertToPxRectangleU(srcRectanglePx), color);
}
//! @brief Scale the texture area so it fits inside the dstRectangle
//! @note Do not invalidate the srcTexture before End() is called.
void Draw(const texture_type& srcTexture, const PxRectangle& dstRectanglePx, const PxRectangle& srcRectanglePx, const Color& color)
{
Draw(srcTexture, dstRectanglePx, ClampConvertToPxRectangleU(srcRectanglePx), color);
}
// ---------- 4
//! @brief Scale the texture area so it fits inside the dstRectangle
//! @note Do not invalidate the srcTexture before End() is called.
void Draw(const atlas_texture_type& srcTexture, const PxAreaRectangleF& dstRectanglePxf, const PxRectangleU& srcRectanglePx, const Color& color);
//! @brief Scale the texture area so it fits inside the dstRectangle
//! @note Do not invalidate the srcTexture before End() is called.
void Draw(const texture_type& srcTexture, const PxAreaRectangleF& dstRectanglePxf, const PxRectangleU& srcRectanglePx, const Color& color);
//! @brief Scale the texture area so it fits inside the dstRectangle
//! @note Do not invalidate the srcTexture before End() is called.
void Draw(const atlas_texture_type& srcTexture, const PxAreaRectangleF& dstRectanglePxf, const PxRectangle& srcRectanglePx, const Color& color)
{
Draw(srcTexture, dstRectanglePxf, ClampConvertToPxRectangleU(srcRectanglePx), color);
}
//! @brief Scale the texture area so it fits inside the dstRectangle
//! @note Do not invalidate the srcTexture before End() is called.
void Draw(const texture_type& srcTexture, const PxAreaRectangleF& dstRectanglePxf, const PxRectangle& srcRectanglePx, const Color& color)
{
Draw(srcTexture, dstRectanglePxf, ClampConvertToPxRectangleU(srcRectanglePx), color);
}
// ---------- 4 With clip
//! @brief Scale the texture area so it fits inside the dstRectangle
//! @note Do not invalidate the srcTexture before End() is called.
void Draw(const atlas_texture_type& srcTexture, const PxAreaRectangleF& dstRectanglePxf, const PxRectangleU& srcRectanglePx, const Color& color,
const PxClipRectangle& clipRectPx);
//! @brief Scale the texture area so it fits inside the dstRectangle
//! @note Do not invalidate the srcTexture before End() is called.
void Draw(const texture_type& srcTexture, const PxAreaRectangleF& dstRectanglePxf, const PxRectangleU& srcRectanglePx, const Color& color,
const PxClipRectangle& clipRectPx);
//! @brief Scale the texture area so it fits inside the dstRectangle
//! @note Do not invalidate the srcTexture before End() is called.
void Draw(const atlas_texture_type& srcTexture, const PxAreaRectangleF& dstRectanglePxf, const PxRectangle& srcRectanglePx, const Color& color,
const PxClipRectangle& clipRectPx)
{
Draw(srcTexture, dstRectanglePxf, ClampConvertToPxRectangleU(srcRectanglePx), color, clipRectPx);
}
//! @brief Scale the texture area so it fits inside the dstRectangle
//! @note Do not invalidate the srcTexture before End() is called.
void Draw(const texture_type& srcTexture, const PxAreaRectangleF& dstRectanglePxf, const PxRectangle& srcRectanglePx, const Color& color,
const PxClipRectangle& clipRectPx)
{
Draw(srcTexture, dstRectanglePxf, ClampConvertToPxRectangleU(srcRectanglePx), color, clipRectPx);
}
// ---------- 4A
//! @brief Scale the texture area so it fits inside the dstRectangle
void Draw(const atlas_texture_type& srcTexture, const PxAreaRectangleF& dstRectanglePxf, const PxRectangleU& srcRectanglePx, const Color& color,
const BatchEffect effect);
//! @brief Scale the texture area so it fits inside the dstRectangle
void Draw(const texture_type& srcTexture, const PxAreaRectangleF& dstRectanglePxf, const PxRectangleU& srcRectanglePx, const Color& color,
const BatchEffect effect);
// ---------- 5
//! @brief Draw the full texture at dstPosition
//! @note Do not invalidate the srcTexture before End() is called.
void Draw(const atlas_texture_type& srcTexture, const Vector2& dstPositionPxf, const Color& color, const Vector2& origin, const Vector2& scale);
//! @brief Draw the full texture at dstPosition
//! @note Do not invalidate the srcTexture before End() is called.
void Draw(const texture_type& srcTexture, const Vector2& dstPositionPxf, const Color& color, const Vector2& origin, const Vector2& scale);
//! @brief Draw the full texture at dstPosition
//! @note Do not invalidate the srcTexture before End() is called.
void Draw(const atlas_texture_type& srcTexture, const Vector2& dstPositionPxf, const Color& color, const Vector2& origin, const Vector2& scale,
const BatchEffect effect);
//! @brief Draw the full texture at dstPosition
//! @note Do not invalidate the srcTexture before End() is called.
void Draw(const texture_type& srcTexture, const Vector2& dstPositionPxf, const Color& color, const Vector2& origin, const Vector2& scale,
const BatchEffect effect);
// ---------- 6
//! @brief Draw the full texture at dstPosition
//! @note Do not invalidate the srcTexture before End() is called.
void Draw(const atlas_texture_type& srcTexture, const Vector2& dstPositionPxf, const Color& color, const float rotation, const Vector2& origin,
const Vector2& scale);
//! @brief Draw the full texture at dstPosition
//! @note Do not invalidate the srcTexture before End() is called.
void Draw(const texture_type& srcTexture, const Vector2& dstPositionPxf, const Color& color, const float rotation, const Vector2& origin,
const Vector2& scale);
// ---------- 7
//! @brief Draw the full texture at dstPosition
//! @note Do not invalidate the srcTexture before End() is called.
void Draw(const atlas_texture_type& srcTexture, const Vector2& dstPositionPxf, const PxRectangleU& srcRectanglePx, const Color& color,
const Vector2& origin, const Vector2& scale);
//! @brief Draw the full texture at dstPosition
//! @note Do not invalidate the srcTexture before End() is called.
void Draw(const texture_type& srcTexture, const Vector2& dstPositionPxf, const PxRectangleU& srcRectanglePx, const Color& color,
const Vector2& origin, const Vector2& scale);
//! @brief Draw the full texture at dstPosition
//! @note Do not invalidate the srcTexture before End() is called.
void Draw(const atlas_texture_type& srcTexture, const Vector2& dstPositionPxf, const PxRectangle& srcRectanglePx, const Color& color,
const Vector2& origin, const Vector2& scale)
{
Draw(srcTexture, dstPositionPxf, ClampConvertToPxRectangleU(srcRectanglePx), color, origin, scale);
}
//! @brief Draw the full texture at dstPosition
//! @note Do not invalidate the srcTexture before End() is called.
void Draw(const texture_type& srcTexture, const Vector2& dstPositionPxf, const PxRectangle& srcRectanglePx, const Color& color,
const Vector2& origin, const Vector2& scale)
{
Draw(srcTexture, dstPositionPxf, ClampConvertToPxRectangleU(srcRectanglePx), color, origin, scale);
}
// ---------- 7 with clip
//! @brief Draw the full texture at dstPosition
//! @note Do not invalidate the srcTexture before End() is called.
void Draw(const atlas_texture_type& srcTexture, const Vector2& dstPositionPxf, const PxRectangleU& srcRectanglePx, const Color& color,
const Vector2& origin, const Vector2& scale, const PxClipRectangle& clipRectPx);
//! @brief Draw the full texture at dstPosition
//! @note Do not invalidate the srcTexture before End() is called.
void Draw(const texture_type& srcTexture, const Vector2& dstPositionPxf, const PxRectangleU& srcRectanglePx, const Color& color,
const Vector2& origin, const Vector2& scale, const PxClipRectangle& clipRectPx);
//! @brief Draw the full texture at dstPosition
//! @note Do not invalidate the srcTexture before End() is called.
void Draw(const atlas_texture_type& srcTexture, const Vector2& dstPositionPxf, const PxRectangle& srcRectanglePx, const Color& color,
const Vector2& origin, const Vector2& scale, const PxClipRectangle& clipRectPx)
{
Draw(srcTexture, dstPositionPxf, ClampConvertToPxRectangleU(srcRectanglePx), color, origin, scale, clipRectPx);
}
//! @brief Draw the full texture at dstPosition
//! @note Do not invalidate the srcTexture before End() is called.
void Draw(const texture_type& srcTexture, const Vector2& dstPositionPxf, const PxRectangle& srcRectanglePx, const Color& color,
const Vector2& origin, const Vector2& scale, const PxClipRectangle& clipRectPx)
{
Draw(srcTexture, dstPositionPxf, ClampConvertToPxRectangleU(srcRectanglePx), color, origin, scale, clipRectPx);
}
// ---------- 7a
//! @brief Draw the full texture at dstPosition
//! @note Do not invalidate the srcTexture before End() is called.
void Draw(const atlas_texture_type& srcTexture, const Vector2& dstPositionPxf, const PxRectangleU& srcRectanglePx, const Color& color,
const Vector2& origin, const Vector2& scale, const BatchEffect effect);
//! @brief Draw the full texture at dstPosition
//! @note Do not invalidate the srcTexture before End() is called.
void Draw(const texture_type& srcTexture, const Vector2& dstPositionPxf, const PxRectangleU& srcRectanglePx, const Color& color,
const Vector2& origin, const Vector2& scale, const BatchEffect effect);
// ---------- 8
//! @brief Draw the full texture at dstPosition
//! @note Do not invalidate the srcTexture before End() is called.
void Draw(const atlas_texture_type& srcTexture, const Vector2& dstPositionPxf, const PxRectangleU& srcRectanglePx, const Color& color,
const float rotation, const Vector2& origin, const Vector2& scale);
//! @brief Draw the full texture at dstPosition
//! @note Do not invalidate the srcTexture before End() is called.
void Draw(const texture_type& srcTexture, const Vector2& dstPositionPxf, const PxRectangleU& srcRectanglePx, const Color& color,
const float rotation, const Vector2& origin, const Vector2& scale);
//! @brief Draw the full texture at dstPosition
//! @note Do not invalidate the srcTexture before End() is called.
void Draw(const atlas_texture_type& srcTexture, const Vector2& dstPositionPxf, const PxRectangle& srcRectanglePx, const Color& color,
const float rotation, const Vector2& origin, const Vector2& scale)
{
Draw(srcTexture, dstPositionPxf, ClampConvertToPxRectangleU(srcRectanglePx), color, rotation, origin, scale);
}
//! @brief Draw the full texture at dstPosition
//! @note Do not invalidate the srcTexture before End() is called.
void Draw(const texture_type& srcTexture, const Vector2& dstPositionPxf, const PxRectangle& srcRectanglePx, const Color& color,
const float rotation, const Vector2& origin, const Vector2& scale)
{
Draw(srcTexture, dstPositionPxf, ClampConvertToPxRectangleU(srcRectanglePx), color, rotation, origin, scale);
}
// ---------- 9
//! @brief Draw the full texture at the given dst positions
//! @note Do not invalidate the srcTexture before End() is called.
//! @note If you use this to draw a lot of instances consider using a more optimal way of rendering it.
void Draw(const atlas_texture_type& srcTexture, const Vector2* const pDstPositionsPxf, const uint32_t dstPositionsLength, const Color& color);
//! @brief Draw the full texture at the given dst positions
//! @note Do not invalidate the srcTexture before End() is called.
//! @note If you use this to draw a lot of instances consider using a more optimal way of rendering it.
void Draw(const texture_type& srcTexture, const Vector2* const pDstPositionsPxf, const uint32_t dstPositionsLength, const Color& color);
// ---------- 10
//! @brief Draw the texture area at the given dst positions
//! @note Do not invalidate the srcTexture before End() is called.
//! @note If you use this to draw a lot of instances consider using a more optimal way of rendering it.
void Draw(const atlas_texture_type& srcTexture, const Vector2* const pDstPositionsPxf, const uint32_t dstPositionsLength,
const PxRectangleU& srcRectanglePx, const Color& color);
//! @brief Draw the texture area at the given dst positions
//! @note Do not invalidate the srcTexture before End() is called.
//! @note If you use this to draw a lot of instances consider using a more optimal way of rendering it.
void Draw(const texture_type& srcTexture, const Vector2* const pDstPositionsPxf, const uint32_t dstPositionsLength,
const PxRectangleU& srcRectanglePx, const Color& color);
//! @brief Draw the texture area at the given dst positions
//! @note Do not invalidate the srcTexture before End() is called.
//! @note If you use this to draw a lot of instances consider using a more optimal way of rendering it.
void Draw(const atlas_texture_type& srcTexture, const Vector2* const pDstPositionsPxf, const uint32_t dstPositionsLength,
const PxRectangle& srcRectanglePx, const Color& color)
{
Draw(srcTexture, pDstPositionsPxf, dstPositionsLength, ClampConvertToPxRectangleU(srcRectanglePx), color);
}
//! @brief Draw the texture area at the given dst positions
//! @note Do not invalidate the srcTexture before End() is called.
//! @note If you use this to draw a lot of instances consider using a more optimal way of rendering it.
void Draw(const texture_type& srcTexture, const Vector2* const pDstPositionsPxf, const uint32_t dstPositionsLength,
const PxRectangle& srcRectanglePx, const Color& color)
{
Draw(srcTexture, pDstPositionsPxf, dstPositionsLength, ClampConvertToPxRectangleU(srcRectanglePx), color);
}
// ---------- 11
//! @brief Draw a ASCII string using the supplied TextureAtlasBitmapFont.
//! @param srcTexture the texture atlas that contains the font.
//! @param font the font to use for rendering the string
//! @param strView the string view to render
//! @param dstPosition to render the string at (top left corner) in pixels. As long as the dstPositionPxf is pixel aligned the rendered font
//! will also be pixel perfectly aligned.
//! @param color the color to use.
void DrawString(const texture_type& srcTexture, const TextureAtlasBitmapFont& font, const StringViewLite& strView, const Vector2& dstPositionPxf,
const Color& color);
//! @brief Draw a ASCII string using the supplied TextureAtlasBitmapFont.
//! @param srcTexture the texture atlas that contains the font.
//! @param font the font to use for rendering the string
//! @param psz a zero terminated string that should be rendered (!= nullptr)
//! @param the dstPosition to render the string at (top left corner)
//! @param color the color to use.
void DrawString(const texture_type& srcTexture, const TextureAtlasBitmapFont& font, const char* const psz, const Vector2& dstPositionPxf,
const Color& color);
//! @brief Draw a ASCII string using the supplied TextureAtlasBitmapFont.
//! @param srcTexture the texture atlas that contains the font.
//! @param font the font to use for rendering the string
//! @param str a string that should be rendered
//! @param the dstPosition to render the string at (top left corner)
//! @param color the color to use.
void DrawString(const texture_type& srcTexture, const TextureAtlasBitmapFont& font, const std::string& str, const Vector2& dstPositionPxf,
const Color& color);
// ---------- 12
//! @brief Draw a ASCII string using the supplied TextureAtlasBitmapFont.
//! @param srcTexture the texture atlas that contains the font.
//! @param font the font to use for rendering the string
//! @param strView the string view to render
//! @param the dstPosition to render the string at (top left corner)
//! @param color the color to use.
void DrawString(const texture_type& srcTexture, const TextureAtlasBitmapFont& font, const StringViewLite& strView, const Vector2& dstPositionPxf,
const Color& color, const Vector2& origin, const Vector2& scale);
//! @brief Draw a ASCII string using the supplied TextureAtlasBitmapFont.
//! @param srcTexture the texture atlas that contains the font.
//! @param font the font to use for rendering the string
//! @param psz a zero terminated string that should be rendered (!= nullptr)
//! @param the dstPosition to render the string at (top left corner)
//! @param color the color to use.
void DrawString(const texture_type& srcTexture, const TextureAtlasBitmapFont& font, const char* const psz, const Vector2& dstPositionPxf,
const Color& color, const Vector2& origin, const Vector2& scale);
//! @brief Draw a ASCII string using the supplied TextureAtlasBitmapFont.
//! @param srcTexture the texture atlas that contains the font.
//! @param font the font to use for rendering the string
//! @param str a string that should be rendered
//! @param the dstPosition to render the string at (top left corner)
//! @param color the color to use.
void DrawString(const texture_type& srcTexture, const TextureAtlasBitmapFont& font, const std::string& str, const Vector2& dstPositionPxf,
const Color& color, const Vector2& origin, const Vector2& scale);
// ---------- 13
//! @brief Draw a ASCII string using the supplied TextureAtlasBitmapFont.
//! @param srcTexture the texture atlas that contains the font.
//! @param font the font to use for rendering the string
//! @param fontConfig the font configuration.
//! @param strView the string view to render
//! @param the dstPosition to render the string at (top left corner)
//! @param color the color to use.
void DrawString(const texture_type& srcTexture, const TextureAtlasBitmapFont& font, const BitmapFontConfig& fontConfig,
const StringViewLite& strView, const Vector2& dstPositionPxf, const Color& color);
//! @brief Draw a ASCII string using the supplied TextureAtlasBitmapFont.
//! @param srcTexture the texture atlas that contains the font.
//! @param font the font to use for rendering the string
//! @param fontConfig the font configuration.
//! @param psz a zero terminated string that should be rendered (!= nullptr)
//! @param the dstPosition to render the string at (top left corner)
//! @param color the color to use.
void DrawString(const texture_type& srcTexture, const TextureAtlasBitmapFont& font, const BitmapFontConfig& fontConfig, const char* const psz,
const Vector2& dstPositionPxf, const Color& color);
//! @brief Draw a ASCII string using the supplied TextureAtlasBitmapFont.
//! @param srcTexture the texture atlas that contains the font.
//! @param font the font to use for rendering the string
//! @param fontConfig the font configuration.
//! @param str a string that should be rendered
//! @param the dstPosition to render the string at (top left corner)
//! @param color the color to use.
void DrawString(const texture_type& srcTexture, const TextureAtlasBitmapFont& font, const BitmapFontConfig& fontConfig, const std::string& str,
const Vector2& dstPositionPxf, const Color& color);
// ---------- 13 with clip
//! @brief Draw a ASCII string using the supplied TextureAtlasBitmapFont.
//! @param srcTexture the texture atlas that contains the font.
//! @param fontConfig the font configuration.
//! @param font the font to use for rendering the string
//! @param strView the string that should be rendered
//! @param the dstPosition to render the string at (top left corner)
//! @param color the color to use.
//! @param clipRectPx the rendering will be clipped against this
void DrawString(const texture_type& srcTexture, const TextureAtlasBitmapFont& font, const BitmapFontConfig& fontConfig,
const StringViewLite& strView, const Vector2& dstPositionPxf, const Color& color, const PxClipRectangle& clipRectPx);
//! @brief Draw a ASCII string using the supplied TextureAtlasBitmapFont.
//! @param srcTexture the texture atlas that contains the font.
//! @param fontConfig the font configuration.
//! @param font the font to use for rendering the string
//! @param strView the string that should be rendered
//! @param the dstPosition to render the string at (top left corner)
//! @param color the color to use.
//! @param clipRectPx the rendering will be clipped against this
void DrawString(const texture_type& srcTexture, const TextureAtlasBitmapFont& font, const BitmapFontConfig& fontConfig, const char* const psz,
const Vector2& dstPositionPxf, const Color& color, const PxClipRectangle& clipRectPx);
//! @brief Draw a ASCII string using the supplied TextureAtlasBitmapFont.
//! @param srcTexture the texture atlas that contains the font.
//! @param fontConfig the font configuration.
//! @param font the font to use for rendering the string
//! @param strView the string that should be rendered
//! @param the dstPosition to render the string at (top left corner)
//! @param color the color to use.
//! @param clipRectPx the rendering will be clipped against this
void DrawString(const texture_type& srcTexture, const TextureAtlasBitmapFont& font, const BitmapFontConfig& fontConfig, const std::string& str,
const Vector2& dstPositionPxf, const Color& color, const PxClipRectangle& clipRectPx);
// ---------- 14
//! @brief Draw a ASCII string using the supplied TextureAtlasBitmapFont.
//! @param srcTexture the texture atlas that contains the font.
//! @param font the font to use for rendering the string
//! @param strView the string view to render
//! @param the dstPosition to render the string at (top left corner)
//! @param color the color to use.
void DrawString(const texture_type& srcTexture, const TextureAtlasBitmapFont& font, const BitmapFontConfig& fontConfig,
const StringViewLite& strView, const Vector2& dstPositionPxf, const Color& color, const Vector2& origin, const Vector2& scale);
//! @brief Draw a ASCII string using the supplied TextureAtlasBitmapFont.
//! @param srcTexture the texture atlas that contains the font.
//! @param font the font to use for rendering the string
//! @param psz a zero terminated string that should be rendered (!= nullptr)
//! @param the dstPosition to render the string at (top left corner)
//! @param color the color to use.
void DrawString(const texture_type& srcTexture, const TextureAtlasBitmapFont& font, const BitmapFontConfig& fontConfig, const char* const psz,
const Vector2& dstPositionPxf, const Color& color, const Vector2& origin, const Vector2& scale);
//! @brief Draw a ASCII string using the supplied TextureAtlasBitmapFont.
//! @param srcTexture the texture atlas that contains the font.
//! @param font the font to use for rendering the string
//! @param str a string that should be rendered
//! @param the dstPosition to render the string at (top left corner)
//! @param color the color to use.
void DrawString(const texture_type& srcTexture, const TextureAtlasBitmapFont& font, const BitmapFontConfig& fontConfig, const std::string& str,
const Vector2& dstPositionPxf, const Color& color, const Vector2& origin, const Vector2& scale);
// ---------- 14 with clip
//! @brief Draw a ASCII string using the supplied TextureAtlasBitmapFont.
//! @param srcTexture the texture atlas that contains the font.
//! @param font the font to use for rendering the string
//! @param strView the string view to render
//! @param the dstPosition to render the string at (top left corner)
//! @param color the color to use.
void DrawString(const texture_type& srcTexture, const TextureAtlasBitmapFont& font, const BitmapFontConfig& fontConfig,
const StringViewLite& strView, const Vector2& dstPositionPxf, const Color& color, const Vector2& origin, const Vector2& scale,
const PxClipRectangle& clipRectPx);
//! @brief Draw a ASCII string using the supplied TextureAtlasBitmapFont.
//! @param srcTexture the texture atlas that contains the font.
//! @param font the font to use for rendering the string
//! @param psz a zero terminated string that should be rendered (!= nullptr)
//! @param the dstPosition to render the string at (top left corner)
//! @param color the color to use.
void DrawString(const texture_type& srcTexture, const TextureAtlasBitmapFont& font, const BitmapFontConfig& fontConfig, const char* const psz,
const Vector2& dstPositionPxf, const Color& color, const Vector2& origin, const Vector2& scale,
const PxClipRectangle& clipRectPx);
//! @brief Draw a ASCII string using the supplied TextureAtlasBitmapFont.
//! @param srcTexture the texture atlas that contains the font.
//! @param font the font to use for rendering the string
//! @param str a string that should be rendered
//! @param the dstPosition to render the string at (top left corner)
//! @param color the color to use.
void DrawString(const texture_type& srcTexture, const TextureAtlasBitmapFont& font, const BitmapFontConfig& fontConfig, const std::string& str,
const Vector2& dstPositionPxf, const Color& color, const Vector2& origin, const Vector2& scale,
const PxClipRectangle& clipRectPx);
// ----------
//! @brief Draw a rectangle at the given location using a fill texture
//! @param srcFillTexture a fill texture is texture containing a white rectangle, we will select the middle pixel of the texture and use it for
//! rendering lines.
//! @param color the color to use.
//! @note Do not invalidate the srcTexture before End() is called.
//! @note If you use this to draw a lot of instances consider using a more optimal way of rendering it.
void DebugDrawRectangle(const atlas_texture_type& srcFillTexture, const PxRectangle& dstRectanglePx, const Color& color);
//! @brief Draw a rectangle at the given location using a fill texture
//! @param srcFillTexture a fill texture is texture containing a white rectangle, we will select the middle pixel of the texture and use it for
//! rendering lines.
//! @param color the color to use.
//! @note Do not invalidate the srcTexture before End() is called.
//! @note If you use this to draw a lot of instances consider using a more optimal way of rendering it.
void DebugDrawRectangle(const texture_type& srcFillTexture, const PxRectangle& dstRectanglePx, const Color& color);
//! @brief Draw a rectangle at the given location using a fill texture
//! @param srcFillTexture a fill texture is texture containing a white rectangle, we will select the middle pixel of the texture and use it for
//! rendering lines.
//! @param color the color to use.
//! @note Do not invalidate the srcTexture before End() is called.
//! @note If you use this to draw a lot of instances consider using a more optimal way of rendering it.
void DebugDrawRectangle(const atlas_texture_type& srcFillTexture, const PxAreaRectangleF& dstRectanglePxf, const Color& color);
//! @brief Draw a rectangle at the given location using a fill texture
//! @param srcFillTexture a fill texture is texture containing a white rectangle, we will select the middle pixel of the texture and use it for
//! rendering lines.
//! @param color the color to use.
//! @note Do not invalidate the srcTexture before End() is called.
//! @note If you use this to draw a lot of instances consider using a more optimal way of rendering it.
void DebugDrawRectangle(const texture_type& srcFillTexture, const PxAreaRectangleF& dstRectanglePxf, const Color& color);
// ----------
//! @brief Draw a line using a fill texture
//! @param srcFillTexture a fill texture is texture containing a white rectangle, we will select the middle pixel of the texture and use it for
//! rendering lines.
//! @param color the color to use.
//! @note Do not invalidate the srcTexture before End() is called.
//! @note If you use this to draw a lot of instances consider using a more optimal way of rendering it.
void DebugDrawLine(const atlas_texture_type& srcFillTexture, const Vector2& dstFromPxf, const Vector2& dstToPxf, const Color& color);
//! @brief Draw a line using a fill texture
//! @param srcFillTexture a fill texture is texture containing a white rectangle, we will select the middle pixel of the texture and use it for
//! rendering lines.
//! @param color the color to use.
//! @note Do not invalidate the srcTexture before End() is called.
//! @note If you use this to draw a lot of instances consider using a more optimal way of rendering it.
void DebugDrawLine(const texture_type& srcFillTexture, const Vector2& dstFromPxf, const Vector2& dstToPxf, const Color& color);
Batch2DStats GetStats() const;
protected:
inline PxRectangleU ClampConvertToPxRectangleU(const PxRectangle& value) const
{
// If left and right is below zero clipping will occur (we consider this a error, hence the reason for the assert)
// width and height should always be >= 0 in a Rectangle
assert(value.Width() >= 0);
assert(value.Height() >= 0);
auto clippedLeft = std::max(value.Left(), 0);
auto clippedTop = std::max(value.Top(), 0);
auto clippedRight = std::max(value.Right(), clippedLeft);
auto clippedBottom = std::max(value.Bottom(), clippedTop);
assert(clippedLeft >= 0 && clippedTop >= 0 && clippedLeft <= clippedRight && clippedTop <= clippedBottom);
assert((clippedRight - clippedLeft) <= value.Width());
assert((clippedBottom - clippedTop) <= value.Height());
return PxRectangleU::FromLeftTopRightBottom(
static_cast<PxRectangleU::value_type>(clippedLeft), static_cast<PxRectangleU::value_type>(clippedTop),
static_cast<PxRectangleU::value_type>(clippedRight), static_cast<PxRectangleU::value_type>(clippedBottom), OptimizationCheckFlag::NoCheck);
}
private:
void FlushQuads();
inline void EnsurePosScratchpadCapacity(const uint32_t minCapacity);
inline void Rotate2D(Vector2& rPoint0, Vector2& rPoint1, Vector2& rPoint2, Vector2& rPoint3, const float rotation) const;
inline BatchSdfRenderConfig ToBatchSdfRenderConfig(const TextureAtlasBitmapFont& font, const BitmapFontConfig& fontConfig);
};
// TNativeBatch is expected to be a pointer type
// The TNativeBatch must have the ConceptNativeBatchType methods
// The TTexture must have the ConceptTextureType methods
// The TextureHandle must have the ConceptTextureHandle methods
//
// class ConceptTextureHandle
//{
// int32_t q;
// public:
// bool operator==(const ConceptTextureHandle& rhs) const { return q == rhs.q; }
// bool operator!=(const ConceptTextureHandle& rhs) const { return !(*this == rhs); }
//};
// class ConceptNativeBatchType
//{
// public:
// void Begin(const Point2& screenResolution, const BlendState blendState) {}
// void DrawQuads(const VertexPositionColorTexture*const pVertices, const int32_t length, ConceptTextureHandle& texture) {}
// void End() {}
//};
// class ConceptTextureType
//{
// public:
// ConceptTextureHandle Handle;
// Point2 Size;
// void Reset() {}
// bool operator==(const ConceptTextureType& rhs) const { return Handle == rhs.Handle && Size == rhs.Size; }
// bool operator!=(const ConceptTextureType& rhs) const { return !(*this == rhs); }
//};
}
#endif
| 55.545998 | 150 | 0.716424 | alexvonduar |
df098c755169d774bd5b99ca5f24b74652fc9420 | 2,656 | cpp | C++ | HackerRank Solutions/Data Structures/Heap/QHEAP1.cpp | UtkarshPathrabe/Competitive-Coding | ba322fbb1b88682d56a9b80bdd92a853f1caa84e | [
"MIT"
] | 13 | 2021-09-02T07:30:02.000Z | 2022-03-22T19:32:03.000Z | HackerRank Solutions/Data Structures/Heap/QHEAP1.cpp | UtkarshPathrabe/Competitive-Coding | ba322fbb1b88682d56a9b80bdd92a853f1caa84e | [
"MIT"
] | null | null | null | HackerRank Solutions/Data Structures/Heap/QHEAP1.cpp | UtkarshPathrabe/Competitive-Coding | ba322fbb1b88682d56a9b80bdd92a853f1caa84e | [
"MIT"
] | 3 | 2021-08-24T16:06:22.000Z | 2021-09-17T15:39:53.000Z | #include <iostream>
#include <vector>
#include <map>
using namespace std;
// Map to maintain the index of values in the heap.
map<int, int> value_index;
int heap[500002], heap_size = 0;
void insert_val(int val)
{
if(heap_size == 0)
{
heap[++heap_size] = val;
value_index[val] = heap_size;
return;
}
heap[++heap_size] = val;
value_index[val] = heap_size;
int iter = heap_size;
while(iter > 1)
{
if(heap[iter] < heap[iter/2])
{
value_index[heap[iter]] = iter/2;
value_index[heap[iter/2]] = iter;
int temp = heap[iter];
heap[iter] = heap[iter/2];
heap[iter/2] = temp;
iter /= 2;
}
else
break;
}
}
void delete_val(int val)
{
int index = value_index[val];
value_index[val] = 0;
value_index[heap[heap_size]] = index;
heap[index] = heap[heap_size--];
while(true)
{
int left_child = 2*index, right_child = 2*index + 1;;
if(left_child <= heap_size)
{
if(right_child <= heap_size)
{
if(heap[index] > heap[left_child] || heap[index] > heap[right_child])
{
int swap_index = (heap[left_child] < heap[right_child])? left_child:right_child;
value_index[heap[swap_index]] = index;;
value_index[heap[index]] = swap_index;;
int temp = heap[index];
heap[index] = heap[swap_index];
heap[swap_index] = temp;
index = swap_index;
}
else
break;
}
else
{
if(heap[index] > heap[left_child])
{
value_index[heap[left_child]] = index;
value_index[heap[index]] = left_child;
int temp = heap[index];
heap[index] = heap[left_child];
heap[left_child] = temp;
index = left_child;
}
else
break;
}
}
else
break;
}
}
int main()
{
int queries;
cin>>queries;
while(queries--)
{
int type, val;
cin>>type;
if(type == 1) // insert
{
cin>>val;
insert_val(val);
}
else if(type == 2) // delete
{
cin>>val;
delete_val(val);
}
else
{
cout<<heap[1]<<endl;
}
}
return 0;
} | 24.592593 | 100 | 0.444654 | UtkarshPathrabe |
df0a4d213b83bd03be598b741c04d96ec3d371ae | 3,378 | cpp | C++ | examples/calculator/src/calculator/Calculator.cpp | amirbawab/EasyCCC- | 2bba922715d442ad250997bed6116d98fa1418bc | [
"MIT"
] | 20 | 2017-08-26T19:35:29.000Z | 2022-03-28T12:41:46.000Z | examples/calculator/src/calculator/Calculator.cpp | amirbawab/EasyCCC- | 2bba922715d442ad250997bed6116d98fa1418bc | [
"MIT"
] | 4 | 2017-09-09T18:56:05.000Z | 2018-01-29T20:13:45.000Z | examples/calculator/src/calculator/Calculator.cpp | amirbawab/EasyCCC- | 2bba922715d442ad250997bed6116d98fa1418bc | [
"MIT"
] | 2 | 2018-12-27T06:42:05.000Z | 2020-03-31T01:52:48.000Z | #include <calculator/Calculator.h>
int Calculator::compile(std::vector<std::string> inputFiles, std::string outputFile) {
// Initialize semantic action handlers
initHandlers();
// Set output file
m_output.open(outputFile);
// Configure easycc
m_easyCC->setParsingPhase(0);
m_easyCC->setSilentSyntaxErrorMessages(false);
m_easyCC->setSilentSemanticEvents(false);
m_easyCC->setOnSyntaxError([&](){
m_easyCC->setSilentSemanticEvents(true);
m_output << "Error evaluating expression" << std::endl;
m_output.close();
});
// Compile all files
for(std::string fileName : inputFiles) {
int code = m_easyCC->compile(fileName);
if(code != ecc::IEasyCC::OK_CODE) {
return code;
}
}
return 0;
}
void Calculator::initHandlers() {
/**
* Register 'push' semantic action
* Every time an integer is read it will be pushed into the stack
*/
m_easyCC->registerSemanticAction("#push#",[&](int phase, Tokens &lexicalVector, int index){
m_operands.push(std::stoi(lexicalVector[index]->getValue()));
});
/**
* Register 'plus' semantic action
* Once the two operands are pushed, add them and push the result into the stack
*/
m_easyCC->registerSemanticAction("#plus#",[&](int phase, Tokens &lexicalVector, int index){
int popR = m_operands.top();
m_operands.pop();
int popL = m_operands.top();
m_operands.pop();
m_operands.push(popL + popR);
});
/**
* Register 'minus' semantic action
* Once the two operands are pushed, subtract them and push the result into the stack
*/
m_easyCC->registerSemanticAction("#minus#",[&](int phase, Tokens &lexicalVector, int index){
int popR = m_operands.top();
m_operands.pop();
int popL = m_operands.top();
m_operands.pop();
m_operands.push(popL - popR);
});
/**
* Register 'multiply' semantic action
* Once the two operands are pushed, multiply them and push the result into the stack
*/
m_easyCC->registerSemanticAction("#multiply#",[&](int phase, Tokens &lexicalVector, int index){
int popR = m_operands.top();
m_operands.pop();
int popL = m_operands.top();
m_operands.pop();
m_operands.push(popL * popR);
});
/**
* Register 'divide' semantic action
* Once the two operands are pushed, divide them and push the result into the stack
*/
m_easyCC->registerSemanticAction("#divide#",[&](int phase, Tokens &lexicalVector, int index){
int popR = m_operands.top();
m_operands.pop();
int popL = m_operands.top();
m_operands.pop();
m_operands.push(popL / popR);
});
/**
* Register 'print' semantic action
* At the end of the expression, output the result to a file
*/
m_easyCC->registerSemanticAction("#print#",[&](int phase, Tokens &lexicalVector, int index){
m_output << "Expression result: " << m_operands.top() << std::endl;
m_operands.pop();
});
/**
* Register 'end' semantic action
* Once the end of file is reached, close the output file
*/
m_easyCC->registerSemanticAction("#end#",[&](int phase, Tokens &lexicalVector, int index){
m_output.close();
});
}
| 31.867925 | 99 | 0.618709 | amirbawab |
df0def27e73116f8cbf74dd8a719697919a52ffa | 747 | hpp | C++ | inc/kos/boot/efi/filesystem.hpp | EmilGedda/kOS | 86d9e3ae377b6d7f003feb1c6ce584e427ed0563 | [
"MIT"
] | 5 | 2018-07-24T02:57:20.000Z | 2020-06-02T04:23:09.000Z | inc/kos/boot/efi/filesystem.hpp | EmilGedda/kOS | 86d9e3ae377b6d7f003feb1c6ce584e427ed0563 | [
"MIT"
] | null | null | null | inc/kos/boot/efi/filesystem.hpp | EmilGedda/kOS | 86d9e3ae377b6d7f003feb1c6ce584e427ed0563 | [
"MIT"
] | 1 | 2018-08-27T15:47:21.000Z | 2018-08-27T15:47:21.000Z | #pragma once
#include <kos/view.hpp>
#include <kos/types.hpp>
#include <Uefi/UefiBaseType.h>
#include <Uefi/UefiSpec.h>
#include <Guid/FileInfo.h>
#include <Protocol/SimpleFileSystem.h>
namespace kos::boot::efi {
struct file_metadata {
u64 size = 0;
};
struct file {
u8* data = 0;
u64 size = 0;
file_metadata info{};
~file();
};
struct filesystem {
inline static EFI_GUID guid = EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID;
EFI_FILE_PROTOCOL *root = 0;
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *protocol = 0;
static auto from_handle(EFI_HANDLE device_handle) -> filesystem;
auto stat(EFI_FILE_PROTOCOL* file) -> file_metadata;
auto open(view<wchar_t> path) -> file;
};
} // namespace kos::boot::efi
| 21.342857 | 71 | 0.686747 | EmilGedda |