blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
201
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
85
license_type
stringclasses
2 values
repo_name
stringlengths
7
100
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
260 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
11.4k
681M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
80 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
8
9.86M
extension
stringclasses
52 values
content
stringlengths
8
9.86M
authors
sequencelengths
1
1
author
stringlengths
0
119
547f4e915b9e492fd792e0f0a8065d9dc27e32a9
5eb5adc6bc0cf7d80581b92668b8cd4b615894dd
/software/mesa/src/gallium/drivers/swr/rasterizer/core/frontend.cpp
db470784a5e776c73024c8c7a2ea62ca5e4a72a8
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
dhanna11/OpenGPU
44a295e5e58e45b330216f944588383ae0cb4c39
ab2f01253bba311e082dfae695b9e70138de75d4
refs/heads/master
2020-04-22T01:52:18.415379
2017-09-20T22:40:15
2017-09-20T22:40:15
170,027,743
8
4
null
null
null
null
UTF-8
C++
false
false
106,028
cpp
/**************************************************************************** * Copyright (C) 2014-2015 Intel Corporation. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * @file frontend.cpp * * @brief Implementation for Frontend which handles vertex processing, * primitive assembly, clipping, binning, etc. * ******************************************************************************/ #include "api.h" #include "frontend.h" #include "backend.h" #include "context.h" #include "rdtsc_core.h" #include "rasterizer.h" #include "conservativeRast.h" #include "utils.h" #include "threads.h" #include "pa.h" #include "clip.h" #include "tilemgr.h" #include "tessellator.h" #include <limits> ////////////////////////////////////////////////////////////////////////// /// @brief Helper macro to generate a bitmask static INLINE uint32_t GenMask(uint32_t numBits) { SWR_ASSERT(numBits <= (sizeof(uint32_t) * 8), "Too many bits (%d) for %s", numBits, __FUNCTION__); return ((1U << numBits) - 1); } ////////////////////////////////////////////////////////////////////////// /// @brief Offsets added to post-viewport vertex positions based on /// raster state. static const simdscalar g_pixelOffsets[SWR_PIXEL_LOCATION_UL + 1] = { _simd_set1_ps(0.0f), // SWR_PIXEL_LOCATION_CENTER _simd_set1_ps(0.5f), // SWR_PIXEL_LOCATION_UL }; ////////////////////////////////////////////////////////////////////////// /// @brief FE handler for SwrSync. /// @param pContext - pointer to SWR context. /// @param pDC - pointer to draw context. /// @param workerId - thread's worker id. Even thread has a unique id. /// @param pUserData - Pointer to user data passed back to sync callback. /// @todo This should go away when we switch this to use compute threading. void ProcessSync( SWR_CONTEXT *pContext, DRAW_CONTEXT *pDC, uint32_t workerId, void *pUserData) { BE_WORK work; work.type = SYNC; work.pfnWork = ProcessSyncBE; MacroTileMgr *pTileMgr = pDC->pTileMgr; pTileMgr->enqueue(0, 0, &work); } ////////////////////////////////////////////////////////////////////////// /// @brief FE handler for SwrClearRenderTarget. /// @param pContext - pointer to SWR context. /// @param pDC - pointer to draw context. /// @param workerId - thread's worker id. Even thread has a unique id. /// @param pUserData - Pointer to user data passed back to clear callback. /// @todo This should go away when we switch this to use compute threading. void ProcessClear( SWR_CONTEXT *pContext, DRAW_CONTEXT *pDC, uint32_t workerId, void *pUserData) { CLEAR_DESC *pDesc = (CLEAR_DESC*)pUserData; MacroTileMgr *pTileMgr = pDC->pTileMgr; // queue a clear to each macro tile // compute macro tile bounds for the specified rect uint32_t macroTileXMin = pDesc->rect.xmin / KNOB_MACROTILE_X_DIM; uint32_t macroTileXMax = (pDesc->rect.xmax - 1) / KNOB_MACROTILE_X_DIM; uint32_t macroTileYMin = pDesc->rect.ymin / KNOB_MACROTILE_Y_DIM; uint32_t macroTileYMax = (pDesc->rect.ymax - 1) / KNOB_MACROTILE_Y_DIM; BE_WORK work; work.type = CLEAR; work.pfnWork = ProcessClearBE; work.desc.clear = *pDesc; for (uint32_t y = macroTileYMin; y <= macroTileYMax; ++y) { for (uint32_t x = macroTileXMin; x <= macroTileXMax; ++x) { pTileMgr->enqueue(x, y, &work); } } } ////////////////////////////////////////////////////////////////////////// /// @brief FE handler for SwrStoreTiles. /// @param pContext - pointer to SWR context. /// @param pDC - pointer to draw context. /// @param workerId - thread's worker id. Even thread has a unique id. /// @param pUserData - Pointer to user data passed back to callback. /// @todo This should go away when we switch this to use compute threading. void ProcessStoreTiles( SWR_CONTEXT *pContext, DRAW_CONTEXT *pDC, uint32_t workerId, void *pUserData) { RDTSC_START(FEProcessStoreTiles); MacroTileMgr *pTileMgr = pDC->pTileMgr; STORE_TILES_DESC* pDesc = (STORE_TILES_DESC*)pUserData; // queue a store to each macro tile // compute macro tile bounds for the specified rect uint32_t macroTileXMin = pDesc->rect.xmin / KNOB_MACROTILE_X_DIM; uint32_t macroTileXMax = (pDesc->rect.xmax - 1) / KNOB_MACROTILE_X_DIM; uint32_t macroTileYMin = pDesc->rect.ymin / KNOB_MACROTILE_Y_DIM; uint32_t macroTileYMax = (pDesc->rect.ymax - 1) / KNOB_MACROTILE_Y_DIM; // store tiles BE_WORK work; work.type = STORETILES; work.pfnWork = ProcessStoreTileBE; work.desc.storeTiles = *pDesc; for (uint32_t y = macroTileYMin; y <= macroTileYMax; ++y) { for (uint32_t x = macroTileXMin; x <= macroTileXMax; ++x) { pTileMgr->enqueue(x, y, &work); } } RDTSC_STOP(FEProcessStoreTiles, 0, pDC->drawId); } ////////////////////////////////////////////////////////////////////////// /// @brief FE handler for SwrInvalidateTiles. /// @param pContext - pointer to SWR context. /// @param pDC - pointer to draw context. /// @param workerId - thread's worker id. Even thread has a unique id. /// @param pUserData - Pointer to user data passed back to callback. /// @todo This should go away when we switch this to use compute threading. void ProcessDiscardInvalidateTiles( SWR_CONTEXT *pContext, DRAW_CONTEXT *pDC, uint32_t workerId, void *pUserData) { RDTSC_START(FEProcessInvalidateTiles); DISCARD_INVALIDATE_TILES_DESC *pDesc = (DISCARD_INVALIDATE_TILES_DESC*)pUserData; MacroTileMgr *pTileMgr = pDC->pTileMgr; // compute macro tile bounds for the specified rect uint32_t macroTileXMin = (pDesc->rect.xmin + KNOB_MACROTILE_X_DIM - 1) / KNOB_MACROTILE_X_DIM; uint32_t macroTileXMax = (pDesc->rect.xmax / KNOB_MACROTILE_X_DIM) - 1; uint32_t macroTileYMin = (pDesc->rect.ymin + KNOB_MACROTILE_Y_DIM - 1) / KNOB_MACROTILE_Y_DIM; uint32_t macroTileYMax = (pDesc->rect.ymax / KNOB_MACROTILE_Y_DIM) - 1; if (pDesc->fullTilesOnly == false) { // include partial tiles macroTileXMin = pDesc->rect.xmin / KNOB_MACROTILE_X_DIM; macroTileXMax = (pDesc->rect.xmax - 1) / KNOB_MACROTILE_X_DIM; macroTileYMin = pDesc->rect.ymin / KNOB_MACROTILE_Y_DIM; macroTileYMax = (pDesc->rect.ymax - 1) / KNOB_MACROTILE_Y_DIM; } SWR_ASSERT(macroTileXMax <= KNOB_NUM_HOT_TILES_X); SWR_ASSERT(macroTileYMax <= KNOB_NUM_HOT_TILES_Y); macroTileXMax = std::min<int32_t>(macroTileXMax, KNOB_NUM_HOT_TILES_X); macroTileYMax = std::min<int32_t>(macroTileYMax, KNOB_NUM_HOT_TILES_Y); // load tiles BE_WORK work; work.type = DISCARDINVALIDATETILES; work.pfnWork = ProcessDiscardInvalidateTilesBE; work.desc.discardInvalidateTiles = *pDesc; for (uint32_t x = macroTileXMin; x <= macroTileXMax; ++x) { for (uint32_t y = macroTileYMin; y <= macroTileYMax; ++y) { pTileMgr->enqueue(x, y, &work); } } RDTSC_STOP(FEProcessInvalidateTiles, 0, pDC->drawId); } ////////////////////////////////////////////////////////////////////////// /// @brief Computes the number of primitives given the number of verts. /// @param mode - primitive topology for draw operation. /// @param numPrims - number of vertices or indices for draw. /// @todo Frontend needs to be refactored. This will go in appropriate place then. uint32_t GetNumPrims( PRIMITIVE_TOPOLOGY mode, uint32_t numPrims) { switch (mode) { case TOP_POINT_LIST: return numPrims; case TOP_TRIANGLE_LIST: return numPrims / 3; case TOP_TRIANGLE_STRIP: return numPrims < 3 ? 0 : numPrims - 2; case TOP_TRIANGLE_FAN: return numPrims < 3 ? 0 : numPrims - 2; case TOP_TRIANGLE_DISC: return numPrims < 2 ? 0 : numPrims - 1; case TOP_QUAD_LIST: return numPrims / 4; case TOP_QUAD_STRIP: return numPrims < 4 ? 0 : (numPrims - 2) / 2; case TOP_LINE_STRIP: return numPrims < 2 ? 0 : numPrims - 1; case TOP_LINE_LIST: return numPrims / 2; case TOP_LINE_LOOP: return numPrims; case TOP_RECT_LIST: return numPrims / 3; case TOP_LINE_LIST_ADJ: return numPrims / 4; case TOP_LISTSTRIP_ADJ: return numPrims < 3 ? 0 : numPrims - 3; case TOP_TRI_LIST_ADJ: return numPrims / 6; case TOP_TRI_STRIP_ADJ: return numPrims < 4 ? 0 : (numPrims / 2) - 2; case TOP_PATCHLIST_1: case TOP_PATCHLIST_2: case TOP_PATCHLIST_3: case TOP_PATCHLIST_4: case TOP_PATCHLIST_5: case TOP_PATCHLIST_6: case TOP_PATCHLIST_7: case TOP_PATCHLIST_8: case TOP_PATCHLIST_9: case TOP_PATCHLIST_10: case TOP_PATCHLIST_11: case TOP_PATCHLIST_12: case TOP_PATCHLIST_13: case TOP_PATCHLIST_14: case TOP_PATCHLIST_15: case TOP_PATCHLIST_16: case TOP_PATCHLIST_17: case TOP_PATCHLIST_18: case TOP_PATCHLIST_19: case TOP_PATCHLIST_20: case TOP_PATCHLIST_21: case TOP_PATCHLIST_22: case TOP_PATCHLIST_23: case TOP_PATCHLIST_24: case TOP_PATCHLIST_25: case TOP_PATCHLIST_26: case TOP_PATCHLIST_27: case TOP_PATCHLIST_28: case TOP_PATCHLIST_29: case TOP_PATCHLIST_30: case TOP_PATCHLIST_31: case TOP_PATCHLIST_32: return numPrims / (mode - TOP_PATCHLIST_BASE); case TOP_POLYGON: case TOP_POINT_LIST_BF: case TOP_LINE_STRIP_CONT: case TOP_LINE_STRIP_BF: case TOP_LINE_STRIP_CONT_BF: case TOP_TRIANGLE_FAN_NOSTIPPLE: case TOP_TRI_STRIP_REVERSE: case TOP_PATCHLIST_BASE: case TOP_UNKNOWN: SWR_ASSERT(false, "Unsupported topology: %d", mode); return 0; } return 0; } ////////////////////////////////////////////////////////////////////////// /// @brief Computes the number of verts given the number of primitives. /// @param mode - primitive topology for draw operation. /// @param numPrims - number of primitives for draw. uint32_t GetNumVerts( PRIMITIVE_TOPOLOGY mode, uint32_t numPrims) { switch (mode) { case TOP_POINT_LIST: return numPrims; case TOP_TRIANGLE_LIST: return numPrims * 3; case TOP_TRIANGLE_STRIP: return numPrims ? numPrims + 2 : 0; case TOP_TRIANGLE_FAN: return numPrims ? numPrims + 2 : 0; case TOP_TRIANGLE_DISC: return numPrims ? numPrims + 1 : 0; case TOP_QUAD_LIST: return numPrims * 4; case TOP_QUAD_STRIP: return numPrims ? numPrims * 2 + 2 : 0; case TOP_LINE_STRIP: return numPrims ? numPrims + 1 : 0; case TOP_LINE_LIST: return numPrims * 2; case TOP_LINE_LOOP: return numPrims; case TOP_RECT_LIST: return numPrims * 3; case TOP_LINE_LIST_ADJ: return numPrims * 4; case TOP_LISTSTRIP_ADJ: return numPrims ? numPrims + 3 : 0; case TOP_TRI_LIST_ADJ: return numPrims * 6; case TOP_TRI_STRIP_ADJ: return numPrims ? (numPrims + 2) * 2 : 0; case TOP_PATCHLIST_1: case TOP_PATCHLIST_2: case TOP_PATCHLIST_3: case TOP_PATCHLIST_4: case TOP_PATCHLIST_5: case TOP_PATCHLIST_6: case TOP_PATCHLIST_7: case TOP_PATCHLIST_8: case TOP_PATCHLIST_9: case TOP_PATCHLIST_10: case TOP_PATCHLIST_11: case TOP_PATCHLIST_12: case TOP_PATCHLIST_13: case TOP_PATCHLIST_14: case TOP_PATCHLIST_15: case TOP_PATCHLIST_16: case TOP_PATCHLIST_17: case TOP_PATCHLIST_18: case TOP_PATCHLIST_19: case TOP_PATCHLIST_20: case TOP_PATCHLIST_21: case TOP_PATCHLIST_22: case TOP_PATCHLIST_23: case TOP_PATCHLIST_24: case TOP_PATCHLIST_25: case TOP_PATCHLIST_26: case TOP_PATCHLIST_27: case TOP_PATCHLIST_28: case TOP_PATCHLIST_29: case TOP_PATCHLIST_30: case TOP_PATCHLIST_31: case TOP_PATCHLIST_32: return numPrims * (mode - TOP_PATCHLIST_BASE); case TOP_POLYGON: case TOP_POINT_LIST_BF: case TOP_LINE_STRIP_CONT: case TOP_LINE_STRIP_BF: case TOP_LINE_STRIP_CONT_BF: case TOP_TRIANGLE_FAN_NOSTIPPLE: case TOP_TRI_STRIP_REVERSE: case TOP_PATCHLIST_BASE: case TOP_UNKNOWN: SWR_ASSERT(false, "Unsupported topology: %d", mode); return 0; } return 0; } ////////////////////////////////////////////////////////////////////////// /// @brief Return number of verts per primitive. /// @param topology - topology /// @param includeAdjVerts - include adjacent verts in primitive vertices INLINE uint32_t NumVertsPerPrim(PRIMITIVE_TOPOLOGY topology, bool includeAdjVerts) { uint32_t numVerts = 0; switch (topology) { case TOP_POINT_LIST: case TOP_POINT_LIST_BF: numVerts = 1; break; case TOP_LINE_LIST: case TOP_LINE_STRIP: case TOP_LINE_LIST_ADJ: case TOP_LINE_LOOP: case TOP_LINE_STRIP_CONT: case TOP_LINE_STRIP_BF: case TOP_LISTSTRIP_ADJ: numVerts = 2; break; case TOP_TRIANGLE_LIST: case TOP_TRIANGLE_STRIP: case TOP_TRIANGLE_FAN: case TOP_TRI_LIST_ADJ: case TOP_TRI_STRIP_ADJ: case TOP_TRI_STRIP_REVERSE: case TOP_RECT_LIST: numVerts = 3; break; case TOP_QUAD_LIST: case TOP_QUAD_STRIP: numVerts = 4; break; case TOP_PATCHLIST_1: case TOP_PATCHLIST_2: case TOP_PATCHLIST_3: case TOP_PATCHLIST_4: case TOP_PATCHLIST_5: case TOP_PATCHLIST_6: case TOP_PATCHLIST_7: case TOP_PATCHLIST_8: case TOP_PATCHLIST_9: case TOP_PATCHLIST_10: case TOP_PATCHLIST_11: case TOP_PATCHLIST_12: case TOP_PATCHLIST_13: case TOP_PATCHLIST_14: case TOP_PATCHLIST_15: case TOP_PATCHLIST_16: case TOP_PATCHLIST_17: case TOP_PATCHLIST_18: case TOP_PATCHLIST_19: case TOP_PATCHLIST_20: case TOP_PATCHLIST_21: case TOP_PATCHLIST_22: case TOP_PATCHLIST_23: case TOP_PATCHLIST_24: case TOP_PATCHLIST_25: case TOP_PATCHLIST_26: case TOP_PATCHLIST_27: case TOP_PATCHLIST_28: case TOP_PATCHLIST_29: case TOP_PATCHLIST_30: case TOP_PATCHLIST_31: case TOP_PATCHLIST_32: numVerts = topology - TOP_PATCHLIST_BASE; break; default: SWR_ASSERT(false, "Unsupported topology: %d", topology); break; } if (includeAdjVerts) { switch (topology) { case TOP_LISTSTRIP_ADJ: case TOP_LINE_LIST_ADJ: numVerts = 4; break; case TOP_TRI_STRIP_ADJ: case TOP_TRI_LIST_ADJ: numVerts = 6; break; default: break; } } return numVerts; } ////////////////////////////////////////////////////////////////////////// /// @brief Generate mask from remaining work. /// @param numWorkItems - Number of items being worked on by a SIMD. static INLINE simdscalari GenerateMask(uint32_t numItemsRemaining) { uint32_t numActive = (numItemsRemaining >= KNOB_SIMD_WIDTH) ? KNOB_SIMD_WIDTH : numItemsRemaining; uint32_t mask = (numActive > 0) ? ((1 << numActive) - 1) : 0; return _simd_castps_si(vMask(mask)); } ////////////////////////////////////////////////////////////////////////// /// @brief Gather scissor rect data based on per-prim viewport indices. /// @param pScissorsInFixedPoint - array of scissor rects in 16.8 fixed point. /// @param pViewportIndex - array of per-primitive vewport indexes. /// @param scisXmin - output vector of per-prmitive scissor rect Xmin data. /// @param scisYmin - output vector of per-prmitive scissor rect Ymin data. /// @param scisXmax - output vector of per-prmitive scissor rect Xmax data. /// @param scisYmax - output vector of per-prmitive scissor rect Ymax data. // /// @todo: Look at speeding this up -- weigh against corresponding costs in rasterizer. template<size_t SimdWidth> struct GatherScissors { static void Gather(const SWR_RECT* pScissorsInFixedPoint, const uint32_t* pViewportIndex, simdscalari &scisXmin, simdscalari &scisYmin, simdscalari &scisXmax, simdscalari &scisYmax) { SWR_ASSERT(0, "Unhandled Simd Width in Scissor Rect Gather"); } }; template<> struct GatherScissors<8> { static void Gather(const SWR_RECT* pScissorsInFixedPoint, const uint32_t* pViewportIndex, simdscalari &scisXmin, simdscalari &scisYmin, simdscalari &scisXmax, simdscalari &scisYmax) { scisXmin = _simd_set_epi32(pScissorsInFixedPoint[pViewportIndex[0]].xmin, pScissorsInFixedPoint[pViewportIndex[1]].xmin, pScissorsInFixedPoint[pViewportIndex[2]].xmin, pScissorsInFixedPoint[pViewportIndex[3]].xmin, pScissorsInFixedPoint[pViewportIndex[4]].xmin, pScissorsInFixedPoint[pViewportIndex[5]].xmin, pScissorsInFixedPoint[pViewportIndex[6]].xmin, pScissorsInFixedPoint[pViewportIndex[7]].xmin); scisYmin = _simd_set_epi32(pScissorsInFixedPoint[pViewportIndex[0]].ymin, pScissorsInFixedPoint[pViewportIndex[1]].ymin, pScissorsInFixedPoint[pViewportIndex[2]].ymin, pScissorsInFixedPoint[pViewportIndex[3]].ymin, pScissorsInFixedPoint[pViewportIndex[4]].ymin, pScissorsInFixedPoint[pViewportIndex[5]].ymin, pScissorsInFixedPoint[pViewportIndex[6]].ymin, pScissorsInFixedPoint[pViewportIndex[7]].ymin); scisXmax = _simd_set_epi32(pScissorsInFixedPoint[pViewportIndex[0]].xmax, pScissorsInFixedPoint[pViewportIndex[1]].xmax, pScissorsInFixedPoint[pViewportIndex[2]].xmax, pScissorsInFixedPoint[pViewportIndex[3]].xmax, pScissorsInFixedPoint[pViewportIndex[4]].xmax, pScissorsInFixedPoint[pViewportIndex[5]].xmax, pScissorsInFixedPoint[pViewportIndex[6]].xmax, pScissorsInFixedPoint[pViewportIndex[7]].xmax); scisYmax = _simd_set_epi32(pScissorsInFixedPoint[pViewportIndex[0]].ymax, pScissorsInFixedPoint[pViewportIndex[1]].ymax, pScissorsInFixedPoint[pViewportIndex[2]].ymax, pScissorsInFixedPoint[pViewportIndex[3]].ymax, pScissorsInFixedPoint[pViewportIndex[4]].ymax, pScissorsInFixedPoint[pViewportIndex[5]].ymax, pScissorsInFixedPoint[pViewportIndex[6]].ymax, pScissorsInFixedPoint[pViewportIndex[7]].ymax); } }; ////////////////////////////////////////////////////////////////////////// /// @brief StreamOut - Streams vertex data out to SO buffers. /// Generally, we are only streaming out a SIMDs worth of triangles. /// @param pDC - pointer to draw context. /// @param workerId - thread's worker id. Even thread has a unique id. /// @param numPrims - Number of prims to streamout (e.g. points, lines, tris) static void StreamOut( DRAW_CONTEXT* pDC, PA_STATE& pa, uint32_t workerId, uint32_t* pPrimData, uint32_t streamIndex) { RDTSC_START(FEStreamout); const API_STATE& state = GetApiState(pDC); const SWR_STREAMOUT_STATE &soState = state.soState; uint32_t soVertsPerPrim = NumVertsPerPrim(pa.binTopology, false); // The pPrimData buffer is sparse in that we allocate memory for all 32 attributes for each vertex. uint32_t primDataDwordVertexStride = (KNOB_NUM_ATTRIBUTES * sizeof(float) * 4) / sizeof(uint32_t); SWR_STREAMOUT_CONTEXT soContext = { 0 }; // Setup buffer state pointers. for (uint32_t i = 0; i < 4; ++i) { soContext.pBuffer[i] = &state.soBuffer[i]; } uint32_t numPrims = pa.NumPrims(); for (uint32_t primIndex = 0; primIndex < numPrims; ++primIndex) { DWORD slot = 0; uint32_t soMask = soState.streamMasks[streamIndex]; // Write all entries into primitive data buffer for SOS. while (_BitScanForward(&slot, soMask)) { __m128 attrib[MAX_NUM_VERTS_PER_PRIM]; // prim attribs (always 4 wide) uint32_t paSlot = slot + VERTEX_ATTRIB_START_SLOT; pa.AssembleSingle(paSlot, primIndex, attrib); // Attribute offset is relative offset from start of vertex. // Note that attributes start at slot 1 in the PA buffer. We need to write this // to prim data starting at slot 0. Which is why we do (slot - 1). // Also note: GL works slightly differently, and needs slot 0 uint32_t primDataAttribOffset = slot * sizeof(float) * 4 / sizeof(uint32_t); // Store each vertex's attrib at appropriate locations in pPrimData buffer. for (uint32_t v = 0; v < soVertsPerPrim; ++v) { uint32_t* pPrimDataAttrib = pPrimData + primDataAttribOffset + (v * primDataDwordVertexStride); _mm_store_ps((float*)pPrimDataAttrib, attrib[v]); } soMask &= ~(1 << slot); } // Update pPrimData pointer soContext.pPrimData = pPrimData; // Call SOS SWR_ASSERT(state.pfnSoFunc[streamIndex] != nullptr, "Trying to execute uninitialized streamout jit function."); state.pfnSoFunc[streamIndex](soContext); } // Update SO write offset. The driver provides memory for the update. for (uint32_t i = 0; i < 4; ++i) { if (state.soBuffer[i].pWriteOffset) { *state.soBuffer[i].pWriteOffset = soContext.pBuffer[i]->streamOffset * sizeof(uint32_t); } if (state.soBuffer[i].soWriteEnable) { pDC->dynState.SoWriteOffset[i] = soContext.pBuffer[i]->streamOffset * sizeof(uint32_t); pDC->dynState.SoWriteOffsetDirty[i] = true; } } UPDATE_STAT_FE(SoPrimStorageNeeded[streamIndex], soContext.numPrimStorageNeeded); UPDATE_STAT_FE(SoNumPrimsWritten[streamIndex], soContext.numPrimsWritten); RDTSC_STOP(FEStreamout, 1, 0); } ////////////////////////////////////////////////////////////////////////// /// @brief Computes number of invocations. The current index represents /// the start of the SIMD. The max index represents how much work /// items are remaining. If there is less then a SIMD's xmin of work /// then return the remaining amount of work. /// @param curIndex - The start index for the SIMD. /// @param maxIndex - The last index for all work items. static INLINE uint32_t GetNumInvocations( uint32_t curIndex, uint32_t maxIndex) { uint32_t remainder = (maxIndex - curIndex); return (remainder >= KNOB_SIMD_WIDTH) ? KNOB_SIMD_WIDTH : remainder; } ////////////////////////////////////////////////////////////////////////// /// @brief Converts a streamId buffer to a cut buffer for the given stream id. /// The geometry shader will loop over each active streamout buffer, assembling /// primitives for the downstream stages. When multistream output is enabled, /// the generated stream ID buffer from the GS needs to be converted to a cut /// buffer for the primitive assembler. /// @param stream - stream id to generate the cut buffer for /// @param pStreamIdBase - pointer to the stream ID buffer /// @param numEmittedVerts - Number of total verts emitted by the GS /// @param pCutBuffer - output buffer to write cuts to void ProcessStreamIdBuffer(uint32_t stream, uint8_t* pStreamIdBase, uint32_t numEmittedVerts, uint8_t *pCutBuffer) { SWR_ASSERT(stream < MAX_SO_STREAMS); uint32_t numInputBytes = (numEmittedVerts * 2 + 7) / 8; uint32_t numOutputBytes = std::max(numInputBytes / 2, 1U); for (uint32_t b = 0; b < numOutputBytes; ++b) { uint8_t curInputByte = pStreamIdBase[2*b]; uint8_t outByte = 0; for (uint32_t i = 0; i < 4; ++i) { if ((curInputByte & 0x3) != stream) { outByte |= (1 << i); } curInputByte >>= 2; } curInputByte = pStreamIdBase[2 * b + 1]; for (uint32_t i = 0; i < 4; ++i) { if ((curInputByte & 0x3) != stream) { outByte |= (1 << (i + 4)); } curInputByte >>= 2; } *pCutBuffer++ = outByte; } } THREAD SWR_GS_CONTEXT tlsGsContext; ////////////////////////////////////////////////////////////////////////// /// @brief Implements GS stage. /// @param pDC - pointer to draw context. /// @param workerId - thread's worker id. Even thread has a unique id. /// @param pa - The primitive assembly object. /// @param pGsOut - output stream for GS template < typename HasStreamOutT, typename HasRastT> static void GeometryShaderStage( DRAW_CONTEXT *pDC, uint32_t workerId, PA_STATE& pa, void* pGsOut, void* pCutBuffer, void* pStreamCutBuffer, uint32_t* pSoPrimData, simdscalari primID) { RDTSC_START(FEGeometryShader); const API_STATE& state = GetApiState(pDC); const SWR_GS_STATE* pState = &state.gsState; SWR_ASSERT(pGsOut != nullptr, "GS output buffer should be initialized"); SWR_ASSERT(pCutBuffer != nullptr, "GS output cut buffer should be initialized"); tlsGsContext.pStream = (uint8_t*)pGsOut; tlsGsContext.pCutOrStreamIdBuffer = (uint8_t*)pCutBuffer; tlsGsContext.PrimitiveID = primID; uint32_t numVertsPerPrim = NumVertsPerPrim(pa.binTopology, true); simdvector attrib[MAX_ATTRIBUTES]; // assemble all attributes for the input primitive for (uint32_t slot = 0; slot < pState->numInputAttribs; ++slot) { uint32_t attribSlot = VERTEX_ATTRIB_START_SLOT + slot; pa.Assemble(attribSlot, attrib); for (uint32_t i = 0; i < numVertsPerPrim; ++i) { tlsGsContext.vert[i].attrib[attribSlot] = attrib[i]; } } // assemble position pa.Assemble(VERTEX_POSITION_SLOT, attrib); for (uint32_t i = 0; i < numVertsPerPrim; ++i) { tlsGsContext.vert[i].attrib[VERTEX_POSITION_SLOT] = attrib[i]; } const uint32_t vertexStride = sizeof(simdvertex); const uint32_t numSimdBatches = (state.gsState.maxNumVerts + KNOB_SIMD_WIDTH - 1) / KNOB_SIMD_WIDTH; const uint32_t inputPrimStride = numSimdBatches * vertexStride; const uint32_t instanceStride = inputPrimStride * KNOB_SIMD_WIDTH; uint32_t cutPrimStride; uint32_t cutInstanceStride; if (pState->isSingleStream) { cutPrimStride = (state.gsState.maxNumVerts + 7) / 8; cutInstanceStride = cutPrimStride * KNOB_SIMD_WIDTH; } else { cutPrimStride = AlignUp(state.gsState.maxNumVerts * 2 / 8, 4); cutInstanceStride = cutPrimStride * KNOB_SIMD_WIDTH; } // record valid prims from the frontend to avoid over binning the newly generated // prims from the GS uint32_t numInputPrims = pa.NumPrims(); for (uint32_t instance = 0; instance < pState->instanceCount; ++instance) { tlsGsContext.InstanceID = instance; tlsGsContext.mask = GenerateMask(numInputPrims); // execute the geometry shader state.pfnGsFunc(GetPrivateState(pDC), &tlsGsContext); tlsGsContext.pStream += instanceStride; tlsGsContext.pCutOrStreamIdBuffer += cutInstanceStride; } // set up new binner and state for the GS output topology PFN_PROCESS_PRIMS pfnClipFunc = nullptr; if (HasRastT::value) { switch (pState->outputTopology) { case TOP_TRIANGLE_STRIP: pfnClipFunc = ClipTriangles; break; case TOP_LINE_STRIP: pfnClipFunc = ClipLines; break; case TOP_POINT_LIST: pfnClipFunc = ClipPoints; break; default: SWR_ASSERT(false, "Unexpected GS output topology: %d", pState->outputTopology); } } // foreach input prim: // - setup a new PA based on the emitted verts for that prim // - loop over the new verts, calling PA to assemble each prim uint32_t* pVertexCount = (uint32_t*)&tlsGsContext.vertexCount; uint32_t* pPrimitiveId = (uint32_t*)&primID; uint32_t totalPrimsGenerated = 0; for (uint32_t inputPrim = 0; inputPrim < numInputPrims; ++inputPrim) { uint8_t* pInstanceBase = (uint8_t*)pGsOut + inputPrim * inputPrimStride; uint8_t* pCutBufferBase = (uint8_t*)pCutBuffer + inputPrim * cutPrimStride; for (uint32_t instance = 0; instance < pState->instanceCount; ++instance) { uint32_t numEmittedVerts = pVertexCount[inputPrim]; if (numEmittedVerts == 0) { continue; } uint8_t* pBase = pInstanceBase + instance * instanceStride; uint8_t* pCutBase = pCutBufferBase + instance * cutInstanceStride; uint32_t numAttribs = state.feNumAttributes; for (uint32_t stream = 0; stream < MAX_SO_STREAMS; ++stream) { bool processCutVerts = false; uint8_t* pCutBuffer = pCutBase; // assign default stream ID, only relevant when GS is outputting a single stream uint32_t streamID = 0; if (pState->isSingleStream) { processCutVerts = true; streamID = pState->singleStreamID; if (streamID != stream) continue; } else { // early exit if this stream is not enabled for streamout if (HasStreamOutT::value && !state.soState.streamEnable[stream]) { continue; } // multi-stream output, need to translate StreamID buffer to a cut buffer ProcessStreamIdBuffer(stream, pCutBase, numEmittedVerts, (uint8_t*)pStreamCutBuffer); pCutBuffer = (uint8_t*)pStreamCutBuffer; processCutVerts = false; } PA_STATE_CUT gsPa(pDC, pBase, numEmittedVerts, pCutBuffer, numEmittedVerts, numAttribs, pState->outputTopology, processCutVerts); while (gsPa.GetNextStreamOutput()) { do { bool assemble = gsPa.Assemble(VERTEX_POSITION_SLOT, attrib); if (assemble) { totalPrimsGenerated += gsPa.NumPrims(); if (HasStreamOutT::value) { StreamOut(pDC, gsPa, workerId, pSoPrimData, stream); } if (HasRastT::value && state.soState.streamToRasterizer == stream) { simdscalari vPrimId; // pull primitiveID from the GS output if available if (state.gsState.emitsPrimitiveID) { simdvector primIdAttrib[3]; gsPa.Assemble(VERTEX_PRIMID_SLOT, primIdAttrib); vPrimId = _simd_castps_si(primIdAttrib[0].x); } else { vPrimId = _simd_set1_epi32(pPrimitiveId[inputPrim]); } // use viewport array index if GS declares it as an output attribute. Otherwise use index 0. simdscalari vViewPortIdx; if (state.gsState.emitsViewportArrayIndex) { simdvector vpiAttrib[3]; gsPa.Assemble(VERTEX_VIEWPORT_ARRAY_INDEX_SLOT, vpiAttrib); // OOB indices => forced to zero. simdscalari vNumViewports = _simd_set1_epi32(KNOB_NUM_VIEWPORTS_SCISSORS); simdscalari vClearMask = _simd_cmplt_epi32(_simd_castps_si(vpiAttrib[0].x), vNumViewports); vpiAttrib[0].x = _simd_and_ps(_simd_castsi_ps(vClearMask), vpiAttrib[0].x); vViewPortIdx = _simd_castps_si(vpiAttrib[0].x); } else { vViewPortIdx = _simd_set1_epi32(0); } pfnClipFunc(pDC, gsPa, workerId, attrib, GenMask(gsPa.NumPrims()), vPrimId, vViewPortIdx); } } } while (gsPa.NextPrim()); } } } } // update GS pipeline stats UPDATE_STAT_FE(GsInvocations, numInputPrims * pState->instanceCount); UPDATE_STAT_FE(GsPrimitives, totalPrimsGenerated); RDTSC_STOP(FEGeometryShader, 1, 0); } ////////////////////////////////////////////////////////////////////////// /// @brief Allocate GS buffers /// @param pDC - pointer to draw context. /// @param state - API state /// @param ppGsOut - pointer to GS output buffer allocation /// @param ppCutBuffer - pointer to GS output cut buffer allocation static INLINE void AllocateGsBuffers(DRAW_CONTEXT* pDC, const API_STATE& state, void** ppGsOut, void** ppCutBuffer, void **ppStreamCutBuffer) { auto pArena = pDC->pArena; SWR_ASSERT(pArena != nullptr); SWR_ASSERT(state.gsState.gsEnable); // allocate arena space to hold GS output verts // @todo pack attribs // @todo support multiple streams const uint32_t vertexStride = sizeof(simdvertex); const uint32_t numSimdBatches = (state.gsState.maxNumVerts + KNOB_SIMD_WIDTH - 1) / KNOB_SIMD_WIDTH; uint32_t size = state.gsState.instanceCount * numSimdBatches * vertexStride * KNOB_SIMD_WIDTH; *ppGsOut = pArena->AllocAligned(size, KNOB_SIMD_WIDTH * sizeof(float)); const uint32_t cutPrimStride = (state.gsState.maxNumVerts + 7) / 8; const uint32_t streamIdPrimStride = AlignUp(state.gsState.maxNumVerts * 2 / 8, 4); const uint32_t cutBufferSize = cutPrimStride * state.gsState.instanceCount * KNOB_SIMD_WIDTH; const uint32_t streamIdSize = streamIdPrimStride * state.gsState.instanceCount * KNOB_SIMD_WIDTH; // allocate arena space to hold cut or streamid buffer, which is essentially a bitfield sized to the // maximum vertex output as defined by the GS state, per SIMD lane, per GS instance // allocate space for temporary per-stream cut buffer if multi-stream is enabled if (state.gsState.isSingleStream) { *ppCutBuffer = pArena->AllocAligned(cutBufferSize, KNOB_SIMD_WIDTH * sizeof(float)); *ppStreamCutBuffer = nullptr; } else { *ppCutBuffer = pArena->AllocAligned(streamIdSize, KNOB_SIMD_WIDTH * sizeof(float)); *ppStreamCutBuffer = pArena->AllocAligned(cutBufferSize, KNOB_SIMD_WIDTH * sizeof(float)); } } ////////////////////////////////////////////////////////////////////////// /// @brief Contains all data generated by the HS and passed to the /// tessellator and DS. struct TessellationThreadLocalData { SWR_HS_CONTEXT hsContext; ScalarPatch patchData[KNOB_SIMD_WIDTH]; void* pTxCtx; size_t tsCtxSize; simdscalar* pDSOutput; size_t numDSOutputVectors; }; THREAD TessellationThreadLocalData* gt_pTessellationThreadData = nullptr; ////////////////////////////////////////////////////////////////////////// /// @brief Allocate tessellation data for this worker thread. INLINE static void AllocateTessellationData(SWR_CONTEXT* pContext) { /// @TODO - Don't use thread local storage. Use Worker local storage instead. if (gt_pTessellationThreadData == nullptr) { gt_pTessellationThreadData = (TessellationThreadLocalData*) AlignedMalloc(sizeof(TessellationThreadLocalData), 64); memset(gt_pTessellationThreadData, 0, sizeof(*gt_pTessellationThreadData)); } } ////////////////////////////////////////////////////////////////////////// /// @brief Implements Tessellation Stages. /// @param pDC - pointer to draw context. /// @param workerId - thread's worker id. Even thread has a unique id. /// @param pa - The primitive assembly object. /// @param pGsOut - output stream for GS template < typename HasGeometryShaderT, typename HasStreamOutT, typename HasRastT> static void TessellationStages( DRAW_CONTEXT *pDC, uint32_t workerId, PA_STATE& pa, void* pGsOut, void* pCutBuffer, void* pCutStreamBuffer, uint32_t* pSoPrimData, simdscalari primID) { const API_STATE& state = GetApiState(pDC); const SWR_TS_STATE& tsState = state.tsState; SWR_ASSERT(gt_pTessellationThreadData); HANDLE tsCtx = TSInitCtx( tsState.domain, tsState.partitioning, tsState.tsOutputTopology, gt_pTessellationThreadData->pTxCtx, gt_pTessellationThreadData->tsCtxSize); if (tsCtx == nullptr) { gt_pTessellationThreadData->pTxCtx = AlignedMalloc(gt_pTessellationThreadData->tsCtxSize, 64); tsCtx = TSInitCtx( tsState.domain, tsState.partitioning, tsState.tsOutputTopology, gt_pTessellationThreadData->pTxCtx, gt_pTessellationThreadData->tsCtxSize); } SWR_ASSERT(tsCtx); PFN_PROCESS_PRIMS pfnClipFunc = nullptr; if (HasRastT::value) { switch (tsState.postDSTopology) { case TOP_TRIANGLE_LIST: pfnClipFunc = ClipTriangles; break; case TOP_LINE_LIST: pfnClipFunc = ClipLines; break; case TOP_POINT_LIST: pfnClipFunc = ClipPoints; break; default: SWR_ASSERT(false, "Unexpected DS output topology: %d", tsState.postDSTopology); } } SWR_HS_CONTEXT& hsContext = gt_pTessellationThreadData->hsContext; hsContext.pCPout = gt_pTessellationThreadData->patchData; hsContext.PrimitiveID = primID; uint32_t numVertsPerPrim = NumVertsPerPrim(pa.binTopology, false); // Max storage for one attribute for an entire simdprimitive simdvector simdattrib[MAX_NUM_VERTS_PER_PRIM]; // assemble all attributes for the input primitives for (uint32_t slot = 0; slot < tsState.numHsInputAttribs; ++slot) { uint32_t attribSlot = VERTEX_ATTRIB_START_SLOT + slot; pa.Assemble(attribSlot, simdattrib); for (uint32_t i = 0; i < numVertsPerPrim; ++i) { hsContext.vert[i].attrib[attribSlot] = simdattrib[i]; } } #if defined(_DEBUG) memset(hsContext.pCPout, 0x90, sizeof(ScalarPatch) * KNOB_SIMD_WIDTH); #endif uint32_t numPrims = pa.NumPrims(); hsContext.mask = GenerateMask(numPrims); // Run the HS RDTSC_START(FEHullShader); state.pfnHsFunc(GetPrivateState(pDC), &hsContext); RDTSC_STOP(FEHullShader, 0, 0); UPDATE_STAT_FE(HsInvocations, numPrims); const uint32_t* pPrimId = (const uint32_t*)&primID; for (uint32_t p = 0; p < numPrims; ++p) { // Run Tessellator SWR_TS_TESSELLATED_DATA tsData = { 0 }; RDTSC_START(FETessellation); TSTessellate(tsCtx, hsContext.pCPout[p].tessFactors, tsData); RDTSC_STOP(FETessellation, 0, 0); if (tsData.NumPrimitives == 0) { continue; } SWR_ASSERT(tsData.NumDomainPoints); // Allocate DS Output memory uint32_t requiredDSVectorInvocations = AlignUp(tsData.NumDomainPoints, KNOB_SIMD_WIDTH) / KNOB_SIMD_WIDTH; size_t requiredDSOutputVectors = requiredDSVectorInvocations * tsState.numDsOutputAttribs; size_t requiredAllocSize = sizeof(simdvector) * requiredDSOutputVectors; if (requiredDSOutputVectors > gt_pTessellationThreadData->numDSOutputVectors) { AlignedFree(gt_pTessellationThreadData->pDSOutput); gt_pTessellationThreadData->pDSOutput = (simdscalar*)AlignedMalloc(requiredAllocSize, 64); gt_pTessellationThreadData->numDSOutputVectors = requiredDSOutputVectors; } SWR_ASSERT(gt_pTessellationThreadData->pDSOutput); SWR_ASSERT(gt_pTessellationThreadData->numDSOutputVectors >= requiredDSOutputVectors); #if defined(_DEBUG) memset(gt_pTessellationThreadData->pDSOutput, 0x90, requiredAllocSize); #endif // Run Domain Shader SWR_DS_CONTEXT dsContext; dsContext.PrimitiveID = pPrimId[p]; dsContext.pCpIn = &hsContext.pCPout[p]; dsContext.pDomainU = (simdscalar*)tsData.pDomainPointsU; dsContext.pDomainV = (simdscalar*)tsData.pDomainPointsV; dsContext.pOutputData = gt_pTessellationThreadData->pDSOutput; dsContext.vectorStride = requiredDSVectorInvocations; uint32_t dsInvocations = 0; for (dsContext.vectorOffset = 0; dsContext.vectorOffset < requiredDSVectorInvocations; ++dsContext.vectorOffset) { dsContext.mask = GenerateMask(tsData.NumDomainPoints - dsInvocations); RDTSC_START(FEDomainShader); state.pfnDsFunc(GetPrivateState(pDC), &dsContext); RDTSC_STOP(FEDomainShader, 0, 0); dsInvocations += KNOB_SIMD_WIDTH; } UPDATE_STAT_FE(DsInvocations, tsData.NumDomainPoints); PA_TESS tessPa( pDC, dsContext.pOutputData, dsContext.vectorStride, tsState.numDsOutputAttribs, tsData.ppIndices, tsData.NumPrimitives, tsState.postDSTopology); while (tessPa.HasWork()) { if (HasGeometryShaderT::value) { GeometryShaderStage<HasStreamOutT, HasRastT>( pDC, workerId, tessPa, pGsOut, pCutBuffer, pCutStreamBuffer, pSoPrimData, _simd_set1_epi32(dsContext.PrimitiveID)); } else { if (HasStreamOutT::value) { StreamOut(pDC, tessPa, workerId, pSoPrimData, 0); } if (HasRastT::value) { simdvector prim[3]; // Only deal with triangles, lines, or points RDTSC_START(FEPAAssemble); #if SWR_ENABLE_ASSERTS bool assemble = #endif tessPa.Assemble(VERTEX_POSITION_SLOT, prim); RDTSC_STOP(FEPAAssemble, 1, 0); SWR_ASSERT(assemble); SWR_ASSERT(pfnClipFunc); pfnClipFunc(pDC, tessPa, workerId, prim, GenMask(tessPa.NumPrims()), _simd_set1_epi32(dsContext.PrimitiveID), _simd_set1_epi32(0)); } } tessPa.NextPrim(); } // while (tessPa.HasWork()) } // for (uint32_t p = 0; p < numPrims; ++p) TSDestroyCtx(tsCtx); } ////////////////////////////////////////////////////////////////////////// /// @brief FE handler for SwrDraw. /// @tparam IsIndexedT - Is indexed drawing enabled /// @tparam HasTessellationT - Is tessellation enabled /// @tparam HasGeometryShaderT::value - Is the geometry shader stage enabled /// @tparam HasStreamOutT - Is stream-out enabled /// @tparam HasRastT - Is rasterization enabled /// @param pContext - pointer to SWR context. /// @param pDC - pointer to draw context. /// @param workerId - thread's worker id. /// @param pUserData - Pointer to DRAW_WORK template < typename IsIndexedT, typename IsCutIndexEnabledT, typename HasTessellationT, typename HasGeometryShaderT, typename HasStreamOutT, typename HasRastT> void ProcessDraw( SWR_CONTEXT *pContext, DRAW_CONTEXT *pDC, uint32_t workerId, void *pUserData) { #if KNOB_ENABLE_TOSS_POINTS if (KNOB_TOSS_QUEUE_FE) { return; } #endif RDTSC_START(FEProcessDraw); DRAW_WORK& work = *(DRAW_WORK*)pUserData; const API_STATE& state = GetApiState(pDC); __m256i vScale = _mm256_set_epi32(7, 6, 5, 4, 3, 2, 1, 0); SWR_VS_CONTEXT vsContext; simdvertex vin; int indexSize = 0; uint32_t endVertex = work.numVerts; const int32_t* pLastRequestedIndex = nullptr; if (IsIndexedT::value) { switch (work.type) { case R32_UINT: indexSize = sizeof(uint32_t); pLastRequestedIndex = &(work.pIB[endVertex]); break; case R16_UINT: indexSize = sizeof(uint16_t); // nasty address offset to last index pLastRequestedIndex = (int32_t*)(&(((uint16_t*)work.pIB)[endVertex])); break; case R8_UINT: indexSize = sizeof(uint8_t); // nasty address offset to last index pLastRequestedIndex = (int32_t*)(&(((uint8_t*)work.pIB)[endVertex])); break; default: SWR_ASSERT(0); } } else { // No cuts, prune partial primitives. endVertex = GetNumVerts(state.topology, GetNumPrims(state.topology, work.numVerts)); } SWR_FETCH_CONTEXT fetchInfo = { 0 }; fetchInfo.pStreams = &state.vertexBuffers[0]; fetchInfo.StartInstance = work.startInstance; fetchInfo.StartVertex = 0; vsContext.pVin = &vin; if (IsIndexedT::value) { fetchInfo.BaseVertex = work.baseVertex; // if the entire index buffer isn't being consumed, set the last index // so that fetches < a SIMD wide will be masked off fetchInfo.pLastIndex = (const int32_t*)(((uint8_t*)state.indexBuffer.pIndices) + state.indexBuffer.size); if (pLastRequestedIndex < fetchInfo.pLastIndex) { fetchInfo.pLastIndex = pLastRequestedIndex; } } else { fetchInfo.StartVertex = work.startVertex; } #ifdef KNOB_ENABLE_RDTSC uint32_t numPrims = GetNumPrims(state.topology, work.numVerts); #endif void* pGsOut = nullptr; void* pCutBuffer = nullptr; void* pStreamCutBuffer = nullptr; if (HasGeometryShaderT::value) { AllocateGsBuffers(pDC, state, &pGsOut, &pCutBuffer, &pStreamCutBuffer); } if (HasTessellationT::value) { SWR_ASSERT(state.tsState.tsEnable == true); SWR_ASSERT(state.pfnHsFunc != nullptr); SWR_ASSERT(state.pfnDsFunc != nullptr); AllocateTessellationData(pContext); } else { SWR_ASSERT(state.tsState.tsEnable == false); SWR_ASSERT(state.pfnHsFunc == nullptr); SWR_ASSERT(state.pfnDsFunc == nullptr); } // allocate space for streamout input prim data uint32_t* pSoPrimData = nullptr; if (HasStreamOutT::value) { pSoPrimData = (uint32_t*)pDC->pArena->AllocAligned(4096, 16); } // choose primitive assembler PA_FACTORY<IsIndexedT, IsCutIndexEnabledT> paFactory(pDC, state.topology, work.numVerts); PA_STATE& pa = paFactory.GetPA(); /// @todo: temporarily move instance loop in the FE to ensure SO ordering for (uint32_t instanceNum = 0; instanceNum < work.numInstances; instanceNum++) { simdscalari vIndex; uint32_t i = 0; if (IsIndexedT::value) { fetchInfo.pIndices = work.pIB; } else { vIndex = _simd_add_epi32(_simd_set1_epi32(work.startVertexID), vScale); fetchInfo.pIndices = (const int32_t*)&vIndex; } fetchInfo.CurInstance = instanceNum; vsContext.InstanceID = instanceNum; while (pa.HasWork()) { // PaGetNextVsOutput currently has the side effect of updating some PA state machine state. // So we need to keep this outside of (i < endVertex) check. simdmask* pvCutIndices = nullptr; if (IsIndexedT::value) { pvCutIndices = &pa.GetNextVsIndices(); } simdvertex& vout = pa.GetNextVsOutput(); vsContext.pVout = &vout; if (i < endVertex) { // 1. Execute FS/VS for a single SIMD. RDTSC_START(FEFetchShader); state.pfnFetchFunc(fetchInfo, vin); RDTSC_STOP(FEFetchShader, 0, 0); // forward fetch generated vertex IDs to the vertex shader vsContext.VertexID = fetchInfo.VertexID; // Setup active mask for vertex shader. vsContext.mask = GenerateMask(endVertex - i); // forward cut mask to the PA if (IsIndexedT::value) { *pvCutIndices = _simd_movemask_ps(_simd_castsi_ps(fetchInfo.CutMask)); } UPDATE_STAT_FE(IaVertices, GetNumInvocations(i, endVertex)); #if KNOB_ENABLE_TOSS_POINTS if (!KNOB_TOSS_FETCH) #endif { RDTSC_START(FEVertexShader); state.pfnVertexFunc(GetPrivateState(pDC), &vsContext); RDTSC_STOP(FEVertexShader, 0, 0); UPDATE_STAT_FE(VsInvocations, GetNumInvocations(i, endVertex)); } } // 2. Assemble primitives given the last two SIMD. do { simdvector prim[MAX_NUM_VERTS_PER_PRIM]; // PaAssemble returns false if there is not enough verts to assemble. RDTSC_START(FEPAAssemble); bool assemble = pa.Assemble(VERTEX_POSITION_SLOT, prim); RDTSC_STOP(FEPAAssemble, 1, 0); #if KNOB_ENABLE_TOSS_POINTS if (!KNOB_TOSS_FETCH) #endif { #if KNOB_ENABLE_TOSS_POINTS if (!KNOB_TOSS_VS) #endif { if (assemble) { UPDATE_STAT_FE(IaPrimitives, pa.NumPrims()); if (HasTessellationT::value) { TessellationStages<HasGeometryShaderT, HasStreamOutT, HasRastT>( pDC, workerId, pa, pGsOut, pCutBuffer, pStreamCutBuffer, pSoPrimData, pa.GetPrimID(work.startPrimID)); } else if (HasGeometryShaderT::value) { GeometryShaderStage<HasStreamOutT, HasRastT>( pDC, workerId, pa, pGsOut, pCutBuffer, pStreamCutBuffer, pSoPrimData, pa.GetPrimID(work.startPrimID)); } else { // If streamout is enabled then stream vertices out to memory. if (HasStreamOutT::value) { StreamOut(pDC, pa, workerId, pSoPrimData, 0); } if (HasRastT::value) { SWR_ASSERT(pDC->pState->pfnProcessPrims); pDC->pState->pfnProcessPrims(pDC, pa, workerId, prim, GenMask(pa.NumPrims()), pa.GetPrimID(work.startPrimID), _simd_set1_epi32(0)); } } } } } } while (pa.NextPrim()); i += KNOB_SIMD_WIDTH; if (IsIndexedT::value) { fetchInfo.pIndices = (int*)((uint8_t*)fetchInfo.pIndices + KNOB_SIMD_WIDTH * indexSize); } else { vIndex = _simd_add_epi32(vIndex, _simd_set1_epi32(KNOB_SIMD_WIDTH)); } } pa.Reset(); } RDTSC_STOP(FEProcessDraw, numPrims * work.numInstances, pDC->drawId); } struct FEDrawChooser { typedef PFN_FE_WORK_FUNC FuncType; template <typename... ArgsB> static FuncType GetFunc() { return ProcessDraw<ArgsB...>; } }; // Selector for correct templated Draw front-end function PFN_FE_WORK_FUNC GetProcessDrawFunc( bool IsIndexed, bool IsCutIndexEnabled, bool HasTessellation, bool HasGeometryShader, bool HasStreamOut, bool HasRasterization) { return TemplateArgUnroller<FEDrawChooser>::GetFunc(IsIndexed, IsCutIndexEnabled, HasTessellation, HasGeometryShader, HasStreamOut, HasRasterization); } ////////////////////////////////////////////////////////////////////////// /// @brief Processes attributes for the backend based on linkage mask and /// linkage map. Essentially just doing an SOA->AOS conversion and pack. /// @param pDC - Draw context /// @param pa - Primitive Assembly state /// @param linkageMask - Specifies which VS outputs are routed to PS. /// @param pLinkageMap - maps VS attribute slot to PS slot /// @param triIndex - Triangle to process attributes for /// @param pBuffer - Output result template<typename NumVertsT, typename IsSwizzledT, typename HasConstantInterpT, typename IsDegenerate> INLINE void ProcessAttributes( DRAW_CONTEXT *pDC, PA_STATE&pa, uint32_t triIndex, uint32_t primId, float *pBuffer) { static_assert(NumVertsT::value > 0 && NumVertsT::value <= 3, "Invalid value for NumVertsT"); const SWR_BACKEND_STATE& backendState = pDC->pState->state.backendState; // Conservative Rasterization requires degenerate tris to have constant attribute interpolation LONG constantInterpMask = IsDegenerate::value ? 0xFFFFFFFF : backendState.constantInterpolationMask; const uint32_t provokingVertex = pDC->pState->state.frontendState.topologyProvokingVertex; const PRIMITIVE_TOPOLOGY topo = pDC->pState->state.topology; static const float constTable[3][4] = { {0.0f, 0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f, 1.0f}, {1.0f, 1.0f, 1.0f, 1.0f} }; for (uint32_t i = 0; i < backendState.numAttributes; ++i) { uint32_t inputSlot; if (IsSwizzledT::value) { SWR_ATTRIB_SWIZZLE attribSwizzle = backendState.swizzleMap[i]; inputSlot = VERTEX_ATTRIB_START_SLOT + attribSwizzle.sourceAttrib; } else { inputSlot = VERTEX_ATTRIB_START_SLOT + i; } __m128 attrib[3]; // triangle attribs (always 4 wide) float* pAttribStart = pBuffer; if (HasConstantInterpT::value || IsDegenerate::value) { if (_bittest(&constantInterpMask, i)) { uint32_t vid; uint32_t adjustedTriIndex; static const uint32_t tristripProvokingVertex[] = { 0, 2, 1 }; static const int32_t quadProvokingTri[2][4] = { {0, 0, 0, 1}, {0, -1, 0, 0} }; static const uint32_t quadProvokingVertex[2][4] = { {0, 1, 2, 2}, {0, 1, 1, 2} }; static const int32_t qstripProvokingTri[2][4] = { {0, 0, 0, 1}, {-1, 0, 0, 0} }; static const uint32_t qstripProvokingVertex[2][4] = { {0, 1, 2, 1}, {0, 0, 2, 1} }; switch (topo) { case TOP_QUAD_LIST: adjustedTriIndex = triIndex + quadProvokingTri[triIndex & 1][provokingVertex]; vid = quadProvokingVertex[triIndex & 1][provokingVertex]; break; case TOP_QUAD_STRIP: adjustedTriIndex = triIndex + qstripProvokingTri[triIndex & 1][provokingVertex]; vid = qstripProvokingVertex[triIndex & 1][provokingVertex]; break; case TOP_TRIANGLE_STRIP: adjustedTriIndex = triIndex; vid = (triIndex & 1) ? tristripProvokingVertex[provokingVertex] : provokingVertex; break; default: adjustedTriIndex = triIndex; vid = provokingVertex; break; } pa.AssembleSingle(inputSlot, adjustedTriIndex, attrib); for (uint32_t i = 0; i < NumVertsT::value; ++i) { _mm_store_ps(pBuffer, attrib[vid]); pBuffer += 4; } } else { pa.AssembleSingle(inputSlot, triIndex, attrib); for (uint32_t i = 0; i < NumVertsT::value; ++i) { _mm_store_ps(pBuffer, attrib[i]); pBuffer += 4; } } } else { pa.AssembleSingle(inputSlot, triIndex, attrib); for (uint32_t i = 0; i < NumVertsT::value; ++i) { _mm_store_ps(pBuffer, attrib[i]); pBuffer += 4; } } // pad out the attrib buffer to 3 verts to ensure the triangle // interpolation code in the pixel shader works correctly for the // 3 topologies - point, line, tri. This effectively zeros out the // effect of the missing vertices in the triangle interpolation. for (uint32_t v = NumVertsT::value; v < 3; ++v) { _mm_store_ps(pBuffer, attrib[NumVertsT::value - 1]); pBuffer += 4; } // check for constant source overrides if (IsSwizzledT::value) { uint32_t mask = backendState.swizzleMap[i].componentOverrideMask; if (mask) { DWORD comp; while (_BitScanForward(&comp, mask)) { mask &= ~(1 << comp); float constantValue = 0.0f; switch ((SWR_CONSTANT_SOURCE)backendState.swizzleMap[i].constantSource) { case SWR_CONSTANT_SOURCE_CONST_0000: case SWR_CONSTANT_SOURCE_CONST_0001_FLOAT: case SWR_CONSTANT_SOURCE_CONST_1111_FLOAT: constantValue = constTable[backendState.swizzleMap[i].constantSource][comp]; break; case SWR_CONSTANT_SOURCE_PRIM_ID: constantValue = *(float*)&primId; break; } // apply constant value to all 3 vertices for (uint32_t v = 0; v < 3; ++v) { pAttribStart[comp + v * 4] = constantValue; } } } } } } typedef void(*PFN_PROCESS_ATTRIBUTES)(DRAW_CONTEXT*, PA_STATE&, uint32_t, uint32_t, float*); struct ProcessAttributesChooser { typedef PFN_PROCESS_ATTRIBUTES FuncType; template <typename... ArgsB> static FuncType GetFunc() { return ProcessAttributes<ArgsB...>; } }; PFN_PROCESS_ATTRIBUTES GetProcessAttributesFunc(uint32_t NumVerts, bool IsSwizzled, bool HasConstantInterp, bool IsDegenerate = false) { return TemplateArgUnroller<ProcessAttributesChooser>::GetFunc(IntArg<1, 3>{NumVerts}, IsSwizzled, HasConstantInterp, IsDegenerate); } ////////////////////////////////////////////////////////////////////////// /// @brief Processes enabled user clip distances. Loads the active clip /// distances from the PA, sets up barycentric equations, and /// stores the results to the output buffer /// @param pa - Primitive Assembly state /// @param primIndex - primitive index to process /// @param clipDistMask - mask of enabled clip distances /// @param pUserClipBuffer - buffer to store results template<uint32_t NumVerts> void ProcessUserClipDist(PA_STATE& pa, uint32_t primIndex, uint8_t clipDistMask, float* pUserClipBuffer) { DWORD clipDist; while (_BitScanForward(&clipDist, clipDistMask)) { clipDistMask &= ~(1 << clipDist); uint32_t clipSlot = clipDist >> 2; uint32_t clipComp = clipDist & 0x3; uint32_t clipAttribSlot = clipSlot == 0 ? VERTEX_CLIPCULL_DIST_LO_SLOT : VERTEX_CLIPCULL_DIST_HI_SLOT; __m128 primClipDist[3]; pa.AssembleSingle(clipAttribSlot, primIndex, primClipDist); float vertClipDist[NumVerts]; for (uint32_t e = 0; e < NumVerts; ++e) { OSALIGNSIMD(float) aVertClipDist[4]; _mm_store_ps(aVertClipDist, primClipDist[e]); vertClipDist[e] = aVertClipDist[clipComp]; }; // setup plane equations for barycentric interpolation in the backend float baryCoeff[NumVerts]; for (uint32_t e = 0; e < NumVerts - 1; ++e) { baryCoeff[e] = vertClipDist[e] - vertClipDist[NumVerts - 1]; } baryCoeff[NumVerts - 1] = vertClipDist[NumVerts - 1]; for (uint32_t e = 0; e < NumVerts; ++e) { *(pUserClipBuffer++) = baryCoeff[e]; } } } ////////////////////////////////////////////////////////////////////////// /// @brief Convert the X,Y coords of a triangle to the requested Fixed /// Point precision from FP32. template <typename PT = FixedPointTraits<Fixed_16_8>> INLINE simdscalari fpToFixedPointVertical(const simdscalar vIn) { simdscalar vFixed = _simd_mul_ps(vIn, _simd_set1_ps(PT::ScaleT::value)); return _simd_cvtps_epi32(vFixed); } ////////////////////////////////////////////////////////////////////////// /// @brief Helper function to set the X,Y coords of a triangle to the /// requested Fixed Point precision from FP32. /// @param tri: simdvector[3] of FP triangle verts /// @param vXi: fixed point X coords of tri verts /// @param vYi: fixed point Y coords of tri verts INLINE static void FPToFixedPoint(const simdvector * const tri, simdscalari (&vXi)[3], simdscalari (&vYi)[3]) { vXi[0] = fpToFixedPointVertical(tri[0].x); vYi[0] = fpToFixedPointVertical(tri[0].y); vXi[1] = fpToFixedPointVertical(tri[1].x); vYi[1] = fpToFixedPointVertical(tri[1].y); vXi[2] = fpToFixedPointVertical(tri[2].x); vYi[2] = fpToFixedPointVertical(tri[2].y); } ////////////////////////////////////////////////////////////////////////// /// @brief Calculate bounding box for current triangle /// @tparam CT: ConservativeRastFETraits type /// @param vX: fixed point X position for triangle verts /// @param vY: fixed point Y position for triangle verts /// @param bbox: fixed point bbox /// *Note*: expects vX, vY to be in the correct precision for the type /// of rasterization. This avoids unnecessary FP->fixed conversions. template <typename CT> INLINE void calcBoundingBoxIntVertical(const simdvector * const tri, simdscalari (&vX)[3], simdscalari (&vY)[3], simdBBox &bbox) { simdscalari vMinX = vX[0]; vMinX = _simd_min_epi32(vMinX, vX[1]); vMinX = _simd_min_epi32(vMinX, vX[2]); simdscalari vMaxX = vX[0]; vMaxX = _simd_max_epi32(vMaxX, vX[1]); vMaxX = _simd_max_epi32(vMaxX, vX[2]); simdscalari vMinY = vY[0]; vMinY = _simd_min_epi32(vMinY, vY[1]); vMinY = _simd_min_epi32(vMinY, vY[2]); simdscalari vMaxY = vY[0]; vMaxY = _simd_max_epi32(vMaxY, vY[1]); vMaxY = _simd_max_epi32(vMaxY, vY[2]); bbox.xmin = vMinX; bbox.xmax = vMaxX; bbox.ymin = vMinY; bbox.ymax = vMaxY; } ////////////////////////////////////////////////////////////////////////// /// @brief FEConservativeRastT specialization of calcBoundingBoxIntVertical /// Offsets BBox for conservative rast template <> INLINE void calcBoundingBoxIntVertical<FEConservativeRastT>(const simdvector * const tri, simdscalari (&vX)[3], simdscalari (&vY)[3], simdBBox &bbox) { // FE conservative rast traits typedef FEConservativeRastT CT; simdscalari vMinX = vX[0]; vMinX = _simd_min_epi32(vMinX, vX[1]); vMinX = _simd_min_epi32(vMinX, vX[2]); simdscalari vMaxX = vX[0]; vMaxX = _simd_max_epi32(vMaxX, vX[1]); vMaxX = _simd_max_epi32(vMaxX, vX[2]); simdscalari vMinY = vY[0]; vMinY = _simd_min_epi32(vMinY, vY[1]); vMinY = _simd_min_epi32(vMinY, vY[2]); simdscalari vMaxY = vY[0]; vMaxY = _simd_max_epi32(vMaxY, vY[1]); vMaxY = _simd_max_epi32(vMaxY, vY[2]); /// Bounding box needs to be expanded by 1/512 before snapping to 16.8 for conservative rasterization /// expand bbox by 1/256; coverage will be correctly handled in the rasterizer. bbox.xmin = _simd_sub_epi32(vMinX, _simd_set1_epi32(CT::BoundingBoxOffsetT::value)); bbox.xmax = _simd_add_epi32(vMaxX, _simd_set1_epi32(CT::BoundingBoxOffsetT::value)); bbox.ymin = _simd_sub_epi32(vMinY, _simd_set1_epi32(CT::BoundingBoxOffsetT::value)); bbox.ymax = _simd_add_epi32(vMaxY, _simd_set1_epi32(CT::BoundingBoxOffsetT::value)); } ////////////////////////////////////////////////////////////////////////// /// @brief Bin triangle primitives to macro tiles. Performs setup, clipping /// culling, viewport transform, etc. /// @param pDC - pointer to draw context. /// @param pa - The primitive assembly object. /// @param workerId - thread's worker id. Even thread has a unique id. /// @param tri - Contains triangle position data for SIMDs worth of triangles. /// @param primID - Primitive ID for each triangle. /// @param viewportIdx - viewport array index for each triangle. /// @tparam CT - ConservativeRastFETraits template <typename CT> void BinTriangles( DRAW_CONTEXT *pDC, PA_STATE& pa, uint32_t workerId, simdvector tri[3], uint32_t triMask, simdscalari primID, simdscalari viewportIdx) { RDTSC_START(FEBinTriangles); const API_STATE& state = GetApiState(pDC); const SWR_RASTSTATE& rastState = state.rastState; const SWR_FRONTEND_STATE& feState = state.frontendState; const SWR_GS_STATE& gsState = state.gsState; MacroTileMgr *pTileMgr = pDC->pTileMgr; simdscalar vRecipW0 = _simd_set1_ps(1.0f); simdscalar vRecipW1 = _simd_set1_ps(1.0f); simdscalar vRecipW2 = _simd_set1_ps(1.0f); if (feState.vpTransformDisable) { // RHW is passed in directly when VP transform is disabled vRecipW0 = tri[0].v[3]; vRecipW1 = tri[1].v[3]; vRecipW2 = tri[2].v[3]; } else { // Perspective divide vRecipW0 = _simd_div_ps(_simd_set1_ps(1.0f), tri[0].w); vRecipW1 = _simd_div_ps(_simd_set1_ps(1.0f), tri[1].w); vRecipW2 = _simd_div_ps(_simd_set1_ps(1.0f), tri[2].w); tri[0].v[0] = _simd_mul_ps(tri[0].v[0], vRecipW0); tri[1].v[0] = _simd_mul_ps(tri[1].v[0], vRecipW1); tri[2].v[0] = _simd_mul_ps(tri[2].v[0], vRecipW2); tri[0].v[1] = _simd_mul_ps(tri[0].v[1], vRecipW0); tri[1].v[1] = _simd_mul_ps(tri[1].v[1], vRecipW1); tri[2].v[1] = _simd_mul_ps(tri[2].v[1], vRecipW2); tri[0].v[2] = _simd_mul_ps(tri[0].v[2], vRecipW0); tri[1].v[2] = _simd_mul_ps(tri[1].v[2], vRecipW1); tri[2].v[2] = _simd_mul_ps(tri[2].v[2], vRecipW2); // Viewport transform to screen space coords if (state.gsState.emitsViewportArrayIndex) { viewportTransform<3>(tri, state.vpMatrices, viewportIdx); } else { viewportTransform<3>(tri, state.vpMatrices); } } // Adjust for pixel center location simdscalar offset = g_pixelOffsets[rastState.pixelLocation]; tri[0].x = _simd_add_ps(tri[0].x, offset); tri[0].y = _simd_add_ps(tri[0].y, offset); tri[1].x = _simd_add_ps(tri[1].x, offset); tri[1].y = _simd_add_ps(tri[1].y, offset); tri[2].x = _simd_add_ps(tri[2].x, offset); tri[2].y = _simd_add_ps(tri[2].y, offset); simdscalari vXi[3], vYi[3]; // Set vXi, vYi to required fixed point precision FPToFixedPoint(tri, vXi, vYi); // triangle setup simdscalari vAi[3], vBi[3]; triangleSetupABIntVertical(vXi, vYi, vAi, vBi); // determinant simdscalari vDet[2]; calcDeterminantIntVertical(vAi, vBi, vDet); // cull zero area int maskLo = _simd_movemask_pd(_simd_castsi_pd(_simd_cmpeq_epi64(vDet[0], _simd_setzero_si()))); int maskHi = _simd_movemask_pd(_simd_castsi_pd(_simd_cmpeq_epi64(vDet[1], _simd_setzero_si()))); int cullZeroAreaMask = maskLo | (maskHi << (KNOB_SIMD_WIDTH / 2)); uint32_t origTriMask = triMask; // don't cull degenerate triangles if we're conservatively rasterizing if(!CT::IsConservativeT::value) { triMask &= ~cullZeroAreaMask; } // determine front winding tris // CW +det // CCW det <= 0; 0 area triangles are marked as backfacing, which is required behavior for conservative rast maskLo = _simd_movemask_pd(_simd_castsi_pd(_simd_cmpgt_epi64(vDet[0], _simd_setzero_si()))); maskHi = _simd_movemask_pd(_simd_castsi_pd(_simd_cmpgt_epi64(vDet[1], _simd_setzero_si()))); int cwTriMask = maskLo | (maskHi << (KNOB_SIMD_WIDTH /2) ); uint32_t frontWindingTris; if (rastState.frontWinding == SWR_FRONTWINDING_CW) { frontWindingTris = cwTriMask; } else { frontWindingTris = ~cwTriMask; } // cull uint32_t cullTris; switch ((SWR_CULLMODE)rastState.cullMode) { case SWR_CULLMODE_BOTH: cullTris = 0xffffffff; break; case SWR_CULLMODE_NONE: cullTris = 0x0; break; case SWR_CULLMODE_FRONT: cullTris = frontWindingTris; break; // 0 area triangles are marked as backfacing, which is required behavior for conservative rast case SWR_CULLMODE_BACK: cullTris = ~frontWindingTris; break; default: SWR_ASSERT(false, "Invalid cull mode: %d", rastState.cullMode); cullTris = 0x0; break; } triMask &= ~cullTris; if (origTriMask ^ triMask) { RDTSC_EVENT(FECullZeroAreaAndBackface, _mm_popcnt_u32(origTriMask ^ triMask), 0); } /// Note: these variable initializations must stay above any 'goto endBenTriangles' // compute per tri backface uint32_t frontFaceMask = frontWindingTris; uint32_t *pPrimID = (uint32_t *)&primID; const uint32_t *pViewportIndex = (uint32_t *)&viewportIdx; DWORD triIndex = 0; // for center sample pattern, all samples are at pixel center; calculate coverage // once at center and broadcast the results in the backend const SWR_MULTISAMPLE_COUNT sampleCount = (rastState.samplePattern == SWR_MSAA_STANDARD_PATTERN) ? rastState.sampleCount : SWR_MULTISAMPLE_1X; uint32_t edgeEnable; PFN_WORK_FUNC pfnWork; if(CT::IsConservativeT::value) { // determine which edges of the degenerate tri, if any, are valid to rasterize. // used to call the appropriate templated rasterizer function if(cullZeroAreaMask > 0) { // e0 = v1-v0 simdscalari x0x1Mask = _simd_cmpeq_epi32(vXi[0], vXi[1]); simdscalari y0y1Mask = _simd_cmpeq_epi32(vYi[0], vYi[1]); uint32_t e0Mask = _simd_movemask_ps(_simd_castsi_ps(_simd_and_si(x0x1Mask, y0y1Mask))); // e1 = v2-v1 simdscalari x1x2Mask = _simd_cmpeq_epi32(vXi[1], vXi[2]); simdscalari y1y2Mask = _simd_cmpeq_epi32(vYi[1], vYi[2]); uint32_t e1Mask = _simd_movemask_ps(_simd_castsi_ps(_simd_and_si(x1x2Mask, y1y2Mask))); // e2 = v0-v2 // if v0 == v1 & v1 == v2, v0 == v2 uint32_t e2Mask = e0Mask & e1Mask; SWR_ASSERT(KNOB_SIMD_WIDTH == 8, "Need to update degenerate mask code for avx512"); // edge order: e0 = v0v1, e1 = v1v2, e2 = v0v2 // 32 bit binary: 0000 0000 0010 0100 1001 0010 0100 1001 e0Mask = pdep_u32(e0Mask, 0x00249249); // 32 bit binary: 0000 0000 0100 1001 0010 0100 1001 0010 e1Mask = pdep_u32(e1Mask, 0x00492492); // 32 bit binary: 0000 0000 1001 0010 0100 1001 0010 0100 e2Mask = pdep_u32(e2Mask, 0x00924924); edgeEnable = (0x00FFFFFF & (~(e0Mask | e1Mask | e2Mask))); } else { edgeEnable = 0x00FFFFFF; } } else { // degenerate triangles won't be sent to rasterizer; just enable all edges pfnWork = GetRasterizerFunc(sampleCount, (rastState.conservativeRast > 0), (SWR_INPUT_COVERAGE)pDC->pState->state.psState.inputCoverage, ALL_EDGES_VALID, (state.scissorsTileAligned == false)); } if (!triMask) { goto endBinTriangles; } // Calc bounding box of triangles simdBBox bbox; calcBoundingBoxIntVertical<CT>(tri, vXi, vYi, bbox); // determine if triangle falls between pixel centers and discard // only discard for non-MSAA case and when conservative rast is disabled // (xmin + 127) & ~255 // (xmax + 128) & ~255 if(rastState.sampleCount == SWR_MULTISAMPLE_1X && (!CT::IsConservativeT::value)) { origTriMask = triMask; int cullCenterMask; { simdscalari xmin = _simd_add_epi32(bbox.xmin, _simd_set1_epi32(127)); xmin = _simd_and_si(xmin, _simd_set1_epi32(~255)); simdscalari xmax = _simd_add_epi32(bbox.xmax, _simd_set1_epi32(128)); xmax = _simd_and_si(xmax, _simd_set1_epi32(~255)); simdscalari vMaskH = _simd_cmpeq_epi32(xmin, xmax); simdscalari ymin = _simd_add_epi32(bbox.ymin, _simd_set1_epi32(127)); ymin = _simd_and_si(ymin, _simd_set1_epi32(~255)); simdscalari ymax = _simd_add_epi32(bbox.ymax, _simd_set1_epi32(128)); ymax = _simd_and_si(ymax, _simd_set1_epi32(~255)); simdscalari vMaskV = _simd_cmpeq_epi32(ymin, ymax); vMaskV = _simd_or_si(vMaskH, vMaskV); cullCenterMask = _simd_movemask_ps(_simd_castsi_ps(vMaskV)); } triMask &= ~cullCenterMask; if(origTriMask ^ triMask) { RDTSC_EVENT(FECullBetweenCenters, _mm_popcnt_u32(origTriMask ^ triMask), 0); } } // Intersect with scissor/viewport. Subtract 1 ULP in x.8 fixed point since xmax/ymax edge is exclusive. // Gather the AOS effective scissor rects based on the per-prim VP index. /// @todo: Look at speeding this up -- weigh against corresponding costs in rasterizer. simdscalari scisXmin, scisYmin, scisXmax, scisYmax; if (state.gsState.emitsViewportArrayIndex) { GatherScissors<KNOB_SIMD_WIDTH>::Gather(&state.scissorsInFixedPoint[0], pViewportIndex, scisXmin, scisYmin, scisXmax, scisYmax); } else // broadcast fast path for non-VPAI case. { scisXmin = _simd_set1_epi32(state.scissorsInFixedPoint[0].xmin); scisYmin = _simd_set1_epi32(state.scissorsInFixedPoint[0].ymin); scisXmax = _simd_set1_epi32(state.scissorsInFixedPoint[0].xmax); scisYmax = _simd_set1_epi32(state.scissorsInFixedPoint[0].ymax); } bbox.xmin = _simd_max_epi32(bbox.xmin, scisXmin); bbox.ymin = _simd_max_epi32(bbox.ymin, scisYmin); bbox.xmax = _simd_min_epi32(_simd_sub_epi32(bbox.xmax, _simd_set1_epi32(1)), scisXmax); bbox.ymax = _simd_min_epi32(_simd_sub_epi32(bbox.ymax, _simd_set1_epi32(1)), scisYmax); if(CT::IsConservativeT::value) { // in the case where a degenerate triangle is on a scissor edge, we need to make sure the primitive bbox has // some area. Bump the xmax/ymax edges out simdscalari topEqualsBottom = _simd_cmpeq_epi32(bbox.ymin, bbox.ymax); bbox.ymax = _simd_blendv_epi32(bbox.ymax, _simd_add_epi32(bbox.ymax, _simd_set1_epi32(1)), topEqualsBottom); simdscalari leftEqualsRight = _simd_cmpeq_epi32(bbox.xmin, bbox.xmax); bbox.xmax = _simd_blendv_epi32(bbox.xmax, _simd_add_epi32(bbox.xmax, _simd_set1_epi32(1)), leftEqualsRight); } // Cull tris completely outside scissor { simdscalari maskOutsideScissorX = _simd_cmpgt_epi32(bbox.xmin, bbox.xmax); simdscalari maskOutsideScissorY = _simd_cmpgt_epi32(bbox.ymin, bbox.ymax); simdscalari maskOutsideScissorXY = _simd_or_si(maskOutsideScissorX, maskOutsideScissorY); uint32_t maskOutsideScissor = _simd_movemask_ps(_simd_castsi_ps(maskOutsideScissorXY)); triMask = triMask & ~maskOutsideScissor; } if (!triMask) { goto endBinTriangles; } // Convert triangle bbox to macrotile units. bbox.xmin = _simd_srai_epi32(bbox.xmin, KNOB_MACROTILE_X_DIM_FIXED_SHIFT); bbox.ymin = _simd_srai_epi32(bbox.ymin, KNOB_MACROTILE_Y_DIM_FIXED_SHIFT); bbox.xmax = _simd_srai_epi32(bbox.xmax, KNOB_MACROTILE_X_DIM_FIXED_SHIFT); bbox.ymax = _simd_srai_epi32(bbox.ymax, KNOB_MACROTILE_Y_DIM_FIXED_SHIFT); OSALIGNSIMD(uint32_t) aMTLeft[KNOB_SIMD_WIDTH], aMTRight[KNOB_SIMD_WIDTH], aMTTop[KNOB_SIMD_WIDTH], aMTBottom[KNOB_SIMD_WIDTH]; _simd_store_si((simdscalari*)aMTLeft, bbox.xmin); _simd_store_si((simdscalari*)aMTRight, bbox.xmax); _simd_store_si((simdscalari*)aMTTop, bbox.ymin); _simd_store_si((simdscalari*)aMTBottom, bbox.ymax); // transpose verts needed for backend /// @todo modify BE to take non-transformed verts __m128 vHorizX[8], vHorizY[8], vHorizZ[8], vHorizW[8]; vTranspose3x8(vHorizX, tri[0].x, tri[1].x, tri[2].x); vTranspose3x8(vHorizY, tri[0].y, tri[1].y, tri[2].y); vTranspose3x8(vHorizZ, tri[0].z, tri[1].z, tri[2].z); vTranspose3x8(vHorizW, vRecipW0, vRecipW1, vRecipW2); // store render target array index OSALIGNSIMD(uint32_t) aRTAI[KNOB_SIMD_WIDTH]; if (gsState.gsEnable && gsState.emitsRenderTargetArrayIndex) { simdvector vRtai[3]; pa.Assemble(VERTEX_RTAI_SLOT, vRtai); simdscalari vRtaii; vRtaii = _simd_castps_si(vRtai[0].x); _simd_store_si((simdscalari*)aRTAI, vRtaii); } else { _simd_store_si((simdscalari*)aRTAI, _simd_setzero_si()); } // scan remaining valid triangles and bin each separately while (_BitScanForward(&triIndex, triMask)) { uint32_t linkageCount = state.backendState.numAttributes; uint32_t numScalarAttribs = linkageCount * 4; BE_WORK work; work.type = DRAW; bool isDegenerate; if(CT::IsConservativeT::value) { // only rasterize valid edges if we have a degenerate primitive int32_t triEdgeEnable = (edgeEnable >> (triIndex * 3)) & ALL_EDGES_VALID; work.pfnWork = GetRasterizerFunc(sampleCount, (rastState.conservativeRast > 0), (SWR_INPUT_COVERAGE)pDC->pState->state.psState.inputCoverage, triEdgeEnable, (state.scissorsTileAligned == false)); // Degenerate triangles are required to be constant interpolated isDegenerate = (triEdgeEnable != ALL_EDGES_VALID) ? true : false; } else { isDegenerate = false; work.pfnWork = pfnWork; } // Select attribute processor PFN_PROCESS_ATTRIBUTES pfnProcessAttribs = GetProcessAttributesFunc(3, state.backendState.swizzleEnable, state.backendState.constantInterpolationMask, isDegenerate); TRIANGLE_WORK_DESC &desc = work.desc.tri; desc.triFlags.frontFacing = state.forceFront ? 1 : ((frontFaceMask >> triIndex) & 1); desc.triFlags.primID = pPrimID[triIndex]; desc.triFlags.renderTargetArrayIndex = aRTAI[triIndex]; desc.triFlags.viewportIndex = pViewportIndex[triIndex]; auto pArena = pDC->pArena; SWR_ASSERT(pArena != nullptr); // store active attribs float *pAttribs = (float*)pArena->AllocAligned(numScalarAttribs * 3 * sizeof(float), 16); desc.pAttribs = pAttribs; desc.numAttribs = linkageCount; pfnProcessAttribs(pDC, pa, triIndex, pPrimID[triIndex], desc.pAttribs); // store triangle vertex data desc.pTriBuffer = (float*)pArena->AllocAligned(4 * 4 * sizeof(float), 16); _mm_store_ps(&desc.pTriBuffer[0], vHorizX[triIndex]); _mm_store_ps(&desc.pTriBuffer[4], vHorizY[triIndex]); _mm_store_ps(&desc.pTriBuffer[8], vHorizZ[triIndex]); _mm_store_ps(&desc.pTriBuffer[12], vHorizW[triIndex]); // store user clip distances if (rastState.clipDistanceMask) { uint32_t numClipDist = _mm_popcnt_u32(rastState.clipDistanceMask); desc.pUserClipBuffer = (float*)pArena->Alloc(numClipDist * 3 * sizeof(float)); ProcessUserClipDist<3>(pa, triIndex, rastState.clipDistanceMask, desc.pUserClipBuffer); } for (uint32_t y = aMTTop[triIndex]; y <= aMTBottom[triIndex]; ++y) { for (uint32_t x = aMTLeft[triIndex]; x <= aMTRight[triIndex]; ++x) { #if KNOB_ENABLE_TOSS_POINTS if (!KNOB_TOSS_SETUP_TRIS) #endif { pTileMgr->enqueue(x, y, &work); } } } triMask &= ~(1 << triIndex); } endBinTriangles: RDTSC_STOP(FEBinTriangles, 1, 0); } struct FEBinTrianglesChooser { typedef PFN_PROCESS_PRIMS FuncType; template <typename... ArgsB> static FuncType GetFunc() { return BinTriangles<ConservativeRastFETraits<ArgsB...>>; } }; // Selector for correct templated BinTrinagles function PFN_PROCESS_PRIMS GetBinTrianglesFunc(bool IsConservative) { return TemplateArgUnroller<FEBinTrianglesChooser>::GetFunc(IsConservative); } ////////////////////////////////////////////////////////////////////////// /// @brief Bin SIMD points to the backend. Only supports point size of 1 /// @param pDC - pointer to draw context. /// @param pa - The primitive assembly object. /// @param workerId - thread's worker id. Even thread has a unique id. /// @param tri - Contains point position data for SIMDs worth of points. /// @param primID - Primitive ID for each point. void BinPoints( DRAW_CONTEXT *pDC, PA_STATE& pa, uint32_t workerId, simdvector prim[3], uint32_t primMask, simdscalari primID, simdscalari viewportIdx) { RDTSC_START(FEBinPoints); simdvector& primVerts = prim[0]; const API_STATE& state = GetApiState(pDC); const SWR_FRONTEND_STATE& feState = state.frontendState; const SWR_GS_STATE& gsState = state.gsState; const SWR_RASTSTATE& rastState = state.rastState; const uint32_t *pViewportIndex = (uint32_t *)&viewportIdx; // Select attribute processor PFN_PROCESS_ATTRIBUTES pfnProcessAttribs = GetProcessAttributesFunc(1, state.backendState.swizzleEnable, state.backendState.constantInterpolationMask); if (!feState.vpTransformDisable) { // perspective divide simdscalar vRecipW0 = _simd_div_ps(_simd_set1_ps(1.0f), primVerts.w); primVerts.x = _simd_mul_ps(primVerts.x, vRecipW0); primVerts.y = _simd_mul_ps(primVerts.y, vRecipW0); primVerts.z = _simd_mul_ps(primVerts.z, vRecipW0); // viewport transform to screen coords if (state.gsState.emitsViewportArrayIndex) { viewportTransform<1>(&primVerts, state.vpMatrices, viewportIdx); } else { viewportTransform<1>(&primVerts, state.vpMatrices); } } // adjust for pixel center location simdscalar offset = g_pixelOffsets[rastState.pixelLocation]; primVerts.x = _simd_add_ps(primVerts.x, offset); primVerts.y = _simd_add_ps(primVerts.y, offset); // convert to fixed point simdscalari vXi, vYi; vXi = fpToFixedPointVertical(primVerts.x); vYi = fpToFixedPointVertical(primVerts.y); if (CanUseSimplePoints(pDC)) { // adjust for ymin-xmin rule vXi = _simd_sub_epi32(vXi, _simd_set1_epi32(1)); vYi = _simd_sub_epi32(vYi, _simd_set1_epi32(1)); // cull points off the ymin-xmin edge of the viewport primMask &= ~_simd_movemask_ps(_simd_castsi_ps(vXi)); primMask &= ~_simd_movemask_ps(_simd_castsi_ps(vYi)); // compute macro tile coordinates simdscalari macroX = _simd_srai_epi32(vXi, KNOB_MACROTILE_X_DIM_FIXED_SHIFT); simdscalari macroY = _simd_srai_epi32(vYi, KNOB_MACROTILE_Y_DIM_FIXED_SHIFT); OSALIGNSIMD(uint32_t) aMacroX[KNOB_SIMD_WIDTH], aMacroY[KNOB_SIMD_WIDTH]; _simd_store_si((simdscalari*)aMacroX, macroX); _simd_store_si((simdscalari*)aMacroY, macroY); // compute raster tile coordinates simdscalari rasterX = _simd_srai_epi32(vXi, KNOB_TILE_X_DIM_SHIFT + FIXED_POINT_SHIFT); simdscalari rasterY = _simd_srai_epi32(vYi, KNOB_TILE_Y_DIM_SHIFT + FIXED_POINT_SHIFT); // compute raster tile relative x,y for coverage mask simdscalari tileAlignedX = _simd_slli_epi32(rasterX, KNOB_TILE_X_DIM_SHIFT); simdscalari tileAlignedY = _simd_slli_epi32(rasterY, KNOB_TILE_Y_DIM_SHIFT); simdscalari tileRelativeX = _simd_sub_epi32(_simd_srai_epi32(vXi, FIXED_POINT_SHIFT), tileAlignedX); simdscalari tileRelativeY = _simd_sub_epi32(_simd_srai_epi32(vYi, FIXED_POINT_SHIFT), tileAlignedY); OSALIGNSIMD(uint32_t) aTileRelativeX[KNOB_SIMD_WIDTH]; OSALIGNSIMD(uint32_t) aTileRelativeY[KNOB_SIMD_WIDTH]; _simd_store_si((simdscalari*)aTileRelativeX, tileRelativeX); _simd_store_si((simdscalari*)aTileRelativeY, tileRelativeY); OSALIGNSIMD(uint32_t) aTileAlignedX[KNOB_SIMD_WIDTH]; OSALIGNSIMD(uint32_t) aTileAlignedY[KNOB_SIMD_WIDTH]; _simd_store_si((simdscalari*)aTileAlignedX, tileAlignedX); _simd_store_si((simdscalari*)aTileAlignedY, tileAlignedY); OSALIGNSIMD(float) aZ[KNOB_SIMD_WIDTH]; _simd_store_ps((float*)aZ, primVerts.z); // store render target array index OSALIGNSIMD(uint32_t) aRTAI[KNOB_SIMD_WIDTH]; if (gsState.gsEnable && gsState.emitsRenderTargetArrayIndex) { simdvector vRtai; pa.Assemble(VERTEX_RTAI_SLOT, &vRtai); simdscalari vRtaii = _simd_castps_si(vRtai.x); _simd_store_si((simdscalari*)aRTAI, vRtaii); } else { _simd_store_si((simdscalari*)aRTAI, _simd_setzero_si()); } uint32_t *pPrimID = (uint32_t *)&primID; DWORD primIndex = 0; const SWR_BACKEND_STATE& backendState = pDC->pState->state.backendState; // scan remaining valid triangles and bin each separately while (_BitScanForward(&primIndex, primMask)) { uint32_t linkageCount = backendState.numAttributes; uint32_t numScalarAttribs = linkageCount * 4; BE_WORK work; work.type = DRAW; TRIANGLE_WORK_DESC &desc = work.desc.tri; // points are always front facing desc.triFlags.frontFacing = 1; desc.triFlags.primID = pPrimID[primIndex]; desc.triFlags.renderTargetArrayIndex = aRTAI[primIndex]; desc.triFlags.viewportIndex = pViewportIndex[primIndex]; work.pfnWork = RasterizeSimplePoint; auto pArena = pDC->pArena; SWR_ASSERT(pArena != nullptr); // store attributes float *pAttribs = (float*)pArena->AllocAligned(3 * numScalarAttribs * sizeof(float), 16); desc.pAttribs = pAttribs; desc.numAttribs = linkageCount; pfnProcessAttribs(pDC, pa, primIndex, pPrimID[primIndex], pAttribs); // store raster tile aligned x, y, perspective correct z float *pTriBuffer = (float*)pArena->AllocAligned(4 * sizeof(float), 16); desc.pTriBuffer = pTriBuffer; *(uint32_t*)pTriBuffer++ = aTileAlignedX[primIndex]; *(uint32_t*)pTriBuffer++ = aTileAlignedY[primIndex]; *pTriBuffer = aZ[primIndex]; uint32_t tX = aTileRelativeX[primIndex]; uint32_t tY = aTileRelativeY[primIndex]; // pack the relative x,y into the coverageMask, the rasterizer will // generate the true coverage mask from it work.desc.tri.triFlags.coverageMask = tX | (tY << 4); // bin it MacroTileMgr *pTileMgr = pDC->pTileMgr; #if KNOB_ENABLE_TOSS_POINTS if (!KNOB_TOSS_SETUP_TRIS) #endif { pTileMgr->enqueue(aMacroX[primIndex], aMacroY[primIndex], &work); } primMask &= ~(1 << primIndex); } } else { // non simple points need to be potentially binned to multiple macro tiles simdscalar vPointSize; if (rastState.pointParam) { simdvector size[3]; pa.Assemble(VERTEX_POINT_SIZE_SLOT, size); vPointSize = size[0].x; } else { vPointSize = _simd_set1_ps(rastState.pointSize); } // bloat point to bbox simdBBox bbox; bbox.xmin = bbox.xmax = vXi; bbox.ymin = bbox.ymax = vYi; simdscalar vHalfWidth = _simd_mul_ps(vPointSize, _simd_set1_ps(0.5f)); simdscalari vHalfWidthi = fpToFixedPointVertical(vHalfWidth); bbox.xmin = _simd_sub_epi32(bbox.xmin, vHalfWidthi); bbox.xmax = _simd_add_epi32(bbox.xmax, vHalfWidthi); bbox.ymin = _simd_sub_epi32(bbox.ymin, vHalfWidthi); bbox.ymax = _simd_add_epi32(bbox.ymax, vHalfWidthi); // Intersect with scissor/viewport. Subtract 1 ULP in x.8 fixed point since xmax/ymax edge is exclusive. // Gather the AOS effective scissor rects based on the per-prim VP index. /// @todo: Look at speeding this up -- weigh against corresponding costs in rasterizer. simdscalari scisXmin, scisYmin, scisXmax, scisYmax; if (state.gsState.emitsViewportArrayIndex) { GatherScissors<KNOB_SIMD_WIDTH>::Gather(&state.scissorsInFixedPoint[0], pViewportIndex, scisXmin, scisYmin, scisXmax, scisYmax); } else // broadcast fast path for non-VPAI case. { scisXmin = _simd_set1_epi32(state.scissorsInFixedPoint[0].xmin); scisYmin = _simd_set1_epi32(state.scissorsInFixedPoint[0].ymin); scisXmax = _simd_set1_epi32(state.scissorsInFixedPoint[0].xmax); scisYmax = _simd_set1_epi32(state.scissorsInFixedPoint[0].ymax); } bbox.xmin = _simd_max_epi32(bbox.xmin, scisXmin); bbox.ymin = _simd_max_epi32(bbox.ymin, scisYmin); bbox.xmax = _simd_min_epi32(_simd_sub_epi32(bbox.xmax, _simd_set1_epi32(1)), scisXmax); bbox.ymax = _simd_min_epi32(_simd_sub_epi32(bbox.ymax, _simd_set1_epi32(1)), scisYmax); // Cull bloated points completely outside scissor simdscalari maskOutsideScissorX = _simd_cmpgt_epi32(bbox.xmin, bbox.xmax); simdscalari maskOutsideScissorY = _simd_cmpgt_epi32(bbox.ymin, bbox.ymax); simdscalari maskOutsideScissorXY = _simd_or_si(maskOutsideScissorX, maskOutsideScissorY); uint32_t maskOutsideScissor = _simd_movemask_ps(_simd_castsi_ps(maskOutsideScissorXY)); primMask = primMask & ~maskOutsideScissor; // Convert bbox to macrotile units. bbox.xmin = _simd_srai_epi32(bbox.xmin, KNOB_MACROTILE_X_DIM_FIXED_SHIFT); bbox.ymin = _simd_srai_epi32(bbox.ymin, KNOB_MACROTILE_Y_DIM_FIXED_SHIFT); bbox.xmax = _simd_srai_epi32(bbox.xmax, KNOB_MACROTILE_X_DIM_FIXED_SHIFT); bbox.ymax = _simd_srai_epi32(bbox.ymax, KNOB_MACROTILE_Y_DIM_FIXED_SHIFT); OSALIGNSIMD(uint32_t) aMTLeft[KNOB_SIMD_WIDTH], aMTRight[KNOB_SIMD_WIDTH], aMTTop[KNOB_SIMD_WIDTH], aMTBottom[KNOB_SIMD_WIDTH]; _simd_store_si((simdscalari*)aMTLeft, bbox.xmin); _simd_store_si((simdscalari*)aMTRight, bbox.xmax); _simd_store_si((simdscalari*)aMTTop, bbox.ymin); _simd_store_si((simdscalari*)aMTBottom, bbox.ymax); // store render target array index OSALIGNSIMD(uint32_t) aRTAI[KNOB_SIMD_WIDTH]; if (gsState.gsEnable && gsState.emitsRenderTargetArrayIndex) { simdvector vRtai[2]; pa.Assemble(VERTEX_RTAI_SLOT, vRtai); simdscalari vRtaii = _simd_castps_si(vRtai[0].x); _simd_store_si((simdscalari*)aRTAI, vRtaii); } else { _simd_store_si((simdscalari*)aRTAI, _simd_setzero_si()); } OSALIGNSIMD(float) aPointSize[KNOB_SIMD_WIDTH]; _simd_store_ps((float*)aPointSize, vPointSize); uint32_t *pPrimID = (uint32_t *)&primID; OSALIGNSIMD(float) aPrimVertsX[KNOB_SIMD_WIDTH]; OSALIGNSIMD(float) aPrimVertsY[KNOB_SIMD_WIDTH]; OSALIGNSIMD(float) aPrimVertsZ[KNOB_SIMD_WIDTH]; _simd_store_ps((float*)aPrimVertsX, primVerts.x); _simd_store_ps((float*)aPrimVertsY, primVerts.y); _simd_store_ps((float*)aPrimVertsZ, primVerts.z); // scan remaining valid prims and bin each separately const SWR_BACKEND_STATE& backendState = state.backendState; DWORD primIndex; while (_BitScanForward(&primIndex, primMask)) { uint32_t linkageCount = backendState.numAttributes; uint32_t numScalarAttribs = linkageCount * 4; BE_WORK work; work.type = DRAW; TRIANGLE_WORK_DESC &desc = work.desc.tri; desc.triFlags.frontFacing = 1; desc.triFlags.primID = pPrimID[primIndex]; desc.triFlags.pointSize = aPointSize[primIndex]; desc.triFlags.renderTargetArrayIndex = aRTAI[primIndex]; desc.triFlags.viewportIndex = pViewportIndex[primIndex]; work.pfnWork = RasterizeTriPoint; auto pArena = pDC->pArena; SWR_ASSERT(pArena != nullptr); // store active attribs desc.pAttribs = (float*)pArena->AllocAligned(numScalarAttribs * 3 * sizeof(float), 16); desc.numAttribs = linkageCount; pfnProcessAttribs(pDC, pa, primIndex, pPrimID[primIndex], desc.pAttribs); // store point vertex data float *pTriBuffer = (float*)pArena->AllocAligned(4 * sizeof(float), 16); desc.pTriBuffer = pTriBuffer; *pTriBuffer++ = aPrimVertsX[primIndex]; *pTriBuffer++ = aPrimVertsY[primIndex]; *pTriBuffer = aPrimVertsZ[primIndex]; // store user clip distances if (rastState.clipDistanceMask) { uint32_t numClipDist = _mm_popcnt_u32(rastState.clipDistanceMask); desc.pUserClipBuffer = (float*)pArena->Alloc(numClipDist * 2 * sizeof(float)); ProcessUserClipDist<2>(pa, primIndex, rastState.clipDistanceMask, desc.pUserClipBuffer); } MacroTileMgr *pTileMgr = pDC->pTileMgr; for (uint32_t y = aMTTop[primIndex]; y <= aMTBottom[primIndex]; ++y) { for (uint32_t x = aMTLeft[primIndex]; x <= aMTRight[primIndex]; ++x) { #if KNOB_ENABLE_TOSS_POINTS if (!KNOB_TOSS_SETUP_TRIS) #endif { pTileMgr->enqueue(x, y, &work); } } } primMask &= ~(1 << primIndex); } } RDTSC_STOP(FEBinPoints, 1, 0); } ////////////////////////////////////////////////////////////////////////// /// @brief Bin SIMD lines to the backend. /// @param pDC - pointer to draw context. /// @param pa - The primitive assembly object. /// @param workerId - thread's worker id. Even thread has a unique id. /// @param tri - Contains line position data for SIMDs worth of points. /// @param primID - Primitive ID for each line. /// @param viewportIdx - Viewport Array Index for each line. void BinLines( DRAW_CONTEXT *pDC, PA_STATE& pa, uint32_t workerId, simdvector prim[], uint32_t primMask, simdscalari primID, simdscalari viewportIdx) { RDTSC_START(FEBinLines); const API_STATE& state = GetApiState(pDC); const SWR_RASTSTATE& rastState = state.rastState; const SWR_FRONTEND_STATE& feState = state.frontendState; const SWR_GS_STATE& gsState = state.gsState; // Select attribute processor PFN_PROCESS_ATTRIBUTES pfnProcessAttribs = GetProcessAttributesFunc(2, state.backendState.swizzleEnable, state.backendState.constantInterpolationMask); simdscalar vRecipW0 = _simd_set1_ps(1.0f); simdscalar vRecipW1 = _simd_set1_ps(1.0f); if (!feState.vpTransformDisable) { // perspective divide vRecipW0 = _simd_div_ps(_simd_set1_ps(1.0f), prim[0].w); vRecipW1 = _simd_div_ps(_simd_set1_ps(1.0f), prim[1].w); prim[0].v[0] = _simd_mul_ps(prim[0].v[0], vRecipW0); prim[1].v[0] = _simd_mul_ps(prim[1].v[0], vRecipW1); prim[0].v[1] = _simd_mul_ps(prim[0].v[1], vRecipW0); prim[1].v[1] = _simd_mul_ps(prim[1].v[1], vRecipW1); prim[0].v[2] = _simd_mul_ps(prim[0].v[2], vRecipW0); prim[1].v[2] = _simd_mul_ps(prim[1].v[2], vRecipW1); // viewport transform to screen coords if (state.gsState.emitsViewportArrayIndex) { viewportTransform<2>(prim, state.vpMatrices, viewportIdx); } else { viewportTransform<2>(prim, state.vpMatrices); } } // adjust for pixel center location simdscalar offset = g_pixelOffsets[rastState.pixelLocation]; prim[0].x = _simd_add_ps(prim[0].x, offset); prim[0].y = _simd_add_ps(prim[0].y, offset); prim[1].x = _simd_add_ps(prim[1].x, offset); prim[1].y = _simd_add_ps(prim[1].y, offset); // convert to fixed point simdscalari vXi[2], vYi[2]; vXi[0] = fpToFixedPointVertical(prim[0].x); vYi[0] = fpToFixedPointVertical(prim[0].y); vXi[1] = fpToFixedPointVertical(prim[1].x); vYi[1] = fpToFixedPointVertical(prim[1].y); // compute x-major vs y-major mask simdscalari xLength = _simd_abs_epi32(_simd_sub_epi32(vXi[0], vXi[1])); simdscalari yLength = _simd_abs_epi32(_simd_sub_epi32(vYi[0], vYi[1])); simdscalar vYmajorMask = _simd_castsi_ps(_simd_cmpgt_epi32(yLength, xLength)); uint32_t yMajorMask = _simd_movemask_ps(vYmajorMask); // cull zero-length lines simdscalari vZeroLengthMask = _simd_cmpeq_epi32(xLength, _simd_setzero_si()); vZeroLengthMask = _simd_and_si(vZeroLengthMask, _simd_cmpeq_epi32(yLength, _simd_setzero_si())); primMask &= ~_simd_movemask_ps(_simd_castsi_ps(vZeroLengthMask)); uint32_t *pPrimID = (uint32_t *)&primID; const uint32_t *pViewportIndex = (uint32_t *)&viewportIdx; simdscalar vUnused = _simd_setzero_ps(); // Calc bounding box of lines simdBBox bbox; bbox.xmin = _simd_min_epi32(vXi[0], vXi[1]); bbox.xmax = _simd_max_epi32(vXi[0], vXi[1]); bbox.ymin = _simd_min_epi32(vYi[0], vYi[1]); bbox.ymax = _simd_max_epi32(vYi[0], vYi[1]); // bloat bbox by line width along minor axis simdscalar vHalfWidth = _simd_set1_ps(rastState.lineWidth / 2.0f); simdscalari vHalfWidthi = fpToFixedPointVertical(vHalfWidth); simdBBox bloatBox; bloatBox.xmin = _simd_sub_epi32(bbox.xmin, vHalfWidthi); bloatBox.xmax = _simd_add_epi32(bbox.xmax, vHalfWidthi); bloatBox.ymin = _simd_sub_epi32(bbox.ymin, vHalfWidthi); bloatBox.ymax = _simd_add_epi32(bbox.ymax, vHalfWidthi); bbox.xmin = _simd_blendv_epi32(bbox.xmin, bloatBox.xmin, vYmajorMask); bbox.xmax = _simd_blendv_epi32(bbox.xmax, bloatBox.xmax, vYmajorMask); bbox.ymin = _simd_blendv_epi32(bloatBox.ymin, bbox.ymin, vYmajorMask); bbox.ymax = _simd_blendv_epi32(bloatBox.ymax, bbox.ymax, vYmajorMask); // Intersect with scissor/viewport. Subtract 1 ULP in x.8 fixed point since xmax/ymax edge is exclusive. simdscalari scisXmin, scisYmin, scisXmax, scisYmax; if (state.gsState.emitsViewportArrayIndex) { GatherScissors<KNOB_SIMD_WIDTH>::Gather(&state.scissorsInFixedPoint[0], pViewportIndex, scisXmin, scisYmin, scisXmax, scisYmax); } else // broadcast fast path for non-VPAI case. { scisXmin = _simd_set1_epi32(state.scissorsInFixedPoint[0].xmin); scisYmin = _simd_set1_epi32(state.scissorsInFixedPoint[0].ymin); scisXmax = _simd_set1_epi32(state.scissorsInFixedPoint[0].xmax); scisYmax = _simd_set1_epi32(state.scissorsInFixedPoint[0].ymax); } bbox.xmin = _simd_max_epi32(bbox.xmin, scisXmin); bbox.ymin = _simd_max_epi32(bbox.ymin, scisYmin); bbox.xmax = _simd_min_epi32(_simd_sub_epi32(bbox.xmax, _simd_set1_epi32(1)), scisXmax); bbox.ymax = _simd_min_epi32(_simd_sub_epi32(bbox.ymax, _simd_set1_epi32(1)), scisYmax); // Cull prims completely outside scissor { simdscalari maskOutsideScissorX = _simd_cmpgt_epi32(bbox.xmin, bbox.xmax); simdscalari maskOutsideScissorY = _simd_cmpgt_epi32(bbox.ymin, bbox.ymax); simdscalari maskOutsideScissorXY = _simd_or_si(maskOutsideScissorX, maskOutsideScissorY); uint32_t maskOutsideScissor = _simd_movemask_ps(_simd_castsi_ps(maskOutsideScissorXY)); primMask = primMask & ~maskOutsideScissor; } if (!primMask) { goto endBinLines; } // Convert triangle bbox to macrotile units. bbox.xmin = _simd_srai_epi32(bbox.xmin, KNOB_MACROTILE_X_DIM_FIXED_SHIFT); bbox.ymin = _simd_srai_epi32(bbox.ymin, KNOB_MACROTILE_Y_DIM_FIXED_SHIFT); bbox.xmax = _simd_srai_epi32(bbox.xmax, KNOB_MACROTILE_X_DIM_FIXED_SHIFT); bbox.ymax = _simd_srai_epi32(bbox.ymax, KNOB_MACROTILE_Y_DIM_FIXED_SHIFT); OSALIGNSIMD(uint32_t) aMTLeft[KNOB_SIMD_WIDTH], aMTRight[KNOB_SIMD_WIDTH], aMTTop[KNOB_SIMD_WIDTH], aMTBottom[KNOB_SIMD_WIDTH]; _simd_store_si((simdscalari*)aMTLeft, bbox.xmin); _simd_store_si((simdscalari*)aMTRight, bbox.xmax); _simd_store_si((simdscalari*)aMTTop, bbox.ymin); _simd_store_si((simdscalari*)aMTBottom, bbox.ymax); // transpose verts needed for backend /// @todo modify BE to take non-transformed verts __m128 vHorizX[8], vHorizY[8], vHorizZ[8], vHorizW[8]; vTranspose3x8(vHorizX, prim[0].x, prim[1].x, vUnused); vTranspose3x8(vHorizY, prim[0].y, prim[1].y, vUnused); vTranspose3x8(vHorizZ, prim[0].z, prim[1].z, vUnused); vTranspose3x8(vHorizW, vRecipW0, vRecipW1, vUnused); // store render target array index OSALIGNSIMD(uint32_t) aRTAI[KNOB_SIMD_WIDTH]; if (gsState.gsEnable && gsState.emitsRenderTargetArrayIndex) { simdvector vRtai[2]; pa.Assemble(VERTEX_RTAI_SLOT, vRtai); simdscalari vRtaii = _simd_castps_si(vRtai[0].x); _simd_store_si((simdscalari*)aRTAI, vRtaii); } else { _simd_store_si((simdscalari*)aRTAI, _simd_setzero_si()); } // scan remaining valid prims and bin each separately DWORD primIndex; while (_BitScanForward(&primIndex, primMask)) { uint32_t linkageCount = state.backendState.numAttributes; uint32_t numScalarAttribs = linkageCount * 4; BE_WORK work; work.type = DRAW; TRIANGLE_WORK_DESC &desc = work.desc.tri; desc.triFlags.frontFacing = 1; desc.triFlags.primID = pPrimID[primIndex]; desc.triFlags.yMajor = (yMajorMask >> primIndex) & 1; desc.triFlags.renderTargetArrayIndex = aRTAI[primIndex]; desc.triFlags.viewportIndex = pViewportIndex[primIndex]; work.pfnWork = RasterizeLine; auto pArena = pDC->pArena; SWR_ASSERT(pArena != nullptr); // store active attribs desc.pAttribs = (float*)pArena->AllocAligned(numScalarAttribs * 3 * sizeof(float), 16); desc.numAttribs = linkageCount; pfnProcessAttribs(pDC, pa, primIndex, pPrimID[primIndex], desc.pAttribs); // store line vertex data desc.pTriBuffer = (float*)pArena->AllocAligned(4 * 4 * sizeof(float), 16); _mm_store_ps(&desc.pTriBuffer[0], vHorizX[primIndex]); _mm_store_ps(&desc.pTriBuffer[4], vHorizY[primIndex]); _mm_store_ps(&desc.pTriBuffer[8], vHorizZ[primIndex]); _mm_store_ps(&desc.pTriBuffer[12], vHorizW[primIndex]); // store user clip distances if (rastState.clipDistanceMask) { uint32_t numClipDist = _mm_popcnt_u32(rastState.clipDistanceMask); desc.pUserClipBuffer = (float*)pArena->Alloc(numClipDist * 2 * sizeof(float)); ProcessUserClipDist<2>(pa, primIndex, rastState.clipDistanceMask, desc.pUserClipBuffer); } MacroTileMgr *pTileMgr = pDC->pTileMgr; for (uint32_t y = aMTTop[primIndex]; y <= aMTBottom[primIndex]; ++y) { for (uint32_t x = aMTLeft[primIndex]; x <= aMTRight[primIndex]; ++x) { #if KNOB_ENABLE_TOSS_POINTS if (!KNOB_TOSS_SETUP_TRIS) #endif { pTileMgr->enqueue(x, y, &work); } } } primMask &= ~(1 << primIndex); } endBinLines: RDTSC_STOP(FEBinLines, 1, 0); }
2138ed9863f80d6e6a55dde514c6b23d30dd8154
df739eb0c350151e0a9c0f6542260f9e7ae38433
/source/Library.Shared/HashMap.h
e0a08ba7069a05dffc1dc7c26bcbf423a8a2c9b5
[]
no_license
Aissasa/FieaGameEngine
6c935b695d1d6350c3eeb94b5c8a1d52f8487311
705ae7aa991bbd80e7d7ac8b98dc4e14805d9f54
refs/heads/master
2021-01-21T10:08:57.110354
2017-04-29T20:14:07
2017-04-29T20:14:07
83,385,638
0
0
null
null
null
null
UTF-8
C++
false
false
9,895
h
#pragma once #include "SList.h" #include "Vector.h" #include <cstdint> #include <cstring> #include <exception> namespace Library { #pragma region Default Hash /** Default hash functor for the hash map. * This default hash functor hashes an entry using its bytes. */ template<typename TKey> class DefaultHash { public: /** Default hash function. * This default hash function hashes an entry using its bytes. * @param key: Key to hash. * @return Hash result. */ inline std::uint32_t operator()(const TKey& key); private: const static std::uint32_t HASH_NUMBER = 31U; }; /** Standard string hash functor. * Template specialization of the default hash functor for the standard string. */ template<> class DefaultHash<std::string> { public: /** Standard string hash function. * This hash function hashes a string using its characters. * @param key: String to hash. * @return Hash result. */ inline std::uint32_t operator()(const std::string& key); private: const static std::uint32_t HASH_NUMBER = 31U; }; /** Char* hash functor. * Template specialization of the default hash functor for char*. */ template<> class DefaultHash<char*> { public: /** Char* hash function. * This hash function hashes a char* using its characters. * @param key: Char* to hash. * @return Hash result. */ inline std::uint32_t operator()(const char* key); private: const static std::uint32_t HASH_NUMBER = 31U; }; #pragma endregion #pragma region HashMap /** HashMap is a templated hash map that uses chaining. * HashMap is implemented using a vector of Slists containing a key and a value pair. * HashMap uses DefaultHash as the default hash functor if none is specified. */ template <typename TKey, typename TData, typename HashFunctor = DefaultHash<TKey>> class HashMap final { public: typedef std::pair<const TKey, TData> PairType; private: typedef SList<PairType> ChainType; typedef Vector<ChainType> BucketType; public: /** Iterator is an iterator class for HashMap. * This is a simple iterator implementation. */ class Iterator final { friend class HashMap; public: /** Iterator constructor. * It creates and initializes an iterator that belongs to no HashMap. */ Iterator(); /** Iterator destructor. * It's the default implementation provided by the compiler. */ ~Iterator() = default; /** Iterator copy constructor. * @param rhs: Iterator to copy. */ Iterator(const Iterator & rhs); /** Iterator assignment operator overloading method. * It allows the assignment operator to create a copy of the assignee iterator. * @param rhs: Iterator to copy. * @return Result copy. */ Iterator& operator=(const Iterator& rhs); /** Iterator prefix incrementation operator overloading method. * It does a prefix incrementation of the iterator allowing it to point to the following element in the HashMap. * @exception It throws an exception if it does not belong to a HashMap. * @exception It throws an exception if it's going out of bounds. * @return Incremented iterator. */ Iterator& operator++(); /** Iterator postfix incrementation operator overloading method. * It does a postfix incrementation of the iterator allowing it to point to the following element in the HashMap. * @exception It throws an exception if it does not belong to a HashMap. * @exception It throws an exception if it's going out of bounds. * @param i: Denotes the postfix form of the increment. Has no effect. * @return Iterator before the incrementation. */ Iterator operator++(int); /** Iterator equal operator overloading method. * @param rhs: Iterator to compare to. * @return Result of the equality comparison. */ bool operator==(const Iterator& rhs) const; /** Iterator not equal operator overloading method. * @param rhs: Iterator to compare to. * @return Result of the non equality comparison. */ bool operator!=(const Iterator& rhs) const; /** Iterator dereference operator overloading method. * @exception It throws an exception if it does not belong to a HashMap. * @return Key and data pair pointed to by the iterator. */ const PairType& operator*() const; /** Iterator dereference operator overloading method. * @exception It throws an exception if it does not belong to a HashMap. * @return Key and data pair pointed to by the iterator. */ PairType& operator*(); /** Iterator dereference operator overloading method. * @exception It throws an exception if it does not belong to a HashMap. * @return Pointer to a key and data pair pointed to by the iterator. */ const PairType* operator->() const; /** Iterator dereference operator overloading method. * @exception It throws an exception if it does not belong to a HashMap. * @return Pointer to a key and data pair pointed to by the iterator. */ PairType* operator->(); private: Iterator(const HashMap* owner, std::uint32_t bucketIndex, typename const ChainType::Iterator& chainIterator); const HashMap* mOwner; std::uint32_t mBucketIndex; typename ChainType::Iterator mChainIterator; }; /** HashMap constructor. * It creates and initializes an empty HashMap. * If no capacity is specified, a default hash table size will be used. * @exception It throws an exception if the initial hash table size is zero. * @param hashTableSize: Initial hash table size. */ HashMap(std::uint32_t hashTableSize = DEFAULT_HASH_TABLE_SIZE); /** HashMap destructor. * It destroys the HashMap and its elements. */ ~HashMap() = default; /** HashMap copy constructor. * It makes a deep copy of the right hand side HashMap. * @param rhs: HashMap to copy. */ HashMap(const HashMap & rhs) = default; /** HashMap assignment operator overloading method. * It allows the assignment operator to create a deep copy of the assignee HashMap. * @param rhs: HashMap to copy. * @return Result HashMap copy. */ HashMap& operator=(const HashMap& rhs) = default; /** Finds a pair in the HashMap using a key. * If the HashMap is empty or the key is not found, the past-the-end iterator is returned. * Key act as an output to the hashed key. * @param key: Key to the pair to find in the HashMap. * @param bucket: The bucket that the key is in. * @return Iterator to the found element in the HashMap. */ Iterator Find(const TKey & key, std::uint32_t& bucket) const; /** Finds a pair in the HashMap using a key. * If the HashMap is empty or the key is not found, the past-the-end iterator is returned. * @param key: Key to the pair to find in the HashMap. * @return Iterator to the found element in the HashMap. */ Iterator Find(const TKey & key) const; /** Adds a new pair to the HashMap. * If the HashMap already contains the passed key, an iterator to the pair of that key is returned. * @param pair: Pair to add to the HashMap. * @return Iterator to the added pair or the already existent pair. */ Iterator Insert(const PairType & pair); /** Adds a new pair to the HashMap. * If the HashMap already contains the passed key, an iterator to the pair of that key is returned. * @param pair: Pair to add to the HashMap. * @param gotInserted: Boolean that expresses if the pair got inserted or not * @return Iterator to the added pair or the already existent pair. */ Iterator Insert(const PairType & pair, bool& gotInserted); /** HashMap const version of the bracket operator overloading method. * It returns the value of the passed key. * @exception It throws an exception if the key does not exist. * @param key: Key of the wanted pair. * @return Value of the wanted data. */ const TData& operator[](const TKey & key) const; /** HashMap non-const version of the bracket operator overloading method. * It returns the value of the passed key or adds it to the HashMap if it's not existent already. * @param key: Key of the wanted pair. * @return Value of the wanted or added data. */ TData& operator[](const TKey & key); /** Removes a pair from the HashMap. * It finds a pair in the HashMap using the passed key and removes it. * If the key is not found, nothing happens. * @param t: Key of the pair to remove from the HashMap. * @return Boolean that represents the success or failure of the method. */ bool Remove(const TKey & key); /** HashMap clear method. * It empties the HashMap by going through the latter and deleting all the existent pairs. */ void Clear(); /** Checks if a key exists in the HashMap. * @param t: Key to check. * @return Boolean that represents if the key exists in the HashMap or not. */ bool ContainsKey(const TKey & key) const; /** Returns the current size of the HashMap. * @return Current HashMap size. */ std::uint32_t Size() const; /** Determines if the HashMap is empty. */ bool IsEmpty() const; /** HashMap equal operator overloading method. * @param rhs: HashMap to compare to. * @return Result of the equality comparison. */ bool operator==(const HashMap& rhs) const; /** HashMap not equal operator overloading method. * @param rhs: HashMap to compare to. * @return Result of the non equality comparison. */ bool operator!=(const HashMap& rhs) const; /** Returns an iterator to the first pair in the HashMap. * @return Iterator to the first element in the HashMap. */ Iterator begin() const; /** Returns an iterator to the past-the-end element in the HashMap. * @return Iterator to the past-the-end element in the HashMap. */ Iterator end() const; private: BucketType mBuckets; std::uint32_t mSize; const static std::uint32_t DEFAULT_HASH_TABLE_SIZE = 16U; }; #pragma endregion #include "HashMap.inl" }
d025a7ca88ac4aed69ae1ed17d4388f62a59170d
011006ca59cfe75fb3dd84a50b6c0ef6427a7dc3
/codeforces/round653/E2_Reading_Books_hard_version_.cpp
e19c42113452d7f343f4d03c100cc31ba6962e2b
[]
no_license
ay2306/Competitive-Programming
34f35367de2e8623da0006135cf21ba6aec34049
8cc9d953b09212ab32b513acf874dba4fa1d2848
refs/heads/master
2021-06-26T16:46:28.179504
2021-01-24T15:32:57
2021-01-24T15:32:57
205,185,905
5
3
null
null
null
null
UTF-8
C++
false
false
6,264
cpp
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> const long long mod = 1e9+7; // const long long mod = 998244353; const long long int special_prime = 982451653; using namespace std; // DEBUGGER // * vector<string> vec_splitter(string s) { s += ','; vector<string> res; while(!s.empty()) { res.push_back(s.substr(0, s.find(','))); s = s.substr(s.find(',') + 1); } return res; } void debug_out( vector<string> __attribute__ ((unused)) args, __attribute__ ((unused)) int idx, __attribute__ ((unused)) int LINE_NUM) { cerr << endl; } template <typename Head, typename... Tail> void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) { if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") "; stringstream ss; ss << H; cerr << args[idx] << " = " << ss.str(); debug_out(args, idx + 1, LINE_NUM, T...); } #ifdef LOCAL #define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__) #else #define debug(...) 42 #endif // * // DEBUGGER #define test int t; cin>>t; while(t--) #define init(arr,val) memset(arr,val,sizeof(arr)) #define loop(i,a,b) for(int i=a;i<b;i++) #define loopr(i,a,b) for(int i=a;i>=b;i--) #define loops(i,a,b,step) for(int i=a;i<b;i+=step) #define looprs(i,a,b,step) for(int i=a;i>=b;i-=step) #define ull unsigned long long int #define ll long long int #define P pair #define PLL pair<long long, long long> #define PII pair<int, int> #define PUU pair<unsigned long long int, unsigned long long int> #define L list #define V vector #define D deque #define ST set #define MS multiset #define mp make_pair #define pb emplace_back #define pf push_front #define MM multimap #define F first #define S second #define IT iterator #define RIT reverse_iterator #define FAST ios_base::sync_with_stdio(false);cin.tie();cout.tie(); #define FILE_READ_IN freopen("input.txt","r",stdin); #define FILE_READ_OUT freopen("output.txt","w",stdout); #define all(a) a.begin(),a.end() #define ld long double #define sz(x) (int)((x).size()) #define square(x) ((x)*(x)) #define cube(x) ((x)*(x)*(x)) #define distance(a,b,c,d) ((a-c)*1LL*(a-c)+(b-d)*1LL*(b-d)) #define range(i,x,y) ((x <= i) && (i <= y)) #define SUM(a) accumulate(a.begin(),a.end(),0LL) #define lb lower_bound #define ub upper_bound #define REV reverse #define seive(N) int pr[N]; void preSieve(){for(int i = 2; i < N; ++i){if(!pr[i])for(int j = i; j < N; j+=i)pr[j]=i;}} #define modInv(N) ll inv[N]; void preModInv(){inv[0]=0;inv[1]=1;for(int i = 2; i < N; ++i)inv[i] = mod-mod/i*inv[mod%i]%mod;} #define fact(N) ll fact[N]; void preFact(){fact[0] = 1,fact[1] = 1; for(int i = 2; i < N; ++i)fact[i]=fact[i-1]*i%mod;} #define inFact(N) ll ifact[N]; void preiFact(){ifact[1] = 1; for(int i = 2; i < N; ++i)ifact[i]=ifact[i-1]*inv[i]%mod;} // Randomization // pair operation template<class T, class U>istream& operator>>(istream& in, pair<T,U> &rhs){in >> rhs.first;in >> rhs.second;return in;} template<class T, class U>ostream& operator<<(ostream& out,const pair<T,U> &rhs){out << rhs.first;out << " ";out << rhs.second;return out;} template<class T, class U>pair<T,U> operator+(pair<T,U> &a, pair<T,U> &b){return pair<T,U>(a.first+b.first,a.second+b.second);} template<class T, class U>pair<T,U> operator-(pair<T,U> &a, pair<T,U> &b){return pair<T,U>(a.first-b.first,a.second-b.second);} // Linear STL // VECTOR template<class T>istream& operator>>(istream& in, vector<T> &a){for(auto &i: a)cin >> i;return in;} template<class T>ostream& operator<<(ostream& out, const vector<T> &a){for(auto &i: a)cout << i << " ";return out;} // SET template<class T>ostream& operator<<(ostream& out, const set<T> &a){for(auto &i: a)cout << i << " ";return out;} template<class T>ostream& operator<<(ostream& out, const unordered_set<T> &a){for(auto &i: a)cout << i << " ";return out;} template<class T>ostream& operator<<(ostream& out, const multiset<T> &a){for(auto &i: a)cout << i << " ";return out;} // MAP template<class T,class U>ostream& operator<<(ostream& out, const map<T,U> &a){for(auto &i: a)cout << "(" << i.first << ", " << i.second << ")\n";return out;} template<class T,class U>ostream& operator<<(ostream& out, const unordered_map<T,U> &a){for(auto &i: a)cout << "(" << i.first << ", " << i.second << ")\n";return out;} using namespace __gnu_pbds; template <typename T> using ord_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>; const long long N = 1e5 + 100; const long long inf = 1e9; const long double pi = acos(-1); void solve(int test_case){ ll n,m,k; cin >> n >> m >> k; vector<PLL> a[4]; map<ll,ll> arr; loop(i,0,n){ int x,y,z; cin >> x >> y >> z; a[y^(z<<1)].pb(x,i); arr[i]=x; } ll ans = LLONG_MAX; loop(i,0,4){ sort(all(a[i])); loop(j,1,a[i].size())a[i][j].F+=a[i][j-1].F; } int mxi; int len = INT_MAX; loop(i,0,a[3].size()+1){ int rem = k - i; if(a[1].size() < rem || a[2].size() < rem)continue; ll cost = 0; if((!rem && !i || 2*rem+i > m))continue; if(rem)cost += a[1][rem-1].F + a[2][rem-1].F; if(i)cost+=a[3][i-1].F; if(cost < ans){ ans = cost; mxi = i; len = 2*rem+i; } } if(ans == LLONG_MAX){ cout << -1 << "\n"; return; } vector<int> c; int rem = k - mxi; loop(i,0,mxi){ c.pb(a[3][i].second); arr.erase(a[3][i].second); } loop(i,0,rem){ c.pb(a[2][i].second); arr.erase(a[2][i].second); } loop(i,0,rem){ c.pb(a[1][i].second); arr.erase(a[1][i].second); } V<PLL> REM; for(auto &i: arr)REM.pb(i.second,i.first); sort(all(REM),greater<PLL>()); while(c.size() < m && REM.size()){ c.pb(REM.back().second); ans+=REM.back().first; REM.pop_back(); } cout << ans << "\n"; for(auto i: c)cout << i+1 << " " ; } int main(){ FAST auto clk = clock(); mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int t = 1; // cin >> t; loop(i,1,t+1)solve(i); #ifdef LOCAL cout << "\n\nTIME ELAPSED : " << double(clock() - clk)/CLOCKS_PER_SEC * 1000.0 << " ms.\n"; #endif }
006c5db6f3ccaf4477c9b999f3d998d917a19055
41495754cf8b951b23cece87b5c79a726748cff7
/Solutions/Codeforces/Contests/Codeforces Global Round 12/c2.cpp
248865b8b214ea38004d2ed4160180b4f7b13d0d
[]
no_license
PedroAngeli/Competitive-Programming
86ad490eced6980d7bc3376a49744832e470c639
ff64a092023987d5e3fdd720f56c62b99ad175a6
refs/heads/master
2021-10-23T04:49:51.508166
2021-10-13T21:39:21
2021-10-13T21:39:21
198,916,501
1
0
null
null
null
null
UTF-8
C++
false
false
2,076
cpp
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define endl '\n' #define f first #define s second #define ub upper_bound #define lb lower_bound #define pb push_back #define all(c) (c).begin(), (c).end() #define sz(x) (int)(x).size() #define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> #define fbo find_by_order #define ook order_of_key #define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define debug(...) __f(#__VA_ARGS__, __VA_ARGS__) template <typename Arg1> void __f(const char* name, Arg1&& arg1){ cerr << "[" << name << " : " << arg1 << "]" << endl; } template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args){ const char* comma = strchr(names + 1, ',');cerr << "["; cerr.write(names, comma - names) << " : " << arg1<<"] | ";__f(comma+1, args...); } using ld = long double; using ll = long long; using pii = pair <int,int>; using pll = pair <ll,ll>; using vi = vector <int>; using vll = vector <ll>; using vpii = vector <pii>; using vpll = vector<pll>; using vs = vector <string>; int main(){ fastio; int t; cin >> t; while(t--){ int n; cin >> n; vs grid(n); int total = 0; for(int i=0;i<n;i++){ cin >> grid[i]; for(char c:grid[i]) total += (c != '.'); } //{X, O, .} vi p(3); iota(all(p), 0); bool printed = false; do{ vs tmp = grid; int cnt = 0; for(int i=0;i<n;i++) for(int j=0;j<n;j++) if((i+j)%3 == p[0] and tmp[i][j] == 'O'){ tmp[i][j] = 'X'; cnt++; }else if((i+j)%3 == p[1] and tmp[i][j] == 'X'){ tmp[i][j] = 'O'; cnt++; } if(cnt <= total/3){ printed = true; for(int i=0;i<n;i++) cout << tmp[i] << endl; break; } }while(next_permutation(all(p))); assert(printed); } return 0; }
880a48d45f1b666a7c54612f104eb4e224df2050
525b8db8c72e77da74f24ab2b004c7289329cbb3
/Exams done during the semester/Exam-1-Seminar-Gramophone-Records/main.cpp
7ad971280d3fc8f3848769a151a74689dcbb88a8
[]
no_license
SavaDtrv/Object-oriented-programming-school-works
63b8dc6b7f7974bdb6ee5ebf81e9d6066a0e8e29
1ba63c3d38f76c26ad91e72bd5bd0c0965dc4111
refs/heads/master
2022-12-11T02:25:42.443472
2020-09-05T12:36:56
2020-09-05T12:36:56
293,072,415
0
0
null
null
null
null
UTF-8
C++
false
false
260
cpp
#include <iostream> #include "RecordCollection.h" #include "GramophoneRecord.h" using namespace std; void testFunction() { while (true) { GramophoneRecord col; } } int main(){ testFunction(); system("pause"); return 0; }
24b82b8d69e3dc576b6c789decd0c248aa61cbbb
447224db3d60aeed236a51178beb033ceac39fdc
/ThirtyEight.cpp
5426f5238f7518074b634628ff834309f7ee2490
[]
no_license
anandstephan/CppBasicQuestionWithSolution
0bb13030c1ec3d901842d039c748bf25dc9b474c
d3ff3d75f32d62b861d2b67c319f1ea76f7426d4
refs/heads/main
2022-12-25T19:13:53.245967
2020-10-02T08:13:51
2020-10-02T08:13:51
null
0
0
null
null
null
null
UTF-8
C++
false
false
368
cpp
//Write a C program to check whether a number is palindrome or not. #include <iostream> using namespace std; int main(){ int a,n,rev=0; cout<<"Enter the Number"; cin>>n; a=n; while(a){ rev = rev*10+a%10; a=a/10; } if(rev == n) cout<<n<<" is plaindrome"; else cout<<n<<" is not a plaindrome"; return 0; }
7e3c088fc570f5b1e3dfeca8fd19ec5620576468
dff43dada9d2a53e7e9d2a9c47eab7c4865d85cf
/GCSoundController.cpp
2e0fb63de5c852cbfce7c7977a7e60b043fa654f
[]
no_license
GabrielJadderson/TFT-4pi
fe6e509063eb392cedc18a46c7a213e6595a2021
cf795b3b01d6171c794cee65994ad34a398d6036
refs/heads/master
2021-03-19T15:44:47.223095
2019-09-27T12:40:53
2019-09-27T12:40:53
82,612,378
1
0
null
null
null
null
UTF-8
C++
false
false
1,224
cpp
#include "GCSoundController.h" #include <wiringPi.h> #define LED 17 GCSoundController::GCSoundController() { } void GCSoundController::PlaySound(ESoundType soundType) { switch (soundType) { case NONE: break; case BEEB: Beeb(256, 100, 600, 600, 600, 600); break; case BEEB_2: Beeb(256, 100, 400, 400, 400, 400); break; case BEEB_3: Beeb(256, 100, 400, 500, 600, 700); break; case BEEB_4: Beeb(256, 100, 1200, 1400, 1200, 1400); break; case LONG: Long(1000, 600, 600); break; case LONG_1: Long(500, 1200, 1200); break; case LONG_2: Long(1500, 1600, 1600); break; case LONG_3: Long(1000, 1, 1); break; default: break; } } void GCSoundController::Beeb(int deltaSpeed, int gapDuration, int sleep_1, int sleep_2, int sleep_3, int sleep_4) { Long(deltaSpeed, sleep_1, sleep_2); delayMicroseconds(gapDuration * 1000); Long(deltaSpeed, sleep_3, sleep_4); } void GCSoundController::Long(int deltaSpeed, int sleep_1, int sleep_2) { for (int i = 0; i < deltaSpeed; i++) { //digitalWrite(LED, HIGH); //delayMicroseconds(sleep_1); //digitalWrite(LED, LOW); //delayMicroseconds(sleep_2); pwmSetMode(PWM_MODE_MS); pwmWrite(LED, 1000); } }
dbf7621cc0282cc064f796ae01903e7fdb2bf0a3
4dff595d59df71df9eaf3ea1fda1a880abf297ec
/src/GUISystem.h
b0425ed3dd3eb83e194421e8fde743225b551d84
[ "BSD-2-Clause" ]
permissive
dgi09/Tower-Defence
125254e30e4f5c1ed37dacbfb420fb650df29543
2edd53d50c9f913d00de26e7e2bdc5e8b950cc02
refs/heads/master
2021-03-12T19:18:59.871669
2015-09-17T10:55:17
2015-09-17T10:55:17
42,649,877
1
0
null
null
null
null
UTF-8
C++
false
false
895
h
#pragma once #include "Widget.h" #include <vector> #include "GuiEvent.h" #include "SDL_ttf.h" #include "Button.h" #include "Label.h" class GUISystem { GUISystem(void); std::vector<Widget*> widgets; std::vector<Widget*>::iterator it; static GUISystem * ptr; Widget * sheet; GuiEvent ev; Uint32 lastMouseState; TTF_Font * defaultFont; public: ~GUISystem(void); void deleteWidget(Widget * widget); static GUISystem * getPtr(); void setGUISheet(Widget * sheet); static void Destroy(); void drawGUI(SDL_Renderer * renderer); void injectMousePos(int x,int y); void injectMouseDown(MouseButton button); void injectMouseUp(MouseButton button); void injectMouseClick(MouseButton button); void injectSDLEvent(SDL_Event & evt); void injectMouseMove(int x,int y); TTF_Font * getDefaultFont(); // factory methods Button * createButton(); Label * createLabel(); };
13574b1841e95dbdb971e3a1d744c49a9136778a
e17c43db9488f57cb835129fa954aa2edfdea8d5
/Libraries/IFC/IFC4/lib/IfcFilter.cpp
afecccd290e3fd0bb9957a39544d364430b06702
[]
no_license
claudioperez/Rts
6e5868ab8d05ea194a276b8059730dbe322653a7
3609161c34f19f1649b713b09ccef0c8795f8fe7
refs/heads/master
2022-11-06T15:57:39.794397
2020-06-27T23:00:11
2020-06-27T23:00:11
null
0
0
null
null
null
null
UTF-8
C++
false
false
6,441
cpp
/* Code generated by IfcQuery EXPRESS generator, www.ifcquery.com */ #include <sstream> #include <limits> #include "model/IfcPPException.h" #include "model/IfcPPAttributeObject.h" #include "model/IfcPPGuid.h" #include "reader/ReaderUtil.h" #include "writer/WriterUtil.h" #include "IFC4/include/IfcFilter.h" #include "IFC4/include/IfcFilterTypeEnum.h" #include "IFC4/include/IfcGloballyUniqueId.h" #include "IFC4/include/IfcIdentifier.h" #include "IFC4/include/IfcLabel.h" #include "IFC4/include/IfcObjectPlacement.h" #include "IFC4/include/IfcOwnerHistory.h" #include "IFC4/include/IfcProductRepresentation.h" #include "IFC4/include/IfcRelAggregates.h" #include "IFC4/include/IfcRelAssigns.h" #include "IFC4/include/IfcRelAssignsToProduct.h" #include "IFC4/include/IfcRelAssociates.h" #include "IFC4/include/IfcRelConnectsElements.h" #include "IFC4/include/IfcRelConnectsPortToElement.h" #include "IFC4/include/IfcRelConnectsWithRealizingElements.h" #include "IFC4/include/IfcRelContainedInSpatialStructure.h" #include "IFC4/include/IfcRelCoversBldgElements.h" #include "IFC4/include/IfcRelDeclares.h" #include "IFC4/include/IfcRelDefinesByObject.h" #include "IFC4/include/IfcRelDefinesByProperties.h" #include "IFC4/include/IfcRelDefinesByType.h" #include "IFC4/include/IfcRelFillsElement.h" #include "IFC4/include/IfcRelFlowControlElements.h" #include "IFC4/include/IfcRelInterferesElements.h" #include "IFC4/include/IfcRelNests.h" #include "IFC4/include/IfcRelProjectsElement.h" #include "IFC4/include/IfcRelReferencedInSpatialStructure.h" #include "IFC4/include/IfcRelSpaceBoundary.h" #include "IFC4/include/IfcRelVoidsElement.h" #include "IFC4/include/IfcText.h" // ENTITY IfcFilter IfcFilter::IfcFilter() {} IfcFilter::IfcFilter( int id ) { m_entity_id = id; } IfcFilter::~IfcFilter() {} shared_ptr<IfcPPObject> IfcFilter::getDeepCopy( IfcPPCopyOptions& options ) { shared_ptr<IfcFilter> copy_self( new IfcFilter() ); if( m_GlobalId ) { if( options.create_new_IfcGloballyUniqueId ) { copy_self->m_GlobalId = shared_ptr<IfcGloballyUniqueId>(new IfcGloballyUniqueId( createGUID32_wstr().c_str() ) ); } else { copy_self->m_GlobalId = dynamic_pointer_cast<IfcGloballyUniqueId>( m_GlobalId->getDeepCopy(options) ); } } if( m_OwnerHistory ) { if( options.shallow_copy_IfcOwnerHistory ) { copy_self->m_OwnerHistory = m_OwnerHistory; } else { copy_self->m_OwnerHistory = dynamic_pointer_cast<IfcOwnerHistory>( m_OwnerHistory->getDeepCopy(options) ); } } if( m_Name ) { copy_self->m_Name = dynamic_pointer_cast<IfcLabel>( m_Name->getDeepCopy(options) ); } if( m_Description ) { copy_self->m_Description = dynamic_pointer_cast<IfcText>( m_Description->getDeepCopy(options) ); } if( m_ObjectType ) { copy_self->m_ObjectType = dynamic_pointer_cast<IfcLabel>( m_ObjectType->getDeepCopy(options) ); } if( m_ObjectPlacement ) { copy_self->m_ObjectPlacement = dynamic_pointer_cast<IfcObjectPlacement>( m_ObjectPlacement->getDeepCopy(options) ); } if( m_Representation ) { copy_self->m_Representation = dynamic_pointer_cast<IfcProductRepresentation>( m_Representation->getDeepCopy(options) ); } if( m_Tag ) { copy_self->m_Tag = dynamic_pointer_cast<IfcIdentifier>( m_Tag->getDeepCopy(options) ); } if( m_PredefinedType ) { copy_self->m_PredefinedType = dynamic_pointer_cast<IfcFilterTypeEnum>( m_PredefinedType->getDeepCopy(options) ); } return copy_self; } void IfcFilter::getStepLine( std::stringstream& stream ) const { stream << "#" << m_entity_id << "= IFCFILTER" << "("; if( m_GlobalId ) { m_GlobalId->getStepParameter( stream ); } else { stream << "*"; } stream << ","; if( m_OwnerHistory ) { stream << "#" << m_OwnerHistory->m_entity_id; } else { stream << "*"; } stream << ","; if( m_Name ) { m_Name->getStepParameter( stream ); } else { stream << "*"; } stream << ","; if( m_Description ) { m_Description->getStepParameter( stream ); } else { stream << "*"; } stream << ","; if( m_ObjectType ) { m_ObjectType->getStepParameter( stream ); } else { stream << "*"; } stream << ","; if( m_ObjectPlacement ) { stream << "#" << m_ObjectPlacement->m_entity_id; } else { stream << "*"; } stream << ","; if( m_Representation ) { stream << "#" << m_Representation->m_entity_id; } else { stream << "*"; } stream << ","; if( m_Tag ) { m_Tag->getStepParameter( stream ); } else { stream << "*"; } stream << ","; if( m_PredefinedType ) { m_PredefinedType->getStepParameter( stream ); } else { stream << "$"; } stream << ");"; } void IfcFilter::getStepParameter( std::stringstream& stream, bool ) const { stream << "#" << m_entity_id; } const std::wstring IfcFilter::toString() const { return L"IfcFilter"; } void IfcFilter::readStepArguments( const std::vector<std::wstring>& args, const std::map<int,shared_ptr<IfcPPEntity> >& map ) { const size_t num_args = args.size(); if( num_args != 9 ){ std::stringstream err; err << "Wrong parameter count for entity IfcFilter, expecting 9, having " << num_args << ". Entity ID: " << m_entity_id << std::endl; throw IfcPPException( err.str().c_str() ); } m_GlobalId = IfcGloballyUniqueId::createObjectFromSTEP( args[0], map ); readEntityReference( args[1], m_OwnerHistory, map ); m_Name = IfcLabel::createObjectFromSTEP( args[2], map ); m_Description = IfcText::createObjectFromSTEP( args[3], map ); m_ObjectType = IfcLabel::createObjectFromSTEP( args[4], map ); readEntityReference( args[5], m_ObjectPlacement, map ); readEntityReference( args[6], m_Representation, map ); m_Tag = IfcIdentifier::createObjectFromSTEP( args[7], map ); m_PredefinedType = IfcFilterTypeEnum::createObjectFromSTEP( args[8], map ); } void IfcFilter::getAttributes( std::vector<std::pair<std::string, shared_ptr<IfcPPObject> > >& vec_attributes ) { IfcFlowTreatmentDevice::getAttributes( vec_attributes ); vec_attributes.push_back( std::make_pair( "PredefinedType", m_PredefinedType ) ); } void IfcFilter::getAttributesInverse( std::vector<std::pair<std::string, shared_ptr<IfcPPObject> > >& vec_attributes_inverse ) { IfcFlowTreatmentDevice::getAttributesInverse( vec_attributes_inverse ); } void IfcFilter::setInverseCounterparts( shared_ptr<IfcPPEntity> ptr_self_entity ) { IfcFlowTreatmentDevice::setInverseCounterparts( ptr_self_entity ); } void IfcFilter::unlinkFromInverseCounterparts() { IfcFlowTreatmentDevice::unlinkFromInverseCounterparts(); }
21e35988e9e4c6e34b7eb925e5398e7bd546dd46
c87095bd13b9080224324b3a6dd4fd538912d97e
/OpenGL/BSP Loader Part5/Quake3Bsp.cpp
46c1a8349a7ba6f0515c900d8de20fc2544ad294
[ "MIT" ]
permissive
Agrelimos/tutorials
6a0a8ef6652a44bd5a35b59bf192326c831367ff
7d2953b8fbb5c56a921a17e7e3cac3d1f4fbb41b
refs/heads/master
2020-04-01T05:26:56.560609
2018-10-13T18:45:56
2018-10-13T18:45:56
152,903,588
0
0
MIT
2018-10-13T18:44:42
2018-10-13T18:44:42
null
WINDOWS-1252
C++
false
false
42,825
cpp
//***********************************************************************// // // // - "Talk to me like I'm a 3 year old!" Programming Lessons - // // // // $Author: DigiBen [email protected] // // // // $Program: BSP Loader 5 // // // // $Description: This implements sliding and AABB collision // // // //***********************************************************************// #include "Main.h" #include "Camera.h" #include "Quake3Bsp.h" #include "Frustum.h" /////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// * // // In this file we will implement simple sliding and collision with an AABB // instead of a sphere. The next tutorial will have gravity, jumping and climbing // stairs/slopes. // // /////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// * // This is our global frustum class, which is used to cull BSP leafs extern CFrustum g_Frustum; // This will store how many faces are drawn and are seen by the camera extern int g_VisibleFaces; // This tells us if we want to render the lightmaps extern bool g_bLightmaps; // This holds the gamma value that was stored in the config file extern float g_Gamma; // This tells us if we want to render the textures extern bool g_bTextures; //////////////////////////// CQUAKE3BSP \\\\\\\\\\\\\\\\\\\\\\\\\\\* ///// ///// This is our object's constructor to initial all it's data members ///// //////////////////////////// CQUAKE3BSP \\\\\\\\\\\\\\\\\\\\\\\\\\\* CQuake3BSP::CQuake3BSP() { // Here we simply initialize our member variables to 0 m_numOfVerts = 0; m_numOfFaces = 0; m_numOfIndices = 0; m_numOfTextures = 0; m_numOfLightmaps = 0; m_numOfNodes = 0; m_numOfLeafs = 0; m_numOfLeafFaces = 0; m_numOfPlanes = 0; m_numOfBrushes = 0; m_numOfBrushSides = 0; m_numOfLeafBrushes = 0; m_traceRatio = 0; m_traceType = 0; m_traceRadius = 0; bool m_bCollided = false; /////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// * // We need to initialize our Min and Max and Extent variables m_vTraceMins = CVector3(0, 0, 0); m_vTraceMaxs = CVector3(0, 0, 0); m_vExtents = CVector3(0, 0, 0); // This will store the normal of the plane we collided with m_vCollisionNormal = CVector3(0, 0, 0); /////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// * // Initialize all the dynamic BSP data pointers to NULL m_pVerts = NULL; m_pFaces = NULL; m_pIndices = NULL; m_pNodes = NULL; m_pLeafs = NULL; m_pPlanes = NULL; m_pLeafFaces = NULL; memset(&m_clusters, 0, sizeof(tBSPVisData)); // Here we initialize our dynamic arrays of data for the brush information of the BSP m_pBrushes = NULL; m_pBrushSides = NULL; m_pTextures = NULL; m_pLeafBrushes = NULL; } //////////////////////////// CHANGE GAMMA \\\\\\\\\\\\\\\\\\\\\\\\\\\* ///// ///// This manually changes the gamma of an image ///// //////////////////////////// CHANGE GAMMA \\\\\\\\\\\\\\\\\\\\\\\\\\\* void CQuake3BSP::ChangeGamma(byte *pImage, int size, float factor) { // Go through every pixel in the lightmap for(int i = 0; i < size / 3; i++, pImage += 3) { float scale = 1.0f, temp = 0.0f; float r = 0, g = 0, b = 0; // extract the current RGB values r = (float)pImage[0]; g = (float)pImage[1]; b = (float)pImage[2]; // Multiply the factor by the RGB values, while keeping it to a 255 ratio r = r * factor / 255.0f; g = g * factor / 255.0f; b = b * factor / 255.0f; // Check if the the values went past the highest value if(r > 1.0f && (temp = (1.0f/r)) < scale) scale=temp; if(g > 1.0f && (temp = (1.0f/g)) < scale) scale=temp; if(b > 1.0f && (temp = (1.0f/b)) < scale) scale=temp; // Get the scale for this pixel and multiply it by our pixel values scale*=255.0f; r*=scale; g*=scale; b*=scale; // Assign the new gamma'nized RGB values to our image pImage[0] = (byte)r; pImage[1] = (byte)g; pImage[2] = (byte)b; } } ////////////////////////////// CREATE LIGHTMAP TEXTURE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\* ///// ///// This creates a texture map from the light map image bits ///// ////////////////////////////// CREATE LIGHTMAP TEXTURE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\* void CQuake3BSP::CreateLightmapTexture(UINT &texture, byte *pImageBits, int width, int height) { // Generate a texture with the associative texture ID stored in the array glGenTextures(1, &texture); // This sets the alignment requirements for the start of each pixel row in memory. glPixelStorei (GL_UNPACK_ALIGNMENT, 1); // Bind the texture to the texture arrays index and init the texture glBindTexture(GL_TEXTURE_2D, texture); // Change the lightmap gamma values by our desired gamma ChangeGamma(pImageBits, width*height*3, g_Gamma); // Build Mipmaps (builds different versions of the picture for distances - looks better) gluBuild2DMipmaps(GL_TEXTURE_2D, 3, width, height, GL_RGB, GL_UNSIGNED_BYTE, pImageBits); //Assign the mip map levels glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); } //////////////////////////// FIND TEXTURE EXTENSION \\\\\\\\\\\\\\\\\\\\\\\\\\\* ///// ///// This attaches the image extension to the texture name, if found ///// //////////////////////////// FIND TEXTURE EXTENSION \\\\\\\\\\\\\\\\\\\\\\\\\\\* void CQuake3BSP::FindTextureExtension(char *strFileName) { char strJPGPath[MAX_PATH] = {0}; char strTGAPath[MAX_PATH] = {0}; FILE *fp = NULL; // Get the current path we are in GetCurrentDirectory(MAX_PATH, strJPGPath); // Add on a '\' and the file name to the end of the current path. // We create 2 seperate strings to test each image extension. strcat(strJPGPath, "\\"); strcat(strJPGPath, strFileName); strcpy(strTGAPath, strJPGPath); // Add the extensions on to the file name and path strcat(strJPGPath, ".jpg"); strcat(strTGAPath, ".tga"); // Check if there is a jpeg file with the texture name if((fp = fopen(strJPGPath, "rb")) != NULL) { // If so, then let's add ".jpg" onto the file name and return strcat(strFileName, ".jpg"); return; } // Check if there is a targa file with the texture name if((fp = fopen(strTGAPath, "rb")) != NULL) { // If so, then let's add a ".tga" onto the file name and return strcat(strFileName, ".tga"); return; } } //////////////////////////// LOAD BSP \\\\\\\\\\\\\\\\\\\\\\\\\\\* ///// ///// This loads in all of the .bsp data for the level ///// //////////////////////////// LOAD BSP \\\\\\\\\\\\\\\\\\\\\\\\\\\* bool CQuake3BSP::LoadBSP(const char *strFileName) { FILE *fp = NULL; int i = 0; // Check if the .bsp file could be opened if((fp = fopen(strFileName, "rb")) == NULL) { // Display an error message and quit if the file can't be found. MessageBox(g_hWnd, "Could not find BSP file!", "Error", MB_OK); return false; } // Initialize the header and lump structures tBSPHeader header = {0}; tBSPLump lumps[kMaxLumps] = {0}; // Read in the header and lump data fread(&header, 1, sizeof(tBSPHeader), fp); fread(&lumps, kMaxLumps, sizeof(tBSPLump), fp); // Now we know all the information about our file. We can // then allocate the needed memory for our member variables. // Allocate the vertex memory m_numOfVerts = lumps[kVertices].length / sizeof(tBSPVertex); m_pVerts = new tBSPVertex [m_numOfVerts]; // Allocate the face memory m_numOfFaces = lumps[kFaces].length / sizeof(tBSPFace); m_pFaces = new tBSPFace [m_numOfFaces]; // Allocate the index memory m_numOfIndices = lumps[kIndices].length / sizeof(int); m_pIndices = new int [m_numOfIndices]; // Allocate memory to read in the texture information. m_numOfTextures = lumps[kTextures].length / sizeof(tBSPTexture); m_pTextures = new tBSPTexture [m_numOfTextures]; // Allocate memory to read in the lightmap data. m_numOfLightmaps = lumps[kLightmaps].length / sizeof(tBSPLightmap); tBSPLightmap *pLightmaps = new tBSPLightmap [m_numOfLightmaps ]; // Seek to the position in the file that stores the vertex information fseek(fp, lumps[kVertices].offset, SEEK_SET); // Go through all of the vertices that need to be read and swap axis's for(i = 0; i < m_numOfVerts; i++) { // Read in the current vertex fread(&m_pVerts[i], 1, sizeof(tBSPVertex), fp); // Swap the y and z values, and negate the new z so Y is up. float temp = m_pVerts[i].vPosition.y; m_pVerts[i].vPosition.y = m_pVerts[i].vPosition.z; m_pVerts[i].vPosition.z = -temp; } // Seek to the position in the file that stores the index information fseek(fp, lumps[kIndices].offset, SEEK_SET); // Read in all the index information fread(m_pIndices, m_numOfIndices, sizeof(int), fp); // Seek to the position in the file that stores the face information fseek(fp, lumps[kFaces].offset, SEEK_SET); // Read in all the face information fread(m_pFaces, m_numOfFaces, sizeof(tBSPFace), fp); // Seek to the position in the file that stores the texture information fseek(fp, lumps[kTextures].offset, SEEK_SET); // Read in all the texture information fread(m_pTextures, m_numOfTextures, sizeof(tBSPTexture), fp); // Go through all of the textures for(i = 0; i < m_numOfTextures; i++) { // Find the extension if any and append it to the file name FindTextureExtension(m_pTextures[i].strName); // Create a texture from the image CreateTexture(m_textures[i], m_pTextures[i].strName); } // Seek to the position in the file that stores the lightmap information fseek(fp, lumps[kLightmaps].offset, SEEK_SET); // Go through all of the lightmaps and read them in for(i = 0; i < m_numOfLightmaps ; i++) { // Read in the RGB data for each lightmap fread(&pLightmaps[i], 1, sizeof(tBSPLightmap), fp); // Create a texture map for each lightmap that is read in. The lightmaps // are always 128 by 128. CreateLightmapTexture(m_lightmaps[i], (unsigned char *)pLightmaps[i].imageBits, 128, 128); } // Delete the image bits because we are already done with them delete [] pLightmaps; // Store the number of nodes and allocate the memory to hold them m_numOfNodes = lumps[kNodes].length / sizeof(tBSPNode); m_pNodes = new tBSPNode [m_numOfNodes]; // Seek to the position in the file that hold the nodes and store them in m_pNodes fseek(fp, lumps[kNodes].offset, SEEK_SET); fread(m_pNodes, m_numOfNodes, sizeof(tBSPNode), fp); // Store the number of leafs and allocate the memory to hold them m_numOfLeafs = lumps[kLeafs].length / sizeof(tBSPLeaf); m_pLeafs = new tBSPLeaf [m_numOfLeafs]; // Seek to the position in the file that holds the leafs and store them in m_pLeafs fseek(fp, lumps[kLeafs].offset, SEEK_SET); fread(m_pLeafs, m_numOfLeafs, sizeof(tBSPLeaf), fp); // Now we need to go through and convert all the leaf bounding boxes // to the normal OpenGL Y up axis. for(i = 0; i < m_numOfLeafs; i++) { // Swap the min y and z values, then negate the new Z int temp = m_pLeafs[i].min.y; m_pLeafs[i].min.y = m_pLeafs[i].min.z; m_pLeafs[i].min.z = -temp; // Swap the max y and z values, then negate the new Z temp = m_pLeafs[i].max.y; m_pLeafs[i].max.y = m_pLeafs[i].max.z; m_pLeafs[i].max.z = -temp; } // Store the number of leaf faces and allocate the memory for them m_numOfLeafFaces = lumps[kLeafFaces].length / sizeof(int); m_pLeafFaces = new int [m_numOfLeafFaces]; // Seek to the leaf faces lump, then read it's data fseek(fp, lumps[kLeafFaces].offset, SEEK_SET); fread(m_pLeafFaces, m_numOfLeafFaces, sizeof(int), fp); // Store the number of planes, then allocate memory to hold them m_numOfPlanes = lumps[kPlanes].length / sizeof(tBSPPlane); m_pPlanes = new tBSPPlane [m_numOfPlanes]; // Seek to the planes lump in the file, then read them into m_pPlanes fseek(fp, lumps[kPlanes].offset, SEEK_SET); fread(m_pPlanes, m_numOfPlanes, sizeof(tBSPPlane), fp); // Go through every plane and convert it's normal to the Y-axis being up for(i = 0; i < m_numOfPlanes; i++) { float temp = m_pPlanes[i].vNormal.y; m_pPlanes[i].vNormal.y = m_pPlanes[i].vNormal.z; m_pPlanes[i].vNormal.z = -temp; } // Seek to the position in the file that holds the visibility lump fseek(fp, lumps[kVisData].offset, SEEK_SET); // Check if there is any visibility information first if(lumps[kVisData].length) { // Read in the number of vectors and each vector's size fread(&(m_clusters.numOfClusters), 1, sizeof(int), fp); fread(&(m_clusters.bytesPerCluster), 1, sizeof(int), fp); // Allocate the memory for the cluster bitsets int size = m_clusters.numOfClusters * m_clusters.bytesPerCluster; m_clusters.pBitsets = new byte [size]; // Read in the all the visibility bitsets for each cluster fread(m_clusters.pBitsets, 1, sizeof(byte) * size, fp); } // Otherwise, we don't have any visibility data (prevents a crash) else m_clusters.pBitsets = NULL; // Like we do for other data, we read get the size of brushes and allocate memory m_numOfBrushes = lumps[kBrushes].length / sizeof(int); m_pBrushes = new tBSPBrush [m_numOfBrushes]; // Here we read in the brush information from the BSP file fseek(fp, lumps[kBrushes].offset, SEEK_SET); fread(m_pBrushes, m_numOfBrushes, sizeof(tBSPBrush), fp); // Get the size of brush sides, then allocate memory for it m_numOfBrushSides = lumps[kBrushSides].length / sizeof(int); m_pBrushSides = new tBSPBrushSide [m_numOfBrushSides]; // Read in the brush sides data fseek(fp, lumps[kBrushSides].offset, SEEK_SET); fread(m_pBrushSides, m_numOfBrushSides, sizeof(tBSPBrushSide), fp); // Read in the number of leaf brushes and allocate memory for it m_numOfLeafBrushes = lumps[kLeafBrushes].length / sizeof(int); m_pLeafBrushes = new int [m_numOfLeafBrushes]; // Finally, read in the leaf brushes for traversing the bsp tree with brushes fseek(fp, lumps[kLeafBrushes].offset, SEEK_SET); fread(m_pLeafBrushes, m_numOfLeafBrushes, sizeof(int), fp); // Close the file fclose(fp); // Here we allocate enough bits to store all the faces for our bitset m_FacesDrawn.Resize(m_numOfFaces); // Return a success return true; } //////////////////////////// FIND LEAF \\\\\\\\\\\\\\\\\\\\\\\\\\\* ///// ///// This returns the leaf our camera is in ///// //////////////////////////// FIND LEAF \\\\\\\\\\\\\\\\\\\\\\\\\\\* int CQuake3BSP::FindLeaf(const CVector3 &vPos) { int i = 0; float distance = 0.0f; // Continue looping until we find a negative index while(i >= 0) { // Get the current node, then find the slitter plane from that // node's plane index. Notice that we use a constant reference // to store the plane and node so we get some optimization. const tBSPNode& node = m_pNodes[i]; const tBSPPlane& plane = m_pPlanes[node.plane]; // Use the Plane Equation (Ax + by + Cz + D = 0) to find if the // camera is in front of or behind the current splitter plane. distance = plane.vNormal.x * vPos.x + plane.vNormal.y * vPos.y + plane.vNormal.z * vPos.z - plane.d; // If the camera is in front of the plane if(distance >= 0) { // Assign the current node to the node in front of itself i = node.front; } // Else if the camera is behind the plane else { // Assign the current node to the node behind itself i = node.back; } } // Return the leaf index (same thing as saying: return -(i + 1)). return ~i; // Binary operation } //////////////////////////// IS CLUSTER VISIBLE \\\\\\\\\\\\\\\\\\\\\\\\\\\* ///// ///// This tells us if the "current" cluster can see the "test" cluster ///// //////////////////////////// IS CLUSTER VISIBLE \\\\\\\\\\\\\\\\\\\\\\\\\\\* inline int CQuake3BSP::IsClusterVisible(int current, int test) { // Make sure we have valid memory and that the current cluster is > 0. // If we don't have any memory or a negative cluster, return a visibility (1). if(!m_clusters.pBitsets || current < 0) return 1; // Use binary math to get the 8 bit visibility set for the current cluster byte visSet = m_clusters.pBitsets[(current*m_clusters.bytesPerCluster) + (test / 8)]; // Now that we have our vector (bitset), do some bit shifting to find if // the "test" cluster is visible from the "current" cluster, according to the bitset. int result = visSet & (1 << ((test) & 7)); // Return the result ( either 1 (visible) or 0 (not visible) ) return ( result ); } /////////////////////////////////// DOT \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\* ///// ///// This computers the dot product of 2 vectors ///// /////////////////////////////////// DOT \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\* float Dot(CVector3 vVector1, CVector3 vVector2) { // The dot product is this equation: V1.V2 = (V1.x * V2.x + V1.y * V2.y + V1.z * V2.z) // In math terms, it looks like this: V1.V2 = ||V1|| ||V2|| cos(theta) // (V1.x * V2.x + V1.y * V2.y + V1.z * V2.z) return ( (vVector1.x * vVector2.x) + (vVector1.y * vVector2.y) + (vVector1.z * vVector2.z) ); } /////////////////////////////////// TRACE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\* ///// ///// This takes a start and end position (general) to test against the BSP brushes ///// /////////////////////////////////// TRACE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\* CVector3 CQuake3BSP::Trace(CVector3 vStart, CVector3 vEnd) { // Initially we set our trace ratio to 1.0f, which means that we don't have // a collision or intersection point, so we can move freely. m_traceRatio = 1.0f; // We start out with the first node (0), setting our start and end ratio to 0 and 1. // We will recursively go through all of the nodes to see which brushes we should check. CheckNode(0, 0.0f, 1.0f, vStart, vEnd); // If the traceRatio is STILL 1.0f, then we never collided and just return our end position if(m_traceRatio == 1.0f) { return vEnd; } else // Else COLLISION!!!! { // Set our new position to a position that is right up to the brush we collided with CVector3 vNewPosition = vStart + ((vEnd - vStart) * m_traceRatio); /////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// * // * SLIDING CODE * // This code is what calculates our sliding along the brush planes. // Like we explained in detail in Main.cpp, we get the vector of the // distance from the end point to the new position, then use the dot // product with that vector and the plane's normal to obtain the distance // along the normal of the plane to the new sliding position. Finally, // we subtract that distance multiplied by the normal of the plane from // the end point, which gives us our new sliding position. // Get the distance from the end point to the new position we just got CVector3 vMove = vEnd - vNewPosition; // Get the distance we need to travel backwards to the new slide position. // This is the distance of course along the normal of the plane we collided with. float distance = Dot(vMove, m_vCollisionNormal); // Get the new end position that we will end up (the slide position). // This is obtained by move along the plane's normal from the end point // by the distance we just calculated. CVector3 vEndPosition = vEnd - m_vCollisionNormal*distance; // Since we got a new position for our sliding vector, we need to check // to make sure that new sliding position doesn't collide with anything else. vNewPosition = Trace(vNewPosition, vEndPosition); /////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// * // Return the new position to be used by our camera (or player) return vNewPosition; } } /////////////////////////////////// TRACE RAY \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\* ///// ///// This takes a start and end position (ray) to test against the BSP brushes ///// /////////////////////////////////// TRACE RAY \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\* CVector3 CQuake3BSP::TraceRay(CVector3 vStart, CVector3 vEnd) { // We don't use this function, but we set it up to allow us to just check a // ray with the BSP tree brushes. We do so by setting the trace type to TYPE_RAY. m_traceType = TYPE_RAY; // Run the normal Trace() function with our start and end // position and return a new position return Trace(vStart, vEnd); } /////////////////////////////////// TRACE SPHERE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\* ///// ///// This tests a sphere around our movement vector against the BSP brushes for collision ///// /////////////////////////////////// TRACE SPHERE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\* CVector3 CQuake3BSP::TraceSphere(CVector3 vStart, CVector3 vEnd, float radius) { // Here we initialize the type of trace (SPHERE) and initialize other data m_traceType = TYPE_SPHERE; m_bCollided = false; m_traceRadius = radius; // Get the new position that we will return to the camera or player CVector3 vNewPosition = Trace(vStart, vEnd); // Return the new position to be changed for the camera or player return vNewPosition; } /////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// * /////////////////////////////////// TRACE BOX \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\* ///// ///// This takes a start and end position to test a AABB (box) against the BSP brushes ///// /////////////////////////////////// TRACE BOX \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\* CVector3 CQuake3BSP::TraceBox(CVector3 vStart, CVector3 vEnd, CVector3 vMin, CVector3 vMax) { m_traceType = TYPE_BOX; // Set the trace type to a BOX m_vTraceMaxs = vMax; // Set the max value of our AABB m_vTraceMins = vMin; // Set the min value of our AABB m_bCollided = false; // Reset the collised flag // Here is a little tricky piece of code that basically takes the largest values // of the min and max values and stores them in a vector called vExtents. This means // that we are storing the largest size of our box along each x, y, z value. We use this // as our offset (like with sphere collision) to determine if our box collides with // any brushes. If you aren't familiar with these "Terse" operations, it means that // we check if (i.e): if(-m_vTraceMins.x > m_vTraceMaxs.x), then return -m_vTraceMins.x, // otherwise, take the positive of x: m_vTraceMins.x. We do this for each x, y, z slot. // This is smaller code than doing a bunch of if statements... but yes, harder to read :) // Grab the extend of our box (the largest size for each x, y, z axis) m_vExtents = CVector3(-m_vTraceMins.x > m_vTraceMaxs.x ? -m_vTraceMins.x : m_vTraceMaxs.x, -m_vTraceMins.y > m_vTraceMaxs.y ? -m_vTraceMins.y : m_vTraceMaxs.y, -m_vTraceMins.z > m_vTraceMaxs.z ? -m_vTraceMins.z : m_vTraceMaxs.z); // Check if our movement collided with anything, then get back our new position CVector3 vNewPosition = Trace(vStart, vEnd); // Return our new position return vNewPosition; } /////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// * /////////////////////////////////// CHECK NODE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\* ///// ///// This traverses the BSP to find the brushes closest to our position ///// /////////////////////////////////// CHECK NODE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\* void CQuake3BSP::CheckNode(int nodeIndex, float startRatio, float endRatio, CVector3 vStart, CVector3 vEnd) { // Check if the next node is a leaf if(nodeIndex < 0) { // If this node in the BSP is a leaf, we need to negate and add 1 to offset // the real node index into the m_pLeafs[] array. You could also do [~nodeIndex]. tBSPLeaf *pLeaf = &m_pLeafs[-(nodeIndex + 1)]; // We have a leaf, so let's go through all of the brushes for that leaf for(int i = 0; i < pLeaf->numOfLeafBrushes; i++) { // Get the current brush that we going to check tBSPBrush *pBrush = &m_pBrushes[m_pLeafBrushes[pLeaf->leafBrush + i]]; // Check if we have brush sides and the current brush is solid and collidable if((pBrush->numOfBrushSides > 0) && (m_pTextures[pBrush->textureID].textureType & 1)) { // Now we delve into the dark depths of the real calculations for collision. // We can now check the movement vector against our brush planes. CheckBrush(pBrush, vStart, vEnd); } } // Since we found the brushes, we can go back up and stop recursing at this level return; } // Grad the next node to work with and grab this node's plane data tBSPNode *pNode = &m_pNodes[nodeIndex]; tBSPPlane *pPlane = &m_pPlanes[pNode->plane]; // Here we use the plane equation to find out where our initial start position is // according the the node that we are checking. We then grab the same info for the end pos. float startDistance = Dot(vStart, pPlane->vNormal) - pPlane->d; float endDistance = Dot(vEnd, pPlane->vNormal) - pPlane->d; float offset = 0.0f; // If we are doing sphere collision, include an offset for our collision tests below if(m_traceType == TYPE_SPHERE) offset = m_traceRadius; /////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// * // Here we check to see if we are working with a BOX or not else if(m_traceType == TYPE_BOX) { // This equation does a dot product to see how far our // AABB is away from the current plane we are checking. // Since this is a distance, we need to make it an absolute // value, which calls for the fabs() function (abs() for floats). // Get the distance our AABB is from the current splitter plane offset = (float)(fabs( m_vExtents.x * pPlane->vNormal.x ) + fabs( m_vExtents.y * pPlane->vNormal.y ) + fabs( m_vExtents.z * pPlane->vNormal.z ) ); } /////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// * // Here we check to see if the start and end point are both in front of the current node. // If so, we want to check all of the nodes in front of this current splitter plane. if(startDistance >= offset && endDistance >= offset) { // Traverse the BSP tree on all the nodes in front of this current splitter plane CheckNode(pNode->front, startDistance, endDistance, vStart, vEnd); } // If both points are behind the current splitter plane, traverse down the back nodes else if(startDistance < -offset && endDistance < -offset) { // Traverse the BSP tree on all the nodes in back of this current splitter plane CheckNode(pNode->back, startDistance, endDistance, vStart, vEnd); } else { // If we get here, then our ray needs to be split in half to check the nodes // on both sides of the current splitter plane. Thus we create 2 ratios. float Ratio1 = 1.0f, Ratio2 = 0.0f, middleRatio = 0.0f; CVector3 vMiddle; // This stores the middle point for our split ray // Start of the side as the front side to check int side = pNode->front; // Here we check to see if the start point is in back of the plane (negative) if(startDistance < endDistance) { // Since the start position is in back, let's check the back nodes side = pNode->back; // Here we create 2 ratios that hold a distance from the start to the // extent closest to the start (take into account a sphere and epsilon). float inverseDistance = 1.0f / (startDistance - endDistance); Ratio1 = (startDistance - offset - kEpsilon) * inverseDistance; Ratio2 = (startDistance + offset + kEpsilon) * inverseDistance; } // Check if the starting point is greater than the end point (positive) else if(startDistance > endDistance) { // This means that we are going to recurse down the front nodes first. // We do the same thing as above and get 2 ratios for split ray. float inverseDistance = 1.0f / (startDistance - endDistance); Ratio1 = (startDistance + offset + kEpsilon) * inverseDistance; Ratio2 = (startDistance - offset - kEpsilon) * inverseDistance; } // Make sure that we have valid numbers and not some weird float problems. // This ensures that we have a value from 0 to 1 as a good ratio should be :) if (Ratio1 < 0.0f) Ratio1 = 0.0f; else if (Ratio1 > 1.0f) Ratio1 = 1.0f; if (Ratio2 < 0.0f) Ratio2 = 0.0f; else if (Ratio2 > 1.0f) Ratio2 = 1.0f; // Just like we do in the Trace() function, we find the desired middle // point on the ray, but instead of a point we get a middleRatio percentage. middleRatio = startRatio + ((endRatio - startRatio) * Ratio1); vMiddle = vStart + ((vEnd - vStart) * Ratio1); // Now we recurse on the current side with only the first half of the ray CheckNode(side, startRatio, middleRatio, vStart, vMiddle); // Now we need to make a middle point and ratio for the other side of the node middleRatio = startRatio + ((endRatio - startRatio) * Ratio2); vMiddle = vStart + ((vEnd - vStart) * Ratio2); // Depending on which side should go last, traverse the bsp with the // other side of the split ray (movement vector). if(side == pNode->back) CheckNode(pNode->front, middleRatio, endRatio, vMiddle, vEnd); else CheckNode(pNode->back, middleRatio, endRatio, vMiddle, vEnd); } } /////////////////////////////////// CHECK BRUSH \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\* ///// ///// This checks our movement vector against all the planes of the brush ///// /////////////////////////////////// CHECK BRUSH \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\* void CQuake3BSP::CheckBrush(tBSPBrush *pBrush, CVector3 vStart, CVector3 vEnd) { float startRatio = -1.0f; // Like in BrushCollision.htm, start a ratio at -1 float endRatio = 1.0f; // Set the end ratio to 1 bool startsOut = false; // This tells us if we starting outside the brush // Go through all of the brush sides and check collision against each plane for(int i = 0; i < pBrush->numOfBrushSides; i++) { // Here we grab the current brush side and plane in this brush tBSPBrushSide *pBrushSide = &m_pBrushSides[pBrush->brushSide + i]; tBSPPlane *pPlane = &m_pPlanes[pBrushSide->plane]; // Let's store a variable for the offset (like for sphere collision) float offset = 0.0f; // If we are testing sphere collision we need to add the sphere radius if(m_traceType == TYPE_SPHERE) offset = m_traceRadius; // Test the start and end points against the current plane of the brush side. // Notice that we add an offset to the distance from the origin, which makes // our sphere collision work. float startDistance = Dot(vStart, pPlane->vNormal) - (pPlane->d + offset); float endDistance = Dot(vEnd, pPlane->vNormal) - (pPlane->d + offset); /////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// * // This is the last beefy part of code in this tutorial. In this // section we need to do a few special checks to see which extents // we should use. We do this by checking the x,y,z of the normal. // If the vNormal.x is less than zero, we want to use the Max.x // value, otherwise use the Min.x value. We do these checks because // we want the corner of the bounding box that is closest to the plane to // test for collision. Write it down on paper and see how this works. // We want to grab the closest corner (x, y, or z value that is...) so we // dont go through the wall. This works because the bounding box is axis aligned. // Store the offset that we will check against the plane CVector3 vOffset = CVector3(0, 0, 0); // If we are using AABB collision if(m_traceType == TYPE_BOX) { // Grab the closest corner (x, y, or z value) that is closest to the plane vOffset.x = (pPlane->vNormal.x < 0) ? m_vTraceMaxs.x : m_vTraceMins.x; vOffset.y = (pPlane->vNormal.y < 0) ? m_vTraceMaxs.y : m_vTraceMins.y; vOffset.z = (pPlane->vNormal.z < 0) ? m_vTraceMaxs.z : m_vTraceMins.z; // Use the plane equation to grab the distance our start position is from the plane. // We need to add the offset to this to see if the box collides with the plane, // even if the position doesn't. startDistance = Dot(vStart + vOffset, pPlane->vNormal) - pPlane->d; // Get the distance our end position is from this current brush plane endDistance = Dot(vEnd + vOffset, pPlane->vNormal) - pPlane->d; } /////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// * // Make sure we start outside of the brush's volume if(startDistance > 0) startsOut = true; // Stop checking since both the start and end position are in front of the plane if(startDistance > 0 && endDistance > 0) return; // Continue on to the next brush side if both points are behind or on the plane if(startDistance <= 0 && endDistance <= 0) continue; // If the distance of the start point is greater than the end point, we have a collision! if(startDistance > endDistance) { // This gets a ratio from our starting point to the approximate collision spot float Ratio1 = (startDistance - kEpsilon) / (startDistance - endDistance); // If this is the first time coming here, then this will always be true, // since startRatio starts at -1.0f. We want to find the closest collision, // so we still continue to check all of the brushes before quitting. if(Ratio1 > startRatio) { // Set the startRatio (currently the closest collision distance from start) startRatio = Ratio1; m_bCollided = true; // Let us know we collided! /////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// * // Store the normal of plane that we collided with for sliding calculations m_vCollisionNormal = pPlane->vNormal; /////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// * } } else { // Get the ratio of the current brush side for the endRatio float Ratio = (startDistance + kEpsilon) / (startDistance - endDistance); // If the ratio is less than the current endRatio, assign a new endRatio. // This will usually always be true when starting out. if(Ratio < endRatio) endRatio = Ratio; } } // If we didn't start outside of the brush we don't want to count this collision - return; if(startsOut == false) { return; } // If our startRatio is less than the endRatio there was a collision!!! if(startRatio < endRatio) { // Make sure the startRatio moved from the start and check if the collision // ratio we just got is less than the current ratio stored in m_traceRatio. // We want the closest collision to our original starting position. if(startRatio > -1 && startRatio < m_traceRatio) { // If the startRatio is less than 0, just set it to 0 if(startRatio < 0) startRatio = 0; // Store the new ratio in our member variable for later m_traceRatio = startRatio; } } } //////////////////////////// RENDER FACE \\\\\\\\\\\\\\\\\\\\\\\\\\\* ///// ///// This renders a face, determined by the passed in index ///// //////////////////////////// RENDER FACE \\\\\\\\\\\\\\\\\\\\\\\\\\\* void CQuake3BSP::RenderFace(int faceIndex) { // Here we grab the face from the index passed in tBSPFace *pFace = &m_pFaces[faceIndex]; // Assign our array of face vertices for our vertex arrays and enable vertex arrays glVertexPointer(3, GL_FLOAT, sizeof(tBSPVertex), &(m_pVerts[pFace->startVertIndex].vPosition)); glEnableClientState(GL_VERTEX_ARRAY); // If we want to render the textures if(g_bTextures) { // Set the current pass as the first texture (For multi-texturing) glActiveTextureARB(GL_TEXTURE0_ARB); // Give OpenGL the texture coordinates for the first texture, and enable that texture glClientActiveTextureARB(GL_TEXTURE0_ARB); glTexCoordPointer(2, GL_FLOAT, sizeof(tBSPVertex), &(m_pVerts[pFace->startVertIndex].vTextureCoord)); // Set our vertex array client states for allowing texture coordinates glEnableClientState(GL_TEXTURE_COORD_ARRAY); // Turn on texture arrays for the first pass glClientActiveTextureARB(GL_TEXTURE0_ARB); // Turn on texture mapping and bind the face's texture map glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, m_textures[pFace->textureID]); } if(g_bLightmaps) { // Set the current pass as the second lightmap texture_ glActiveTextureARB(GL_TEXTURE1_ARB); // Turn on texture arrays for the second lightmap pass glClientActiveTextureARB(GL_TEXTURE1_ARB); glEnableClientState(GL_TEXTURE_COORD_ARRAY); // Next, we need to specify the UV coordinates for our lightmaps. This is done // by switching to the second texture and giving OpenGL our lightmap array. glClientActiveTextureARB(GL_TEXTURE1_ARB); glTexCoordPointer(2, GL_FLOAT, sizeof(tBSPVertex), &(m_pVerts[pFace->startVertIndex].vLightmapCoord)); // Turn on texture mapping and bind the face's lightmap over the texture glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, m_lightmaps[pFace->lightmapID]); } // Render our current face to the screen with vertex arrays glDrawElements(GL_TRIANGLES, pFace->numOfIndices, GL_UNSIGNED_INT, &(m_pIndices[pFace->startIndex]) ); } //////////////////////////// RENDER LEVEL \\\\\\\\\\\\\\\\\\\\\\\\\\\* ///// ///// Goes through all of the faces and draws them if the type is FACE_POLYGON ///// //////////////////////////// RENDER LEVEL \\\\\\\\\\\\\\\\\\\\\\\\\\\* void CQuake3BSP::RenderLevel(const CVector3 &vPos) { // Reset our bitset so all the slots are zero. m_FacesDrawn.ClearAll(); // Grab the leaf index that our camera is in int leafIndex = FindLeaf(vPos); // Grab the cluster that is assigned to the leaf int cluster = m_pLeafs[leafIndex].cluster; // Initialize our counter variables (start at the last leaf and work down) int i = m_numOfLeafs; g_VisibleFaces = 0; // Go through all the leafs and check their visibility while(i--) { // Get the current leaf that is to be tested for visibility from our camera's leaf tBSPLeaf *pLeaf = &(m_pLeafs[i]); // If the current leaf can't be seen from our cluster, go to the next leaf if(!IsClusterVisible(cluster, pLeaf->cluster)) continue; // If the current leaf is not in the camera's frustum, go to the next leaf if(!g_Frustum.BoxInFrustum((float)pLeaf->min.x, (float)pLeaf->min.y, (float)pLeaf->min.z, (float)pLeaf->max.x, (float)pLeaf->max.y, (float)pLeaf->max.z)) continue; // If we get here, the leaf we are testing must be visible in our camera's view. // Get the number of faces that this leaf is in charge of. int faceCount = pLeaf->numOfLeafFaces; // Loop through and render all of the faces in this leaf while(faceCount--) { // Grab the current face index from our leaf faces array int faceIndex = m_pLeafFaces[pLeaf->leafface + faceCount]; // Before drawing this face, make sure it's a normal polygon if(m_pFaces[faceIndex].type != FACE_POLYGON) continue; // Since many faces are duplicated in other leafs, we need to // make sure this face already hasn't been drawn. if(!m_FacesDrawn.On(faceIndex)) { // Increase the rendered face count to display for fun g_VisibleFaces++; // Set this face as drawn and render it m_FacesDrawn.Set(faceIndex); RenderFace(faceIndex); } } } } //////////////////////////// DESTROY \\\\\\\\\\\\\\\\\\\\\\\\\\\* ///// ///// This cleans up our object and frees allocated memory ///// //////////////////////////// DESTROY \\\\\\\\\\\\\\\\\\\\\\\\\\\* void CQuake3BSP::Destroy() { // If we still have valid memory for our vertices, free them if(m_pVerts) { delete [] m_pVerts; m_pVerts = NULL; } // If we still have valid memory for our faces, free them if(m_pFaces) { delete [] m_pFaces; m_pFaces = NULL; } // If we still have valid memory for our indices, free them if(m_pIndices) { delete [] m_pIndices; m_pIndices = NULL; } // If we still have valid memory for our nodes, free them if(m_pNodes) { delete [] m_pNodes; m_pNodes = NULL; } // If we still have valid memory for our leafs, free them if(m_pLeafs) { delete [] m_pLeafs; m_pLeafs = NULL; } // If we still have valid memory for our leaf faces, free them if(m_pLeafFaces) { delete [] m_pLeafFaces; m_pLeafFaces = NULL; } // If we still have valid memory for our planes, free them if(m_pPlanes) { delete [] m_pPlanes; m_pPlanes = NULL; } // If we still have valid memory for our clusters, free them if(m_clusters.pBitsets) { delete [] m_clusters.pBitsets; m_clusters.pBitsets = NULL; } // If we still have valid memory for our brushes, free them if(m_pBrushes) { delete [] m_pBrushes; m_pBrushes = NULL; } // If we still have valid memory for our brush sides, free them if(m_pBrushSides) { delete [] m_pBrushSides; m_pBrushSides = NULL; } // If we still have valid memory for our leaf brushes, free them if(m_pLeafBrushes) { delete [] m_pLeafBrushes; m_pLeafBrushes = NULL; } // If we still have valid memory for our BSP texture info, free it if(m_pTextures) { delete [] m_pTextures; m_pTextures = NULL; } // Free all the textures glDeleteTextures(m_numOfTextures, m_textures); // Delete the lightmap textures glDeleteTextures(m_numOfLightmaps, m_lightmaps); } //////////////////////////// ~CQUAKE3BSP \\\\\\\\\\\\\\\\\\\\\\\\\\\* ///// ///// This is our deconstructor that is called when the object is destroyed ///// //////////////////////////// ~CQUAKE3BSP \\\\\\\\\\\\\\\\\\\\\\\\\\\* CQuake3BSP::~CQuake3BSP() { // Call our destroy function Destroy(); } ///////////////////////////////////////////////////////////////////////////////// // // * QUICK NOTES * // // We have just added Bounding Box Collision and Sliding to our collision detection. // The only thing we are missing now is jumping, gravity and being able to walk up // stairs. // // This tutorial wasn't so hard, but it is important to get the basics down with our // collision before we go onto more advanced topics. There are many people that // ask how to do sliding collision detection, so I figured if we made a more simpler // tutorial people could pick out how to accomplish this effect, even if they aren't // interested in doing BSP collision detection. // // In this file we added a new function TraceBox() for AABB collision detection. // We also added in the Trace() function the ability to slide off of the walls when // we collide. Simple, but pretty cool huh? // // Good luck on your collision! // // // Ben Humphrey (DigiBen) // Game Programmer // [email protected] // ©2000-2005 GameTutorials // //
c579b1608a3f0357aa410e68762b26d49f697be4
3695785e40bc96850d7f68a40263738c43a5f8d7
/Heap/Heap.hpp
a56dbc53c784f3509019b49f3701b93b03b6e58a
[]
no_license
Dmowmyh/DataStructures
80e28247f886b403764aab75d2a5a6de813325ae
88e93837fcf0cdfe7149a4b1225925fb2923aadf
refs/heads/master
2023-03-31T08:33:47.875424
2021-04-14T08:39:54
2021-04-14T08:39:54
354,754,343
0
0
null
null
null
null
UTF-8
C++
false
false
2,099
hpp
#pragma once #include <iostream> #include <algorithm> #include "Heap.h" template <typename T> typename Heap<T>::Predicate Heap<T>::MinPredicate = [](const T& lhs, const T& rhs, bool traverseDirection) { if (traverseDirection) return lhs < rhs; else return lhs > rhs; }; template <typename T> typename Heap<T>::Predicate Heap<T>::MaxPredicate = [](const T& lhs, const T& rhs, bool traverseDirection) { if (traverseDirection) return lhs > rhs; else return lhs < rhs; }; template <typename T> Heap<T>::Heap(size_t capacity, Heap::Predicate pred): m_data(std::vector<T>()), m_capacity(capacity), m_predicate(pred) { m_data.reserve(m_capacity); } template <typename T> void Heap<T>::Insert(T&& value) noexcept { if (Size() != m_capacity) { m_data.emplace_back(std::forward<T>(value)); size_t i = Size()-1; FixHeap(i); } } template <typename T> auto Heap<T>::PopRoot() -> T { if (Size() <= 0) { return 0; //return INVALID NUMBER; } if (Size() == 1) { auto root = m_data.front(); m_data.pop_back(); return root; } int root = m_data[0]; m_data[0] = m_data[Size()-1]; m_data.pop_back(); Heapify(0); return root; } template <typename T> void Heap<T>::FixHeap(size_t nodeIdx) { while(nodeIdx != 0 && m_predicate(m_data[Parent(nodeIdx)], m_data[nodeIdx], false)) { std::swap(m_data[nodeIdx], m_data[Parent(nodeIdx)]); nodeIdx = Parent(nodeIdx); } } template <typename T> void Heap<T>::Heapify(size_t nodeIdx) { size_t left = Left(nodeIdx); size_t right = Right(nodeIdx); size_t valueToChange = nodeIdx; if (left < Size() && m_predicate(m_data[left], m_data[nodeIdx], true)) { valueToChange = left; } if (right < Size() && m_predicate(m_data[right], m_data[valueToChange], true)) { valueToChange = right; } if (valueToChange != nodeIdx) { std::swap(m_data[nodeIdx], m_data[valueToChange]); Heapify(valueToChange); } }
f9cfd99eadbc5e2350efc8f656d15d0dd3958868
c037f3092d3f94a7e6f380184507ab133639cc3d
/src/services/audio/input_controller.h
1a0b49bdcbd6614f0415fda82d1d60264edaf2f9
[ "BSD-3-Clause" ]
permissive
webosose/chromium79
bab17fe53458195b41251e4d5adfa29116ae89a9
57b21279f43f265bf0476d2ebf8fe11c8dee4bba
refs/heads/master
2022-11-10T03:27:02.861486
2020-10-29T11:30:27
2020-11-09T05:19:01
247,589,218
3
6
null
2022-10-23T11:12:07
2020-03-16T02:06:18
null
UTF-8
C++
false
false
13,663
h
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef SERVICES_AUDIO_INPUT_CONTROLLER_H_ #define SERVICES_AUDIO_INPUT_CONTROLLER_H_ #include <stddef.h> #include <stdint.h> #include <memory> #include <string> #include "base/memory/weak_ptr.h" #include "base/optional.h" #include "base/strings/string_piece.h" #include "base/threading/thread_checker.h" #include "base/timer/timer.h" #include "build/build_config.h" #include "media/base/audio_parameters.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/receiver.h" #include "mojo/public/cpp/bindings/remote.h" #include "services/audio/public/mojom/audio_processing.mojom.h" #include "services/audio/snoopable.h" #include "services/audio/stream_monitor.h" #include "services/audio/stream_monitor_coordinator.h" namespace media { class AudioBus; class AudioInputStream; class AudioManager; #if defined(AUDIO_PROCESSING_IN_AUDIO_SERVICE) class AudioProcessor; #endif class UserInputMonitor; } // namespace media namespace audio { // Only do power monitoring for non-mobile platforms to save resources. #if !defined(OS_ANDROID) && !defined(OS_IOS) #define AUDIO_POWER_MONITORING #endif // All public methods of InputController must be called from the audio thread. class InputController final : public StreamMonitor { public: // Error codes to make native logging more clear. These error codes are added // to generic error strings to provide a higher degree of details. // Changing these values can lead to problems when matching native debug // logs with the actual cause of error. enum ErrorCode { // An unspecified error occured. UNKNOWN_ERROR = 0, // Failed to create an audio input stream. STREAM_CREATE_ERROR, // = 1 // Failed to open an audio input stream. STREAM_OPEN_ERROR, // = 2 // Native input stream reports an error. Exact reason differs between // platforms. STREAM_ERROR, // = 3 }; // An event handler that receives events from the InputController. The // following methods are all called on the audio thread. class EventHandler { public: // The initial "muted" state of the underlying stream is sent along with the // OnCreated callback, to avoid the stream being treated as unmuted until an // OnMuted callback has had time to be processed. virtual void OnCreated(bool initially_muted) = 0; virtual void OnError(ErrorCode error_code) = 0; virtual void OnLog(base::StringPiece) = 0; // Called whenever the muted state of the underlying stream changes. virtual void OnMuted(bool is_muted) = 0; protected: virtual ~EventHandler() {} }; // A synchronous writer interface used by InputController for // synchronous writing. class SyncWriter { public: virtual ~SyncWriter() {} // Write certain amount of data from |data|. virtual void Write(const media::AudioBus* data, double volume, bool key_pressed, base::TimeTicks capture_time) = 0; // Close this synchronous writer. virtual void Close() = 0; }; // enum used for determining what UMA stats to report. enum StreamType { VIRTUAL = 0, HIGH_LATENCY = 1, LOW_LATENCY = 2, FAKE = 3, }; ~InputController() final; media::AudioInputStream* stream_for_testing() { return stream_; } // |user_input_monitor| is used for typing detection and can be NULL. static std::unique_ptr<InputController> Create( media::AudioManager* audio_manager, EventHandler* event_handler, SyncWriter* sync_writer, media::UserInputMonitor* user_input_monitor, const media::AudioParameters& params, const std::string& device_id, bool agc_is_enabled, StreamMonitorCoordinator* stream_monitor_coordinator, mojom::AudioProcessingConfigPtr processing_config); // Starts recording using the created audio input stream. void Record(); #if defined(USE_NEVA_SUSPEND_MEDIA_CAPTURE) // Pauses capturing the audio input stream so it can be // resumed later. void Pause(); // Resumes the previously paused audio input stream. void Resume(); #endif // Closes the audio input stream, freeing the associated resources. Must be // called before destruction. void Close(); // Sets the capture volume of the input stream. The value 0.0 corresponds // to muted and 1.0 to maximum volume. void SetVolume(double volume); // Sets the output device which will be used to cancel audio from, if this // input device supports echo cancellation. void SetOutputDeviceForAec(const std::string& output_device_id); bool ShouldRegisterWithStreamMonitorCoordinator() const; // StreamMonitor implementation void OnStreamActive(Snoopable* snoopable) override; void OnStreamInactive(Snoopable* snoopable) override; private: // Used to log the result of capture startup. // This was previously logged as a boolean with only the no callback and OK // options. The enum order is kept to ensure backwards compatibility. // Elements in this enum should not be deleted or rearranged; the only // permitted operation is to add new elements before // CAPTURE_STARTUP_RESULT_MAX and update CAPTURE_STARTUP_RESULT_MAX. // // The NO_DATA_CALLBACK enum has been replaced with NEVER_GOT_DATA, // and there are also other histograms such as // Media.Audio.InputStartupSuccessMac to cover issues similar // to the ones the NO_DATA_CALLBACK was intended for. enum CaptureStartupResult { CAPTURE_STARTUP_OK = 0, CAPTURE_STARTUP_CREATE_STREAM_FAILED = 1, CAPTURE_STARTUP_OPEN_STREAM_FAILED = 2, CAPTURE_STARTUP_NEVER_GOT_DATA = 3, CAPTURE_STARTUP_STOPPED_EARLY = 4, CAPTURE_STARTUP_RESULT_MAX = CAPTURE_STARTUP_STOPPED_EARLY, }; #if defined(AUDIO_POWER_MONITORING) // Used to log a silence report (see OnData). // Elements in this enum should not be deleted or rearranged; the only // permitted operation is to add new elements before SILENCE_STATE_MAX and // update SILENCE_STATE_MAX. // Possible silence state transitions: // SILENCE_STATE_AUDIO_AND_SILENCE // ^ ^ // SILENCE_STATE_ONLY_AUDIO SILENCE_STATE_ONLY_SILENCE // ^ ^ // SILENCE_STATE_NO_MEASUREMENT enum SilenceState { SILENCE_STATE_NO_MEASUREMENT = 0, SILENCE_STATE_ONLY_AUDIO = 1, SILENCE_STATE_ONLY_SILENCE = 2, SILENCE_STATE_AUDIO_AND_SILENCE = 3, SILENCE_STATE_MAX = SILENCE_STATE_AUDIO_AND_SILENCE }; #endif #if defined(AUDIO_PROCESSING_IN_AUDIO_SERVICE) class ProcessingHelper final : public mojom::AudioProcessorControls, public Snoopable::Snooper { public: ProcessingHelper( const media::AudioParameters& params, media::AudioProcessingSettings processing_settings, mojo::PendingReceiver<mojom::AudioProcessorControls> controls_receiver); ~ProcessingHelper() final; // Snoopable::Snooper implementation void OnData(const media::AudioBus& audio_bus, base::TimeTicks reference_time, double volume) final; // mojom::AudioProcessorControls implementation. void GetStats(GetStatsCallback callback) final; void StartEchoCancellationDump(base::File file) final; void StopEchoCancellationDump() final; media::AudioProcessor* GetAudioProcessor(); // Starts monitoring |output_stream| instead of the currently monitored // stream, if any. void StartMonitoringStream(Snoopable* output_stream); // Stops monitoring |output_stream|, provided it's the currently monitored // stream. void StopMonitoringStream(Snoopable* output_stream); // Stops monitoring |monitored_output_stream_|, if not null. void StopAllStreamMonitoring(); private: // Starts and/or stops snooping and updates |monitored_output_stream_| // appropriately. void ChangeMonitoredStream(Snoopable* output_stream); THREAD_CHECKER(owning_thread_); const mojo::Receiver<mojom::AudioProcessorControls> receiver_; const media::AudioParameters params_; const std::unique_ptr<media::AudioProcessor> audio_processor_; media::AudioParameters output_params_; Snoopable* monitored_output_stream_ = nullptr; std::unique_ptr<media::AudioBus> clamped_bus_; }; #endif // defined(AUDIO_PROCESSING_IN_AUDIO_SERVICE) InputController(EventHandler* handler, SyncWriter* sync_writer, media::UserInputMonitor* user_input_monitor, const media::AudioParameters& params, StreamType type, StreamMonitorCoordinator* stream_monitor_coordinator, mojom::AudioProcessingConfigPtr processing_config); void DoCreate(media::AudioManager* audio_manager, const media::AudioParameters& params, const std::string& device_id, bool enable_agc); void DoReportError(); void DoLogAudioLevels(float level_dbfs, int microphone_volume_percent); #if defined(AUDIO_POWER_MONITORING) // Updates the silence state, see enum SilenceState above for state // transitions. void UpdateSilenceState(bool silence); // Logs the silence state as UMA stat. void LogSilenceState(SilenceState value); #endif // Logs the result of creating an InputController. void LogCaptureStartupResult(CaptureStartupResult result); // Logs whether an error was encountered suring the stream. void LogCallbackError(); // Called by the stream with log messages. void LogMessage(const std::string& message); // Called on the hw callback thread. Checks for keyboard input if // |user_input_monitor_| is set otherwise returns false. bool CheckForKeyboardInput(); // Does power monitoring on supported platforms. // Called on the hw callback thread. // Returns true iff average power and mic volume was returned and should // be posted to DoLogAudioLevels on the audio thread. // Returns false if either power measurements are disabled or aren't needed // right now (they're done periodically). bool CheckAudioPower(const media::AudioBus* source, double volume, float* average_power_dbfs, int* mic_volume_percent); void CheckMutedState(); static StreamType ParamsToStreamType(const media::AudioParameters& params); #if defined(AUDIO_PROCESSING_IN_AUDIO_SERVICE) void UpdateVolumeAndAPMStats(base::Optional<double> new_volume); #endif // This class must be used on the audio manager thread. THREAD_CHECKER(owning_thread_); // Contains the InputController::EventHandler which receives state // notifications from this class. EventHandler* const handler_; // Pointer to the audio input stream object. // Only used on the audio thread. media::AudioInputStream* stream_ = nullptr; // SyncWriter is used only in low-latency mode for synchronous writing. SyncWriter* const sync_writer_; StreamType type_; double max_volume_ = 0.0; media::UserInputMonitor* const user_input_monitor_; bool registered_to_coordinator_ = false; StreamMonitorCoordinator* const stream_monitor_coordinator_; mojom::AudioProcessingConfigPtr processing_config_; #if defined(AUDIO_POWER_MONITORING) // Whether the silence state and microphone levels should be checked and sent // as UMA stats. bool power_measurement_is_enabled_ = false; // Updated each time a power measurement is performed. base::TimeTicks last_audio_level_log_time_; // The silence report sent as UMA stat at the end of a session. SilenceState silence_state_ = SILENCE_STATE_NO_MEASUREMENT; #endif size_t prev_key_down_count_ = 0; // Time when the stream started recording. base::TimeTicks stream_create_time_; bool is_muted_ = false; base::RepeatingTimer check_muted_state_timer_; #if defined(AUDIO_PROCESSING_IN_AUDIO_SERVICE) // Holds stats related to audio processing. base::Optional<ProcessingHelper> processing_helper_; #endif class AudioCallback; // Holds a pointer to the callback object that receives audio data from // the lower audio layer. Valid only while 'recording' (between calls to // stream_->Start() and stream_->Stop()). // The value of this pointer is only set and read on the audio thread while // the callbacks themselves occur on the hw callback thread. More details // in the AudioCallback class in the cc file. std::unique_ptr<AudioCallback> audio_callback_; // A weak pointer factory that we use when posting tasks to the audio thread // that we want to be automatically discarded after Close() has been called // and that we do not want to keep the InputController instance alive // beyond what is desired by the user of the instance. An example of where // this is important is when we fire error notifications from the hw callback // thread, post them to the audio thread. In that case, we do not want the // error notification to keep the InputController alive for as long as // the error notification is pending and then make a callback from an // InputController that has already been closed. // All outstanding weak pointers, are invalidated at the end of DoClose. base::WeakPtrFactory<InputController> weak_ptr_factory_{this}; DISALLOW_COPY_AND_ASSIGN(InputController); }; } // namespace audio #endif // SERVICES_AUDIO_INPUT_CONTROLLER_H_
0b952c9ee0bd690e2658e7c06d7a8292f13af4b9
d5c4aa648736e968813e06cbada6d717f8347a59
/Mercs/Source/InfoScreen.cpp
1c937030f5ad7cabc4724d28d31c43e135b49c90
[ "MIT" ]
permissive
Alejandromo125/DeltaSquad
6a4a2264a1aaf34b7d943f55934c775d8c063885
1baa350bca973c0d04c4ab447ee3456e0365a3ab
refs/heads/main
2023-05-23T04:03:19.478648
2021-06-12T15:23:54
2021-06-12T15:23:54
339,020,739
4
0
null
null
null
null
UTF-8
C++
false
false
1,241
cpp
#include "InfoScreen.h" #include "Application.h" #include "ModuleTextures.h" #include "ModuleRender.h" #include "ModuleAudio.h" #include "ModuleInput.h" #include "ModuleFadeToBlack.h" #include "ModulePlayer.h" InfoScreen::InfoScreen(bool startEnabled) : Module(startEnabled) { } InfoScreen::~InfoScreen() { } // Load assets bool InfoScreen::Start() { LOG("Loading background assets"); bool ret = true; bgTexture = App->textures->Load("Assets/Art/Sequences/firstbg.png"); App->audio->PlayMusic("Assets/Music/Assassin.ogg", 1.0f); delay = 0; App->render->camera.x = 0; App->render->camera.y = 0; App->player->cameraXlimitation = true; App->player->cameraYlimitation = true; return ret; } Update_Status InfoScreen::Update() { delay++; if (App->input->keys[SDL_SCANCODE_SPACE] == Key_State::KEY_DOWN) { App->fade->FadeToBlack(this, (Module*)App->whiteHouseIntro, 90); } if (delay >= 420) { App->fade->FadeToBlack(this, (Module*)App->titleScreen, 90); } return Update_Status::UPDATE_CONTINUE; } // Update: draw background Update_Status InfoScreen::PostUpdate() { // Draw everything -------------------------------------- App->render->Blit(bgTexture, 0, 0, NULL); return Update_Status::UPDATE_CONTINUE; }
cbf6da1e2e621444e9bec34a13d091cce4c5e8d6
348895dc8570694e3af2413f2dec92dc7b84f862
/k09/kstat02.cpp
1bd25ed99ad6f59e8fec7a195b7a450a6caecbbb
[ "MIT", "LicenseRef-scancode-free-unknown" ]
permissive
kojiynet/koli
5c804e5b176b99c79c79f2eaab884ea7de791749
db8a8c8d1031dab28dd0d1e985ab75fa68570f9e
refs/heads/master
2023-06-12T08:29:57.684235
2023-05-28T05:02:48
2023-05-28T05:02:48
216,354,148
0
0
MIT
2023-04-01T10:53:45
2019-10-20T11:55:18
C++
UTF-8
C++
false
false
26,839
cpp
/* kstat Ver. k09.02 Written by Koji Yamamoto Copyright (C) 2015-2020 Koji Yamamoto In using this, please read the document which states terms of use. Module for Statistical Computations k10になるときに以下の関数を消す。 double unbiasedVar() →kstatboostのものを推奨。 double boostMean( const std::vector <double> &dv0) Note: As for FreqType, possibly in the future we should refer the following libraries:  GSL's Histogram */ /* ********** Preprocessor Directives ********** */ #ifndef kstat_cpp_include_guard #define kstat_cpp_include_guard #include <memory> #include <map> #include <vector> #include <limits> #include <functional> #include <cmath> #include <k09/kutil02.cpp> #include <k09/kalgo02.cpp> /* ********** Using Directives ********** */ //using namespace std; /* ********** Type Declarations: enum, class, etc. ********** */ // TCount is int by default template <typename T, typename TCount = int> class FreqType; // TCode is int by default template <typename T, typename TCode = int> class RecodeTable; /* // This class is declared in RecodeType template <typename T, typename TCode> struct RecodeTable :: CodeType; */ template <typename T> class JudgeEqual; template <typename T> class JudgeEqualTol; /* ********** Function Declarations ********** */ template <typename T> int countUniqueValues( const std::vector <T> &); template <typename TOrigin, typename TCode, typename TCount> void createFreqFromRecodeTable( FreqType <TCode, TCount> &, const std::vector <TOrigin> &, const RecodeTable <TOrigin, TCode> & ); template <typename T> std::vector <T> omitNan( const std::vector <T> &); double sum( const std::vector <double> &); double mean( const std::vector <double> &); double median( const std::vector <double> &); double unbiasedVar( const std::vector <double> &); // 非推奨。deprecated. double boostMean( const std::vector <double> &); // 非推奨。deprecated. double sum( const double *, int); double mean( const double *, int); double unbiasedVar( const double *, int); // このファイル内でよいのか? template <typename T> std::string toString( const T &); /* ********** Type Definitions: enum, class, etc. ********** */ // frequency type // T is type for key, and TCount is type for count // This type is essentially for discrete variables, // with Tolerance for equality judgment being very small. // When applied to continuous variables, // special methods should be used. // 基本的に離散変数用。 // doubleなどに使う場合、等値判断のための // toleranceは0か非常に小さい値である、 // という前提がある。そうでないとカテゴリ間の // 重なりが生じてしまう。 // 連続変数に用いる場合には、特定の機能を使うべし。 // TCount is int by default template <typename T, typename TCount /* = int */> class FreqType { private: map <T, TCount> freqmap; std::function < bool( const T &, const T &) > areEqual; TCount sumcount; // Note that we specify double as TOrigin for RecodeTable // RecodeTableのTOriginとして、doubleを指定してしまっている。 // ここに柔軟性を持たせたいならば、rtablepがないクラスをつくり、 // それを基底クラスにして、派生クラスでテンプレート引数を増やしてrtablepを持たせるのが、素直だろう。 std::unique_ptr < RecodeTable<double, T> > rtablep; public: FreqType( void); ~FreqType( void); void clear( void); void setEqualExactly( void); void setEqualWithTol( const T &); bool addPossibleKey( const T &); bool addPossibleKeys( const std::vector <T> &); void increment( const T &); void addCount( const T &, const TCount &); void addFreqType( const FreqType <T, TCount> &); void clearCount( void); TCount getSumCount( void) const; void getVectors( std::vector <T> &, std::vector <TCount> &) const; double meanFromFreq( void) const; double medianFromFreq( void) const; void modeFromFreq( std::vector <T> &) const; void setFreqFromRecodeTable( const std::vector <double> &, const RecodeTable <double, T> &); void printPadding( std::ostream &) const; // Note that obtained vectors should be // parallel to those obtained by getVectors() above void getRangeVectors( std::vector <double> &, std::vector <double> &) const; }; // TCode is int by default template <typename TOrigin, typename TCode /* = int */> class RecodeTable { private: struct CodeType; // inner class; defined below // 1要素はRecodeTableの1行分 std::vector <CodeType> codes; // "else"の場合の処理方法 (スコープを持つ列挙型) enum class ElseType { Copy, AssignValue}; ElseType toDoForElse; // "else"の場合の処理方法 TCode codeForElse; // "else"の場合に値を埋める場合の値(NaN以外) public: RecodeTable( void){} ~RecodeTable( void){} void setAutoTableFromContVar( const std::vector <TOrigin> &); std::vector <TCode> getPossibleCodeVec( void) const; TCode getCodeForValue( TOrigin) const; void getLeftRightForCode( TOrigin &, TOrigin &, TCode) const; std::string getRangeLabelForCode( TCode) const; void print( ostream &, string = ","s) const; }; template <typename TOrigin, typename TCode> struct RecodeTable <TOrigin, TCode> :: CodeType { // Fields: TOrigin left; // the left-handside endpoint of the class bool leftIn; // whether the endpoint value is inclusive TOrigin right; // the right-handside endpoint of the class bool rightIn; // whether the endpoint value is inclusive TCode codeAssigned; // the code assigned to this class // Methods: CodeType( TOrigin l0, bool li0, TOrigin r0, bool ri0, TCode ca0) : left( l0), leftIn( li0), right( r0), rightIn( ri0), codeAssigned( ca0) {} ~CodeType( void){}; bool correspond( TOrigin v) const { if ( left < v && v < right){ return true; } if ( leftIn == true && left == v){ return true; } if ( rightIn == true && right == v){ return true; } return false; } string getRangeLabel( void) const { stringstream ss; ss << left << " "; if ( leftIn == true){ ss << "<="; } else { ss << "<"; } ss << " x "; if ( rightIn == true){ ss << "<="; } else { ss << "<"; } ss << " " << right; return ss.str(); } }; // 等値判断のためのファンクタクラス:==演算子で判断する。 template <typename T> class JudgeEqual { public: JudgeEqual( void){} ~JudgeEqual( void){} bool operator()( const T &a, const T &b) { return ( a == b); } }; // 等値判断のためのファンクタクラス:Toleranceを含んで判断する。 // class to judge equality with tolerance // i.e. regard a and b equal when a < b + tol and a > b - tol // thus if T is double and a = 1.0 and tol = 0.1, // then b can be ( 0.9, 1.1) template <typename T> class JudgeEqualTol { private: T tol; // this is assumed to be non-negative and very small public: JudgeEqualTol( void){} JudgeEqualTol( const T &tol0) : tol( tol0){} ~JudgeEqualTol( void){} void setTol( const T &tol0) { tol = tol0; } bool operator()( const T &a, const T &b) { return ( ( a < b + tol) && ( a > b - tol)); } }; /* ********** Global Variables ********** */ /* ********** Definitions of Static Member Variables ********** */ /* ********** Function Definitions ********** */ // ==演算子を用いて、ユニークな値が何個あるかを返す。 // var0に欠損値は含まないと仮定して、ケース数を算出している。 // We assume var0 does not contain invalid values. template <typename T> int countUniqueValues( const std::vector <T> &vec0) { if ( vec0.size() < 1){ return 0; } std::vector <T> vec( vec0); std::sort( vec.begin(), vec.end()); T prev = vec[ 0]; int ret = 1; for ( auto v : vec){ if ( v != prev){ ret++; prev = v; } } return ret; } // This function is more flexible than FreqType::setFreqFromRecodeType() // in the sense that this can allow <TOrigin> different from <double>. // But this function does not make FreqType store rtable itself. template <typename TOrigin, typename TCode, typename TCount> void createFreqFromRecodeTable( FreqType <TCode, TCount> &ret, const std::vector <TOrigin> &var, const RecodeTable <TOrigin, TCode> &rtable ) { ret.clear(); std::vector <TCode> codeVec = rtable.getPossibleCodeVec(); ret.addPossibleKeys( codeVec); for ( auto v : var){ if ( std::isnan( v)){ // do nothing } else { TCode codeToAdd = rtable.getCodeForValue( v); ret.increment( codeToAdd); } } } template <typename T> std::vector <T> omitNan( const std::vector <T> &vec0) { std::vector <T> ret; ret.reserve( vec0.size()); for ( const auto &v : vec0){ if ( std::isnan( v)){ // do nothing } else { ret.push_back( v); } } return ret; } // returns the sum of all the elements double sum( const std::vector <double> &dv0) { double s; s = 0.0; for ( auto v : dv0){ s += v; } return s; } // returns the mean value inline double mean( const std::vector <double> &dv0) { double s, ret; s = sum( dv0); ret = s / ( double)( dv0.size()); return ret; } // returns the median value double median( const std::vector <double> &dv0) { int n; std::vector <double> sorted; double ret; n = dv0.size(); sorted = dv0; sort( sorted.begin(), sorted.end()); if ( n % 2 == 0){ // n is an even number ret = ( sorted[ n / 2 - 1] + sorted[ n / 2]) / 2.0; } else { // n is an odd number ret = sorted[ n / 2]; } return ret; } // DEPRECATED 非推奨 // このアルゴリズムでは精度が落ちるときがあるらしい。 // kstatboostのものを推奨する。 // returns "unbiased" variance inline double unbiasedVar( const std::vector <double> &v0) { int n = v0.size(); double m = mean( v0); double s2 = 0.0; for ( auto &d : v0){ s2 += d * d; } return ( s2 / ( double)n - m * m) * ( double)n / ( double)( n - 1); } // DEPRECATED 非推奨 // boost version of mean calculation // // I would not prefer this series, // because the algorithm for median value is just estimating it; // not returining accurate values #include <boost/accumulators/accumulators.hpp> #include <boost/accumulators/statistics.hpp> // for stats<> template, tag::mean double boostMean( const std::vector <double> &dv0) { using namespace boost::accumulators; accumulator_set< double, stats< tag::mean > > acc; acc = std::for_each( dv0.begin(), dv0.end(), acc); return extract::mean( acc); } // 長さnの配列へのポインタpを得て、合計を返す。 double sum( const double *p, int n) { double s; s = 0.0; for ( int i = 0; i < n; i++){ s += p[ i]; } return s; } // 長さnの配列へのポインタpを得て、平均を返す。 inline double mean( const double *p, int n) { return ( sum( p, n) / ( double)n); } // 長さnの配列へのポインタpを得て、不偏分散を返す。 inline double unbiasedVar( const double *p, int n) { double m, s2; m = mean( p, n); s2 = 0.0; for ( int i = 0; i < n; i++){ s2 += p[ i] * p[ i]; } return ( s2 / ( double)n - m * m) * ( double)n / ( double)( n - 1); } // convert any type T into string // using stringstream template <typename T> std::string toString( const T &origin) { std::stringstream ss; ss.str( ""); ss << origin; return ss.str(); } /* ********** Definitions of Member Functions ********** */ /* ---------- class FreqType ---------- */ template <typename T, typename TCount> FreqType <T, TCount> :: FreqType( void) : freqmap(), areEqual( JudgeEqual<T>()), sumcount( static_cast<TCount>( 0)) { } template <typename T, typename TCount> FreqType <T, TCount> :: ~FreqType( void) { } template <typename T, typename TCount> void FreqType <T, TCount> :: clear( void) { freqmap.clear(); sumcount = static_cast<TCount>( 0); } template <typename T, typename TCount> void FreqType <T, TCount> :: setEqualExactly( void) { areEqual = JudgeEqual<T>(); } template <typename T, typename TCount> void FreqType <T, TCount> :: setEqualWithTol( const T &tol) { areEqual = JudgeEqualTol<T>( tol); } // add v as a key with no freq when such a key does not exist. // if the "same" key exists, this does nothing. // returns true if such a key does not exist. // returns false if such a key does exist. // Note that the judgment about equivalence is made // simply using "map::find()" function; not using areEqual() template <typename T, typename TCount> bool FreqType <T, TCount> :: addPossibleKey( const T &v) { auto it = freqmap.find( v); // ここでfindを使う。areEqualを使っていない。 if ( it == freqmap.end()){ freqmap.insert( { v, 0}); return true; } return false; } // adds values in vec as a key with no freq when such a key does not exist. // if the same key exists, this does nothing. // returns true if such a key does not exist. // returns false if such a key does exist. // We can use this function like below. // addPossibleKeys( { 1.0, 2.0, 3.0, 4.0, 5.0}); // addPossibleKeys( vector <double> ( { 1.0, 2.0, 3.0, 4.0, 5.0})); template <typename T, typename TCount> bool FreqType <T, TCount> :: addPossibleKeys( const std::vector <T> &vec) { bool ret = true; for ( const T &v : vec){ bool b = addPossibleKey( v); if ( b == false){ ret = false; } } return ret; } // increment the count for the key "v" template <typename T, typename TCount> void FreqType <T, TCount> :: increment( const T &v) { bool exist = false; for ( auto &pair : freqmap){ if ( areEqual( pair.first, v) == true){ ( pair.second)++; exist = true; break; } } if ( exist == false){ freqmap.insert( { v, 1}); } sumcount++; } template <typename T, typename TCount> void FreqType <T, TCount> :: addCount( const T &key, const TCount &count) { bool exist = false; for ( auto &pair : freqmap){ if ( areEqual( pair.first, key) == true){ pair.second += count; exist = true; break; } } if ( exist == false){ freqmap.insert( { key, count}); } sumcount += count; } template <typename T, typename TCount> void FreqType <T, TCount> :: addFreqType( const FreqType <T, TCount> &freqobj) { for ( const auto &pair : freqobj.freqmap){ addCount( pair.first, pair.second); } } // Clears counts into zeros. // Possible keys and setting for equality judgement are retained. template <typename T, typename TCount> void FreqType <T, TCount> :: clearCount( void) { for ( auto &pair : freqmap){ ( pair.second) = static_cast<TCount>( 0); } sumcount = static_cast<TCount>( 0); } template <typename T, typename TCount> TCount FreqType <T, TCount> :: getSumCount( void) const { return sumcount; } // returns vectors of keys and frequency counts template <typename T, typename TCount> void FreqType <T, TCount> :: getVectors( std::vector <T> &keyvec, std::vector <TCount> &frevec) const { keyvec.resize( freqmap.size()); frevec.resize( freqmap.size()); int i = 0; for ( const auto &pair : freqmap){ keyvec[ i] = pair.first; frevec[ i] = pair.second; i++; } } template <typename T, typename TCount> double FreqType <T, TCount> :: meanFromFreq( void) const { // if sumcount == 0, then return NaN if ( sumcount == static_cast<TCount>( 0)){ alert( "FreqType :: meanFromFreq()"); return numeric_limits<double>::signaling_NaN(); } double sumval = 0.0; for ( const auto &pair : freqmap){ sumval += static_cast<double>( pair.first) * static_cast<double>( pair.second); } return ( sumval / static_cast<double>( sumcount)); } template <typename T, typename TCount> double FreqType <T, TCount> :: medianFromFreq( void) const { // we are using class "map" because it stores data sorted by key // if sumcount == 0, then return NaN if ( sumcount == static_cast<TCount>( 0)){ alert( "FreqType :: medianFromFreq()"); return numeric_limits<double>::signaling_NaN(); } TCount half; half = static_cast<TCount>( floor( static_cast<double>( sumcount) / 2.0)); bool even = false; if ( half * 2 == sumcount){ even = true; } TCount cumcount = 0; double ret1; bool waitfornext = false; int i = 0; // in class "map" data are sorted by the key for ( const auto &pair : freqmap){ cumcount += pair.second; if ( waitfornext == true){ if ( pair.second > static_cast<TCount>( 0)){ // 頻度総計が偶数で、「累積頻度50%」が2値の間になっており、 // 大きい方を待っていた状態のとき return ( ( ret1 + ( double)pair.first) / 2.0); } } else { if ( even == true){ if ( cumcount > half){ return static_cast<double>( pair.first); } else if ( cumcount == half){ ret1 = static_cast<double>( pair.first); waitfornext = true; } } else { if ( cumcount > half){ return static_cast<double>( pair.first); } } } } alert( "FreqType :: medianFromFreq()"); return numeric_limits<double>::signaling_NaN(); } template <typename T, typename TCount> void FreqType <T, TCount> :: modeFromFreq( std::vector <T> &ret) const { // if sumcount == 0, then return a vector of size 0 if ( sumcount == static_cast<TCount>( 0)){ alert( "FreqType :: modeFromFreq()"); ret.clear(); return; } std::vector <T> keyvec; std::vector <TCount> frevec; getVectors( keyvec, frevec); std::vector <int> idmax; getIndexOfMax( idmax, frevec); ret.clear(); for ( const auto &id : idmax){ ret.push_back( keyvec[ id]); } } // Note that rt0 should be of RecodeTable <double, T> template <typename T, typename TCount> void FreqType <T, TCount> :: setFreqFromRecodeTable( const std::vector <double> &vec0, const RecodeTable <double, T> &rt0) { clear(); rtablep.reset( new RecodeTable<double, T>( rt0)); std::vector <T> codeVec = rtablep->getPossibleCodeVec(); addPossibleKeys( codeVec); for ( auto v : vec0){ if ( std::isnan( v)){ // do nothing } else { T codeToAdd = rtablep->getCodeForValue( v); increment( codeToAdd); } } } // 本来は、Datasetに入れて表示したいが、また今度。 template <typename T, typename TCount> void FreqType <T, TCount> :: printPadding( std::ostream &os) const { using namespace std; vector < vector <string> > strcols; vector <int> width; int ncol; if ( freqmap.size() < 1){ alert( "FreqType :: printPadding()"); } // preparation ncol = 2; if ( bool( rtablep) == true){ // we will add range label column ncol = 3; } strcols.resize( ncol); for ( auto &col : strcols){ col.reserve( freqmap.size() + 1); } { int j = 0; strcols[ j].push_back( "Code"); j++; if ( bool( rtablep) == true){ strcols[ j].push_back( "Label"); j++; } strcols[ j].push_back( "Freq"); } for ( auto pair : freqmap){ const T &key = pair.first; const TCount &fre = pair.second; int j_col = 0; // Code strcols[ j_col].push_back( toString( key)); j_col++; // Range Label (optional) if ( bool( rtablep) == true){ string labelstr = rtablep->getRangeLabelForCode( pair.first); strcols[ j_col].push_back( labelstr); j_col++; } // Freq strcols[ j_col].push_back( toString( fre)); } width.resize( strcols.size()); for ( int i = 0; i < strcols.size(); i++){ int w0 = 0; for ( const auto &s : strcols[ i]){ if ( w0 < s.size()){ w0 = s.size(); } } width[ i] = w0; } // display os << setfill( ' '); for ( int i_row = 0; i_row < strcols[ 0].size(); i_row++){ for ( int j_col = 0; j_col < strcols.size(); j_col++){ os << setw( width[ j_col]); os << strcols[ j_col][ i_row]; os << " "; } os << endl; } } // 各階級の左端と右端のVectorを得る。 // RecodeTypeがない場合には空のVectorが返る。 // Note that obtained vectors should be // parallel to those obtained by getVectors() above // これも、上記のprintPadding()と同様に、 // 本来はDatasetに入れて処理したいが、また今度。 template <typename T, typename TCount> void FreqType <T, TCount> :: getRangeVectors( std::vector <double> &lvec, std::vector <double> &rvec) const { lvec.clear(); rvec.clear(); if ( bool( rtablep) == false){ return; } lvec.reserve( freqmap.size()); rvec.reserve( freqmap.size()); for ( const auto &pair : freqmap){ const T &key = pair.first; double left, right; rtablep->getLeftRightForCode( left, right, key); lvec.push_back( left); rvec.push_back( right); } } /* ---------- class RecodeTable ---------- */ // 自動で階級を作成する。 // Nから階級の数を設定する。Stataの方式で。 // 最小値と最大値の幅を出して、そこから階級幅を出す。 // 各階級は、左端点を含み、右端点を含まない。 // 有効ケース数が1未満のとき、エラー。 // 有効ケース数が1のとき、階級数は1。 // 最大値と最小値の差がゼロの場合、次のように最大・最小を修正。 //  値がゼロなら、最小値を-1に、最大値を1にする。 //  値が正なら、最小値を0に、最大値をそのままにする。 //  値が負なら、最大値を0に、最小値をそのままにする。 template <typename TOrigin, typename TCode> void RecodeTable <TOrigin, TCode> :: setAutoTableFromContVar( const std::vector <TOrigin> &var0) { codes.clear(); std::vector <TOrigin> vec = omitNan( var0); int nobs = vec.size(); if ( nobs < 1){ alert( "RecodeTable :: setAutoTableFromContVar()"); return; } std::sort( vec.begin(), vec.end()); TOrigin truemin = vec.front(); TOrigin truemax = vec.back(); // This way to determine the number of classes is // from Stata's histogram command. long double log10n = log10( nobs); int nclasses = std::round( std::min( ( long double)( std::sqrt( nobs)), 10.0 * log10n)); if ( nclasses < 1){ // This will occur when nobs==1 nclasses = 1; } // Manipulation for the case where width is zero if ( ( long double)truemax - ( long double)truemin <= 0.0){ nclasses = 1; if ( ( long double)truemin == 0.0){ truemin = static_cast<TOrigin>( -1.0); truemax = static_cast<TOrigin>( 1.0); } else { if ( truemin > 0){ truemin = static_cast<TOrigin>( 0.0); } else { truemax = static_cast<TOrigin>( 0.0); } } } // Adjustment to make sure all cases would fall inside one of ranges, // even if rounding errors occur // adjmin and adjmax are rounded into values with 3-digits accuracy TOrigin truewidth = static_cast<TOrigin>( ( ( long double)truemax - (long double)truemin) / ( long double)nclasses ); int log10truewidth = std::floor( log10( truewidth)); long double base = std::pow( 10.0, log10truewidth - 3); long double adjmin = std::floor( ( long double)truemin / base - 0.5) * base; long double adjmax = std::ceil( ( long double)truemax / base + 0.5) * base; long double adjwidth = ( adjmax - adjmin) / ( long double)nclasses; for ( int i = 0; i < nclasses; i++){ TOrigin left = adjmin + adjwidth * ( long double)i; TOrigin right = adjmin + adjwidth * ( long double)( i + 1); CodeType ct = CodeType ( left, true, right, false, i + 1 ); codes.push_back( ct); } toDoForElse = ElseType :: AssignValue; codeForElse = std::numeric_limits<TCode>::quiet_NaN(); } // codeになりうる値のvectorを返す。 // ソートして返す。 // ただし、Elseの場合のcodeは含めない。 template <typename TOrigin, typename TCode> std::vector <TCode> RecodeTable <TOrigin, TCode> :: getPossibleCodeVec( void) const { std::vector <TCode> ret; ret.clear(); for ( auto c : codes){ ret.push_back( c.codeAssigned); } std::sort( ret.begin(), ret.end()); return ret; } // vに対応するコードを返す。 template <typename TOrigin, typename TCode> TCode RecodeTable <TOrigin, TCode> :: getCodeForValue( TOrigin v) const { for ( auto c : codes){ if ( c.correspond( v) == true){ return c.codeAssigned; } } TCode ret; switch( toDoForElse){ case ElseType :: Copy: ret = v; break; case ElseType :: AssignValue: ret = codeForElse; break; } return ret; } // code0に対応するleftとrightを返す。 // code0に対応する範囲が登録されていなければ、nanを返す。 template <typename TOrigin, typename TCode> void RecodeTable <TOrigin, TCode> :: getLeftRightForCode( TOrigin &lret, TOrigin &rret, TCode code0) const { for ( const auto &c : codes){ if ( c.codeAssigned == code0){ lret = c.left; rret = c.right; return; } } lret = std::numeric_limits<TOrigin>::quiet_NaN(); rret = std::numeric_limits<TOrigin>::quiet_NaN(); } // code0に対応するラベルを返す。 // code0に対応する範囲が登録されていなければ、空のstringを返す。 template <typename TOrigin, typename TCode> std::string RecodeTable <TOrigin, TCode> :: getRangeLabelForCode( TCode code0) const { for ( const auto &c : codes){ if ( c.codeAssigned == code0){ return c.getRangeLabel(); } } return string( ""); } // ストリームに出力する。 // スペースでパディングはしない。sepで区切る。 template <typename TOrigin, typename TCode> void RecodeTable <TOrigin, TCode> :: print( ostream &os, string sep // = ","s ) const { os << "Code" << sep << "Range" << std::endl; for ( auto c : codes){ os << c.codeAssigned; os << sep; os << c.getRangeLabel(); os << endl; } } #endif /* kstat_cpp_include_guard */
4a77da265bfb8250bf57d7ff2ba2d78b3a861261
51d0bd0807ccd97f2510adbbf54328543d77fe4f
/hackerrank_datastructure/1 arrays ds E10.cpp
8d35d81d5c52269df5da3a65fd5b61c966fd78ee
[]
no_license
dhineshmuthukaruppan/my_solution__competitive_programming
3de42cbe5757831771bc391ca29ce318f432ac78
7895cd0a13cb1b41aa590e2c27f17d79ae471811
refs/heads/master
2023-02-13T20:31:08.048510
2021-01-13T15:30:15
2021-01-13T15:30:15
246,559,806
0
0
null
null
null
null
UTF-8
C++
false
false
1,827
cpp
#include <bits/stdc++.h> #include <vector> #include <algorithm> using namespace std; vector<string> split_string(string); // Complete the reverseArray function below. vector<int> reverseArray(vector<int> a) { // vector<int>::reverse_iterator it = a.rbegin(); // while(it!= a.rend()){ // cout << *it << " "; // } reverse(a.begin(), a.end()); return a; } int main() { ofstream fout(getenv("OUTPUT_PATH")); int arr_count; cin >> arr_count; cin.ignore(numeric_limits<streamsize>::max(), '\n'); string arr_temp_temp; getline(cin, arr_temp_temp); vector<string> arr_temp = split_string(arr_temp_temp); vector<int> arr(arr_count); for (int i = 0; i < arr_count; i++) { int arr_item = stoi(arr_temp[i]); arr[i] = arr_item; } vector<int> res = reverseArray(arr); for (int i = 0; i < res.size(); i++) { fout << res[i]; if (i != res.size() - 1) { fout << " "; } } fout << "\n"; fout.close(); return 0; } vector<string> split_string(string input_string) { string::iterator new_end = unique(input_string.begin(), input_string.end(), [] (const char &x, const char &y) { return x == y and x == ' '; }); input_string.erase(new_end, input_string.end()); while (input_string[input_string.length() - 1] == ' ') { input_string.pop_back(); } vector<string> splits; char delimiter = ' '; size_t i = 0; size_t pos = input_string.find(delimiter); while (pos != string::npos) { splits.push_back(input_string.substr(i, pos - i)); i = pos + 1; pos = input_string.find(delimiter, i); } splits.push_back(input_string.substr(i, min(pos, input_string.length()) - i + 1)); return splits; }
b08437a06ba832bf6333ca37c912e30301e14548
48591e6fe907d1d1c15ea671db3ab32b6d60f5a6
/opengl playground/matrixProjection/matrixProjection/src/ViewFormGL.h
cc75f40712bd693d8ff9d68bc41b90e3c211aa98
[]
no_license
dizuo/dizuo
17a2da81c0ad39d77e904012cb9fbb8f6681df1b
6083ca9969d9d45b72859d9795544ccdf2d13b1c
refs/heads/master
2021-10-24T21:16:19.910030
2021-10-23T07:17:30
2021-10-23T07:17:30
1,253,554
7
5
null
null
null
null
UTF-8
C++
false
false
1,741
h
/////////////////////////////////////////////////////////////////////////////// // ViewFormGL.h // ============ // View component of OpenGL dialog window // // AUTHORL Song Ho Ahn ([email protected]) // CREATED: 2008-10-02 // UPDATED: 2008-10-07 /////////////////////////////////////////////////////////////////////////////// #ifndef VIEW_FORM_GL_H #define VIEW_FORM_GL_H #include <windows.h> #include "Controls.h" #include "ModelGL.h" namespace Win { class ViewFormGL { public: ViewFormGL(ModelGL* model); ~ViewFormGL(); void initControls(HWND handle); // init all controls int changeUpDownPosition(HWND handle, int position); void setProjection(float l, float r, float b, float t, float n, float f); void updateProjectionMatrix(); protected: private: ModelGL* model; HWND parentHandle; // controls Win::RadioButton radioOrthographic; Win::RadioButton radioPerspective; Win::RadioButton radioFill; Win::RadioButton radioLine; Win::RadioButton radioPoint; Win::Button buttonReset; Win::EditBox editLeft; Win::EditBox editRight; Win::EditBox editBottom; Win::EditBox editTop; Win::EditBox editNear; Win::EditBox editFar; Win::UpDownBox spinLeft; Win::UpDownBox spinRight; Win::UpDownBox spinBottom; Win::UpDownBox spinTop; Win::UpDownBox spinNear; Win::UpDownBox spinFar; Win::TextBox textGL; Win::TextBox m[16]; // projection matrix }; } #endif
[ "ren.yafee@107d8d70-eac7-11de-9d05-050bbbc75a16" ]
ren.yafee@107d8d70-eac7-11de-9d05-050bbbc75a16
755b3eec1ade6bf00217c27015a236617b39fd78
c02f95258cb24b43fc2491317449dd4e303aa8c1
/main.cpp
23a0a71b2bf91e69bc8b5eb83872d80997b834eb
[]
no_license
jamd10/P3Lab1_JesusMeraz
7678d76f3b3bbf8d8a8c4839a6ef9dceaabb7cd9
decc9e3fd8d96fdca10d67b272f65f441c1839f6
refs/heads/master
2023-06-25T00:47:30.157755
2021-07-23T20:48:41
2021-07-23T20:48:41
388,908,843
1
0
null
null
null
null
UTF-8
C++
false
false
1,164
cpp
#include <iostream> #include <math.h> using namespace std; int menu(); void ejercicio1(); void ejercicio2(); int main(int argc, char** argv) { int op = menu(); while(op != 3){ switch(op){ case 1:{ ejercicio1(); break; } case 2:{ ejercicio2(); break; } default: { cout<<"Opcion invalida"<< endl; menu(); break; } } op = menu(); } return 0; } int menu(){ int opcion = 0; cout<<"********** Menu **********"<<endl; cout<<"* 1. Ejercicio 1 *"<<endl; cout<<"* 2. Ejercicio 2 *"<<endl; cout<<"* 3. Salir *"<<endl; cout<<"**************************"<<endl; cout<<"Elija una opcion: "<<endl; cin>> opcion; return opcion; } void ejercicio1(){ int n = 0; double total = 0; cout<<"Ingrese n: "<<endl; cin>>n; while(n < 1){ cout<<"Ingrese n: "<<endl; cin>>n; } for(int i = 1; i <= n; i++){ double nom = 2.0 * i - 1.0; double denom = i * (i + 1.0); total += nom/denom; } cout<<"Resultado = "<< total<<endl; } void ejercicio2(){ int x = 0; cout<<"Ingrese x: "<<endl; cin>>x; double total = 1.0 / (1 + exp(x)); cout<<"Resultado = "<< total<<endl; }
a5cc2b36c2e826be1728054a8b6ffab38a6b2fc8
6e47e4637a3f7245714f241fd74883f79af3afb8
/Secro/Secro/source/secro/framework/detail/VirtualObjectPool.h
9741402fb73b564f570cd64136289b887087073f
[]
no_license
LagMeester4000/secro
c359d5113236e4967288b5582a76b603f16506d5
0896ce8e86af66207a5724fe1af7e09c9538910c
refs/heads/master
2020-04-19T07:36:43.849720
2020-01-24T11:45:18
2020-01-24T11:45:18
168,052,698
2
0
null
null
null
null
UTF-8
C++
false
false
6,009
h
#pragma once #include <new> #include <utility> #include <stdint.h> #include <assert.h> namespace secro { template<typename Base, typename T> void copyFunc(const Base& toCopy, void* memPos) { new(memPos) T((const T&)toCopy); } template<typename Base, typename T> void moveFunc(Base&& toCopy, void* memPos) { new(memPos) T(std::move((T&&)toCopy)); } //memory pool that holds objects from a virtual base class //restrictions for the classes stored in this template<typename T> class VirtualObjectPool { public: using BaseClass = T; struct MetaElement { //relative pointer (from objectMemory) to an element //if nullptr, element is destroyed BaseClass* element = nullptr; //current generation of this object //if new object is created in this slot, generation goes up by 1 //used to check if handle is valid uint32_t generation = 0; //functions used to copy and move memory of the object void(*copy)(const BaseClass&, void*); void(*move)(BaseClass&&, void*); }; struct FreeSpaceHeader { //size of the current memory block, including the size of the header size_t size = 0; //distance in bytes to the next free space size_t next = 0; }; struct Handle { uint32_t index = 0; //might change to size_t uint32_t generation = UINT32_MAX; }; public: VirtualObjectPool(size_t sizeOfMemory, size_t amountOfElements); ~VirtualObjectPool(); VirtualObjectPool(const VirtualObjectPool<T>& other); VirtualObjectPool<T>& operator=(const VirtualObjectPool<T>& other); VirtualObjectPool(VirtualObjectPool<T>&& other); VirtualObjectPool<T>& operator=(VirtualObjectPool<T>&& other); //add an object to the pool template<typename U> Handle add(); //remove an object from the pool void remove(const Handle& handle); //returns nullptr if handle is invalid template<typename U> U* get(const Handle& handle); private: //allocate the memory for the pool void allocateMemory(size_t memorySize); //initialize the memory and setup the pointers void initMemory(size_t memorySize, size_t elementSize); //defragment the object pool void defragment(); private: std::pair<FreeSpaceHeader*, size_t> findFreeMemory(size_t neededSize, FreeSpaceHeader* listElement); void* allocateObjectMemory(size_t neededSize); private: //memory pool uint8_t* memory = nullptr; size_t memorySize = 0; //meta element list (part of memory array) MetaElement* metaElements = nullptr; size_t metaElementsSize = 0; //object memory uint8_t* objectMemory = nullptr; size_t objectMemorySize = 0; //free space linked list FreeSpaceHeader* freeSpaceList = nullptr; }; template<typename T> inline VirtualObjectPool<T>::VirtualObjectPool(size_t sizeOfMemory, size_t amountOfElements) { initMemory(sizeOfMemory, amountOfElements); } template<typename T> inline VirtualObjectPool<T>::~VirtualObjectPool() { //if pointer is valid, destroy memory if (memory) { ::operator delete((void*)memory); } } template<typename T> inline VirtualObjectPool<T>::VirtualObjectPool(const VirtualObjectPool<T>& other) { } template<typename T> inline VirtualObjectPool<T>& VirtualObjectPool<T>::operator=(const VirtualObjectPool<T>& other) { // TODO: insert return statement here } template<typename T> inline VirtualObjectPool<T>::VirtualObjectPool(VirtualObjectPool<T>&& other) { } template<typename T> inline VirtualObjectPool<T>& VirtualObjectPool<T>::operator=(VirtualObjectPool<T>&& other) { // TODO: insert return statement here } template<typename T> inline void VirtualObjectPool<T>::remove(const Handle & handle) { } template<typename T> inline void VirtualObjectPool<T>::allocateMemory(size_t memorySize) { //make sure memory is not created assert(!memory); //allocate memory = (uint8_t*)::operator new(memorySize); this->memorySize = memorySize; } template<typename T> inline void VirtualObjectPool<T>::initMemory(size_t memorySize, size_t elementSize) { allocateMemory(memorySize); //meta elements at position 0 metaElements = (MetaElement*)memory; metaElementsSize = elementSize; //set all data to 0 std::memset((void*)metaElements, 0, elementSize * sizeof(MetaElement)); //objects after meta elements objectMemory = (uint8_t*)metaElements + metaElementsSize; objectMemorySize = memorySize - metaElementsSize * sizeof(MetaElement); //initialize free object list at the start of object memory freeSpaceList = (FreeSpaceHeader*)objectMemory; freeSpaceList->next = 0; freeSpaceList->size = objectMemorySize; } template<typename T> inline void VirtualObjectPool<T>::defragment() { //TODO } template<typename T> inline std::pair<typename VirtualObjectPool<T>::FreeSpaceHeader*, size_t> VirtualObjectPool<T>::findFreeMemory(size_t neededSize, FreeSpaceHeader * listElement) { //if (listElement->size >= neededSize) //{ // return { listElement, 0 }; //} //else //{ // FreeSpaceHeader* next = (FreeSpaceHeader*)(objectMemory + listElement->next); // auto toReturn = findFreeMemory(neededSize, next); // if (toReturn.first == next) // { // //update this lists next value and possibly make a new node // // listElement->next = next->next; // // //check if next element // // listElement->size += next->size // } //} // //return nullptr; return nullptr; } template<typename T> inline void * VirtualObjectPool<T>::allocateObjectMemory(size_t neededSize) { FreeSpaceHeader* prev = nullptr; FreeSpaceHeader* it = freeSpaceList; while (it) { prev = it; if (it->next) it = (FreeSpaceHeader*)(objectMemory + it->next); else it = nullptr; } return nullptr; } template<typename T> template<typename U> inline VirtualObjectPool<T>::Handle VirtualObjectPool<T>::add() { return Handle(); } template<typename T> template<typename U> inline U * VirtualObjectPool<T>::get(const Handle & handle) { return nullptr; } }
0cd04c18645668c3197ce0c2de336d369cf5c4f1
d42357b2d4c6ec2236a89211c8fc394840de3fd7
/src/leveldb/port/atomic_pointer.h
41c32d4de9a7559f9d1de977af02b3e9f30eaba8
[ "LicenseRef-scancode-generic-cla", "BSD-3-Clause", "MIT" ]
permissive
boxycoin/boxycore
dcaf9fab447e8261fe883782dd88ea069c22365d
09c4c62bef170db804fffd482b5f5dad7f432b65
refs/heads/main
2023-08-22T20:33:00.031913
2021-09-19T22:41:41
2021-09-19T22:41:41
403,459,902
0
0
null
null
null
null
UTF-8
C++
false
false
7,266
h
// Copyright (c) 2011 The LevelDB Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. // AtomicPointer provides storage for a lock-free pointer. // Platform-dependent implementation of AtomicPointer: // - If the platform provides a cheap barrier, we use it with raw pointers // - If <atomic> is present (on newer versions of gcc, it is), we use // a <atomic>-based AtomicPointer. However we prefer the memory // barrier based version, because at least on a gcc 4.4 32-bit build // on linux, we have encountered a buggy <atomic> implementation. // Also, some <atomic> implementations are much slower than a memory-barrier // based implementation (~16ns for <atomic> based acquire-load vs. ~1ns for // a barrier based acquire-load). // This code is based on atomicops-internals-* in Google's perftools: // http://code.google.com/p/google-perftools/source/browse/#svn%2Ftrunk%2Fsrc%2Fbase #ifndef PORT_ATOMIC_POINTER_H_ #define PORT_ATOMIC_POINTER_H_ #include <stdint.h> #ifdef LEVELDB_ATOMIC_PRESENT #include <atomic> #endif #ifdef OS_WIN #include <windows.h> #endif #ifdef OS_MACOSX #include <libkern/OSAtomic.h> #endif #if defined(_M_X64) || defined(__x86_64__) #define ARCH_BOXY_X86_FAMILY 1 #elif defined(_M_IX86) || defined(__i386__) || defined(__i386) #define ARCH_BOXY_X86_FAMILY 1 #elif defined(__ARMEL__) #define ARCH_BOXY_ARM_FAMILY 1 #elif defined(__aarch64__) #define ARCH_BOXY_ARM64_FAMILY 1 #elif defined(__ppc__) || defined(__powerpc__) || defined(__powerpc64__) #define ARCH_BOXY_PPC_FAMILY 1 #elif defined(__mips__) #define ARCH_BOXY_MIPS_FAMILY 1 #endif namespace leveldb { namespace port { // AtomicPointer based on <cstdatomic> if available #if defined(LEVELDB_ATOMIC_PRESENT) class AtomicPointer { private: std::atomic<void*> rep_; public: AtomicPointer() { } explicit AtomicPointer(void* v) : rep_(v) { } inline void* Acquire_Load() const { return rep_.load(std::memory_order_acquire); } inline void Release_Store(void* v) { rep_.store(v, std::memory_order_release); } inline void* NoBarrier_Load() const { return rep_.load(std::memory_order_relaxed); } inline void NoBarrier_Store(void* v) { rep_.store(v, std::memory_order_relaxed); } }; #else // Define MemoryBarrier() if available // Windows on x86 #if defined(OS_WIN) && defined(COMPILER_MSVC) && defined(ARCH_BOXY_X86_FAMILY) // windows.h already provides a MemoryBarrier(void) macro // http://msdn.microsoft.com/en-us/library/ms684208(v=vs.85).aspx #define LEVELDB_HAVE_MEMORY_BARRIER // Mac OS #elif defined(OS_MACOSX) inline void MemoryBarrier() { OSMemoryBarrier(); } #define LEVELDB_HAVE_MEMORY_BARRIER // Gcc on x86 #elif defined(ARCH_BOXY_X86_FAMILY) && defined(__GNUC__) inline void MemoryBarrier() { // See http://gcc.gnu.org/ml/gcc/2003-04/msg01180.html for a discussion on // this idiom. Also see http://en.wikipedia.org/wiki/Memory_ordering. __asm__ __volatile__("" : : : "memory"); } #define LEVELDB_HAVE_MEMORY_BARRIER // Sun Studio #elif defined(ARCH_BOXY_X86_FAMILY) && defined(__SUNPRO_CC) inline void MemoryBarrier() { // See http://gcc.gnu.org/ml/gcc/2003-04/msg01180.html for a discussion on // this idiom. Also see http://en.wikipedia.org/wiki/Memory_ordering. asm volatile("" : : : "memory"); } #define LEVELDB_HAVE_MEMORY_BARRIER // ARM Linux #elif defined(ARCH_BOXY_ARM_FAMILY) && defined(__linux__) typedef void (*LinuxKernelMemoryBarrierFunc)(void); // The Linux ARM kernel provides a highly optimized device-specific memory // barrier function at a fixed memory address that is mapped in every // user-level process. // // This beats using BOXY-specific instructions which are, on single-core // devices, un-necessary and very costly (e.g. ARMv7-A "dmb" takes more // than 180ns on a Cortex-A8 like the one on a Nexus One). Benchmarking // shows that the extra function call cost is completely negligible on // multi-core devices. // inline void MemoryBarrier() { (*(LinuxKernelMemoryBarrierFunc)0xffff0fa0)(); } #define LEVELDB_HAVE_MEMORY_BARRIER // ARM64 #elif defined(ARCH_BOXY_ARM64_FAMILY) inline void MemoryBarrier() { asm volatile("dmb sy" : : : "memory"); } #define LEVELDB_HAVE_MEMORY_BARRIER // PPC #elif defined(ARCH_BOXY_PPC_FAMILY) && defined(__GNUC__) inline void MemoryBarrier() { // TODO for some powerpc expert: is there a cheaper suitable variant? // Perhaps by having separate barriers for acquire and release ops. asm volatile("sync" : : : "memory"); } #define LEVELDB_HAVE_MEMORY_BARRIER // MIPS #elif defined(ARCH_BOXY_MIPS_FAMILY) && defined(__GNUC__) inline void MemoryBarrier() { __asm__ __volatile__("sync" : : : "memory"); } #define LEVELDB_HAVE_MEMORY_BARRIER #endif // AtomicPointer built using platform-specific MemoryBarrier() #if defined(LEVELDB_HAVE_MEMORY_BARRIER) class AtomicPointer { private: void* rep_; public: AtomicPointer() { } explicit AtomicPointer(void* p) : rep_(p) {} inline void* NoBarrier_Load() const { return rep_; } inline void NoBarrier_Store(void* v) { rep_ = v; } inline void* Acquire_Load() const { void* result = rep_; MemoryBarrier(); return result; } inline void Release_Store(void* v) { MemoryBarrier(); rep_ = v; } }; // Atomic pointer based on sparc memory barriers #elif defined(__sparcv9) && defined(__GNUC__) class AtomicPointer { private: void* rep_; public: AtomicPointer() { } explicit AtomicPointer(void* v) : rep_(v) { } inline void* Acquire_Load() const { void* val; __asm__ __volatile__ ( "ldx [%[rep_]], %[val] \n\t" "membar #LoadLoad|#LoadStore \n\t" : [val] "=r" (val) : [rep_] "r" (&rep_) : "memory"); return val; } inline void Release_Store(void* v) { __asm__ __volatile__ ( "membar #LoadStore|#StoreStore \n\t" "stx %[v], [%[rep_]] \n\t" : : [rep_] "r" (&rep_), [v] "r" (v) : "memory"); } inline void* NoBarrier_Load() const { return rep_; } inline void NoBarrier_Store(void* v) { rep_ = v; } }; // Atomic pointer based on ia64 acq/rel #elif defined(__ia64) && defined(__GNUC__) class AtomicPointer { private: void* rep_; public: AtomicPointer() { } explicit AtomicPointer(void* v) : rep_(v) { } inline void* Acquire_Load() const { void* val ; __asm__ __volatile__ ( "ld8.acq %[val] = [%[rep_]] \n\t" : [val] "=r" (val) : [rep_] "r" (&rep_) : "memory" ); return val; } inline void Release_Store(void* v) { __asm__ __volatile__ ( "st8.rel [%[rep_]] = %[v] \n\t" : : [rep_] "r" (&rep_), [v] "r" (v) : "memory" ); } inline void* NoBarrier_Load() const { return rep_; } inline void NoBarrier_Store(void* v) { rep_ = v; } }; // We have neither MemoryBarrier(), nor <atomic> #else #error Please implement AtomicPointer for this platform. #endif #endif #undef LEVELDB_HAVE_MEMORY_BARRIER #undef ARCH_BOXY_X86_FAMILY #undef ARCH_BOXY_ARM_FAMILY #undef ARCH_BOXY_ARM64_FAMILY #undef ARCH_BOXY_PPC_FAMILY } // namespace port } // namespace leveldb #endif // PORT_ATOMIC_POINTER_H_
9781793719987028c904b778d293bed9d8c6751e
a0fc1c274ab8b126b866a295055a6ebcd263edd4
/libperfmgr/include/perfmgr/NodeLooperThread.h
b04d2a40676edfbab1f14ddc173a02799f70a16d
[]
no_license
SuperiorOS/android_system_extras
88627dced915ba595038f7b2bacecde73f87b614
25615a747ce345392661b32f86dc9bbb829805df
refs/heads/ten
2023-07-12T16:30:05.981897
2019-10-30T04:34:21
2019-10-30T04:34:21
149,216,797
0
1
null
2021-07-10T15:16:29
2018-09-18T02:26:13
HTML
UTF-8
C++
false
false
3,902
h
/* * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specic language governing permissions and * limitations under the License. */ #ifndef ANDROID_LIBPERFMGR_NODELOOPERTHREAD_H_ #define ANDROID_LIBPERFMGR_NODELOOPERTHREAD_H_ #include <cstddef> #include <memory> #include <string> #include <utility> #include <vector> #include <utils/Thread.h> #include "perfmgr/Node.h" namespace android { namespace perfmgr { // The NodeAction specifies the sysfs node, the value to be assigned, and the // timeout for this action: struct NodeAction { NodeAction(std::size_t node_index, std::size_t value_index, std::chrono::milliseconds timeout_ms) : node_index(node_index), value_index(value_index), timeout_ms(timeout_ms) {} std::size_t node_index; std::size_t value_index; std::chrono::milliseconds timeout_ms; // 0ms for forever }; // The NodeLooperThread is responsible for managing each of the sysfs nodes // specified in the configuration. At initialization, the NodeLooperThrea holds // a vector containing the nodes defined in the configuration. The NodeManager // gets powerhint requests and cancellations from the HintManager, maintains // state about the current set of powerhint requests on each sysfs node, and // decides how to apply the requests. The NodeLooperThread contains a ThreadLoop // to maintain the sysfs nodes, and that thread is woken up both to handle // powerhint requests and when the timeout expires for an in-progress powerhint. class NodeLooperThread : public ::android::Thread { public: explicit NodeLooperThread(std::vector<std::unique_ptr<Node>> nodes) : Thread(false), nodes_(std::move(nodes)) {} virtual ~NodeLooperThread() { Stop(); } // Need call Stop() as the threadloop will hold a strong pointer // itself and wait for Condition fired or timeout (60s) before // the out looper can call deconstructor to Stop() thread void Stop(); // Return true when successfully adds request from actions for the hint_type // in each individual node. Return false if any of the actions has either // invalid node index or value index. bool Request(const std::vector<NodeAction>& actions, const std::string& hint_type); // Return when successfully cancels request from actions for the hint_type // in each individual node. Return false if any of the actions has invalid // node index. bool Cancel(const std::vector<NodeAction>& actions, const std::string& hint_type); // Dump all nodes to fd void DumpToFd(int fd); private: NodeLooperThread(NodeLooperThread const&) = delete; void operator=(NodeLooperThread const&) = delete; bool threadLoop() override; void onFirstRef() override; static constexpr auto kMaxUpdatePeriod = std::chrono::milliseconds::max(); std::vector<std::unique_ptr<Node>> nodes_; // parsed from Config // conditional variable from C++ standard library can be affected by wall // time change as it is using CLOCK_REAL (b/35756266). The component should // not be impacted by wall time, thus need use Android specific Condition // class for waking up threadloop. ::android::Condition wake_cond_; // lock to protect nodes_ ::android::Mutex lock_; }; } // namespace perfmgr } // namespace android #endif // ANDROID_LIBPERFMGR_NODELOOPERTHREAD_H_
cf433c8d660a3851394b59a7dfebc1b79dc8a457
6d66ec6a8545c9e2d14a6a6967a08859f75e8a30
/v1/includes/Perceptron.hpp
d4549d4b81954c6cd4bf15157de7f40be6b7e4a6
[]
no_license
M4urici0GM/Perceptron
a1e4f3e221ec0e5d17e65461a02cc9296f315ef2
70ff53498e690354d467165cef7928e72d490c64
refs/heads/master
2022-11-29T23:28:19.811373
2020-08-01T20:15:38
2020-08-01T20:15:38
277,225,201
7
1
null
null
null
null
UTF-8
C++
false
false
930
hpp
// // Created by Mauricio on 7/5/2020. // #ifndef PERCEPTRON_PERCEPTRON_HPP #define PERCEPTRON_PERCEPTRON_HPP #include <vector> #include "Layer.hpp" class Perceptron { public: Perceptron(const std::vector<int> &topology); void initialize_network(); void train(int epochs, Matrix inputs,Matrix targets); void set_learning_rate(double learning_rate); void set_bias(std::vector<double> bias); void print_network(); std::vector<double> get_error_history(); Matrix predict(const std::vector<double> &inputs); private: std::vector<int> topology; std::vector<double> error_history; std::vector<double> targets; std::vector<double> bias; std::vector<std::vector<double>> inputs; std::vector<Layer*> layers; std::vector<Matrix*> weights_matrix; double learning_rate; double error_rate; }; #endif //PERCEPTRON_PERCEPTRON_HPP
6ccfe08d3d9745580273e18eeb0c9c16a30f1f17
64178ab5958c36c4582e69b6689359f169dc6f0d
/vscode/wg/sdk/UPlanarReflectionComponent.hpp
69fc0eba37c9f8db1f6b3b5d81d6d46abba0063e
[]
no_license
c-ber/cber
47bc1362f180c9e8f0638e40bf716d8ec582e074
3cb5c85abd8a6be09e0283d136c87761925072de
refs/heads/master
2023-06-07T20:07:44.813723
2023-02-28T07:43:29
2023-02-28T07:43:29
40,457,301
5
5
null
2023-05-30T19:14:51
2015-08-10T01:37:22
C++
UTF-8
C++
false
false
7,906
hpp
#pragma once #include "USceneCaptureComponent.hpp" #ifdef _MSC_VER #pragma pack(push, 1) #endif namespace PUBGSDK { struct alignas(1) UPlanarReflectionComponent // Size: 0x610 : public USceneCaptureComponent // Size: 0x510 { private: typedef UPlanarReflectionComponent t_struct; typedef ExternalPtr<t_struct> t_structHelper; public: static ExternalPtr<struct UClass> StaticClass() { static ExternalPtr<struct UClass> ptr; if(!ptr) ptr = UObject::FindClassFast(238); // id32("Class Engine.PlanarReflectionComponent") return ptr; } ExternalPtr<struct UBoxComponent> PreviewBox; /* Ofs: 0x510 Size: 0x8 - ObjectProperty Engine.PlanarReflectionComponent.PreviewBox */ float NormalDistortionStrength; /* Ofs: 0x518 Size: 0x4 - FloatProperty Engine.PlanarReflectionComponent.NormalDistortionStrength */ float PrefilterRoughness; /* Ofs: 0x51C Size: 0x4 - FloatProperty Engine.PlanarReflectionComponent.PrefilterRoughness */ float PrefilterRoughnessDistance; /* Ofs: 0x520 Size: 0x4 - FloatProperty Engine.PlanarReflectionComponent.PrefilterRoughnessDistance */ int32_t ScreenPercentage; /* Ofs: 0x524 Size: 0x4 - IntProperty Engine.PlanarReflectionComponent.ScreenPercentage */ float ExtraFOV; /* Ofs: 0x528 Size: 0x4 - FloatProperty Engine.PlanarReflectionComponent.ExtraFOV */ float DistanceFromPlaneFadeStart; /* Ofs: 0x52C Size: 0x4 - FloatProperty Engine.PlanarReflectionComponent.DistanceFromPlaneFadeStart */ float DistanceFromPlaneFadeEnd; /* Ofs: 0x530 Size: 0x4 - FloatProperty Engine.PlanarReflectionComponent.DistanceFromPlaneFadeEnd */ float DistanceFromPlaneFadeoutStart; /* Ofs: 0x534 Size: 0x4 - FloatProperty Engine.PlanarReflectionComponent.DistanceFromPlaneFadeoutStart */ float DistanceFromPlaneFadeoutEnd; /* Ofs: 0x538 Size: 0x4 - FloatProperty Engine.PlanarReflectionComponent.DistanceFromPlaneFadeoutEnd */ float AngleFromPlaneFadeStart; /* Ofs: 0x53C Size: 0x4 - FloatProperty Engine.PlanarReflectionComponent.AngleFromPlaneFadeStart */ float AngleFromPlaneFadeEnd; /* Ofs: 0x540 Size: 0x4 - FloatProperty Engine.PlanarReflectionComponent.AngleFromPlaneFadeEnd */ uint8_t boolField544; uint8_t UnknownData545[0xCB]; inline bool SetPreviewBox(t_structHelper inst, ExternalPtr<struct UBoxComponent> value) { inst.WriteOffset(0x510, value); } inline bool SetNormalDistortionStrength(t_structHelper inst, float value) { inst.WriteOffset(0x518, value); } inline bool SetPrefilterRoughness(t_structHelper inst, float value) { inst.WriteOffset(0x51C, value); } inline bool SetPrefilterRoughnessDistance(t_structHelper inst, float value) { inst.WriteOffset(0x520, value); } inline bool SetScreenPercentage(t_structHelper inst, int32_t value) { inst.WriteOffset(0x524, value); } inline bool SetExtraFOV(t_structHelper inst, float value) { inst.WriteOffset(0x528, value); } inline bool SetDistanceFromPlaneFadeStart(t_structHelper inst, float value) { inst.WriteOffset(0x52C, value); } inline bool SetDistanceFromPlaneFadeEnd(t_structHelper inst, float value) { inst.WriteOffset(0x530, value); } inline bool SetDistanceFromPlaneFadeoutStart(t_structHelper inst, float value) { inst.WriteOffset(0x534, value); } inline bool SetDistanceFromPlaneFadeoutEnd(t_structHelper inst, float value) { inst.WriteOffset(0x538, value); } inline bool SetAngleFromPlaneFadeStart(t_structHelper inst, float value) { inst.WriteOffset(0x53C, value); } inline bool SetAngleFromPlaneFadeEnd(t_structHelper inst, float value) { inst.WriteOffset(0x540, value); } inline bool bRenderSceneTwoSided() { return boolField544& 0x1; } inline bool SetbRenderSceneTwoSided(t_structHelper inst, bool value) { auto curVal = *reinterpret_cast<uint8_t*>(&value); inst.WriteOffset(0x544, (uint8_t)(value ? curVal | (uint8_t)1 : curVal & ~(uint8_t)1)); } }; #ifdef VALIDATE_SDK namespace Validation{ auto constexpr sizeofUPlanarReflectionComponent = sizeof(UPlanarReflectionComponent); // 1552 static_assert(sizeof(UPlanarReflectionComponent) == 0x610, "Size of UPlanarReflectionComponent is not correct."); auto constexpr UPlanarReflectionComponent_PreviewBox_Offset = offsetof(UPlanarReflectionComponent, PreviewBox); static_assert(UPlanarReflectionComponent_PreviewBox_Offset == 0x510, "UPlanarReflectionComponent::PreviewBox offset is not 510"); auto constexpr UPlanarReflectionComponent_NormalDistortionStrength_Offset = offsetof(UPlanarReflectionComponent, NormalDistortionStrength); static_assert(UPlanarReflectionComponent_NormalDistortionStrength_Offset == 0x518, "UPlanarReflectionComponent::NormalDistortionStrength offset is not 518"); auto constexpr UPlanarReflectionComponent_PrefilterRoughness_Offset = offsetof(UPlanarReflectionComponent, PrefilterRoughness); static_assert(UPlanarReflectionComponent_PrefilterRoughness_Offset == 0x51c, "UPlanarReflectionComponent::PrefilterRoughness offset is not 51c"); auto constexpr UPlanarReflectionComponent_PrefilterRoughnessDistance_Offset = offsetof(UPlanarReflectionComponent, PrefilterRoughnessDistance); static_assert(UPlanarReflectionComponent_PrefilterRoughnessDistance_Offset == 0x520, "UPlanarReflectionComponent::PrefilterRoughnessDistance offset is not 520"); auto constexpr UPlanarReflectionComponent_ScreenPercentage_Offset = offsetof(UPlanarReflectionComponent, ScreenPercentage); static_assert(UPlanarReflectionComponent_ScreenPercentage_Offset == 0x524, "UPlanarReflectionComponent::ScreenPercentage offset is not 524"); auto constexpr UPlanarReflectionComponent_ExtraFOV_Offset = offsetof(UPlanarReflectionComponent, ExtraFOV); static_assert(UPlanarReflectionComponent_ExtraFOV_Offset == 0x528, "UPlanarReflectionComponent::ExtraFOV offset is not 528"); auto constexpr UPlanarReflectionComponent_DistanceFromPlaneFadeStart_Offset = offsetof(UPlanarReflectionComponent, DistanceFromPlaneFadeStart); static_assert(UPlanarReflectionComponent_DistanceFromPlaneFadeStart_Offset == 0x52c, "UPlanarReflectionComponent::DistanceFromPlaneFadeStart offset is not 52c"); auto constexpr UPlanarReflectionComponent_DistanceFromPlaneFadeEnd_Offset = offsetof(UPlanarReflectionComponent, DistanceFromPlaneFadeEnd); static_assert(UPlanarReflectionComponent_DistanceFromPlaneFadeEnd_Offset == 0x530, "UPlanarReflectionComponent::DistanceFromPlaneFadeEnd offset is not 530"); auto constexpr UPlanarReflectionComponent_DistanceFromPlaneFadeoutStart_Offset = offsetof(UPlanarReflectionComponent, DistanceFromPlaneFadeoutStart); static_assert(UPlanarReflectionComponent_DistanceFromPlaneFadeoutStart_Offset == 0x534, "UPlanarReflectionComponent::DistanceFromPlaneFadeoutStart offset is not 534"); auto constexpr UPlanarReflectionComponent_DistanceFromPlaneFadeoutEnd_Offset = offsetof(UPlanarReflectionComponent, DistanceFromPlaneFadeoutEnd); static_assert(UPlanarReflectionComponent_DistanceFromPlaneFadeoutEnd_Offset == 0x538, "UPlanarReflectionComponent::DistanceFromPlaneFadeoutEnd offset is not 538"); auto constexpr UPlanarReflectionComponent_AngleFromPlaneFadeStart_Offset = offsetof(UPlanarReflectionComponent, AngleFromPlaneFadeStart); static_assert(UPlanarReflectionComponent_AngleFromPlaneFadeStart_Offset == 0x53c, "UPlanarReflectionComponent::AngleFromPlaneFadeStart offset is not 53c"); auto constexpr UPlanarReflectionComponent_AngleFromPlaneFadeEnd_Offset = offsetof(UPlanarReflectionComponent, AngleFromPlaneFadeEnd); static_assert(UPlanarReflectionComponent_AngleFromPlaneFadeEnd_Offset == 0x540, "UPlanarReflectionComponent::AngleFromPlaneFadeEnd offset is not 540"); auto constexpr UPlanarReflectionComponent_boolField544_Offset = offsetof(UPlanarReflectionComponent, boolField544); static_assert(UPlanarReflectionComponent_boolField544_Offset == 0x544, "UPlanarReflectionComponent::boolField544 offset is not 544"); } #endif } #ifdef _MSC_VER #pragma pack(pop) #endif
1e533bc6e02f70d3b1b78e32389ce86c0ff73047
b116e1d41f3665cc16f71bc63640e18b520ffdc8
/tetromino.hh
c49b0609f761b2b4cc62d53801d00f625d4f2527
[]
no_license
HammerCar/Tetris
d0ef8234796ba21a0e24ead382796b2b3ab0fa93
80a16950adadc82ab5d2ca799fd6b4ebe8c1099e
refs/heads/master
2022-11-21T14:28:14.757777
2020-07-15T17:54:50
2020-07-15T17:54:50
279,936,714
0
0
null
null
null
null
UTF-8
C++
false
false
944
hh
#ifndef TETROMINO_H #define TETROMINO_H #include <QColor> #include "point.hh" #include "tetromino_rotation_offsets.hh" class Engine; struct Block { Point position; QColor color; }; class Tetromino { public: Tetromino(Engine* engine = nullptr, const std::vector<Offset>& offsets_ = {}); Tetromino(const Tetromino& other); ~Tetromino(); std::vector<Block*> blocks_; bool move(const Point& direction); bool rotate(const bool& clockwise, const bool& shouldOffset = true); Tetromino& operator=(const Tetromino& other); private: Engine* engine_; int rotation_ = 0; std::vector<Offset> offsets_; void move_without_checking(const Point& direction); void rotate_block(Block* block, const Point& origin, const bool& clockwise); bool find_offset(const int& old_index); bool is_valid_position(); // Modulo operation that works for positive and negative values int mod(const int& x, const int& m); }; #endif // TETROMINO_H
a7e5acbad41153e7d8a146a93d9e22d7ffef5583
c7b85d3ccd1bc4ccf27e28ed0b2cead6803b03bf
/01.start-project/start/Source/start/startGameMode.h
0c1f8d0e9323248915200f2ceacc2ee1d9b912f4
[]
no_license
yhikishima/Unreal-Engine-dev
74035f37d50f72bcdc7031d3aa71dab5effe6a5a
1e69e9d44dd8e029df957ab597f4d9098f02e996
refs/heads/master
2022-03-08T17:52:31.161867
2019-11-23T16:39:53
2019-11-23T16:39:53
48,109,784
1
0
null
null
null
null
UTF-8
C++
false
false
270
h
// Fill out your copyright notice in the Description page of Project Settings. #pragma once #include "GameFramework/GameMode.h" #include "startGameMode.generated.h" /** * */ UCLASS() class START_API AstartGameMode : public AGameMode { GENERATED_BODY() };
7fa3973d93782079bc00a81218adb03739e82dfa
95876e6a55c2349153007ca2e548ddadc1bd8c09
/Introduction-to-Programming/Homework_Seminar_Unofficial.cpp
fa95b5840847a5e5dc38b97afec4eb6432b66609
[]
no_license
SimeonHristov99/FMI_Semester_1
d182914992f68780416ad9439aa187e5a3e738ed
c10ad609865dccd3288b34d0627e0740307921a0
refs/heads/master
2020-04-28T00:34:11.948922
2019-03-10T13:03:23
2019-03-10T13:03:23
174,820,557
0
0
null
null
null
null
UTF-8
C++
false
false
1,250
cpp
#include "pch.h" #include <iostream> using namespace std; const int MAX_SIZE = 100; void enterElements(int *arr) { cout << "Please Enter The Elements Of The Array (limit is " << MAX_SIZE << ") (to stop input enter 0):" << endl; for (int i = 0; arr[i] < MAX_SIZE; ++i) { cin >> arr[i]; if (arr[i] == 0) break; } } void outputArr(int *arr) { cout << "\nCurrent array:" << endl; for (int i = 0; arr[i] != 0; ++i) { cout << arr[i] << " "; } } bool isPrime(int &number) { if (number < 2) return false; for (int i = 2; i * i <= number; ++i) if (number % i == 0) return false; return true; } void outputPrimes(int *arr) { for (int i = 0; arr[i] != 0; ++i) if (isPrime(arr[i])) cout << arr[i] << " "; } void outputEvens(int *arr) { for (int i = 0; arr[i] != 0; ++i) if (arr[i] % 2 == 0) cout << arr[i] << " "; } int main() { //Task: Въведете масив. Изкарайте простите и четните числа. int arr[MAX_SIZE] = { -1 }; enterElements(arr); outputArr(arr); cout << "\n\nThe Prime Numbers Are:" << endl; outputPrimes(arr); cout << "\n\nThe Even Numbers Are:" << endl; outputEvens(arr); return 0; }
2d656467175b07040c60859adeefdadf0cef6d45
ceb020fee45a01645f0b2adc118483c6cf296226
/FindNumbersWithEvenNumberOfDigits.cpp
284e91af35a0b8e23ab2a163977f80951eb6a110
[]
no_license
anaypaul/LeetCode
6423c4ca1b0d147206c06ebb86c9e558a85077f2
667825d32df2499301184d486e3a674291c0ca0b
refs/heads/master
2021-09-28T06:05:21.256702
2020-10-12T04:01:46
2020-10-12T04:01:46
153,226,092
0
0
null
null
null
null
UTF-8
C++
false
false
608
cpp
class Solution { public: int count(int num){ int c = 0; while(num>0){ c++; num = num/10; } return c; } int findNumbers(vector<int>& nums) { int res = 0; for(auto x : nums){ if(count(x)%2==0){ res++; } } return res; } }; //Approach 2 : using count_if with a lambda expression. class Solution { public: int findNumbers(vector<int>& nums) { return count_if(nums.begin(), nums.end(), [](int x){ return ((int)log10(x) & 1); }); } };
7846c69e18319774bb034850345f230df27d2ed7
dd4cef03507b26115f55a19db13f909ab4a41731
/Mom.cpp
46eb593247f941c36037d06ec01b675dec80a219
[]
no_license
KrikorHerlopian1/MusicalChairs-
56c0bfaaf3fbee790802a35e923448f17a8d1b8d
86eb6ec01b5a8c6b71792aef26f9becd65b93b3f
refs/heads/main
2023-04-04T03:45:14.044288
2021-04-14T19:15:57
2021-04-14T19:15:57
319,845,391
0
0
null
null
null
null
UTF-8
C++
false
false
3,308
cpp
// // Mom.cpp // Program 5 // // Created by Krikor Herlopian and Ricardo Aliwalas on October 20, 2020. // Copyright © 2020 Krikor Herlopian. All rights reserved. // #include "Mom.hpp" #include <algorithm> Mom::Mom(int nKids) { m = Model(nKids-1); Kid* players[nKids]; for (int i=0; i<nKids; i++) { players[i] = new Kid(&m, i); } stillIn = nKids; // check if all threads created before starting. Model* model = &m; pthread_mutex_lock(&model->mx); for (;;) { if (model->threadsCreated >= stillIn) { break; } else { pthread_cond_wait(&model->cv2,&model->mx); } } pthread_mutex_unlock(&model->mx); for (int x=0; x<(nKids-1); x++) { PlayOneRound(&m,players); cout << "\nNUMBER OF PLAYERS Left:" << stillIn << endl; } if (stillIn == 1) { cout << "\nCongratulations Winner is Player: " << players[0]->getId() << " , GO HOME NOW!" << endl; pthread_kill(players[0]->getTid(), SIGQUIT); pthread_join(players[0]->getTid(), NULL); } } bool valueComp(Kid* const &a, Kid* const &b) { return a->getSeatNumber() < b->getSeatNumber(); } void Mom::PlayOneRound(Model* m, Kid* players[]){ cout << "\n--------------------------NEW ROUND---------------------------" << endl; for (int i=0; i<m->nChairs; i++) { m->chairs[i]=-1; } m->nMarching=0; for (int i=0; i<stillIn; i++) { players[i]->standUp(); } usleep(100000); pthread_mutex_lock(&m->mx); for (int i=0; i<stillIn; i++) { pthread_kill(players[i]->getTid(), SIGUSR1); } // wait for signal from kid for (;;) { if (m->nMarching == stillIn) { break; } else { pthread_cond_wait(&m->cv2,&m->mx); } } usleep(100000); m->nMarching = 0; for (int i=0; i<stillIn; i++) { pthread_kill(players[i]->getTid(), SIGUSR2); } usleep(100000); for (;;) { if (m->nMarching == stillIn) { break; } else { // wait for signal from the kid pthread_cond_wait(&m->cv,&m->mx); } } pthread_mutex_unlock(&m->mx); usleep(100000); int found = -1; cout << "Child " << "\t\tSITTING " << "\t\tseat" << endl; cout << "------------------------------------------------------------" << endl; //sort players by seat number std::sort(players, players + stillIn, valueComp); //print players on screen with their seat number. for (int i=0; i<stillIn; i++) { if (!players[i]->isSitting()) { found = i; cout << players[i]->getId() << "\t\t" << (players[i]->isSitting() ? "Yes" : "No" ) \ << "\t\t\t" << "KILLED " << players[i]->getSeatNumber() << endl; pthread_kill(players[i]->getTid(), SIGQUIT); pthread_join(players[i]->getTid(),NULL); } else { cout << players[i]->getId() << "\t\t"<<(players[i]->isSitting() ? "Yes" : "No" ) \ << "\t\t\t" << players[i]->getSeatNumber() << endl; } } swap(players[found],players[(stillIn-1)]); usleep(100000); m->nChairs--; m->chairs--; stillIn--; }
1a053e471ac7650eb5e28f5ae6682a2a934be651
399217c1a551fcc587ff1ade3bc9b822de2804d9
/BoostPart/ASIO/Syn/client/client.cpp
1f7105a619ed9ef491308d026d17914c92cd9940
[]
no_license
jiudianren/STLAndBoost
a6bb5801dd3eec5915e8c084520a034836aea4e5
d9d1b145bdc7f52e0f12159d533ae03072b90691
refs/heads/master
2021-06-29T22:07:37.987092
2019-04-23T02:05:58
2019-04-23T02:05:58
143,680,357
0
0
null
null
null
null
GB18030
C++
false
false
1,534
cpp
/* * client.cpp * * Created on: 2018年8月16日 * Author: Administrator */ #include <boost/thread.hpp> #include <boost/bind.hpp> #include <boost/asio.hpp> #include <boost/system/error_code.hpp> #include <boost/asio/ip/tcp.hpp> #include <string.h> #include <iostream> using namespace std; using namespace boost::asio; io_service service; size_t read_complete(char * buf, const error_code & err, size_t bytes) { if ( err) return 0; bool found = std::find(buf, buf + bytes, '\n') < buf + bytes; // 我们一个一个读取直到读到回车,不缓存 return found ? 0 : 1; } void sync_echo(std::string msg) { msg += "\n"; ip::tcp::socket sock(service); ip::tcp::endpoint ep( ip::address::from_string("127.0.0.1"),8001); sock.connect(ep); sock.write_some(buffer(msg)); char buf[1024]; int bytes = read(sock, buffer(buf), boost::bind(read_complete,buf,_1,_2)); std::string copy(buf, bytes - 1); msg = msg.substr(0, msg.size() - 1); std::cout << "server echoed our " << msg << ": "<< (copy == msg ? "OK" : "FAIL") << std::endl; sock.close(); } int main(int argc, char* argv[]) { char* messages[] = { "John says hi", "so does James", "Lucy just got home", "Boost.Asio is Fun!", 0 }; boost::thread_group threads; for ( char ** message = messages; *message; ++message) { threads.create_thread( boost::bind(sync_echo, *message)); boost::this_thread::sleep( boost::posix_time::millisec(100)); } threads.join_all(); }
aa8d99720ff3c940ae7f631b5f6d64e654d7597c
641fa8341d8c436ad24945bcbf8e7d7d1dd7dbb2
/chrome/browser/ui/search/instant_search_prerenderer.h
a33edc8b1ad56df8a0d020f5acf65c1654a83bcb
[ "BSD-3-Clause" ]
permissive
massnetwork/mass-browser
7de0dfc541cbac00ffa7308541394bac1e945b76
67526da9358734698c067b7775be491423884339
refs/heads/master
2022-12-07T09:01:31.027715
2017-01-19T14:29:18
2017-01-19T14:29:18
73,799,690
4
4
BSD-3-Clause
2022-11-26T11:53:23
2016-11-15T09:49:29
null
UTF-8
C++
false
false
3,581
h
// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_UI_SEARCH_INSTANT_SEARCH_PRERENDERER_H_ #define CHROME_BROWSER_UI_SEARCH_INSTANT_SEARCH_PRERENDERER_H_ #include <memory> #include "base/macros.h" #include "base/strings/string16.h" #include "chrome/common/search/instant_types.h" class GURL; class Profile; struct AutocompleteMatch; namespace chrome { struct NavigateParams; } namespace content { class SessionStorageNamespace; class WebContents; } namespace gfx { class Size; } namespace prerender { class PrerenderHandle; } // InstantSearchPrerenderer is responsible for prerendering the default search // provider Instant search base page URL to prefetch high-confidence search // suggestions. InstantSearchPrerenderer manages the prerender handle associated // with the prerendered contents. class InstantSearchPrerenderer { public: InstantSearchPrerenderer(Profile* profile, const GURL& prerender_url); ~InstantSearchPrerenderer(); // Returns the InstantSearchPrerenderer instance for the given |profile|. static InstantSearchPrerenderer* GetForProfile(Profile* profile); // Prerender the |prerender_url_| contents. |session_storage_namespace| is // used to identify the namespace of the active tab at the time the prerender // is generated. The |size| gives the initial size for the target // prerender. InstantSearchPrerenderer will run at most one prerender at a // time, so launching a prerender will cancel the previous prerenders (if // any). void Init(content::SessionStorageNamespace* session_storage_namespace, const gfx::Size& size); // Cancels the current request. void Cancel(); // Tells the Instant search base page to prerender |suggestion|. void Prerender(const InstantSuggestion& suggestion); // Tells the Instant search base page to render the search results for the // given |query|. void Commit(const base::string16& query, const EmbeddedSearchRequestParams& params); // Returns true if the prerendered page can be used to process the search for // the given |source|. bool CanCommitQuery(content::WebContents* source, const base::string16& query) const; // Returns true and updates |params->target_contents| if a prerendered page // exists for |url| and is swapped in. bool UsePrerenderedPage(const GURL& url, chrome::NavigateParams* params); const GURL& prerender_url() const { return prerender_url_; } // Returns the last prefetched search query. const base::string16& get_last_query() const { return last_instant_suggestion_.text; } // Returns true when prerendering is allowed for the given |source| and // |match|. bool IsAllowed(const AutocompleteMatch& match, content::WebContents* source) const; private: friend class InstantSearchPrerendererTest; content::WebContents* prerender_contents() const; // Returns true if the |query| matches the last prefetched search query or if // the 'reuse_instant_search_base_page' flag is enabled in the field trials. bool QueryMatchesPrefetch(const base::string16& query) const; Profile* const profile_; // Instant search base page URL. const GURL prerender_url_; std::unique_ptr<prerender::PrerenderHandle> prerender_handle_; InstantSuggestion last_instant_suggestion_; DISALLOW_COPY_AND_ASSIGN(InstantSearchPrerenderer); }; #endif // CHROME_BROWSER_UI_SEARCH_INSTANT_SEARCH_PRERENDERER_H_
e8fb19f538390ffa890ecc8fada1828f41a118da
0a96045a7a2a3a04ac7bd217967a56f39da868bf
/WikiAdventure/Source/WA-SDL/SDLStateShowPicture.cpp
e41905ab19c8adacadfb338fa0a1aa6e8cb76a62
[ "LicenseRef-scancode-public-domain" ]
permissive
Happy-Ferret/WikiAdventure
532b4687884c4029be30aef88e4d3ae53843ae3f
54fc76583f0779352d876038b5f1fb1dd67b82d0
refs/heads/master
2020-05-22T03:24:31.444239
2012-06-06T21:40:17
2012-06-06T21:40:17
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,261
cpp
#include "SDLStateShowPicture.h" #include "EngineMain.h" CSDLStateShowPicture::CSDLStateShowPicture( const string& sPicture, const string& sOnExitScript ) { DebugInfo( TypeCreate, "Creating picture box." ); m_sOnExitScript = sOnExitScript; m_pBackground = new CSDLBaseObject; m_pBackground->LoadImageFromFile( GetMediaPath( pEngine->GetGameDir(), sPicture ) ); SDL_Color stBlueish = { 100, 100, 255 }; SDL_Color stWhite = { 255, 255, 255 }; m_pButtonOkay = new CSDLCenterTextObject( "GameDefault", "Close", stBlueish, stWhite ); int iWidth = m_pBackground->GetWidth(); int iHeight = m_pBackground->GetHeight(); SetPosX( (800 / 2) - (iWidth / 2) ); SetPosY( (600 / 2) - ((iHeight + 10 + m_pButtonOkay->GetHeight()) / 2) ); m_pBackground->SetPos( GetPosX(), GetPosY() ); int iButtonTop = (m_iPosY + iHeight) + 5; if ( (iButtonTop + m_pButtonOkay->GetHeight()) > 600 ) iButtonTop = 600 - m_pButtonOkay->GetHeight() - 5; m_pButtonOkay->SetPos( GetPosX() + iWidth / 2, iButtonTop ); m_pButtonOkay->SetCallbackContainer( this ); m_stContainerRect = m_pBackground->GetRect(); m_stContainerRect.x -= 5; m_stContainerRect.y -= 5; m_stContainerRect.w += 10; m_stContainerRect.h = m_pButtonOkay->GetButtom() + 5 - m_stContainerRect.y; } CSDLStateShowPicture::~CSDLStateShowPicture() { DebugInfo( TypeDelete, "Deleting picture box." ); if ( m_pButtonOkay != 0 ) delete m_pButtonOkay; m_pButtonOkay = 0; if ( m_sOnExitScript.length() > 0 ) { pEngine->GetLuaScriptHandler()->DoLuaScript( m_sOnExitScript ); } } void CSDLStateShowPicture::MouseMoved( const int& iButton, const int& iX, const int& iY ) { m_pButtonOkay->MouseMoved( iButton, iX, iY ); } void CSDLStateShowPicture::MouseButtonDown( const int& iButton, const int& iX, const int& iY ) { m_pButtonOkay->MouseButtonDown( iButton, iX, iY ); } void CSDLStateShowPicture::Render(SDL_Surface* pDestSurface ) { //CSDLBaseState::Render( pDestSurface ); SDL_FillRect( pDestSurface, &m_stContainerRect, 0 ); m_pBackground->Render( pDestSurface ); m_pButtonOkay->Render( pDestSurface ); } void CSDLStateShowPicture::OnClicked( CSDLBaseObject* pObject, const int& iButton ) { if ( pObject == m_pButtonOkay ) { pEngine->GetStateHandler()->DelayedPopLayer(); } }
fcc4bfa314212168bb00a992ff1812e95717e926
8b369bd73a80feece74db7966c778268eb6bd967
/TheExperimentDiv2.cpp
4b25260fa90461003d26cd2471de53cd2c550a1c
[]
no_license
t11a/topcoder
bd7dfea7e0bd628d4b443bff53e1a272f77a0c95
e5661fbed2005d6b853c59922ef11fcfee496fbb
refs/heads/master
2021-01-19T18:32:20.276721
2013-04-22T01:57:41
2013-04-22T01:57:41
null
0
0
null
null
null
null
UTF-8
C++
false
false
6,863
cpp
#include <cmath> #include <ctime> #include <iostream> #include <string> #include <vector> using namespace std; class TheExperimentDiv2 { public: vector <int> determineHumidity( vector <int> intensity, int L, vector <int> leftEnd ) { vector<int> ans; vector<int> flg; int size = leftEnd.size(); int memo[size]; for (int i=0; i<size ;i++) { memo[i] = 0; } for (int i=0; i<size ;i++) { int left = leftEnd.at(i); int right = left + L - 1; int tmp=0; for (int j=left; j<=right ;j++) { if (memo[j] != -1) { tmp += intensity[j]; memo[j] = -1; } } ans.push_back(tmp); } return ans; } }; // BEGIN CUT HERE namespace moj_harness { int run_test_case(int); void run_test(int casenum = -1, bool quiet = false) { if (casenum != -1) { if (run_test_case(casenum) == -1 && !quiet) { cerr << "Illegal input! Test case " << casenum << " does not exist." << endl; } return; } int correct = 0, total = 0; for (int i=0;; ++i) { int x = run_test_case(i); if (x == -1) { if (i >= 100) break; continue; } correct += x; ++total; } if (total == 0) { cerr << "No test cases run." << endl; } else if (correct < total) { cerr << "Some cases FAILED (passed " << correct << " of " << total << ")." << endl; } else { cerr << "All " << total << " tests passed!" << endl; } } template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { os << "{"; for (typename vector<T>::const_iterator vi=v.begin(); vi!=v.end(); ++vi) { if (vi != v.begin()) os << ","; os << " " << *vi; } os << " }"; return os; } int verify_case(int casenum, const vector <int> &expected, const vector <int> &received, clock_t elapsed) { cerr << "Example " << casenum << "... "; string verdict; vector<string> info; char buf[100]; if (elapsed > CLOCKS_PER_SEC / 200) { sprintf(buf, "time %.2fs", elapsed * (1.0/CLOCKS_PER_SEC)); info.push_back(buf); } if (expected == received) { verdict = "PASSED"; } else { verdict = "FAILED"; } cerr << verdict; if (!info.empty()) { cerr << " ("; for (int i=0; i<(int)info.size(); ++i) { if (i > 0) cerr << ", "; cerr << info[i]; } cerr << ")"; } cerr << endl; if (verdict == "FAILED") { cerr << " Expected: " << expected << endl; cerr << " Received: " << received << endl; } return verdict == "PASSED"; } int run_test_case(int casenum__) { switch (casenum__) { case 0: { int intensity[] = {3, 4, 1, 1, 5, 6}; int L = 3; int leftEnd[] = {3, 1, 0}; int expected__[] = {12, 5, 3 }; clock_t start__ = clock(); vector <int> received__ = TheExperimentDiv2().determineHumidity(vector <int>(intensity, intensity + (sizeof intensity / sizeof intensity[0])), L, vector <int>(leftEnd, leftEnd + (sizeof leftEnd / sizeof leftEnd[0]))); return verify_case(casenum__, vector <int>(expected__, expected__ + (sizeof expected__ / sizeof expected__[0])), received__, clock()-start__); } case 1: { int intensity[] = {5, 5}; int L = 2; int leftEnd[] = {0, 0}; int expected__[] = {10, 0 }; clock_t start__ = clock(); vector <int> received__ = TheExperimentDiv2().determineHumidity(vector <int>(intensity, intensity + (sizeof intensity / sizeof intensity[0])), L, vector <int>(leftEnd, leftEnd + (sizeof leftEnd / sizeof leftEnd[0]))); return verify_case(casenum__, vector <int>(expected__, expected__ + (sizeof expected__ / sizeof expected__[0])), received__, clock()-start__); } case 2: { int intensity[] = {92, 11, 1000, 14, 3}; int L = 2; int leftEnd[] = {0, 3}; int expected__[] = {103, 17 }; clock_t start__ = clock(); vector <int> received__ = TheExperimentDiv2().determineHumidity(vector <int>(intensity, intensity + (sizeof intensity / sizeof intensity[0])), L, vector <int>(leftEnd, leftEnd + (sizeof leftEnd / sizeof leftEnd[0]))); return verify_case(casenum__, vector <int>(expected__, expected__ + (sizeof expected__ / sizeof expected__[0])), received__, clock()-start__); } case 3: { int intensity[] = {2, 6, 15, 10, 8, 11, 99, 2, 4, 4, 4, 13}; int L = 4; int leftEnd[] = {1, 7, 4, 5, 8, 0}; int expected__[] = {39, 14, 110, 0, 13, 2 }; clock_t start__ = clock(); vector <int> received__ = TheExperimentDiv2().determineHumidity(vector <int>(intensity, intensity + (sizeof intensity / sizeof intensity[0])), L, vector <int>(leftEnd, leftEnd + (sizeof leftEnd / sizeof leftEnd[0]))); return verify_case(casenum__, vector <int>(expected__, expected__ + (sizeof expected__ / sizeof expected__[0])), received__, clock()-start__); } // custom cases /* case 4: { int intensity[] = ; int L = ; int leftEnd[] = ; int expected__[] = ; clock_t start__ = clock(); vector <int> received__ = TheExperimentDiv2().determineHumidity(vector <int>(intensity, intensity + (sizeof intensity / sizeof intensity[0])), L, vector <int>(leftEnd, leftEnd + (sizeof leftEnd / sizeof leftEnd[0]))); return verify_case(casenum__, vector <int>(expected__, expected__ + (sizeof expected__ / sizeof expected__[0])), received__, clock()-start__); }*/ /* case 5: { int intensity[] = ; int L = ; int leftEnd[] = ; int expected__[] = ; clock_t start__ = clock(); vector <int> received__ = TheExperimentDiv2().determineHumidity(vector <int>(intensity, intensity + (sizeof intensity / sizeof intensity[0])), L, vector <int>(leftEnd, leftEnd + (sizeof leftEnd / sizeof leftEnd[0]))); return verify_case(casenum__, vector <int>(expected__, expected__ + (sizeof expected__ / sizeof expected__[0])), received__, clock()-start__); }*/ /* case 6: { int intensity[] = ; int L = ; int leftEnd[] = ; int expected__[] = ; clock_t start__ = clock(); vector <int> received__ = TheExperimentDiv2().determineHumidity(vector <int>(intensity, intensity + (sizeof intensity / sizeof intensity[0])), L, vector <int>(leftEnd, leftEnd + (sizeof leftEnd / sizeof leftEnd[0]))); return verify_case(casenum__, vector <int>(expected__, expected__ + (sizeof expected__ / sizeof expected__[0])), received__, clock()-start__); }*/ default: return -1; } } } int main(int argc, char *argv[]) { if (argc == 1) { moj_harness::run_test(); } else { for (int i=1; i<argc; ++i) moj_harness::run_test(atoi(argv[i])); } } // END CUT HERE
1c91353b20e7e291b8d9380948fd9539dec7c3c7
d2fbecb5613d970864bc7f0caf4bbede6127d808
/CPP/Eeny_meeny_miny_moe.cpp
e258c0481d9623d527856ed17cfb17d712463c57
[ "MIT" ]
permissive
abhikushwaha/Hacktoberfest2019
f303c50730c8257c319cd3e3e8ea4e2c301a1ff1
b9cd60a2121cd1776a3eba3857e5b1128bac5207
refs/heads/master
2020-08-21T21:02:49.067576
2019-10-19T18:04:53
2019-10-19T18:04:53
216,245,093
1
0
MIT
2019-10-19T18:04:54
2019-10-19T17:31:35
null
UTF-8
C++
false
false
2,202
cpp
#include<bits/stdc++.h> using namespace std; int main() { string str; //the rhyme, consisting of a list of words separated by spaces char x; int count = 0; while(1) { cin >> str; if(str[0]>='0' && str[0]<='9') { break; } count++; } int val = 0, j = 1; /* calculating the value of number of kids */ for(int i=0;i<str.length();i++) { val = val*j + str[i]-'0'; j*=10; } string s[val]; bool arr[val]; memset(arr, false, sizeof arr); for(int i=0;i<val;i++) { cin >> s[i]; // the names of the kids, one per line } j = 0; int count2 = count; vector<string> vec; //cout << count; /* selecting the players alternatively one for each team */ for(int i=0;i<val;i++) { count2 = count; //count of number of words in the rhyme while(1) { /* Checking if the current player is still in the queue of non- selected players */ if(arr[j]==false) count2--; /* When our counting ends at a particular player we select it into one of the team */ if(count2==0) { vec.push_back(s[j]); // pushing the new selected player into the vector arr[j] = true; // marking it as selected // j++; // j = j%val; break; } j++; j = j%val; } } int k1, k2; /* calculating the size of each team */ if(vec.size()%2==0) { k1 = vec.size()/2; k2 = k1; } else { k1 = vec.size()/2 + 1; k2 = vec.size()/2; } /* printing the number of players in each team and the corresponding players */ cout << k1 << endl; for(int i=0;i<vec.size();i+=2) { cout << vec[i] << endl; } cout << k2 << endl; for(int i=1;i<vec.size();i+=2) { cout << vec[i] << endl; } // for(int i=0;i<vec.size();i++) // cout << vec[i] << ' '; return 0; }
1158a34ff33c599ae0344ce8c4eccd5e9d7fc362
d21083ae345a64071a9af6c4cb726afdf6519c87
/StealTheDiamond/Animation.cpp
99b6b4d13615485e031a829212417f8784ccd376
[]
no_license
vecel/steal-the-diamond
17d2c527cd784be5c7fbc32c9a692af20a595061
f07aeee03248b973993ab07ed7bd4324fcd034ba
refs/heads/master
2023-04-11T15:34:15.249162
2021-04-26T10:31:39
2021-04-26T10:31:39
350,823,093
0
0
null
null
null
null
UTF-8
C++
false
false
608
cpp
#include "Animation.h" Animation::Animation(Object* target) { this->target = target; totalLength = progress = 0.0; } Animation::~Animation() { } void Animation::addFrame(Frame&& frame) { frames.push_back(std::move(frame)); totalLength += frame.duration; } void Animation::update(double elapsedTime) { progress = elapsedTime; double p = progress; for (int i = 0; i < frames.size(); ++i) { p -= frames[i].duration; if (p <= 0.0 || &frames[i] == &(frames.back())) { target->sprite.setTextureRect(frames[i].frameRect); break; } } } double Animation::getLength() { return totalLength; }
a5c7a4153a80291934403166a3c7749c69528147
fe06b6d602595b147ea4e8bbcbdd2a2e25d6e2ab
/2_stars/483.cpp
df0653e1f78f9f889aaeed0254f3d81db3a406cd
[]
no_license
lausai/UVa
8c4a86785d5c561bb9d464466b60bdf4e993757c
fb14b6f9031a449e20830d5f0903a06a8899dfa5
refs/heads/master
2022-10-17T12:49:02.561369
2022-09-23T03:02:50
2022-09-23T03:02:50
20,293,790
0
0
null
null
null
null
UTF-8
C++
false
false
372
cpp
#include <cstdio> #include <cstring> using namespace std; int main() { char str[32] = {0}; char ch = 0; while (EOF != scanf("%s%c", str, &ch)) { int len = strlen(str); for (int i = len - 1; i >= 0; i--) printf("%c", str[i]); printf("%c", ch); } return 0; }
89337b70bb16b45d0fc518095cbc9c31e2920367
ca865ab1f67a1e71351d8720d1ce8212ad29c573
/src/algorithm/INS.h
3ea610409ddb657dad3afea343e81d00e54e714e
[]
no_license
chiewen/RoadINS
e0b225af2ccad5a910807425ce9ca9fef43d0b0e
d4b3a821a0e50a2caebd27c1a50103e494127386
refs/heads/master
2021-01-10T13:36:52.897252
2015-12-14T13:44:44
2015-12-14T13:44:44
45,672,095
0
0
null
null
null
null
UTF-8
C++
false
false
517
h
// // Created by chiewen on 2015/11/13. // #ifndef ROADINS_MKNN_H #define ROADINS_MKNN_H #include "../network/Trajectory.h" #include "MknnProcessor.h" class INS : public MknnProcessor { int k; set<long> top_k, ins; set<PNode, ptr_node_less> ptr_top_k; public: INS(int k) : k(k) { } void move(Trajectory trajectory); void refresh(int k, set<long> &top_k, set<PNode, ptr_node_less> &ptr_top_k, set<long> &ins, const pair<PRoad, double> &pos); }; #endif //ROADINS_MKNN_H
40c65613a5a8d0e979b9f938a151f6e081859374
5ec06dab1409d790496ce082dacb321392b32fe9
/clients/cpp-tizen/generated/src/ComAdobeCqSocialEnablementServicesImplAuthorMarkerImplProperties.h
f6d909035f66c698c02b16e6b610ec6063935c0f
[ "Apache-2.0" ]
permissive
shinesolutions/swagger-aem-osgi
e9d2385f44bee70e5bbdc0d577e99a9f2525266f
c2f6e076971d2592c1cbd3f70695c679e807396b
refs/heads/master
2022-10-29T13:07:40.422092
2021-04-09T07:46:03
2021-04-09T07:46:03
190,217,155
3
3
Apache-2.0
2022-10-05T03:26:20
2019-06-04T14:23:28
null
UTF-8
C++
false
false
1,475
h
/* * ComAdobeCqSocialEnablementServicesImplAuthorMarkerImplProperties.h * * */ #ifndef _ComAdobeCqSocialEnablementServicesImplAuthorMarkerImplProperties_H_ #define _ComAdobeCqSocialEnablementServicesImplAuthorMarkerImplProperties_H_ #include <string> #include "ConfigNodePropertyInteger.h" #include "Object.h" /** \defgroup Models Data Structures for API * Classes containing all the Data Structures needed for calling/returned by API endpoints * */ namespace Tizen { namespace ArtikCloud { /*! \brief * * \ingroup Models * */ class ComAdobeCqSocialEnablementServicesImplAuthorMarkerImplProperties : public Object { public: /*! \brief Constructor. */ ComAdobeCqSocialEnablementServicesImplAuthorMarkerImplProperties(); ComAdobeCqSocialEnablementServicesImplAuthorMarkerImplProperties(char* str); /*! \brief Destructor. */ virtual ~ComAdobeCqSocialEnablementServicesImplAuthorMarkerImplProperties(); /*! \brief Retrieve a string JSON representation of this class. */ char* toJson(); /*! \brief Fills in members of this class from JSON string representing it. */ void fromJson(char* jsonStr); /*! \brief Get */ ConfigNodePropertyInteger getServiceranking(); /*! \brief Set */ void setServiceranking(ConfigNodePropertyInteger serviceranking); private: ConfigNodePropertyInteger serviceranking; void __init(); void __cleanup(); }; } } #endif /* _ComAdobeCqSocialEnablementServicesImplAuthorMarkerImplProperties_H_ */
72a0abdd16658b6c9de406ecddbcc035ea4c3cb8
ae553859e8cabc8fc9ffe1fb623c8990fc7f562e
/7-mapreduce/friendlyNumbers_MPI.cpp
dbd3882c6461ca8ad3e31fa24d49a7fea08cb8eb
[]
no_license
Duknust/CPD-AP-Aulas
7bcacb09fe101d66c7fc3647727ef01f8973b87d
95f62f2bf9ce7980b523feb45275c4c232508c49
refs/heads/master
2021-01-18T17:40:38.022133
2015-06-10T16:32:39
2015-06-10T16:32:39
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,847
cpp
#include <stdio.h> #include <stdlib.h> #include <math.h> #include <mpi.h> int *num; int *den; int size; int gcd(int u, int v) { if (v == 0) return u; return gcd(v, u % v); } void printArray(int *array,int size){ int i=0; for(i;i<size;i++) printf("%d ",array[i]); printf("\n"); } void FriendlyNumbers (int start, int end) { // size = end-start+1; // printf("Tstart:%d Tend:%d Last:%d\n",start,end,size); // num = new int[offset]; // den = new int[offset]; #pragma omp parallel { int i, j, factor, ii, sum, done, n; // -- MAP -- #pragma omp for schedule (dynamic, 16) for (i = start; i <= end; i++) { ii = i - start; sum = 1 + i; done = i; factor = 2; while (factor < done) { if ((i % factor) == 0) { sum += (factor + (i/factor)); if ((done = i/factor) == factor) sum -= factor; } factor++; } num[ii] = sum; den[ii] = i; n = gcd(num[ii], den[ii]); num[ii] /= n; den[ii] /= n; } // end for } // end parallel region } int main(int argc, char **argv) { unsigned int start = atoi(argv[1]); unsigned int end = atoi(argv[2]); MPI_Init(&argc,&argv); double time=MPI_Wtime(); int pid,n_proc; MPI_Status status1,status2; MPI_Comm_size(MPI_COMM_WORLD,&n_proc); MPI_Comm_rank(MPI_COMM_WORLD,&pid); size = end-start+1; int offset = size / (n_proc); int off = 0,proc; printf("pid:%d start:%d end:%d offset:%d size:%d\n",pid,start+(offset*pid),start+(offset*(pid+1)),offset,size); // int *the_num = new int[size]; if(pid==0){ num = new int[size]; den = new int[size];} else { num = new int[offset]; den = new int[offset];} FriendlyNumbers(start+(offset*(pid)), start+(offset*(pid+1)-1)); if(pid==0){ int i=1,j; for(i;i<n_proc;i++){ MPI_Recv(&num[(i)*offset],offset, MPI_INT, i,1,MPI_COMM_WORLD,&status1); MPI_Recv(&den[(i)*offset],offset, MPI_INT, i,2,MPI_COMM_WORLD,&status2); } // -- REDUCE -- #pragma parallel omp for schedule (static, 8) for (i = 0; i < size; i++) { for (j = i+1; j< size; j++) { if ((num[i] == num[j]) && (den[i] == den[j])) printf ("%d and %d are FRIENDLY \n", start+i, start+j); } } time=MPI_Wtime()-time; printf("Time:%f seconds\n"); /* printf("num %d\n",pid); printArray(num,size); printf("den %d\n",pid); printArray(den,size);*/ } else{ MPI_Send(&num[0],offset, MPI_INT, 0,1,MPI_COMM_WORLD); MPI_Send(&den[0],offset, MPI_INT, 0,2,MPI_COMM_WORLD); /* printf("num %d\n",pid); printArray(num,offset); printf("den %d\n",pid); printArray(den,offset);*/ //delete[] num; // delete[] den; } MPI_Finalize(); /* printf("num %d\n",pid); printArray(num,size); printf("den %d\n",pid); printArray(den,offset);*/ }
50bea943576abaead330cd8c9dfa53cde4bb6b38
1af49694004c6fbc31deada5618dae37255ce978
/chrome/credential_provider/extension/service.h
48555611941d25351fa536c70313d1b1dfcd9698
[ "BSD-3-Clause" ]
permissive
sadrulhc/chromium
59682b173a00269ed036eee5ebfa317ba3a770cc
a4b950c23db47a0fdd63549cccf9ac8acd8e2c41
refs/heads/master
2023-02-02T07:59:20.295144
2020-12-01T21:32:32
2020-12-01T21:32:32
317,678,056
3
0
BSD-3-Clause
2020-12-01T21:56:26
2020-12-01T21:56:25
null
UTF-8
C++
false
false
2,293
h
// Copyright 2020 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_CREDENTIAL_PROVIDER_EXTENSION_SERVICE_H_ #define CHROME_CREDENTIAL_PROVIDER_EXTENSION_SERVICE_H_ #include <windows.h> #include "base/callback.h" #include "base/macros.h" namespace credential_provider { namespace extension { // Bare implementation of the GCPW extension service. Takes care the handshake // with the service control manager and the lifetime of the service. class Service { public: // Gets the singleton instance of the service. static Service* Get(); // Invoke the chosen action routine. By default service runs as a service, // but the action routine can support running in console for testing purposes. DWORD Run(); private: Service(); virtual ~Service(); // The action routine to be executed. DWORD (Service::*run_routine_)(); // This function handshakes with the service control manager and starts // the service. DWORD RunAsService(); // Non-static function that is called as part of service main(ServiceMain). // Performs registering control handler callback and managing the service // states. void StartMain(); // Service main call back which was provided earlier to service control // manager as part of RunAsService call. static VOID WINAPI ServiceMain(DWORD argc, WCHAR* argv[]); // The control handler of the service. Details about the control codes can be // found here: // https://docs.microsoft.com/en-us/windows/win32/services/service-control-handler-function static void WINAPI ServiceControlHandler(DWORD control); // Returns the storage used for the instance pointer. static Service** GetInstanceStorage(); // Status of the running service. Must be updated accordingly before calling // SetServiceStatus API. SERVICE_STATUS service_status_; // The service status handle which is used with SetServiceStatus API. SERVICE_STATUS_HANDLE service_status_handle_; // Callback to end running periodic tasks. base::OnceClosure quit_closure_; DISALLOW_COPY_AND_ASSIGN(Service); }; } // namespace extension } // namespace credential_provider #endif // CHROME_CREDENTIAL_PROVIDER_EXTENSION_SERVICE_H_
5823937e3a6dec8a0e19b9505aa2069ab5b727a2
f424cab1ce02cbd2077fa6a23b879b7c50a15771
/NaiveBayes.cpp
ac2aaf2d4a416f9855ee5bf8ffe8603d2551540b
[]
no_license
nharada1/innocent-bayes
98072f1db3c9a96050b02bb3f7c9ff54813f82e6
4c7ccd4438b03b04f648cabeafd07ecd6012dd16
refs/heads/master
2021-03-27T18:36:49.372902
2016-03-07T18:32:00
2016-03-07T18:32:00
53,169,136
0
0
null
null
null
null
UTF-8
C++
false
false
2,192
cpp
// // Created by Nate Harada on 3/3/16. // #include "NaiveBayes.h" void NaiveBayes::fit(MatrixXd X, VectorXi y) { int n_classes = y.maxCoeff() + 1; int n_features = X.cols(); pC.resize(n_classes); pXC.resize(n_features, n_classes); // Compute class probabilites P(C_k) for (int c=0; c<n_classes; c++) { pC(c) = getClassProb(y, c); } // Compute class-conditional probabilities P(x_i | C_k) for (int i=0; i<n_features; i++) { for (int c=0; c<n_classes; c++) { pXC(i, c) = getClassCondProb(X, y, i, c); } } } MatrixXd NaiveBayes::predict_proba(MatrixXd X) { // Naive bayes can be viewed as a linear classifier when expressed in log space // where pC is the bias MatrixXd rel_probs = X * pXC; rel_probs.rowwise() += pC.transpose(); return rel_probs; } VectorXi NaiveBayes::predict(MatrixXd X) { MatrixXd rel_probs = predict_proba(X); VectorXi maxVal(rel_probs.rows()); for (int r=0; r<rel_probs.rows(); ++r) { float max = -std::numeric_limits<float>::max(); int argmax = 0; // Calculate the max prob for this row for (int c=0; c<rel_probs.cols(); ++c) { if (rel_probs(r, c) > max) { max = rel_probs(r, c); argmax = c; } } maxVal(r) = argmax; } std::cout << rel_probs << "\n"; std::cout << maxVal << "\n"; return maxVal; } float NaiveBayes::getClassProb(VectorXi v, int c) { int n_class = 0; for (int i=0; i<v.size(); ++i) { if (v(i) == c) n_class++; } return log(float(n_class) / v.size()); } float NaiveBayes::getClassCondProb(MatrixXd X, VectorXi y, int i, int c) { float Nyi = 0; float Ny = 0; float alpha = 1; // Compute number of times feature appears in class y // Compute sum of features in class y for (int r=0; r<X.rows(); r++) { if (y(r) == c) { Nyi += X(r, i); for (int f=0; f<X.cols(); f++) { Ny += X(r, f); } } } float smoothed = (Nyi + alpha) / (Ny + alpha*y.maxCoeff()); return log(smoothed); }
5e4c94208b97c77aaf83e3cd29ad85af91532440
89032afea0526303299f01986ed2bca8cc6b35a0
/day_16.1.cpp
60d45181ace800f9968802a0342505e6b1c7bc2a
[ "MIT" ]
permissive
watmough/Advent-of-Code-2017
8937b5cdf021f599fe0b20f379b13b2de56a48a5
0de5d71999059a153b56fbcc5f9ed34dfae31bd5
refs/heads/master
2021-10-02T21:29:40.469908
2018-11-30T23:59:36
2018-11-30T23:59:36
112,746,532
0
0
null
null
null
null
UTF-8
C++
false
false
1,728
cpp
// Advent of Code 2017 // Day 16 - Permutation Promenade #include <iostream> #include <sstream> #include <algorithm> #include <fstream> #include <map> using namespace std; int main() { // test inputs /* string input = "s1, x3/4, pe/b"; // a spin of size 1: eabcd.*/ int n,n1,n2; string ins; char ch; map<string,uint> seq; // cycle? string p = "abcdefghijklmnop"; for(int i=0;i<1000000000%60;++i) { ifstream in("day_16.txt"); while(in >> ch) { if (ch==',' || ch<'0' || ch=='/' || ch==' ') continue; if (ch=='s') { in >> n; string temp(p); copy(end(p)-n,end(p),temp.begin()); copy(begin(p),end(p)-n,temp.begin()+n); p=temp; } if (ch=='x') { in >> n1; if(in.peek()=='/') in.get(); in >> n2; swap(p[n1],p[n2]); } if (ch=='p') { string sw; char ch; while (in.peek()!=',' && in >> ch) sw.push_back(ch); auto slash = find_if(sw.begin(),sw.end(),[](int c)->bool{return c=='/';}); string t1(sw.begin(),slash); string t2(slash+1,sw.end()); auto it1 = p.find(t1); auto it2 = p.find(t2); copy(t1.begin(),t1.end(),p.begin()+it2); copy(t2.begin(),t2.end(),p.begin()+it1); } } if (seq.find(p)!=seq.end()) { cout << "Found a repeat of " << p << " at " << i << endl; } seq[p] = i; } cout << p << endl; }
02c6671438a1a82120683f55a571c465c86d90ba
a239b6bfb8d2976838233c7ecf17e799f00af7df
/monitoring_suhu_tembakau/monitoring_suhu_tembakau.ino
143e2c62a686462c53882138eb9632b037eeadb3
[]
no_license
DavaKU/monitoring-suhu-tembakau
d0b6c380d5a6000f820fd09605fb15ad08f25f01
330b5c38ef6bf823d4240902c7ed329a4def745f
refs/heads/main
2023-01-03T17:27:06.415556
2020-11-02T02:37:21
2020-11-02T02:37:21
309,237,933
0
0
null
null
null
null
UTF-8
C++
false
false
2,500
ino
#include "DHT.h" #define DHTPIN D2 #define DHTTYPE DHT11 // DHT 11 #include <ESP8266WiFi.h> DHT dht(DHTPIN, DHTTYPE); //Konfigurasi WiFi const char *ssid = "ZTE_2.4G_HKdG6U"; const char *password = "87654321"; //IP Address Server yang terpasang XAMPP const char *host = "192.168.1.25"; void setup() { Serial.begin(9600); dht.begin(); WiFi.mode(WIFI_STA); WiFi.begin(ssid, password); Serial.println(""); Serial.print("Connecting"); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } //Jika koneksi berhasil, maka akan muncul address di serial monitor Serial.println(""); Serial.print("Connected to "); Serial.println(ssid); Serial.print("IP address: "); Serial.println(WiFi.localIP()); } int value = 0; void loop() { // Proses Pengiriman ----------------------------------------------------------- delay(60000); ++value; // Membaca Sensor Analog ------------------------------------------------------- float h = dht.readHumidity(); // Read temperature as Celsius (the default) float t = dht.readTemperature(); Serial.print("Humidity: "); Serial.print(h); Serial.print(" %\t"); Serial.print("Temperature: "); Serial.println(t) ; Serial.print("connecting to "); Serial.println(host); // Mengirimkan ke alamat host dengan port 80 ----------------------------------- WiFiClient client; const int httpPort = 80; if (!client.connect(host, httpPort)) { Serial.println("connection failed"); return; } // Isi Konten yang dikirim adalah alamat ip si esp ----------------------------- String url = "/web-warriornux/write-data.php?data="; url += t; Serial.print("Requesting URL: "); Serial.println(url); // Mengirimkan Request ke Server ----------------------------------------------- client.print(String("GET ") + url + " HTTP/1.1\r\n" + "Host: " + host + "\r\n" + "Connection: close\r\n\r\n"); unsigned long timeout = millis(); while (client.available() == 0) { if (millis() - timeout > 1000) { Serial.println(">>> Client Timeout !"); client.stop(); return; } } // Read all the lines of the reply from server and print them to Serial while (client.available()) { String line = client.readStringUntil('\r'); Serial.print(line); } Serial.println(); Serial.println("closing connection"); }
34ac5ac52f31d897bd7e15d210743ddf4f3d8022
289536c2769e68a3ed87cdbfc1a7bfee6d22bd8e
/!programming/C++/!semester 2 labs/Laba 5. STL containers/Source.cpp
b608d4a77864e1d7dcec5b3e0b5091a5fe241c59
[]
no_license
aroud/bsu
a1fc7d5d03fe5d072dfd3f1c2c7a67cace1e3f48
a145f6ebbb0f7f6ff3df9c403007f44a98bf0af2
refs/heads/main
2023-03-26T19:17:05.392878
2021-03-30T13:59:55
2021-03-30T13:59:55
341,375,837
1
0
null
null
null
null
WINDOWS-1251
C++
false
false
5,726
cpp
//Рудь Андрей, 7 группа //unordered_map #include <unordered_map> #include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; class student //пользовательский тип: конструкторы, операторы equality_comparing { public: student() :mark(4),name(""){} student(string name_, int mark) : mark(mark),name(name_){} student(const student& st2):mark(st2.mark),name(st2.name){} string name; int mark; friend bool operator== (const student& st1,const student& st2); friend bool operator!= (const student& st1, const student& st2); }; bool operator== (const student& st1, const student& st2) { return st1.name==st2.name; } bool operator!= (const student& st1, const student& st2) { return st1.name != st2.name; } namespace std { // хеш-функция для student template <> struct hash<student> { size_t operator()(const student & x) const { return hash<int>()(x.mark); } }; } unordered_map<student, string> function(unordered_map<student, string> a) { return a; } int main() { setlocale(LC_ALL, "rus"); /*3. Все возможные конструкторы*/ unordered_map<int, string> umap1; /*-умолчанию*/ // конструкторы с новыми аллокаторами, хеш функциями, equality-comparator-ами -- пропускаю unordered_map<int, string> umap1_2(umap1); /*-копирующий*/ unordered_map<int, string> umap2(50); /*-количество бакетов*/ umap2[1] = "Иванов"; umap2[10] = "Petrov"; umap2[30] = "Sokolov"; vector<pair<int, string>>v = { make_pair(1,"abc1"),make_pair(2,"abc2"),make_pair(3,"abc3"),make_pair(4,"abc4") }; unordered_map<int, string> umap2_2(v.begin(),v.end()); /*-по итераторам*/ for (auto &it : umap2_2) cout << it.first << ' ' << it.second << endl; unordered_map<int, string> umap2_3(v.begin(), v.end(),50); /*-итераторы и количество бакетов*/ /*перемещающие конструкторы -- пропускаю*/ cout << endl; unordered_map<int, string> umap3 = { make_pair(1,"xyz1"),make_pair(2,"xyz2"),make_pair(3,"xyz3"),make_pair(4,"xyz4") }; /*-initializer_list*/ for (auto &it : umap3) cout << it.first << ' ' << it.second << endl; /*--------------------------------*/ /*Тестирование для пользовательских типов 4)7)8)*/ unordered_map<student, string> umap; string n4 = "Kuznetsov"; string n5 = "Orlov"; student a("Ivanov", 5); student b("Petrov", 10); student c("Popov", 4); umap.insert(make_pair(a,"удовлетворительно")); //insert() umap[b] = "отлично"; //oprator[] umap[c] = "удовлетворительно"; if (!umap.empty()) //empty() cout << "size: " << umap.size() << endl; //size() cout << "max_size: " << umap.max_size() << endl; //max_size() unordered_map<student, string> unmap; unordered_map<student, string> unmap2; unmap2 = unmap = umap; //operator= for (auto it = unmap.cbegin(); it != unmap.cend(); ++it) //cbegin(),cend() по map cout << (*it).first.name<<' '; cout << endl; unmap.clear(); //clear() for (auto & it : umap) //erase() cout << it.first.name << ' '; cout << endl; umap.erase(umap.begin(),--umap.end()); for (auto & it : umap) cout << it.first.name << ' '; cout << endl; swap(umap, unmap2); //swap() for (auto & it : umap) cout << it.first.name << ' '; cout << endl; umap.emplace(student(n4, 10), string("хорошо"));//emplace() umap.emplace_hint(umap.begin(),make_pair(student(n5, 7), string("хорошо"))); for (auto & it : umap) cout << it.first.name << ' '; cout << endl; //emplace_hint() auto it = umap.find(b); //find if (it != umap.end()) { cout << (*it).first.name << endl; cout << "Value for student b: " << umap.at(b) << endl; //at } for (auto & it : umap) cout << it.first.name<<' '; cout << endl; cout << "bucket_count: " << umap.bucket_count() << endl; cout << "max_bucket_count: " << umap.max_bucket_count() << endl; cout << "load_factor: " << umap.load_factor() << endl; double d = 0.7; umap.max_load_factor(d); cout << "max_load_factor " << umap.max_load_factor() << endl; cout << "size: " << umap.size() << endl; cout << umap.bucket(b) << endl; //номер бакета по ключу for (auto it = umap.begin(7); it != umap.end(7); ++it) //итераторы по бакету cout << (*it).first.name << ' '; cout << endl; /* -----------------------------*/ /*6)*/ unordered_map<student, string> mapA(function(umap)); unordered_map<student, string> map = function(mapA); for (auto & it : map) cout << it.first.name << ' '; cout << endl; /*---------------------*/ /* 11) примеры использования хеш-таблиц (А.Бхаргава "Грокаем алгоритмы", СПб.: Питер, 2017. - 288 с.: ил.) -создание связь, отображающую один объект на другой -нахождение значения в списке -исключение дубликатов -Кэширование/запоминание данных вместо выполнения работы на сервере */ system("pause"); return 0; }
9cfd30366c2ec9de6442014a26a03ae44f123c17
f2d1a0d39d3ffa6560936b47e40222d955a1d6e9
/XPlay/main.cpp
46d19fccb252911c7e96f822d6937405922d0ee7
[]
no_license
VideosWorks/XPlay
c50999e52782ec07854feef9d95d044fbb4e99e5
fa6592d3df88f5280afe41f71a335a2a37120cde
refs/heads/master
2020-07-08T01:39:09.247131
2019-01-28T02:36:00
2019-01-28T02:36:00
null
0
0
null
null
null
null
UTF-8
C++
false
false
207
cpp
#include "xplay.h" #include <QtWidgets/QApplication> #include "XFFmpeg.h" #include <QAudioOutput> int main(int argc, char *argv[]) { QApplication a(argc, argv); XPlay w; w.show(); return a.exec(); }
4911b8abb52251b11315c20bcfc8766ee5c18e24
45364deefe009a0df9e745a4dd4b680dcedea42b
/SDK/FSD_AssetRegistry_classes.hpp
202b588584240c28176ac99542485707c1556297
[]
no_license
RussellJerome/DeepRockGalacticSDK
5ae9b59c7324f2a97035f28545f92773526ed99e
f13d9d8879a645c3de89ad7dc6756f4a7a94607e
refs/heads/master
2022-11-26T17:55:08.185666
2020-07-26T21:39:30
2020-07-26T21:39:30
277,796,048
0
0
null
null
null
null
UTF-8
C++
false
false
3,702
hpp
#pragma once // DeepRockGalactic SDK #ifdef _MSC_VER #pragma pack(push, 0x8) #endif #include "FSD_AssetRegistry_structs.hpp" namespace SDK { //--------------------------------------------------------------------------- //Classes //--------------------------------------------------------------------------- // Class AssetRegistry.AssetRegistryImpl // 0x0750 (0x0778 - 0x0028) class UAssetRegistryImpl : public UObject { public: unsigned char UnknownData00[0x750]; // 0x0028(0x0750) MISSED OFFSET static UClass* StaticClass() { static auto ptr = UObject::FindClass("Class AssetRegistry.AssetRegistryImpl"); return ptr; } }; // Class AssetRegistry.AssetRegistryHelpers // 0x0000 (0x0028 - 0x0028) class UAssetRegistryHelpers : public UObject { public: static UClass* StaticClass() { static auto ptr = UObject::FindClass("Class AssetRegistry.AssetRegistryHelpers"); return ptr; } struct FSoftObjectPath STATIC_ToSoftObjectPath(struct FAssetData* InAssetData); struct FARFilter STATIC_SetFilterTagsAndValues(struct FARFilter* InFilter, TArray<struct FTagAndValue>* InTagsAndValues); bool STATIC_IsValid(struct FAssetData* InAssetData); bool STATIC_IsUAsset(struct FAssetData* InAssetData); bool STATIC_IsRedirector(struct FAssetData* InAssetData); bool STATIC_IsAssetLoaded(struct FAssetData* InAssetData); bool STATIC_GetTagValue(struct FAssetData* InAssetData, struct FName* InTagName, class FString* OutTagValue); class FString STATIC_GetFullName(struct FAssetData* InAssetData); class FString STATIC_GetExportTextName(struct FAssetData* InAssetData); class UClass* STATIC_GetClass(struct FAssetData* InAssetData); TScriptInterface<class UAssetRegistry> STATIC_GetAssetRegistry(); class UObject* STATIC_GetAsset(struct FAssetData* InAssetData); struct FAssetData STATIC_CreateAssetData(class UObject** InAsset, bool* bAllowBlueprintClass); }; // Class AssetRegistry.AssetRegistry // 0x0000 (0x0028 - 0x0028) class UAssetRegistry : public UInterface { public: static UClass* StaticClass() { static auto ptr = UObject::FindClass("Class AssetRegistry.AssetRegistry"); return ptr; } void UseFilterToExcludeAssets(struct FARFilter* Filter, TArray<struct FAssetData>* AssetDataList); void SearchAllAssets(bool* bSynchronousSearch); void ScanPathsSynchronous(TArray<class FString>* InPaths, bool* bForceRescan); void ScanModifiedAssetFiles(TArray<class FString>* InFilePaths); void ScanFilesSynchronous(TArray<class FString>* InFilePaths, bool* bForceRescan); void RunAssetsThroughFilter(struct FARFilter* Filter, TArray<struct FAssetData>* AssetDataList); void PrioritizeSearchPath(class FString* PathToPrioritize); bool IsLoadingAssets(); bool HasAssets(struct FName* PackagePath, bool* bRecursive); void GetSubPaths(class FString* InBasePath, bool* bInRecurse, TArray<class FString>* OutPathList); bool GetAssetsByPath(struct FName* PackagePath, bool* bRecursive, bool* bIncludeOnlyOnDiskAssets, TArray<struct FAssetData>* OutAssetData); bool GetAssetsByPackageName(struct FName* PackageName, bool* bIncludeOnlyOnDiskAssets, TArray<struct FAssetData>* OutAssetData); bool GetAssetsByClass(struct FName* ClassName, bool* bSearchSubClasses, TArray<struct FAssetData>* OutAssetData); bool GetAssets(struct FARFilter* Filter, TArray<struct FAssetData>* OutAssetData); struct FAssetData GetAssetByObjectPath(struct FName* ObjectPath, bool* bIncludeOnlyOnDiskAssets); void GetAllCachedPaths(TArray<class FString>* OutPathList); bool GetAllAssets(bool* bIncludeOnlyOnDiskAssets, TArray<struct FAssetData>* OutAssetData); }; } #ifdef _MSC_VER #pragma pack(pop) #endif
71dd4333e9e14992b4a69a2b7ec24fb9335e0d0c
3db023edb0af1dcf8a1da83434d219c3a96362ba
/windows_nt_3_5_source_code/NT-782/PRIVATE/NET/UI/NCPA/NCPA/RULE.HXX
8a40ec5746a38da4dc6f026faffe2eb39e2fd3b6
[]
no_license
xiaoqgao/windows_nt_3_5_source_code
de30e9b95856bc09469d4008d76191f94379c884
d2894c9125ff1c14028435ed1b21164f6b2b871a
refs/heads/master
2022-12-23T17:58:33.768209
2020-09-28T20:20:18
2020-09-28T20:20:18
null
0
0
null
null
null
null
UTF-8
C++
false
false
9,746
hxx
/**********************************************************************/ /** Microsoft Windows/NT **/ /** Copyright(c) Microsoft Corp., 1991 **/ /**********************************************************************/ /* rule.hxx Storage, parsing and searching classes for NCPA/SPROLOG rule handling. OVERVIEW This class lexically scans and parses text blocks in SProlog form. The general form is: <block> ::= <item> | <block> ; <item> ::= <list> | '=' | variable | token ; <list> ::= '(' <item>* ')' ; <variable> ::= [A-Z][A-Za-z0-9_]* ; <token> ::= number | atom | '|' ; <number> ::= [0-9]+ ; <atom> ::= [a-z][A-Za-z0-9_]* ; Special parse flags control whether the outer class (CFG_RULE_SET) allows variables or the eqivalence token ('='). The cases are these: 1) SProlog facts only, such as when the Registry has been browsed and a set of facts has been created. No variables or list markers ('|') are allowed. For example: (dog spot) (dog lassie) (cat meu_meu) 2) SProlog rules and facts. Variables and list markers are allowed. For example: (dog spot) (dog lassie) (cat meu_meu) (dog Anydog) (topdog (Dog | RestOfDogList ) ) 3) Results of a query. An SProlog query sequence might appear as: [query:] (dog X) [answer:] X = spot X = lassie In this case, the '=' token is followed by exactly one item; it may be a list. Lists are constructed in the following manner. When a list is found, a CFG_RULE_NODE is created and marked as a "list"; then another node is created marked as a "nil", and linked as the child of the list node. This "nil" node becomes the first member of the list. As items are added to the list, the nil node remains the physical first and last element of the list since it's circular. All of the tokens found at the uppermost lexical level of the text block are stored as elements of a list representing the entire block. Note that this implies that a parse ALWAYS RESULTS IN AN ADDITION BOUNDING LIST. This must be discarded (dereferenced) by the caller if undesired. CAVEATS This class cannot handle all of the possible errors which may occur in parsing. It is primarily a lexical scanner which aborts on gross errors of syntax. It is up to the caller to determine if the sequence of tokens is sensible. For example: (dog (Dog | OtherDog | AnotherDog)) will be parsed and stored into its tree form without error. However, such a sequence is completely impossible in SProlog. (A list marker cannot be followed by another list marker at the same lexical level.) FILE HISTORY: DavidHov 10/1/91 Created DavidHov 3/19/92 Amended after code review */ #ifndef _RULE_HXX_ #define _RULE_HXX_ // Include definition of TEXT_BUFFER #include "ncpastrs.hxx" enum CFG_RULE_NODE_TYPE { CRN_NIL, CRN_ROOT, CRN_RULE, CRN_ATOM, CRN_STR, CRN_NUM, CRN_LIST, CRN_VAR, CRN_EQUIV, CRN_VBAR, CRN_MORE, CRN_ANY, CRN_NUM_ANY, CRN_UNKNOWN }; enum CFG_RULE_TYPE { CRT_TOP, CRT_CONTAINER, CRT_RULE, CRT_SUB }; class CFG_RULE_NODE ; // Forward declarations class CFG_RULE_SET ; /************************************************************************* NAME: CFG_RULE_NODE SYNOPSIS: Rule element (node) class for NCPA configuration rules. INTERFACE: PARENT: none USES: nothing CAVEATS: NOTES: HISTORY: DavidHov 10/1/91 Created **************************************************************************/ class CFG_RULE_NODE { public: // Atom or string CFG_RULE_NODE ( CFG_RULE_NODE * pcrnPrev, HUATOM hUatom, CFG_RULE_NODE_TYPE crnt = CRN_ATOM ) ; // Number CFG_RULE_NODE ( CFG_RULE_NODE * pcrnPrev, LONG lNumber ) ; // Token or child list node CFG_RULE_NODE ( CFG_RULE_NODE * pcrnPrev, CFG_RULE_NODE_TYPE crnt ) ; ~ CFG_RULE_NODE () ; // Delete tree // Value query routines CFG_RULE_NODE_TYPE QueryType () // Return type of node { return _ecnType ; } HUATOM QueryAtom () // Return atom { return HUATOM( (UATOM *) _pv ) ; } LONG QueryNumber () // Return number { return (LONG) _pv ; } CFG_RULE_NODE * QueryList () // Return list NIL ptr { return (CFG_RULE_NODE *) _pv ; } CFG_RULE_NODE * QueryNext () // Return ptr to next node { return _pcrnFwd->_ecnType == CRN_NIL ? NULL : _pcrnFwd ; } CFG_RULE_NODE * QueryPrev () // Return ptr to previous node { return _pcrnBack->_ecnType == CRN_NIL ? NULL : _pcrnBack ; } CFG_RULE_NODE * QueryParent () // Return ptr to parent node { return _pcrnParent ; } CFG_RULE_NODE * QueryNth ( int cIndex ) ; // Return nth element of list // UNICODE-compatible replacements for alphabetic/numeric operations static BOOL cfIsDigit ( TCHAR ch ) ; static BOOL cfIsAlpha ( TCHAR ch ) ; static BOOL cfIsAlNum ( TCHAR ch ) ; static TCHAR cfIsUpper ( TCHAR ch ) ; static TCHAR cfIsLower ( TCHAR ch ) ; static TCHAR cfToUpper ( TCHAR ch ) ; static TCHAR cfToLower ( TCHAR ch ) ; static LONG cfAtoL ( TCHAR * pszData ) ; static INT cfScanAtomic ( const TCHAR * pszData, const TCHAR * pszDelim, TCHAR * pszBuffer, INT cchBuffLen ) ; protected: CFG_RULE_NODE * _pcrnParent ; // Parent node CFG_RULE_NODE * _pcrnFwd ; // Next node CFG_RULE_NODE * _pcrnBack ; // Previous node CFG_RULE_TYPE _ecrType ; // Rule type CFG_RULE_NODE_TYPE _ecnType ; // Node type void * _pv ; // Pointer to void // Set the value and its type void SetNumber ( LONG lNum ) { _ecnType = CRN_NUM ; _pv = (void *) lNum ; } void SetList ( CFG_RULE_NODE * pcrn, CFG_RULE_NODE_TYPE crnt = CRN_RULE ) { _ecnType = crnt ; _pv = (void *) pcrn ; } void SetAtom ( HUATOM huaAtom, CFG_RULE_NODE_TYPE crnt = CRN_ATOM ) { _ecnType = crnt ; _pv = (void *) huaAtom ; } void SetNil () { _ecnType = CRN_NIL ; _pv = NULL ; } CFG_RULE_NODE_TYPE SetType ( CFG_RULE_NODE_TYPE crnt ) { return _ecnType = crnt ; } CFG_RULE_NODE () ; // Create top of tree void LinkAfter ( CFG_RULE_NODE * pcrnPrev ) ; }; /************************************************************************* NAME: CFG_RULE_SET SYNOPSIS: Rule element tree class for NCPA configuration rules. INTERFACE: Parse() Build the branches and leaves of the tree by parsing the given block of text. Textify() Convert the rule set to text. PARENT: CFG_RULE_SET, BASE USES: nothing CAVEATS: NOTES: HISTORY: DavidHov 10/1/91 Created **************************************************************************/ const int PARSE_SUCCESSFUL = 1 ; const int PARSE_INCOMPLETE = 0 ; const int PARSE_ERR_UNBAL_PAREN = -1 ; const int PARSE_ERR_BAD_TOKEN = -2 ; const int PARSE_ERR_NO_MEMORY = -3 ; const int PARSE_CLOSE_LEVEL = -4 ; const int PARSE_CTL_FULL_SYNTAX = 1 ; // Full syntax allowed const int PARSE_CTL_RSP_SYNTAX = 2 ; // Special query response syntax class CFG_RULE_SET : public CFG_RULE_NODE, public BASE { private: const TCHAR * _pszData ; const TCHAR * _pszNext ; const TCHAR * _pszTok ; USHORT _usParseCtl ; int _iParseResult ; ULONG _ulLength ; int NextChar () ; int PeekChar () { return *_pszNext ; } // Return the next token from the string. // Store the token into "pszStr"; max length is "cbStr". int NextToken ( TCHAR * pszStr, int cbStr ) ; BOOL ParseLevel ( CFG_RULE_NODE * pcrn, int level ) ; // Recursive helper routine for INF-to-SP conversion INT ConvertInfList ( const TCHAR * * ppszIn, TCHAR * * ppszOut, INT cLevel ) ; INT TextifyInfList ( TEXT_BUFFER * ptxbBuff, CFG_RULE_NODE * pcrnList, INT cLevel, INT cBaseLevel ) ; public: CFG_RULE_SET () ; ~ CFG_RULE_SET () ; // Convert to/from text strings APIERR Parse ( const TCHAR * pszText, USHORT usParseCtl ) ; APIERR Textify ( TEXT_BUFFER * ptxbBuff ) ; // Convert to/from INF-style lists APIERR ParseInfList ( const TCHAR * pszText ) ; APIERR TextifyInf ( TEXT_BUFFER * ptxBuff, INT cLevel = 0 ) ; int ParseResult () { return _iParseResult ; } const TCHAR * LastToken () { return _pszTok ; } }; #endif /* _RULE_HXX_ */
eaf43bc1787b389b5da5dfb61e3c24d0065434a5
12c82ceba45d5508cff2e4f152563435873f2b8b
/longest_increasing_path_in_matrix.cpp
24c5ca59cd9c966ae81a7d1ef4b0b90d498ddc68
[]
no_license
Web-Dev-Collaborative/leetcode-solutions
45d50ff92f4c96cf59d5407a8a2bed7405383430
b46d09c665d4a89322a32916ebc76c15565616bf
refs/heads/master
2023-04-03T17:22:53.180100
2021-03-29T21:15:55
2021-03-29T21:15:55
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,245
cpp
class Solution { public: int result; int findLength(vector<vector<int>>& arr,vector<vector<int>>& dp,int i,int j,int prev){ int n = arr.size(); int m = arr[0].size(); //check if i and j are valid (in range) and this value is greater than prev value if(i<0 || j<0 || i>=n || j>=m || arr[i][j]<=prev) return -1; //already computed if(dp[i][j]!=-1) return dp[i][j]; int ans=1; //recur for neighbours ans = max(ans,findLength(arr,dp,i-1,j,arr[i][j])+1); ans = max(ans,findLength(arr,dp,i+1,j,arr[i][j])+1); ans = max(ans,findLength(arr,dp,i,j-1,arr[i][j])+1); ans = max(ans,findLength(arr,dp,i,j+1,arr[i][j])+1); dp[i][j]=ans; //update overall result result = max(result,ans); return ans; } int longestIncreasingPath(vector<vector<int>>& arr) { int n = arr.size(); if(n==0)return 0; int m = arr[0].size(); result = INT_MIN; vector<vector<int>>dp(n,vector<int>(m,-1)); for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ findLength(arr,dp,i,j,INT_MIN); } } return result; } };
dc00e9eab24de1da6de1979edd82a1a275f0d2c7
64de8c9292e7efa94398ffd34175cfe5dab57d56
/examples/examples9.cpp
1f9b06428b7fa34516bd23eff15e43da00f80989
[ "MIT" ]
permissive
idfumg/xml11
d2a2290e4875e4f2ff1118198de65f37e6d2d711
497db02b140e1118871b654be8904ca84e6fb434
refs/heads/master
2022-06-10T21:56:46.348011
2022-04-30T17:55:11
2022-04-30T17:55:11
84,711,600
5
1
null
null
null
null
UTF-8
C++
false
false
776
cpp
#include "../xml11/xml11.hpp" using namespace xml11; using namespace xml11::literals; int main() { const auto root = Node{ "root", { {"Employers", { {"Employer", { {"name", "1"}, {"surname", "2"}, {"patronym", "3"} }}, {"Employer", { {"name", "1"}, {"surname", "2"}, {"patronym", "3"} }}, {"Employer", { {"name", "1"}, {"surname", "2"}, {"patronym", "3"} }} }} } }; std::cout << root("Employers")["Employer"].size() << std::endl; return 0; }
55338dbaad7f2e4ee56abb0d85f2928eec1d1294
293e71df512e720032371dc7b9dca51a7ca8d5f6
/Source/MainComponent.cpp
5efedd2b4d3dd10a63dc2b9a8c068c3c0f65f466
[]
no_license
venkatarajasekhar/SoniColor
feca44f0808138d15ba466325429d356ce661592
96defba7489b3f3616cd76f604f2449fb78cac68
refs/heads/master
2021-01-12T09:47:13.555747
2016-12-08T09:09:43
2016-12-08T09:09:43
null
0
0
null
null
null
null
UTF-8
C++
false
false
7,854
cpp
#ifndef MAINCOMPONENT_INCLUDED #define MAINCOMPONENT_INCLUDED #include "../JuceLibraryCode/JuceHeader.h" struct MainContentComponent : public AudioAppComponent, public Timer, public Slider::Listener, public Button::Listener { MainContentComponent() { sensitivity = 12; smoothing = 6; addAndMakeVisible(settingsPanel); colourPanel.addMouseListener(this, false); addAndMakeVisible(colourPanel); settingsButton.addListener(this); colourPanel.addAndMakeVisible(settingsButton); settingsPanel.sensitivitySlider.setValue(sensitivity); settingsPanel.sensitivitySlider.addListener(this); settingsPanel.smoothingSlider.setValue(smoothing); settingsPanel.smoothingSlider.addListener(this); screenSize = Desktop::getInstance().getDisplays().getMainDisplay().userArea; setSize (screenSize.getWidth(), screenSize.getHeight()); setAudioChannels (1, 0); } ~MainContentComponent() { shutdownAudio(); } void prepareToPlay (int samplesPerBlockExpected, double sampleRate) override { startTimer(1000/30); } void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill) override { lastrms = rms; rms = bufferToFill.buffer->getRMSLevel(0, bufferToFill.startSample, bufferToFill.numSamples); } void releaseResources() override { stopTimer(); lastrms = rms = 0; } void mouseDown(const MouseEvent& e) override { if (settingsOpen) { settingsOpen = false; triggerAnimation(); } } void paint (Graphics& g) override { g.fillAll(Colours::black); } void resized() override { int w = screenSize.getWidth(); int h = screenSize.getHeight(); settingsPanel.setBounds(0, 0, (w * 2) / 3, h); settingsButton.setBounds(w/23, w/23, (h/18) / 1.2, h/18); colourPanel.setBounds(0, 0, w, h); animationStartPoint = colourPanel.getBounds(); animationEndPoint = colourPanel.getBounds().translated((w * 2)/3, 0); } void sliderValueChanged(Slider* s) override { if (s == &settingsPanel.sensitivitySlider) { sensitivity = s->getValue(); } else if (s == &settingsPanel.smoothingSlider) { smoothing = s->getValue(); } } void buttonClicked(Button* b) override { settingsOpen = (settingsOpen) ? false : true; triggerAnimation(); } void triggerAnimation() { if (settingsOpen) { animator.animateComponent(&colourPanel, animationEndPoint, 1.0, 200, false, 0, 1); } else { animator.animateComponent(&colourPanel, animationStartPoint, 1.0, 200, false, 0, 1); } } void timerCallback() override { if (!animator.isAnimating() && !settingsOpen) { settingsPanel.setVisible(false); } else { if (!settingsPanel.isVisible()) { settingsPanel.setVisible(true); settingsPanel.toBack(); } } if (std::abs(rms - lastrms) > 0.001) { targetColour = expm1f((rms + lastrms) / 2) * (sensitivity/smoothing); } if (currentColour < targetColour) { currentColour += std::abs(currentColour - targetColour) / smoothing; } else { currentColour -= std::abs(currentColour - targetColour) / smoothing; } if (std::abs(rms - lastrms) > 0.001) { colourPanel.displayColour = Colour(minColour.interpolatedWith(maxColour, currentColour)); colourPanel.repaint(); } } struct SettingsButton : public Button { SettingsButton() : Button("Settings") {}; void paintButton(Graphics& g, bool isMouseOverButton, bool isButtonDown) override { int w = getWidth(); int h = getHeight(); g.setColour(Colours::white.withAlpha((uint8) 64)); for (int i = 0; i < 3; i++) g.fillRoundedRectangle(0, ((h/3) - 1) * i, w, h/6, h/12); } }; struct SettingsPanel : public Component { SettingsPanel() { sensitivitySlider.setRange(1, 18); sensitivitySlider.setTextBoxStyle(Slider::NoTextBox, true, 0, 0); addAndMakeVisible(sensitivitySlider); smoothingSlider.setRange(1, 12); smoothingSlider.setTextBoxStyle(Slider::NoTextBox, true, 0, 0); addAndMakeVisible(smoothingSlider); } void paint(Graphics& g) override { int w = getWidth(); int h = getHeight(); g.fillAll(Colours::darkgrey); g.setColour(Colours::grey); g.setFont(h/24); g.drawFittedText( "Settings", 0, 10, w, h/24, Justification::centred, 1 ); g.setFont(h/48); g.drawFittedText( "Sensitivity", sensitivitySlider.getX(), sensitivitySlider.getY(), sensitivitySlider.getWidth(), h/48, Justification::centred, 1 ); g.drawFittedText( "Smoothing", smoothingSlider.getX(), smoothingSlider.getY(), smoothingSlider.getWidth(), h/48, Justification::centred, 1 ); } void resized() override { int w = getWidth(); int h = getHeight(); std::vector<Component*> components = { &sensitivitySlider, &smoothingSlider }; for (int i = 0; i < components.size(); ++i) components[i]->setBounds(10, ((h/8) * i) + (i * h/16) + h/8, w - 20, h/8); } Slider sensitivitySlider; Slider smoothingSlider; }; struct ColourPanel : public Component { void paint(Graphics& g) override { g.setColour(displayColour); g.fillAll(); } Colour displayColour = Colours::black; }; float rms, lastrms, targetColour, currentColour, sensitivity, smoothing; bool settingsOpen = false; Colour minColour = Colour(74, 168, 219); Colour maxColour = Colour(227, 109, 80); SettingsButton settingsButton; SettingsPanel settingsPanel; ColourPanel colourPanel; ComponentAnimator animator; Rectangle<int> animationStartPoint; Rectangle<int> animationEndPoint; Rectangle<int> screenSize; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MainContentComponent) }; Component* createMainContentComponent() { return new MainContentComponent(); } #endif // MAINCOMPONENT_INCLUDED
6f8b85458f8e5c8b662784b0640c3564b420a778
68cce658c5848d9c5838fbe8e4b0c66431715f83
/KaratsubaMultiplication/main.cpp
70c5db39d521de9b34eeda921d482a52ab2707d1
[]
no_license
a1774281/UndergraduateCode
fc35cab36fff761b96db63772da11477ffbd5ef0
8ac94da857dd5e53c168e23462200ccb67ed4eab
refs/heads/master
2023-06-22T13:49:24.506537
2020-09-03T13:31:45
2020-09-03T13:31:45
191,682,108
0
0
null
null
null
null
UTF-8
C++
false
false
9,689
cpp
//Code written by (a1771235) and (a1774281) /*IF YOURE AN ADELAIDE UNI STUDENT, NO MATTER HOW MUCH YOU CHANGE VARIABLES OR FLOW OF CODE, YOULL GET HIT BY PLAGARISM DETECTION, SEE README.txt FOR HELP*/ /*Code created to demonstrate Karatsuba Multiplication with numbers up to and exceeding 100 digits of any base between 2-10 using string manipulation Code takes three numbers as input seperated by spaces, the first two represent numbers to be added and multiplied the third being the base being used. Output is sum of numbers by school addition followed by product of numbers by karatsuba multiplication*/ #include <iostream> #include <string> #include <sstream> #include <tgmath.h> #include <bits/stdc++.h> using namespace std; string SchoolAddition(string num1, string num2, string base); string SchoolSubtraction(string num1, string num2, string base); string SchoolMultiplication(string num1, string num2, string base); string MakeStringsEqual(string num1, string num2, int exit); string KaratsubaMultiplication(string num1, string num2, string base); string ShiftToLeft(string str, int numOfShifts); int main(){ //Parse input into three strings for each number and the base string str1, str2, base, inpLine; getline(cin, inpLine); istringstream iss(inpLine); iss >> str1 >> str2 >> base; cout << SchoolAddition(str1, str2, base) << " "<< KaratsubaMultiplication(str1, str2, base) << endl; } //Takes both strings and recursively (cause fun to learn to use) //to add leading zeroes to make both numbers of equal length //Note:Kindof self explanatory with some messy and unneeded recursion string MakeStringsEqual(string num1, string num2, int exit){ int num1len = num1.length(); int num2len = num2.length(); if (num1len > num2len && exit == 0){ return MakeStringsEqual(num1, num2, 1); } else if (num1len < num2len && exit == 0){ return MakeStringsEqual(num1, num2, 2); } else { while (num1len > num2len){ num2 = '0' + num2; return MakeStringsEqual(num1, num2, 1); } while (num1len < num2len){ num1 = '0' + num1; return MakeStringsEqual(num1, num2, 2); } if (num1len == num2len && exit == 1){ return num2; } else if (num1len == num2len && exit == 2){ return num1; } } return 0; } //Takes number and shifts number to the left by the number of shifts string ShiftToLeft(string str, int numOfShifts){ for (int i = 0; i < numOfShifts; i++){ str += '0'; } return str; } string KaratsubaMultiplication(string num1, string num2, string base){ int num1len = num1.length(); int num2len = num2.length(); //Makes strings equal length if (num1len > num2len){ num2 = MakeStringsEqual(num1, num2, 0); } else if (num1len < num2len) { num1 = MakeStringsEqual(num1, num2, 0); } //Recheck strings lengths num1len = num1.length(); num2len = num2.length(); //Finding position of string substrings int p0size = num1len/2; int p2size = num1len - (num1len/2); //Creates string substrings string a0 = num1.substr(0, p0size); string a1 = num1.substr(p0size, p2size); string b0 = num2.substr(0, p0size); string b1 = num2.substr(p0size, p2size); //Karatsuba Multiplication (Compute three Products) string P0 = SchoolMultiplication(a0, b0, base); //P0=a0·b0 string P1 = SchoolMultiplication(SchoolAddition(a0, a1, base), SchoolAddition(b0, b1, base), base); //P1=(a1+a0)·(b1+b0) string P2 = SchoolMultiplication(a1, b1, base); //P2=a1·b1 //Add aligned products to obtain results string answer = SchoolAddition(SchoolAddition(ShiftToLeft(P0, 2*p2size), P2, base),ShiftToLeft(SchoolSubtraction(P1, SchoolAddition(P0, P2, base), base), p2size), base); //(P0+P2)+(P1-(P0+P2)) (Bases also present with ShiftToLeft) //removes/ignores zeros at beginning of string (Messy and added last second) string result; int i = 0, anslen = answer.length(); if (answer[i] == '0'){ while (answer[i] == '0'){ i++; } for (int j = i; j < anslen; j++){ result += answer[j]; } } else { return answer; } return result; } //Takes both strings and finds their sum using School Addition //and storing in a result string, //Note: Accepts any base between 2-10 string SchoolAddition(string num1, string num2, string base){ //Base to integer int baseInt = stoi(base); //Variables //Find length of string int num1len = num1.length(); int num2len = num2.length(); //return variables string tempStr; string result; //IF num1 is larger than num2, switch their values if(num1len > num2len){ tempStr = num1; num1 = num2; num2 = tempStr; } //Clears tempString and resets lengths tempStr.clear(); //Find length num1len = num1.length(); num2len = num2.length(); //Reverses Strings for (int i = num1len - 1; i >= 0; i--) { //append result to tempStr tempStr += num1[i]; } num1=tempStr; //Clears tempString and resets lengths tempStr.clear(); for (int i = num2len - 1; i >= 0; i--) { tempStr += num2[i]; } num2 = tempStr; //Clears tempString and resets lengths tempStr.clear(); //School Method of Addition (Compute sum of current digits and carry) int carry = 0; for (int i = 0; i < num1len; i++){ int sum = ((num1[i] - '0') + (num2[i] - '0') + carry); result.push_back(sum % baseInt + '0'); // Calculate carry carry = sum / baseInt; } //Add remaining digits of larger number for (int i = num1len; i < num2len; i++){ int sum = ((num2[i] - '0') + carry); result.push_back(sum % baseInt + '0'); carry = sum / baseInt; } // Add carry if(carry){ result.push_back(carry + '0'); } //Reverse String for (int i = result.length() - 1; i >= 0; i--) { tempStr += result[i]; } result = tempStr; return result; } //Takes both strings and finds their difference using School Subtraction //and storing in a result string //Note: Accepts any base between 2-10 string SchoolSubtraction(string num1, string num2, string base){ //convert string to int int baseInt = stoi(base); //calculates string length int num1len = num1.length(); int num2len = num2.length(); //return variables string tempstr; string result; //IF num2 is larger than num1, switch their values if(num1len < num2len){ tempstr = num1; num1 = num2; num2 = tempstr; } //Create empty string //Clears tempstring and resets lengths tempstr.clear(); num1len = num1.length(); num2len = num2.length(); //Reverses Strings //Loops the result backwards and appends. for (int i = num1len - 1; i >= 0; i--) { tempstr += num1[i]; } num1=tempstr; //Clears tempstring and resets lengths tempstr.clear(); //Loops the result backwards and appends. for (int i = num2len - 1; i >= 0; i--) { tempstr += num2[i]; } num2 = tempstr; //Clears tempstring and resets lengths tempstr.clear(); int carry = 0; for (int i = 0; i < num2len; i++){ //school subtraction int subtract = ((num1[i]-'0')-(num2[i]-'0')-carry); //If subtraction less than 0, add baseInt if (subtract < 0){ subtract += baseInt; carry = 1; } else carry = 0; tempstr.push_back(subtract + '0'); } // subtract digits of num2 for (int i=num2len; i<num1len; i++){ int subtract = ((num1[i]-'0') - carry); // if value is a negative make it positive if (subtract < 0) { subtract += baseInt; carry = 1; } else carry = 0; //Adds a new element at the end of the vector tempstr.push_back(subtract + '0'); } //Loops the result backwards and appends to result; for (int i = tempstr.length() - 1; i >= 0; i--) { result += tempstr[i]; } return result; } //Takes both strings and finds their product using School Multiplication //and storing in a result vector, before returning answer as int //Note: Accepts any base between 2-10 string SchoolMultiplication(string num1, string num2, string base){ int num1Size = num1.size(), num2Size = num2.size(); //convert string into an int int baseInt = stoi(base); //Store result into vector in reverse vector<int> result(num1Size+num2Size, 0); int tempInt1 = 0, tempInt2 = 0; //loop from right to left for (int i=num1Size-1; i>=0; i--) { int carry = 0; int tn1 = num1[i] - '0'; //switches position to the left after every multiplication for num2 tempInt2 = 0; for (int j=num2Size-1; j>=0; j--) { int tn2= num2[j] - '0'; //Multiplies current number and adds it to result int sum = tn1*tn2 + result[tempInt1 + tempInt2] + carry; carry = sum/baseInt; result[tempInt1 + tempInt2] = sum % baseInt; //determines position of next mulitplication of num2 tempInt2++; } if (carry > 0){ result[tempInt1 + tempInt2] += carry; } tempInt1++; } //removes/ignores zeros at beginning of string int i = result.size() - 1; while (i>=0 && result[i] == 0){ i--; } string str; //increments to str while (i >= 0){ str += to_string(result[i--]); } return str; }
ff1fbe47270c06b7fcc03462bae382ade619378a
058355106fcf57b746afc5e9979281477c8bd34c
/.history/113.path-sum-ii_20200901160318.cpp
096c4789cd85ee3126568a70492962a709ec6bd2
[]
no_license
Subzero-10/leetcode
ff24f133f984b86eac686ed9b9cccbefb15c9dd8
701ec3dd4020970ecb55734de0355c8666849578
refs/heads/master
2022-12-24T19:03:16.482923
2020-10-11T09:25:29
2020-10-11T09:25:29
291,388,415
0
0
null
null
null
null
UTF-8
C++
false
false
1,653
cpp
/* * @lc app=leetcode id=113 lang=cpp * * [113] Path Sum II */ // @lc code=start /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode() : val(0), left(nullptr), right(nullptr) {} * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} * }; */ class Solution { public: vector<vector<int>> pathSum(TreeNode* root, int sum) { return helper(root, sum, 0); } vector<vector<int>> helper(TreeNode* root, int sum, int nowsum){ vector<vector<int>> output; if (root == NULL) { return output; } nowsum += root->val; if (root->left == NULL && root->right== NULL) { if (sum == nowsum) { vector<int> tem(1,root->val); output.push_back(tem); } return output; } vector<vector<int>> outputleft(helper(root->left, sum, nowsum)); vector<vector<int>> outputright(helper(root->right, sum, nowsum)); vector<vector<int>>::iterator it; for (it = outputleft.begin(); it != outputleft.end(); it++) { vector<int> tem(*it); tem.push_back(root->val); output.push_back(tem); } for (it = outputright.begin(); it != outputright.end(); it++) { vector<int> tem(*it); tem.push_back(root->val); output.push_back(tem); } return output; } }; // @lc code=end
b57c6732f8edf23a6635715db3c48d2b19ad11e6
e8c7eb191e9e317b33e90922ca0db9721f495e76
/Week3/covering_segments.cpp
c79ef35ec5e7cd5c3c0a359cd3ba5b0d1e11ab72
[]
no_license
AymanM92/Algorithms_ToolBox_Coursera_Cpp
77bb47c77386cb218be226ffb6ba40287040af7c
947f07a496accd926d045d3465fd41e1f583cc6f
refs/heads/master
2020-03-10T19:13:25.449483
2018-06-12T17:02:37
2018-06-12T17:02:37
129,543,515
0
0
null
null
null
null
UTF-8
C++
false
false
6,872
cpp
#include <algorithm> #include <iostream> #include <climits> #include <vector> #include "stdint.h" using std::vector; struct Segment { int start, end; }; /* 5 1 3 2 5 3 6 7 8 8 9 */ /* Function for the sort SDL to sort by the start address, */ //bool compare(const Segment& lhs, const Segment& rhs) { return lhs.end < rhs.end; } vector<int> optimal_points(vector<Segment> &segments) { vector<int> points; std::sort(segments.begin(), segments.end(), [](const Segment &a, const Segment &b) -> bool { return a.end < b.end; }); int point = segments[0].end; // std::cout << " Print the output of the search " << std::endl; // for(int i=0 ; i< segments.size() ; i++) // { // std::cout << segments[i].start <<" "<< segments[i].end << std::endl; // } //std::cout << std::endl; //std::cout << std::endl; for (size_t i = 1; i < segments.size(); ++i) { //std::cout <<"Segment of i="<<i<<" "<< segments[i].start <<" "<< segments[i].end << std::endl; //std::cout <<"point of comparison = "<<point<< std::endl; if (point < segments[i].start ) { points.push_back(point); point = segments[i].end; } if( (i == (segments.size()-1))) { points.push_back(point); } } return points; } ///* //Segment FindIntersection(Segment FirstSegment,Segment SecondSegment) /*First 4,7 Second 5,6 */ //{ // //std::cout << "First Segment start = " << FirstSegment.start << " end = " << FirstSegment.end << std::endl; // //std::cout << "Second Segment start = " << SecondSegment.start << " end = " << SecondSegment.end << std::endl; // Segment Intersection; // if( (FirstSegment.start <= SecondSegment.start) && (FirstSegment.end >= SecondSegment.start) && (FirstSegment.end < SecondSegment.end) ) /* ///\\\ */ // { // //std::cout << "This is and Intersection ---++||||" << std::endl; // Intersection.start = SecondSegment.start; // Intersection.end = FirstSegment.end; // } // else if( (FirstSegment.start <= SecondSegment.start) && (FirstSegment.end > SecondSegment.start) && (FirstSegment.end > SecondSegment.end) ) /* ////XXXXXX//// */ // { // //std::cout << "This is and Intersection ---++++----" << std::endl; // Intersection.start = SecondSegment.start; // Intersection.end = SecondSegment.end; // } // else // { // //std::cout << "This is no Intersection" << std::endl; // Intersection.start = 0; // Intersection.end = 0; // } // return Intersection; //} // //vector<int> optimal_points(vector<Segment> &segments) // { // vector<int> points; // Segment Intersections , segments_intersections , LastIntersections; // uint16_t j = 1; // uint16_t i = 0; // uint16_t LastPush = 0; // bool LastWasIntersection , CurrentIsNotIntersection , LastTime = 0; // //write your code here // //std::cout << segments.size() << std::endl; // Intersections.start = 0; // Intersections.end = 0; // std::sort(segments.begin() ,segments.end() ,compare); // // segments_intersections = segments[0]; //// std::cout <<"Sorted Array Printing:"<<std::endl; //// for (size_t i = 0; i < segments.size(); ++i) //// { //// std::cout << segments[i].start <<std::endl; //// } //// std::cout <<std::endl; //// std::cout <<std::endl; //// std::cout <<std::endl; // // while( j < segments.size() ) // { // //std::cout <<"Entered the While Loop "<<" i = " << i << " " << "j = " << j <<std::endl; // Intersections = FindIntersection(segments_intersections,segments[j]); // //std::cout <<" i = " << i << " " << "j = " << j <<" intersection in each while loop = " << Intersections.start << " " << Intersections.end <<std::endl; // //std::cout <<"The output of FindIntersection function is = "<< Intersections.start << " " << Intersections.end <<std::endl; // // if( (0 == Intersections.start) && (0 == Intersections.end) ) // { // LastWasIntersection = 0; // CurrentIsNotIntersection = 1; // LastIntersections = segments_intersections; // if(j == (segments.size()-1)) // { // i = j-1; // LastTime = 1; // } // { // i = j; // j = i+1; // } // segments_intersections = segments[i]; // } // else // { // if(j == (segments.size()-1)) // { // LastTime = 1; // } // //Intersections = FindIntersection(Intersections,segments[j]); // segments_intersections = Intersections; // LastIntersections = segments_intersections; // LastWasIntersection = 1; // CurrentIsNotIntersection = 0; // j++; // } // // // if( (1 == LastWasIntersection) && (1 == CurrentIsNotIntersection) ) /*This time has no intersection and the one before has intersection*/ // { // if( LastPush != LastIntersections.end) // { // points.push_back(LastIntersections.end); // LastPush = LastIntersections.end; // } // //std::cout << "This time has no intersection and the one before has intersection " << "LastWasIntersection = " << LastWasIntersection << " CurrentIsNotIntersection = " << CurrentIsNotIntersection <<" i = " << i << " " << "j = " << j <<" intersection in each while loop = " << LastIntersections.start << " " << LastIntersections.end <<std::endl; // } // else if( (0 == LastWasIntersection) && (1 == CurrentIsNotIntersection) ) /*The last one was not intersection and this also*/ // { // if( LastPush != LastIntersections.end) // { // points.push_back(LastIntersections.end); // LastPush = LastIntersections.end; // } // //std::cout << "The last one was not intersection and this also " << "LastWasIntersection = " << LastWasIntersection << " CurrentIsNotIntersection = " << CurrentIsNotIntersection <<" i = " << i << " " << "j = " << j <<" intersection in each while loop = " << LastIntersections.start << " " << LastIntersections.end <<std::endl; // } // else if( (1 == LastWasIntersection) && (1 == LastTime) && (0 == CurrentIsNotIntersection) ) /*This is the last time has intersection and the one before has intersection*/ // { // if( LastPush != LastIntersections.end) // { // points.push_back(LastIntersections.end); // LastPush = LastIntersections.end; // } // //std::cout << "This is the last time has intersection and the one before has intersection " << "LastWasIntersection = " << LastWasIntersection << " CurrentIsNotIntersection = " << CurrentIsNotIntersection <<" i = " << i << " " << "j = " << j <<" intersection in each while loop = " << LastIntersections.start << " " << LastIntersections.end <<std::endl; // } // } // // // for (size_t i = 0; i < segments.size(); ++i) { // // points.push_back(segments[i].start); // // points.push_back(segments[i].end); // // } // return points; // } int main() { int n; std::cin >> n; vector<Segment> segments(n); for (size_t i = 0; i < segments.size(); ++i) { std::cin >> segments[i].start >> segments[i].end; } vector<int> points = optimal_points(segments); std::cout << points.size() << "\n"; for (size_t i = 0; i < points.size(); ++i) { std::cout << points[i] << " "; } } /* */
06d55ee75778565ea8fa1c7aac110191ee3009dd
168d6508cb54264e162f3abfdca87318feed061f
/Vjezbe_7/Analyzer.h
cb22b950646f27a4a02e0b25a65fd9e0eb9b8e11
[]
no_license
nlovric/DAHEP
6b7c7f26df79f393c4cdbf69b01053e785fbadcf
d6185a20de3e3592ccb12ae13cec85aa2f8c520d
refs/heads/master
2021-07-09T13:05:20.509081
2020-11-17T09:51:13
2020-11-17T09:51:13
214,362,191
0
0
null
null
null
null
UTF-8
C++
false
false
163,420
h
////////////////////////////////////////////////////////// // This class has been automatically generated on // Tue Nov 5 10:13:23 2019 by ROOT version 6.18/04 // from TTree candTree/Event Summary // found on file: /home/public/data/ggH125/ZZ4lAnalysis.root ////////////////////////////////////////////////////////// #ifndef Analyzer_h #define Analyzer_h #include <TROOT.h> #include <TChain.h> #include <TFile.h> #include <TLegend.h> #include <TH1F.h> #include <TH2F.h> #include <TH1.h> #include <TH2.h> #include <TLorentzVector.h> #include <TStyle.h> #include <TCanvas.h> #include <TString.h> #include <THStack.h> #include <TGraph.h> // Header file for the classes stored in the TTree if any. #include <vector> #include<string> #include <iostream> #include<fstream> using namespace std; class Analyzer { public : TTree *fChain; //!pointer to the analyzed TTree or TChain Int_t fCurrent; //!current Tree number in a TChain // Fixed size dimensions of array or collections stored in the TTree if any. // Declaration of leaf types Int_t RunNumber; Long64_t EventNumber; Int_t LumiNumber; Short_t NRecoMu; Short_t NRecoEle; Short_t Nvtx; Short_t NObsInt; Float_t NTrueInt; Float_t GenMET; Float_t GenMETPhi; Float_t PFMET; Float_t PFMET_jesUp; Float_t PFMET_jesDn; Float_t PFMETPhi; Float_t PFMETPhi_jesUp; Float_t PFMETPhi_jesDn; Float_t PFMET_corrected; Float_t PFMET_corrected_jesUp; Float_t PFMET_corrected_jesDn; Float_t PFMET_corrected_jerUp; Float_t PFMET_corrected_jerDn; Float_t PFMET_corrected_puUp; Float_t PFMET_corrected_puDn; Float_t PFMET_corrected_metUp; Float_t PFMET_corrected_metDn; Float_t PFMETPhi_corrected; Float_t PFMETPhi_corrected_jesUp; Float_t PFMETPhi_corrected_jesDn; Float_t PFMETPhi_corrected_jerUp; Float_t PFMETPhi_corrected_jerDn; Float_t PFMETPhi_corrected_puUp; Float_t PFMETPhi_corrected_puDn; Float_t PFMETPhi_corrected_metUp; Float_t PFMETPhi_corrected_metDn; Short_t nCleanedJets; Short_t nCleanedJetsPt30; Short_t nCleanedJetsPt30_jecUp; Short_t nCleanedJetsPt30_jecDn; Short_t nCleanedJetsPt30BTagged; Short_t nCleanedJetsPt30BTagged_bTagSF; Short_t nCleanedJetsPt30BTagged_bTagSF_jecUp; Short_t nCleanedJetsPt30BTagged_bTagSF_jecDn; Short_t nCleanedJetsPt30BTagged_bTagSFUp; Short_t nCleanedJetsPt30BTagged_bTagSFDn; Short_t trigWord; Short_t evtPassMETFilter; Float_t ZZMass; Float_t ZZMassErr; Float_t ZZMassErrCorr; Float_t ZZMassPreFSR; Short_t ZZsel; Float_t ZZPt; Float_t ZZEta; Float_t ZZPhi; Float_t ZZjjPt; Int_t CRflag; Float_t Z1Mass; Float_t Z1Pt; Short_t Z1Flav; Float_t ZZMassRefit; Float_t ZZMassRefitErr; Float_t ZZMassUnrefitErr; Float_t Z2Mass; Float_t Z2Pt; Short_t Z2Flav; Float_t costhetastar; Float_t helphi; Float_t helcosthetaZ1; Float_t helcosthetaZ2; Float_t phistarZ1; Float_t phistarZ2; Float_t xi; Float_t xistar; vector<float> *LepPt; vector<float> *LepEta; vector<float> *LepPhi; vector<short> *LepLepId; vector<float> *LepSIP; vector<float> *Lepdxy; vector<float> *Lepdz; vector<float> *LepTime; vector<bool> *LepisID; vector<short> *LepisLoose; vector<float> *LepBDT; vector<char> *LepMissingHit; vector<float> *LepChargedHadIso; vector<float> *LepNeutralHadIso; vector<float> *LepPhotonIso; vector<float> *LepPUIsoComponent; vector<float> *LepCombRelIsoPF; vector<float> *LepRecoSF; vector<float> *LepRecoSF_Unc; vector<float> *LepSelSF; vector<float> *LepSelSF_Unc; vector<float> *LepScale_Total_Up; vector<float> *LepScale_Total_Dn; vector<float> *LepScale_Stat_Up; vector<float> *LepScale_Stat_Dn; vector<float> *LepScale_Syst_Up; vector<float> *LepScale_Syst_Dn; vector<float> *LepScale_Gain_Up; vector<float> *LepScale_Gain_Dn; vector<float> *LepSigma_Total_Up; vector<float> *LepSigma_Total_Dn; vector<float> *LepSigma_Rho_Up; vector<float> *LepSigma_Rho_Dn; vector<float> *LepSigma_Phi_Up; vector<float> *LepSigma_Phi_Dn; vector<float> *fsrPt; vector<float> *fsrEta; vector<float> *fsrPhi; vector<short> *fsrLept; Bool_t passIsoPreFSR; vector<float> *JetPt; vector<float> *JetEta; vector<float> *JetPhi; vector<float> *JetMass; vector<float> *JetBTagger; vector<float> *JetIsBtagged; vector<float> *JetIsBtaggedWithSF; vector<float> *JetIsBtaggedWithSFUp; vector<float> *JetIsBtaggedWithSFDn; vector<float> *JetQGLikelihood; vector<float> *JetAxis2; vector<float> *JetMult; vector<float> *JetPtD; vector<float> *JetSigma; vector<short> *JetHadronFlavour; vector<short> *JetPartonFlavour; vector<float> *JetRawPt; vector<float> *JetPtJEC_noJER; vector<float> *JetJERUp; vector<float> *JetJERDown; vector<short> *JetID; vector<short> *JetPUID; vector<float> *JetPUValue; Float_t DiJetMass; Float_t DiJetDEta; Float_t DiJetFisher; vector<float> *PhotonPt; vector<float> *PhotonEta; vector<float> *PhotonPhi; vector<bool> *PhotonIsCutBasedLooseID; Short_t nExtraLep; Short_t nExtraZ; vector<float> *ExtraLepPt; vector<float> *ExtraLepEta; vector<float> *ExtraLepPhi; vector<short> *ExtraLepLepId; Float_t ZXFakeweight; Float_t KFactor_QCD_ggZZ_Nominal; Float_t KFactor_QCD_ggZZ_PDFScaleDn; Float_t KFactor_QCD_ggZZ_PDFScaleUp; Float_t KFactor_QCD_ggZZ_QCDScaleDn; Float_t KFactor_QCD_ggZZ_QCDScaleUp; Float_t KFactor_QCD_ggZZ_AsDn; Float_t KFactor_QCD_ggZZ_AsUp; Float_t KFactor_QCD_ggZZ_PDFReplicaDn; Float_t KFactor_QCD_ggZZ_PDFReplicaUp; Short_t genFinalState; Int_t genProcessId; Float_t genHEPMCweight; Float_t genHEPMCweight_POWHEGonly; Float_t PUWeight; Float_t PUWeight_Dn; Float_t PUWeight_Up; Float_t dataMCWeight; Float_t muonSF_Unc; Float_t eleSF_Unc; Float_t trigEffWeight; Float_t overallEventWeight; Float_t L1prefiringWeight; Float_t L1prefiringWeightUp; Float_t L1prefiringWeightDn; Float_t HqTMCweight; Float_t xsec; Float_t genxsec; Float_t genBR; Short_t genExtInfo; Float_t GenHMass; Float_t GenHPt; Float_t GenHRapidity; Float_t GenZ1Mass; Float_t GenZ1Pt; Float_t GenZ1Phi; Float_t GenZ1Flav; Float_t GenZ2Mass; Float_t GenZ2Pt; Float_t GenZ2Phi; Float_t GenZ2Flav; Float_t GenLep1Pt; Float_t GenLep1Eta; Float_t GenLep1Phi; Short_t GenLep1Id; Float_t GenLep2Pt; Float_t GenLep2Eta; Float_t GenLep2Phi; Short_t GenLep2Id; Float_t GenLep3Pt; Float_t GenLep3Eta; Float_t GenLep3Phi; Short_t GenLep3Id; Float_t GenLep4Pt; Float_t GenLep4Eta; Float_t GenLep4Phi; Short_t GenLep4Id; Float_t GenAssocLep1Pt; Float_t GenAssocLep1Eta; Float_t GenAssocLep1Phi; Short_t GenAssocLep1Id; Float_t GenAssocLep2Pt; Float_t GenAssocLep2Eta; Float_t GenAssocLep2Phi; Short_t GenAssocLep2Id; Int_t htxs_errorCode; Int_t htxs_prodMode; Int_t htxsNJets; Float_t htxsHPt; Int_t htxs_stage0_cat; Int_t htxs_stage1_cat; Float_t ggH_NNLOPS_weight; Float_t ggH_NNLOPS_weight_unc; vector<float> *qcd_ggF_uncertSF; vector<float> *LHEMotherPz; vector<float> *LHEMotherE; vector<short> *LHEMotherId; vector<float> *LHEDaughterPt; vector<float> *LHEDaughterEta; vector<float> *LHEDaughterPhi; vector<float> *LHEDaughterMass; vector<short> *LHEDaughterId; vector<float> *LHEAssociatedParticlePt; vector<float> *LHEAssociatedParticleEta; vector<float> *LHEAssociatedParticlePhi; vector<float> *LHEAssociatedParticleMass; vector<short> *LHEAssociatedParticleId; Float_t LHEPDFScale; Float_t LHEweight_QCDscale_muR1_muF1; Float_t LHEweight_QCDscale_muR1_muF2; Float_t LHEweight_QCDscale_muR1_muF0p5; Float_t LHEweight_QCDscale_muR2_muF1; Float_t LHEweight_QCDscale_muR2_muF2; Float_t LHEweight_QCDscale_muR2_muF0p5; Float_t LHEweight_QCDscale_muR0p5_muF1; Float_t LHEweight_QCDscale_muR0p5_muF2; Float_t LHEweight_QCDscale_muR0p5_muF0p5; Float_t LHEweight_PDFVariation_Up; Float_t LHEweight_PDFVariation_Dn; Float_t LHEweight_AsMZ_Up; Float_t LHEweight_AsMZ_Dn; Float_t PythiaWeight_isr_muR4; Float_t PythiaWeight_isr_muR2; Float_t PythiaWeight_isr_muRsqrt2; Float_t PythiaWeight_isr_muRoneoversqrt2; Float_t PythiaWeight_isr_muR0p5; Float_t PythiaWeight_isr_muR0p25; Float_t PythiaWeight_fsr_muR4; Float_t PythiaWeight_fsr_muR2; Float_t PythiaWeight_fsr_muRsqrt2; Float_t PythiaWeight_fsr_muRoneoversqrt2; Float_t PythiaWeight_fsr_muR0p5; Float_t PythiaWeight_fsr_muR0p25; Float_t pConst_GG_SIG_ghg2_1_ghz1_1_JHUGen; Float_t p_GG_SIG_ghg2_1_ghz1_1_JHUGen; Float_t p_GG_SIG_ghg2_1_ghz1prime2_1E4_JHUGen; Float_t p_GG_SIG_ghg2_1_ghz2_1_JHUGen; Float_t p_GG_SIG_ghg2_1_ghz4_1_JHUGen; Float_t p_GG_SIG_ghg2_1_ghza1prime2_1E4_JHUGen; Float_t p_GG_SIG_ghg2_1_ghza2_1_JHUGen; Float_t p_GG_SIG_ghg2_1_ghza4_1_JHUGen; Float_t p_GG_SIG_ghg2_1_gha2_1_JHUGen; Float_t p_GG_SIG_ghg2_1_gha4_1_JHUGen; Float_t p_GG_SIG_ghg2_1_ghz1_1_ghz1prime2_1E4_JHUGen; Float_t p_GG_SIG_ghg2_1_ghz1_1_ghz2_1_JHUGen; Float_t p_GG_SIG_ghg2_1_ghz1_1_ghz2_i_JHUGen; Float_t p_GG_SIG_ghg2_1_ghz1_1_ghz4_1_JHUGen; Float_t p_GG_SIG_ghg2_1_ghz1_1_ghz4_i_JHUGen; Float_t p_GG_SIG_ghg2_1_ghz1_1_ghza1prime2_1E4_JHUGen; Float_t p_GG_SIG_ghg2_1_ghz1_1_ghza1prime2_1E4i_JHUGen; Float_t p_GG_SIG_ghg2_1_ghz1_1_ghza2_1_JHUGen; Float_t p_GG_SIG_ghg2_1_ghz1_1_ghza4_1_JHUGen; Float_t p_GG_SIG_ghg2_1_ghz1_1_gha2_1_JHUGen; Float_t p_GG_SIG_ghg2_1_ghz1_1_gha4_1_JHUGen; Float_t p_GG_SIG_ghg2_1_ghz1prime2_1E4_ghza1prime2_1E4_JHUGen; Float_t pAux_JVBF_SIG_ghv1_1_JHUGen_JECNominal; Float_t p_JVBF_SIG_ghv1_1_JHUGen_JECNominal; Float_t pConst_JQCD_SIG_ghg2_1_JHUGen_JECNominal; Float_t p_JQCD_SIG_ghg2_1_JHUGen_JECNominal; Float_t pConst_JJVBF_SIG_ghv1_1_JHUGen_JECNominal; Float_t p_JJVBF_SIG_ghv1_1_JHUGen_JECNominal; Float_t p_JJVBF_SIG_ghv1prime2_1E4_JHUGen_JECNominal; Float_t p_JJVBF_SIG_ghv2_1_JHUGen_JECNominal; Float_t p_JJVBF_SIG_ghv4_1_JHUGen_JECNominal; Float_t p_JJVBF_SIG_ghza1prime2_1E4_JHUGen_JECNominal; Float_t p_JJVBF_SIG_ghza2_1_JHUGen_JECNominal; Float_t p_JJVBF_SIG_ghza4_1_JHUGen_JECNominal; Float_t p_JJVBF_SIG_gha2_1_JHUGen_JECNominal; Float_t p_JJVBF_SIG_gha4_1_JHUGen_JECNominal; Float_t p_JJVBF_SIG_ghv1_1_ghv1prime2_1E4_JHUGen_JECNominal; Float_t p_JJVBF_SIG_ghv1_1_ghv2_1_JHUGen_JECNominal; Float_t p_JJVBF_SIG_ghv1_1_ghv4_1_JHUGen_JECNominal; Float_t p_JJVBF_SIG_ghv1_1_ghza1prime2_1E4_JHUGen_JECNominal; Float_t p_JJVBF_SIG_ghv1_1_ghza2_1_JHUGen_JECNominal; Float_t p_JJVBF_SIG_ghv1_1_ghza4_1_JHUGen_JECNominal; Float_t p_JJVBF_SIG_ghv1_1_gha2_1_JHUGen_JECNominal; Float_t p_JJVBF_SIG_ghv1_1_gha4_1_JHUGen_JECNominal; Float_t pConst_JJQCD_SIG_ghg2_1_JHUGen_JECNominal; Float_t p_JJQCD_SIG_ghg2_1_JHUGen_JECNominal; Float_t p_JJQCD_SIG_ghg4_1_JHUGen_JECNominal; Float_t p_JJQCD_SIG_ghg2_1_ghg4_1_JHUGen_JECNominal; Float_t pConst_JJQCD_InitialQQ_SIG_ghg2_1_JHUGen_JECNominal; Float_t p_JJQCD_InitialQQ_SIG_ghg2_1_JHUGen_JECNominal; Float_t p_JJQCD_InitialQQ_SIG_ghg4_1_JHUGen_JECNominal; Float_t p_JJQCD_InitialQQ_SIG_ghg2_1_ghg4_1_JHUGen_JECNominal; Float_t pConst_HadZH_SIG_ghz1_1_JHUGen_JECNominal; Float_t p_HadZH_SIG_ghz1_1_JHUGen_JECNominal; Float_t p_HadZH_SIG_ghz1prime2_1E4_JHUGen_JECNominal; Float_t p_HadZH_SIG_ghz2_1_JHUGen_JECNominal; Float_t p_HadZH_SIG_ghz4_1_JHUGen_JECNominal; Float_t p_HadZH_SIG_ghza1prime2_1E4_JHUGen_JECNominal; Float_t p_HadZH_SIG_ghza2_1_JHUGen_JECNominal; Float_t p_HadZH_SIG_ghza4_1_JHUGen_JECNominal; Float_t p_HadZH_SIG_gha2_1_JHUGen_JECNominal; Float_t p_HadZH_SIG_gha4_1_JHUGen_JECNominal; Float_t p_HadZH_SIG_ghz1_1_ghz1prime2_1E4_JHUGen_JECNominal; Float_t p_HadZH_SIG_ghz1_1_ghz2_1_JHUGen_JECNominal; Float_t p_HadZH_SIG_ghz1_1_ghz4_1_JHUGen_JECNominal; Float_t p_HadZH_SIG_ghz1_1_ghza1prime2_1E4_JHUGen_JECNominal; Float_t p_HadZH_SIG_ghz1_1_ghza2_1_JHUGen_JECNominal; Float_t p_HadZH_SIG_ghz1_1_ghza4_1_JHUGen_JECNominal; Float_t p_HadZH_SIG_ghz1_1_gha2_1_JHUGen_JECNominal; Float_t p_HadZH_SIG_ghz1_1_gha4_1_JHUGen_JECNominal; Float_t pConst_HadWH_SIG_ghw1_1_JHUGen_JECNominal; Float_t p_HadWH_SIG_ghw1_1_JHUGen_JECNominal; Float_t p_HadWH_SIG_ghw1prime2_1E4_JHUGen_JECNominal; Float_t p_HadWH_SIG_ghw2_1_JHUGen_JECNominal; Float_t p_HadWH_SIG_ghw4_1_JHUGen_JECNominal; Float_t p_HadWH_SIG_ghw1_1_ghw1prime2_1E4_JHUGen_JECNominal; Float_t p_HadWH_SIG_ghw1_1_ghw2_1_JHUGen_JECNominal; Float_t p_HadWH_SIG_ghw1_1_ghw4_1_JHUGen_JECNominal; Float_t p_ttHUndecayed_SIG_kappa_1_JHUGen_JECNominal; Float_t p_ttHUndecayed_SIG_kappatilde_1_JHUGen_JECNominal; Float_t p_ttHUndecayed_SIG_kappa_1_kappatilde_1_JHUGen_JECNominal; Float_t p_bbH_SIG_kappa_1_JHUGen_JECNominal; Float_t pAux_JVBF_SIG_ghv1_1_JHUGen_JECUp; Float_t p_JVBF_SIG_ghv1_1_JHUGen_JECUp; Float_t pConst_JQCD_SIG_ghg2_1_JHUGen_JECUp; Float_t p_JQCD_SIG_ghg2_1_JHUGen_JECUp; Float_t pConst_JJVBF_SIG_ghv1_1_JHUGen_JECUp; Float_t p_JJVBF_SIG_ghv1_1_JHUGen_JECUp; Float_t p_JJVBF_SIG_ghv1prime2_1E4_JHUGen_JECUp; Float_t p_JJVBF_SIG_ghv2_1_JHUGen_JECUp; Float_t p_JJVBF_SIG_ghv4_1_JHUGen_JECUp; Float_t p_JJVBF_SIG_ghza1prime2_1E4_JHUGen_JECUp; Float_t p_JJVBF_SIG_ghza2_1_JHUGen_JECUp; Float_t p_JJVBF_SIG_ghza4_1_JHUGen_JECUp; Float_t p_JJVBF_SIG_gha2_1_JHUGen_JECUp; Float_t p_JJVBF_SIG_gha4_1_JHUGen_JECUp; Float_t p_JJVBF_SIG_ghv1_1_ghv1prime2_1E4_JHUGen_JECUp; Float_t p_JJVBF_SIG_ghv1_1_ghv2_1_JHUGen_JECUp; Float_t p_JJVBF_SIG_ghv1_1_ghv4_1_JHUGen_JECUp; Float_t p_JJVBF_SIG_ghv1_1_ghza1prime2_1E4_JHUGen_JECUp; Float_t p_JJVBF_SIG_ghv1_1_ghza2_1_JHUGen_JECUp; Float_t p_JJVBF_SIG_ghv1_1_ghza4_1_JHUGen_JECUp; Float_t p_JJVBF_SIG_ghv1_1_gha2_1_JHUGen_JECUp; Float_t p_JJVBF_SIG_ghv1_1_gha4_1_JHUGen_JECUp; Float_t pConst_JJQCD_SIG_ghg2_1_JHUGen_JECUp; Float_t p_JJQCD_SIG_ghg2_1_JHUGen_JECUp; Float_t p_JJQCD_SIG_ghg4_1_JHUGen_JECUp; Float_t p_JJQCD_SIG_ghg2_1_ghg4_1_JHUGen_JECUp; Float_t pConst_JJQCD_InitialQQ_SIG_ghg2_1_JHUGen_JECUp; Float_t p_JJQCD_InitialQQ_SIG_ghg2_1_JHUGen_JECUp; Float_t p_JJQCD_InitialQQ_SIG_ghg4_1_JHUGen_JECUp; Float_t p_JJQCD_InitialQQ_SIG_ghg2_1_ghg4_1_JHUGen_JECUp; Float_t pConst_HadZH_SIG_ghz1_1_JHUGen_JECUp; Float_t p_HadZH_SIG_ghz1_1_JHUGen_JECUp; Float_t p_HadZH_SIG_ghz1prime2_1E4_JHUGen_JECUp; Float_t p_HadZH_SIG_ghz2_1_JHUGen_JECUp; Float_t p_HadZH_SIG_ghz4_1_JHUGen_JECUp; Float_t p_HadZH_SIG_ghza1prime2_1E4_JHUGen_JECUp; Float_t p_HadZH_SIG_ghza2_1_JHUGen_JECUp; Float_t p_HadZH_SIG_ghza4_1_JHUGen_JECUp; Float_t p_HadZH_SIG_gha2_1_JHUGen_JECUp; Float_t p_HadZH_SIG_gha4_1_JHUGen_JECUp; Float_t p_HadZH_SIG_ghz1_1_ghz1prime2_1E4_JHUGen_JECUp; Float_t p_HadZH_SIG_ghz1_1_ghz2_1_JHUGen_JECUp; Float_t p_HadZH_SIG_ghz1_1_ghz4_1_JHUGen_JECUp; Float_t p_HadZH_SIG_ghz1_1_ghza1prime2_1E4_JHUGen_JECUp; Float_t p_HadZH_SIG_ghz1_1_ghza2_1_JHUGen_JECUp; Float_t p_HadZH_SIG_ghz1_1_ghza4_1_JHUGen_JECUp; Float_t p_HadZH_SIG_ghz1_1_gha2_1_JHUGen_JECUp; Float_t p_HadZH_SIG_ghz1_1_gha4_1_JHUGen_JECUp; Float_t pConst_HadWH_SIG_ghw1_1_JHUGen_JECUp; Float_t p_HadWH_SIG_ghw1_1_JHUGen_JECUp; Float_t p_HadWH_SIG_ghw1prime2_1E4_JHUGen_JECUp; Float_t p_HadWH_SIG_ghw2_1_JHUGen_JECUp; Float_t p_HadWH_SIG_ghw4_1_JHUGen_JECUp; Float_t p_HadWH_SIG_ghw1_1_ghw1prime2_1E4_JHUGen_JECUp; Float_t p_HadWH_SIG_ghw1_1_ghw2_1_JHUGen_JECUp; Float_t p_HadWH_SIG_ghw1_1_ghw4_1_JHUGen_JECUp; Float_t p_ttHUndecayed_SIG_kappa_1_JHUGen_JECUp; Float_t p_ttHUndecayed_SIG_kappatilde_1_JHUGen_JECUp; Float_t p_ttHUndecayed_SIG_kappa_1_kappatilde_1_JHUGen_JECUp; Float_t p_bbH_SIG_kappa_1_JHUGen_JECUp; Float_t pAux_JVBF_SIG_ghv1_1_JHUGen_JECDn; Float_t p_JVBF_SIG_ghv1_1_JHUGen_JECDn; Float_t pConst_JQCD_SIG_ghg2_1_JHUGen_JECDn; Float_t p_JQCD_SIG_ghg2_1_JHUGen_JECDn; Float_t pConst_JJVBF_SIG_ghv1_1_JHUGen_JECDn; Float_t p_JJVBF_SIG_ghv1_1_JHUGen_JECDn; Float_t p_JJVBF_SIG_ghv1prime2_1E4_JHUGen_JECDn; Float_t p_JJVBF_SIG_ghv2_1_JHUGen_JECDn; Float_t p_JJVBF_SIG_ghv4_1_JHUGen_JECDn; Float_t p_JJVBF_SIG_ghza1prime2_1E4_JHUGen_JECDn; Float_t p_JJVBF_SIG_ghza2_1_JHUGen_JECDn; Float_t p_JJVBF_SIG_ghza4_1_JHUGen_JECDn; Float_t p_JJVBF_SIG_gha2_1_JHUGen_JECDn; Float_t p_JJVBF_SIG_gha4_1_JHUGen_JECDn; Float_t p_JJVBF_SIG_ghv1_1_ghv1prime2_1E4_JHUGen_JECDn; Float_t p_JJVBF_SIG_ghv1_1_ghv2_1_JHUGen_JECDn; Float_t p_JJVBF_SIG_ghv1_1_ghv4_1_JHUGen_JECDn; Float_t p_JJVBF_SIG_ghv1_1_ghza1prime2_1E4_JHUGen_JECDn; Float_t p_JJVBF_SIG_ghv1_1_ghza2_1_JHUGen_JECDn; Float_t p_JJVBF_SIG_ghv1_1_ghza4_1_JHUGen_JECDn; Float_t p_JJVBF_SIG_ghv1_1_gha2_1_JHUGen_JECDn; Float_t p_JJVBF_SIG_ghv1_1_gha4_1_JHUGen_JECDn; Float_t pConst_JJQCD_SIG_ghg2_1_JHUGen_JECDn; Float_t p_JJQCD_SIG_ghg2_1_JHUGen_JECDn; Float_t p_JJQCD_SIG_ghg4_1_JHUGen_JECDn; Float_t p_JJQCD_SIG_ghg2_1_ghg4_1_JHUGen_JECDn; Float_t pConst_JJQCD_InitialQQ_SIG_ghg2_1_JHUGen_JECDn; Float_t p_JJQCD_InitialQQ_SIG_ghg2_1_JHUGen_JECDn; Float_t p_JJQCD_InitialQQ_SIG_ghg4_1_JHUGen_JECDn; Float_t p_JJQCD_InitialQQ_SIG_ghg2_1_ghg4_1_JHUGen_JECDn; Float_t pConst_HadZH_SIG_ghz1_1_JHUGen_JECDn; Float_t p_HadZH_SIG_ghz1_1_JHUGen_JECDn; Float_t p_HadZH_SIG_ghz1prime2_1E4_JHUGen_JECDn; Float_t p_HadZH_SIG_ghz2_1_JHUGen_JECDn; Float_t p_HadZH_SIG_ghz4_1_JHUGen_JECDn; Float_t p_HadZH_SIG_ghza1prime2_1E4_JHUGen_JECDn; Float_t p_HadZH_SIG_ghza2_1_JHUGen_JECDn; Float_t p_HadZH_SIG_ghza4_1_JHUGen_JECDn; Float_t p_HadZH_SIG_gha2_1_JHUGen_JECDn; Float_t p_HadZH_SIG_gha4_1_JHUGen_JECDn; Float_t p_HadZH_SIG_ghz1_1_ghz1prime2_1E4_JHUGen_JECDn; Float_t p_HadZH_SIG_ghz1_1_ghz2_1_JHUGen_JECDn; Float_t p_HadZH_SIG_ghz1_1_ghz4_1_JHUGen_JECDn; Float_t p_HadZH_SIG_ghz1_1_ghza1prime2_1E4_JHUGen_JECDn; Float_t p_HadZH_SIG_ghz1_1_ghza2_1_JHUGen_JECDn; Float_t p_HadZH_SIG_ghz1_1_ghza4_1_JHUGen_JECDn; Float_t p_HadZH_SIG_ghz1_1_gha2_1_JHUGen_JECDn; Float_t p_HadZH_SIG_ghz1_1_gha4_1_JHUGen_JECDn; Float_t pConst_HadWH_SIG_ghw1_1_JHUGen_JECDn; Float_t p_HadWH_SIG_ghw1_1_JHUGen_JECDn; Float_t p_HadWH_SIG_ghw1prime2_1E4_JHUGen_JECDn; Float_t p_HadWH_SIG_ghw2_1_JHUGen_JECDn; Float_t p_HadWH_SIG_ghw4_1_JHUGen_JECDn; Float_t p_HadWH_SIG_ghw1_1_ghw1prime2_1E4_JHUGen_JECDn; Float_t p_HadWH_SIG_ghw1_1_ghw2_1_JHUGen_JECDn; Float_t p_HadWH_SIG_ghw1_1_ghw4_1_JHUGen_JECDn; Float_t p_ttHUndecayed_SIG_kappa_1_JHUGen_JECDn; Float_t p_ttHUndecayed_SIG_kappatilde_1_JHUGen_JECDn; Float_t p_ttHUndecayed_SIG_kappa_1_kappatilde_1_JHUGen_JECDn; Float_t p_bbH_SIG_kappa_1_JHUGen_JECDn; Float_t p_LepZH_SIG_ghz1_1_JHUGen; Float_t p_LepZH_SIG_ghz1prime2_1E4_JHUGen; Float_t p_LepZH_SIG_ghz2_1_JHUGen; Float_t p_LepZH_SIG_ghz4_1_JHUGen; Float_t p_LepZH_SIG_ghza1prime2_1E4_JHUGen; Float_t p_LepZH_SIG_ghza2_1_JHUGen; Float_t p_LepZH_SIG_ghza4_1_JHUGen; Float_t p_LepZH_SIG_gha2_1_JHUGen; Float_t p_LepZH_SIG_gha4_1_JHUGen; Float_t p_LepZH_SIG_ghz1_1_ghz1prime2_1E4_JHUGen; Float_t p_LepZH_SIG_ghz1_1_ghz2_1_JHUGen; Float_t p_LepZH_SIG_ghz1_1_ghz4_1_JHUGen; Float_t p_LepZH_SIG_ghz1_1_ghza1prime2_1E4_JHUGen; Float_t p_LepZH_SIG_ghz1_1_ghza2_1_JHUGen; Float_t p_LepZH_SIG_ghz1_1_ghza4_1_JHUGen; Float_t p_LepZH_SIG_ghz1_1_gha2_1_JHUGen; Float_t p_LepZH_SIG_ghz1_1_gha4_1_JHUGen; Float_t p_LepWH_SIG_ghw1_1_JHUGen; Float_t p_LepWH_SIG_ghw1prime2_1E4_JHUGen; Float_t p_LepWH_SIG_ghw2_1_JHUGen; Float_t p_LepWH_SIG_ghw4_1_JHUGen; Float_t p_LepWH_SIG_ghw1_1_ghw1prime2_1E4_JHUGen; Float_t p_LepWH_SIG_ghw1_1_ghw2_1_JHUGen; Float_t p_LepWH_SIG_ghw1_1_ghw4_1_JHUGen; Float_t p_QQB_SIG_ZPqqLR_1_gZPz1_1_JHUGen; Float_t p_QQB_SIG_ZPqqLR_1_gZPz2_1_JHUGen; Float_t p_INDEPENDENT_SIG_gZPz1_1_JHUGen; Float_t p_INDEPENDENT_SIG_gZPz2_1_JHUGen; Float_t p_GG_SIG_gXg1_1_gXz1_1_JHUGen; Float_t p_GG_SIG_gXg2_1_gXz2_1_JHUGen; Float_t p_GG_SIG_gXg3_1_gXz3_1_JHUGen; Float_t p_GG_SIG_gXg4_1_gXz4_1_JHUGen; Float_t p_GG_SIG_gXg1_1_gXz5_1_JHUGen; Float_t p_GG_SIG_gXg1_1_gXz1_1_gXz5_1_JHUGen; Float_t p_GG_SIG_gXg1_1_gXz6_1_JHUGen; Float_t p_GG_SIG_gXg1_1_gXz7_1_JHUGen; Float_t p_GG_SIG_gXg5_1_gXz8_1_JHUGen; Float_t p_GG_SIG_gXg5_1_gXz9_1_JHUGen; Float_t p_GG_SIG_gXg5_1_gXz10_1_JHUGen; Float_t p_QQB_SIG_XqqLR_1_gXz1_1_JHUGen; Float_t p_QQB_SIG_XqqLR_1_gXz2_1_JHUGen; Float_t p_QQB_SIG_XqqLR_1_gXz3_1_JHUGen; Float_t p_QQB_SIG_XqqLR_1_gXz4_1_JHUGen; Float_t p_QQB_SIG_XqqLR_1_gXz5_1_JHUGen; Float_t p_QQB_SIG_XqqLR_1_gXz1_1_gXz5_1_JHUGen; Float_t p_QQB_SIG_XqqLR_1_gXz6_1_JHUGen; Float_t p_QQB_SIG_XqqLR_1_gXz7_1_JHUGen; Float_t p_QQB_SIG_XqqLR_1_gXz8_1_JHUGen; Float_t p_QQB_SIG_XqqLR_1_gXz9_1_JHUGen; Float_t p_QQB_SIG_XqqLR_1_gXz10_1_JHUGen; Float_t p_INDEPENDENT_SIG_gXz1_1_JHUGen; Float_t p_INDEPENDENT_SIG_gXz2_1_JHUGen; Float_t p_INDEPENDENT_SIG_gXz3_1_JHUGen; Float_t p_INDEPENDENT_SIG_gXz4_1_JHUGen; Float_t p_INDEPENDENT_SIG_gXz5_1_JHUGen; Float_t p_INDEPENDENT_SIG_gXz1_1_gXz5_1_JHUGen; Float_t p_INDEPENDENT_SIG_gXz6_1_JHUGen; Float_t p_INDEPENDENT_SIG_gXz7_1_JHUGen; Float_t p_INDEPENDENT_SIG_gXz8_1_JHUGen; Float_t p_INDEPENDENT_SIG_gXz9_1_JHUGen; Float_t p_INDEPENDENT_SIG_gXz10_1_JHUGen; Float_t pConst_GG_SIG_kappaTopBot_1_ghz1_1_MCFM; Float_t p_GG_SIG_kappaTopBot_1_ghz1_1_MCFM; Float_t p_GG_BSI_kappaTopBot_1_ghz1_1_MCFM; Float_t p_GG_BSI_kappaTopBot_1_ghz1_i_MCFM; Float_t pConst_GG_BKG_MCFM; Float_t p_GG_BKG_MCFM; Float_t pConst_QQB_BKG_MCFM; Float_t p_QQB_BKG_MCFM; Float_t pConst_ZJJ_BKG_MCFM; Float_t p_ZJJ_BKG_MCFM; Float_t p_JJEW_SIG_ghv1_1_MCFM_JECNominal; Float_t p_JJEW_BSI_ghv1_1_MCFM_JECNominal; Float_t p_JJEW_BSI_ghv1_i_MCFM_JECNominal; Float_t p_JJEW_BKG_MCFM_JECNominal; Float_t pConst_JJVBF_S_SIG_ghv1_1_MCFM_JECNominal; Float_t p_JJVBF_S_SIG_ghv1_1_MCFM_JECNominal; Float_t p_JJVBF_S_BSI_ghv1_1_MCFM_JECNominal; Float_t p_JJVBF_S_BSI_ghv1_i_MCFM_JECNominal; Float_t p_JJVBF_SIG_ghv1_1_MCFM_JECNominal; Float_t p_JJVBF_BSI_ghv1_1_MCFM_JECNominal; Float_t p_JJVBF_BSI_ghv1_i_MCFM_JECNominal; Float_t pConst_JJVBF_BKG_MCFM_JECNominal; Float_t p_JJVBF_BKG_MCFM_JECNominal; Float_t pConst_HadZH_S_SIG_ghz1_1_MCFM_JECNominal; Float_t p_HadZH_S_SIG_ghz1_1_MCFM_JECNominal; Float_t p_HadZH_S_BSI_ghz1_1_MCFM_JECNominal; Float_t p_HadZH_S_BSI_ghz1_i_MCFM_JECNominal; Float_t p_HadZH_SIG_ghz1_1_MCFM_JECNominal; Float_t p_HadZH_BSI_ghz1_1_MCFM_JECNominal; Float_t p_HadZH_BSI_ghz1_i_MCFM_JECNominal; Float_t pConst_HadZH_BKG_MCFM_JECNominal; Float_t p_HadZH_BKG_MCFM_JECNominal; Float_t pConst_HadWH_S_SIG_ghw1_1_MCFM_JECNominal; Float_t p_HadWH_S_SIG_ghw1_1_MCFM_JECNominal; Float_t p_HadWH_S_BSI_ghw1_1_MCFM_JECNominal; Float_t p_HadWH_S_BSI_ghw1_i_MCFM_JECNominal; Float_t pConst_HadWH_BKG_MCFM_JECNominal; Float_t p_HadWH_BKG_MCFM_JECNominal; Float_t pConst_JJQCD_BKG_MCFM_JECNominal; Float_t p_JJQCD_BKG_MCFM_JECNominal; Float_t p_JJEW_SIG_ghv1_1_MCFM_JECUp; Float_t p_JJEW_BSI_ghv1_1_MCFM_JECUp; Float_t p_JJEW_BSI_ghv1_i_MCFM_JECUp; Float_t p_JJEW_BKG_MCFM_JECUp; Float_t pConst_JJVBF_S_SIG_ghv1_1_MCFM_JECUp; Float_t p_JJVBF_S_SIG_ghv1_1_MCFM_JECUp; Float_t p_JJVBF_S_BSI_ghv1_1_MCFM_JECUp; Float_t p_JJVBF_S_BSI_ghv1_i_MCFM_JECUp; Float_t p_JJVBF_SIG_ghv1_1_MCFM_JECUp; Float_t p_JJVBF_BSI_ghv1_1_MCFM_JECUp; Float_t p_JJVBF_BSI_ghv1_i_MCFM_JECUp; Float_t pConst_JJVBF_BKG_MCFM_JECUp; Float_t p_JJVBF_BKG_MCFM_JECUp; Float_t pConst_HadZH_S_SIG_ghz1_1_MCFM_JECUp; Float_t p_HadZH_S_SIG_ghz1_1_MCFM_JECUp; Float_t p_HadZH_S_BSI_ghz1_1_MCFM_JECUp; Float_t p_HadZH_S_BSI_ghz1_i_MCFM_JECUp; Float_t p_HadZH_SIG_ghz1_1_MCFM_JECUp; Float_t p_HadZH_BSI_ghz1_1_MCFM_JECUp; Float_t p_HadZH_BSI_ghz1_i_MCFM_JECUp; Float_t pConst_HadZH_BKG_MCFM_JECUp; Float_t p_HadZH_BKG_MCFM_JECUp; Float_t pConst_HadWH_S_SIG_ghw1_1_MCFM_JECUp; Float_t p_HadWH_S_SIG_ghw1_1_MCFM_JECUp; Float_t p_HadWH_S_BSI_ghw1_1_MCFM_JECUp; Float_t p_HadWH_S_BSI_ghw1_i_MCFM_JECUp; Float_t pConst_HadWH_BKG_MCFM_JECUp; Float_t p_HadWH_BKG_MCFM_JECUp; Float_t pConst_JJQCD_BKG_MCFM_JECUp; Float_t p_JJQCD_BKG_MCFM_JECUp; Float_t p_JJEW_SIG_ghv1_1_MCFM_JECDn; Float_t p_JJEW_BSI_ghv1_1_MCFM_JECDn; Float_t p_JJEW_BSI_ghv1_i_MCFM_JECDn; Float_t p_JJEW_BKG_MCFM_JECDn; Float_t pConst_JJVBF_S_SIG_ghv1_1_MCFM_JECDn; Float_t p_JJVBF_S_SIG_ghv1_1_MCFM_JECDn; Float_t p_JJVBF_S_BSI_ghv1_1_MCFM_JECDn; Float_t p_JJVBF_S_BSI_ghv1_i_MCFM_JECDn; Float_t p_JJVBF_SIG_ghv1_1_MCFM_JECDn; Float_t p_JJVBF_BSI_ghv1_1_MCFM_JECDn; Float_t p_JJVBF_BSI_ghv1_i_MCFM_JECDn; Float_t pConst_JJVBF_BKG_MCFM_JECDn; Float_t p_JJVBF_BKG_MCFM_JECDn; Float_t pConst_HadZH_S_SIG_ghz1_1_MCFM_JECDn; Float_t p_HadZH_S_SIG_ghz1_1_MCFM_JECDn; Float_t p_HadZH_S_BSI_ghz1_1_MCFM_JECDn; Float_t p_HadZH_S_BSI_ghz1_i_MCFM_JECDn; Float_t p_HadZH_SIG_ghz1_1_MCFM_JECDn; Float_t p_HadZH_BSI_ghz1_1_MCFM_JECDn; Float_t p_HadZH_BSI_ghz1_i_MCFM_JECDn; Float_t pConst_HadZH_BKG_MCFM_JECDn; Float_t p_HadZH_BKG_MCFM_JECDn; Float_t pConst_HadWH_S_SIG_ghw1_1_MCFM_JECDn; Float_t p_HadWH_S_SIG_ghw1_1_MCFM_JECDn; Float_t p_HadWH_S_BSI_ghw1_1_MCFM_JECDn; Float_t p_HadWH_S_BSI_ghw1_i_MCFM_JECDn; Float_t pConst_HadWH_BKG_MCFM_JECDn; Float_t p_HadWH_BKG_MCFM_JECDn; Float_t pConst_JJQCD_BKG_MCFM_JECDn; Float_t p_JJQCD_BKG_MCFM_JECDn; Float_t p_m4l_SIG; Float_t p_m4l_BKG; Float_t p_m4l_SIG_ScaleDown; Float_t p_m4l_BKG_ScaleDown; Float_t p_m4l_SIG_ResDown; Float_t p_m4l_BKG_ResDown; Float_t p_m4l_SIG_ScaleUp; Float_t p_m4l_BKG_ScaleUp; Float_t p_m4l_SIG_ResUp; Float_t p_m4l_BKG_ResUp; Float_t p_HadZH_mavjj_true_JECNominal; Float_t p_HadWH_mavjj_true_JECNominal; Float_t p_HadZH_mavjj_JECNominal; Float_t p_HadWH_mavjj_JECNominal; Float_t p_HadZH_mavjj_true_JECUp; Float_t p_HadWH_mavjj_true_JECUp; Float_t p_HadZH_mavjj_JECUp; Float_t p_HadWH_mavjj_JECUp; Float_t p_HadZH_mavjj_true_JECDn; Float_t p_HadWH_mavjj_true_JECDn; Float_t p_HadZH_mavjj_JECDn; Float_t p_HadWH_mavjj_JECDn; Float_t pConst_JJVBF_SIG_ghv1_1_JHUGen_JECNominal_BestDJJ; Float_t p_JJVBF_SIG_ghv1_1_JHUGen_JECNominal_BestDJJ; Float_t pConst_JJQCD_SIG_ghg2_1_JHUGen_JECNominal_BestDJJ; Float_t p_JJQCD_SIG_ghg2_1_JHUGen_JECNominal_BestDJJ; Float_t pConst_JJVBF_SIG_ghv1_1_JHUGen_JECUp_BestDJJ; Float_t p_JJVBF_SIG_ghv1_1_JHUGen_JECUp_BestDJJ; Float_t pConst_JJQCD_SIG_ghg2_1_JHUGen_JECUp_BestDJJ; Float_t p_JJQCD_SIG_ghg2_1_JHUGen_JECUp_BestDJJ; Float_t pConst_JJVBF_SIG_ghv1_1_JHUGen_JECDn_BestDJJ; Float_t p_JJVBF_SIG_ghv1_1_JHUGen_JECDn_BestDJJ; Float_t pConst_JJQCD_SIG_ghg2_1_JHUGen_JECDn_BestDJJ; Float_t p_JJQCD_SIG_ghg2_1_JHUGen_JECDn_BestDJJ; Float_t p_Gen_CPStoBWPropRewgt; Float_t p_Gen_GG_SIG_kappaTopBot_1_ghz1_1_MCFM; Float_t p_Gen_GG_SIG_kappaTopBot_1_ghz1prime2_1E4_MCFM; Float_t p_Gen_GG_SIG_kappaTopBot_1_ghz2_1_MCFM; Float_t p_Gen_GG_SIG_kappaTopBot_1_ghz4_1_MCFM; Float_t p_Gen_GG_SIG_kappaTopBot_1_ghza1prime2_1E4_MCFM; Float_t p_Gen_GG_SIG_kappaTopBot_1_ghza2_1_MCFM; Float_t p_Gen_GG_SIG_kappaTopBot_1_ghza4_1_MCFM; Float_t p_Gen_GG_SIG_kappaTopBot_1_gha2_1_MCFM; Float_t p_Gen_GG_SIG_kappaTopBot_1_gha4_1_MCFM; Float_t p_Gen_GG_SIG_kappaTopBot_1_ghz1_1_ghz1prime2_1E4_MCFM; Float_t p_Gen_GG_SIG_kappaTopBot_1_ghz1_1_ghz2_1_MCFM; Float_t p_Gen_GG_SIG_kappaTopBot_1_ghz1_1_ghz4_1_MCFM; Float_t p_Gen_GG_SIG_kappaTopBot_1_ghz1_1_ghza1prime2_1E4_MCFM; Float_t p_Gen_GG_SIG_kappaTopBot_1_ghz1_1_ghza2_1_MCFM; Float_t p_Gen_GG_SIG_kappaTopBot_1_ghz1_1_ghza4_1_MCFM; Float_t p_Gen_GG_SIG_kappaTopBot_1_ghz1_1_gha2_1_MCFM; Float_t p_Gen_GG_SIG_kappaTopBot_1_ghz1_1_gha4_1_MCFM; Float_t p_Gen_GG_BSI_kappaTopBot_1_ghz1_1_MCFM; Float_t p_Gen_GG_BSI_kappaTopBot_1_ghz1prime2_1E4_MCFM; Float_t p_Gen_GG_BSI_kappaTopBot_1_ghz2_1_MCFM; Float_t p_Gen_GG_BSI_kappaTopBot_1_ghz4_1_MCFM; Float_t p_Gen_GG_BSI_kappaTopBot_1_ghza1prime2_1E4_MCFM; Float_t p_Gen_GG_BSI_kappaTopBot_1_ghza2_1_MCFM; Float_t p_Gen_GG_BSI_kappaTopBot_1_ghza4_1_MCFM; Float_t p_Gen_GG_BSI_kappaTopBot_1_gha2_1_MCFM; Float_t p_Gen_GG_BSI_kappaTopBot_1_gha4_1_MCFM; Float_t p_Gen_GG_BKG_MCFM; Float_t p_Gen_QQB_BKG_MCFM; Float_t p_Gen_GG_SIG_gXg1_1_gXz1_1_JHUGen; Float_t p_Gen_GG_SIG_gXg2_1_gXz2_1_JHUGen; Float_t p_Gen_GG_SIG_gXg3_1_gXz3_1_JHUGen; Float_t p_Gen_GG_SIG_gXg4_1_gXz4_1_JHUGen; Float_t p_Gen_GG_SIG_gXg1_1_gXz5_1_JHUGen; Float_t p_Gen_GG_SIG_gXg1_1_gXz1_1_gXz5_1_JHUGen; Float_t p_Gen_GG_SIG_gXg1_1_gXz6_1_JHUGen; Float_t p_Gen_GG_SIG_gXg1_1_gXz7_1_JHUGen; Float_t p_Gen_GG_SIG_gXg5_1_gXz8_1_JHUGen; Float_t p_Gen_GG_SIG_gXg5_1_gXz9_1_JHUGen; Float_t p_Gen_GG_SIG_gXg5_1_gXz10_1_JHUGen; // List of branches TBranch *b_RunNumber; //! TBranch *b_EventNumber; //! TBranch *b_LumiNumber; //! TBranch *b_NRecoMu; //! TBranch *b_NRecoEle; //! TBranch *b_Nvtx; //! TBranch *b_NObsInt; //! TBranch *b_NTrueInt; //! TBranch *b_GenMET; //! TBranch *b_GenMETPhi; //! TBranch *b_PFMET; //! TBranch *b_PFMET_jesUp; //! TBranch *b_PFMET_jesDn; //! TBranch *b_PFMETPhi; //! TBranch *b_PFMETPhi_jesUp; //! TBranch *b_PFMETPhi_jesDn; //! TBranch *b_PFMET_corrected; //! TBranch *b_PFMET_corrected_jesUp; //! TBranch *b_PFMET_corrected_jesDn; //! TBranch *b_PFMET_corrected_jerUp; //! TBranch *b_PFMET_corrected_jerDn; //! TBranch *b_PFMET_corrected_puUp; //! TBranch *b_PFMET_corrected_puDn; //! TBranch *b_PFMET_corrected_metUp; //! TBranch *b_PFMET_corrected_metDn; //! TBranch *b_PFMETPhi_corrected; //! TBranch *b_PFMETPhi_corrected_jesUp; //! TBranch *b_PFMETPhi_corrected_jesDn; //! TBranch *b_PFMETPhi_corrected_jerUp; //! TBranch *b_PFMETPhi_corrected_jerDn; //! TBranch *b_PFMETPhi_corrected_puUp; //! TBranch *b_PFMETPhi_corrected_puDn; //! TBranch *b_PFMETPhi_corrected_metUp; //! TBranch *b_PFMETPhi_corrected_metDn; //! TBranch *b_nCleanedJets; //! TBranch *b_nCleanedJetsPt30; //! TBranch *b_nCleanedJetsPt30_jecUp; //! TBranch *b_nCleanedJetsPt30_jecDn; //! TBranch *b_nCleanedJetsPt30BTagged; //! TBranch *b_nCleanedJetsPt30BTagged_bTagSF; //! TBranch *b_nCleanedJetsPt30BTagged_bTagSF_jecUp; //! TBranch *b_nCleanedJetsPt30BTagged_bTagSF_jecDn; //! TBranch *b_nCleanedJetsPt30BTagged_bTagSFUp; //! TBranch *b_nCleanedJetsPt30BTagged_bTagSFDn; //! TBranch *b_trigWord; //! TBranch *b_evtPassMETFilter; //! TBranch *b_ZZMass; //! TBranch *b_ZZMassErr; //! TBranch *b_ZZMassErrCorr; //! TBranch *b_ZZMassPreFSR; //! TBranch *b_ZZsel; //! TBranch *b_ZZPt; //! TBranch *b_ZZEta; //! TBranch *b_ZZPhi; //! TBranch *b_ZZjjPt; //! TBranch *b_CRflag; //! TBranch *b_Z1Mass; //! TBranch *b_Z1Pt; //! TBranch *b_Z1Flav; //! TBranch *b_ZZMassRefit; //! TBranch *b_ZZMassRefitErr; //! TBranch *b_ZZMassUnrefitErr; //! TBranch *b_Z2Mass; //! TBranch *b_Z2Pt; //! TBranch *b_Z2Flav; //! TBranch *b_costhetastar; //! TBranch *b_helphi; //! TBranch *b_helcosthetaZ1; //! TBranch *b_helcosthetaZ2; //! TBranch *b_phistarZ1; //! TBranch *b_phistarZ2; //! TBranch *b_xi; //! TBranch *b_xistar; //! TBranch *b_LepPt; //! TBranch *b_LepEta; //! TBranch *b_LepPhi; //! TBranch *b_LepLepId; //! TBranch *b_LepSIP; //! TBranch *b_Lepdxy; //! TBranch *b_Lepdz; //! TBranch *b_LepTime; //! TBranch *b_LepisID; //! TBranch *b_LepisLoose; //! TBranch *b_LepBDT; //! TBranch *b_LepMissingHit; //! TBranch *b_LepChargedHadIso; //! TBranch *b_LepNeutralHadIso; //! TBranch *b_LepPhotonIso; //! TBranch *b_LepPUIsoComponent; //! TBranch *b_LepCombRelIsoPF; //! TBranch *b_LepRecoSF; //! TBranch *b_LepRecoSF_Unc; //! TBranch *b_LepSelSF; //! TBranch *b_LepSelSF_Unc; //! TBranch *b_LepScale_Total_Up; //! TBranch *b_LepScale_Total_Dn; //! TBranch *b_LepScale_Stat_Up; //! TBranch *b_LepScale_Stat_Dn; //! TBranch *b_LepScale_Syst_Up; //! TBranch *b_LepScale_Syst_Dn; //! TBranch *b_LepScale_Gain_Up; //! TBranch *b_LepScale_Gain_Dn; //! TBranch *b_LepSigma_Total_Up; //! TBranch *b_LepSigma_Total_Dn; //! TBranch *b_LepSigma_Rho_Up; //! TBranch *b_LepSigma_Rho_Dn; //! TBranch *b_LepSigma_Phi_Up; //! TBranch *b_LepSigma_Phi_Dn; //! TBranch *b_fsrPt; //! TBranch *b_fsrEta; //! TBranch *b_fsrPhi; //! TBranch *b_fsrLept; //! TBranch *b_passIsoPreFSR; //! TBranch *b_JetPt; //! TBranch *b_JetEta; //! TBranch *b_JetPhi; //! TBranch *b_JetMass; //! TBranch *b_JetBTagger; //! TBranch *b_JetIsBtagged; //! TBranch *b_JetIsBtaggedWithSF; //! TBranch *b_JetIsBtaggedWithSFUp; //! TBranch *b_JetIsBtaggedWithSFDn; //! TBranch *b_JetQGLikelihood; //! TBranch *b_JetAxis2; //! TBranch *b_JetMult; //! TBranch *b_JetPtD; //! TBranch *b_JetSigma; //! TBranch *b_JetHadronFlavour; //! TBranch *b_JetPartonFlavour; //! TBranch *b_JetRawPt; //! TBranch *b_JetPtJEC_noJER; //! TBranch *b_JetJERUp; //! TBranch *b_JetJERDown; //! TBranch *b_JetID; //! TBranch *b_JetPUID; //! TBranch *b_JetPUValue; //! TBranch *b_DiJetMass; //! TBranch *b_DiJetDEta; //! TBranch *b_DiJetFisher; //! TBranch *b_PhotonPt; //! TBranch *b_PhotonEta; //! TBranch *b_PhotonPhi; //! TBranch *b_PhotonIsCutBasedLooseID; //! TBranch *b_nExtraLep; //! TBranch *b_nExtraZ; //! TBranch *b_ExtraLepPt; //! TBranch *b_ExtraLepEta; //! TBranch *b_ExtraLepPhi; //! TBranch *b_ExtraLepLepId; //! TBranch *b_ZXFakeweight; //! TBranch *b_KFactor_QCD_ggZZ_Nominal; //! TBranch *b_KFactor_QCD_ggZZ_PDFScaleDn; //! TBranch *b_KFactor_QCD_ggZZ_PDFScaleUp; //! TBranch *b_KFactor_QCD_ggZZ_QCDScaleDn; //! TBranch *b_KFactor_QCD_ggZZ_QCDScaleUp; //! TBranch *b_KFactor_QCD_ggZZ_AsDn; //! TBranch *b_KFactor_QCD_ggZZ_AsUp; //! TBranch *b_KFactor_QCD_ggZZ_PDFReplicaDn; //! TBranch *b_KFactor_QCD_ggZZ_PDFReplicaUp; //! TBranch *b_genFinalState; //! TBranch *b_genProcessId; //! TBranch *b_genHEPMCweight; //! TBranch *b_genHEPMCweight_POWHEGonly; //! TBranch *b_PUWeight; //! TBranch *b_PUWeight_Dn; //! TBranch *b_PUWeight_Up; //! TBranch *b_dataMCWeight; //! TBranch *b_muonSF_Unc; //! TBranch *b_eleSF_Unc; //! TBranch *b_trigEffWeight; //! TBranch *b_overallEventWeight; //! TBranch *b_L1prefiringWeight; //! TBranch *b_L1prefiringWeightUp; //! TBranch *b_L1prefiringWeightDn; //! TBranch *b_HqTMCweight; //! TBranch *b_xsec; //! TBranch *b_genxsec; //! TBranch *b_genBR; //! TBranch *b_genExtInfo; //! TBranch *b_GenHMass; //! TBranch *b_GenHPt; //! TBranch *b_GenHRapidity; //! TBranch *b_GenZ1Mass; //! TBranch *b_GenZ1Pt; //! TBranch *b_GenZ1Phi; //! TBranch *b_GenZ1Flav; //! TBranch *b_GenZ2Mass; //! TBranch *b_GenZ2Pt; //! TBranch *b_GenZ2Phi; //! TBranch *b_GenZ2Flav; //! TBranch *b_GenLep1Pt; //! TBranch *b_GenLep1Eta; //! TBranch *b_GenLep1Phi; //! TBranch *b_GenLep1Id; //! TBranch *b_GenLep2Pt; //! TBranch *b_GenLep2Eta; //! TBranch *b_GenLep2Phi; //! TBranch *b_GenLep2Id; //! TBranch *b_GenLep3Pt; //! TBranch *b_GenLep3Eta; //! TBranch *b_GenLep3Phi; //! TBranch *b_GenLep3Id; //! TBranch *b_GenLep4Pt; //! TBranch *b_GenLep4Eta; //! TBranch *b_GenLep4Phi; //! TBranch *b_GenLep4Id; //! TBranch *b_GenAssocLep1Pt; //! TBranch *b_GenAssocLep1Eta; //! TBranch *b_GenAssocLep1Phi; //! TBranch *b_GenAssocLep1Id; //! TBranch *b_GenAssocLep2Pt; //! TBranch *b_GenAssocLep2Eta; //! TBranch *b_GenAssocLep2Phi; //! TBranch *b_GenAssocLep2Id; //! TBranch *b_htxs_errorCode; //! TBranch *b_htxs_prodMode; //! TBranch *b_htxsNJets; //! TBranch *b_htxsHPt; //! TBranch *b_htxs_stage0_cat; //! TBranch *b_htxs_stage1_cat; //! TBranch *b_ggH_NNLOPS_weight; //! TBranch *b_ggH_NNLOPS_weight_unc; //! TBranch *b_qcd_ggF_uncertSF; //! TBranch *b_LHEMotherPz; //! TBranch *b_LHEMotherE; //! TBranch *b_LHEMotherId; //! TBranch *b_LHEDaughterPt; //! TBranch *b_LHEDaughterEta; //! TBranch *b_LHEDaughterPhi; //! TBranch *b_LHEDaughterMass; //! TBranch *b_LHEDaughterId; //! TBranch *b_LHEAssociatedParticlePt; //! TBranch *b_LHEAssociatedParticleEta; //! TBranch *b_LHEAssociatedParticlePhi; //! TBranch *b_LHEAssociatedParticleMass; //! TBranch *b_LHEAssociatedParticleId; //! TBranch *b_LHEPDFScale; //! TBranch *b_LHEweight_QCDscale_muR1_muF1; //! TBranch *b_LHEweight_QCDscale_muR1_muF2; //! TBranch *b_LHEweight_QCDscale_muR1_muF0p5; //! TBranch *b_LHEweight_QCDscale_muR2_muF1; //! TBranch *b_LHEweight_QCDscale_muR2_muF2; //! TBranch *b_LHEweight_QCDscale_muR2_muF0p5; //! TBranch *b_LHEweight_QCDscale_muR0p5_muF1; //! TBranch *b_LHEweight_QCDscale_muR0p5_muF2; //! TBranch *b_LHEweight_QCDscale_muR0p5_muF0p5; //! TBranch *b_LHEweight_PDFVariation_Up; //! TBranch *b_LHEweight_PDFVariation_Dn; //! TBranch *b_LHEweight_AsMZ_Up; //! TBranch *b_LHEweight_AsMZ_Dn; //! TBranch *b_PythiaWeight_isr_muR4; //! TBranch *b_PythiaWeight_isr_muR2; //! TBranch *b_PythiaWeight_isr_muRsqrt2; //! TBranch *b_PythiaWeight_isr_muRoneoversqrt2; //! TBranch *b_PythiaWeight_isr_muR0p5; //! TBranch *b_PythiaWeight_isr_muR0p25; //! TBranch *b_PythiaWeight_fsr_muR4; //! TBranch *b_PythiaWeight_fsr_muR2; //! TBranch *b_PythiaWeight_fsr_muRsqrt2; //! TBranch *b_PythiaWeight_fsr_muRoneoversqrt2; //! TBranch *b_PythiaWeight_fsr_muR0p5; //! TBranch *b_PythiaWeight_fsr_muR0p25; //! TBranch *b_pConst_GG_SIG_ghg2_1_ghz1_1_JHUGen; //! TBranch *b_p_GG_SIG_ghg2_1_ghz1_1_JHUGen; //! TBranch *b_p_GG_SIG_ghg2_1_ghz1prime2_1E4_JHUGen; //! TBranch *b_p_GG_SIG_ghg2_1_ghz2_1_JHUGen; //! TBranch *b_p_GG_SIG_ghg2_1_ghz4_1_JHUGen; //! TBranch *b_p_GG_SIG_ghg2_1_ghza1prime2_1E4_JHUGen; //! TBranch *b_p_GG_SIG_ghg2_1_ghza2_1_JHUGen; //! TBranch *b_p_GG_SIG_ghg2_1_ghza4_1_JHUGen; //! TBranch *b_p_GG_SIG_ghg2_1_gha2_1_JHUGen; //! TBranch *b_p_GG_SIG_ghg2_1_gha4_1_JHUGen; //! TBranch *b_p_GG_SIG_ghg2_1_ghz1_1_ghz1prime2_1E4_JHUGen; //! TBranch *b_p_GG_SIG_ghg2_1_ghz1_1_ghz2_1_JHUGen; //! TBranch *b_p_GG_SIG_ghg2_1_ghz1_1_ghz2_i_JHUGen; //! TBranch *b_p_GG_SIG_ghg2_1_ghz1_1_ghz4_1_JHUGen; //! TBranch *b_p_GG_SIG_ghg2_1_ghz1_1_ghz4_i_JHUGen; //! TBranch *b_p_GG_SIG_ghg2_1_ghz1_1_ghza1prime2_1E4_JHUGen; //! TBranch *b_p_GG_SIG_ghg2_1_ghz1_1_ghza1prime2_1E4i_JHUGen; //! TBranch *b_p_GG_SIG_ghg2_1_ghz1_1_ghza2_1_JHUGen; //! TBranch *b_p_GG_SIG_ghg2_1_ghz1_1_ghza4_1_JHUGen; //! TBranch *b_p_GG_SIG_ghg2_1_ghz1_1_gha2_1_JHUGen; //! TBranch *b_p_GG_SIG_ghg2_1_ghz1_1_gha4_1_JHUGen; //! TBranch *b_p_GG_SIG_ghg2_1_ghz1prime2_1E4_ghza1prime2_1E4_JHUGen; //! TBranch *b_pAux_JVBF_SIG_ghv1_1_JHUGen_JECNominal; //! TBranch *b_p_JVBF_SIG_ghv1_1_JHUGen_JECNominal; //! TBranch *b_pConst_JQCD_SIG_ghg2_1_JHUGen_JECNominal; //! TBranch *b_p_JQCD_SIG_ghg2_1_JHUGen_JECNominal; //! TBranch *b_pConst_JJVBF_SIG_ghv1_1_JHUGen_JECNominal; //! TBranch *b_p_JJVBF_SIG_ghv1_1_JHUGen_JECNominal; //! TBranch *b_p_JJVBF_SIG_ghv1prime2_1E4_JHUGen_JECNominal; //! TBranch *b_p_JJVBF_SIG_ghv2_1_JHUGen_JECNominal; //! TBranch *b_p_JJVBF_SIG_ghv4_1_JHUGen_JECNominal; //! TBranch *b_p_JJVBF_SIG_ghza1prime2_1E4_JHUGen_JECNominal; //! TBranch *b_p_JJVBF_SIG_ghza2_1_JHUGen_JECNominal; //! TBranch *b_p_JJVBF_SIG_ghza4_1_JHUGen_JECNominal; //! TBranch *b_p_JJVBF_SIG_gha2_1_JHUGen_JECNominal; //! TBranch *b_p_JJVBF_SIG_gha4_1_JHUGen_JECNominal; //! TBranch *b_p_JJVBF_SIG_ghv1_1_ghv1prime2_1E4_JHUGen_JECNominal; //! TBranch *b_p_JJVBF_SIG_ghv1_1_ghv2_1_JHUGen_JECNominal; //! TBranch *b_p_JJVBF_SIG_ghv1_1_ghv4_1_JHUGen_JECNominal; //! TBranch *b_p_JJVBF_SIG_ghv1_1_ghza1prime2_1E4_JHUGen_JECNominal; //! TBranch *b_p_JJVBF_SIG_ghv1_1_ghza2_1_JHUGen_JECNominal; //! TBranch *b_p_JJVBF_SIG_ghv1_1_ghza4_1_JHUGen_JECNominal; //! TBranch *b_p_JJVBF_SIG_ghv1_1_gha2_1_JHUGen_JECNominal; //! TBranch *b_p_JJVBF_SIG_ghv1_1_gha4_1_JHUGen_JECNominal; //! TBranch *b_pConst_JJQCD_SIG_ghg2_1_JHUGen_JECNominal; //! TBranch *b_p_JJQCD_SIG_ghg2_1_JHUGen_JECNominal; //! TBranch *b_p_JJQCD_SIG_ghg4_1_JHUGen_JECNominal; //! TBranch *b_p_JJQCD_SIG_ghg2_1_ghg4_1_JHUGen_JECNominal; //! TBranch *b_pConst_JJQCD_InitialQQ_SIG_ghg2_1_JHUGen_JECNominal; //! TBranch *b_p_JJQCD_InitialQQ_SIG_ghg2_1_JHUGen_JECNominal; //! TBranch *b_p_JJQCD_InitialQQ_SIG_ghg4_1_JHUGen_JECNominal; //! TBranch *b_p_JJQCD_InitialQQ_SIG_ghg2_1_ghg4_1_JHUGen_JECNominal; //! TBranch *b_pConst_HadZH_SIG_ghz1_1_JHUGen_JECNominal; //! TBranch *b_p_HadZH_SIG_ghz1_1_JHUGen_JECNominal; //! TBranch *b_p_HadZH_SIG_ghz1prime2_1E4_JHUGen_JECNominal; //! TBranch *b_p_HadZH_SIG_ghz2_1_JHUGen_JECNominal; //! TBranch *b_p_HadZH_SIG_ghz4_1_JHUGen_JECNominal; //! TBranch *b_p_HadZH_SIG_ghza1prime2_1E4_JHUGen_JECNominal; //! TBranch *b_p_HadZH_SIG_ghza2_1_JHUGen_JECNominal; //! TBranch *b_p_HadZH_SIG_ghza4_1_JHUGen_JECNominal; //! TBranch *b_p_HadZH_SIG_gha2_1_JHUGen_JECNominal; //! TBranch *b_p_HadZH_SIG_gha4_1_JHUGen_JECNominal; //! TBranch *b_p_HadZH_SIG_ghz1_1_ghz1prime2_1E4_JHUGen_JECNominal; //! TBranch *b_p_HadZH_SIG_ghz1_1_ghz2_1_JHUGen_JECNominal; //! TBranch *b_p_HadZH_SIG_ghz1_1_ghz4_1_JHUGen_JECNominal; //! TBranch *b_p_HadZH_SIG_ghz1_1_ghza1prime2_1E4_JHUGen_JECNominal; //! TBranch *b_p_HadZH_SIG_ghz1_1_ghza2_1_JHUGen_JECNominal; //! TBranch *b_p_HadZH_SIG_ghz1_1_ghza4_1_JHUGen_JECNominal; //! TBranch *b_p_HadZH_SIG_ghz1_1_gha2_1_JHUGen_JECNominal; //! TBranch *b_p_HadZH_SIG_ghz1_1_gha4_1_JHUGen_JECNominal; //! TBranch *b_pConst_HadWH_SIG_ghw1_1_JHUGen_JECNominal; //! TBranch *b_p_HadWH_SIG_ghw1_1_JHUGen_JECNominal; //! TBranch *b_p_HadWH_SIG_ghw1prime2_1E4_JHUGen_JECNominal; //! TBranch *b_p_HadWH_SIG_ghw2_1_JHUGen_JECNominal; //! TBranch *b_p_HadWH_SIG_ghw4_1_JHUGen_JECNominal; //! TBranch *b_p_HadWH_SIG_ghw1_1_ghw1prime2_1E4_JHUGen_JECNominal; //! TBranch *b_p_HadWH_SIG_ghw1_1_ghw2_1_JHUGen_JECNominal; //! TBranch *b_p_HadWH_SIG_ghw1_1_ghw4_1_JHUGen_JECNominal; //! TBranch *b_p_ttHUndecayed_SIG_kappa_1_JHUGen_JECNominal; //! TBranch *b_p_ttHUndecayed_SIG_kappatilde_1_JHUGen_JECNominal; //! TBranch *b_p_ttHUndecayed_SIG_kappa_1_kappatilde_1_JHUGen_JECNominal; //! TBranch *b_p_bbH_SIG_kappa_1_JHUGen_JECNominal; //! TBranch *b_pAux_JVBF_SIG_ghv1_1_JHUGen_JECUp; //! TBranch *b_p_JVBF_SIG_ghv1_1_JHUGen_JECUp; //! TBranch *b_pConst_JQCD_SIG_ghg2_1_JHUGen_JECUp; //! TBranch *b_p_JQCD_SIG_ghg2_1_JHUGen_JECUp; //! TBranch *b_pConst_JJVBF_SIG_ghv1_1_JHUGen_JECUp; //! TBranch *b_p_JJVBF_SIG_ghv1_1_JHUGen_JECUp; //! TBranch *b_p_JJVBF_SIG_ghv1prime2_1E4_JHUGen_JECUp; //! TBranch *b_p_JJVBF_SIG_ghv2_1_JHUGen_JECUp; //! TBranch *b_p_JJVBF_SIG_ghv4_1_JHUGen_JECUp; //! TBranch *b_p_JJVBF_SIG_ghza1prime2_1E4_JHUGen_JECUp; //! TBranch *b_p_JJVBF_SIG_ghza2_1_JHUGen_JECUp; //! TBranch *b_p_JJVBF_SIG_ghza4_1_JHUGen_JECUp; //! TBranch *b_p_JJVBF_SIG_gha2_1_JHUGen_JECUp; //! TBranch *b_p_JJVBF_SIG_gha4_1_JHUGen_JECUp; //! TBranch *b_p_JJVBF_SIG_ghv1_1_ghv1prime2_1E4_JHUGen_JECUp; //! TBranch *b_p_JJVBF_SIG_ghv1_1_ghv2_1_JHUGen_JECUp; //! TBranch *b_p_JJVBF_SIG_ghv1_1_ghv4_1_JHUGen_JECUp; //! TBranch *b_p_JJVBF_SIG_ghv1_1_ghza1prime2_1E4_JHUGen_JECUp; //! TBranch *b_p_JJVBF_SIG_ghv1_1_ghza2_1_JHUGen_JECUp; //! TBranch *b_p_JJVBF_SIG_ghv1_1_ghza4_1_JHUGen_JECUp; //! TBranch *b_p_JJVBF_SIG_ghv1_1_gha2_1_JHUGen_JECUp; //! TBranch *b_p_JJVBF_SIG_ghv1_1_gha4_1_JHUGen_JECUp; //! TBranch *b_pConst_JJQCD_SIG_ghg2_1_JHUGen_JECUp; //! TBranch *b_p_JJQCD_SIG_ghg2_1_JHUGen_JECUp; //! TBranch *b_p_JJQCD_SIG_ghg4_1_JHUGen_JECUp; //! TBranch *b_p_JJQCD_SIG_ghg2_1_ghg4_1_JHUGen_JECUp; //! TBranch *b_pConst_JJQCD_InitialQQ_SIG_ghg2_1_JHUGen_JECUp; //! TBranch *b_p_JJQCD_InitialQQ_SIG_ghg2_1_JHUGen_JECUp; //! TBranch *b_p_JJQCD_InitialQQ_SIG_ghg4_1_JHUGen_JECUp; //! TBranch *b_p_JJQCD_InitialQQ_SIG_ghg2_1_ghg4_1_JHUGen_JECUp; //! TBranch *b_pConst_HadZH_SIG_ghz1_1_JHUGen_JECUp; //! TBranch *b_p_HadZH_SIG_ghz1_1_JHUGen_JECUp; //! TBranch *b_p_HadZH_SIG_ghz1prime2_1E4_JHUGen_JECUp; //! TBranch *b_p_HadZH_SIG_ghz2_1_JHUGen_JECUp; //! TBranch *b_p_HadZH_SIG_ghz4_1_JHUGen_JECUp; //! TBranch *b_p_HadZH_SIG_ghza1prime2_1E4_JHUGen_JECUp; //! TBranch *b_p_HadZH_SIG_ghza2_1_JHUGen_JECUp; //! TBranch *b_p_HadZH_SIG_ghza4_1_JHUGen_JECUp; //! TBranch *b_p_HadZH_SIG_gha2_1_JHUGen_JECUp; //! TBranch *b_p_HadZH_SIG_gha4_1_JHUGen_JECUp; //! TBranch *b_p_HadZH_SIG_ghz1_1_ghz1prime2_1E4_JHUGen_JECUp; //! TBranch *b_p_HadZH_SIG_ghz1_1_ghz2_1_JHUGen_JECUp; //! TBranch *b_p_HadZH_SIG_ghz1_1_ghz4_1_JHUGen_JECUp; //! TBranch *b_p_HadZH_SIG_ghz1_1_ghza1prime2_1E4_JHUGen_JECUp; //! TBranch *b_p_HadZH_SIG_ghz1_1_ghza2_1_JHUGen_JECUp; //! TBranch *b_p_HadZH_SIG_ghz1_1_ghza4_1_JHUGen_JECUp; //! TBranch *b_p_HadZH_SIG_ghz1_1_gha2_1_JHUGen_JECUp; //! TBranch *b_p_HadZH_SIG_ghz1_1_gha4_1_JHUGen_JECUp; //! TBranch *b_pConst_HadWH_SIG_ghw1_1_JHUGen_JECUp; //! TBranch *b_p_HadWH_SIG_ghw1_1_JHUGen_JECUp; //! TBranch *b_p_HadWH_SIG_ghw1prime2_1E4_JHUGen_JECUp; //! TBranch *b_p_HadWH_SIG_ghw2_1_JHUGen_JECUp; //! TBranch *b_p_HadWH_SIG_ghw4_1_JHUGen_JECUp; //! TBranch *b_p_HadWH_SIG_ghw1_1_ghw1prime2_1E4_JHUGen_JECUp; //! TBranch *b_p_HadWH_SIG_ghw1_1_ghw2_1_JHUGen_JECUp; //! TBranch *b_p_HadWH_SIG_ghw1_1_ghw4_1_JHUGen_JECUp; //! TBranch *b_p_ttHUndecayed_SIG_kappa_1_JHUGen_JECUp; //! TBranch *b_p_ttHUndecayed_SIG_kappatilde_1_JHUGen_JECUp; //! TBranch *b_p_ttHUndecayed_SIG_kappa_1_kappatilde_1_JHUGen_JECUp; //! TBranch *b_p_bbH_SIG_kappa_1_JHUGen_JECUp; //! TBranch *b_pAux_JVBF_SIG_ghv1_1_JHUGen_JECDn; //! TBranch *b_p_JVBF_SIG_ghv1_1_JHUGen_JECDn; //! TBranch *b_pConst_JQCD_SIG_ghg2_1_JHUGen_JECDn; //! TBranch *b_p_JQCD_SIG_ghg2_1_JHUGen_JECDn; //! TBranch *b_pConst_JJVBF_SIG_ghv1_1_JHUGen_JECDn; //! TBranch *b_p_JJVBF_SIG_ghv1_1_JHUGen_JECDn; //! TBranch *b_p_JJVBF_SIG_ghv1prime2_1E4_JHUGen_JECDn; //! TBranch *b_p_JJVBF_SIG_ghv2_1_JHUGen_JECDn; //! TBranch *b_p_JJVBF_SIG_ghv4_1_JHUGen_JECDn; //! TBranch *b_p_JJVBF_SIG_ghza1prime2_1E4_JHUGen_JECDn; //! TBranch *b_p_JJVBF_SIG_ghza2_1_JHUGen_JECDn; //! TBranch *b_p_JJVBF_SIG_ghza4_1_JHUGen_JECDn; //! TBranch *b_p_JJVBF_SIG_gha2_1_JHUGen_JECDn; //! TBranch *b_p_JJVBF_SIG_gha4_1_JHUGen_JECDn; //! TBranch *b_p_JJVBF_SIG_ghv1_1_ghv1prime2_1E4_JHUGen_JECDn; //! TBranch *b_p_JJVBF_SIG_ghv1_1_ghv2_1_JHUGen_JECDn; //! TBranch *b_p_JJVBF_SIG_ghv1_1_ghv4_1_JHUGen_JECDn; //! TBranch *b_p_JJVBF_SIG_ghv1_1_ghza1prime2_1E4_JHUGen_JECDn; //! TBranch *b_p_JJVBF_SIG_ghv1_1_ghza2_1_JHUGen_JECDn; //! TBranch *b_p_JJVBF_SIG_ghv1_1_ghza4_1_JHUGen_JECDn; //! TBranch *b_p_JJVBF_SIG_ghv1_1_gha2_1_JHUGen_JECDn; //! TBranch *b_p_JJVBF_SIG_ghv1_1_gha4_1_JHUGen_JECDn; //! TBranch *b_pConst_JJQCD_SIG_ghg2_1_JHUGen_JECDn; //! TBranch *b_p_JJQCD_SIG_ghg2_1_JHUGen_JECDn; //! TBranch *b_p_JJQCD_SIG_ghg4_1_JHUGen_JECDn; //! TBranch *b_p_JJQCD_SIG_ghg2_1_ghg4_1_JHUGen_JECDn; //! TBranch *b_pConst_JJQCD_InitialQQ_SIG_ghg2_1_JHUGen_JECDn; //! TBranch *b_p_JJQCD_InitialQQ_SIG_ghg2_1_JHUGen_JECDn; //! TBranch *b_p_JJQCD_InitialQQ_SIG_ghg4_1_JHUGen_JECDn; //! TBranch *b_p_JJQCD_InitialQQ_SIG_ghg2_1_ghg4_1_JHUGen_JECDn; //! TBranch *b_pConst_HadZH_SIG_ghz1_1_JHUGen_JECDn; //! TBranch *b_p_HadZH_SIG_ghz1_1_JHUGen_JECDn; //! TBranch *b_p_HadZH_SIG_ghz1prime2_1E4_JHUGen_JECDn; //! TBranch *b_p_HadZH_SIG_ghz2_1_JHUGen_JECDn; //! TBranch *b_p_HadZH_SIG_ghz4_1_JHUGen_JECDn; //! TBranch *b_p_HadZH_SIG_ghza1prime2_1E4_JHUGen_JECDn; //! TBranch *b_p_HadZH_SIG_ghza2_1_JHUGen_JECDn; //! TBranch *b_p_HadZH_SIG_ghza4_1_JHUGen_JECDn; //! TBranch *b_p_HadZH_SIG_gha2_1_JHUGen_JECDn; //! TBranch *b_p_HadZH_SIG_gha4_1_JHUGen_JECDn; //! TBranch *b_p_HadZH_SIG_ghz1_1_ghz1prime2_1E4_JHUGen_JECDn; //! TBranch *b_p_HadZH_SIG_ghz1_1_ghz2_1_JHUGen_JECDn; //! TBranch *b_p_HadZH_SIG_ghz1_1_ghz4_1_JHUGen_JECDn; //! TBranch *b_p_HadZH_SIG_ghz1_1_ghza1prime2_1E4_JHUGen_JECDn; //! TBranch *b_p_HadZH_SIG_ghz1_1_ghza2_1_JHUGen_JECDn; //! TBranch *b_p_HadZH_SIG_ghz1_1_ghza4_1_JHUGen_JECDn; //! TBranch *b_p_HadZH_SIG_ghz1_1_gha2_1_JHUGen_JECDn; //! TBranch *b_p_HadZH_SIG_ghz1_1_gha4_1_JHUGen_JECDn; //! TBranch *b_pConst_HadWH_SIG_ghw1_1_JHUGen_JECDn; //! TBranch *b_p_HadWH_SIG_ghw1_1_JHUGen_JECDn; //! TBranch *b_p_HadWH_SIG_ghw1prime2_1E4_JHUGen_JECDn; //! TBranch *b_p_HadWH_SIG_ghw2_1_JHUGen_JECDn; //! TBranch *b_p_HadWH_SIG_ghw4_1_JHUGen_JECDn; //! TBranch *b_p_HadWH_SIG_ghw1_1_ghw1prime2_1E4_JHUGen_JECDn; //! TBranch *b_p_HadWH_SIG_ghw1_1_ghw2_1_JHUGen_JECDn; //! TBranch *b_p_HadWH_SIG_ghw1_1_ghw4_1_JHUGen_JECDn; //! TBranch *b_p_ttHUndecayed_SIG_kappa_1_JHUGen_JECDn; //! TBranch *b_p_ttHUndecayed_SIG_kappatilde_1_JHUGen_JECDn; //! TBranch *b_p_ttHUndecayed_SIG_kappa_1_kappatilde_1_JHUGen_JECDn; //! TBranch *b_p_bbH_SIG_kappa_1_JHUGen_JECDn; //! TBranch *b_p_LepZH_SIG_ghz1_1_JHUGen; //! TBranch *b_p_LepZH_SIG_ghz1prime2_1E4_JHUGen; //! TBranch *b_p_LepZH_SIG_ghz2_1_JHUGen; //! TBranch *b_p_LepZH_SIG_ghz4_1_JHUGen; //! TBranch *b_p_LepZH_SIG_ghza1prime2_1E4_JHUGen; //! TBranch *b_p_LepZH_SIG_ghza2_1_JHUGen; //! TBranch *b_p_LepZH_SIG_ghza4_1_JHUGen; //! TBranch *b_p_LepZH_SIG_gha2_1_JHUGen; //! TBranch *b_p_LepZH_SIG_gha4_1_JHUGen; //! TBranch *b_p_LepZH_SIG_ghz1_1_ghz1prime2_1E4_JHUGen; //! TBranch *b_p_LepZH_SIG_ghz1_1_ghz2_1_JHUGen; //! TBranch *b_p_LepZH_SIG_ghz1_1_ghz4_1_JHUGen; //! TBranch *b_p_LepZH_SIG_ghz1_1_ghza1prime2_1E4_JHUGen; //! TBranch *b_p_LepZH_SIG_ghz1_1_ghza2_1_JHUGen; //! TBranch *b_p_LepZH_SIG_ghz1_1_ghza4_1_JHUGen; //! TBranch *b_p_LepZH_SIG_ghz1_1_gha2_1_JHUGen; //! TBranch *b_p_LepZH_SIG_ghz1_1_gha4_1_JHUGen; //! TBranch *b_p_LepWH_SIG_ghw1_1_JHUGen; //! TBranch *b_p_LepWH_SIG_ghw1prime2_1E4_JHUGen; //! TBranch *b_p_LepWH_SIG_ghw2_1_JHUGen; //! TBranch *b_p_LepWH_SIG_ghw4_1_JHUGen; //! TBranch *b_p_LepWH_SIG_ghw1_1_ghw1prime2_1E4_JHUGen; //! TBranch *b_p_LepWH_SIG_ghw1_1_ghw2_1_JHUGen; //! TBranch *b_p_LepWH_SIG_ghw1_1_ghw4_1_JHUGen; //! TBranch *b_p_QQB_SIG_ZPqqLR_1_gZPz1_1_JHUGen; //! TBranch *b_p_QQB_SIG_ZPqqLR_1_gZPz2_1_JHUGen; //! TBranch *b_p_INDEPENDENT_SIG_gZPz1_1_JHUGen; //! TBranch *b_p_INDEPENDENT_SIG_gZPz2_1_JHUGen; //! TBranch *b_p_GG_SIG_gXg1_1_gXz1_1_JHUGen; //! TBranch *b_p_GG_SIG_gXg2_1_gXz2_1_JHUGen; //! TBranch *b_p_GG_SIG_gXg3_1_gXz3_1_JHUGen; //! TBranch *b_p_GG_SIG_gXg4_1_gXz4_1_JHUGen; //! TBranch *b_p_GG_SIG_gXg1_1_gXz5_1_JHUGen; //! TBranch *b_p_GG_SIG_gXg1_1_gXz1_1_gXz5_1_JHUGen; //! TBranch *b_p_GG_SIG_gXg1_1_gXz6_1_JHUGen; //! TBranch *b_p_GG_SIG_gXg1_1_gXz7_1_JHUGen; //! TBranch *b_p_GG_SIG_gXg5_1_gXz8_1_JHUGen; //! TBranch *b_p_GG_SIG_gXg5_1_gXz9_1_JHUGen; //! TBranch *b_p_GG_SIG_gXg5_1_gXz10_1_JHUGen; //! TBranch *b_p_QQB_SIG_XqqLR_1_gXz1_1_JHUGen; //! TBranch *b_p_QQB_SIG_XqqLR_1_gXz2_1_JHUGen; //! TBranch *b_p_QQB_SIG_XqqLR_1_gXz3_1_JHUGen; //! TBranch *b_p_QQB_SIG_XqqLR_1_gXz4_1_JHUGen; //! TBranch *b_p_QQB_SIG_XqqLR_1_gXz5_1_JHUGen; //! TBranch *b_p_QQB_SIG_XqqLR_1_gXz1_1_gXz5_1_JHUGen; //! TBranch *b_p_QQB_SIG_XqqLR_1_gXz6_1_JHUGen; //! TBranch *b_p_QQB_SIG_XqqLR_1_gXz7_1_JHUGen; //! TBranch *b_p_QQB_SIG_XqqLR_1_gXz8_1_JHUGen; //! TBranch *b_p_QQB_SIG_XqqLR_1_gXz9_1_JHUGen; //! TBranch *b_p_QQB_SIG_XqqLR_1_gXz10_1_JHUGen; //! TBranch *b_p_INDEPENDENT_SIG_gXz1_1_JHUGen; //! TBranch *b_p_INDEPENDENT_SIG_gXz2_1_JHUGen; //! TBranch *b_p_INDEPENDENT_SIG_gXz3_1_JHUGen; //! TBranch *b_p_INDEPENDENT_SIG_gXz4_1_JHUGen; //! TBranch *b_p_INDEPENDENT_SIG_gXz5_1_JHUGen; //! TBranch *b_p_INDEPENDENT_SIG_gXz1_1_gXz5_1_JHUGen; //! TBranch *b_p_INDEPENDENT_SIG_gXz6_1_JHUGen; //! TBranch *b_p_INDEPENDENT_SIG_gXz7_1_JHUGen; //! TBranch *b_p_INDEPENDENT_SIG_gXz8_1_JHUGen; //! TBranch *b_p_INDEPENDENT_SIG_gXz9_1_JHUGen; //! TBranch *b_p_INDEPENDENT_SIG_gXz10_1_JHUGen; //! TBranch *b_pConst_GG_SIG_kappaTopBot_1_ghz1_1_MCFM; //! TBranch *b_p_GG_SIG_kappaTopBot_1_ghz1_1_MCFM; //! TBranch *b_p_GG_BSI_kappaTopBot_1_ghz1_1_MCFM; //! TBranch *b_p_GG_BSI_kappaTopBot_1_ghz1_i_MCFM; //! TBranch *b_pConst_GG_BKG_MCFM; //! TBranch *b_p_GG_BKG_MCFM; //! TBranch *b_pConst_QQB_BKG_MCFM; //! TBranch *b_p_QQB_BKG_MCFM; //! TBranch *b_pConst_ZJJ_BKG_MCFM; //! TBranch *b_p_ZJJ_BKG_MCFM; //! TBranch *b_p_JJEW_SIG_ghv1_1_MCFM_JECNominal; //! TBranch *b_p_JJEW_BSI_ghv1_1_MCFM_JECNominal; //! TBranch *b_p_JJEW_BSI_ghv1_i_MCFM_JECNominal; //! TBranch *b_p_JJEW_BKG_MCFM_JECNominal; //! TBranch *b_pConst_JJVBF_S_SIG_ghv1_1_MCFM_JECNominal; //! TBranch *b_p_JJVBF_S_SIG_ghv1_1_MCFM_JECNominal; //! TBranch *b_p_JJVBF_S_BSI_ghv1_1_MCFM_JECNominal; //! TBranch *b_p_JJVBF_S_BSI_ghv1_i_MCFM_JECNominal; //! TBranch *b_p_JJVBF_SIG_ghv1_1_MCFM_JECNominal; //! TBranch *b_p_JJVBF_BSI_ghv1_1_MCFM_JECNominal; //! TBranch *b_p_JJVBF_BSI_ghv1_i_MCFM_JECNominal; //! TBranch *b_pConst_JJVBF_BKG_MCFM_JECNominal; //! TBranch *b_p_JJVBF_BKG_MCFM_JECNominal; //! TBranch *b_pConst_HadZH_S_SIG_ghz1_1_MCFM_JECNominal; //! TBranch *b_p_HadZH_S_SIG_ghz1_1_MCFM_JECNominal; //! TBranch *b_p_HadZH_S_BSI_ghz1_1_MCFM_JECNominal; //! TBranch *b_p_HadZH_S_BSI_ghz1_i_MCFM_JECNominal; //! TBranch *b_p_HadZH_SIG_ghz1_1_MCFM_JECNominal; //! TBranch *b_p_HadZH_BSI_ghz1_1_MCFM_JECNominal; //! TBranch *b_p_HadZH_BSI_ghz1_i_MCFM_JECNominal; //! TBranch *b_pConst_HadZH_BKG_MCFM_JECNominal; //! TBranch *b_p_HadZH_BKG_MCFM_JECNominal; //! TBranch *b_pConst_HadWH_S_SIG_ghw1_1_MCFM_JECNominal; //! TBranch *b_p_HadWH_S_SIG_ghw1_1_MCFM_JECNominal; //! TBranch *b_p_HadWH_S_BSI_ghw1_1_MCFM_JECNominal; //! TBranch *b_p_HadWH_S_BSI_ghw1_i_MCFM_JECNominal; //! TBranch *b_pConst_HadWH_BKG_MCFM_JECNominal; //! TBranch *b_p_HadWH_BKG_MCFM_JECNominal; //! TBranch *b_pConst_JJQCD_BKG_MCFM_JECNominal; //! TBranch *b_p_JJQCD_BKG_MCFM_JECNominal; //! TBranch *b_p_JJEW_SIG_ghv1_1_MCFM_JECUp; //! TBranch *b_p_JJEW_BSI_ghv1_1_MCFM_JECUp; //! TBranch *b_p_JJEW_BSI_ghv1_i_MCFM_JECUp; //! TBranch *b_p_JJEW_BKG_MCFM_JECUp; //! TBranch *b_pConst_JJVBF_S_SIG_ghv1_1_MCFM_JECUp; //! TBranch *b_p_JJVBF_S_SIG_ghv1_1_MCFM_JECUp; //! TBranch *b_p_JJVBF_S_BSI_ghv1_1_MCFM_JECUp; //! TBranch *b_p_JJVBF_S_BSI_ghv1_i_MCFM_JECUp; //! TBranch *b_p_JJVBF_SIG_ghv1_1_MCFM_JECUp; //! TBranch *b_p_JJVBF_BSI_ghv1_1_MCFM_JECUp; //! TBranch *b_p_JJVBF_BSI_ghv1_i_MCFM_JECUp; //! TBranch *b_pConst_JJVBF_BKG_MCFM_JECUp; //! TBranch *b_p_JJVBF_BKG_MCFM_JECUp; //! TBranch *b_pConst_HadZH_S_SIG_ghz1_1_MCFM_JECUp; //! TBranch *b_p_HadZH_S_SIG_ghz1_1_MCFM_JECUp; //! TBranch *b_p_HadZH_S_BSI_ghz1_1_MCFM_JECUp; //! TBranch *b_p_HadZH_S_BSI_ghz1_i_MCFM_JECUp; //! TBranch *b_p_HadZH_SIG_ghz1_1_MCFM_JECUp; //! TBranch *b_p_HadZH_BSI_ghz1_1_MCFM_JECUp; //! TBranch *b_p_HadZH_BSI_ghz1_i_MCFM_JECUp; //! TBranch *b_pConst_HadZH_BKG_MCFM_JECUp; //! TBranch *b_p_HadZH_BKG_MCFM_JECUp; //! TBranch *b_pConst_HadWH_S_SIG_ghw1_1_MCFM_JECUp; //! TBranch *b_p_HadWH_S_SIG_ghw1_1_MCFM_JECUp; //! TBranch *b_p_HadWH_S_BSI_ghw1_1_MCFM_JECUp; //! TBranch *b_p_HadWH_S_BSI_ghw1_i_MCFM_JECUp; //! TBranch *b_pConst_HadWH_BKG_MCFM_JECUp; //! TBranch *b_p_HadWH_BKG_MCFM_JECUp; //! TBranch *b_pConst_JJQCD_BKG_MCFM_JECUp; //! TBranch *b_p_JJQCD_BKG_MCFM_JECUp; //! TBranch *b_p_JJEW_SIG_ghv1_1_MCFM_JECDn; //! TBranch *b_p_JJEW_BSI_ghv1_1_MCFM_JECDn; //! TBranch *b_p_JJEW_BSI_ghv1_i_MCFM_JECDn; //! TBranch *b_p_JJEW_BKG_MCFM_JECDn; //! TBranch *b_pConst_JJVBF_S_SIG_ghv1_1_MCFM_JECDn; //! TBranch *b_p_JJVBF_S_SIG_ghv1_1_MCFM_JECDn; //! TBranch *b_p_JJVBF_S_BSI_ghv1_1_MCFM_JECDn; //! TBranch *b_p_JJVBF_S_BSI_ghv1_i_MCFM_JECDn; //! TBranch *b_p_JJVBF_SIG_ghv1_1_MCFM_JECDn; //! TBranch *b_p_JJVBF_BSI_ghv1_1_MCFM_JECDn; //! TBranch *b_p_JJVBF_BSI_ghv1_i_MCFM_JECDn; //! TBranch *b_pConst_JJVBF_BKG_MCFM_JECDn; //! TBranch *b_p_JJVBF_BKG_MCFM_JECDn; //! TBranch *b_pConst_HadZH_S_SIG_ghz1_1_MCFM_JECDn; //! TBranch *b_p_HadZH_S_SIG_ghz1_1_MCFM_JECDn; //! TBranch *b_p_HadZH_S_BSI_ghz1_1_MCFM_JECDn; //! TBranch *b_p_HadZH_S_BSI_ghz1_i_MCFM_JECDn; //! TBranch *b_p_HadZH_SIG_ghz1_1_MCFM_JECDn; //! TBranch *b_p_HadZH_BSI_ghz1_1_MCFM_JECDn; //! TBranch *b_p_HadZH_BSI_ghz1_i_MCFM_JECDn; //! TBranch *b_pConst_HadZH_BKG_MCFM_JECDn; //! TBranch *b_p_HadZH_BKG_MCFM_JECDn; //! TBranch *b_pConst_HadWH_S_SIG_ghw1_1_MCFM_JECDn; //! TBranch *b_p_HadWH_S_SIG_ghw1_1_MCFM_JECDn; //! TBranch *b_p_HadWH_S_BSI_ghw1_1_MCFM_JECDn; //! TBranch *b_p_HadWH_S_BSI_ghw1_i_MCFM_JECDn; //! TBranch *b_pConst_HadWH_BKG_MCFM_JECDn; //! TBranch *b_p_HadWH_BKG_MCFM_JECDn; //! TBranch *b_pConst_JJQCD_BKG_MCFM_JECDn; //! TBranch *b_p_JJQCD_BKG_MCFM_JECDn; //! TBranch *b_p_m4l_SIG; //! TBranch *b_p_m4l_BKG; //! TBranch *b_p_m4l_SIG_ScaleDown; //! TBranch *b_p_m4l_BKG_ScaleDown; //! TBranch *b_p_m4l_SIG_ResDown; //! TBranch *b_p_m4l_BKG_ResDown; //! TBranch *b_p_m4l_SIG_ScaleUp; //! TBranch *b_p_m4l_BKG_ScaleUp; //! TBranch *b_p_m4l_SIG_ResUp; //! TBranch *b_p_m4l_BKG_ResUp; //! TBranch *b_p_HadZH_mavjj_true_JECNominal; //! TBranch *b_p_HadWH_mavjj_true_JECNominal; //! TBranch *b_p_HadZH_mavjj_JECNominal; //! TBranch *b_p_HadWH_mavjj_JECNominal; //! TBranch *b_p_HadZH_mavjj_true_JECUp; //! TBranch *b_p_HadWH_mavjj_true_JECUp; //! TBranch *b_p_HadZH_mavjj_JECUp; //! TBranch *b_p_HadWH_mavjj_JECUp; //! TBranch *b_p_HadZH_mavjj_true_JECDn; //! TBranch *b_p_HadWH_mavjj_true_JECDn; //! TBranch *b_p_HadZH_mavjj_JECDn; //! TBranch *b_p_HadWH_mavjj_JECDn; //! TBranch *b_pConst_JJVBF_SIG_ghv1_1_JHUGen_JECNominal_BestDJJ; //! TBranch *b_p_JJVBF_SIG_ghv1_1_JHUGen_JECNominal_BestDJJ; //! TBranch *b_pConst_JJQCD_SIG_ghg2_1_JHUGen_JECNominal_BestDJJ; //! TBranch *b_p_JJQCD_SIG_ghg2_1_JHUGen_JECNominal_BestDJJ; //! TBranch *b_pConst_JJVBF_SIG_ghv1_1_JHUGen_JECUp_BestDJJ; //! TBranch *b_p_JJVBF_SIG_ghv1_1_JHUGen_JECUp_BestDJJ; //! TBranch *b_pConst_JJQCD_SIG_ghg2_1_JHUGen_JECUp_BestDJJ; //! TBranch *b_p_JJQCD_SIG_ghg2_1_JHUGen_JECUp_BestDJJ; //! TBranch *b_pConst_JJVBF_SIG_ghv1_1_JHUGen_JECDn_BestDJJ; //! TBranch *b_p_JJVBF_SIG_ghv1_1_JHUGen_JECDn_BestDJJ; //! TBranch *b_pConst_JJQCD_SIG_ghg2_1_JHUGen_JECDn_BestDJJ; //! TBranch *b_p_JJQCD_SIG_ghg2_1_JHUGen_JECDn_BestDJJ; //! TBranch *b_p_Gen_CPStoBWPropRewgt; //! TBranch *b_p_Gen_GG_SIG_kappaTopBot_1_ghz1_1_MCFM; //! TBranch *b_p_Gen_GG_SIG_kappaTopBot_1_ghz1prime2_1E4_MCFM; //! TBranch *b_p_Gen_GG_SIG_kappaTopBot_1_ghz2_1_MCFM; //! TBranch *b_p_Gen_GG_SIG_kappaTopBot_1_ghz4_1_MCFM; //! TBranch *b_p_Gen_GG_SIG_kappaTopBot_1_ghza1prime2_1E4_MCFM; //! TBranch *b_p_Gen_GG_SIG_kappaTopBot_1_ghza2_1_MCFM; //! TBranch *b_p_Gen_GG_SIG_kappaTopBot_1_ghza4_1_MCFM; //! TBranch *b_p_Gen_GG_SIG_kappaTopBot_1_gha2_1_MCFM; //! TBranch *b_p_Gen_GG_SIG_kappaTopBot_1_gha4_1_MCFM; //! TBranch *b_p_Gen_GG_SIG_kappaTopBot_1_ghz1_1_ghz1prime2_1E4_MCFM; //! TBranch *b_p_Gen_GG_SIG_kappaTopBot_1_ghz1_1_ghz2_1_MCFM; //! TBranch *b_p_Gen_GG_SIG_kappaTopBot_1_ghz1_1_ghz4_1_MCFM; //! TBranch *b_p_Gen_GG_SIG_kappaTopBot_1_ghz1_1_ghza1prime2_1E4_MCFM; //! TBranch *b_p_Gen_GG_SIG_kappaTopBot_1_ghz1_1_ghza2_1_MCFM; //! TBranch *b_p_Gen_GG_SIG_kappaTopBot_1_ghz1_1_ghza4_1_MCFM; //! TBranch *b_p_Gen_GG_SIG_kappaTopBot_1_ghz1_1_gha2_1_MCFM; //! TBranch *b_p_Gen_GG_SIG_kappaTopBot_1_ghz1_1_gha4_1_MCFM; //! TBranch *b_p_Gen_GG_BSI_kappaTopBot_1_ghz1_1_MCFM; //! TBranch *b_p_Gen_GG_BSI_kappaTopBot_1_ghz1prime2_1E4_MCFM; //! TBranch *b_p_Gen_GG_BSI_kappaTopBot_1_ghz2_1_MCFM; //! TBranch *b_p_Gen_GG_BSI_kappaTopBot_1_ghz4_1_MCFM; //! TBranch *b_p_Gen_GG_BSI_kappaTopBot_1_ghza1prime2_1E4_MCFM; //! TBranch *b_p_Gen_GG_BSI_kappaTopBot_1_ghza2_1_MCFM; //! TBranch *b_p_Gen_GG_BSI_kappaTopBot_1_ghza4_1_MCFM; //! TBranch *b_p_Gen_GG_BSI_kappaTopBot_1_gha2_1_MCFM; //! TBranch *b_p_Gen_GG_BSI_kappaTopBot_1_gha4_1_MCFM; //! TBranch *b_p_Gen_GG_BKG_MCFM; //! TBranch *b_p_Gen_QQB_BKG_MCFM; //! TBranch *b_p_Gen_GG_SIG_gXg1_1_gXz1_1_JHUGen; //! TBranch *b_p_Gen_GG_SIG_gXg2_1_gXz2_1_JHUGen; //! TBranch *b_p_Gen_GG_SIG_gXg3_1_gXz3_1_JHUGen; //! TBranch *b_p_Gen_GG_SIG_gXg4_1_gXz4_1_JHUGen; //! TBranch *b_p_Gen_GG_SIG_gXg1_1_gXz5_1_JHUGen; //! TBranch *b_p_Gen_GG_SIG_gXg1_1_gXz1_1_gXz5_1_JHUGen; //! TBranch *b_p_Gen_GG_SIG_gXg1_1_gXz6_1_JHUGen; //! TBranch *b_p_Gen_GG_SIG_gXg1_1_gXz7_1_JHUGen; //! TBranch *b_p_Gen_GG_SIG_gXg5_1_gXz8_1_JHUGen; //! TBranch *b_p_Gen_GG_SIG_gXg5_1_gXz9_1_JHUGen; //! TBranch *b_p_Gen_GG_SIG_gXg5_1_gXz10_1_JHUGen; //! Analyzer(); virtual ~Analyzer(); virtual Int_t Cut(Long64_t entry); virtual Int_t GetEntry(Long64_t entry); virtual Long64_t LoadTree(Long64_t entry); virtual void Init(TTree *tree); virtual void Loop(); virtual Bool_t Notify(); virtual void Show(Long64_t entry = -1); virtual void PlotHistogram(TString); virtual void SavePlots(TCanvas*, TString); virtual void PlotMass(); virtual void PlotDkin(); private: TCanvas *c, *c1; TLorentzVector l1,l2,l3,l4,Z1,Z2,H; TH1F *LeptonPt_histo[4], *LeptonEta_histo[4], *LeptonPhi_histo[4], *LeptonBDT_histo[4], *Higgs_recMass_histo; TString histo_name; TFile *input_file; TTree *input_tree; float gen_sum_weights, _event_weight; TH1F *hCounters; TH1F *Mass_histo_signal, *Mass_histo_background; TH1F *Dkin_histo_signal, *Dkin_histo_background; TH2F *histo_signal, *histo_background; float Dkin; TLegend *legend; TLegend* CreateLegend(TH1F *lepton_1, TH1F *lepton_2, TH1F *lepton_3, TH1F *lepton_4); }; #endif #ifdef Analyzer_cxx Int_t Analyzer::GetEntry(Long64_t entry) { // Read contents of entry. if (!fChain) return 0; return fChain->GetEntry(entry); } Long64_t Analyzer::LoadTree(Long64_t entry) { // Set the environment to read one entry if (!fChain) return -5; Long64_t centry = fChain->LoadTree(entry); if (centry < 0) return centry; if (fChain->GetTreeNumber() != fCurrent) { fCurrent = fChain->GetTreeNumber(); Notify(); } return centry; } void Analyzer::Init(TTree *tree) { // The Init() function is called when the selector needs to initialize // a new tree or chain. Typically here the branch addresses and branch // pointers of the tree will be set. // It is normally not necessary to make changes to the generated // code, but the routine can be extended by the user if needed. // Init() will be called many times when running on PROOF // (once per file to be processed). // Set object pointer LepPt = 0; LepEta = 0; LepPhi = 0; LepLepId = 0; LepSIP = 0; Lepdxy = 0; Lepdz = 0; LepTime = 0; LepisID = 0; LepisLoose = 0; LepBDT = 0; LepMissingHit = 0; LepChargedHadIso = 0; LepNeutralHadIso = 0; LepPhotonIso = 0; LepPUIsoComponent = 0; LepCombRelIsoPF = 0; LepRecoSF = 0; LepRecoSF_Unc = 0; LepSelSF = 0; LepSelSF_Unc = 0; LepScale_Total_Up = 0; LepScale_Total_Dn = 0; LepScale_Stat_Up = 0; LepScale_Stat_Dn = 0; LepScale_Syst_Up = 0; LepScale_Syst_Dn = 0; LepScale_Gain_Up = 0; LepScale_Gain_Dn = 0; LepSigma_Total_Up = 0; LepSigma_Total_Dn = 0; LepSigma_Rho_Up = 0; LepSigma_Rho_Dn = 0; LepSigma_Phi_Up = 0; LepSigma_Phi_Dn = 0; fsrPt = 0; fsrEta = 0; fsrPhi = 0; fsrLept = 0; JetPt = 0; JetEta = 0; JetPhi = 0; JetMass = 0; JetBTagger = 0; JetIsBtagged = 0; JetIsBtaggedWithSF = 0; JetIsBtaggedWithSFUp = 0; JetIsBtaggedWithSFDn = 0; JetQGLikelihood = 0; JetAxis2 = 0; JetMult = 0; JetPtD = 0; JetSigma = 0; JetHadronFlavour = 0; JetPartonFlavour = 0; JetRawPt = 0; JetPtJEC_noJER = 0; JetJERUp = 0; JetJERDown = 0; JetID = 0; JetPUID = 0; JetPUValue = 0; PhotonPt = 0; PhotonEta = 0; PhotonPhi = 0; PhotonIsCutBasedLooseID = 0; ExtraLepPt = 0; ExtraLepEta = 0; ExtraLepPhi = 0; ExtraLepLepId = 0; qcd_ggF_uncertSF = 0; LHEMotherPz = 0; LHEMotherE = 0; LHEMotherId = 0; LHEDaughterPt = 0; LHEDaughterEta = 0; LHEDaughterPhi = 0; LHEDaughterMass = 0; LHEDaughterId = 0; LHEAssociatedParticlePt = 0; LHEAssociatedParticleEta = 0; LHEAssociatedParticlePhi = 0; LHEAssociatedParticleMass = 0; LHEAssociatedParticleId = 0; // Set branch addresses and branch pointers if (!tree) return; fChain = tree; fCurrent = -1; fChain->SetMakeClass(1); fChain->SetBranchAddress("RunNumber", &RunNumber, &b_RunNumber); fChain->SetBranchAddress("EventNumber", &EventNumber, &b_EventNumber); fChain->SetBranchAddress("LumiNumber", &LumiNumber, &b_LumiNumber); fChain->SetBranchAddress("NRecoMu", &NRecoMu, &b_NRecoMu); fChain->SetBranchAddress("NRecoEle", &NRecoEle, &b_NRecoEle); fChain->SetBranchAddress("Nvtx", &Nvtx, &b_Nvtx); fChain->SetBranchAddress("NObsInt", &NObsInt, &b_NObsInt); fChain->SetBranchAddress("NTrueInt", &NTrueInt, &b_NTrueInt); fChain->SetBranchAddress("GenMET", &GenMET, &b_GenMET); fChain->SetBranchAddress("GenMETPhi", &GenMETPhi, &b_GenMETPhi); fChain->SetBranchAddress("PFMET", &PFMET, &b_PFMET); fChain->SetBranchAddress("PFMET_jesUp", &PFMET_jesUp, &b_PFMET_jesUp); fChain->SetBranchAddress("PFMET_jesDn", &PFMET_jesDn, &b_PFMET_jesDn); fChain->SetBranchAddress("PFMETPhi", &PFMETPhi, &b_PFMETPhi); fChain->SetBranchAddress("PFMETPhi_jesUp", &PFMETPhi_jesUp, &b_PFMETPhi_jesUp); fChain->SetBranchAddress("PFMETPhi_jesDn", &PFMETPhi_jesDn, &b_PFMETPhi_jesDn); fChain->SetBranchAddress("PFMET_corrected", &PFMET_corrected, &b_PFMET_corrected); fChain->SetBranchAddress("PFMET_corrected_jesUp", &PFMET_corrected_jesUp, &b_PFMET_corrected_jesUp); fChain->SetBranchAddress("PFMET_corrected_jesDn", &PFMET_corrected_jesDn, &b_PFMET_corrected_jesDn); fChain->SetBranchAddress("PFMET_corrected_jerUp", &PFMET_corrected_jerUp, &b_PFMET_corrected_jerUp); fChain->SetBranchAddress("PFMET_corrected_jerDn", &PFMET_corrected_jerDn, &b_PFMET_corrected_jerDn); fChain->SetBranchAddress("PFMET_corrected_puUp", &PFMET_corrected_puUp, &b_PFMET_corrected_puUp); fChain->SetBranchAddress("PFMET_corrected_puDn", &PFMET_corrected_puDn, &b_PFMET_corrected_puDn); fChain->SetBranchAddress("PFMET_corrected_metUp", &PFMET_corrected_metUp, &b_PFMET_corrected_metUp); fChain->SetBranchAddress("PFMET_corrected_metDn", &PFMET_corrected_metDn, &b_PFMET_corrected_metDn); fChain->SetBranchAddress("PFMETPhi_corrected", &PFMETPhi_corrected, &b_PFMETPhi_corrected); fChain->SetBranchAddress("PFMETPhi_corrected_jesUp", &PFMETPhi_corrected_jesUp, &b_PFMETPhi_corrected_jesUp); fChain->SetBranchAddress("PFMETPhi_corrected_jesDn", &PFMETPhi_corrected_jesDn, &b_PFMETPhi_corrected_jesDn); fChain->SetBranchAddress("PFMETPhi_corrected_jerUp", &PFMETPhi_corrected_jerUp, &b_PFMETPhi_corrected_jerUp); fChain->SetBranchAddress("PFMETPhi_corrected_jerDn", &PFMETPhi_corrected_jerDn, &b_PFMETPhi_corrected_jerDn); fChain->SetBranchAddress("PFMETPhi_corrected_puUp", &PFMETPhi_corrected_puUp, &b_PFMETPhi_corrected_puUp); fChain->SetBranchAddress("PFMETPhi_corrected_puDn", &PFMETPhi_corrected_puDn, &b_PFMETPhi_corrected_puDn); fChain->SetBranchAddress("PFMETPhi_corrected_metUp", &PFMETPhi_corrected_metUp, &b_PFMETPhi_corrected_metUp); fChain->SetBranchAddress("PFMETPhi_corrected_metDn", &PFMETPhi_corrected_metDn, &b_PFMETPhi_corrected_metDn); fChain->SetBranchAddress("nCleanedJets", &nCleanedJets, &b_nCleanedJets); fChain->SetBranchAddress("nCleanedJetsPt30", &nCleanedJetsPt30, &b_nCleanedJetsPt30); fChain->SetBranchAddress("nCleanedJetsPt30_jecUp", &nCleanedJetsPt30_jecUp, &b_nCleanedJetsPt30_jecUp); fChain->SetBranchAddress("nCleanedJetsPt30_jecDn", &nCleanedJetsPt30_jecDn, &b_nCleanedJetsPt30_jecDn); fChain->SetBranchAddress("nCleanedJetsPt30BTagged", &nCleanedJetsPt30BTagged, &b_nCleanedJetsPt30BTagged); fChain->SetBranchAddress("nCleanedJetsPt30BTagged_bTagSF", &nCleanedJetsPt30BTagged_bTagSF, &b_nCleanedJetsPt30BTagged_bTagSF); fChain->SetBranchAddress("nCleanedJetsPt30BTagged_bTagSF_jecUp", &nCleanedJetsPt30BTagged_bTagSF_jecUp, &b_nCleanedJetsPt30BTagged_bTagSF_jecUp); fChain->SetBranchAddress("nCleanedJetsPt30BTagged_bTagSF_jecDn", &nCleanedJetsPt30BTagged_bTagSF_jecDn, &b_nCleanedJetsPt30BTagged_bTagSF_jecDn); fChain->SetBranchAddress("nCleanedJetsPt30BTagged_bTagSFUp", &nCleanedJetsPt30BTagged_bTagSFUp, &b_nCleanedJetsPt30BTagged_bTagSFUp); fChain->SetBranchAddress("nCleanedJetsPt30BTagged_bTagSFDn", &nCleanedJetsPt30BTagged_bTagSFDn, &b_nCleanedJetsPt30BTagged_bTagSFDn); fChain->SetBranchAddress("trigWord", &trigWord, &b_trigWord); fChain->SetBranchAddress("evtPassMETFilter", &evtPassMETFilter, &b_evtPassMETFilter); fChain->SetBranchAddress("ZZMass", &ZZMass, &b_ZZMass); fChain->SetBranchAddress("ZZMassErr", &ZZMassErr, &b_ZZMassErr); fChain->SetBranchAddress("ZZMassErrCorr", &ZZMassErrCorr, &b_ZZMassErrCorr); fChain->SetBranchAddress("ZZMassPreFSR", &ZZMassPreFSR, &b_ZZMassPreFSR); fChain->SetBranchAddress("ZZsel", &ZZsel, &b_ZZsel); fChain->SetBranchAddress("ZZPt", &ZZPt, &b_ZZPt); fChain->SetBranchAddress("ZZEta", &ZZEta, &b_ZZEta); fChain->SetBranchAddress("ZZPhi", &ZZPhi, &b_ZZPhi); fChain->SetBranchAddress("ZZjjPt", &ZZjjPt, &b_ZZjjPt); fChain->SetBranchAddress("CRflag", &CRflag, &b_CRflag); fChain->SetBranchAddress("Z1Mass", &Z1Mass, &b_Z1Mass); fChain->SetBranchAddress("Z1Pt", &Z1Pt, &b_Z1Pt); fChain->SetBranchAddress("Z1Flav", &Z1Flav, &b_Z1Flav); fChain->SetBranchAddress("ZZMassRefit", &ZZMassRefit, &b_ZZMassRefit); fChain->SetBranchAddress("ZZMassRefitErr", &ZZMassRefitErr, &b_ZZMassRefitErr); fChain->SetBranchAddress("ZZMassUnrefitErr", &ZZMassUnrefitErr, &b_ZZMassUnrefitErr); fChain->SetBranchAddress("Z2Mass", &Z2Mass, &b_Z2Mass); fChain->SetBranchAddress("Z2Pt", &Z2Pt, &b_Z2Pt); fChain->SetBranchAddress("Z2Flav", &Z2Flav, &b_Z2Flav); fChain->SetBranchAddress("costhetastar", &costhetastar, &b_costhetastar); fChain->SetBranchAddress("helphi", &helphi, &b_helphi); fChain->SetBranchAddress("helcosthetaZ1", &helcosthetaZ1, &b_helcosthetaZ1); fChain->SetBranchAddress("helcosthetaZ2", &helcosthetaZ2, &b_helcosthetaZ2); fChain->SetBranchAddress("phistarZ1", &phistarZ1, &b_phistarZ1); fChain->SetBranchAddress("phistarZ2", &phistarZ2, &b_phistarZ2); fChain->SetBranchAddress("xi", &xi, &b_xi); fChain->SetBranchAddress("xistar", &xistar, &b_xistar); fChain->SetBranchAddress("LepPt", &LepPt, &b_LepPt); fChain->SetBranchAddress("LepEta", &LepEta, &b_LepEta); fChain->SetBranchAddress("LepPhi", &LepPhi, &b_LepPhi); fChain->SetBranchAddress("LepLepId", &LepLepId, &b_LepLepId); fChain->SetBranchAddress("LepSIP", &LepSIP, &b_LepSIP); fChain->SetBranchAddress("Lepdxy", &Lepdxy, &b_Lepdxy); fChain->SetBranchAddress("Lepdz", &Lepdz, &b_Lepdz); fChain->SetBranchAddress("LepTime", &LepTime, &b_LepTime); fChain->SetBranchAddress("LepisID", &LepisID, &b_LepisID); fChain->SetBranchAddress("LepisLoose", &LepisLoose, &b_LepisLoose); fChain->SetBranchAddress("LepBDT", &LepBDT, &b_LepBDT); fChain->SetBranchAddress("LepMissingHit", &LepMissingHit, &b_LepMissingHit); fChain->SetBranchAddress("LepChargedHadIso", &LepChargedHadIso, &b_LepChargedHadIso); fChain->SetBranchAddress("LepNeutralHadIso", &LepNeutralHadIso, &b_LepNeutralHadIso); fChain->SetBranchAddress("LepPhotonIso", &LepPhotonIso, &b_LepPhotonIso); fChain->SetBranchAddress("LepPUIsoComponent", &LepPUIsoComponent, &b_LepPUIsoComponent); fChain->SetBranchAddress("LepCombRelIsoPF", &LepCombRelIsoPF, &b_LepCombRelIsoPF); fChain->SetBranchAddress("LepRecoSF", &LepRecoSF, &b_LepRecoSF); fChain->SetBranchAddress("LepRecoSF_Unc", &LepRecoSF_Unc, &b_LepRecoSF_Unc); fChain->SetBranchAddress("LepSelSF", &LepSelSF, &b_LepSelSF); fChain->SetBranchAddress("LepSelSF_Unc", &LepSelSF_Unc, &b_LepSelSF_Unc); fChain->SetBranchAddress("LepScale_Total_Up", &LepScale_Total_Up, &b_LepScale_Total_Up); fChain->SetBranchAddress("LepScale_Total_Dn", &LepScale_Total_Dn, &b_LepScale_Total_Dn); fChain->SetBranchAddress("LepScale_Stat_Up", &LepScale_Stat_Up, &b_LepScale_Stat_Up); fChain->SetBranchAddress("LepScale_Stat_Dn", &LepScale_Stat_Dn, &b_LepScale_Stat_Dn); fChain->SetBranchAddress("LepScale_Syst_Up", &LepScale_Syst_Up, &b_LepScale_Syst_Up); fChain->SetBranchAddress("LepScale_Syst_Dn", &LepScale_Syst_Dn, &b_LepScale_Syst_Dn); fChain->SetBranchAddress("LepScale_Gain_Up", &LepScale_Gain_Up, &b_LepScale_Gain_Up); fChain->SetBranchAddress("LepScale_Gain_Dn", &LepScale_Gain_Dn, &b_LepScale_Gain_Dn); fChain->SetBranchAddress("LepSigma_Total_Up", &LepSigma_Total_Up, &b_LepSigma_Total_Up); fChain->SetBranchAddress("LepSigma_Total_Dn", &LepSigma_Total_Dn, &b_LepSigma_Total_Dn); fChain->SetBranchAddress("LepSigma_Rho_Up", &LepSigma_Rho_Up, &b_LepSigma_Rho_Up); fChain->SetBranchAddress("LepSigma_Rho_Dn", &LepSigma_Rho_Dn, &b_LepSigma_Rho_Dn); fChain->SetBranchAddress("LepSigma_Phi_Up", &LepSigma_Phi_Up, &b_LepSigma_Phi_Up); fChain->SetBranchAddress("LepSigma_Phi_Dn", &LepSigma_Phi_Dn, &b_LepSigma_Phi_Dn); fChain->SetBranchAddress("fsrPt", &fsrPt, &b_fsrPt); fChain->SetBranchAddress("fsrEta", &fsrEta, &b_fsrEta); fChain->SetBranchAddress("fsrPhi", &fsrPhi, &b_fsrPhi); fChain->SetBranchAddress("fsrLept", &fsrLept, &b_fsrLept); fChain->SetBranchAddress("passIsoPreFSR", &passIsoPreFSR, &b_passIsoPreFSR); fChain->SetBranchAddress("JetPt", &JetPt, &b_JetPt); fChain->SetBranchAddress("JetEta", &JetEta, &b_JetEta); fChain->SetBranchAddress("JetPhi", &JetPhi, &b_JetPhi); fChain->SetBranchAddress("JetMass", &JetMass, &b_JetMass); fChain->SetBranchAddress("JetBTagger", &JetBTagger, &b_JetBTagger); fChain->SetBranchAddress("JetIsBtagged", &JetIsBtagged, &b_JetIsBtagged); fChain->SetBranchAddress("JetIsBtaggedWithSF", &JetIsBtaggedWithSF, &b_JetIsBtaggedWithSF); fChain->SetBranchAddress("JetIsBtaggedWithSFUp", &JetIsBtaggedWithSFUp, &b_JetIsBtaggedWithSFUp); fChain->SetBranchAddress("JetIsBtaggedWithSFDn", &JetIsBtaggedWithSFDn, &b_JetIsBtaggedWithSFDn); fChain->SetBranchAddress("JetQGLikelihood", &JetQGLikelihood, &b_JetQGLikelihood); fChain->SetBranchAddress("JetAxis2", &JetAxis2, &b_JetAxis2); fChain->SetBranchAddress("JetMult", &JetMult, &b_JetMult); fChain->SetBranchAddress("JetPtD", &JetPtD, &b_JetPtD); fChain->SetBranchAddress("JetSigma", &JetSigma, &b_JetSigma); fChain->SetBranchAddress("JetHadronFlavour", &JetHadronFlavour, &b_JetHadronFlavour); fChain->SetBranchAddress("JetPartonFlavour", &JetPartonFlavour, &b_JetPartonFlavour); fChain->SetBranchAddress("JetRawPt", &JetRawPt, &b_JetRawPt); fChain->SetBranchAddress("JetPtJEC_noJER", &JetPtJEC_noJER, &b_JetPtJEC_noJER); fChain->SetBranchAddress("JetJERUp", &JetJERUp, &b_JetJERUp); fChain->SetBranchAddress("JetJERDown", &JetJERDown, &b_JetJERDown); fChain->SetBranchAddress("JetID", &JetID, &b_JetID); fChain->SetBranchAddress("JetPUID", &JetPUID, &b_JetPUID); fChain->SetBranchAddress("JetPUValue", &JetPUValue, &b_JetPUValue); fChain->SetBranchAddress("DiJetMass", &DiJetMass, &b_DiJetMass); fChain->SetBranchAddress("DiJetDEta", &DiJetDEta, &b_DiJetDEta); fChain->SetBranchAddress("DiJetFisher", &DiJetFisher, &b_DiJetFisher); fChain->SetBranchAddress("PhotonPt", &PhotonPt, &b_PhotonPt); fChain->SetBranchAddress("PhotonEta", &PhotonEta, &b_PhotonEta); fChain->SetBranchAddress("PhotonPhi", &PhotonPhi, &b_PhotonPhi); fChain->SetBranchAddress("PhotonIsCutBasedLooseID", &PhotonIsCutBasedLooseID, &b_PhotonIsCutBasedLooseID); fChain->SetBranchAddress("nExtraLep", &nExtraLep, &b_nExtraLep); fChain->SetBranchAddress("nExtraZ", &nExtraZ, &b_nExtraZ); fChain->SetBranchAddress("ExtraLepPt", &ExtraLepPt, &b_ExtraLepPt); fChain->SetBranchAddress("ExtraLepEta", &ExtraLepEta, &b_ExtraLepEta); fChain->SetBranchAddress("ExtraLepPhi", &ExtraLepPhi, &b_ExtraLepPhi); fChain->SetBranchAddress("ExtraLepLepId", &ExtraLepLepId, &b_ExtraLepLepId); fChain->SetBranchAddress("ZXFakeweight", &ZXFakeweight, &b_ZXFakeweight); fChain->SetBranchAddress("KFactor_QCD_ggZZ_Nominal", &KFactor_QCD_ggZZ_Nominal, &b_KFactor_QCD_ggZZ_Nominal); fChain->SetBranchAddress("KFactor_QCD_ggZZ_PDFScaleDn", &KFactor_QCD_ggZZ_PDFScaleDn, &b_KFactor_QCD_ggZZ_PDFScaleDn); fChain->SetBranchAddress("KFactor_QCD_ggZZ_PDFScaleUp", &KFactor_QCD_ggZZ_PDFScaleUp, &b_KFactor_QCD_ggZZ_PDFScaleUp); fChain->SetBranchAddress("KFactor_QCD_ggZZ_QCDScaleDn", &KFactor_QCD_ggZZ_QCDScaleDn, &b_KFactor_QCD_ggZZ_QCDScaleDn); fChain->SetBranchAddress("KFactor_QCD_ggZZ_QCDScaleUp", &KFactor_QCD_ggZZ_QCDScaleUp, &b_KFactor_QCD_ggZZ_QCDScaleUp); fChain->SetBranchAddress("KFactor_QCD_ggZZ_AsDn", &KFactor_QCD_ggZZ_AsDn, &b_KFactor_QCD_ggZZ_AsDn); fChain->SetBranchAddress("KFactor_QCD_ggZZ_AsUp", &KFactor_QCD_ggZZ_AsUp, &b_KFactor_QCD_ggZZ_AsUp); fChain->SetBranchAddress("KFactor_QCD_ggZZ_PDFReplicaDn", &KFactor_QCD_ggZZ_PDFReplicaDn, &b_KFactor_QCD_ggZZ_PDFReplicaDn); fChain->SetBranchAddress("KFactor_QCD_ggZZ_PDFReplicaUp", &KFactor_QCD_ggZZ_PDFReplicaUp, &b_KFactor_QCD_ggZZ_PDFReplicaUp); fChain->SetBranchAddress("genFinalState", &genFinalState, &b_genFinalState); fChain->SetBranchAddress("genProcessId", &genProcessId, &b_genProcessId); fChain->SetBranchAddress("genHEPMCweight", &genHEPMCweight, &b_genHEPMCweight); fChain->SetBranchAddress("genHEPMCweight_POWHEGonly", &genHEPMCweight_POWHEGonly, &b_genHEPMCweight_POWHEGonly); fChain->SetBranchAddress("PUWeight", &PUWeight, &b_PUWeight); fChain->SetBranchAddress("PUWeight_Dn", &PUWeight_Dn, &b_PUWeight_Dn); fChain->SetBranchAddress("PUWeight_Up", &PUWeight_Up, &b_PUWeight_Up); fChain->SetBranchAddress("dataMCWeight", &dataMCWeight, &b_dataMCWeight); fChain->SetBranchAddress("muonSF_Unc", &muonSF_Unc, &b_muonSF_Unc); fChain->SetBranchAddress("eleSF_Unc", &eleSF_Unc, &b_eleSF_Unc); fChain->SetBranchAddress("trigEffWeight", &trigEffWeight, &b_trigEffWeight); fChain->SetBranchAddress("overallEventWeight", &overallEventWeight, &b_overallEventWeight); fChain->SetBranchAddress("L1prefiringWeight", &L1prefiringWeight, &b_L1prefiringWeight); fChain->SetBranchAddress("L1prefiringWeightUp", &L1prefiringWeightUp, &b_L1prefiringWeightUp); fChain->SetBranchAddress("L1prefiringWeightDn", &L1prefiringWeightDn, &b_L1prefiringWeightDn); fChain->SetBranchAddress("HqTMCweight", &HqTMCweight, &b_HqTMCweight); fChain->SetBranchAddress("xsec", &xsec, &b_xsec); fChain->SetBranchAddress("genxsec", &genxsec, &b_genxsec); fChain->SetBranchAddress("genBR", &genBR, &b_genBR); fChain->SetBranchAddress("genExtInfo", &genExtInfo, &b_genExtInfo); fChain->SetBranchAddress("GenHMass", &GenHMass, &b_GenHMass); fChain->SetBranchAddress("GenHPt", &GenHPt, &b_GenHPt); fChain->SetBranchAddress("GenHRapidity", &GenHRapidity, &b_GenHRapidity); fChain->SetBranchAddress("GenZ1Mass", &GenZ1Mass, &b_GenZ1Mass); fChain->SetBranchAddress("GenZ1Pt", &GenZ1Pt, &b_GenZ1Pt); fChain->SetBranchAddress("GenZ1Phi", &GenZ1Phi, &b_GenZ1Phi); fChain->SetBranchAddress("GenZ1Flav", &GenZ1Flav, &b_GenZ1Flav); fChain->SetBranchAddress("GenZ2Mass", &GenZ2Mass, &b_GenZ2Mass); fChain->SetBranchAddress("GenZ2Pt", &GenZ2Pt, &b_GenZ2Pt); fChain->SetBranchAddress("GenZ2Phi", &GenZ2Phi, &b_GenZ2Phi); fChain->SetBranchAddress("GenZ2Flav", &GenZ2Flav, &b_GenZ2Flav); fChain->SetBranchAddress("GenLep1Pt", &GenLep1Pt, &b_GenLep1Pt); fChain->SetBranchAddress("GenLep1Eta", &GenLep1Eta, &b_GenLep1Eta); fChain->SetBranchAddress("GenLep1Phi", &GenLep1Phi, &b_GenLep1Phi); fChain->SetBranchAddress("GenLep1Id", &GenLep1Id, &b_GenLep1Id); fChain->SetBranchAddress("GenLep2Pt", &GenLep2Pt, &b_GenLep2Pt); fChain->SetBranchAddress("GenLep2Eta", &GenLep2Eta, &b_GenLep2Eta); fChain->SetBranchAddress("GenLep2Phi", &GenLep2Phi, &b_GenLep2Phi); fChain->SetBranchAddress("GenLep2Id", &GenLep2Id, &b_GenLep2Id); fChain->SetBranchAddress("GenLep3Pt", &GenLep3Pt, &b_GenLep3Pt); fChain->SetBranchAddress("GenLep3Eta", &GenLep3Eta, &b_GenLep3Eta); fChain->SetBranchAddress("GenLep3Phi", &GenLep3Phi, &b_GenLep3Phi); fChain->SetBranchAddress("GenLep3Id", &GenLep3Id, &b_GenLep3Id); fChain->SetBranchAddress("GenLep4Pt", &GenLep4Pt, &b_GenLep4Pt); fChain->SetBranchAddress("GenLep4Eta", &GenLep4Eta, &b_GenLep4Eta); fChain->SetBranchAddress("GenLep4Phi", &GenLep4Phi, &b_GenLep4Phi); fChain->SetBranchAddress("GenLep4Id", &GenLep4Id, &b_GenLep4Id); fChain->SetBranchAddress("GenAssocLep1Pt", &GenAssocLep1Pt, &b_GenAssocLep1Pt); fChain->SetBranchAddress("GenAssocLep1Eta", &GenAssocLep1Eta, &b_GenAssocLep1Eta); fChain->SetBranchAddress("GenAssocLep1Phi", &GenAssocLep1Phi, &b_GenAssocLep1Phi); fChain->SetBranchAddress("GenAssocLep1Id", &GenAssocLep1Id, &b_GenAssocLep1Id); fChain->SetBranchAddress("GenAssocLep2Pt", &GenAssocLep2Pt, &b_GenAssocLep2Pt); fChain->SetBranchAddress("GenAssocLep2Eta", &GenAssocLep2Eta, &b_GenAssocLep2Eta); fChain->SetBranchAddress("GenAssocLep2Phi", &GenAssocLep2Phi, &b_GenAssocLep2Phi); fChain->SetBranchAddress("GenAssocLep2Id", &GenAssocLep2Id, &b_GenAssocLep2Id); fChain->SetBranchAddress("htxs_errorCode", &htxs_errorCode, &b_htxs_errorCode); fChain->SetBranchAddress("htxs_prodMode", &htxs_prodMode, &b_htxs_prodMode); fChain->SetBranchAddress("htxsNJets", &htxsNJets, &b_htxsNJets); fChain->SetBranchAddress("htxsHPt", &htxsHPt, &b_htxsHPt); fChain->SetBranchAddress("htxs_stage0_cat", &htxs_stage0_cat, &b_htxs_stage0_cat); fChain->SetBranchAddress("htxs_stage1_cat", &htxs_stage1_cat, &b_htxs_stage1_cat); fChain->SetBranchAddress("ggH_NNLOPS_weight", &ggH_NNLOPS_weight, &b_ggH_NNLOPS_weight); fChain->SetBranchAddress("ggH_NNLOPS_weight_unc", &ggH_NNLOPS_weight_unc, &b_ggH_NNLOPS_weight_unc); fChain->SetBranchAddress("qcd_ggF_uncertSF", &qcd_ggF_uncertSF, &b_qcd_ggF_uncertSF); fChain->SetBranchAddress("LHEMotherPz", &LHEMotherPz, &b_LHEMotherPz); fChain->SetBranchAddress("LHEMotherE", &LHEMotherE, &b_LHEMotherE); fChain->SetBranchAddress("LHEMotherId", &LHEMotherId, &b_LHEMotherId); fChain->SetBranchAddress("LHEDaughterPt", &LHEDaughterPt, &b_LHEDaughterPt); fChain->SetBranchAddress("LHEDaughterEta", &LHEDaughterEta, &b_LHEDaughterEta); fChain->SetBranchAddress("LHEDaughterPhi", &LHEDaughterPhi, &b_LHEDaughterPhi); fChain->SetBranchAddress("LHEDaughterMass", &LHEDaughterMass, &b_LHEDaughterMass); fChain->SetBranchAddress("LHEDaughterId", &LHEDaughterId, &b_LHEDaughterId); fChain->SetBranchAddress("LHEAssociatedParticlePt", &LHEAssociatedParticlePt, &b_LHEAssociatedParticlePt); fChain->SetBranchAddress("LHEAssociatedParticleEta", &LHEAssociatedParticleEta, &b_LHEAssociatedParticleEta); fChain->SetBranchAddress("LHEAssociatedParticlePhi", &LHEAssociatedParticlePhi, &b_LHEAssociatedParticlePhi); fChain->SetBranchAddress("LHEAssociatedParticleMass", &LHEAssociatedParticleMass, &b_LHEAssociatedParticleMass); fChain->SetBranchAddress("LHEAssociatedParticleId", &LHEAssociatedParticleId, &b_LHEAssociatedParticleId); fChain->SetBranchAddress("LHEPDFScale", &LHEPDFScale, &b_LHEPDFScale); fChain->SetBranchAddress("LHEweight_QCDscale_muR1_muF1", &LHEweight_QCDscale_muR1_muF1, &b_LHEweight_QCDscale_muR1_muF1); fChain->SetBranchAddress("LHEweight_QCDscale_muR1_muF2", &LHEweight_QCDscale_muR1_muF2, &b_LHEweight_QCDscale_muR1_muF2); fChain->SetBranchAddress("LHEweight_QCDscale_muR1_muF0p5", &LHEweight_QCDscale_muR1_muF0p5, &b_LHEweight_QCDscale_muR1_muF0p5); fChain->SetBranchAddress("LHEweight_QCDscale_muR2_muF1", &LHEweight_QCDscale_muR2_muF1, &b_LHEweight_QCDscale_muR2_muF1); fChain->SetBranchAddress("LHEweight_QCDscale_muR2_muF2", &LHEweight_QCDscale_muR2_muF2, &b_LHEweight_QCDscale_muR2_muF2); fChain->SetBranchAddress("LHEweight_QCDscale_muR2_muF0p5", &LHEweight_QCDscale_muR2_muF0p5, &b_LHEweight_QCDscale_muR2_muF0p5); fChain->SetBranchAddress("LHEweight_QCDscale_muR0p5_muF1", &LHEweight_QCDscale_muR0p5_muF1, &b_LHEweight_QCDscale_muR0p5_muF1); fChain->SetBranchAddress("LHEweight_QCDscale_muR0p5_muF2", &LHEweight_QCDscale_muR0p5_muF2, &b_LHEweight_QCDscale_muR0p5_muF2); fChain->SetBranchAddress("LHEweight_QCDscale_muR0p5_muF0p5", &LHEweight_QCDscale_muR0p5_muF0p5, &b_LHEweight_QCDscale_muR0p5_muF0p5); fChain->SetBranchAddress("LHEweight_PDFVariation_Up", &LHEweight_PDFVariation_Up, &b_LHEweight_PDFVariation_Up); fChain->SetBranchAddress("LHEweight_PDFVariation_Dn", &LHEweight_PDFVariation_Dn, &b_LHEweight_PDFVariation_Dn); fChain->SetBranchAddress("LHEweight_AsMZ_Up", &LHEweight_AsMZ_Up, &b_LHEweight_AsMZ_Up); fChain->SetBranchAddress("LHEweight_AsMZ_Dn", &LHEweight_AsMZ_Dn, &b_LHEweight_AsMZ_Dn); fChain->SetBranchAddress("PythiaWeight_isr_muR4", &PythiaWeight_isr_muR4, &b_PythiaWeight_isr_muR4); fChain->SetBranchAddress("PythiaWeight_isr_muR2", &PythiaWeight_isr_muR2, &b_PythiaWeight_isr_muR2); fChain->SetBranchAddress("PythiaWeight_isr_muRsqrt2", &PythiaWeight_isr_muRsqrt2, &b_PythiaWeight_isr_muRsqrt2); fChain->SetBranchAddress("PythiaWeight_isr_muRoneoversqrt2", &PythiaWeight_isr_muRoneoversqrt2, &b_PythiaWeight_isr_muRoneoversqrt2); fChain->SetBranchAddress("PythiaWeight_isr_muR0p5", &PythiaWeight_isr_muR0p5, &b_PythiaWeight_isr_muR0p5); fChain->SetBranchAddress("PythiaWeight_isr_muR0p25", &PythiaWeight_isr_muR0p25, &b_PythiaWeight_isr_muR0p25); fChain->SetBranchAddress("PythiaWeight_fsr_muR4", &PythiaWeight_fsr_muR4, &b_PythiaWeight_fsr_muR4); fChain->SetBranchAddress("PythiaWeight_fsr_muR2", &PythiaWeight_fsr_muR2, &b_PythiaWeight_fsr_muR2); fChain->SetBranchAddress("PythiaWeight_fsr_muRsqrt2", &PythiaWeight_fsr_muRsqrt2, &b_PythiaWeight_fsr_muRsqrt2); fChain->SetBranchAddress("PythiaWeight_fsr_muRoneoversqrt2", &PythiaWeight_fsr_muRoneoversqrt2, &b_PythiaWeight_fsr_muRoneoversqrt2); fChain->SetBranchAddress("PythiaWeight_fsr_muR0p5", &PythiaWeight_fsr_muR0p5, &b_PythiaWeight_fsr_muR0p5); fChain->SetBranchAddress("PythiaWeight_fsr_muR0p25", &PythiaWeight_fsr_muR0p25, &b_PythiaWeight_fsr_muR0p25); fChain->SetBranchAddress("pConst_GG_SIG_ghg2_1_ghz1_1_JHUGen", &pConst_GG_SIG_ghg2_1_ghz1_1_JHUGen, &b_pConst_GG_SIG_ghg2_1_ghz1_1_JHUGen); fChain->SetBranchAddress("p_GG_SIG_ghg2_1_ghz1_1_JHUGen", &p_GG_SIG_ghg2_1_ghz1_1_JHUGen, &b_p_GG_SIG_ghg2_1_ghz1_1_JHUGen); fChain->SetBranchAddress("p_GG_SIG_ghg2_1_ghz1prime2_1E4_JHUGen", &p_GG_SIG_ghg2_1_ghz1prime2_1E4_JHUGen, &b_p_GG_SIG_ghg2_1_ghz1prime2_1E4_JHUGen); fChain->SetBranchAddress("p_GG_SIG_ghg2_1_ghz2_1_JHUGen", &p_GG_SIG_ghg2_1_ghz2_1_JHUGen, &b_p_GG_SIG_ghg2_1_ghz2_1_JHUGen); fChain->SetBranchAddress("p_GG_SIG_ghg2_1_ghz4_1_JHUGen", &p_GG_SIG_ghg2_1_ghz4_1_JHUGen, &b_p_GG_SIG_ghg2_1_ghz4_1_JHUGen); fChain->SetBranchAddress("p_GG_SIG_ghg2_1_ghza1prime2_1E4_JHUGen", &p_GG_SIG_ghg2_1_ghza1prime2_1E4_JHUGen, &b_p_GG_SIG_ghg2_1_ghza1prime2_1E4_JHUGen); fChain->SetBranchAddress("p_GG_SIG_ghg2_1_ghza2_1_JHUGen", &p_GG_SIG_ghg2_1_ghza2_1_JHUGen, &b_p_GG_SIG_ghg2_1_ghza2_1_JHUGen); fChain->SetBranchAddress("p_GG_SIG_ghg2_1_ghza4_1_JHUGen", &p_GG_SIG_ghg2_1_ghza4_1_JHUGen, &b_p_GG_SIG_ghg2_1_ghza4_1_JHUGen); fChain->SetBranchAddress("p_GG_SIG_ghg2_1_gha2_1_JHUGen", &p_GG_SIG_ghg2_1_gha2_1_JHUGen, &b_p_GG_SIG_ghg2_1_gha2_1_JHUGen); fChain->SetBranchAddress("p_GG_SIG_ghg2_1_gha4_1_JHUGen", &p_GG_SIG_ghg2_1_gha4_1_JHUGen, &b_p_GG_SIG_ghg2_1_gha4_1_JHUGen); fChain->SetBranchAddress("p_GG_SIG_ghg2_1_ghz1_1_ghz1prime2_1E4_JHUGen", &p_GG_SIG_ghg2_1_ghz1_1_ghz1prime2_1E4_JHUGen, &b_p_GG_SIG_ghg2_1_ghz1_1_ghz1prime2_1E4_JHUGen); fChain->SetBranchAddress("p_GG_SIG_ghg2_1_ghz1_1_ghz2_1_JHUGen", &p_GG_SIG_ghg2_1_ghz1_1_ghz2_1_JHUGen, &b_p_GG_SIG_ghg2_1_ghz1_1_ghz2_1_JHUGen); fChain->SetBranchAddress("p_GG_SIG_ghg2_1_ghz1_1_ghz2_i_JHUGen", &p_GG_SIG_ghg2_1_ghz1_1_ghz2_i_JHUGen, &b_p_GG_SIG_ghg2_1_ghz1_1_ghz2_i_JHUGen); fChain->SetBranchAddress("p_GG_SIG_ghg2_1_ghz1_1_ghz4_1_JHUGen", &p_GG_SIG_ghg2_1_ghz1_1_ghz4_1_JHUGen, &b_p_GG_SIG_ghg2_1_ghz1_1_ghz4_1_JHUGen); fChain->SetBranchAddress("p_GG_SIG_ghg2_1_ghz1_1_ghz4_i_JHUGen", &p_GG_SIG_ghg2_1_ghz1_1_ghz4_i_JHUGen, &b_p_GG_SIG_ghg2_1_ghz1_1_ghz4_i_JHUGen); fChain->SetBranchAddress("p_GG_SIG_ghg2_1_ghz1_1_ghza1prime2_1E4_JHUGen", &p_GG_SIG_ghg2_1_ghz1_1_ghza1prime2_1E4_JHUGen, &b_p_GG_SIG_ghg2_1_ghz1_1_ghza1prime2_1E4_JHUGen); fChain->SetBranchAddress("p_GG_SIG_ghg2_1_ghz1_1_ghza1prime2_1E4i_JHUGen", &p_GG_SIG_ghg2_1_ghz1_1_ghza1prime2_1E4i_JHUGen, &b_p_GG_SIG_ghg2_1_ghz1_1_ghza1prime2_1E4i_JHUGen); fChain->SetBranchAddress("p_GG_SIG_ghg2_1_ghz1_1_ghza2_1_JHUGen", &p_GG_SIG_ghg2_1_ghz1_1_ghza2_1_JHUGen, &b_p_GG_SIG_ghg2_1_ghz1_1_ghza2_1_JHUGen); fChain->SetBranchAddress("p_GG_SIG_ghg2_1_ghz1_1_ghza4_1_JHUGen", &p_GG_SIG_ghg2_1_ghz1_1_ghza4_1_JHUGen, &b_p_GG_SIG_ghg2_1_ghz1_1_ghza4_1_JHUGen); fChain->SetBranchAddress("p_GG_SIG_ghg2_1_ghz1_1_gha2_1_JHUGen", &p_GG_SIG_ghg2_1_ghz1_1_gha2_1_JHUGen, &b_p_GG_SIG_ghg2_1_ghz1_1_gha2_1_JHUGen); fChain->SetBranchAddress("p_GG_SIG_ghg2_1_ghz1_1_gha4_1_JHUGen", &p_GG_SIG_ghg2_1_ghz1_1_gha4_1_JHUGen, &b_p_GG_SIG_ghg2_1_ghz1_1_gha4_1_JHUGen); fChain->SetBranchAddress("p_GG_SIG_ghg2_1_ghz1prime2_1E4_ghza1prime2_1E4_JHUGen", &p_GG_SIG_ghg2_1_ghz1prime2_1E4_ghza1prime2_1E4_JHUGen, &b_p_GG_SIG_ghg2_1_ghz1prime2_1E4_ghza1prime2_1E4_JHUGen); fChain->SetBranchAddress("pAux_JVBF_SIG_ghv1_1_JHUGen_JECNominal", &pAux_JVBF_SIG_ghv1_1_JHUGen_JECNominal, &b_pAux_JVBF_SIG_ghv1_1_JHUGen_JECNominal); fChain->SetBranchAddress("p_JVBF_SIG_ghv1_1_JHUGen_JECNominal", &p_JVBF_SIG_ghv1_1_JHUGen_JECNominal, &b_p_JVBF_SIG_ghv1_1_JHUGen_JECNominal); fChain->SetBranchAddress("pConst_JQCD_SIG_ghg2_1_JHUGen_JECNominal", &pConst_JQCD_SIG_ghg2_1_JHUGen_JECNominal, &b_pConst_JQCD_SIG_ghg2_1_JHUGen_JECNominal); fChain->SetBranchAddress("p_JQCD_SIG_ghg2_1_JHUGen_JECNominal", &p_JQCD_SIG_ghg2_1_JHUGen_JECNominal, &b_p_JQCD_SIG_ghg2_1_JHUGen_JECNominal); fChain->SetBranchAddress("pConst_JJVBF_SIG_ghv1_1_JHUGen_JECNominal", &pConst_JJVBF_SIG_ghv1_1_JHUGen_JECNominal, &b_pConst_JJVBF_SIG_ghv1_1_JHUGen_JECNominal); fChain->SetBranchAddress("p_JJVBF_SIG_ghv1_1_JHUGen_JECNominal", &p_JJVBF_SIG_ghv1_1_JHUGen_JECNominal, &b_p_JJVBF_SIG_ghv1_1_JHUGen_JECNominal); fChain->SetBranchAddress("p_JJVBF_SIG_ghv1prime2_1E4_JHUGen_JECNominal", &p_JJVBF_SIG_ghv1prime2_1E4_JHUGen_JECNominal, &b_p_JJVBF_SIG_ghv1prime2_1E4_JHUGen_JECNominal); fChain->SetBranchAddress("p_JJVBF_SIG_ghv2_1_JHUGen_JECNominal", &p_JJVBF_SIG_ghv2_1_JHUGen_JECNominal, &b_p_JJVBF_SIG_ghv2_1_JHUGen_JECNominal); fChain->SetBranchAddress("p_JJVBF_SIG_ghv4_1_JHUGen_JECNominal", &p_JJVBF_SIG_ghv4_1_JHUGen_JECNominal, &b_p_JJVBF_SIG_ghv4_1_JHUGen_JECNominal); fChain->SetBranchAddress("p_JJVBF_SIG_ghza1prime2_1E4_JHUGen_JECNominal", &p_JJVBF_SIG_ghza1prime2_1E4_JHUGen_JECNominal, &b_p_JJVBF_SIG_ghza1prime2_1E4_JHUGen_JECNominal); fChain->SetBranchAddress("p_JJVBF_SIG_ghza2_1_JHUGen_JECNominal", &p_JJVBF_SIG_ghza2_1_JHUGen_JECNominal, &b_p_JJVBF_SIG_ghza2_1_JHUGen_JECNominal); fChain->SetBranchAddress("p_JJVBF_SIG_ghza4_1_JHUGen_JECNominal", &p_JJVBF_SIG_ghza4_1_JHUGen_JECNominal, &b_p_JJVBF_SIG_ghza4_1_JHUGen_JECNominal); fChain->SetBranchAddress("p_JJVBF_SIG_gha2_1_JHUGen_JECNominal", &p_JJVBF_SIG_gha2_1_JHUGen_JECNominal, &b_p_JJVBF_SIG_gha2_1_JHUGen_JECNominal); fChain->SetBranchAddress("p_JJVBF_SIG_gha4_1_JHUGen_JECNominal", &p_JJVBF_SIG_gha4_1_JHUGen_JECNominal, &b_p_JJVBF_SIG_gha4_1_JHUGen_JECNominal); fChain->SetBranchAddress("p_JJVBF_SIG_ghv1_1_ghv1prime2_1E4_JHUGen_JECNominal", &p_JJVBF_SIG_ghv1_1_ghv1prime2_1E4_JHUGen_JECNominal, &b_p_JJVBF_SIG_ghv1_1_ghv1prime2_1E4_JHUGen_JECNominal); fChain->SetBranchAddress("p_JJVBF_SIG_ghv1_1_ghv2_1_JHUGen_JECNominal", &p_JJVBF_SIG_ghv1_1_ghv2_1_JHUGen_JECNominal, &b_p_JJVBF_SIG_ghv1_1_ghv2_1_JHUGen_JECNominal); fChain->SetBranchAddress("p_JJVBF_SIG_ghv1_1_ghv4_1_JHUGen_JECNominal", &p_JJVBF_SIG_ghv1_1_ghv4_1_JHUGen_JECNominal, &b_p_JJVBF_SIG_ghv1_1_ghv4_1_JHUGen_JECNominal); fChain->SetBranchAddress("p_JJVBF_SIG_ghv1_1_ghza1prime2_1E4_JHUGen_JECNominal", &p_JJVBF_SIG_ghv1_1_ghza1prime2_1E4_JHUGen_JECNominal, &b_p_JJVBF_SIG_ghv1_1_ghza1prime2_1E4_JHUGen_JECNominal); fChain->SetBranchAddress("p_JJVBF_SIG_ghv1_1_ghza2_1_JHUGen_JECNominal", &p_JJVBF_SIG_ghv1_1_ghza2_1_JHUGen_JECNominal, &b_p_JJVBF_SIG_ghv1_1_ghza2_1_JHUGen_JECNominal); fChain->SetBranchAddress("p_JJVBF_SIG_ghv1_1_ghza4_1_JHUGen_JECNominal", &p_JJVBF_SIG_ghv1_1_ghza4_1_JHUGen_JECNominal, &b_p_JJVBF_SIG_ghv1_1_ghza4_1_JHUGen_JECNominal); fChain->SetBranchAddress("p_JJVBF_SIG_ghv1_1_gha2_1_JHUGen_JECNominal", &p_JJVBF_SIG_ghv1_1_gha2_1_JHUGen_JECNominal, &b_p_JJVBF_SIG_ghv1_1_gha2_1_JHUGen_JECNominal); fChain->SetBranchAddress("p_JJVBF_SIG_ghv1_1_gha4_1_JHUGen_JECNominal", &p_JJVBF_SIG_ghv1_1_gha4_1_JHUGen_JECNominal, &b_p_JJVBF_SIG_ghv1_1_gha4_1_JHUGen_JECNominal); fChain->SetBranchAddress("pConst_JJQCD_SIG_ghg2_1_JHUGen_JECNominal", &pConst_JJQCD_SIG_ghg2_1_JHUGen_JECNominal, &b_pConst_JJQCD_SIG_ghg2_1_JHUGen_JECNominal); fChain->SetBranchAddress("p_JJQCD_SIG_ghg2_1_JHUGen_JECNominal", &p_JJQCD_SIG_ghg2_1_JHUGen_JECNominal, &b_p_JJQCD_SIG_ghg2_1_JHUGen_JECNominal); fChain->SetBranchAddress("p_JJQCD_SIG_ghg4_1_JHUGen_JECNominal", &p_JJQCD_SIG_ghg4_1_JHUGen_JECNominal, &b_p_JJQCD_SIG_ghg4_1_JHUGen_JECNominal); fChain->SetBranchAddress("p_JJQCD_SIG_ghg2_1_ghg4_1_JHUGen_JECNominal", &p_JJQCD_SIG_ghg2_1_ghg4_1_JHUGen_JECNominal, &b_p_JJQCD_SIG_ghg2_1_ghg4_1_JHUGen_JECNominal); fChain->SetBranchAddress("pConst_JJQCD_InitialQQ_SIG_ghg2_1_JHUGen_JECNominal", &pConst_JJQCD_InitialQQ_SIG_ghg2_1_JHUGen_JECNominal, &b_pConst_JJQCD_InitialQQ_SIG_ghg2_1_JHUGen_JECNominal); fChain->SetBranchAddress("p_JJQCD_InitialQQ_SIG_ghg2_1_JHUGen_JECNominal", &p_JJQCD_InitialQQ_SIG_ghg2_1_JHUGen_JECNominal, &b_p_JJQCD_InitialQQ_SIG_ghg2_1_JHUGen_JECNominal); fChain->SetBranchAddress("p_JJQCD_InitialQQ_SIG_ghg4_1_JHUGen_JECNominal", &p_JJQCD_InitialQQ_SIG_ghg4_1_JHUGen_JECNominal, &b_p_JJQCD_InitialQQ_SIG_ghg4_1_JHUGen_JECNominal); fChain->SetBranchAddress("p_JJQCD_InitialQQ_SIG_ghg2_1_ghg4_1_JHUGen_JECNominal", &p_JJQCD_InitialQQ_SIG_ghg2_1_ghg4_1_JHUGen_JECNominal, &b_p_JJQCD_InitialQQ_SIG_ghg2_1_ghg4_1_JHUGen_JECNominal); fChain->SetBranchAddress("pConst_HadZH_SIG_ghz1_1_JHUGen_JECNominal", &pConst_HadZH_SIG_ghz1_1_JHUGen_JECNominal, &b_pConst_HadZH_SIG_ghz1_1_JHUGen_JECNominal); fChain->SetBranchAddress("p_HadZH_SIG_ghz1_1_JHUGen_JECNominal", &p_HadZH_SIG_ghz1_1_JHUGen_JECNominal, &b_p_HadZH_SIG_ghz1_1_JHUGen_JECNominal); fChain->SetBranchAddress("p_HadZH_SIG_ghz1prime2_1E4_JHUGen_JECNominal", &p_HadZH_SIG_ghz1prime2_1E4_JHUGen_JECNominal, &b_p_HadZH_SIG_ghz1prime2_1E4_JHUGen_JECNominal); fChain->SetBranchAddress("p_HadZH_SIG_ghz2_1_JHUGen_JECNominal", &p_HadZH_SIG_ghz2_1_JHUGen_JECNominal, &b_p_HadZH_SIG_ghz2_1_JHUGen_JECNominal); fChain->SetBranchAddress("p_HadZH_SIG_ghz4_1_JHUGen_JECNominal", &p_HadZH_SIG_ghz4_1_JHUGen_JECNominal, &b_p_HadZH_SIG_ghz4_1_JHUGen_JECNominal); fChain->SetBranchAddress("p_HadZH_SIG_ghza1prime2_1E4_JHUGen_JECNominal", &p_HadZH_SIG_ghza1prime2_1E4_JHUGen_JECNominal, &b_p_HadZH_SIG_ghza1prime2_1E4_JHUGen_JECNominal); fChain->SetBranchAddress("p_HadZH_SIG_ghza2_1_JHUGen_JECNominal", &p_HadZH_SIG_ghza2_1_JHUGen_JECNominal, &b_p_HadZH_SIG_ghza2_1_JHUGen_JECNominal); fChain->SetBranchAddress("p_HadZH_SIG_ghza4_1_JHUGen_JECNominal", &p_HadZH_SIG_ghza4_1_JHUGen_JECNominal, &b_p_HadZH_SIG_ghza4_1_JHUGen_JECNominal); fChain->SetBranchAddress("p_HadZH_SIG_gha2_1_JHUGen_JECNominal", &p_HadZH_SIG_gha2_1_JHUGen_JECNominal, &b_p_HadZH_SIG_gha2_1_JHUGen_JECNominal); fChain->SetBranchAddress("p_HadZH_SIG_gha4_1_JHUGen_JECNominal", &p_HadZH_SIG_gha4_1_JHUGen_JECNominal, &b_p_HadZH_SIG_gha4_1_JHUGen_JECNominal); fChain->SetBranchAddress("p_HadZH_SIG_ghz1_1_ghz1prime2_1E4_JHUGen_JECNominal", &p_HadZH_SIG_ghz1_1_ghz1prime2_1E4_JHUGen_JECNominal, &b_p_HadZH_SIG_ghz1_1_ghz1prime2_1E4_JHUGen_JECNominal); fChain->SetBranchAddress("p_HadZH_SIG_ghz1_1_ghz2_1_JHUGen_JECNominal", &p_HadZH_SIG_ghz1_1_ghz2_1_JHUGen_JECNominal, &b_p_HadZH_SIG_ghz1_1_ghz2_1_JHUGen_JECNominal); fChain->SetBranchAddress("p_HadZH_SIG_ghz1_1_ghz4_1_JHUGen_JECNominal", &p_HadZH_SIG_ghz1_1_ghz4_1_JHUGen_JECNominal, &b_p_HadZH_SIG_ghz1_1_ghz4_1_JHUGen_JECNominal); fChain->SetBranchAddress("p_HadZH_SIG_ghz1_1_ghza1prime2_1E4_JHUGen_JECNominal", &p_HadZH_SIG_ghz1_1_ghza1prime2_1E4_JHUGen_JECNominal, &b_p_HadZH_SIG_ghz1_1_ghza1prime2_1E4_JHUGen_JECNominal); fChain->SetBranchAddress("p_HadZH_SIG_ghz1_1_ghza2_1_JHUGen_JECNominal", &p_HadZH_SIG_ghz1_1_ghza2_1_JHUGen_JECNominal, &b_p_HadZH_SIG_ghz1_1_ghza2_1_JHUGen_JECNominal); fChain->SetBranchAddress("p_HadZH_SIG_ghz1_1_ghza4_1_JHUGen_JECNominal", &p_HadZH_SIG_ghz1_1_ghza4_1_JHUGen_JECNominal, &b_p_HadZH_SIG_ghz1_1_ghza4_1_JHUGen_JECNominal); fChain->SetBranchAddress("p_HadZH_SIG_ghz1_1_gha2_1_JHUGen_JECNominal", &p_HadZH_SIG_ghz1_1_gha2_1_JHUGen_JECNominal, &b_p_HadZH_SIG_ghz1_1_gha2_1_JHUGen_JECNominal); fChain->SetBranchAddress("p_HadZH_SIG_ghz1_1_gha4_1_JHUGen_JECNominal", &p_HadZH_SIG_ghz1_1_gha4_1_JHUGen_JECNominal, &b_p_HadZH_SIG_ghz1_1_gha4_1_JHUGen_JECNominal); fChain->SetBranchAddress("pConst_HadWH_SIG_ghw1_1_JHUGen_JECNominal", &pConst_HadWH_SIG_ghw1_1_JHUGen_JECNominal, &b_pConst_HadWH_SIG_ghw1_1_JHUGen_JECNominal); fChain->SetBranchAddress("p_HadWH_SIG_ghw1_1_JHUGen_JECNominal", &p_HadWH_SIG_ghw1_1_JHUGen_JECNominal, &b_p_HadWH_SIG_ghw1_1_JHUGen_JECNominal); fChain->SetBranchAddress("p_HadWH_SIG_ghw1prime2_1E4_JHUGen_JECNominal", &p_HadWH_SIG_ghw1prime2_1E4_JHUGen_JECNominal, &b_p_HadWH_SIG_ghw1prime2_1E4_JHUGen_JECNominal); fChain->SetBranchAddress("p_HadWH_SIG_ghw2_1_JHUGen_JECNominal", &p_HadWH_SIG_ghw2_1_JHUGen_JECNominal, &b_p_HadWH_SIG_ghw2_1_JHUGen_JECNominal); fChain->SetBranchAddress("p_HadWH_SIG_ghw4_1_JHUGen_JECNominal", &p_HadWH_SIG_ghw4_1_JHUGen_JECNominal, &b_p_HadWH_SIG_ghw4_1_JHUGen_JECNominal); fChain->SetBranchAddress("p_HadWH_SIG_ghw1_1_ghw1prime2_1E4_JHUGen_JECNominal", &p_HadWH_SIG_ghw1_1_ghw1prime2_1E4_JHUGen_JECNominal, &b_p_HadWH_SIG_ghw1_1_ghw1prime2_1E4_JHUGen_JECNominal); fChain->SetBranchAddress("p_HadWH_SIG_ghw1_1_ghw2_1_JHUGen_JECNominal", &p_HadWH_SIG_ghw1_1_ghw2_1_JHUGen_JECNominal, &b_p_HadWH_SIG_ghw1_1_ghw2_1_JHUGen_JECNominal); fChain->SetBranchAddress("p_HadWH_SIG_ghw1_1_ghw4_1_JHUGen_JECNominal", &p_HadWH_SIG_ghw1_1_ghw4_1_JHUGen_JECNominal, &b_p_HadWH_SIG_ghw1_1_ghw4_1_JHUGen_JECNominal); fChain->SetBranchAddress("p_ttHUndecayed_SIG_kappa_1_JHUGen_JECNominal", &p_ttHUndecayed_SIG_kappa_1_JHUGen_JECNominal, &b_p_ttHUndecayed_SIG_kappa_1_JHUGen_JECNominal); fChain->SetBranchAddress("p_ttHUndecayed_SIG_kappatilde_1_JHUGen_JECNominal", &p_ttHUndecayed_SIG_kappatilde_1_JHUGen_JECNominal, &b_p_ttHUndecayed_SIG_kappatilde_1_JHUGen_JECNominal); fChain->SetBranchAddress("p_ttHUndecayed_SIG_kappa_1_kappatilde_1_JHUGen_JECNominal", &p_ttHUndecayed_SIG_kappa_1_kappatilde_1_JHUGen_JECNominal, &b_p_ttHUndecayed_SIG_kappa_1_kappatilde_1_JHUGen_JECNominal); fChain->SetBranchAddress("p_bbH_SIG_kappa_1_JHUGen_JECNominal", &p_bbH_SIG_kappa_1_JHUGen_JECNominal, &b_p_bbH_SIG_kappa_1_JHUGen_JECNominal); fChain->SetBranchAddress("pAux_JVBF_SIG_ghv1_1_JHUGen_JECUp", &pAux_JVBF_SIG_ghv1_1_JHUGen_JECUp, &b_pAux_JVBF_SIG_ghv1_1_JHUGen_JECUp); fChain->SetBranchAddress("p_JVBF_SIG_ghv1_1_JHUGen_JECUp", &p_JVBF_SIG_ghv1_1_JHUGen_JECUp, &b_p_JVBF_SIG_ghv1_1_JHUGen_JECUp); fChain->SetBranchAddress("pConst_JQCD_SIG_ghg2_1_JHUGen_JECUp", &pConst_JQCD_SIG_ghg2_1_JHUGen_JECUp, &b_pConst_JQCD_SIG_ghg2_1_JHUGen_JECUp); fChain->SetBranchAddress("p_JQCD_SIG_ghg2_1_JHUGen_JECUp", &p_JQCD_SIG_ghg2_1_JHUGen_JECUp, &b_p_JQCD_SIG_ghg2_1_JHUGen_JECUp); fChain->SetBranchAddress("pConst_JJVBF_SIG_ghv1_1_JHUGen_JECUp", &pConst_JJVBF_SIG_ghv1_1_JHUGen_JECUp, &b_pConst_JJVBF_SIG_ghv1_1_JHUGen_JECUp); fChain->SetBranchAddress("p_JJVBF_SIG_ghv1_1_JHUGen_JECUp", &p_JJVBF_SIG_ghv1_1_JHUGen_JECUp, &b_p_JJVBF_SIG_ghv1_1_JHUGen_JECUp); fChain->SetBranchAddress("p_JJVBF_SIG_ghv1prime2_1E4_JHUGen_JECUp", &p_JJVBF_SIG_ghv1prime2_1E4_JHUGen_JECUp, &b_p_JJVBF_SIG_ghv1prime2_1E4_JHUGen_JECUp); fChain->SetBranchAddress("p_JJVBF_SIG_ghv2_1_JHUGen_JECUp", &p_JJVBF_SIG_ghv2_1_JHUGen_JECUp, &b_p_JJVBF_SIG_ghv2_1_JHUGen_JECUp); fChain->SetBranchAddress("p_JJVBF_SIG_ghv4_1_JHUGen_JECUp", &p_JJVBF_SIG_ghv4_1_JHUGen_JECUp, &b_p_JJVBF_SIG_ghv4_1_JHUGen_JECUp); fChain->SetBranchAddress("p_JJVBF_SIG_ghza1prime2_1E4_JHUGen_JECUp", &p_JJVBF_SIG_ghza1prime2_1E4_JHUGen_JECUp, &b_p_JJVBF_SIG_ghza1prime2_1E4_JHUGen_JECUp); fChain->SetBranchAddress("p_JJVBF_SIG_ghza2_1_JHUGen_JECUp", &p_JJVBF_SIG_ghza2_1_JHUGen_JECUp, &b_p_JJVBF_SIG_ghza2_1_JHUGen_JECUp); fChain->SetBranchAddress("p_JJVBF_SIG_ghza4_1_JHUGen_JECUp", &p_JJVBF_SIG_ghza4_1_JHUGen_JECUp, &b_p_JJVBF_SIG_ghza4_1_JHUGen_JECUp); fChain->SetBranchAddress("p_JJVBF_SIG_gha2_1_JHUGen_JECUp", &p_JJVBF_SIG_gha2_1_JHUGen_JECUp, &b_p_JJVBF_SIG_gha2_1_JHUGen_JECUp); fChain->SetBranchAddress("p_JJVBF_SIG_gha4_1_JHUGen_JECUp", &p_JJVBF_SIG_gha4_1_JHUGen_JECUp, &b_p_JJVBF_SIG_gha4_1_JHUGen_JECUp); fChain->SetBranchAddress("p_JJVBF_SIG_ghv1_1_ghv1prime2_1E4_JHUGen_JECUp", &p_JJVBF_SIG_ghv1_1_ghv1prime2_1E4_JHUGen_JECUp, &b_p_JJVBF_SIG_ghv1_1_ghv1prime2_1E4_JHUGen_JECUp); fChain->SetBranchAddress("p_JJVBF_SIG_ghv1_1_ghv2_1_JHUGen_JECUp", &p_JJVBF_SIG_ghv1_1_ghv2_1_JHUGen_JECUp, &b_p_JJVBF_SIG_ghv1_1_ghv2_1_JHUGen_JECUp); fChain->SetBranchAddress("p_JJVBF_SIG_ghv1_1_ghv4_1_JHUGen_JECUp", &p_JJVBF_SIG_ghv1_1_ghv4_1_JHUGen_JECUp, &b_p_JJVBF_SIG_ghv1_1_ghv4_1_JHUGen_JECUp); fChain->SetBranchAddress("p_JJVBF_SIG_ghv1_1_ghza1prime2_1E4_JHUGen_JECUp", &p_JJVBF_SIG_ghv1_1_ghza1prime2_1E4_JHUGen_JECUp, &b_p_JJVBF_SIG_ghv1_1_ghza1prime2_1E4_JHUGen_JECUp); fChain->SetBranchAddress("p_JJVBF_SIG_ghv1_1_ghza2_1_JHUGen_JECUp", &p_JJVBF_SIG_ghv1_1_ghza2_1_JHUGen_JECUp, &b_p_JJVBF_SIG_ghv1_1_ghza2_1_JHUGen_JECUp); fChain->SetBranchAddress("p_JJVBF_SIG_ghv1_1_ghza4_1_JHUGen_JECUp", &p_JJVBF_SIG_ghv1_1_ghza4_1_JHUGen_JECUp, &b_p_JJVBF_SIG_ghv1_1_ghza4_1_JHUGen_JECUp); fChain->SetBranchAddress("p_JJVBF_SIG_ghv1_1_gha2_1_JHUGen_JECUp", &p_JJVBF_SIG_ghv1_1_gha2_1_JHUGen_JECUp, &b_p_JJVBF_SIG_ghv1_1_gha2_1_JHUGen_JECUp); fChain->SetBranchAddress("p_JJVBF_SIG_ghv1_1_gha4_1_JHUGen_JECUp", &p_JJVBF_SIG_ghv1_1_gha4_1_JHUGen_JECUp, &b_p_JJVBF_SIG_ghv1_1_gha4_1_JHUGen_JECUp); fChain->SetBranchAddress("pConst_JJQCD_SIG_ghg2_1_JHUGen_JECUp", &pConst_JJQCD_SIG_ghg2_1_JHUGen_JECUp, &b_pConst_JJQCD_SIG_ghg2_1_JHUGen_JECUp); fChain->SetBranchAddress("p_JJQCD_SIG_ghg2_1_JHUGen_JECUp", &p_JJQCD_SIG_ghg2_1_JHUGen_JECUp, &b_p_JJQCD_SIG_ghg2_1_JHUGen_JECUp); fChain->SetBranchAddress("p_JJQCD_SIG_ghg4_1_JHUGen_JECUp", &p_JJQCD_SIG_ghg4_1_JHUGen_JECUp, &b_p_JJQCD_SIG_ghg4_1_JHUGen_JECUp); fChain->SetBranchAddress("p_JJQCD_SIG_ghg2_1_ghg4_1_JHUGen_JECUp", &p_JJQCD_SIG_ghg2_1_ghg4_1_JHUGen_JECUp, &b_p_JJQCD_SIG_ghg2_1_ghg4_1_JHUGen_JECUp); fChain->SetBranchAddress("pConst_JJQCD_InitialQQ_SIG_ghg2_1_JHUGen_JECUp", &pConst_JJQCD_InitialQQ_SIG_ghg2_1_JHUGen_JECUp, &b_pConst_JJQCD_InitialQQ_SIG_ghg2_1_JHUGen_JECUp); fChain->SetBranchAddress("p_JJQCD_InitialQQ_SIG_ghg2_1_JHUGen_JECUp", &p_JJQCD_InitialQQ_SIG_ghg2_1_JHUGen_JECUp, &b_p_JJQCD_InitialQQ_SIG_ghg2_1_JHUGen_JECUp); fChain->SetBranchAddress("p_JJQCD_InitialQQ_SIG_ghg4_1_JHUGen_JECUp", &p_JJQCD_InitialQQ_SIG_ghg4_1_JHUGen_JECUp, &b_p_JJQCD_InitialQQ_SIG_ghg4_1_JHUGen_JECUp); fChain->SetBranchAddress("p_JJQCD_InitialQQ_SIG_ghg2_1_ghg4_1_JHUGen_JECUp", &p_JJQCD_InitialQQ_SIG_ghg2_1_ghg4_1_JHUGen_JECUp, &b_p_JJQCD_InitialQQ_SIG_ghg2_1_ghg4_1_JHUGen_JECUp); fChain->SetBranchAddress("pConst_HadZH_SIG_ghz1_1_JHUGen_JECUp", &pConst_HadZH_SIG_ghz1_1_JHUGen_JECUp, &b_pConst_HadZH_SIG_ghz1_1_JHUGen_JECUp); fChain->SetBranchAddress("p_HadZH_SIG_ghz1_1_JHUGen_JECUp", &p_HadZH_SIG_ghz1_1_JHUGen_JECUp, &b_p_HadZH_SIG_ghz1_1_JHUGen_JECUp); fChain->SetBranchAddress("p_HadZH_SIG_ghz1prime2_1E4_JHUGen_JECUp", &p_HadZH_SIG_ghz1prime2_1E4_JHUGen_JECUp, &b_p_HadZH_SIG_ghz1prime2_1E4_JHUGen_JECUp); fChain->SetBranchAddress("p_HadZH_SIG_ghz2_1_JHUGen_JECUp", &p_HadZH_SIG_ghz2_1_JHUGen_JECUp, &b_p_HadZH_SIG_ghz2_1_JHUGen_JECUp); fChain->SetBranchAddress("p_HadZH_SIG_ghz4_1_JHUGen_JECUp", &p_HadZH_SIG_ghz4_1_JHUGen_JECUp, &b_p_HadZH_SIG_ghz4_1_JHUGen_JECUp); fChain->SetBranchAddress("p_HadZH_SIG_ghza1prime2_1E4_JHUGen_JECUp", &p_HadZH_SIG_ghza1prime2_1E4_JHUGen_JECUp, &b_p_HadZH_SIG_ghza1prime2_1E4_JHUGen_JECUp); fChain->SetBranchAddress("p_HadZH_SIG_ghza2_1_JHUGen_JECUp", &p_HadZH_SIG_ghza2_1_JHUGen_JECUp, &b_p_HadZH_SIG_ghza2_1_JHUGen_JECUp); fChain->SetBranchAddress("p_HadZH_SIG_ghza4_1_JHUGen_JECUp", &p_HadZH_SIG_ghza4_1_JHUGen_JECUp, &b_p_HadZH_SIG_ghza4_1_JHUGen_JECUp); fChain->SetBranchAddress("p_HadZH_SIG_gha2_1_JHUGen_JECUp", &p_HadZH_SIG_gha2_1_JHUGen_JECUp, &b_p_HadZH_SIG_gha2_1_JHUGen_JECUp); fChain->SetBranchAddress("p_HadZH_SIG_gha4_1_JHUGen_JECUp", &p_HadZH_SIG_gha4_1_JHUGen_JECUp, &b_p_HadZH_SIG_gha4_1_JHUGen_JECUp); fChain->SetBranchAddress("p_HadZH_SIG_ghz1_1_ghz1prime2_1E4_JHUGen_JECUp", &p_HadZH_SIG_ghz1_1_ghz1prime2_1E4_JHUGen_JECUp, &b_p_HadZH_SIG_ghz1_1_ghz1prime2_1E4_JHUGen_JECUp); fChain->SetBranchAddress("p_HadZH_SIG_ghz1_1_ghz2_1_JHUGen_JECUp", &p_HadZH_SIG_ghz1_1_ghz2_1_JHUGen_JECUp, &b_p_HadZH_SIG_ghz1_1_ghz2_1_JHUGen_JECUp); fChain->SetBranchAddress("p_HadZH_SIG_ghz1_1_ghz4_1_JHUGen_JECUp", &p_HadZH_SIG_ghz1_1_ghz4_1_JHUGen_JECUp, &b_p_HadZH_SIG_ghz1_1_ghz4_1_JHUGen_JECUp); fChain->SetBranchAddress("p_HadZH_SIG_ghz1_1_ghza1prime2_1E4_JHUGen_JECUp", &p_HadZH_SIG_ghz1_1_ghza1prime2_1E4_JHUGen_JECUp, &b_p_HadZH_SIG_ghz1_1_ghza1prime2_1E4_JHUGen_JECUp); fChain->SetBranchAddress("p_HadZH_SIG_ghz1_1_ghza2_1_JHUGen_JECUp", &p_HadZH_SIG_ghz1_1_ghza2_1_JHUGen_JECUp, &b_p_HadZH_SIG_ghz1_1_ghza2_1_JHUGen_JECUp); fChain->SetBranchAddress("p_HadZH_SIG_ghz1_1_ghza4_1_JHUGen_JECUp", &p_HadZH_SIG_ghz1_1_ghza4_1_JHUGen_JECUp, &b_p_HadZH_SIG_ghz1_1_ghza4_1_JHUGen_JECUp); fChain->SetBranchAddress("p_HadZH_SIG_ghz1_1_gha2_1_JHUGen_JECUp", &p_HadZH_SIG_ghz1_1_gha2_1_JHUGen_JECUp, &b_p_HadZH_SIG_ghz1_1_gha2_1_JHUGen_JECUp); fChain->SetBranchAddress("p_HadZH_SIG_ghz1_1_gha4_1_JHUGen_JECUp", &p_HadZH_SIG_ghz1_1_gha4_1_JHUGen_JECUp, &b_p_HadZH_SIG_ghz1_1_gha4_1_JHUGen_JECUp); fChain->SetBranchAddress("pConst_HadWH_SIG_ghw1_1_JHUGen_JECUp", &pConst_HadWH_SIG_ghw1_1_JHUGen_JECUp, &b_pConst_HadWH_SIG_ghw1_1_JHUGen_JECUp); fChain->SetBranchAddress("p_HadWH_SIG_ghw1_1_JHUGen_JECUp", &p_HadWH_SIG_ghw1_1_JHUGen_JECUp, &b_p_HadWH_SIG_ghw1_1_JHUGen_JECUp); fChain->SetBranchAddress("p_HadWH_SIG_ghw1prime2_1E4_JHUGen_JECUp", &p_HadWH_SIG_ghw1prime2_1E4_JHUGen_JECUp, &b_p_HadWH_SIG_ghw1prime2_1E4_JHUGen_JECUp); fChain->SetBranchAddress("p_HadWH_SIG_ghw2_1_JHUGen_JECUp", &p_HadWH_SIG_ghw2_1_JHUGen_JECUp, &b_p_HadWH_SIG_ghw2_1_JHUGen_JECUp); fChain->SetBranchAddress("p_HadWH_SIG_ghw4_1_JHUGen_JECUp", &p_HadWH_SIG_ghw4_1_JHUGen_JECUp, &b_p_HadWH_SIG_ghw4_1_JHUGen_JECUp); fChain->SetBranchAddress("p_HadWH_SIG_ghw1_1_ghw1prime2_1E4_JHUGen_JECUp", &p_HadWH_SIG_ghw1_1_ghw1prime2_1E4_JHUGen_JECUp, &b_p_HadWH_SIG_ghw1_1_ghw1prime2_1E4_JHUGen_JECUp); fChain->SetBranchAddress("p_HadWH_SIG_ghw1_1_ghw2_1_JHUGen_JECUp", &p_HadWH_SIG_ghw1_1_ghw2_1_JHUGen_JECUp, &b_p_HadWH_SIG_ghw1_1_ghw2_1_JHUGen_JECUp); fChain->SetBranchAddress("p_HadWH_SIG_ghw1_1_ghw4_1_JHUGen_JECUp", &p_HadWH_SIG_ghw1_1_ghw4_1_JHUGen_JECUp, &b_p_HadWH_SIG_ghw1_1_ghw4_1_JHUGen_JECUp); fChain->SetBranchAddress("p_ttHUndecayed_SIG_kappa_1_JHUGen_JECUp", &p_ttHUndecayed_SIG_kappa_1_JHUGen_JECUp, &b_p_ttHUndecayed_SIG_kappa_1_JHUGen_JECUp); fChain->SetBranchAddress("p_ttHUndecayed_SIG_kappatilde_1_JHUGen_JECUp", &p_ttHUndecayed_SIG_kappatilde_1_JHUGen_JECUp, &b_p_ttHUndecayed_SIG_kappatilde_1_JHUGen_JECUp); fChain->SetBranchAddress("p_ttHUndecayed_SIG_kappa_1_kappatilde_1_JHUGen_JECUp", &p_ttHUndecayed_SIG_kappa_1_kappatilde_1_JHUGen_JECUp, &b_p_ttHUndecayed_SIG_kappa_1_kappatilde_1_JHUGen_JECUp); fChain->SetBranchAddress("p_bbH_SIG_kappa_1_JHUGen_JECUp", &p_bbH_SIG_kappa_1_JHUGen_JECUp, &b_p_bbH_SIG_kappa_1_JHUGen_JECUp); fChain->SetBranchAddress("pAux_JVBF_SIG_ghv1_1_JHUGen_JECDn", &pAux_JVBF_SIG_ghv1_1_JHUGen_JECDn, &b_pAux_JVBF_SIG_ghv1_1_JHUGen_JECDn); fChain->SetBranchAddress("p_JVBF_SIG_ghv1_1_JHUGen_JECDn", &p_JVBF_SIG_ghv1_1_JHUGen_JECDn, &b_p_JVBF_SIG_ghv1_1_JHUGen_JECDn); fChain->SetBranchAddress("pConst_JQCD_SIG_ghg2_1_JHUGen_JECDn", &pConst_JQCD_SIG_ghg2_1_JHUGen_JECDn, &b_pConst_JQCD_SIG_ghg2_1_JHUGen_JECDn); fChain->SetBranchAddress("p_JQCD_SIG_ghg2_1_JHUGen_JECDn", &p_JQCD_SIG_ghg2_1_JHUGen_JECDn, &b_p_JQCD_SIG_ghg2_1_JHUGen_JECDn); fChain->SetBranchAddress("pConst_JJVBF_SIG_ghv1_1_JHUGen_JECDn", &pConst_JJVBF_SIG_ghv1_1_JHUGen_JECDn, &b_pConst_JJVBF_SIG_ghv1_1_JHUGen_JECDn); fChain->SetBranchAddress("p_JJVBF_SIG_ghv1_1_JHUGen_JECDn", &p_JJVBF_SIG_ghv1_1_JHUGen_JECDn, &b_p_JJVBF_SIG_ghv1_1_JHUGen_JECDn); fChain->SetBranchAddress("p_JJVBF_SIG_ghv1prime2_1E4_JHUGen_JECDn", &p_JJVBF_SIG_ghv1prime2_1E4_JHUGen_JECDn, &b_p_JJVBF_SIG_ghv1prime2_1E4_JHUGen_JECDn); fChain->SetBranchAddress("p_JJVBF_SIG_ghv2_1_JHUGen_JECDn", &p_JJVBF_SIG_ghv2_1_JHUGen_JECDn, &b_p_JJVBF_SIG_ghv2_1_JHUGen_JECDn); fChain->SetBranchAddress("p_JJVBF_SIG_ghv4_1_JHUGen_JECDn", &p_JJVBF_SIG_ghv4_1_JHUGen_JECDn, &b_p_JJVBF_SIG_ghv4_1_JHUGen_JECDn); fChain->SetBranchAddress("p_JJVBF_SIG_ghza1prime2_1E4_JHUGen_JECDn", &p_JJVBF_SIG_ghza1prime2_1E4_JHUGen_JECDn, &b_p_JJVBF_SIG_ghza1prime2_1E4_JHUGen_JECDn); fChain->SetBranchAddress("p_JJVBF_SIG_ghza2_1_JHUGen_JECDn", &p_JJVBF_SIG_ghza2_1_JHUGen_JECDn, &b_p_JJVBF_SIG_ghza2_1_JHUGen_JECDn); fChain->SetBranchAddress("p_JJVBF_SIG_ghza4_1_JHUGen_JECDn", &p_JJVBF_SIG_ghza4_1_JHUGen_JECDn, &b_p_JJVBF_SIG_ghza4_1_JHUGen_JECDn); fChain->SetBranchAddress("p_JJVBF_SIG_gha2_1_JHUGen_JECDn", &p_JJVBF_SIG_gha2_1_JHUGen_JECDn, &b_p_JJVBF_SIG_gha2_1_JHUGen_JECDn); fChain->SetBranchAddress("p_JJVBF_SIG_gha4_1_JHUGen_JECDn", &p_JJVBF_SIG_gha4_1_JHUGen_JECDn, &b_p_JJVBF_SIG_gha4_1_JHUGen_JECDn); fChain->SetBranchAddress("p_JJVBF_SIG_ghv1_1_ghv1prime2_1E4_JHUGen_JECDn", &p_JJVBF_SIG_ghv1_1_ghv1prime2_1E4_JHUGen_JECDn, &b_p_JJVBF_SIG_ghv1_1_ghv1prime2_1E4_JHUGen_JECDn); fChain->SetBranchAddress("p_JJVBF_SIG_ghv1_1_ghv2_1_JHUGen_JECDn", &p_JJVBF_SIG_ghv1_1_ghv2_1_JHUGen_JECDn, &b_p_JJVBF_SIG_ghv1_1_ghv2_1_JHUGen_JECDn); fChain->SetBranchAddress("p_JJVBF_SIG_ghv1_1_ghv4_1_JHUGen_JECDn", &p_JJVBF_SIG_ghv1_1_ghv4_1_JHUGen_JECDn, &b_p_JJVBF_SIG_ghv1_1_ghv4_1_JHUGen_JECDn); fChain->SetBranchAddress("p_JJVBF_SIG_ghv1_1_ghza1prime2_1E4_JHUGen_JECDn", &p_JJVBF_SIG_ghv1_1_ghza1prime2_1E4_JHUGen_JECDn, &b_p_JJVBF_SIG_ghv1_1_ghza1prime2_1E4_JHUGen_JECDn); fChain->SetBranchAddress("p_JJVBF_SIG_ghv1_1_ghza2_1_JHUGen_JECDn", &p_JJVBF_SIG_ghv1_1_ghza2_1_JHUGen_JECDn, &b_p_JJVBF_SIG_ghv1_1_ghza2_1_JHUGen_JECDn); fChain->SetBranchAddress("p_JJVBF_SIG_ghv1_1_ghza4_1_JHUGen_JECDn", &p_JJVBF_SIG_ghv1_1_ghza4_1_JHUGen_JECDn, &b_p_JJVBF_SIG_ghv1_1_ghza4_1_JHUGen_JECDn); fChain->SetBranchAddress("p_JJVBF_SIG_ghv1_1_gha2_1_JHUGen_JECDn", &p_JJVBF_SIG_ghv1_1_gha2_1_JHUGen_JECDn, &b_p_JJVBF_SIG_ghv1_1_gha2_1_JHUGen_JECDn); fChain->SetBranchAddress("p_JJVBF_SIG_ghv1_1_gha4_1_JHUGen_JECDn", &p_JJVBF_SIG_ghv1_1_gha4_1_JHUGen_JECDn, &b_p_JJVBF_SIG_ghv1_1_gha4_1_JHUGen_JECDn); fChain->SetBranchAddress("pConst_JJQCD_SIG_ghg2_1_JHUGen_JECDn", &pConst_JJQCD_SIG_ghg2_1_JHUGen_JECDn, &b_pConst_JJQCD_SIG_ghg2_1_JHUGen_JECDn); fChain->SetBranchAddress("p_JJQCD_SIG_ghg2_1_JHUGen_JECDn", &p_JJQCD_SIG_ghg2_1_JHUGen_JECDn, &b_p_JJQCD_SIG_ghg2_1_JHUGen_JECDn); fChain->SetBranchAddress("p_JJQCD_SIG_ghg4_1_JHUGen_JECDn", &p_JJQCD_SIG_ghg4_1_JHUGen_JECDn, &b_p_JJQCD_SIG_ghg4_1_JHUGen_JECDn); fChain->SetBranchAddress("p_JJQCD_SIG_ghg2_1_ghg4_1_JHUGen_JECDn", &p_JJQCD_SIG_ghg2_1_ghg4_1_JHUGen_JECDn, &b_p_JJQCD_SIG_ghg2_1_ghg4_1_JHUGen_JECDn); fChain->SetBranchAddress("pConst_JJQCD_InitialQQ_SIG_ghg2_1_JHUGen_JECDn", &pConst_JJQCD_InitialQQ_SIG_ghg2_1_JHUGen_JECDn, &b_pConst_JJQCD_InitialQQ_SIG_ghg2_1_JHUGen_JECDn); fChain->SetBranchAddress("p_JJQCD_InitialQQ_SIG_ghg2_1_JHUGen_JECDn", &p_JJQCD_InitialQQ_SIG_ghg2_1_JHUGen_JECDn, &b_p_JJQCD_InitialQQ_SIG_ghg2_1_JHUGen_JECDn); fChain->SetBranchAddress("p_JJQCD_InitialQQ_SIG_ghg4_1_JHUGen_JECDn", &p_JJQCD_InitialQQ_SIG_ghg4_1_JHUGen_JECDn, &b_p_JJQCD_InitialQQ_SIG_ghg4_1_JHUGen_JECDn); fChain->SetBranchAddress("p_JJQCD_InitialQQ_SIG_ghg2_1_ghg4_1_JHUGen_JECDn", &p_JJQCD_InitialQQ_SIG_ghg2_1_ghg4_1_JHUGen_JECDn, &b_p_JJQCD_InitialQQ_SIG_ghg2_1_ghg4_1_JHUGen_JECDn); fChain->SetBranchAddress("pConst_HadZH_SIG_ghz1_1_JHUGen_JECDn", &pConst_HadZH_SIG_ghz1_1_JHUGen_JECDn, &b_pConst_HadZH_SIG_ghz1_1_JHUGen_JECDn); fChain->SetBranchAddress("p_HadZH_SIG_ghz1_1_JHUGen_JECDn", &p_HadZH_SIG_ghz1_1_JHUGen_JECDn, &b_p_HadZH_SIG_ghz1_1_JHUGen_JECDn); fChain->SetBranchAddress("p_HadZH_SIG_ghz1prime2_1E4_JHUGen_JECDn", &p_HadZH_SIG_ghz1prime2_1E4_JHUGen_JECDn, &b_p_HadZH_SIG_ghz1prime2_1E4_JHUGen_JECDn); fChain->SetBranchAddress("p_HadZH_SIG_ghz2_1_JHUGen_JECDn", &p_HadZH_SIG_ghz2_1_JHUGen_JECDn, &b_p_HadZH_SIG_ghz2_1_JHUGen_JECDn); fChain->SetBranchAddress("p_HadZH_SIG_ghz4_1_JHUGen_JECDn", &p_HadZH_SIG_ghz4_1_JHUGen_JECDn, &b_p_HadZH_SIG_ghz4_1_JHUGen_JECDn); fChain->SetBranchAddress("p_HadZH_SIG_ghza1prime2_1E4_JHUGen_JECDn", &p_HadZH_SIG_ghza1prime2_1E4_JHUGen_JECDn, &b_p_HadZH_SIG_ghza1prime2_1E4_JHUGen_JECDn); fChain->SetBranchAddress("p_HadZH_SIG_ghza2_1_JHUGen_JECDn", &p_HadZH_SIG_ghza2_1_JHUGen_JECDn, &b_p_HadZH_SIG_ghza2_1_JHUGen_JECDn); fChain->SetBranchAddress("p_HadZH_SIG_ghza4_1_JHUGen_JECDn", &p_HadZH_SIG_ghza4_1_JHUGen_JECDn, &b_p_HadZH_SIG_ghza4_1_JHUGen_JECDn); fChain->SetBranchAddress("p_HadZH_SIG_gha2_1_JHUGen_JECDn", &p_HadZH_SIG_gha2_1_JHUGen_JECDn, &b_p_HadZH_SIG_gha2_1_JHUGen_JECDn); fChain->SetBranchAddress("p_HadZH_SIG_gha4_1_JHUGen_JECDn", &p_HadZH_SIG_gha4_1_JHUGen_JECDn, &b_p_HadZH_SIG_gha4_1_JHUGen_JECDn); fChain->SetBranchAddress("p_HadZH_SIG_ghz1_1_ghz1prime2_1E4_JHUGen_JECDn", &p_HadZH_SIG_ghz1_1_ghz1prime2_1E4_JHUGen_JECDn, &b_p_HadZH_SIG_ghz1_1_ghz1prime2_1E4_JHUGen_JECDn); fChain->SetBranchAddress("p_HadZH_SIG_ghz1_1_ghz2_1_JHUGen_JECDn", &p_HadZH_SIG_ghz1_1_ghz2_1_JHUGen_JECDn, &b_p_HadZH_SIG_ghz1_1_ghz2_1_JHUGen_JECDn); fChain->SetBranchAddress("p_HadZH_SIG_ghz1_1_ghz4_1_JHUGen_JECDn", &p_HadZH_SIG_ghz1_1_ghz4_1_JHUGen_JECDn, &b_p_HadZH_SIG_ghz1_1_ghz4_1_JHUGen_JECDn); fChain->SetBranchAddress("p_HadZH_SIG_ghz1_1_ghza1prime2_1E4_JHUGen_JECDn", &p_HadZH_SIG_ghz1_1_ghza1prime2_1E4_JHUGen_JECDn, &b_p_HadZH_SIG_ghz1_1_ghza1prime2_1E4_JHUGen_JECDn); fChain->SetBranchAddress("p_HadZH_SIG_ghz1_1_ghza2_1_JHUGen_JECDn", &p_HadZH_SIG_ghz1_1_ghza2_1_JHUGen_JECDn, &b_p_HadZH_SIG_ghz1_1_ghza2_1_JHUGen_JECDn); fChain->SetBranchAddress("p_HadZH_SIG_ghz1_1_ghza4_1_JHUGen_JECDn", &p_HadZH_SIG_ghz1_1_ghza4_1_JHUGen_JECDn, &b_p_HadZH_SIG_ghz1_1_ghza4_1_JHUGen_JECDn); fChain->SetBranchAddress("p_HadZH_SIG_ghz1_1_gha2_1_JHUGen_JECDn", &p_HadZH_SIG_ghz1_1_gha2_1_JHUGen_JECDn, &b_p_HadZH_SIG_ghz1_1_gha2_1_JHUGen_JECDn); fChain->SetBranchAddress("p_HadZH_SIG_ghz1_1_gha4_1_JHUGen_JECDn", &p_HadZH_SIG_ghz1_1_gha4_1_JHUGen_JECDn, &b_p_HadZH_SIG_ghz1_1_gha4_1_JHUGen_JECDn); fChain->SetBranchAddress("pConst_HadWH_SIG_ghw1_1_JHUGen_JECDn", &pConst_HadWH_SIG_ghw1_1_JHUGen_JECDn, &b_pConst_HadWH_SIG_ghw1_1_JHUGen_JECDn); fChain->SetBranchAddress("p_HadWH_SIG_ghw1_1_JHUGen_JECDn", &p_HadWH_SIG_ghw1_1_JHUGen_JECDn, &b_p_HadWH_SIG_ghw1_1_JHUGen_JECDn); fChain->SetBranchAddress("p_HadWH_SIG_ghw1prime2_1E4_JHUGen_JECDn", &p_HadWH_SIG_ghw1prime2_1E4_JHUGen_JECDn, &b_p_HadWH_SIG_ghw1prime2_1E4_JHUGen_JECDn); fChain->SetBranchAddress("p_HadWH_SIG_ghw2_1_JHUGen_JECDn", &p_HadWH_SIG_ghw2_1_JHUGen_JECDn, &b_p_HadWH_SIG_ghw2_1_JHUGen_JECDn); fChain->SetBranchAddress("p_HadWH_SIG_ghw4_1_JHUGen_JECDn", &p_HadWH_SIG_ghw4_1_JHUGen_JECDn, &b_p_HadWH_SIG_ghw4_1_JHUGen_JECDn); fChain->SetBranchAddress("p_HadWH_SIG_ghw1_1_ghw1prime2_1E4_JHUGen_JECDn", &p_HadWH_SIG_ghw1_1_ghw1prime2_1E4_JHUGen_JECDn, &b_p_HadWH_SIG_ghw1_1_ghw1prime2_1E4_JHUGen_JECDn); fChain->SetBranchAddress("p_HadWH_SIG_ghw1_1_ghw2_1_JHUGen_JECDn", &p_HadWH_SIG_ghw1_1_ghw2_1_JHUGen_JECDn, &b_p_HadWH_SIG_ghw1_1_ghw2_1_JHUGen_JECDn); fChain->SetBranchAddress("p_HadWH_SIG_ghw1_1_ghw4_1_JHUGen_JECDn", &p_HadWH_SIG_ghw1_1_ghw4_1_JHUGen_JECDn, &b_p_HadWH_SIG_ghw1_1_ghw4_1_JHUGen_JECDn); fChain->SetBranchAddress("p_ttHUndecayed_SIG_kappa_1_JHUGen_JECDn", &p_ttHUndecayed_SIG_kappa_1_JHUGen_JECDn, &b_p_ttHUndecayed_SIG_kappa_1_JHUGen_JECDn); fChain->SetBranchAddress("p_ttHUndecayed_SIG_kappatilde_1_JHUGen_JECDn", &p_ttHUndecayed_SIG_kappatilde_1_JHUGen_JECDn, &b_p_ttHUndecayed_SIG_kappatilde_1_JHUGen_JECDn); fChain->SetBranchAddress("p_ttHUndecayed_SIG_kappa_1_kappatilde_1_JHUGen_JECDn", &p_ttHUndecayed_SIG_kappa_1_kappatilde_1_JHUGen_JECDn, &b_p_ttHUndecayed_SIG_kappa_1_kappatilde_1_JHUGen_JECDn); fChain->SetBranchAddress("p_bbH_SIG_kappa_1_JHUGen_JECDn", &p_bbH_SIG_kappa_1_JHUGen_JECDn, &b_p_bbH_SIG_kappa_1_JHUGen_JECDn); fChain->SetBranchAddress("p_LepZH_SIG_ghz1_1_JHUGen", &p_LepZH_SIG_ghz1_1_JHUGen, &b_p_LepZH_SIG_ghz1_1_JHUGen); fChain->SetBranchAddress("p_LepZH_SIG_ghz1prime2_1E4_JHUGen", &p_LepZH_SIG_ghz1prime2_1E4_JHUGen, &b_p_LepZH_SIG_ghz1prime2_1E4_JHUGen); fChain->SetBranchAddress("p_LepZH_SIG_ghz2_1_JHUGen", &p_LepZH_SIG_ghz2_1_JHUGen, &b_p_LepZH_SIG_ghz2_1_JHUGen); fChain->SetBranchAddress("p_LepZH_SIG_ghz4_1_JHUGen", &p_LepZH_SIG_ghz4_1_JHUGen, &b_p_LepZH_SIG_ghz4_1_JHUGen); fChain->SetBranchAddress("p_LepZH_SIG_ghza1prime2_1E4_JHUGen", &p_LepZH_SIG_ghza1prime2_1E4_JHUGen, &b_p_LepZH_SIG_ghza1prime2_1E4_JHUGen); fChain->SetBranchAddress("p_LepZH_SIG_ghza2_1_JHUGen", &p_LepZH_SIG_ghza2_1_JHUGen, &b_p_LepZH_SIG_ghza2_1_JHUGen); fChain->SetBranchAddress("p_LepZH_SIG_ghza4_1_JHUGen", &p_LepZH_SIG_ghza4_1_JHUGen, &b_p_LepZH_SIG_ghza4_1_JHUGen); fChain->SetBranchAddress("p_LepZH_SIG_gha2_1_JHUGen", &p_LepZH_SIG_gha2_1_JHUGen, &b_p_LepZH_SIG_gha2_1_JHUGen); fChain->SetBranchAddress("p_LepZH_SIG_gha4_1_JHUGen", &p_LepZH_SIG_gha4_1_JHUGen, &b_p_LepZH_SIG_gha4_1_JHUGen); fChain->SetBranchAddress("p_LepZH_SIG_ghz1_1_ghz1prime2_1E4_JHUGen", &p_LepZH_SIG_ghz1_1_ghz1prime2_1E4_JHUGen, &b_p_LepZH_SIG_ghz1_1_ghz1prime2_1E4_JHUGen); fChain->SetBranchAddress("p_LepZH_SIG_ghz1_1_ghz2_1_JHUGen", &p_LepZH_SIG_ghz1_1_ghz2_1_JHUGen, &b_p_LepZH_SIG_ghz1_1_ghz2_1_JHUGen); fChain->SetBranchAddress("p_LepZH_SIG_ghz1_1_ghz4_1_JHUGen", &p_LepZH_SIG_ghz1_1_ghz4_1_JHUGen, &b_p_LepZH_SIG_ghz1_1_ghz4_1_JHUGen); fChain->SetBranchAddress("p_LepZH_SIG_ghz1_1_ghza1prime2_1E4_JHUGen", &p_LepZH_SIG_ghz1_1_ghza1prime2_1E4_JHUGen, &b_p_LepZH_SIG_ghz1_1_ghza1prime2_1E4_JHUGen); fChain->SetBranchAddress("p_LepZH_SIG_ghz1_1_ghza2_1_JHUGen", &p_LepZH_SIG_ghz1_1_ghza2_1_JHUGen, &b_p_LepZH_SIG_ghz1_1_ghza2_1_JHUGen); fChain->SetBranchAddress("p_LepZH_SIG_ghz1_1_ghza4_1_JHUGen", &p_LepZH_SIG_ghz1_1_ghza4_1_JHUGen, &b_p_LepZH_SIG_ghz1_1_ghza4_1_JHUGen); fChain->SetBranchAddress("p_LepZH_SIG_ghz1_1_gha2_1_JHUGen", &p_LepZH_SIG_ghz1_1_gha2_1_JHUGen, &b_p_LepZH_SIG_ghz1_1_gha2_1_JHUGen); fChain->SetBranchAddress("p_LepZH_SIG_ghz1_1_gha4_1_JHUGen", &p_LepZH_SIG_ghz1_1_gha4_1_JHUGen, &b_p_LepZH_SIG_ghz1_1_gha4_1_JHUGen); fChain->SetBranchAddress("p_LepWH_SIG_ghw1_1_JHUGen", &p_LepWH_SIG_ghw1_1_JHUGen, &b_p_LepWH_SIG_ghw1_1_JHUGen); fChain->SetBranchAddress("p_LepWH_SIG_ghw1prime2_1E4_JHUGen", &p_LepWH_SIG_ghw1prime2_1E4_JHUGen, &b_p_LepWH_SIG_ghw1prime2_1E4_JHUGen); fChain->SetBranchAddress("p_LepWH_SIG_ghw2_1_JHUGen", &p_LepWH_SIG_ghw2_1_JHUGen, &b_p_LepWH_SIG_ghw2_1_JHUGen); fChain->SetBranchAddress("p_LepWH_SIG_ghw4_1_JHUGen", &p_LepWH_SIG_ghw4_1_JHUGen, &b_p_LepWH_SIG_ghw4_1_JHUGen); fChain->SetBranchAddress("p_LepWH_SIG_ghw1_1_ghw1prime2_1E4_JHUGen", &p_LepWH_SIG_ghw1_1_ghw1prime2_1E4_JHUGen, &b_p_LepWH_SIG_ghw1_1_ghw1prime2_1E4_JHUGen); fChain->SetBranchAddress("p_LepWH_SIG_ghw1_1_ghw2_1_JHUGen", &p_LepWH_SIG_ghw1_1_ghw2_1_JHUGen, &b_p_LepWH_SIG_ghw1_1_ghw2_1_JHUGen); fChain->SetBranchAddress("p_LepWH_SIG_ghw1_1_ghw4_1_JHUGen", &p_LepWH_SIG_ghw1_1_ghw4_1_JHUGen, &b_p_LepWH_SIG_ghw1_1_ghw4_1_JHUGen); fChain->SetBranchAddress("p_QQB_SIG_ZPqqLR_1_gZPz1_1_JHUGen", &p_QQB_SIG_ZPqqLR_1_gZPz1_1_JHUGen, &b_p_QQB_SIG_ZPqqLR_1_gZPz1_1_JHUGen); fChain->SetBranchAddress("p_QQB_SIG_ZPqqLR_1_gZPz2_1_JHUGen", &p_QQB_SIG_ZPqqLR_1_gZPz2_1_JHUGen, &b_p_QQB_SIG_ZPqqLR_1_gZPz2_1_JHUGen); fChain->SetBranchAddress("p_INDEPENDENT_SIG_gZPz1_1_JHUGen", &p_INDEPENDENT_SIG_gZPz1_1_JHUGen, &b_p_INDEPENDENT_SIG_gZPz1_1_JHUGen); fChain->SetBranchAddress("p_INDEPENDENT_SIG_gZPz2_1_JHUGen", &p_INDEPENDENT_SIG_gZPz2_1_JHUGen, &b_p_INDEPENDENT_SIG_gZPz2_1_JHUGen); fChain->SetBranchAddress("p_GG_SIG_gXg1_1_gXz1_1_JHUGen", &p_GG_SIG_gXg1_1_gXz1_1_JHUGen, &b_p_GG_SIG_gXg1_1_gXz1_1_JHUGen); fChain->SetBranchAddress("p_GG_SIG_gXg2_1_gXz2_1_JHUGen", &p_GG_SIG_gXg2_1_gXz2_1_JHUGen, &b_p_GG_SIG_gXg2_1_gXz2_1_JHUGen); fChain->SetBranchAddress("p_GG_SIG_gXg3_1_gXz3_1_JHUGen", &p_GG_SIG_gXg3_1_gXz3_1_JHUGen, &b_p_GG_SIG_gXg3_1_gXz3_1_JHUGen); fChain->SetBranchAddress("p_GG_SIG_gXg4_1_gXz4_1_JHUGen", &p_GG_SIG_gXg4_1_gXz4_1_JHUGen, &b_p_GG_SIG_gXg4_1_gXz4_1_JHUGen); fChain->SetBranchAddress("p_GG_SIG_gXg1_1_gXz5_1_JHUGen", &p_GG_SIG_gXg1_1_gXz5_1_JHUGen, &b_p_GG_SIG_gXg1_1_gXz5_1_JHUGen); fChain->SetBranchAddress("p_GG_SIG_gXg1_1_gXz1_1_gXz5_1_JHUGen", &p_GG_SIG_gXg1_1_gXz1_1_gXz5_1_JHUGen, &b_p_GG_SIG_gXg1_1_gXz1_1_gXz5_1_JHUGen); fChain->SetBranchAddress("p_GG_SIG_gXg1_1_gXz6_1_JHUGen", &p_GG_SIG_gXg1_1_gXz6_1_JHUGen, &b_p_GG_SIG_gXg1_1_gXz6_1_JHUGen); fChain->SetBranchAddress("p_GG_SIG_gXg1_1_gXz7_1_JHUGen", &p_GG_SIG_gXg1_1_gXz7_1_JHUGen, &b_p_GG_SIG_gXg1_1_gXz7_1_JHUGen); fChain->SetBranchAddress("p_GG_SIG_gXg5_1_gXz8_1_JHUGen", &p_GG_SIG_gXg5_1_gXz8_1_JHUGen, &b_p_GG_SIG_gXg5_1_gXz8_1_JHUGen); fChain->SetBranchAddress("p_GG_SIG_gXg5_1_gXz9_1_JHUGen", &p_GG_SIG_gXg5_1_gXz9_1_JHUGen, &b_p_GG_SIG_gXg5_1_gXz9_1_JHUGen); fChain->SetBranchAddress("p_GG_SIG_gXg5_1_gXz10_1_JHUGen", &p_GG_SIG_gXg5_1_gXz10_1_JHUGen, &b_p_GG_SIG_gXg5_1_gXz10_1_JHUGen); fChain->SetBranchAddress("p_QQB_SIG_XqqLR_1_gXz1_1_JHUGen", &p_QQB_SIG_XqqLR_1_gXz1_1_JHUGen, &b_p_QQB_SIG_XqqLR_1_gXz1_1_JHUGen); fChain->SetBranchAddress("p_QQB_SIG_XqqLR_1_gXz2_1_JHUGen", &p_QQB_SIG_XqqLR_1_gXz2_1_JHUGen, &b_p_QQB_SIG_XqqLR_1_gXz2_1_JHUGen); fChain->SetBranchAddress("p_QQB_SIG_XqqLR_1_gXz3_1_JHUGen", &p_QQB_SIG_XqqLR_1_gXz3_1_JHUGen, &b_p_QQB_SIG_XqqLR_1_gXz3_1_JHUGen); fChain->SetBranchAddress("p_QQB_SIG_XqqLR_1_gXz4_1_JHUGen", &p_QQB_SIG_XqqLR_1_gXz4_1_JHUGen, &b_p_QQB_SIG_XqqLR_1_gXz4_1_JHUGen); fChain->SetBranchAddress("p_QQB_SIG_XqqLR_1_gXz5_1_JHUGen", &p_QQB_SIG_XqqLR_1_gXz5_1_JHUGen, &b_p_QQB_SIG_XqqLR_1_gXz5_1_JHUGen); fChain->SetBranchAddress("p_QQB_SIG_XqqLR_1_gXz1_1_gXz5_1_JHUGen", &p_QQB_SIG_XqqLR_1_gXz1_1_gXz5_1_JHUGen, &b_p_QQB_SIG_XqqLR_1_gXz1_1_gXz5_1_JHUGen); fChain->SetBranchAddress("p_QQB_SIG_XqqLR_1_gXz6_1_JHUGen", &p_QQB_SIG_XqqLR_1_gXz6_1_JHUGen, &b_p_QQB_SIG_XqqLR_1_gXz6_1_JHUGen); fChain->SetBranchAddress("p_QQB_SIG_XqqLR_1_gXz7_1_JHUGen", &p_QQB_SIG_XqqLR_1_gXz7_1_JHUGen, &b_p_QQB_SIG_XqqLR_1_gXz7_1_JHUGen); fChain->SetBranchAddress("p_QQB_SIG_XqqLR_1_gXz8_1_JHUGen", &p_QQB_SIG_XqqLR_1_gXz8_1_JHUGen, &b_p_QQB_SIG_XqqLR_1_gXz8_1_JHUGen); fChain->SetBranchAddress("p_QQB_SIG_XqqLR_1_gXz9_1_JHUGen", &p_QQB_SIG_XqqLR_1_gXz9_1_JHUGen, &b_p_QQB_SIG_XqqLR_1_gXz9_1_JHUGen); fChain->SetBranchAddress("p_QQB_SIG_XqqLR_1_gXz10_1_JHUGen", &p_QQB_SIG_XqqLR_1_gXz10_1_JHUGen, &b_p_QQB_SIG_XqqLR_1_gXz10_1_JHUGen); fChain->SetBranchAddress("p_INDEPENDENT_SIG_gXz1_1_JHUGen", &p_INDEPENDENT_SIG_gXz1_1_JHUGen, &b_p_INDEPENDENT_SIG_gXz1_1_JHUGen); fChain->SetBranchAddress("p_INDEPENDENT_SIG_gXz2_1_JHUGen", &p_INDEPENDENT_SIG_gXz2_1_JHUGen, &b_p_INDEPENDENT_SIG_gXz2_1_JHUGen); fChain->SetBranchAddress("p_INDEPENDENT_SIG_gXz3_1_JHUGen", &p_INDEPENDENT_SIG_gXz3_1_JHUGen, &b_p_INDEPENDENT_SIG_gXz3_1_JHUGen); fChain->SetBranchAddress("p_INDEPENDENT_SIG_gXz4_1_JHUGen", &p_INDEPENDENT_SIG_gXz4_1_JHUGen, &b_p_INDEPENDENT_SIG_gXz4_1_JHUGen); fChain->SetBranchAddress("p_INDEPENDENT_SIG_gXz5_1_JHUGen", &p_INDEPENDENT_SIG_gXz5_1_JHUGen, &b_p_INDEPENDENT_SIG_gXz5_1_JHUGen); fChain->SetBranchAddress("p_INDEPENDENT_SIG_gXz1_1_gXz5_1_JHUGen", &p_INDEPENDENT_SIG_gXz1_1_gXz5_1_JHUGen, &b_p_INDEPENDENT_SIG_gXz1_1_gXz5_1_JHUGen); fChain->SetBranchAddress("p_INDEPENDENT_SIG_gXz6_1_JHUGen", &p_INDEPENDENT_SIG_gXz6_1_JHUGen, &b_p_INDEPENDENT_SIG_gXz6_1_JHUGen); fChain->SetBranchAddress("p_INDEPENDENT_SIG_gXz7_1_JHUGen", &p_INDEPENDENT_SIG_gXz7_1_JHUGen, &b_p_INDEPENDENT_SIG_gXz7_1_JHUGen); fChain->SetBranchAddress("p_INDEPENDENT_SIG_gXz8_1_JHUGen", &p_INDEPENDENT_SIG_gXz8_1_JHUGen, &b_p_INDEPENDENT_SIG_gXz8_1_JHUGen); fChain->SetBranchAddress("p_INDEPENDENT_SIG_gXz9_1_JHUGen", &p_INDEPENDENT_SIG_gXz9_1_JHUGen, &b_p_INDEPENDENT_SIG_gXz9_1_JHUGen); fChain->SetBranchAddress("p_INDEPENDENT_SIG_gXz10_1_JHUGen", &p_INDEPENDENT_SIG_gXz10_1_JHUGen, &b_p_INDEPENDENT_SIG_gXz10_1_JHUGen); fChain->SetBranchAddress("pConst_GG_SIG_kappaTopBot_1_ghz1_1_MCFM", &pConst_GG_SIG_kappaTopBot_1_ghz1_1_MCFM, &b_pConst_GG_SIG_kappaTopBot_1_ghz1_1_MCFM); fChain->SetBranchAddress("p_GG_SIG_kappaTopBot_1_ghz1_1_MCFM", &p_GG_SIG_kappaTopBot_1_ghz1_1_MCFM, &b_p_GG_SIG_kappaTopBot_1_ghz1_1_MCFM); fChain->SetBranchAddress("p_GG_BSI_kappaTopBot_1_ghz1_1_MCFM", &p_GG_BSI_kappaTopBot_1_ghz1_1_MCFM, &b_p_GG_BSI_kappaTopBot_1_ghz1_1_MCFM); fChain->SetBranchAddress("p_GG_BSI_kappaTopBot_1_ghz1_i_MCFM", &p_GG_BSI_kappaTopBot_1_ghz1_i_MCFM, &b_p_GG_BSI_kappaTopBot_1_ghz1_i_MCFM); fChain->SetBranchAddress("pConst_GG_BKG_MCFM", &pConst_GG_BKG_MCFM, &b_pConst_GG_BKG_MCFM); fChain->SetBranchAddress("p_GG_BKG_MCFM", &p_GG_BKG_MCFM, &b_p_GG_BKG_MCFM); fChain->SetBranchAddress("pConst_QQB_BKG_MCFM", &pConst_QQB_BKG_MCFM, &b_pConst_QQB_BKG_MCFM); fChain->SetBranchAddress("p_QQB_BKG_MCFM", &p_QQB_BKG_MCFM, &b_p_QQB_BKG_MCFM); fChain->SetBranchAddress("pConst_ZJJ_BKG_MCFM", &pConst_ZJJ_BKG_MCFM, &b_pConst_ZJJ_BKG_MCFM); fChain->SetBranchAddress("p_ZJJ_BKG_MCFM", &p_ZJJ_BKG_MCFM, &b_p_ZJJ_BKG_MCFM); fChain->SetBranchAddress("p_JJEW_SIG_ghv1_1_MCFM_JECNominal", &p_JJEW_SIG_ghv1_1_MCFM_JECNominal, &b_p_JJEW_SIG_ghv1_1_MCFM_JECNominal); fChain->SetBranchAddress("p_JJEW_BSI_ghv1_1_MCFM_JECNominal", &p_JJEW_BSI_ghv1_1_MCFM_JECNominal, &b_p_JJEW_BSI_ghv1_1_MCFM_JECNominal); fChain->SetBranchAddress("p_JJEW_BSI_ghv1_i_MCFM_JECNominal", &p_JJEW_BSI_ghv1_i_MCFM_JECNominal, &b_p_JJEW_BSI_ghv1_i_MCFM_JECNominal); fChain->SetBranchAddress("p_JJEW_BKG_MCFM_JECNominal", &p_JJEW_BKG_MCFM_JECNominal, &b_p_JJEW_BKG_MCFM_JECNominal); fChain->SetBranchAddress("pConst_JJVBF_S_SIG_ghv1_1_MCFM_JECNominal", &pConst_JJVBF_S_SIG_ghv1_1_MCFM_JECNominal, &b_pConst_JJVBF_S_SIG_ghv1_1_MCFM_JECNominal); fChain->SetBranchAddress("p_JJVBF_S_SIG_ghv1_1_MCFM_JECNominal", &p_JJVBF_S_SIG_ghv1_1_MCFM_JECNominal, &b_p_JJVBF_S_SIG_ghv1_1_MCFM_JECNominal); fChain->SetBranchAddress("p_JJVBF_S_BSI_ghv1_1_MCFM_JECNominal", &p_JJVBF_S_BSI_ghv1_1_MCFM_JECNominal, &b_p_JJVBF_S_BSI_ghv1_1_MCFM_JECNominal); fChain->SetBranchAddress("p_JJVBF_S_BSI_ghv1_i_MCFM_JECNominal", &p_JJVBF_S_BSI_ghv1_i_MCFM_JECNominal, &b_p_JJVBF_S_BSI_ghv1_i_MCFM_JECNominal); fChain->SetBranchAddress("p_JJVBF_SIG_ghv1_1_MCFM_JECNominal", &p_JJVBF_SIG_ghv1_1_MCFM_JECNominal, &b_p_JJVBF_SIG_ghv1_1_MCFM_JECNominal); fChain->SetBranchAddress("p_JJVBF_BSI_ghv1_1_MCFM_JECNominal", &p_JJVBF_BSI_ghv1_1_MCFM_JECNominal, &b_p_JJVBF_BSI_ghv1_1_MCFM_JECNominal); fChain->SetBranchAddress("p_JJVBF_BSI_ghv1_i_MCFM_JECNominal", &p_JJVBF_BSI_ghv1_i_MCFM_JECNominal, &b_p_JJVBF_BSI_ghv1_i_MCFM_JECNominal); fChain->SetBranchAddress("pConst_JJVBF_BKG_MCFM_JECNominal", &pConst_JJVBF_BKG_MCFM_JECNominal, &b_pConst_JJVBF_BKG_MCFM_JECNominal); fChain->SetBranchAddress("p_JJVBF_BKG_MCFM_JECNominal", &p_JJVBF_BKG_MCFM_JECNominal, &b_p_JJVBF_BKG_MCFM_JECNominal); fChain->SetBranchAddress("pConst_HadZH_S_SIG_ghz1_1_MCFM_JECNominal", &pConst_HadZH_S_SIG_ghz1_1_MCFM_JECNominal, &b_pConst_HadZH_S_SIG_ghz1_1_MCFM_JECNominal); fChain->SetBranchAddress("p_HadZH_S_SIG_ghz1_1_MCFM_JECNominal", &p_HadZH_S_SIG_ghz1_1_MCFM_JECNominal, &b_p_HadZH_S_SIG_ghz1_1_MCFM_JECNominal); fChain->SetBranchAddress("p_HadZH_S_BSI_ghz1_1_MCFM_JECNominal", &p_HadZH_S_BSI_ghz1_1_MCFM_JECNominal, &b_p_HadZH_S_BSI_ghz1_1_MCFM_JECNominal); fChain->SetBranchAddress("p_HadZH_S_BSI_ghz1_i_MCFM_JECNominal", &p_HadZH_S_BSI_ghz1_i_MCFM_JECNominal, &b_p_HadZH_S_BSI_ghz1_i_MCFM_JECNominal); fChain->SetBranchAddress("p_HadZH_SIG_ghz1_1_MCFM_JECNominal", &p_HadZH_SIG_ghz1_1_MCFM_JECNominal, &b_p_HadZH_SIG_ghz1_1_MCFM_JECNominal); fChain->SetBranchAddress("p_HadZH_BSI_ghz1_1_MCFM_JECNominal", &p_HadZH_BSI_ghz1_1_MCFM_JECNominal, &b_p_HadZH_BSI_ghz1_1_MCFM_JECNominal); fChain->SetBranchAddress("p_HadZH_BSI_ghz1_i_MCFM_JECNominal", &p_HadZH_BSI_ghz1_i_MCFM_JECNominal, &b_p_HadZH_BSI_ghz1_i_MCFM_JECNominal); fChain->SetBranchAddress("pConst_HadZH_BKG_MCFM_JECNominal", &pConst_HadZH_BKG_MCFM_JECNominal, &b_pConst_HadZH_BKG_MCFM_JECNominal); fChain->SetBranchAddress("p_HadZH_BKG_MCFM_JECNominal", &p_HadZH_BKG_MCFM_JECNominal, &b_p_HadZH_BKG_MCFM_JECNominal); fChain->SetBranchAddress("pConst_HadWH_S_SIG_ghw1_1_MCFM_JECNominal", &pConst_HadWH_S_SIG_ghw1_1_MCFM_JECNominal, &b_pConst_HadWH_S_SIG_ghw1_1_MCFM_JECNominal); fChain->SetBranchAddress("p_HadWH_S_SIG_ghw1_1_MCFM_JECNominal", &p_HadWH_S_SIG_ghw1_1_MCFM_JECNominal, &b_p_HadWH_S_SIG_ghw1_1_MCFM_JECNominal); fChain->SetBranchAddress("p_HadWH_S_BSI_ghw1_1_MCFM_JECNominal", &p_HadWH_S_BSI_ghw1_1_MCFM_JECNominal, &b_p_HadWH_S_BSI_ghw1_1_MCFM_JECNominal); fChain->SetBranchAddress("p_HadWH_S_BSI_ghw1_i_MCFM_JECNominal", &p_HadWH_S_BSI_ghw1_i_MCFM_JECNominal, &b_p_HadWH_S_BSI_ghw1_i_MCFM_JECNominal); fChain->SetBranchAddress("pConst_HadWH_BKG_MCFM_JECNominal", &pConst_HadWH_BKG_MCFM_JECNominal, &b_pConst_HadWH_BKG_MCFM_JECNominal); fChain->SetBranchAddress("p_HadWH_BKG_MCFM_JECNominal", &p_HadWH_BKG_MCFM_JECNominal, &b_p_HadWH_BKG_MCFM_JECNominal); fChain->SetBranchAddress("pConst_JJQCD_BKG_MCFM_JECNominal", &pConst_JJQCD_BKG_MCFM_JECNominal, &b_pConst_JJQCD_BKG_MCFM_JECNominal); fChain->SetBranchAddress("p_JJQCD_BKG_MCFM_JECNominal", &p_JJQCD_BKG_MCFM_JECNominal, &b_p_JJQCD_BKG_MCFM_JECNominal); fChain->SetBranchAddress("p_JJEW_SIG_ghv1_1_MCFM_JECUp", &p_JJEW_SIG_ghv1_1_MCFM_JECUp, &b_p_JJEW_SIG_ghv1_1_MCFM_JECUp); fChain->SetBranchAddress("p_JJEW_BSI_ghv1_1_MCFM_JECUp", &p_JJEW_BSI_ghv1_1_MCFM_JECUp, &b_p_JJEW_BSI_ghv1_1_MCFM_JECUp); fChain->SetBranchAddress("p_JJEW_BSI_ghv1_i_MCFM_JECUp", &p_JJEW_BSI_ghv1_i_MCFM_JECUp, &b_p_JJEW_BSI_ghv1_i_MCFM_JECUp); fChain->SetBranchAddress("p_JJEW_BKG_MCFM_JECUp", &p_JJEW_BKG_MCFM_JECUp, &b_p_JJEW_BKG_MCFM_JECUp); fChain->SetBranchAddress("pConst_JJVBF_S_SIG_ghv1_1_MCFM_JECUp", &pConst_JJVBF_S_SIG_ghv1_1_MCFM_JECUp, &b_pConst_JJVBF_S_SIG_ghv1_1_MCFM_JECUp); fChain->SetBranchAddress("p_JJVBF_S_SIG_ghv1_1_MCFM_JECUp", &p_JJVBF_S_SIG_ghv1_1_MCFM_JECUp, &b_p_JJVBF_S_SIG_ghv1_1_MCFM_JECUp); fChain->SetBranchAddress("p_JJVBF_S_BSI_ghv1_1_MCFM_JECUp", &p_JJVBF_S_BSI_ghv1_1_MCFM_JECUp, &b_p_JJVBF_S_BSI_ghv1_1_MCFM_JECUp); fChain->SetBranchAddress("p_JJVBF_S_BSI_ghv1_i_MCFM_JECUp", &p_JJVBF_S_BSI_ghv1_i_MCFM_JECUp, &b_p_JJVBF_S_BSI_ghv1_i_MCFM_JECUp); fChain->SetBranchAddress("p_JJVBF_SIG_ghv1_1_MCFM_JECUp", &p_JJVBF_SIG_ghv1_1_MCFM_JECUp, &b_p_JJVBF_SIG_ghv1_1_MCFM_JECUp); fChain->SetBranchAddress("p_JJVBF_BSI_ghv1_1_MCFM_JECUp", &p_JJVBF_BSI_ghv1_1_MCFM_JECUp, &b_p_JJVBF_BSI_ghv1_1_MCFM_JECUp); fChain->SetBranchAddress("p_JJVBF_BSI_ghv1_i_MCFM_JECUp", &p_JJVBF_BSI_ghv1_i_MCFM_JECUp, &b_p_JJVBF_BSI_ghv1_i_MCFM_JECUp); fChain->SetBranchAddress("pConst_JJVBF_BKG_MCFM_JECUp", &pConst_JJVBF_BKG_MCFM_JECUp, &b_pConst_JJVBF_BKG_MCFM_JECUp); fChain->SetBranchAddress("p_JJVBF_BKG_MCFM_JECUp", &p_JJVBF_BKG_MCFM_JECUp, &b_p_JJVBF_BKG_MCFM_JECUp); fChain->SetBranchAddress("pConst_HadZH_S_SIG_ghz1_1_MCFM_JECUp", &pConst_HadZH_S_SIG_ghz1_1_MCFM_JECUp, &b_pConst_HadZH_S_SIG_ghz1_1_MCFM_JECUp); fChain->SetBranchAddress("p_HadZH_S_SIG_ghz1_1_MCFM_JECUp", &p_HadZH_S_SIG_ghz1_1_MCFM_JECUp, &b_p_HadZH_S_SIG_ghz1_1_MCFM_JECUp); fChain->SetBranchAddress("p_HadZH_S_BSI_ghz1_1_MCFM_JECUp", &p_HadZH_S_BSI_ghz1_1_MCFM_JECUp, &b_p_HadZH_S_BSI_ghz1_1_MCFM_JECUp); fChain->SetBranchAddress("p_HadZH_S_BSI_ghz1_i_MCFM_JECUp", &p_HadZH_S_BSI_ghz1_i_MCFM_JECUp, &b_p_HadZH_S_BSI_ghz1_i_MCFM_JECUp); fChain->SetBranchAddress("p_HadZH_SIG_ghz1_1_MCFM_JECUp", &p_HadZH_SIG_ghz1_1_MCFM_JECUp, &b_p_HadZH_SIG_ghz1_1_MCFM_JECUp); fChain->SetBranchAddress("p_HadZH_BSI_ghz1_1_MCFM_JECUp", &p_HadZH_BSI_ghz1_1_MCFM_JECUp, &b_p_HadZH_BSI_ghz1_1_MCFM_JECUp); fChain->SetBranchAddress("p_HadZH_BSI_ghz1_i_MCFM_JECUp", &p_HadZH_BSI_ghz1_i_MCFM_JECUp, &b_p_HadZH_BSI_ghz1_i_MCFM_JECUp); fChain->SetBranchAddress("pConst_HadZH_BKG_MCFM_JECUp", &pConst_HadZH_BKG_MCFM_JECUp, &b_pConst_HadZH_BKG_MCFM_JECUp); fChain->SetBranchAddress("p_HadZH_BKG_MCFM_JECUp", &p_HadZH_BKG_MCFM_JECUp, &b_p_HadZH_BKG_MCFM_JECUp); fChain->SetBranchAddress("pConst_HadWH_S_SIG_ghw1_1_MCFM_JECUp", &pConst_HadWH_S_SIG_ghw1_1_MCFM_JECUp, &b_pConst_HadWH_S_SIG_ghw1_1_MCFM_JECUp); fChain->SetBranchAddress("p_HadWH_S_SIG_ghw1_1_MCFM_JECUp", &p_HadWH_S_SIG_ghw1_1_MCFM_JECUp, &b_p_HadWH_S_SIG_ghw1_1_MCFM_JECUp); fChain->SetBranchAddress("p_HadWH_S_BSI_ghw1_1_MCFM_JECUp", &p_HadWH_S_BSI_ghw1_1_MCFM_JECUp, &b_p_HadWH_S_BSI_ghw1_1_MCFM_JECUp); fChain->SetBranchAddress("p_HadWH_S_BSI_ghw1_i_MCFM_JECUp", &p_HadWH_S_BSI_ghw1_i_MCFM_JECUp, &b_p_HadWH_S_BSI_ghw1_i_MCFM_JECUp); fChain->SetBranchAddress("pConst_HadWH_BKG_MCFM_JECUp", &pConst_HadWH_BKG_MCFM_JECUp, &b_pConst_HadWH_BKG_MCFM_JECUp); fChain->SetBranchAddress("p_HadWH_BKG_MCFM_JECUp", &p_HadWH_BKG_MCFM_JECUp, &b_p_HadWH_BKG_MCFM_JECUp); fChain->SetBranchAddress("pConst_JJQCD_BKG_MCFM_JECUp", &pConst_JJQCD_BKG_MCFM_JECUp, &b_pConst_JJQCD_BKG_MCFM_JECUp); fChain->SetBranchAddress("p_JJQCD_BKG_MCFM_JECUp", &p_JJQCD_BKG_MCFM_JECUp, &b_p_JJQCD_BKG_MCFM_JECUp); fChain->SetBranchAddress("p_JJEW_SIG_ghv1_1_MCFM_JECDn", &p_JJEW_SIG_ghv1_1_MCFM_JECDn, &b_p_JJEW_SIG_ghv1_1_MCFM_JECDn); fChain->SetBranchAddress("p_JJEW_BSI_ghv1_1_MCFM_JECDn", &p_JJEW_BSI_ghv1_1_MCFM_JECDn, &b_p_JJEW_BSI_ghv1_1_MCFM_JECDn); fChain->SetBranchAddress("p_JJEW_BSI_ghv1_i_MCFM_JECDn", &p_JJEW_BSI_ghv1_i_MCFM_JECDn, &b_p_JJEW_BSI_ghv1_i_MCFM_JECDn); fChain->SetBranchAddress("p_JJEW_BKG_MCFM_JECDn", &p_JJEW_BKG_MCFM_JECDn, &b_p_JJEW_BKG_MCFM_JECDn); fChain->SetBranchAddress("pConst_JJVBF_S_SIG_ghv1_1_MCFM_JECDn", &pConst_JJVBF_S_SIG_ghv1_1_MCFM_JECDn, &b_pConst_JJVBF_S_SIG_ghv1_1_MCFM_JECDn); fChain->SetBranchAddress("p_JJVBF_S_SIG_ghv1_1_MCFM_JECDn", &p_JJVBF_S_SIG_ghv1_1_MCFM_JECDn, &b_p_JJVBF_S_SIG_ghv1_1_MCFM_JECDn); fChain->SetBranchAddress("p_JJVBF_S_BSI_ghv1_1_MCFM_JECDn", &p_JJVBF_S_BSI_ghv1_1_MCFM_JECDn, &b_p_JJVBF_S_BSI_ghv1_1_MCFM_JECDn); fChain->SetBranchAddress("p_JJVBF_S_BSI_ghv1_i_MCFM_JECDn", &p_JJVBF_S_BSI_ghv1_i_MCFM_JECDn, &b_p_JJVBF_S_BSI_ghv1_i_MCFM_JECDn); fChain->SetBranchAddress("p_JJVBF_SIG_ghv1_1_MCFM_JECDn", &p_JJVBF_SIG_ghv1_1_MCFM_JECDn, &b_p_JJVBF_SIG_ghv1_1_MCFM_JECDn); fChain->SetBranchAddress("p_JJVBF_BSI_ghv1_1_MCFM_JECDn", &p_JJVBF_BSI_ghv1_1_MCFM_JECDn, &b_p_JJVBF_BSI_ghv1_1_MCFM_JECDn); fChain->SetBranchAddress("p_JJVBF_BSI_ghv1_i_MCFM_JECDn", &p_JJVBF_BSI_ghv1_i_MCFM_JECDn, &b_p_JJVBF_BSI_ghv1_i_MCFM_JECDn); fChain->SetBranchAddress("pConst_JJVBF_BKG_MCFM_JECDn", &pConst_JJVBF_BKG_MCFM_JECDn, &b_pConst_JJVBF_BKG_MCFM_JECDn); fChain->SetBranchAddress("p_JJVBF_BKG_MCFM_JECDn", &p_JJVBF_BKG_MCFM_JECDn, &b_p_JJVBF_BKG_MCFM_JECDn); fChain->SetBranchAddress("pConst_HadZH_S_SIG_ghz1_1_MCFM_JECDn", &pConst_HadZH_S_SIG_ghz1_1_MCFM_JECDn, &b_pConst_HadZH_S_SIG_ghz1_1_MCFM_JECDn); fChain->SetBranchAddress("p_HadZH_S_SIG_ghz1_1_MCFM_JECDn", &p_HadZH_S_SIG_ghz1_1_MCFM_JECDn, &b_p_HadZH_S_SIG_ghz1_1_MCFM_JECDn); fChain->SetBranchAddress("p_HadZH_S_BSI_ghz1_1_MCFM_JECDn", &p_HadZH_S_BSI_ghz1_1_MCFM_JECDn, &b_p_HadZH_S_BSI_ghz1_1_MCFM_JECDn); fChain->SetBranchAddress("p_HadZH_S_BSI_ghz1_i_MCFM_JECDn", &p_HadZH_S_BSI_ghz1_i_MCFM_JECDn, &b_p_HadZH_S_BSI_ghz1_i_MCFM_JECDn); fChain->SetBranchAddress("p_HadZH_SIG_ghz1_1_MCFM_JECDn", &p_HadZH_SIG_ghz1_1_MCFM_JECDn, &b_p_HadZH_SIG_ghz1_1_MCFM_JECDn); fChain->SetBranchAddress("p_HadZH_BSI_ghz1_1_MCFM_JECDn", &p_HadZH_BSI_ghz1_1_MCFM_JECDn, &b_p_HadZH_BSI_ghz1_1_MCFM_JECDn); fChain->SetBranchAddress("p_HadZH_BSI_ghz1_i_MCFM_JECDn", &p_HadZH_BSI_ghz1_i_MCFM_JECDn, &b_p_HadZH_BSI_ghz1_i_MCFM_JECDn); fChain->SetBranchAddress("pConst_HadZH_BKG_MCFM_JECDn", &pConst_HadZH_BKG_MCFM_JECDn, &b_pConst_HadZH_BKG_MCFM_JECDn); fChain->SetBranchAddress("p_HadZH_BKG_MCFM_JECDn", &p_HadZH_BKG_MCFM_JECDn, &b_p_HadZH_BKG_MCFM_JECDn); fChain->SetBranchAddress("pConst_HadWH_S_SIG_ghw1_1_MCFM_JECDn", &pConst_HadWH_S_SIG_ghw1_1_MCFM_JECDn, &b_pConst_HadWH_S_SIG_ghw1_1_MCFM_JECDn); fChain->SetBranchAddress("p_HadWH_S_SIG_ghw1_1_MCFM_JECDn", &p_HadWH_S_SIG_ghw1_1_MCFM_JECDn, &b_p_HadWH_S_SIG_ghw1_1_MCFM_JECDn); fChain->SetBranchAddress("p_HadWH_S_BSI_ghw1_1_MCFM_JECDn", &p_HadWH_S_BSI_ghw1_1_MCFM_JECDn, &b_p_HadWH_S_BSI_ghw1_1_MCFM_JECDn); fChain->SetBranchAddress("p_HadWH_S_BSI_ghw1_i_MCFM_JECDn", &p_HadWH_S_BSI_ghw1_i_MCFM_JECDn, &b_p_HadWH_S_BSI_ghw1_i_MCFM_JECDn); fChain->SetBranchAddress("pConst_HadWH_BKG_MCFM_JECDn", &pConst_HadWH_BKG_MCFM_JECDn, &b_pConst_HadWH_BKG_MCFM_JECDn); fChain->SetBranchAddress("p_HadWH_BKG_MCFM_JECDn", &p_HadWH_BKG_MCFM_JECDn, &b_p_HadWH_BKG_MCFM_JECDn); fChain->SetBranchAddress("pConst_JJQCD_BKG_MCFM_JECDn", &pConst_JJQCD_BKG_MCFM_JECDn, &b_pConst_JJQCD_BKG_MCFM_JECDn); fChain->SetBranchAddress("p_JJQCD_BKG_MCFM_JECDn", &p_JJQCD_BKG_MCFM_JECDn, &b_p_JJQCD_BKG_MCFM_JECDn); fChain->SetBranchAddress("p_m4l_SIG", &p_m4l_SIG, &b_p_m4l_SIG); fChain->SetBranchAddress("p_m4l_BKG", &p_m4l_BKG, &b_p_m4l_BKG); fChain->SetBranchAddress("p_m4l_SIG_ScaleDown", &p_m4l_SIG_ScaleDown, &b_p_m4l_SIG_ScaleDown); fChain->SetBranchAddress("p_m4l_BKG_ScaleDown", &p_m4l_BKG_ScaleDown, &b_p_m4l_BKG_ScaleDown); fChain->SetBranchAddress("p_m4l_SIG_ResDown", &p_m4l_SIG_ResDown, &b_p_m4l_SIG_ResDown); fChain->SetBranchAddress("p_m4l_BKG_ResDown", &p_m4l_BKG_ResDown, &b_p_m4l_BKG_ResDown); fChain->SetBranchAddress("p_m4l_SIG_ScaleUp", &p_m4l_SIG_ScaleUp, &b_p_m4l_SIG_ScaleUp); fChain->SetBranchAddress("p_m4l_BKG_ScaleUp", &p_m4l_BKG_ScaleUp, &b_p_m4l_BKG_ScaleUp); fChain->SetBranchAddress("p_m4l_SIG_ResUp", &p_m4l_SIG_ResUp, &b_p_m4l_SIG_ResUp); fChain->SetBranchAddress("p_m4l_BKG_ResUp", &p_m4l_BKG_ResUp, &b_p_m4l_BKG_ResUp); fChain->SetBranchAddress("p_HadZH_mavjj_true_JECNominal", &p_HadZH_mavjj_true_JECNominal, &b_p_HadZH_mavjj_true_JECNominal); fChain->SetBranchAddress("p_HadWH_mavjj_true_JECNominal", &p_HadWH_mavjj_true_JECNominal, &b_p_HadWH_mavjj_true_JECNominal); fChain->SetBranchAddress("p_HadZH_mavjj_JECNominal", &p_HadZH_mavjj_JECNominal, &b_p_HadZH_mavjj_JECNominal); fChain->SetBranchAddress("p_HadWH_mavjj_JECNominal", &p_HadWH_mavjj_JECNominal, &b_p_HadWH_mavjj_JECNominal); fChain->SetBranchAddress("p_HadZH_mavjj_true_JECUp", &p_HadZH_mavjj_true_JECUp, &b_p_HadZH_mavjj_true_JECUp); fChain->SetBranchAddress("p_HadWH_mavjj_true_JECUp", &p_HadWH_mavjj_true_JECUp, &b_p_HadWH_mavjj_true_JECUp); fChain->SetBranchAddress("p_HadZH_mavjj_JECUp", &p_HadZH_mavjj_JECUp, &b_p_HadZH_mavjj_JECUp); fChain->SetBranchAddress("p_HadWH_mavjj_JECUp", &p_HadWH_mavjj_JECUp, &b_p_HadWH_mavjj_JECUp); fChain->SetBranchAddress("p_HadZH_mavjj_true_JECDn", &p_HadZH_mavjj_true_JECDn, &b_p_HadZH_mavjj_true_JECDn); fChain->SetBranchAddress("p_HadWH_mavjj_true_JECDn", &p_HadWH_mavjj_true_JECDn, &b_p_HadWH_mavjj_true_JECDn); fChain->SetBranchAddress("p_HadZH_mavjj_JECDn", &p_HadZH_mavjj_JECDn, &b_p_HadZH_mavjj_JECDn); fChain->SetBranchAddress("p_HadWH_mavjj_JECDn", &p_HadWH_mavjj_JECDn, &b_p_HadWH_mavjj_JECDn); fChain->SetBranchAddress("pConst_JJVBF_SIG_ghv1_1_JHUGen_JECNominal_BestDJJ", &pConst_JJVBF_SIG_ghv1_1_JHUGen_JECNominal_BestDJJ, &b_pConst_JJVBF_SIG_ghv1_1_JHUGen_JECNominal_BestDJJ); fChain->SetBranchAddress("p_JJVBF_SIG_ghv1_1_JHUGen_JECNominal_BestDJJ", &p_JJVBF_SIG_ghv1_1_JHUGen_JECNominal_BestDJJ, &b_p_JJVBF_SIG_ghv1_1_JHUGen_JECNominal_BestDJJ); fChain->SetBranchAddress("pConst_JJQCD_SIG_ghg2_1_JHUGen_JECNominal_BestDJJ", &pConst_JJQCD_SIG_ghg2_1_JHUGen_JECNominal_BestDJJ, &b_pConst_JJQCD_SIG_ghg2_1_JHUGen_JECNominal_BestDJJ); fChain->SetBranchAddress("p_JJQCD_SIG_ghg2_1_JHUGen_JECNominal_BestDJJ", &p_JJQCD_SIG_ghg2_1_JHUGen_JECNominal_BestDJJ, &b_p_JJQCD_SIG_ghg2_1_JHUGen_JECNominal_BestDJJ); fChain->SetBranchAddress("pConst_JJVBF_SIG_ghv1_1_JHUGen_JECUp_BestDJJ", &pConst_JJVBF_SIG_ghv1_1_JHUGen_JECUp_BestDJJ, &b_pConst_JJVBF_SIG_ghv1_1_JHUGen_JECUp_BestDJJ); fChain->SetBranchAddress("p_JJVBF_SIG_ghv1_1_JHUGen_JECUp_BestDJJ", &p_JJVBF_SIG_ghv1_1_JHUGen_JECUp_BestDJJ, &b_p_JJVBF_SIG_ghv1_1_JHUGen_JECUp_BestDJJ); fChain->SetBranchAddress("pConst_JJQCD_SIG_ghg2_1_JHUGen_JECUp_BestDJJ", &pConst_JJQCD_SIG_ghg2_1_JHUGen_JECUp_BestDJJ, &b_pConst_JJQCD_SIG_ghg2_1_JHUGen_JECUp_BestDJJ); fChain->SetBranchAddress("p_JJQCD_SIG_ghg2_1_JHUGen_JECUp_BestDJJ", &p_JJQCD_SIG_ghg2_1_JHUGen_JECUp_BestDJJ, &b_p_JJQCD_SIG_ghg2_1_JHUGen_JECUp_BestDJJ); fChain->SetBranchAddress("pConst_JJVBF_SIG_ghv1_1_JHUGen_JECDn_BestDJJ", &pConst_JJVBF_SIG_ghv1_1_JHUGen_JECDn_BestDJJ, &b_pConst_JJVBF_SIG_ghv1_1_JHUGen_JECDn_BestDJJ); fChain->SetBranchAddress("p_JJVBF_SIG_ghv1_1_JHUGen_JECDn_BestDJJ", &p_JJVBF_SIG_ghv1_1_JHUGen_JECDn_BestDJJ, &b_p_JJVBF_SIG_ghv1_1_JHUGen_JECDn_BestDJJ); fChain->SetBranchAddress("pConst_JJQCD_SIG_ghg2_1_JHUGen_JECDn_BestDJJ", &pConst_JJQCD_SIG_ghg2_1_JHUGen_JECDn_BestDJJ, &b_pConst_JJQCD_SIG_ghg2_1_JHUGen_JECDn_BestDJJ); fChain->SetBranchAddress("p_JJQCD_SIG_ghg2_1_JHUGen_JECDn_BestDJJ", &p_JJQCD_SIG_ghg2_1_JHUGen_JECDn_BestDJJ, &b_p_JJQCD_SIG_ghg2_1_JHUGen_JECDn_BestDJJ); fChain->SetBranchAddress("p_Gen_CPStoBWPropRewgt", &p_Gen_CPStoBWPropRewgt, &b_p_Gen_CPStoBWPropRewgt); fChain->SetBranchAddress("p_Gen_GG_SIG_kappaTopBot_1_ghz1_1_MCFM", &p_Gen_GG_SIG_kappaTopBot_1_ghz1_1_MCFM, &b_p_Gen_GG_SIG_kappaTopBot_1_ghz1_1_MCFM); fChain->SetBranchAddress("p_Gen_GG_SIG_kappaTopBot_1_ghz1prime2_1E4_MCFM", &p_Gen_GG_SIG_kappaTopBot_1_ghz1prime2_1E4_MCFM, &b_p_Gen_GG_SIG_kappaTopBot_1_ghz1prime2_1E4_MCFM); fChain->SetBranchAddress("p_Gen_GG_SIG_kappaTopBot_1_ghz2_1_MCFM", &p_Gen_GG_SIG_kappaTopBot_1_ghz2_1_MCFM, &b_p_Gen_GG_SIG_kappaTopBot_1_ghz2_1_MCFM); fChain->SetBranchAddress("p_Gen_GG_SIG_kappaTopBot_1_ghz4_1_MCFM", &p_Gen_GG_SIG_kappaTopBot_1_ghz4_1_MCFM, &b_p_Gen_GG_SIG_kappaTopBot_1_ghz4_1_MCFM); fChain->SetBranchAddress("p_Gen_GG_SIG_kappaTopBot_1_ghza1prime2_1E4_MCFM", &p_Gen_GG_SIG_kappaTopBot_1_ghza1prime2_1E4_MCFM, &b_p_Gen_GG_SIG_kappaTopBot_1_ghza1prime2_1E4_MCFM); fChain->SetBranchAddress("p_Gen_GG_SIG_kappaTopBot_1_ghza2_1_MCFM", &p_Gen_GG_SIG_kappaTopBot_1_ghza2_1_MCFM, &b_p_Gen_GG_SIG_kappaTopBot_1_ghza2_1_MCFM); fChain->SetBranchAddress("p_Gen_GG_SIG_kappaTopBot_1_ghza4_1_MCFM", &p_Gen_GG_SIG_kappaTopBot_1_ghza4_1_MCFM, &b_p_Gen_GG_SIG_kappaTopBot_1_ghza4_1_MCFM); fChain->SetBranchAddress("p_Gen_GG_SIG_kappaTopBot_1_gha2_1_MCFM", &p_Gen_GG_SIG_kappaTopBot_1_gha2_1_MCFM, &b_p_Gen_GG_SIG_kappaTopBot_1_gha2_1_MCFM); fChain->SetBranchAddress("p_Gen_GG_SIG_kappaTopBot_1_gha4_1_MCFM", &p_Gen_GG_SIG_kappaTopBot_1_gha4_1_MCFM, &b_p_Gen_GG_SIG_kappaTopBot_1_gha4_1_MCFM); fChain->SetBranchAddress("p_Gen_GG_SIG_kappaTopBot_1_ghz1_1_ghz1prime2_1E4_MCFM", &p_Gen_GG_SIG_kappaTopBot_1_ghz1_1_ghz1prime2_1E4_MCFM, &b_p_Gen_GG_SIG_kappaTopBot_1_ghz1_1_ghz1prime2_1E4_MCFM); fChain->SetBranchAddress("p_Gen_GG_SIG_kappaTopBot_1_ghz1_1_ghz2_1_MCFM", &p_Gen_GG_SIG_kappaTopBot_1_ghz1_1_ghz2_1_MCFM, &b_p_Gen_GG_SIG_kappaTopBot_1_ghz1_1_ghz2_1_MCFM); fChain->SetBranchAddress("p_Gen_GG_SIG_kappaTopBot_1_ghz1_1_ghz4_1_MCFM", &p_Gen_GG_SIG_kappaTopBot_1_ghz1_1_ghz4_1_MCFM, &b_p_Gen_GG_SIG_kappaTopBot_1_ghz1_1_ghz4_1_MCFM); fChain->SetBranchAddress("p_Gen_GG_SIG_kappaTopBot_1_ghz1_1_ghza1prime2_1E4_MCFM", &p_Gen_GG_SIG_kappaTopBot_1_ghz1_1_ghza1prime2_1E4_MCFM, &b_p_Gen_GG_SIG_kappaTopBot_1_ghz1_1_ghza1prime2_1E4_MCFM); fChain->SetBranchAddress("p_Gen_GG_SIG_kappaTopBot_1_ghz1_1_ghza2_1_MCFM", &p_Gen_GG_SIG_kappaTopBot_1_ghz1_1_ghza2_1_MCFM, &b_p_Gen_GG_SIG_kappaTopBot_1_ghz1_1_ghza2_1_MCFM); fChain->SetBranchAddress("p_Gen_GG_SIG_kappaTopBot_1_ghz1_1_ghza4_1_MCFM", &p_Gen_GG_SIG_kappaTopBot_1_ghz1_1_ghza4_1_MCFM, &b_p_Gen_GG_SIG_kappaTopBot_1_ghz1_1_ghza4_1_MCFM); fChain->SetBranchAddress("p_Gen_GG_SIG_kappaTopBot_1_ghz1_1_gha2_1_MCFM", &p_Gen_GG_SIG_kappaTopBot_1_ghz1_1_gha2_1_MCFM, &b_p_Gen_GG_SIG_kappaTopBot_1_ghz1_1_gha2_1_MCFM); fChain->SetBranchAddress("p_Gen_GG_SIG_kappaTopBot_1_ghz1_1_gha4_1_MCFM", &p_Gen_GG_SIG_kappaTopBot_1_ghz1_1_gha4_1_MCFM, &b_p_Gen_GG_SIG_kappaTopBot_1_ghz1_1_gha4_1_MCFM); fChain->SetBranchAddress("p_Gen_GG_BSI_kappaTopBot_1_ghz1_1_MCFM", &p_Gen_GG_BSI_kappaTopBot_1_ghz1_1_MCFM, &b_p_Gen_GG_BSI_kappaTopBot_1_ghz1_1_MCFM); fChain->SetBranchAddress("p_Gen_GG_BSI_kappaTopBot_1_ghz1prime2_1E4_MCFM", &p_Gen_GG_BSI_kappaTopBot_1_ghz1prime2_1E4_MCFM, &b_p_Gen_GG_BSI_kappaTopBot_1_ghz1prime2_1E4_MCFM); fChain->SetBranchAddress("p_Gen_GG_BSI_kappaTopBot_1_ghz2_1_MCFM", &p_Gen_GG_BSI_kappaTopBot_1_ghz2_1_MCFM, &b_p_Gen_GG_BSI_kappaTopBot_1_ghz2_1_MCFM); fChain->SetBranchAddress("p_Gen_GG_BSI_kappaTopBot_1_ghz4_1_MCFM", &p_Gen_GG_BSI_kappaTopBot_1_ghz4_1_MCFM, &b_p_Gen_GG_BSI_kappaTopBot_1_ghz4_1_MCFM); fChain->SetBranchAddress("p_Gen_GG_BSI_kappaTopBot_1_ghza1prime2_1E4_MCFM", &p_Gen_GG_BSI_kappaTopBot_1_ghza1prime2_1E4_MCFM, &b_p_Gen_GG_BSI_kappaTopBot_1_ghza1prime2_1E4_MCFM); fChain->SetBranchAddress("p_Gen_GG_BSI_kappaTopBot_1_ghza2_1_MCFM", &p_Gen_GG_BSI_kappaTopBot_1_ghza2_1_MCFM, &b_p_Gen_GG_BSI_kappaTopBot_1_ghza2_1_MCFM); fChain->SetBranchAddress("p_Gen_GG_BSI_kappaTopBot_1_ghza4_1_MCFM", &p_Gen_GG_BSI_kappaTopBot_1_ghza4_1_MCFM, &b_p_Gen_GG_BSI_kappaTopBot_1_ghza4_1_MCFM); fChain->SetBranchAddress("p_Gen_GG_BSI_kappaTopBot_1_gha2_1_MCFM", &p_Gen_GG_BSI_kappaTopBot_1_gha2_1_MCFM, &b_p_Gen_GG_BSI_kappaTopBot_1_gha2_1_MCFM); fChain->SetBranchAddress("p_Gen_GG_BSI_kappaTopBot_1_gha4_1_MCFM", &p_Gen_GG_BSI_kappaTopBot_1_gha4_1_MCFM, &b_p_Gen_GG_BSI_kappaTopBot_1_gha4_1_MCFM); fChain->SetBranchAddress("p_Gen_GG_BKG_MCFM", &p_Gen_GG_BKG_MCFM, &b_p_Gen_GG_BKG_MCFM); fChain->SetBranchAddress("p_Gen_QQB_BKG_MCFM", &p_Gen_QQB_BKG_MCFM, &b_p_Gen_QQB_BKG_MCFM); fChain->SetBranchAddress("p_Gen_GG_SIG_gXg1_1_gXz1_1_JHUGen", &p_Gen_GG_SIG_gXg1_1_gXz1_1_JHUGen, &b_p_Gen_GG_SIG_gXg1_1_gXz1_1_JHUGen); fChain->SetBranchAddress("p_Gen_GG_SIG_gXg2_1_gXz2_1_JHUGen", &p_Gen_GG_SIG_gXg2_1_gXz2_1_JHUGen, &b_p_Gen_GG_SIG_gXg2_1_gXz2_1_JHUGen); fChain->SetBranchAddress("p_Gen_GG_SIG_gXg3_1_gXz3_1_JHUGen", &p_Gen_GG_SIG_gXg3_1_gXz3_1_JHUGen, &b_p_Gen_GG_SIG_gXg3_1_gXz3_1_JHUGen); fChain->SetBranchAddress("p_Gen_GG_SIG_gXg4_1_gXz4_1_JHUGen", &p_Gen_GG_SIG_gXg4_1_gXz4_1_JHUGen, &b_p_Gen_GG_SIG_gXg4_1_gXz4_1_JHUGen); fChain->SetBranchAddress("p_Gen_GG_SIG_gXg1_1_gXz5_1_JHUGen", &p_Gen_GG_SIG_gXg1_1_gXz5_1_JHUGen, &b_p_Gen_GG_SIG_gXg1_1_gXz5_1_JHUGen); fChain->SetBranchAddress("p_Gen_GG_SIG_gXg1_1_gXz1_1_gXz5_1_JHUGen", &p_Gen_GG_SIG_gXg1_1_gXz1_1_gXz5_1_JHUGen, &b_p_Gen_GG_SIG_gXg1_1_gXz1_1_gXz5_1_JHUGen); fChain->SetBranchAddress("p_Gen_GG_SIG_gXg1_1_gXz6_1_JHUGen", &p_Gen_GG_SIG_gXg1_1_gXz6_1_JHUGen, &b_p_Gen_GG_SIG_gXg1_1_gXz6_1_JHUGen); fChain->SetBranchAddress("p_Gen_GG_SIG_gXg1_1_gXz7_1_JHUGen", &p_Gen_GG_SIG_gXg1_1_gXz7_1_JHUGen, &b_p_Gen_GG_SIG_gXg1_1_gXz7_1_JHUGen); fChain->SetBranchAddress("p_Gen_GG_SIG_gXg5_1_gXz8_1_JHUGen", &p_Gen_GG_SIG_gXg5_1_gXz8_1_JHUGen, &b_p_Gen_GG_SIG_gXg5_1_gXz8_1_JHUGen); fChain->SetBranchAddress("p_Gen_GG_SIG_gXg5_1_gXz9_1_JHUGen", &p_Gen_GG_SIG_gXg5_1_gXz9_1_JHUGen, &b_p_Gen_GG_SIG_gXg5_1_gXz9_1_JHUGen); fChain->SetBranchAddress("p_Gen_GG_SIG_gXg5_1_gXz10_1_JHUGen", &p_Gen_GG_SIG_gXg5_1_gXz10_1_JHUGen, &b_p_Gen_GG_SIG_gXg5_1_gXz10_1_JHUGen); Notify(); } Bool_t Analyzer::Notify() { // The Notify() function is called when a new file is opened. This // can be either for a new TTree in a TChain or when when a new TTree // is started when using PROOF. It is normally not necessary to make changes // to the generated code, but the routine can be extended by the // user if needed. The return value is currently not used. return kTRUE; } void Analyzer::Show(Long64_t entry) { // Print contents of entry. // If entry is not specified, print current entry if (!fChain) return; fChain->Show(entry); } Int_t Analyzer::Cut(Long64_t entry) { // This function may be called from Loop. // returns 1 if entry is accepted. // returns -1 otherwise. return 1; } #endif // #ifdef Analyzer_cxx
8947703d9870a5ac40ddb22daca73fbc6debab29
f6663a3687c7d398dd137bd7450b65d247b8343d
/src/Buffer.h
04158fe3bdb420611db22a6cd8158977b261b8c1
[ "MIT" ]
permissive
troter/xyzzy
94e3d2652c72c2fe3f1d7906361af11cb1320b44
b8697b0f838cb0fce4261da57c58cc943769127a
refs/heads/master
2021-01-15T18:08:52.740188
2012-02-21T02:02:58
2012-02-21T02:02:58
3,503,039
3
1
null
null
null
null
SHIFT_JIS
C++
false
false
28,101
h
#ifndef _Buffer_h_ # define _Buffer_h_ # include "alloc.h" # include "kanji.h" enum wcolor_index { WCOLOR_TEXT, WCOLOR_BACK, WCOLOR_CTRL, WCOLOR_HIGHLIGHT_TEXT, WCOLOR_HIGHLIGHT, WCOLOR_KWD1, WCOLOR_KWD2, WCOLOR_KWD3, WCOLOR_STRING, WCOLOR_COMMENT, WCOLOR_TAG, WCOLOR_CURSOR, WCOLOR_CARET, WCOLOR_IMECARET, WCOLOR_LINENUM, WCOLOR_REVERSE, WCOLOR_MODELINE_FG, WCOLOR_MODELINE_BG, WCOLOR_GRAY, WCOLOR_BTNSHADOW, WCOLOR_BTNTEXT, WCOLOR_MAX, USER_DEFINABLE_COLORS = WCOLOR_GRAY }; struct wcolor_index_name { const char *name; COLORREF rgb; const char *display_name; }; extern const wcolor_index_name wcolor_index_names[]; # define MIN_FOLD_WIDTH 4 # define MAX_FOLD_WIDTH 30000 struct Buffer; class syntax_info; #define CHUNK_TEXT_SIZE 4096 // #define CHUNK_FOLD_BREAK_SIZE ((CHUNK_TEXT_SIZE + 7) / 8) struct ChunkFoldInfo { static const u_char c_breaks_mask[]; enum {BREAKS_SIZE = (CHUNK_TEXT_SIZE + 7) / 8}; ChunkFoldInfo() { c_nbreaks = -1; bzero (c_breaks, BREAKS_SIZE); c_first_eol = -1; c_last_eol = -1; } short c_nbreaks; short c_first_eol; short c_last_eol; u_char c_breaks[BREAKS_SIZE]; void clear_breaks (short used) { bzero (c_breaks, (used + 7) / 8); c_nbreaks = 0; } void break_on (int n) { c_breaks[n >> 3] |= c_breaks_mask[n & 7]; c_nbreaks++; } void break_off (int n) { assert (break_p (n)); assert (c_nbreaks > 0); c_breaks[n >> 3] &= ~c_breaks_mask[n & 7]; c_nbreaks--; } u_char break_p (int n) const {return c_breaks[n >> 3] & c_breaks_mask[n & 7];} }; struct Chunk { enum {TEXT_SIZE = CHUNK_TEXT_SIZE}; enum {BREAKS_SIZE = (TEXT_SIZE + 7) / 8}; enum {SPECIAL = 0x7FFF }; static fixed_heap c_heap; static fixed_heap c_breaks_heap; static const u_char c_breaks_mask[]; Chunk *c_prev; Chunk *c_next; Char *c_text; // std::map<int fold_columns, ChunkFoldInfo> *, but I don't want to include here. // Key should have been const Window*, but all the upper layer pass just fold_columns. // Logically, fold_columns is only the factor that this infomation should be sorted, so no problem. void *c_fold_map; short c_default_nbreaks; short c_used; short c_nlines; Char c_bstrch; Char c_estrch; u_char c_bstate; u_char c_estate; void update_syntax (const syntax_info &); void parse_syntax (); int count_lines () const; int rest () const; void clear (); void ensure_fold_info(int fold_columns); ChunkFoldInfo& find_fold_info(int fold_columns) const; bool fold_info_exist(int fold_columns) const; void invalidate_fold_info(); /* short c_nbreaks; // tmp short c_first_eol; // tmp short c_last_eol; // tmp */ void set_nbreaks(int fold_columns, short nbreaks) { ensure_fold_info(fold_columns); find_fold_info(fold_columns).c_nbreaks = nbreaks; } short get_nbreaks(int fold_columns) const { if(!fold_info_exist(fold_columns)) return c_default_nbreaks; return find_fold_info(fold_columns).c_nbreaks; } void set_first_eol(int fold_columns, short feol) { ensure_fold_info(fold_columns); find_fold_info(fold_columns).c_first_eol = feol; } short get_first_eol(int fold_columns) const { if(!fold_info_exist(fold_columns)) return -1; return find_fold_info(fold_columns).c_first_eol; } void set_last_eol(int fold_columns, short leol) { ensure_fold_info(fold_columns); find_fold_info(fold_columns).c_last_eol = leol; } short get_last_eol(int fold_columns) { if(!fold_info_exist(fold_columns)) return -1; return find_fold_info(fold_columns).c_last_eol; } void clear_breaks (int fold_columns) { ensure_fold_info(fold_columns); find_fold_info(fold_columns).clear_breaks(c_used); } void break_on(int fold_columns, int n) { ensure_fold_info(fold_columns); find_fold_info(fold_columns).break_on(n); } void break_off (int fold_columns, int n) { ensure_fold_info(fold_columns); find_fold_info(fold_columns).break_off(n); } u_char break_p (int fold_columns, int n) const { if(!fold_info_exist(fold_columns)) return 0; return find_fold_info(fold_columns).break_p(n); } }; inline int Chunk::rest () const { return TEXT_SIZE - c_used; } struct textprop { textprop *t_next; Region t_range; lisp t_tag; int t_attrib; int operator < (point_t point) const {return (t_range.p1 < point || (t_range.p1 == point && t_range.p1 == t_range.p2));} int operator > (point_t point) const {return (t_range.p2 > point || (t_range.p2 == point && t_range.p1 == t_range.p2));} }; template <class T> class allocator { struct arep {arep *a_next;}; static fixed_heap a_heap; arep *a_reps; arep *a_free; public: allocator () : a_reps (0), a_free (0) {} ~allocator () { free_all (); } T *alloc () { if (!a_free) { arep *r = (arep *)a_heap.alloc (); if (!r) return 0; r->a_next = a_reps; a_reps = r; a_free = r + 1; arep *p, *pe; for (p = a_free, pe = (arep *)((T *)p + ((a_heap.size () - sizeof *p) / sizeof (T) - 1)); p < pe; p = (arep *)((T *)p + 1)) p->a_next = (arep *)((T *)p + 1); p->a_next = 0; } T *p = (T *)a_free; a_free = a_free->a_next; return p; } void free (T *p) { ((arep *)p)->a_next = a_free; a_free = (arep *)p; } void free_all () { for (arep *p = a_reps, *next; p; p = next) { next = p->a_next; a_heap.free (p); } a_reps = 0; a_free = 0; } }; typedef allocator <Chunk> ChunkHeap; typedef allocator <textprop> textprop_heap; # define NO_MARK_SET (-1) struct Point { point_t p_point; Chunk *p_chunk; int p_offset; Char ch () const; Char &ch (); Char prevch () const; }; inline Char Point::ch () const { assert (p_chunk); assert (p_offset >= 0 && (p_chunk->c_used == Chunk::SPECIAL || p_offset < p_chunk->c_used)); return p_chunk->c_text[p_offset]; } inline Char & Point::ch () { assert (p_chunk); assert (p_offset >= 0 && (p_chunk->c_used == Chunk::SPECIAL || p_offset < p_chunk->c_used)); return p_chunk->c_text[p_offset]; } inline Char Point::prevch () const { assert (p_chunk); if (p_offset) return p_chunk->c_text[p_offset - 1]; const Chunk *p = p_chunk->c_prev; assert (p); assert (p->c_used > 0); return p->c_text[p->c_used - 1]; } struct ReadFileContext; class xread_stream; class xwrite_stream; class xwrite_buffer; class save_excursion; class save_restriction; enum syntax_code; class FileTime: public _FILETIME { public: enum {VOID_TIME = -1}; FileTime (); FileTime (lisp, int); int voidp (); void clear (); void file_modtime (lisp, int); FileTime &operator = (const _FILETIME &); }; inline int operator == (const _FILETIME &a, const _FILETIME &b) { return a.dwLowDateTime == b.dwLowDateTime && a.dwHighDateTime == b.dwHighDateTime; } inline int operator != (const _FILETIME &a, const _FILETIME &b) { return a.dwLowDateTime != b.dwLowDateTime || a.dwHighDateTime != b.dwHighDateTime; } inline int operator < (const _FILETIME &a, const _FILETIME &b) { return CompareFileTime (&a, &b) < 0; } inline int operator > (const _FILETIME &a, const _FILETIME &b) { return CompareFileTime (&a, &b) > 0; } inline void FileTime::clear () { dwLowDateTime = VOID_TIME; dwHighDateTime = VOID_TIME; } inline FileTime::FileTime () { clear (); } inline FileTime::FileTime (lisp path, int dir_ok) { file_modtime (path, dir_ok); } inline int FileTime::voidp () { return dwLowDateTime == VOID_TIME && dwHighDateTime == VOID_TIME; } inline FileTime & FileTime::operator = (const _FILETIME &s) { dwLowDateTime = s.dwLowDateTime; dwHighDateTime = s.dwHighDateTime; return *this; } struct insertChars { const Char *string; int length; }; enum eol_code { eol_lf, eol_crlf, eol_cr, eol_guess, eol_noconv = eol_lf }; static inline int valid_eol_code_p (int code) { return code >= eol_lf && code <= eol_guess; } static inline int exact_valid_eol_code_p (int code) { return code >= eol_lf && code < eol_guess; } static inline eol_code exact_eol_code (int code) { return exact_valid_eol_code_p (code) ? eol_code (code) : eol_crlf; } class UndoInfo; struct fold_parameter { int mode; int extend_limit; int shorten_limit; }; struct write_region_param { lisp encoding; eol_code eol; int error; int error_open; }; struct glyph_width; struct Buffer { static Buffer *b_blist; static Buffer *b_dlist; static Buffer *b_last_selected_buffer; Buffer *b_prev; Buffer *b_next; Buffer *b_ldisp; ChunkHeap b_chunk_heap; Chunk *b_chunkb; Chunk *b_chunke; long b_nchars; long b_nlines; textprop_heap b_textprop_heap; textprop *b_textprop; textprop *b_textprop_cache; Region b_contents; point_t b_point; point_t b_mark; point_t b_disp; long b_version; static long b_total_create_count; long b_create_count; static Buffer *b_last_title_bar_buffer; static int b_title_bar_text_order; eol_code b_eol_code; enum selection_type { SELECTION_TYPE_MASK = 3, SELECTION_VOID = 0, SELECTION_LINEAR = 1, SELECTION_REGION = 2, SELECTION_RECTANGLE = 3, PRE_SELECTION = 0x100, CONTINUE_PRE_SELECTION = 0x200 }; selection_type b_selection_type; point_t b_selection_point; point_t b_selection_marker; long b_selection_column; selection_type b_reverse_temp; Region b_reverse_region; COLORREF b_buffer_bar_fg; COLORREF b_buffer_bar_bg; static int b_last_modified_version_number; int b_modified_version; u_char b_truncated; u_char b_modified; long b_modified_count; Region b_modified_region; point_t b_last_modified; u_char b_need_auto_save; u_char b_done_auto_save; u_char b_make_backup; u_char b_buffer_name_modified; FileTime b_modtime; HANDLE b_hlock; int b_narrow_depth; int b_last_narrow_depth; # define Buffer_gc_start lbp lisp lbp; lisp lvar; lisp lmap; lisp lminor_map; lisp lsyntax_table; lisp lbuffer_name; lisp ldirectory; lisp lfile_name; lisp lalternate_file_name; lisp lminibuffer_buffer; lisp ldialog_title; lisp lminibuffer_default; lisp lcomplete_type; lisp lcomplete_list; lisp lprocess; lisp lmenu; lisp lwaitobj_list; lisp lkinsoku_bol_chars; lisp lkinsoku_eol_chars; lisp lchar_encoding; # define Buffer_gc_end lchar_encoding lisp lmarkers; // XXX u_char b_minibufferp; const Char *b_prompt; int b_prompt_length; int b_prompt_columns; char b_prompt_arg[16]; UndoInfo *b_undo; UndoInfo *b_redo; int b_undo_count; save_excursion *b_excursion; save_restriction *b_restriction; XCOLORREF b_colors[USER_DEFINABLE_COLORS]; int b_colors_enable; int b_hjump_columns; static int b_default_fold_mode; enum {FOLD_DEFAULT = -2, FOLD_NONE = -1, FOLD_WINDOW = 0}; int b_fold_mode; int b_fold_columns; // don't want to include STL inside header. // std::map<const Window*, int>* void *fold_map; bool fold_columns_exist(const Window* win) const; // 折り返しカラム(-1: しない) int get_fold_columns(const Window* win) const ; int get_first_fold_columns() const ; void set_fold_columns(Window* win, int column); // don't want to include STL inside header. // std::map<int fold_column, long nfolded>* void *nfolded_map; bool nfolded_exist(int fold_columns) const; long get_nfolded(int fold_columns) const; void set_nfolded(int fold_columns, long nfolded); void set_nfolded_all(long nfolded); long b_default_nfolded; enum {LNMODE_DEFAULT, LNMODE_DISP, LNMODE_LF}; static int b_default_linenum_mode; int b_linenum_mode; int linenum_mode () const {return (b_linenum_mode == LNMODE_DEFAULT ? b_default_linenum_mode : b_linenum_mode);} lisp kinsoku_eol_chars () const {return (lkinsoku_eol_chars != Qnil ? lkinsoku_eol_chars : xsymbol_value (Vdefault_kinsoku_eol_chars));} lisp kinsoku_bol_chars () const {return (lkinsoku_bol_chars != Qnil ? lkinsoku_bol_chars : xsymbol_value (Vdefault_kinsoku_bol_chars));} enum { KINSOKU_DEFAULT = -1, KINSOKU_NONE = 0, KINSOKU_EOL = 1, KINSOKU_SPC = 2, KINSOKU_WORDWRAP = 4, KINSOKU_CHARS = 8, KINSOKU_MODE_MASK = 15 }; static int b_default_kinsoku_mode; int b_kinsoku_mode; int kinsoku_mode () const {return (b_kinsoku_mode == KINSOKU_DEFAULT ? b_default_kinsoku_mode : b_kinsoku_mode);} enum {MAX_KINSOKU_LIMIT = 16}; static int b_default_kinsoku_extend_limit; static int b_default_kinsoku_shorten_limit; int b_kinsoku_extend_limit; int b_kinsoku_shorten_limit; int kinsoku_extend_limit () const {return (b_kinsoku_extend_limit < 0 ? b_default_kinsoku_extend_limit : b_kinsoku_extend_limit);} int kinsoku_shorten_limit () const {return (b_kinsoku_shorten_limit < 0 ? b_default_kinsoku_shorten_limit : b_kinsoku_shorten_limit);} int b_tab_columns; int b_local_tab_columns; int b_ime_mode; int b_wflags; int b_wflags_mask; Point b_stream_cache; int b_post_modified_hook_enabled; int b_in_post_modified_hook; Chunk *alloc_chunk (); void free_chunk (Chunk *); void free_all_chunks (Chunk *); void delete_chunk (Chunk *); void delete_contents (); void erase (); void delete_all_markers (); textprop *make_textprop () {return b_textprop_heap.alloc ();} void free_textprop (textprop *p) { if (p == b_textprop_cache) b_textprop_cache = 0; b_textprop_heap.free (p); } textprop *textprop_head (point_t point) const { return (b_textprop_cache && b_textprop_cache->t_range.p2 <= point ? b_textprop_cache : b_textprop); } textprop *find_textprop (point_t) const; textprop *add_textprop (point_t, point_t); void textprop_adjust_insertion (point_t, int); void textprop_adjust_deletion (point_t, int); void modify (); void modify_chunk (Chunk *) const; void set_modified_region (point_t, point_t); void prepare_modify_buffer (); void prepare_modify_region (Window *, point_t, point_t); point_t prepare_modify_region (Window *, lisp, lisp); void call_post_buffer_modified_hook (lisp, Point &, point_t, point_t); void post_buffer_modified (lisp ope, Point &point, point_t from, point_t to) { if (b_post_modified_hook_enabled) call_post_buffer_modified_hook (ope, point, from, to); } void insert_chars (Point &, const Char *, int); void insert_chars (Window *, const Char *, int, int); void insert_chars (Window *, const insertChars *, int, int); int insert_chars_internal (Point &, const Char *, int, int); int insert_chars_internal (Point &, const insertChars *, int, int); int pre_insert_chars (Point &, int); void post_insert_chars (Point &, int); void delete_region (Window *, point_t, point_t); int delete_region_internal (Point &, point_t, point_t); void insert_file_contents (Window *, lisp, lisp, lisp, lisp, ReadFileContext &); void set_point (Point &, point_t) const; void set_point_no_restrictions (Point &, point_t); int move_gap (Point &, int); int allocate_new_chunks (Point &, int); void move_after_gap (Point &, int) const; void move_before_gap (Point &, int) const; void adjust_insertion (const Point &, int); void adjust_deletion (const Point &, int); void overwrite_chars (Window *, const Char *, int); void file_modtime (FileTime &ft); void update_modtime (); int verify_modtime (); int read_only_p () const {return symbol_value (Vbuffer_read_only, this) != Qnil;} void check_read_only () const; int delete_surplus_undo (); UndoInfo *setup_save_undo (); UndoInfo *setup_insert_undo (point_t, int); void save_insert_undo (UndoInfo *, point_t, int); int save_delete_undo (const Point &, int); int save_modify_undo (const Point &, int); void save_modtime_undo (const FileTime &); void chain_undo (UndoInfo *); void clear_undo_info (); void undo_boundary (); int clear_undo_boundary (); void process_undo (UndoInfo *&); int undo_step (Window *, UndoInfo *&, int &); point_t last_modified_point () const; void substring (const Point &, int, Char *) const; void substring (point_t, int, Char *) const; lisp substring (point_t, point_t) const; Buffer (lisp, lisp, lisp, int = 0); ~Buffer (); static Buffer *create_buffer (lisp, lisp, lisp); void link_list (); void unlink_list () const; static Buffer *find_buffer (const Char *, int, long); static Buffer *find_buffer (lisp, long, int); static Buffer *make_internal_buffer (const char *); void set_local_variable (lisp, lisp); void make_local_variable (lisp); Chunk *read_chunk (ReadFileContext &, xread_stream &); int read_file_contents (ReadFileContext &, xread_stream &); int read_file_contents (ReadFileContext &, const char *, int, int); int write_region (const char *, point_t, point_t, int, write_region_param &); int write_region (xwrite_stream &, xwrite_buffer &, int &); void init_write_region_param (write_region_param &, lisp, lisp) const; int readin_chunk (ReadFileContext &, xread_stream &); int readin_chunk (ReadFileContext &, const char *); int make_auto_save_file_name (char *); void delete_auto_save_file (); int make_backup_file_name (char *, const char *); lisp save_buffer (lisp encoding, lisp eol); void goto_char (Point &, point_t) const; int line_forward (Point &, long) const; int line_backward (Point &, long) const; void goto_bol (Point &) const; void goto_eol (Point &) const; int forward_line (Point &, long) const; int forward_char (Point &, long) const; long count_lines (); int bolp (const Point &) const; int eolp (const Point &) const; int bobp (const Point &) const; int eobp (const Point &) const; int forward_word (Point &, long) const; void valid_marker_p (lisp marker) const; long point_column (const Point &) const; long forward_column (Point &, long, long, int, int) const; long goto_column (Point &, long, int) const; long point_linenum (const Point &) const; long point_linenum (point_t) const; long linenum_point (Point &, long); void go_bol (Point &) const; void go_eol (Point &) const; int next_char (Point &) const; void narrow_to_region (point_t, point_t); void widen (); int scan_forward (Point &, const Char *, int, const int *, point_t, int) const; int scan_backward (Point &, const Char *, int, const int *, point_t, int) const; int word_bound (const Point &) const; int symbol_bound (const Point &) const; int bm_execf (Point &, const Char *, int, const int *, point_t, int) const; int bm_execb (Point &, const Char *, int, const int *, point_t, int) const; int re_scan_buffer (Point &, lisp, point_t, point_t, lChar, int) const; point_t coerce_to_point (lisp) const; point_t coerce_to_restricted_point (lisp) const; static Buffer *coerce_to_buffer (lisp); char *buffer_name (char *, char *) const; char *quoted_buffer_name (char *, char *, int, int) const; void modify_mode_line () const; void modify_buffer_bar () { b_modified_version = ++Buffer::b_last_modified_version_number; } static void maybe_modify_buffer_bar () { ++Buffer::b_last_modified_version_number; } void buffer_bar_created () { b_modified_version = ++Buffer::b_last_modified_version_number; } static int count_modified_buffers (); static int query_kill_xyzzy (); static int kill_xyzzy (int); void refresh_mode_line (); void refresh_buffer () const; void dlist_remove (); void dlist_add_head (); void dlist_add_tail (); void dlist_force_add_tail (); static Buffer *dlist_find (); int internal_buffer_p () const; int escaped_char_p (const Point &, int = 0) const; int skip_string (Point &, Char, int) const; int skip_multi_chars_comment (Point &, int, int, int) const; int comment_char_p (Point &, int, int) const; int skip_single_char_comment (Point &, int, syntax_code) const; int skip_maybe_comment (Point &) const; int skip_cplusplus_comment_forward (Point &) const; int skip_cplusplus_comment_backward (Point &) const; int goto_matched_open (Point &, Char) const; int goto_matched_close (Point &, Char) const; int skip_symbol (Point &, int) const; int skip_white_forward (Point &, int) const; int skip_white_backward (Point &, int) const; int skip_sexp_forward (Point &) const; int skip_sexp_backward (Point &) const; int column_comment_p (const struct syntax_table *, const Point &) const; int up_down_list (Point &, int, int) const; void invalidate_syntax () const; int symbol_match_p (const Point &, const char *, int, int) const; int symbol_match_p (const Point &, const Char *, int, int) const; int forward_identifier (Point &, const Char *, int, const Char *, int, int) const; int backward_identifier (Point &, const Char *, int, const Char *, int, int) const; void skip_pure_white (Point &) const; int c_goto_if_directive (Point &) const; int c_skip_white_backward (Point &, int) const; int c_label_line_p (const Point &) const; int first_char_p (const Point &) const; int c_goto_match_if (Point &) const; int calc_c_indent (Point &, Point &, int) const; int c_beginning_of_stmt (Point &, int, Point * = 0) const; int c_class_decl_p (Point &, const Point &, int) const; int c_in_class_p (const Point &, int) const; int c_argdecl_p (Point &, Point &, const Point &, const Point &, int, int) const; int c_check_class_decl (Point &, Point &, const Point &, int, Char) const; int c_check_throws (Point &, Point &, const Point &, int) const; int c_check_extern_p (const Point &) const; lisp lock_file (); lisp lock_file (lisp, int); int unlock_file (); int file_locked_p () const; void refresh_title_bar (ApplicationFrame*) const; void set_frame_title (ApplicationFrame*, int); char *store_title (lisp, char *, char *) const; void change_colors (const XCOLORREF *); long char_columns (Char, long) const; long folded_point_linenum (point_t, int fold_columns) const; long folded_point_linenum (const Point &point, int fold_columns) const {return folded_point_linenum (point.p_point, fold_columns);} long folded_linenum_point (Point &, int fold_columns, long); long folded_count_lines (int fold_columns); long folded_point_column (const Point &, int fold_columns) const; long folded_point_linenum_column (point_t, int fold_columns, long *) const; long folded_point_linenum_column (const Point &point, int fold_columns, long *columnp) const {return folded_point_linenum_column (point.p_point, fold_columns, columnp);} void folded_go_bol (Point &, int fold_columns) const; void folded_go_eol (Point &, int fold_columns) const; long folded_forward_column (Point &, int fold_columns, long, long, int, int) const; void folded_goto_bol (Point &, int fold_columns) const; void folded_goto_eol (Point &, int fold_columns) const; int folded_forward_line (Point &, int fold_columns, long); long folded_goto_column (Point &, int fold_columns, long, int) const; void init_fold_width (int); bool init_fold_width_with_window (Window*, int); void window_size_changed (); void check_range (Point &) const; void change_ime_mode (ApplicationFrame* app); void upcase_region_internal (Point &, point_t); void downcase_region_internal (Point &, point_t); void capitalize_region_internal (Point &, point_t); void cleanup_waitobj_list (); void fold_width_modified (); int parse_fold_line (Point &, long, const fold_parameter &) const; void parse_fold_chunk (Chunk *, int fold_columns) const; int parse_fold_line (Point &, long, const glyph_width &, const fold_parameter &) const; struct update_fold_info { point_t point; Chunk *cp; long linenum; }; void update_fold_chunk (point_t, int fold_columns, update_fold_info &) const; void folded_go_bol_1 (Point &, int fold_columns) const; long folded_point_column_1 (point_t, int fold_columns, const update_fold_info &) const; long folded_point_column_1 (point_t, Point &) const; int check_hook (lisp, lisp &) const; lisp run_hook (lisp) const; lisp run_hook (lisp, lisp) const; lisp run_hook (lisp, lisp, lisp) const; lisp run_hook (lisp, lisp, lisp, lisp) const; lisp run_hook (lisp, lisp, lisp, lisp, lisp) const; lisp run_hook (lisp, lisp, lisp, lisp, lisp, lisp) const; lisp run_hook_while_success (lisp) const; lisp run_hook_while_success (lisp, lisp) const; lisp run_hook_until_success (lisp) const; lisp run_hook_until_success (lisp, lisp) const; lisp safe_run_hook (lisp, int) const; Buffer *next_buffer (int); Buffer *prev_buffer (int); #ifdef DEBUG void check_valid () const; #endif }; inline long Buffer::point_linenum (const Point &point) const { return point_linenum (point.p_point); } inline int Buffer::bobp (const Point &p) const { return p.p_point == b_contents.p1; } inline int Buffer::eobp (const Point &p) const { return p.p_point == b_contents.p2; } inline void Buffer::update_modtime () { file_modtime (b_modtime); } inline int Buffer::internal_buffer_p () const { return *xstring_contents (lbuffer_name) == ' '; } inline lisp Buffer::lock_file () { return lock_file (lfile_name, 0); } inline int Buffer::file_locked_p () const { return b_hlock != INVALID_HANDLE_VALUE; } static inline long char_columns (Char c, long column, long tab) { if (c == '\t') return tab - column % tab; return char_width (c); } inline long Buffer::char_columns (Char c, long column) const { return ::char_columns (c, column, b_tab_columns); } class no_restrictions { Buffer *bufp; Region oreg; public: no_restrictions (Buffer *bp) : bufp (bp), oreg (bp->b_contents) { bp->b_contents.p1 = 0; bp->b_contents.p2 = bp->b_nchars; } ~no_restrictions () { bufp->b_contents = oreg; } }; struct ReadFileContext { enum { RFCS_NOERR, RFCS_OPEN, RFCS_MEM, RFCS_IOERR }; int r_status; eol_code r_expect_eol; eol_code r_eol_code; lisp r_expect_char_encoding; lisp r_char_encoding; DWORD r_errcode; long r_nchars; long r_nlines; FileTime r_modtime; Chunk *r_chunk; Chunk *r_tail; int r_cr; }; void create_default_buffers (); void discard_insert_undo (UndoInfo *); #endif
[ "none@none" ]
none@none
6cbb827462bdffca0fcdd9db172f40be64ea5a78
e8b41408e40803dd5aa3f4430edd43b36b33d6b5
/nau/src/nau/physics/physicsManager.h
c4ab556458f627fa14f8e4e43c0bef191902ac75
[ "MIT" ]
permissive
Nau3D/nau
0cec4aa02600158ee092e0d6562822f4f1a3ac52
415ffa63032d4243ccdb3d8c18391d3a32c30b82
refs/heads/master
2023-04-13T00:32:21.385542
2023-03-28T22:43:51
2023-03-28T22:43:51
17,006,132
48
12
null
null
null
null
UTF-8
C++
false
false
2,487
h
/* Main class for physics in NAU. */ #ifndef PHYSICSMANAGER_H #define PHYSICSMANAGER_H #include "nau/attributeValues.h" #include "nau/enums.h" #include "nau/math/data.h" #include "nau/physics/iPhysics.h" #include "nau/physics/physicsMaterial.h" #include "nau/scene/iScene.h" #include "nau/material/iBuffer.h" #include <map> #include <string> #include <vector> #ifdef _WINDLL #ifdef nau_EXPORTS #define nau_API __declspec(dllexport) #else #define nau_API __declspec(dllimport) #endif #else #define nau_API #endif namespace nau { namespace physics { class PhysicsPropertyManager; class PhysicsManager: public AttributeValues, public nau::event_::IListener { friend class PhysicsMaterial; public: FLOAT_PROP(TIME_STEP, 0); FLOAT4_PROP(CAMERA_POSITION, 0); FLOAT4_PROP(CAMERA_DIRECTION, 1); FLOAT4_PROP(CAMERA_UP, 2); FLOAT_PROP(CAMERA_RADIUS, 1); FLOAT_PROP(CAMERA_HEIGHT, 2); static AttribSet Attribs; static nau_API AttribSet &GetAttribs(); static nau_API PhysicsManager* GetInstance(); nau_API bool isPhysicsAvailable(); void updateProps(); void update(); void build(); void clear(); void addScene(nau::scene::IScene *aScene, const std::string &matName); void cameraAction(Camera * camera, std::string action, float * value); nau_API PhysicsMaterial &getMaterial(const std::string &name); nau_API void getMaterialNames(std::vector<std::string> *); void setPropf(FloatProperty p, float value); void setPropf4(Float4Property p, vec4 &value); void eventReceived(const std::string &sender, const std::string &eventType, const std::shared_ptr<IEventData> &evt); std::string& getName(); ~PhysicsManager(); protected: PhysicsManager(); void applyMaterialFloatProperty(const std::string &matName, const std::string &property, float value); void applyMaterialVec4Property(const std::string &matName, const std::string &property, float *value); void applyGlobalFloatProperty(const std::string &property, float value); void applyGlobalVec4Property(const std::string &property, float *value); IPhysics *loadPlugin(); static PhysicsManager *PhysManInst; PhysicsPropertyManager *m_PropertyManager; IPhysics *m_PhysInst; static bool Init(); static bool Inited; bool m_Built; bool hasCamera; std::map<std::string, PhysicsMaterial> m_MatLib; std::map<nau::scene::IScene *, std::string> m_Scenes; }; }; }; #endif
a554f0f29d8500a8802f63816a6013614b3cf4c4
522547e1ae4452ba9235e97b1dc00d6d55b196ec
/Greedy puppy.cpp
fbfaff9c8f6e90e8b6921df647cb2331c165760a
[]
no_license
nachomonllor/Codechef
2045edf65be8de83583f7eb9c6b1435ef5563587
a49f7ac45b242694d13fa215f40b9e397b79599e
refs/heads/master
2023-01-12T08:10:26.271742
2023-01-01T02:11:53
2023-01-01T02:11:53
216,129,034
0
0
null
null
null
null
UTF-8
C++
false
false
782
cpp
https://www.codechef.com/problems/GDOG using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { int t = int.Parse(Console.ReadLine()); while (t-- > 0) { long[] arr = Array.ConvertAll(Console.ReadLine().Trim().Split(' '), e => long.Parse(e)); long n = arr[0]; long k = arr[1]; long max = 0; for(int i =1; i<=k; i++) { max = Math.Max(max, n % i); } Console.WriteLine(max); } Console.ReadLine(); } } }
0f3b2abfb8e2b736109aef707834726c17bc2e4f
9a6b4675a9eb7c0fb42f1f350cd7061f8be27ff1
/Section6/Trial_6_5_4/trial.cpp
c5ac8fdce3b7e7fe2bdfdfa66e06a0a1dccfd4a1
[]
no_license
kantoku009/dokushu_cpp
cead489033f1391d87013ca854406152e23cad8c
4e698fb083261f4c03800211e707ce01fa031938
refs/heads/master
2021-01-10T09:37:38.539656
2016-02-23T14:46:39
2016-02-23T14:46:39
49,725,601
0
0
null
null
null
null
UTF-8
C++
false
false
4,126
cpp
/** * @file trial.cpp * @brief 独習C++ 練習問題 6.5 4 * @note friendを使用した演算子のオーバーロード. */ #include <iostream> using namespace std; class coord { public: /** * @brief コンストラクタ. */ coord(int n=0, int m=0){ x=n; y=m; } /** * @brief 座標値xを取得. */ int get_x() const { return x; } /** * @brief 座標値yを取得. */ int get_y() const { return y; } /** * @brief =演算子のオーバーロード. */ coord operator=(const coord& ob) { this->x = ob.x; this->y = ob.y; return *this; } /** * @brief +演算子のオーバーロード */ friend coord operator+(const coord& ob1, const coord& ob2); friend coord operator+(const int num, const coord& ob); friend coord operator+(const coord& ob, const int num); /** * @brief -演算子のオーバーロード. */ friend coord operator-(const coord& ob1, const coord& ob2); friend coord operator-(const int num, const coord& ob); friend coord operator-(const coord& ob, const int num); /** * @brief *演算子のオーバーロード. */ friend coord operator*(const coord& ob1, const coord& ob2); friend coord operator*(const int num, const coord& ob); friend coord operator*(const coord& ob, const int num); /** * @brief /演算子のオーバーロード. * @note 0除算を考慮していない. */ friend coord operator/(const coord& ob1, const coord& ob2); friend coord operator/(const int num, const coord& ob); friend coord operator/(const coord& ob, const int num); /** * @brief ++演算子のオーバーロード. */ friend coord operator++(coord& ob); friend coord operator++(coord& ob, int notuse); /** * @brief --演算子のオーバーロード. */ friend coord operator--(coord& ob); friend coord operator--(coord& ob, int notuse); private: /** * @brief 座標値 x. */ int x; /** * @brief 座標値 y. */ int y; }; coord operator+(const coord& ob1, const coord& ob2) { coord temp; temp.x = ob1.x + ob2.x; temp.y = ob1.y + ob2.y; return temp; } coord operator+(const int num, const coord& ob) { coord temp; temp.x = num + ob.x; temp.y = num + ob.y; return temp; } coord operator+(const coord& ob, const int num) { coord temp; temp.x = ob.x + num; temp.y = ob.y + num; return temp; } coord operator-(const coord& ob1, const coord& ob2) { coord temp; temp.x = ob1.x - ob2.x; temp.y = ob1.y - ob2.y; return temp; } coord operator-(const int num, const coord& ob) { coord temp; temp.x = num - ob.x; temp.y = num - ob.y; return temp; } coord operator-(const coord& ob, const int num) { coord temp; temp.x = ob.x - num; temp.y = ob.y - num; return temp; } coord operator*(const coord& ob1, const coord& ob2) { coord temp; temp.x = ob1.x * ob2.x; temp.y = ob1.y * ob2.y; return temp; } coord operator*(const int num, const coord& ob) { coord temp; temp.x = num * ob.x; temp.y = num * ob.y; return temp; } coord operator*(const coord& ob, const int num) { coord temp; temp.x = ob.x * num; temp.y = ob.y * num; return temp; } coord operator/(const coord& ob1, const coord& ob2) { coord temp; temp.x = ob1.x / ob2.x; temp.y = ob1.y / ob2.y; return temp; } coord operator/(const int num, const coord& ob) { coord temp; temp.x = num / ob.x; temp.y = num / ob.y; return temp; } coord operator/(const coord& ob, const int num) { coord temp; temp.x = ob.x / num; temp.y = ob.y / num; return temp; } coord operator++(coord& ob) { ++(ob.x); ++(ob.y); return ob; } coord operator++(coord& ob, int notuse) { ob.x++; ob.y++; return ob; } coord operator--(coord& ob) { --(ob.x); --(ob.y); return ob; } coord operator--(coord& ob, int notuse) { ob.x--; ob.y--; return ob; } void show(const coord& ob) { cout << "(" << ob.get_x() << "," << ob.get_y() << ")" << endl; } int main() { coord r1(100, 90), r2(2, 3); coord r3; cout << "r1 = "; show(r1); cout << "r2 = "; show(r2); r1++; cout << "r1++ = "; show(r1); ++r1; cout << "++r1 = "; show(r1); r1--; cout << "r1-- = "; show(r1); --r1; cout << "--r1 = "; show(r1); return 0; }
590faf2ce5d64436712ea43783b742f9839d7433
ee858a021ffd0ec50f15d9fd54acf4d07ab372e3
/server/tcpserver.h
e59765b0f9545cf994b0a6fe124d74f426ead397
[]
no_license
krase/boost_asio_tcpclient
80f524cbf1fd6f99fc9f4064e31ec5631e17544a
37229e8278f076854c6398f6e4948f740f40c41d
refs/heads/master
2021-01-19T04:38:02.576805
2016-10-26T10:07:43
2016-10-26T10:07:43
44,088,533
3
1
null
null
null
null
UTF-8
C++
false
false
604
h
#ifndef TCPSERVER_H #define TCPSERVER_H #include <boost/asio.hpp> #include <boost/bind.hpp> #include <boost/thread/thread.hpp> #include "tcpserversession.h" #include "iserverdelegate.h" class TCPServer { public: TCPServer(uint16_t port, IServerDelegate *pHandler); private: boost::asio::io_service m_io_service; boost::asio::ip::tcp::acceptor m_acceptor; boost::thread m_worker; IServerDelegate *m_pHandler; void start_accept(); void run(); void handle_accept(TCPServerSession::SPointer connection, const boost::system::error_code &error); }; #endif // TCPSERVER_H
7fc211bcde92533efd50e9cac351fb52dda50940
59b2d9114592a1151713996a8888456a7fbfe56c
/hust_train/2016/new2016/G.cpp
88d7c332880efcf6b41c5a487f5aef7a75a9f212
[]
no_license
111qqz/ACM-ICPC
8a8e8f5653d8b6dc43524ef96b2cf473135e28bf
0a1022bf13ddf1c1e3a705efcc4a12df506f5ed2
refs/heads/master
2022-04-02T21:43:33.759517
2020-01-18T14:14:07
2020-01-18T14:14:07
98,531,401
1
1
null
null
null
null
UTF-8
C++
false
false
1,605
cpp
/* *********************************************** Author :111qqz Created Time :2016年03月06日 星期日 12时59分11秒 File Name :code/hust/new2016/G.cpp ************************************************ */ #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> #include <vector> #include <queue> #include <set> #include <map> #include <string> #include <cmath> #include <cstdlib> #include <ctime> #define fst first #define sec second #define lson l,m,rt<<1 #define rson m+1,r,rt<<1|1 #define ms(a,x) memset(a,x,sizeof(a)) typedef long long LL; #define pi pair < int ,int > #define MP make_pair using namespace std; const double eps = 1E-8; const int dx4[4]={1,0,0,-1}; const int dy4[4]={0,-1,1,0}; const int inf = 0x3f3f3f3f; const int N=1E6+15; bool np[N]; int prime[N]; int cnt_prime=0; int n; void getprime() { ms(np,false); for ( int i = 2 ; i < N ; i++) { if (!np[i]) { prime[++cnt_prime] = i; for ( int j = i+i ; j < N; j+=i) { np[j] = true; } } } } int main() { #ifndef ONLINE_JUDGE freopen("code/in.txt","r",stdin); #endif getprime(); // for ( int i = 1 ; i <= 100 ; i++) cout<<prime[i]<<endl; while (~scanf("%d",&n)) { if (n==0) break; //check bool ok = false; int x,y; for ( int i = 2 ; prime[i]<n ; i++) //奇素数,排除掉2。 { if (!np[n-prime[i]]) { ok = true; printf("%d = %d + %d\n",n,prime[i],n-prime[i]); break; } } if (!ok) { puts("No answer"); } } #ifndef ONLINE_JUDGE fclose(stdin); #endif return 0; }
[ "111qqz" ]
111qqz
cc1b2a01e29f7c5a8738065bc4ebbe2aa7e59f1c
d5f75adf5603927396bdecf3e4afae292143ddf9
/paddle/fluid/operators/fill_diagonal_tensor_op.cc
8967f13b1239e37111d9d8833ab610cdb0a3515b
[ "Apache-2.0" ]
permissive
jiweibo/Paddle
8faaaa1ff0beaf97ef7fb367f6c9fcc065f42fc4
605a2f0052e0ffb2fab3a4cf4f3bf1965aa7eb74
refs/heads/develop
2023-07-21T03:36:05.367977
2022-06-24T02:31:11
2022-06-24T02:31:11
196,316,126
3
2
Apache-2.0
2023-04-04T02:42:53
2019-07-11T03:51:12
Python
UTF-8
C++
false
false
11,008
cc
/* Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/operators/fill_diagonal_tensor_op.h" namespace paddle { namespace operators { // calculate the offset\new_dims\(strides of dim1/dim2)\matoffset void CalMatDims(framework::DDim out_dims, int dim1, int dim2, int64_t *offset, int64_t *new_dims, int64_t *strides, int64_t *matoffset) { int64_t dimprod = 1, batchdim = 1; int rank = out_dims.size(); int matoffidx = 0; for (int i = rank - 1; i >= 0; i--) { if (i == dim2) { strides[0] = dimprod; } else if (i == dim1) { strides[1] = dimprod; } else { batchdim *= out_dims[i]; // matoffset calculate the offset position of the diagonal defined by dim1 // and dim2 // the first circle calculate the final free dimension // and then calculate the front free dim one by one if (matoffidx == 0) { for (int64_t j = 0; j < out_dims[i]; j++) { matoffset[matoffidx] = dimprod * j; matoffidx++; } } else { auto size = matoffidx; for (int64_t j = 1; j < out_dims[i]; j++) { for (int64_t k = 0; k < size; k++) { matoffset[matoffidx] = matoffset[k] + dimprod * j; matoffidx++; } } } } dimprod *= out_dims[i]; } auto diagdim = dim1; if (*offset >= 0) { diagdim = std::min(out_dims[dim1], out_dims[dim2] - *offset); *offset *= strides[0]; } else { diagdim = std::min(out_dims[dim1] + *offset, out_dims[dim2]); *offset *= -strides[1]; } new_dims[0] = batchdim; new_dims[1] = diagdim; return; } class FillDiagonalTensorOpMaker : public framework::OpProtoAndCheckerMaker { public: void Make() override { AddComment(R"DOC(Fill replace operator Fill the diagonal of an tensor with `Y` Tensor. )DOC"); AddInput("X", "(Tensor) The input tensor."); AddInput("Y", "(Tensor) The input tensor to fill in."); AddOutput("Out", "Tensor, the output tensor, with the same shape and data type " "as input(x)"); AddAttr<int>("dim1", "the first dim to figure out the diagonal") .SetDefault(0); AddAttr<int>("dim2", "the second dim to figure out the diagonal") .SetDefault(1); AddAttr<int64_t>("offset", "offset of diagonal, zero means no offset, positive means " "offset to up-right corner; negtive means offset to " "bottom-left corner") .SetDefault(0); } }; class FillDiagonalTensorOp : public framework::OperatorWithKernel { public: using framework::OperatorWithKernel::OperatorWithKernel; void InferShape(framework::InferShapeContext *context) const override { OP_INOUT_CHECK(context->HasInput("X"), "Input", "X", "FillDiagonalTensor"); OP_INOUT_CHECK(context->HasOutput("Out"), "Output", "Out", "FillDiagonalTensor"); auto x_dims = context->GetInputDim("X"); context->SetOutputDim("Out", x_dims); } protected: framework::OpKernelType GetExpectedKernelType( const framework::ExecutionContext &ctx) const override { return framework::OpKernelType( OperatorWithKernel::IndicateVarDataType(ctx, "X"), ctx.GetPlace()); } }; class FillDiagonalTensorOpVarTypeInference : public framework::VarTypeInference { public: void operator()(framework::InferVarTypeContext *ctx) const override { auto var_type = ctx->GetInputType("X", 0); auto data_type = ctx->GetInputDataType("X", 0); ctx->SetOutputType("Out", var_type, framework::ALL_ELEMENTS); ctx->SetOutputDataType("Out", data_type, framework::ALL_ELEMENTS); } }; template <typename T> class FillDiagonalTensorKernel : public framework::OpKernel<T> { public: void Compute(const paddle::framework::ExecutionContext &ctx) const override { auto *out = ctx.Output<framework::Tensor>("Out"); auto *srctensor = ctx.Input<framework::Tensor>("Y"); auto dim1 = ctx.Attr<int>("dim1"); auto dim2 = ctx.Attr<int>("dim2"); auto offset = ctx.Attr<int64_t>("offset"); auto *xin = ctx.Input<framework::Tensor>("X"); T *out_data = out->mutable_data<T>(ctx.GetPlace()); const T *fill_data = srctensor->data<T>(); framework::TensorCopy(*xin, ctx.GetPlace(), out); auto out_dims = out->dims(); auto matdims = srctensor->dims(); auto fill_dims = phi::flatten_to_2d(matdims, matdims.size() - 1); int64_t new_dims[2], strides[2]; std::vector<int64_t> matdim; matdim.resize(fill_dims[0]); CalMatDims(out_dims, dim1, dim2, &offset, new_dims, strides, matdim.data()); PADDLE_ENFORCE_EQ( new_dims[0], fill_dims[0], platform::errors::InvalidArgument("The dims should be %d x %d, but get " "%d x %d in fill tensor Y", new_dims[0], new_dims[1], fill_dims[0], fill_dims[1])); PADDLE_ENFORCE_EQ( new_dims[1], fill_dims[1], platform::errors::InvalidArgument("The dims should be %d x %d, but get " "%d x %d in fill tensor Y", new_dims[0], new_dims[1], fill_dims[0], fill_dims[1])); auto size = out->numel(); for (int64_t i = 0; i < fill_dims[0]; i += 1) { auto sumoff = matdim[i] + offset; for (int64_t j = 0; j < fill_dims[1]; j += 1) { auto fill_index = j * (strides[1] + strides[0]) + sumoff; if (fill_index < size) { out_data[fill_index] = fill_data[i * fill_dims[1] + j]; } } } } }; class FillDiagonalTensorGradOp : public framework::OperatorWithKernel { public: using framework::OperatorWithKernel::OperatorWithKernel; void InferShape(framework::InferShapeContext *ctx) const override { OP_INOUT_CHECK(ctx->HasInput(framework::GradVarName("Out")), "Input", "Out@GRAD", "mul"); auto x_dims = ctx->GetInputDim(framework::GradVarName("Out")); auto x_grad_name = framework::GradVarName("X"); if (ctx->HasOutput(x_grad_name)) { ctx->SetOutputDim(x_grad_name, x_dims); } } framework::OpKernelType GetExpectedKernelType( const framework::ExecutionContext &ctx) const override { // Note: don't get data type from ctx.Input<framework::Tensor>("Input"); auto dtype = ctx.Input<framework::Tensor>(framework::GradVarName("Out"))->type(); return framework::OpKernelType(framework::TransToProtoVarType(dtype), ctx.GetPlace()); } }; template <typename T> class FillDiagonalTensorGradOpMaker : public framework::SingleGradOpMaker<T> { public: using framework::SingleGradOpMaker<T>::SingleGradOpMaker; protected: void Apply(GradOpPtr<T> retv) const override { retv->SetType("fill_diagonal_tensor_grad"); retv->SetInput(framework::GradVarName("Out"), this->OutputGrad("Out")); retv->SetOutput(framework::GradVarName("X"), this->InputGrad("X")); retv->SetAttrMap(this->Attrs()); } }; template <typename T> class FillDiagonalTensorGradKernel : public framework::OpKernel<T> { public: void Compute(const paddle::framework::ExecutionContext &ctx) const override { auto *dx = ctx.Output<framework::Tensor>(framework::GradVarName("X")); auto *dout = ctx.Input<framework::Tensor>(framework::GradVarName("Out")); auto dim1 = ctx.Attr<int>("dim1"); auto dim2 = ctx.Attr<int>("dim2"); auto offset = ctx.Attr<int64_t>("offset"); auto matrows = 1; if (dx) { auto *data = dx->mutable_data<T>(ctx.GetPlace()); auto dx_dims = dx->dims(); for (int i = 0; i < dx_dims.size(); i++) { if (i != dim1 && i != dim2) { matrows *= dx_dims[i]; } } int64_t new_dims[2], strides[2]; std::vector<int64_t> matdim; matdim.resize(matrows); CalMatDims(dx_dims, dim1, dim2, &offset, new_dims, strides, matdim.data()); auto size = dx->numel(); framework::TensorCopy(*dout, ctx.GetPlace(), dx); for (int64_t i = 0; i < new_dims[0]; i += 1) { auto sumoff = matdim[i] + offset; for (int64_t j = 0; j < new_dims[1]; j += 1) { auto fill_index = j * (strides[1] + strides[0]) + sumoff; if (fill_index < size) { data[fill_index] = 0; } } } } } }; DECLARE_INPLACE_OP_INFERER(FillDiagonalTensorOpInplaceInferer, {"X", "Out"}); DECLARE_INPLACE_OP_INFERER(FillDiagonalTensorGradOpInplaceInferer, {framework::GradVarName("Out"), framework::GradVarName("X")}); } // namespace operators } // namespace paddle namespace ops = paddle::operators; REGISTER_OPERATOR( fill_diagonal_tensor, ops::FillDiagonalTensorOp, ops::FillDiagonalTensorOpMaker, ops::FillDiagonalTensorOpVarTypeInference, ops::FillDiagonalTensorGradOpMaker<paddle::framework::OpDesc>, ops::FillDiagonalTensorGradOpMaker<paddle::imperative::OpBase>, ops::FillDiagonalTensorOpInplaceInferer); REGISTER_OPERATOR(fill_diagonal_tensor_grad, ops::FillDiagonalTensorGradOp, ops::FillDiagonalTensorGradOpInplaceInferer); REGISTER_OP_CPU_KERNEL( fill_diagonal_tensor, ops::FillDiagonalTensorKernel<float>, ops::FillDiagonalTensorKernel<double>, ops::FillDiagonalTensorKernel<int64_t>, ops::FillDiagonalTensorKernel<int>, ops::FillDiagonalTensorKernel<int8_t>, ops::FillDiagonalTensorKernel<uint8_t>, ops::FillDiagonalTensorKernel<paddle::platform::float16>, ops::FillDiagonalTensorKernel<paddle::platform::complex<float>>, ops::FillDiagonalTensorKernel<paddle::platform::complex<double>>, ops::FillDiagonalTensorKernel<bool>); REGISTER_OP_CPU_KERNEL( fill_diagonal_tensor_grad, ops::FillDiagonalTensorGradKernel<float>, ops::FillDiagonalTensorGradKernel<double>, ops::FillDiagonalTensorGradKernel<int64_t>, ops::FillDiagonalTensorGradKernel<int>, ops::FillDiagonalTensorGradKernel<int8_t>, ops::FillDiagonalTensorGradKernel<uint8_t>, ops::FillDiagonalTensorGradKernel<paddle::platform::float16>, ops::FillDiagonalTensorGradKernel<paddle::platform::complex<float>>, ops::FillDiagonalTensorGradKernel<paddle::platform::complex<double>>, ops::FillDiagonalTensorGradKernel<bool>);
ea48bc459c520a36b0097da40ef5d5905c84be0d
80da91481d4e2e029ad467364cb05b37a83b6af4
/src/renderer.cpp
86c18e5f4a0922767b16322d811216120d94a063
[]
no_license
smriti100jain/CppND-Capstone-Snake-Game
f394a79dce181b0217a8fc8f3952bb15d80ad554
45e7a4aefa0389cfcc18071add20c8a6ebdeb315
refs/heads/master
2023-02-08T11:59:03.543857
2020-12-30T15:48:23
2020-12-30T15:48:23
325,395,522
0
0
null
null
null
null
UTF-8
C++
false
false
3,168
cpp
#include "renderer.h" #include <iostream> #include <string> Renderer::Renderer(const std::size_t screen_width, const std::size_t screen_height, const std::size_t grid_width, const std::size_t grid_height) : screen_width(screen_width), screen_height(screen_height), grid_width(grid_width), grid_height(grid_height) { // Initialize SDL if (SDL_Init(SDL_INIT_VIDEO) < 0) { std::cerr << "SDL could not initialize.\n"; std::cerr << "SDL_Error: " << SDL_GetError() << "\n"; } // Create Window sdl_window = SDL_CreateWindow("Snake Game", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, screen_width, screen_height, SDL_WINDOW_SHOWN); if (nullptr == sdl_window) { std::cerr << "Window could not be created.\n"; std::cerr << " SDL_Error: " << SDL_GetError() << "\n"; } // Create renderer sdl_renderer = SDL_CreateRenderer(sdl_window, -1, SDL_RENDERER_ACCELERATED); if (nullptr == sdl_renderer) { std::cerr << "Renderer could not be created.\n"; std::cerr << "SDL_Error: " << SDL_GetError() << "\n"; } } Renderer::~Renderer() { SDL_DestroyWindow(sdl_window); SDL_Quit(); } void Renderer::Render(Snake const snake, std::vector<SDL_Point> const food1,std::vector<SDL_Point> const food2, std::vector<SDL_Point> const wall) { SDL_Rect block; block.w = screen_width / grid_width; block.h = screen_height / grid_height; // Clear screen SDL_SetRenderDrawColor(sdl_renderer, 0, 0, 0, 255); SDL_RenderClear(sdl_renderer); //Render Wall SDL_SetRenderDrawColor(sdl_renderer, 255, 0, 0, 255); for (int i = 0; i < wall.size(); i++) { block.x = wall[i].x * block.w; block.y = wall[i].y * block.h; SDL_RenderFillRect(sdl_renderer, &block); } // Render food1 SDL_SetRenderDrawColor(sdl_renderer, 255, 223,0,255); for (int i = 0; i < food1.size(); i++) { block.x = food1[i].x * block.w; block.y = food1[i].y * block.h; SDL_RenderFillRect(sdl_renderer, &block); } // Render food2 SDL_SetRenderDrawColor(sdl_renderer, 128, 128, 128, 255); for (int i = 0; i < food2.size(); i++) { block.x = food2[i].x * block.w; block.y = food2[i].y * block.h; SDL_RenderFillRect(sdl_renderer, &block); } // Render snake's body SDL_SetRenderDrawColor(sdl_renderer, 0xFF, 0xFF, 0xFF, 0xFF); for (SDL_Point const &point : snake.body) { block.x = point.x * block.w; block.y = point.y * block.h; SDL_RenderFillRect(sdl_renderer, &block); } // Render snake's head block.x = static_cast<int>(snake.head_x) * block.w; block.y = static_cast<int>(snake.head_y) * block.h; if (snake.alive) { SDL_SetRenderDrawColor(sdl_renderer, 0x00, 0x7A, 0xCC, 0xFF); } else { SDL_SetRenderDrawColor(sdl_renderer, 0xFF, 0x00, 0x00, 0xFF); } SDL_RenderFillRect(sdl_renderer, &block); // Update Screen SDL_RenderPresent(sdl_renderer); } void Renderer::UpdateWindowTitle(int score, int fps) { std::string title{"Snake Score: " + std::to_string(score) + " FPS: " + std::to_string(fps)}; SDL_SetWindowTitle(sdl_window, title.c_str()); }
a672ae3710e79d0ebbdc295e36eda6dc06bc3e11
d47cf9282cf0b66cd913d7c2c5b7ec62ae048caf
/lib/md5/md5.h
714b8477f73587256876bf120a639fb4565a12c7
[]
no_license
zhangyifei-chelsea/practice_in_winter_vacation_2017
2269e74357be4cc9eeb7202aca06c22f036b9c9b
5bff8afd0227a820d7f8a5284972d2d62cc05f67
refs/heads/master
2021-01-11T11:27:14.239646
2017-02-18T16:17:14
2017-02-18T16:17:14
80,178,882
2
2
null
null
null
null
UTF-8
C++
false
false
1,345
h
#ifndef MD5_H #define MD5_H #include <string> #include <fstream> /* Type define */ typedef unsigned char byte; typedef unsigned long ulong; using std::string; using std::ifstream; /* MD5 declaration. */ class MD5 { public: MD5(); MD5(const void *input, size_t length); MD5(const string &str); MD5(ifstream &in); void update(const void *input, size_t length); void update(const string &str); void update(ifstream &in); const byte* digest(); string toString(); void reset(); private: void update(const byte *input, size_t length); void final(); void transform(const byte block[64]); void encode(const ulong *input, byte *output, size_t length); void decode(const byte *input, ulong *output, size_t length); string bytesToHexString(const byte *input, size_t length); /* class uncopyable */ MD5(const MD5&); MD5& operator=(const MD5&); private: ulong _state[4]; /* state (ABCD) */ ulong _count[2]; /* number of bits, modulo 2^64 (low-order word first) */ byte _buffer[64]; /* input buffer */ byte _digest[16]; /* message digest */ bool _finished; /* calculate finished ? */ static const byte PADDING[64]; /* padding for calculate */ static const char HEX[16]; static const size_t BUFFER_SIZE = 1024; }; #endif/*MD5_H*/
9603722173f4c8569e2e4ac8aca8ffa8d51cfc7e
9030ce2789a58888904d0c50c21591632eddffd7
/SDK/ARKSurvivalEvolved_PrimalInventoryBP_TekTransmitter_functions.cpp
eb00fbf33d5d94c826d0d39f436ba9127d9e016a
[ "MIT" ]
permissive
2bite/ARK-SDK
8ce93f504b2e3bd4f8e7ced184980b13f127b7bf
ce1f4906ccf82ed38518558c0163c4f92f5f7b14
refs/heads/master
2022-09-19T06:28:20.076298
2022-09-03T17:21:00
2022-09-03T17:21:00
232,411,353
14
5
null
null
null
null
UTF-8
C++
false
false
2,051
cpp
// ARKSurvivalEvolved (332.8) SDK #ifdef _MSC_VER #pragma pack(push, 0x8) #endif #include "ARKSurvivalEvolved_PrimalInventoryBP_TekTransmitter_parameters.hpp" namespace sdk { //--------------------------------------------------------------------------- //Functions //--------------------------------------------------------------------------- // Function PrimalInventoryBP_TekTransmitter.PrimalInventoryBP_TekTransmitter_C.BPRemoteInventoryAllowViewing // () // Parameters: // class AShooterPlayerController** PC (Parm, ZeroConstructor, IsPlainOldData) // bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData) bool UPrimalInventoryBP_TekTransmitter_C::BPRemoteInventoryAllowViewing(class AShooterPlayerController** PC) { static auto fn = UObject::FindObject<UFunction>("Function PrimalInventoryBP_TekTransmitter.PrimalInventoryBP_TekTransmitter_C.BPRemoteInventoryAllowViewing"); UPrimalInventoryBP_TekTransmitter_C_BPRemoteInventoryAllowViewing_Params params; params.PC = PC; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function PrimalInventoryBP_TekTransmitter.PrimalInventoryBP_TekTransmitter_C.ExecuteUbergraph_PrimalInventoryBP_TekTransmitter // () // Parameters: // int EntryPoint (Parm, ZeroConstructor, IsPlainOldData) void UPrimalInventoryBP_TekTransmitter_C::ExecuteUbergraph_PrimalInventoryBP_TekTransmitter(int EntryPoint) { static auto fn = UObject::FindObject<UFunction>("Function PrimalInventoryBP_TekTransmitter.PrimalInventoryBP_TekTransmitter_C.ExecuteUbergraph_PrimalInventoryBP_TekTransmitter"); UPrimalInventoryBP_TekTransmitter_C_ExecuteUbergraph_PrimalInventoryBP_TekTransmitter_Params params; params.EntryPoint = EntryPoint; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } } #ifdef _MSC_VER #pragma pack(pop) #endif
4469a724abbf1de784852cad9cd24dd7be16d733
04b1803adb6653ecb7cb827c4f4aa616afacf629
/components/language_usage_metrics/language_usage_metrics_unittest.cc
74344eb329453f3e091c22abd2e8f7281b76635b
[ "BSD-3-Clause" ]
permissive
Samsung/Castanets
240d9338e097b75b3f669604315b06f7cf129d64
4896f732fc747dfdcfcbac3d442f2d2d42df264a
refs/heads/castanets_76_dev
2023-08-31T09:01:04.744346
2021-07-30T04:56:25
2021-08-11T05:45:21
125,484,161
58
49
BSD-3-Clause
2022-10-16T19:31:26
2018-03-16T08:07:37
null
UTF-8
C++
false
false
3,658
cc
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "components/language_usage_metrics/language_usage_metrics.h" #include "testing/gtest/include/gtest/gtest.h" namespace language_usage_metrics { TEST(LanguageUsageMetricsTest, ParseAcceptLanguages) { std::set<int> language_set; std::set<int>::const_iterator it; const int ENGLISH = 25966; const int SPANISH = 25971; const int JAPANESE = 27233; // Basic single language case. LanguageUsageMetrics::ParseAcceptLanguages("ja", &language_set); EXPECT_EQ(1U, language_set.size()); EXPECT_EQ(JAPANESE, *language_set.begin()); // Empty language. LanguageUsageMetrics::ParseAcceptLanguages(std::string(), &language_set); EXPECT_EQ(0U, language_set.size()); // Country code is ignored. LanguageUsageMetrics::ParseAcceptLanguages("ja-JP", &language_set); EXPECT_EQ(1U, language_set.size()); EXPECT_EQ(JAPANESE, *language_set.begin()); // Case is ignored. LanguageUsageMetrics::ParseAcceptLanguages("Ja-jP", &language_set); EXPECT_EQ(1U, language_set.size()); EXPECT_EQ(JAPANESE, *language_set.begin()); // Underscore as the separator. LanguageUsageMetrics::ParseAcceptLanguages("ja_JP", &language_set); EXPECT_EQ(1U, language_set.size()); EXPECT_EQ(JAPANESE, *language_set.begin()); // The result contains a same language code only once. LanguageUsageMetrics::ParseAcceptLanguages("ja-JP,ja", &language_set); EXPECT_EQ(1U, language_set.size()); EXPECT_EQ(JAPANESE, *language_set.begin()); // Basic two languages case. LanguageUsageMetrics::ParseAcceptLanguages("en,ja", &language_set); EXPECT_EQ(2U, language_set.size()); it = language_set.begin(); EXPECT_EQ(ENGLISH, *it); EXPECT_EQ(JAPANESE, *++it); // Multiple languages. LanguageUsageMetrics::ParseAcceptLanguages("ja-JP,en,es,ja,en-US", &language_set); EXPECT_EQ(3U, language_set.size()); it = language_set.begin(); EXPECT_EQ(ENGLISH, *it); EXPECT_EQ(SPANISH, *++it); EXPECT_EQ(JAPANESE, *++it); // Two empty languages. LanguageUsageMetrics::ParseAcceptLanguages(",", &language_set); EXPECT_EQ(0U, language_set.size()); // Trailing comma. LanguageUsageMetrics::ParseAcceptLanguages("ja,", &language_set); EXPECT_EQ(1U, language_set.size()); EXPECT_EQ(JAPANESE, *language_set.begin()); // Leading comma. LanguageUsageMetrics::ParseAcceptLanguages(",es", &language_set); EXPECT_EQ(1U, language_set.size()); EXPECT_EQ(SPANISH, *language_set.begin()); // Combination of invalid and valid. LanguageUsageMetrics::ParseAcceptLanguages("1234,en", &language_set); EXPECT_EQ(1U, language_set.size()); it = language_set.begin(); EXPECT_EQ(ENGLISH, *it); } TEST(LanguageUsageMetricsTest, ToLanguageCode) { const int SPANISH = 25971; const int JAPANESE = 27233; // Basic case. EXPECT_EQ(JAPANESE, LanguageUsageMetrics::ToLanguageCode("ja")); // Case is ignored. EXPECT_EQ(SPANISH, LanguageUsageMetrics::ToLanguageCode("Es")); // Coutry code is ignored. EXPECT_EQ(JAPANESE, LanguageUsageMetrics::ToLanguageCode("ja-JP")); // Invalid locales are considered as unknown language. EXPECT_EQ(0, LanguageUsageMetrics::ToLanguageCode(std::string())); EXPECT_EQ(0, LanguageUsageMetrics::ToLanguageCode("1234")); // "xx" is not acceptable because it doesn't exist in ISO 639-1 table. // However, LanguageUsageMetrics doesn't tell what code is valid. EXPECT_EQ(30840, LanguageUsageMetrics::ToLanguageCode("xx")); } } // namespace language_usage_metrics
3e3f4172a7a8f95fc8a7eed8f48499408dca72bb
9ddf847ffceded21298d21ded4cea757420f0b72
/common_library/alarm/alarminstance.cpp
1b46ed255c64eebef638f2f2e7aa69799e3ac836
[]
no_license
ErnadS/EsDemo
511cc33e23589223b5aa215bb75ceb3df57ca881
4b1db01b1930b9f19fed6efa79effb1c00c7a645
refs/heads/master
2021-05-31T19:14:53.504590
2016-01-11T13:27:31
2016-01-11T13:27:31
36,649,915
0
0
null
null
null
null
UTF-8
C++
false
false
2,416
cpp
#include "alarminstance.h" //#include "utc_time.h" AlarmInstance::AlarmInstance() { // reset(); // nRevisionCounter = 1; /*bAlarmEnabled = true; bAlarmTrigged = false; bAlarmAcked = true; bExitingAlarmState = false; bStateChanged = false;*/ // stateChangedTimeStample = ""; //nAlarmType = TYPE_NOT_ALARM; } // should be set by constructor /*void AlarmInstance::setAlarmSource(AlarmSource alarmSource) { this->alarmSource = alarmSource; } // Do not use this function if state is unchanged. Timestample will be changed. void AlarmInstance::setActive() { this->bAlarmActive = true; this->bAlarmWaitsOnACK = true; setTimestampleStateChanged(); bResponsibilityTransfer = false; nExcalationCounter = 0; // not used yet (we always send zero) bSilence = false; nSilencedTimeCounter = 0; } void AlarmInstance::setAcknowledged() { this->bAlarmWaitsOnACK = false; bResponsibilityTransfer = false; nExcalationCounter = 0; // not used yet (we always send zero) bSilence = false; nSilencedTimeCounter = 0; setTimestampleStateChanged(); } void AlarmInstance::setResponsabilityTransfered() { this->bAlarmWaitsOnACK = false; this->bResponsibilityTransfer = true; nExcalationCounter = 0; // not used yet (we always send zero) bSilence = false; nSilencedTimeCounter = 0; setTimestampleStateChanged(); } void AlarmInstance::setRectified() { // alarm condition is over this->bAlarmActive = false; bSilence = false; nSilencedTimeCounter = 0; setTimestampleStateChanged(); } void AlarmInstance::setTimestampleStateChanged() { stateChangedTimeStample = UTC_Time::getTimeStample(); // remember when state was changed (needs for ALR message) nRevisionCounter ++; if (nRevisionCounter > 99) nRevisionCounter = 1; } void AlarmInstance::setSilenced() { bSilence = true; nSilencedTimeCounter = 0; bResponsibilityTransfer = false; nExcalationCounter = 0; // not used yet (we always send zero) } // Alarm is ack-ed and over. Reset it to active=false, acknowledged=false void AlarmInstance::reset() { bAlarmActive = false; bAlarmWaitsOnACK = false; stateChangedTimeStample = ""; bResponsibilityTransfer = false; nExcalationCounter = 0; // not used yet (we always send zero) bSilence = false; nSilencedTimeCounter = 0; }*/
6e8a1926216dbf6077b410851bb37414438e9083
d77c8281815514ec757e6cf82386f83b13bc6a4b
/applications/csvshell2shell.cxx
66fa4776ca5791f572f762dd12e26b88dd192246
[ "Apache-2.0", "BSD-3-Clause" ]
permissive
alonsoJASL/lassy
a4a97c2d4baf66d9324d7f3d039c0dc481806c2f
10aefa4d6b3b9d859e9fc1cd1302b06163cc24d1
refs/heads/master
2021-06-14T03:18:22.105647
2021-04-26T12:27:36
2021-04-26T12:27:36
181,511,106
0
0
null
2019-04-15T15:04:43
2019-04-15T15:04:42
null
UTF-8
C++
false
false
2,564
cxx
#define HAS_VTK 1 #include "LaShell2ShellPointsCSV.h" /* * Author: * Dr. Rashed Karim * Department of Biomedical Engineering, King's College London * Email: rashed 'dot' karim @kcl.ac.uk * Copyright (c) 2017 * * This application demonstrates the LaShell2ShellPointsCSV class * Reads a CSV file containing 3D points, locates them in source shell and then locates their closest points in target shell * Outputs a CSV file containing cloest points xyz in target shell */ int main(int argc, char * argv[]) { char* input_f1, *input_f2, *input_f3, *input_csv, *output_csv; bool foundArgs1 = false; bool foundArgs2 = false; bool foundArgs3 = false; bool foundArgs4 = false; bool foundArgs5 = false; if (argc >= 1) { for (int i = 1; i < argc; i++) { if (i + 1 != argc) { if (string(argv[i]) == "-source") { input_f1 = argv[i + 1]; foundArgs1 = true; } else if (string(argv[i]) == "-target") { input_f2 = argv[i + 1]; foundArgs2 = true; } else if (string(argv[i]) == "-starget") { input_f3 = argv[i + 1]; foundArgs3 = true; } else if (string(argv[i]) == "-csv") { input_csv = argv[i + 1]; foundArgs4 = true; } else if (string(argv[i]) == "-out") { output_csv = argv[i + 1]; foundArgs5 = true; } } // end outer if } } if (!(foundArgs1 && foundArgs2 && foundArgs3 && foundArgs4 && foundArgs5)) { cerr << "Cheeck your parameters\n\nUsage:" "\nReads a CSV file containing 3D points, locates them in source shell and then locates their closest points in target shell." "\nOutputs a CSV file containing cloest points xyz in target shell" "\n(Mandatory)\n\t-source <source shell1> \n\t-target <target shell2> \n\t-starget (source registered to target vtk)" "\n\t-csv <csv file>\n\t-out <csv output>\n" << endl; exit(1); } else { LaShell* source = new LaShell(input_f1); LaShell* target = new LaShell(input_f2); LaShell* source_in_target = new LaShell(input_f3); LaShell2ShellPointsCSV* algorithm = new LaShell2ShellPointsCSV(); algorithm->SetSourceData(source); algorithm->SetTargetData(target); algorithm->SetSourceInTargetData(source_in_target); algorithm->SetOutputFileName(output_csv); algorithm->ReadCSVFile(input_csv); algorithm->Update(); } }
b383ae9af6b16ba3401d2782960a2a73fd640b6b
05aed997643020b0763dc413212ac5b46159284d
/source/string.h
99c2a2f7c3f494e56a00af44c041eb0f48b192c3
[]
no_license
yuvalsteuer-personal/Stython
43fe2ab46ecbce1869e48b9592c0c049f84b11d1
34f71561ed62f212d3f049170e4260cb3fe8f476
refs/heads/master
2022-06-17T15:04:49.123581
2019-02-15T15:46:35
2019-02-15T15:46:35
null
0
0
null
null
null
null
UTF-8
C++
false
false
412
h
#ifndef STRING_H #define STRING_H #include "sequence.h" #include <string> class String : public Sequence { private: std::string _str = ""; public: String(std::string str = "", bool isTemp = false); //virtual virtual bool isPrintable()const override; virtual std::string toString()const override; virtual std::string type()const override; virtual size_t length()const override; }; #endif // STRING_H
e26d12af72425b08369187d42732ce82d4a10cea
709cd826da3ae55945fd7036ecf872ee7cdbd82a
/Term/WildMagic2/Source/Intersection/WmlIntrTri3Con3.cpp
a0d5a7f4353d6bec1785653a15cf4f674bd4a8f5
[]
no_license
argapratama/kucgbowling
20dbaefe1596358156691e81ccceb9151b15efb0
65e40b6f33c5511bddf0fa350c1eefc647ace48a
refs/heads/master
2018-01-08T15:27:44.784437
2011-06-19T15:23:39
2011-06-19T15:23:39
36,738,655
0
0
null
null
null
null
UTF-8
C++
false
false
10,534
cpp
// Magic Software, Inc. // http://www.magic-software.com // http://www.wild-magic.com // Copyright (c) 2003. All Rights Reserved // // The Wild Magic Library (WML) source code is supplied under the terms of // the license agreement http://www.magic-software.com/License/WildMagic.pdf // and may not be copied or disclosed except in accordance with the terms of // that agreement. #include "WmlIntrTri3Con3.h" using namespace Wml; //---------------------------------------------------------------------------- template <class Real> bool Wml::TestIntersection (const Triangle3<Real>& rkTri, const Cone3<Real>& rkCone) { // NOTE. The following quantities computed in this function can be // precomputed and stored in the cone and triangle classes as an // optimization. // 1. The cone squared cosine. // 2. The triangle squared edge lengths |E0|^2 and |E1|^2. // 3. The third triangle edge E2 = E1 - E0 and squared length |E2|^2. // 4. The triangle normal N = Cross(E0,E1) or unitized normal // N = Cross(E0,E1)/Length(Cross(E0,E1)). // triangle is <P0,P1,P2>, edges are E0 = P1-P0, E1=P2-P0 int iOnConeSide = 0; Real fP0Test, fP1Test, fP2Test, fAdE, fEdE, fEdD, fC1, fC2; Real fCosSqr = rkCone.CosAngle()*rkCone.CosAngle(); // test vertex P0 Vector3<Real> kDiff0 = rkTri.Origin() - rkCone.Vertex(); Real fAdD0 = rkCone.Axis().Dot(kDiff0); if ( fAdD0 >= (Real)0.0 ) { // P0 is on cone side of plane fP0Test = fAdD0*fAdD0 - fCosSqr*(kDiff0.Dot(kDiff0)); if ( fP0Test >= (Real)0.0 ) { // P0 is inside the cone return true; } else { // P0 is outside the cone, but on cone side of plane iOnConeSide |= 1; } } // else P0 is not on cone side of plane // test vertex P1 Vector3<Real> kDiff1 = kDiff0 + rkTri.Edge0(); Real fAdD1 = rkCone.Axis().Dot(kDiff1); if ( fAdD1 >= (Real)0.0 ) { // P1 is on cone side of plane fP1Test = fAdD1*fAdD1 - fCosSqr*(kDiff1.Dot(kDiff1)); if ( fP1Test >= (Real)0.0 ) { // P1 is inside the cone return true; } else { // P1 is outside the cone, but on cone side of plane iOnConeSide |= 2; } } // else P1 is not on cone side of plane // test vertex P2 Vector3<Real> kDiff2 = kDiff0 + rkTri.Edge1(); Real fAdD2 = rkCone.Axis().Dot(kDiff2); if ( fAdD2 >= (Real)0.0 ) { // P2 is on cone side of plane fP2Test = fAdD2*fAdD2 - fCosSqr*(kDiff2.Dot(kDiff2)); if ( fP2Test >= (Real)0.0 ) { // P2 is inside the cone return true; } else { // P2 is outside the cone, but on cone side of plane iOnConeSide |= 4; } } // else P2 is not on cone side of plane // test edge <P0,P1> = E0 if ( iOnConeSide & 3 ) { fAdE = fAdD1 - fAdD0; fEdE = rkTri.Edge0().Dot(rkTri.Edge0()); fC2 = fAdE*fAdE - fCosSqr*fEdE; if ( fC2 < (Real)0.0 ) { fEdD = rkTri.Edge0().Dot(kDiff0); fC1 = fAdE*fAdD0 - fCosSqr*fEdD; if ( iOnConeSide & 1 ) { if ( iOnConeSide & 2 ) { // <P0,P1> fully on cone side of plane, fC0 = fP0Test if ( (Real)0.0 <= fC1 && fC1 <= -fC2 && fC1*fC1 >= fP0Test*fC2 ) { return true; } } else { // P0 on cone side (Dot(A,P0-V) >= 0), // P1 on opposite side (Dot(A,P1-V) <= 0) // (Dot(A,E0) <= 0), fC0 = fP0Test if ( (Real)0.0 <= fC1 && fC2*fAdD0 <= fC1*fAdE && fC1*fC1 >= fP0Test*fC2 ) { return true; } } } else { // P1 on cone side (Dot(A,P1-V) >= 0), // P0 on opposite side (Dot(A,P0-V) <= 0) // (Dot(A,E0) >= 0), fC0 = fP0Test (needs calculating) if ( fC1 <= -fC2 && fC2*fAdD0 <= fC1*fAdE ) { fP0Test = fAdD0*fAdD0 - fCosSqr*(kDiff0.Dot(kDiff0)); if ( fC1*fC1 >= fP0Test*fC2 ) return true; } } } } // else <P0,P1> does not intersect cone half space // test edge <P0,P2> = E1 if ( iOnConeSide & 5 ) { fAdE = fAdD2 - fAdD0; fEdE = rkTri.Edge1().Dot(rkTri.Edge1()); fC2 = fAdE*fAdE - fCosSqr*fEdE; if ( fC2 < (Real)0.0 ) { fEdD = rkTri.Edge1().Dot(kDiff0); fC1 = fAdE*fAdD0 - fCosSqr*fEdD; if ( iOnConeSide & 1 ) { if ( iOnConeSide & 4 ) { // <P0,P2> fully on cone side of plane, fC0 = fP0Test if ( (Real)0.0 <= fC1 && fC1 <= -fC2 && fC1*fC1 >= fP0Test*fC2 ) { return true; } } else { // P0 on cone side (Dot(A,P0-V) >= 0), // P2 on opposite side (Dot(A,P2-V) <= 0) // (Dot(A,E1) <= 0), fC0 = fP0Test if ( (Real)0.0 <= fC1 && fC2*fAdD0 <= fC1*fAdE && fC1*fC1 >= fP0Test*fC2 ) { return true; } } } else { // P2 on cone side (Dot(A,P2-V) >= 0), // P0 on opposite side (Dot(A,P0-V) <= 0) // (Dot(A,E1) >= 0), fC0 = fP0Test (needs calculating) if ( fC1 <= -fC2 && fC2*fAdD0 <= fC1*fAdE ) { fP0Test = fAdD0*fAdD0 - fCosSqr*(kDiff0.Dot(kDiff0)); if ( fC1*fC1 >= fP0Test*fC2 ) return true; } } } } // else <P0,P2> does not intersect cone half space // test edge <P1,P2> = E1-E0 = E2 if ( iOnConeSide & 6 ) { Vector3<Real> kE2 = rkTri.Edge1() - rkTri.Edge0(); fAdE = fAdD2 - fAdD1; fEdE = kE2.Dot(kE2); fC2 = fAdE*fAdE - fCosSqr*fEdE; if ( fC2 < (Real)0.0 ) { fEdD = kE2.Dot(kDiff1); fC1 = fAdE*fAdD1 - fCosSqr*fEdD; if ( iOnConeSide & 2 ) { if ( iOnConeSide & 4 ) { // <P1,P2> fully on cone side of plane, fC0 = fP1Test if ( (Real)0.0 <= fC1 && fC1 <= -fC2 && fC1*fC1 >= fP1Test*fC2 ) { return true; } } else { // P1 on cone side (Dot(A,P1-V) >= 0), // P2 on opposite side (Dot(A,P2-V) <= 0) // (Dot(A,E2) <= 0), fC0 = fP1Test if ( (Real)0.0 <= fC1 && fC2*fAdD1 <= fC1*fAdE && fC1*fC1 >= fP1Test*fC2 ) { return true; } } } else { // P2 on cone side (Dot(A,P2-V) >= 0), // P1 on opposite side (Dot(A,P1-V) <= 0) // (Dot(A,E2) >= 0), fC0 = fP1Test (needs calculating) if ( fC1 <= -fC2 && fC2*fAdD1 <= fC1*fAdE ) { fP1Test = fAdD1*fAdD1 - fCosSqr*(kDiff1.Dot(kDiff1)); if ( fC1*fC1 >= fP1Test*fC2 ) return true; } } } } // else <P1,P2> does not intersect cone half space // Test triangle <P0,P1,P2>. It is enough to handle only the case when // at least one Pi is on the cone side of the plane. In this case and // after the previous testing, if the triangle intersects the cone, the // set of intersection must contain the point of intersection between // the cone axis and the triangle. if ( iOnConeSide > 0 ) { Vector3<Real> kN = rkTri.Edge0().Cross(rkTri.Edge1()); Real fNdA = kN.Dot(rkCone.Axis()); Real fNdD = kN.Dot(kDiff0); Vector3<Real> kU = fNdD*rkCone.Axis() - fNdA*kDiff0; Vector3<Real> kNcU = kN.Cross(kU); Real fNcUdE0 = kNcU.Dot(rkTri.Edge0()), fNcUdE1, fNcUdE2, fNdN; if ( fNdA >= (Real)0.0 ) { if ( fNcUdE0 <= (Real)0.0 ) { fNcUdE1 = kNcU.Dot(rkTri.Edge1()); if ( fNcUdE1 >= (Real)0.0 ) { fNcUdE2 = fNcUdE1 - fNcUdE0; fNdN = kN.SquaredLength(); if ( fNcUdE2 <= fNdA*fNdN ) return true; } } } else { if ( fNcUdE0 >= (Real)0.0 ) { fNcUdE1 = kNcU.Dot(rkTri.Edge1()); if ( fNcUdE1 <= (Real)0.0 ) { fNcUdE2 = fNcUdE1 - fNcUdE0; fNdN = kN.SquaredLength(); if ( fNcUdE2 >= fNdA*fNdN ) return true; } } } } return false; } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- // explicit instantiation //---------------------------------------------------------------------------- namespace Wml { template WML_ITEM bool TestIntersection<float> ( const Triangle3<float>&, const Cone3<float>&); template WML_ITEM bool TestIntersection<double> ( const Triangle3<double>&, const Cone3<double>&); } //----------------------------------------------------------------------------
d5e697fe9cb6483101be623c948e92086252f0f0
f05bde6d5bdee3e9a07e34af1ce18259919dd9bd
/examples/cpp/source/linear_regression/linear_regression_norm_eq_distributed.cpp
c330d3a8af72ae8d924ff5d181f0ab86a8b17327
[ "Intel", "Apache-2.0" ]
permissive
HFTrader/daal
f827c83b75cf5884ecfb6249a664ce6f091bfc57
b18624d2202a29548008711ec2abc93d017bd605
refs/heads/daal_2017_beta
2020-12-28T19:08:39.038346
2016-04-15T17:02:24
2016-04-15T17:02:24
56,404,044
0
1
null
2016-04-16T20:26:14
2016-04-16T20:26:14
null
UTF-8
C++
false
false
6,174
cpp
/* file: linear_regression_norm_eq_distributed.cpp */ /******************************************************************************* * Copyright 2014-2016 Intel Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *******************************************************************************/ /* ! Content: ! C++ example of multiple linear regression in the distributed processing ! mode. ! ! The program trains the multiple linear regression model on a training ! datasetFileName with the normal equations method and computes regression ! for the test data. !******************************************************************************/ /** * <a name="DAAL-EXAMPLE-CPP-LINEAR_REGRESSION_NORM_EQ_DISTRIBUTED"></a> * \example linear_regression_norm_eq_distributed.cpp */ #include "daal.h" #include "service.h" using namespace std; using namespace daal; using namespace daal::algorithms::linear_regression; const string trainDatasetFileNames[] = { "../data/distributed/linear_regression_train_1.csv", "../data/distributed/linear_regression_train_2.csv", "../data/distributed/linear_regression_train_3.csv", "../data/distributed/linear_regression_train_4.csv" }; string testDatasetFileName = "../data/distributed/linear_regression_test.csv"; const size_t nBlocks = 4; const size_t nFeatures = 10; const size_t nDependentVariables = 2; void trainModel(); void testModel(); services::SharedPtr<training::Result> trainingResult; services::SharedPtr<prediction::Result> predictionResult; int main(int argc, char *argv[]) { checkArguments(argc, argv, 5, &testDatasetFileName, &trainDatasetFileNames[0], &trainDatasetFileNames[1], &trainDatasetFileNames[2], &trainDatasetFileNames[3]); trainModel(); testModel(); return 0; } void trainModel() { /* Create an algorithm object to build the final multiple linear regression model on the master node */ training::Distributed<step2Master> masterAlgorithm; for(size_t i = 0; i < nBlocks; i++) { /* Initialize FileDataSource<CSVFeatureManager> to retrieve the input data from a .csv file */ FileDataSource<CSVFeatureManager> trainDataSource(trainDatasetFileNames[i], DataSource::notAllocateNumericTable, DataSource::doDictionaryFromContext); /* Create Numeric Tables for training data and variables */ services::SharedPtr<NumericTable> trainData(new HomogenNumericTable<double>(nFeatures, 0, NumericTable::notAllocate)); services::SharedPtr<NumericTable> trainDependentVariables(new HomogenNumericTable<double>(nDependentVariables, 0, NumericTable::notAllocate)); services::SharedPtr<NumericTable> mergedData(new MergedNumericTable(trainData, trainDependentVariables)); /* Retrieve the data from input file */ trainDataSource.loadDataBlock(mergedData.get()); /* Create an algorithm object to train the multiple linear regression model based on the local-node data */ training::Distributed<step1Local> localAlgorithm; /* Pass a training data set and dependent values to the algorithm */ localAlgorithm.input.set(training::data, trainData); localAlgorithm.input.set(training::dependentVariables, trainDependentVariables); /* Train the multiple linear regression model on the local-node data */ localAlgorithm.compute(); /* Set the local multiple linear regression model as input for the master-node algorithm */ masterAlgorithm.input.add(training::partialModels, localAlgorithm.getPartialResult()); } /* Merge and finalize the multiple linear regression model on the master node */ masterAlgorithm.compute(); masterAlgorithm.finalizeCompute(); /* Retrieve the algorithm results */ trainingResult = masterAlgorithm.getResult(); printNumericTable(trainingResult->get(training::model)->getBeta(), "Linear Regression coefficients:"); } void testModel() { /* Initialize FileDataSource<CSVFeatureManager> to retrieve the input data from a .csv file */ FileDataSource<CSVFeatureManager> testDataSource(testDatasetFileName, DataSource::doAllocateNumericTable, DataSource::doDictionaryFromContext); /* Create Numeric Tables for testing data and ground truth values */ services::SharedPtr<NumericTable> testData(new HomogenNumericTable<double>(nFeatures, 0, NumericTable::notAllocate)); services::SharedPtr<NumericTable> testGroundTruth(new HomogenNumericTable<double>(nDependentVariables, 0, NumericTable::notAllocate)); services::SharedPtr<NumericTable> mergedData(new MergedNumericTable(testData, testGroundTruth)); /* Load the data from the data file */ testDataSource.loadDataBlock(mergedData.get()); /* Create an algorithm object to predict values of multiple linear regression */ prediction::Batch<> algorithm; /* Pass a testing data set and the trained model to the algorithm */ algorithm.input.set(prediction::data, testData); algorithm.input.set(prediction::model, trainingResult->get(training::model)); /* Predict values of multiple linear regression */ algorithm.compute(); /* Retrieve the algorithm results */ predictionResult = algorithm.getResult(); printNumericTable(predictionResult->get(prediction::prediction), "Linear Regression prediction results: (first 10 rows):", 10); printNumericTable(testGroundTruth, "Ground truth (first 10 rows):", 10); }
a4d1c20c0979e8f13b8ecbf5ea8a711af2ac5652
f5ca8b8c7c1cf8dc36a7554cd1bef4919551ee90
/sofdata/mwpcData/R3BSofMWPCPoint.cxx
3d6ae61a86e5ee6840ee25a4ea252540159e23f2
[]
no_license
paandre/sofia
6d79275aa0153767533eef00f334a624164ffb91
609c35586c3a4e6e02b1a0faa891e3a87fdde1bf
refs/heads/master
2021-01-02T21:20:52.108077
2020-01-07T11:05:25
2020-01-07T11:25:24
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,519
cxx
// ------------------------------------------------------------------------- // ----- R3BSofMWPCPoint source file ----- // ------------------------------------------------------------------------- #include "R3BSofMWPCPoint.h" #include <iostream> using std::cout; using std::endl; using std::flush; // ----- Default constructor ------------------------------------------- R3BSofMWPCPoint::R3BSofMWPCPoint() : FairMCPoint() { fX_out = fY_out = fZ_out = 0.; fPx_out = fPy_out = fPz_out = 0.; } // ------------------------------------------------------------------------- // ----- Standard constructor ------------------------------------------ R3BSofMWPCPoint::R3BSofMWPCPoint(Int_t trackID, Int_t detID, Int_t detCopyID, TVector3 posIn, TVector3 posOut, TVector3 momIn, TVector3 momOut, Double_t tof, Double_t length, Double_t eLoss) : FairMCPoint(trackID, detID, posIn, momIn, tof, length, eLoss) { fDetCopyID = detCopyID; fX_out = posOut.X(); fY_out = posOut.Y(); fZ_out = posOut.Z(); fPx_out = momOut.Px(); fPy_out = momOut.Py(); fPz_out = momOut.Pz(); } // ------------------------------------------------------------------------- // ----- Destructor ---------------------------------------------------- R3BSofMWPCPoint::~R3BSofMWPCPoint() {} // ------------------------------------------------------------------------- // ----- Public method Print ------------------------------------------- void R3BSofMWPCPoint::Print(const Option_t* opt) const { cout << "-I- R3BSofMWPCPoint: STS Point for track " << fTrackID << " in detector " << fDetectorID << endl; cout << " Position (" << fX << ", " << fY << ", " << fZ << ") cm" << endl; cout << " Momentum (" << fPx << ", " << fPy << ", " << fPz << ") GeV" << endl; cout << " Time " << fTime << " ns, Length " << fLength << " cm, Energy loss " << fELoss * 1.0e06 << " keV" << endl; } // ------------------------------------------------------------------------- // ----- Point x coordinate from linear extrapolation ------------------ Double_t R3BSofMWPCPoint::GetX(Double_t z) const { // cout << fZ << " " << z << " " << fZ_out << endl; if ((fZ_out - z) * (fZ - z) >= 0.) return (fX_out + fX) / 2.; Double_t dz = fZ_out - fZ; return (fX + (z - fZ) / dz * (fX_out - fX)); } // ------------------------------------------------------------------------- // ----- Point y coordinate from linear extrapolation ------------------ Double_t R3BSofMWPCPoint::GetY(Double_t z) const { if ((fZ_out - z) * (fZ - z) >= 0.) return (fY_out + fY) / 2.; Double_t dz = fZ_out - fZ; // if ( TMath::Abs(dz) < 1.e-3 ) return (fY_out+fY)/2.; return (fY + (z - fZ) / dz * (fY_out - fY)); } // ------------------------------------------------------------------------- // ----- Public method IsUsable ---------------------------------------- Bool_t R3BSofMWPCPoint::IsUsable() const { Double_t dz = fZ_out - fZ; if (TMath::Abs(dz) < 1.e-4) return kFALSE; return kTRUE; } // ------------------------------------------------------------------------- ClassImp(R3BSofMWPCPoint)
2c92f286200211f1679ac63f1fb701a5ca80589c
32e6b07cafd0f01308b4d1825c1e0de06aff702c
/HW1/NYUCodebase/main.cpp
108d2e1d6adfd0c2a15cdd25b7ccf0783278da4b
[]
no_license
Chaosshade99/CS3113
7a79a6360aac83e2249ed8ee29c877d25b08a22c
ec1f5fc48ec89f9cfb8138838df6879f0259cbc3
refs/heads/master
2020-03-30T08:32:11.309609
2018-12-17T16:10:41
2018-12-17T16:10:41
148,077,226
0
0
null
null
null
null
UTF-8
C++
false
false
5,813
cpp
#ifdef _WINDOWS #include <GL/glew.h> #endif #include <SDL.h> #include <SDL_opengl.h> #include <SDL_image.h> #include "ShaderProgram.h" #include "glm/mat4x4.hpp" #include "glm/gtc/matrix_transform.hpp" #define STB_IMAGE_IMPLEMENTATION #include "stb_image.h" #ifdef _WINDOWS #define RESOURCE_FOLDER "" #else #define RESOURCE_FOLDER "NYUCodebase.app/Contents/Resources/" #endif SDL_Window* displayWindow; GLuint LoadTexture(const char *filePath) { int w, h, comp; unsigned char* image = stbi_load(filePath, &w, &h, &comp, STBI_rgb_alpha); if (image == NULL) { std::cout << "Unable to load image. Make sure the path is correct\n"; assert(false); } GLuint retTexture; glGenTextures(1, &retTexture); glBindTexture(GL_TEXTURE_2D, retTexture); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, image); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); stbi_image_free(image); return retTexture; } int main(int argc, char *argv[]) { SDL_Init(SDL_INIT_VIDEO); displayWindow = SDL_CreateWindow("My Game", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 640, 360, SDL_WINDOW_OPENGL); SDL_GLContext context = SDL_GL_CreateContext(displayWindow); SDL_GL_MakeCurrent(displayWindow, context); #ifdef _WINDOWS glewInit(); #endif glViewport(0, 0, 640, 360); ShaderProgram program; program.Load(RESOURCE_FOLDER"vertex_textured.glsl", RESOURCE_FOLDER"fragment_textured.glsl"); GLuint cardBackTexture = LoadTexture(RESOURCE_FOLDER"cardBack_blue1.png"); glm::mat4 projectionMatrix = glm::mat4(1.0f); glm::mat4 viewMatrix = glm::mat4(1.0f); glm::mat4 modelMatrix = glm::mat4(1.0f); float angle1 = -0.1f * (3.1415926f / 180.0f); glm::mat4 modelMatrix1 = glm::rotate(modelMatrix, angle1, glm::vec3(0.0f, 0.0f, 1.0f)); projectionMatrix = glm::ortho(-1.777f, 1.777f, -1.0f, 1.0f, -1.0f, 1.0f); glUseProgram(program.programID); // ShaderProgram program2; program2.Load(RESOURCE_FOLDER"vertex_textured.glsl", RESOURCE_FOLDER"fragment_textured.glsl"); GLuint blackPieceTexture = LoadTexture(RESOURCE_FOLDER"pieceBlack_single01.png"); float angle2 = 0.1f * (3.1415926f / 180.0f); glm::mat4 modelMatrix2 = glm::rotate(modelMatrix, angle2, glm::vec3(0.0f, 0.0f, 1.0f)); glUseProgram(program2.programID); // glm::mat4 modelMatrix3 = glm::mat4(1.0f); modelMatrix3 = glm::scale(modelMatrix3, glm::vec3(0.25f, 0.25f, 1.0f)); modelMatrix3 = glm::translate(modelMatrix3, glm::vec3(4.0f, 0.0f, 1.0f)); ShaderProgram program3; program3.Load(RESOURCE_FOLDER"vertex_textured.glsl", RESOURCE_FOLDER"fragment_textured.glsl"); GLuint alienPinkTexture = LoadTexture(RESOURCE_FOLDER"alienPink_round.png"); glUseProgram(program3.programID); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); SDL_Event event; bool done = false; while (!done) { while (SDL_PollEvent(&event)) { if (event.type == SDL_QUIT || event.type == SDL_WINDOWEVENT_CLOSE) { done = true; } } glClear(GL_COLOR_BUFFER_BIT); modelMatrix1 = glm::rotate(modelMatrix1, angle1, glm::vec3(0.0f, 0.0f, 1.0f)); program.SetModelMatrix(modelMatrix1); program.SetProjectionMatrix(projectionMatrix); program.SetViewMatrix(viewMatrix); glBindTexture(GL_TEXTURE_2D, cardBackTexture); float vertices[] = { -0.5, -0.5, 0.5, -0.5, 0.5, 0.5, -0.5, -0.5, 0.5, 0.5, -0.5, 0.5 }; glVertexAttribPointer(program.positionAttribute, 2, GL_FLOAT, false, 0, vertices); glEnableVertexAttribArray(program.positionAttribute); float texCoords[] = { 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0 }; glVertexAttribPointer(program.texCoordAttribute, 2, GL_FLOAT, false, 0, texCoords); glEnableVertexAttribArray(program.texCoordAttribute); glDrawArrays(GL_TRIANGLES, 0, 6); glDisableVertexAttribArray(program.positionAttribute); glDisableVertexAttribArray(program.texCoordAttribute); // modelMatrix2 = glm::rotate(modelMatrix2, angle2, glm::vec3(0.0f, 0.0f, 1.0f)); program2.SetModelMatrix(modelMatrix2); program2.SetProjectionMatrix(projectionMatrix); program2.SetViewMatrix(viewMatrix); glBindTexture(GL_TEXTURE_2D, blackPieceTexture); float vertices2[] = { -0.5, -0.5, 0.5, -0.5, 0.5, 0.5, -0.5, -0.5, 0.5, 0.5, -0.5, 0.5 }; glVertexAttribPointer(program2.positionAttribute, 2, GL_FLOAT, false, 0, vertices2); glEnableVertexAttribArray(program2.positionAttribute); float texCoords2[] = { 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0 }; glVertexAttribPointer(program2.texCoordAttribute, 2, GL_FLOAT, false, 0, texCoords2); glEnableVertexAttribArray(program2.texCoordAttribute); glDrawArrays(GL_TRIANGLES, 0, 6); glDisableVertexAttribArray(program2.positionAttribute); glDisableVertexAttribArray(program2.texCoordAttribute); // program3.SetModelMatrix(modelMatrix3); program3.SetProjectionMatrix(projectionMatrix); program3.SetViewMatrix(viewMatrix); glBindTexture(GL_TEXTURE_2D, alienPinkTexture); float vertices3[] = { -0.5, -0.5, 0.5, -0.5, 0.5, 0.5, -0.5, -0.5, 0.5, 0.5, -0.5, 0.5 }; glVertexAttribPointer(program3.positionAttribute, 2, GL_FLOAT, false, 0, vertices2); glEnableVertexAttribArray(program3.positionAttribute); float texCoords3[] = { 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0 }; glVertexAttribPointer(program3.texCoordAttribute, 2, GL_FLOAT, false, 0, texCoords2); glEnableVertexAttribArray(program3.texCoordAttribute); glDrawArrays(GL_TRIANGLES, 0, 6); glDisableVertexAttribArray(program3.positionAttribute); glDisableVertexAttribArray(program3.texCoordAttribute); SDL_GL_SwapWindow(displayWindow); } SDL_Quit(); return 0; }
8ae37e17b6155ed7f940f02e9d5d77658e880ef6
ac72cd7decbf36d121e113ff251715c23405e104
/platform/RemotingNG/include/Poco/RemotingNG/Transport.h
f7f2f8bb808fcb112f4fd674187502f1136be964
[ "Apache-2.0" ]
permissive
lcding/macchina.io
736722659d37aa8f6632c899fe9ec426bcbb5227
0e17814175a25d7732740e7cd172b7dfc27f1716
refs/heads/develop
2021-01-11T01:01:46.087855
2016-10-08T20:30:52
2016-10-08T20:30:52
70,465,903
1
0
null
2016-10-10T08:08:36
2016-10-10T08:08:35
null
UTF-8
C++
false
false
6,935
h
// // Transport.h // // $Id: //poco/1.7/RemotingNG/include/Poco/RemotingNG/Transport.h#1 $ // // Library: RemotingNG // Package: Transport // Module: Transport // // Definition of the Transport class. // // Copyright (c) 2006-2014, Applied Informatics Software Engineering GmbH. // All rights reserved. // // SPDX-License-Identifier: Apache-2.0 // #ifndef RemotingNG_Transport_INCLUDED #define RemotingNG_Transport_INCLUDED #include "Poco/RemotingNG/RemotingNG.h" #include "Poco/RemotingNG/AttributedObject.h" #include "Poco/RemotingNG/Identifiable.h" #include "Poco/RemotingNG/SerializerBase.h" #include "Poco/RefCountedObject.h" #include "Poco/AutoPtr.h" #include "Poco/Mutex.h" #include <map> namespace Poco { namespace RemotingNG { class Serializer; class Deserializer; class RemotingNG_API Transport: public AttributedObject, public Poco::RefCountedObject /// Transport objects are responsible for setting up and maintaining a /// network (or other kind of) connection between Proxy objects on the /// client side and Listener objects on the server side, and for exchanging /// messages over that connection. /// /// A Transport object also maintains Serializer and Deserializer objects. /// /// Transport objects must support two message exchange patterns (MEP): /// - One-Way: a message is sent from the client to the server and the client /// does not expect to receive a reply from the server. With this pattern, /// the server has no way to provide status information back to the client, /// and the client has no way to know whether the call was successful. /// - Request-Reply: a message is sent from the client to the server and /// the client expects to receive a reply from the server. The reply may /// be a regular reply containing a return value and/or output parameters, /// or it may be a fault message, reporting an exception to the client. /// /// Provided a Transport object is already connected, sending a one-way /// message is a three-step process: /// 1. A new one-way message is started with a call to beginMessage(). This will /// prepare the Transport to deliver a one-way message to the server, as well /// as setting up a Serializer for creating the one-way message. /// 2. The Serializer returned by beginMessage() is used to compose /// the actual message. /// 3. The one-way message is delivered to the server with a /// call to sendMessage(). This completes the message exchange. /// /// Doing a request-reply message exchange is a five-step process. /// 1. A new request message is started with a call to beginRequest(). This will /// prepare the Transport to deliver a request message, as well as /// setting up a Serializer for creating the request message. /// 2. The Serializer returned by beginRequest() is used to compose /// the actual message. /// 3. The request is delivered to the server with a call to /// sendRequest(). After delivering the request, sendRequest() will /// wait for a reply from the server, and set up a Deserializer /// for reading the reply. /// 4. The reply message is read using the Deserializer returned /// by sendRequest(). /// 5. A call to endRequest() ends the message exchange. /// /// Transport objects must be able to deal with incomplete message /// exchange sequences. For example, if an exception occurs between /// a call to beginRequest() and the corresponding call to sendRequest(), /// sendRequest() and endRequest() will not be called for this exchange. /// When beginRequest() or beginMessage() is called the next time, it /// must do the necessary cleanup to reset the Transport object to a /// well-defined state. { public: typedef Poco::AutoPtr<Transport> Ptr; typedef std::map<std::string,std::string> NameValueMap; Transport(); /// Creates a Transport. virtual ~Transport(); /// Destroys the Transport. virtual const std::string& endPoint() const = 0; /// Returns the endpoint to which this Transport is connected. /// If not connected, an empty string will be returned. virtual void connect(const std::string& endPoint) = 0; /// Connects the transport to the given endpoint. /// /// The format of the endpoint is specific to the Transport. /// Some Transport implementations may accept a complete URI as endpoint. virtual void disconnect() = 0; /// Disconnects the transport. virtual bool connected() const = 0; /// Returns true iff the Transport is connected to a Listener, false otherwise. virtual Serializer& beginMessage(const Identifiable::ObjectId& oid, const Identifiable::TypeId& tid, const std::string& messageName, SerializerBase::MessageType messageType) = 0; /// Prepare a one-way message and set up a Serializer for writing the request. /// /// The messageType should be MESSAGE_REQUEST or MESSAGE_EVENT. Whether this is checked /// is up to the actual implementation. /// /// Returns a Serializer for composing the message. /// /// No response message will be sent back for a one-way request. virtual void sendMessage(const Identifiable::ObjectId& oid, const Identifiable::TypeId& tid, const std::string& messageName, SerializerBase::MessageType messageType) = 0; /// Deliver the one-way message to the server and complete the message exchange. /// /// All parameters must have the same value as the parameters passed to beginMessage(). /// If not, the behavior is undefined. virtual Serializer& beginRequest(const Identifiable::ObjectId& oid, const Identifiable::TypeId& tid, const std::string& messageName, SerializerBase::MessageType messageType) = 0; /// Prepare a two-way (request - reply) message exchange and set up a Serializer for writing the request. /// /// The messageType should be MESSAGE_REQUEST or MESSAGE_EVENT. Whether this is checked /// is up to the actual implementation. /// /// Returns a Serializer for composing the request message. virtual Deserializer& sendRequest(const Identifiable::ObjectId& oid, const Identifiable::TypeId& tid, const std::string& messageName, SerializerBase::MessageType messageType) = 0; /// Deliver the request message to the server, wait for a response and prepare a Deserializer for reading the reply. /// /// All parameters must have the same value as the parameters passed to beginRequest(). /// If not, the behavior is undefined. /// /// Returns a Deserializer for reading the reply message. virtual void endRequest() = 0; /// Ends a request - reply message exchange. void lock(); /// Locks the Transport's mutex. void unlock(); /// Unlocks the Transport's mutex. private: Poco::FastMutex _mutex; }; // // inlines // inline void Transport::lock() { _mutex.lock(); } inline void Transport::unlock() { _mutex.unlock(); } } } // namespace Poco::RemotingNG #endif // RemotingNG_Transport_INCLUDED
2e640e13eb985d3207e12617cb151e604feb2456
9f10b911d8d474193f493dba28f7635aed5e7abf
/AtCoder/abc121_d_5681669.cpp
cb316d8c9f04badd34cccad206a6f2afc45b4331
[]
no_license
xryuseix/SecHack365-Dataset
f981a2cb5571a7b6f4092e32e18d999aeb6d905e
6f5b96f05dd7beb131d74adfa1f3caa7b7fcc0c3
refs/heads/master
2023-01-18T21:48:41.452468
2020-11-20T08:32:59
2020-11-20T08:32:59
304,354,709
0
0
null
null
null
null
UTF-8
C++
false
false
1,902
cpp
/* 引用元:https://atcoder.jp/contests/abc121/tasks/abc121_d D - XOR WorldEditorial // ソースコードの引用元 : https://atcoder.jp/contests/abc121/submissions/5681669 // 提出ID : 5681669 // 問題ID : abc121_d // コンテストID : abc121 // ユーザID : xryuseix // コード長 : 1458 // 実行時間 : 1 */ #include <iostream> #include <cstdio> #include <algorithm> #include <cmath> #include <string> #include <vector> #include <list> #include <set> #include <map> #include <queue> #include <stack> #include <cctype> #include <climits> #include <bitset> #define ld long double #define ll long long int #define ull unsigned long long int #define rep(i, n) for (i = 0; i < n; i++) #define fin(ans) cout << (ans) << endl #define INF INT_MAX #define vi vector<int> #define vc vector<char> #define vs vector<string> #define vpii vector<pair<int, int>> #define vvi vector<vector<int>> #define vvc vector<vector<char>> #define vvs vector<vector<string>> #define P 1000000007 using namespace std; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } const long long LLINF = 1LL << 60; // set<int>::iterator it; int main(void) { ios::sync_with_stdio(false); cin.tie(0); ////////////////////////////////////////////////////// ll a, b, i, ans; cin >> a >> b; ans = 0; if (a % 2 == 0) { if (b % 2 == 0) { cout << (b ^ ((max(b - a, (ll)0) + 1) / 2 % 2)) << endl; } else { cout << ((max(b - a, (ll)0) + 1) / 2 % 2) << endl; } } else { if (b % 2 == 0) { cout << (a ^ b ^ ((max(b - a - 1, (ll)0) + 1) / 2 % 2)) << endl; } else { cout << (a ^ (max(b - a - 1, (ll)0) + 1) / 2 % 2) << endl; } } ////////////////////////////////////////////////////// return 0; }
dea30480b0c437ccc113a85ba42ab97f6dda148a
c1626152963432aa221a4a9b0e4767a4608a51f7
/src/boost/regex/v5/basic_regex_parser.hpp
9e233fc41a0343c4388b71ad7f21b254f7c72679
[ "MIT" ]
permissive
107-systems/107-Arduino-BoostUnits
d2bffefc2787e99173797c9a89d47961718f9b03
f1a4dfa7bf2af78c422bf10ba0c30e2a703cb69b
refs/heads/main
2023-09-06T03:46:02.903776
2023-09-05T09:32:35
2023-09-05T09:32:35
401,328,494
0
0
MIT
2023-09-05T09:32:37
2021-08-30T12:03:20
C++
UTF-8
C++
false
false
111,825
hpp
/* * * Copyright (c) 2004 * John Maddock * * Use, modification and distribution are subject to 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) * */ /* * LOCATION: see http://www.boost.org for most recent version. * FILE basic_regex_parser.cpp * VERSION see "boost/version.hpp" * DESCRIPTION: Declares template class basic_regex_parser. */ #ifndef BOOST_REGEX_V5_BASIC_REGEX_PARSER_HPP #define BOOST_REGEX_V5_BASIC_REGEX_PARSER_HPP namespace boost{ namespace BOOST_REGEX_DETAIL_NS{ #ifdef BOOST_REGEX_MSVC #pragma warning(push) #pragma warning(disable:4244 4459) #if BOOST_REGEX_MSVC < 1910 #pragma warning(disable:4800) #endif #endif inline std::intmax_t umax(std::integral_constant<bool, false> const&) { // Get out clause here, just in case numeric_limits is unspecialized: return std::numeric_limits<std::intmax_t>::is_specialized ? (std::numeric_limits<std::intmax_t>::max)() : INT_MAX; } inline std::intmax_t umax(std::integral_constant<bool, true> const&) { return (std::numeric_limits<std::size_t>::max)(); } inline std::intmax_t umax() { return umax(std::integral_constant<bool, std::numeric_limits<std::intmax_t>::digits >= std::numeric_limits<std::size_t>::digits>()); } template <class charT, class traits> class basic_regex_parser : public basic_regex_creator<charT, traits> { public: basic_regex_parser(regex_data<charT, traits>* data); void parse(const charT* p1, const charT* p2, unsigned flags); void fail(regex_constants::error_type error_code, std::ptrdiff_t position); void fail(regex_constants::error_type error_code, std::ptrdiff_t position, std::string message, std::ptrdiff_t start_pos); void fail(regex_constants::error_type error_code, std::ptrdiff_t position, const std::string& message) { fail(error_code, position, message, position); } bool parse_all(); bool parse_basic(); bool parse_extended(); bool parse_literal(); bool parse_open_paren(); bool parse_basic_escape(); bool parse_extended_escape(); bool parse_match_any(); bool parse_repeat(std::size_t low = 0, std::size_t high = (std::numeric_limits<std::size_t>::max)()); bool parse_repeat_range(bool isbasic); bool parse_alt(); bool parse_set(); bool parse_backref(); void parse_set_literal(basic_char_set<charT, traits>& char_set); bool parse_inner_set(basic_char_set<charT, traits>& char_set); bool parse_QE(); bool parse_perl_extension(); bool parse_perl_verb(); bool match_verb(const char*); bool add_emacs_code(bool negate); bool unwind_alts(std::ptrdiff_t last_paren_start); digraph<charT> get_next_set_literal(basic_char_set<charT, traits>& char_set); charT unescape_character(); regex_constants::syntax_option_type parse_options(); private: typedef bool (basic_regex_parser::*parser_proc_type)(); typedef typename traits::string_type string_type; typedef typename traits::char_class_type char_class_type; parser_proc_type m_parser_proc; // the main parser to use const charT* m_base; // the start of the string being parsed const charT* m_end; // the end of the string being parsed const charT* m_position; // our current parser position unsigned m_mark_count; // how many sub-expressions we have int m_mark_reset; // used to indicate that we're inside a (?|...) block. unsigned m_max_mark; // largest mark count seen inside a (?|...) block. std::ptrdiff_t m_paren_start; // where the last seen ')' began (where repeats are inserted). std::ptrdiff_t m_alt_insert_point; // where to insert the next alternative bool m_has_case_change; // true if somewhere in the current block the case has changed unsigned m_recursion_count; // How many times we've called parse_all. #if defined(BOOST_REGEX_MSVC) && defined(_M_IX86) // This is an ugly warning suppression workaround (for warnings *inside* std::vector // that can not otherwise be suppressed)... static_assert(sizeof(long) >= sizeof(void*), "Long isn't long enough!"); std::vector<long> m_alt_jumps; // list of alternative in the current scope. #else std::vector<std::ptrdiff_t> m_alt_jumps; // list of alternative in the current scope. #endif basic_regex_parser& operator=(const basic_regex_parser&); basic_regex_parser(const basic_regex_parser&); }; template <class charT, class traits> basic_regex_parser<charT, traits>::basic_regex_parser(regex_data<charT, traits>* data) : basic_regex_creator<charT, traits>(data), m_parser_proc(), m_base(0), m_end(0), m_position(0), m_mark_count(0), m_mark_reset(-1), m_max_mark(0), m_paren_start(0), m_alt_insert_point(0), m_has_case_change(false), m_recursion_count(0) { } template <class charT, class traits> void basic_regex_parser<charT, traits>::parse(const charT* p1, const charT* p2, unsigned l_flags) { // pass l_flags on to base class: this->init(l_flags); // set up pointers: m_position = m_base = p1; m_end = p2; // empty strings are errors: if((p1 == p2) && ( ((l_flags & regbase::main_option_type) != regbase::perl_syntax_group) || (l_flags & regbase::no_empty_expressions) ) ) { fail(regex_constants::error_empty, 0); return; } // select which parser to use: switch(l_flags & regbase::main_option_type) { case regbase::perl_syntax_group: { m_parser_proc = &basic_regex_parser<charT, traits>::parse_extended; // // Add a leading paren with index zero to give recursions a target: // re_brace* br = static_cast<re_brace*>(this->append_state(syntax_element_startmark, sizeof(re_brace))); br->index = 0; br->icase = this->flags() & regbase::icase; break; } case regbase::basic_syntax_group: m_parser_proc = &basic_regex_parser<charT, traits>::parse_basic; break; case regbase::literal: m_parser_proc = &basic_regex_parser<charT, traits>::parse_literal; break; default: // Oops, someone has managed to set more than one of the main option flags, // so this must be an error: fail(regex_constants::error_unknown, 0, "An invalid combination of regular expression syntax flags was used."); return; } // parse all our characters: bool result = parse_all(); // // Unwind our alternatives: // unwind_alts(-1); // reset l_flags as a global scope (?imsx) may have altered them: this->flags(l_flags); // if we haven't gobbled up all the characters then we must // have had an unexpected ')' : if(!result) { fail(regex_constants::error_paren, std::distance(m_base, m_position), "Found a closing ) with no corresponding opening parenthesis."); return; } // if an error has been set then give up now: if(this->m_pdata->m_status) return; // fill in our sub-expression count: this->m_pdata->m_mark_count = 1u + (std::size_t)m_mark_count; this->finalize(p1, p2); } template <class charT, class traits> void basic_regex_parser<charT, traits>::fail(regex_constants::error_type error_code, std::ptrdiff_t position) { // get the error message: std::string message = this->m_pdata->m_ptraits->error_string(error_code); fail(error_code, position, message); } template <class charT, class traits> void basic_regex_parser<charT, traits>::fail(regex_constants::error_type error_code, std::ptrdiff_t position, std::string message, std::ptrdiff_t start_pos) { if(0 == this->m_pdata->m_status) // update the error code if not already set this->m_pdata->m_status = error_code; m_position = m_end; // don't bother parsing anything else // // Augment error message with the regular expression text: // if(start_pos == position) start_pos = (std::max)(static_cast<std::ptrdiff_t>(0), position - static_cast<std::ptrdiff_t>(10)); std::ptrdiff_t end_pos = (std::min)(position + static_cast<std::ptrdiff_t>(10), static_cast<std::ptrdiff_t>(m_end - m_base)); if(error_code != regex_constants::error_empty) { if((start_pos != 0) || (end_pos != (m_end - m_base))) message += " The error occurred while parsing the regular expression fragment: '"; else message += " The error occurred while parsing the regular expression: '"; if(start_pos != end_pos) { message += std::string(m_base + start_pos, m_base + position); message += ">>>HERE>>>"; message += std::string(m_base + position, m_base + end_pos); } message += "'."; } #ifndef BOOST_NO_EXCEPTIONS if(0 == (this->flags() & regex_constants::no_except)) { boost::regex_error e(message, error_code, position); e.raise(); } #else (void)position; // suppress warnings. #endif } template <class charT, class traits> bool basic_regex_parser<charT, traits>::parse_all() { if (++m_recursion_count > 400) { // exceeded internal limits fail(boost::regex_constants::error_complexity, m_position - m_base, "Exceeded nested brace limit."); } bool result = true; while(result && (m_position != m_end)) { result = (this->*m_parser_proc)(); } --m_recursion_count; return result; } #ifdef BOOST_REGEX_MSVC #pragma warning(push) #pragma warning(disable:4702) #endif template <class charT, class traits> bool basic_regex_parser<charT, traits>::parse_basic() { switch(this->m_traits.syntax_type(*m_position)) { case regex_constants::syntax_escape: return parse_basic_escape(); case regex_constants::syntax_dot: return parse_match_any(); case regex_constants::syntax_caret: ++m_position; this->append_state(syntax_element_start_line); break; case regex_constants::syntax_dollar: ++m_position; this->append_state(syntax_element_end_line); break; case regex_constants::syntax_star: if(!(this->m_last_state) || (this->m_last_state->type == syntax_element_start_line)) return parse_literal(); else { ++m_position; return parse_repeat(); } case regex_constants::syntax_plus: if(!(this->m_last_state) || (this->m_last_state->type == syntax_element_start_line) || !(this->flags() & regbase::emacs_ex)) return parse_literal(); else { ++m_position; return parse_repeat(1); } case regex_constants::syntax_question: if(!(this->m_last_state) || (this->m_last_state->type == syntax_element_start_line) || !(this->flags() & regbase::emacs_ex)) return parse_literal(); else { ++m_position; return parse_repeat(0, 1); } case regex_constants::syntax_open_set: return parse_set(); case regex_constants::syntax_newline: if(this->flags() & regbase::newline_alt) return parse_alt(); else return parse_literal(); default: return parse_literal(); } return true; } #ifdef BOOST_REGEX_MSVC # pragma warning(push) #if BOOST_REGEX_MSVC >= 1800 #pragma warning(disable:26812) #endif #endif template <class charT, class traits> bool basic_regex_parser<charT, traits>::parse_extended() { bool result = true; switch(this->m_traits.syntax_type(*m_position)) { case regex_constants::syntax_open_mark: return parse_open_paren(); case regex_constants::syntax_close_mark: return false; case regex_constants::syntax_escape: return parse_extended_escape(); case regex_constants::syntax_dot: return parse_match_any(); case regex_constants::syntax_caret: ++m_position; this->append_state( (this->flags() & regex_constants::no_mod_m ? syntax_element_buffer_start : syntax_element_start_line)); break; case regex_constants::syntax_dollar: ++m_position; this->append_state( (this->flags() & regex_constants::no_mod_m ? syntax_element_buffer_end : syntax_element_end_line)); break; case regex_constants::syntax_star: if(m_position == this->m_base) { fail(regex_constants::error_badrepeat, 0, "The repeat operator \"*\" cannot start a regular expression."); return false; } ++m_position; return parse_repeat(); case regex_constants::syntax_question: if(m_position == this->m_base) { fail(regex_constants::error_badrepeat, 0, "The repeat operator \"?\" cannot start a regular expression."); return false; } ++m_position; return parse_repeat(0,1); case regex_constants::syntax_plus: if(m_position == this->m_base) { fail(regex_constants::error_badrepeat, 0, "The repeat operator \"+\" cannot start a regular expression."); return false; } ++m_position; return parse_repeat(1); case regex_constants::syntax_open_brace: ++m_position; return parse_repeat_range(false); case regex_constants::syntax_close_brace: if((this->flags() & regbase::no_perl_ex) == regbase::no_perl_ex) { fail(regex_constants::error_brace, this->m_position - this->m_base, "Found a closing repetition operator } with no corresponding {."); return false; } result = parse_literal(); break; case regex_constants::syntax_or: return parse_alt(); case regex_constants::syntax_open_set: return parse_set(); case regex_constants::syntax_newline: if(this->flags() & regbase::newline_alt) return parse_alt(); else return parse_literal(); case regex_constants::syntax_hash: // // If we have a mod_x flag set, then skip until // we get to a newline character: // if((this->flags() & (regbase::no_perl_ex|regbase::mod_x)) == regbase::mod_x) { while((m_position != m_end) && !is_separator(*m_position++)){} return true; } BOOST_REGEX_FALLTHROUGH; default: result = parse_literal(); break; } return result; } #ifdef BOOST_REGEX_MSVC # pragma warning(pop) #endif #ifdef BOOST_REGEX_MSVC #pragma warning(pop) #endif template <class charT, class traits> bool basic_regex_parser<charT, traits>::parse_literal() { // append this as a literal provided it's not a space character // or the perl option regbase::mod_x is not set: if( ((this->flags() & (regbase::main_option_type|regbase::mod_x|regbase::no_perl_ex)) != regbase::mod_x) || !this->m_traits.isctype(*m_position, this->m_mask_space)) this->append_literal(*m_position); ++m_position; return true; } template <class charT, class traits> bool basic_regex_parser<charT, traits>::parse_open_paren() { // // skip the '(' and error check: // if(++m_position == m_end) { fail(regex_constants::error_paren, m_position - m_base); return false; } // // begin by checking for a perl-style (?...) extension: // if( ((this->flags() & (regbase::main_option_type | regbase::no_perl_ex)) == 0) || ((this->flags() & (regbase::main_option_type | regbase::emacs_ex)) == (regbase::basic_syntax_group|regbase::emacs_ex)) ) { if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_question) return parse_perl_extension(); if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_star) return parse_perl_verb(); } // // update our mark count, and append the required state: // unsigned markid = 0; if(0 == (this->flags() & regbase::nosubs)) { markid = ++m_mark_count; if(this->flags() & regbase::save_subexpression_location) this->m_pdata->m_subs.push_back(std::pair<std::size_t, std::size_t>(std::distance(m_base, m_position) - 1, 0)); } re_brace* pb = static_cast<re_brace*>(this->append_state(syntax_element_startmark, sizeof(re_brace))); pb->index = markid; pb->icase = this->flags() & regbase::icase; std::ptrdiff_t last_paren_start = this->getoffset(pb); // back up insertion point for alternations, and set new point: std::ptrdiff_t last_alt_point = m_alt_insert_point; this->m_pdata->m_data.align(); m_alt_insert_point = this->m_pdata->m_data.size(); // // back up the current flags in case we have a nested (?imsx) group: // regex_constants::syntax_option_type opts = this->flags(); bool old_case_change = m_has_case_change; m_has_case_change = false; // no changes to this scope as yet... // // Back up branch reset data in case we have a nested (?|...) // int mark_reset = m_mark_reset; m_mark_reset = -1; // // now recursively add more states, this will terminate when we get to a // matching ')' : // parse_all(); // // Unwind pushed alternatives: // if(0 == unwind_alts(last_paren_start)) return false; // // restore flags: // if(m_has_case_change) { // the case has changed in one or more of the alternatives // within the scoped (...) block: we have to add a state // to reset the case sensitivity: static_cast<re_case*>( this->append_state(syntax_element_toggle_case, sizeof(re_case)) )->icase = opts & regbase::icase; } this->flags(opts); m_has_case_change = old_case_change; // // restore branch reset: // m_mark_reset = mark_reset; // // we either have a ')' or we have run out of characters prematurely: // if(m_position == m_end) { this->fail(regex_constants::error_paren, std::distance(m_base, m_end)); return false; } if(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_mark) return false; if(markid && (this->flags() & regbase::save_subexpression_location)) this->m_pdata->m_subs.at(markid - 1).second = std::distance(m_base, m_position); ++m_position; // // append closing parenthesis state: // pb = static_cast<re_brace*>(this->append_state(syntax_element_endmark, sizeof(re_brace))); pb->index = markid; pb->icase = this->flags() & regbase::icase; this->m_paren_start = last_paren_start; // // restore the alternate insertion point: // this->m_alt_insert_point = last_alt_point; // // allow backrefs to this mark: // if(markid > 0) this->m_backrefs.set(markid); return true; } template <class charT, class traits> bool basic_regex_parser<charT, traits>::parse_basic_escape() { if(++m_position == m_end) { fail(regex_constants::error_paren, m_position - m_base); return false; } bool result = true; switch(this->m_traits.escape_syntax_type(*m_position)) { case regex_constants::syntax_open_mark: return parse_open_paren(); case regex_constants::syntax_close_mark: return false; case regex_constants::syntax_plus: if(this->flags() & regex_constants::bk_plus_qm) { ++m_position; return parse_repeat(1); } else return parse_literal(); case regex_constants::syntax_question: if(this->flags() & regex_constants::bk_plus_qm) { ++m_position; return parse_repeat(0, 1); } else return parse_literal(); case regex_constants::syntax_open_brace: if(this->flags() & regbase::no_intervals) return parse_literal(); ++m_position; return parse_repeat_range(true); case regex_constants::syntax_close_brace: if(this->flags() & regbase::no_intervals) return parse_literal(); fail(regex_constants::error_brace, this->m_position - this->m_base, "Found a closing repetition operator } with no corresponding {."); return false; case regex_constants::syntax_or: if(this->flags() & regbase::bk_vbar) return parse_alt(); else result = parse_literal(); break; case regex_constants::syntax_digit: return parse_backref(); case regex_constants::escape_type_start_buffer: if(this->flags() & regbase::emacs_ex) { ++m_position; this->append_state(syntax_element_buffer_start); } else result = parse_literal(); break; case regex_constants::escape_type_end_buffer: if(this->flags() & regbase::emacs_ex) { ++m_position; this->append_state(syntax_element_buffer_end); } else result = parse_literal(); break; case regex_constants::escape_type_word_assert: if(this->flags() & regbase::emacs_ex) { ++m_position; this->append_state(syntax_element_word_boundary); } else result = parse_literal(); break; case regex_constants::escape_type_not_word_assert: if(this->flags() & regbase::emacs_ex) { ++m_position; this->append_state(syntax_element_within_word); } else result = parse_literal(); break; case regex_constants::escape_type_left_word: if(this->flags() & regbase::emacs_ex) { ++m_position; this->append_state(syntax_element_word_start); } else result = parse_literal(); break; case regex_constants::escape_type_right_word: if(this->flags() & regbase::emacs_ex) { ++m_position; this->append_state(syntax_element_word_end); } else result = parse_literal(); break; default: if(this->flags() & regbase::emacs_ex) { bool negate = true; switch(*m_position) { case 'w': negate = false; BOOST_REGEX_FALLTHROUGH; case 'W': { basic_char_set<charT, traits> char_set; if(negate) char_set.negate(); char_set.add_class(this->m_word_mask); if(0 == this->append_set(char_set)) { fail(regex_constants::error_ctype, m_position - m_base); return false; } ++m_position; return true; } case 's': negate = false; BOOST_REGEX_FALLTHROUGH; case 'S': return add_emacs_code(negate); case 'c': case 'C': // not supported yet: fail(regex_constants::error_escape, m_position - m_base, "The \\c and \\C escape sequences are not supported by POSIX basic regular expressions: try the Perl syntax instead."); return false; default: break; } } result = parse_literal(); break; } return result; } template <class charT, class traits> bool basic_regex_parser<charT, traits>::parse_extended_escape() { ++m_position; if(m_position == m_end) { fail(regex_constants::error_escape, m_position - m_base, "Incomplete escape sequence found."); return false; } bool negate = false; // in case this is a character class escape: \w \d etc switch(this->m_traits.escape_syntax_type(*m_position)) { case regex_constants::escape_type_not_class: negate = true; BOOST_REGEX_FALLTHROUGH; case regex_constants::escape_type_class: { escape_type_class_jump: typedef typename traits::char_class_type m_type; m_type m = this->m_traits.lookup_classname(m_position, m_position+1); if(m != 0) { basic_char_set<charT, traits> char_set; if(negate) char_set.negate(); char_set.add_class(m); if(0 == this->append_set(char_set)) { fail(regex_constants::error_ctype, m_position - m_base); return false; } ++m_position; return true; } // // not a class, just a regular unknown escape: // this->append_literal(unescape_character()); break; } case regex_constants::syntax_digit: return parse_backref(); case regex_constants::escape_type_left_word: ++m_position; this->append_state(syntax_element_word_start); break; case regex_constants::escape_type_right_word: ++m_position; this->append_state(syntax_element_word_end); break; case regex_constants::escape_type_start_buffer: ++m_position; this->append_state(syntax_element_buffer_start); break; case regex_constants::escape_type_end_buffer: ++m_position; this->append_state(syntax_element_buffer_end); break; case regex_constants::escape_type_word_assert: ++m_position; this->append_state(syntax_element_word_boundary); break; case regex_constants::escape_type_not_word_assert: ++m_position; this->append_state(syntax_element_within_word); break; case regex_constants::escape_type_Z: ++m_position; this->append_state(syntax_element_soft_buffer_end); break; case regex_constants::escape_type_Q: return parse_QE(); case regex_constants::escape_type_C: return parse_match_any(); case regex_constants::escape_type_X: ++m_position; this->append_state(syntax_element_combining); break; case regex_constants::escape_type_G: ++m_position; this->append_state(syntax_element_restart_continue); break; case regex_constants::escape_type_not_property: negate = true; BOOST_REGEX_FALLTHROUGH; case regex_constants::escape_type_property: { ++m_position; char_class_type m; if(m_position == m_end) { fail(regex_constants::error_escape, m_position - m_base, "Incomplete property escape found."); return false; } // maybe have \p{ddd} if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_open_brace) { const charT* base = m_position; // skip forward until we find enclosing brace: while((m_position != m_end) && (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_brace)) ++m_position; if(m_position == m_end) { fail(regex_constants::error_escape, m_position - m_base, "Closing } missing from property escape sequence."); return false; } m = this->m_traits.lookup_classname(++base, m_position++); } else { m = this->m_traits.lookup_classname(m_position, m_position+1); ++m_position; } if(m != 0) { basic_char_set<charT, traits> char_set; if(negate) char_set.negate(); char_set.add_class(m); if(0 == this->append_set(char_set)) { fail(regex_constants::error_ctype, m_position - m_base); return false; } return true; } fail(regex_constants::error_ctype, m_position - m_base, "Escape sequence was neither a valid property nor a valid character class name."); return false; } case regex_constants::escape_type_reset_start_mark: if(0 == (this->flags() & (regbase::main_option_type | regbase::no_perl_ex))) { re_brace* pb = static_cast<re_brace*>(this->append_state(syntax_element_startmark, sizeof(re_brace))); pb->index = -5; pb->icase = this->flags() & regbase::icase; this->m_pdata->m_data.align(); ++m_position; return true; } goto escape_type_class_jump; case regex_constants::escape_type_line_ending: if(0 == (this->flags() & (regbase::main_option_type | regbase::no_perl_ex))) { const charT* e = get_escape_R_string<charT>(); const charT* old_position = m_position; const charT* old_end = m_end; const charT* old_base = m_base; m_position = e; m_base = e; m_end = e + traits::length(e); bool r = parse_all(); m_position = ++old_position; m_end = old_end; m_base = old_base; return r; } goto escape_type_class_jump; case regex_constants::escape_type_extended_backref: if(0 == (this->flags() & (regbase::main_option_type | regbase::no_perl_ex))) { bool have_brace = false; bool negative = false; static const char incomplete_message[] = "Incomplete \\g escape found."; if(++m_position == m_end) { fail(regex_constants::error_escape, m_position - m_base, incomplete_message); return false; } // maybe have \g{ddd} regex_constants::syntax_type syn = this->m_traits.syntax_type(*m_position); regex_constants::syntax_type syn_end = 0; if((syn == regex_constants::syntax_open_brace) || (syn == regex_constants::escape_type_left_word) || (syn == regex_constants::escape_type_end_buffer)) { if(++m_position == m_end) { fail(regex_constants::error_escape, m_position - m_base, incomplete_message); return false; } have_brace = true; switch(syn) { case regex_constants::syntax_open_brace: syn_end = regex_constants::syntax_close_brace; break; case regex_constants::escape_type_left_word: syn_end = regex_constants::escape_type_right_word; break; default: syn_end = regex_constants::escape_type_end_buffer; break; } } negative = (*m_position == static_cast<charT>('-')); if((negative) && (++m_position == m_end)) { fail(regex_constants::error_escape, m_position - m_base, incomplete_message); return false; } const charT* pc = m_position; std::intmax_t i = this->m_traits.toi(pc, m_end, 10); if((i < 0) && syn_end) { // Check for a named capture, get the leftmost one if there is more than one: const charT* base = m_position; while((m_position != m_end) && (this->m_traits.syntax_type(*m_position) != syn_end)) { ++m_position; } i = hash_value_from_capture_name(base, m_position); pc = m_position; } if(negative) i = 1 + (static_cast<std::intmax_t>(m_mark_count) - i); if(((i < hash_value_mask) && (i > 0) && (this->m_backrefs.test((std::size_t)i))) || ((i >= hash_value_mask) && (this->m_pdata->get_id((int)i) > 0) && (this->m_backrefs.test(this->m_pdata->get_id((int)i))))) { m_position = pc; re_brace* pb = static_cast<re_brace*>(this->append_state(syntax_element_backref, sizeof(re_brace))); pb->index = (int)i; pb->icase = this->flags() & regbase::icase; } else { fail(regex_constants::error_backref, m_position - m_base); return false; } m_position = pc; if(have_brace) { if((m_position == m_end) || (this->m_traits.syntax_type(*m_position) != syn_end)) { fail(regex_constants::error_escape, m_position - m_base, incomplete_message); return false; } ++m_position; } return true; } goto escape_type_class_jump; case regex_constants::escape_type_control_v: if(0 == (this->flags() & (regbase::main_option_type | regbase::no_perl_ex))) goto escape_type_class_jump; BOOST_REGEX_FALLTHROUGH; default: this->append_literal(unescape_character()); break; } return true; } template <class charT, class traits> bool basic_regex_parser<charT, traits>::parse_match_any() { // // we have a '.' that can match any character: // ++m_position; static_cast<re_dot*>( this->append_state(syntax_element_wild, sizeof(re_dot)) )->mask = static_cast<unsigned char>(this->flags() & regbase::no_mod_s ? BOOST_REGEX_DETAIL_NS::force_not_newline : this->flags() & regbase::mod_s ? BOOST_REGEX_DETAIL_NS::force_newline : BOOST_REGEX_DETAIL_NS::dont_care); return true; } template <class charT, class traits> bool basic_regex_parser<charT, traits>::parse_repeat(std::size_t low, std::size_t high) { bool greedy = true; bool possessive = false; std::size_t insert_point; // // when we get to here we may have a non-greedy ? mark still to come: // if((m_position != m_end) && ( (0 == (this->flags() & (regbase::main_option_type | regbase::no_perl_ex))) || ((regbase::basic_syntax_group|regbase::emacs_ex) == (this->flags() & (regbase::main_option_type | regbase::emacs_ex))) ) ) { // OK we have a perl or emacs regex, check for a '?': if ((this->flags() & (regbase::main_option_type | regbase::mod_x | regbase::no_perl_ex)) == regbase::mod_x) { // whitespace skip: while ((m_position != m_end) && this->m_traits.isctype(*m_position, this->m_mask_space)) ++m_position; } if((m_position != m_end) && (this->m_traits.syntax_type(*m_position) == regex_constants::syntax_question)) { greedy = false; ++m_position; } // for perl regexes only check for possessive ++ repeats. if((m_position != m_end) && (0 == (this->flags() & regbase::main_option_type)) && (this->m_traits.syntax_type(*m_position) == regex_constants::syntax_plus)) { possessive = true; ++m_position; } } if(0 == this->m_last_state) { fail(regex_constants::error_badrepeat, std::distance(m_base, m_position), "Nothing to repeat."); return false; } if(this->m_last_state->type == syntax_element_endmark) { // insert a repeat before the '(' matching the last ')': insert_point = this->m_paren_start; } else if((this->m_last_state->type == syntax_element_literal) && (static_cast<re_literal*>(this->m_last_state)->length > 1)) { // the last state was a literal with more than one character, split it in two: re_literal* lit = static_cast<re_literal*>(this->m_last_state); charT c = (static_cast<charT*>(static_cast<void*>(lit+1)))[lit->length - 1]; lit->length -= 1; // now append new state: lit = static_cast<re_literal*>(this->append_state(syntax_element_literal, sizeof(re_literal) + sizeof(charT))); lit->length = 1; (static_cast<charT*>(static_cast<void*>(lit+1)))[0] = c; insert_point = this->getoffset(this->m_last_state); } else { // repeat the last state whatever it was, need to add some error checking here: switch(this->m_last_state->type) { case syntax_element_start_line: case syntax_element_end_line: case syntax_element_word_boundary: case syntax_element_within_word: case syntax_element_word_start: case syntax_element_word_end: case syntax_element_buffer_start: case syntax_element_buffer_end: case syntax_element_alt: case syntax_element_soft_buffer_end: case syntax_element_restart_continue: case syntax_element_jump: case syntax_element_startmark: case syntax_element_backstep: // can't legally repeat any of the above: fail(regex_constants::error_badrepeat, m_position - m_base); return false; default: // do nothing... break; } insert_point = this->getoffset(this->m_last_state); } // // OK we now know what to repeat, so insert the repeat around it: // re_repeat* rep = static_cast<re_repeat*>(this->insert_state(insert_point, syntax_element_rep, re_repeater_size)); rep->min = low; rep->max = high; rep->greedy = greedy; rep->leading = false; // store our repeater position for later: std::ptrdiff_t rep_off = this->getoffset(rep); // and append a back jump to the repeat: re_jump* jmp = static_cast<re_jump*>(this->append_state(syntax_element_jump, sizeof(re_jump))); jmp->alt.i = rep_off - this->getoffset(jmp); this->m_pdata->m_data.align(); // now fill in the alt jump for the repeat: rep = static_cast<re_repeat*>(this->getaddress(rep_off)); rep->alt.i = this->m_pdata->m_data.size() - rep_off; // // If the repeat is possessive then bracket the repeat with a (?>...) // independent sub-expression construct: // if(possessive) { if(m_position != m_end) { // // Check for illegal following quantifier, we have to do this here, because // the extra states we insert below circumvents our usual error checking :-( // bool contin = false; do { if ((this->flags() & (regbase::main_option_type | regbase::mod_x | regbase::no_perl_ex)) == regbase::mod_x) { // whitespace skip: while ((m_position != m_end) && this->m_traits.isctype(*m_position, this->m_mask_space)) ++m_position; } if (m_position != m_end) { switch (this->m_traits.syntax_type(*m_position)) { case regex_constants::syntax_star: case regex_constants::syntax_plus: case regex_constants::syntax_question: case regex_constants::syntax_open_brace: fail(regex_constants::error_badrepeat, m_position - m_base); return false; case regex_constants::syntax_open_mark: // Do we have a comment? If so we need to skip it here... if ((m_position + 2 < m_end) && this->m_traits.syntax_type(*(m_position + 1)) == regex_constants::syntax_question && this->m_traits.syntax_type(*(m_position + 2)) == regex_constants::syntax_hash) { while ((m_position != m_end) && (this->m_traits.syntax_type(*m_position++) != regex_constants::syntax_close_mark)) { } contin = true; } else contin = false; break; default: contin = false; } } else contin = false; } while (contin); } re_brace* pb = static_cast<re_brace*>(this->insert_state(insert_point, syntax_element_startmark, sizeof(re_brace))); pb->index = -3; pb->icase = this->flags() & regbase::icase; jmp = static_cast<re_jump*>(this->insert_state(insert_point + sizeof(re_brace), syntax_element_jump, sizeof(re_jump))); this->m_pdata->m_data.align(); jmp->alt.i = this->m_pdata->m_data.size() - this->getoffset(jmp); pb = static_cast<re_brace*>(this->append_state(syntax_element_endmark, sizeof(re_brace))); pb->index = -3; pb->icase = this->flags() & regbase::icase; } return true; } template <class charT, class traits> bool basic_regex_parser<charT, traits>::parse_repeat_range(bool isbasic) { static const char incomplete_message[] = "Missing } in quantified repetition."; // // parse a repeat-range: // std::size_t min, max; std::intmax_t v; // skip whitespace: while((m_position != m_end) && this->m_traits.isctype(*m_position, this->m_mask_space)) ++m_position; if(this->m_position == this->m_end) { if(this->flags() & (regbase::main_option_type | regbase::no_perl_ex)) { fail(regex_constants::error_brace, this->m_position - this->m_base, incomplete_message); return false; } // Treat the opening '{' as a literal character, rewind to start of error: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_brace) --m_position; return parse_literal(); } // get min: v = this->m_traits.toi(m_position, m_end, 10); // skip whitespace: if((v < 0) || (v > umax())) { if(this->flags() & (regbase::main_option_type | regbase::no_perl_ex)) { fail(regex_constants::error_brace, this->m_position - this->m_base, incomplete_message); return false; } // Treat the opening '{' as a literal character, rewind to start of error: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_brace) --m_position; return parse_literal(); } while((m_position != m_end) && this->m_traits.isctype(*m_position, this->m_mask_space)) ++m_position; if(this->m_position == this->m_end) { if(this->flags() & (regbase::main_option_type | regbase::no_perl_ex)) { fail(regex_constants::error_brace, this->m_position - this->m_base, incomplete_message); return false; } // Treat the opening '{' as a literal character, rewind to start of error: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_brace) --m_position; return parse_literal(); } min = static_cast<std::size_t>(v); // see if we have a comma: if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_comma) { // move on and error check: ++m_position; // skip whitespace: while((m_position != m_end) && this->m_traits.isctype(*m_position, this->m_mask_space)) ++m_position; if(this->m_position == this->m_end) { if(this->flags() & (regbase::main_option_type | regbase::no_perl_ex)) { fail(regex_constants::error_brace, this->m_position - this->m_base, incomplete_message); return false; } // Treat the opening '{' as a literal character, rewind to start of error: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_brace) --m_position; return parse_literal(); } // get the value if any: v = this->m_traits.toi(m_position, m_end, 10); max = ((v >= 0) && (v < umax())) ? (std::size_t)v : (std::numeric_limits<std::size_t>::max)(); } else { // no comma, max = min: max = min; } // skip whitespace: while((m_position != m_end) && this->m_traits.isctype(*m_position, this->m_mask_space)) ++m_position; // OK now check trailing }: if(this->m_position == this->m_end) { if(this->flags() & (regbase::main_option_type | regbase::no_perl_ex)) { fail(regex_constants::error_brace, this->m_position - this->m_base, incomplete_message); return false; } // Treat the opening '{' as a literal character, rewind to start of error: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_brace) --m_position; return parse_literal(); } if(isbasic) { if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_escape) { ++m_position; if(this->m_position == this->m_end) { fail(regex_constants::error_brace, this->m_position - this->m_base, incomplete_message); return false; } } else { fail(regex_constants::error_brace, this->m_position - this->m_base, incomplete_message); return false; } } if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_close_brace) ++m_position; else { // Treat the opening '{' as a literal character, rewind to start of error: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_brace) --m_position; return parse_literal(); } // // finally go and add the repeat, unless error: // if(min > max) { // Backtrack to error location: m_position -= 2; while(this->m_traits.isctype(*m_position, this->m_word_mask)) --m_position; ++m_position; fail(regex_constants::error_badbrace, m_position - m_base); return false; } return parse_repeat(min, max); } template <class charT, class traits> bool basic_regex_parser<charT, traits>::parse_alt() { // // error check: if there have been no previous states, // or if the last state was a '(' then error: // if( ((this->m_last_state == 0) || (this->m_last_state->type == syntax_element_startmark)) && !( ((this->flags() & regbase::main_option_type) == regbase::perl_syntax_group) && ((this->flags() & regbase::no_empty_expressions) == 0) ) ) { fail(regex_constants::error_empty, this->m_position - this->m_base, "A regular expression cannot start with the alternation operator |."); return false; } // // Reset mark count if required: // if(m_max_mark < m_mark_count) m_max_mark = m_mark_count; if(m_mark_reset >= 0) m_mark_count = m_mark_reset; ++m_position; // // we need to append a trailing jump: // re_syntax_base* pj = this->append_state(BOOST_REGEX_DETAIL_NS::syntax_element_jump, sizeof(re_jump)); std::ptrdiff_t jump_offset = this->getoffset(pj); // // now insert the alternative: // re_alt* palt = static_cast<re_alt*>(this->insert_state(this->m_alt_insert_point, syntax_element_alt, re_alt_size)); jump_offset += re_alt_size; this->m_pdata->m_data.align(); palt->alt.i = this->m_pdata->m_data.size() - this->getoffset(palt); // // update m_alt_insert_point so that the next alternate gets // inserted at the start of the second of the two we've just created: // this->m_alt_insert_point = this->m_pdata->m_data.size(); // // the start of this alternative must have a case changes state // if the current block has messed around with case changes: // if(m_has_case_change) { static_cast<re_case*>( this->append_state(syntax_element_toggle_case, sizeof(re_case)) )->icase = this->m_icase; } // // push the alternative onto our stack, a recursive // implementation here is easier to understand (and faster // as it happens), but causes all kinds of stack overflow problems // on programs with small stacks (COM+). // m_alt_jumps.push_back(jump_offset); return true; } template <class charT, class traits> bool basic_regex_parser<charT, traits>::parse_set() { static const char incomplete_message[] = "Character set declaration starting with [ terminated prematurely - either no ] was found or the set had no content."; ++m_position; if(m_position == m_end) { fail(regex_constants::error_brack, m_position - m_base, incomplete_message); return false; } basic_char_set<charT, traits> char_set; const charT* base = m_position; // where the '[' was const charT* item_base = m_position; // where the '[' or '^' was while(m_position != m_end) { switch(this->m_traits.syntax_type(*m_position)) { case regex_constants::syntax_caret: if(m_position == base) { char_set.negate(); ++m_position; item_base = m_position; } else parse_set_literal(char_set); break; case regex_constants::syntax_close_set: if(m_position == item_base) { parse_set_literal(char_set); break; } else { ++m_position; if(0 == this->append_set(char_set)) { fail(regex_constants::error_ctype, m_position - m_base); return false; } } return true; case regex_constants::syntax_open_set: if(parse_inner_set(char_set)) break; return true; case regex_constants::syntax_escape: { // // look ahead and see if this is a character class shortcut // \d \w \s etc... // ++m_position; if(this->m_traits.escape_syntax_type(*m_position) == regex_constants::escape_type_class) { char_class_type m = this->m_traits.lookup_classname(m_position, m_position+1); if(m != 0) { char_set.add_class(m); ++m_position; break; } } else if(this->m_traits.escape_syntax_type(*m_position) == regex_constants::escape_type_not_class) { // negated character class: char_class_type m = this->m_traits.lookup_classname(m_position, m_position+1); if(m != 0) { char_set.add_negated_class(m); ++m_position; break; } } // not a character class, just a regular escape: --m_position; parse_set_literal(char_set); break; } default: parse_set_literal(char_set); break; } } return m_position != m_end; } template <class charT, class traits> bool basic_regex_parser<charT, traits>::parse_inner_set(basic_char_set<charT, traits>& char_set) { static const char incomplete_message[] = "Character class declaration starting with [ terminated prematurely - either no ] was found or the set had no content."; // // we have either a character class [:name:] // a collating element [.name.] // or an equivalence class [=name=] // if(m_end == ++m_position) { fail(regex_constants::error_brack, m_position - m_base, incomplete_message); return false; } switch(this->m_traits.syntax_type(*m_position)) { case regex_constants::syntax_dot: // // a collating element is treated as a literal: // --m_position; parse_set_literal(char_set); return true; case regex_constants::syntax_colon: { // check that character classes are actually enabled: if((this->flags() & (regbase::main_option_type | regbase::no_char_classes)) == (regbase::basic_syntax_group | regbase::no_char_classes)) { --m_position; parse_set_literal(char_set); return true; } // skip the ':' if(m_end == ++m_position) { fail(regex_constants::error_brack, m_position - m_base, incomplete_message); return false; } const charT* name_first = m_position; // skip at least one character, then find the matching ':]' if(m_end == ++m_position) { fail(regex_constants::error_brack, m_position - m_base, incomplete_message); return false; } while((m_position != m_end) && (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_colon)) ++m_position; const charT* name_last = m_position; if(m_end == m_position) { fail(regex_constants::error_brack, m_position - m_base, incomplete_message); return false; } if((m_end == ++m_position) || (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_set)) { fail(regex_constants::error_brack, m_position - m_base, incomplete_message); return false; } // // check for negated class: // bool negated = false; if(this->m_traits.syntax_type(*name_first) == regex_constants::syntax_caret) { ++name_first; negated = true; } typedef typename traits::char_class_type m_type; m_type m = this->m_traits.lookup_classname(name_first, name_last); if(m == 0) { if(char_set.empty() && (name_last - name_first == 1)) { // maybe a special case: ++m_position; if( (m_position != m_end) && (this->m_traits.syntax_type(*m_position) == regex_constants::syntax_close_set)) { if(this->m_traits.escape_syntax_type(*name_first) == regex_constants::escape_type_left_word) { ++m_position; this->append_state(syntax_element_word_start); return false; } if(this->m_traits.escape_syntax_type(*name_first) == regex_constants::escape_type_right_word) { ++m_position; this->append_state(syntax_element_word_end); return false; } } } fail(regex_constants::error_ctype, name_first - m_base); return false; } if(!negated) char_set.add_class(m); else char_set.add_negated_class(m); ++m_position; break; } case regex_constants::syntax_equal: { // skip the '=' if(m_end == ++m_position) { fail(regex_constants::error_brack, m_position - m_base, incomplete_message); return false; } const charT* name_first = m_position; // skip at least one character, then find the matching '=]' if(m_end == ++m_position) { fail(regex_constants::error_brack, m_position - m_base, incomplete_message); return false; } while((m_position != m_end) && (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_equal)) ++m_position; const charT* name_last = m_position; if(m_end == m_position) { fail(regex_constants::error_brack, m_position - m_base, incomplete_message); return false; } if((m_end == ++m_position) || (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_set)) { fail(regex_constants::error_brack, m_position - m_base, incomplete_message); return false; } string_type m = this->m_traits.lookup_collatename(name_first, name_last); if(m.empty() || (m.size() > 2)) { fail(regex_constants::error_collate, name_first - m_base); return false; } digraph<charT> d; d.first = m[0]; if(m.size() > 1) d.second = m[1]; else d.second = 0; char_set.add_equivalent(d); ++m_position; break; } default: --m_position; parse_set_literal(char_set); break; } return true; } template <class charT, class traits> void basic_regex_parser<charT, traits>::parse_set_literal(basic_char_set<charT, traits>& char_set) { digraph<charT> start_range(get_next_set_literal(char_set)); if(m_end == m_position) { fail(regex_constants::error_brack, m_position - m_base); return; } if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_dash) { // we have a range: if(m_end == ++m_position) { fail(regex_constants::error_brack, m_position - m_base); return; } if(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_set) { digraph<charT> end_range = get_next_set_literal(char_set); char_set.add_range(start_range, end_range); if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_dash) { if(m_end == ++m_position) { fail(regex_constants::error_brack, m_position - m_base); return; } if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_close_set) { // trailing - : --m_position; return; } fail(regex_constants::error_range, m_position - m_base); return; } return; } --m_position; } char_set.add_single(start_range); } template <class charT, class traits> digraph<charT> basic_regex_parser<charT, traits>::get_next_set_literal(basic_char_set<charT, traits>& char_set) { digraph<charT> result; switch(this->m_traits.syntax_type(*m_position)) { case regex_constants::syntax_dash: if(!char_set.empty()) { // see if we are at the end of the set: if((++m_position == m_end) || (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_set)) { fail(regex_constants::error_range, m_position - m_base); return result; } --m_position; } result.first = *m_position++; return result; case regex_constants::syntax_escape: // check to see if escapes are supported first: if(this->flags() & regex_constants::no_escape_in_lists) { result = *m_position++; break; } ++m_position; result = unescape_character(); break; case regex_constants::syntax_open_set: { if(m_end == ++m_position) { fail(regex_constants::error_collate, m_position - m_base); return result; } if(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_dot) { --m_position; result.first = *m_position; ++m_position; return result; } if(m_end == ++m_position) { fail(regex_constants::error_collate, m_position - m_base); return result; } const charT* name_first = m_position; // skip at least one character, then find the matching ':]' if(m_end == ++m_position) { fail(regex_constants::error_collate, name_first - m_base); return result; } while((m_position != m_end) && (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_dot)) ++m_position; const charT* name_last = m_position; if(m_end == m_position) { fail(regex_constants::error_collate, name_first - m_base); return result; } if((m_end == ++m_position) || (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_set)) { fail(regex_constants::error_collate, name_first - m_base); return result; } ++m_position; string_type s = this->m_traits.lookup_collatename(name_first, name_last); if(s.empty() || (s.size() > 2)) { fail(regex_constants::error_collate, name_first - m_base); return result; } result.first = s[0]; if(s.size() > 1) result.second = s[1]; else result.second = 0; return result; } default: result = *m_position++; } return result; } // // does a value fit in the specified charT type? // template <class charT> bool valid_value(charT, std::intmax_t v, const std::integral_constant<bool, true>&) { return (v >> (sizeof(charT) * CHAR_BIT)) == 0; } template <class charT> bool valid_value(charT, std::intmax_t, const std::integral_constant<bool, false>&) { return true; // v will alsways fit in a charT } template <class charT> bool valid_value(charT c, std::intmax_t v) { return valid_value(c, v, std::integral_constant<bool, (sizeof(charT) < sizeof(std::intmax_t))>()); } template <class charT, class traits> charT basic_regex_parser<charT, traits>::unescape_character() { #ifdef BOOST_REGEX_MSVC #pragma warning(push) #pragma warning(disable:4127) #endif charT result(0); if(m_position == m_end) { fail(regex_constants::error_escape, m_position - m_base, "Escape sequence terminated prematurely."); return false; } switch(this->m_traits.escape_syntax_type(*m_position)) { case regex_constants::escape_type_control_a: result = charT('\a'); break; case regex_constants::escape_type_e: result = charT(27); break; case regex_constants::escape_type_control_f: result = charT('\f'); break; case regex_constants::escape_type_control_n: result = charT('\n'); break; case regex_constants::escape_type_control_r: result = charT('\r'); break; case regex_constants::escape_type_control_t: result = charT('\t'); break; case regex_constants::escape_type_control_v: result = charT('\v'); break; case regex_constants::escape_type_word_assert: result = charT('\b'); break; case regex_constants::escape_type_ascii_control: ++m_position; if(m_position == m_end) { // Rewind to start of escape: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_escape) --m_position; fail(regex_constants::error_escape, m_position - m_base, "ASCII escape sequence terminated prematurely."); return result; } result = static_cast<charT>(*m_position % 32); break; case regex_constants::escape_type_hex: ++m_position; if(m_position == m_end) { // Rewind to start of escape: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_escape) --m_position; fail(regex_constants::error_escape, m_position - m_base, "Hexadecimal escape sequence terminated prematurely."); return result; } // maybe have \x{ddd} if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_open_brace) { ++m_position; if(m_position == m_end) { // Rewind to start of escape: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_escape) --m_position; fail(regex_constants::error_escape, m_position - m_base, "Missing } in hexadecimal escape sequence."); return result; } std::intmax_t i = this->m_traits.toi(m_position, m_end, 16); if((m_position == m_end) || (i < 0) || ((std::numeric_limits<charT>::is_specialized) && (i > (std::intmax_t)(std::numeric_limits<charT>::max)())) || (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_brace)) { // Rewind to start of escape: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_escape) --m_position; fail(regex_constants::error_badbrace, m_position - m_base, "Hexadecimal escape sequence was invalid."); return result; } ++m_position; result = charT(i); } else { std::ptrdiff_t len = (std::min)(static_cast<std::ptrdiff_t>(2), static_cast<std::ptrdiff_t>(m_end - m_position)); std::intmax_t i = this->m_traits.toi(m_position, m_position + len, 16); if((i < 0) || !valid_value(charT(0), i)) { // Rewind to start of escape: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_escape) --m_position; fail(regex_constants::error_escape, m_position - m_base, "Escape sequence did not encode a valid character."); return result; } result = charT(i); } return result; case regex_constants::syntax_digit: { // an octal escape sequence, the first character must be a zero // followed by up to 3 octal digits: std::ptrdiff_t len = (std::min)(std::distance(m_position, m_end), static_cast<std::ptrdiff_t>(4)); const charT* bp = m_position; std::intmax_t val = this->m_traits.toi(bp, bp + 1, 8); if(val != 0) { // Rewind to start of escape: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_escape) --m_position; // Oops not an octal escape after all: fail(regex_constants::error_escape, m_position - m_base, "Invalid octal escape sequence."); return result; } val = this->m_traits.toi(m_position, m_position + len, 8); if((val < 0) || (val > (std::intmax_t)(std::numeric_limits<charT>::max)())) { // Rewind to start of escape: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_escape) --m_position; fail(regex_constants::error_escape, m_position - m_base, "Octal escape sequence is invalid."); return result; } return static_cast<charT>(val); } case regex_constants::escape_type_named_char: { ++m_position; if(m_position == m_end) { // Rewind to start of escape: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_escape) --m_position; fail(regex_constants::error_escape, m_position - m_base); return false; } // maybe have \N{name} if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_open_brace) { const charT* base = m_position; // skip forward until we find enclosing brace: while((m_position != m_end) && (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_brace)) ++m_position; if(m_position == m_end) { // Rewind to start of escape: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_escape) --m_position; fail(regex_constants::error_escape, m_position - m_base); return false; } string_type s = this->m_traits.lookup_collatename(++base, m_position++); if(s.empty()) { // Rewind to start of escape: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_escape) --m_position; fail(regex_constants::error_collate, m_position - m_base); return false; } if(s.size() == 1) { return s[0]; } } // fall through is a failure: // Rewind to start of escape: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_escape) --m_position; fail(regex_constants::error_escape, m_position - m_base); return false; } default: result = *m_position; break; } ++m_position; return result; #ifdef BOOST_REGEX_MSVC #pragma warning(pop) #endif } template <class charT, class traits> bool basic_regex_parser<charT, traits>::parse_backref() { BOOST_REGEX_ASSERT(m_position != m_end); const charT* pc = m_position; std::intmax_t i = this->m_traits.toi(pc, pc + 1, 10); if((i == 0) || (((this->flags() & regbase::main_option_type) == regbase::perl_syntax_group) && (this->flags() & regbase::no_bk_refs))) { // not a backref at all but an octal escape sequence: charT c = unescape_character(); this->append_literal(c); } else if((i > 0) && (this->m_backrefs.test((std::size_t)i))) { m_position = pc; re_brace* pb = static_cast<re_brace*>(this->append_state(syntax_element_backref, sizeof(re_brace))); pb->index = (int)i; pb->icase = this->flags() & regbase::icase; } else { // Rewind to start of escape: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_escape) --m_position; fail(regex_constants::error_backref, m_position - m_base); return false; } return true; } template <class charT, class traits> bool basic_regex_parser<charT, traits>::parse_QE() { #ifdef BOOST_REGEX_MSVC #pragma warning(push) #pragma warning(disable:4127) #endif // // parse a \Q...\E sequence: // ++m_position; // skip the Q const charT* start = m_position; const charT* end; do { while((m_position != m_end) && (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_escape)) ++m_position; if(m_position == m_end) { // a \Q...\E sequence may terminate with the end of the expression: end = m_position; break; } if(++m_position == m_end) // skip the escape { fail(regex_constants::error_escape, m_position - m_base, "Unterminated \\Q...\\E sequence."); return false; } // check to see if it's a \E: if(this->m_traits.escape_syntax_type(*m_position) == regex_constants::escape_type_E) { ++m_position; end = m_position - 2; break; } // otherwise go round again: }while(true); // // now add all the character between the two escapes as literals: // while(start != end) { this->append_literal(*start); ++start; } return true; #ifdef BOOST_REGEX_MSVC #pragma warning(pop) #endif } template <class charT, class traits> bool basic_regex_parser<charT, traits>::parse_perl_extension() { if(++m_position == m_end) { // Rewind to start of (? sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base); return false; } // // treat comments as a special case, as these // are the only ones that don't start with a leading // startmark state: // if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_hash) { while((m_position != m_end) && (this->m_traits.syntax_type(*m_position++) != regex_constants::syntax_close_mark)) {} return true; } // // backup some state, and prepare the way: // int markid = 0; std::ptrdiff_t jump_offset = 0; re_brace* pb = static_cast<re_brace*>(this->append_state(syntax_element_startmark, sizeof(re_brace))); pb->icase = this->flags() & regbase::icase; std::ptrdiff_t last_paren_start = this->getoffset(pb); // back up insertion point for alternations, and set new point: std::ptrdiff_t last_alt_point = m_alt_insert_point; this->m_pdata->m_data.align(); m_alt_insert_point = this->m_pdata->m_data.size(); std::ptrdiff_t expected_alt_point = m_alt_insert_point; bool restore_flags = true; regex_constants::syntax_option_type old_flags = this->flags(); bool old_case_change = m_has_case_change; m_has_case_change = false; charT name_delim; int mark_reset = m_mark_reset; int max_mark = m_max_mark; m_mark_reset = -1; m_max_mark = m_mark_count; std::intmax_t v; // // select the actual extension used: // switch(this->m_traits.syntax_type(*m_position)) { case regex_constants::syntax_or: m_mark_reset = m_mark_count; BOOST_REGEX_FALLTHROUGH; case regex_constants::syntax_colon: // // a non-capturing mark: // pb->index = markid = 0; ++m_position; break; case regex_constants::syntax_digit: { // // a recursive subexpression: // v = this->m_traits.toi(m_position, m_end, 10); if((v < 0) || (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_mark)) { // Rewind to start of (? sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base, "The recursive sub-expression refers to an invalid marking group, or is unterminated."); return false; } insert_recursion: pb->index = markid = 0; re_recurse* pr = static_cast<re_recurse*>(this->append_state(syntax_element_recurse, sizeof(re_recurse))); pr->alt.i = (std::ptrdiff_t)v; pr->state_id = 0; static_cast<re_case*>( this->append_state(syntax_element_toggle_case, sizeof(re_case)) )->icase = this->flags() & regbase::icase; break; } case regex_constants::syntax_plus: // // A forward-relative recursive subexpression: // ++m_position; v = this->m_traits.toi(m_position, m_end, 10); if((v <= 0) || (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_mark)) { // Rewind to start of (? sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base, "An invalid or unterminated recursive sub-expression."); return false; } if ((std::numeric_limits<std::intmax_t>::max)() - m_mark_count < v) { fail(regex_constants::error_perl_extension, m_position - m_base, "An invalid or unterminated recursive sub-expression."); return false; } v += m_mark_count; goto insert_recursion; case regex_constants::syntax_dash: // // Possibly a backward-relative recursive subexpression: // ++m_position; v = this->m_traits.toi(m_position, m_end, 10); if(v <= 0) { --m_position; // Oops not a relative recursion at all, but a (?-imsx) group: goto option_group_jump; } v = static_cast<std::intmax_t>(m_mark_count) + 1 - v; if(v <= 0) { // Rewind to start of (? sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base, "An invalid or unterminated recursive sub-expression."); return false; } goto insert_recursion; case regex_constants::syntax_equal: pb->index = markid = -1; ++m_position; jump_offset = this->getoffset(this->append_state(syntax_element_jump, sizeof(re_jump))); this->m_pdata->m_data.align(); m_alt_insert_point = this->m_pdata->m_data.size(); break; case regex_constants::syntax_not: pb->index = markid = -2; ++m_position; jump_offset = this->getoffset(this->append_state(syntax_element_jump, sizeof(re_jump))); this->m_pdata->m_data.align(); m_alt_insert_point = this->m_pdata->m_data.size(); break; case regex_constants::escape_type_left_word: { // a lookbehind assertion: if(++m_position == m_end) { // Rewind to start of (? sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base); return false; } regex_constants::syntax_type t = this->m_traits.syntax_type(*m_position); if(t == regex_constants::syntax_not) pb->index = markid = -2; else if(t == regex_constants::syntax_equal) pb->index = markid = -1; else { // Probably a named capture which also starts (?< : name_delim = '>'; --m_position; goto named_capture_jump; } ++m_position; jump_offset = this->getoffset(this->append_state(syntax_element_jump, sizeof(re_jump))); this->append_state(syntax_element_backstep, sizeof(re_brace)); this->m_pdata->m_data.align(); m_alt_insert_point = this->m_pdata->m_data.size(); break; } case regex_constants::escape_type_right_word: // // an independent sub-expression: // pb->index = markid = -3; ++m_position; jump_offset = this->getoffset(this->append_state(syntax_element_jump, sizeof(re_jump))); this->m_pdata->m_data.align(); m_alt_insert_point = this->m_pdata->m_data.size(); break; case regex_constants::syntax_open_mark: { // a conditional expression: pb->index = markid = -4; if(++m_position == m_end) { // Rewind to start of (? sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base); return false; } v = this->m_traits.toi(m_position, m_end, 10); if(m_position == m_end) { // Rewind to start of (? sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base); return false; } if(*m_position == charT('R')) { if(++m_position == m_end) { // Rewind to start of (? sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base); return false; } if(*m_position == charT('&')) { const charT* base = ++m_position; while((m_position != m_end) && (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_mark)) ++m_position; if(m_position == m_end) { // Rewind to start of (? sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base); return false; } v = -static_cast<int>(hash_value_from_capture_name(base, m_position)); } else { v = -this->m_traits.toi(m_position, m_end, 10); } re_brace* br = static_cast<re_brace*>(this->append_state(syntax_element_assert_backref, sizeof(re_brace))); br->index = v < 0 ? (int)(v - 1) : 0; if(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_mark) { // Rewind to start of (? sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base); return false; } if(++m_position == m_end) { // Rewind to start of (? sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base); return false; } } else if((*m_position == charT('\'')) || (*m_position == charT('<'))) { const charT* base = ++m_position; while((m_position != m_end) && (*m_position != charT('>')) && (*m_position != charT('\''))) ++m_position; if(m_position == m_end) { // Rewind to start of (? sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base); return false; } v = static_cast<int>(hash_value_from_capture_name(base, m_position)); re_brace* br = static_cast<re_brace*>(this->append_state(syntax_element_assert_backref, sizeof(re_brace))); br->index = (int)v; if(((*m_position != charT('>')) && (*m_position != charT('\''))) || (++m_position == m_end)) { // Rewind to start of (? sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base, "Unterminated named capture."); return false; } if(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_mark) { // Rewind to start of (? sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base); return false; } if(++m_position == m_end) { // Rewind to start of (? sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base); return false; } } else if(*m_position == charT('D')) { const char* def = "DEFINE"; while(*def && (m_position != m_end) && (*m_position == charT(*def))) ++m_position, ++def; if((m_position == m_end) || *def) { // Rewind to start of (? sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base); return false; } re_brace* br = static_cast<re_brace*>(this->append_state(syntax_element_assert_backref, sizeof(re_brace))); br->index = 9999; // special magic value! if(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_mark) { // Rewind to start of (? sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base); return false; } if(++m_position == m_end) { // Rewind to start of (? sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base); return false; } } else if(v > 0) { re_brace* br = static_cast<re_brace*>(this->append_state(syntax_element_assert_backref, sizeof(re_brace))); br->index = (int)v; if(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_mark) { // Rewind to start of (? sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base); return false; } if(++m_position == m_end) { // Rewind to start of (? sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base); return false; } } else { // verify that we have a lookahead or lookbehind assert: if(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_question) { // Rewind to start of (? sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base); return false; } if(++m_position == m_end) { // Rewind to start of (? sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base); return false; } if(this->m_traits.syntax_type(*m_position) == regex_constants::escape_type_left_word) { if(++m_position == m_end) { // Rewind to start of (? sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base); return false; } if((this->m_traits.syntax_type(*m_position) != regex_constants::syntax_equal) && (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_not)) { // Rewind to start of (? sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base); return false; } m_position -= 3; } else { if((this->m_traits.syntax_type(*m_position) != regex_constants::syntax_equal) && (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_not)) { // Rewind to start of (? sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base); return false; } m_position -= 2; } } break; } case regex_constants::syntax_close_mark: // Rewind to start of (? sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base); return false; case regex_constants::escape_type_end_buffer: { name_delim = *m_position; named_capture_jump: markid = 0; if(0 == (this->flags() & regbase::nosubs)) { markid = ++m_mark_count; if(this->flags() & regbase::save_subexpression_location) this->m_pdata->m_subs.push_back(std::pair<std::size_t, std::size_t>(std::distance(m_base, m_position) - 2, 0)); } pb->index = markid; const charT* base = ++m_position; if(m_position == m_end) { // Rewind to start of (? sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base); return false; } while((m_position != m_end) && (*m_position != name_delim)) ++m_position; if(m_position == m_end) { // Rewind to start of (? sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base); return false; } this->m_pdata->set_name(base, m_position, markid); ++m_position; break; } default: if(*m_position == charT('R')) { ++m_position; v = 0; if(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_mark) { // Rewind to start of (? sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base); return false; } goto insert_recursion; } if(*m_position == charT('&')) { ++m_position; const charT* base = m_position; while((m_position != m_end) && (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_mark)) ++m_position; if(m_position == m_end) { // Rewind to start of (? sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base); return false; } v = static_cast<int>(hash_value_from_capture_name(base, m_position)); goto insert_recursion; } if(*m_position == charT('P')) { ++m_position; if(m_position == m_end) { // Rewind to start of (? sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base); return false; } if(*m_position == charT('>')) { ++m_position; const charT* base = m_position; while((m_position != m_end) && (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_mark)) ++m_position; if(m_position == m_end) { // Rewind to start of (? sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base); return false; } v = static_cast<int>(hash_value_from_capture_name(base, m_position)); goto insert_recursion; } } // // lets assume that we have a (?imsx) group and try and parse it: // option_group_jump: regex_constants::syntax_option_type opts = parse_options(); if(m_position == m_end) { // Rewind to start of (? sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base); return false; } // make a note of whether we have a case change: m_has_case_change = ((opts & regbase::icase) != (this->flags() & regbase::icase)); pb->index = markid = 0; if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_close_mark) { // update flags and carry on as normal: this->flags(opts); restore_flags = false; old_case_change |= m_has_case_change; // defer end of scope by one ')' } else if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_colon) { // update flags and carry on until the matching ')' is found: this->flags(opts); ++m_position; } else { // Rewind to start of (? sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base); return false; } // finally append a case change state if we need it: if(m_has_case_change) { static_cast<re_case*>( this->append_state(syntax_element_toggle_case, sizeof(re_case)) )->icase = opts & regbase::icase; } } // // now recursively add more states, this will terminate when we get to a // matching ')' : // parse_all(); // // Unwind alternatives: // if(0 == unwind_alts(last_paren_start)) { // Rewind to start of (? sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base, "Invalid alternation operators within (?...) block."); return false; } // // we either have a ')' or we have run out of characters prematurely: // if(m_position == m_end) { // Rewind to start of (? sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; this->fail(regex_constants::error_paren, std::distance(m_base, m_end)); return false; } BOOST_REGEX_ASSERT(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_close_mark); ++m_position; // // restore the flags: // if(restore_flags) { // append a case change state if we need it: if(m_has_case_change) { static_cast<re_case*>( this->append_state(syntax_element_toggle_case, sizeof(re_case)) )->icase = old_flags & regbase::icase; } this->flags(old_flags); } // // set up the jump pointer if we have one: // if(jump_offset) { this->m_pdata->m_data.align(); re_jump* jmp = static_cast<re_jump*>(this->getaddress(jump_offset)); jmp->alt.i = this->m_pdata->m_data.size() - this->getoffset(jmp); if((this->m_last_state == jmp) && (markid != -2)) { // Oops... we didn't have anything inside the assertion. // Note we don't get here for negated forward lookahead as (?!) // does have some uses. // Rewind to start of (? sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base, "Invalid or empty zero width assertion."); return false; } } // // verify that if this is conditional expression, that we do have // an alternative, if not add one: // if(markid == -4) { re_syntax_base* b = this->getaddress(expected_alt_point); // Make sure we have exactly one alternative following this state: if(b->type != syntax_element_alt) { re_alt* alt = static_cast<re_alt*>(this->insert_state(expected_alt_point, syntax_element_alt, sizeof(re_alt))); alt->alt.i = this->m_pdata->m_data.size() - this->getoffset(alt); } else if(((std::ptrdiff_t)this->m_pdata->m_data.size() > (static_cast<re_alt*>(b)->alt.i + this->getoffset(b))) && (static_cast<re_alt*>(b)->alt.i > 0) && this->getaddress(static_cast<re_alt*>(b)->alt.i, b)->type == syntax_element_alt) { // Can't have seen more than one alternative: // Rewind to start of (? sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_bad_pattern, m_position - m_base, "More than one alternation operator | was encountered inside a conditional expression."); return false; } else { // We must *not* have seen an alternative inside a (DEFINE) block: b = this->getaddress(b->next.i, b); if((b->type == syntax_element_assert_backref) && (static_cast<re_brace*>(b)->index == 9999)) { // Rewind to start of (? sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_bad_pattern, m_position - m_base, "Alternation operators are not allowed inside a DEFINE block."); return false; } } // check for invalid repetition of next state: b = this->getaddress(expected_alt_point); b = this->getaddress(static_cast<re_alt*>(b)->next.i, b); if((b->type != syntax_element_assert_backref) && (b->type != syntax_element_startmark)) { // Rewind to start of (? sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_badrepeat, m_position - m_base, "A repetition operator cannot be applied to a zero-width assertion."); return false; } } // // append closing parenthesis state: // pb = static_cast<re_brace*>(this->append_state(syntax_element_endmark, sizeof(re_brace))); pb->index = markid; pb->icase = this->flags() & regbase::icase; this->m_paren_start = last_paren_start; // // restore the alternate insertion point: // this->m_alt_insert_point = last_alt_point; // // and the case change data: // m_has_case_change = old_case_change; // // And the mark_reset data: // if(m_max_mark > m_mark_count) { m_mark_count = m_max_mark; } m_mark_reset = mark_reset; m_max_mark = max_mark; if(markid > 0) { if(this->flags() & regbase::save_subexpression_location) this->m_pdata->m_subs.at((std::size_t)markid - 1).second = std::distance(m_base, m_position) - 1; // // allow backrefs to this mark: // this->m_backrefs.set(markid); } return true; } template <class charT, class traits> bool basic_regex_parser<charT, traits>::match_verb(const char* verb) { while(*verb) { if(static_cast<charT>(*verb) != *m_position) { while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base); return false; } if(++m_position == m_end) { --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base); return false; } ++verb; } return true; } #ifdef BOOST_REGEX_MSVC # pragma warning(push) #if BOOST_REGEX_MSVC >= 1800 #pragma warning(disable:26812) #endif #endif template <class charT, class traits> bool basic_regex_parser<charT, traits>::parse_perl_verb() { if(++m_position == m_end) { // Rewind to start of (* sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base); return false; } switch(*m_position) { case 'F': if(++m_position == m_end) { // Rewind to start of (* sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base); return false; } if((this->m_traits.syntax_type(*m_position) == regex_constants::syntax_close_mark) || match_verb("AIL")) { if((m_position == m_end) || (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_mark)) { // Rewind to start of (* sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base); return false; } ++m_position; this->append_state(syntax_element_fail); return true; } break; case 'A': if(++m_position == m_end) { // Rewind to start of (* sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base); return false; } if(match_verb("CCEPT")) { if((m_position == m_end) || (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_mark)) { // Rewind to start of (* sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base); return false; } ++m_position; this->append_state(syntax_element_accept); return true; } break; case 'C': if(++m_position == m_end) { // Rewind to start of (* sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base); return false; } if(match_verb("OMMIT")) { if((m_position == m_end) || (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_mark)) { // Rewind to start of (* sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base); return false; } ++m_position; static_cast<re_commit*>(this->append_state(syntax_element_commit, sizeof(re_commit)))->action = commit_commit; this->m_pdata->m_disable_match_any = true; return true; } break; case 'P': if(++m_position == m_end) { // Rewind to start of (* sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base); return false; } if(match_verb("RUNE")) { if((m_position == m_end) || (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_mark)) { // Rewind to start of (* sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base); return false; } ++m_position; static_cast<re_commit*>(this->append_state(syntax_element_commit, sizeof(re_commit)))->action = commit_prune; this->m_pdata->m_disable_match_any = true; return true; } break; case 'S': if(++m_position == m_end) { // Rewind to start of (* sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base); return false; } if(match_verb("KIP")) { if((m_position == m_end) || (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_mark)) { // Rewind to start of (* sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base); return false; } ++m_position; static_cast<re_commit*>(this->append_state(syntax_element_commit, sizeof(re_commit)))->action = commit_skip; this->m_pdata->m_disable_match_any = true; return true; } break; case 'T': if(++m_position == m_end) { // Rewind to start of (* sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base); return false; } if(match_verb("HEN")) { if((m_position == m_end) || (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_mark)) { // Rewind to start of (* sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base); return false; } ++m_position; this->append_state(syntax_element_then); this->m_pdata->m_disable_match_any = true; return true; } break; } // Rewind to start of (* sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base); return false; } #ifdef BOOST_REGEX_MSVC # pragma warning(pop) #endif template <class charT, class traits> bool basic_regex_parser<charT, traits>::add_emacs_code(bool negate) { // // parses an emacs style \sx or \Sx construct. // if(++m_position == m_end) { // Rewind to start of sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_escape) --m_position; fail(regex_constants::error_escape, m_position - m_base); return false; } basic_char_set<charT, traits> char_set; if(negate) char_set.negate(); static const charT s_punct[5] = { 'p', 'u', 'n', 'c', 't', }; switch(*m_position) { case 's': case ' ': char_set.add_class(this->m_mask_space); break; case 'w': char_set.add_class(this->m_word_mask); break; case '_': char_set.add_single(digraph<charT>(charT('$'))); char_set.add_single(digraph<charT>(charT('&'))); char_set.add_single(digraph<charT>(charT('*'))); char_set.add_single(digraph<charT>(charT('+'))); char_set.add_single(digraph<charT>(charT('-'))); char_set.add_single(digraph<charT>(charT('_'))); char_set.add_single(digraph<charT>(charT('<'))); char_set.add_single(digraph<charT>(charT('>'))); break; case '.': char_set.add_class(this->m_traits.lookup_classname(s_punct, s_punct+5)); break; case '(': char_set.add_single(digraph<charT>(charT('('))); char_set.add_single(digraph<charT>(charT('['))); char_set.add_single(digraph<charT>(charT('{'))); break; case ')': char_set.add_single(digraph<charT>(charT(')'))); char_set.add_single(digraph<charT>(charT(']'))); char_set.add_single(digraph<charT>(charT('}'))); break; case '"': char_set.add_single(digraph<charT>(charT('"'))); char_set.add_single(digraph<charT>(charT('\''))); char_set.add_single(digraph<charT>(charT('`'))); break; case '\'': char_set.add_single(digraph<charT>(charT('\''))); char_set.add_single(digraph<charT>(charT(','))); char_set.add_single(digraph<charT>(charT('#'))); break; case '<': char_set.add_single(digraph<charT>(charT(';'))); break; case '>': char_set.add_single(digraph<charT>(charT('\n'))); char_set.add_single(digraph<charT>(charT('\f'))); break; default: fail(regex_constants::error_ctype, m_position - m_base); return false; } if(0 == this->append_set(char_set)) { fail(regex_constants::error_ctype, m_position - m_base); return false; } ++m_position; return true; } template <class charT, class traits> regex_constants::syntax_option_type basic_regex_parser<charT, traits>::parse_options() { // we have a (?imsx-imsx) group, convert it into a set of flags: regex_constants::syntax_option_type f = this->flags(); bool breakout = false; do { switch(*m_position) { case 's': f |= regex_constants::mod_s; f &= ~regex_constants::no_mod_s; break; case 'm': f &= ~regex_constants::no_mod_m; break; case 'i': f |= regex_constants::icase; break; case 'x': f |= regex_constants::mod_x; break; default: breakout = true; continue; } if(++m_position == m_end) { // Rewind to start of (? sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_paren, m_position - m_base); return false; } } while(!breakout); breakout = false; if(*m_position == static_cast<charT>('-')) { if(++m_position == m_end) { // Rewind to start of (? sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_paren, m_position - m_base); return false; } do { switch(*m_position) { case 's': f &= ~regex_constants::mod_s; f |= regex_constants::no_mod_s; break; case 'm': f |= regex_constants::no_mod_m; break; case 'i': f &= ~regex_constants::icase; break; case 'x': f &= ~regex_constants::mod_x; break; default: breakout = true; continue; } if(++m_position == m_end) { // Rewind to start of (? sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_paren, m_position - m_base); return false; } } while(!breakout); } return f; } template <class charT, class traits> bool basic_regex_parser<charT, traits>::unwind_alts(std::ptrdiff_t last_paren_start) { // // If we didn't actually add any states after the last // alternative then that's an error: // if((this->m_alt_insert_point == static_cast<std::ptrdiff_t>(this->m_pdata->m_data.size())) && (!m_alt_jumps.empty()) && (m_alt_jumps.back() > last_paren_start) && !( ((this->flags() & regbase::main_option_type) == regbase::perl_syntax_group) && ((this->flags() & regbase::no_empty_expressions) == 0) ) ) { fail(regex_constants::error_empty, this->m_position - this->m_base, "Can't terminate a sub-expression with an alternation operator |."); return false; } // // Fix up our alternatives: // while((!m_alt_jumps.empty()) && (m_alt_jumps.back() > last_paren_start)) { // // fix up the jump to point to the end of the states // that we've just added: // std::ptrdiff_t jump_offset = m_alt_jumps.back(); m_alt_jumps.pop_back(); this->m_pdata->m_data.align(); re_jump* jmp = static_cast<re_jump*>(this->getaddress(jump_offset)); BOOST_REGEX_ASSERT(jmp->type == syntax_element_jump); jmp->alt.i = this->m_pdata->m_data.size() - jump_offset; } return true; } #ifdef BOOST_REGEX_MSVC #pragma warning(pop) #endif } // namespace BOOST_REGEX_DETAIL_NS } // namespace boost #endif
bc05c0d52a7000f61baf67ba02e390667041ccd3
9bdb2af7525c873e0594c7bee6d5a4e16d07850b
/4AT100_V2/DefaultComponent/DefaultConfig/sim.cpp
f1f4109fb9f47401082a47d88ad264b21850f8bf
[]
no_license
Madhav6697/Group4-ibm
1b886765dd3bdf9706c664c917a515c8d4e947fd
8d5b0d049c1ef3ea2522107a022112b752a5d9dd
refs/heads/master
2023-03-16T01:31:29.528226
2020-06-13T20:30:12
2020-06-13T20:30:12
null
0
0
null
null
null
null
UTF-8
C++
false
false
824
cpp
/******************************************************************** Rhapsody : 8.4 Login : 20191029 Component : DefaultComponent Configuration : DefaultConfig Model Element : sim //! Generated Date : Thu, 28, May 2020 File Path : DefaultComponent\DefaultConfig\sim.cpp *********************************************************************/ //## auto_generated #include "sim.h" //## package UnityPkg //## class sim //#[ ignore sim::sim(void) { m_nSampleTime = 100; TestDrive_initialize(1); } sim::~sim(void) { TestDrive_terminate(); } void sim::doStep(void) { TestDrive_step(0); } //#] /********************************************************************* File Path : DefaultComponent\DefaultConfig\sim.cpp *********************************************************************/
ce7849efd0ec77d908a377f873d513f0faa296e3
cab63902992d4b2a1761507569d16dbecaa3ef70
/telement.h
9b6fb0bd29ce5aaf67e0457bb213f62f6a23ea0d
[]
no_license
hosinoyuya/C-STLDesigner
c73c21d4cf68b989b20124dfc42a8c6d0b87d408
07f20a215ff8a6c971b99c45f90e57ac818c4e7a
refs/heads/master
2020-06-12T05:56:52.772827
2016-10-03T07:13:52
2016-10-03T07:13:52
194,214,016
0
0
null
null
null
null
UTF-8
C++
false
false
419
h
#pragma once #include "line_element_base.h" #include "unit_change.h" #include <string> using namespace std; class telement : public line_element_base { public: telement(string name); ~telement(); virtual string get_param_str(); virtual void set_length(double length); private: double time_delay_; virtual int node_num(); virtual void set_spetialized_parameters(string key, string val); string param_str_; };
a94c331c0cb3acf106cd0b1506365cd2d50f2ce7
a507a9e944b6c27229d57dba5c48f0a86912e7a5
/c3dToolKit/core/c3dSubMeshData.cpp
ee012b7ef22d60859cf4b7e35bc4449eda258676
[]
no_license
jjzhang166/_3DToolKit2-for-cocos2dx-3x
9437409c7f9ec95b009bb36b8efc696909017150
852b4a6c71de78855b7979886d7acbc76ec2376c
refs/heads/master
2023-03-18T19:08:35.208982
2015-05-26T09:48:44
2015-05-26T09:48:44
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,588
cpp
// // c3dSubMeshData.cpp // HelloCpp // // Created by Yang Chao (wantnon) on 14-1-2. // // #include "c3dSubMeshData.h" void Cc3dSubMeshData::initIDtriList(const short indexArray[],int indexArrayLen){ assert(indexArrayLen%3==0); m_IDtriList.clear(); for(int i=0;i<indexArrayLen;i+=3){ Cc3dIDTriangle IDtri(indexArray[i],indexArray[i+1],indexArray[i+2]); m_IDtriList.push_back(IDtri); } } void Cc3dSubMeshData::initPositionList(const float positionArray[],int positionArrayLen){ m_positionList.clear(); for(int i=0;i<positionArrayLen;i+=4){ Cc3dVector4 pos(positionArray[i],positionArray[i+1],positionArray[i+2],positionArray[i+3]); m_positionList.push_back(pos); } } void Cc3dSubMeshData::initTexCoordList(const float texCoordArray[],int texCoordArrayLen){ m_texCoordList.clear(); for(int i=0;i<texCoordArrayLen;i+=2){ Cc3dVector2 texCoord(texCoordArray[i],texCoordArray[i+1]); m_texCoordList.push_back(texCoord); } } void Cc3dSubMeshData::initNormalList(const float normalArray[],int normalArrayLen){ m_normalList.clear(); for(int i=0;i<normalArrayLen;i+=4){ Cc3dVector4 normal(normalArray[i],normalArray[i+1],normalArray[i+2],normalArray[i+3]); m_normalList.push_back(normal); } } void Cc3dSubMeshData::initColorList(const float colorArray[],int colorArrayLen){ m_colorList.clear(); for(int i=0;i<colorArrayLen;i+=4){ Cc3dVector4 color(colorArray[i],colorArray[i+1],colorArray[i+2],colorArray[i+3]); m_colorList.push_back(color); } }
4bf44fc852192fb4ea000458ec0f3ecf7b2aac62
891f1abec5a1f233021d0d9645dc610e1c67a188
/Homework/homework 03.03/LinkedList.cpp
065c479d990c8463914177bf2ee33dc07d6a4b54
[]
no_license
IsmagilovaD/IsmagilovaD_11005_ASD
60a58c1fb5ad80437c887ce99ab5d49e7a24fae0
50f9ab1d1183eb14f1072a8a99b7fb0b9b508af4
refs/heads/master
2023-05-04T14:42:29.187919
2021-05-23T11:04:19
2021-05-23T11:04:19
339,623,137
0
0
null
null
null
null
UTF-8
C++
false
false
1,196
cpp
#include <iostream> using namespace std; struct Node { int item; Node* next = 0; }; struct LinkedList { Node* root = 0; void Add(int item) { Node* node = new Node; node->item = item; if (!root) root = node; else { Node* temp = root; while (temp->next) { temp = temp->next; } temp->next = node; } } int size() { if (!root) return 0; else { int k = 0; Node* temp = root; while (temp->next) { temp = temp->next; k++; } return k+1; } } int get(int id) { if (!root) return 0; else { Node* temp = root; int i = 1; while (i != id) { if (temp->next) { temp = temp->next; i++; } else { cout << "id is not correct"; return 0; } } return temp->item; } } void PrintAll() { if (!root) throw 1; Node* temp = root; while (temp) { cout << temp->item << ' '; temp = temp->next; } cout << endl; } }; int main() { LinkedList* list = new LinkedList; list->Add(100); list->Add(20); list->Add(3000); list->Add(4); cout << list->get(3) << endl << list->size() << endl; list->PrintAll(); delete list; return 0; }
a494d898741c07012f87e313ae57b571f44a544b
802c8ded8cf50a88ac52af0bef05a2d3849b50a7
/libwallet/pubkey.h
c7aa174227d17d083ce7f1486188171cd106d69f
[]
no_license
lialvin/utsuite
aaca1b847a66467fa3d5263cddbfc481dfb5678c
946bbda6b3eb07b79544b6235265faf55a1ce341
refs/heads/master
2021-08-24T16:18:34.135040
2020-04-16T01:56:50
2020-04-16T01:56:50
161,790,500
1
0
null
null
null
null
UTF-8
C++
false
false
6,205
h
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2015 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_PUBKEY_H #define BITCOIN_PUBKEY_H #include "hash.h" #include "serialize.h" #include "uint256.h" #include <stdexcept> #include <vector> /** * secp256k1: * const unsigned int PRIVATE_KEY_SIZE = 279; * const unsigned int PUBLIC_KEY_SIZE = 65; * const unsigned int SIGNATURE_SIZE = 72; * * see www.keylength.com * script supports up to 75 for single byte push */ /** A reference to a CKey: the Hash160 of its serialized public key */ class CKeyID : public uint160 { public: CKeyID() : uint160() {} CKeyID(const uint160& in) : uint160(in) {} }; typedef uint256 ChainCode; /** An encapsulated public key. */ class CPubKey { private: /** * Just store the serialized data. * Its length can very cheaply be computed from the first byte. */ unsigned char vch[65]; //! Compute the length of a pubkey with a given first byte. unsigned int static GetLen(unsigned char chHeader) { if (chHeader == 2 || chHeader == 3) return 33; if (chHeader == 4 || chHeader == 6 || chHeader == 7) return 65; return 0; } //! Set this key data to be invalid void Invalidate() { vch[0] = 0xFF; } public: //! Construct an invalid public key. CPubKey() { Invalidate(); } //! Initialize a public key using begin/end iterators to byte data. template <typename T> void Set(const T pbegin, const T pend) { int len = pend == pbegin ? 0 : GetLen(pbegin[0]); if (len && len == (pend - pbegin)) memcpy(vch, (unsigned char*)&pbegin[0], len); else Invalidate(); } //! Construct a public key using begin/end iterators to byte data. template <typename T> CPubKey(const T pbegin, const T pend) { Set(pbegin, pend); } //! Construct a public key from a byte vector. CPubKey(const std::vector<unsigned char>& vch) { Set(vch.begin(), vch.end()); } std::string toBase58(); //! Simple read-only vector-like interface to the pubkey data. unsigned int size() const { return GetLen(vch[0]); } const unsigned char* begin() const { return vch; } const unsigned char* end() const { return vch + size(); } const unsigned char& operator[](unsigned int pos) const { return vch[pos]; } //! Comparator implementation. friend bool operator==(const CPubKey& a, const CPubKey& b) { return a.vch[0] == b.vch[0] && memcmp(a.vch, b.vch, a.size()) == 0; } friend bool operator!=(const CPubKey& a, const CPubKey& b) { return !(a == b); } friend bool operator<(const CPubKey& a, const CPubKey& b) { return a.vch[0] < b.vch[0] || (a.vch[0] == b.vch[0] && memcmp(a.vch, b.vch, a.size()) < 0); } //! Implement serialization, as if this was a byte vector. unsigned int GetSerializeSize(int nType, int nVersion) const { return size() + 1; } template <typename Stream> void Serialize(Stream& s, int nType, int nVersion) const { unsigned int len = size(); ::WriteCompactSize(s, len); s.write((char*)vch, len); } template <typename Stream> void Unserialize(Stream& s, int nType, int nVersion) { unsigned int len = ::ReadCompactSize(s); if (len <= 65) { s.read((char*)vch, len); } else { // invalid pubkey, skip available data char dummy; while (len--) s.read(&dummy, 1); Invalidate(); } } //! Get the KeyID of this public key (hash of its serialization) CKeyID GetID() const { return CKeyID(Hash160(vch, vch + size())); } //! Get the 256-bit hash of this public key. uint256 GetHash() const { return Hash(vch, vch + size()); } /* * Check syntactic correctness. * * Note that this is consensus critical as CheckSig() calls it! */ bool IsValid() const { return size() > 0; } //! fully validate whether this is a valid public key (more expensive than IsValid()) bool IsFullyValid() const; //! Check whether this is a compressed public key. bool IsCompressed() const { return size() == 33; } /** * Verify a DER signature (~72 bytes). * If this public key is not fully valid, the return value will be false. */ bool Verify(const uint256& hash, const std::vector<unsigned char>& vchSig) const; /** * Check whether a signature is normalized (lower-S). */ static bool CheckLowS(const std::vector<unsigned char>& vchSig); //! Recover a public key from a compact signature. bool RecoverCompact(const uint256& hash, const std::vector<unsigned char>& vchSig); //! Turn this public key into an uncompressed public key. bool Decompress(); //! Derive BIP32 child pubkey. bool Derive(CPubKey& pubkeyChild, ChainCode &ccChild, unsigned int nChild, const ChainCode& cc) const; }; struct CExtPubKey { unsigned char nDepth; unsigned char vchFingerprint[4]; unsigned int nChild; ChainCode chaincode; CPubKey pubkey; friend bool operator==(const CExtPubKey &a, const CExtPubKey &b) { return a.nDepth == b.nDepth && memcmp(&a.vchFingerprint[0], &b.vchFingerprint[0], 4) == 0 && a.nChild == b.nChild && a.chaincode == b.chaincode && a.pubkey == b.pubkey; } void Encode(unsigned char code[74]) const; void Decode(const unsigned char code[74]); bool Derive(CExtPubKey& out, unsigned int nChild) const; }; /** Users of this module must hold an ECCVerifyHandle. The constructor and * destructor of these are not allowed to run in parallel, though. */ class ECCVerifyHandle { static int refcount; public: ECCVerifyHandle(); ~ECCVerifyHandle(); }; #endif // BITCOIN_PUBKEY_H
7fad69e0bbf3b9792bcaca934183034c74db3b4f
a9b74851ed9d12ffa5d8d8b9d816c6fda14169dc
/extra/examples/ecomapper/navigator.hh
beffe0dd9aac6f05067062157fe184774ad8a22e
[]
permissive
miatauro/trex2-agent
787716379b66ad25d8c0b3ffe2e451e4a051b61a
b1488543771604c148518b84fd38848708597c56
refs/heads/master
2020-06-09T12:48:23.229509
2015-12-15T19:57:31
2015-12-15T19:57:31
193,440,297
0
0
BSD-3-Clause
2019-06-24T05:34:32
2019-06-24T05:34:32
null
UTF-8
C++
false
false
2,430
hh
#ifndef H_ECOMAPPER_NAVIGATOR #define H_ECOMAPPER_NAVIGATOR #include <trex/transaction/TeleoReactor.hh> #include <iostream> #include <mutex> #include <boost/unordered_map.hpp> //Open source library for Cubic Splines #include "spline.hh" namespace TREX { namespace ecomapper { class Navigator :public TREX::transaction::TeleoReactor { public: Navigator(TREX::transaction::TeleoReactor::xml_arg_type arg); ~Navigator(); private: void handleInit(); bool synchronize(); void notify(TREX::transaction::Observation const &obs); void handleRequest(TREX::transaction::goal_id const &g); void handleRecall(TREX::transaction::goal_id const &g); void stateObservation(TREX::transaction::Observation const &obs); void dvlObservation(TREX::transaction::Observation const &obs); void wqmObservation(TREX::transaction::Observation const &obs); void ctd_rhObservation(TREX::transaction::Observation const &obs); void fixObservation(TREX::transaction::Observation const &obs); void navSatFixObservation(TREX::transaction::Observation const &obs); double getAttribute(std::string const &name, TREX::transaction::Observation const &obs); void addToMap(TREX::transaction::TICK tick, double value) { columns[tick]=value; }; double getMapValue(TREX::transaction::TICK tick) { return columns[tick];}; //Cubic spline for path making magnet::math::Spline spline; std::mutex lock; bool beginBoundaryTracking; bool ros_commanderBusy; typedef boost::unordered_map<TREX::transaction::TICK, double> TickDoubleMap; TickDoubleMap columns; typedef boost::unordered_map<TREX::transaction::TICK, std::pair<double, double> > CoordinateMap; CoordinateMap coordinates; TickDoubleMap wp_numbers; double nextwp_number; int numberOfSplinePoints; TREX::transaction::TICK currentTick; std::list<TREX::transaction::goal_id> m_pending; static TREX::utils::Symbol const navigatorObj; static TREX::utils::Symbol const waypointObj; }; } } #endif //H_ECOMAPPER_NAVIGATOR
[ "[email protected]@eff219cc-a5a7-32d8-cb09-f88e880e2402" ]
[email protected]@eff219cc-a5a7-32d8-cb09-f88e880e2402
89b346f73bffcb4f0ac2dbfb3bf33dbe862281d9
85ddfc9db105aa6f26a33f9280bff321a2ebadf8
/Headers/IPyx.hpp
8b8ff26363fe7295c5ab8cb6ac09d808f15d7aa9
[]
no_license
PyxProject/PyxSDK
1e458ec8e78b4f526af3b73fdf3a66fa0b97dfbf
cf06a296f1c1c6d9f7e618b4c00cc60232378b02
refs/heads/master
2020-09-22T11:00:23.336607
2016-08-18T05:31:15
2016-08-18T05:31:15
65,956,263
0
0
null
null
null
null
UTF-8
C++
false
false
759
hpp
#pragma once namespace pyx { namespace Extensions { class IExtensionsContext; } ///< Memory namespace Memory { class IMemoryContext; } ///< Memory namespace Graphics { class IGraphicsContext; } ///< Graphics class IPyx { public: virtual ~IPyx() { } /// Return the Pyx module handle virtual void* GetPyxModule() = 0; /// Return the main Pyx directory path virtual const wchar_t* GetPyxDirectory() = 0; /// Return the Pyx MemoryContext virtual Memory::IMemoryContext& GetMemoryContext() = 0; /// Return the Pyx GraphicsContext virtual Graphics::IGraphicsContext& GetGraphicsContext() = 0; /// Return the Pyx ExtensionsContext virtual Extensions::IExtensionsContext& GetExtensionsContext() = 0; }; } ///< Pyx
1e1be740ddf3dcfd4ddd42aed855d20b31d22887
641b69cdbfb83bee96826e5c473e59548f1dc1a5
/UbiGame/Source/Game/Components/PlayerMovementComponent.h
b00bb825856f68ca4f01efd77f48f32ab0daeb9e
[]
no_license
hemelroy/ubigame
7173845d265750eb9823c4050a84736ce2644b46
53611bf117b965ca5c1d34ca305eb3feda6a8434
refs/heads/master
2020-07-26T04:00:23.173428
2019-09-24T18:01:49
2019-09-24T18:01:49
208,525,814
2
1
null
null
null
null
UTF-8
C++
false
false
325
h
#pragma once #include "GameEngine\EntitySystem\Component.h" namespace Game { class PlayerMovementComponent : public GameEngine::Component { public: PlayerMovementComponent(); ~PlayerMovementComponent(); virtual void Update() override; virtual void OnAddToWorld() override; private: int m_lastFaceIndex; }; }
741336298fe805f5804c7a7762e8032e086551e9
f11059a855524ea036e4c17b1c19d11d54c16099
/firmware/stm/Src/comm_ascii.cpp
c408913b59188f33e3f4343db8b85e393b7244a1
[]
no_license
Forrest-Z/robot
8edc6d27a6e69c343dde921dada2f2030fb7d8c2
66877347b3dd0fd5bd870a6d64fb5a606f4075c6
refs/heads/master
2023-04-04T11:58:33.925162
2021-04-15T23:25:29
2021-04-15T23:25:29
null
0
0
null
null
null
null
UTF-8
C++
false
false
4,393
cpp
/* * comm_ascii.cpp * * Created on: May 24, 2017 * Author: addaon */ #include "comm_ascii.h" #include "command_handler.h" #include "motor.h" #include "usbd_cdc_if.h" #include "packages/hal/proto/vcu_command_envelope.nanopb.h" #include "packages/hal/proto/vcu_command_response.nanopb.h" static volatile int has_pending_error = 0; static volatile int has_pending_command = 0; static CommandHandler::MotionCommand pending_command; void OnUSBReceive_ASCII(uint8_t* Buf, uint32_t *Len) { if (Len && *Len < std::numeric_limits<uint16_t>::max()) { HAL_GPIO_TogglePin(LD3_GPIO_Port, LD3_Pin); CDC_Transmit_FS(Buf, static_cast<uint16_t>(*Len)); // Best effort, no checking HAL_GPIO_TogglePin(LD3_GPIO_Port, LD3_Pin); static enum { V_READY, VELOCITY, C_READY, CURVATURE, ERROR } state = V_READY; static float v_scale = 1.0f; static float v_value = 0.0f; static float c_scale = 1.0f; static float c_value = 0.0f; for (uint32_t i = 0; i < *Len; i++) { uint8_t c = Buf[i]; switch (state) { case V_READY: switch (c) { case '+': v_scale = +1.0f; break; case '-': v_scale = -1.0f; break; case '0' ... '9': v_value += v_scale * static_cast<float>(c - '0'); state = VELOCITY; break; default: state = ERROR; --i; break; } break; case VELOCITY: switch (c) { case '0' ... '9': if (v_scale >= 1.0f) v_value *= 10.0f; v_value += v_scale * static_cast<float>(c - '0'); if (v_scale < 1.0f) v_scale /= 10.0f; break; case '.': v_scale /= 10.0f; break; case ',': state = C_READY; break; default: state = ERROR; --i; break; } break; case C_READY: switch (c) { case '+': c_scale = +1.0f; break; case '-': c_scale = -1.0f; break; case '0' ... '9': c_value += c_scale * static_cast<float>(c - '0'); state = CURVATURE; break; default: state = ERROR; --i; break; } break; case CURVATURE: switch (c) { case '0' ... '9': if (c_scale >= 1.0f) c_value *= 10.0f; c_value += c_scale * static_cast<float>(c - '0'); if (c_scale < 1.0f) c_scale /= 10.0f; break; case '.': c_scale /= 10.0f; break; case '\r': break; case '\n': has_pending_command = 1; pending_command = {v_value, c_value}; state = V_READY; v_scale = 1.0f; v_value = 0.0f; c_scale = 1.0f; c_value = 0.0f; break; default: state = ERROR; --i; break; } break; case ERROR: switch (c) { case '\r': break; case '\n': ++has_pending_error; state = V_READY; v_scale = 1.0f; v_value = 0.0f; c_scale = 1.0f; c_value = 0.0f; break; default: /* nothing */ break; } } } } } void OnMainLoop_ASCII() { int has_pending_error_shadow; int has_pending_command_shadow; struct CommandHandler::MotionCommand pending_command_shadow; __disable_irq(); has_pending_error_shadow = has_pending_error; has_pending_command_shadow = has_pending_command; pending_command_shadow = pending_command; has_pending_error = 0; has_pending_command = 0; __enable_irq(); if (has_pending_error_shadow) { uint8_t error_msg[] = "parse error\r\n"; HAL_GPIO_TogglePin(LD3_GPIO_Port, LD3_Pin); CDC_Transmit_FS(error_msg, sizeof(error_msg)); // Best effort, no checking HAL_GPIO_TogglePin(LD3_GPIO_Port, LD3_Pin); } if (has_pending_command_shadow) { uint8_t init_msg[] = "init error\r\n"; uint8_t ack_msg[] = "okay\r\n"; uint8_t range_msg[] = "range error\r\n"; uint8_t *msg = NULL; uint8_t msg_length = 0; if (!command_handler) { msg = init_msg; msg_length = sizeof(init_msg); } else if (pending_command_shadow.velocity_fwd_m_s >= -HARD_SPEED_LIMIT && pending_command_shadow.velocity_fwd_m_s <= HARD_SPEED_LIMIT && pending_command_shadow.curvature_right_inv_m >= -HARD_CURVATURE_LIMIT && pending_command_shadow.curvature_right_inv_m <= HARD_CURVATURE_LIMIT) { command_handler->HandleCommand(pending_command_shadow); msg = ack_msg; msg_length = sizeof(ack_msg); } else { msg = range_msg; msg_length = sizeof(range_msg); } HAL_GPIO_TogglePin(LD3_GPIO_Port, LD3_Pin); CDC_Transmit_FS(msg, msg_length); // Best effort, no checking HAL_GPIO_TogglePin(LD3_GPIO_Port, LD3_Pin); } }
0fa879ff223b7943c2da44a1e1dacb91de229cbc
4937439d44aeda85ceb6d81163d15a691559a13d
/code/eclipse/robby/Base/Base.cpp
70ab6d62fcb0181f2d8d17f13c70b5769627dc42
[]
no_license
mfatzer/Robby
7f483a8f7fd441e122272aaf59d1a06682f50f91
cb8c346c1fca06fb0ea14cc3515239aefb1f9e76
refs/heads/master
2021-01-10T08:08:30.182347
2015-06-24T21:48:36
2015-06-24T21:48:36
36,243,657
0
0
null
null
null
null
UTF-8
C++
false
false
554
cpp
// Do not remove the include below #include "Base.h" #include "Motor.h" #include "TimerA.h" #include "TimerC.h" #include "Logger.h" Logger setupLogger("setup()"); Logger loopLogger("loop()"); Motor motor1("Motor1", 10, 11, false, LeoTimer1); Motor motor2("Motor2", 8, 9, true, LeoTimer3); //The setup function is called once at startup of the sketch void setup() { Serial.begin(57600); // while (!Serial) { // ; // } setupLogger.log("Start"); motor1.setup(); motor2.setup(); } // The loop function is called in an endless loop void loop() { }
d8f9c5e032f72292dbd5580a5b80b46eaf0a912a
d7e9f18640aa4ef330f242b8472fad91d63648f3
/stack.cpp
e5665fe55710a7c128471a3db4bcb49568e4e233
[]
no_license
arifin-reza/Data-Structure
ee1e6184753c8ccbdb859ccaf3dc6e4758856fff
2e714d598349ee50f7c6cb68f0a524bbe1889534
refs/heads/master
2021-01-18T22:12:44.822471
2016-09-27T08:41:07
2016-09-27T08:41:07
69,221,169
0
0
null
null
null
null
UTF-8
C++
false
false
1,658
cpp
#include <iostream> #include <string.h> using namespace std; //Node structure struct node{ int val; node *next; }; //Stack class class stack{ struct node *top; public: stack(){ top = NULL; } void push(int val); void pop(); void show(); }; //Push void stack::push(int val){ struct node *ptr; ptr = new node; ptr->val = val; ptr->next = NULL; if(top != NULL){ ptr->next = top; } top = ptr; } //Pop void stack::pop(){ struct node *ptr; if(top == NULL){ cout<<"The Stack is empty"<<endl; }else{ ptr = top; top = top->next; cout<<"Poped value: "<<ptr->val<<endl; delete ptr; } } //Show the stack void stack::show(){ struct node *cur; cout<<"The stack: "<<endl; for(cur = top; cur != NULL; cur = cur->next){ cout<<cur->val<<"-> "; } cout<<"NULL"<<endl; } int main(){ stack s; char op[8]; int data; cout<<" Stack Implementation"<<endl; cout<<"========================================="<<endl; cout<<"Use with these arguments:"<<endl; cout<<"push <val> push the stack with val"<<endl; cout<<"pop pop the stack"<<endl; cout<<"quit quit the program"<<endl; while(1){ cin>>op; if(strcmp(op, "push") == 0){ cin>>data; s.push(data); }else if(strcmp(op, "pop") == 0){ s.pop(); }else if(strcmp(op, "quit") == 0){ break; } else{ cout<<"Please use the correct arguments"<<endl; } s.show(); } return 0; }
3a9f2c5d0e00b1ae9ebb1587fdf8a50298197426
7e2128a7ac692e9ee612be157b181b9476e76c7a
/src/KalmanTracker.h
a39348e641b4375427e0a75c31f4cf197f9afd1d
[ "MIT" ]
permissive
ZiliPeng/mtcnn-light-with-tracking
3f63f2890175171e263dc832a36a896645de043f
d374a6024095bb0f64b313b2a30790d3afe6fa5e
refs/heads/master
2021-01-14T16:12:40.824584
2020-02-26T02:02:03
2020-02-26T02:02:03
242,675,394
0
0
MIT
2020-02-24T07:43:26
2020-02-24T07:43:25
null
UTF-8
C++
false
false
1,236
h
/////////////////////////////////////////////////////////////////////////////// // KalmanTracker.h: KalmanTracker Class Declaration #ifndef KALMAN_H #define KALMAN_H 2 #include "opencv2/video/tracking.hpp" #include "opencv2/highgui/highgui.hpp" using namespace std; using namespace cv; #define StateType Rect_<float> // This class represents the internel state of individual tracked objects observed as bounding box. class KalmanTracker { public: KalmanTracker() { init_kf(StateType()); m_time_since_update = 0; m_hits = 0; m_hit_streak = 0; m_age = 0; m_id = kf_count; //kf_count++; } KalmanTracker(StateType initRect) { init_kf(initRect); m_time_since_update = 0; m_hits = 0; m_hit_streak = 0; m_age = 0; m_id = kf_count; kf_count++; } ~KalmanTracker() { m_history.clear(); } StateType predict(); void update(StateType stateMat); StateType get_state(); StateType get_rect_xysr(float cx, float cy, float s, float r); StateType lastRect; static int kf_count; int m_time_since_update; int m_hits; int m_hit_streak; int m_age; int m_id; private: void init_kf(StateType stateMat); cv::KalmanFilter kf; cv::Mat measurement; std::vector<StateType> m_history; }; #endif
3b73f4aab31ddfe605dc1750191ad61050e04bbe
e350332fbb8168e7c2c47af4b3c1e5645ba9a042
/HWRemoteControl/DEPRECATED/ArduinoPS2_SimpleTest/ArduinoPS2_SimpleTest.ino
a3de8b62e7946c1f443d95d5260f1af8d14e46c1
[ "MIT" ]
permissive
davidoises/FlightController
079803d6f161c2a1c9ad86026359cc84bd528482
7bb12fd073a16ef1ae07648538a225fe0c13c74b
refs/heads/master
2022-11-20T17:39:17.488796
2020-07-26T16:53:13
2020-07-26T16:53:13
266,119,912
12
3
null
null
null
null
UTF-8
C++
false
false
3,375
ino
#include "PS2X_lib.h" PS2X ps2x; // create PS2 Controller Class //right now, the library does NOT support hot pluggable controllers, meaning //you must always either restart your Arduino after you connect the controller, //or call config_gamepad(pins) again after connecting the controller. int error = 0; byte type = 0; byte vibrate = 0; void setup(){ Serial.begin(115200); delay(300); //added delay to give wireless ps2 module some time to startup, before configuring it //CHANGES for v1.6 HERE!!! **************PAY ATTENTION************* //setup pins and settings: GamePad(clock, command, attention, data, Pressures?, Rumble?) check for error error = ps2x.config_gamepad(13, 11, 10, 12, true, true); } void loop() { /* You must Read Gamepad to get new values and set vibration values ps2x.read_gamepad(small motor on/off, larger motor strenght from 0-255) if you don't enable the rumble, use ps2x.read_gamepad(); with no values You should call this at least once a second */ if(error == 1) //skip loop if no controller found return; ps2x.read_gamepad(); if(ps2x.Button(PSB_START)) //will be TRUE as long as button is pressed Serial.println("Start is being held"); if(ps2x.Button(PSB_SELECT)) Serial.println("Select is being held"); if(ps2x.Button(PSB_PAD_UP)) { //will be TRUE as long as button is pressed Serial.print("Up held this hard: "); Serial.println(ps2x.Analog(PSAB_PAD_UP), DEC); } if(ps2x.Button(PSB_PAD_RIGHT)){ Serial.print("Right held this hard: "); Serial.println(ps2x.Analog(PSAB_PAD_RIGHT), DEC); } if(ps2x.Button(PSB_PAD_LEFT)){ Serial.print("LEFT held this hard: "); Serial.println(ps2x.Analog(PSAB_PAD_LEFT), DEC); } if(ps2x.Button(PSB_PAD_DOWN)){ Serial.print("DOWN held this hard: "); Serial.println(ps2x.Analog(PSAB_PAD_DOWN), DEC); } vibrate = ps2x.Analog(PSAB_CROSS); //this will set the large motor vibrate speed based on how hard you press the blue (X) button if (ps2x.NewButtonState()) { //will be TRUE if any button changes state (on to off, or off to on) if(ps2x.Button(PSB_L3)) Serial.println("L3 pressed"); if(ps2x.Button(PSB_R3)) Serial.println("R3 pressed"); if(ps2x.Button(PSB_L2)) Serial.println("L2 pressed"); if(ps2x.Button(PSB_R2)) Serial.println("R2 pressed"); if(ps2x.Button(PSB_TRIANGLE)) Serial.println("Triangle pressed"); } if(ps2x.ButtonPressed(PSB_CIRCLE)) //will be TRUE if button was JUST pressed Serial.println("Circle just pressed"); if(ps2x.NewButtonState(PSB_CROSS)) //will be TRUE if button was JUST pressed OR released Serial.println("X just changed"); if(ps2x.ButtonReleased(PSB_SQUARE)) //will be TRUE if button was JUST released Serial.println("Square just released"); if(ps2x.Button(PSB_L1) || ps2x.Button(PSB_R1)) { //print stick values if either is TRUE //Serial.print("Stick Values:"); Serial.print(ps2x.Analog(PSS_LY), DEC); //Left stick, Y axis. Other options: LX, RY, RX Serial.print(","); Serial.print(ps2x.Analog(PSS_LX), DEC); Serial.print(","); Serial.print(ps2x.Analog(PSS_RY), DEC); Serial.print(","); Serial.println(ps2x.Analog(PSS_RX), DEC); } delay(50); }
c96d86bd988f0c74829801cf2e9b1266d7b0114c
02fec111191ecede92d844422125ac8482171bde
/Contests/bapc18/j.cpp
cd8a25c453d4c82e5ec7921d05db4b929b8c5f29
[]
no_license
Lucas3H/Maratona
475825b249659e376a1f63a6b3b6a1e15c0d4287
97a2e2a91fb60243124fc2ffb4193e1b72924c3c
refs/heads/master
2020-11-24T18:35:24.456960
2020-11-06T14:00:56
2020-11-06T14:00:56
228,292,025
0
0
null
null
null
null
UTF-8
C++
false
false
1,870
cpp
#include<bits/stdc++.h> using namespace std; #define fr(i, n) for(int i = 0; i < n; i++) #define frr(i, n) for(int i = 1; i <= n; i++) #define frm(i, n) for(int i = n-1; i >= 0; i--) #define pb push_back #define f first #define s second typedef long long ll; typedef pair<int,int> pii; typedef pair<ll, ll> pll; typedef pair<double, double> ponto; typedef vector<vector<ll>> matrix; #define mem(v, k) memset(v, k, sizeof(v)); #define db cout << "Debug" << endl; #define mp make_pair #define pq priority_queue #define mx(a, b) a = max(a, b); #define mod(a, b) a = a%b; #define MAXN 100010 #define MOD 1000000007 #define MAXL 30 #define ROOT 1 #define INF 987654321 #define pi acos(-1) double l[4]; double heron(double a, double b, double c){ if(c > a + b || a > b + c || b > a + c) { return -INF; } return sqrt((a + b + c)/2*(a + b - c)/2*(c + b - a)/2*(a + c - b)/2); } double maximo(double a, double b){ if(a > b) return a; else return b; } double solve(){ double ang = 0.000000, eps = 0.000001, ans = 0.000000; double a = l[3], b = l[2]; double diag = a - b; while(ang <= pi/2){ diag = sqrt(a*a + b*b - 2*a*b*cos(ang)); double area = a*b*sin(ang)/2 + heron(l[1], l[0], diag); //printf("%.6lf\n", diag); ans = maximo(area, ans); ang+=eps; } a = l[3], b = l[1]; ang = 0.0000000, diag = a - b; while(ang <= pi/2){ diag = sqrt(a*a + b*b - 2*a*b*cos(ang)); double area = a*b*sin(ang)/2 + heron(l[2], l[0], diag); ans = maximo(area, ans); ang+=eps; } a = l[3], b = l[0]; ang = 0.0000000, diag = a - b; while(ang <= pi/2){ diag = sqrt(a*a + b*b - 2*a*b*cos(ang)); double area = a*b*sin(ang)/2 + heron(l[1], l[2], diag); ans = maximo(area, ans); ang+=eps; } return ans; } int main(){ //ios::sync_with_stdio(false); cin >> l[0] >> l[1] >> l[2] >> l[3]; sort(l, l + 4); printf("%.7lf\n", solve()); }
96f250f7b8fb67951a6ff3a283b2c33f05dac086
8402f9a3506d979187de84b726ab4029a91b3fed
/codeforces/cf-1285E.cpp
bd6d7d5b5132cafcb163bccdd39c9ea7f80b4a09
[]
no_license
forty-twoo/acm-code-record2
ef96c6f660543552854f8475dd18afe72ba6e601
05743d93d383dfd96125be2f5e784300d93555ae
refs/heads/master
2020-09-03T19:57:07.989357
2020-03-19T16:31:48
2020-03-19T16:31:48
219,553,846
0
0
null
null
null
null
UTF-8
C++
false
false
1,275
cpp
/* * @Don't panic: Allons-y! * @Author: forty-twoo * @LastEditTime: 2020-02-18 19:44:46 * @Description: 删除一个区间使得剩下区间的并集数最多 * @Source: https://codeforces.com/contest/1285/problem/E */ #include<bits/stdc++.h> #define mst(a,b) memset(a,b,sizeof(a)) #define prique priority_queue #define INF 0x3f3f3f3f #define pb push_back #define pf push_front const double eps=1e-5; const int MAX=2e5+10; const int MAXN=4e5+10; const int MOD=20071027; typedef long long ll; using namespace std; typedef pair<int,int> PI; int n; vector<PI> V; set<int> S; int cnt[MAX]; int main(){ #ifndef ONLINE_JUDGE freopen("data.txt","r",stdin); #endif int ks; scanf("%d",&ks); while(ks--){ scanf("%d",&n); for(int i=0;i<=n+1;i++)cnt[i]=0; V.clear();S.clear(); int x,y,tot=0; for(int i=1;i<=n;i++){ scanf("%d%d",&x,&y); V.pb(make_pair(x,-i)); V.pb(make_pair(y,i)); } sort(V.begin(),V.end()); for(auto t:V){ int sid=abs(t.second); if(t.second<0){ if(S.empty())cnt[sid]--; S.insert(sid); }else{ S.erase(sid); if(S.empty())cnt[sid]--; } if(S.empty())tot++; if(S.size()==1)cnt[*S.begin()]++; } int ext=-1; for(int i=1;i<=n;i++)ext=max(ext,cnt[i]); printf("%d\n",tot+ext); } return 0; }
8331c06ef8b0a6265b31a54a68d8916a8281695d
efd7349a39f6d728cb08f0ad4d217a03a03ea12c
/compiler/helper.hpp
053cb2f12e8c378f3f09430df7977198b1d64723
[ "MIT" ]
permissive
filhodanuvem/cloudblocks
64a966ff3b3147b08a66368e0dfd09e2362522cf
1a09a3753f597ff0a93e67acfae3e26abe1b1196
refs/heads/master
2022-02-23T09:10:43.835019
2019-10-05T12:46:29
2019-10-05T12:46:29
null
0
0
null
null
null
null
UTF-8
C++
false
false
253
hpp
#ifndef CLOUD_HELPER #define CLOUD_HELPER 1 class Helper { public: static char* str_cpy(const char* needle); static char* str_cat(const char* string1, const char* string2); static bool str_eq(const char* string1, const char* string2); }; #endif
8eb1ec44c91e5b072b58600245f7eaef8e1e2adc
a8aa270ca072e22f7c1646b12cdfd4a1b7d7ac15
/score.cpp
1729ac7324138ba1950cada008fc180b4e6c4957
[]
no_license
mnito/ttt-seeder
2f0a4d21116ccc5d2d19641cc836809fee2145ef
313027766f3cacdaab70abe7f78faf1fe46dbcad
refs/heads/master
2021-05-12T03:49:01.510107
2018-01-17T03:32:06
2018-01-17T03:32:06
117,627,425
0
0
null
null
null
null
UTF-8
C++
false
false
948
cpp
#include <unordered_map> #include "score.hpp" const unsigned int WEIGHT_PERCEIVED_SKILL = 2; const unsigned int WEIGHT_OUTWARD_SKILL = 3; const unsigned int WEIGHT_FREQUENCY = 4; const unsigned int WEIGHT_HAS_PLAYED_ORGANIZED_TT = 5; const unsigned int WEIGHT_HAS_PLAYED_ORGANIZED_LT = 5; const unsigned int WEIGHT_SPIN_ABILITY = 4; const unsigned int WEIGHT_OWNS_EQUIPMENT = 5; unsigned int PlayerScorer::score(PlayerData player) { unsigned int score = 0; score += player.perceived_skill * WEIGHT_PERCEIVED_SKILL; score += player.outward_skill * WEIGHT_OUTWARD_SKILL; score += static_cast<int>(player.frequency) * WEIGHT_FREQUENCY; score += player.has_played_organized_tt * WEIGHT_HAS_PLAYED_ORGANIZED_TT; score += player.has_played_organized_lt * WEIGHT_HAS_PLAYED_ORGANIZED_LT; score += player.spin_ability * WEIGHT_SPIN_ABILITY; score += player.owns_equipment * WEIGHT_OWNS_EQUIPMENT; return score; }
1843c0c66014e217fca57f9dfb6a9a33ba1f5b9a
688f459c40a7cacb2d98484b4f396db527595088
/test/CodeGenCXX/cxx11-thread-local.cpp
298770336212deb9e14ff071858a6e546a00b6af
[ "NCSA" ]
permissive
acgessler/clang
88f6c4a64b5f87fdea2b84b5a9cf5b3bcb06b750
df08c4b371522025d1d3aec4992fb0f27d7c4571
refs/heads/master
2020-12-25T10:15:11.190329
2013-05-30T18:53:21
2013-05-30T18:53:21
10,390,043
2
0
null
null
null
null
UTF-8
C++
false
false
5,525
cpp
// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s int f(); int g(); // CHECK: @a = thread_local global i32 0 thread_local int a = f(); extern thread_local int b; // CHECK: @c = global i32 0 int c = b; // CHECK: @_ZL1d = internal thread_local global i32 0 static thread_local int d = g(); struct U { static thread_local int m; }; // CHECK: @_ZN1U1mE = thread_local global i32 0 thread_local int U::m = f(); template<typename T> struct V { static thread_local int m; }; template<typename T> thread_local int V<T>::m = g(); // CHECK: @e = global i32 0 int e = V<int>::m; // CHECK: @_ZN1VIiE1mE = weak_odr thread_local global i32 0 // CHECK: @_ZZ1fvE1n = internal thread_local global i32 0 // CHECK: @_ZGVZ1fvE1n = internal thread_local global i8 0 // CHECK: @_ZZ8tls_dtorvE1s = internal thread_local global // CHECK: @_ZGVZ8tls_dtorvE1s = internal thread_local global i8 0 // CHECK: @_ZZ8tls_dtorvE1t = internal thread_local global // CHECK: @_ZGVZ8tls_dtorvE1t = internal thread_local global i8 0 // CHECK: @_ZZ8tls_dtorvE1u = internal thread_local global // CHECK: @_ZGVZ8tls_dtorvE1u = internal thread_local global i8 0 // CHECK: @_ZGRZ8tls_dtorvE1u = internal thread_local global // CHECK: @_ZGVN1VIiE1mE = weak_odr thread_local global i64 0 // CHECK: @__tls_guard = internal thread_local global i8 0 // CHECK: @llvm.global_ctors = appending global {{.*}} @[[GLOBAL_INIT:[^ ]*]] // CHECK: @_ZTH1a = alias void ()* @__tls_init // CHECK: @_ZTHL1d = alias internal void ()* @__tls_init // CHECK: @_ZTHN1U1mE = alias void ()* @__tls_init // CHECK: @_ZTHN1VIiE1mE = alias weak_odr void ()* @__tls_init // Individual variable initialization functions: // CHECK: define {{.*}} @[[A_INIT:.*]]() // CHECK: call i32 @_Z1fv() // CHECK-NEXT: store i32 {{.*}}, i32* @a, align 4 // CHECK: define i32 @_Z1fv() int f() { // CHECK: %[[GUARD:.*]] = load i8* @_ZGVZ1fvE1n, align 1 // CHECK: %[[NEED_INIT:.*]] = icmp eq i8 %[[GUARD]], 0 // CHECK: br i1 %[[NEED_INIT]] // CHECK: %[[CALL:.*]] = call i32 @_Z1gv() // CHECK: store i32 %[[CALL]], i32* @_ZZ1fvE1n, align 4 // CHECK: store i8 1, i8* @_ZGVZ1fvE1n // CHECK: br label static thread_local int n = g(); // CHECK: load i32* @_ZZ1fvE1n, align 4 return n; } // CHECK: define {{.*}} @[[C_INIT:.*]]() // CHECK: call i32* @_ZTW1b() // CHECK-NEXT: load i32* %{{.*}}, align 4 // CHECK-NEXT: store i32 %{{.*}}, i32* @c, align 4 // CHECK: define weak_odr hidden i32* @_ZTW1b() // CHECK: br i1 icmp ne (void ()* @_ZTH1b, void ()* null), // not null: // CHECK: call void @_ZTH1b() // CHECK: br label // finally: // CHECK: ret i32* @b // CHECK: define {{.*}} @[[D_INIT:.*]]() // CHECK: call i32 @_Z1gv() // CHECK-NEXT: store i32 %{{.*}}, i32* @_ZL1d, align 4 // CHECK: define {{.*}} @[[U_M_INIT:.*]]() // CHECK: call i32 @_Z1fv() // CHECK-NEXT: store i32 %{{.*}}, i32* @_ZN1U1mE, align 4 // CHECK: define {{.*}} @[[E_INIT:.*]]() // CHECK: call i32* @_ZTWN1VIiE1mE() // CHECK-NEXT: load i32* %{{.*}}, align 4 // CHECK-NEXT: store i32 %{{.*}}, i32* @e, align 4 // CHECK: define weak_odr hidden i32* @_ZTWN1VIiE1mE() // CHECK: call void @_ZTHN1VIiE1mE() // CHECK: ret i32* @_ZN1VIiE1mE struct S { S(); ~S(); }; struct T { ~T(); }; // CHECK: define void @_Z8tls_dtorv() void tls_dtor() { // CHECK: load i8* @_ZGVZ8tls_dtorvE1s // CHECK: call void @_ZN1SC1Ev(%struct.S* @_ZZ8tls_dtorvE1s) // CHECK: call i32 @__cxa_thread_atexit({{.*}}@_ZN1SD1Ev {{.*}} @_ZZ8tls_dtorvE1s{{.*}} @__dso_handle // CHECK: store i8 1, i8* @_ZGVZ8tls_dtorvE1s static thread_local S s; // CHECK: load i8* @_ZGVZ8tls_dtorvE1t // CHECK-NOT: _ZN1T // CHECK: call i32 @__cxa_thread_atexit({{.*}}@_ZN1TD1Ev {{.*}}@_ZZ8tls_dtorvE1t{{.*}} @__dso_handle // CHECK: store i8 1, i8* @_ZGVZ8tls_dtorvE1t static thread_local T t; // CHECK: load i8* @_ZGVZ8tls_dtorvE1u // CHECK: call void @_ZN1SC1Ev(%struct.S* @_ZGRZ8tls_dtorvE1u) // CHECK: call i32 @__cxa_thread_atexit({{.*}}@_ZN1SD1Ev {{.*}} @_ZGRZ8tls_dtorvE1u{{.*}} @__dso_handle // CHECK: store i8 1, i8* @_ZGVZ8tls_dtorvE1u static thread_local const S &u = S(); } // CHECK: declare i32 @__cxa_thread_atexit(void (i8*)*, i8*, i8*) // CHECK: define {{.*}} @_Z7PR15991v( int PR15991() { thread_local int n; auto l = [] { return n; }; return l(); } // CHECK: define {{.*}} @[[V_M_INIT:.*]]() // CHECK: load i8* bitcast (i64* @_ZGVN1VIiE1mE to i8*) // CHECK: %[[V_M_INITIALIZED:.*]] = icmp eq i8 %{{.*}}, 0 // CHECK: br i1 %[[V_M_INITIALIZED]], // need init: // CHECK: call i32 @_Z1gv() // CHECK: store i32 %{{.*}}, i32* @_ZN1VIiE1mE, align 4 // CHECK: store i64 1, i64* @_ZGVN1VIiE1mE // CHECK: br label // CHECK: define {{.*}}@[[GLOBAL_INIT:.*]]() // CHECK: call void @[[C_INIT]]() // CHECK: call void @[[E_INIT]]() // CHECK: define {{.*}}@__tls_init() // CHECK: load i8* @__tls_guard // CHECK: %[[NEED_TLS_INIT:.*]] = icmp eq i8 %{{.*}}, 0 // CHECK: store i8 1, i8* @__tls_guard // CHECK: br i1 %[[NEED_TLS_INIT]], // init: // CHECK: call void @[[A_INIT]]() // CHECK: call void @[[D_INIT]]() // CHECK: call void @[[U_M_INIT]]() // CHECK: call void @[[V_M_INIT]]() // CHECK: define weak_odr hidden i32* @_ZTW1a() { // CHECK: call void @_ZTH1a() // CHECK: ret i32* @a // CHECK: } // CHECK: declare extern_weak void @_ZTH1b() // CHECK: define internal hidden i32* @_ZTWL1d() // CHECK: call void @_ZTHL1d() // CHECK: ret i32* @_ZL1d // CHECK: define weak_odr hidden i32* @_ZTWN1U1mE() // CHECK: call void @_ZTHN1U1mE() // CHECK: ret i32* @_ZN1U1mE
df93f999cdc80b6323ae2a992b1c9489b420ceba
e7f109004afdf8e19d54a07be5bdcc224713e835
/ledjoy_controller/ledjoy_controller.ino
a0407b25fbc520e5809b350deffbffbbccdee273
[]
no_license
simonbq/glowing-archer
39adb6822745de718feb02535e73fe24b1d8e52b
f5a00107f33877ea10062b84ccf8706c55454fdd
refs/heads/master
2016-09-02T17:42:28.810207
2014-08-29T13:03:51
2014-08-29T13:03:51
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,727
ino
/* Copyright Simon Bergkvist 2014 */ /* //DEFAULT int leds[8][8] = { {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0} }; //DOTA LOGO 1 int leds[8][8] = { {1, 1, 1, 1, 1, 1, 1, 1}, {1, 0, 0, 0, 0, 0, 0, 1}, {1, 0, 1, 0, 0, 1, 0, 1}, {1, 0, 0, 1, 0, 0, 0, 1}, {1, 0, 0, 0, 1, 0, 0, 1}, {1, 0, 1, 0, 0, 1, 0, 1}, {1, 0, 0, 0, 0, 0, 0, 1}, {1, 1, 1, 1, 1, 1, 1, 1} }; //DOTA LOGO 2 int leds[8][8] = { {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 1, 0, 0, 1, 1, 0}, {0, 1, 1, 1, 0, 0, 1, 0}, {0, 0, 1, 1, 1, 0, 0, 0}, {0, 0, 0, 1, 1, 1, 0, 0}, {0, 1, 0, 0, 1, 1, 1, 0}, {0, 1, 1, 0, 0, 1, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0} }; */ //SMILEY int leds[8][8] = { {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 1, 0, 0, 1, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0}, {0, 1, 1, 1, 1, 1, 1, 0}, {0, 1, 0, 0, 0, 0, 1, 0}, {0, 0, 1, 0, 0, 1, 0, 0}, {0, 0, 0, 1, 1, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0} }; int row[8] = { 14, 15, 16, 17, 2, 3, 4, 5 }; int column[8] = { 6, 7, 8, 9, 10, 11, 12, 13 }; // Variables will change: int ledState = HIGH; // ledState used to set the LED void setup() { // set the digital pin as output: for(int i=0;i<8;i++){ pinMode(row[i], OUTPUT); pinMode(column[i], OUTPUT); } pinMode(18, INPUT); pinMode(19, INPUT); } void loop() { for(int i=0;i<8;i++){ for(int j=0;j<8;j++){ if(leds[i][j]>0){ digitalWrite(row[i], HIGH); digitalWrite(column[j], HIGH); }else{ digitalWrite(row[i], LOW); digitalWrite(column[j], LOW); } digitalWrite(column[j], LOW); } digitalWrite(row[i], LOW); } }
27bdbb3a1ac9347f7535c43167a13b928b4b0b5e
e3eecfce5fc2258c95c3205d04d8e2ae8a9875f5
/libnd4j/include/ops/declarable/helpers/gru.h
e00897908781f4bd1ac20d4e5463fc0293ac59e4
[ "Apache-2.0" ]
permissive
farizrahman4u/deeplearning4j
585bdec78e7e8252ca63a0691102b15774e7a6dc
e0555358db5a55823ea1af78ae98a546ad64baab
refs/heads/master
2021-06-28T19:20:38.204203
2019-10-02T10:16:12
2019-10-02T10:16:12
134,716,860
1
1
Apache-2.0
2019-10-02T10:14:08
2018-05-24T13:08:06
Java
UTF-8
C++
false
false
449
h
// // @author Yurii Shyrma ([email protected]), created on 15.02.2018 // #ifndef LIBND4J_GRU_H #define LIBND4J_GRU_H #include <ops/declarable/helpers/helpers.h> namespace nd4j { namespace ops { namespace helpers { template <typename T> void gruCell(const std::vector<NDArray<T>*>& inArrs, NDArray<T>* h); template <typename T> void gruTimeLoop(const std::vector<NDArray<T>*>& inArrs, NDArray<T>* h); } } } #endif //LIBND4J_GRU_H
4f2549c2950a281fd0fc346835b3df8836da2dc1
ef0b63a8389d501839d1d71d57586a64948cb18e
/BDMD/sphere.h
7512d68c0d83939324d8b91d203c11d9ce452fef
[]
no_license
Bradleydi/BDMD
d30be8fb2f3b0e2c2a11eaa4fa3c6b1523e196fd
d6c96b634f02a163bbe57cb444129c290341bac6
refs/heads/master
2020-07-26T08:21:26.701745
2016-08-28T07:42:32
2016-08-28T07:42:32
66,755,224
0
0
null
null
null
null
UTF-8
C++
false
false
1,307
h
#ifndef SPHERE_H #define SPHERE_H #include "vector.h" class sphere { public: // constructor and destructor sphere(); sphere(const sphere& s); sphere(int i_i, vector<DIM> x, vector<DIM, int> cell_i, double lutime_i, double r_i, double gr_i, double m_i, int species_i); ~sphere(); //variables int i; // sphere ID // impending event event nextevent; // next event...can be collision or transfer event nextcollision; // next collision if next event is transfer // maybe nextnext event // past information int type; double lutime; // last update time vector<DIM, int> cell; // cell that it belongs to vector<DIM, double> x; // position vector<DIM, double> xu; vector<DIM, double> v; // velocity vector<DIM, double> va; // active force // 1/16 double r; // sphere radius double gr; // sphere growth rate double m; // sphere mass double D; double theta1,theta2; // orientation [0,M_PI] // 1/16 bool id_active; // id_active // 1/16 int species; // species number (not used during the MD) // make sure efficent in memory }; #endif
b8eee0fe653df2de75fc7ce8f5a728410dfc7ad1
5b2b72c98649a862f78789be899c604732b2dbf1
/BZOJ/3998-Old.cpp
4d3e9ba26a50911d7e97ba7d62c93ff29aeb6762
[]
no_license
PhoenixGS/Solutions
822a8cef7b5c1712208a49c4c44b69fc2ffb3a0c
2526b76071ffab99e41e34a4d78d32183f6a1381
refs/heads/master
2023-07-25T00:26:29.068190
2023-07-11T14:12:14
2023-07-11T14:12:14
131,302,364
0
0
null
null
null
null
UTF-8
C++
false
false
2,224
cpp
#include <cstdio> #include <cstring> #include <queue> #include <algorithm> char st[600000]; int n, cas; long long k; int knum, last; int len[1200000], to[1200000][27], pre[1200000]; long long s[1200000], ss[1200000], kk[1200000]; int cnt[1200000]; std::queue<int> que; int anss; char ans[1200000]; void add(int c) { int u = last; knum++; int v = knum; len[v] = len[u] + 1; last = v; // printf("X%d %d\n", c, u); for (; u && ! to[u][c]; u = pre[u]) { // printf("G%d %d\n", u, to[u][c]); to[u][c] = v; } // printf("Y%d %d\n", c, u); if (! u) { pre[v] = 1; return; } int w = to[u][c]; if (len[u] + 1 == len[w]) { pre[v] = w; return; } knum++; int neww = knum; pre[neww] = pre[w]; for (int i = 0; i < 26; i++) { to[neww][i] = to[w][i]; } len[neww] = len[u] + 1; pre[w] = pre[v] = neww; for (; u && to[u][c] == w; u = pre[u]) { to[u][c] = neww; } } void dfs(int u) { if (ss[u]) { return; } if (cas == 0) { //ss[u] = len[u] - len[pre[u]]; ss[u] = kk[u] = 1; } else { //ss[u] = s[u] * (len[u] - len[pre[u]]); ss[u] = kk[u] = s[u]; } for (int i = 0; i < 26; i++) { if (to[u][i]) { dfs(to[u][i]); ss[u] += ss[to[u][i]]; } } // printf("O%d %lld %lld\n", u, kk[u], ss[u]); } void print() { for (int i = 1; i <= anss; i++) { printf("%c", ans[i]); } puts(""); } void solve(int u, long long k) { if (k <= kk[u]) { // printf("K%d %lld\n", u, kk[u]); print(); std::exit(0); } k -= kk[u]; for (int i = 0; i < 26; i++) { if (to[u][i]) { if (k > ss[to[u][i]]) { k -= ss[to[u][i]]; } else { anss++; ans[anss] = i + 'a'; solve(to[u][i], k); } } } } int main() { scanf("%s", st + 1); n = strlen(st + 1); scanf("%d%lld", &cas, &k); knum = 1; last = 1; for (int i = 1; i <= n; i++) { add(st[i] - 'a'); s[last]++; } for (int i = 2; i <= knum; i++) { cnt[pre[i]]++; } for (int i = 1; i <= knum; i++) { if (! cnt[i]) { que.push(i); } } while (! que.empty()) { int u = que.front(); que.pop(); s[pre[u]] += s[u]; cnt[pre[u]]--; if (! cnt[pre[u]]) { que.push(pre[u]); } } dfs(1); kk[1] = 0; solve(1, k); printf("-1\n"); // printf("G%lld\n", ss[1]); return 0; }
4853d56479721fac527f244cc0f9454ab7dce550
4a907a704659f1a72b19ba98afa625b1b208d5df
/PCInputSystem.cpp
2217a33415d56b338c8719b2f4ae8df71f83e12d
[]
no_license
fishersc/3DGEFinal
e7ad8e84bb1d9d9031b2663f0d377fed595919f0
e3e2ac927eddb044d7305e577b80def244829a19
refs/heads/master
2016-09-08T00:32:14.997889
2013-05-07T03:36:13
2013-05-07T03:36:13
null
0
0
null
null
null
null
UTF-8
C++
false
false
830
cpp
#include <Windows.h> #include "PCInputSystem.h" PCInputSystem::PCInputSystem(void) { for(int i = 0; i < sizeof(keys); i++){ keys[i] = false; } maxMouseX = maxMouseY = oldMouseX = oldMouseY = mouseX = mouseY = 0; mouseMoved = false; leftMouseButton = false; rightMouseButton = false; moveDirectionX = moveDirectionY = 0; blocked = false; } PCInputSystem::~PCInputSystem(void) { } void PCInputSystem::moveMouse(int newMouseX, int newMouseY) { if(blocked) return; mouseY = newMouseY; mouseX = newMouseX; if(newMouseX >= maxMouseX-10){ mouseX = 1; blocked = true; SetCursorPos(mouseX, mouseY); blocked = false; } else if(newMouseX <= 0){ mouseX = maxMouseX - 11; blocked = true; SetCursorPos(mouseX, mouseY); blocked = false; } }
fb3e0970245549b700eeea0956c5c369e3669ae9
144812d83b048d219ffa87ac5cce4314fd630392
/XIASocket/API/xia.pb.cc
bdf42181ea996f8448a035dc77db6892f403c03e
[]
no_license
bbramble/cs740-xia
ce76ef8a9a3e7dbf9d8d7294b8b307cade841955
6946bae293283c8e586adefc228c788f94dd5783
refs/heads/master
2021-01-17T10:24:34.698820
2013-04-05T03:01:45
2013-04-05T03:01:45
null
0
0
null
null
null
null
UTF-8
C++
false
true
284,896
cc
// Generated by the protocol buffer compiler. DO NOT EDIT! #define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION #include "xia.pb.h" #include <algorithm> #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/reflection_ops.h> #include <google/protobuf/wire_format.h> // @@protoc_insertion_point(includes) namespace xia { namespace { const ::google::protobuf::Descriptor* XSocketMsg_descriptor_ = NULL; const ::google::protobuf::internal::GeneratedMessageReflection* XSocketMsg_reflection_ = NULL; const ::google::protobuf::Descriptor* X_Socket_Msg_descriptor_ = NULL; const ::google::protobuf::internal::GeneratedMessageReflection* X_Socket_Msg_reflection_ = NULL; const ::google::protobuf::Descriptor* X_Bind_Msg_descriptor_ = NULL; const ::google::protobuf::internal::GeneratedMessageReflection* X_Bind_Msg_reflection_ = NULL; const ::google::protobuf::Descriptor* X_Close_Msg_descriptor_ = NULL; const ::google::protobuf::internal::GeneratedMessageReflection* X_Close_Msg_reflection_ = NULL; const ::google::protobuf::Descriptor* X_Connect_Msg_descriptor_ = NULL; const ::google::protobuf::internal::GeneratedMessageReflection* X_Connect_Msg_reflection_ = NULL; const ::google::protobuf::Descriptor* X_Accept_Msg_descriptor_ = NULL; const ::google::protobuf::internal::GeneratedMessageReflection* X_Accept_Msg_reflection_ = NULL; const ::google::protobuf::Descriptor* X_Sendto_Msg_descriptor_ = NULL; const ::google::protobuf::internal::GeneratedMessageReflection* X_Sendto_Msg_reflection_ = NULL; const ::google::protobuf::Descriptor* X_Send_Msg_descriptor_ = NULL; const ::google::protobuf::internal::GeneratedMessageReflection* X_Send_Msg_reflection_ = NULL; const ::google::protobuf::Descriptor* X_Recv_Msg_descriptor_ = NULL; const ::google::protobuf::internal::GeneratedMessageReflection* X_Recv_Msg_reflection_ = NULL; const ::google::protobuf::Descriptor* X_Recvfrom_Msg_descriptor_ = NULL; const ::google::protobuf::internal::GeneratedMessageReflection* X_Recvfrom_Msg_reflection_ = NULL; const ::google::protobuf::Descriptor* X_Setsockopt_Msg_descriptor_ = NULL; const ::google::protobuf::internal::GeneratedMessageReflection* X_Setsockopt_Msg_reflection_ = NULL; const ::google::protobuf::Descriptor* X_Getsockopt_Msg_descriptor_ = NULL; const ::google::protobuf::internal::GeneratedMessageReflection* X_Getsockopt_Msg_reflection_ = NULL; const ::google::protobuf::Descriptor* X_Putchunk_Msg_descriptor_ = NULL; const ::google::protobuf::internal::GeneratedMessageReflection* X_Putchunk_Msg_reflection_ = NULL; const ::google::protobuf::Descriptor* X_Requestchunk_Msg_descriptor_ = NULL; const ::google::protobuf::internal::GeneratedMessageReflection* X_Requestchunk_Msg_reflection_ = NULL; const ::google::protobuf::Descriptor* X_Getchunkstatus_Msg_descriptor_ = NULL; const ::google::protobuf::internal::GeneratedMessageReflection* X_Getchunkstatus_Msg_reflection_ = NULL; const ::google::protobuf::Descriptor* X_Readchunk_Msg_descriptor_ = NULL; const ::google::protobuf::internal::GeneratedMessageReflection* X_Readchunk_Msg_reflection_ = NULL; const ::google::protobuf::Descriptor* X_Removechunk_Msg_descriptor_ = NULL; const ::google::protobuf::internal::GeneratedMessageReflection* X_Removechunk_Msg_reflection_ = NULL; const ::google::protobuf::Descriptor* X_Result_Msg_descriptor_ = NULL; const ::google::protobuf::internal::GeneratedMessageReflection* X_Result_Msg_reflection_ = NULL; const ::google::protobuf::Descriptor* X_Requestfailed_Msg_descriptor_ = NULL; const ::google::protobuf::internal::GeneratedMessageReflection* X_Requestfailed_Msg_reflection_ = NULL; const ::google::protobuf::Descriptor* X_Changead_Msg_descriptor_ = NULL; const ::google::protobuf::internal::GeneratedMessageReflection* X_Changead_Msg_reflection_ = NULL; const ::google::protobuf::Descriptor* X_ReadLocalHostAddr_Msg_descriptor_ = NULL; const ::google::protobuf::internal::GeneratedMessageReflection* X_ReadLocalHostAddr_Msg_reflection_ = NULL; const ::google::protobuf::Descriptor* X_Updatenameserverdag_Msg_descriptor_ = NULL; const ::google::protobuf::internal::GeneratedMessageReflection* X_Updatenameserverdag_Msg_reflection_ = NULL; const ::google::protobuf::Descriptor* X_ReadNameServerDag_Msg_descriptor_ = NULL; const ::google::protobuf::internal::GeneratedMessageReflection* X_ReadNameServerDag_Msg_reflection_ = NULL; const ::google::protobuf::Descriptor* msg_descriptor_ = NULL; const ::google::protobuf::internal::GeneratedMessageReflection* msg_reflection_ = NULL; const ::google::protobuf::EnumDescriptor* msg_MsgType_descriptor_ = NULL; const ::google::protobuf::Descriptor* msg_response_descriptor_ = NULL; const ::google::protobuf::internal::GeneratedMessageReflection* msg_response_reflection_ = NULL; const ::google::protobuf::EnumDescriptor* XSocketCallType_descriptor_ = NULL; } // namespace void protobuf_AssignDesc_xia_2eproto() { protobuf_AddDesc_xia_2eproto(); const ::google::protobuf::FileDescriptor* file = ::google::protobuf::DescriptorPool::generated_pool()->FindFileByName( "xia.proto"); GOOGLE_CHECK(file != NULL); XSocketMsg_descriptor_ = file->message_type(0); static const int XSocketMsg_offsets_[23] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(XSocketMsg, type_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(XSocketMsg, x_socket_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(XSocketMsg, x_bind_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(XSocketMsg, x_close_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(XSocketMsg, x_connect_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(XSocketMsg, x_accept_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(XSocketMsg, x_sendto_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(XSocketMsg, x_send_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(XSocketMsg, x_recv_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(XSocketMsg, x_recvfrom_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(XSocketMsg, x_setsockopt_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(XSocketMsg, x_getsockopt_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(XSocketMsg, x_putchunk_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(XSocketMsg, x_requestchunk_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(XSocketMsg, x_getchunkstatus_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(XSocketMsg, x_readchunk_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(XSocketMsg, x_removechunk_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(XSocketMsg, x_requestfailed_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(XSocketMsg, x_result_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(XSocketMsg, x_changead_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(XSocketMsg, x_readlocalhostaddr_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(XSocketMsg, x_updatenameserverdag_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(XSocketMsg, x_readnameserverdag_), }; XSocketMsg_reflection_ = new ::google::protobuf::internal::GeneratedMessageReflection( XSocketMsg_descriptor_, XSocketMsg::default_instance_, XSocketMsg_offsets_, GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(XSocketMsg, _has_bits_[0]), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(XSocketMsg, _unknown_fields_), -1, ::google::protobuf::DescriptorPool::generated_pool(), ::google::protobuf::MessageFactory::generated_factory(), sizeof(XSocketMsg)); X_Socket_Msg_descriptor_ = file->message_type(1); static const int X_Socket_Msg_offsets_[2] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Socket_Msg, type_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Socket_Msg, temp_), }; X_Socket_Msg_reflection_ = new ::google::protobuf::internal::GeneratedMessageReflection( X_Socket_Msg_descriptor_, X_Socket_Msg::default_instance_, X_Socket_Msg_offsets_, GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Socket_Msg, _has_bits_[0]), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Socket_Msg, _unknown_fields_), -1, ::google::protobuf::DescriptorPool::generated_pool(), ::google::protobuf::MessageFactory::generated_factory(), sizeof(X_Socket_Msg)); X_Bind_Msg_descriptor_ = file->message_type(2); static const int X_Bind_Msg_offsets_[1] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Bind_Msg, sdag_), }; X_Bind_Msg_reflection_ = new ::google::protobuf::internal::GeneratedMessageReflection( X_Bind_Msg_descriptor_, X_Bind_Msg::default_instance_, X_Bind_Msg_offsets_, GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Bind_Msg, _has_bits_[0]), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Bind_Msg, _unknown_fields_), -1, ::google::protobuf::DescriptorPool::generated_pool(), ::google::protobuf::MessageFactory::generated_factory(), sizeof(X_Bind_Msg)); X_Close_Msg_descriptor_ = file->message_type(3); static const int X_Close_Msg_offsets_[1] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Close_Msg, payload_), }; X_Close_Msg_reflection_ = new ::google::protobuf::internal::GeneratedMessageReflection( X_Close_Msg_descriptor_, X_Close_Msg::default_instance_, X_Close_Msg_offsets_, GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Close_Msg, _has_bits_[0]), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Close_Msg, _unknown_fields_), -1, ::google::protobuf::DescriptorPool::generated_pool(), ::google::protobuf::MessageFactory::generated_factory(), sizeof(X_Close_Msg)); X_Connect_Msg_descriptor_ = file->message_type(4); static const int X_Connect_Msg_offsets_[2] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Connect_Msg, ddag_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Connect_Msg, status_), }; X_Connect_Msg_reflection_ = new ::google::protobuf::internal::GeneratedMessageReflection( X_Connect_Msg_descriptor_, X_Connect_Msg::default_instance_, X_Connect_Msg_offsets_, GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Connect_Msg, _has_bits_[0]), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Connect_Msg, _unknown_fields_), -1, ::google::protobuf::DescriptorPool::generated_pool(), ::google::protobuf::MessageFactory::generated_factory(), sizeof(X_Connect_Msg)); X_Accept_Msg_descriptor_ = file->message_type(5); static const int X_Accept_Msg_offsets_[1] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Accept_Msg, temp_), }; X_Accept_Msg_reflection_ = new ::google::protobuf::internal::GeneratedMessageReflection( X_Accept_Msg_descriptor_, X_Accept_Msg::default_instance_, X_Accept_Msg_offsets_, GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Accept_Msg, _has_bits_[0]), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Accept_Msg, _unknown_fields_), -1, ::google::protobuf::DescriptorPool::generated_pool(), ::google::protobuf::MessageFactory::generated_factory(), sizeof(X_Accept_Msg)); X_Sendto_Msg_descriptor_ = file->message_type(6); static const int X_Sendto_Msg_offsets_[2] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Sendto_Msg, ddag_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Sendto_Msg, payload_), }; X_Sendto_Msg_reflection_ = new ::google::protobuf::internal::GeneratedMessageReflection( X_Sendto_Msg_descriptor_, X_Sendto_Msg::default_instance_, X_Sendto_Msg_offsets_, GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Sendto_Msg, _has_bits_[0]), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Sendto_Msg, _unknown_fields_), -1, ::google::protobuf::DescriptorPool::generated_pool(), ::google::protobuf::MessageFactory::generated_factory(), sizeof(X_Sendto_Msg)); X_Send_Msg_descriptor_ = file->message_type(7); static const int X_Send_Msg_offsets_[1] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Send_Msg, payload_), }; X_Send_Msg_reflection_ = new ::google::protobuf::internal::GeneratedMessageReflection( X_Send_Msg_descriptor_, X_Send_Msg::default_instance_, X_Send_Msg_offsets_, GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Send_Msg, _has_bits_[0]), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Send_Msg, _unknown_fields_), -1, ::google::protobuf::DescriptorPool::generated_pool(), ::google::protobuf::MessageFactory::generated_factory(), sizeof(X_Send_Msg)); X_Recv_Msg_descriptor_ = file->message_type(8); static const int X_Recv_Msg_offsets_[1] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Recv_Msg, temp_), }; X_Recv_Msg_reflection_ = new ::google::protobuf::internal::GeneratedMessageReflection( X_Recv_Msg_descriptor_, X_Recv_Msg::default_instance_, X_Recv_Msg_offsets_, GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Recv_Msg, _has_bits_[0]), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Recv_Msg, _unknown_fields_), -1, ::google::protobuf::DescriptorPool::generated_pool(), ::google::protobuf::MessageFactory::generated_factory(), sizeof(X_Recv_Msg)); X_Recvfrom_Msg_descriptor_ = file->message_type(9); static const int X_Recvfrom_Msg_offsets_[1] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Recvfrom_Msg, temp_), }; X_Recvfrom_Msg_reflection_ = new ::google::protobuf::internal::GeneratedMessageReflection( X_Recvfrom_Msg_descriptor_, X_Recvfrom_Msg::default_instance_, X_Recvfrom_Msg_offsets_, GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Recvfrom_Msg, _has_bits_[0]), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Recvfrom_Msg, _unknown_fields_), -1, ::google::protobuf::DescriptorPool::generated_pool(), ::google::protobuf::MessageFactory::generated_factory(), sizeof(X_Recvfrom_Msg)); X_Setsockopt_Msg_descriptor_ = file->message_type(10); static const int X_Setsockopt_Msg_offsets_[2] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Setsockopt_Msg, opt_type_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Setsockopt_Msg, int_opt_), }; X_Setsockopt_Msg_reflection_ = new ::google::protobuf::internal::GeneratedMessageReflection( X_Setsockopt_Msg_descriptor_, X_Setsockopt_Msg::default_instance_, X_Setsockopt_Msg_offsets_, GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Setsockopt_Msg, _has_bits_[0]), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Setsockopt_Msg, _unknown_fields_), -1, ::google::protobuf::DescriptorPool::generated_pool(), ::google::protobuf::MessageFactory::generated_factory(), sizeof(X_Setsockopt_Msg)); X_Getsockopt_Msg_descriptor_ = file->message_type(11); static const int X_Getsockopt_Msg_offsets_[2] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Getsockopt_Msg, opt_type_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Getsockopt_Msg, int_opt_), }; X_Getsockopt_Msg_reflection_ = new ::google::protobuf::internal::GeneratedMessageReflection( X_Getsockopt_Msg_descriptor_, X_Getsockopt_Msg::default_instance_, X_Getsockopt_Msg_offsets_, GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Getsockopt_Msg, _has_bits_[0]), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Getsockopt_Msg, _unknown_fields_), -1, ::google::protobuf::DescriptorPool::generated_pool(), ::google::protobuf::MessageFactory::generated_factory(), sizeof(X_Getsockopt_Msg)); X_Putchunk_Msg_descriptor_ = file->message_type(12); static const int X_Putchunk_Msg_offsets_[8] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Putchunk_Msg, cachepolicy_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Putchunk_Msg, cachesize_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Putchunk_Msg, contextid_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Putchunk_Msg, ttl_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Putchunk_Msg, payload_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Putchunk_Msg, cid_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Putchunk_Msg, length_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Putchunk_Msg, timestamp_), }; X_Putchunk_Msg_reflection_ = new ::google::protobuf::internal::GeneratedMessageReflection( X_Putchunk_Msg_descriptor_, X_Putchunk_Msg::default_instance_, X_Putchunk_Msg_offsets_, GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Putchunk_Msg, _has_bits_[0]), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Putchunk_Msg, _unknown_fields_), -1, ::google::protobuf::DescriptorPool::generated_pool(), ::google::protobuf::MessageFactory::generated_factory(), sizeof(X_Putchunk_Msg)); X_Requestchunk_Msg_descriptor_ = file->message_type(13); static const int X_Requestchunk_Msg_offsets_[2] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Requestchunk_Msg, dag_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Requestchunk_Msg, payload_), }; X_Requestchunk_Msg_reflection_ = new ::google::protobuf::internal::GeneratedMessageReflection( X_Requestchunk_Msg_descriptor_, X_Requestchunk_Msg::default_instance_, X_Requestchunk_Msg_offsets_, GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Requestchunk_Msg, _has_bits_[0]), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Requestchunk_Msg, _unknown_fields_), -1, ::google::protobuf::DescriptorPool::generated_pool(), ::google::protobuf::MessageFactory::generated_factory(), sizeof(X_Requestchunk_Msg)); X_Getchunkstatus_Msg_descriptor_ = file->message_type(14); static const int X_Getchunkstatus_Msg_offsets_[3] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Getchunkstatus_Msg, dag_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Getchunkstatus_Msg, status_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Getchunkstatus_Msg, payload_), }; X_Getchunkstatus_Msg_reflection_ = new ::google::protobuf::internal::GeneratedMessageReflection( X_Getchunkstatus_Msg_descriptor_, X_Getchunkstatus_Msg::default_instance_, X_Getchunkstatus_Msg_offsets_, GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Getchunkstatus_Msg, _has_bits_[0]), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Getchunkstatus_Msg, _unknown_fields_), -1, ::google::protobuf::DescriptorPool::generated_pool(), ::google::protobuf::MessageFactory::generated_factory(), sizeof(X_Getchunkstatus_Msg)); X_Readchunk_Msg_descriptor_ = file->message_type(15); static const int X_Readchunk_Msg_offsets_[2] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Readchunk_Msg, dag_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Readchunk_Msg, payload_), }; X_Readchunk_Msg_reflection_ = new ::google::protobuf::internal::GeneratedMessageReflection( X_Readchunk_Msg_descriptor_, X_Readchunk_Msg::default_instance_, X_Readchunk_Msg_offsets_, GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Readchunk_Msg, _has_bits_[0]), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Readchunk_Msg, _unknown_fields_), -1, ::google::protobuf::DescriptorPool::generated_pool(), ::google::protobuf::MessageFactory::generated_factory(), sizeof(X_Readchunk_Msg)); X_Removechunk_Msg_descriptor_ = file->message_type(16); static const int X_Removechunk_Msg_offsets_[3] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Removechunk_Msg, contextid_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Removechunk_Msg, cid_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Removechunk_Msg, status_), }; X_Removechunk_Msg_reflection_ = new ::google::protobuf::internal::GeneratedMessageReflection( X_Removechunk_Msg_descriptor_, X_Removechunk_Msg::default_instance_, X_Removechunk_Msg_offsets_, GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Removechunk_Msg, _has_bits_[0]), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Removechunk_Msg, _unknown_fields_), -1, ::google::protobuf::DescriptorPool::generated_pool(), ::google::protobuf::MessageFactory::generated_factory(), sizeof(X_Removechunk_Msg)); X_Result_Msg_descriptor_ = file->message_type(17); static const int X_Result_Msg_offsets_[3] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Result_Msg, type_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Result_Msg, return_code_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Result_Msg, err_code_), }; X_Result_Msg_reflection_ = new ::google::protobuf::internal::GeneratedMessageReflection( X_Result_Msg_descriptor_, X_Result_Msg::default_instance_, X_Result_Msg_offsets_, GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Result_Msg, _has_bits_[0]), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Result_Msg, _unknown_fields_), -1, ::google::protobuf::DescriptorPool::generated_pool(), ::google::protobuf::MessageFactory::generated_factory(), sizeof(X_Result_Msg)); X_Requestfailed_Msg_descriptor_ = file->message_type(18); static const int X_Requestfailed_Msg_offsets_[2] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Requestfailed_Msg, type_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Requestfailed_Msg, temp_), }; X_Requestfailed_Msg_reflection_ = new ::google::protobuf::internal::GeneratedMessageReflection( X_Requestfailed_Msg_descriptor_, X_Requestfailed_Msg::default_instance_, X_Requestfailed_Msg_offsets_, GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Requestfailed_Msg, _has_bits_[0]), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Requestfailed_Msg, _unknown_fields_), -1, ::google::protobuf::DescriptorPool::generated_pool(), ::google::protobuf::MessageFactory::generated_factory(), sizeof(X_Requestfailed_Msg)); X_Changead_Msg_descriptor_ = file->message_type(19); static const int X_Changead_Msg_offsets_[1] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Changead_Msg, dag_), }; X_Changead_Msg_reflection_ = new ::google::protobuf::internal::GeneratedMessageReflection( X_Changead_Msg_descriptor_, X_Changead_Msg::default_instance_, X_Changead_Msg_offsets_, GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Changead_Msg, _has_bits_[0]), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Changead_Msg, _unknown_fields_), -1, ::google::protobuf::DescriptorPool::generated_pool(), ::google::protobuf::MessageFactory::generated_factory(), sizeof(X_Changead_Msg)); X_ReadLocalHostAddr_Msg_descriptor_ = file->message_type(20); static const int X_ReadLocalHostAddr_Msg_offsets_[2] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_ReadLocalHostAddr_Msg, ad_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_ReadLocalHostAddr_Msg, hid_), }; X_ReadLocalHostAddr_Msg_reflection_ = new ::google::protobuf::internal::GeneratedMessageReflection( X_ReadLocalHostAddr_Msg_descriptor_, X_ReadLocalHostAddr_Msg::default_instance_, X_ReadLocalHostAddr_Msg_offsets_, GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_ReadLocalHostAddr_Msg, _has_bits_[0]), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_ReadLocalHostAddr_Msg, _unknown_fields_), -1, ::google::protobuf::DescriptorPool::generated_pool(), ::google::protobuf::MessageFactory::generated_factory(), sizeof(X_ReadLocalHostAddr_Msg)); X_Updatenameserverdag_Msg_descriptor_ = file->message_type(21); static const int X_Updatenameserverdag_Msg_offsets_[1] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Updatenameserverdag_Msg, dag_), }; X_Updatenameserverdag_Msg_reflection_ = new ::google::protobuf::internal::GeneratedMessageReflection( X_Updatenameserverdag_Msg_descriptor_, X_Updatenameserverdag_Msg::default_instance_, X_Updatenameserverdag_Msg_offsets_, GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Updatenameserverdag_Msg, _has_bits_[0]), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_Updatenameserverdag_Msg, _unknown_fields_), -1, ::google::protobuf::DescriptorPool::generated_pool(), ::google::protobuf::MessageFactory::generated_factory(), sizeof(X_Updatenameserverdag_Msg)); X_ReadNameServerDag_Msg_descriptor_ = file->message_type(22); static const int X_ReadNameServerDag_Msg_offsets_[1] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_ReadNameServerDag_Msg, dag_), }; X_ReadNameServerDag_Msg_reflection_ = new ::google::protobuf::internal::GeneratedMessageReflection( X_ReadNameServerDag_Msg_descriptor_, X_ReadNameServerDag_Msg::default_instance_, X_ReadNameServerDag_Msg_offsets_, GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_ReadNameServerDag_Msg, _has_bits_[0]), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(X_ReadNameServerDag_Msg, _unknown_fields_), -1, ::google::protobuf::DescriptorPool::generated_pool(), ::google::protobuf::MessageFactory::generated_factory(), sizeof(X_ReadNameServerDag_Msg)); msg_descriptor_ = file->message_type(23); static const int msg_offsets_[6] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(msg, appid_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(msg, xid_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(msg, xiapath_src_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(msg, xiapath_dst_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(msg, payload_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(msg, type_), }; msg_reflection_ = new ::google::protobuf::internal::GeneratedMessageReflection( msg_descriptor_, msg::default_instance_, msg_offsets_, GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(msg, _has_bits_[0]), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(msg, _unknown_fields_), -1, ::google::protobuf::DescriptorPool::generated_pool(), ::google::protobuf::MessageFactory::generated_factory(), sizeof(msg)); msg_MsgType_descriptor_ = msg_descriptor_->enum_type(0); msg_response_descriptor_ = file->message_type(24); static const int msg_response_offsets_[3] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(msg_response, appid_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(msg_response, xid_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(msg_response, payload_), }; msg_response_reflection_ = new ::google::protobuf::internal::GeneratedMessageReflection( msg_response_descriptor_, msg_response::default_instance_, msg_response_offsets_, GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(msg_response, _has_bits_[0]), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(msg_response, _unknown_fields_), -1, ::google::protobuf::DescriptorPool::generated_pool(), ::google::protobuf::MessageFactory::generated_factory(), sizeof(msg_response)); XSocketCallType_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_xia_2eproto); } void protobuf_RegisterTypes(const ::std::string&) { protobuf_AssignDescriptorsOnce(); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( XSocketMsg_descriptor_, &XSocketMsg::default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( X_Socket_Msg_descriptor_, &X_Socket_Msg::default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( X_Bind_Msg_descriptor_, &X_Bind_Msg::default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( X_Close_Msg_descriptor_, &X_Close_Msg::default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( X_Connect_Msg_descriptor_, &X_Connect_Msg::default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( X_Accept_Msg_descriptor_, &X_Accept_Msg::default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( X_Sendto_Msg_descriptor_, &X_Sendto_Msg::default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( X_Send_Msg_descriptor_, &X_Send_Msg::default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( X_Recv_Msg_descriptor_, &X_Recv_Msg::default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( X_Recvfrom_Msg_descriptor_, &X_Recvfrom_Msg::default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( X_Setsockopt_Msg_descriptor_, &X_Setsockopt_Msg::default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( X_Getsockopt_Msg_descriptor_, &X_Getsockopt_Msg::default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( X_Putchunk_Msg_descriptor_, &X_Putchunk_Msg::default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( X_Requestchunk_Msg_descriptor_, &X_Requestchunk_Msg::default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( X_Getchunkstatus_Msg_descriptor_, &X_Getchunkstatus_Msg::default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( X_Readchunk_Msg_descriptor_, &X_Readchunk_Msg::default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( X_Removechunk_Msg_descriptor_, &X_Removechunk_Msg::default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( X_Result_Msg_descriptor_, &X_Result_Msg::default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( X_Requestfailed_Msg_descriptor_, &X_Requestfailed_Msg::default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( X_Changead_Msg_descriptor_, &X_Changead_Msg::default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( X_ReadLocalHostAddr_Msg_descriptor_, &X_ReadLocalHostAddr_Msg::default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( X_Updatenameserverdag_Msg_descriptor_, &X_Updatenameserverdag_Msg::default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( X_ReadNameServerDag_Msg_descriptor_, &X_ReadNameServerDag_Msg::default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( msg_descriptor_, &msg::default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( msg_response_descriptor_, &msg_response::default_instance()); } } // namespace void protobuf_ShutdownFile_xia_2eproto() { delete XSocketMsg::default_instance_; delete XSocketMsg_reflection_; delete X_Socket_Msg::default_instance_; delete X_Socket_Msg_reflection_; delete X_Bind_Msg::default_instance_; delete X_Bind_Msg_reflection_; delete X_Close_Msg::default_instance_; delete X_Close_Msg_reflection_; delete X_Connect_Msg::default_instance_; delete X_Connect_Msg_reflection_; delete X_Accept_Msg::default_instance_; delete X_Accept_Msg_reflection_; delete X_Sendto_Msg::default_instance_; delete X_Sendto_Msg_reflection_; delete X_Send_Msg::default_instance_; delete X_Send_Msg_reflection_; delete X_Recv_Msg::default_instance_; delete X_Recv_Msg_reflection_; delete X_Recvfrom_Msg::default_instance_; delete X_Recvfrom_Msg_reflection_; delete X_Setsockopt_Msg::default_instance_; delete X_Setsockopt_Msg_reflection_; delete X_Getsockopt_Msg::default_instance_; delete X_Getsockopt_Msg_reflection_; delete X_Putchunk_Msg::default_instance_; delete X_Putchunk_Msg_reflection_; delete X_Requestchunk_Msg::default_instance_; delete X_Requestchunk_Msg_reflection_; delete X_Getchunkstatus_Msg::default_instance_; delete X_Getchunkstatus_Msg_reflection_; delete X_Readchunk_Msg::default_instance_; delete X_Readchunk_Msg_reflection_; delete X_Removechunk_Msg::default_instance_; delete X_Removechunk_Msg_reflection_; delete X_Result_Msg::default_instance_; delete X_Result_Msg_reflection_; delete X_Requestfailed_Msg::default_instance_; delete X_Requestfailed_Msg_reflection_; delete X_Changead_Msg::default_instance_; delete X_Changead_Msg_reflection_; delete X_ReadLocalHostAddr_Msg::default_instance_; delete X_ReadLocalHostAddr_Msg_reflection_; delete X_Updatenameserverdag_Msg::default_instance_; delete X_Updatenameserverdag_Msg_reflection_; delete X_ReadNameServerDag_Msg::default_instance_; delete X_ReadNameServerDag_Msg_reflection_; delete msg::default_instance_; delete msg_reflection_; delete msg_response::default_instance_; delete msg_response_reflection_; } void protobuf_AddDesc_xia_2eproto() { static bool already_here = false; if (already_here) return; already_here = true; GOOGLE_PROTOBUF_VERIFY_VERSION; ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( "\n\txia.proto\022\003xia\"\356\007\n\nXSocketMsg\022\"\n\004type\030" "\001 \002(\0162\024.xia.XSocketCallType\022#\n\010x_socket\030" "\002 \001(\0132\021.xia.X_Socket_Msg\022\037\n\006x_bind\030\003 \001(\013" "2\017.xia.X_Bind_Msg\022!\n\007x_close\030\004 \001(\0132\020.xia" ".X_Close_Msg\022%\n\tx_connect\030\005 \001(\0132\022.xia.X_" "Connect_Msg\022#\n\010x_accept\030\006 \001(\0132\021.xia.X_Ac" "cept_Msg\022#\n\010x_sendto\030\007 \001(\0132\021.xia.X_Sendt" "o_Msg\022\037\n\006x_send\030\010 \001(\0132\017.xia.X_Send_Msg\022\037" "\n\006x_recv\030\t \001(\0132\017.xia.X_Recv_Msg\022\'\n\nx_rec" "vfrom\030\n \001(\0132\023.xia.X_Recvfrom_Msg\022+\n\014x_se" "tsockopt\030\013 \001(\0132\025.xia.X_Setsockopt_Msg\022+\n" "\014x_getsockopt\030\014 \001(\0132\025.xia.X_Getsockopt_M" "sg\022\'\n\nx_putchunk\030\r \001(\0132\023.xia.X_Putchunk_" "Msg\022/\n\016x_requestchunk\030\016 \001(\0132\027.xia.X_Requ" "estchunk_Msg\0223\n\020x_getchunkstatus\030\017 \001(\0132\031" ".xia.X_Getchunkstatus_Msg\022)\n\013x_readchunk" "\030\020 \001(\0132\024.xia.X_Readchunk_Msg\022-\n\rx_remove" "chunk\030\021 \001(\0132\026.xia.X_Removechunk_Msg\0221\n\017x" "_requestfailed\030\022 \001(\0132\030.xia.X_Requestfail" "ed_Msg\022#\n\010x_result\030\023 \001(\0132\021.xia.X_Result_" "Msg\022\'\n\nx_changead\030\024 \001(\0132\023.xia.X_Changead" "_Msg\0229\n\023x_readlocalhostaddr\030\025 \001(\0132\034.xia." "X_ReadLocalHostAddr_Msg\022=\n\025x_updatenames" "erverdag\030\026 \001(\0132\036.xia.X_Updatenameserverd" "ag_Msg\0229\n\023x_readnameserverdag\030\027 \001(\0132\034.xi" "a.X_ReadNameServerDag_Msg\"*\n\014X_Socket_Ms" "g\022\014\n\004type\030\001 \002(\005\022\014\n\004temp\030\002 \001(\t\"\032\n\nX_Bind_" "Msg\022\014\n\004sdag\030\001 \002(\t\"\036\n\013X_Close_Msg\022\017\n\007payl" "oad\030\001 \001(\014\"-\n\rX_Connect_Msg\022\014\n\004ddag\030\001 \002(\t" "\022\016\n\006status\030\002 \001(\005\"\034\n\014X_Accept_Msg\022\014\n\004temp" "\030\001 \001(\t\"-\n\014X_Sendto_Msg\022\014\n\004ddag\030\001 \002(\t\022\017\n\007" "payload\030\002 \002(\014\"\035\n\nX_Send_Msg\022\017\n\007payload\030\001" " \002(\014\"\032\n\nX_Recv_Msg\022\014\n\004temp\030\001 \001(\t\"\036\n\016X_Re" "cvfrom_Msg\022\014\n\004temp\030\001 \001(\t\"5\n\020X_Setsockopt" "_Msg\022\020\n\010opt_type\030\001 \002(\005\022\017\n\007int_opt\030\002 \001(\005\"" "5\n\020X_Getsockopt_Msg\022\020\n\010opt_type\030\001 \002(\005\022\017\n" "\007int_opt\030\002 \001(\005\"\231\001\n\016X_Putchunk_Msg\022\023\n\013cac" "hepolicy\030\001 \002(\005\022\021\n\tcachesize\030\002 \002(\005\022\021\n\tcon" "textid\030\003 \002(\005\022\013\n\003TTL\030\004 \002(\005\022\017\n\007payload\030\005 \002" "(\014\022\013\n\003cid\030\006 \001(\t\022\016\n\006length\030\007 \001(\005\022\021\n\ttimes" "tamp\030\010 \001(\003\"2\n\022X_Requestchunk_Msg\022\013\n\003dag\030" "\001 \003(\t\022\017\n\007payload\030\002 \001(\014\"D\n\024X_Getchunkstat" "us_Msg\022\013\n\003dag\030\001 \003(\t\022\016\n\006status\030\002 \003(\t\022\017\n\007p" "ayload\030\003 \001(\014\"/\n\017X_Readchunk_Msg\022\013\n\003dag\030\001" " \002(\t\022\017\n\007payload\030\002 \001(\014\"C\n\021X_Removechunk_M" "sg\022\021\n\tcontextid\030\001 \002(\005\022\013\n\003cid\030\002 \002(\t\022\016\n\006st" "atus\030\003 \001(\005\"Y\n\014X_Result_Msg\022\"\n\004type\030\001 \002(\016" "2\024.xia.XSocketCallType\022\023\n\013return_code\030\002 " "\002(\005\022\020\n\010err_code\030\003 \001(\005\"1\n\023X_Requestfailed" "_Msg\022\014\n\004type\030\001 \001(\005\022\014\n\004temp\030\002 \001(\t\"\035\n\016X_Ch" "angead_Msg\022\013\n\003dag\030\001 \002(\t\"2\n\027X_ReadLocalHo" "stAddr_Msg\022\n\n\002ad\030\001 \001(\t\022\013\n\003hid\030\002 \001(\t\"(\n\031X" "_Updatenameserverdag_Msg\022\013\n\003dag\030\001 \002(\t\"&\n" "\027X_ReadNameServerDag_Msg\022\013\n\003dag\030\001 \001(\t\"\316\001" "\n\003msg\022\r\n\005appid\030\001 \001(\005\022\013\n\003xid\030\002 \001(\014\022\023\n\013xia" "path_src\030\005 \001(\t\022\023\n\013xiapath_dst\030\006 \001(\t\022\017\n\007p" "ayload\030\003 \001(\014\022\036\n\004type\030\004 \001(\0162\020.xia.msg.Msg" "Type\"P\n\007MsgType\022\017\n\013GETLOCALHID\020\000\022\n\n\006GETC" "ID\020\001\022\016\n\nCONNECTSID\020\002\022\n\n\006PUTCID\020\003\022\014\n\010SERV" "ESID\020\004\";\n\014msg_response\022\r\n\005appid\030\001 \002(\005\022\013\n" "\003xid\030\002 \003(\014\022\017\n\007payload\030\003 \001(\t*\367\002\n\017XSocketC" "allType\022\013\n\007XSOCKET\020\001\022\t\n\005XBIND\020\002\022\n\n\006XCLOS" "E\020\003\022\014\n\010XCONNECT\020\004\022\013\n\007XACCEPT\020\005\022\013\n\007XSENDT" "O\020\006\022\t\n\005XSEND\020\007\022\t\n\005XRECV\020\010\022\r\n\tXRECVFROM\020\t" "\022\017\n\013XSETSOCKOPT\020\n\022\017\n\013XGETSOCKOPT\020\013\022\r\n\tXP" "UTCHUNK\020\014\022\021\n\rXREQUESTCHUNK\020\r\022\023\n\017XGETCHUN" "KSTATUS\020\016\022\016\n\nXREADCHUNK\020\017\022\020\n\014XREMOVECHUN" "K\020\020\022\022\n\016XREQUESTFAILED\020\021\022\013\n\007XRESULT\020\022\022\r\n\t" "XCHANGEAD\020\023\022\026\n\022XREADLOCALHOSTADDR\020\024\022\030\n\024X" "UPDATENAMESERVERDAG\020\025\022\026\n\022XREADNAMESERVER" "DAG\020\026", 2805); ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( "xia.proto", &protobuf_RegisterTypes); XSocketMsg::default_instance_ = new XSocketMsg(); X_Socket_Msg::default_instance_ = new X_Socket_Msg(); X_Bind_Msg::default_instance_ = new X_Bind_Msg(); X_Close_Msg::default_instance_ = new X_Close_Msg(); X_Connect_Msg::default_instance_ = new X_Connect_Msg(); X_Accept_Msg::default_instance_ = new X_Accept_Msg(); X_Sendto_Msg::default_instance_ = new X_Sendto_Msg(); X_Send_Msg::default_instance_ = new X_Send_Msg(); X_Recv_Msg::default_instance_ = new X_Recv_Msg(); X_Recvfrom_Msg::default_instance_ = new X_Recvfrom_Msg(); X_Setsockopt_Msg::default_instance_ = new X_Setsockopt_Msg(); X_Getsockopt_Msg::default_instance_ = new X_Getsockopt_Msg(); X_Putchunk_Msg::default_instance_ = new X_Putchunk_Msg(); X_Requestchunk_Msg::default_instance_ = new X_Requestchunk_Msg(); X_Getchunkstatus_Msg::default_instance_ = new X_Getchunkstatus_Msg(); X_Readchunk_Msg::default_instance_ = new X_Readchunk_Msg(); X_Removechunk_Msg::default_instance_ = new X_Removechunk_Msg(); X_Result_Msg::default_instance_ = new X_Result_Msg(); X_Requestfailed_Msg::default_instance_ = new X_Requestfailed_Msg(); X_Changead_Msg::default_instance_ = new X_Changead_Msg(); X_ReadLocalHostAddr_Msg::default_instance_ = new X_ReadLocalHostAddr_Msg(); X_Updatenameserverdag_Msg::default_instance_ = new X_Updatenameserverdag_Msg(); X_ReadNameServerDag_Msg::default_instance_ = new X_ReadNameServerDag_Msg(); msg::default_instance_ = new msg(); msg_response::default_instance_ = new msg_response(); XSocketMsg::default_instance_->InitAsDefaultInstance(); X_Socket_Msg::default_instance_->InitAsDefaultInstance(); X_Bind_Msg::default_instance_->InitAsDefaultInstance(); X_Close_Msg::default_instance_->InitAsDefaultInstance(); X_Connect_Msg::default_instance_->InitAsDefaultInstance(); X_Accept_Msg::default_instance_->InitAsDefaultInstance(); X_Sendto_Msg::default_instance_->InitAsDefaultInstance(); X_Send_Msg::default_instance_->InitAsDefaultInstance(); X_Recv_Msg::default_instance_->InitAsDefaultInstance(); X_Recvfrom_Msg::default_instance_->InitAsDefaultInstance(); X_Setsockopt_Msg::default_instance_->InitAsDefaultInstance(); X_Getsockopt_Msg::default_instance_->InitAsDefaultInstance(); X_Putchunk_Msg::default_instance_->InitAsDefaultInstance(); X_Requestchunk_Msg::default_instance_->InitAsDefaultInstance(); X_Getchunkstatus_Msg::default_instance_->InitAsDefaultInstance(); X_Readchunk_Msg::default_instance_->InitAsDefaultInstance(); X_Removechunk_Msg::default_instance_->InitAsDefaultInstance(); X_Result_Msg::default_instance_->InitAsDefaultInstance(); X_Requestfailed_Msg::default_instance_->InitAsDefaultInstance(); X_Changead_Msg::default_instance_->InitAsDefaultInstance(); X_ReadLocalHostAddr_Msg::default_instance_->InitAsDefaultInstance(); X_Updatenameserverdag_Msg::default_instance_->InitAsDefaultInstance(); X_ReadNameServerDag_Msg::default_instance_->InitAsDefaultInstance(); msg::default_instance_->InitAsDefaultInstance(); msg_response::default_instance_->InitAsDefaultInstance(); ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_xia_2eproto); } // Force AddDescriptors() to be called at static initialization time. struct StaticDescriptorInitializer_xia_2eproto { StaticDescriptorInitializer_xia_2eproto() { protobuf_AddDesc_xia_2eproto(); } } static_descriptor_initializer_xia_2eproto_; const ::google::protobuf::EnumDescriptor* XSocketCallType_descriptor() { protobuf_AssignDescriptorsOnce(); return XSocketCallType_descriptor_; } bool XSocketCallType_IsValid(int value) { switch(value) { case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 15: case 16: case 17: case 18: case 19: case 20: case 21: case 22: return true; default: return false; } } // =================================================================== #ifndef _MSC_VER const int XSocketMsg::kTypeFieldNumber; const int XSocketMsg::kXSocketFieldNumber; const int XSocketMsg::kXBindFieldNumber; const int XSocketMsg::kXCloseFieldNumber; const int XSocketMsg::kXConnectFieldNumber; const int XSocketMsg::kXAcceptFieldNumber; const int XSocketMsg::kXSendtoFieldNumber; const int XSocketMsg::kXSendFieldNumber; const int XSocketMsg::kXRecvFieldNumber; const int XSocketMsg::kXRecvfromFieldNumber; const int XSocketMsg::kXSetsockoptFieldNumber; const int XSocketMsg::kXGetsockoptFieldNumber; const int XSocketMsg::kXPutchunkFieldNumber; const int XSocketMsg::kXRequestchunkFieldNumber; const int XSocketMsg::kXGetchunkstatusFieldNumber; const int XSocketMsg::kXReadchunkFieldNumber; const int XSocketMsg::kXRemovechunkFieldNumber; const int XSocketMsg::kXRequestfailedFieldNumber; const int XSocketMsg::kXResultFieldNumber; const int XSocketMsg::kXChangeadFieldNumber; const int XSocketMsg::kXReadlocalhostaddrFieldNumber; const int XSocketMsg::kXUpdatenameserverdagFieldNumber; const int XSocketMsg::kXReadnameserverdagFieldNumber; #endif // !_MSC_VER XSocketMsg::XSocketMsg() : ::google::protobuf::Message() { SharedCtor(); } void XSocketMsg::InitAsDefaultInstance() { x_socket_ = const_cast< ::xia::X_Socket_Msg*>(&::xia::X_Socket_Msg::default_instance()); x_bind_ = const_cast< ::xia::X_Bind_Msg*>(&::xia::X_Bind_Msg::default_instance()); x_close_ = const_cast< ::xia::X_Close_Msg*>(&::xia::X_Close_Msg::default_instance()); x_connect_ = const_cast< ::xia::X_Connect_Msg*>(&::xia::X_Connect_Msg::default_instance()); x_accept_ = const_cast< ::xia::X_Accept_Msg*>(&::xia::X_Accept_Msg::default_instance()); x_sendto_ = const_cast< ::xia::X_Sendto_Msg*>(&::xia::X_Sendto_Msg::default_instance()); x_send_ = const_cast< ::xia::X_Send_Msg*>(&::xia::X_Send_Msg::default_instance()); x_recv_ = const_cast< ::xia::X_Recv_Msg*>(&::xia::X_Recv_Msg::default_instance()); x_recvfrom_ = const_cast< ::xia::X_Recvfrom_Msg*>(&::xia::X_Recvfrom_Msg::default_instance()); x_setsockopt_ = const_cast< ::xia::X_Setsockopt_Msg*>(&::xia::X_Setsockopt_Msg::default_instance()); x_getsockopt_ = const_cast< ::xia::X_Getsockopt_Msg*>(&::xia::X_Getsockopt_Msg::default_instance()); x_putchunk_ = const_cast< ::xia::X_Putchunk_Msg*>(&::xia::X_Putchunk_Msg::default_instance()); x_requestchunk_ = const_cast< ::xia::X_Requestchunk_Msg*>(&::xia::X_Requestchunk_Msg::default_instance()); x_getchunkstatus_ = const_cast< ::xia::X_Getchunkstatus_Msg*>(&::xia::X_Getchunkstatus_Msg::default_instance()); x_readchunk_ = const_cast< ::xia::X_Readchunk_Msg*>(&::xia::X_Readchunk_Msg::default_instance()); x_removechunk_ = const_cast< ::xia::X_Removechunk_Msg*>(&::xia::X_Removechunk_Msg::default_instance()); x_requestfailed_ = const_cast< ::xia::X_Requestfailed_Msg*>(&::xia::X_Requestfailed_Msg::default_instance()); x_result_ = const_cast< ::xia::X_Result_Msg*>(&::xia::X_Result_Msg::default_instance()); x_changead_ = const_cast< ::xia::X_Changead_Msg*>(&::xia::X_Changead_Msg::default_instance()); x_readlocalhostaddr_ = const_cast< ::xia::X_ReadLocalHostAddr_Msg*>(&::xia::X_ReadLocalHostAddr_Msg::default_instance()); x_updatenameserverdag_ = const_cast< ::xia::X_Updatenameserverdag_Msg*>(&::xia::X_Updatenameserverdag_Msg::default_instance()); x_readnameserverdag_ = const_cast< ::xia::X_ReadNameServerDag_Msg*>(&::xia::X_ReadNameServerDag_Msg::default_instance()); } XSocketMsg::XSocketMsg(const XSocketMsg& from) : ::google::protobuf::Message() { SharedCtor(); MergeFrom(from); } void XSocketMsg::SharedCtor() { _cached_size_ = 0; type_ = 1; x_socket_ = NULL; x_bind_ = NULL; x_close_ = NULL; x_connect_ = NULL; x_accept_ = NULL; x_sendto_ = NULL; x_send_ = NULL; x_recv_ = NULL; x_recvfrom_ = NULL; x_setsockopt_ = NULL; x_getsockopt_ = NULL; x_putchunk_ = NULL; x_requestchunk_ = NULL; x_getchunkstatus_ = NULL; x_readchunk_ = NULL; x_removechunk_ = NULL; x_requestfailed_ = NULL; x_result_ = NULL; x_changead_ = NULL; x_readlocalhostaddr_ = NULL; x_updatenameserverdag_ = NULL; x_readnameserverdag_ = NULL; ::memset(_has_bits_, 0, sizeof(_has_bits_)); } XSocketMsg::~XSocketMsg() { SharedDtor(); } void XSocketMsg::SharedDtor() { if (this != default_instance_) { delete x_socket_; delete x_bind_; delete x_close_; delete x_connect_; delete x_accept_; delete x_sendto_; delete x_send_; delete x_recv_; delete x_recvfrom_; delete x_setsockopt_; delete x_getsockopt_; delete x_putchunk_; delete x_requestchunk_; delete x_getchunkstatus_; delete x_readchunk_; delete x_removechunk_; delete x_requestfailed_; delete x_result_; delete x_changead_; delete x_readlocalhostaddr_; delete x_updatenameserverdag_; delete x_readnameserverdag_; } } void XSocketMsg::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* XSocketMsg::descriptor() { protobuf_AssignDescriptorsOnce(); return XSocketMsg_descriptor_; } const XSocketMsg& XSocketMsg::default_instance() { if (default_instance_ == NULL) protobuf_AddDesc_xia_2eproto(); return *default_instance_; } XSocketMsg* XSocketMsg::default_instance_ = NULL; XSocketMsg* XSocketMsg::New() const { return new XSocketMsg; } void XSocketMsg::Clear() { if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { type_ = 1; if (has_x_socket()) { if (x_socket_ != NULL) x_socket_->::xia::X_Socket_Msg::Clear(); } if (has_x_bind()) { if (x_bind_ != NULL) x_bind_->::xia::X_Bind_Msg::Clear(); } if (has_x_close()) { if (x_close_ != NULL) x_close_->::xia::X_Close_Msg::Clear(); } if (has_x_connect()) { if (x_connect_ != NULL) x_connect_->::xia::X_Connect_Msg::Clear(); } if (has_x_accept()) { if (x_accept_ != NULL) x_accept_->::xia::X_Accept_Msg::Clear(); } if (has_x_sendto()) { if (x_sendto_ != NULL) x_sendto_->::xia::X_Sendto_Msg::Clear(); } if (has_x_send()) { if (x_send_ != NULL) x_send_->::xia::X_Send_Msg::Clear(); } } if (_has_bits_[8 / 32] & (0xffu << (8 % 32))) { if (has_x_recv()) { if (x_recv_ != NULL) x_recv_->::xia::X_Recv_Msg::Clear(); } if (has_x_recvfrom()) { if (x_recvfrom_ != NULL) x_recvfrom_->::xia::X_Recvfrom_Msg::Clear(); } if (has_x_setsockopt()) { if (x_setsockopt_ != NULL) x_setsockopt_->::xia::X_Setsockopt_Msg::Clear(); } if (has_x_getsockopt()) { if (x_getsockopt_ != NULL) x_getsockopt_->::xia::X_Getsockopt_Msg::Clear(); } if (has_x_putchunk()) { if (x_putchunk_ != NULL) x_putchunk_->::xia::X_Putchunk_Msg::Clear(); } if (has_x_requestchunk()) { if (x_requestchunk_ != NULL) x_requestchunk_->::xia::X_Requestchunk_Msg::Clear(); } if (has_x_getchunkstatus()) { if (x_getchunkstatus_ != NULL) x_getchunkstatus_->::xia::X_Getchunkstatus_Msg::Clear(); } if (has_x_readchunk()) { if (x_readchunk_ != NULL) x_readchunk_->::xia::X_Readchunk_Msg::Clear(); } } if (_has_bits_[16 / 32] & (0xffu << (16 % 32))) { if (has_x_removechunk()) { if (x_removechunk_ != NULL) x_removechunk_->::xia::X_Removechunk_Msg::Clear(); } if (has_x_requestfailed()) { if (x_requestfailed_ != NULL) x_requestfailed_->::xia::X_Requestfailed_Msg::Clear(); } if (has_x_result()) { if (x_result_ != NULL) x_result_->::xia::X_Result_Msg::Clear(); } if (has_x_changead()) { if (x_changead_ != NULL) x_changead_->::xia::X_Changead_Msg::Clear(); } if (has_x_readlocalhostaddr()) { if (x_readlocalhostaddr_ != NULL) x_readlocalhostaddr_->::xia::X_ReadLocalHostAddr_Msg::Clear(); } if (has_x_updatenameserverdag()) { if (x_updatenameserverdag_ != NULL) x_updatenameserverdag_->::xia::X_Updatenameserverdag_Msg::Clear(); } if (has_x_readnameserverdag()) { if (x_readnameserverdag_ != NULL) x_readnameserverdag_->::xia::X_ReadNameServerDag_Msg::Clear(); } } ::memset(_has_bits_, 0, sizeof(_has_bits_)); mutable_unknown_fields()->Clear(); } bool XSocketMsg::MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) { #define DO_(EXPRESSION) if (!(EXPRESSION)) return false ::google::protobuf::uint32 tag; while ((tag = input->ReadTag()) != 0) { switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // required .xia.XSocketCallType type = 1; case 1: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { int value; DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( input, &value))); if (xia::XSocketCallType_IsValid(value)) { set_type(static_cast< xia::XSocketCallType >(value)); } else { mutable_unknown_fields()->AddVarint(1, value); } } else { goto handle_uninterpreted; } if (input->ExpectTag(18)) goto parse_x_socket; break; } // optional .xia.X_Socket_Msg x_socket = 2; case 2: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { parse_x_socket: DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( input, mutable_x_socket())); } else { goto handle_uninterpreted; } if (input->ExpectTag(26)) goto parse_x_bind; break; } // optional .xia.X_Bind_Msg x_bind = 3; case 3: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { parse_x_bind: DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( input, mutable_x_bind())); } else { goto handle_uninterpreted; } if (input->ExpectTag(34)) goto parse_x_close; break; } // optional .xia.X_Close_Msg x_close = 4; case 4: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { parse_x_close: DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( input, mutable_x_close())); } else { goto handle_uninterpreted; } if (input->ExpectTag(42)) goto parse_x_connect; break; } // optional .xia.X_Connect_Msg x_connect = 5; case 5: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { parse_x_connect: DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( input, mutable_x_connect())); } else { goto handle_uninterpreted; } if (input->ExpectTag(50)) goto parse_x_accept; break; } // optional .xia.X_Accept_Msg x_accept = 6; case 6: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { parse_x_accept: DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( input, mutable_x_accept())); } else { goto handle_uninterpreted; } if (input->ExpectTag(58)) goto parse_x_sendto; break; } // optional .xia.X_Sendto_Msg x_sendto = 7; case 7: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { parse_x_sendto: DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( input, mutable_x_sendto())); } else { goto handle_uninterpreted; } if (input->ExpectTag(66)) goto parse_x_send; break; } // optional .xia.X_Send_Msg x_send = 8; case 8: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { parse_x_send: DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( input, mutable_x_send())); } else { goto handle_uninterpreted; } if (input->ExpectTag(74)) goto parse_x_recv; break; } // optional .xia.X_Recv_Msg x_recv = 9; case 9: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { parse_x_recv: DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( input, mutable_x_recv())); } else { goto handle_uninterpreted; } if (input->ExpectTag(82)) goto parse_x_recvfrom; break; } // optional .xia.X_Recvfrom_Msg x_recvfrom = 10; case 10: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { parse_x_recvfrom: DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( input, mutable_x_recvfrom())); } else { goto handle_uninterpreted; } if (input->ExpectTag(90)) goto parse_x_setsockopt; break; } // optional .xia.X_Setsockopt_Msg x_setsockopt = 11; case 11: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { parse_x_setsockopt: DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( input, mutable_x_setsockopt())); } else { goto handle_uninterpreted; } if (input->ExpectTag(98)) goto parse_x_getsockopt; break; } // optional .xia.X_Getsockopt_Msg x_getsockopt = 12; case 12: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { parse_x_getsockopt: DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( input, mutable_x_getsockopt())); } else { goto handle_uninterpreted; } if (input->ExpectTag(106)) goto parse_x_putchunk; break; } // optional .xia.X_Putchunk_Msg x_putchunk = 13; case 13: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { parse_x_putchunk: DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( input, mutable_x_putchunk())); } else { goto handle_uninterpreted; } if (input->ExpectTag(114)) goto parse_x_requestchunk; break; } // optional .xia.X_Requestchunk_Msg x_requestchunk = 14; case 14: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { parse_x_requestchunk: DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( input, mutable_x_requestchunk())); } else { goto handle_uninterpreted; } if (input->ExpectTag(122)) goto parse_x_getchunkstatus; break; } // optional .xia.X_Getchunkstatus_Msg x_getchunkstatus = 15; case 15: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { parse_x_getchunkstatus: DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( input, mutable_x_getchunkstatus())); } else { goto handle_uninterpreted; } if (input->ExpectTag(130)) goto parse_x_readchunk; break; } // optional .xia.X_Readchunk_Msg x_readchunk = 16; case 16: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { parse_x_readchunk: DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( input, mutable_x_readchunk())); } else { goto handle_uninterpreted; } if (input->ExpectTag(138)) goto parse_x_removechunk; break; } // optional .xia.X_Removechunk_Msg x_removechunk = 17; case 17: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { parse_x_removechunk: DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( input, mutable_x_removechunk())); } else { goto handle_uninterpreted; } if (input->ExpectTag(146)) goto parse_x_requestfailed; break; } // optional .xia.X_Requestfailed_Msg x_requestfailed = 18; case 18: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { parse_x_requestfailed: DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( input, mutable_x_requestfailed())); } else { goto handle_uninterpreted; } if (input->ExpectTag(154)) goto parse_x_result; break; } // optional .xia.X_Result_Msg x_result = 19; case 19: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { parse_x_result: DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( input, mutable_x_result())); } else { goto handle_uninterpreted; } if (input->ExpectTag(162)) goto parse_x_changead; break; } // optional .xia.X_Changead_Msg x_changead = 20; case 20: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { parse_x_changead: DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( input, mutable_x_changead())); } else { goto handle_uninterpreted; } if (input->ExpectTag(170)) goto parse_x_readlocalhostaddr; break; } // optional .xia.X_ReadLocalHostAddr_Msg x_readlocalhostaddr = 21; case 21: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { parse_x_readlocalhostaddr: DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( input, mutable_x_readlocalhostaddr())); } else { goto handle_uninterpreted; } if (input->ExpectTag(178)) goto parse_x_updatenameserverdag; break; } // optional .xia.X_Updatenameserverdag_Msg x_updatenameserverdag = 22; case 22: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { parse_x_updatenameserverdag: DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( input, mutable_x_updatenameserverdag())); } else { goto handle_uninterpreted; } if (input->ExpectTag(186)) goto parse_x_readnameserverdag; break; } // optional .xia.X_ReadNameServerDag_Msg x_readnameserverdag = 23; case 23: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { parse_x_readnameserverdag: DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( input, mutable_x_readnameserverdag())); } else { goto handle_uninterpreted; } if (input->ExpectAtEnd()) return true; break; } default: { handle_uninterpreted: if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { return true; } DO_(::google::protobuf::internal::WireFormat::SkipField( input, tag, mutable_unknown_fields())); break; } } } return true; #undef DO_ } void XSocketMsg::SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const { // required .xia.XSocketCallType type = 1; if (has_type()) { ::google::protobuf::internal::WireFormatLite::WriteEnum( 1, this->type(), output); } // optional .xia.X_Socket_Msg x_socket = 2; if (has_x_socket()) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( 2, this->x_socket(), output); } // optional .xia.X_Bind_Msg x_bind = 3; if (has_x_bind()) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( 3, this->x_bind(), output); } // optional .xia.X_Close_Msg x_close = 4; if (has_x_close()) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( 4, this->x_close(), output); } // optional .xia.X_Connect_Msg x_connect = 5; if (has_x_connect()) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( 5, this->x_connect(), output); } // optional .xia.X_Accept_Msg x_accept = 6; if (has_x_accept()) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( 6, this->x_accept(), output); } // optional .xia.X_Sendto_Msg x_sendto = 7; if (has_x_sendto()) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( 7, this->x_sendto(), output); } // optional .xia.X_Send_Msg x_send = 8; if (has_x_send()) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( 8, this->x_send(), output); } // optional .xia.X_Recv_Msg x_recv = 9; if (has_x_recv()) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( 9, this->x_recv(), output); } // optional .xia.X_Recvfrom_Msg x_recvfrom = 10; if (has_x_recvfrom()) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( 10, this->x_recvfrom(), output); } // optional .xia.X_Setsockopt_Msg x_setsockopt = 11; if (has_x_setsockopt()) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( 11, this->x_setsockopt(), output); } // optional .xia.X_Getsockopt_Msg x_getsockopt = 12; if (has_x_getsockopt()) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( 12, this->x_getsockopt(), output); } // optional .xia.X_Putchunk_Msg x_putchunk = 13; if (has_x_putchunk()) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( 13, this->x_putchunk(), output); } // optional .xia.X_Requestchunk_Msg x_requestchunk = 14; if (has_x_requestchunk()) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( 14, this->x_requestchunk(), output); } // optional .xia.X_Getchunkstatus_Msg x_getchunkstatus = 15; if (has_x_getchunkstatus()) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( 15, this->x_getchunkstatus(), output); } // optional .xia.X_Readchunk_Msg x_readchunk = 16; if (has_x_readchunk()) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( 16, this->x_readchunk(), output); } // optional .xia.X_Removechunk_Msg x_removechunk = 17; if (has_x_removechunk()) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( 17, this->x_removechunk(), output); } // optional .xia.X_Requestfailed_Msg x_requestfailed = 18; if (has_x_requestfailed()) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( 18, this->x_requestfailed(), output); } // optional .xia.X_Result_Msg x_result = 19; if (has_x_result()) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( 19, this->x_result(), output); } // optional .xia.X_Changead_Msg x_changead = 20; if (has_x_changead()) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( 20, this->x_changead(), output); } // optional .xia.X_ReadLocalHostAddr_Msg x_readlocalhostaddr = 21; if (has_x_readlocalhostaddr()) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( 21, this->x_readlocalhostaddr(), output); } // optional .xia.X_Updatenameserverdag_Msg x_updatenameserverdag = 22; if (has_x_updatenameserverdag()) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( 22, this->x_updatenameserverdag(), output); } // optional .xia.X_ReadNameServerDag_Msg x_readnameserverdag = 23; if (has_x_readnameserverdag()) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( 23, this->x_readnameserverdag(), output); } if (!unknown_fields().empty()) { ::google::protobuf::internal::WireFormat::SerializeUnknownFields( unknown_fields(), output); } } ::google::protobuf::uint8* XSocketMsg::SerializeWithCachedSizesToArray( ::google::protobuf::uint8* target) const { // required .xia.XSocketCallType type = 1; if (has_type()) { target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray( 1, this->type(), target); } // optional .xia.X_Socket_Msg x_socket = 2; if (has_x_socket()) { target = ::google::protobuf::internal::WireFormatLite:: WriteMessageNoVirtualToArray( 2, this->x_socket(), target); } // optional .xia.X_Bind_Msg x_bind = 3; if (has_x_bind()) { target = ::google::protobuf::internal::WireFormatLite:: WriteMessageNoVirtualToArray( 3, this->x_bind(), target); } // optional .xia.X_Close_Msg x_close = 4; if (has_x_close()) { target = ::google::protobuf::internal::WireFormatLite:: WriteMessageNoVirtualToArray( 4, this->x_close(), target); } // optional .xia.X_Connect_Msg x_connect = 5; if (has_x_connect()) { target = ::google::protobuf::internal::WireFormatLite:: WriteMessageNoVirtualToArray( 5, this->x_connect(), target); } // optional .xia.X_Accept_Msg x_accept = 6; if (has_x_accept()) { target = ::google::protobuf::internal::WireFormatLite:: WriteMessageNoVirtualToArray( 6, this->x_accept(), target); } // optional .xia.X_Sendto_Msg x_sendto = 7; if (has_x_sendto()) { target = ::google::protobuf::internal::WireFormatLite:: WriteMessageNoVirtualToArray( 7, this->x_sendto(), target); } // optional .xia.X_Send_Msg x_send = 8; if (has_x_send()) { target = ::google::protobuf::internal::WireFormatLite:: WriteMessageNoVirtualToArray( 8, this->x_send(), target); } // optional .xia.X_Recv_Msg x_recv = 9; if (has_x_recv()) { target = ::google::protobuf::internal::WireFormatLite:: WriteMessageNoVirtualToArray( 9, this->x_recv(), target); } // optional .xia.X_Recvfrom_Msg x_recvfrom = 10; if (has_x_recvfrom()) { target = ::google::protobuf::internal::WireFormatLite:: WriteMessageNoVirtualToArray( 10, this->x_recvfrom(), target); } // optional .xia.X_Setsockopt_Msg x_setsockopt = 11; if (has_x_setsockopt()) { target = ::google::protobuf::internal::WireFormatLite:: WriteMessageNoVirtualToArray( 11, this->x_setsockopt(), target); } // optional .xia.X_Getsockopt_Msg x_getsockopt = 12; if (has_x_getsockopt()) { target = ::google::protobuf::internal::WireFormatLite:: WriteMessageNoVirtualToArray( 12, this->x_getsockopt(), target); } // optional .xia.X_Putchunk_Msg x_putchunk = 13; if (has_x_putchunk()) { target = ::google::protobuf::internal::WireFormatLite:: WriteMessageNoVirtualToArray( 13, this->x_putchunk(), target); } // optional .xia.X_Requestchunk_Msg x_requestchunk = 14; if (has_x_requestchunk()) { target = ::google::protobuf::internal::WireFormatLite:: WriteMessageNoVirtualToArray( 14, this->x_requestchunk(), target); } // optional .xia.X_Getchunkstatus_Msg x_getchunkstatus = 15; if (has_x_getchunkstatus()) { target = ::google::protobuf::internal::WireFormatLite:: WriteMessageNoVirtualToArray( 15, this->x_getchunkstatus(), target); } // optional .xia.X_Readchunk_Msg x_readchunk = 16; if (has_x_readchunk()) { target = ::google::protobuf::internal::WireFormatLite:: WriteMessageNoVirtualToArray( 16, this->x_readchunk(), target); } // optional .xia.X_Removechunk_Msg x_removechunk = 17; if (has_x_removechunk()) { target = ::google::protobuf::internal::WireFormatLite:: WriteMessageNoVirtualToArray( 17, this->x_removechunk(), target); } // optional .xia.X_Requestfailed_Msg x_requestfailed = 18; if (has_x_requestfailed()) { target = ::google::protobuf::internal::WireFormatLite:: WriteMessageNoVirtualToArray( 18, this->x_requestfailed(), target); } // optional .xia.X_Result_Msg x_result = 19; if (has_x_result()) { target = ::google::protobuf::internal::WireFormatLite:: WriteMessageNoVirtualToArray( 19, this->x_result(), target); } // optional .xia.X_Changead_Msg x_changead = 20; if (has_x_changead()) { target = ::google::protobuf::internal::WireFormatLite:: WriteMessageNoVirtualToArray( 20, this->x_changead(), target); } // optional .xia.X_ReadLocalHostAddr_Msg x_readlocalhostaddr = 21; if (has_x_readlocalhostaddr()) { target = ::google::protobuf::internal::WireFormatLite:: WriteMessageNoVirtualToArray( 21, this->x_readlocalhostaddr(), target); } // optional .xia.X_Updatenameserverdag_Msg x_updatenameserverdag = 22; if (has_x_updatenameserverdag()) { target = ::google::protobuf::internal::WireFormatLite:: WriteMessageNoVirtualToArray( 22, this->x_updatenameserverdag(), target); } // optional .xia.X_ReadNameServerDag_Msg x_readnameserverdag = 23; if (has_x_readnameserverdag()) { target = ::google::protobuf::internal::WireFormatLite:: WriteMessageNoVirtualToArray( 23, this->x_readnameserverdag(), target); } if (!unknown_fields().empty()) { target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( unknown_fields(), target); } return target; } int XSocketMsg::ByteSize() const { int total_size = 0; if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { // required .xia.XSocketCallType type = 1; if (has_type()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::EnumSize(this->type()); } // optional .xia.X_Socket_Msg x_socket = 2; if (has_x_socket()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( this->x_socket()); } // optional .xia.X_Bind_Msg x_bind = 3; if (has_x_bind()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( this->x_bind()); } // optional .xia.X_Close_Msg x_close = 4; if (has_x_close()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( this->x_close()); } // optional .xia.X_Connect_Msg x_connect = 5; if (has_x_connect()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( this->x_connect()); } // optional .xia.X_Accept_Msg x_accept = 6; if (has_x_accept()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( this->x_accept()); } // optional .xia.X_Sendto_Msg x_sendto = 7; if (has_x_sendto()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( this->x_sendto()); } // optional .xia.X_Send_Msg x_send = 8; if (has_x_send()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( this->x_send()); } } if (_has_bits_[8 / 32] & (0xffu << (8 % 32))) { // optional .xia.X_Recv_Msg x_recv = 9; if (has_x_recv()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( this->x_recv()); } // optional .xia.X_Recvfrom_Msg x_recvfrom = 10; if (has_x_recvfrom()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( this->x_recvfrom()); } // optional .xia.X_Setsockopt_Msg x_setsockopt = 11; if (has_x_setsockopt()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( this->x_setsockopt()); } // optional .xia.X_Getsockopt_Msg x_getsockopt = 12; if (has_x_getsockopt()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( this->x_getsockopt()); } // optional .xia.X_Putchunk_Msg x_putchunk = 13; if (has_x_putchunk()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( this->x_putchunk()); } // optional .xia.X_Requestchunk_Msg x_requestchunk = 14; if (has_x_requestchunk()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( this->x_requestchunk()); } // optional .xia.X_Getchunkstatus_Msg x_getchunkstatus = 15; if (has_x_getchunkstatus()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( this->x_getchunkstatus()); } // optional .xia.X_Readchunk_Msg x_readchunk = 16; if (has_x_readchunk()) { total_size += 2 + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( this->x_readchunk()); } } if (_has_bits_[16 / 32] & (0xffu << (16 % 32))) { // optional .xia.X_Removechunk_Msg x_removechunk = 17; if (has_x_removechunk()) { total_size += 2 + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( this->x_removechunk()); } // optional .xia.X_Requestfailed_Msg x_requestfailed = 18; if (has_x_requestfailed()) { total_size += 2 + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( this->x_requestfailed()); } // optional .xia.X_Result_Msg x_result = 19; if (has_x_result()) { total_size += 2 + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( this->x_result()); } // optional .xia.X_Changead_Msg x_changead = 20; if (has_x_changead()) { total_size += 2 + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( this->x_changead()); } // optional .xia.X_ReadLocalHostAddr_Msg x_readlocalhostaddr = 21; if (has_x_readlocalhostaddr()) { total_size += 2 + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( this->x_readlocalhostaddr()); } // optional .xia.X_Updatenameserverdag_Msg x_updatenameserverdag = 22; if (has_x_updatenameserverdag()) { total_size += 2 + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( this->x_updatenameserverdag()); } // optional .xia.X_ReadNameServerDag_Msg x_readnameserverdag = 23; if (has_x_readnameserverdag()) { total_size += 2 + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( this->x_readnameserverdag()); } } 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 XSocketMsg::MergeFrom(const ::google::protobuf::Message& from) { GOOGLE_CHECK_NE(&from, this); const XSocketMsg* source = ::google::protobuf::internal::dynamic_cast_if_available<const XSocketMsg*>( &from); if (source == NULL) { ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { MergeFrom(*source); } } void XSocketMsg::MergeFrom(const XSocketMsg& from) { GOOGLE_CHECK_NE(&from, this); if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { if (from.has_type()) { set_type(from.type()); } if (from.has_x_socket()) { mutable_x_socket()->::xia::X_Socket_Msg::MergeFrom(from.x_socket()); } if (from.has_x_bind()) { mutable_x_bind()->::xia::X_Bind_Msg::MergeFrom(from.x_bind()); } if (from.has_x_close()) { mutable_x_close()->::xia::X_Close_Msg::MergeFrom(from.x_close()); } if (from.has_x_connect()) { mutable_x_connect()->::xia::X_Connect_Msg::MergeFrom(from.x_connect()); } if (from.has_x_accept()) { mutable_x_accept()->::xia::X_Accept_Msg::MergeFrom(from.x_accept()); } if (from.has_x_sendto()) { mutable_x_sendto()->::xia::X_Sendto_Msg::MergeFrom(from.x_sendto()); } if (from.has_x_send()) { mutable_x_send()->::xia::X_Send_Msg::MergeFrom(from.x_send()); } } if (from._has_bits_[8 / 32] & (0xffu << (8 % 32))) { if (from.has_x_recv()) { mutable_x_recv()->::xia::X_Recv_Msg::MergeFrom(from.x_recv()); } if (from.has_x_recvfrom()) { mutable_x_recvfrom()->::xia::X_Recvfrom_Msg::MergeFrom(from.x_recvfrom()); } if (from.has_x_setsockopt()) { mutable_x_setsockopt()->::xia::X_Setsockopt_Msg::MergeFrom(from.x_setsockopt()); } if (from.has_x_getsockopt()) { mutable_x_getsockopt()->::xia::X_Getsockopt_Msg::MergeFrom(from.x_getsockopt()); } if (from.has_x_putchunk()) { mutable_x_putchunk()->::xia::X_Putchunk_Msg::MergeFrom(from.x_putchunk()); } if (from.has_x_requestchunk()) { mutable_x_requestchunk()->::xia::X_Requestchunk_Msg::MergeFrom(from.x_requestchunk()); } if (from.has_x_getchunkstatus()) { mutable_x_getchunkstatus()->::xia::X_Getchunkstatus_Msg::MergeFrom(from.x_getchunkstatus()); } if (from.has_x_readchunk()) { mutable_x_readchunk()->::xia::X_Readchunk_Msg::MergeFrom(from.x_readchunk()); } } if (from._has_bits_[16 / 32] & (0xffu << (16 % 32))) { if (from.has_x_removechunk()) { mutable_x_removechunk()->::xia::X_Removechunk_Msg::MergeFrom(from.x_removechunk()); } if (from.has_x_requestfailed()) { mutable_x_requestfailed()->::xia::X_Requestfailed_Msg::MergeFrom(from.x_requestfailed()); } if (from.has_x_result()) { mutable_x_result()->::xia::X_Result_Msg::MergeFrom(from.x_result()); } if (from.has_x_changead()) { mutable_x_changead()->::xia::X_Changead_Msg::MergeFrom(from.x_changead()); } if (from.has_x_readlocalhostaddr()) { mutable_x_readlocalhostaddr()->::xia::X_ReadLocalHostAddr_Msg::MergeFrom(from.x_readlocalhostaddr()); } if (from.has_x_updatenameserverdag()) { mutable_x_updatenameserverdag()->::xia::X_Updatenameserverdag_Msg::MergeFrom(from.x_updatenameserverdag()); } if (from.has_x_readnameserverdag()) { mutable_x_readnameserverdag()->::xia::X_ReadNameServerDag_Msg::MergeFrom(from.x_readnameserverdag()); } } mutable_unknown_fields()->MergeFrom(from.unknown_fields()); } void XSocketMsg::CopyFrom(const ::google::protobuf::Message& from) { if (&from == this) return; Clear(); MergeFrom(from); } void XSocketMsg::CopyFrom(const XSocketMsg& from) { if (&from == this) return; Clear(); MergeFrom(from); } bool XSocketMsg::IsInitialized() const { if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false; if (has_x_socket()) { if (!this->x_socket().IsInitialized()) return false; } if (has_x_bind()) { if (!this->x_bind().IsInitialized()) return false; } if (has_x_connect()) { if (!this->x_connect().IsInitialized()) return false; } if (has_x_sendto()) { if (!this->x_sendto().IsInitialized()) return false; } if (has_x_send()) { if (!this->x_send().IsInitialized()) return false; } if (has_x_setsockopt()) { if (!this->x_setsockopt().IsInitialized()) return false; } if (has_x_getsockopt()) { if (!this->x_getsockopt().IsInitialized()) return false; } if (has_x_putchunk()) { if (!this->x_putchunk().IsInitialized()) return false; } if (has_x_readchunk()) { if (!this->x_readchunk().IsInitialized()) return false; } if (has_x_removechunk()) { if (!this->x_removechunk().IsInitialized()) return false; } if (has_x_result()) { if (!this->x_result().IsInitialized()) return false; } if (has_x_changead()) { if (!this->x_changead().IsInitialized()) return false; } if (has_x_updatenameserverdag()) { if (!this->x_updatenameserverdag().IsInitialized()) return false; } return true; } void XSocketMsg::Swap(XSocketMsg* other) { if (other != this) { std::swap(type_, other->type_); std::swap(x_socket_, other->x_socket_); std::swap(x_bind_, other->x_bind_); std::swap(x_close_, other->x_close_); std::swap(x_connect_, other->x_connect_); std::swap(x_accept_, other->x_accept_); std::swap(x_sendto_, other->x_sendto_); std::swap(x_send_, other->x_send_); std::swap(x_recv_, other->x_recv_); std::swap(x_recvfrom_, other->x_recvfrom_); std::swap(x_setsockopt_, other->x_setsockopt_); std::swap(x_getsockopt_, other->x_getsockopt_); std::swap(x_putchunk_, other->x_putchunk_); std::swap(x_requestchunk_, other->x_requestchunk_); std::swap(x_getchunkstatus_, other->x_getchunkstatus_); std::swap(x_readchunk_, other->x_readchunk_); std::swap(x_removechunk_, other->x_removechunk_); std::swap(x_requestfailed_, other->x_requestfailed_); std::swap(x_result_, other->x_result_); std::swap(x_changead_, other->x_changead_); std::swap(x_readlocalhostaddr_, other->x_readlocalhostaddr_); std::swap(x_updatenameserverdag_, other->x_updatenameserverdag_); std::swap(x_readnameserverdag_, other->x_readnameserverdag_); 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 XSocketMsg::GetMetadata() const { protobuf_AssignDescriptorsOnce(); ::google::protobuf::Metadata metadata; metadata.descriptor = XSocketMsg_descriptor_; metadata.reflection = XSocketMsg_reflection_; return metadata; } // =================================================================== #ifndef _MSC_VER const int X_Socket_Msg::kTypeFieldNumber; const int X_Socket_Msg::kTempFieldNumber; #endif // !_MSC_VER X_Socket_Msg::X_Socket_Msg() : ::google::protobuf::Message() { SharedCtor(); } void X_Socket_Msg::InitAsDefaultInstance() { } X_Socket_Msg::X_Socket_Msg(const X_Socket_Msg& from) : ::google::protobuf::Message() { SharedCtor(); MergeFrom(from); } void X_Socket_Msg::SharedCtor() { _cached_size_ = 0; type_ = 0; temp_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); ::memset(_has_bits_, 0, sizeof(_has_bits_)); } X_Socket_Msg::~X_Socket_Msg() { SharedDtor(); } void X_Socket_Msg::SharedDtor() { if (temp_ != &::google::protobuf::internal::kEmptyString) { delete temp_; } if (this != default_instance_) { } } void X_Socket_Msg::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* X_Socket_Msg::descriptor() { protobuf_AssignDescriptorsOnce(); return X_Socket_Msg_descriptor_; } const X_Socket_Msg& X_Socket_Msg::default_instance() { if (default_instance_ == NULL) protobuf_AddDesc_xia_2eproto(); return *default_instance_; } X_Socket_Msg* X_Socket_Msg::default_instance_ = NULL; X_Socket_Msg* X_Socket_Msg::New() const { return new X_Socket_Msg; } void X_Socket_Msg::Clear() { if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { type_ = 0; if (has_temp()) { if (temp_ != &::google::protobuf::internal::kEmptyString) { temp_->clear(); } } } ::memset(_has_bits_, 0, sizeof(_has_bits_)); mutable_unknown_fields()->Clear(); } bool X_Socket_Msg::MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) { #define DO_(EXPRESSION) if (!(EXPRESSION)) return false ::google::protobuf::uint32 tag; while ((tag = input->ReadTag()) != 0) { switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // required int32 type = 1; case 1: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( input, &type_))); set_has_type(); } else { goto handle_uninterpreted; } if (input->ExpectTag(18)) goto parse_temp; break; } // optional string temp = 2; case 2: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { parse_temp: DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_temp())); ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->temp().data(), this->temp().length(), ::google::protobuf::internal::WireFormat::PARSE); } else { goto handle_uninterpreted; } if (input->ExpectAtEnd()) return true; break; } default: { handle_uninterpreted: if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { return true; } DO_(::google::protobuf::internal::WireFormat::SkipField( input, tag, mutable_unknown_fields())); break; } } } return true; #undef DO_ } void X_Socket_Msg::SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const { // required int32 type = 1; if (has_type()) { ::google::protobuf::internal::WireFormatLite::WriteInt32(1, this->type(), output); } // optional string temp = 2; if (has_temp()) { ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->temp().data(), this->temp().length(), ::google::protobuf::internal::WireFormat::SERIALIZE); ::google::protobuf::internal::WireFormatLite::WriteString( 2, this->temp(), output); } if (!unknown_fields().empty()) { ::google::protobuf::internal::WireFormat::SerializeUnknownFields( unknown_fields(), output); } } ::google::protobuf::uint8* X_Socket_Msg::SerializeWithCachedSizesToArray( ::google::protobuf::uint8* target) const { // required int32 type = 1; if (has_type()) { target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(1, this->type(), target); } // optional string temp = 2; if (has_temp()) { ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->temp().data(), this->temp().length(), ::google::protobuf::internal::WireFormat::SERIALIZE); target = ::google::protobuf::internal::WireFormatLite::WriteStringToArray( 2, this->temp(), target); } if (!unknown_fields().empty()) { target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( unknown_fields(), target); } return target; } int X_Socket_Msg::ByteSize() const { int total_size = 0; if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { // required int32 type = 1; if (has_type()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( this->type()); } // optional string temp = 2; if (has_temp()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( this->temp()); } } 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 X_Socket_Msg::MergeFrom(const ::google::protobuf::Message& from) { GOOGLE_CHECK_NE(&from, this); const X_Socket_Msg* source = ::google::protobuf::internal::dynamic_cast_if_available<const X_Socket_Msg*>( &from); if (source == NULL) { ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { MergeFrom(*source); } } void X_Socket_Msg::MergeFrom(const X_Socket_Msg& from) { GOOGLE_CHECK_NE(&from, this); if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { if (from.has_type()) { set_type(from.type()); } if (from.has_temp()) { set_temp(from.temp()); } } mutable_unknown_fields()->MergeFrom(from.unknown_fields()); } void X_Socket_Msg::CopyFrom(const ::google::protobuf::Message& from) { if (&from == this) return; Clear(); MergeFrom(from); } void X_Socket_Msg::CopyFrom(const X_Socket_Msg& from) { if (&from == this) return; Clear(); MergeFrom(from); } bool X_Socket_Msg::IsInitialized() const { if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false; return true; } void X_Socket_Msg::Swap(X_Socket_Msg* other) { if (other != this) { std::swap(type_, other->type_); std::swap(temp_, other->temp_); 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 X_Socket_Msg::GetMetadata() const { protobuf_AssignDescriptorsOnce(); ::google::protobuf::Metadata metadata; metadata.descriptor = X_Socket_Msg_descriptor_; metadata.reflection = X_Socket_Msg_reflection_; return metadata; } // =================================================================== #ifndef _MSC_VER const int X_Bind_Msg::kSdagFieldNumber; #endif // !_MSC_VER X_Bind_Msg::X_Bind_Msg() : ::google::protobuf::Message() { SharedCtor(); } void X_Bind_Msg::InitAsDefaultInstance() { } X_Bind_Msg::X_Bind_Msg(const X_Bind_Msg& from) : ::google::protobuf::Message() { SharedCtor(); MergeFrom(from); } void X_Bind_Msg::SharedCtor() { _cached_size_ = 0; sdag_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); ::memset(_has_bits_, 0, sizeof(_has_bits_)); } X_Bind_Msg::~X_Bind_Msg() { SharedDtor(); } void X_Bind_Msg::SharedDtor() { if (sdag_ != &::google::protobuf::internal::kEmptyString) { delete sdag_; } if (this != default_instance_) { } } void X_Bind_Msg::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* X_Bind_Msg::descriptor() { protobuf_AssignDescriptorsOnce(); return X_Bind_Msg_descriptor_; } const X_Bind_Msg& X_Bind_Msg::default_instance() { if (default_instance_ == NULL) protobuf_AddDesc_xia_2eproto(); return *default_instance_; } X_Bind_Msg* X_Bind_Msg::default_instance_ = NULL; X_Bind_Msg* X_Bind_Msg::New() const { return new X_Bind_Msg; } void X_Bind_Msg::Clear() { if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { if (has_sdag()) { if (sdag_ != &::google::protobuf::internal::kEmptyString) { sdag_->clear(); } } } ::memset(_has_bits_, 0, sizeof(_has_bits_)); mutable_unknown_fields()->Clear(); } bool X_Bind_Msg::MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) { #define DO_(EXPRESSION) if (!(EXPRESSION)) return false ::google::protobuf::uint32 tag; while ((tag = input->ReadTag()) != 0) { switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // required string sdag = 1; case 1: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_sdag())); ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->sdag().data(), this->sdag().length(), ::google::protobuf::internal::WireFormat::PARSE); } else { goto handle_uninterpreted; } if (input->ExpectAtEnd()) return true; break; } default: { handle_uninterpreted: if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { return true; } DO_(::google::protobuf::internal::WireFormat::SkipField( input, tag, mutable_unknown_fields())); break; } } } return true; #undef DO_ } void X_Bind_Msg::SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const { // required string sdag = 1; if (has_sdag()) { ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->sdag().data(), this->sdag().length(), ::google::protobuf::internal::WireFormat::SERIALIZE); ::google::protobuf::internal::WireFormatLite::WriteString( 1, this->sdag(), output); } if (!unknown_fields().empty()) { ::google::protobuf::internal::WireFormat::SerializeUnknownFields( unknown_fields(), output); } } ::google::protobuf::uint8* X_Bind_Msg::SerializeWithCachedSizesToArray( ::google::protobuf::uint8* target) const { // required string sdag = 1; if (has_sdag()) { ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->sdag().data(), this->sdag().length(), ::google::protobuf::internal::WireFormat::SERIALIZE); target = ::google::protobuf::internal::WireFormatLite::WriteStringToArray( 1, this->sdag(), target); } if (!unknown_fields().empty()) { target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( unknown_fields(), target); } return target; } int X_Bind_Msg::ByteSize() const { int total_size = 0; if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { // required string sdag = 1; if (has_sdag()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( this->sdag()); } } 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 X_Bind_Msg::MergeFrom(const ::google::protobuf::Message& from) { GOOGLE_CHECK_NE(&from, this); const X_Bind_Msg* source = ::google::protobuf::internal::dynamic_cast_if_available<const X_Bind_Msg*>( &from); if (source == NULL) { ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { MergeFrom(*source); } } void X_Bind_Msg::MergeFrom(const X_Bind_Msg& from) { GOOGLE_CHECK_NE(&from, this); if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { if (from.has_sdag()) { set_sdag(from.sdag()); } } mutable_unknown_fields()->MergeFrom(from.unknown_fields()); } void X_Bind_Msg::CopyFrom(const ::google::protobuf::Message& from) { if (&from == this) return; Clear(); MergeFrom(from); } void X_Bind_Msg::CopyFrom(const X_Bind_Msg& from) { if (&from == this) return; Clear(); MergeFrom(from); } bool X_Bind_Msg::IsInitialized() const { if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false; return true; } void X_Bind_Msg::Swap(X_Bind_Msg* other) { if (other != this) { std::swap(sdag_, other->sdag_); 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 X_Bind_Msg::GetMetadata() const { protobuf_AssignDescriptorsOnce(); ::google::protobuf::Metadata metadata; metadata.descriptor = X_Bind_Msg_descriptor_; metadata.reflection = X_Bind_Msg_reflection_; return metadata; } // =================================================================== #ifndef _MSC_VER const int X_Close_Msg::kPayloadFieldNumber; #endif // !_MSC_VER X_Close_Msg::X_Close_Msg() : ::google::protobuf::Message() { SharedCtor(); } void X_Close_Msg::InitAsDefaultInstance() { } X_Close_Msg::X_Close_Msg(const X_Close_Msg& from) : ::google::protobuf::Message() { SharedCtor(); MergeFrom(from); } void X_Close_Msg::SharedCtor() { _cached_size_ = 0; payload_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); ::memset(_has_bits_, 0, sizeof(_has_bits_)); } X_Close_Msg::~X_Close_Msg() { SharedDtor(); } void X_Close_Msg::SharedDtor() { if (payload_ != &::google::protobuf::internal::kEmptyString) { delete payload_; } if (this != default_instance_) { } } void X_Close_Msg::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* X_Close_Msg::descriptor() { protobuf_AssignDescriptorsOnce(); return X_Close_Msg_descriptor_; } const X_Close_Msg& X_Close_Msg::default_instance() { if (default_instance_ == NULL) protobuf_AddDesc_xia_2eproto(); return *default_instance_; } X_Close_Msg* X_Close_Msg::default_instance_ = NULL; X_Close_Msg* X_Close_Msg::New() const { return new X_Close_Msg; } void X_Close_Msg::Clear() { if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { if (has_payload()) { if (payload_ != &::google::protobuf::internal::kEmptyString) { payload_->clear(); } } } ::memset(_has_bits_, 0, sizeof(_has_bits_)); mutable_unknown_fields()->Clear(); } bool X_Close_Msg::MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) { #define DO_(EXPRESSION) if (!(EXPRESSION)) return false ::google::protobuf::uint32 tag; while ((tag = input->ReadTag()) != 0) { switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // optional bytes payload = 1; case 1: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( input, this->mutable_payload())); } else { goto handle_uninterpreted; } if (input->ExpectAtEnd()) return true; break; } default: { handle_uninterpreted: if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { return true; } DO_(::google::protobuf::internal::WireFormat::SkipField( input, tag, mutable_unknown_fields())); break; } } } return true; #undef DO_ } void X_Close_Msg::SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const { // optional bytes payload = 1; if (has_payload()) { ::google::protobuf::internal::WireFormatLite::WriteBytes( 1, this->payload(), output); } if (!unknown_fields().empty()) { ::google::protobuf::internal::WireFormat::SerializeUnknownFields( unknown_fields(), output); } } ::google::protobuf::uint8* X_Close_Msg::SerializeWithCachedSizesToArray( ::google::protobuf::uint8* target) const { // optional bytes payload = 1; if (has_payload()) { target = ::google::protobuf::internal::WireFormatLite::WriteBytesToArray( 1, this->payload(), target); } if (!unknown_fields().empty()) { target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( unknown_fields(), target); } return target; } int X_Close_Msg::ByteSize() const { int total_size = 0; if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { // optional bytes payload = 1; if (has_payload()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::BytesSize( this->payload()); } } 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 X_Close_Msg::MergeFrom(const ::google::protobuf::Message& from) { GOOGLE_CHECK_NE(&from, this); const X_Close_Msg* source = ::google::protobuf::internal::dynamic_cast_if_available<const X_Close_Msg*>( &from); if (source == NULL) { ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { MergeFrom(*source); } } void X_Close_Msg::MergeFrom(const X_Close_Msg& from) { GOOGLE_CHECK_NE(&from, this); if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { if (from.has_payload()) { set_payload(from.payload()); } } mutable_unknown_fields()->MergeFrom(from.unknown_fields()); } void X_Close_Msg::CopyFrom(const ::google::protobuf::Message& from) { if (&from == this) return; Clear(); MergeFrom(from); } void X_Close_Msg::CopyFrom(const X_Close_Msg& from) { if (&from == this) return; Clear(); MergeFrom(from); } bool X_Close_Msg::IsInitialized() const { return true; } void X_Close_Msg::Swap(X_Close_Msg* other) { if (other != this) { std::swap(payload_, other->payload_); 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 X_Close_Msg::GetMetadata() const { protobuf_AssignDescriptorsOnce(); ::google::protobuf::Metadata metadata; metadata.descriptor = X_Close_Msg_descriptor_; metadata.reflection = X_Close_Msg_reflection_; return metadata; } // =================================================================== #ifndef _MSC_VER const int X_Connect_Msg::kDdagFieldNumber; const int X_Connect_Msg::kStatusFieldNumber; #endif // !_MSC_VER X_Connect_Msg::X_Connect_Msg() : ::google::protobuf::Message() { SharedCtor(); } void X_Connect_Msg::InitAsDefaultInstance() { } X_Connect_Msg::X_Connect_Msg(const X_Connect_Msg& from) : ::google::protobuf::Message() { SharedCtor(); MergeFrom(from); } void X_Connect_Msg::SharedCtor() { _cached_size_ = 0; ddag_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); status_ = 0; ::memset(_has_bits_, 0, sizeof(_has_bits_)); } X_Connect_Msg::~X_Connect_Msg() { SharedDtor(); } void X_Connect_Msg::SharedDtor() { if (ddag_ != &::google::protobuf::internal::kEmptyString) { delete ddag_; } if (this != default_instance_) { } } void X_Connect_Msg::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* X_Connect_Msg::descriptor() { protobuf_AssignDescriptorsOnce(); return X_Connect_Msg_descriptor_; } const X_Connect_Msg& X_Connect_Msg::default_instance() { if (default_instance_ == NULL) protobuf_AddDesc_xia_2eproto(); return *default_instance_; } X_Connect_Msg* X_Connect_Msg::default_instance_ = NULL; X_Connect_Msg* X_Connect_Msg::New() const { return new X_Connect_Msg; } void X_Connect_Msg::Clear() { if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { if (has_ddag()) { if (ddag_ != &::google::protobuf::internal::kEmptyString) { ddag_->clear(); } } status_ = 0; } ::memset(_has_bits_, 0, sizeof(_has_bits_)); mutable_unknown_fields()->Clear(); } bool X_Connect_Msg::MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) { #define DO_(EXPRESSION) if (!(EXPRESSION)) return false ::google::protobuf::uint32 tag; while ((tag = input->ReadTag()) != 0) { switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // required string ddag = 1; case 1: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_ddag())); ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->ddag().data(), this->ddag().length(), ::google::protobuf::internal::WireFormat::PARSE); } else { goto handle_uninterpreted; } if (input->ExpectTag(16)) goto parse_status; break; } // optional int32 status = 2; case 2: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { parse_status: DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( input, &status_))); set_has_status(); } else { goto handle_uninterpreted; } if (input->ExpectAtEnd()) return true; break; } default: { handle_uninterpreted: if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { return true; } DO_(::google::protobuf::internal::WireFormat::SkipField( input, tag, mutable_unknown_fields())); break; } } } return true; #undef DO_ } void X_Connect_Msg::SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const { // required string ddag = 1; if (has_ddag()) { ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->ddag().data(), this->ddag().length(), ::google::protobuf::internal::WireFormat::SERIALIZE); ::google::protobuf::internal::WireFormatLite::WriteString( 1, this->ddag(), output); } // optional int32 status = 2; if (has_status()) { ::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->status(), output); } if (!unknown_fields().empty()) { ::google::protobuf::internal::WireFormat::SerializeUnknownFields( unknown_fields(), output); } } ::google::protobuf::uint8* X_Connect_Msg::SerializeWithCachedSizesToArray( ::google::protobuf::uint8* target) const { // required string ddag = 1; if (has_ddag()) { ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->ddag().data(), this->ddag().length(), ::google::protobuf::internal::WireFormat::SERIALIZE); target = ::google::protobuf::internal::WireFormatLite::WriteStringToArray( 1, this->ddag(), target); } // optional int32 status = 2; if (has_status()) { target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(2, this->status(), target); } if (!unknown_fields().empty()) { target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( unknown_fields(), target); } return target; } int X_Connect_Msg::ByteSize() const { int total_size = 0; if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { // required string ddag = 1; if (has_ddag()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( this->ddag()); } // optional int32 status = 2; if (has_status()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( this->status()); } } 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 X_Connect_Msg::MergeFrom(const ::google::protobuf::Message& from) { GOOGLE_CHECK_NE(&from, this); const X_Connect_Msg* source = ::google::protobuf::internal::dynamic_cast_if_available<const X_Connect_Msg*>( &from); if (source == NULL) { ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { MergeFrom(*source); } } void X_Connect_Msg::MergeFrom(const X_Connect_Msg& from) { GOOGLE_CHECK_NE(&from, this); if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { if (from.has_ddag()) { set_ddag(from.ddag()); } if (from.has_status()) { set_status(from.status()); } } mutable_unknown_fields()->MergeFrom(from.unknown_fields()); } void X_Connect_Msg::CopyFrom(const ::google::protobuf::Message& from) { if (&from == this) return; Clear(); MergeFrom(from); } void X_Connect_Msg::CopyFrom(const X_Connect_Msg& from) { if (&from == this) return; Clear(); MergeFrom(from); } bool X_Connect_Msg::IsInitialized() const { if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false; return true; } void X_Connect_Msg::Swap(X_Connect_Msg* other) { if (other != this) { std::swap(ddag_, other->ddag_); std::swap(status_, other->status_); 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 X_Connect_Msg::GetMetadata() const { protobuf_AssignDescriptorsOnce(); ::google::protobuf::Metadata metadata; metadata.descriptor = X_Connect_Msg_descriptor_; metadata.reflection = X_Connect_Msg_reflection_; return metadata; } // =================================================================== #ifndef _MSC_VER const int X_Accept_Msg::kTempFieldNumber; #endif // !_MSC_VER X_Accept_Msg::X_Accept_Msg() : ::google::protobuf::Message() { SharedCtor(); } void X_Accept_Msg::InitAsDefaultInstance() { } X_Accept_Msg::X_Accept_Msg(const X_Accept_Msg& from) : ::google::protobuf::Message() { SharedCtor(); MergeFrom(from); } void X_Accept_Msg::SharedCtor() { _cached_size_ = 0; temp_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); ::memset(_has_bits_, 0, sizeof(_has_bits_)); } X_Accept_Msg::~X_Accept_Msg() { SharedDtor(); } void X_Accept_Msg::SharedDtor() { if (temp_ != &::google::protobuf::internal::kEmptyString) { delete temp_; } if (this != default_instance_) { } } void X_Accept_Msg::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* X_Accept_Msg::descriptor() { protobuf_AssignDescriptorsOnce(); return X_Accept_Msg_descriptor_; } const X_Accept_Msg& X_Accept_Msg::default_instance() { if (default_instance_ == NULL) protobuf_AddDesc_xia_2eproto(); return *default_instance_; } X_Accept_Msg* X_Accept_Msg::default_instance_ = NULL; X_Accept_Msg* X_Accept_Msg::New() const { return new X_Accept_Msg; } void X_Accept_Msg::Clear() { if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { if (has_temp()) { if (temp_ != &::google::protobuf::internal::kEmptyString) { temp_->clear(); } } } ::memset(_has_bits_, 0, sizeof(_has_bits_)); mutable_unknown_fields()->Clear(); } bool X_Accept_Msg::MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) { #define DO_(EXPRESSION) if (!(EXPRESSION)) return false ::google::protobuf::uint32 tag; while ((tag = input->ReadTag()) != 0) { switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // optional string temp = 1; case 1: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_temp())); ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->temp().data(), this->temp().length(), ::google::protobuf::internal::WireFormat::PARSE); } else { goto handle_uninterpreted; } if (input->ExpectAtEnd()) return true; break; } default: { handle_uninterpreted: if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { return true; } DO_(::google::protobuf::internal::WireFormat::SkipField( input, tag, mutable_unknown_fields())); break; } } } return true; #undef DO_ } void X_Accept_Msg::SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const { // optional string temp = 1; if (has_temp()) { ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->temp().data(), this->temp().length(), ::google::protobuf::internal::WireFormat::SERIALIZE); ::google::protobuf::internal::WireFormatLite::WriteString( 1, this->temp(), output); } if (!unknown_fields().empty()) { ::google::protobuf::internal::WireFormat::SerializeUnknownFields( unknown_fields(), output); } } ::google::protobuf::uint8* X_Accept_Msg::SerializeWithCachedSizesToArray( ::google::protobuf::uint8* target) const { // optional string temp = 1; if (has_temp()) { ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->temp().data(), this->temp().length(), ::google::protobuf::internal::WireFormat::SERIALIZE); target = ::google::protobuf::internal::WireFormatLite::WriteStringToArray( 1, this->temp(), target); } if (!unknown_fields().empty()) { target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( unknown_fields(), target); } return target; } int X_Accept_Msg::ByteSize() const { int total_size = 0; if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { // optional string temp = 1; if (has_temp()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( this->temp()); } } 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 X_Accept_Msg::MergeFrom(const ::google::protobuf::Message& from) { GOOGLE_CHECK_NE(&from, this); const X_Accept_Msg* source = ::google::protobuf::internal::dynamic_cast_if_available<const X_Accept_Msg*>( &from); if (source == NULL) { ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { MergeFrom(*source); } } void X_Accept_Msg::MergeFrom(const X_Accept_Msg& from) { GOOGLE_CHECK_NE(&from, this); if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { if (from.has_temp()) { set_temp(from.temp()); } } mutable_unknown_fields()->MergeFrom(from.unknown_fields()); } void X_Accept_Msg::CopyFrom(const ::google::protobuf::Message& from) { if (&from == this) return; Clear(); MergeFrom(from); } void X_Accept_Msg::CopyFrom(const X_Accept_Msg& from) { if (&from == this) return; Clear(); MergeFrom(from); } bool X_Accept_Msg::IsInitialized() const { return true; } void X_Accept_Msg::Swap(X_Accept_Msg* other) { if (other != this) { std::swap(temp_, other->temp_); 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 X_Accept_Msg::GetMetadata() const { protobuf_AssignDescriptorsOnce(); ::google::protobuf::Metadata metadata; metadata.descriptor = X_Accept_Msg_descriptor_; metadata.reflection = X_Accept_Msg_reflection_; return metadata; } // =================================================================== #ifndef _MSC_VER const int X_Sendto_Msg::kDdagFieldNumber; const int X_Sendto_Msg::kPayloadFieldNumber; #endif // !_MSC_VER X_Sendto_Msg::X_Sendto_Msg() : ::google::protobuf::Message() { SharedCtor(); } void X_Sendto_Msg::InitAsDefaultInstance() { } X_Sendto_Msg::X_Sendto_Msg(const X_Sendto_Msg& from) : ::google::protobuf::Message() { SharedCtor(); MergeFrom(from); } void X_Sendto_Msg::SharedCtor() { _cached_size_ = 0; ddag_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); payload_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); ::memset(_has_bits_, 0, sizeof(_has_bits_)); } X_Sendto_Msg::~X_Sendto_Msg() { SharedDtor(); } void X_Sendto_Msg::SharedDtor() { if (ddag_ != &::google::protobuf::internal::kEmptyString) { delete ddag_; } if (payload_ != &::google::protobuf::internal::kEmptyString) { delete payload_; } if (this != default_instance_) { } } void X_Sendto_Msg::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* X_Sendto_Msg::descriptor() { protobuf_AssignDescriptorsOnce(); return X_Sendto_Msg_descriptor_; } const X_Sendto_Msg& X_Sendto_Msg::default_instance() { if (default_instance_ == NULL) protobuf_AddDesc_xia_2eproto(); return *default_instance_; } X_Sendto_Msg* X_Sendto_Msg::default_instance_ = NULL; X_Sendto_Msg* X_Sendto_Msg::New() const { return new X_Sendto_Msg; } void X_Sendto_Msg::Clear() { if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { if (has_ddag()) { if (ddag_ != &::google::protobuf::internal::kEmptyString) { ddag_->clear(); } } if (has_payload()) { if (payload_ != &::google::protobuf::internal::kEmptyString) { payload_->clear(); } } } ::memset(_has_bits_, 0, sizeof(_has_bits_)); mutable_unknown_fields()->Clear(); } bool X_Sendto_Msg::MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) { #define DO_(EXPRESSION) if (!(EXPRESSION)) return false ::google::protobuf::uint32 tag; while ((tag = input->ReadTag()) != 0) { switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // required string ddag = 1; case 1: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_ddag())); ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->ddag().data(), this->ddag().length(), ::google::protobuf::internal::WireFormat::PARSE); } else { goto handle_uninterpreted; } if (input->ExpectTag(18)) goto parse_payload; break; } // required bytes payload = 2; case 2: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { parse_payload: DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( input, this->mutable_payload())); } else { goto handle_uninterpreted; } if (input->ExpectAtEnd()) return true; break; } default: { handle_uninterpreted: if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { return true; } DO_(::google::protobuf::internal::WireFormat::SkipField( input, tag, mutable_unknown_fields())); break; } } } return true; #undef DO_ } void X_Sendto_Msg::SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const { // required string ddag = 1; if (has_ddag()) { ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->ddag().data(), this->ddag().length(), ::google::protobuf::internal::WireFormat::SERIALIZE); ::google::protobuf::internal::WireFormatLite::WriteString( 1, this->ddag(), output); } // required bytes payload = 2; if (has_payload()) { ::google::protobuf::internal::WireFormatLite::WriteBytes( 2, this->payload(), output); } if (!unknown_fields().empty()) { ::google::protobuf::internal::WireFormat::SerializeUnknownFields( unknown_fields(), output); } } ::google::protobuf::uint8* X_Sendto_Msg::SerializeWithCachedSizesToArray( ::google::protobuf::uint8* target) const { // required string ddag = 1; if (has_ddag()) { ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->ddag().data(), this->ddag().length(), ::google::protobuf::internal::WireFormat::SERIALIZE); target = ::google::protobuf::internal::WireFormatLite::WriteStringToArray( 1, this->ddag(), target); } // required bytes payload = 2; if (has_payload()) { target = ::google::protobuf::internal::WireFormatLite::WriteBytesToArray( 2, this->payload(), target); } if (!unknown_fields().empty()) { target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( unknown_fields(), target); } return target; } int X_Sendto_Msg::ByteSize() const { int total_size = 0; if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { // required string ddag = 1; if (has_ddag()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( this->ddag()); } // required bytes payload = 2; if (has_payload()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::BytesSize( this->payload()); } } 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 X_Sendto_Msg::MergeFrom(const ::google::protobuf::Message& from) { GOOGLE_CHECK_NE(&from, this); const X_Sendto_Msg* source = ::google::protobuf::internal::dynamic_cast_if_available<const X_Sendto_Msg*>( &from); if (source == NULL) { ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { MergeFrom(*source); } } void X_Sendto_Msg::MergeFrom(const X_Sendto_Msg& from) { GOOGLE_CHECK_NE(&from, this); if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { if (from.has_ddag()) { set_ddag(from.ddag()); } if (from.has_payload()) { set_payload(from.payload()); } } mutable_unknown_fields()->MergeFrom(from.unknown_fields()); } void X_Sendto_Msg::CopyFrom(const ::google::protobuf::Message& from) { if (&from == this) return; Clear(); MergeFrom(from); } void X_Sendto_Msg::CopyFrom(const X_Sendto_Msg& from) { if (&from == this) return; Clear(); MergeFrom(from); } bool X_Sendto_Msg::IsInitialized() const { if ((_has_bits_[0] & 0x00000003) != 0x00000003) return false; return true; } void X_Sendto_Msg::Swap(X_Sendto_Msg* other) { if (other != this) { std::swap(ddag_, other->ddag_); std::swap(payload_, other->payload_); 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 X_Sendto_Msg::GetMetadata() const { protobuf_AssignDescriptorsOnce(); ::google::protobuf::Metadata metadata; metadata.descriptor = X_Sendto_Msg_descriptor_; metadata.reflection = X_Sendto_Msg_reflection_; return metadata; } // =================================================================== #ifndef _MSC_VER const int X_Send_Msg::kPayloadFieldNumber; #endif // !_MSC_VER X_Send_Msg::X_Send_Msg() : ::google::protobuf::Message() { SharedCtor(); } void X_Send_Msg::InitAsDefaultInstance() { } X_Send_Msg::X_Send_Msg(const X_Send_Msg& from) : ::google::protobuf::Message() { SharedCtor(); MergeFrom(from); } void X_Send_Msg::SharedCtor() { _cached_size_ = 0; payload_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); ::memset(_has_bits_, 0, sizeof(_has_bits_)); } X_Send_Msg::~X_Send_Msg() { SharedDtor(); } void X_Send_Msg::SharedDtor() { if (payload_ != &::google::protobuf::internal::kEmptyString) { delete payload_; } if (this != default_instance_) { } } void X_Send_Msg::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* X_Send_Msg::descriptor() { protobuf_AssignDescriptorsOnce(); return X_Send_Msg_descriptor_; } const X_Send_Msg& X_Send_Msg::default_instance() { if (default_instance_ == NULL) protobuf_AddDesc_xia_2eproto(); return *default_instance_; } X_Send_Msg* X_Send_Msg::default_instance_ = NULL; X_Send_Msg* X_Send_Msg::New() const { return new X_Send_Msg; } void X_Send_Msg::Clear() { if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { if (has_payload()) { if (payload_ != &::google::protobuf::internal::kEmptyString) { payload_->clear(); } } } ::memset(_has_bits_, 0, sizeof(_has_bits_)); mutable_unknown_fields()->Clear(); } bool X_Send_Msg::MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) { #define DO_(EXPRESSION) if (!(EXPRESSION)) return false ::google::protobuf::uint32 tag; while ((tag = input->ReadTag()) != 0) { switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // required bytes payload = 1; case 1: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( input, this->mutable_payload())); } else { goto handle_uninterpreted; } if (input->ExpectAtEnd()) return true; break; } default: { handle_uninterpreted: if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { return true; } DO_(::google::protobuf::internal::WireFormat::SkipField( input, tag, mutable_unknown_fields())); break; } } } return true; #undef DO_ } void X_Send_Msg::SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const { // required bytes payload = 1; if (has_payload()) { ::google::protobuf::internal::WireFormatLite::WriteBytes( 1, this->payload(), output); } if (!unknown_fields().empty()) { ::google::protobuf::internal::WireFormat::SerializeUnknownFields( unknown_fields(), output); } } ::google::protobuf::uint8* X_Send_Msg::SerializeWithCachedSizesToArray( ::google::protobuf::uint8* target) const { // required bytes payload = 1; if (has_payload()) { target = ::google::protobuf::internal::WireFormatLite::WriteBytesToArray( 1, this->payload(), target); } if (!unknown_fields().empty()) { target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( unknown_fields(), target); } return target; } int X_Send_Msg::ByteSize() const { int total_size = 0; if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { // required bytes payload = 1; if (has_payload()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::BytesSize( this->payload()); } } 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 X_Send_Msg::MergeFrom(const ::google::protobuf::Message& from) { GOOGLE_CHECK_NE(&from, this); const X_Send_Msg* source = ::google::protobuf::internal::dynamic_cast_if_available<const X_Send_Msg*>( &from); if (source == NULL) { ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { MergeFrom(*source); } } void X_Send_Msg::MergeFrom(const X_Send_Msg& from) { GOOGLE_CHECK_NE(&from, this); if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { if (from.has_payload()) { set_payload(from.payload()); } } mutable_unknown_fields()->MergeFrom(from.unknown_fields()); } void X_Send_Msg::CopyFrom(const ::google::protobuf::Message& from) { if (&from == this) return; Clear(); MergeFrom(from); } void X_Send_Msg::CopyFrom(const X_Send_Msg& from) { if (&from == this) return; Clear(); MergeFrom(from); } bool X_Send_Msg::IsInitialized() const { if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false; return true; } void X_Send_Msg::Swap(X_Send_Msg* other) { if (other != this) { std::swap(payload_, other->payload_); 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 X_Send_Msg::GetMetadata() const { protobuf_AssignDescriptorsOnce(); ::google::protobuf::Metadata metadata; metadata.descriptor = X_Send_Msg_descriptor_; metadata.reflection = X_Send_Msg_reflection_; return metadata; } // =================================================================== #ifndef _MSC_VER const int X_Recv_Msg::kTempFieldNumber; #endif // !_MSC_VER X_Recv_Msg::X_Recv_Msg() : ::google::protobuf::Message() { SharedCtor(); } void X_Recv_Msg::InitAsDefaultInstance() { } X_Recv_Msg::X_Recv_Msg(const X_Recv_Msg& from) : ::google::protobuf::Message() { SharedCtor(); MergeFrom(from); } void X_Recv_Msg::SharedCtor() { _cached_size_ = 0; temp_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); ::memset(_has_bits_, 0, sizeof(_has_bits_)); } X_Recv_Msg::~X_Recv_Msg() { SharedDtor(); } void X_Recv_Msg::SharedDtor() { if (temp_ != &::google::protobuf::internal::kEmptyString) { delete temp_; } if (this != default_instance_) { } } void X_Recv_Msg::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* X_Recv_Msg::descriptor() { protobuf_AssignDescriptorsOnce(); return X_Recv_Msg_descriptor_; } const X_Recv_Msg& X_Recv_Msg::default_instance() { if (default_instance_ == NULL) protobuf_AddDesc_xia_2eproto(); return *default_instance_; } X_Recv_Msg* X_Recv_Msg::default_instance_ = NULL; X_Recv_Msg* X_Recv_Msg::New() const { return new X_Recv_Msg; } void X_Recv_Msg::Clear() { if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { if (has_temp()) { if (temp_ != &::google::protobuf::internal::kEmptyString) { temp_->clear(); } } } ::memset(_has_bits_, 0, sizeof(_has_bits_)); mutable_unknown_fields()->Clear(); } bool X_Recv_Msg::MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) { #define DO_(EXPRESSION) if (!(EXPRESSION)) return false ::google::protobuf::uint32 tag; while ((tag = input->ReadTag()) != 0) { switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // optional string temp = 1; case 1: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_temp())); ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->temp().data(), this->temp().length(), ::google::protobuf::internal::WireFormat::PARSE); } else { goto handle_uninterpreted; } if (input->ExpectAtEnd()) return true; break; } default: { handle_uninterpreted: if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { return true; } DO_(::google::protobuf::internal::WireFormat::SkipField( input, tag, mutable_unknown_fields())); break; } } } return true; #undef DO_ } void X_Recv_Msg::SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const { // optional string temp = 1; if (has_temp()) { ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->temp().data(), this->temp().length(), ::google::protobuf::internal::WireFormat::SERIALIZE); ::google::protobuf::internal::WireFormatLite::WriteString( 1, this->temp(), output); } if (!unknown_fields().empty()) { ::google::protobuf::internal::WireFormat::SerializeUnknownFields( unknown_fields(), output); } } ::google::protobuf::uint8* X_Recv_Msg::SerializeWithCachedSizesToArray( ::google::protobuf::uint8* target) const { // optional string temp = 1; if (has_temp()) { ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->temp().data(), this->temp().length(), ::google::protobuf::internal::WireFormat::SERIALIZE); target = ::google::protobuf::internal::WireFormatLite::WriteStringToArray( 1, this->temp(), target); } if (!unknown_fields().empty()) { target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( unknown_fields(), target); } return target; } int X_Recv_Msg::ByteSize() const { int total_size = 0; if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { // optional string temp = 1; if (has_temp()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( this->temp()); } } 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 X_Recv_Msg::MergeFrom(const ::google::protobuf::Message& from) { GOOGLE_CHECK_NE(&from, this); const X_Recv_Msg* source = ::google::protobuf::internal::dynamic_cast_if_available<const X_Recv_Msg*>( &from); if (source == NULL) { ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { MergeFrom(*source); } } void X_Recv_Msg::MergeFrom(const X_Recv_Msg& from) { GOOGLE_CHECK_NE(&from, this); if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { if (from.has_temp()) { set_temp(from.temp()); } } mutable_unknown_fields()->MergeFrom(from.unknown_fields()); } void X_Recv_Msg::CopyFrom(const ::google::protobuf::Message& from) { if (&from == this) return; Clear(); MergeFrom(from); } void X_Recv_Msg::CopyFrom(const X_Recv_Msg& from) { if (&from == this) return; Clear(); MergeFrom(from); } bool X_Recv_Msg::IsInitialized() const { return true; } void X_Recv_Msg::Swap(X_Recv_Msg* other) { if (other != this) { std::swap(temp_, other->temp_); 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 X_Recv_Msg::GetMetadata() const { protobuf_AssignDescriptorsOnce(); ::google::protobuf::Metadata metadata; metadata.descriptor = X_Recv_Msg_descriptor_; metadata.reflection = X_Recv_Msg_reflection_; return metadata; } // =================================================================== #ifndef _MSC_VER const int X_Recvfrom_Msg::kTempFieldNumber; #endif // !_MSC_VER X_Recvfrom_Msg::X_Recvfrom_Msg() : ::google::protobuf::Message() { SharedCtor(); } void X_Recvfrom_Msg::InitAsDefaultInstance() { } X_Recvfrom_Msg::X_Recvfrom_Msg(const X_Recvfrom_Msg& from) : ::google::protobuf::Message() { SharedCtor(); MergeFrom(from); } void X_Recvfrom_Msg::SharedCtor() { _cached_size_ = 0; temp_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); ::memset(_has_bits_, 0, sizeof(_has_bits_)); } X_Recvfrom_Msg::~X_Recvfrom_Msg() { SharedDtor(); } void X_Recvfrom_Msg::SharedDtor() { if (temp_ != &::google::protobuf::internal::kEmptyString) { delete temp_; } if (this != default_instance_) { } } void X_Recvfrom_Msg::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* X_Recvfrom_Msg::descriptor() { protobuf_AssignDescriptorsOnce(); return X_Recvfrom_Msg_descriptor_; } const X_Recvfrom_Msg& X_Recvfrom_Msg::default_instance() { if (default_instance_ == NULL) protobuf_AddDesc_xia_2eproto(); return *default_instance_; } X_Recvfrom_Msg* X_Recvfrom_Msg::default_instance_ = NULL; X_Recvfrom_Msg* X_Recvfrom_Msg::New() const { return new X_Recvfrom_Msg; } void X_Recvfrom_Msg::Clear() { if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { if (has_temp()) { if (temp_ != &::google::protobuf::internal::kEmptyString) { temp_->clear(); } } } ::memset(_has_bits_, 0, sizeof(_has_bits_)); mutable_unknown_fields()->Clear(); } bool X_Recvfrom_Msg::MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) { #define DO_(EXPRESSION) if (!(EXPRESSION)) return false ::google::protobuf::uint32 tag; while ((tag = input->ReadTag()) != 0) { switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // optional string temp = 1; case 1: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_temp())); ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->temp().data(), this->temp().length(), ::google::protobuf::internal::WireFormat::PARSE); } else { goto handle_uninterpreted; } if (input->ExpectAtEnd()) return true; break; } default: { handle_uninterpreted: if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { return true; } DO_(::google::protobuf::internal::WireFormat::SkipField( input, tag, mutable_unknown_fields())); break; } } } return true; #undef DO_ } void X_Recvfrom_Msg::SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const { // optional string temp = 1; if (has_temp()) { ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->temp().data(), this->temp().length(), ::google::protobuf::internal::WireFormat::SERIALIZE); ::google::protobuf::internal::WireFormatLite::WriteString( 1, this->temp(), output); } if (!unknown_fields().empty()) { ::google::protobuf::internal::WireFormat::SerializeUnknownFields( unknown_fields(), output); } } ::google::protobuf::uint8* X_Recvfrom_Msg::SerializeWithCachedSizesToArray( ::google::protobuf::uint8* target) const { // optional string temp = 1; if (has_temp()) { ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->temp().data(), this->temp().length(), ::google::protobuf::internal::WireFormat::SERIALIZE); target = ::google::protobuf::internal::WireFormatLite::WriteStringToArray( 1, this->temp(), target); } if (!unknown_fields().empty()) { target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( unknown_fields(), target); } return target; } int X_Recvfrom_Msg::ByteSize() const { int total_size = 0; if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { // optional string temp = 1; if (has_temp()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( this->temp()); } } 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 X_Recvfrom_Msg::MergeFrom(const ::google::protobuf::Message& from) { GOOGLE_CHECK_NE(&from, this); const X_Recvfrom_Msg* source = ::google::protobuf::internal::dynamic_cast_if_available<const X_Recvfrom_Msg*>( &from); if (source == NULL) { ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { MergeFrom(*source); } } void X_Recvfrom_Msg::MergeFrom(const X_Recvfrom_Msg& from) { GOOGLE_CHECK_NE(&from, this); if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { if (from.has_temp()) { set_temp(from.temp()); } } mutable_unknown_fields()->MergeFrom(from.unknown_fields()); } void X_Recvfrom_Msg::CopyFrom(const ::google::protobuf::Message& from) { if (&from == this) return; Clear(); MergeFrom(from); } void X_Recvfrom_Msg::CopyFrom(const X_Recvfrom_Msg& from) { if (&from == this) return; Clear(); MergeFrom(from); } bool X_Recvfrom_Msg::IsInitialized() const { return true; } void X_Recvfrom_Msg::Swap(X_Recvfrom_Msg* other) { if (other != this) { std::swap(temp_, other->temp_); 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 X_Recvfrom_Msg::GetMetadata() const { protobuf_AssignDescriptorsOnce(); ::google::protobuf::Metadata metadata; metadata.descriptor = X_Recvfrom_Msg_descriptor_; metadata.reflection = X_Recvfrom_Msg_reflection_; return metadata; } // =================================================================== #ifndef _MSC_VER const int X_Setsockopt_Msg::kOptTypeFieldNumber; const int X_Setsockopt_Msg::kIntOptFieldNumber; #endif // !_MSC_VER X_Setsockopt_Msg::X_Setsockopt_Msg() : ::google::protobuf::Message() { SharedCtor(); } void X_Setsockopt_Msg::InitAsDefaultInstance() { } X_Setsockopt_Msg::X_Setsockopt_Msg(const X_Setsockopt_Msg& from) : ::google::protobuf::Message() { SharedCtor(); MergeFrom(from); } void X_Setsockopt_Msg::SharedCtor() { _cached_size_ = 0; opt_type_ = 0; int_opt_ = 0; ::memset(_has_bits_, 0, sizeof(_has_bits_)); } X_Setsockopt_Msg::~X_Setsockopt_Msg() { SharedDtor(); } void X_Setsockopt_Msg::SharedDtor() { if (this != default_instance_) { } } void X_Setsockopt_Msg::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* X_Setsockopt_Msg::descriptor() { protobuf_AssignDescriptorsOnce(); return X_Setsockopt_Msg_descriptor_; } const X_Setsockopt_Msg& X_Setsockopt_Msg::default_instance() { if (default_instance_ == NULL) protobuf_AddDesc_xia_2eproto(); return *default_instance_; } X_Setsockopt_Msg* X_Setsockopt_Msg::default_instance_ = NULL; X_Setsockopt_Msg* X_Setsockopt_Msg::New() const { return new X_Setsockopt_Msg; } void X_Setsockopt_Msg::Clear() { if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { opt_type_ = 0; int_opt_ = 0; } ::memset(_has_bits_, 0, sizeof(_has_bits_)); mutable_unknown_fields()->Clear(); } bool X_Setsockopt_Msg::MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) { #define DO_(EXPRESSION) if (!(EXPRESSION)) return false ::google::protobuf::uint32 tag; while ((tag = input->ReadTag()) != 0) { switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // required int32 opt_type = 1; case 1: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( input, &opt_type_))); set_has_opt_type(); } else { goto handle_uninterpreted; } if (input->ExpectTag(16)) goto parse_int_opt; break; } // optional int32 int_opt = 2; case 2: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { parse_int_opt: DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( input, &int_opt_))); set_has_int_opt(); } else { goto handle_uninterpreted; } if (input->ExpectAtEnd()) return true; break; } default: { handle_uninterpreted: if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { return true; } DO_(::google::protobuf::internal::WireFormat::SkipField( input, tag, mutable_unknown_fields())); break; } } } return true; #undef DO_ } void X_Setsockopt_Msg::SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const { // required int32 opt_type = 1; if (has_opt_type()) { ::google::protobuf::internal::WireFormatLite::WriteInt32(1, this->opt_type(), output); } // optional int32 int_opt = 2; if (has_int_opt()) { ::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->int_opt(), output); } if (!unknown_fields().empty()) { ::google::protobuf::internal::WireFormat::SerializeUnknownFields( unknown_fields(), output); } } ::google::protobuf::uint8* X_Setsockopt_Msg::SerializeWithCachedSizesToArray( ::google::protobuf::uint8* target) const { // required int32 opt_type = 1; if (has_opt_type()) { target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(1, this->opt_type(), target); } // optional int32 int_opt = 2; if (has_int_opt()) { target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(2, this->int_opt(), target); } if (!unknown_fields().empty()) { target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( unknown_fields(), target); } return target; } int X_Setsockopt_Msg::ByteSize() const { int total_size = 0; if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { // required int32 opt_type = 1; if (has_opt_type()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( this->opt_type()); } // optional int32 int_opt = 2; if (has_int_opt()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( this->int_opt()); } } 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 X_Setsockopt_Msg::MergeFrom(const ::google::protobuf::Message& from) { GOOGLE_CHECK_NE(&from, this); const X_Setsockopt_Msg* source = ::google::protobuf::internal::dynamic_cast_if_available<const X_Setsockopt_Msg*>( &from); if (source == NULL) { ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { MergeFrom(*source); } } void X_Setsockopt_Msg::MergeFrom(const X_Setsockopt_Msg& from) { GOOGLE_CHECK_NE(&from, this); if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { if (from.has_opt_type()) { set_opt_type(from.opt_type()); } if (from.has_int_opt()) { set_int_opt(from.int_opt()); } } mutable_unknown_fields()->MergeFrom(from.unknown_fields()); } void X_Setsockopt_Msg::CopyFrom(const ::google::protobuf::Message& from) { if (&from == this) return; Clear(); MergeFrom(from); } void X_Setsockopt_Msg::CopyFrom(const X_Setsockopt_Msg& from) { if (&from == this) return; Clear(); MergeFrom(from); } bool X_Setsockopt_Msg::IsInitialized() const { if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false; return true; } void X_Setsockopt_Msg::Swap(X_Setsockopt_Msg* other) { if (other != this) { std::swap(opt_type_, other->opt_type_); std::swap(int_opt_, other->int_opt_); 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 X_Setsockopt_Msg::GetMetadata() const { protobuf_AssignDescriptorsOnce(); ::google::protobuf::Metadata metadata; metadata.descriptor = X_Setsockopt_Msg_descriptor_; metadata.reflection = X_Setsockopt_Msg_reflection_; return metadata; } // =================================================================== #ifndef _MSC_VER const int X_Getsockopt_Msg::kOptTypeFieldNumber; const int X_Getsockopt_Msg::kIntOptFieldNumber; #endif // !_MSC_VER X_Getsockopt_Msg::X_Getsockopt_Msg() : ::google::protobuf::Message() { SharedCtor(); } void X_Getsockopt_Msg::InitAsDefaultInstance() { } X_Getsockopt_Msg::X_Getsockopt_Msg(const X_Getsockopt_Msg& from) : ::google::protobuf::Message() { SharedCtor(); MergeFrom(from); } void X_Getsockopt_Msg::SharedCtor() { _cached_size_ = 0; opt_type_ = 0; int_opt_ = 0; ::memset(_has_bits_, 0, sizeof(_has_bits_)); } X_Getsockopt_Msg::~X_Getsockopt_Msg() { SharedDtor(); } void X_Getsockopt_Msg::SharedDtor() { if (this != default_instance_) { } } void X_Getsockopt_Msg::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* X_Getsockopt_Msg::descriptor() { protobuf_AssignDescriptorsOnce(); return X_Getsockopt_Msg_descriptor_; } const X_Getsockopt_Msg& X_Getsockopt_Msg::default_instance() { if (default_instance_ == NULL) protobuf_AddDesc_xia_2eproto(); return *default_instance_; } X_Getsockopt_Msg* X_Getsockopt_Msg::default_instance_ = NULL; X_Getsockopt_Msg* X_Getsockopt_Msg::New() const { return new X_Getsockopt_Msg; } void X_Getsockopt_Msg::Clear() { if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { opt_type_ = 0; int_opt_ = 0; } ::memset(_has_bits_, 0, sizeof(_has_bits_)); mutable_unknown_fields()->Clear(); } bool X_Getsockopt_Msg::MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) { #define DO_(EXPRESSION) if (!(EXPRESSION)) return false ::google::protobuf::uint32 tag; while ((tag = input->ReadTag()) != 0) { switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // required int32 opt_type = 1; case 1: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( input, &opt_type_))); set_has_opt_type(); } else { goto handle_uninterpreted; } if (input->ExpectTag(16)) goto parse_int_opt; break; } // optional int32 int_opt = 2; case 2: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { parse_int_opt: DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( input, &int_opt_))); set_has_int_opt(); } else { goto handle_uninterpreted; } if (input->ExpectAtEnd()) return true; break; } default: { handle_uninterpreted: if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { return true; } DO_(::google::protobuf::internal::WireFormat::SkipField( input, tag, mutable_unknown_fields())); break; } } } return true; #undef DO_ } void X_Getsockopt_Msg::SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const { // required int32 opt_type = 1; if (has_opt_type()) { ::google::protobuf::internal::WireFormatLite::WriteInt32(1, this->opt_type(), output); } // optional int32 int_opt = 2; if (has_int_opt()) { ::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->int_opt(), output); } if (!unknown_fields().empty()) { ::google::protobuf::internal::WireFormat::SerializeUnknownFields( unknown_fields(), output); } } ::google::protobuf::uint8* X_Getsockopt_Msg::SerializeWithCachedSizesToArray( ::google::protobuf::uint8* target) const { // required int32 opt_type = 1; if (has_opt_type()) { target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(1, this->opt_type(), target); } // optional int32 int_opt = 2; if (has_int_opt()) { target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(2, this->int_opt(), target); } if (!unknown_fields().empty()) { target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( unknown_fields(), target); } return target; } int X_Getsockopt_Msg::ByteSize() const { int total_size = 0; if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { // required int32 opt_type = 1; if (has_opt_type()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( this->opt_type()); } // optional int32 int_opt = 2; if (has_int_opt()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( this->int_opt()); } } 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 X_Getsockopt_Msg::MergeFrom(const ::google::protobuf::Message& from) { GOOGLE_CHECK_NE(&from, this); const X_Getsockopt_Msg* source = ::google::protobuf::internal::dynamic_cast_if_available<const X_Getsockopt_Msg*>( &from); if (source == NULL) { ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { MergeFrom(*source); } } void X_Getsockopt_Msg::MergeFrom(const X_Getsockopt_Msg& from) { GOOGLE_CHECK_NE(&from, this); if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { if (from.has_opt_type()) { set_opt_type(from.opt_type()); } if (from.has_int_opt()) { set_int_opt(from.int_opt()); } } mutable_unknown_fields()->MergeFrom(from.unknown_fields()); } void X_Getsockopt_Msg::CopyFrom(const ::google::protobuf::Message& from) { if (&from == this) return; Clear(); MergeFrom(from); } void X_Getsockopt_Msg::CopyFrom(const X_Getsockopt_Msg& from) { if (&from == this) return; Clear(); MergeFrom(from); } bool X_Getsockopt_Msg::IsInitialized() const { if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false; return true; } void X_Getsockopt_Msg::Swap(X_Getsockopt_Msg* other) { if (other != this) { std::swap(opt_type_, other->opt_type_); std::swap(int_opt_, other->int_opt_); 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 X_Getsockopt_Msg::GetMetadata() const { protobuf_AssignDescriptorsOnce(); ::google::protobuf::Metadata metadata; metadata.descriptor = X_Getsockopt_Msg_descriptor_; metadata.reflection = X_Getsockopt_Msg_reflection_; return metadata; } // =================================================================== #ifndef _MSC_VER const int X_Putchunk_Msg::kCachepolicyFieldNumber; const int X_Putchunk_Msg::kCachesizeFieldNumber; const int X_Putchunk_Msg::kContextidFieldNumber; const int X_Putchunk_Msg::kTTLFieldNumber; const int X_Putchunk_Msg::kPayloadFieldNumber; const int X_Putchunk_Msg::kCidFieldNumber; const int X_Putchunk_Msg::kLengthFieldNumber; const int X_Putchunk_Msg::kTimestampFieldNumber; #endif // !_MSC_VER X_Putchunk_Msg::X_Putchunk_Msg() : ::google::protobuf::Message() { SharedCtor(); } void X_Putchunk_Msg::InitAsDefaultInstance() { } X_Putchunk_Msg::X_Putchunk_Msg(const X_Putchunk_Msg& from) : ::google::protobuf::Message() { SharedCtor(); MergeFrom(from); } void X_Putchunk_Msg::SharedCtor() { _cached_size_ = 0; cachepolicy_ = 0; cachesize_ = 0; contextid_ = 0; ttl_ = 0; payload_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); cid_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); length_ = 0; timestamp_ = GOOGLE_LONGLONG(0); ::memset(_has_bits_, 0, sizeof(_has_bits_)); } X_Putchunk_Msg::~X_Putchunk_Msg() { SharedDtor(); } void X_Putchunk_Msg::SharedDtor() { if (payload_ != &::google::protobuf::internal::kEmptyString) { delete payload_; } if (cid_ != &::google::protobuf::internal::kEmptyString) { delete cid_; } if (this != default_instance_) { } } void X_Putchunk_Msg::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* X_Putchunk_Msg::descriptor() { protobuf_AssignDescriptorsOnce(); return X_Putchunk_Msg_descriptor_; } const X_Putchunk_Msg& X_Putchunk_Msg::default_instance() { if (default_instance_ == NULL) protobuf_AddDesc_xia_2eproto(); return *default_instance_; } X_Putchunk_Msg* X_Putchunk_Msg::default_instance_ = NULL; X_Putchunk_Msg* X_Putchunk_Msg::New() const { return new X_Putchunk_Msg; } void X_Putchunk_Msg::Clear() { if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { cachepolicy_ = 0; cachesize_ = 0; contextid_ = 0; ttl_ = 0; if (has_payload()) { if (payload_ != &::google::protobuf::internal::kEmptyString) { payload_->clear(); } } if (has_cid()) { if (cid_ != &::google::protobuf::internal::kEmptyString) { cid_->clear(); } } length_ = 0; timestamp_ = GOOGLE_LONGLONG(0); } ::memset(_has_bits_, 0, sizeof(_has_bits_)); mutable_unknown_fields()->Clear(); } bool X_Putchunk_Msg::MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) { #define DO_(EXPRESSION) if (!(EXPRESSION)) return false ::google::protobuf::uint32 tag; while ((tag = input->ReadTag()) != 0) { switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // required int32 cachepolicy = 1; case 1: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( input, &cachepolicy_))); set_has_cachepolicy(); } else { goto handle_uninterpreted; } if (input->ExpectTag(16)) goto parse_cachesize; break; } // required int32 cachesize = 2; case 2: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { parse_cachesize: DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( input, &cachesize_))); set_has_cachesize(); } else { goto handle_uninterpreted; } if (input->ExpectTag(24)) goto parse_contextid; break; } // required int32 contextid = 3; case 3: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { parse_contextid: DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( input, &contextid_))); set_has_contextid(); } else { goto handle_uninterpreted; } if (input->ExpectTag(32)) goto parse_TTL; break; } // required int32 TTL = 4; case 4: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { parse_TTL: DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( input, &ttl_))); set_has_ttl(); } else { goto handle_uninterpreted; } if (input->ExpectTag(42)) goto parse_payload; break; } // required bytes payload = 5; case 5: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { parse_payload: DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( input, this->mutable_payload())); } else { goto handle_uninterpreted; } if (input->ExpectTag(50)) goto parse_cid; break; } // optional string cid = 6; case 6: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { parse_cid: DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_cid())); ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->cid().data(), this->cid().length(), ::google::protobuf::internal::WireFormat::PARSE); } else { goto handle_uninterpreted; } if (input->ExpectTag(56)) goto parse_length; break; } // optional int32 length = 7; case 7: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { parse_length: DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( input, &length_))); set_has_length(); } else { goto handle_uninterpreted; } if (input->ExpectTag(64)) goto parse_timestamp; break; } // optional int64 timestamp = 8; case 8: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { parse_timestamp: DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>( input, &timestamp_))); set_has_timestamp(); } else { goto handle_uninterpreted; } if (input->ExpectAtEnd()) return true; break; } default: { handle_uninterpreted: if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { return true; } DO_(::google::protobuf::internal::WireFormat::SkipField( input, tag, mutable_unknown_fields())); break; } } } return true; #undef DO_ } void X_Putchunk_Msg::SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const { // required int32 cachepolicy = 1; if (has_cachepolicy()) { ::google::protobuf::internal::WireFormatLite::WriteInt32(1, this->cachepolicy(), output); } // required int32 cachesize = 2; if (has_cachesize()) { ::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->cachesize(), output); } // required int32 contextid = 3; if (has_contextid()) { ::google::protobuf::internal::WireFormatLite::WriteInt32(3, this->contextid(), output); } // required int32 TTL = 4; if (has_ttl()) { ::google::protobuf::internal::WireFormatLite::WriteInt32(4, this->ttl(), output); } // required bytes payload = 5; if (has_payload()) { ::google::protobuf::internal::WireFormatLite::WriteBytes( 5, this->payload(), output); } // optional string cid = 6; if (has_cid()) { ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->cid().data(), this->cid().length(), ::google::protobuf::internal::WireFormat::SERIALIZE); ::google::protobuf::internal::WireFormatLite::WriteString( 6, this->cid(), output); } // optional int32 length = 7; if (has_length()) { ::google::protobuf::internal::WireFormatLite::WriteInt32(7, this->length(), output); } // optional int64 timestamp = 8; if (has_timestamp()) { ::google::protobuf::internal::WireFormatLite::WriteInt64(8, this->timestamp(), output); } if (!unknown_fields().empty()) { ::google::protobuf::internal::WireFormat::SerializeUnknownFields( unknown_fields(), output); } } ::google::protobuf::uint8* X_Putchunk_Msg::SerializeWithCachedSizesToArray( ::google::protobuf::uint8* target) const { // required int32 cachepolicy = 1; if (has_cachepolicy()) { target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(1, this->cachepolicy(), target); } // required int32 cachesize = 2; if (has_cachesize()) { target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(2, this->cachesize(), target); } // required int32 contextid = 3; if (has_contextid()) { target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(3, this->contextid(), target); } // required int32 TTL = 4; if (has_ttl()) { target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(4, this->ttl(), target); } // required bytes payload = 5; if (has_payload()) { target = ::google::protobuf::internal::WireFormatLite::WriteBytesToArray( 5, this->payload(), target); } // optional string cid = 6; if (has_cid()) { ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->cid().data(), this->cid().length(), ::google::protobuf::internal::WireFormat::SERIALIZE); target = ::google::protobuf::internal::WireFormatLite::WriteStringToArray( 6, this->cid(), target); } // optional int32 length = 7; if (has_length()) { target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(7, this->length(), target); } // optional int64 timestamp = 8; if (has_timestamp()) { target = ::google::protobuf::internal::WireFormatLite::WriteInt64ToArray(8, this->timestamp(), target); } if (!unknown_fields().empty()) { target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( unknown_fields(), target); } return target; } int X_Putchunk_Msg::ByteSize() const { int total_size = 0; if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { // required int32 cachepolicy = 1; if (has_cachepolicy()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( this->cachepolicy()); } // required int32 cachesize = 2; if (has_cachesize()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( this->cachesize()); } // required int32 contextid = 3; if (has_contextid()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( this->contextid()); } // required int32 TTL = 4; if (has_ttl()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( this->ttl()); } // required bytes payload = 5; if (has_payload()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::BytesSize( this->payload()); } // optional string cid = 6; if (has_cid()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( this->cid()); } // optional int32 length = 7; if (has_length()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( this->length()); } // optional int64 timestamp = 8; if (has_timestamp()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int64Size( 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 X_Putchunk_Msg::MergeFrom(const ::google::protobuf::Message& from) { GOOGLE_CHECK_NE(&from, this); const X_Putchunk_Msg* source = ::google::protobuf::internal::dynamic_cast_if_available<const X_Putchunk_Msg*>( &from); if (source == NULL) { ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { MergeFrom(*source); } } void X_Putchunk_Msg::MergeFrom(const X_Putchunk_Msg& from) { GOOGLE_CHECK_NE(&from, this); if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { if (from.has_cachepolicy()) { set_cachepolicy(from.cachepolicy()); } if (from.has_cachesize()) { set_cachesize(from.cachesize()); } if (from.has_contextid()) { set_contextid(from.contextid()); } if (from.has_ttl()) { set_ttl(from.ttl()); } if (from.has_payload()) { set_payload(from.payload()); } if (from.has_cid()) { set_cid(from.cid()); } if (from.has_length()) { set_length(from.length()); } if (from.has_timestamp()) { set_timestamp(from.timestamp()); } } mutable_unknown_fields()->MergeFrom(from.unknown_fields()); } void X_Putchunk_Msg::CopyFrom(const ::google::protobuf::Message& from) { if (&from == this) return; Clear(); MergeFrom(from); } void X_Putchunk_Msg::CopyFrom(const X_Putchunk_Msg& from) { if (&from == this) return; Clear(); MergeFrom(from); } bool X_Putchunk_Msg::IsInitialized() const { if ((_has_bits_[0] & 0x0000001f) != 0x0000001f) return false; return true; } void X_Putchunk_Msg::Swap(X_Putchunk_Msg* other) { if (other != this) { std::swap(cachepolicy_, other->cachepolicy_); std::swap(cachesize_, other->cachesize_); std::swap(contextid_, other->contextid_); std::swap(ttl_, other->ttl_); std::swap(payload_, other->payload_); std::swap(cid_, other->cid_); std::swap(length_, other->length_); 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 X_Putchunk_Msg::GetMetadata() const { protobuf_AssignDescriptorsOnce(); ::google::protobuf::Metadata metadata; metadata.descriptor = X_Putchunk_Msg_descriptor_; metadata.reflection = X_Putchunk_Msg_reflection_; return metadata; } // =================================================================== #ifndef _MSC_VER const int X_Requestchunk_Msg::kDagFieldNumber; const int X_Requestchunk_Msg::kPayloadFieldNumber; #endif // !_MSC_VER X_Requestchunk_Msg::X_Requestchunk_Msg() : ::google::protobuf::Message() { SharedCtor(); } void X_Requestchunk_Msg::InitAsDefaultInstance() { } X_Requestchunk_Msg::X_Requestchunk_Msg(const X_Requestchunk_Msg& from) : ::google::protobuf::Message() { SharedCtor(); MergeFrom(from); } void X_Requestchunk_Msg::SharedCtor() { _cached_size_ = 0; payload_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); ::memset(_has_bits_, 0, sizeof(_has_bits_)); } X_Requestchunk_Msg::~X_Requestchunk_Msg() { SharedDtor(); } void X_Requestchunk_Msg::SharedDtor() { if (payload_ != &::google::protobuf::internal::kEmptyString) { delete payload_; } if (this != default_instance_) { } } void X_Requestchunk_Msg::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* X_Requestchunk_Msg::descriptor() { protobuf_AssignDescriptorsOnce(); return X_Requestchunk_Msg_descriptor_; } const X_Requestchunk_Msg& X_Requestchunk_Msg::default_instance() { if (default_instance_ == NULL) protobuf_AddDesc_xia_2eproto(); return *default_instance_; } X_Requestchunk_Msg* X_Requestchunk_Msg::default_instance_ = NULL; X_Requestchunk_Msg* X_Requestchunk_Msg::New() const { return new X_Requestchunk_Msg; } void X_Requestchunk_Msg::Clear() { if (_has_bits_[1 / 32] & (0xffu << (1 % 32))) { if (has_payload()) { if (payload_ != &::google::protobuf::internal::kEmptyString) { payload_->clear(); } } } dag_.Clear(); ::memset(_has_bits_, 0, sizeof(_has_bits_)); mutable_unknown_fields()->Clear(); } bool X_Requestchunk_Msg::MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) { #define DO_(EXPRESSION) if (!(EXPRESSION)) return false ::google::protobuf::uint32 tag; while ((tag = input->ReadTag()) != 0) { switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // repeated string dag = 1; case 1: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { parse_dag: DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->add_dag())); ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->dag(0).data(), this->dag(0).length(), ::google::protobuf::internal::WireFormat::PARSE); } else { goto handle_uninterpreted; } if (input->ExpectTag(10)) goto parse_dag; if (input->ExpectTag(18)) goto parse_payload; break; } // optional bytes payload = 2; case 2: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { parse_payload: DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( input, this->mutable_payload())); } else { goto handle_uninterpreted; } if (input->ExpectAtEnd()) return true; break; } default: { handle_uninterpreted: if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { return true; } DO_(::google::protobuf::internal::WireFormat::SkipField( input, tag, mutable_unknown_fields())); break; } } } return true; #undef DO_ } void X_Requestchunk_Msg::SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const { // repeated string dag = 1; for (int i = 0; i < this->dag_size(); i++) { ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->dag(i).data(), this->dag(i).length(), ::google::protobuf::internal::WireFormat::SERIALIZE); ::google::protobuf::internal::WireFormatLite::WriteString( 1, this->dag(i), output); } // optional bytes payload = 2; if (has_payload()) { ::google::protobuf::internal::WireFormatLite::WriteBytes( 2, this->payload(), output); } if (!unknown_fields().empty()) { ::google::protobuf::internal::WireFormat::SerializeUnknownFields( unknown_fields(), output); } } ::google::protobuf::uint8* X_Requestchunk_Msg::SerializeWithCachedSizesToArray( ::google::protobuf::uint8* target) const { // repeated string dag = 1; for (int i = 0; i < this->dag_size(); i++) { ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->dag(i).data(), this->dag(i).length(), ::google::protobuf::internal::WireFormat::SERIALIZE); target = ::google::protobuf::internal::WireFormatLite:: WriteStringToArray(1, this->dag(i), target); } // optional bytes payload = 2; if (has_payload()) { target = ::google::protobuf::internal::WireFormatLite::WriteBytesToArray( 2, this->payload(), target); } if (!unknown_fields().empty()) { target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( unknown_fields(), target); } return target; } int X_Requestchunk_Msg::ByteSize() const { int total_size = 0; if (_has_bits_[1 / 32] & (0xffu << (1 % 32))) { // optional bytes payload = 2; if (has_payload()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::BytesSize( this->payload()); } } // repeated string dag = 1; total_size += 1 * this->dag_size(); for (int i = 0; i < this->dag_size(); i++) { total_size += ::google::protobuf::internal::WireFormatLite::StringSize( this->dag(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 X_Requestchunk_Msg::MergeFrom(const ::google::protobuf::Message& from) { GOOGLE_CHECK_NE(&from, this); const X_Requestchunk_Msg* source = ::google::protobuf::internal::dynamic_cast_if_available<const X_Requestchunk_Msg*>( &from); if (source == NULL) { ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { MergeFrom(*source); } } void X_Requestchunk_Msg::MergeFrom(const X_Requestchunk_Msg& from) { GOOGLE_CHECK_NE(&from, this); dag_.MergeFrom(from.dag_); if (from._has_bits_[1 / 32] & (0xffu << (1 % 32))) { if (from.has_payload()) { set_payload(from.payload()); } } mutable_unknown_fields()->MergeFrom(from.unknown_fields()); } void X_Requestchunk_Msg::CopyFrom(const ::google::protobuf::Message& from) { if (&from == this) return; Clear(); MergeFrom(from); } void X_Requestchunk_Msg::CopyFrom(const X_Requestchunk_Msg& from) { if (&from == this) return; Clear(); MergeFrom(from); } bool X_Requestchunk_Msg::IsInitialized() const { return true; } void X_Requestchunk_Msg::Swap(X_Requestchunk_Msg* other) { if (other != this) { dag_.Swap(&other->dag_); std::swap(payload_, other->payload_); 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 X_Requestchunk_Msg::GetMetadata() const { protobuf_AssignDescriptorsOnce(); ::google::protobuf::Metadata metadata; metadata.descriptor = X_Requestchunk_Msg_descriptor_; metadata.reflection = X_Requestchunk_Msg_reflection_; return metadata; } // =================================================================== #ifndef _MSC_VER const int X_Getchunkstatus_Msg::kDagFieldNumber; const int X_Getchunkstatus_Msg::kStatusFieldNumber; const int X_Getchunkstatus_Msg::kPayloadFieldNumber; #endif // !_MSC_VER X_Getchunkstatus_Msg::X_Getchunkstatus_Msg() : ::google::protobuf::Message() { SharedCtor(); } void X_Getchunkstatus_Msg::InitAsDefaultInstance() { } X_Getchunkstatus_Msg::X_Getchunkstatus_Msg(const X_Getchunkstatus_Msg& from) : ::google::protobuf::Message() { SharedCtor(); MergeFrom(from); } void X_Getchunkstatus_Msg::SharedCtor() { _cached_size_ = 0; payload_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); ::memset(_has_bits_, 0, sizeof(_has_bits_)); } X_Getchunkstatus_Msg::~X_Getchunkstatus_Msg() { SharedDtor(); } void X_Getchunkstatus_Msg::SharedDtor() { if (payload_ != &::google::protobuf::internal::kEmptyString) { delete payload_; } if (this != default_instance_) { } } void X_Getchunkstatus_Msg::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* X_Getchunkstatus_Msg::descriptor() { protobuf_AssignDescriptorsOnce(); return X_Getchunkstatus_Msg_descriptor_; } const X_Getchunkstatus_Msg& X_Getchunkstatus_Msg::default_instance() { if (default_instance_ == NULL) protobuf_AddDesc_xia_2eproto(); return *default_instance_; } X_Getchunkstatus_Msg* X_Getchunkstatus_Msg::default_instance_ = NULL; X_Getchunkstatus_Msg* X_Getchunkstatus_Msg::New() const { return new X_Getchunkstatus_Msg; } void X_Getchunkstatus_Msg::Clear() { if (_has_bits_[2 / 32] & (0xffu << (2 % 32))) { if (has_payload()) { if (payload_ != &::google::protobuf::internal::kEmptyString) { payload_->clear(); } } } dag_.Clear(); status_.Clear(); ::memset(_has_bits_, 0, sizeof(_has_bits_)); mutable_unknown_fields()->Clear(); } bool X_Getchunkstatus_Msg::MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) { #define DO_(EXPRESSION) if (!(EXPRESSION)) return false ::google::protobuf::uint32 tag; while ((tag = input->ReadTag()) != 0) { switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // repeated string dag = 1; case 1: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { parse_dag: DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->add_dag())); ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->dag(0).data(), this->dag(0).length(), ::google::protobuf::internal::WireFormat::PARSE); } else { goto handle_uninterpreted; } if (input->ExpectTag(10)) goto parse_dag; if (input->ExpectTag(18)) goto parse_status; break; } // repeated string status = 2; case 2: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { parse_status: DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->add_status())); ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->status(0).data(), this->status(0).length(), ::google::protobuf::internal::WireFormat::PARSE); } else { goto handle_uninterpreted; } if (input->ExpectTag(18)) goto parse_status; if (input->ExpectTag(26)) goto parse_payload; break; } // optional bytes payload = 3; case 3: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { parse_payload: DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( input, this->mutable_payload())); } else { goto handle_uninterpreted; } if (input->ExpectAtEnd()) return true; break; } default: { handle_uninterpreted: if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { return true; } DO_(::google::protobuf::internal::WireFormat::SkipField( input, tag, mutable_unknown_fields())); break; } } } return true; #undef DO_ } void X_Getchunkstatus_Msg::SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const { // repeated string dag = 1; for (int i = 0; i < this->dag_size(); i++) { ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->dag(i).data(), this->dag(i).length(), ::google::protobuf::internal::WireFormat::SERIALIZE); ::google::protobuf::internal::WireFormatLite::WriteString( 1, this->dag(i), output); } // repeated string status = 2; for (int i = 0; i < this->status_size(); i++) { ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->status(i).data(), this->status(i).length(), ::google::protobuf::internal::WireFormat::SERIALIZE); ::google::protobuf::internal::WireFormatLite::WriteString( 2, this->status(i), output); } // optional bytes payload = 3; if (has_payload()) { ::google::protobuf::internal::WireFormatLite::WriteBytes( 3, this->payload(), output); } if (!unknown_fields().empty()) { ::google::protobuf::internal::WireFormat::SerializeUnknownFields( unknown_fields(), output); } } ::google::protobuf::uint8* X_Getchunkstatus_Msg::SerializeWithCachedSizesToArray( ::google::protobuf::uint8* target) const { // repeated string dag = 1; for (int i = 0; i < this->dag_size(); i++) { ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->dag(i).data(), this->dag(i).length(), ::google::protobuf::internal::WireFormat::SERIALIZE); target = ::google::protobuf::internal::WireFormatLite:: WriteStringToArray(1, this->dag(i), target); } // repeated string status = 2; for (int i = 0; i < this->status_size(); i++) { ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->status(i).data(), this->status(i).length(), ::google::protobuf::internal::WireFormat::SERIALIZE); target = ::google::protobuf::internal::WireFormatLite:: WriteStringToArray(2, this->status(i), target); } // optional bytes payload = 3; if (has_payload()) { target = ::google::protobuf::internal::WireFormatLite::WriteBytesToArray( 3, this->payload(), target); } if (!unknown_fields().empty()) { target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( unknown_fields(), target); } return target; } int X_Getchunkstatus_Msg::ByteSize() const { int total_size = 0; if (_has_bits_[2 / 32] & (0xffu << (2 % 32))) { // optional bytes payload = 3; if (has_payload()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::BytesSize( this->payload()); } } // repeated string dag = 1; total_size += 1 * this->dag_size(); for (int i = 0; i < this->dag_size(); i++) { total_size += ::google::protobuf::internal::WireFormatLite::StringSize( this->dag(i)); } // repeated string status = 2; total_size += 1 * this->status_size(); for (int i = 0; i < this->status_size(); i++) { total_size += ::google::protobuf::internal::WireFormatLite::StringSize( this->status(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 X_Getchunkstatus_Msg::MergeFrom(const ::google::protobuf::Message& from) { GOOGLE_CHECK_NE(&from, this); const X_Getchunkstatus_Msg* source = ::google::protobuf::internal::dynamic_cast_if_available<const X_Getchunkstatus_Msg*>( &from); if (source == NULL) { ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { MergeFrom(*source); } } void X_Getchunkstatus_Msg::MergeFrom(const X_Getchunkstatus_Msg& from) { GOOGLE_CHECK_NE(&from, this); dag_.MergeFrom(from.dag_); status_.MergeFrom(from.status_); if (from._has_bits_[2 / 32] & (0xffu << (2 % 32))) { if (from.has_payload()) { set_payload(from.payload()); } } mutable_unknown_fields()->MergeFrom(from.unknown_fields()); } void X_Getchunkstatus_Msg::CopyFrom(const ::google::protobuf::Message& from) { if (&from == this) return; Clear(); MergeFrom(from); } void X_Getchunkstatus_Msg::CopyFrom(const X_Getchunkstatus_Msg& from) { if (&from == this) return; Clear(); MergeFrom(from); } bool X_Getchunkstatus_Msg::IsInitialized() const { return true; } void X_Getchunkstatus_Msg::Swap(X_Getchunkstatus_Msg* other) { if (other != this) { dag_.Swap(&other->dag_); status_.Swap(&other->status_); std::swap(payload_, other->payload_); 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 X_Getchunkstatus_Msg::GetMetadata() const { protobuf_AssignDescriptorsOnce(); ::google::protobuf::Metadata metadata; metadata.descriptor = X_Getchunkstatus_Msg_descriptor_; metadata.reflection = X_Getchunkstatus_Msg_reflection_; return metadata; } // =================================================================== #ifndef _MSC_VER const int X_Readchunk_Msg::kDagFieldNumber; const int X_Readchunk_Msg::kPayloadFieldNumber; #endif // !_MSC_VER X_Readchunk_Msg::X_Readchunk_Msg() : ::google::protobuf::Message() { SharedCtor(); } void X_Readchunk_Msg::InitAsDefaultInstance() { } X_Readchunk_Msg::X_Readchunk_Msg(const X_Readchunk_Msg& from) : ::google::protobuf::Message() { SharedCtor(); MergeFrom(from); } void X_Readchunk_Msg::SharedCtor() { _cached_size_ = 0; dag_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); payload_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); ::memset(_has_bits_, 0, sizeof(_has_bits_)); } X_Readchunk_Msg::~X_Readchunk_Msg() { SharedDtor(); } void X_Readchunk_Msg::SharedDtor() { if (dag_ != &::google::protobuf::internal::kEmptyString) { delete dag_; } if (payload_ != &::google::protobuf::internal::kEmptyString) { delete payload_; } if (this != default_instance_) { } } void X_Readchunk_Msg::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* X_Readchunk_Msg::descriptor() { protobuf_AssignDescriptorsOnce(); return X_Readchunk_Msg_descriptor_; } const X_Readchunk_Msg& X_Readchunk_Msg::default_instance() { if (default_instance_ == NULL) protobuf_AddDesc_xia_2eproto(); return *default_instance_; } X_Readchunk_Msg* X_Readchunk_Msg::default_instance_ = NULL; X_Readchunk_Msg* X_Readchunk_Msg::New() const { return new X_Readchunk_Msg; } void X_Readchunk_Msg::Clear() { if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { if (has_dag()) { if (dag_ != &::google::protobuf::internal::kEmptyString) { dag_->clear(); } } if (has_payload()) { if (payload_ != &::google::protobuf::internal::kEmptyString) { payload_->clear(); } } } ::memset(_has_bits_, 0, sizeof(_has_bits_)); mutable_unknown_fields()->Clear(); } bool X_Readchunk_Msg::MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) { #define DO_(EXPRESSION) if (!(EXPRESSION)) return false ::google::protobuf::uint32 tag; while ((tag = input->ReadTag()) != 0) { switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // required string dag = 1; case 1: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_dag())); ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->dag().data(), this->dag().length(), ::google::protobuf::internal::WireFormat::PARSE); } else { goto handle_uninterpreted; } if (input->ExpectTag(18)) goto parse_payload; break; } // optional bytes payload = 2; case 2: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { parse_payload: DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( input, this->mutable_payload())); } else { goto handle_uninterpreted; } if (input->ExpectAtEnd()) return true; break; } default: { handle_uninterpreted: if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { return true; } DO_(::google::protobuf::internal::WireFormat::SkipField( input, tag, mutable_unknown_fields())); break; } } } return true; #undef DO_ } void X_Readchunk_Msg::SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const { // required string dag = 1; if (has_dag()) { ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->dag().data(), this->dag().length(), ::google::protobuf::internal::WireFormat::SERIALIZE); ::google::protobuf::internal::WireFormatLite::WriteString( 1, this->dag(), output); } // optional bytes payload = 2; if (has_payload()) { ::google::protobuf::internal::WireFormatLite::WriteBytes( 2, this->payload(), output); } if (!unknown_fields().empty()) { ::google::protobuf::internal::WireFormat::SerializeUnknownFields( unknown_fields(), output); } } ::google::protobuf::uint8* X_Readchunk_Msg::SerializeWithCachedSizesToArray( ::google::protobuf::uint8* target) const { // required string dag = 1; if (has_dag()) { ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->dag().data(), this->dag().length(), ::google::protobuf::internal::WireFormat::SERIALIZE); target = ::google::protobuf::internal::WireFormatLite::WriteStringToArray( 1, this->dag(), target); } // optional bytes payload = 2; if (has_payload()) { target = ::google::protobuf::internal::WireFormatLite::WriteBytesToArray( 2, this->payload(), target); } if (!unknown_fields().empty()) { target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( unknown_fields(), target); } return target; } int X_Readchunk_Msg::ByteSize() const { int total_size = 0; if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { // required string dag = 1; if (has_dag()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( this->dag()); } // optional bytes payload = 2; if (has_payload()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::BytesSize( this->payload()); } } 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 X_Readchunk_Msg::MergeFrom(const ::google::protobuf::Message& from) { GOOGLE_CHECK_NE(&from, this); const X_Readchunk_Msg* source = ::google::protobuf::internal::dynamic_cast_if_available<const X_Readchunk_Msg*>( &from); if (source == NULL) { ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { MergeFrom(*source); } } void X_Readchunk_Msg::MergeFrom(const X_Readchunk_Msg& from) { GOOGLE_CHECK_NE(&from, this); if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { if (from.has_dag()) { set_dag(from.dag()); } if (from.has_payload()) { set_payload(from.payload()); } } mutable_unknown_fields()->MergeFrom(from.unknown_fields()); } void X_Readchunk_Msg::CopyFrom(const ::google::protobuf::Message& from) { if (&from == this) return; Clear(); MergeFrom(from); } void X_Readchunk_Msg::CopyFrom(const X_Readchunk_Msg& from) { if (&from == this) return; Clear(); MergeFrom(from); } bool X_Readchunk_Msg::IsInitialized() const { if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false; return true; } void X_Readchunk_Msg::Swap(X_Readchunk_Msg* other) { if (other != this) { std::swap(dag_, other->dag_); std::swap(payload_, other->payload_); 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 X_Readchunk_Msg::GetMetadata() const { protobuf_AssignDescriptorsOnce(); ::google::protobuf::Metadata metadata; metadata.descriptor = X_Readchunk_Msg_descriptor_; metadata.reflection = X_Readchunk_Msg_reflection_; return metadata; } // =================================================================== #ifndef _MSC_VER const int X_Removechunk_Msg::kContextidFieldNumber; const int X_Removechunk_Msg::kCidFieldNumber; const int X_Removechunk_Msg::kStatusFieldNumber; #endif // !_MSC_VER X_Removechunk_Msg::X_Removechunk_Msg() : ::google::protobuf::Message() { SharedCtor(); } void X_Removechunk_Msg::InitAsDefaultInstance() { } X_Removechunk_Msg::X_Removechunk_Msg(const X_Removechunk_Msg& from) : ::google::protobuf::Message() { SharedCtor(); MergeFrom(from); } void X_Removechunk_Msg::SharedCtor() { _cached_size_ = 0; contextid_ = 0; cid_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); status_ = 0; ::memset(_has_bits_, 0, sizeof(_has_bits_)); } X_Removechunk_Msg::~X_Removechunk_Msg() { SharedDtor(); } void X_Removechunk_Msg::SharedDtor() { if (cid_ != &::google::protobuf::internal::kEmptyString) { delete cid_; } if (this != default_instance_) { } } void X_Removechunk_Msg::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* X_Removechunk_Msg::descriptor() { protobuf_AssignDescriptorsOnce(); return X_Removechunk_Msg_descriptor_; } const X_Removechunk_Msg& X_Removechunk_Msg::default_instance() { if (default_instance_ == NULL) protobuf_AddDesc_xia_2eproto(); return *default_instance_; } X_Removechunk_Msg* X_Removechunk_Msg::default_instance_ = NULL; X_Removechunk_Msg* X_Removechunk_Msg::New() const { return new X_Removechunk_Msg; } void X_Removechunk_Msg::Clear() { if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { contextid_ = 0; if (has_cid()) { if (cid_ != &::google::protobuf::internal::kEmptyString) { cid_->clear(); } } status_ = 0; } ::memset(_has_bits_, 0, sizeof(_has_bits_)); mutable_unknown_fields()->Clear(); } bool X_Removechunk_Msg::MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) { #define DO_(EXPRESSION) if (!(EXPRESSION)) return false ::google::protobuf::uint32 tag; while ((tag = input->ReadTag()) != 0) { switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // required int32 contextid = 1; case 1: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( input, &contextid_))); set_has_contextid(); } else { goto handle_uninterpreted; } if (input->ExpectTag(18)) goto parse_cid; break; } // required string cid = 2; case 2: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { parse_cid: DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_cid())); ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->cid().data(), this->cid().length(), ::google::protobuf::internal::WireFormat::PARSE); } else { goto handle_uninterpreted; } if (input->ExpectTag(24)) goto parse_status; break; } // optional int32 status = 3; case 3: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { parse_status: DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( input, &status_))); set_has_status(); } else { goto handle_uninterpreted; } if (input->ExpectAtEnd()) return true; break; } default: { handle_uninterpreted: if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { return true; } DO_(::google::protobuf::internal::WireFormat::SkipField( input, tag, mutable_unknown_fields())); break; } } } return true; #undef DO_ } void X_Removechunk_Msg::SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const { // required int32 contextid = 1; if (has_contextid()) { ::google::protobuf::internal::WireFormatLite::WriteInt32(1, this->contextid(), output); } // required string cid = 2; if (has_cid()) { ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->cid().data(), this->cid().length(), ::google::protobuf::internal::WireFormat::SERIALIZE); ::google::protobuf::internal::WireFormatLite::WriteString( 2, this->cid(), output); } // optional int32 status = 3; if (has_status()) { ::google::protobuf::internal::WireFormatLite::WriteInt32(3, this->status(), output); } if (!unknown_fields().empty()) { ::google::protobuf::internal::WireFormat::SerializeUnknownFields( unknown_fields(), output); } } ::google::protobuf::uint8* X_Removechunk_Msg::SerializeWithCachedSizesToArray( ::google::protobuf::uint8* target) const { // required int32 contextid = 1; if (has_contextid()) { target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(1, this->contextid(), target); } // required string cid = 2; if (has_cid()) { ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->cid().data(), this->cid().length(), ::google::protobuf::internal::WireFormat::SERIALIZE); target = ::google::protobuf::internal::WireFormatLite::WriteStringToArray( 2, this->cid(), target); } // optional int32 status = 3; if (has_status()) { target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(3, this->status(), target); } if (!unknown_fields().empty()) { target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( unknown_fields(), target); } return target; } int X_Removechunk_Msg::ByteSize() const { int total_size = 0; if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { // required int32 contextid = 1; if (has_contextid()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( this->contextid()); } // required string cid = 2; if (has_cid()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( this->cid()); } // optional int32 status = 3; if (has_status()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( this->status()); } } 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 X_Removechunk_Msg::MergeFrom(const ::google::protobuf::Message& from) { GOOGLE_CHECK_NE(&from, this); const X_Removechunk_Msg* source = ::google::protobuf::internal::dynamic_cast_if_available<const X_Removechunk_Msg*>( &from); if (source == NULL) { ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { MergeFrom(*source); } } void X_Removechunk_Msg::MergeFrom(const X_Removechunk_Msg& from) { GOOGLE_CHECK_NE(&from, this); if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { if (from.has_contextid()) { set_contextid(from.contextid()); } if (from.has_cid()) { set_cid(from.cid()); } if (from.has_status()) { set_status(from.status()); } } mutable_unknown_fields()->MergeFrom(from.unknown_fields()); } void X_Removechunk_Msg::CopyFrom(const ::google::protobuf::Message& from) { if (&from == this) return; Clear(); MergeFrom(from); } void X_Removechunk_Msg::CopyFrom(const X_Removechunk_Msg& from) { if (&from == this) return; Clear(); MergeFrom(from); } bool X_Removechunk_Msg::IsInitialized() const { if ((_has_bits_[0] & 0x00000003) != 0x00000003) return false; return true; } void X_Removechunk_Msg::Swap(X_Removechunk_Msg* other) { if (other != this) { std::swap(contextid_, other->contextid_); std::swap(cid_, other->cid_); std::swap(status_, other->status_); 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 X_Removechunk_Msg::GetMetadata() const { protobuf_AssignDescriptorsOnce(); ::google::protobuf::Metadata metadata; metadata.descriptor = X_Removechunk_Msg_descriptor_; metadata.reflection = X_Removechunk_Msg_reflection_; return metadata; } // =================================================================== #ifndef _MSC_VER const int X_Result_Msg::kTypeFieldNumber; const int X_Result_Msg::kReturnCodeFieldNumber; const int X_Result_Msg::kErrCodeFieldNumber; #endif // !_MSC_VER X_Result_Msg::X_Result_Msg() : ::google::protobuf::Message() { SharedCtor(); } void X_Result_Msg::InitAsDefaultInstance() { } X_Result_Msg::X_Result_Msg(const X_Result_Msg& from) : ::google::protobuf::Message() { SharedCtor(); MergeFrom(from); } void X_Result_Msg::SharedCtor() { _cached_size_ = 0; type_ = 1; return_code_ = 0; err_code_ = 0; ::memset(_has_bits_, 0, sizeof(_has_bits_)); } X_Result_Msg::~X_Result_Msg() { SharedDtor(); } void X_Result_Msg::SharedDtor() { if (this != default_instance_) { } } void X_Result_Msg::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* X_Result_Msg::descriptor() { protobuf_AssignDescriptorsOnce(); return X_Result_Msg_descriptor_; } const X_Result_Msg& X_Result_Msg::default_instance() { if (default_instance_ == NULL) protobuf_AddDesc_xia_2eproto(); return *default_instance_; } X_Result_Msg* X_Result_Msg::default_instance_ = NULL; X_Result_Msg* X_Result_Msg::New() const { return new X_Result_Msg; } void X_Result_Msg::Clear() { if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { type_ = 1; return_code_ = 0; err_code_ = 0; } ::memset(_has_bits_, 0, sizeof(_has_bits_)); mutable_unknown_fields()->Clear(); } bool X_Result_Msg::MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) { #define DO_(EXPRESSION) if (!(EXPRESSION)) return false ::google::protobuf::uint32 tag; while ((tag = input->ReadTag()) != 0) { switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // required .xia.XSocketCallType type = 1; case 1: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { int value; DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( input, &value))); if (xia::XSocketCallType_IsValid(value)) { set_type(static_cast< xia::XSocketCallType >(value)); } else { mutable_unknown_fields()->AddVarint(1, value); } } else { goto handle_uninterpreted; } if (input->ExpectTag(16)) goto parse_return_code; break; } // required int32 return_code = 2; case 2: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { parse_return_code: DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( input, &return_code_))); set_has_return_code(); } else { goto handle_uninterpreted; } if (input->ExpectTag(24)) goto parse_err_code; break; } // optional int32 err_code = 3; case 3: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { parse_err_code: DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( input, &err_code_))); set_has_err_code(); } else { goto handle_uninterpreted; } if (input->ExpectAtEnd()) return true; break; } default: { handle_uninterpreted: if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { return true; } DO_(::google::protobuf::internal::WireFormat::SkipField( input, tag, mutable_unknown_fields())); break; } } } return true; #undef DO_ } void X_Result_Msg::SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const { // required .xia.XSocketCallType type = 1; if (has_type()) { ::google::protobuf::internal::WireFormatLite::WriteEnum( 1, this->type(), output); } // required int32 return_code = 2; if (has_return_code()) { ::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->return_code(), output); } // optional int32 err_code = 3; if (has_err_code()) { ::google::protobuf::internal::WireFormatLite::WriteInt32(3, this->err_code(), output); } if (!unknown_fields().empty()) { ::google::protobuf::internal::WireFormat::SerializeUnknownFields( unknown_fields(), output); } } ::google::protobuf::uint8* X_Result_Msg::SerializeWithCachedSizesToArray( ::google::protobuf::uint8* target) const { // required .xia.XSocketCallType type = 1; if (has_type()) { target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray( 1, this->type(), target); } // required int32 return_code = 2; if (has_return_code()) { target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(2, this->return_code(), target); } // optional int32 err_code = 3; if (has_err_code()) { target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(3, this->err_code(), target); } if (!unknown_fields().empty()) { target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( unknown_fields(), target); } return target; } int X_Result_Msg::ByteSize() const { int total_size = 0; if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { // required .xia.XSocketCallType type = 1; if (has_type()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::EnumSize(this->type()); } // required int32 return_code = 2; if (has_return_code()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( this->return_code()); } // optional int32 err_code = 3; if (has_err_code()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( this->err_code()); } } 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 X_Result_Msg::MergeFrom(const ::google::protobuf::Message& from) { GOOGLE_CHECK_NE(&from, this); const X_Result_Msg* source = ::google::protobuf::internal::dynamic_cast_if_available<const X_Result_Msg*>( &from); if (source == NULL) { ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { MergeFrom(*source); } } void X_Result_Msg::MergeFrom(const X_Result_Msg& from) { GOOGLE_CHECK_NE(&from, this); if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { if (from.has_type()) { set_type(from.type()); } if (from.has_return_code()) { set_return_code(from.return_code()); } if (from.has_err_code()) { set_err_code(from.err_code()); } } mutable_unknown_fields()->MergeFrom(from.unknown_fields()); } void X_Result_Msg::CopyFrom(const ::google::protobuf::Message& from) { if (&from == this) return; Clear(); MergeFrom(from); } void X_Result_Msg::CopyFrom(const X_Result_Msg& from) { if (&from == this) return; Clear(); MergeFrom(from); } bool X_Result_Msg::IsInitialized() const { if ((_has_bits_[0] & 0x00000003) != 0x00000003) return false; return true; } void X_Result_Msg::Swap(X_Result_Msg* other) { if (other != this) { std::swap(type_, other->type_); std::swap(return_code_, other->return_code_); std::swap(err_code_, other->err_code_); 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 X_Result_Msg::GetMetadata() const { protobuf_AssignDescriptorsOnce(); ::google::protobuf::Metadata metadata; metadata.descriptor = X_Result_Msg_descriptor_; metadata.reflection = X_Result_Msg_reflection_; return metadata; } // =================================================================== #ifndef _MSC_VER const int X_Requestfailed_Msg::kTypeFieldNumber; const int X_Requestfailed_Msg::kTempFieldNumber; #endif // !_MSC_VER X_Requestfailed_Msg::X_Requestfailed_Msg() : ::google::protobuf::Message() { SharedCtor(); } void X_Requestfailed_Msg::InitAsDefaultInstance() { } X_Requestfailed_Msg::X_Requestfailed_Msg(const X_Requestfailed_Msg& from) : ::google::protobuf::Message() { SharedCtor(); MergeFrom(from); } void X_Requestfailed_Msg::SharedCtor() { _cached_size_ = 0; type_ = 0; temp_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); ::memset(_has_bits_, 0, sizeof(_has_bits_)); } X_Requestfailed_Msg::~X_Requestfailed_Msg() { SharedDtor(); } void X_Requestfailed_Msg::SharedDtor() { if (temp_ != &::google::protobuf::internal::kEmptyString) { delete temp_; } if (this != default_instance_) { } } void X_Requestfailed_Msg::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* X_Requestfailed_Msg::descriptor() { protobuf_AssignDescriptorsOnce(); return X_Requestfailed_Msg_descriptor_; } const X_Requestfailed_Msg& X_Requestfailed_Msg::default_instance() { if (default_instance_ == NULL) protobuf_AddDesc_xia_2eproto(); return *default_instance_; } X_Requestfailed_Msg* X_Requestfailed_Msg::default_instance_ = NULL; X_Requestfailed_Msg* X_Requestfailed_Msg::New() const { return new X_Requestfailed_Msg; } void X_Requestfailed_Msg::Clear() { if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { type_ = 0; if (has_temp()) { if (temp_ != &::google::protobuf::internal::kEmptyString) { temp_->clear(); } } } ::memset(_has_bits_, 0, sizeof(_has_bits_)); mutable_unknown_fields()->Clear(); } bool X_Requestfailed_Msg::MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) { #define DO_(EXPRESSION) if (!(EXPRESSION)) return false ::google::protobuf::uint32 tag; while ((tag = input->ReadTag()) != 0) { switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // optional int32 type = 1; case 1: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( input, &type_))); set_has_type(); } else { goto handle_uninterpreted; } if (input->ExpectTag(18)) goto parse_temp; break; } // optional string temp = 2; case 2: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { parse_temp: DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_temp())); ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->temp().data(), this->temp().length(), ::google::protobuf::internal::WireFormat::PARSE); } else { goto handle_uninterpreted; } if (input->ExpectAtEnd()) return true; break; } default: { handle_uninterpreted: if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { return true; } DO_(::google::protobuf::internal::WireFormat::SkipField( input, tag, mutable_unknown_fields())); break; } } } return true; #undef DO_ } void X_Requestfailed_Msg::SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const { // optional int32 type = 1; if (has_type()) { ::google::protobuf::internal::WireFormatLite::WriteInt32(1, this->type(), output); } // optional string temp = 2; if (has_temp()) { ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->temp().data(), this->temp().length(), ::google::protobuf::internal::WireFormat::SERIALIZE); ::google::protobuf::internal::WireFormatLite::WriteString( 2, this->temp(), output); } if (!unknown_fields().empty()) { ::google::protobuf::internal::WireFormat::SerializeUnknownFields( unknown_fields(), output); } } ::google::protobuf::uint8* X_Requestfailed_Msg::SerializeWithCachedSizesToArray( ::google::protobuf::uint8* target) const { // optional int32 type = 1; if (has_type()) { target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(1, this->type(), target); } // optional string temp = 2; if (has_temp()) { ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->temp().data(), this->temp().length(), ::google::protobuf::internal::WireFormat::SERIALIZE); target = ::google::protobuf::internal::WireFormatLite::WriteStringToArray( 2, this->temp(), target); } if (!unknown_fields().empty()) { target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( unknown_fields(), target); } return target; } int X_Requestfailed_Msg::ByteSize() const { int total_size = 0; if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { // optional int32 type = 1; if (has_type()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( this->type()); } // optional string temp = 2; if (has_temp()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( this->temp()); } } 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 X_Requestfailed_Msg::MergeFrom(const ::google::protobuf::Message& from) { GOOGLE_CHECK_NE(&from, this); const X_Requestfailed_Msg* source = ::google::protobuf::internal::dynamic_cast_if_available<const X_Requestfailed_Msg*>( &from); if (source == NULL) { ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { MergeFrom(*source); } } void X_Requestfailed_Msg::MergeFrom(const X_Requestfailed_Msg& from) { GOOGLE_CHECK_NE(&from, this); if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { if (from.has_type()) { set_type(from.type()); } if (from.has_temp()) { set_temp(from.temp()); } } mutable_unknown_fields()->MergeFrom(from.unknown_fields()); } void X_Requestfailed_Msg::CopyFrom(const ::google::protobuf::Message& from) { if (&from == this) return; Clear(); MergeFrom(from); } void X_Requestfailed_Msg::CopyFrom(const X_Requestfailed_Msg& from) { if (&from == this) return; Clear(); MergeFrom(from); } bool X_Requestfailed_Msg::IsInitialized() const { return true; } void X_Requestfailed_Msg::Swap(X_Requestfailed_Msg* other) { if (other != this) { std::swap(type_, other->type_); std::swap(temp_, other->temp_); 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 X_Requestfailed_Msg::GetMetadata() const { protobuf_AssignDescriptorsOnce(); ::google::protobuf::Metadata metadata; metadata.descriptor = X_Requestfailed_Msg_descriptor_; metadata.reflection = X_Requestfailed_Msg_reflection_; return metadata; } // =================================================================== #ifndef _MSC_VER const int X_Changead_Msg::kDagFieldNumber; #endif // !_MSC_VER X_Changead_Msg::X_Changead_Msg() : ::google::protobuf::Message() { SharedCtor(); } void X_Changead_Msg::InitAsDefaultInstance() { } X_Changead_Msg::X_Changead_Msg(const X_Changead_Msg& from) : ::google::protobuf::Message() { SharedCtor(); MergeFrom(from); } void X_Changead_Msg::SharedCtor() { _cached_size_ = 0; dag_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); ::memset(_has_bits_, 0, sizeof(_has_bits_)); } X_Changead_Msg::~X_Changead_Msg() { SharedDtor(); } void X_Changead_Msg::SharedDtor() { if (dag_ != &::google::protobuf::internal::kEmptyString) { delete dag_; } if (this != default_instance_) { } } void X_Changead_Msg::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* X_Changead_Msg::descriptor() { protobuf_AssignDescriptorsOnce(); return X_Changead_Msg_descriptor_; } const X_Changead_Msg& X_Changead_Msg::default_instance() { if (default_instance_ == NULL) protobuf_AddDesc_xia_2eproto(); return *default_instance_; } X_Changead_Msg* X_Changead_Msg::default_instance_ = NULL; X_Changead_Msg* X_Changead_Msg::New() const { return new X_Changead_Msg; } void X_Changead_Msg::Clear() { if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { if (has_dag()) { if (dag_ != &::google::protobuf::internal::kEmptyString) { dag_->clear(); } } } ::memset(_has_bits_, 0, sizeof(_has_bits_)); mutable_unknown_fields()->Clear(); } bool X_Changead_Msg::MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) { #define DO_(EXPRESSION) if (!(EXPRESSION)) return false ::google::protobuf::uint32 tag; while ((tag = input->ReadTag()) != 0) { switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // required string dag = 1; case 1: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_dag())); ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->dag().data(), this->dag().length(), ::google::protobuf::internal::WireFormat::PARSE); } else { goto handle_uninterpreted; } if (input->ExpectAtEnd()) return true; break; } default: { handle_uninterpreted: if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { return true; } DO_(::google::protobuf::internal::WireFormat::SkipField( input, tag, mutable_unknown_fields())); break; } } } return true; #undef DO_ } void X_Changead_Msg::SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const { // required string dag = 1; if (has_dag()) { ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->dag().data(), this->dag().length(), ::google::protobuf::internal::WireFormat::SERIALIZE); ::google::protobuf::internal::WireFormatLite::WriteString( 1, this->dag(), output); } if (!unknown_fields().empty()) { ::google::protobuf::internal::WireFormat::SerializeUnknownFields( unknown_fields(), output); } } ::google::protobuf::uint8* X_Changead_Msg::SerializeWithCachedSizesToArray( ::google::protobuf::uint8* target) const { // required string dag = 1; if (has_dag()) { ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->dag().data(), this->dag().length(), ::google::protobuf::internal::WireFormat::SERIALIZE); target = ::google::protobuf::internal::WireFormatLite::WriteStringToArray( 1, this->dag(), target); } if (!unknown_fields().empty()) { target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( unknown_fields(), target); } return target; } int X_Changead_Msg::ByteSize() const { int total_size = 0; if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { // required string dag = 1; if (has_dag()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( this->dag()); } } 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 X_Changead_Msg::MergeFrom(const ::google::protobuf::Message& from) { GOOGLE_CHECK_NE(&from, this); const X_Changead_Msg* source = ::google::protobuf::internal::dynamic_cast_if_available<const X_Changead_Msg*>( &from); if (source == NULL) { ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { MergeFrom(*source); } } void X_Changead_Msg::MergeFrom(const X_Changead_Msg& from) { GOOGLE_CHECK_NE(&from, this); if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { if (from.has_dag()) { set_dag(from.dag()); } } mutable_unknown_fields()->MergeFrom(from.unknown_fields()); } void X_Changead_Msg::CopyFrom(const ::google::protobuf::Message& from) { if (&from == this) return; Clear(); MergeFrom(from); } void X_Changead_Msg::CopyFrom(const X_Changead_Msg& from) { if (&from == this) return; Clear(); MergeFrom(from); } bool X_Changead_Msg::IsInitialized() const { if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false; return true; } void X_Changead_Msg::Swap(X_Changead_Msg* other) { if (other != this) { std::swap(dag_, other->dag_); 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 X_Changead_Msg::GetMetadata() const { protobuf_AssignDescriptorsOnce(); ::google::protobuf::Metadata metadata; metadata.descriptor = X_Changead_Msg_descriptor_; metadata.reflection = X_Changead_Msg_reflection_; return metadata; } // =================================================================== #ifndef _MSC_VER const int X_ReadLocalHostAddr_Msg::kAdFieldNumber; const int X_ReadLocalHostAddr_Msg::kHidFieldNumber; #endif // !_MSC_VER X_ReadLocalHostAddr_Msg::X_ReadLocalHostAddr_Msg() : ::google::protobuf::Message() { SharedCtor(); } void X_ReadLocalHostAddr_Msg::InitAsDefaultInstance() { } X_ReadLocalHostAddr_Msg::X_ReadLocalHostAddr_Msg(const X_ReadLocalHostAddr_Msg& from) : ::google::protobuf::Message() { SharedCtor(); MergeFrom(from); } void X_ReadLocalHostAddr_Msg::SharedCtor() { _cached_size_ = 0; ad_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); hid_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); ::memset(_has_bits_, 0, sizeof(_has_bits_)); } X_ReadLocalHostAddr_Msg::~X_ReadLocalHostAddr_Msg() { SharedDtor(); } void X_ReadLocalHostAddr_Msg::SharedDtor() { if (ad_ != &::google::protobuf::internal::kEmptyString) { delete ad_; } if (hid_ != &::google::protobuf::internal::kEmptyString) { delete hid_; } if (this != default_instance_) { } } void X_ReadLocalHostAddr_Msg::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* X_ReadLocalHostAddr_Msg::descriptor() { protobuf_AssignDescriptorsOnce(); return X_ReadLocalHostAddr_Msg_descriptor_; } const X_ReadLocalHostAddr_Msg& X_ReadLocalHostAddr_Msg::default_instance() { if (default_instance_ == NULL) protobuf_AddDesc_xia_2eproto(); return *default_instance_; } X_ReadLocalHostAddr_Msg* X_ReadLocalHostAddr_Msg::default_instance_ = NULL; X_ReadLocalHostAddr_Msg* X_ReadLocalHostAddr_Msg::New() const { return new X_ReadLocalHostAddr_Msg; } void X_ReadLocalHostAddr_Msg::Clear() { if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { if (has_ad()) { if (ad_ != &::google::protobuf::internal::kEmptyString) { ad_->clear(); } } if (has_hid()) { if (hid_ != &::google::protobuf::internal::kEmptyString) { hid_->clear(); } } } ::memset(_has_bits_, 0, sizeof(_has_bits_)); mutable_unknown_fields()->Clear(); } bool X_ReadLocalHostAddr_Msg::MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) { #define DO_(EXPRESSION) if (!(EXPRESSION)) return false ::google::protobuf::uint32 tag; while ((tag = input->ReadTag()) != 0) { switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // optional string ad = 1; case 1: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_ad())); ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->ad().data(), this->ad().length(), ::google::protobuf::internal::WireFormat::PARSE); } else { goto handle_uninterpreted; } if (input->ExpectTag(18)) goto parse_hid; break; } // optional string hid = 2; case 2: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { parse_hid: DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_hid())); ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->hid().data(), this->hid().length(), ::google::protobuf::internal::WireFormat::PARSE); } else { goto handle_uninterpreted; } if (input->ExpectAtEnd()) return true; break; } default: { handle_uninterpreted: if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { return true; } DO_(::google::protobuf::internal::WireFormat::SkipField( input, tag, mutable_unknown_fields())); break; } } } return true; #undef DO_ } void X_ReadLocalHostAddr_Msg::SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const { // optional string ad = 1; if (has_ad()) { ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->ad().data(), this->ad().length(), ::google::protobuf::internal::WireFormat::SERIALIZE); ::google::protobuf::internal::WireFormatLite::WriteString( 1, this->ad(), output); } // optional string hid = 2; if (has_hid()) { ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->hid().data(), this->hid().length(), ::google::protobuf::internal::WireFormat::SERIALIZE); ::google::protobuf::internal::WireFormatLite::WriteString( 2, this->hid(), output); } if (!unknown_fields().empty()) { ::google::protobuf::internal::WireFormat::SerializeUnknownFields( unknown_fields(), output); } } ::google::protobuf::uint8* X_ReadLocalHostAddr_Msg::SerializeWithCachedSizesToArray( ::google::protobuf::uint8* target) const { // optional string ad = 1; if (has_ad()) { ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->ad().data(), this->ad().length(), ::google::protobuf::internal::WireFormat::SERIALIZE); target = ::google::protobuf::internal::WireFormatLite::WriteStringToArray( 1, this->ad(), target); } // optional string hid = 2; if (has_hid()) { ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->hid().data(), this->hid().length(), ::google::protobuf::internal::WireFormat::SERIALIZE); target = ::google::protobuf::internal::WireFormatLite::WriteStringToArray( 2, this->hid(), target); } if (!unknown_fields().empty()) { target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( unknown_fields(), target); } return target; } int X_ReadLocalHostAddr_Msg::ByteSize() const { int total_size = 0; if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { // optional string ad = 1; if (has_ad()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( this->ad()); } // optional string hid = 2; if (has_hid()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( this->hid()); } } 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 X_ReadLocalHostAddr_Msg::MergeFrom(const ::google::protobuf::Message& from) { GOOGLE_CHECK_NE(&from, this); const X_ReadLocalHostAddr_Msg* source = ::google::protobuf::internal::dynamic_cast_if_available<const X_ReadLocalHostAddr_Msg*>( &from); if (source == NULL) { ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { MergeFrom(*source); } } void X_ReadLocalHostAddr_Msg::MergeFrom(const X_ReadLocalHostAddr_Msg& from) { GOOGLE_CHECK_NE(&from, this); if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { if (from.has_ad()) { set_ad(from.ad()); } if (from.has_hid()) { set_hid(from.hid()); } } mutable_unknown_fields()->MergeFrom(from.unknown_fields()); } void X_ReadLocalHostAddr_Msg::CopyFrom(const ::google::protobuf::Message& from) { if (&from == this) return; Clear(); MergeFrom(from); } void X_ReadLocalHostAddr_Msg::CopyFrom(const X_ReadLocalHostAddr_Msg& from) { if (&from == this) return; Clear(); MergeFrom(from); } bool X_ReadLocalHostAddr_Msg::IsInitialized() const { return true; } void X_ReadLocalHostAddr_Msg::Swap(X_ReadLocalHostAddr_Msg* other) { if (other != this) { std::swap(ad_, other->ad_); std::swap(hid_, other->hid_); 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 X_ReadLocalHostAddr_Msg::GetMetadata() const { protobuf_AssignDescriptorsOnce(); ::google::protobuf::Metadata metadata; metadata.descriptor = X_ReadLocalHostAddr_Msg_descriptor_; metadata.reflection = X_ReadLocalHostAddr_Msg_reflection_; return metadata; } // =================================================================== #ifndef _MSC_VER const int X_Updatenameserverdag_Msg::kDagFieldNumber; #endif // !_MSC_VER X_Updatenameserverdag_Msg::X_Updatenameserverdag_Msg() : ::google::protobuf::Message() { SharedCtor(); } void X_Updatenameserverdag_Msg::InitAsDefaultInstance() { } X_Updatenameserverdag_Msg::X_Updatenameserverdag_Msg(const X_Updatenameserverdag_Msg& from) : ::google::protobuf::Message() { SharedCtor(); MergeFrom(from); } void X_Updatenameserverdag_Msg::SharedCtor() { _cached_size_ = 0; dag_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); ::memset(_has_bits_, 0, sizeof(_has_bits_)); } X_Updatenameserverdag_Msg::~X_Updatenameserverdag_Msg() { SharedDtor(); } void X_Updatenameserverdag_Msg::SharedDtor() { if (dag_ != &::google::protobuf::internal::kEmptyString) { delete dag_; } if (this != default_instance_) { } } void X_Updatenameserverdag_Msg::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* X_Updatenameserverdag_Msg::descriptor() { protobuf_AssignDescriptorsOnce(); return X_Updatenameserverdag_Msg_descriptor_; } const X_Updatenameserverdag_Msg& X_Updatenameserverdag_Msg::default_instance() { if (default_instance_ == NULL) protobuf_AddDesc_xia_2eproto(); return *default_instance_; } X_Updatenameserverdag_Msg* X_Updatenameserverdag_Msg::default_instance_ = NULL; X_Updatenameserverdag_Msg* X_Updatenameserverdag_Msg::New() const { return new X_Updatenameserverdag_Msg; } void X_Updatenameserverdag_Msg::Clear() { if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { if (has_dag()) { if (dag_ != &::google::protobuf::internal::kEmptyString) { dag_->clear(); } } } ::memset(_has_bits_, 0, sizeof(_has_bits_)); mutable_unknown_fields()->Clear(); } bool X_Updatenameserverdag_Msg::MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) { #define DO_(EXPRESSION) if (!(EXPRESSION)) return false ::google::protobuf::uint32 tag; while ((tag = input->ReadTag()) != 0) { switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // required string dag = 1; case 1: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_dag())); ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->dag().data(), this->dag().length(), ::google::protobuf::internal::WireFormat::PARSE); } else { goto handle_uninterpreted; } if (input->ExpectAtEnd()) return true; break; } default: { handle_uninterpreted: if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { return true; } DO_(::google::protobuf::internal::WireFormat::SkipField( input, tag, mutable_unknown_fields())); break; } } } return true; #undef DO_ } void X_Updatenameserverdag_Msg::SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const { // required string dag = 1; if (has_dag()) { ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->dag().data(), this->dag().length(), ::google::protobuf::internal::WireFormat::SERIALIZE); ::google::protobuf::internal::WireFormatLite::WriteString( 1, this->dag(), output); } if (!unknown_fields().empty()) { ::google::protobuf::internal::WireFormat::SerializeUnknownFields( unknown_fields(), output); } } ::google::protobuf::uint8* X_Updatenameserverdag_Msg::SerializeWithCachedSizesToArray( ::google::protobuf::uint8* target) const { // required string dag = 1; if (has_dag()) { ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->dag().data(), this->dag().length(), ::google::protobuf::internal::WireFormat::SERIALIZE); target = ::google::protobuf::internal::WireFormatLite::WriteStringToArray( 1, this->dag(), target); } if (!unknown_fields().empty()) { target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( unknown_fields(), target); } return target; } int X_Updatenameserverdag_Msg::ByteSize() const { int total_size = 0; if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { // required string dag = 1; if (has_dag()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( this->dag()); } } 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 X_Updatenameserverdag_Msg::MergeFrom(const ::google::protobuf::Message& from) { GOOGLE_CHECK_NE(&from, this); const X_Updatenameserverdag_Msg* source = ::google::protobuf::internal::dynamic_cast_if_available<const X_Updatenameserverdag_Msg*>( &from); if (source == NULL) { ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { MergeFrom(*source); } } void X_Updatenameserverdag_Msg::MergeFrom(const X_Updatenameserverdag_Msg& from) { GOOGLE_CHECK_NE(&from, this); if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { if (from.has_dag()) { set_dag(from.dag()); } } mutable_unknown_fields()->MergeFrom(from.unknown_fields()); } void X_Updatenameserverdag_Msg::CopyFrom(const ::google::protobuf::Message& from) { if (&from == this) return; Clear(); MergeFrom(from); } void X_Updatenameserverdag_Msg::CopyFrom(const X_Updatenameserverdag_Msg& from) { if (&from == this) return; Clear(); MergeFrom(from); } bool X_Updatenameserverdag_Msg::IsInitialized() const { if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false; return true; } void X_Updatenameserverdag_Msg::Swap(X_Updatenameserverdag_Msg* other) { if (other != this) { std::swap(dag_, other->dag_); 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 X_Updatenameserverdag_Msg::GetMetadata() const { protobuf_AssignDescriptorsOnce(); ::google::protobuf::Metadata metadata; metadata.descriptor = X_Updatenameserverdag_Msg_descriptor_; metadata.reflection = X_Updatenameserverdag_Msg_reflection_; return metadata; } // =================================================================== #ifndef _MSC_VER const int X_ReadNameServerDag_Msg::kDagFieldNumber; #endif // !_MSC_VER X_ReadNameServerDag_Msg::X_ReadNameServerDag_Msg() : ::google::protobuf::Message() { SharedCtor(); } void X_ReadNameServerDag_Msg::InitAsDefaultInstance() { } X_ReadNameServerDag_Msg::X_ReadNameServerDag_Msg(const X_ReadNameServerDag_Msg& from) : ::google::protobuf::Message() { SharedCtor(); MergeFrom(from); } void X_ReadNameServerDag_Msg::SharedCtor() { _cached_size_ = 0; dag_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); ::memset(_has_bits_, 0, sizeof(_has_bits_)); } X_ReadNameServerDag_Msg::~X_ReadNameServerDag_Msg() { SharedDtor(); } void X_ReadNameServerDag_Msg::SharedDtor() { if (dag_ != &::google::protobuf::internal::kEmptyString) { delete dag_; } if (this != default_instance_) { } } void X_ReadNameServerDag_Msg::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* X_ReadNameServerDag_Msg::descriptor() { protobuf_AssignDescriptorsOnce(); return X_ReadNameServerDag_Msg_descriptor_; } const X_ReadNameServerDag_Msg& X_ReadNameServerDag_Msg::default_instance() { if (default_instance_ == NULL) protobuf_AddDesc_xia_2eproto(); return *default_instance_; } X_ReadNameServerDag_Msg* X_ReadNameServerDag_Msg::default_instance_ = NULL; X_ReadNameServerDag_Msg* X_ReadNameServerDag_Msg::New() const { return new X_ReadNameServerDag_Msg; } void X_ReadNameServerDag_Msg::Clear() { if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { if (has_dag()) { if (dag_ != &::google::protobuf::internal::kEmptyString) { dag_->clear(); } } } ::memset(_has_bits_, 0, sizeof(_has_bits_)); mutable_unknown_fields()->Clear(); } bool X_ReadNameServerDag_Msg::MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) { #define DO_(EXPRESSION) if (!(EXPRESSION)) return false ::google::protobuf::uint32 tag; while ((tag = input->ReadTag()) != 0) { switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // optional string dag = 1; case 1: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_dag())); ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->dag().data(), this->dag().length(), ::google::protobuf::internal::WireFormat::PARSE); } else { goto handle_uninterpreted; } if (input->ExpectAtEnd()) return true; break; } default: { handle_uninterpreted: if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { return true; } DO_(::google::protobuf::internal::WireFormat::SkipField( input, tag, mutable_unknown_fields())); break; } } } return true; #undef DO_ } void X_ReadNameServerDag_Msg::SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const { // optional string dag = 1; if (has_dag()) { ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->dag().data(), this->dag().length(), ::google::protobuf::internal::WireFormat::SERIALIZE); ::google::protobuf::internal::WireFormatLite::WriteString( 1, this->dag(), output); } if (!unknown_fields().empty()) { ::google::protobuf::internal::WireFormat::SerializeUnknownFields( unknown_fields(), output); } } ::google::protobuf::uint8* X_ReadNameServerDag_Msg::SerializeWithCachedSizesToArray( ::google::protobuf::uint8* target) const { // optional string dag = 1; if (has_dag()) { ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->dag().data(), this->dag().length(), ::google::protobuf::internal::WireFormat::SERIALIZE); target = ::google::protobuf::internal::WireFormatLite::WriteStringToArray( 1, this->dag(), target); } if (!unknown_fields().empty()) { target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( unknown_fields(), target); } return target; } int X_ReadNameServerDag_Msg::ByteSize() const { int total_size = 0; if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { // optional string dag = 1; if (has_dag()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( this->dag()); } } 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 X_ReadNameServerDag_Msg::MergeFrom(const ::google::protobuf::Message& from) { GOOGLE_CHECK_NE(&from, this); const X_ReadNameServerDag_Msg* source = ::google::protobuf::internal::dynamic_cast_if_available<const X_ReadNameServerDag_Msg*>( &from); if (source == NULL) { ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { MergeFrom(*source); } } void X_ReadNameServerDag_Msg::MergeFrom(const X_ReadNameServerDag_Msg& from) { GOOGLE_CHECK_NE(&from, this); if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { if (from.has_dag()) { set_dag(from.dag()); } } mutable_unknown_fields()->MergeFrom(from.unknown_fields()); } void X_ReadNameServerDag_Msg::CopyFrom(const ::google::protobuf::Message& from) { if (&from == this) return; Clear(); MergeFrom(from); } void X_ReadNameServerDag_Msg::CopyFrom(const X_ReadNameServerDag_Msg& from) { if (&from == this) return; Clear(); MergeFrom(from); } bool X_ReadNameServerDag_Msg::IsInitialized() const { return true; } void X_ReadNameServerDag_Msg::Swap(X_ReadNameServerDag_Msg* other) { if (other != this) { std::swap(dag_, other->dag_); 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 X_ReadNameServerDag_Msg::GetMetadata() const { protobuf_AssignDescriptorsOnce(); ::google::protobuf::Metadata metadata; metadata.descriptor = X_ReadNameServerDag_Msg_descriptor_; metadata.reflection = X_ReadNameServerDag_Msg_reflection_; return metadata; } // =================================================================== const ::google::protobuf::EnumDescriptor* msg_MsgType_descriptor() { protobuf_AssignDescriptorsOnce(); return msg_MsgType_descriptor_; } bool msg_MsgType_IsValid(int value) { switch(value) { case 0: case 1: case 2: case 3: case 4: return true; default: return false; } } #ifndef _MSC_VER const msg_MsgType msg::GETLOCALHID; const msg_MsgType msg::GETCID; const msg_MsgType msg::CONNECTSID; const msg_MsgType msg::PUTCID; const msg_MsgType msg::SERVESID; const msg_MsgType msg::MsgType_MIN; const msg_MsgType msg::MsgType_MAX; const int msg::MsgType_ARRAYSIZE; #endif // _MSC_VER #ifndef _MSC_VER const int msg::kAppidFieldNumber; const int msg::kXidFieldNumber; const int msg::kXiapathSrcFieldNumber; const int msg::kXiapathDstFieldNumber; const int msg::kPayloadFieldNumber; const int msg::kTypeFieldNumber; #endif // !_MSC_VER msg::msg() : ::google::protobuf::Message() { SharedCtor(); } void msg::InitAsDefaultInstance() { } msg::msg(const msg& from) : ::google::protobuf::Message() { SharedCtor(); MergeFrom(from); } void msg::SharedCtor() { _cached_size_ = 0; appid_ = 0; xid_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); xiapath_src_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); xiapath_dst_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); payload_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); type_ = 0; ::memset(_has_bits_, 0, sizeof(_has_bits_)); } msg::~msg() { SharedDtor(); } void msg::SharedDtor() { if (xid_ != &::google::protobuf::internal::kEmptyString) { delete xid_; } if (xiapath_src_ != &::google::protobuf::internal::kEmptyString) { delete xiapath_src_; } if (xiapath_dst_ != &::google::protobuf::internal::kEmptyString) { delete xiapath_dst_; } if (payload_ != &::google::protobuf::internal::kEmptyString) { delete payload_; } if (this != default_instance_) { } } void msg::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* msg::descriptor() { protobuf_AssignDescriptorsOnce(); return msg_descriptor_; } const msg& msg::default_instance() { if (default_instance_ == NULL) protobuf_AddDesc_xia_2eproto(); return *default_instance_; } msg* msg::default_instance_ = NULL; msg* msg::New() const { return new msg; } void msg::Clear() { if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { appid_ = 0; if (has_xid()) { if (xid_ != &::google::protobuf::internal::kEmptyString) { xid_->clear(); } } if (has_xiapath_src()) { if (xiapath_src_ != &::google::protobuf::internal::kEmptyString) { xiapath_src_->clear(); } } if (has_xiapath_dst()) { if (xiapath_dst_ != &::google::protobuf::internal::kEmptyString) { xiapath_dst_->clear(); } } if (has_payload()) { if (payload_ != &::google::protobuf::internal::kEmptyString) { payload_->clear(); } } type_ = 0; } ::memset(_has_bits_, 0, sizeof(_has_bits_)); mutable_unknown_fields()->Clear(); } bool msg::MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) { #define DO_(EXPRESSION) if (!(EXPRESSION)) return false ::google::protobuf::uint32 tag; while ((tag = input->ReadTag()) != 0) { switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // optional int32 appid = 1; case 1: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( input, &appid_))); set_has_appid(); } else { goto handle_uninterpreted; } if (input->ExpectTag(18)) goto parse_xid; break; } // optional bytes xid = 2; case 2: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { parse_xid: DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( input, this->mutable_xid())); } else { goto handle_uninterpreted; } if (input->ExpectTag(26)) goto parse_payload; break; } // optional bytes payload = 3; case 3: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { parse_payload: DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( input, this->mutable_payload())); } else { goto handle_uninterpreted; } if (input->ExpectTag(32)) goto parse_type; break; } // optional .xia.msg.MsgType type = 4; case 4: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { parse_type: int value; DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( input, &value))); if (::xia::msg_MsgType_IsValid(value)) { set_type(static_cast< ::xia::msg_MsgType >(value)); } else { mutable_unknown_fields()->AddVarint(4, value); } } else { goto handle_uninterpreted; } if (input->ExpectTag(42)) goto parse_xiapath_src; break; } // optional string xiapath_src = 5; case 5: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { parse_xiapath_src: DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_xiapath_src())); ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->xiapath_src().data(), this->xiapath_src().length(), ::google::protobuf::internal::WireFormat::PARSE); } else { goto handle_uninterpreted; } if (input->ExpectTag(50)) goto parse_xiapath_dst; break; } // optional string xiapath_dst = 6; case 6: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { parse_xiapath_dst: DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_xiapath_dst())); ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->xiapath_dst().data(), this->xiapath_dst().length(), ::google::protobuf::internal::WireFormat::PARSE); } else { goto handle_uninterpreted; } if (input->ExpectAtEnd()) return true; break; } default: { handle_uninterpreted: if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { return true; } DO_(::google::protobuf::internal::WireFormat::SkipField( input, tag, mutable_unknown_fields())); break; } } } return true; #undef DO_ } void msg::SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const { // optional int32 appid = 1; if (has_appid()) { ::google::protobuf::internal::WireFormatLite::WriteInt32(1, this->appid(), output); } // optional bytes xid = 2; if (has_xid()) { ::google::protobuf::internal::WireFormatLite::WriteBytes( 2, this->xid(), output); } // optional bytes payload = 3; if (has_payload()) { ::google::protobuf::internal::WireFormatLite::WriteBytes( 3, this->payload(), output); } // optional .xia.msg.MsgType type = 4; if (has_type()) { ::google::protobuf::internal::WireFormatLite::WriteEnum( 4, this->type(), output); } // optional string xiapath_src = 5; if (has_xiapath_src()) { ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->xiapath_src().data(), this->xiapath_src().length(), ::google::protobuf::internal::WireFormat::SERIALIZE); ::google::protobuf::internal::WireFormatLite::WriteString( 5, this->xiapath_src(), output); } // optional string xiapath_dst = 6; if (has_xiapath_dst()) { ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->xiapath_dst().data(), this->xiapath_dst().length(), ::google::protobuf::internal::WireFormat::SERIALIZE); ::google::protobuf::internal::WireFormatLite::WriteString( 6, this->xiapath_dst(), output); } if (!unknown_fields().empty()) { ::google::protobuf::internal::WireFormat::SerializeUnknownFields( unknown_fields(), output); } } ::google::protobuf::uint8* msg::SerializeWithCachedSizesToArray( ::google::protobuf::uint8* target) const { // optional int32 appid = 1; if (has_appid()) { target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(1, this->appid(), target); } // optional bytes xid = 2; if (has_xid()) { target = ::google::protobuf::internal::WireFormatLite::WriteBytesToArray( 2, this->xid(), target); } // optional bytes payload = 3; if (has_payload()) { target = ::google::protobuf::internal::WireFormatLite::WriteBytesToArray( 3, this->payload(), target); } // optional .xia.msg.MsgType type = 4; if (has_type()) { target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray( 4, this->type(), target); } // optional string xiapath_src = 5; if (has_xiapath_src()) { ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->xiapath_src().data(), this->xiapath_src().length(), ::google::protobuf::internal::WireFormat::SERIALIZE); target = ::google::protobuf::internal::WireFormatLite::WriteStringToArray( 5, this->xiapath_src(), target); } // optional string xiapath_dst = 6; if (has_xiapath_dst()) { ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->xiapath_dst().data(), this->xiapath_dst().length(), ::google::protobuf::internal::WireFormat::SERIALIZE); target = ::google::protobuf::internal::WireFormatLite::WriteStringToArray( 6, this->xiapath_dst(), target); } if (!unknown_fields().empty()) { target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( unknown_fields(), target); } return target; } int msg::ByteSize() const { int total_size = 0; if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { // optional int32 appid = 1; if (has_appid()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( this->appid()); } // optional bytes xid = 2; if (has_xid()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::BytesSize( this->xid()); } // optional string xiapath_src = 5; if (has_xiapath_src()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( this->xiapath_src()); } // optional string xiapath_dst = 6; if (has_xiapath_dst()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( this->xiapath_dst()); } // optional bytes payload = 3; if (has_payload()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::BytesSize( this->payload()); } // optional .xia.msg.MsgType type = 4; if (has_type()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::EnumSize(this->type()); } } 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 msg::MergeFrom(const ::google::protobuf::Message& from) { GOOGLE_CHECK_NE(&from, this); const msg* source = ::google::protobuf::internal::dynamic_cast_if_available<const msg*>( &from); if (source == NULL) { ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { MergeFrom(*source); } } void msg::MergeFrom(const msg& from) { GOOGLE_CHECK_NE(&from, this); if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { if (from.has_appid()) { set_appid(from.appid()); } if (from.has_xid()) { set_xid(from.xid()); } if (from.has_xiapath_src()) { set_xiapath_src(from.xiapath_src()); } if (from.has_xiapath_dst()) { set_xiapath_dst(from.xiapath_dst()); } if (from.has_payload()) { set_payload(from.payload()); } if (from.has_type()) { set_type(from.type()); } } mutable_unknown_fields()->MergeFrom(from.unknown_fields()); } void msg::CopyFrom(const ::google::protobuf::Message& from) { if (&from == this) return; Clear(); MergeFrom(from); } void msg::CopyFrom(const msg& from) { if (&from == this) return; Clear(); MergeFrom(from); } bool msg::IsInitialized() const { return true; } void msg::Swap(msg* other) { if (other != this) { std::swap(appid_, other->appid_); std::swap(xid_, other->xid_); std::swap(xiapath_src_, other->xiapath_src_); std::swap(xiapath_dst_, other->xiapath_dst_); std::swap(payload_, other->payload_); std::swap(type_, other->type_); 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 msg::GetMetadata() const { protobuf_AssignDescriptorsOnce(); ::google::protobuf::Metadata metadata; metadata.descriptor = msg_descriptor_; metadata.reflection = msg_reflection_; return metadata; } // =================================================================== #ifndef _MSC_VER const int msg_response::kAppidFieldNumber; const int msg_response::kXidFieldNumber; const int msg_response::kPayloadFieldNumber; #endif // !_MSC_VER msg_response::msg_response() : ::google::protobuf::Message() { SharedCtor(); } void msg_response::InitAsDefaultInstance() { } msg_response::msg_response(const msg_response& from) : ::google::protobuf::Message() { SharedCtor(); MergeFrom(from); } void msg_response::SharedCtor() { _cached_size_ = 0; appid_ = 0; payload_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); ::memset(_has_bits_, 0, sizeof(_has_bits_)); } msg_response::~msg_response() { SharedDtor(); } void msg_response::SharedDtor() { if (payload_ != &::google::protobuf::internal::kEmptyString) { delete payload_; } if (this != default_instance_) { } } void msg_response::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* msg_response::descriptor() { protobuf_AssignDescriptorsOnce(); return msg_response_descriptor_; } const msg_response& msg_response::default_instance() { if (default_instance_ == NULL) protobuf_AddDesc_xia_2eproto(); return *default_instance_; } msg_response* msg_response::default_instance_ = NULL; msg_response* msg_response::New() const { return new msg_response; } void msg_response::Clear() { if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { appid_ = 0; if (has_payload()) { if (payload_ != &::google::protobuf::internal::kEmptyString) { payload_->clear(); } } } xid_.Clear(); ::memset(_has_bits_, 0, sizeof(_has_bits_)); mutable_unknown_fields()->Clear(); } bool msg_response::MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) { #define DO_(EXPRESSION) if (!(EXPRESSION)) return false ::google::protobuf::uint32 tag; while ((tag = input->ReadTag()) != 0) { switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // required int32 appid = 1; case 1: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( input, &appid_))); set_has_appid(); } else { goto handle_uninterpreted; } if (input->ExpectTag(18)) goto parse_xid; break; } // repeated bytes xid = 2; case 2: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { parse_xid: DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( input, this->add_xid())); } else { goto handle_uninterpreted; } if (input->ExpectTag(18)) goto parse_xid; if (input->ExpectTag(26)) goto parse_payload; break; } // optional string payload = 3; case 3: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { parse_payload: DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_payload())); ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->payload().data(), this->payload().length(), ::google::protobuf::internal::WireFormat::PARSE); } else { goto handle_uninterpreted; } if (input->ExpectAtEnd()) return true; break; } default: { handle_uninterpreted: if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { return true; } DO_(::google::protobuf::internal::WireFormat::SkipField( input, tag, mutable_unknown_fields())); break; } } } return true; #undef DO_ } void msg_response::SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const { // required int32 appid = 1; if (has_appid()) { ::google::protobuf::internal::WireFormatLite::WriteInt32(1, this->appid(), output); } // repeated bytes xid = 2; for (int i = 0; i < this->xid_size(); i++) { ::google::protobuf::internal::WireFormatLite::WriteBytes( 2, this->xid(i), output); } // optional string payload = 3; if (has_payload()) { ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->payload().data(), this->payload().length(), ::google::protobuf::internal::WireFormat::SERIALIZE); ::google::protobuf::internal::WireFormatLite::WriteString( 3, this->payload(), output); } if (!unknown_fields().empty()) { ::google::protobuf::internal::WireFormat::SerializeUnknownFields( unknown_fields(), output); } } ::google::protobuf::uint8* msg_response::SerializeWithCachedSizesToArray( ::google::protobuf::uint8* target) const { // required int32 appid = 1; if (has_appid()) { target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(1, this->appid(), target); } // repeated bytes xid = 2; for (int i = 0; i < this->xid_size(); i++) { target = ::google::protobuf::internal::WireFormatLite:: WriteBytesToArray(2, this->xid(i), target); } // optional string payload = 3; if (has_payload()) { ::google::protobuf::internal::WireFormat::VerifyUTF8String( this->payload().data(), this->payload().length(), ::google::protobuf::internal::WireFormat::SERIALIZE); target = ::google::protobuf::internal::WireFormatLite::WriteStringToArray( 3, this->payload(), target); } if (!unknown_fields().empty()) { target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( unknown_fields(), target); } return target; } int msg_response::ByteSize() const { int total_size = 0; if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { // required int32 appid = 1; if (has_appid()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( this->appid()); } // optional string payload = 3; if (has_payload()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( this->payload()); } } // repeated bytes xid = 2; total_size += 1 * this->xid_size(); for (int i = 0; i < this->xid_size(); i++) { total_size += ::google::protobuf::internal::WireFormatLite::BytesSize( this->xid(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 msg_response::MergeFrom(const ::google::protobuf::Message& from) { GOOGLE_CHECK_NE(&from, this); const msg_response* source = ::google::protobuf::internal::dynamic_cast_if_available<const msg_response*>( &from); if (source == NULL) { ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { MergeFrom(*source); } } void msg_response::MergeFrom(const msg_response& from) { GOOGLE_CHECK_NE(&from, this); xid_.MergeFrom(from.xid_); if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { if (from.has_appid()) { set_appid(from.appid()); } if (from.has_payload()) { set_payload(from.payload()); } } mutable_unknown_fields()->MergeFrom(from.unknown_fields()); } void msg_response::CopyFrom(const ::google::protobuf::Message& from) { if (&from == this) return; Clear(); MergeFrom(from); } void msg_response::CopyFrom(const msg_response& from) { if (&from == this) return; Clear(); MergeFrom(from); } bool msg_response::IsInitialized() const { if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false; return true; } void msg_response::Swap(msg_response* other) { if (other != this) { std::swap(appid_, other->appid_); xid_.Swap(&other->xid_); std::swap(payload_, other->payload_); 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 msg_response::GetMetadata() const { protobuf_AssignDescriptorsOnce(); ::google::protobuf::Metadata metadata; metadata.descriptor = msg_response_descriptor_; metadata.reflection = msg_response_reflection_; return metadata; } // @@protoc_insertion_point(namespace_scope) } // namespace xia // @@protoc_insertion_point(global_scope)
5595af7f68dd7d8ab4c7e3435d1b80c4191f57ae
0a233295302a4a0160963ae835aad6fc3f1ac683
/BitManipulation/16.01.cpp
5d6c1f1d1f9c88251d267ede1580e26c3e203720
[]
no_license
MregXN/Leetcode
90e4851699d1275416c21ce53623cfcba43d1a32
fa570fb744d7b97d600e3254ba17121deecee959
refs/heads/master
2023-01-13T01:22:40.835827
2020-10-30T11:53:17
2020-10-30T11:53:17
267,321,023
0
0
null
null
null
null
UTF-8
C++
false
false
219
cpp
class Solution { public: vector<int> swapNumbers(vector<int>& numbers) { numbers[0] ^= numbers[1]; numbers[1] ^= numbers[0]; numbers[0] ^= numbers[1]; return numbers; } };
[ "“[email protected]”" ]
d3011b6c0520e4ca60f8a970c0239f64399eeeb0
b16236a633a566d171ec069bfa36cb7116a191d2
/compiler1/P1/globals.h
a469bd1f02c1499562625e2277c9cd122c360ee2
[]
no_license
daralim1987/cmpsci4280
273ee7cbe833ee2d6d3259660a4adf79c0964eb9
fd8837d9915115d32e315876f41a7e306dfbbe98
refs/heads/master
2020-11-25T23:17:17.670787
2019-12-18T17:02:33
2019-12-18T17:02:33
228,886,221
0
0
null
null
null
null
UTF-8
C++
false
false
168
h
/* * William Moll * CS4280 * Project P1 * */ #ifndef GLOBALS_H #define GLOBALS_H #include <string> extern std::string file_extension; #endif /* GLOBALS_H */
de203e89f1367445af5fb581293c3909ea861814
874108607f5534f884e03a857c47442ed15d8129
/nodeedit/CalenhadView.cpp
4c14645d81c97a5df428ad124b541ff2e35d980e
[]
no_license
MAPSWorks/calenhad-GIS-and-terrain-creation-for-imaginary-worlds
9b40f6f1ce5dd5730701d4fe50b2206d313063e0
7cfcf586ce0a8d271146826611c2624615207c35
refs/heads/master
2020-04-06T21:31:57.559570
2019-12-08T17:03:27
2019-12-08T17:03:27
null
0
0
null
null
null
null
UTF-8
C++
false
false
7,261
cpp
// // Created by martin on 27/10/16. // #include "CalenhadView.h" #include "Calenhad.h" #include "CalenhadController.h" #include "../pipeline/CalenhadModel.h" #include "module/NodeGroup.h" #include <QDragEnterEvent> #include <QMimeData> #include <CalenhadServices.h> #include "../preferences/PreferencesService.h" using namespace calenhad::pipeline; using namespace calenhad::nodeedit; CalenhadView::CalenhadView (QWidget* parent) : QGraphicsView (parent) { setDragMode (QGraphicsView::ScrollHandDrag); setRubberBandSelectionMode (Qt::ContainsItemShape); setRenderHints (QPainter::Antialiasing | QPainter::SmoothPixmapTransform); setZoom (CalenhadServices::preferences() -> calenhad_desktop_zoom_default); } CalenhadView::~CalenhadView() = default; void CalenhadView::setZoom (const qreal& z) { qreal factor = z / zoom; scale (factor, factor); zoom = z; QTransform xf = transform(); double oldZoom = zoom; zoom = (xf.m11 () + xf.m22 ()) / 2; emit viewZoomed (oldZoom, zoom); } double CalenhadView::currentZoom() { return zoom; } void CalenhadView::setController (CalenhadController* controller) { if (! _controller) { _controller = controller; } } void CalenhadView::dragEnterEvent (QDragEnterEvent *event) { if (event -> mimeData() -> hasFormat("application/x-dnditemdata")) { if (event -> source() == this) { event -> setDropAction(Qt::MoveAction); event -> accept(); } else { event->acceptProposedAction(); } } else { event -> ignore(); } } void CalenhadView::dragMoveEvent(QDragMoveEvent *event) { //QPointF pos = mapToScene (event -> pos()); if (event->mimeData()->hasFormat("application/x-dnditemdata")) { if (event -> source() == this) { event -> setDropAction(Qt::MoveAction); } else { event -> acceptProposedAction(); } } else { event -> ignore(); } scene() -> update (); } void CalenhadView::dropEvent(QDropEvent *event) { if (event -> mimeData ()->hasFormat ("application/x-dnditemdata")) { QByteArray itemData = event -> mimeData () -> data ("application/x-dnditemdata"); QDataStream dataStream (&itemData, QIODevice::ReadOnly); QPixmap pixmap; QString type; //dataStream >> pixmap >> type; dataStream >> type; QPointF pos = mapToScene (event -> pos()); ((CalenhadModel*) scene ())->doCreateNode (pos, type); if (event -> source() == this) { event -> setDropAction (Qt::MoveAction); event -> accept (); } else { event -> acceptProposedAction (); } } else { event -> ignore (); } } void CalenhadView::wheelEvent (QWheelEvent* event) { if (event -> angleDelta().y() > 0) { emit zoomInRequested(); } else { emit zoomOutRequested(); } } void CalenhadView::drawBackground(QPainter *painter, const QRectF &rect) { // thanks to Bitto at QtCentre for this - https://www.qtcentre.org/threads/5609-Drawing-grids-efficiently-in-QGraphicsScene QGraphicsView::drawBackground (painter, rect); if (gridVisible()) { QPen majorPen; QPen minorPen; majorPen.setColor (CalenhadServices::preferences ()->calenhad_desktop_grid_major_color); majorPen.setStyle (Qt::PenStyle (CalenhadServices::preferences ()->calenhad_desktop_grid_major_style)); majorPen.setWidth (CalenhadServices::preferences ()->calenhad_desktop_grid_major_weight); minorPen.setColor (CalenhadServices::preferences ()->calenhad_desktop_grid_minor_color); minorPen.setStyle (Qt::PenStyle (CalenhadServices::preferences ()->calenhad_desktop_grid_minor_style)); minorPen.setWidth (CalenhadServices::preferences ()->calenhad_desktop_grid_minor_weight); QRectF r = mapToScene (viewport ()->geometry ()).boundingRect (); int gridSize = CalenhadServices::preferences ()->calenhad_desktop_grid_density; int steps = CalenhadServices::preferences() -> calenhad_desktop_grid_major_steps; int offset = gridSize * (steps + 1); qreal minorLeft = (int (r.left ()) - (int (r.left ())) % offset) - offset; qreal minorTop = (int (r.top ()) - (int (r.top ())) % offset) - offset; QVector<QLineF> minorLines, majorLines; painter->setPen (minorPen); int i = 0, j = 0; for (qreal x = minorLeft; x < r.right (); x += gridSize) { QLineF l (x, r.top (), x, r.bottom ()); minorLines.append (l); if (i++ == steps) { i = 0; majorLines.append (l); } } for (qreal y = minorTop; y < r.bottom (); y += gridSize) { QLineF l (r.left (), y, r.right (), y); minorLines.append (l); if (j++ == steps) { j = 0; majorLines.append (l); } } painter->drawLines (minorLines.data (), minorLines.size ()); painter->setPen (majorPen); painter->drawLines (majorLines.data (), majorLines.size ()); } } void CalenhadView::setGridVisible (const bool& visible) { CalenhadServices::preferences() -> calenhad_desktop_grid_visible = visible; update(); } bool CalenhadView::gridVisible() { return CalenhadServices::preferences() -> calenhad_desktop_grid_visible; } void CalenhadView::setSnapToGrid (const bool& enabled) { CalenhadServices::preferences() -> calenhad_desktop_grid_snap = enabled; update(); } bool CalenhadView::snapToGrid() { return CalenhadServices::preferences() -> calenhad_desktop_grid_snap; } void CalenhadView::setModel (CalenhadModel* model) { setScene (model); connect (model, &QGraphicsScene::changed, this, &CalenhadView::modelChanged); } // Whnever the model changes we resize the canvas to its new bounds so that the view pans appropriately. // This code comes from apalomer on StackOverflow 7 March 2019 (adapted for house style) // https://stackoverflow.com/questions/55007339/allow-qgraphicsview-to-move-outside-scene void CalenhadView::modelChanged() { // Widget viewport recangle QRectF rectInScene (mapToScene (-20, -20), mapToScene (rect().bottomRight() + QPoint(20, 20))); // Copy the new size from the old one QPointF newTopLeft (sceneRect().topLeft()); QPointF newBottomRight (sceneRect().bottomRight()); // Check that the scene has a bigger limit in the top side if (sceneRect().top() > rectInScene.top()) { newTopLeft.setY (rectInScene.top()); } // Check that the scene has a bigger limit in the bottom side if (sceneRect().bottom() < rectInScene.bottom()) { newBottomRight.setY (rectInScene.bottom()); } // Check that the scene has a bigger limit in the left side if (sceneRect().left() > rectInScene.left()) { newTopLeft.setX (rectInScene.left()); } // Check that the scene has a bigger limit in the right side if (sceneRect().right() < rectInScene.right()) { newBottomRight.setX (rectInScene.right()); } // Set new scene size setSceneRect (QRectF(newTopLeft, newBottomRight)); }