hexsha
stringlengths 40
40
| size
int64 7
1.05M
| ext
stringclasses 13
values | lang
stringclasses 1
value | max_stars_repo_path
stringlengths 4
269
| max_stars_repo_name
stringlengths 5
109
| max_stars_repo_head_hexsha
stringlengths 40
40
| max_stars_repo_licenses
listlengths 1
9
| max_stars_count
int64 1
191k
⌀ | max_stars_repo_stars_event_min_datetime
stringlengths 24
24
⌀ | max_stars_repo_stars_event_max_datetime
stringlengths 24
24
⌀ | max_issues_repo_path
stringlengths 4
269
| max_issues_repo_name
stringlengths 5
116
| max_issues_repo_head_hexsha
stringlengths 40
40
| max_issues_repo_licenses
listlengths 1
9
| max_issues_count
int64 1
48.5k
⌀ | max_issues_repo_issues_event_min_datetime
stringlengths 24
24
⌀ | max_issues_repo_issues_event_max_datetime
stringlengths 24
24
⌀ | max_forks_repo_path
stringlengths 4
269
| max_forks_repo_name
stringlengths 5
116
| max_forks_repo_head_hexsha
stringlengths 40
40
| max_forks_repo_licenses
listlengths 1
9
| max_forks_count
int64 1
105k
⌀ | max_forks_repo_forks_event_min_datetime
stringlengths 24
24
⌀ | max_forks_repo_forks_event_max_datetime
stringlengths 24
24
⌀ | content
stringlengths 7
1.05M
| avg_line_length
float64 1.21
330k
| max_line_length
int64 6
990k
| alphanum_fraction
float64 0.01
0.99
| author_id
stringlengths 2
40
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
040ba98d9766871e116a3362d484b066a11fd83d
| 282
|
cpp
|
C++
|
Basic-Programming/Recursion/variable 2.cpp
|
arifparvez14/Basic-and-competetive-programming
|
4cb9ee7fbed3c70307d0f63499fcede86ed3c732
|
[
"MIT"
] | null | null | null |
Basic-Programming/Recursion/variable 2.cpp
|
arifparvez14/Basic-and-competetive-programming
|
4cb9ee7fbed3c70307d0f63499fcede86ed3c732
|
[
"MIT"
] | null | null | null |
Basic-Programming/Recursion/variable 2.cpp
|
arifparvez14/Basic-and-competetive-programming
|
4cb9ee7fbed3c70307d0f63499fcede86ed3c732
|
[
"MIT"
] | null | null | null |
#include<bits/stdc++.h>
using namespace std;
int x=1;
void myfunc(int y)
{
y = y * 2;
x = x + 10;
printf("Value inside myfunc,x:%d and y:%d\n",x,y);
}
int main()
{
int y=5;
x=10;
myfunc(y);
printf("Value inside main,x:%d and y:%d",x,y);
return 0;
}
| 14.842105
| 54
| 0.535461
|
arifparvez14
|
040f916f455594c396309ad8c777580543648548
| 8,934
|
cpp
|
C++
|
src/apps/network/main.cpp
|
inviwo/sgct
|
1b81860af3d8493526fe03343cfc49218830c9ef
|
[
"libpng-2.0"
] | null | null | null |
src/apps/network/main.cpp
|
inviwo/sgct
|
1b81860af3d8493526fe03343cfc49218830c9ef
|
[
"libpng-2.0"
] | null | null | null |
src/apps/network/main.cpp
|
inviwo/sgct
|
1b81860af3d8493526fe03343cfc49218830c9ef
|
[
"libpng-2.0"
] | null | null | null |
/*****************************************************************************************
* SGCT *
* Simple Graphics Cluster Toolkit *
* *
* Copyright (c) 2012-2020 *
* For conditions of distribution and use, see copyright notice in LICENSE.md *
****************************************************************************************/
#include <sgct/sgct.h>
#include <sgct/opengl.h>
#include <sgct/utils/box.h>
#include <fmt/format.h>
#include <glm/glm.hpp>
#include <glm/gtc/type_ptr.hpp>
namespace {
std::unique_ptr<std::thread> connectionThread;
std::atomic_bool connected = false;
std::atomic_bool running = true;
unsigned int textureId = 0;
std::unique_ptr<sgct::utils::Box> box;
GLint matrixLoc = -1;
double currentTime(0.0);
int port;
std::string address;
bool isServer = false;
std::unique_ptr<sgct::Network> networkPtr;
std::pair<double, int> timerData;
constexpr const char* vertexShader = R"(
#version 330 core
layout(location = 0) in vec2 texCoords;
layout(location = 1) in vec3 normals;
layout(location = 2) in vec3 vertPositions;
uniform mat4 mvp;
out vec2 uv;
void main() {
gl_Position = mvp * vec4(vertPositions, 1.0);
uv = texCoords;
})";
constexpr const char* fragmentShader = R"(
#version 330 core
uniform sampler2D tex;
in vec2 uv;
out vec4 color;
void main() { color = texture(tex, uv); }
)";
} // namespace
using namespace sgct;
void networkConnectionUpdated(Network* conn) {
if (conn->isServer()) {
// wake up the connection handler thread on server if node disconnects to enable
// reconnection
conn->startConnectionConditionVar().notify_all();
}
connected = conn->isConnected();
Log::Info(fmt::format(
"Network is {}", conn->isConnected() ? "connected" : "disconneced"
));
}
void networkAck(int packageId, int) {
Log::Info(fmt::format("Network package {} is received", packageId));
if (timerData.second == packageId) {
Log::Info(fmt::format(
"Loop time: {} ms", (Engine::getTime() - timerData.first) * 1000.0
));
}
}
void networkDecode(void* receivedData, int receivedLength, int packageId, int) {
Log::Info(fmt::format("Network decoding package {}", packageId));
std::string test(reinterpret_cast<char*>(receivedData), receivedLength);
Log::Info(fmt::format("Message: \"{}\"", test));
}
void connect() {
if (!Engine::instance().isMaster()) {
return;
}
// no need to specify the address on the host/server
if (!isServer && address.empty()) {
Log::Error("Network error: No address set");
return;
}
networkPtr = std::make_unique<Network>(
port,
address,
isServer,
Network::ConnectionType::DataTransfer
);
// init
try {
Log::Debug(fmt::format("Initiating network connection at port {}", port));
networkPtr->setUpdateFunction(networkConnectionUpdated);
networkPtr->setPackageDecodeFunction(networkDecode);
networkPtr->setAcknowledgeFunction(networkAck);
networkPtr->initialize();
}
catch (const std::runtime_error& err) {
Log::Error(fmt::format("Network error: {}", err.what()));
networkPtr->initShutdown();
std::this_thread::sleep_for(std::chrono::seconds(1));
networkPtr->closeNetwork(true);
return;
}
connected = true;
}
void networkLoop() {
connect();
// if client try to connect to server even after disconnection
if (!isServer) {
while (running.load()) {
if (connected.load() == false) {
connect();
}
else {
// just check if connected once per second
std::this_thread::sleep_for(std::chrono::seconds(1));
}
}
}
}
void disconnect() {
if (networkPtr) {
networkPtr->initShutdown();
// wait for all nodes callbacks to run
std::this_thread::sleep_for(std::chrono::milliseconds(250));
// wait for threads to die
networkPtr->closeNetwork(false);
networkPtr = nullptr;
}
}
void sendData(const void* data, int length, int id) {
if (networkPtr) {
NetworkManager::instance().transferData(data, length, id, *networkPtr);
timerData.first = Engine::getTime();
timerData.second = id;
}
}
void sendTestMessage() {
std::string test = "What's up?";
static int counter = 0;
sendData(test.data(), static_cast<int>(test.size()), counter);
counter++;
}
void draw(const RenderData& data) {
glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
constexpr const double Speed = 0.44;
//create scene transform (animation)
glm::mat4 scene = glm::translate(glm::mat4(1.f), glm::vec3(0.f, 0.f, -3.f));
scene = glm::rotate(
scene,
static_cast<float>(currentTime * Speed),
glm::vec3(0.f, -1.f, 0.f)
);
scene = glm::rotate(
scene,
static_cast<float>(currentTime * (Speed / 2.0)),
glm::vec3(1.f, 0.f, 0.f)
);
const glm::mat4 mvp = glm::make_mat4(data.modelViewProjectionMatrix.values) * scene;
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, textureId);
ShaderManager::instance().shaderProgram("xform").bind();
glUniformMatrix4fv(matrixLoc, 1, GL_FALSE, glm::value_ptr(mvp));
box->draw();
ShaderManager::instance().shaderProgram("xform").unbind();
glDisable(GL_CULL_FACE);
glDisable(GL_DEPTH_TEST);
}
void preSync() {
if (Engine::instance().isMaster()) {
currentTime = Engine::getTime();
}
}
void initOGL(GLFWwindow*) {
textureId = TextureManager::instance().loadTexture("box.png", true, 8.f);
box = std::make_unique<utils::Box>(2.f, utils::Box::TextureMappingMode::Regular);
// Set up backface culling
glCullFace(GL_BACK);
glFrontFace(GL_CCW);
ShaderManager::instance().addShaderProgram(
"xform",
vertexShader,
fragmentShader
);
const ShaderProgram& prg = ShaderManager::instance().shaderProgram("xform");
prg.bind();
matrixLoc = glGetUniformLocation(prg.id(), "mvp");
glUniform1i(glGetUniformLocation(prg.id(), "tex"), 0 );
prg.unbind();
for (const std::unique_ptr<Window>& win : Engine::instance().windows()) {
win->setWindowTitle(isServer ? "SERVER" : "CLIENT");
}
}
std::vector<std::byte> encode() {
std::vector<std::byte> data;
serializeObject(data, currentTime);
return data;
}
void decode(const std::vector<std::byte>& data, unsigned int pos) {
deserializeObject(data, pos, currentTime);
}
void cleanup() {
box = nullptr;
running = false;
if (connectionThread) {
if (networkPtr) {
networkPtr->initShutdown();
}
connectionThread->join();
connectionThread = nullptr;
}
disconnect();
}
void keyboard(Key key, Modifier, Action action, int) {
if (Engine::instance().isMaster() && action == Action::Press) {
if (key == Key::Esc) {
Engine::instance().terminate();
}
else if (key == Key::Space) {
sendTestMessage();
}
}
}
int main(int argc, char** argv) {
std::vector<std::string> arg(argv + 1, argv + argc);
Configuration config = parseArguments(arg);
config::Cluster cluster = loadCluster(config.configFilename);
for (int i = 0; i < argc; i++) {
std::string_view v(argv[i]);
if (v == "-port" && argc > (i + 1)) {
port = std::stoi(argv[i + 1]);
Log::Info(fmt::format("Setting port to: {}", port));
}
else if (v == "-address" && argc > (i + 1)) {
address = argv[i + 1];
Log::Info(fmt::format("Setting address to: {}", address));
}
else if (v == "--server") {
isServer = true;
Log::Info("This computer will host the connection");
}
}
Engine::Callbacks callbacks;
callbacks.initOpenGL = initOGL;
callbacks.preSync = preSync;
callbacks.encode = encode;
callbacks.decode = decode;
callbacks.draw = draw;
callbacks.cleanup = cleanup;
callbacks.keyboard = keyboard;
try {
Engine::create(cluster, callbacks, config);
}
catch (const std::runtime_error& e) {
Log::Error(e.what());
Engine::destroy();
return EXIT_FAILURE;
}
connectionThread = std::make_unique<std::thread>(networkLoop);
Engine::instance().render();
Engine::destroy();
exit(EXIT_SUCCESS);
}
| 27.831776
| 90
| 0.573763
|
inviwo
|
04119933a8ffff68b1ebbbfee2b0c6812d42b967
| 24,325
|
cc
|
C++
|
crv/crvQuality.cc
|
cwsmith/core
|
840fbf6ec49a63aeaa3945f11ddb224f6055ac9f
|
[
"BSD-3-Clause"
] | 138
|
2015-01-05T15:50:20.000Z
|
2022-02-25T01:09:58.000Z
|
crv/crvQuality.cc
|
cwsmith/core
|
840fbf6ec49a63aeaa3945f11ddb224f6055ac9f
|
[
"BSD-3-Clause"
] | 337
|
2015-08-07T18:24:58.000Z
|
2022-03-31T14:39:03.000Z
|
crv/crvQuality.cc
|
cwsmith/core
|
840fbf6ec49a63aeaa3945f11ddb224f6055ac9f
|
[
"BSD-3-Clause"
] | 70
|
2015-01-17T00:58:41.000Z
|
2022-02-13T04:58:20.000Z
|
/*
* Copyright 2015 Scientific Computation Research Center
*
* This work is open source software, licensed under the terms of the
* BSD license as described in the LICENSE file in the top-level directory.
*/
#include "crv.h"
#include "crvBezier.h"
#include "crvBezierShapes.h"
#include "crvMath.h"
#include "crvTables.h"
#include "crvQuality.h"
namespace crv {
static int maxAdaptiveIter = 5;
static int maxElevationLevel = 19;
static double minAcceptable = 0.0;
static double convergenceTolerance = 0.01;
class Quality2D : public Quality
{
public:
Quality2D(apf::Mesh* m, int algorithm) : Quality(m,algorithm)
{
blendingOrder = getBlendingOrder(apf::Mesh::TRIANGLE);
if ( blendingOrder > 0 &&
getNumInternalControlPoints(apf::Mesh::TRIANGLE,order)){
getInternalBezierTransformationCoefficients(mesh,order,
blendingOrder,apf::Mesh::TRIANGLE,blendingCoeffs);
}
n = getNumControlPoints(apf::Mesh::TRIANGLE,2*(order-1));
if (algorithm == 0 || algorithm == 2){
for (int d = 1; d <= 2; ++d)
getBezierJacobianDetSubdivisionCoefficients(
2*(order-1),apf::Mesh::simplexTypes[d],subdivisionCoeffs[d]);
}
};
virtual ~Quality2D() {};
double getQuality(apf::MeshEntity* e);
int checkValidity(apf::MeshEntity* e);
int blendingOrder;
int n;
apf::NewArray<double> blendingCoeffs;
apf::NewArray<double> subdivisionCoeffs[3];
};
class Quality3D : public Quality
{
public:
Quality3D(apf::Mesh* m, int algorithm) : Quality(m,algorithm)
{
if (algorithm == 0 || algorithm == 2){
for (int d = 1; d <= 3; ++d)
getBezierJacobianDetSubdivisionCoefficients(
3*(order-1),apf::Mesh::simplexTypes[d],subdivisionCoeffs[d]);
}
n = getNumControlPoints(apf::Mesh::TET,3*(order-1));
xi.allocate(n);
transformationMatrix.resize(n,n);
mth::Matrix<double> A(n,n);
collectNodeXi(apf::Mesh::TET,apf::Mesh::TET,3*(order-1),
elem_vert_xi[apf::Mesh::TET],xi);
getBezierTransformationMatrix(apf::Mesh::TET,3*(order-1),A,
elem_vert_xi[apf::Mesh::TET]);
invertMatrixWithPLU(n,A,transformationMatrix);
}
virtual ~Quality3D() {};
double getQuality(apf::MeshEntity* e);
int checkValidity(apf::MeshEntity* e);
// 3D uses an alternate method of computing these
// returns a validity tag so both quality and validity can
// quit early if this function thinks they should
// if validity = true, quit if its obvious the element is invalid
int computeJacDetNodes(apf::MeshEntity* e,
apf::NewArray<double>& nodes, bool validity);
int n;
apf::NewArray<double> subdivisionCoeffs[4];
apf::NewArray<apf::Vector3> xi;
mth::Matrix<double> transformationMatrix;
};
Quality* makeQuality(apf::Mesh* m, int algorithm)
{
if (m->getDimension() == 2)
return new Quality2D(m,algorithm);
else if (m->getDimension() == 3)
return new Quality3D(m,algorithm);
return 0;
}
/* Set up quality object, computing matrices that are used frequently */
Quality::Quality(apf::Mesh* m, int algorithm_) :
mesh(m), algorithm(algorithm_)
{
PCU_ALWAYS_ASSERT(algorithm >= 0 && algorithm <= 2);
order = mesh->getShape()->getOrder();
PCU_ALWAYS_ASSERT(order >= 1);
};
/* This work is based on the approach of Geometric Validity of high-order
* lagrange finite elements, theory and practical guidance,
* by George, Borouchaki, and Barral. (2014)
*
* The notation follows theirs, almost exactly.
*/
static double getTriPartialJacobianDet(apf::NewArray<apf::Vector3>& nodes,
int P, int i1, int j1, int i2, int j2)
{
int p00 = getTriNodeIndex(P,i1+1,j1);
int p01 = getTriNodeIndex(P,i1,j1+1);
int p10 = getTriNodeIndex(P,i2+1,j2);
int p11 = getTriNodeIndex(P,i2,j2);
return apf::cross(nodes[p01]-nodes[p00],
nodes[p11]-nodes[p10])[2];
}
static double getTetPartialJacobianDet(apf::NewArray<apf::Vector3>& nodes,
int P, int i1, int j1, int k1, int i2, int j2, int k2,
int i3, int j3, int k3)
{
int p00 = getTetNodeIndex(P,i1+1,j1,k1);
int p01 = getTetNodeIndex(P,i1,j1+1,k1);
int p10 = getTetNodeIndex(P,i2+1,j2,k2);
int p11 = getTetNodeIndex(P,i2,j2,k2+1);
int p20 = getTetNodeIndex(P,i3+1,j3,k3);
int p21 = getTetNodeIndex(P,i3,j3,k3);
return apf::cross(nodes[p01]-nodes[p00],nodes[p11]-nodes[p10])
*(nodes[p21]-nodes[p20]);
}
/* These two functions are in George, Borouchaki, and Barral. (2014)
*
* The math is not fun, and they are for loop madness. They exist
* because it was the first implementation, I have since switched
* to a different approach to computing jacobian determinant
* control points
*
* the 2D one exists, because the other approach does not quite work for
* 2D planar meshes.
*
*/
static double Nijk(apf::NewArray<apf::Vector3>& nodes,
int d, int I, int J)
{
double sum = 0.;
int CD = trinomial(2*(d-1),I,J);
for(int j1 = 0; j1 <= J; ++j1){
int i1start = std::max(0,I+J-j1-(d-1));
int i1end = std::min(I,d-1-j1);
for(int i1 = i1start; i1 <= i1end; ++i1){
sum += trinomial(d-1,i1,j1)*trinomial(d-1,I-i1,J-j1)
*getTriPartialJacobianDet(nodes,d,i1,j1,I-i1,J-j1);
}
}
return sum*d*d/CD;
}
static double Nijkl(apf::NewArray<apf::Vector3>& nodes,
int d, int I, int J, int K)
{
double sum = 0.;
int CD = quadnomial(3*(d-1),I,J,K);
for(int k1 = 0; k1 <= K; ++k1){
int k2start = std::max(0,K-k1-(d-1));
for (int k2 = k2start; k2 <= K-k1; ++k2){
for (int j1 = 0; j1 <= J; ++j1){
int j2start = std::max(0,J-j1-(d-1));
for (int j2 = j2start; j2 <= J-j1; ++j2){
int i1end = std::min(I,d-1-j1-k1);
for (int i1 = 0; i1 <= i1end; ++i1){
int i2start = std::max(0,I+J+K-i1-j1-k1-j2-k2-(d-1));
int i2end = std::min(I-i1,d-1-j2-k2);
for (int i2 = i2start; i2 <= i2end; ++i2){
int i3 = I-i1-i2;
int j3 = J-j1-j2;
int k3 = K-k1-k2;
sum += quadnomial(d-1,i1,j1,k1)*quadnomial(d-1,i2,j2,k2)
*quadnomial(d-1,i3,j3,k3)
*getTetPartialJacobianDet(nodes,d,i1,j1,k1,i2,j2,k2,i3,j3,k3);
}
}
}
}
}
}
return sum*d*d*d/CD;
}
static double calcMinJacDet(int n, apf::NewArray<double>& nodes)
{
double minJ = 1e10;
for (int i = 0; i < n; ++i)
minJ = std::min(minJ,nodes[i]);
return minJ;
}
static double calcMaxJacDet(int n, apf::NewArray<double>& nodes)
{
double maxJ = -1e10;
for (int i = 0; i < n; ++i)
maxJ = std::max(maxJ,nodes[i]);
return maxJ;
}
/* nodes is (2(P-1)+1)(2(P-1)+2)/2 = P(2P-1)
* except for P = 1, which has size 3 due to numbering convention used,
* such that i=j=k=0 results in index 2
*
* these are not actively used, other than to debug and double check other
* algorithms. The cost of compute Nijkl is significant (and the for loops
* are ugly), so for now, lets compute things using Remacle's approach.
*/
static void getTriJacDetNodes(int P, apf::NewArray<apf::Vector3>& elemNodes,
apf::NewArray<double>& nodes)
{
for (int I = 0; I <= 2*(P-1); ++I)
for (int J = 0; J <= 2*(P-1)-I; ++J)
nodes[getTriNodeIndex(2*(P-1),I,J)] = Nijk(elemNodes,P,I,J);
}
//static void getTetJacDetNodes(int P, apf::NewArray<apf::Vector3>& elemNodes,
// apf::NewArray<double>& nodes)
//{
// for (int I = 0; I <= 3*(P-1); ++I)
// for (int J = 0; J <= 3*(P-1)-I; ++J)
// for (int K = 0; K <= 3*(P-1)-I-J; ++K)
// nodes[getTetNodeIndex(3*(P-1),I,J,K)] = Nijkl(elemNodes,P,I,J,K);
//}
/*
* This is the elevation version of this algorithm
* There is no recursion needed, at least not yet
*
*/
static void getJacDetByElevation(int type, int P,
apf::NewArray<double>& nodes, double& minJ, double& maxJ)
{
/*
* as a convergence check, use the max dist between points
*/
double maxDist[2] = {0.,1e10};
int n = getNumControlPoints(type,P);
minJ = calcMinJacDet(n,nodes);
maxJ = calcMaxJacDet(n,nodes);
maxDist[0] = nodes[1]-nodes[0];
for (int j = 1; j < n-1; ++j)
maxDist[0] = std::max(maxDist[0],nodes[j+1]-nodes[j]);
// declare these two arrays, never need to reallocate
apf::NewArray<double> elevatedNodes[2];
elevatedNodes[0].allocate(getNumControlPoints(type,maxElevationLevel));
elevatedNodes[1].allocate(getNumControlPoints(type,maxElevationLevel));
// copy for the start
for(int i = 0; i < n; ++i)
elevatedNodes[0][i] = nodes[i];
int i = 0;
while(P+i < maxElevationLevel && minJ/maxJ < minAcceptable
&& std::fabs(maxDist[(i+1) % 2] - maxDist[i % 2]) > convergenceTolerance){
// use the modulus to alternate between them,
// never needing to increase storage
// for now, only elevate by 1
elevateBezierJacobianDet(type,P+i,1,
elevatedNodes[i % 2],
elevatedNodes[(i+1) % 2]);
int ni = getNumControlPoints(type,P+i);
maxDist[(i+1) % 2] = elevatedNodes[(i+1) % 2][1]-elevatedNodes[(i+1) % 2][0];
for (int j = 1; j < ni-1; ++j)
maxDist[(i+1) % 2] = std::max(elevatedNodes[(i+1) % 2][j+1]
- elevatedNodes[(i+1) % 2][j],maxDist[(i+1) % 2]);
minJ = calcMinJacDet(ni,elevatedNodes[(i+1) % 2]);
maxJ = calcMaxJacDet(ni,elevatedNodes[(i+1) % 2]);
++i;
}
}
/*
* This is the subdivision version, with recursion
*
*/
static int numSplits[apf::Mesh::TYPES] =
{0,2,4,0,8,0,0,0};
static void getJacDetBySubdivision(int type, int P,
int iter, apf::NewArray<double>& nodes,
double& minJ, double& maxJ, bool& done)
{
int n = getNumControlPoints(type,P);
double change = minJ;
if(!done){
minJ = calcMinJacDet(n,nodes);
maxJ = calcMaxJacDet(n,nodes);
change = minJ - change;
}
if(!done && iter < maxAdaptiveIter && minJ/maxJ < minAcceptable
&& std::fabs(change) > convergenceTolerance){
iter++;
apf::NewArray<double> subNodes[8];
for (int i = 0; i < numSplits[type]; ++i)
subNodes[i].allocate(n);
subdivideBezierJacobianDet[type](P,nodes,subNodes);
apf::NewArray<double> newMinJ(numSplits[type]);
apf::NewArray<double> newMaxJ(numSplits[type]);
for (int i = 0; i < numSplits[type]; ++i){
newMinJ[i] = 1e10;
newMaxJ[i] = -1e10;
}
for (int i = 0; i < numSplits[type]; ++i)
getJacDetBySubdivision(type,P,iter,subNodes[i],
newMinJ[i],newMaxJ[i],done);
minJ = newMinJ[0];
maxJ = newMaxJ[0];
for (int i = 1; i < numSplits[type]; ++i){
minJ = std::min(newMinJ[i],minJ);
maxJ = std::max(newMaxJ[i],maxJ);
}
} else if (minJ/maxJ < minAcceptable){
done = true;
}
}
static void getJacDetBySubdivisionMatrices(int type, int P,
int iter, apf::NewArray<double>& c,apf::NewArray<double>& nodes,
double& minJ, double& maxJ, bool& done, bool& quality)
{
int n = getNumControlPoints(type,P);
double change = minJ;
if(!done){
minJ = calcMinJacDet(n,nodes);
maxJ = calcMaxJacDet(n,nodes);
change = minJ - change;
}
if(!done && iter < maxAdaptiveIter && (quality || minJ/maxJ < minAcceptable)
&& std::fabs(change) > convergenceTolerance){
iter++;
apf::NewArray<double> subNodes[8];
for (int i = 0; i < numSplits[type]; ++i)
subNodes[i].allocate(n);
subdivideBezierEntityJacobianDet(P,type,c,nodes,subNodes);
apf::NewArray<double> newMinJ(numSplits[type]);
apf::NewArray<double> newMaxJ(numSplits[type]);
for (int i = 0; i < numSplits[type]; ++i){
newMinJ[i] = 1e10;
newMaxJ[i] = -1e10;
}
for (int i = 0; i < numSplits[type]; ++i)
getJacDetBySubdivisionMatrices(type,P,iter,c,subNodes[i],
newMinJ[i],newMaxJ[i],done,quality);
minJ = newMinJ[0];
maxJ = newMaxJ[0];
for (int i = 1; i < numSplits[type]; ++i){
minJ = std::min(newMinJ[i],minJ);
maxJ = std::max(newMaxJ[i],maxJ);
}
} else if (minJ/maxJ < minAcceptable){
done = true;
}
}
int Quality2D::checkValidity(apf::MeshEntity* e)
{
apf::Element* elem = apf::createElement(mesh->getCoordinateField(),e);
apf::NewArray<apf::Vector3> elemNodes;
apf::getVectorNodes(elem,elemNodes);
// if we are blended, we need to create a full representation
if (blendingOrder > 0 &&
getNumInternalControlPoints(apf::Mesh::TRIANGLE,order)) {
getFullRepFromBlended(apf::Mesh::TRIANGLE,blendingCoeffs,elemNodes);
}
apf::destroyElement(elem);
apf::NewArray<double> nodes(order*(2*order-1));
// have to use this function because its for x-y plane, and
// the other method used in 3D does not work in those cases
getTriJacDetNodes(order,elemNodes,nodes);
// check vertices
apf::Downward verts;
mesh->getDownward(e,0,verts);
for (int i = 0; i < 3; ++i){
if(nodes[i] < minAcceptable){
return i+2;
}
}
apf::MeshEntity* edges[3];
mesh->getDownward(e,1,edges);
double minJ = 0, maxJ = 0;
// Vertices will already be flagged in the first check
for (int edge = 0; edge < 3; ++edge){
for (int i = 0; i < 2*(order-1)-1; ++i){
if (nodes[3+edge*(2*(order-1)-1)+i] < minAcceptable){
minJ = -1e10;
apf::NewArray<double> edgeNodes(2*(order-1)+1);
if(algorithm < 2){
edgeNodes[0] = nodes[apf::tri_edge_verts[edge][0]];
edgeNodes[2*(order-1)] = nodes[apf::tri_edge_verts[edge][1]];
for (int j = 0; j < 2*(order-1)-1; ++j)
edgeNodes[j+1] = nodes[3+edge*(2*(order-1)-1)+j];
if(algorithm == 1){
getJacDetByElevation(apf::Mesh::EDGE,2*(order-1),edgeNodes,minJ,maxJ);
} else {
// allows recursion stop on first "conclusive" invalidity
bool done = false;
getJacDetBySubdivision(apf::Mesh::EDGE,2*(order-1),
0,edgeNodes,minJ,maxJ,done);
}
} else {
edgeNodes[0] = nodes[apf::tri_edge_verts[edge][0]];
edgeNodes[1] = nodes[apf::tri_edge_verts[edge][1]];
for (int j = 0; j < 2*(order-1)-1; ++j)
edgeNodes[j+2] = nodes[3+edge*(2*(order-1)-1)+j];
bool done = false;
bool quality = false;
getJacDetBySubdivisionMatrices(apf::Mesh::EDGE,2*(order-1),
0,subdivisionCoeffs[1],edgeNodes,minJ,maxJ,done,quality);
}
if(minJ < minAcceptable){
return 8+edge;
}
}
}
}
bool done = false;
for (int i = 0; i < (2*order-3)*(2*order-4)/2; ++i){
if (nodes[6*(order-1)+i] < minAcceptable){
minJ = -1e10;
if(algorithm == 1)
getJacDetByElevation(apf::Mesh::TRIANGLE,2*(order-1),nodes,minJ,maxJ);
else if(algorithm == 2){
bool quality = false;
getJacDetBySubdivisionMatrices(apf::Mesh::TRIANGLE,2*(order-1),
0,subdivisionCoeffs[2],nodes,minJ,maxJ,done,quality);
} else {
getJacDetBySubdivision(apf::Mesh::TRIANGLE,2*(order-1),
0,nodes,minJ,maxJ,done);
}
if(minJ < minAcceptable){
return 14;
}
}
}
return 1;
}
int Quality3D::checkValidity(apf::MeshEntity* e)
{
apf::NewArray<double> nodes(n);
// apf::Element* elem = apf::createElement(mesh->getCoordinateField(),e);
// apf::NewArray<apf::Vector3> elemNodes;
// apf::getVectorNodes(elem,elemNodes);
// apf::destroyElement(elem);
// getTetJacDetNodes(order,elemNodes,nodes);
int validityTag = computeJacDetNodes(e,nodes,true);
if (validityTag > 1)
return validityTag;
// check verts
apf::Downward verts;
mesh->getDownward(e,0,verts);
for (int i = 0; i < 4; ++i){
if(nodes[i] < minAcceptable){
return 2+i;
}
}
apf::MeshEntity* edges[6];
mesh->getDownward(e,1,edges);
double minJ = 0, maxJ = 0;
// Vertices will already be flagged in the first check
for (int edge = 0; edge < 6; ++edge){
for (int i = 0; i < 3*(order-1)-1; ++i){
if (nodes[4+edge*(3*(order-1)-1)+i] < minAcceptable){
minJ = -1e10;
apf::NewArray<double> edgeNodes(3*(order-1)+1);
if(algorithm < 2){
edgeNodes[0] = nodes[apf::tet_edge_verts[edge][0]];
edgeNodes[3*(order-1)] = nodes[apf::tet_edge_verts[edge][1]];
for (int j = 0; j < 3*(order-1)-1; ++j)
edgeNodes[j+1] = nodes[4+edge*(3*(order-1)-1)+j];
// allows recursion stop on first "conclusive" invalidity
if(algorithm == 1)
getJacDetByElevation(apf::Mesh::EDGE,3*(order-1),
edgeNodes,minJ,maxJ);
else {
bool done = false;
getJacDetBySubdivision(apf::Mesh::EDGE,3*(order-1),
0,edgeNodes,minJ,maxJ,done);
}
} else {
edgeNodes[0] = nodes[apf::tet_edge_verts[edge][0]];
edgeNodes[1] = nodes[apf::tet_edge_verts[edge][1]];
for (int j = 0; j < 3*(order-1)-1; ++j)
edgeNodes[j+2] = nodes[4+edge*(3*(order-1)-1)+j];
bool done = false;
bool quality = false;
getJacDetBySubdivisionMatrices(apf::Mesh::EDGE,3*(order-1),
0,subdivisionCoeffs[1],edgeNodes,minJ,maxJ,done,quality);
}
if(minJ < minAcceptable){
return 8+edge;
}
}
}
}
apf::MeshEntity* faces[4];
mesh->getDownward(e,2,faces);
for (int face = 0; face < 4; ++face){
double minJ = -1e10;
for (int i = 0; i < (3*order-4)*(3*order-5)/2; ++i){
if (nodes[18*order-20+face*(3*order-4)*(3*order-5)/2+i] < minAcceptable){
minJ = -1e10;
apf::NewArray<double> triNodes((3*order-2)*(3*order-1)/2);
getTriDetJacNodesFromTetDetJacNodes(face,3*(order-1),nodes,triNodes);
if(algorithm == 2){
bool done = false;
bool quality = false;
getJacDetBySubdivisionMatrices(apf::Mesh::TRIANGLE,3*(order-1),
0,subdivisionCoeffs[2],triNodes,minJ,maxJ,done,quality);
} else if(algorithm == 1)
getJacDetByElevation(apf::Mesh::TRIANGLE,3*(order-1),
triNodes,minJ,maxJ);
else {
bool done = false;
getJacDetBySubdivision(apf::Mesh::TRIANGLE,3*(order-1),
0,triNodes,minJ,maxJ,done);
}
if(minJ < minAcceptable){
return 14+face;
}
}
}
}
for (int i = 0; i < (3*order-4)*(3*order-5)*(3*order-6)/6; ++i){
if (nodes[18*order*order-36*order+20+i] < minAcceptable){
minJ = -1e10;
if(algorithm == 1){
getJacDetByElevation(apf::Mesh::TET,3*(order-1),nodes,minJ,maxJ);
} else {
bool done = false;
bool quality = false;
getJacDetBySubdivisionMatrices(apf::Mesh::TET,3*(order-1),
0,subdivisionCoeffs[3],nodes,minJ,maxJ,done,quality);
}
if(minJ < minAcceptable){
return 20;
}
}
}
return 1;
}
double computeTriJacobianDetFromBezierFormulation(apf::Mesh* m,
apf::MeshEntity* e, apf::Vector3& xi)
{
double detJ = 0.;
int P = m->getShape()->getOrder();
apf::Element* elem = apf::createElement(m->getCoordinateField(),e);
apf::NewArray<apf::Vector3> nodes;
apf::getVectorNodes(elem,nodes);
for (int I = 0; I <= 2*(P-1); ++I){
for (int J = 0; J <= 2*(P-1)-I; ++J){
detJ += trinomial(2*(P-1),I,J)
*Bijk(I,J,2*(P-1)-I-J,1.-xi[0]-xi[1],xi[0],xi[1])
*Nijk(nodes,P,I,J);
}
}
apf::destroyElement(elem);
return detJ;
}
double computeTetJacobianDetFromBezierFormulation(apf::Mesh* m,
apf::MeshEntity* e, apf::Vector3& xi)
{
int P = m->getShape()->getOrder();
apf::Element* elem = apf::createElement(m->getCoordinateField(),e);
apf::NewArray<apf::Vector3> nodes;
apf::getVectorNodes(elem,nodes);
double detJ = 0.;
for (int I = 0; I <= 3*(P-1); ++I){
for (int J = 0; J <= 3*(P-1)-I; ++J){
for (int K = 0; K <= 3*(P-1)-I-J; ++K){
detJ += quadnomial(3*(P-1),I,J,K)*Bijkl(I,J,K,3*(P-1)-I-J-K,
1.-xi[0]-xi[1]-xi[2],xi[0],xi[1],xi[2])
*Nijkl(nodes,P,I,J,K);
}
}
}
apf::destroyElement(elem);
return detJ;
}
int Quality3D::computeJacDetNodes(apf::MeshEntity* e,
apf::NewArray<double>& nodes, bool validity)
{
apf::NewArray<double> interNodes(n);
apf::MeshElement* me = apf::createMeshElement(mesh,e);
if (validity == false)
{
for (int i = 0; i < n; ++i){
interNodes[i] = apf::getDV(me,xi[i]);
}
}
for (int i = 0; i < 4; ++i){
interNodes[i] = apf::getDV(me,xi[i]);
if(interNodes[i] < 1e-10){
apf::destroyMeshElement(me);
return i+2;
}
}
for (int edge = 0; edge < 6; ++edge){
for (int i = 0; i < 3*(order-1)-1; ++i){
int index = 4+edge*(3*(order-1)-1)+i;
interNodes[index] = apf::getDV(me,xi[index]);
if(interNodes[index] < 1e-10){
apf::destroyMeshElement(me);
return edge+8;
}
}
}
for (int face = 0; face < 4; ++face){
for (int i = 0; i < (3*order-4)*(3*order-5)/2; ++i){
int index = 18*order-20+face*(3*order-4)*(3*order-5)/2+i;
interNodes[index] = apf::getDV(me,xi[index]);
if(interNodes[index] < 1e-10){
apf::destroyMeshElement(me);
return face+14;
}
}
}
for (int i = 0; i < (3*order-4)*(3*order-5)*(3*order-6)/6; ++i){
int index = 18*order*order-36*order+20+i;
interNodes[index] = apf::getDV(me,xi[index]);
if(interNodes[index] < 1e-10){
apf::destroyMeshElement(me);
return 20;
}
}
apf::destroyMeshElement(me);
for( int i = 0; i < n; ++i){
nodes[i] = 0.;
for( int j = 0; j < n; ++j)
nodes[i] += interNodes[j]*transformationMatrix(i,j);
}
return 1;
}
double Quality2D::getQuality(apf::MeshEntity* e)
{
apf::Element* elem = apf::createElement(mesh->getCoordinateField(),e);
apf::NewArray<apf::Vector3> elemNodes;
apf::getVectorNodes(elem,elemNodes);
if(blendingOrder > 0
&& mesh->getShape()->hasNodesIn(2)){
getFullRepFromBlended(apf::Mesh::TRIANGLE,blendingCoeffs,elemNodes);
}
apf::destroyElement(elem);
apf::NewArray<double> nodes(n);
getTriJacDetNodes(order,elemNodes,nodes);
bool done = false;
double minJ = -1e10, maxJ = -1e10;
double oldAcceptable = minAcceptable;
int oldIter = maxAdaptiveIter;
maxAdaptiveIter = 1;
minAcceptable = -1e10;
bool quality = true;
getJacDetBySubdivisionMatrices(apf::Mesh::TRIANGLE,2*(order-1),
0,subdivisionCoeffs[2],nodes,minJ,maxJ,done,quality);
done = false;
minAcceptable = oldAcceptable;
maxAdaptiveIter = oldIter;
if(std::fabs(maxJ) > 1e-8)
return minJ/maxJ;
else return minJ;
}
double Quality3D::getQuality(apf::MeshEntity* e)
{
// this is the old way of computing things, don't do it anymore
// apf::Element* elem = apf::createElement(mesh->getCoordinateField(),e);
//
// apf::NewArray<apf::Vector3> elemNodes;
// apf::getVectorNodes(elem,elemNodes);
//
// if(blendingOrder > 0
// && mesh->getShape()->hasNodesIn(mesh->getDimension())){
// getFullRepFromBlended(type,blendingCoeffs,elemNodes);
// }
// apf::destroyElement(elem);
// getTetJacDetNodes(order,elemNodes,nodes);
apf::NewArray<double> nodes(n);
/* This part is optional, if we use the validity tag,
* we can decide the entity is invalid, and just return some
* negative number. While not a true assessment of quality,
* this is enough to convince swapping/coarsening to give up
* on the configuration its looking at, which is good.
* There is some downside to this, I'm sure.
*/
int validityTag =
computeJacDetNodes(e,nodes,false);
if (validityTag > 1)
return -1e-10;
bool done = false;
double minJ = -1e10, maxJ = -1e10;
double oldAcceptable = minAcceptable;
int oldIter = maxAdaptiveIter;
maxAdaptiveIter = 1; // just do one interation, thats enough
minAcceptable = -1e10;
bool quality = true;
getJacDetBySubdivisionMatrices(apf::Mesh::TET,3*(order-1),
0,subdivisionCoeffs[3],nodes,minJ,maxJ,done,quality);
done = false;
minAcceptable = oldAcceptable;
maxAdaptiveIter = oldIter;
if(std::fabs(maxJ) > 1e-8)
return minJ/maxJ;
else return minJ;
}
int checkValidity(apf::Mesh* m, apf::MeshEntity* e,
int algorithm)
{
Quality* qual = makeQuality(m,algorithm);
int validity = qual->checkValidity(e);
delete qual;
return validity;
}
double getQuality(apf::Mesh* m, apf::MeshEntity* e)
{
Quality* qual = makeQuality(m,2);
double quality = qual->getQuality(e);
delete qual;
return quality;
}
}
| 31.468305
| 82
| 0.61073
|
cwsmith
|
041313275ba2334ac0cbe059dc09eb138a69087e
| 1,623
|
cpp
|
C++
|
Game/Source/Game/src/MY_ResourceManager.cpp
|
PureBread/Game
|
957dd9f9450f0576ec5cc73c13525f5f47a9c4c9
|
[
"MIT"
] | null | null | null |
Game/Source/Game/src/MY_ResourceManager.cpp
|
PureBread/Game
|
957dd9f9450f0576ec5cc73c13525f5f47a9c4c9
|
[
"MIT"
] | 67
|
2015-10-14T12:15:52.000Z
|
2021-08-06T07:20:42.000Z
|
Game/Source/Game/src/MY_ResourceManager.cpp
|
PureBread/Game
|
957dd9f9450f0576ec5cc73c13525f5f47a9c4c9
|
[
"MIT"
] | null | null | null |
#pragma once
#include <MY_ResourceManager.h>
Scenario * MY_ResourceManager::scenario = nullptr;
std::vector<Scenario *> MY_ResourceManager::randomEvents;
std::vector<Scenario *> MY_ResourceManager::lossEvents;
std::vector<Scenario *> MY_ResourceManager::destinationEvents;
void MY_ResourceManager::init(){
Json::Value root;
Json::Reader reader;
std::string jsonLoaded = FileUtils::readFile("assets/events/scenarioListing.json");
bool parsingSuccessful = reader.parse( jsonLoaded, root );
if(!parsingSuccessful){
Log::error("JSON parse failed: " + reader.getFormattedErrorMessages()/* + "\n" + jsonLoaded*/);
}else{
Json::Value randomEventsJson = root["randomEvents"];
for(Json::Value::ArrayIndex i = 0; i < randomEventsJson.size(); ++i) {
Scenario * s = new Scenario("assets/events/random/" + randomEventsJson[i].asString() + ".json");
randomEvents.push_back(s);
resources.push_back(s);
}
Json::Value lossEventsJson = root["lossEvents"];
for(Json::Value::ArrayIndex i = 0; i < lossEventsJson.size(); ++i) {
Scenario * s = new Scenario("assets/events/loss/" + lossEventsJson[i].asString() + ".json");
lossEvents.push_back(s);
resources.push_back(s);
}
Json::Value destinationEventsJson = root["destinationEvents"];
for(Json::Value::ArrayIndex i = 0; i < destinationEventsJson.size(); ++i) {
Scenario * s = new Scenario("assets/events/destination/" + destinationEventsJson[i].asString() + ".json");
destinationEvents.push_back(s);
resources.push_back(s);
}
}
scenario = new Scenario("assets/scenarioGlobal.json");
resources.push_back(scenario);
}
| 39.585366
| 110
| 0.707948
|
PureBread
|
041365df87c48879c21861554c04f58cc97b0376
| 2,722
|
cpp
|
C++
|
ZOJ/4102/greedy.cpp
|
codgician/ACM
|
391f3ce9b89b0a4bbbe3ff60eb2369fef57460d4
|
[
"MIT"
] | 2
|
2018-02-14T01:59:31.000Z
|
2018-03-28T03:30:45.000Z
|
ZOJ/4102/greedy.cpp
|
codgician/ACM
|
391f3ce9b89b0a4bbbe3ff60eb2369fef57460d4
|
[
"MIT"
] | null | null | null |
ZOJ/4102/greedy.cpp
|
codgician/ACM
|
391f3ce9b89b0a4bbbe3ff60eb2369fef57460d4
|
[
"MIT"
] | 2
|
2017-12-30T02:46:35.000Z
|
2018-03-28T03:30:49.000Z
|
#include <bits/stdc++.h>
using namespace std;
#define SIZE 100010
#define DIGIT_SIZE 10
int arr[SIZE], orig[SIZE], ava[SIZE];
int ans[SIZE], ansPt;
bool lazy[SIZE];
priority_queue<pair<int, int> > pq;
set<int> avaList;
void updatePq() {
int cntPt = pq.top().second;
pq.pop();
if (ava[cntPt] > 0)
pq.push(make_pair(ava[cntPt] + orig[cntPt], cntPt));
lazy[cntPt] = false;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int caseNum;
cin >> caseNum;
while (caseNum--) {
memset(orig, 0, sizeof(orig));
memset(ava, 0, sizeof(ava));
memset(lazy, false, sizeof(lazy));
avaList.clear();
pq = priority_queue<pair<int, int> >();
int len;
cin >> len;
for (int i = 0; i < len; i++) {
cin >> arr[i]; arr[i]--;
orig[arr[i]]++; ava[arr[i]]++;
}
for (int i = 0; i < len; i++) {
if (ava[arr[i]] > 0) {
pq.push(make_pair(orig[i] + ava[i], i));
avaList.insert(i);
}
}
bool hasAns = true; int ansPt = 0;
for (int i = 0; i < len; i++) {
while (!pq.empty() && lazy[pq.top().second])
updatePq();
if (pq.empty() || pq.top().first > len - i) {
hasAns = false;
break;
}
int dangPt = pq.top().second, dangSum = pq.top().first;
if (dangSum == len - i && dangPt != arr[i]) {
// Can't decrease orig(dangPt), must decrease ava(dangPt)
ans[ansPt++] = dangPt;
ava[dangPt]--; lazy[dangPt] = true;
orig[arr[i]]--; lazy[arr[i]] = true;
} else {
// Select smallest available
auto it = avaList.begin();
while (it != avaList.end()) {
if (ava[*it] == 0) {
++it;
avaList.erase(prev(it));
} else if (*it == arr[i]) {
++it;
} else {
break;
}
}
if (it == avaList.end()) {
hasAns = false;
break;
}
ans[ansPt++] = *it;
ava[*it]--; lazy[*it] = true;
orig[arr[i]]--; lazy[arr[i]] = true;
}
}
if (hasAns) {
cout << ans[0] + 1;
for (int i = 1; i < ansPt; i++)
cout << " " << ans[i] + 1;
cout << '\n';
} else {
cout << "Impossible\n";
}
}
return 0;
}
| 27.22
| 73
| 0.3964
|
codgician
|
04161e31d1c66952000bf55e21753351563b674b
| 96
|
hpp
|
C++
|
src/scenes/scenes.hpp
|
seanbutler/engine
|
7fa38f43f61c97fc1df28f3a666d90628b699e91
|
[
"MIT"
] | null | null | null |
src/scenes/scenes.hpp
|
seanbutler/engine
|
7fa38f43f61c97fc1df28f3a666d90628b699e91
|
[
"MIT"
] | null | null | null |
src/scenes/scenes.hpp
|
seanbutler/engine
|
7fa38f43f61c97fc1df28f3a666d90628b699e91
|
[
"MIT"
] | null | null | null |
#pragma once
#include "./mainmenu.hpp"
#include "./splashscene.hpp"
#include "./testscene.hpp"
| 16
| 28
| 0.708333
|
seanbutler
|
041771075e4012550ddbdc91e23f392324821fbd
| 595
|
hpp
|
C++
|
Engine/Src/Ancona/Platformer/Actions/ScaleAction.hpp
|
ild-games/Ancona
|
6a4f520f97d17648a6dd3ba0582cd51da4f9e809
|
[
"MIT"
] | 11
|
2018-04-15T21:00:48.000Z
|
2021-12-30T20:55:21.000Z
|
Engine/Src/Ancona/Platformer/Actions/ScaleAction.hpp
|
tlein/Ancona
|
6a4f520f97d17648a6dd3ba0582cd51da4f9e809
|
[
"MIT"
] | 58
|
2016-04-17T20:41:25.000Z
|
2017-02-27T01:21:46.000Z
|
Engine/Src/Ancona/Platformer/Actions/ScaleAction.hpp
|
ild-games/Ancona
|
6a4f520f97d17648a6dd3ba0582cd51da4f9e809
|
[
"MIT"
] | 4
|
2018-05-04T17:03:20.000Z
|
2021-02-12T21:26:57.000Z
|
#ifndef Ancona_Platformer_Action_ScaleAction_hpp
#define Ancona_Platformer_Action_ScaleAction_hpp
#include <SFML/System.hpp>
#include "ValueAction.hpp"
namespace ild
{
template<typename T>
class ScaleAction : public ValueAction<T>
{
public:
ScaleAction(std::string drawableKey = "") : _drawableKey(drawableKey)
{
}
/* getters and setters */
std::string drawableKey() { return _drawableKey; }
void drawableKey(std::string newDrawableKey) { _drawableKey = newDrawableKey; }
private:
std::string _drawableKey = "";
};
}
#endif
| 20.517241
| 87
| 0.685714
|
ild-games
|
042199996e136c4076f552e7e928272b94ec1ecc
| 16,917
|
cpp
|
C++
|
physically-based-cloud-rendering/clouds/main.cpp
|
markomijolovic/physically-based-cloud-rendering
|
a8f9b3e11d6c2f744a45a598b872afb45ff8756c
|
[
"BSD-3-Clause"
] | 3
|
2021-05-25T13:58:22.000Z
|
2022-02-21T11:53:26.000Z
|
physically-based-cloud-rendering/clouds/main.cpp
|
markomijolovic/physically-based-cloud-rendering
|
a8f9b3e11d6c2f744a45a598b872afb45ff8756c
|
[
"BSD-3-Clause"
] | null | null | null |
physically-based-cloud-rendering/clouds/main.cpp
|
markomijolovic/physically-based-cloud-rendering
|
a8f9b3e11d6c2f744a45a598b872afb45ff8756c
|
[
"BSD-3-Clause"
] | null | null | null |
#define GLFW_INCLUDE_NONE
#include "GLFW/glfw3.h"
#include "camera.hpp"
#include "framebuffer.hpp"
#include "glbinding/gl/gl.h"
#include "glbinding/glbinding.h"
#include "imgui/imgui.h"
#include "imgui/imgui_impl_glfw.h"
#include "imgui/imgui_impl_opengl3.h"
#include "input.hpp"
#include "mesh.hpp"
#include "preetham.hpp"
#include "shader.hpp"
#include "stb_image.h"
#include "transforms.hpp"
#include <chrono>
#include <string_view>
struct configuration_t {
std::string_view weather_map{};
float base_scale{};
float detail_scale{};
float weather_scale{};
float detail_factor{};
glm::vec3 min{};
glm::vec3 max{};
float a{};
float b{};
float c{};
float extinction{};
float scattering{};
float global_coverage{};
};
auto main() -> int
{
constexpr auto screen_width = 1280;
constexpr auto screen_height = 720;
const auto full_screen_quad_positions = std::vector{
glm::vec3{-1.0F, -1.0F, 0.0F},
glm::vec3{1.0F, -1.0F, 0.0F},
glm::vec3{1.0F, 1.0F, 0.0F},
glm::vec3{-1.0F, 1.0F, 0.0F}};
const auto full_screen_quad_uvs = std::vector{
glm::vec2{0.0F, 0.0F},
glm::vec2{1.0F, 0.0F},
glm::vec2{1.0F, 1.0F},
glm::vec2{0.0F, 1.0F}};
const auto full_screen_quad_indices = std::vector{0U, 1U, 2U, 2U, 3U, 0U};
auto camera = camera_t{
perspective(90.0F, static_cast<float>(screen_width) / screen_height, 0.01F, 100000.0F),
{{0.0F, 10.0F, 0.0F, 1.0F}, {}, {1.0F, 1.0F, 1.0F}}};
auto configurations = std::array{
configuration_t{
"perlin_test_cumulus",
60000,
1500,
60000,
0.5F,
{-30000, 1000, -30000},
{30000, 4000, 30000},
0.55F,
0.7F,
0.00F,
0.06F,
0.06F,
0.0F},
configuration_t{
"perlin_test_stratocumulus",
40000,
2000,
60000,
0.5F,
{-30000, 1000, -30000},
{30000, 4000, 30000},
0.6F,
0.75,
0.0F,
0.033F,
0.033F,
0.0F},
configuration_t{
"perlin_test_stratus",
60000,
3000,
60000,
0.33F,
{-30000, 1000, -30000},
{30000, 4000, 30000},
0.6F,
0.75F,
0.0F,
0.02F,
0.02F,
1.0F},
configuration_t{
"custom_cumulus",
15000,
1500,
60000,
0.5F,
{-6000, 1000, -6000},
{6000, 4000, 6000},
0.6F,
0.75F,
0.0F,
0.06F,
0.06F,
1.0F},
};
auto weather_maps = std::unordered_map<std::string_view, texture_t<2U>>{};
const auto arr_up = std::array{
normalize(glm::vec3{0, 1, 0}),
normalize(glm::vec3{1, 0.01, 0}),
glm::vec3{-1, 0.01, 0},
glm::vec3{0, 0.01, 1},
glm::vec3{0, 0.01, -1}};
const auto arr_down = std::array{
normalize(glm::vec3{0, -1, 0}),
normalize(glm::vec3{1, -0.01, 0}),
glm::vec3{-1, -0.01, 0},
glm::vec3{0, -0.01, 1},
glm::vec3{0, -0.01, -1}};
auto radio_button_value{3};
auto cfg_value{0};
auto sun_intensity{1.0F};
auto anvil_bias{0.0F};
auto coverage_multiplier{1.0F};
auto exposure_factor{0.000015F};
auto turbidity{5.0F};
auto multiple_scattering_approximation{true};
auto blue_noise{false};
auto blur{false};
auto ambient{true};
auto n{16};
auto primary_ray_steps{64};
auto secondary_ray_steps{16};
auto cloud_speed{0.0F};
auto density_multiplier{1.0F};
auto wind_direction{glm::vec3{1.0F, 0.0F, 0.0F}};
auto wind_direction_normalized{glm::vec3{}};
auto sun_direction{glm::vec3{0.0F, -1.0F, 0.0F}};
auto sun_direction_normalized{glm::vec3{}};
// init glfw
if (glfwInit() == 0) {
std::exit(-1);
}
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 6);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_RESIZABLE, 0);
const auto window = glfwCreateWindow(screen_width, screen_height, "clouds", nullptr, nullptr);
if (window == nullptr) {
std::exit(-1);
}
glfwSetCursorPosCallback(window, mouse_callback);
glfwSetKeyCallback(window, key_callback);
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
glfwMakeContextCurrent(window);
glfwSwapInterval(0); // disable v-sync
glbinding::initialize(glfwGetProcAddress);
gl::glViewport(0, 0, screen_width, screen_height);
//init imgui
IMGUI_CHECKVERSION();
ImGui::CreateContext();
ImGui::StyleColorsLight();
ImGui_ImplGlfw_InitForOpenGL(window, true);
ImGui_ImplOpenGL3_Init("#version 460");
// load textures
stbi_set_flip_vertically_on_load(1);
const auto cloud_base_texture = texture_t<3U>{128U, 128U, 128U, "textures/noise_shape.tga"};
const auto cloud_erosion_texture = texture_t<3U>{64U, 64U, 64U, "textures/noise_erosion_hd.tga"};
const auto mie_texture = texture_t<1U>{
1800U,
0U,
0U,
"textures/mie_phase_function_normalized.hdr",
gl::GLenum::GL_RGB32F,
gl::GLenum::GL_RGB,
gl::GLenum::GL_FLOAT};
weather_maps["perlin_test_stratus"] = texture_t<2U>{512U, 512U, 0U, "textures/perlin_test_stratus.tga"};
weather_maps["perlin_test_stratocumulus"] = texture_t<2U>{512U, 512U, 0U, "textures/perlin_test_stratocumulus.tga"};
weather_maps["perlin_test_cumulus"] = texture_t<2U>{512U, 512U, 0U, "textures/perlin_test_cumulus.tga"};
weather_maps["custom_cumulus"] = texture_t<2U>{512U, 512U, 0U, "textures/custom_cumulus.tga"};
const auto blue_noise_texture = texture_t<2U>(512U, 512U, 0U, "textures/blue_noise.png");
const auto quad = mesh_t{full_screen_quad_positions, full_screen_quad_uvs, full_screen_quad_indices};
const auto raymarching_shader = shader_t{"shaders/raymarch.vert", "shaders/raymarch.frag"};
const auto blur_shader = shader_t{"shaders/raymarch.vert", "shaders/blur.frag"};
const auto tonemap_shader = shader_t{"shaders/raymarch.vert", "shaders/tonemap.frag"};
gl::glClearColor(0.0F, 0.0F, 0.0F, 1.0F);
// create framebuffers
auto framebuffer{framebuffer_t{screen_width, screen_height, 1, true}};
auto framebuffer2{framebuffer_t{screen_width, screen_height, 1, true}};
auto framebuffer3{framebuffer_t{screen_width, screen_height, 1, true}};
auto delta_time = 1.0F / 60.0F;
auto cumulative_time{0.0F};
auto now = std::chrono::high_resolution_clock::now();
while (glfwWindowShouldClose(window) == 0) {
glfwPollEvents();
delta_time = std::chrono::duration<float, std::milli>(std::chrono::high_resolution_clock::now() - now).count();
now = std::chrono::high_resolution_clock::now();
cumulative_time += delta_time;
process_input(delta_time, camera);
//std::cout << "Delta time: " << delta_time << std::endl;
// raymarching
auto &cfg = configurations[cfg_value];
framebuffer2.bind();
glClear(gl::ClearBufferMask::GL_COLOR_BUFFER_BIT | gl::ClearBufferMask::GL_DEPTH_BUFFER_BIT);
raymarching_shader.use();
cloud_base_texture.bind(1);
cloud_erosion_texture.bind(2);
weather_maps[cfg.weather_map].bind(3);
raymarching_shader.set_uniform("cloud_base", 1);
raymarching_shader.set_uniform("cloud_erosion", 2);
raymarching_shader.set_uniform("weather_map", 3);
raymarching_shader.set_uniform("use_blue_noise", blue_noise);
if (blue_noise) {
blue_noise_texture.bind(4);
raymarching_shader.set_uniform("blue_noise", 4);
}
mie_texture.bind(5);
raymarching_shader.set_uniform("mie_texture", 5);
raymarching_shader.set_uniform("projection", camera.projection);
raymarching_shader.set_uniform("view", get_view_matrix(camera.transform));
raymarching_shader.set_uniform("camera_pos", glm::vec3{camera.transform.position});
raymarching_shader.set_uniform("low_frequency_noise_visualization", static_cast<int>(radio_button_value == 2));
raymarching_shader.set_uniform("high_frequency_noise_visualization", static_cast<int>(radio_button_value == 3));
raymarching_shader.set_uniform("multiple_scattering_approximation", multiple_scattering_approximation);
raymarching_shader.set_uniform("low_freq_noise_scale", cfg.base_scale);
raymarching_shader.set_uniform("weather_map_scale", cfg.weather_scale);
raymarching_shader.set_uniform("high_freq_noise_scale", cfg.detail_scale);
raymarching_shader.set_uniform("scattering_factor", cfg.scattering);
raymarching_shader.set_uniform("extinction_factor", cfg.extinction);
raymarching_shader.set_uniform("sun_intensity", sun_intensity);
raymarching_shader.set_uniform("high_freq_noise_factor", cfg.detail_factor);
raymarching_shader.set_uniform("N", n);
raymarching_shader.set_uniform("a", cfg.a);
raymarching_shader.set_uniform("b", cfg.b);
raymarching_shader.set_uniform("c", cfg.c);
raymarching_shader.set_uniform("primary_ray_steps", primary_ray_steps);
raymarching_shader.set_uniform("secondary_ray_steps", secondary_ray_steps);
raymarching_shader.set_uniform("time", cumulative_time);
raymarching_shader.set_uniform("cloud_speed", cloud_speed);
raymarching_shader.set_uniform("global_cloud_coverage", cfg.global_coverage);
raymarching_shader.set_uniform("anvil_bias", anvil_bias);
wind_direction_normalized = normalize(wind_direction);
raymarching_shader.set_uniform("wind_direction", wind_direction_normalized);
sun_direction_normalized = normalize(sun_direction);
raymarching_shader.set_uniform("sun_direction", sun_direction_normalized);
raymarching_shader.set_uniform("use_ambient", ambient);
raymarching_shader.set_uniform("turbidity", turbidity);
raymarching_shader.set_uniform("coverage_mult", coverage_multiplier);
raymarching_shader.set_uniform("density_mult", density_multiplier);
raymarching_shader.set_uniform("aabb_max", cfg.max);
raymarching_shader.set_uniform("aabb_min", cfg.min);
// use average of 5 samples as ambient radiance
// this could really be improved (and done on the GPU as well)
auto ambient_luminance_up{glm::vec3{}};
for (const auto &el: arr_up) {
ambient_luminance_up += 1000.0F * calculate_sky_luminance_RGB(-sun_direction_normalized, el, turbidity);
}
ambient_luminance_up /= 5.0F;
raymarching_shader.set_uniform("ambient_luminance_up", ambient_luminance_up);
auto ambient_luminance_down{glm::vec3{}};
for (const auto &el: arr_down) {
ambient_luminance_down += 1000.0F * calculate_sky_luminance_RGB(-sun_direction_normalized, el, turbidity);
}
ambient_luminance_down /= 5.0F;
raymarching_shader.set_uniform("ambient_luminance_down", ambient_luminance_down);
quad.draw();
if (blur) {
// gaussian blur
auto horizontal = true;
auto amount = 4;
blur_shader.use();
blur_shader.set_uniform("full_screen", 0);
for (auto i = 0; i < amount; i++) {
if (horizontal) {
framebuffer3.bind();
framebuffer2.colour_attachments().front().bind(0);
} else {
framebuffer2.bind();
framebuffer3.colour_attachments().front().bind(0);
}
blur_shader.set_uniform("horizontal", horizontal);
quad.draw();
horizontal = !horizontal;
}
}
framebuffer_t::unbind();
glClear(gl::ClearBufferMask::GL_COLOR_BUFFER_BIT | gl::ClearBufferMask::GL_DEPTH_BUFFER_BIT);
tonemap_shader.use();
framebuffer2.colour_attachments().front().bind(0);
tonemap_shader.set_uniform("full_screen", 0);
tonemap_shader.set_uniform("exposure_factor", exposure_factor);
quad.draw();
// render gui
if (options()) {
ImGui_ImplOpenGL3_NewFrame();
ImGui_ImplGlfw_NewFrame();
ImGui::NewFrame();
ImGui::Begin("clouds");
ImGui::Text("average fps: %.2f fps", ImGui::GetIO().Framerate);
ImGui::Text("average frametime: %.2f ms", 1000.0F / ImGui::GetIO().Framerate);
ImGui::Text("time elapsed: %.2f ms", cumulative_time);
ImGui::Text("camera world position: x=%f, y=%f, z=%f",
camera.transform.position.x,
camera.transform.position.y,
camera.transform.position.z);
ImGui::Text("press 'o' to toggle options");
ImGui::End();
ImGui::Begin("options");
ImGui::SliderInt("number of primary ray steps", &primary_ray_steps, 1, 500, "%d");
ImGui::SliderInt("number of secondary ray steps", &secondary_ray_steps, 1, 100, "%d");
ImGui::NewLine();
ImGui::RadioButton("low frequency noise", &radio_button_value, 2);
ImGui::RadioButton("high frequency noise", &radio_button_value, 3);
ImGui::NewLine();
ImGui::RadioButton("cumulus map", &cfg_value, 0);
ImGui::RadioButton("stratocumulus map", &cfg_value, 1);
ImGui::RadioButton("stratus map", &cfg_value, 2);
ImGui::RadioButton("one cumulus map", &cfg_value, 3);
ImGui::NewLine();
ImGui::Checkbox("blue noise jitter", &blue_noise);
ImGui::Checkbox("gaussian blur", &blur);
ImGui::NewLine();
ImGui::SliderFloat("low frequency noise scale", &cfg.base_scale, 10.0F, 200000.0F, "%.5f");
ImGui::SliderFloat("high frequency noise scale", &cfg.detail_scale, 10.0F, 10000.0F, "%.5f");
ImGui::SliderFloat("weather map scale", &cfg.weather_scale, 3000.0F, 300000.0F, "%.5f");
ImGui::NewLine();
ImGui::SliderFloat("high frequency noise factor", &cfg.detail_factor, 0.0F, 1.0F, "%.5f");
ImGui::SliderFloat("anvil bias", &anvil_bias, 0.0F, 1.0F, "%.5f");
ImGui::SliderFloat("scattering factor", &cfg.scattering, 0.01F, 1.0F, "%.5f");
ImGui::SliderFloat("extinction factor", &cfg.extinction, 0.01F, 1.0F, "%.5f");
ImGui::SliderFloat3("wind direction", &wind_direction[0], -1.0F, 1.0F, "%.5f");
ImGui::SliderFloat3("aabb max", &cfg.max[0], -30000.0F, 30000.0F, "%.5f");
ImGui::SliderFloat3("aabb min", &cfg.min[0], -30000.0F, 30000.0F, "%.5f");
ImGui::SliderFloat("sun direction x", &sun_direction[0], -1.0F, 1.0F, "%.5f");
ImGui::SliderFloat("sun direction y", &sun_direction[1], -1.0F, -0.001F, "%.5f");
ImGui::SliderFloat("sun direction z", &sun_direction[2], -1.0F, 1.0F, "%.5f");
ImGui::SliderFloat("cloud speed", &cloud_speed, 0.0F, 10.0F, "%.5f");
ImGui::SliderFloat("exposure factor", &exposure_factor, 0.00001F, 0.0001F, "%.8f");
ImGui::SliderFloat("global cloud coverage", &cfg.global_coverage, 0.0F, 1.0F, "%.5f");
ImGui::SliderFloat("turbidity", &turbidity, 2.0F, 20.0F);
ImGui::SliderFloat("coverage_mult", &coverage_multiplier, 0.0F, 1.0F);
ImGui::SliderFloat("density_mult", &density_multiplier, 0.0F, 5.0F);
ImGui::NewLine();
ImGui::Checkbox("approximate ambient light", &ambient);
ImGui::Checkbox("multiple scattering approximation", &multiple_scattering_approximation);
ImGui::SliderInt("octaves count", &n, 1, 16, "%d");
ImGui::SliderFloat("attenuation", &cfg.a, 0.01F, 1.0F, "%.2f");
ImGui::SliderFloat("contribution", &cfg.b, 0.01F, 1.0F, "%.2f");
ImGui::SliderFloat("eccentricity attenuation", &cfg.c, 0.01F, 1.0F, "%.2f");
ImGui::End();
ImGui::Render();
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
}
glfwSwapBuffers(window);
}
ImGui_ImplOpenGL3_Shutdown();
ImGui_ImplGlfw_Shutdown();
glfwDestroyWindow(window);
glfwTerminate();
}
| 40.471292
| 120
| 0.612106
|
markomijolovic
|
54bd7b9f769501f46b5c842b931f46d1f551a22f
| 911
|
cpp
|
C++
|
built_in_translation-31533019/main.cpp
|
kay54068/qt-snippets
|
1af5b41599d469cf3e9ccce267f4721fad1e169e
|
[
"Apache-2.0"
] | 10
|
2016-04-07T07:10:42.000Z
|
2021-12-08T19:57:45.000Z
|
built_in_translation-31533019/main.cpp
|
kay54068/qt-snippets
|
1af5b41599d469cf3e9ccce267f4721fad1e169e
|
[
"Apache-2.0"
] | null | null | null |
built_in_translation-31533019/main.cpp
|
kay54068/qt-snippets
|
1af5b41599d469cf3e9ccce267f4721fad1e169e
|
[
"Apache-2.0"
] | 3
|
2017-01-26T13:58:20.000Z
|
2020-02-04T22:12:19.000Z
|
#include <QDebug>
#include <QtWidgets/QApplication>
#include <QMessageBox>
#include <QTranslator>
#include <QLibraryInfo>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QTranslator qtTranslator;
if (qtTranslator.load(QLocale::system(),
"qt", "_",
QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
{
qDebug() << "qtTranslator ok";
app.installTranslator(&qtTranslator);
}
QTranslator qtBaseTranslator;
if (qtBaseTranslator.load("qtbase_" + QLocale::system().name(),
QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
{
qDebug() << "qtBaseTranslator ok";
app.installTranslator(&qtBaseTranslator);
}
QTranslator translator;
translator.load("myapp_es", ":/");
app.installTranslator(&translator);
QMessageBox::question(0, QObject::tr("Sure want to quit?"),
QObject::tr("Sure?"),
QMessageBox::Yes | QMessageBox::No);
return app.exec();
}
| 23.358974
| 64
| 0.711306
|
kay54068
|
54bf8f716cc6ef9e5331c44b3e06e1537f53f941
| 10,375
|
hpp
|
C++
|
src/dtl/bitmap/uah_skip.hpp
|
harald-lang/tree-encoded-bitmaps
|
a4ab056f2cefa7843b27c736833b08977b56649c
|
[
"Apache-2.0"
] | 29
|
2020-06-18T12:51:42.000Z
|
2022-02-22T07:38:24.000Z
|
src/dtl/bitmap/uah_skip.hpp
|
marcellus-saputra/Thuja
|
8443320a6d0e9a20bb6b665f0befc6988978cafd
|
[
"Apache-2.0"
] | null | null | null |
src/dtl/bitmap/uah_skip.hpp
|
marcellus-saputra/Thuja
|
8443320a6d0e9a20bb6b665f0befc6988978cafd
|
[
"Apache-2.0"
] | 2
|
2021-04-07T13:43:34.000Z
|
2021-06-09T04:49:39.000Z
|
#pragma once
//===----------------------------------------------------------------------===//
#include "uah.hpp"
#include <dtl/bitmap/util/plain_bitmap.hpp>
#include <dtl/bitmap/util/plain_bitmap_iter.hpp>
#include <dtl/dtl.hpp>
#include <boost/dynamic_bitset.hpp>
#include <algorithm>
#include <cstddef>
#include <type_traits>
#include <vector>
//===----------------------------------------------------------------------===//
namespace dtl {
//===----------------------------------------------------------------------===//
/// Un-Aligned Hybrid: An RLE compressed representation of a bitmap of length N.
/// Unlike WAH or BBC, the encoding is not word or byte aligned.
/// This implementation maintains a small index that allows for faster skips.
template<typename _word_type = u32, std::size_t _skip_distance = 1024>
class uah_skip : public uah<_word_type> {
using super = uah<_word_type>;
using word_type = typename super::word_type;
using uah<_word_type>::uah;
using uah<_word_type>::is_fill_word;
using uah<_word_type>::extract_fill_value;
using uah<_word_type>::extract_fill_length;
using uah<_word_type>::word_bitlength;
using uah<_word_type>::payload_bit_cnt;
std::vector<$u32> offsets_;
/// Initialize the skip offsets.
void
init_skip_offsets() {
const auto word_cnt = this->data_.size();
offsets_.reserve((word_cnt + (_skip_distance - 1)) / _skip_distance);
std::size_t i = 0;
if (word_cnt > 1) {
for (std::size_t word_idx = 0; word_idx < word_cnt - 1; ++word_idx) {
if (word_idx % _skip_distance == 0) {
offsets_.push_back(i);
}
const auto w = this->data_[word_idx];
i += super::is_fill_word(w)
? super::extract_fill_length(w)
: super::payload_bit_cnt;
}
}
if (offsets_.empty()) {
offsets_.push_back(0);
}
}
public:
uah_skip() = default;
explicit uah_skip(const boost::dynamic_bitset<$u32>& in) : super(in), offsets_() {
init_skip_offsets();
}
~uah_skip() = default;
uah_skip(const uah_skip& other) = default;
uah_skip(uah_skip&& other) noexcept = default;
uah_skip& operator=(const uah_skip& other) = default;
uah_skip& operator=(uah_skip&& other) noexcept = default;
/// Return the size in bytes.
std::size_t __forceinline__
size_in_bytes() const {
return super::size_in_bytes()
+ offsets_.size() * sizeof(u32);
}
static std::string
name() {
return "uah_skip" + std::to_string(super::word_bitlength);
}
/// Returns the value of the bit at the position pos.
u1 __forceinline__
test(const std::size_t pos) const {
std::size_t word_idx = 0;
std::size_t i = 0;
auto search = std::upper_bound(offsets_.begin(), offsets_.end(), $u32(pos));
const std::size_t offset_idx = std::distance(offsets_.begin(), search) - 1;
word_idx = offset_idx * _skip_distance;
i = offsets_[offset_idx];
// Find the corresponding word.
for (; word_idx < this->data_.size(); ++word_idx) {
auto& w = this->data_[word_idx];
if (this->is_literal_word(w)) {
if (pos >= i + super::payload_bit_cnt) {
i += super::payload_bit_cnt;
continue;
}
else {
return dtl::bits::bit_test(w, pos - i + 1); // TODO optimize
}
}
else {
auto fill_len = this->extract_fill_length(w);
if (pos >= i + fill_len) {
i += fill_len;
continue;
}
else {
return this->extract_fill_value(w);
}
}
}
return false;
}
/// Try to reduce the memory consumption. This function is supposed to be
/// called after the bitmap has been modified.
__forceinline__ void
shrink() {
super::shrink();
offsets_.shrink_to_fit();
}
//===--------------------------------------------------------------------===//
/// 1-run iterator
class iter {
const uah_skip& outer_;
std::size_t word_idx_;
std::size_t in_word_idx_;
//===------------------------------------------------------------------===//
// Iterator state
//===------------------------------------------------------------------===//
/// Points to the beginning of a 1-run.
$u64 pos_;
/// The length of the current 1-run.
$u64 length_;
//===------------------------------------------------------------------===//
public:
explicit __forceinline__
iter(const uah_skip& outer)
: outer_(outer),
word_idx_(0),
in_word_idx_(0),
pos_(0), length_(0) {
const auto word_cnt = outer_.data_.size();
word_type w;
while (word_idx_ < word_cnt) {
w = outer_.data_[word_idx_];
if (is_fill_word(w)) {
if (extract_fill_value(w) == false) {
pos_ += extract_fill_length(w);
}
else {
length_ = extract_fill_length(w);
in_word_idx_ = 0;
break;
}
}
else {
const word_type payload = w >> 1;
if (payload == 0) {
pos_ += payload_bit_cnt;
}
else {
const std::size_t b = dtl::bits::tz_count(payload);
std::size_t e = b + 1;
for (; e < payload_bit_cnt; ++e) {
u1 is_set = dtl::bits::bit_test(payload, e);
if (!is_set) break;
}
pos_ += b;
length_ = e - b;
in_word_idx_ = e;
break;
}
}
++word_idx_;
}
if (word_idx_ == word_cnt) {
pos_ = outer_.encoded_bitmap_length_;
length_ = 0;
}
else {
if (is_fill_word(w)) {
++word_idx_;
in_word_idx_ = 0;
}
}
}
/// Forward the iterator to the next 1-run.
void __forceinline__
next() {
pos_ += length_;
length_ = 0;
const auto word_cnt = outer_.data_.size();
word_type w;
while (word_idx_ < word_cnt) {
w = outer_.data_[word_idx_];
if (is_fill_word(w)) {
if (extract_fill_value(w) == false) {
pos_ += extract_fill_length(w);
}
else {
length_ = extract_fill_length(w);
break;
}
}
else {
if (in_word_idx_ < payload_bit_cnt) { // TODO decode the entire literal word at once.
const word_type payload = w >> (1 + in_word_idx_);
if (payload == 0) {
pos_ += payload_bit_cnt - in_word_idx_;
}
else {
const std::size_t b = dtl::bits::tz_count(payload);
std::size_t e = b + 1;
for (; e < (payload_bit_cnt - in_word_idx_); ++e) {
u1 is_set = dtl::bits::bit_test(payload, e);
if (!is_set) break;
}
pos_ += b;
length_ = e - b;
in_word_idx_ += e;
break;
}
}
}
++word_idx_;
in_word_idx_ = 0;
}
if (word_idx_ == word_cnt) {
pos_ = outer_.encoded_bitmap_length_;
length_ = 0;
}
else {
if (is_fill_word(w)) {
++word_idx_;
in_word_idx_ = 0;
}
}
}
/// Forward the iterator to the desired position.
void __forceinline__
skip_to(const std::size_t to_pos) {
assert(pos_ <= to_pos);
if (to_pos >= outer_.encoded_bitmap_length_) {
pos_ = outer_.encoded_bitmap_length_;
length_ = 0;
return;
}
// Skip close to the desired position.
auto search = std::upper_bound(
outer_.offsets_.begin(), outer_.offsets_.end(), $u32(to_pos));
const std::size_t offset_idx =
std::distance(outer_.offsets_.begin(), search) - 1;
word_idx_ = offset_idx * _skip_distance;
in_word_idx_ = 0;
pos_ = outer_.offsets_[offset_idx];
length_ = 0;
// Call next until the desired position has been reached.
while (!end() && pos() + length() <= to_pos) {
next();
}
// Adjust the current position and run length.
if (!end() && pos() < to_pos) {
length_ -= to_pos - pos_;
pos_ = to_pos;
}
}
u1 __forceinline__
end() const noexcept {
return pos_ >= outer_.encoded_bitmap_length_;
}
u64 __forceinline__
pos() const noexcept {
return pos_;
}
u64 __forceinline__
length() const noexcept {
return length_;
}
};
//===--------------------------------------------------------------------===//
using skip_iter_type = iter;
using scan_iter_type = iter;
/// Returns a 1-run iterator.
skip_iter_type __forceinline__
it() const {
return skip_iter_type(*this);
}
/// Returns a 1-run iterator.
scan_iter_type __forceinline__
scan_it() const {
return scan_iter_type(*this);
}
/// Returns the name of the instance including the most important parameters
/// in JSON.
std::string
info() const {
return "{\"name\":\"" + name() + "\""
+ ",\"n\":" + std::to_string(this->size())
+ ",\"size\":" + std::to_string(size_in_bytes())
+ ",\"word_size\":" + std::to_string(sizeof(_word_type))
+ ",\"skip_distance\":" + std::to_string(_skip_distance)
+ ",\"skip_offsets_size\":" + std::to_string(offsets_.size() * sizeof($u32))
+ "}";
}
// For debugging purposes.
void
print(std::ostream& os) const {
super::print(os);
os << " idx | offset " << std::endl;
for (std::size_t i = 0; i < offsets_.size(); ++i) {
os << std::setw(8) << i << " | ";
os << std::setw(8) << offsets_[i];
os << std::endl;
}
}
};
//===----------------------------------------------------------------------===//
/// UAH compressed representation of a bitmap of length N using 8-bit words.
using uah8_skip = uah_skip<u8>;
/// UAH compressed representation of a bitmap of length N using 16-bit words.
using uah16_skip = uah_skip<u16>;
/// UAH compressed representation of a bitmap of length N using 32-bit words.
using uah32_skip = uah_skip<u32>;
/// UAH compressed representation of a bitmap of length N using 64-bit words.
using uah64_skip = uah_skip<u64>;
//===----------------------------------------------------------------------===//
} // namespace dtl
| 29.30791
| 95
| 0.525783
|
harald-lang
|
54c0c3aeee1752643ec38d00020ae44d6ee4a79f
| 325
|
cpp
|
C++
|
All_code/73.cpp
|
jnvshubham7/cpp-programming
|
7d00f4a3b97b9308e337c5d3547fd3edd47c5e0b
|
[
"Apache-2.0"
] | 1
|
2021-12-22T12:37:36.000Z
|
2021-12-22T12:37:36.000Z
|
All_code/73.cpp
|
jnvshubham7/CPP_Programming
|
a17c4a42209556495302ca305b7c3026df064041
|
[
"Apache-2.0"
] | null | null | null |
All_code/73.cpp
|
jnvshubham7/CPP_Programming
|
a17c4a42209556495302ca305b7c3026df064041
|
[
"Apache-2.0"
] | null | null | null |
#include <bits/stdc++.h>
using namespace std;
int main() {
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
int N;
cin>>N;
for(int i=0;i<N;i++){
cin>>i;
if(i%2!=0){
cout<<i<<" "<<endl;
}
}
// YOUR CODE GOES HERE
return 0;
}
| 12.5
| 38
| 0.443077
|
jnvshubham7
|
54c35c93dac2804d9b04f7392759251ee6147a8d
| 654
|
hpp
|
C++
|
source/parser/parser_content.hpp
|
octopus-prime/hessian_x3
|
f0cf0f7a334efb8ba434ac87370814561e033ea0
|
[
"BSL-1.0"
] | 3
|
2016-12-10T15:01:11.000Z
|
2019-11-25T14:03:49.000Z
|
source/parser/parser_content.hpp
|
octopus-prime/hessian_x3
|
f0cf0f7a334efb8ba434ac87370814561e033ea0
|
[
"BSL-1.0"
] | null | null | null |
source/parser/parser_content.hpp
|
octopus-prime/hessian_x3
|
f0cf0f7a334efb8ba434ac87370814561e033ea0
|
[
"BSL-1.0"
] | null | null | null |
/*
* parser_content.hpp
*
* Created on: 25.02.2016
* Author: mike_gresens
*/
#pragma once
using namespace std::literals;
namespace hessian {
namespace parser {
namespace content {
const x3::rule<class content_rule, content_t> content_rule;
const x3::rule<class reply_rule, reply_t> reply_rule;
const x3::rule<class fault_rule, fault_t> fault_rule;
const auto content_rule_def = x3::lit("H\x02\x00"s) >> (reply_rule | fault_rule);
const auto reply_rule_def = x3::lit('R') >> value_rule;
const auto fault_rule_def = x3::lit('F') >> map_rule;
BOOST_SPIRIT_DEFINE(content_rule, reply_rule, fault_rule);
}
using content::content_rule;
}
}
| 20.4375
| 81
| 0.730887
|
octopus-prime
|
54c45bc46cce1b65b021b01bfa42d8b83b5c86cf
| 10,722
|
cpp
|
C++
|
src/mod/visualize/flamethrower.cpp
|
fugueinheels/sigsegv-mvm
|
092a69d44a3ed9aacd14886037f4093a27ff816b
|
[
"BSD-2-Clause"
] | 7
|
2021-03-02T02:27:18.000Z
|
2022-02-18T00:56:28.000Z
|
src/mod/visualize/flamethrower.cpp
|
fugueinheels/sigsegv-mvm
|
092a69d44a3ed9aacd14886037f4093a27ff816b
|
[
"BSD-2-Clause"
] | 3
|
2021-11-29T15:53:02.000Z
|
2022-02-21T13:09:22.000Z
|
src/mod/visualize/flamethrower.cpp
|
fugueinheels/sigsegv-mvm
|
092a69d44a3ed9aacd14886037f4093a27ff816b
|
[
"BSD-2-Clause"
] | 5
|
2021-03-04T20:26:11.000Z
|
2021-11-26T07:09:24.000Z
|
#include "mod.h"
#include "stub/entities.h"
#include "stub/tfplayer.h"
// adapted from Debug:Flamethrower_Mojo
namespace Mod::Visualize::Flamethrower
{
Color RainbowGenerator()
{
static long i = 0;
switch ((i++) % 8) {
case 0: return Color(0xff, 0x00, 0x00, 0xff); // red
case 1: return Color(0xff, 0x80, 0x00, 0xff); // orange
case 2: return Color(0xff, 0xff, 0x00, 0xff); // yellow
case 3: return Color(0x00, 0xff, 0x00, 0xff); // green
case 4: return Color(0x00, 0xff, 0xff, 0xff); // cyan
case 5: return Color(0x00, 0x00, 0xff, 0xff); // blue
case 6: return Color(0x80, 0x00, 0xff, 0xff); // violet
case 7: return Color(0xff, 0x00, 0xff, 0xff); // magenta
default: return Color(0x00, 0x00, 0x00, 0x00); // black
}
}
Color MakeColorLighter(Color c)
{
c[0] += (0xff - c[0]) / 2;
c[1] += (0xff - c[1]) / 2;
c[2] += (0xff - c[2]) / 2;
return c;
}
struct FlameInfo
{
FlameInfo(CTFFlameEntity *flame)
{
init_origin = flame->GetAbsOrigin();
init_curtime = gpGlobals->curtime;
init_realtime = Plat_FloatTime();
init_tick = gpGlobals->tickcount;
// col = RainbowGenerator();
//
// CBaseEntity *flamethrower = flame->GetOwnerEntity();
// if (flamethrower != nullptr) {
// CTFPlayer *player = ToTFPlayer(flamethrower->GetOwnerEntity());
// if (player != nullptr) {
//
//
// if (player->IsMiniBoss()) {
//
// } else {
//
// }
//
//
// }
// }
col = Color(0xff, 0xff, 0xff, 0xff);
col_lt = MakeColorLighter(col);
num_thinks = 0;
missed_thinks = 0;
hit_an_entity = false;
spawned_this_tick = true;
thought_this_tick = false;
removed_this_tick = false;
}
FlameInfo(const FlameInfo&) = delete;
Vector init_origin;
float init_curtime;
float init_realtime;
int init_tick;
Color col;
Color col_lt;
int num_thinks;
int missed_thinks;
bool hit_an_entity;
bool spawned_this_tick;
bool thought_this_tick;
bool removed_this_tick;
};
std::map<CHandle<CBaseEntity>, FlameInfo> flames;
std::vector<decltype(flames)::iterator> dead_flames;
DETOUR_DECL_STATIC(CTFFlameEntity *, CTFFlameEntity_Create, const Vector& origin, const QAngle& angles, CBaseEntity *owner, float f1, int i1, float f2, bool b1, bool b2)
{
auto result = DETOUR_STATIC_CALL(CTFFlameEntity_Create)(origin, angles, owner, f1, i1, f2, b1, b2);
if (result != nullptr) {
flames.emplace(std::make_pair(result, result));
}
return result;
}
ConVar cvar_dead_flame_duration("sig_visualize_flamethrower_dead_flame_duration", "1.0", FCVAR_NOTIFY,
"Visualization: How long to show boxes for flame entities after they've been removed");
DETOUR_DECL_MEMBER(void, CTFFlameEntity_RemoveFlame)
{
auto flame = reinterpret_cast<CTFFlameEntity *>(this);
auto it = flames.find(flame);
if (it != flames.end()) {
FlameInfo& info = (*it).second;
const Vector& pos_start = info.init_origin;
const Vector& pos_end = flame->GetAbsOrigin();
float dist = (pos_end - pos_start).Length();
int delta_tick = gpGlobals->tickcount - info.init_tick;
float delta_curtime = gpGlobals->curtime - info.init_curtime;
float delta_realtime = Plat_FloatTime() - info.init_realtime;
// NDebugOverlay::EntityTextAtPosition(pos_end, 0, CFmtStrN<64>("%.0f", dist), cvar_dead_flame_duration.GetFloat(), 0xff, 0xff, 0xff, 0xff);
// NDebugOverlay::EntityTextAtPosition(pos_end, 0, CFmtStrN<64>("%dt", delta_tick), cvar_dead_flame_duration.GetFloat(), 0xff, 0xff, 0xff, 0xff);
// NDebugOverlay::EntityTextAtPosition(pos_end, 1, CFmtStrN<64>("%.3fs", delta_realtime), cvar_dead_flame_duration.GetFloat(), 0xff, 0xff, 0xff, 0xff);
NDebugOverlay::EntityBounds(flame, 0xff, 0xff, 0xff, 0x10, cvar_dead_flame_duration.GetFloat());
// NDebugOverlay::Cross3D(flame->WorldSpaceCenter(), 3.0f, 0xff, 0xff, 0xff, false, cvar_dead_flame_duration.GetFloat());
info.removed_this_tick = true;
dead_flames.push_back(it);
}
// DevMsg("[CTFFlameEntity::RemoveFlame] [%+6.1f %+6.1f %+6.1f]\n",
// flame->GetAbsOrigin().x, flame->GetAbsOrigin().y, flame->GetAbsOrigin().z);
DETOUR_MEMBER_CALL(CTFFlameEntity_RemoveFlame)();
}
DETOUR_DECL_MEMBER(void, CTFFlameEntity_FlameThink)
{
auto flame = reinterpret_cast<CTFFlameEntity *>(this);
auto it = flames.find(flame);
if (it != flames.end()) {
FlameInfo& info = (*it).second;
info.thought_this_tick = true;
int num_thinks = info.num_thinks++;
}
DETOUR_MEMBER_CALL(CTFFlameEntity_FlameThink)();
}
DETOUR_DECL_MEMBER(void, CTFFlameEntity_OnCollide, CBaseEntity *pOther)
{
auto flame = reinterpret_cast<CTFFlameEntity *>(this);
auto it = flames.find(flame);
if (it != flames.end()) {
FlameInfo& info = (*it).second;
info.hit_an_entity = true;
// NDebugOverlay::EntityTextAtPosition(flame->WorldSpaceCenter(), -2, "HIT", 0.10f, info.col_lt.r(), info.col_lt.g(), info.col_lt.b(), 0xff);
}
DETOUR_MEMBER_CALL(CTFFlameEntity_OnCollide)(pOther);
}
ConVar cvar_show_thinks("sig_visualize_flamethrower_show_thinks", "0", FCVAR_NOTIFY,
"Visualization: show think overlays on active flame entities");
void PostThink_DrawFlames()
{
for (int i = 0; i < ITFFlameEntityAutoList::AutoList().Count(); ++i) {
auto flame = rtti_cast<CTFFlameEntity *>(ITFFlameEntityAutoList::AutoList()[i]);
if (flame == nullptr) continue;
auto it = flames.find(flame);
if (it != flames.end()) {
FlameInfo& info = (*it).second;
NDebugOverlay::EntityBounds(flame, info.col.r(), info.col.g(), info.col.b(), 0x10, gpGlobals->interval_per_tick);
// NDebugOverlay::Cross3D(flame->WorldSpaceCenter(), 3.0f, 0xff, 0xff, 0xff, false, gpGlobals->interval_per_tick);
if (cvar_show_thinks.GetBool()) {
if (info.thought_this_tick) {
NDebugOverlay::EntityTextAtPosition(flame->WorldSpaceCenter(), -1, "THINK", gpGlobals->interval_per_tick, info.col_lt.r(), info.col_lt.g(), info.col_lt.b(), 0xff);
NDebugOverlay::EntityTextAtPosition(flame->WorldSpaceCenter(), 0, CFmtStrN<64>("#%d", info.num_thinks), gpGlobals->interval_per_tick, info.col_lt.r(), info.col_lt.g(), info.col_lt.b(), 0xff);
} else {
if (info.spawned_this_tick) {
NDebugOverlay::EntityTextAtPosition(flame->WorldSpaceCenter(), -1, "SPAWN", gpGlobals->interval_per_tick, info.col_lt.r(), info.col_lt.g(), info.col_lt.b(), 0xff);
} else if (info.removed_this_tick) {
NDebugOverlay::EntityTextAtPosition(flame->WorldSpaceCenter(), -1, "DEAD", gpGlobals->interval_per_tick, info.col_lt.r(), info.col_lt.g(), info.col_lt.b(), 0xff);
} else {
++info.missed_thinks;
NDebugOverlay::EntityTextAtPosition(flame->WorldSpaceCenter(), -1, "MISSED", gpGlobals->interval_per_tick, info.col_lt.r(), info.col_lt.g(), info.col_lt.b(), 0xff);
NDebugOverlay::EntityTextAtPosition(flame->WorldSpaceCenter(), 0, "THINK!", gpGlobals->interval_per_tick, info.col_lt.r(), info.col_lt.g(), info.col_lt.b(), 0xff);
}
}
if (info.missed_thinks != 0) {
NDebugOverlay::EntityTextAtPosition(flame->WorldSpaceCenter(), 5, CFmtStrN<64>("%d MISSED", info.missed_thinks), gpGlobals->interval_per_tick, info.col_lt.r(), info.col_lt.g(), info.col_lt.b(), 0xff);
NDebugOverlay::EntityTextAtPosition(flame->WorldSpaceCenter(), 6, "THINKS!!", gpGlobals->interval_per_tick, info.col_lt.r(), info.col_lt.g(), info.col_lt.b(), 0xff);
}
}
}
}
}
void PostThink_PyroOverlay()
{
static CountdownTimer ctPyroOverlay;
if (ctPyroOverlay.IsElapsed()) {
ctPyroOverlay.Start(1.00f);
for (int i = 1; i <= gpGlobals->maxClients; ++i) {
CTFPlayer *player = ToTFPlayer(UTIL_PlayerByIndex(i));
if (player == nullptr) continue;
if (player->IsPlayerClass(TF_CLASS_PYRO)) {
NDebugOverlay::EntityBounds(player, 0xff, 0xff, 0xff, 0x00, 1.00f);
Vector vecFwd;
player->EyeVectors(&vecFwd);
Vector vecStart = player->EyePosition() + Vector(0.0f, 0.0f, 50.0f);
vecFwd.z = 0.0f;
vecFwd.NormalizeInPlace();
// NDebugOverlay::Line(vecStart, vecStart + (1000.0f * vecFwd), 0x80, 0x80, 0x80, true, 1.00f);
NDebugOverlay::EntityTextAtPosition(vecStart + (-30.0f * vecFwd) + Vector(0.0f, 0.0f, 15.0f), 0, "HAMMER", 1.00f, 0xc0, 0xc0, 0xc0, 0xff);
NDebugOverlay::EntityTextAtPosition(vecStart + (-30.0f * vecFwd) + Vector(0.0f, 0.0f, 15.0f), 1, " UNITS", 1.00f, 0xc0, 0xc0, 0xc0, 0xff);
for (float x = 0.0f; x <= 1000.0f; x += 50.0f) {
Vector vecHash1 = vecStart + (x * vecFwd) + Vector(0.0f, 0.0f, 10.0f);
Vector vecHash2 = vecStart + (x * vecFwd) + Vector(0.0f, 0.0f, -50.0f);
Vector vecHash3 = vecStart + ((x - 3.0f) * vecFwd) + Vector(0.0f, 0.0f, 15.0f);
NDebugOverlay::Line(vecHash1, vecHash2, 0x80, 0x80, 0x80, true, 1.00f);
NDebugOverlay::EntityTextAtPosition(vecHash3, 0, CFmtStrN<64>("%.0f", x), 1.00f, 0xc0, 0xc0, 0xc0, 0xff);
}
}
}
}
}
class CMod : public IMod, public IFrameUpdatePostEntityThinkListener, public IFrameUpdatePreEntityThinkListener
{
public:
CMod() : IMod("Visualize:Flamethrower")
{
MOD_ADD_DETOUR_STATIC(CTFFlameEntity_Create, "CTFFlameEntity::Create");
MOD_ADD_DETOUR_MEMBER(CTFFlameEntity_RemoveFlame, "CTFFlameEntity::RemoveFlame");
MOD_ADD_DETOUR_MEMBER(CTFFlameEntity_FlameThink, "CTFFlameEntity::FlameThink");
MOD_ADD_DETOUR_MEMBER(CTFFlameEntity_OnCollide, "CTFFlameEntity::OnCollide");
}
virtual bool ShouldReceiveCallbacks() const override { return this->IsEnabled(); }
virtual void FrameUpdatePreEntityThink() override
{
for (auto& pair : flames) {
pair.second.spawned_this_tick = false;
pair.second.thought_this_tick = false;
}
}
virtual void FrameUpdatePostEntityThink() override
{
PostThink_DrawFlames();
// PostThink_PyroOverlay();
for (auto it : dead_flames) {
flames.erase(it);
}
dead_flames.clear();
}
};
CMod s_Mod;
ConVar cvar_enable("sig_visualize_flamethrower", "0", FCVAR_NOTIFY,
"Visualization: show flame entity boxes, distances, etc.",
[](IConVar *pConVar, const char *pOldValue, float flOldValue){
s_Mod.Toggle(static_cast<ConVar *>(pConVar)->GetBool());
});
}
| 34.475884
| 207
| 0.650159
|
fugueinheels
|
54c5674d3497c353587118936250be8331eb1d14
| 3,785
|
cpp
|
C++
|
src/blinkit/blink/renderer/core/loader/CookieJar.cpp
|
titilima/blink
|
2de70073edfe0e1e0aaf2bb22b5d6abd9b776fad
|
[
"MIT"
] | 13
|
2020-04-21T13:14:00.000Z
|
2021-11-13T14:55:12.000Z
|
src/blinkit/blink/renderer/core/loader/CookieJar.cpp
|
titilima/blink
|
2de70073edfe0e1e0aaf2bb22b5d6abd9b776fad
|
[
"MIT"
] | null | null | null |
src/blinkit/blink/renderer/core/loader/CookieJar.cpp
|
titilima/blink
|
2de70073edfe0e1e0aaf2bb22b5d6abd9b776fad
|
[
"MIT"
] | 4
|
2020-04-21T13:15:43.000Z
|
2021-11-13T14:55:00.000Z
|
// -------------------------------------------------
// BlinKit - BlinKit Library
// -------------------------------------------------
// File Name: CookieJar.cpp
// Description: CookieJar Class
// Author: Ziming Li
// Created: 2021-07-26
// -------------------------------------------------
// Copyright (C) 2021 MingYang Software Technology.
// -------------------------------------------------
/*
* Copyright (C) 2013 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "core/loader/CookieJar.h"
#include "core/dom/Document.h"
#include "core/frame/LocalFrame.h"
#include "core/loader/FrameLoaderClient.h"
#include "public/platform/Platform.h"
#if 0 // BKTODO:
#include "public/platform/WebCookieJar.h"
#include "public/platform/WebURL.h"
#endif
#ifdef BLINKIT_CRAWLER_ENABLED
# include "blinkit/crawler/crawler_impl.h"
#endif
namespace blink {
static WebCookieJar* toCookieJar(const Document* document)
{
if (!document || !document->frame())
return 0;
ASSERT(false); // BKTODO: return document->frame()->loader().client()->cookieJar();
return nullptr;
}
String cookies(const Document* document, const KURL& url)
{
WebCookieJar* cookieJar = toCookieJar(document);
if (!cookieJar)
return String();
ASSERT(false); // BKTODO: return cookieJar->cookies(url, document->firstPartyForCookies());
return String();
}
void setCookies(Document* document, const KURL& url, const String& cookieString)
{
WebCookieJar* cookieJar = toCookieJar(document);
if (!cookieJar)
return;
ASSERT(false); // BKTODO: cookieJar->setCookie(url, document->firstPartyForCookies(), cookieString);
}
bool cookiesEnabled(const Document *document)
{
#ifdef BLINKIT_CRAWLER_ENABLED
if (document->isCrawlerNode())
{
CrawlerImpl *crawler = CrawlerImpl::From(*document);
if (nullptr != crawler->GetCookieJar(false))
return true;
}
#endif
return false;
}
String cookieRequestHeaderFieldValue(const Document* document, const KURL& url)
{
WebCookieJar* cookieJar = toCookieJar(document);
if (!cookieJar)
return String();
ASSERT(false); // BKTODO: return cookieJar->cookieRequestHeaderFieldValue(url, document->firstPartyForCookies());
return String();
}
} // namespace blink
| 36.047619
| 117
| 0.689828
|
titilima
|
54c5714add2bb96b302e54b6841d006eb13a76f3
| 1,412
|
cpp
|
C++
|
Talg/Test/testErase.cpp
|
doside/Tiny-C---Template-Algorithm-Library
|
9aea047659fedb273abca960b8501a4297829a2b
|
[
"MIT"
] | null | null | null |
Talg/Test/testErase.cpp
|
doside/Tiny-C---Template-Algorithm-Library
|
9aea047659fedb273abca960b8501a4297829a2b
|
[
"MIT"
] | null | null | null |
Talg/Test/testErase.cpp
|
doside/Tiny-C---Template-Algorithm-Library
|
9aea047659fedb273abca960b8501a4297829a2b
|
[
"MIT"
] | null | null | null |
#include <Talg/core.h>
#include "test_suits.h"
#include <tuple>
#include <Talg/seqop.h>
#include <Talg/find_val.h>
using namespace Talg;
namespace {
void f() {
testSame(
Seq<int,double,char>,
Reverse<std::tuple<char,double,int>>,
Seq<int, int, int, int>,
Erase_front<Seq<int, double, float>, Seq<int, int, int, int, int>>,
Seq<int, double, float>,
Erase_front<Seq<bool, char>, Seq<int, char, double, float>>,
Seq<>,
Erase_front<Seq<int, double>, Seq<int>>,
Seq<float>,
Erase_front<Seq<int, double>, std::tuple<float>>,
Seq<int, int, int, int>,
Erase_front_s<Seq<int, double, float>, Seq<int, int, int, int, int>>,
Seq<int, double, float>,
Erase_front_s<Seq<bool, char>, Seq<int, char, double, float>>,
Seq<>,
Erase_front_s<Seq<int, double>, Seq<int>>,
Seq<float>,
Erase_front_s<Seq<int, double>, Seq<float>>,
Erase_back<Seq<int,double>,Seq<bool,bool,bool>>,
Seq<bool, bool, bool>,
Erase_back<Seq<int,double>, Seq<bool, bool, bool,double>>,
Seq<bool, bool, bool>,
Erase_back<Seq<int, double>, Seq<bool, bool, bool,int,double>>,
Seq<bool, bool, bool>,
Seq<char,char>,
Erase_back<Seq<>,Seq<char,char>>,
Seq<char>,
Erase_back<Seq<char>,Seq<char,char>>,
Seq<char>,
Erase_back<Seq<>,Seq<char>>,
Seq<int,float,int,double>,
EraseAt_s<2,Seq<int,float,float,int,double>>
);
}
}
| 17.65
| 72
| 0.628187
|
doside
|
54c8d87c22a2d2d0f4c418b7e79e3135505f72d4
| 2,153
|
cpp
|
C++
|
src/mode/network_config.cpp
|
FissionAndFusion/FnFnMvWallet-Pre
|
80d3d5b2c6a4c25ebb6c25dc111bb65d7105d032
|
[
"MIT"
] | 22
|
2018-08-17T07:05:56.000Z
|
2019-09-16T09:22:32.000Z
|
src/mode/network_config.cpp
|
FissionAndFusion/FnFnMvWallet-Pre
|
80d3d5b2c6a4c25ebb6c25dc111bb65d7105d032
|
[
"MIT"
] | 23
|
2018-08-18T11:09:42.000Z
|
2019-04-22T10:02:02.000Z
|
src/mode/network_config.cpp
|
FissionAndFusion/FnFnMvWallet-Pre
|
80d3d5b2c6a4c25ebb6c25dc111bb65d7105d032
|
[
"MIT"
] | 13
|
2018-08-17T01:12:58.000Z
|
2019-09-16T09:05:31.000Z
|
// Copyright (c) 2017-2019 The Multiverse developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "mode/network_config.h"
#include "mode/config_macro.h"
namespace multiverse
{
namespace po = boost::program_options;
CMvNetworkConfig::CMvNetworkConfig()
{
po::options_description desc("LoMoNetwork");
CMvNetworkConfigOption::AddOptionsImpl(desc);
AddOptions(desc);
}
CMvNetworkConfig::~CMvNetworkConfig() {}
bool CMvNetworkConfig::PostLoad()
{
if (fHelp)
{
return true;
}
if (nPortInt <= 0 || nPortInt > 0xFFFF)
{
nPort = (fTestNet ? DEFAULT_TESTNET_P2PPORT : DEFAULT_P2PPORT);
}
else
{
nPort = (unsigned short)nPortInt;
}
nMaxOutBounds = DEFAULT_MAX_OUTBOUNDS;
if (nMaxConnection <= DEFAULT_MAX_OUTBOUNDS)
{
nMaxInBounds = (fListen || fListen4 || fListen6) ? 1 : 0;
}
else
{
nMaxInBounds = nMaxConnection - DEFAULT_MAX_OUTBOUNDS;
}
if (nConnectTimeout == 0)
{
nConnectTimeout = 1;
}
if (!fTestNet)
{
// vDNSeed.push_back("118.193.83.220");
}
if (nThreadNumber <= 0)
{
nThreadNumber = 1;
}
vector<uint8> vecMac;
if (!walleve::GetAnIFMacAddress(vecMac))
{
return false;
}
string strPath = pathRoot.string();
vecMac.insert(vecMac.end(), strPath.begin(), strPath.end());
uint256 seed = crypto::CryptoHash(&vecMac[0], vecMac.size());
crypto::CryptoImportKey(nodeKey, seed);
return true;
}
std::string CMvNetworkConfig::ListConfig() const
{
std::ostringstream oss;
oss << CMvNetworkConfigOption::ListConfigImpl();
oss << "port: " << nPort << "\n";
oss << "maxOutBounds: " << nMaxOutBounds << "\n";
oss << "maxInBounds: " << nMaxInBounds << "\n";
oss << "dnseed: ";
for (auto& s: vDNSeed)
{
oss << s << " ";
}
oss << "\n";
return oss.str();
}
std::string CMvNetworkConfig::Help() const
{
return CMvNetworkConfigOption::HelpImpl();
}
} // namespace multiverse
| 21.53
| 71
| 0.619601
|
FissionAndFusion
|
54c9ef8bf0099d1ee734be0129b5affc826504eb
| 3,997
|
cc
|
C++
|
server/modules/routing/pinloki/gtid.cc
|
2733284198/MaxScale
|
b921dddbf06fcce650828ca94a3d715012b7072f
|
[
"BSD-3-Clause"
] | 1
|
2020-10-29T07:39:00.000Z
|
2020-10-29T07:39:00.000Z
|
server/modules/routing/pinloki/gtid.cc
|
2733284198/MaxScale
|
b921dddbf06fcce650828ca94a3d715012b7072f
|
[
"BSD-3-Clause"
] | null | null | null |
server/modules/routing/pinloki/gtid.cc
|
2733284198/MaxScale
|
b921dddbf06fcce650828ca94a3d715012b7072f
|
[
"BSD-3-Clause"
] | null | null | null |
/*
* Copyright (c) 2020 MariaDB Corporation Ab
*
* Use of this software is governed by the Business Source License included
* in the LICENSE.TXT file and at www.mariadb.com/bsl11.
*
* Change Date: 2024-10-14
*
* On the date above, in accordance with the Business Source License, use
* of this software will be governed by version 2 or later of the General
* Public License.
*/
#define BOOST_ERROR_CODE_HEADER_ONLY 1
#include "gtid.hh"
#include <maxbase/string.hh>
#include <maxscale/log.hh>
#include <maxbase/log.hh>
#include <boost/fusion/adapted/std_tuple.hpp>
#include <boost/spirit/home/x3.hpp>
#include <algorithm>
#include <sstream>
#include <mysql.h>
#include <mariadb_rpl.h>
#include <iostream>
#include <iomanip>
namespace maxsql
{
Gtid::Gtid(st_mariadb_gtid* mgtid)
: m_domain_id(mgtid->domain_id)
, m_server_id(mgtid->server_id)
, m_sequence_nr(mgtid->sequence_nr)
, m_is_valid(true)
{
}
std::string Gtid::to_string() const
{
return MAKE_STR(m_domain_id << '-' << m_server_id << '-' << m_sequence_nr);
}
Gtid Gtid::from_string(const std::string& gtid_str)
{
if (gtid_str.empty())
{
return Gtid();
}
namespace x3 = boost::spirit::x3;
const auto gtid_parser = x3::uint32 >> '-' >> x3::uint32 >> '-' >> x3::uint64;
std::tuple<uint32_t, uint32_t, uint64_t> result; // intermediary to avoid boost-fusionizing Gtid.
auto first = begin(gtid_str);
auto success = parse(first, end(gtid_str), gtid_parser, result);
if (success && first == end(gtid_str))
{
return Gtid(result);
}
else
{
MXS_SERROR("Invalid gtid string: '" << gtid_str);
return Gtid();
}
}
Gtid Gtid::previous() const
{
if (m_is_valid && m_sequence_nr > 1)
{
return Gtid(m_domain_id, m_server_id, m_sequence_nr - 1);
}
else
{
return Gtid();
}
}
std::ostream& operator<<(std::ostream& os, const Gtid& gtid)
{
os << gtid.to_string();
return os;
}
GtidList::GtidList(const std::vector<Gtid>&& gtids)
: m_gtids(std::move(gtids))
{
sort();
m_is_valid = std::all_of(begin(m_gtids), end(m_gtids), [](const Gtid& gtid) {
return gtid.is_valid();
});
}
void GtidList::clear()
{
m_gtids.clear();
m_is_valid = false;
}
void GtidList::replace(const Gtid& gtid)
{
auto ite = std::find_if(begin(m_gtids), end(m_gtids), [>id](const Gtid& rhs) {
return gtid.domain_id() == rhs.domain_id();
});
if (ite != end(m_gtids) && ite->domain_id() == gtid.domain_id())
{
*ite = gtid;
}
else
{
m_gtids.push_back(gtid);
sort();
}
m_is_valid = std::all_of(begin(m_gtids), end(m_gtids), [](const Gtid& gtid) {
return gtid.is_valid();
});
}
std::string GtidList::to_string() const
{
return maxbase::join(m_gtids);
}
GtidList GtidList::from_string(const std::string& str)
{
std::vector<Gtid> gvec;
auto gtid_strs = maxbase::strtok(str, ",");
for (auto& s : gtid_strs)
{
gvec.push_back(Gtid::from_string(s));
}
return GtidList(std::move(gvec));
}
void GtidList::sort()
{
std::sort(begin(m_gtids), end(m_gtids), [](const Gtid& lhs, const Gtid& rhs) {
return lhs.domain_id() < rhs.domain_id();
});
}
bool GtidList::is_included(const GtidList& other) const
{
for (const auto& gtid : other.gtids())
{
auto it = std::find_if(
m_gtids.begin(), m_gtids.end(), [&](const Gtid& g) {
return g.domain_id() == gtid.domain_id();
});
if (it == m_gtids.end() || it->sequence_nr() < gtid.sequence_nr())
{
return false;
}
}
return true;
}
std::ostream& operator<<(std::ostream& os, const GtidList& lst)
{
os << lst.to_string();
return os;
}
}
| 22.84
| 104
| 0.585689
|
2733284198
|
54cb8da02e65d1ad7fa65c1d58dcd1114f576909
| 280
|
cpp
|
C++
|
cpcli/templates/template.cpp
|
EricLiclair/CPCLI
|
0b03a5f07348c4522e06bd77d5579fa6321277ff
|
[
"MIT"
] | null | null | null |
cpcli/templates/template.cpp
|
EricLiclair/CPCLI
|
0b03a5f07348c4522e06bd77d5579fa6321277ff
|
[
"MIT"
] | 7
|
2021-12-21T10:50:28.000Z
|
2022-01-01T20:08:59.000Z
|
cpcli/templates/template.cpp
|
EricLiclair/CPCLI
|
0b03a5f07348c4522e06bd77d5579fa6321277ff
|
[
"MIT"
] | 1
|
2022-03-31T10:34:27.000Z
|
2022-03-31T10:34:27.000Z
|
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main()
{
cout << "[Algorithm Name] - Algorithm for [Algorithm Usage]\n"
<< "Time Complexity - O(1)\n"
<< "Space Complexity - O(1)\n"
<< "Ref Link - [LINK]\n";
return 0;
}
| 20
| 66
| 0.553571
|
EricLiclair
|
54cdc3fc3d06c3b29ac643bc6f2e9d4e57758dbd
| 19,734
|
cpp
|
C++
|
src/gse/src/gs_serializer.cpp
|
RichLogan/gse
|
9243166142d8f1500df13b57ca0985105d334d83
|
[
"BSD-2-Clause"
] | null | null | null |
src/gse/src/gs_serializer.cpp
|
RichLogan/gse
|
9243166142d8f1500df13b57ca0985105d334d83
|
[
"BSD-2-Clause"
] | null | null | null |
src/gse/src/gs_serializer.cpp
|
RichLogan/gse
|
9243166142d8f1500df13b57ca0985105d334d83
|
[
"BSD-2-Clause"
] | 1
|
2022-03-28T15:37:40.000Z
|
2022-03-28T15:37:40.000Z
|
/*
* gs_serializer.cpp
*
* Copyright (C) 2022
* Cisco Systems, Inc.
* All Rights Reserved
*
* Description:
* The Game State Serializer is an object used by the Game State Encoder
* to serialize data into a given buffer.
*
* Portability Issues:
* The C++ float and double types are assumed to be implemented following
* IEEE-754 specification.
*
* License:
* BSD 2-Clause License
*
* Copyright (c) 2022, Cisco Systems
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <cstring>
#include "gs_serializer.h"
#include "half_float.h"
namespace gs
{
/*
* Serializer::Write
*
* Description:
* This function will write the unsigned integer of fixed-size to
* the data buffer.
*
* Parameters:
* data_buffer [in]
* The data buffer into which the value shall be written.
*
* value [in]
* The unsigned integer value to write to the data buffer.
*
* Returns:
* The number of octets appended to the data buffer or would have been
* appended if the data_buffer contains a zero-sized buffer.
*
* Comments:
* None.
*/
std::size_t Serializer::Write(DataBuffer<> &data_buffer, Uint8 value) const
{
if (data_buffer.GetBufferSize()) data_buffer.AppendValue(value);
return sizeof(Uint8);
}
/*
* Serializer::Write
*
* Description:
* This function will write the unsigned integer of fixed-size to
* the data buffer.
*
* Parameters:
* data_buffer [in]
* The data buffer into which the value shall be written.
*
* value [in]
* The unsigned integer value to write to the data buffer.
*
* Returns:
* The number of octets appended to the data buffer or would have been
* appended if the data_buffer contains a zero-sized buffer.
*
* Comments:
* None.
*/
std::size_t Serializer::Write(DataBuffer<> &data_buffer, Uint16 value) const
{
if (data_buffer.GetBufferSize()) data_buffer.AppendValue(value);
return sizeof(Uint16);
}
/*
* Serializer::Write
*
* Description:
* This function will write the unsigned integer of fixed-size to
* the data buffer.
*
* Parameters:
* data_buffer [in]
* The data buffer into which the value shall be written.
*
* value [in]
* The unsigned integer value to write to the data buffer.
*
* Returns:
* The number of octets appended to the data buffer or would have been
* appended if the data_buffer contains a zero-sized buffer.
*
* Comments:
* None.
*/
std::size_t Serializer::Write(DataBuffer<> &data_buffer, Uint32 value) const
{
if (data_buffer.GetBufferSize()) data_buffer.AppendValue(value);
return sizeof(Uint32);
}
/*
* Serializer::Write
*
* Description:
* This function will write the unsigned integer of fixed-size to
* the data buffer.
*
* Parameters:
* data_buffer [in]
* The data buffer into which the value shall be written.
*
* value [in]
* The unsigned integer value to write to the data buffer.
*
* Returns:
* The number of octets appended to the data buffer or would have been
* appended if the data_buffer contains a zero-sized buffer.
*
* Comments:
* None.
*/
std::size_t Serializer::Write(DataBuffer<> &data_buffer, Uint64 value) const
{
if (data_buffer.GetBufferSize()) data_buffer.AppendValue(value);
return sizeof(Uint64);
}
/*
* Serializer::Write
*
* Description:
* This function will write the signed integer of fixed-size to
* the data buffer.
*
* Parameters:
* data_buffer [in]
* The data buffer into which the value shall be written.
*
* value [in]
* The unsigned integer value to write to the data buffer.
*
* Returns:
* The number of octets appended to the data buffer or would have been
* appended if the data_buffer contains a zero-sized buffer.
*
* Comments:
* None.
*/
std::size_t Serializer::Write(DataBuffer<> &data_buffer, Int8 value) const
{
if (data_buffer.GetBufferSize())
{
data_buffer.AppendValue(static_cast<Uint8>(value));
}
return sizeof(Int8);
}
/*
* Serializer::Write
*
* Description:
* This function will write the signed integer of fixed-size to
* the data buffer.
*
* Parameters:
* data_buffer [in]
* The data buffer into which the value shall be written.
*
* value [in]
* The unsigned integer value to write to the data buffer.
*
* Returns:
* The number of octets appended to the data buffer or would have been
* appended if the data_buffer contains a zero-sized buffer.
*
* Comments:
* None.
*/
std::size_t Serializer::Write(DataBuffer<> &data_buffer, Int16 value) const
{
if (data_buffer.GetBufferSize())
{
data_buffer.AppendValue(static_cast<Uint16>(value));
}
return sizeof(Int16);
}
/*
* Serializer::Write
*
* Description:
* This function will write the signed integer of fixed-size to
* the data buffer.
*
* Parameters:
* data_buffer [in]
* The data buffer into which the value shall be written.
*
* value [in]
* The unsigned integer value to write to the data buffer.
*
* Returns:
* The number of octets appended to the data buffer or would have been
* appended if the data_buffer contains a zero-sized buffer.
*
* Comments:
* None.
*/
std::size_t Serializer::Write(DataBuffer<> &data_buffer, Int32 value) const
{
if (data_buffer.GetBufferSize())
{
data_buffer.AppendValue(static_cast<Uint32>(value));
}
return sizeof(Int32);
}
/*
* Serializer::Write
*
* Description:
* This function will write the signed integer of fixed-size to
* the data buffer.
*
* Parameters:
* data_buffer [in]
* The data buffer into which the value shall be written.
*
* value [in]
* The unsigned integer value to write to the data buffer.
*
* Returns:
* The number of octets appended to the data buffer or would have been
* appended if the data_buffer contains a zero-sized buffer.
*
* Comments:
* None.
*/
std::size_t Serializer::Write(DataBuffer<> &data_buffer, Int64 value) const
{
if (data_buffer.GetBufferSize())
{
data_buffer.AppendValue(static_cast<Uint64>(value));
}
return sizeof(Int64);
}
/*
* Serializer::WriteVarUint
*
* Description:
* This function will write the unsigned integer as a variable-length
* integer.
*
* Parameters:
* data_buffer [in]
* The data buffer into which the value shall be written.
*
* value [in]
* The 64-bit VarUint value to write to the data buffer.
*
* Returns:
* The number of octets appended to the data buffer or would have been
* appended if the data_buffer contains a zero-sized buffer.
*
* Comments:
* VarUint is encoded as follows:
* [a] 0b + 7 bits for unsigned integer in the range 0 to 127
* [b] 10b + 14 bits for unsigned integer in the range 0 to 16383
* [c] 110b + 21 bits for unsigned integer 0 to 2097151
* [d] 11100001b + 4 octets for a 32-bit unsigned integer
* [e] 11100010b + 8 octets for a 64-bit unsigned integer
*/
std::size_t Serializer::Write(DataBuffer<> &data_buffer,
const VarUint &value) const
{
// [a] Produce a 7-bit unsigned integer
if (value.value <= 0x7f)
{
if (data_buffer.GetBufferSize())
{
data_buffer.AppendValue(static_cast<std::uint8_t>(value.value));
}
return sizeof(std::uint8_t);
}
// [b] Produce a 14-bit unsigned integer
if (value.value <= 0x3fff)
{
if (data_buffer.GetBufferSize())
{
data_buffer.AppendValue(
static_cast<std::uint16_t>(value.value | 0x8000));
}
return sizeof(std::uint16_t);
}
// [c] Produce a 21-bit unsigned integer
if (value.value <= 0x001f'ffff)
{
std::uint32_t i = static_cast<std::uint32_t>(value.value) | 0x00c0'0000;
if (data_buffer.GetBufferSize())
{
data_buffer.AppendValue(static_cast<std::uint8_t>(i >> 16));
data_buffer.AppendValue(static_cast<std::uint16_t>(i & 0xffff));
}
return sizeof(std::uint8_t) + sizeof(std::uint16_t);
}
// [d] Prduce a 32-bit unsigned integer
if (value.value <= 0xffff'ffff)
{
if (data_buffer.GetBufferSize())
{
data_buffer.AppendValue(static_cast<std::uint8_t>(0b1110'0001));
data_buffer.AppendValue(static_cast<std::uint32_t>(value.value));
}
return sizeof(std::uint8_t) + sizeof(std::uint32_t);
}
// [e] Produce a 64-bit unsigned integer
if (data_buffer.GetBufferSize())
{
data_buffer.AppendValue(static_cast<std::uint8_t>(0b1110'0010));
data_buffer.AppendValue(static_cast<std::uint64_t>(value.value));
}
return sizeof(std::uint8_t) + sizeof(std::uint64_t);
}
/*
* Serializer::WriteVarInt
*
* Description:
* This function will write the signed integer as a variable-length
* integer.
*
* Parameters:
* data_buffer [in]
* The data buffer into which the value shall be written.
*
* value [in]
* The 64-bit VarInt value to write to the data buffer.
*
* Returns:
* The number of octets appended to the data buffer or would have been
* appended if the data_buffer contains a zero-sized buffer.
*
* Comments:
* VarInt is encoded as follows:
* [a] 0b + 7 bits for signed integer in the range -64 to +63
* [b] 10b + 14 bits for signed integer in the range -8192 to 8191
* [c] 110b + 21 bits for signed integer -1048576 to 1048575
* [d] 11100001b + 4 octets for a 32-bit signed integer
* [e] 11100010b + 8 octets for a 64-bit signed integer
*/
std::size_t Serializer::Write(DataBuffer<> &data_buffer,
const VarInt &value) const
{
// [a] Produce a 7-bit signed integer
if (((value.value & 0xffff'ffff'ffff'ffc0) == 0xffff'ffff'ffff'ffc0) ||
((value.value & 0xffff'ffff'ffff'ffc0) == 0x0000'0000'0000'0000))
{
if (data_buffer.GetBufferSize())
{
data_buffer.AppendValue(
static_cast<std::uint8_t>(value.value & 0x7f));
}
return sizeof(std::uint8_t);
}
// [b] Produce a 14-bit signed integer
if (((value.value & 0xffff'ffff'ffff'e000) == 0xffff'ffff'ffff'e000) ||
((value.value & 0xffff'ffff'ffff'e000) == 0x0000'0000'0000'0000))
{
if (data_buffer.GetBufferSize())
{
data_buffer.AppendValue(
static_cast<std::uint16_t>((value.value & 0x3fff) | 0x8000));
}
return sizeof(std::uint16_t);
}
// [c] Produce a 21-bit signed integer
if (((value.value & 0xffff'ffff'fff0'0000) == 0xffff'ffff'fff0'0000) ||
((value.value & 0xffff'ffff'fff0'0000) == 0x0000'0000'0000'0000))
{
if (data_buffer.GetBufferSize())
{
std::uint32_t i = (value.value & 0x001f'ffff) | 0x00c0'0000;
data_buffer.AppendValue(static_cast<std::uint8_t>(i >> 16));
data_buffer.AppendValue(static_cast<std::uint16_t>(i & 0xffff));
}
return sizeof(std::uint8_t) + sizeof(std::uint16_t);
}
// [d] Prduce a 32-bit signed integer
if (((value.value & 0xffff'ffff'8000'0000) == 0xffff'ffff'8000'0000) ||
((value.value & 0xffff'ffff'8000'0000) == 0x0000'0000'0000'0000))
{
if (data_buffer.GetBufferSize())
{
data_buffer.AppendValue(static_cast<std::uint8_t>(0b1110'0001));
data_buffer.AppendValue(
static_cast<std::uint32_t>(value.value & 0xffff'ffff));
}
return sizeof(std::uint8_t) + sizeof(std::uint32_t);
}
// [e] Produce a 64-bit signed integer
if (data_buffer.GetBufferSize())
{
data_buffer.AppendValue(static_cast<std::uint8_t>(0b1110'0010));
data_buffer.AppendValue(static_cast<std::uint64_t>(value.value));
}
return sizeof(std::uint8_t) + sizeof(std::uint64_t);
}
/*
* Serializer::Write
*
* Description:
* This function will take a 32-bit floating point value and serialize it
* as a 16-bit half floating point value per IEEE 754 at the end of the
* given data buffer. See
* https://en.wikipedia.org/wiki/Half-precision_floating-point_format.
*
* Parameters:
* data_buffer [in]
* The data buffer into which the value shall be written.
*
* value [in]
* The floating point value to write to the data buffer.
*
* Returns:
* The number of octets appended to the data buffer or would have been
* appended if the data_buffer contains a zero-sized buffer.
*
* Comments:
* None.
*/
std::size_t Serializer::Write(DataBuffer<> &data_buffer,
const Float16 &value) const
{
if (data_buffer.GetBufferSize())
{
data_buffer.AppendValue(FloatToHalfFloat(value.value));
}
return sizeof(std::uint16_t);
}
/*
* Serializer::Write
*
* Description:
* This function will take a 32-bit floating point value and serialize it
* at the end of the given data buffer. The floating point value is
* assumed to conform to IEEE 754.
*
* Parameters:
* data_buffer [in]
* The data buffer into which the value shall be written.
*
* value [in]
* The single-precision floating point value to write to the data
* buffer.
*
* Returns:
* The number of octets appended to the data buffer or would have been
* appended if the data_buffer contains a zero-sized buffer.
*
* Comments:
* None.
*/
std::size_t Serializer::Write(DataBuffer<> &data_buffer, Float32 value) const
{
static_assert(sizeof(value) == 4, "expected Float32 to be 32 bits");
if (data_buffer.GetBufferSize())
{
data_buffer.AppendValue(value);
}
return sizeof(std::uint32_t);
}
/*
* Serializer::Write
*
* Description:
* This function will take a 64-bit floating point value and serialize it
* at the end of the given data buffer. The floating point value is
* assumed to conform to IEEE 754.
*
* Parameters:
* data_buffer [in]
* The data buffer into which the value shall be written.
*
* value [in]
* The double-precision floating point value to write to the data
* buffer.
*
* Returns:
* The number of octets appended to the data buffer or would have been
* appended if the data_buffer contains a zero-sized buffer.
*
* Comments:
* None.
*/
std::size_t Serializer::Write(DataBuffer<> &data_buffer, Float64 value) const
{
static_assert(sizeof(value) == 8, "expected Float64 to be 64 bits");
if (data_buffer.GetBufferSize())
{
data_buffer.AppendValue(value);
}
return sizeof(std::uint64_t);
}
/*
* Serializer::Write
*
* Description:
* This function will write a Boolean value to the end of the specified
* data buffer.
*
* Parameters:
* data_buffer [in]
* The data buffer into which the value shall be written.
*
* value [in]
* The Boolean value to write to the data buffer.
*
* Returns:
* The number of octets appended to the data buffer or would have been
* appended if the data_buffer contains a zero-sized buffer.
*
* Comments:
* None.
*/
std::size_t Serializer::Write(DataBuffer<> &data_buffer, Boolean value) const
{
if (data_buffer.GetBufferSize())
{
if (value)
{
data_buffer.AppendValue(static_cast<std::uint8_t>(1));
}
else
{
data_buffer.AppendValue(static_cast<std::uint8_t>(0));
}
}
return sizeof(std::uint8_t);
}
/*
* Write
*
* Description:
* This function will write a String to the end of the specified data
* buffer.
*
* Parameters:
* data_buffer [in]
* The data buffer into which the value shall be written.
*
* value [in]
* The String value to write to the data buffer.
*
* Returns:
* The number of octets appended to the data buffer or would have been
* appended if the data_buffer contains a zero-sized buffer.
*
* Comments:
* None.
*/
std::size_t Serializer::Write(DataBuffer<> &data_buffer,
const String &value) const
{
std::size_t total_length{};
// Write out the buffer length as a VarUint
total_length = Write(data_buffer, VarUint{value.size()});
// If the string is empty, just return
if (value.empty()) return total_length;
// Write out the actual string content if there is a string
if (data_buffer.GetBufferSize()) data_buffer.AppendValue(value);
// Update the octet count
total_length += value.length();
return total_length;
}
/*
* Serializer::Write
*
* Description:
* This function will write a vector of elements to the end of the
* specified data buffer.
*
* Parameters:
* data_buffer [in]
* The data buffer into which the value shall be written.
*
* value [in]
* The vector of values to write to the data buffer.
*
* Returns:
* The number of octets appended to the data buffer or would have been
* appended if the data_buffer contains a zero-sized buffer.
*
* Comments:
* None.
*/
std::size_t Serializer::Write(DataBuffer<> &data_buffer,
const Blob &value) const
{
std::size_t total_length{};
// Write out the number of Blob bytes that follow
total_length = Write(data_buffer, VarUint{value.size()});
// If the string is empty, just return
if (value.empty()) return total_length;
// Write out the actual string content if there is a string
if (data_buffer.GetBufferSize()) data_buffer.AppendValue(value);
// Update the octet count
total_length += value.size();
return total_length;
}
} // namespace gs
| 28.435159
| 80
| 0.631144
|
RichLogan
|
54ce01688c93bc76dcbc66d229cf6c5a6dd60dce
| 1,307
|
cpp
|
C++
|
7/E.cpp
|
CovarianceMomentum/dm-itmo
|
b87b65727d376895e23f9f2317c8e930dd420c5a
|
[
"MIT"
] | null | null | null |
7/E.cpp
|
CovarianceMomentum/dm-itmo
|
b87b65727d376895e23f9f2317c8e930dd420c5a
|
[
"MIT"
] | null | null | null |
7/E.cpp
|
CovarianceMomentum/dm-itmo
|
b87b65727d376895e23f9f2317c8e930dd420c5a
|
[
"MIT"
] | null | null | null |
//
// Created by covariance on 26.12.2020.
//
#include <bits/stdc++.h>
using namespace std;
unordered_set<bitset<20>> dependent;
void bitmask_dfs(bitset<20> mask) {
dependent.insert(mask);
if (mask.count() != 20) {
for (uint32_t i = 0; i != 20u; ++i) {
if (!mask.test(i)) {
mask.set(i);
if (dependent.find(mask) == dependent.end()) {
bitmask_dfs(mask);
}
mask.reset(i);
}
}
}
}
int main() {
#ifndef DEBUG
freopen("cycles.in", "r", stdin);
freopen("cycles.out", "w", stdout);
#endif
uint32_t n, m;
cin >> n >> m;
vector<pair<uint32_t, uint32_t>> weights(n);
for (uint32_t i = 0; i != n; ++i) {
cin >> weights[i].first;
weights[i].second = i;
}
uint32_t cnt, tmp;
bitset<20> set;
while (m--) {
set.reset();
cin >> cnt;
while (cnt--) {
cin >> tmp;
set.set(tmp - 1);
}
bitmask_dfs(set);
}
sort(weights.begin(), weights.end());
set.reset();
uint32_t weight = 0;
while (!weights.empty()) {
weight += weights.rbegin()->first;
set.set(weights.rbegin()->second);
if (dependent.find(set) != dependent.end()) {
weight -= weights.rbegin()->first;
set.reset(weights.rbegin()->second);
}
weights.pop_back();
}
cout << weight;
return 0;
}
| 19.80303
| 54
| 0.54935
|
CovarianceMomentum
|
54d08a888ae124a9b2fb0f7acdd84b2019606de3
| 816
|
cpp
|
C++
|
13- Linked Lists/findmidPoint.cpp
|
ShreyashRoyzada/C-plus-plus-Algorithms
|
9db89faf0a9b9e636aece3e7289f21ab6a1e3748
|
[
"MIT"
] | 21
|
2020-10-03T03:57:19.000Z
|
2022-03-25T22:41:05.000Z
|
13- Linked Lists/findmidPoint.cpp
|
ShreyashRoyzada/C-plus-plus-Algorithms
|
9db89faf0a9b9e636aece3e7289f21ab6a1e3748
|
[
"MIT"
] | 40
|
2020-10-02T07:02:34.000Z
|
2021-10-30T16:00:07.000Z
|
13- Linked Lists/findmidPoint.cpp
|
ShreyashRoyzada/C-plus-plus-Algorithms
|
9db89faf0a9b9e636aece3e7289f21ab6a1e3748
|
[
"MIT"
] | 90
|
2020-10-02T07:06:22.000Z
|
2022-03-25T22:41:17.000Z
|
#include<iostream>
using namespace std;
class node{
public:
int data;
node*next;
node(int d){
data=d;
node*next=NULL;
}
};
void insertAtBeginning(node*&head, int data){
node*n= new node(data);
n->next= head;
head=n;
}
void printNode(node*head){
while(head!=NULL){
cout<<head->data<<"->";
head= head->next;
}
}
node*middle(node*head){
if(head->next==NULL and head==NULL){
return head;
}
else{
node*slow;
node*fast;
while(fast->next!=NULL and fast!=NULL){
fast= head->next->next;
slow= head->next;
}
return slow;
}
}
int main()
{
node*head=NULL;
insertAtBeginning(head,4);
insertAtBeginning(head,3);
insertAtBeginning(head,2);
insertAtBeginning(head,1);
insertAtBeginning(head,8);
printNode(head);
cout<<endl;
node*m= middle(head);
cout<<m->data<<endl;
return 0;
}
| 15.396226
| 45
| 0.655637
|
ShreyashRoyzada
|
54d22e29fabfff883297742c415d9a11e5a1862b
| 932
|
cpp
|
C++
|
Engine/src/model.cpp
|
julienbernat/dmri-explorer
|
32639916b0a95ecc2ae7484f9e1a084f84c3035a
|
[
"MIT"
] | null | null | null |
Engine/src/model.cpp
|
julienbernat/dmri-explorer
|
32639916b0a95ecc2ae7484f9e1a084f84c3035a
|
[
"MIT"
] | null | null | null |
Engine/src/model.cpp
|
julienbernat/dmri-explorer
|
32639916b0a95ecc2ae7484f9e1a084f84c3035a
|
[
"MIT"
] | null | null | null |
#include <model.h>
#include <utils.hpp>
#include <iostream>
namespace Slicer
{
Model::Model(const std::shared_ptr<ApplicationState>& state)
:mState(state)
,mTransformGPUData(GPU::Binding::modelTransform)
,mCoordinateSystem()
,mIsInit(false)
{
}
Model::~Model()
{
}
void Model::initializeModel()
{
updateApplicationStateAtInit();
registerStateCallbacks();
initProgramPipeline();
mIsInit = true;
}
void Model::Draw()
{
if(!mIsInit)
{
throw std::runtime_error("Model::Draw() called before initializeModel()");
}
mProgramPipeline.Bind();
uploadTransformToGPU();
drawSpecific();
}
void Model::uploadTransformToGPU()
{
glm::mat4 transform = mCoordinateSystem->ToWorld();
mTransformGPUData.Update(0, sizeof(glm::mat4), &transform);
mTransformGPUData.ToGPU();
}
void Model::resetCS(std::shared_ptr<CoordinateSystem> cs)
{
mCoordinateSystem = cs;
}
} // namespace Slicer
| 18.64
| 82
| 0.698498
|
julienbernat
|
54d3a3eb3e6202b452e200ad5ccdbc9e4bc865b5
| 581
|
cpp
|
C++
|
Kawakawa/PhysicTest/Physic/ForceGenerator/ParticleForceGenerator/ForceGenerationRegistry.cpp
|
JiaqiJin/KawaiiDesune
|
e5c3031898f96f1ec5370b41371b2c1cf22c3586
|
[
"MIT"
] | null | null | null |
Kawakawa/PhysicTest/Physic/ForceGenerator/ParticleForceGenerator/ForceGenerationRegistry.cpp
|
JiaqiJin/KawaiiDesune
|
e5c3031898f96f1ec5370b41371b2c1cf22c3586
|
[
"MIT"
] | null | null | null |
Kawakawa/PhysicTest/Physic/ForceGenerator/ParticleForceGenerator/ForceGenerationRegistry.cpp
|
JiaqiJin/KawaiiDesune
|
e5c3031898f96f1ec5370b41371b2c1cf22c3586
|
[
"MIT"
] | null | null | null |
#include "../PrecompiledHeader.h"
#include "ForceGenerationRegistry.h"
namespace Physic
{
void ForceGenerationRegistry::RemoveForceGenerator(const IParticleForceGenerator* forceGenerator)
{
for (auto iter = forceGenerators.begin(); iter != forceGenerators.end(); ++iter)
{
if (*iter == forceGenerator)
{
forceGenerators.erase(iter);
break;
}
}
}
void ForceGenerationRegistry::UpdateForceGenerators(Particle* particle)
{
for (auto iter = forceGenerators.begin(); iter != forceGenerators.end(); ++iter)
{
(*iter)->UpdateForces(particle);
}
}
}
| 23.24
| 98
| 0.707401
|
JiaqiJin
|
54d521b3fe10fa2cd5a115f25348ec29ee237a8a
| 852
|
cpp
|
C++
|
201703/2.cpp
|
qzylalala/CSP
|
8bd474b0cb70b90c41e3fb87452724c5a2bc14fa
|
[
"Apache-2.0"
] | 23
|
2021-03-01T07:07:48.000Z
|
2022-03-19T12:49:14.000Z
|
201703/2.cpp
|
qzylalala/CSP
|
8bd474b0cb70b90c41e3fb87452724c5a2bc14fa
|
[
"Apache-2.0"
] | null | null | null |
201703/2.cpp
|
qzylalala/CSP
|
8bd474b0cb70b90c41e3fb87452724c5a2bc14fa
|
[
"Apache-2.0"
] | 2
|
2021-08-30T09:35:17.000Z
|
2021-09-10T12:26:13.000Z
|
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
int n, m;
int a[1010];
int main() {
cin >> n;
cin >> m;
for (int i = 1; i <= n; i++) a[i] = i;
while(m --) {
int p, q;
cin >> p >> q;
int idx;
for (int i = 1; i <= n; i++) {
if (a[i] == p) idx = i;
}
if (q > 0) {
for (int i = 1; i <= q; i++) {
int cur = idx + i - 1;
a[cur] = a[cur + 1];
}
a[idx + q] = p;
}
else {
q = -1 * q;
for (int i = 1; i <= q; i++) {
int cur = idx - i + 1;
a[cur] = a[cur - 1];
}
a[idx - q] = p;
}
}
for (int i = 1; i <= n; i++) cout << a[i] << " ";
cout << endl;
return 0;
}
| 18.933333
| 53
| 0.308685
|
qzylalala
|
54de68a0ba2a5cb767507d12925fd930b9eaf435
| 3,780
|
cc
|
C++
|
src/Modules/Legacy/DataIO/ReadMatrix.cc
|
benjaminlarson/SCIRunGUIPrototype
|
ed34ee11cda114e3761bd222a71a9f397517914d
|
[
"Unlicense"
] | null | null | null |
src/Modules/Legacy/DataIO/ReadMatrix.cc
|
benjaminlarson/SCIRunGUIPrototype
|
ed34ee11cda114e3761bd222a71a9f397517914d
|
[
"Unlicense"
] | null | null | null |
src/Modules/Legacy/DataIO/ReadMatrix.cc
|
benjaminlarson/SCIRunGUIPrototype
|
ed34ee11cda114e3761bd222a71a9f397517914d
|
[
"Unlicense"
] | null | null | null |
/*
For more information, please see: http://software.sci.utah.edu
The MIT License
Copyright (c) 2009 Scientific Computing and Imaging Institute,
University of Utah.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
///
/// @file ReadMatrix.cc
///
/// @author
/// Steven G. Parker
/// Department of Computer Science
/// University of Utah
/// @date July 1994
///
#include <Dataflow/Network/Ports/MatrixPort.h>
#include <Dataflow/Modules/DataIO/GenericReader.h>
#include <Core/ImportExport/Matrix/MatrixIEPlugin.h>
namespace SCIRun {
template class GenericReader<MatrixHandle>;
/// @class ReadMatrix
/// @brief This module reads a matrix from file
///
/// (a SCIRun .mat file and various other file formats using a plugin system).
class ReadMatrix : public GenericReader<MatrixHandle> {
protected:
GuiString gui_types_;
GuiString gui_filetype_;
virtual bool call_importer(const std::string &filename, MatrixHandle &fHandle);
public:
ReadMatrix(GuiContext* ctx);
virtual ~ReadMatrix() {}
virtual void execute();
};
DECLARE_MAKER(ReadMatrix)
ReadMatrix::ReadMatrix(GuiContext* ctx)
: GenericReader<MatrixHandle>("ReadMatrix", ctx, "DataIO", "SCIRun"),
gui_types_(get_ctx()->subVar("types", false)),
gui_filetype_(get_ctx()->subVar("filetype"))
{
MatrixIEPluginManager mgr;
std::vector<std::string> importers;
mgr.get_importer_list(importers);
std::string importtypes = "{";
importtypes += "{{SCIRun Matrix File} {.mat} } ";
for (unsigned int i = 0; i < importers.size(); i++)
{
MatrixIEPlugin *pl = mgr.get_plugin(importers[i]);
if (pl->fileExtension_ != "")
{
importtypes += "{{" + importers[i] + "} {" + pl->fileExtension_ + "} } ";
}
else
{
importtypes += "{{" + importers[i] + "} {.*} } ";
}
}
importtypes += "}";
gui_types_.set(importtypes);
}
bool
ReadMatrix::call_importer(const std::string &filename, MatrixHandle &mHandle)
{
const std::string ftpre = gui_filetype_.get();
const std::string::size_type loc = ftpre.find(" (");
const std::string ft = ftpre.substr(0, loc);
MatrixIEPluginManager mgr;
MatrixIEPlugin *pl = mgr.get_plugin(ft);
if (pl)
{
mHandle = pl->fileReader_(this, filename.c_str());
return mHandle.get_rep();
}
return false;
}
void
ReadMatrix::execute()
{
if (gui_types_.changed() || gui_filetype_.changed()) inputs_changed_ = true;
const std::string ftpre = gui_filetype_.get();
const std::string::size_type loc = ftpre.find(" (");
const std::string ft = ftpre.substr(0, loc);
importing_ = !(ft == "" ||
ft == "SCIRun Matrix File" ||
ft == "SCIRun Matrix Any");
GenericReader<MatrixHandle>::execute();
}
} // End namespace SCIRun
| 28.421053
| 83
| 0.692328
|
benjaminlarson
|
54e001bb8984467c6e695ea4fb4b844c42bb16fd
| 59,348
|
tcc
|
C++
|
include/solvers/mpm_base.tcc
|
jgiven100/mpm-1
|
adc83ab57782874d4dce1ac13be46bca1754a0fe
|
[
"MIT"
] | null | null | null |
include/solvers/mpm_base.tcc
|
jgiven100/mpm-1
|
adc83ab57782874d4dce1ac13be46bca1754a0fe
|
[
"MIT"
] | null | null | null |
include/solvers/mpm_base.tcc
|
jgiven100/mpm-1
|
adc83ab57782874d4dce1ac13be46bca1754a0fe
|
[
"MIT"
] | null | null | null |
//! Constructor
template <unsigned Tdim>
mpm::MPMBase<Tdim>::MPMBase(const std::shared_ptr<IO>& io) : mpm::MPM(io) {
//! Logger
console_ = spdlog::get("MPMBase");
// Create a mesh with global id 0
const mpm::Index id = 0;
// Set analysis step to start at 0
step_ = 0;
// Set mesh as isoparametric
bool isoparametric = is_isoparametric();
mesh_ = std::make_shared<mpm::Mesh<Tdim>>(id, isoparametric);
// Create constraints
constraints_ = std::make_shared<mpm::Constraints<Tdim>>(mesh_);
// Empty all materials
materials_.clear();
// Variable list
tsl::robin_map<std::string, VariableType> variables = {
// Scalar variables
{"mass", VariableType::Scalar},
{"volume", VariableType::Scalar},
{"mass_density", VariableType::Scalar},
// Vector variables
{"displacements", VariableType::Vector},
{"velocities", VariableType::Vector},
{"normals", VariableType::Vector},
// Tensor variables
{"strains", VariableType::Tensor},
{"stresses", VariableType::Tensor}};
try {
analysis_ = io_->analysis();
// Time-step size
dt_ = analysis_["dt"].template get<double>();
// Number of time steps
nsteps_ = analysis_["nsteps"].template get<mpm::Index>();
// nload balance
if (analysis_.find("nload_balance_steps") != analysis_.end())
nload_balance_steps_ =
analysis_["nload_balance_steps"].template get<mpm::Index>();
// Locate particles
if (analysis_.find("locate_particles") != analysis_.end())
locate_particles_ = analysis_["locate_particles"].template get<bool>();
// Stress update method (USF/USL/MUSL/Newmark)
try {
if (analysis_.find("mpm_scheme") != analysis_.end())
stress_update_ = analysis_["mpm_scheme"].template get<std::string>();
} catch (std::exception& exception) {
console_->warn(
"{} #{}: {}. Stress update method is not specified, using USF as "
"default",
__FILE__, __LINE__, exception.what());
}
// Velocity update
try {
velocity_update_ = analysis_["velocity_update"].template get<bool>();
} catch (std::exception& exception) {
console_->warn(
"{} #{}: Velocity update parameter is not specified, using default "
"as false",
__FILE__, __LINE__, exception.what());
velocity_update_ = false;
}
// Damping
try {
if (analysis_.find("damping") != analysis_.end()) {
if (!initialise_damping(analysis_.at("damping")))
throw std::runtime_error("Damping parameters are not defined");
}
} catch (std::exception& exception) {
console_->warn("{} #{}: Damping is not specified, using none as default",
__FILE__, __LINE__, exception.what());
}
// Math functions
try {
// Get materials properties
auto math_functions = io_->json_object("math_functions");
if (!math_functions.empty())
this->initialise_math_functions(math_functions);
} catch (std::exception& exception) {
console_->warn("{} #{}: No math functions are defined", __FILE__,
__LINE__, exception.what());
}
post_process_ = io_->post_processing();
// Output steps
output_steps_ = post_process_["output_steps"].template get<mpm::Index>();
} catch (std::domain_error& domain_error) {
console_->error("{} {} Get analysis object: {}", __FILE__, __LINE__,
domain_error.what());
abort();
}
// VTK particle variables
// Initialise container with empty vector
vtk_vars_.insert(
std::make_pair(mpm::VariableType::Scalar, std::vector<std::string>()));
vtk_vars_.insert(
std::make_pair(mpm::VariableType::Vector, std::vector<std::string>()));
vtk_vars_.insert(
std::make_pair(mpm::VariableType::Tensor, std::vector<std::string>()));
if ((post_process_.find("vtk") != post_process_.end()) &&
post_process_.at("vtk").is_array() &&
post_process_.at("vtk").size() > 0) {
// Iterate over vtk
for (unsigned i = 0; i < post_process_.at("vtk").size(); ++i) {
std::string attribute =
post_process_["vtk"][i].template get<std::string>();
if (variables.find(attribute) != variables.end())
vtk_vars_[variables.at(attribute)].emplace_back(attribute);
else {
console_->warn(
"{} #{}: VTK variable '{}' was specified, but is not available "
"in variable list",
__FILE__, __LINE__, attribute);
}
}
} else {
console_->warn(
"{} #{}: No VTK variables were specified, none will be generated",
__FILE__, __LINE__);
}
// VTK state variables
bool vtk_statevar = false;
if ((post_process_.find("vtk_statevars") != post_process_.end()) &&
post_process_.at("vtk_statevars").is_array() &&
post_process_.at("vtk_statevars").size() > 0) {
// Iterate over state_vars
for (const auto& svars : post_process_["vtk_statevars"]) {
// Phase id
unsigned phase_id = 0;
if (svars.contains("phase_id"))
phase_id = svars.at("phase_id").template get<unsigned>();
// State variables
if (svars.at("statevars").is_array() &&
svars.at("statevars").size() > 0) {
// Insert vtk_statevars_
const std::vector<std::string> state_var = svars["statevars"];
vtk_statevars_.insert(std::make_pair(phase_id, state_var));
vtk_statevar = true;
} else {
vtk_statevar = false;
break;
}
}
}
if (!vtk_statevar)
console_->warn(
"{} #{}: No VTK statevariable were specified, none will be generated",
__FILE__, __LINE__);
}
// Initialise mesh
template <unsigned Tdim>
void mpm::MPMBase<Tdim>::initialise_mesh() {
// Initialise MPI rank and size
int mpi_rank = 0;
int mpi_size = 1;
#ifdef USE_MPI
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
// Get number of MPI ranks
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
#endif
// Get mesh properties
auto mesh_props = io_->json_object("mesh");
// Get Mesh reader from JSON object
const std::string io_type = mesh_props["io_type"].template get<std::string>();
bool check_duplicates = true;
try {
check_duplicates = mesh_props["check_duplicates"].template get<bool>();
} catch (std::exception& exception) {
console_->warn(
"{} #{}: Check duplicates, not specified setting default as true",
__FILE__, __LINE__, exception.what());
check_duplicates = true;
}
// Create a mesh reader
auto mesh_io = Factory<mpm::IOMesh<Tdim>>::instance()->create(io_type);
auto nodes_begin = std::chrono::steady_clock::now();
// Global Index
mpm::Index gid = 0;
// Node type
const auto node_type = mesh_props["node_type"].template get<std::string>();
// Mesh file
std::string mesh_file =
io_->file_name(mesh_props["mesh"].template get<std::string>());
// Create nodes from file
bool node_status =
mesh_->create_nodes(gid, // global id
node_type, // node type
mesh_io->read_mesh_nodes(mesh_file), // coordinates
check_duplicates); // check dups
if (!node_status)
throw std::runtime_error(
"mpm::base::init_mesh(): Addition of nodes to mesh failed");
auto nodes_end = std::chrono::steady_clock::now();
console_->info("Rank {} Read nodes: {} ms", mpi_rank,
std::chrono::duration_cast<std::chrono::milliseconds>(
nodes_end - nodes_begin)
.count());
// Read and assign node sets
this->node_entity_sets(mesh_props, check_duplicates);
// Read nodal euler angles and assign rotation matrices
this->node_euler_angles(mesh_props, mesh_io);
// Read and assign velocity constraints
this->nodal_velocity_constraints(mesh_props, mesh_io);
// Read and assign velocity constraints for implicit solver
this->nodal_displacement_constraints(mesh_props, mesh_io);
// Read and assign friction constraints
this->nodal_frictional_constraints(mesh_props, mesh_io);
// Read and assign pressure constraints
this->nodal_pressure_constraints(mesh_props, mesh_io);
// Initialise cell
auto cells_begin = std::chrono::steady_clock::now();
// Shape function name
const auto cell_type = mesh_props["cell_type"].template get<std::string>();
// Shape function
std::shared_ptr<mpm::Element<Tdim>> element =
Factory<mpm::Element<Tdim>>::instance()->create(cell_type);
// Create cells from file
bool cell_status =
mesh_->create_cells(gid, // global id
element, // element type
mesh_io->read_mesh_cells(mesh_file), // Node ids
check_duplicates); // Check dups
if (!cell_status)
throw std::runtime_error(
"mpm::base::init_mesh(): Addition of cells to mesh failed");
// Compute cell neighbours
mesh_->find_cell_neighbours();
// Read and assign cell sets
this->cell_entity_sets(mesh_props, check_duplicates);
// Use Nonlocal basis
if (cell_type.back() == 'B') {
this->initialise_nonlocal_mesh(mesh_props);
}
auto cells_end = std::chrono::steady_clock::now();
console_->info("Rank {} Read cells: {} ms", mpi_rank,
std::chrono::duration_cast<std::chrono::milliseconds>(
cells_end - cells_begin)
.count());
}
// Initialise particle types
template <unsigned Tdim>
void mpm::MPMBase<Tdim>::initialise_particle_types() {
// Get particles properties
auto json_particles = io_->json_object("particles");
for (const auto& json_particle : json_particles) {
// Gather particle types
auto particle_type =
json_particle["generator"]["particle_type"].template get<std::string>();
particle_types_.insert(particle_type);
}
}
// Initialise particles
template <unsigned Tdim>
void mpm::MPMBase<Tdim>::initialise_particles() {
// Initialise MPI rank and size
int mpi_rank = 0;
int mpi_size = 1;
#ifdef USE_MPI
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
// Get number of MPI ranks
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
#endif
// Get mesh properties
auto mesh_props = io_->json_object("mesh");
// Get Mesh reader from JSON object
const std::string io_type = mesh_props["io_type"].template get<std::string>();
// Check duplicates default set to true
bool check_duplicates = true;
if (mesh_props.find("check_duplicates") != mesh_props.end())
check_duplicates = mesh_props["check_duplicates"].template get<bool>();
auto particles_gen_begin = std::chrono::steady_clock::now();
// Get particles properties
auto json_particles = io_->json_object("particles");
for (const auto& json_particle : json_particles) {
// Generate particles
bool gen_status =
mesh_->generate_particles(io_, json_particle["generator"]);
if (!gen_status)
std::runtime_error(
"mpm::base::init_particles() Generate particles failed");
}
// Gather particle types
this->initialise_particle_types();
auto particles_gen_end = std::chrono::steady_clock::now();
console_->info("Rank {} Generate particles: {} ms", mpi_rank,
std::chrono::duration_cast<std::chrono::milliseconds>(
particles_gen_end - particles_gen_begin)
.count());
auto particles_locate_begin = std::chrono::steady_clock::now();
// Create a mesh reader
auto particle_io = Factory<mpm::IOMesh<Tdim>>::instance()->create(io_type);
// Read and assign particles cells
this->particles_cells(mesh_props, particle_io);
// Locate particles in cell
auto unlocatable_particles = mesh_->locate_particles_mesh();
if (!unlocatable_particles.empty())
throw std::runtime_error(
"mpm::base::init_particles() Particle outside the mesh domain");
// Write particles and cells to file
particle_io->write_particles_cells(
io_->output_file("particles-cells", ".txt", uuid_, 0, 0).string(),
mesh_->particles_cells());
auto particles_locate_end = std::chrono::steady_clock::now();
console_->info("Rank {} Locate particles: {} ms", mpi_rank,
std::chrono::duration_cast<std::chrono::milliseconds>(
particles_locate_end - particles_locate_begin)
.count());
auto particles_volume_begin = std::chrono::steady_clock::now();
// Compute volume
mesh_->iterate_over_particles(std::bind(
&mpm::ParticleBase<Tdim>::compute_volume, std::placeholders::_1));
// Read and assign particles volumes
this->particles_volumes(mesh_props, particle_io);
// Read and assign particles stresses
this->particles_stresses(mesh_props, particle_io);
// Read and assign particles initial pore pressure
this->particles_pore_pressures(mesh_props, particle_io);
auto particles_volume_end = std::chrono::steady_clock::now();
console_->info("Rank {} Read volume, velocity and stresses: {} ms", mpi_rank,
std::chrono::duration_cast<std::chrono::milliseconds>(
particles_volume_end - particles_volume_begin)
.count());
// Particle entity sets
this->particle_entity_sets(check_duplicates);
// Read and assign particles velocity constraints
this->particle_velocity_constraints();
console_->info("Rank {} Create particle sets: {} ms", mpi_rank,
std::chrono::duration_cast<std::chrono::milliseconds>(
particles_volume_end - particles_volume_begin)
.count());
// Material id update using particle sets
try {
auto material_sets = io_->json_object("material_sets");
if (!material_sets.empty()) {
for (const auto& material_set : material_sets) {
unsigned material_id =
material_set["material_id"].template get<unsigned>();
unsigned phase_id = mpm::ParticlePhase::Solid;
if (material_set.contains("phase_id"))
phase_id = material_set["phase_id"].template get<unsigned>();
unsigned pset_id = material_set["pset_id"].template get<unsigned>();
// Update material_id for particles in each pset
mesh_->iterate_over_particle_set(
pset_id, std::bind(&mpm::ParticleBase<Tdim>::assign_material,
std::placeholders::_1,
materials_.at(material_id), phase_id));
}
}
} catch (std::exception& exception) {
console_->warn("{} #{}: Material sets are not specified", __FILE__,
__LINE__, exception.what());
}
}
// Initialise materials
template <unsigned Tdim>
void mpm::MPMBase<Tdim>::initialise_materials() {
// Get materials properties
auto materials = io_->json_object("materials");
for (const auto material_props : materials) {
// Get material type
const std::string material_type =
material_props["type"].template get<std::string>();
// Get material id
auto material_id = material_props["id"].template get<unsigned>();
// Create a new material from JSON object
auto mat =
Factory<mpm::Material<Tdim>, unsigned, const Json&>::instance()->create(
material_type, std::move(material_id), material_props);
// Add material to list
auto result = materials_.insert(std::make_pair(mat->id(), mat));
// If insert material failed
if (!result.second)
throw std::runtime_error(
"mpm::base::init_materials(): New material cannot be added, "
"insertion failed");
}
// Copy materials to mesh
mesh_->initialise_material_models(this->materials_);
}
//! Checkpoint resume
template <unsigned Tdim>
bool mpm::MPMBase<Tdim>::checkpoint_resume() {
bool checkpoint = true;
try {
int mpi_rank = 0;
#ifdef USE_MPI
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
#endif
// Gather particle types
this->initialise_particle_types();
if (!analysis_["resume"]["resume"].template get<bool>())
throw std::runtime_error("Resume analysis option is disabled!");
// Get unique analysis id
this->uuid_ = analysis_["resume"]["uuid"].template get<std::string>();
// Get step
this->step_ = analysis_["resume"]["step"].template get<mpm::Index>();
// Input particle h5 file for resume
for (const auto ptype : particle_types_) {
std::string attribute = mpm::ParticlePODTypeName.at(ptype);
std::string extension = ".h5";
auto particles_file =
io_->output_file(attribute, extension, uuid_, step_, this->nsteps_)
.string();
// Load particle information from file
mesh_->read_particles_hdf5(particles_file, attribute, ptype);
}
// Clear all particle ids
mesh_->iterate_over_cells(
std::bind(&mpm::Cell<Tdim>::clear_particle_ids, std::placeholders::_1));
// Locate particles
auto unlocatable_particles = mesh_->locate_particles_mesh();
if (!unlocatable_particles.empty())
throw std::runtime_error("Particle outside the mesh domain");
console_->info("Checkpoint resume at step {} of {}", this->step_,
this->nsteps_);
} catch (std::exception& exception) {
console_->info("{} {} Resume failed, restarting analysis: {}", __FILE__,
__LINE__, exception.what());
this->step_ = 0;
checkpoint = false;
}
return checkpoint;
}
//! Write HDF5 files
template <unsigned Tdim>
void mpm::MPMBase<Tdim>::write_hdf5(mpm::Index step, mpm::Index max_steps) {
// Write hdf5 file for single phase particle
for (const auto ptype : particle_types_) {
std::string attribute = mpm::ParticlePODTypeName.at(ptype);
std::string extension = ".h5";
auto particles_file =
io_->output_file(attribute, extension, uuid_, step, max_steps).string();
// Load particle information from file
if (attribute == "particles" || attribute == "fluid_particles")
mesh_->write_particles_hdf5(particles_file);
else if (attribute == "twophase_particles")
mesh_->write_particles_hdf5_twophase(particles_file);
}
}
#ifdef USE_VTK
//! Write VTK files
template <unsigned Tdim>
void mpm::MPMBase<Tdim>::write_vtk(mpm::Index step, mpm::Index max_steps) {
// VTK PolyData writer
auto vtk_writer = std::make_unique<VtkWriter>(mesh_->particle_coordinates());
// Write mesh on step 0
// Get active node pairs use true
if (step % nload_balance_steps_ == 0)
vtk_writer->write_mesh(
io_->output_file("mesh", ".vtp", uuid_, step, max_steps).string(),
mesh_->nodal_coordinates(), mesh_->node_pairs(true));
// Write input geometry to vtk file
const std::string extension = ".vtp";
const std::string attribute = "geometry";
auto meshfile =
io_->output_file(attribute, extension, uuid_, step, max_steps).string();
vtk_writer->write_geometry(meshfile);
// MPI parallel vtk file
int mpi_rank = 0;
int mpi_size = 1;
bool write_mpi_rank = false;
#ifdef USE_MPI
// Get MPI rank
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
// Get number of MPI ranks
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
#endif
//! VTK scalar variables
for (const auto& attribute : vtk_vars_.at(mpm::VariableType::Scalar)) {
// Write scalar
auto file =
io_->output_file(attribute, extension, uuid_, step, max_steps).string();
vtk_writer->write_scalar_point_data(
file, mesh_->particles_scalar_data(attribute), attribute);
// Write a parallel MPI VTK container file
#ifdef USE_MPI
if (mpi_rank == 0 && mpi_size > 1) {
auto parallel_file = io_->output_file(attribute, ".pvtp", uuid_, step,
max_steps, write_mpi_rank)
.string();
vtk_writer->write_parallel_vtk(parallel_file, attribute, mpi_size, step,
max_steps, 1);
}
#endif
}
//! VTK vector variables
for (const auto& attribute : vtk_vars_.at(mpm::VariableType::Vector)) {
// Write vector
auto file =
io_->output_file(attribute, extension, uuid_, step, max_steps).string();
vtk_writer->write_vector_point_data(
file, mesh_->particles_vector_data(attribute), attribute);
// Write a parallel MPI VTK container file
#ifdef USE_MPI
if (mpi_rank == 0 && mpi_size > 1) {
auto parallel_file = io_->output_file(attribute, ".pvtp", uuid_, step,
max_steps, write_mpi_rank)
.string();
vtk_writer->write_parallel_vtk(parallel_file, attribute, mpi_size, step,
max_steps, 3);
}
#endif
}
//! VTK tensor variables
for (const auto& attribute : vtk_vars_.at(mpm::VariableType::Tensor)) {
// Write vector
auto file =
io_->output_file(attribute, extension, uuid_, step, max_steps).string();
vtk_writer->write_tensor_point_data(
file, mesh_->template particles_tensor_data<6>(attribute), attribute);
// Write a parallel MPI VTK container file
#ifdef USE_MPI
if (mpi_rank == 0 && mpi_size > 1) {
auto parallel_file = io_->output_file(attribute, ".pvtp", uuid_, step,
max_steps, write_mpi_rank)
.string();
vtk_writer->write_parallel_vtk(parallel_file, attribute, mpi_size, step,
max_steps, 9);
}
#endif
}
// VTK state variables
for (auto const& vtk_statevar : vtk_statevars_) {
unsigned phase_id = vtk_statevar.first;
for (const auto& attribute : vtk_statevar.second) {
std::string phase_attribute =
"phase" + std::to_string(phase_id) + attribute;
// Write state variables
auto file =
io_->output_file(phase_attribute, extension, uuid_, step, max_steps)
.string();
vtk_writer->write_scalar_point_data(
file, mesh_->particles_statevars_data(attribute, phase_id),
phase_attribute);
// Write a parallel MPI VTK container file
#ifdef USE_MPI
if (mpi_rank == 0 && mpi_size > 1) {
auto parallel_file = io_->output_file(phase_attribute, ".pvtp", uuid_,
step, max_steps, write_mpi_rank)
.string();
unsigned ncomponents = 1;
vtk_writer->write_parallel_vtk(parallel_file, phase_attribute, mpi_size,
step, max_steps, ncomponents);
}
#endif
}
}
}
#endif
#ifdef USE_PARTIO
//! Write Partio files
template <unsigned Tdim>
void mpm::MPMBase<Tdim>::write_partio(mpm::Index step, mpm::Index max_steps) {
// MPI parallel partio file
int mpi_rank = 0;
int mpi_size = 1;
#ifdef USE_MPI
// Get MPI rank
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
// Get number of MPI ranks
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
#endif
// Get Partio file extensions
const std::string extension = ".bgeo";
const std::string attribute = "partio";
// Create filename
auto file =
io_->output_file(attribute, extension, uuid_, step, max_steps).string();
// Write partio file
mpm::partio::write_particles(file, mesh_->particles_hdf5());
}
#endif // USE_PARTIO
//! Output results
template <unsigned Tdim>
void mpm::MPMBase<Tdim>::write_outputs(mpm::Index step) {
if (step % this->output_steps_ == 0) {
// HDF5 outputs
this->write_hdf5(step, this->nsteps_);
#ifdef USE_VTK
// VTK outputs
this->write_vtk(step, this->nsteps_);
#endif
#ifdef USE_PARTIO
// Partio outputs
this->write_partio(step, this->nsteps_);
#endif
}
}
//! Return if a mesh is isoparametric
template <unsigned Tdim>
bool mpm::MPMBase<Tdim>::is_isoparametric() {
bool isoparametric = true;
try {
const auto mesh_props = io_->json_object("mesh");
isoparametric = mesh_props.at("isoparametric").template get<bool>();
} catch (std::exception& exception) {
console_->warn(
"{} {} Isoparametric status of mesh: {}\n Setting mesh as "
"isoparametric.",
__FILE__, __LINE__, exception.what());
isoparametric = true;
}
return isoparametric;
}
//! Initialise loads
template <unsigned Tdim>
void mpm::MPMBase<Tdim>::initialise_loads() {
auto loads = io_->json_object("external_loading_conditions");
// Initialise gravity loading
gravity_.setZero();
if (loads.at("gravity").is_array() &&
loads.at("gravity").size() == gravity_.size()) {
for (unsigned i = 0; i < gravity_.size(); ++i) {
gravity_[i] = loads.at("gravity").at(i);
}
// Assign initial particle acceleration as gravity
mesh_->iterate_over_particles(
std::bind(&mpm::ParticleBase<Tdim>::assign_acceleration,
std::placeholders::_1, gravity_));
} else {
throw std::runtime_error("Specified gravity dimension is invalid");
}
// Create a file reader
const std::string io_type =
io_->json_object("mesh")["io_type"].template get<std::string>();
auto reader = Factory<mpm::IOMesh<Tdim>>::instance()->create(io_type);
// Read and assign particles surface tractions
if (loads.find("particle_surface_traction") != loads.end()) {
for (const auto& ptraction : loads["particle_surface_traction"]) {
// Get the math function
std::shared_ptr<FunctionBase> tfunction = nullptr;
// If a math function is defined set to function or use scalar
if (ptraction.find("math_function_id") != ptraction.end())
tfunction = math_functions_.at(
ptraction.at("math_function_id").template get<unsigned>());
// Set id
int pset_id = ptraction.at("pset_id").template get<int>();
// Direction
unsigned dir = ptraction.at("dir").template get<unsigned>();
// Traction
double traction = ptraction.at("traction").template get<double>();
// Create particle surface tractions
bool particles_tractions =
mesh_->create_particles_tractions(tfunction, pset_id, dir, traction);
if (!particles_tractions)
throw std::runtime_error(
"Particles tractions are not properly assigned");
}
} else
console_->warn("No particle surface traction is defined for the analysis");
// Read and assign nodal concentrated forces
if (loads.find("concentrated_nodal_forces") != loads.end()) {
for (const auto& nforce : loads["concentrated_nodal_forces"]) {
// Forces are specified in a file
if (nforce.find("file") != nforce.end()) {
std::string force_file = nforce.at("file").template get<std::string>();
bool nodal_forces = mesh_->assign_nodal_concentrated_forces(
reader->read_forces(io_->file_name(force_file)));
if (!nodal_forces)
throw std::runtime_error(
"Nodal force file is invalid, forces are not properly "
"assigned");
set_node_concentrated_force_ = true;
} else {
// Get the math function
std::shared_ptr<FunctionBase> ffunction = nullptr;
if (nforce.find("math_function_id") != nforce.end())
ffunction = math_functions_.at(
nforce.at("math_function_id").template get<unsigned>());
// Set id
int nset_id = nforce.at("nset_id").template get<int>();
// Direction
unsigned dir = nforce.at("dir").template get<unsigned>();
// Traction
double force = nforce.at("force").template get<double>();
// Read and assign nodal concentrated forces
bool nodal_force = mesh_->assign_nodal_concentrated_forces(
ffunction, nset_id, dir, force);
if (!nodal_force)
throw std::runtime_error(
"Concentrated nodal forces are not properly assigned");
set_node_concentrated_force_ = true;
}
}
} else
console_->warn("No concentrated nodal force is defined for the analysis");
}
//! Initialise math functions
template <unsigned Tdim>
bool mpm::MPMBase<Tdim>::initialise_math_functions(const Json& math_functions) {
bool status = true;
try {
// Get materials properties
for (const auto& function_props : math_functions) {
// Get math function id
auto function_id = function_props["id"].template get<unsigned>();
// Get function type
const std::string function_type =
function_props["type"].template get<std::string>();
// Create a new function from JSON object
auto function =
Factory<mpm::FunctionBase, unsigned, const Json&>::instance()->create(
function_type, std::move(function_id), function_props);
// Add material to list
auto insert_status =
math_functions_.insert(std::make_pair(function->id(), function));
// If insert material failed
if (!insert_status.second) {
status = false;
throw std::runtime_error(
"Invalid properties for new math function, fn insertion failed");
}
}
} catch (std::exception& exception) {
console_->error("#{}: Reading math functions: {}", __LINE__,
exception.what());
status = false;
}
return status;
}
//! Node entity sets
template <unsigned Tdim>
void mpm::MPMBase<Tdim>::node_entity_sets(const Json& mesh_props,
bool check_duplicates) {
try {
if (mesh_props.find("entity_sets") != mesh_props.end()) {
std::string entity_sets =
mesh_props["entity_sets"].template get<std::string>();
if (!io_->file_name(entity_sets).empty()) {
bool node_sets = mesh_->create_node_sets(
(io_->entity_sets(io_->file_name(entity_sets), "node_sets")),
check_duplicates);
if (!node_sets)
throw std::runtime_error("Node sets are not properly assigned");
}
} else
throw std::runtime_error("Entity set JSON not found");
} catch (std::exception& exception) {
console_->warn("#{}: Entity sets are undefined {} ", __LINE__,
exception.what());
}
}
//! Node Euler angles
template <unsigned Tdim>
void mpm::MPMBase<Tdim>::node_euler_angles(
const Json& mesh_props, const std::shared_ptr<mpm::IOMesh<Tdim>>& mesh_io) {
try {
if (mesh_props.find("boundary_conditions") != mesh_props.end() &&
mesh_props["boundary_conditions"].find("nodal_euler_angles") !=
mesh_props["boundary_conditions"].end()) {
std::string euler_angles =
mesh_props["boundary_conditions"]["nodal_euler_angles"]
.template get<std::string>();
if (!io_->file_name(euler_angles).empty()) {
bool rotation_matrices = mesh_->compute_nodal_rotation_matrices(
mesh_io->read_euler_angles(io_->file_name(euler_angles)));
if (!rotation_matrices)
throw std::runtime_error(
"Euler angles are not properly assigned/computed");
}
} else
throw std::runtime_error("Euler angles JSON not found");
} catch (std::exception& exception) {
console_->warn("#{}: Euler angles are undefined {} ", __LINE__,
exception.what());
}
}
// Nodal velocity constraints
template <unsigned Tdim>
void mpm::MPMBase<Tdim>::nodal_velocity_constraints(
const Json& mesh_props, const std::shared_ptr<mpm::IOMesh<Tdim>>& mesh_io) {
try {
// Read and assign velocity constraints
if (mesh_props.find("boundary_conditions") != mesh_props.end() &&
mesh_props["boundary_conditions"].find("velocity_constraints") !=
mesh_props["boundary_conditions"].end()) {
// Iterate over velocity constraints
for (const auto& constraints :
mesh_props["boundary_conditions"]["velocity_constraints"]) {
// Velocity constraints are specified in a file
if (constraints.find("file") != constraints.end()) {
std::string velocity_constraints_file =
constraints.at("file").template get<std::string>();
bool velocity_constraints =
constraints_->assign_nodal_velocity_constraints(
mesh_io->read_velocity_constraints(
io_->file_name(velocity_constraints_file)));
if (!velocity_constraints)
throw std::runtime_error(
"Velocity constraints are not properly assigned");
} else {
// Set id
int nset_id = constraints.at("nset_id").template get<int>();
// Direction
unsigned dir = constraints.at("dir").template get<unsigned>();
// Velocity
double velocity = constraints.at("velocity").template get<double>();
// Add velocity constraint to mesh
auto velocity_constraint =
std::make_shared<mpm::VelocityConstraint>(nset_id, dir, velocity);
bool velocity_constraints =
constraints_->assign_nodal_velocity_constraint(
nset_id, velocity_constraint);
if (!velocity_constraints)
throw std::runtime_error(
"Nodal velocity constraint is not properly assigned");
}
}
} else
throw std::runtime_error("Velocity constraints JSON not found");
} catch (std::exception& exception) {
console_->warn("#{}: Velocity constraints are undefined {} ", __LINE__,
exception.what());
}
}
// Nodal displacement constraints for implicit solver
template <unsigned Tdim>
void mpm::MPMBase<Tdim>::nodal_displacement_constraints(
const Json& mesh_props, const std::shared_ptr<mpm::IOMesh<Tdim>>& mesh_io) {
try {
// Read and assign displacement constraints
if (mesh_props.find("boundary_conditions") != mesh_props.end() &&
mesh_props["boundary_conditions"].find("displacement_constraints") !=
mesh_props["boundary_conditions"].end()) {
// Iterate over displacement constraints
for (const auto& constraints :
mesh_props["boundary_conditions"]["displacement_constraints"]) {
// Displacement constraints are specified in a file
if (constraints.find("file") != constraints.end()) {
std::string displacement_constraints_file =
constraints.at("file").template get<std::string>();
bool displacement_constraints =
constraints_->assign_nodal_displacement_constraints(
mesh_io->read_displacement_constraints(
io_->file_name(displacement_constraints_file)));
if (!displacement_constraints)
throw std::runtime_error(
"Displacement constraints are not properly assigned");
} else {
// Get the math function
std::shared_ptr<FunctionBase> dfunction = nullptr;
if (constraints.find("math_function_id") != constraints.end())
dfunction = math_functions_.at(
constraints.at("math_function_id").template get<unsigned>());
// Set id
int nset_id = constraints.at("nset_id").template get<int>();
// Direction
unsigned dir = constraints.at("dir").template get<unsigned>();
// Displacement
double displacement =
constraints.at("displacement").template get<double>();
// Add displacement constraint to mesh
auto displacement_constraint =
std::make_shared<mpm::DisplacementConstraint>(nset_id, dir,
displacement);
bool displacement_constraints =
constraints_->assign_nodal_displacement_constraint(
dfunction, nset_id, displacement_constraint);
if (!displacement_constraints)
throw std::runtime_error(
"Nodal displacement constraint is not properly assigned");
}
}
} else
throw std::runtime_error("Displacement constraints JSON not found");
} catch (std::exception& exception) {
console_->warn("#{}: Displacement constraints are undefined {} ", __LINE__,
exception.what());
}
}
// Nodal frictional constraints
template <unsigned Tdim>
void mpm::MPMBase<Tdim>::nodal_frictional_constraints(
const Json& mesh_props, const std::shared_ptr<mpm::IOMesh<Tdim>>& mesh_io) {
try {
// Read and assign friction constraints
if (mesh_props.find("boundary_conditions") != mesh_props.end() &&
mesh_props["boundary_conditions"].find("friction_constraints") !=
mesh_props["boundary_conditions"].end()) {
// Iterate over velocity constraints
for (const auto& constraints :
mesh_props["boundary_conditions"]["friction_constraints"]) {
// Friction constraints are specified in a file
if (constraints.find("file") != constraints.end()) {
std::string friction_constraints_file =
constraints.at("file").template get<std::string>();
bool friction_constraints =
constraints_->assign_nodal_friction_constraints(
mesh_io->read_friction_constraints(
io_->file_name(friction_constraints_file)));
if (!friction_constraints)
throw std::runtime_error(
"Friction constraints are not properly assigned");
} else {
// Set id
int nset_id = constraints.at("nset_id").template get<int>();
// Direction
unsigned dir = constraints.at("dir").template get<unsigned>();
// Sign n
int sign_n = constraints.at("sign_n").template get<int>();
// Friction
double friction = constraints.at("friction").template get<double>();
// Add friction constraint to mesh
auto friction_constraint = std::make_shared<mpm::FrictionConstraint>(
nset_id, dir, sign_n, friction);
bool friction_constraints =
constraints_->assign_nodal_frictional_constraint(
nset_id, friction_constraint);
if (!friction_constraints)
throw std::runtime_error(
"Nodal friction constraint is not properly assigned");
}
}
} else
throw std::runtime_error("Friction constraints JSON not found");
} catch (std::exception& exception) {
console_->warn("#{}: Friction conditions are undefined {} ", __LINE__,
exception.what());
}
}
// Nodal pressure constraints
template <unsigned Tdim>
void mpm::MPMBase<Tdim>::nodal_pressure_constraints(
const Json& mesh_props, const std::shared_ptr<mpm::IOMesh<Tdim>>& mesh_io) {
try {
// Read and assign pressure constraints
if (mesh_props.find("boundary_conditions") != mesh_props.end() &&
mesh_props["boundary_conditions"].find("pressure_constraints") !=
mesh_props["boundary_conditions"].end()) {
// Iterate over pressure constraints
for (const auto& constraints :
mesh_props["boundary_conditions"]["pressure_constraints"]) {
// Pore pressure constraint phase indice
unsigned constraint_phase = constraints["phase_id"];
// Pore pressure constraints are specified in a file
if (constraints.find("file") != constraints.end()) {
std::string pressure_constraints_file =
constraints.at("file").template get<std::string>();
bool ppressure_constraints =
constraints_->assign_nodal_pressure_constraints(
constraint_phase,
mesh_io->read_pressure_constraints(
io_->file_name(pressure_constraints_file)));
if (!ppressure_constraints)
throw std::runtime_error(
"Pore pressure constraints are not properly assigned");
} else {
// Get the math function
std::shared_ptr<FunctionBase> pfunction = nullptr;
if (constraints.find("math_function_id") != constraints.end())
pfunction = math_functions_.at(
constraints.at("math_function_id").template get<unsigned>());
// Set id
int nset_id = constraints.at("nset_id").template get<int>();
// Pressure
double pressure = constraints.at("pressure").template get<double>();
// Add pressure constraint to mesh
constraints_->assign_nodal_pressure_constraint(
pfunction, nset_id, constraint_phase, pressure);
}
}
} else
throw std::runtime_error("Pressure constraints JSON not found");
} catch (std::exception& exception) {
console_->warn("#{}: Nodal pressure constraints are undefined {} ",
__LINE__, exception.what());
}
}
//! Cell entity sets
template <unsigned Tdim>
void mpm::MPMBase<Tdim>::cell_entity_sets(const Json& mesh_props,
bool check_duplicates) {
try {
if (mesh_props.find("entity_sets") != mesh_props.end()) {
// Read and assign cell sets
std::string entity_sets =
mesh_props["entity_sets"].template get<std::string>();
if (!io_->file_name(entity_sets).empty()) {
bool cell_sets = mesh_->create_cell_sets(
(io_->entity_sets(io_->file_name(entity_sets), "cell_sets")),
check_duplicates);
if (!cell_sets)
throw std::runtime_error("Cell sets are not properly assigned");
}
} else
throw std::runtime_error("Cell entity sets JSON not found");
} catch (std::exception& exception) {
console_->warn("#{}: Cell entity sets are undefined {} ", __LINE__,
exception.what());
}
}
// Particles cells
template <unsigned Tdim>
void mpm::MPMBase<Tdim>::particles_cells(
const Json& mesh_props,
const std::shared_ptr<mpm::IOMesh<Tdim>>& particle_io) {
try {
if (mesh_props.find("particle_cells") != mesh_props.end()) {
std::string fparticles_cells =
mesh_props["particle_cells"].template get<std::string>();
if (!io_->file_name(fparticles_cells).empty()) {
bool particles_cells =
mesh_->assign_particles_cells(particle_io->read_particles_cells(
io_->file_name(fparticles_cells)));
if (!particles_cells)
throw std::runtime_error(
"Particle cells are not properly assigned to particles");
}
} else
throw std::runtime_error("Particle cells JSON not found");
} catch (std::exception& exception) {
console_->warn("#{}: Particle cells are undefined {} ", __LINE__,
exception.what());
}
}
// Particles volumes
template <unsigned Tdim>
void mpm::MPMBase<Tdim>::particles_volumes(
const Json& mesh_props,
const std::shared_ptr<mpm::IOMesh<Tdim>>& particle_io) {
try {
if (mesh_props.find("particles_volumes") != mesh_props.end()) {
std::string fparticles_volumes =
mesh_props["particles_volumes"].template get<std::string>();
if (!io_->file_name(fparticles_volumes).empty()) {
bool particles_volumes =
mesh_->assign_particles_volumes(particle_io->read_particles_volumes(
io_->file_name(fparticles_volumes)));
if (!particles_volumes)
throw std::runtime_error(
"Particles volumes are not properly assigned");
}
} else
throw std::runtime_error("Particle volumes JSON not found");
} catch (std::exception& exception) {
console_->warn("#{}: Particle volumes are undefined {} ", __LINE__,
exception.what());
}
}
// Particle velocity constraints
template <unsigned Tdim>
void mpm::MPMBase<Tdim>::particle_velocity_constraints() {
auto mesh_props = io_->json_object("mesh");
// Create a file reader
const std::string io_type =
io_->json_object("mesh")["io_type"].template get<std::string>();
auto reader = Factory<mpm::IOMesh<Tdim>>::instance()->create(io_type);
try {
if (mesh_props.find("boundary_conditions") != mesh_props.end() &&
mesh_props["boundary_conditions"].find(
"particles_velocity_constraints") !=
mesh_props["boundary_conditions"].end()) {
// Iterate over velocity constraints
for (const auto& constraints :
mesh_props["boundary_conditions"]
["particles_velocity_constraints"]) {
// Set id
int pset_id = constraints.at("pset_id").template get<int>();
// Direction
unsigned dir = constraints.at("dir").template get<unsigned>();
// Velocity
double velocity = constraints.at("velocity").template get<double>();
// Add velocity constraint to mesh
auto velocity_constraint =
std::make_shared<mpm::VelocityConstraint>(pset_id, dir, velocity);
mesh_->create_particle_velocity_constraint(pset_id,
velocity_constraint);
}
} else
throw std::runtime_error("Particle velocity constraints JSON not found");
} catch (std::exception& exception) {
console_->warn("#{}: Particle velocity constraints are undefined {} ",
__LINE__, exception.what());
}
}
// Particles stresses
template <unsigned Tdim>
void mpm::MPMBase<Tdim>::particles_stresses(
const Json& mesh_props,
const std::shared_ptr<mpm::IOMesh<Tdim>>& particle_io) {
try {
if (mesh_props.find("particles_stresses") != mesh_props.end()) {
// Get generator type
const std::string type =
mesh_props["particles_stresses"]["type"].template get<std::string>();
if (type == "file") {
std::string fparticles_stresses =
mesh_props["particles_stresses"]["location"]
.template get<std::string>();
if (!io_->file_name(fparticles_stresses).empty()) {
// Get stresses of all particles
const auto all_particles_stresses =
particle_io->read_particles_stresses(
io_->file_name(fparticles_stresses));
// Read and assign particles stresses
if (!mesh_->assign_particles_stresses(all_particles_stresses))
throw std::runtime_error(
"Particles stresses are not properly assigned");
}
} else if (type == "isotropic") {
Eigen::Matrix<double, 6, 1> in_stress;
in_stress.setZero();
if (mesh_props["particles_stresses"]["values"].is_array() &&
mesh_props["particles_stresses"]["values"].size() ==
in_stress.size()) {
for (unsigned i = 0; i < in_stress.size(); ++i) {
in_stress[i] = mesh_props["particles_stresses"]["values"].at(i);
}
mesh_->iterate_over_particles(
std::bind(&mpm::ParticleBase<Tdim>::initial_stress,
std::placeholders::_1, in_stress));
} else {
throw std::runtime_error("Initial stress dimension is invalid");
}
}
} else
throw std::runtime_error("Particle stresses JSON not found");
} catch (std::exception& exception) {
console_->warn("#{}: Particle stresses are undefined {} ", __LINE__,
exception.what());
}
}
// Particles pore pressures
template <unsigned Tdim>
void mpm::MPMBase<Tdim>::particles_pore_pressures(
const Json& mesh_props,
const std::shared_ptr<mpm::IOMesh<Tdim>>& particle_io) {
try {
if (mesh_props.find("particles_pore_pressures") != mesh_props.end()) {
// Get generator type
const std::string type = mesh_props["particles_pore_pressures"]["type"]
.template get<std::string>();
// Assign initial pore pressure by file
if (type == "file") {
std::string fparticles_pore_pressures =
mesh_props["particles_pore_pressures"]["location"]
.template get<std::string>();
if (!io_->file_name(fparticles_pore_pressures).empty()) {
// Read and assign particles pore pressures
if (!mesh_->assign_particles_pore_pressures(
particle_io->read_particles_scalar_properties(
io_->file_name(fparticles_pore_pressures))))
throw std::runtime_error(
"Particles pore pressures are not properly assigned");
} else
throw std::runtime_error("Particle pore pressures JSON not found");
} else if (type == "water_table") {
// Initialise water tables
std::map<double, double> reference_points;
// Vertical direction
const unsigned dir_v = mesh_props["particles_pore_pressures"]["dir_v"]
.template get<unsigned>();
// Horizontal direction
const unsigned dir_h = mesh_props["particles_pore_pressures"]["dir_h"]
.template get<unsigned>();
// Iterate over water tables
for (const auto& water_table :
mesh_props["particles_pore_pressures"]["water_tables"]) {
// Position coordinate
double position = water_table.at("position").template get<double>();
// Direction
double h0 = water_table.at("h0").template get<double>();
// Add reference points to mesh
reference_points.insert(std::make_pair<double, double>(
static_cast<double>(position), static_cast<double>(h0)));
}
// Initialise particles pore pressures by watertable
mesh_->iterate_over_particles(std::bind(
&mpm::ParticleBase<Tdim>::initialise_pore_pressure_watertable,
std::placeholders::_1, dir_v, dir_h, this->gravity_,
reference_points));
} else if (type == "isotropic") {
const double pore_pressure =
mesh_props["particles_pore_pressures"]["values"]
.template get<double>();
mesh_->iterate_over_particles(std::bind(
&mpm::ParticleBase<Tdim>::assign_pressure, std::placeholders::_1,
pore_pressure, mpm::ParticlePhase::Liquid));
} else
throw std::runtime_error(
"Particle pore pressures generator type is not properly "
"specified");
} else
throw std::runtime_error("Particle pore pressure JSON not found");
} catch (std::exception& exception) {
console_->warn("#{}: Particle pore pressures are undefined {} ", __LINE__,
exception.what());
}
}
//! Particle entity sets
template <unsigned Tdim>
void mpm::MPMBase<Tdim>::particle_entity_sets(bool check_duplicates) {
// Get mesh properties
auto mesh_props = io_->json_object("mesh");
// Read and assign particle sets
try {
if (mesh_props.find("entity_sets") != mesh_props.end()) {
std::string entity_sets =
mesh_props["entity_sets"].template get<std::string>();
if (!io_->file_name(entity_sets).empty()) {
bool particle_sets = mesh_->create_particle_sets(
(io_->entity_sets(io_->file_name(entity_sets), "particle_sets")),
check_duplicates);
if (!particle_sets)
throw std::runtime_error("Particle set creation failed");
}
} else
throw std::runtime_error("Particle entity set JSON not found");
} catch (std::exception& exception) {
console_->warn("#{}: Particle sets are undefined {} ", __LINE__,
exception.what());
}
}
// Initialise Damping
template <unsigned Tdim>
bool mpm::MPMBase<Tdim>::initialise_damping(const Json& damping_props) {
// Read damping JSON object
bool status = true;
try {
// Read damping type
std::string type = damping_props.at("type").template get<std::string>();
if (type == "Cundall") damping_type_ = mpm::Damping::Cundall;
// Read damping factor
damping_factor_ = damping_props.at("damping_factor").template get<double>();
} catch (std::exception& exception) {
console_->warn("#{}: Damping parameters are undefined {} ", __LINE__,
exception.what());
status = false;
}
return status;
}
//! Domain decomposition
template <unsigned Tdim>
void mpm::MPMBase<Tdim>::mpi_domain_decompose(bool initial_step) {
#ifdef USE_MPI
// Initialise MPI rank and size
int mpi_rank = 0;
int mpi_size = 1;
// Get MPI rank
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
// Get number of MPI ranks
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
if (mpi_size > 1 && mesh_->ncells() > 1) {
// Initialize MPI
MPI_Comm comm;
MPI_Comm_dup(MPI_COMM_WORLD, &comm);
auto mpi_domain_begin = std::chrono::steady_clock::now();
console_->info("Rank {}, Domain decomposition started\n", mpi_rank);
#ifdef USE_GRAPH_PARTITIONING
// Create graph object if empty
if (initial_step || graph_ == nullptr)
graph_ = std::make_shared<Graph<Tdim>>(mesh_->cells());
// Find number of particles in each cell across MPI ranks
mesh_->find_nglobal_particles_cells();
// Construct a weighted DAG
graph_->construct_graph(mpi_size, mpi_rank);
// Graph partitioning mode
int mode = 4; // FAST
// Create graph partition
graph_->create_partitions(&comm, mode);
// Collect the partitions
auto exchange_cells = graph_->collect_partitions(mpi_size, mpi_rank, &comm);
// Identify shared nodes across MPI domains
mesh_->find_domain_shared_nodes();
// Identify ghost boundary cells
mesh_->find_ghost_boundary_cells();
// Delete all the particles which is not in local task parititon
if (initial_step) mesh_->remove_all_nonrank_particles();
// Transfer non-rank particles to appropriate cells
else
mesh_->transfer_nonrank_particles(exchange_cells);
#endif
auto mpi_domain_end = std::chrono::steady_clock::now();
console_->info("Rank {}, Domain decomposition: {} ms", mpi_rank,
std::chrono::duration_cast<std::chrono::milliseconds>(
mpi_domain_end - mpi_domain_begin)
.count());
}
#endif // MPI
}
//! MPM pressure smoothing
template <unsigned Tdim>
void mpm::MPMBase<Tdim>::pressure_smoothing(unsigned phase) {
// Assign pressure to nodes
mesh_->iterate_over_particles(
std::bind(&mpm::ParticleBase<Tdim>::map_pressure_to_nodes,
std::placeholders::_1, phase));
// Apply pressure constraint
mesh_->iterate_over_nodes_predicate(
std::bind(&mpm::NodeBase<Tdim>::apply_pressure_constraint,
std::placeholders::_1, phase, this->dt_, this->step_),
std::bind(&mpm::NodeBase<Tdim>::status, std::placeholders::_1));
#ifdef USE_MPI
int mpi_size = 1;
// Get number of MPI ranks
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
// Run if there is more than a single MPI task
if (mpi_size > 1) {
// MPI all reduce nodal pressure
mesh_->template nodal_halo_exchange<double, 1>(
std::bind(&mpm::NodeBase<Tdim>::pressure, std::placeholders::_1, phase),
std::bind(&mpm::NodeBase<Tdim>::assign_pressure, std::placeholders::_1,
phase, std::placeholders::_2));
}
#endif
// Smooth pressure over particles
mesh_->iterate_over_particles(
std::bind(&mpm::ParticleBase<Tdim>::compute_pressure_smoothing,
std::placeholders::_1, phase));
}
//! MPM implicit solver initialization
template <unsigned Tdim>
void mpm::MPMBase<Tdim>::initialise_linear_solver(
const Json& lin_solver_props,
tsl::robin_map<
std::string,
std::shared_ptr<mpm::SolverBase<Eigen::SparseMatrix<double>>>>&
linear_solver) {
// Iterate over specific solver settings
for (const auto& solver : lin_solver_props) {
std::string dof = solver["dof"].template get<std::string>();
std::string solver_type = solver["solver_type"].template get<std::string>();
// NOTE: Only KrylovPETSC solver is supported for MPI
#ifdef USE_MPI
// Get number of MPI ranks
int mpi_size = 1;
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
if (solver_type != "KrylovPETSC" && mpi_size > 1) {
console_->warn(
"The linear solver for DOF:\'{}\' in MPI setting is "
"automatically set to default: \'KrylovPETSC\'. Only "
"\'KrylovPETSC\' solver is supported for MPI.",
dof);
solver_type = "KrylovPETSC";
}
#endif
unsigned max_iter = solver["max_iter"].template get<unsigned>();
double tolerance = solver["tolerance"].template get<double>();
auto lin_solver =
Factory<mpm::SolverBase<Eigen::SparseMatrix<double>>, unsigned,
double>::instance()
->create(solver_type, std::move(max_iter), std::move(tolerance));
// Specific settings
if (solver.contains("sub_solver_type"))
lin_solver->set_sub_solver_type(
solver["sub_solver_type"].template get<std::string>());
if (solver.contains("preconditioner_type"))
lin_solver->set_preconditioner_type(
solver["preconditioner_type"].template get<std::string>());
if (solver.contains("abs_tolerance"))
lin_solver->set_abs_tolerance(
solver["abs_tolerance"].template get<double>());
if (solver.contains("div_tolerance"))
lin_solver->set_div_tolerance(
solver["div_tolerance"].template get<double>());
if (solver.contains("verbosity"))
lin_solver->set_verbosity(solver["verbosity"].template get<unsigned>());
// Add solver set to map
linear_solver.insert(
std::pair<
std::string,
std::shared_ptr<mpm::SolverBase<Eigen::SparseMatrix<double>>>>(
dof, lin_solver));
}
}
//! Initialise nonlocal mesh
template <unsigned Tdim>
void mpm::MPMBase<Tdim>::initialise_nonlocal_mesh(const Json& mesh_props) {
//! Shape function name
const auto cell_type = mesh_props["cell_type"].template get<std::string>();
try {
if (cell_type.back() == 'B') {
// Cell and node neighbourhood for quadratic B-Spline
cell_neighbourhood_ = 1;
node_neighbourhood_ = 3;
// Initialise nonlocal node
mesh_->iterate_over_nodes(
std::bind(&mpm::NodeBase<Tdim>::initialise_nonlocal_node,
std::placeholders::_1));
//! Read nodal type from entity sets
if (mesh_props.find("nonlocal_mesh_properties") != mesh_props.end() &&
mesh_props["nonlocal_mesh_properties"].find("node_types") !=
mesh_props["nonlocal_mesh_properties"].end()) {
// Iterate over node type
for (const auto& node_type :
mesh_props["nonlocal_mesh_properties"]["node_types"]) {
// Set id
int nset_id = node_type.at("nset_id").template get<int>();
// Direction
unsigned dir = node_type.at("dir").template get<unsigned>();
// Type
unsigned type = node_type.at("type").template get<unsigned>();
// Assign nodal nonlocal type
mesh_->assign_nodal_nonlocal_type(nset_id, dir, type);
}
}
//! Update number of nodes in cell
mesh_->upgrade_cells_to_nonlocal(cell_type, cell_neighbourhood_);
}
} catch (std::exception& exception) {
console_->warn("{} #{}: initialising nonlocal mesh failed! ", __FILE__,
__LINE__, exception.what());
}
}
| 37.255493
| 80
| 0.634967
|
jgiven100
|
54e372d63f2884a1d9cc555ce2b3aa6387125a89
| 2,190
|
cpp
|
C++
|
bbs/exec_os2.cpp
|
RPTST/wwiv_dietpi
|
202177393778e809ffe657095c1f77aa8f404651
|
[
"Apache-2.0"
] | 157
|
2015-07-08T18:29:22.000Z
|
2022-03-10T10:22:58.000Z
|
bbs/exec_os2.cpp
|
RPTST/wwiv_dietpi
|
202177393778e809ffe657095c1f77aa8f404651
|
[
"Apache-2.0"
] | 1,037
|
2015-07-18T03:09:12.000Z
|
2022-03-13T17:39:55.000Z
|
bbs/exec_os2.cpp
|
RPTST/wwiv_dietpi
|
202177393778e809ffe657095c1f77aa8f404651
|
[
"Apache-2.0"
] | 74
|
2015-07-08T19:42:19.000Z
|
2021-12-22T06:15:46.000Z
|
/**************************************************************************/
/* */
/* WWIV Version 5.x */
/* Copyright (C)1998-2021, WWIV Software Services */
/* */
/* 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 "bbs/exec.h"
#include "bbs/application.h"
#include "bbs/bbs.h"
#include "bbs/stuffin.h"
#include "common/output.h"
#include "common/remote_io.h"
#include "core/log.h"
#include "fmt/format.h"
#include <cctype>
#include <process.h>
#include <string>
int exec_cmdline(wwiv::bbs::CommandLine& cmdline, int flags) {
if (a()->sess().ok_modem_stuff() && a()->sess().using_modem()) {
VLOG(1) <<"Closing remote IO";
bout.remoteIO()->close(true);
}
const auto cmd = cmdline.cmdline();
auto res = system(cmd.c_str());
if (a()->sess().ok_modem_stuff() && a()->sess().using_modem()) {
VLOG(1) << "Reopening comm (on createprocess error)";
bout.remoteIO()->open();
}
if (res != 0) {
LOG(ERROR) << "error on system: " << res << "; errno: " << errno;
}
return res;
}
| 41.320755
| 76
| 0.440639
|
RPTST
|
54f0ef86df8ebf9356f2995d7a7bee04ef3e64e2
| 1,740
|
hpp
|
C++
|
mesk-installer/Pages/bootloaderPage.hpp
|
aaly/Mesk-Installer
|
a3e07318c9bb08d02a7adfdda380eee5c829bab2
|
[
"BSD-3-Clause"
] | 2
|
2019-01-12T06:20:38.000Z
|
2019-02-05T06:20:58.000Z
|
mesk-installer/Pages/bootloaderPage.hpp
|
aaly/Mesk-Installer
|
a3e07318c9bb08d02a7adfdda380eee5c829bab2
|
[
"BSD-3-Clause"
] | null | null | null |
mesk-installer/Pages/bootloaderPage.hpp
|
aaly/Mesk-Installer
|
a3e07318c9bb08d02a7adfdda380eee5c829bab2
|
[
"BSD-3-Clause"
] | null | null | null |
/******************************************************
* copyright 2011, 2012, 2013 AbdAllah Aly Saad , aaly90[@]gmail.com
* Part of Mesklinux Installer
* See LICENSE file for more info
******************************************************/
#ifndef BOOTLOADERPAGE_HPP
#define BOOTLOADERPAGE_HPP
#include <QtWidgets/QWidget>
//#include <MPF/pageBase.hpp>
#include "ui_bootloaderPage.h"
#include <MPF/System/drive.hpp>
#include <Pages/diskPage.hpp>
#include <MPF/System/chroot.hpp>
class bootEntry
{
public:
QString title;
QString kernel;
QString kernelOptions;
QString initramfs;
QString options;
QString root;
QString os;
QPair<int, int> rootpartition;
QString rootUUID;
QString rootDevPath;
bool sub;
//QVector<bootEntry> subEntries;
private:
};
class bootloaderPage : public pageBase, private Ui::bootloaderPage
{
Q_OBJECT
public:
explicit bootloaderPage(QWidget *parent = 0);
int initAll();
~bootloaderPage();
private:
void changeEvent(QEvent* event);
chroot croot;
QFile bootMenuFile;
diskPage* dpage;
QList<Drive> drives;
QVector<bootEntry> bootMenu;
int generateBootMenu();
int installBootLoader();
QString rootPath;
QProcess mountRoot;
int writeBootMenu();
QString cfgOptions;
QString bootPartition;
int generateFsTab();
int initMenu();
QString rootdev;
private slots:
int checkBootloaderPasswordStrength();
int confirmBootloaderPassword();
int removeBootEntry();
int addBootEntry();
int resetBootMenu();
int modifyBootEntry(int, int);
int addToBootMenu();
int changeOptions();
public slots:
int finishUp();
};
#endif // BOOTLOADERPAGE_HPP
| 16.571429
| 67
| 0.651149
|
aaly
|
54f101c539ee0891520d0b6610dbd5206de89e62
| 2,863
|
hpp
|
C++
|
libcore/include/sirikata/core/transfer/OAuthHttpManager.hpp
|
pathorn/sirikata
|
5d366a822ef2fb57cd9f64cc4f6085c0a635fdfa
|
[
"BSD-3-Clause"
] | 1
|
2016-05-09T03:34:51.000Z
|
2016-05-09T03:34:51.000Z
|
libcore/include/sirikata/core/transfer/OAuthHttpManager.hpp
|
pathorn/sirikata
|
5d366a822ef2fb57cd9f64cc4f6085c0a635fdfa
|
[
"BSD-3-Clause"
] | null | null | null |
libcore/include/sirikata/core/transfer/OAuthHttpManager.hpp
|
pathorn/sirikata
|
5d366a822ef2fb57cd9f64cc4f6085c0a635fdfa
|
[
"BSD-3-Clause"
] | null | null | null |
// Copyright (c) 2011 Sirikata 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 _SIRIKATA_LIBCORE_OAUTH_HTTP_MANAGER_HPP_
#define _SIRIKATA_LIBCORE_OAUTH_HTTP_MANAGER_HPP_
#include <sirikata/core/transfer/HttpManager.hpp>
#include <liboauthcpp/liboauthcpp.h>
namespace Sirikata {
namespace Transfer {
/** Wrapper around HttpManager which signs requests as an OAuth consumer. Unlike
* HttpManager, this is not a Singleton so that you can use this multiple times
* to be different consumers to different sites.
*/
class SIRIKATA_EXPORT OAuthHttpManager {
public:
OAuthHttpManager(const String& hostname, const String& consumer_key, const String& consumer_secret);
OAuthHttpManager(const String& hostname, const String& consumer_key, const String& consumer_secret, const String& token_key, const String& token_secret);
void head(
Sirikata::Network::Address addr, const String& path,
HttpManager::HttpCallback cb,
const HttpManager::Headers& headers = HttpManager::Headers(), const HttpManager::QueryParameters& query_params = HttpManager::QueryParameters(),
bool allow_redirects = true
);
void get(
Sirikata::Network::Address addr, const String& path,
HttpManager::HttpCallback cb,
const HttpManager::Headers& headers = HttpManager::Headers(), const HttpManager::QueryParameters& query_params = HttpManager::QueryParameters(),
bool allow_redirects = true
);
void post(
Sirikata::Network::Address addr, const String& path,
const String& content_type, const String& body,
HttpManager::HttpCallback cb, const HttpManager::Headers& headers = HttpManager::Headers(), const HttpManager::QueryParameters& query_params = HttpManager::QueryParameters(),
bool allow_redirects = true
);
void postURLEncoded(
Sirikata::Network::Address addr, const String& path,
const HttpManager::StringDictionary& body,
HttpManager::HttpCallback cb, const HttpManager::Headers& headers = HttpManager::Headers(), const HttpManager::QueryParameters& query_params = HttpManager::QueryParameters(),
bool allow_redirects = true
);
void postMultipartForm(
Sirikata::Network::Address addr, const String& path,
const HttpManager::MultipartDataList& data,
HttpManager::HttpCallback cb, const HttpManager::Headers& headers = HttpManager::Headers(), const HttpManager::QueryParameters& query_params = HttpManager::QueryParameters(),
bool allow_redirects = true
);
private:
const String mHostname;
OAuth::Consumer mConsumer;
OAuth::Token mToken;
OAuth::Client mClient;
};
} // namespace Transfer
} // namespace Sirikata
#endif //_SIRIKATA_LIBCORE_OAUTH_HTTP_MANAGER_HPP_
| 41.492754
| 182
| 0.735592
|
pathorn
|
54f3d12579cb8e2a9b2145b2a85f0a84efd66f75
| 27,871
|
cpp
|
C++
|
libs2eplugins/src/s2e/Plugins/Checkers/MemoryBugChecker.cpp
|
trusslab/mousse
|
eb6ac492b15e2ca416a3b23bd4c4d115ae83b606
|
[
"MIT"
] | 7
|
2020-04-27T03:53:16.000Z
|
2021-12-31T02:04:48.000Z
|
libs2eplugins/src/s2e/Plugins/Checkers/MemoryBugChecker.cpp
|
trusslab/mousse
|
eb6ac492b15e2ca416a3b23bd4c4d115ae83b606
|
[
"MIT"
] | null | null | null |
libs2eplugins/src/s2e/Plugins/Checkers/MemoryBugChecker.cpp
|
trusslab/mousse
|
eb6ac492b15e2ca416a3b23bd4c4d115ae83b606
|
[
"MIT"
] | 1
|
2020-07-15T05:19:28.000Z
|
2020-07-15T05:19:28.000Z
|
/// Copyright (C) 2010-2015, Dependable Systems Laboratory, EPFL
/// Copyright (C) 2020, TrussLab@University of California, Irvine.
/// Authors: Hsin-Wei Hung<hsinweih@uci.edu>
/// All rights reserved.
///
/// Licensed under the Cyberhaven Research License Agreement.
///
#include "MemoryBugChecker.h"
#include <s2e/S2E.h>
#include <s2e/ConfigFile.h>
#include <s2e/Utils.h>
#include <s2e/S2EExecutor.h>
#include <s2e/Plugins/OSMonitors/ModuleDescriptor.h>
#include <cpu/se_libcpu.h>
#include <cpu/tb.h>
#include <cpu/exec.h>
#include <klee/Solver.h>
#include <klee/util/ExprTemplates.h>
#include <klee/Internal/ADT/ImmutableMap.h>
#include "klee/util/ExprPPrinter.h"
#include <sys/types.h>
#include <unistd.h>
#include <fstream>
#include <iostream>
#include <sstream>
extern llvm::cl::opt<bool> ConcolicMode;
namespace s2e {
namespace plugins {
S2E_DEFINE_PLUGIN(MemoryBugChecker, "MemoryBugChecker plugin", "MemoryBugChecker",
"ExecutionTracer");
namespace {
struct MemoryRange {
uint64_t start;
uint64_t size;
};
//Used to track OS resources that are accessed
//through a handle
struct ResourceHandle {
uint64_t allocPC;
std::string type;
uint64_t handle;
};
//XXX: Should also add per-module permissions
struct MemoryRegion {
MemoryRange range;
uint64_t perms;
uint64_t allocPC;
std::string type;
uint64_t id;
bool permanent;
};
struct StoreAttribute {
bool stack; //true: stack; false: heap
bool local; //true: only access within stack frame, false: only access memory beyond current stack frame
uint64_t framePC; // if the write is to stack and not local
};
struct MemoryRangeLT {
bool operator()(const MemoryRange& a, const MemoryRange& b) const {
return a.start + a.size <= b.start;
}
};
typedef klee::ImmutableMap<MemoryRange, const MemoryRegion*,
MemoryRangeLT> MemoryMap;
typedef std::map<uint64_t /*pc of the str*/, StoreAttribute> StoreMap;
} // namespace
inline bool is_aligned(uint64_t addr)
{
return !(addr % TARGET_PAGE_SIZE);
}
uint64_t align(uint64_t addr, bool floor)
{
uint64_t add = floor? 0: is_aligned(addr)? 0: 1;
return (addr/TARGET_PAGE_SIZE + add) * TARGET_PAGE_SIZE;
}
class MemoryBugCheckerState: public PluginState
{
public:
uint64_t m_brkAddress;
uint64_t m_brkPageAddress;
MemoryBugChecker* m_plugin;
MemoryMap m_memoryMap;
StoreMap m_storeMap;
public:
MemoryBugCheckerState() {}
~MemoryBugCheckerState() {}
MemoryBugCheckerState *clone() const { return new MemoryBugCheckerState(*this); }
static PluginState *factory(Plugin* p, S2EExecutionState* s) {
MemoryBugCheckerState *ret = new MemoryBugCheckerState();
ret->m_plugin = static_cast<MemoryBugChecker *>(p);
return ret;
}
uint64_t &getBRKAddress() { return m_brkAddress; }
uint64_t &getBRKPageAddress() { return m_brkPageAddress; }
void setBRKAddress(uint64_t addr) {
m_brkAddress = addr;
m_brkPageAddress = align(addr, false);
}
MemoryMap &getMemoryMap() {
return m_memoryMap;
}
void setMemoryMap(const MemoryMap& memoryMap) {
m_memoryMap = memoryMap;
}
StoreMap &getStoreMap() {
return m_storeMap;
}
void setStoreMap(const StoreMap& storeMap) {
m_storeMap = storeMap;
}
};
void MemoryBugChecker::initialize()
{
ConfigFile *cfg = s2e()->getConfig();
m_debugLevel = cfg->getInt(getConfigKey() + ".debugLevel", 0);
m_checkBugs = cfg->getBool(getConfigKey() + ".checkMemoryBugs", true);
m_checkNullPtrDerefBug = cfg->getBool(getConfigKey() + ".checkNullPtrDereferenceBug", false);
m_checkRetPtrOverrideBug = cfg->getBool(getConfigKey() + ".checkReturnPtrOverrideBug", false);
m_checkOOBAccessBug = cfg->getBool(getConfigKey() + ".checkOOBAccessBug", false);
m_terminateOnBugs = cfg->getBool(getConfigKey() + ".terminateOnBugs", true);
m_traceMemoryAccesses = cfg->getBool(getConfigKey() + ".traceMemoryAccesses", false);
m_stackMonitor = s2e()->getPlugin<StackMonitor>();
m_pm = s2e()->getPlugin<ProcessMonitor>();
assert(m_pm);
s2e()->getCorePlugin()->onBeforeSymbolicDataMemoryAccess.connect(
sigc::mem_fun(*this, &MemoryBugChecker::onBeforeSymbolicDataMemoryAccess));
s2e()->getCorePlugin()->onConcreteDataMemoryAccess.connect(
sigc::mem_fun(*this, &MemoryBugChecker::onConcreteDataMemoryAccess));
s2e()->getCorePlugin()->onAlwaysConcreteMemoryAccess.connect(
sigc::mem_fun(*this, &MemoryBugChecker::onAlwaysConcreteMemoryAccess));
}
void MemoryBugChecker::printImageInfo(S2EExecutionState *state, ImageInfo *info)
{
getDebugStream(state) << "\n"
<< "[Binary]\n"
<< "load_bias: " << hexval(info->load_bias)
<< " load_addr: " << hexval(info->load_addr) << "\n"
<< "start_code: " << hexval(info->start_code)
<< " end_code: " << hexval(info->end_code) << "\n"
<< "start_data: " << hexval(info->start_data)
<< " end_data: " << hexval(info->end_data) << "\n"
<< "start_brk: " << hexval(info->start_brk)
<< " brk: " << hexval(info->brk) << "\n"
<< "start_mmap: " << hexval(info->start_mmap)
<< " mmap: " << hexval(info->mmap) << "\n"
<< "rss: " << hexval(info->rss) << "\n"
<< "start_stack: " << hexval(info->start_stack)
<< " stack_limit: " << hexval(info->stack_limit) << "\n"
<< "entry: " << hexval(info->entry) << "\n"
<< "code_offset: " << hexval(info->code_offset) << "\n"
<< "data_offset: " << hexval(info->data_offset) << "\n"
<< "saved_auxv: " << hexval(info->saved_auxv)
<< " auxv_len: " << hexval(info->auxv_len) << "\n"
<< "arg_start: " << hexval(info->arg_start)
<< " arg_end: " << hexval(info->arg_end) << "\n"
<< "elf_flags: " << hexval(info->elf_flags) << "\n\n";
if (info->interp_info) {
ImageInfo* interp_info = info->interp_info;
getDebugStream(state) << "\n"
<< "[ELF interpreter]\n"
<< "load_bias: " << hexval(interp_info->load_bias)
<< " load_addr: " << hexval(interp_info->load_addr) << "\n"
<< "start_code: " << hexval(interp_info->start_code)
<< " end_code: " << hexval(interp_info->end_code) << "\n"
<< "start_data: " << hexval(interp_info->start_data)
<< " end_data: " << hexval(interp_info->end_data) << "\n"
<< "start_brk: " << hexval(interp_info->start_brk)
<< " brk: " << hexval(interp_info->brk) << "\n"
<< "start_mmap: " << hexval(interp_info->start_mmap)
<< " mmap: " << hexval(interp_info->mmap) << "\n"
<< "rss: " << hexval(interp_info->rss) << "\n"
<< "start_stack: " << hexval(interp_info->start_stack)
<< " stack_limit: " << hexval(interp_info->stack_limit) << "\n"
<< "entry: " << hexval(interp_info->entry) << "\n"
<< "code_offset: " << hexval(interp_info->code_offset) << "\n"
<< "data_offset: " << hexval(interp_info->data_offset) << "\n"
<< "saved_auxv: " << hexval(interp_info->saved_auxv)
<< " auxv_len: " << hexval(interp_info->auxv_len) << "\n"
<< "arg_start: " << hexval(interp_info->arg_start)
<< " arg_end: " << hexval(interp_info->arg_end) << "\n"
<< "elf_flags: " << hexval(interp_info->elf_flags) << "\n\n";
}
}
void MemoryBugChecker::emitOnBugDetected(S2EExecutionState *state, uint32_t bug, uint64_t pc)
{
if (pc == 0)
pc = state->regs()->getPc();
std::string file = m_pm->getFileName(pc);
uint32_t offset = m_pm->getOffsetWithinFile(file, pc);
uint32_t insn;
if (!state->mem()->read<uint32_t>(pc, &insn, VirtualAddress, false)) {
getWarningsStream(state) << "cannot get instruction at " << hexval(pc);
insn = 0xffffffff;
}
onBugDetected.emit(state, bug, offset, insn, file, m_bugInputs);
}
void MemoryBugChecker::printConcreteInputs(llvm::raw_ostream &os, const ConcreteInputs &inputs) {
std::stringstream ss;
for (auto& it : inputs) {
const VarValuePair &vp = it;
ss << std::setw(20) << vp.first << " = {";
for (unsigned i = 0; i < vp.second.size(); ++i) {
if (i != 0)
ss << ", ";
ss << std::setw(2) << std::setfill('0') << "0x" << std::hex
<< (unsigned) vp.second[i] << std::dec;
}
ss << "}" << std::setfill(' ') << "; ";
if (vp.second.size() == sizeof(int32_t)) {
int32_t valueAsInt = vp.second[0] | ((int32_t) vp.second[1] << 8) |
((int32_t) vp.second[2] << 16) | ((int32_t) vp.second[3] << 24);
ss << "(int32_t) " << valueAsInt << ", ";
}
if (vp.second.size() == sizeof(int64_t)) {
int64_t valueAsInt = vp.second[0] | ((int64_t) vp.second[1] << 8) |
((int64_t) vp.second[2] << 16) | ((int64_t) vp.second[3] << 24) |
((int64_t) vp.second[4] << 32) | ((int64_t) vp.second[5] << 40) |
((int64_t) vp.second[6] << 48) | ((int64_t) vp.second[7] << 56);
ss << "(int64_t) " << valueAsInt << ", ";
}
ss << "(string) \"";
for (unsigned i = 0; i < vp.second.size(); ++i) {
ss << (char) (std::isprint(vp.second[i]) ? vp.second[i] : '.');
}
ss << "\"\n";
}
os << "concrete inputs:\n" << ss.str();
}
// Check if the experssion could have multiple feasible value under current constriants
bool MemoryBugChecker::checkRange(S2EExecutionState *state, klee::ref<klee::Expr> expr)
{
std::pair<klee::ref<klee::Expr>, klee::ref<klee::Expr>> range;
klee::Query query(state->constraints, expr);
range = s2e()->getExecutor()->getSolver(*state)->getRange(query);
uint64_t min = dyn_cast<klee::ConstantExpr>(range.first)->getZExtValue();
uint64_t max = dyn_cast<klee::ConstantExpr>(range.second)->getZExtValue();
getWarningsStream(state) << "checkRange min = " << hexval(min) << " max = " << hexval(max) << "fd = " << state->regs()->read<uint32_t>(CPU_OFFSET(regs[0])) <<"\n";
return (min != max);
}
bool MemoryBugChecker::assume(S2EExecutionState *state, klee::ref<klee::Expr> expr)
{
getDebugStream(state) << "Thread = " << hexval((unsigned long)pthread_self()) << " assume: " << expr << "\n";
klee::ref<klee::Expr> zero = klee::ConstantExpr::create(0, expr.get()->getWidth());
klee::ref<klee::Expr> boolexpr = klee::NeExpr::create(expr, zero);
// check if expr may be true under current path constraints
bool isValid = true;
bool truth;
klee::Solver *solver = s2e()->getExecutor()->getSolver(*state);
klee::Query query(state->constraints, boolexpr);
bool res = solver->mustBeTrue(query.negateExpr(), truth);
if (!res || truth) {
isValid = false;
}
if (!isValid) {
std::stringstream ss;
ss << "MemoryBugChecker: specified constraint cannot be satisfied "
<< expr;
} else {
std::vector<std::vector<unsigned char>> values;
std::vector<const klee::Array *> objects;
for (auto it : state->symbolics) {
objects.push_back(it.second);
}
klee::ConstraintManager tmpConstraints = state->constraints;
tmpConstraints.addConstraint(expr);
// ConcreteInputs inputs;
m_bugInputs.clear();
isValid = solver->getInitialValues(
klee::Query(tmpConstraints, klee::ConstantExpr::alloc(0, klee::Expr::Bool)), objects, values);
assert(isValid && "should be solvable");
for (unsigned i = 0; i != state->symbolics.size(); ++i) {
// inputs.push_back(
m_bugInputs.push_back(
std::make_pair(state->symbolics[i].first->name, values[i]));
}
printConcreteInputs(getWarningsStream(state), m_bugInputs);
}
return isValid;
}
bool MemoryBugChecker::checkNullPtrDeref(S2EExecutionState *state, klee::ref<klee::Expr> addr)
{
klee::ref<klee::Expr> nullValue = E_CONST(0, state->getPointerWidth());
klee::ref<klee::Expr> nullAddressRead =
klee::EqExpr::create(nullValue, addr);
return assume(state, nullAddressRead);
}
bool MemoryBugChecker::checkAddressRange(S2EExecutionState *state, klee::ref<klee::Expr> addr,
uint64_t lower, uint64_t upper)
{
klee::ref<klee::Expr> lowerValue = E_CONST(lower, state->getPointerWidth());
klee::ref<klee::Expr> upperValue = E_CONST(upper, state->getPointerWidth());
klee::ref<klee::Expr> rangeConstraint =
klee::AndExpr::create(klee::UgeExpr::create(addr, lowerValue),
klee::UleExpr::create(addr, upperValue));
bool ret = assume(state, rangeConstraint);
getDebugStream(state) << "check if addr: " << addr << " can fall in the range("
<< hexval(lower) << "," << hexval(upper) << "):" << ret << "\n";
return ret;
}
bool MemoryBugChecker::checkRetPtrOverride(S2EExecutionState *state, klee::ref<klee::Expr> addr)
{
bool isSeedState = false;
bool hasBug = false;
// if (m_seedSearcher) {
// isSeedState = m_seedSearcher->isSeedState(state);
// }
/*
* For every EIP stored on the stack, fork a state that will overwrite it.
*/
StackMonitor::CallStack cs;
if (!m_stackMonitor->getCallStack(state, 1, pthread_self(), cs)) {
getWarningsStream(state) << "Failed to get call stack\n";
return false;
}
std::vector<klee::ref<klee::Expr>> retAddrLocations;
for (unsigned i = 1; i < cs.size(); i++) { // always skip first dummy frame
retAddrLocations.push_back(E_CONST(cs[i].FrameTop, state->getPointerWidth()));
}
bool forkState = false;
if (forkState) {
std::vector<klee::ExecutionState *> states =
s2e()->getExecutor()->forkValues(state, isSeedState, addr, retAddrLocations);
assert(states.size() == retAddrLocations.size());
for (unsigned i = 0; i < states.size(); i++) {
S2EExecutionState *valuableState = static_cast<S2EExecutionState *>(states[i]);
/*
if (valuableState) {
// We've forked a state where symbolic address will be concretized to one exact value.
// Put the state into separate CUPA group to distinguish it from other states that were
// produced by fork and concretise at the same PC.
m_keyValueStore->setProperty(valuableState, "group", CUPA_GROUP_SYMBOLIC_ADDRESS);
}
*/
std::ostringstream os;
os << "Stack frame " << i << " retAddr @ " << retAddrLocations[i];
if (valuableState) {
os << " overriden in state " << valuableState->getID();
getWarningsStream(state) << os.str() << "\n";
hasBug = true;
} else {
os << " can not be overriden";
getDebugStream(state) << os.str() << "\n";
}
}
} else {
for (unsigned i = 0; i < retAddrLocations.size(); i++) {
std::ostringstream os;
os << "Stack frame " << i << " retAddr @ " << retAddrLocations[i];
klee::ref<klee::Expr> retAddrLocationWrite =
klee::EqExpr::create(retAddrLocations.at(i), addr);
if (assume(state, retAddrLocationWrite)) {
os << " could be overridden";
getWarningsStream(state) << os.str() << "\n";
hasBug = true;
} else {
}
}
}
return hasBug;
}
/*
bool MemoryBugChecker::checkSymbolicUnallocatedHeapAccess(S2EExecutionState *state,
klee::ref<klee::Expr> addr)
{
m_pm->updateProcessAddressMap("[anon:libc_malloc]", 0xffffffff);
bool notAllocated = true;
if (isAddressWithinFile(addr, "[anon:libc_malloc]")) {
for (auto region : m_libcMallocRegions) {
if (addr >= region.first && addr + size < region.second) {
notAllocated = false;
break;
}
}
}
if (notAllocated) {
err << "MemoryBugChecker::checkMemoryAccess: "
<< "BUG: memory range at " << hexval(addr) << " of size " << hexval(size)
<< " can not be accessed by instruction " << getPrettyCodeLocation(state)
<< ": using not allocated region in heap" << '\n';
emitOnBugDetected(state, BUG_C_LIBC_UNALLOCHEAP);
}
return notAllocated;
}*/
bool MemoryBugChecker::checkSymbolicMemoryAccess(S2EExecutionState *state,
klee::ref<klee::Expr> start,
klee::ref<klee::Expr> value,
bool isWrite,
llvm::raw_ostream &err)
{
DECLARE_PLUGINSTATE(MemoryBugCheckerState, state);
if (!m_checkBugs)
return true;
bool hasBug = false;
if (checkRange(state, start)) {
emitOnBugDetected(state, BUG_S_MEMACCESS);
getWarningsStream(state) << "Symbolic memory access\n"
<< " Instruction: " << getPrettyCodeLocation(state) << "\n"
<< " Address: " << start << "\n";
m_stackMonitor->printCallStack(state);
}
if (m_checkNullPtrDerefBug) {
hasBug = checkNullPtrDeref(state, start);
if (hasBug) {
err << "BUG: potential null pointer dereference\n"
<< " Instruction: " << getPrettyCodeLocation(state) << "\n"
<< " Address: " << start << "\n";
emitOnBugDetected(state, BUG_S_R_NULLPTR);
}
}
if (isWrite) {
if (m_checkRetPtrOverrideBug) {
hasBug = checkRetPtrOverride(state, start);
if (hasBug) {
err << "BUG: potential return pointer override\n"
<< " Instruction: " << getPrettyCodeLocation(state) << "\n"
<< " Address: "<< start << "\n";
emitOnBugDetected(state, BUG_S_W_RETPTR);
}
}
if (m_checkOOBAccessBug) {
StackMonitor::CallStack cs;
if (m_stackMonitor->getCallStack(state, 1, pthread_self(), cs)) {
ImageInfo* info = &m_binaryInfo;
if (checkAddressRange(state, start, cs.back().FrameTop, info->start_stack)
&& checkAddressRange(state, start, info->start_code, plgState->getBRKAddress())) {
err << "BUG: suspicious memory access (could access to both heap and stack)\n"
<< " Instruction: " << getPrettyCodeLocation(state) << "\n"
<< " Address: "<< start << "\n";
hasBug = true;
emitOnBugDetected(state, BUG_S_W_STACKANDHEAP);
}
}
}
if (m_checkOOBAccessBug) {
ImageInfo* info = &m_binaryInfo;
if (checkAddressRange(state, start, info->start_code, info->end_code)) {
err << "BUG: potential write to code section\n"
<< " Instruction: " << getPrettyCodeLocation(state) << "\n"
<< " Address: "<< start << "\n";
hasBug = true;
emitOnBugDetected(state, BUG_S_W_CODE);
}
}
}
return !hasBug;
}
void MemoryBugChecker::onBeforeSymbolicDataMemoryAccess(S2EExecutionState* state,
klee::ref<klee::Expr> virtualAddress,
klee::ref<klee::Expr> value,
bool isWrite)
{
std::string errstr;
llvm::raw_string_ostream err(errstr);
bool result = checkSymbolicMemoryAccess(state, virtualAddress, value, isWrite, err);
if (!result) {
if (m_terminateOnBugs) {
s2e()->getExecutor()->terminateStateEarly(*state, err.str());
}
else {
s2e()->getWarningsStream(state) << err.str();
m_stackMonitor->printCallStack(state);
}
}
}
bool MemoryBugChecker::checkConcreteOOBAccess(S2EExecutionState *state, uint64_t addr, int size,
bool isWrite, llvm::raw_ostream &err)
{
// DECLARE_PLUGINSTATE(MemoryBugCheckerState, state);
// StoreMap &storeMap = plgState->getStoreMap();
if (!m_checkRetPtrOverrideBug)
return false;
bool hasError = false;
if (isWrite) {
StackMonitor::CallStack cs;
if (!m_stackMonitor->getCallStack(state, 1, pthread_self(), cs)) {
getWarningsStream(state) << "Failed to get call stack\n";
return false;
}
bool stack = (addr <= m_binaryInfo.start_stack && addr > m_binaryInfo.stack_limit);
uint64_t framePc = 0;
uint64_t pc = state->regs()->getPc();
int wordSize = state->getPointerWidth() / 8;
//getDebugStream(state) <<'\n';
if (stack) {
for (unsigned i = 1; i < cs.size(); i++) { // always skip first dummy frame
//getDebugStream(state) << " waddr: "<< hexval(addr)
// << " frameTop: " << hexval(cs[i].FrameTop) << '\n';
if ((addr < cs[i].FrameTop && addr >= cs[i].FrameTop + wordSize) ||
(addr + wordSize < cs[i].FrameTop && addr + wordSize >= cs[i].FrameTop + wordSize)) {
err << "MemoryBugChecker::checkMemoryAccess: "
<< "BUG: memory range at " << hexval(addr) << " of size " << hexval(size)
<< " can not be accessed by instruction " << getPrettyCodeLocation(state)
<< ": the return pointer at " << hexval(cs[i].FrameTop)
<< " should not be overriden" << "\n";
hasError = true;
emitOnBugDetected(state, BUG_C_W_RETPTR, pc);
break;
}
if (addr >= cs[i].FrameTop) {
framePc = cs[i].FramePc;
}
}
}
// //Check the access pattern
// StoreAttribute *attr = new StoreAttribute();
// attr->stack = stack;
// attr->local = (framePc == cs.back().FramePc);
// attr->framePC = framePc;
//
// auto it = storeMap.find(pc);
// if (it != storeMap.end()) {
// storeMap.insert(std::pair<uint64_t, StoreAttribute>(pc, *attr));
// } else {
// if (it->second.stack != attr->stack ||
// (attr->stack == true && it->second.local != attr->local)) {
// err << "MemoryBugChecker::checkMemoryAccess: "
// << "BUG: memory range at " << hexval(addr) << " of size " << hexval(size)
// << " accessed by instruction " << getPrettyCodeLocation(state)
// << " : Access pattern mismatch. This could be an out-of-bound access. " << "\n";
// hasError = true;
// emitOnBugDetected(state, BUG_C_W_STACKANDHEAP, pc);
// }
// }
}
return hasError;
}
/*
bool MemoryBugChecker::checkUnallocatedHeapAccess(S2EExecutionState *state, uint64_t addr,
int size, llvm::raw_ostream &err)
{
if (m_pm->isAddressUnknown(addr))
m_pm->updateProcessAddressMap("[anon:libc_malloc]", addr + size);
bool notAllocated = true;
if (m_pm->isAddressWithinFile(addr, "[anon:libc_malloc]")) {
for (auto region : m_libcMallocRegions) {
if (addr >= region.first && addr + size < region.second) {
notAllocated = false;
break;
}
}
}
if (notAllocated) {
err << "MemoryBugChecker::checkMemoryAccess: "
<< "BUG: memory range at " << hexval(addr) << " of size " << hexval(size)
<< " can not be accessed by instruction " << getPrettyCodeLocation(state)
<< ": using not allocated region in heap" << '\n';
emitOnBugDetected(state, BUG_C_LIBC_UNALLOCHEAP);
}
return notAllocated;
}*/
bool MemoryBugChecker::checkMemoryAccess(S2EExecutionState *state,
uint64_t start, uint64_t size, uint8_t perms,
llvm::raw_ostream &err)
{
if (!m_checkBugs)
return true;
bool hasError = false;
//FIXME: should move the checking for concrete null pointer dereference to a handler
//connected to a signal emitted before concrete memory access. Otherwise, null
//pointer dereference will trigger qemu bad ram pointer error before the checking.
if (m_checkNullPtrDerefBug && (start == 0)) {
err << "MemoryBugChecker::checkMemoryAccess: "
<< "BUG: memory range at " << hexval(start) << " of size " << hexval(size)
<< " can not be accessed by instruction " << getPrettyCodeLocation(state)
<< ": reading memory @ 0x0, could be null pointer dereference" << '\n';
hasError = true;
}
hasError |= checkConcreteOOBAccess(state, start, size, perms & WRITE, err);
// hasError |= checkUnallocatedHeapAccess(state, start, size, err);
return !hasError;
}
void MemoryBugChecker::onAlwaysConcreteMemoryAccess(S2EExecutionState *state,
klee::ref<klee::Expr> value,
bool isWrite)
{
if (isWrite)
getWarningsStream(state) << "write pc\n";
else
getWarningsStream(state) << "read pc\n";
}
void MemoryBugChecker::onConcreteDataMemoryAccess(S2EExecutionState *state,
uint64_t virtualAddress,
uint64_t value,
uint8_t size,
unsigned flags)
{
bool isWrite = flags & MEM_TRACE_FLAG_WRITE;
onPreCheck.emit(state, virtualAddress, size, isWrite);
std::string errstr;
llvm::raw_string_ostream err(errstr);
bool result = checkMemoryAccess(state, virtualAddress, size, isWrite ? WRITE : READ, err);
if (!result) {
onPostCheck.emit(state, virtualAddress, size, isWrite, &result);
if (result) {
return;
}
if (m_terminateOnBugs)
s2e()->getExecutor()->terminateStateEarly(*state, err.str());
else
s2e()->getWarningsStream(state) << err.str();
}
}
std::string MemoryBugChecker::getPrettyCodeLocation(S2EExecutionState *state)
{
std::stringstream ss;
uint64_t pc = state->regs()->getPc();
uint32_t insn;
std::string binary = m_pm->getFileName(pc);
if (!state->mem()->read<uint32_t>(pc, &insn, VirtualAddress, false)) {
getWarningsStream(state) << "cannot get instruction at " << hexval(pc);
}
ss << hexval(insn) << " @" << hexval(pc) << " " << binary;
return ss.str();
}
} // namespace plugins
} // namespace s2e
| 38.495856
| 167
| 0.559757
|
trusslab
|
54f5801d9388ffab36e8d18a91e7f7804e4b564e
| 463
|
cpp
|
C++
|
leetcode/problems/easy/504-base-7.cpp
|
wingkwong/competitive-programming
|
e8bf7aa32e87b3a020b63acac20e740728764649
|
[
"MIT"
] | 18
|
2020-08-27T05:27:50.000Z
|
2022-03-08T02:56:48.000Z
|
leetcode/problems/easy/504-base-7.cpp
|
wingkwong/competitive-programming
|
e8bf7aa32e87b3a020b63acac20e740728764649
|
[
"MIT"
] | null | null | null |
leetcode/problems/easy/504-base-7.cpp
|
wingkwong/competitive-programming
|
e8bf7aa32e87b3a020b63acac20e740728764649
|
[
"MIT"
] | 1
|
2020-10-13T05:23:58.000Z
|
2020-10-13T05:23:58.000Z
|
/*
Base 7
https://leetcode.com/problems/base-7/
Given an integer num, return a string of its base 7 representation.
Example 1:
Input: num = 100
Output: "202"
Example 2:
Input: num = -7
Output: "-10"
Constraints:
-107 <= num <= 107
*/
class Solution {
public:
string convertToBase7(int n) {
if (n < 0) return "-" + convertToBase7(-n);
if (n < 7) return to_string(n);
return convertToBase7(n / 7) + to_string(n % 7);
}
};
| 14.935484
| 67
| 0.609071
|
wingkwong
|
54f642de2d6c37b21f4bbf4a19b278b1e07e7524
| 3,999
|
cpp
|
C++
|
emf_core_bindings/src/emf_event.cpp
|
GabeRealB/emf
|
a233edaed7ed99948b0a935e6378bac131fdf4c2
|
[
"Apache-2.0",
"MIT"
] | null | null | null |
emf_core_bindings/src/emf_event.cpp
|
GabeRealB/emf
|
a233edaed7ed99948b0a935e6378bac131fdf4c2
|
[
"Apache-2.0",
"MIT"
] | null | null | null |
emf_core_bindings/src/emf_event.cpp
|
GabeRealB/emf
|
a233edaed7ed99948b0a935e6378bac131fdf4c2
|
[
"Apache-2.0",
"MIT"
] | 1
|
2021-01-10T15:00:08.000Z
|
2021-01-10T15:00:08.000Z
|
#include <emf_core/emf_event.h>
#include <emf_core_bindings/emf_core_bindings.h>
using namespace EMF::Core::C;
namespace EMF::Core::Bindings::C {
extern "C" {
emf_event_handle_t EMF_CALL_C emf_event_create(
const emf_event_name_t* EMF_NOT_NULL event_name, emf_event_handler_fn_t EMF_MAYBE_NULL event_handler) EMF_NOEXCEPT
{
EMF_ASSERT_ERROR(event_name != nullptr, "emf_event_create()")
EMF_ASSERT_ERROR(emf_event_name_exists(event_name) == emf_bool_false, "emf_event_create()")
return emf_binding_interface->event_create_fn(event_name, event_handler);
}
EMF_NODISCARD emf_event_handle_t EMF_CALL_C emf_event_create_private(
emf_event_handler_fn_t EMF_MAYBE_NULL event_handler) EMF_NOEXCEPT
{
return emf_binding_interface->event_create_private_fn(event_handler);
}
void EMF_CALL_C emf_event_destroy(emf_event_handle_t event_handle) EMF_NOEXCEPT
{
EMF_ASSERT_ERROR(emf_event_handle_exists(event_handle) == emf_bool_true, "emf_event_destroy()")
emf_binding_interface->event_destroy_fn(event_handle);
}
void EMF_CALL_C emf_event_publish(emf_event_handle_t event_handle, const emf_event_name_t* EMF_NOT_NULL event_name) EMF_NOEXCEPT
{
EMF_ASSERT_ERROR(event_name != nullptr, "emf_event_publish()")
EMF_ASSERT_ERROR(emf_event_name_exists(event_name) == emf_bool_false, "emf_event_publish()")
emf_binding_interface->event_publish_fn(event_handle, event_name);
}
EMF_NODISCARD size_t EMF_CALL_C emf_event_get_num_public_events() EMF_NOEXCEPT
{
return emf_binding_interface->event_get_num_public_events_fn();
}
size_t EMF_CALL_C emf_event_get_public_events(emf_event_name_span_t* EMF_NOT_NULL buffer) EMF_NOEXCEPT
{
EMF_ASSERT_ERROR(buffer != nullptr, "emf_event_get_public_events()")
EMF_ASSERT_ERROR(buffer->length >= emf_event_get_num_public_events(), "emf_event_get_public_events()")
EMF_ASSERT_ERROR(buffer->data != nullptr, "emf_event_get_public_events()")
return emf_binding_interface->event_get_public_events_fn(buffer);
}
EMF_NODISCARD emf_event_handle_t EMF_CALL_C emf_event_get_event_handle(
const emf_event_name_t* EMF_NOT_NULL event_name) EMF_NOEXCEPT
{
EMF_ASSERT_ERROR(event_name != nullptr, "emf_event_get_event_handle()")
EMF_ASSERT_ERROR(emf_event_name_exists(event_name) == emf_bool_true, "emf_event_get_event_handle()")
return emf_binding_interface->event_get_event_handle_fn(event_name);
}
EMF_NODISCARD emf_bool_t EMF_CALL_C emf_event_handle_exists(emf_event_handle_t event_handle) EMF_NOEXCEPT
{
return emf_binding_interface->event_handle_exists_fn(event_handle);
}
EMF_NODISCARD emf_bool_t EMF_CALL_C emf_event_name_exists(const emf_event_name_t* EMF_NOT_NULL event_name) EMF_NOEXCEPT
{
EMF_ASSERT_ERROR(event_name != nullptr, "emf_event_name_exists()")
return emf_binding_interface->event_name_exists_fn(event_name);
}
void EMF_CALL_C emf_event_subscribe_handler(
emf_event_handle_t event_handle, emf_event_handler_fn_t EMF_NOT_NULL event_handler) EMF_NOEXCEPT
{
EMF_ASSERT_ERROR(emf_event_handle_exists(event_handle) == emf_bool_true, "emf_event_subscribe_handler()")
EMF_ASSERT_ERROR(event_handler != nullptr, "emf_event_subscribe_handler()")
emf_binding_interface->event_subscribe_handler_fn(event_handle, event_handler);
}
void EMF_CALL_C emf_event_unsubscribe_handler(
emf_event_handle_t event_handle, emf_event_handler_fn_t EMF_NOT_NULL event_handler) EMF_NOEXCEPT
{
EMF_ASSERT_ERROR(emf_event_handle_exists(event_handle) == emf_bool_true, "emf_event_unsubscribe_handler()")
EMF_ASSERT_ERROR(event_handler != nullptr, "emf_event_unsubscribe_handler()")
emf_binding_interface->event_unsubscribe_handler_fn(event_handle, event_handler);
}
void EMF_CALL_C emf_event_signal(emf_event_handle_t event_handle, emf_event_data_t EMF_MAYBE_NULL event_data) EMF_NOEXCEPT
{
EMF_ASSERT_ERROR(emf_event_handle_exists(event_handle) == emf_bool_true, "emf_event_signal()")
emf_binding_interface->event_signal_fn(event_handle, event_data);
}
}
}
| 43
| 128
| 0.829457
|
GabeRealB
|
54f8453c90ce9688988ec717ad5a17241d7ee8d8
| 180
|
cpp
|
C++
|
Landlords/Player.cpp
|
jie65535/Landlords
|
cb0cbae732af868c34fb66e01a7159dfc90992ee
|
[
"MIT"
] | null | null | null |
Landlords/Player.cpp
|
jie65535/Landlords
|
cb0cbae732af868c34fb66e01a7159dfc90992ee
|
[
"MIT"
] | null | null | null |
Landlords/Player.cpp
|
jie65535/Landlords
|
cb0cbae732af868c34fb66e01a7159dfc90992ee
|
[
"MIT"
] | 1
|
2019-05-19T15:12:30.000Z
|
2019-05-19T15:12:30.000Z
|
#include "stdafx.h"
#include "Player.h"
Player::Player(playerID_t id):
m_id(id), m_name(), m_integral(0), m_currRoom(0), isReady(false)
{
}
Player::~Player()
{
}
| 12.857143
| 66
| 0.611111
|
jie65535
|
54fe6917cba19e2966b310eb77007a25e7d3dbf1
| 22,871
|
cc
|
C++
|
GRPC/grpc.pb.cc
|
SoftlySpoken/gStore
|
b2cf71288ccef376640000965aff7c430101446a
|
[
"BSD-3-Clause"
] | 150
|
2015-01-14T15:06:38.000Z
|
2018-08-28T09:34:17.000Z
|
GRPC/grpc.pb.cc
|
SoftlySpoken/gStore
|
b2cf71288ccef376640000965aff7c430101446a
|
[
"BSD-3-Clause"
] | 28
|
2015-05-11T02:45:39.000Z
|
2018-08-24T11:43:17.000Z
|
GRPC/grpc.pb.cc
|
SoftlySpoken/gStore
|
b2cf71288ccef376640000965aff7c430101446a
|
[
"BSD-3-Clause"
] | 91
|
2015-05-04T09:52:41.000Z
|
2018-08-18T13:02:15.000Z
|
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: grpc.proto
#include "grpc.pb.h"
#include <algorithm>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/extension_set.h>
#include <google/protobuf/wire_format_lite.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format.h>
// @@protoc_insertion_point(includes)
#include <google/protobuf/port_def.inc>
PROTOBUF_PRAGMA_INIT_SEG
constexpr EchoRequest::EchoRequest(
::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
: message_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
, name_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string){}
struct EchoRequestDefaultTypeInternal {
constexpr EchoRequestDefaultTypeInternal()
: _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
~EchoRequestDefaultTypeInternal() {}
union {
EchoRequest _instance;
};
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT EchoRequestDefaultTypeInternal _EchoRequest_default_instance_;
constexpr EchoResponse::EchoResponse(
::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
: message_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string){}
struct EchoResponseDefaultTypeInternal {
constexpr EchoResponseDefaultTypeInternal()
: _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
~EchoResponseDefaultTypeInternal() {}
union {
EchoResponse _instance;
};
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT EchoResponseDefaultTypeInternal _EchoResponse_default_instance_;
static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_grpc_2eproto[2];
static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_grpc_2eproto = nullptr;
static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_grpc_2eproto = nullptr;
const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_grpc_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
PROTOBUF_FIELD_OFFSET(::EchoRequest, _has_bits_),
PROTOBUF_FIELD_OFFSET(::EchoRequest, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
PROTOBUF_FIELD_OFFSET(::EchoRequest, message_),
PROTOBUF_FIELD_OFFSET(::EchoRequest, name_),
0,
1,
PROTOBUF_FIELD_OFFSET(::EchoResponse, _has_bits_),
PROTOBUF_FIELD_OFFSET(::EchoResponse, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
PROTOBUF_FIELD_OFFSET(::EchoResponse, message_),
0,
};
static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
{ 0, 7, sizeof(::EchoRequest)},
{ 9, 15, sizeof(::EchoResponse)},
};
static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = {
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::_EchoRequest_default_instance_),
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::_EchoResponse_default_instance_),
};
const char descriptor_table_protodef_grpc_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) =
"\n\ngrpc.proto\",\n\013EchoRequest\022\017\n\007message\030\001"
" \001(\t\022\014\n\004name\030\002 \001(\t\"\037\n\014EchoResponse\022\017\n\007me"
"ssage\030\001 \001(\t2.\n\007Example\022#\n\004Echo\022\014.EchoReq"
"uest\032\r.EchoResponse"
;
static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_grpc_2eproto_once;
const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_grpc_2eproto = {
false, false, 139, descriptor_table_protodef_grpc_2eproto, "grpc.proto",
&descriptor_table_grpc_2eproto_once, nullptr, 0, 2,
schemas, file_default_instances, TableStruct_grpc_2eproto::offsets,
file_level_metadata_grpc_2eproto, file_level_enum_descriptors_grpc_2eproto, file_level_service_descriptors_grpc_2eproto,
};
PROTOBUF_ATTRIBUTE_WEAK const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable* descriptor_table_grpc_2eproto_getter() {
return &descriptor_table_grpc_2eproto;
}
// Force running AddDescriptors() at dynamic initialization time.
PROTOBUF_ATTRIBUTE_INIT_PRIORITY static ::PROTOBUF_NAMESPACE_ID::internal::AddDescriptorsRunner dynamic_init_dummy_grpc_2eproto(&descriptor_table_grpc_2eproto);
// ===================================================================
class EchoRequest::_Internal {
public:
using HasBits = decltype(std::declval<EchoRequest>()._has_bits_);
static void set_has_message(HasBits* has_bits) {
(*has_bits)[0] |= 1u;
}
static void set_has_name(HasBits* has_bits) {
(*has_bits)[0] |= 2u;
}
};
EchoRequest::EchoRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned)
: ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
SharedCtor();
if (!is_message_owned) {
RegisterArenaDtor(arena);
}
// @@protoc_insertion_point(arena_constructor:EchoRequest)
}
EchoRequest::EchoRequest(const EchoRequest& from)
: ::PROTOBUF_NAMESPACE_ID::Message(),
_has_bits_(from._has_bits_) {
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
message_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from._internal_has_message()) {
message_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_message(),
GetArenaForAllocation());
}
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from._internal_has_name()) {
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
GetArenaForAllocation());
}
// @@protoc_insertion_point(copy_constructor:EchoRequest)
}
inline void EchoRequest::SharedCtor() {
message_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}
EchoRequest::~EchoRequest() {
// @@protoc_insertion_point(destructor:EchoRequest)
if (GetArenaForAllocation() != nullptr) return;
SharedDtor();
_internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
inline void EchoRequest::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
message_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}
void EchoRequest::ArenaDtor(void* object) {
EchoRequest* _this = reinterpret_cast< EchoRequest* >(object);
(void)_this;
}
void EchoRequest::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
}
void EchoRequest::SetCachedSize(int size) const {
_cached_size_.Set(size);
}
void EchoRequest::Clear() {
// @@protoc_insertion_point(message_clear_start:EchoRequest)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
if (cached_has_bits & 0x00000003u) {
if (cached_has_bits & 0x00000001u) {
message_.ClearNonDefaultToEmpty();
}
if (cached_has_bits & 0x00000002u) {
name_.ClearNonDefaultToEmpty();
}
}
_has_bits_.Clear();
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
const char* EchoRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
_Internal::HasBits has_bits{};
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// optional string message = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
auto str = _internal_mutable_message();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
#ifndef NDEBUG
::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "EchoRequest.message");
#endif // !NDEBUG
CHK_(ptr);
} else goto handle_unusual;
continue;
// optional string name = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
auto str = _internal_mutable_name();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
#ifndef NDEBUG
::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "EchoRequest.name");
#endif // !NDEBUG
CHK_(ptr);
} else goto handle_unusual;
continue;
default: {
handle_unusual:
if ((tag == 0) || ((tag & 7) == 4)) {
CHK_(ptr);
ctx->SetLastTag(tag);
goto success;
}
ptr = UnknownFieldParse(tag,
_internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
ptr, ctx);
CHK_(ptr != nullptr);
continue;
}
} // switch
} // while
success:
_has_bits_.Or(has_bits);
return ptr;
failure:
ptr = nullptr;
goto success;
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* EchoRequest::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:EchoRequest)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
// optional string message = 1;
if (cached_has_bits & 0x00000001u) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
this->_internal_message().data(), static_cast<int>(this->_internal_message().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
"EchoRequest.message");
target = stream->WriteStringMaybeAliased(
1, this->_internal_message(), target);
}
// optional string name = 2;
if (cached_has_bits & 0x00000002u) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
"EchoRequest.name");
target = stream->WriteStringMaybeAliased(
2, this->_internal_name(), target);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:EchoRequest)
return target;
}
size_t EchoRequest::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:EchoRequest)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
if (cached_has_bits & 0x00000003u) {
// optional string message = 1;
if (cached_has_bits & 0x00000001u) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
this->_internal_message());
}
// optional string name = 2;
if (cached_has_bits & 0x00000002u) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
this->_internal_name());
}
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
_internal_metadata_, total_size, &_cached_size_);
}
int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
SetCachedSize(cached_size);
return total_size;
}
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData EchoRequest::_class_data_ = {
::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck,
EchoRequest::MergeImpl
};
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*EchoRequest::GetClassData() const { return &_class_data_; }
void EchoRequest::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to,
const ::PROTOBUF_NAMESPACE_ID::Message&from) {
static_cast<EchoRequest *>(to)->MergeFrom(
static_cast<const EchoRequest &>(from));
}
void EchoRequest::MergeFrom(const EchoRequest& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:EchoRequest)
GOOGLE_DCHECK_NE(&from, this);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = from._has_bits_[0];
if (cached_has_bits & 0x00000003u) {
if (cached_has_bits & 0x00000001u) {
_internal_set_message(from._internal_message());
}
if (cached_has_bits & 0x00000002u) {
_internal_set_name(from._internal_name());
}
}
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
}
void EchoRequest::CopyFrom(const EchoRequest& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:EchoRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool EchoRequest::IsInitialized() const {
return true;
}
void EchoRequest::InternalSwap(EchoRequest* other) {
using std::swap;
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&message_, GetArenaForAllocation(),
&other->message_, other->GetArenaForAllocation()
);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&name_, GetArenaForAllocation(),
&other->name_, other->GetArenaForAllocation()
);
}
::PROTOBUF_NAMESPACE_ID::Metadata EchoRequest::GetMetadata() const {
return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
&descriptor_table_grpc_2eproto_getter, &descriptor_table_grpc_2eproto_once,
file_level_metadata_grpc_2eproto[0]);
}
// ===================================================================
class EchoResponse::_Internal {
public:
using HasBits = decltype(std::declval<EchoResponse>()._has_bits_);
static void set_has_message(HasBits* has_bits) {
(*has_bits)[0] |= 1u;
}
};
EchoResponse::EchoResponse(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned)
: ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
SharedCtor();
if (!is_message_owned) {
RegisterArenaDtor(arena);
}
// @@protoc_insertion_point(arena_constructor:EchoResponse)
}
EchoResponse::EchoResponse(const EchoResponse& from)
: ::PROTOBUF_NAMESPACE_ID::Message(),
_has_bits_(from._has_bits_) {
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
message_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from._internal_has_message()) {
message_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_message(),
GetArenaForAllocation());
}
// @@protoc_insertion_point(copy_constructor:EchoResponse)
}
inline void EchoResponse::SharedCtor() {
message_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}
EchoResponse::~EchoResponse() {
// @@protoc_insertion_point(destructor:EchoResponse)
if (GetArenaForAllocation() != nullptr) return;
SharedDtor();
_internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
inline void EchoResponse::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
message_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}
void EchoResponse::ArenaDtor(void* object) {
EchoResponse* _this = reinterpret_cast< EchoResponse* >(object);
(void)_this;
}
void EchoResponse::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
}
void EchoResponse::SetCachedSize(int size) const {
_cached_size_.Set(size);
}
void EchoResponse::Clear() {
// @@protoc_insertion_point(message_clear_start:EchoResponse)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
if (cached_has_bits & 0x00000001u) {
message_.ClearNonDefaultToEmpty();
}
_has_bits_.Clear();
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
const char* EchoResponse::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
_Internal::HasBits has_bits{};
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
switch (tag >> 3) {
// optional string message = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
auto str = _internal_mutable_message();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
#ifndef NDEBUG
::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "EchoResponse.message");
#endif // !NDEBUG
CHK_(ptr);
} else goto handle_unusual;
continue;
default: {
handle_unusual:
if ((tag == 0) || ((tag & 7) == 4)) {
CHK_(ptr);
ctx->SetLastTag(tag);
goto success;
}
ptr = UnknownFieldParse(tag,
_internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
ptr, ctx);
CHK_(ptr != nullptr);
continue;
}
} // switch
} // while
success:
_has_bits_.Or(has_bits);
return ptr;
failure:
ptr = nullptr;
goto success;
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* EchoResponse::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:EchoResponse)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _has_bits_[0];
// optional string message = 1;
if (cached_has_bits & 0x00000001u) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
this->_internal_message().data(), static_cast<int>(this->_internal_message().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
"EchoResponse.message");
target = stream->WriteStringMaybeAliased(
1, this->_internal_message(), target);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:EchoResponse)
return target;
}
size_t EchoResponse::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:EchoResponse)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
// optional string message = 1;
cached_has_bits = _has_bits_[0];
if (cached_has_bits & 0x00000001u) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
this->_internal_message());
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
_internal_metadata_, total_size, &_cached_size_);
}
int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
SetCachedSize(cached_size);
return total_size;
}
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData EchoResponse::_class_data_ = {
::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck,
EchoResponse::MergeImpl
};
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*EchoResponse::GetClassData() const { return &_class_data_; }
void EchoResponse::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to,
const ::PROTOBUF_NAMESPACE_ID::Message&from) {
static_cast<EchoResponse *>(to)->MergeFrom(
static_cast<const EchoResponse &>(from));
}
void EchoResponse::MergeFrom(const EchoResponse& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:EchoResponse)
GOOGLE_DCHECK_NE(&from, this);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (from._internal_has_message()) {
_internal_set_message(from._internal_message());
}
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
}
void EchoResponse::CopyFrom(const EchoResponse& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:EchoResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool EchoResponse::IsInitialized() const {
return true;
}
void EchoResponse::InternalSwap(EchoResponse* other) {
using std::swap;
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
&message_, GetArenaForAllocation(),
&other->message_, other->GetArenaForAllocation()
);
}
::PROTOBUF_NAMESPACE_ID::Metadata EchoResponse::GetMetadata() const {
return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
&descriptor_table_grpc_2eproto_getter, &descriptor_table_grpc_2eproto_once,
file_level_metadata_grpc_2eproto[1]);
}
// @@protoc_insertion_point(namespace_scope)
PROTOBUF_NAMESPACE_OPEN
template<> PROTOBUF_NOINLINE ::EchoRequest* Arena::CreateMaybeMessage< ::EchoRequest >(Arena* arena) {
return Arena::CreateMessageInternal< ::EchoRequest >(arena);
}
template<> PROTOBUF_NOINLINE ::EchoResponse* Arena::CreateMaybeMessage< ::EchoResponse >(Arena* arena) {
return Arena::CreateMessageInternal< ::EchoResponse >(arena);
}
PROTOBUF_NAMESPACE_CLOSE
// @@protoc_insertion_point(global_scope)
#include <google/protobuf/port_undef.inc>
| 38.374161
| 162
| 0.738883
|
SoftlySpoken
|
0701c19396d73fb85d535bbc66f42e8da46a8c49
| 2,033
|
cpp
|
C++
|
Source/Qurses/Windows/WinQCgetsc.cpp
|
mfaithfull/QOR
|
0fa51789344da482e8c2726309265d56e7271971
|
[
"BSL-1.0"
] | 9
|
2016-05-27T01:00:39.000Z
|
2021-04-01T08:54:46.000Z
|
Source/Qurses/Windows/WinQCgetsc.cpp
|
mfaithfull/QOR
|
0fa51789344da482e8c2726309265d56e7271971
|
[
"BSL-1.0"
] | 1
|
2016-03-03T22:54:08.000Z
|
2016-03-03T22:54:08.000Z
|
Source/Qurses/Windows/WinQCgetsc.cpp
|
mfaithfull/QOR
|
0fa51789344da482e8c2726309265d56e7271971
|
[
"BSL-1.0"
] | 4
|
2016-05-27T01:00:43.000Z
|
2018-08-19T08:47:49.000Z
|
// Public Domain Curses
#include "Qurses/Windows/pdcwin.h"
#include "WinQL/Application/Console/WinQLConsoleScreenBuffer.h"
#include "WinQL/Application/WinQLApplication.h"
RCSID("$Id: pdcgetsc.c,v 1.36 2008/07/14 04:24:52 wmcbrine Exp $")
//------------------------------------------------------------------------------
// get the cursor size/shape
int PDC_get_cursor_mode( void )
{
__QCS_FCONTEXT( "PDC_get_cursor_mode" );
nsWin32::ConsoleCursorInfo cci;
if( !nsWin32::CConsole::TheWin32Console()->ScreenBuffer()->GetCursorInfo( cci ) )
{
return ERR;
}
return cci.dwSize;
}
//------------------------------------------------------------------------------
// return number of screen rows
int PDC_get_rows( void )
{
__QCS_FCONTEXT( "PDC_get_rows" );
nsWin32::ConsoleScreenBufferInfoEx scr;
memset( &scr, 0, sizeof( nsWin32::ConsoleScreenBufferInfoEx ) );
scr.cbSize = sizeof( nsWin32::ConsoleScreenBufferInfoEx );
nsWin32::CConsole::TheWin32Console()->ScreenBuffer()->GetInfoEx( scr );
return scr.srWindow.Bottom - scr.srWindow.Top + 1;
}
//------------------------------------------------------------------------------
// return number of buffer rows
int PDC_get_buffer_rows( void )
{
__QCS_FCONTEXT( "PDC_get_buffer_rows" );
nsWin32::ConsoleScreenBufferInfoEx scr;
memset( &scr, 0, sizeof( nsWin32::ConsoleScreenBufferInfoEx ) );
scr.cbSize = sizeof( nsWin32::ConsoleScreenBufferInfoEx );
nsWin32::CConsole::TheWin32Console()->ScreenBuffer()->GetInfoEx( scr );
return scr.dwSize.Y;
}
//------------------------------------------------------------------------------
// return width of screen/viewport
int PDC_get_columns( void )
{
__QCS_FCONTEXT( "PDC_get_colomns" );
nsWin32::ConsoleScreenBufferInfoEx scr;
memset( &scr, 0, sizeof( nsWin32::ConsoleScreenBufferInfoEx ) );
scr.cbSize = sizeof( nsWin32::ConsoleScreenBufferInfoEx );
nsWin32::CConsole::TheWin32Console()->ScreenBuffer()->GetInfoEx( scr );
return scr.srWindow.Right - scr.srWindow.Left + 1;
}
| 31.765625
| 85
| 0.614855
|
mfaithfull
|
07042b5ff176afe9602386c4bb725084db362100
| 1,720
|
cpp
|
C++
|
ewk/unittest/utc_blink_ewk_custom_handlers_data_url_get_func.cpp
|
Jabawack/chromium-efl
|
6d3a3accc8afba0aa0eff6461eb5c83138172e6e
|
[
"BSD-3-Clause"
] | 9
|
2015-04-09T20:22:08.000Z
|
2021-03-17T08:34:56.000Z
|
ewk/unittest/utc_blink_ewk_custom_handlers_data_url_get_func.cpp
|
Jabawack/chromium-efl
|
6d3a3accc8afba0aa0eff6461eb5c83138172e6e
|
[
"BSD-3-Clause"
] | 2
|
2015-02-04T13:41:12.000Z
|
2015-05-25T14:00:40.000Z
|
ewk/unittest/utc_blink_ewk_custom_handlers_data_url_get_func.cpp
|
isabella232/chromium-efl
|
db2d09aba6498fb09bbea1f8440d071c4b0fde78
|
[
"BSD-3-Clause"
] | 14
|
2015-02-12T16:20:47.000Z
|
2022-01-20T10:36:26.000Z
|
// Copyright 2014 Samsung Electronics. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "utc_blink_ewk_base.h"
class utc_blink_ewk_custom_handlers_data_url_get: public utc_blink_ewk_base {
protected:
void PostSetUp()
{
evas_object_smart_callback_add(GetEwkWebView(),"protocolhandler,registration,requested", (void(*)(void*, Evas_Object*, void*))custom_handler, this);
}
void PreTearDown()
{
evas_object_smart_callback_del(GetEwkWebView(),"protocolhandler,registration,requested", (void(*)(void*, Evas_Object*, void*))custom_handler);
}
void LoadFinished(Evas_Object* webview)
{
utc_message("[loadFinished] :: ");
EventLoopStop(Failure);
}
static void custom_handler(utc_blink_ewk_custom_handlers_data_url_get* owner, Evas_Object* /*webview*/, Ewk_Custom_Handlers_Data* custom_handler_data)
{
utc_message("[custom handler] :: \n");
ASSERT_TRUE(NULL != owner);
ASSERT_TRUE(NULL != custom_handler_data);
ASSERT_STREQ("http://codebits.glennjones.net/registerprotocol/register.html?%s", ewk_custom_handlers_data_url_get(custom_handler_data));
owner->EventLoopStop(Success);
}
};
/**
* @brief Checking if base_url is returned properly.
*/
TEST_F(utc_blink_ewk_custom_handlers_data_url_get, POS_TEST)
{
ASSERT_EQ(EINA_TRUE, ewk_view_url_set(GetEwkWebView(), "http://codebits.glennjones.net/registerprotocol/register.html"));
ASSERT_EQ(Success, EventLoopStart());
}
/**
* @brief Checking if NULL is returned when custom_handler_data is NULL.
*/
TEST_F(utc_blink_ewk_custom_handlers_data_url_get, NEG_TEST)
{
ASSERT_EQ(NULL, ewk_custom_handlers_data_url_get(NULL));
}
| 33.076923
| 152
| 0.764535
|
Jabawack
|
07043bd8b9db17683fd695131cccbf06e343a650
| 41,075
|
cpp
|
C++
|
src/gfx/conetracing_utils.cpp
|
scanberg/viamd
|
2e5330fad35f7c2116e15b4a538d5c4a5a18ca59
|
[
"MIT"
] | 11
|
2018-06-04T14:51:32.000Z
|
2021-12-21T13:35:08.000Z
|
src/gfx/conetracing_utils.cpp
|
scanberg/viamd
|
2e5330fad35f7c2116e15b4a538d5c4a5a18ca59
|
[
"MIT"
] | 19
|
2019-03-03T14:42:03.000Z
|
2022-03-01T19:09:49.000Z
|
src/gfx/conetracing_utils.cpp
|
scanberg/viamd
|
2e5330fad35f7c2116e15b4a538d5c4a5a18ca59
|
[
"MIT"
] | 1
|
2020-06-08T15:56:57.000Z
|
2020-06-08T15:56:57.000Z
|
#include "conetracing_utils.h"
#include <core/md_allocator.h>
#include <core/md_log.h>
#include <core/md_vec_math.h>
#include <core/md_sync.h>
#include "gfx/gl_utils.h"
#include "gfx/immediate_draw_utils.h"
#include "color_utils.h"
#include "task_system.h"
#include <atomic>
namespace cone_trace {
static GLuint vao = 0;
static GLuint vbo = 0;
static const char* v_shader_fs_quad_src = R"(
#version 150 core
out vec2 uv;
void main() {
uint idx = uint(gl_VertexID) % 3U;
gl_Position = vec4_t(
(float( idx &1U)) * 4.0 - 1.0,
(float((idx>>1U)&1U)) * 4.0 - 1.0,
0, 1.0);
uv = gl_Position.xy * 0.5 + 0.5;
}
)";
namespace voxelize {
static struct {
GLuint program = 0;
GLuint vao = 0;
struct {
GLint volume_dim = -1;
GLint volume_min = -1;
GLint voxel_ext = -1;
GLint tex_volume = -1;
} uniform_location;
} gl;
static const char* v_shader_src = R"(
#version 430 core
uniform ivec3_t u_volume_dim;
uniform vec3_t u_volume_min;
uniform vec3_t u_voxel_ext;
layout(binding=0, rgba8) uniform image3D u_tex_volume;
in vec4_t sphere;
in vec4_t color;
ivec3_t compute_voxel_coord(vec3_t coord) {
return clamp(ivec3_t((coord - u_volume_min) / u_voxel_ext), ivec3_t(0), u_volume_dim - 1);
}
void main() {
if (color.a == 0.0) discard;
ivec3_t coord = ivec3_t((sphere.xyz - u_volume_min) / u_voxel_ext);
vec3_t pos = sphere.xyz;
float r2 = sphere.w * sphere.w;
ivec3_t min_cc = compute_voxel_coord(sphere.xyz - vec3_t(sphere.w));
ivec3_t max_cc = compute_voxel_coord(sphere.xyz + vec3_t(sphere.w));
ivec3_t cc;
for (cc.z = min_cc.z; cc.z <= max_cc.z; cc.z++) {
for (cc.y = min_cc.y; cc.y <= max_cc.y; cc.y++) {
for (cc.x = min_cc.x; cc.x <= max_cc.x; cc.x++) {
vec3_t min_voxel = u_volume_min + vec3_t(cc) * u_voxel_ext;
vec3_t max_voxel = min_voxel + u_voxel_ext;
vec3_t clamped_pos = clamp(pos, min_voxel, max_voxel);
vec3_t d = clamped_pos - pos;
if (dot(d, d) < r2) {
imageStore(u_tex_volume, cc, color);
}
}
}
}
}
)";
static void initialize(int version_major, int version_minor) {
if (!gl.program) {
if (version_major >= 4 && version_minor >= 3) {
constexpr int BUFFER_SIZE = 1024;
char buffer[BUFFER_SIZE];
GLuint v_shader = glCreateShader(GL_VERTEX_SHADER);
glShaderSource(v_shader, 1, &v_shader_src, 0);
glCompileShader(v_shader);
if (gl::get_shader_compile_error(buffer, BUFFER_SIZE, v_shader)) {
md_printf(MD_LOG_TYPE_ERROR, "Compiling sphere binning vertex shader:\n%s\n", buffer);
}
gl.program = glCreateProgram();
glAttachShader(gl.program, v_shader);
glLinkProgram(gl.program);
if (gl::get_program_link_error(buffer, BUFFER_SIZE, gl.program)) {
md_printf(MD_LOG_TYPE_ERROR, "Linking sphere binning program:\n%s\n", buffer);
}
glDetachShader(gl.program, v_shader);
glDeleteShader(v_shader);
gl.uniform_location.volume_dim = glGetUniformLocation(gl.program, "u_volume_dim");
gl.uniform_location.volume_min = glGetUniformLocation(gl.program, "u_volume_min");
gl.uniform_location.voxel_ext = glGetUniformLocation(gl.program, "u_voxel_ext");
gl.uniform_location.tex_volume = glGetUniformLocation(gl.program, "u_tex_volume");
} else {
md_print(MD_LOG_TYPE_INFO, "Sphere binning shader requires OpenGL 4.3");
}
}
if (!gl.vao) glGenVertexArrays(1, &gl.vao);
}
static void shutdown() {
if (gl.program) {
glDeleteProgram(gl.program);
gl.program = 0;
}
if (gl.vao) {
glDeleteVertexArrays(1, &gl.vao);
gl.vao = 0;
}
}
} // namespace voxelize
namespace cone_trace {
static struct {
GLuint program = 0;
struct {
GLint depth_tex = -1;
GLint normal_tex = -1;
GLint color_alpha_tex = -1;
GLint f0_smoothness_tex = -1;
GLint voxel_tex = -1;
GLint voxel_grid_min = -1;
GLint voxel_grid_size = -1;
GLint voxel_dimensions = -1;
GLint voxel_extent = -1;
GLint indirect_diffuse_scale = -1;
GLint indirect_specular_scale = -1;
GLint ambient_occlusion_scale = -1;
GLint cone_angle = -1;
GLint inv_view_mat = -1;
GLint inv_view_proj_mat = -1;
GLint world_space_camera = -1;
} uniform_location;
} gl;
// Modified version of
// https://github.com/Cigg/Voxel-Cone-Tracing
static const char* f_shader_src = R"(
#version 330 core
in vec2 uv;
out vec4_t frag_color;
// Textures
uniform sampler2D u_depth_texture;
uniform sampler2D u_normal_texture;
uniform sampler2D u_color_alpha_texture;
uniform sampler2D u_f0_smoothness_texture;
// Voxel stuff
uniform sampler3D u_voxel_texture;
uniform vec3_t u_voxel_grid_world_size;
uniform vec3_t u_voxel_grid_world_min;
uniform ivec3_t u_voxel_dimensions;
uniform float u_voxel_extent;
// Scaling factors
uniform float u_indirect_diffuse_scale = 1.f;
uniform float u_indirect_specular_scale = 1.f;
uniform float u_ambient_occlusion_scale = 1.f;
uniform float u_cone_angle = 0.08;
// View parameters
uniform mat4_t u_inv_view_mat;
uniform mat4_t u_inv_view_proj_mat;
uniform vec3_t u_world_space_camera;
const float MAX_DIST = 1000.0;
const float ALPHA_THRESH = 0.95;
// 6 60 degree cone
const int NUM_CONES = 6;
const vec3_t cone_directions[6] = vec3[]
( vec3_t(0, 1, 0),
vec3_t(0, 0.5, 0.866025),
vec3_t(0.823639, 0.5, 0.267617),
vec3_t(0.509037, 0.5, -0.700629),
vec3_t(-0.509037, 0.5, -0.700629),
vec3_t(-0.823639, 0.5, 0.267617)
);
const float cone_weights[6] = float[](0.25, 0.15, 0.15, 0.15, 0.15, 0.15);
// // 5 90 degree cones
// const int NUM_CONES = 5;
// vec3_t coneDirections[5] = vec3[]
// ( vec3_t(0, 1, 0),
// vec3_t(0, 0.707, 0.707),
// vec3_t(0, 0.707, -0.707),
// vec3_t(0.707, 0.707, 0),
// vec3_t(-0.707, 0.707, 0)
// );
// float coneWeights[5] = float[](0.28, 0.18, 0.18, 0.18, 0.18);
vec4_t sample_voxels(vec3_t world_position, float lod) {
vec3_t tc = (world_position - u_voxel_grid_world_min) / (u_voxel_grid_world_size);
//vec3_t d = tc - vec3_t(0.5);
//if (dot(d,d) > 1) return vec4_t(0,0,0,1);
//tc = tc + vec3_t(0.5) / vec3_t(u_voxel_dimensions);
return textureLod(u_voxel_texture, tc, lod);
}
// Third argument to say how long between steps?
vec4_t cone_trace(vec3_t world_position, vec3_t world_normal, vec3_t direction, float tan_half_angle, out float occlusion) {
// lod level 0 mipmap is full size, level 1 is half that size and so on
float lod = 0.0;
vec4_t rgba = vec4_t(0);
occlusion = 0.0;
float dist = u_voxel_extent; // Start one voxel away to avoid self occlusion
vec3_t start_pos = world_position + world_normal * u_voxel_extent; // Plus move away slightly in the normal direction to avoid
// self occlusion in flat surfaces
while(dist < MAX_DIST && rgba.a < ALPHA_THRESH) {
// smallest sample diameter possible is the voxel size
float diameter = max(u_voxel_extent, 2.0 * tan_half_angle * dist);
float lod_level = log2(diameter / u_voxel_extent);
vec4_t voxel_color = sample_voxels(start_pos + dist * direction, lod_level);
//if (voxel_color.a < 0) break;
// front-to-back compositing
float a = (1.0 - rgba.a);
rgba += a * voxel_color;
occlusion += (a * voxel_color.a) / (1.0 + 0.03 * diameter);
//dist += diameter * 0.5; // smoother
dist += diameter; // faster but misses more voxels
}
return rgba;
}
vec4_t indirect_light(in vec3_t world_position, in vec3_t world_normal, in mat3 tangent_to_world, out float occlusion_out) {
vec4_t color = vec4_t(0);
occlusion_out = 0.0;
for(int i = 0; i < NUM_CONES; i++) {
float occlusion = 0.0;
// 60 degree cones -> tan(30) = 0.577
// 90 degree cones -> tan(45) = 1.0
color += cone_weights[i] * cone_trace(world_position, world_normal, tangent_to_world * cone_directions[i], 0.577, occlusion);
occlusion_out += cone_weights[i] * occlusion;
}
occlusion_out = 1.0 - occlusion_out;
return color;
}
mat3 compute_ON_basis(in vec3_t v1) {
vec3_t v0;
vec3_t v2;
float d0 = dot(vec3_t(1,0,0), v1);
float d1 = dot(vec3_t(0,0,1), v1);
if (d0 < d1) {
v0 = normalize(vec3_t(1,0,0) - v1 * d0);
} else {
v0 = normalize(vec3_t(0,0,1) - v1 * d1);
}
v2 = cross(v0, v1);
return mat3(v0, v1, v2);
}
vec4_t depth_to_world_coord(vec2 tex_coord, float depth) {
vec4_t clip_coord = vec4_t(vec3_t(tex_coord, depth) * 2.0 - 1.0, 1.0);
vec4_t world_coord = u_inv_view_proj_mat * clip_coord;
return world_coord / world_coord.w;
}
// https://aras-p.info/texts/CompactNormalStorage.html
vec3_t decode_normal(vec2 enc) {
vec2 fenc = enc*4-2;
float f = dot(fenc,fenc);
float g = sqrt(1-f/4.0);
vec3_t n;
n.xy = fenc*g;
n.z = 1-f/2.0;
return n;
}
vec3_t fresnel(vec3_t f0, float H_dot_V) {
//const float n1 = 1.0;
//const float n2 = 1.5;
//const float R0 = pow((n1-n2)/(n1+n2), 2);
return f0 + (1.0 - f0) * pow(1.0 - H_dot_V, 5.0);
}
vec3_t shade(vec3_t albedo, float alpha, vec3_t f0, float smoothness, vec3_t P, vec3_t V, vec3_t N) {
const float PI_QUARTER = 3.14159265 * 0.25;
const vec3_t env_radiance = vec3_t(0.5);
const vec3_t dir_radiance = vec3_t(0.5);
const vec3_t L = normalize(vec3_t(1));
const float spec_exp = 10.0;
mat3 tangent_to_world = compute_ON_basis(N);
float N_dot_V = max(0.0, -dot(N, V));
vec3_t R = -V + 2.0 * dot(N, V) * N;
vec3_t H = normalize(L + V);
float H_dot_V = max(0.0, dot(H, V));
float N_dot_H = max(0.0, dot(N, H));
float N_dot_L = max(0.0, dot(N, L));
vec3_t fresnel_direct = fresnel(f0, H_dot_V);
vec3_t fresnel_indirect = fresnel(f0, N_dot_V);
float tan_half_angle = tan(mix(PI_QUARTER, 0.0, smoothness));
float diffuse_occlusion;
vec3_t direct_diffuse = env_radiance + N_dot_L * dir_radiance;
vec3_t indirect_diffuse = indirect_light(P, N, tangent_to_world, diffuse_occlusion).rgb;
float transmissive_occlusion;
vec3_t transmissive = vec3_t(0);
//alpha = 0.1;
//if (alpha < 1.0) {
// transmissive = cone_trace(P, N, -V, tan_half_angle, transmissive_occlusion).rgb;
// transmissive *= 1.0 - alpha * albedo;
// direct_diffuse *= alpha;
// indirect_diffuse *= alpha;
//}
float specular_occlusion;
vec3_t direct_specular = dir_radiance * pow(N_dot_H, spec_exp);
vec3_t indirect_specular = cone_trace(P, N, R, tan_half_angle, specular_occlusion).rgb;
vec3_t result = vec3_t(0);
result += albedo * (direct_diffuse + u_indirect_diffuse_scale * indirect_diffuse) * pow(diffuse_occlusion, u_ambient_occlusion_scale * 0.5);
result += direct_specular * fresnel_direct + u_indirect_specular_scale * indirect_specular * fresnel_indirect;
result += transmissive;
return result;
}
void main() {
float depth = texture(u_depth_texture, uv).r;
if (depth == 1.0) discard;
vec2 encoded_normal = texture(u_normal_texture, uv).rg;
vec4_t albedo_alpha = texture(u_color_alpha_texture, uv);
vec4_t f0_smoothness = texture(u_f0_smoothness_texture, uv);
vec3_t albedo = albedo_alpha.rgb;
float alpha = albedo_alpha.a;
vec3_t f0 = f0_smoothness.rgb;
float smoothness = f0_smoothness.a;
vec3_t world_position = depth_to_world_coord(uv, depth).xyz;
vec3_t world_normal = mat3(u_inv_view_mat) * decode_normal(encoded_normal);
vec3_t world_eye = u_world_space_camera;
vec3_t P = world_position;
vec3_t V = normalize(world_eye - world_position);
vec3_t N = world_normal;
frag_color = vec4_t(shade(albedo, alpha, f0, smoothness, P, V, N), 1);
}
)";
static void initialize() {
constexpr int BUFFER_SIZE = 1024;
char buffer[BUFFER_SIZE];
GLuint v_shader = glCreateShader(GL_VERTEX_SHADER);
GLuint f_shader = glCreateShader(GL_FRAGMENT_SHADER);
glShaderSource(v_shader, 1, &v_shader_fs_quad_src, 0);
glShaderSource(f_shader, 1, &f_shader_src, 0);
glCompileShader(v_shader);
if (gl::get_shader_compile_error(buffer, BUFFER_SIZE, v_shader)) {
md_printf(MD_LOG_TYPE_ERROR,"Compiling cone_tracing vertex shader:\n%s\n", buffer);
}
glCompileShader(f_shader);
if (gl::get_shader_compile_error(buffer, BUFFER_SIZE, f_shader)) {
md_printf(MD_LOG_TYPE_ERROR,"Compiling cone_tracing fragment shader:\n%s\n", buffer);
}
gl.program = glCreateProgram();
glAttachShader(gl.program, v_shader);
glAttachShader(gl.program, f_shader);
glLinkProgram(gl.program);
if (gl::get_program_link_error(buffer, BUFFER_SIZE, gl.program)) {
md_printf(MD_LOG_TYPE_ERROR,"Linking cone_tracing program:\n%s\n", buffer);
}
glDetachShader(gl.program, v_shader);
glDetachShader(gl.program, f_shader);
glDeleteShader(v_shader);
glDeleteShader(f_shader);
gl.uniform_location.depth_tex = glGetUniformLocation(gl.program, "u_depth_texture");
gl.uniform_location.normal_tex = glGetUniformLocation(gl.program, "u_normal_texture");
gl.uniform_location.color_alpha_tex = glGetUniformLocation(gl.program, "u_color_alpha_texture");
gl.uniform_location.f0_smoothness_tex = glGetUniformLocation(gl.program, "u_f0_smoothness_texture");
gl.uniform_location.voxel_tex = glGetUniformLocation(gl.program, "u_voxel_texture");
gl.uniform_location.voxel_grid_min = glGetUniformLocation(gl.program, "u_voxel_grid_world_min");
gl.uniform_location.voxel_grid_size = glGetUniformLocation(gl.program, "u_voxel_grid_world_size");
gl.uniform_location.voxel_dimensions = glGetUniformLocation(gl.program, "u_voxel_dimensions");
gl.uniform_location.voxel_extent = glGetUniformLocation(gl.program, "u_voxel_extent");
gl.uniform_location.indirect_diffuse_scale = glGetUniformLocation(gl.program, "u_indirect_diffuse_scale");
gl.uniform_location.indirect_specular_scale = glGetUniformLocation(gl.program, "u_indirect_specular_scale");
gl.uniform_location.ambient_occlusion_scale = glGetUniformLocation(gl.program, "u_ambient_occlusion_scale");
gl.uniform_location.cone_angle = glGetUniformLocation(gl.program, "u_cone_angle");
gl.uniform_location.inv_view_mat = glGetUniformLocation(gl.program, "u_inv_view_mat");
gl.uniform_location.inv_view_proj_mat = glGetUniformLocation(gl.program, "u_inv_view_proj_mat");
gl.uniform_location.world_space_camera = glGetUniformLocation(gl.program, "u_world_space_camera");
}
static void shutdown() {
if (gl.program) {
glDeleteProgram(gl.program);
gl.program = 0;
}
}
} // namespace cone_trace
namespace directional_occlusion {
static GLuint program = 0;
void initialize() {
if (!program) {
program = glCreateProgram();
}
GLuint v_shader = gl::compile_shader_from_source(v_shader_fs_quad_src, GL_VERTEX_SHADER);
GLuint f_shader = gl::compile_shader_from_file(VIAMD_SHADER_DIR "/cone_tracing/directional_occlusion.frag", GL_FRAGMENT_SHADER);
const GLuint shaders[] = {v_shader, f_shader};
gl::attach_link_detach(program, shaders, ARRAY_SIZE(shaders));
}
void shutdown() {
if (program) glDeleteProgram(program);
}
} // namespace directional_occlusion
void initialize(int version_major, int version_minor) {
if (!vao) glGenVertexArrays(1, &vao);
if (!vbo) glGenBuffers(1, &vbo);
glBindVertexArray(vao);
glBindBuffer(GL_ARRAY_BUFFER, vbo);
glBufferData(GL_ARRAY_BUFFER, 12, nullptr, GL_STATIC_DRAW);
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, (const GLvoid*)0);
glBindVertexArray(0);
cone_trace::initialize();
voxelize::initialize(version_major, version_minor);
directional_occlusion::initialize();
}
void shutdown() {
cone_trace::shutdown();
voxelize::shutdown();
directional_occlusion::shutdown();
}
void init_rgba_volume(GPUVolume* vol, int res_x, int res_y, int res_z, vec3_t min_box, vec3_t max_box) {
ASSERT(vol);
if (!vol->texture_id) glGenTextures(1, &vol->texture_id);
vol->min_box = min_box;
vol->max_box = max_box;
vol->voxel_ext = (max_box - min_box) / vec3_t{(float)res_x, (float)res_y, (float)res_z};
if (res_x != vol->res_x || res_y != vol->res_y || res_z != vol->res_z) {
vol->res_x = res_x;
vol->res_y = res_y;
vol->res_z = res_z;
glBindTexture(GL_TEXTURE_3D, vol->texture_id);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_BORDER);
// glTexStorage3D(GL_TEXTURE_3D, 4, GL_RGBA8, res.x, res.y, res.z);
glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA8, res_x, res_y, res_z, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
glBindTexture(GL_TEXTURE_3D, 0);
}
}
uint32_t floor_power_of_two(uint32_t v) {
uint32_t r = 0;
while (v >>= 1) {
r++;
}
return 1 << r;
}
uint32_t ceil_power_of_two(uint32_t x) {
x--;
x |= x >> 1;
x |= x >> 2;
x |= x >> 4;
x |= x >> 8;
x |= x >> 16;
x++;
return x;
}
void init_occlusion_volume(GPUVolume* vol, vec3_t min_box, vec3_t max_box, float voxel_ext_target) {
ASSERT(vol);
if (min_box == max_box) {
return;
}
const float voxel_ext = voxel_ext_target;
const vec3_t ext = (max_box - min_box);
const float max_ext = MAX(ext.x, MAX(ext.y, ext.z));
int32_t dim = (int32_t)CLAMP(ceil_power_of_two((uint32_t)(max_ext / voxel_ext_target)), 1, 256);
int res[3] = {dim, dim, dim};
for (int i = 0; i < 3; i++) {
float half_ext = max_ext * 0.5f;
while (ext[i] < half_ext && dim > 1) {
res[i] /= 2;
half_ext *= 0.5f;
}
}
const vec3_t center = (min_box + max_box) * 0.5f;
const vec3_t half_ext = vec3_t{(float)res[0], (float)res[1], (float)res[2]} * voxel_ext * 0.5f;
min_box = center - half_ext;
max_box = center + half_ext;
vol->min_box = min_box;
vol->max_box = max_box;
vol->voxel_ext = vec3_t{voxel_ext, voxel_ext, voxel_ext};
if (res[0] != vol->res_x || res[1] != vol->res_y || res[2] != vol->res_z) {
// @NOTE: Compute log2 (integer version) to find the amount of mipmaps required
int mips = 1;
{
int max_dim = MAX(res[0], MAX(res[1], res[2]));
while (max_dim >>= 1) ++mips;
}
if (vol->texture_id) glDeleteTextures(1, &vol->texture_id);
glGenTextures(1, &vol->texture_id);
glBindTexture(GL_TEXTURE_3D, vol->texture_id);
glTexStorage3D(GL_TEXTURE_3D, mips, GL_R8, res[0], res[1], res[2]);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_BASE_LEVEL, 0);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAX_LEVEL, mips - 1);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_BORDER);
glBindTexture(GL_TEXTURE_3D, 0);
vol->res_x = res[0];
vol->res_y = res[1];
vol->res_z = res[2];
}
}
void free_volume(GPUVolume* vol) {
if (vol->texture_id) {
glDeleteTextures(1, &vol->texture_id);
vol->texture_id = 0;
}
}
struct ivec3_t {
int x, y, z;
};
inline ivec3_t compute_voxel_coord(const GPUVolume& data, const vec3_t& coord) {
ivec3_t c;
c.x = CLAMP((int)((coord.x - data.min_box.x) / data.voxel_ext.x), 0, data.res_x - 1);
c.y = CLAMP((int)((coord.y - data.min_box.y) / data.voxel_ext.y), 0, data.res_y - 1);
c.z = CLAMP((int)((coord.z - data.min_box.z) / data.voxel_ext.z), 0, data.res_z - 1);
return c;
}
inline int compute_voxel_idx(const ivec3_t& res, const ivec3_t& coord) { return coord.z * res.x * res.y + coord.y * res.x + coord.x; }
inline int compute_voxel_idx(const GPUVolume& data, const vec3_t& coord) {
return compute_voxel_idx({data.res_x, data.res_y, data.res_z}, compute_voxel_coord(data, coord));
}
inline uint32_t accumulate_voxel_color(uint32_t current_color, uint32_t new_color, float counter) {
vec4_t c = convert_color(current_color);
vec4_t n = convert_color(new_color);
c = (counter * c + n) / (counter + 1.f);
return convert_color(c);
}
void voxelize_spheres_cpu(const GPUVolume& vol, const float* x, const float* y, const float* z, const float* r, const uint32_t* colors, int64_t count) {
const int32_t voxel_count = vol.res_x * vol.res_y * vol.res_z;
if (voxel_count == 0) {
md_print(MD_LOG_TYPE_ERROR, "Volume resolution is zero on one or more axes.");
return;
}
uint32_t* voxel_data = (uint32_t*)md_alloc(default_allocator, voxel_count * sizeof(uint32_t));
float* voxel_counter = (float*)md_alloc(default_allocator, voxel_count * sizeof(float));
defer {
md_free(default_allocator, voxel_counter, voxel_count * sizeof(float));
md_free(default_allocator, voxel_data, voxel_count * sizeof(uint32_t));
};
ivec3_t vol_res = {vol.res_x, vol.res_y, vol.res_z};
for (int64_t i = 0; i < count; i++) {
vec3_t pos = {x[i], y[i], z[i]};
float radius = r[i];
uint32_t color = colors[i];
const float r2 = radius * radius;
ivec3_t min_cc = compute_voxel_coord(vol, pos - radius);
ivec3_t max_cc = compute_voxel_coord(vol, pos + radius);
ivec3_t cc;
for (cc.z = min_cc.z; cc.z <= max_cc.z; cc.z++) {
for (cc.y = min_cc.y; cc.y <= max_cc.y; cc.y++) {
for (cc.x = min_cc.x; cc.x <= max_cc.x; cc.x++) {
vec3_t min_voxel = vol.min_box + vec3_t{(float)cc.x, (float)cc.y, (float)cc.z} * vol.voxel_ext;
vec3_t max_voxel = min_voxel + vol.voxel_ext;
vec3_t clamped_pos = vec3_clamp(pos, min_voxel, max_voxel);
vec3_t d = clamped_pos - pos;
if (vec3_dot(d, d) < r2) {
int voxel_idx = compute_voxel_idx(vol_res, cc);
voxel_data[voxel_idx] = accumulate_voxel_color(voxel_data[voxel_idx], color, voxel_counter[voxel_idx] + 1);
voxel_counter[voxel_idx] += 1;
}
}
}
}
}
// Apply crude lambert illumination model
for (int32_t i = 0; i < voxel_count; ++i) {
vec4_t c = convert_color(voxel_data[i]);
voxel_data[i] = convert_color(vec4_from_vec3(vec3_from_vec4(c) / 3.1415926535f, c.w));
}
glBindTexture(GL_TEXTURE_3D, vol.texture_id);
glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, vol.res_x, vol.res_y, vol.res_z, GL_RGBA, GL_UNSIGNED_BYTE, voxel_data);
glGenerateMipmap(GL_TEXTURE_3D);
glBindTexture(GL_TEXTURE_3D, 0);
}
void voxelize_spheres_gpu(const GPUVolume& vol, GLuint position_radius_buffer, GLuint color_buffer, int32_t num_spheres) {
if (!voxelize::gl.program) {
md_print(MD_LOG_TYPE_ERROR, "sphere_binning program is not compiled");
return;
}
glClearTexImage(vol.texture_id, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
glBindVertexArray(voxelize::gl.vao);
glBindBuffer(GL_ARRAY_BUFFER, position_radius_buffer);
glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, sizeof(vec4_t), nullptr);
glEnableVertexAttribArray(0);
glBindBuffer(GL_ARRAY_BUFFER, color_buffer);
glVertexAttribPointer(1, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(uint32_t), nullptr);
glEnableVertexAttribArray(1);
glUseProgram(voxelize::gl.program);
glUniform3i(voxelize::gl.uniform_location.volume_dim, vol.res_x, vol.res_y, vol.res_z);
glUniform3fv(voxelize::gl.uniform_location.volume_min, 1, &vol.min_box[0]);
glUniform3fv(voxelize::gl.uniform_location.voxel_ext, 1, &vol.voxel_ext[0]);
glUniform1i(voxelize::gl.uniform_location.tex_volume, 0);
glBindTexture(GL_TEXTURE_3D, vol.texture_id);
glBindImageTexture(0, vol.texture_id, 0, GL_FALSE, 0, GL_WRITE_ONLY, GL_RGBA8);
glColorMask(0, 0, 0, 0);
glDepthMask(0);
glEnable(GL_RASTERIZER_DISCARD);
glDrawArrays(GL_POINTS, 0, num_spheres);
// glMemoryBarrier(GL_ALL_BARRIER_BITS);
// glGenerateMipmap(GL_TEXTURE_3D);
glDisable(GL_RASTERIZER_DISCARD);
glDepthMask(1);
glColorMask(1, 1, 1, 1);
glUseProgram(0);
glBindVertexArray(0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
}
/*
enum IlluminationDirection { POSITIVE_X, NEGATIVE_X, POSITIVE_Y, NEGATIVE_Y, POSITIVE_Z, NEGATIVE_Z };
void illuminate_voxels_directional_constant(Array<vec3> light_voxels, Array<const uint32> rgba_voxels, const ivec3& voxel_dim,
IlluminationDirection direction, const vec3& intensity) {
const auto dim = cone_trace::volume.dim;
const bool positive = direction % 2 == 0;
ivec3_t step = {1, 1, 1};
ivec3_t beg_idx = {0, 0, 0};
ivec3_t end_idx = dim;
switch (direction) {
case POSITIVE_X:
case NEGATIVE_X: {
if (positive) {
beg_idx.x = 1;
} else {
step.x = -1;
beg_idx.x = dim.x - 2;
end_idx.x = -1;
}
for (int32 z = beg_idx.z; z != end_idx.z; z += step.z) {
for (int32 y = beg_idx.y; y != end_idx.y; y += step.y) {
light_voxels[z * dim.y * dim.x + y * dim.x + (beg_idx.x - step.x)] += intensity;
}
}
for (int32 x = beg_idx.x; x != end_idx.x; x += step.x) {
for (int32 z = beg_idx.z; z != end_idx.z; z += step.z) {
for (int32 y = beg_idx.y; y != end_idx.y; y += step.y) {
const int32 src_vol_idx = z * dim.y * dim.x + y * dim.x + (x - step.x);
const int32 dst_vol_idx = z * dim.y * dim.x + y * dim.x + x;
const vec4_t voxel_rgba = math::convert_color(rgba_voxels[src_vol_idx]);
light_voxels[dst_vol_idx] += (1.f - voxel_rgba.a) * light_voxels[src_vol_idx];
}
}
}
} break;
case POSITIVE_Y:
case NEGATIVE_Y: {
if (positive) {
beg_idx.y = 1;
} else {
step.y = -1;
beg_idx.y = dim.y - 2;
end_idx.y = -1;
}
for (int32 z = beg_idx.z; z != end_idx.z; z += step.z) {
for (int32 x = beg_idx.x; x != end_idx.x; x += step.x) {
light_voxels[z * dim.y * dim.x + (beg_idx.y - step.y) * dim.x + x] += intensity;
}
}
for (int32 y = beg_idx.y; y != end_idx.y; y += step.y) {
for (int32 z = beg_idx.z; z != end_idx.z; z += step.z) {
for (int32 x = beg_idx.x; x != end_idx.x; x += step.x) {
const int32 src_vol_idx = z * dim.y * dim.x + (y - step.y) * dim.x + x;
const int32 dst_vol_idx = z * dim.y * dim.x + y * dim.x + x;
const vec4_t voxel_rgba = math::convert_color(rgba_voxels[src_vol_idx]);
light_voxels[dst_vol_idx] += (1.f - voxel_rgba.a) * light_voxels[src_vol_idx];
}
}
}
} break;
case POSITIVE_Z:
case NEGATIVE_Z: {
if (positive) {
beg_idx.z = 1;
} else {
step.z = -1;
beg_idx.z = dim.z - 2;
end_idx.z = -1;
}
for (int32 y = beg_idx.y; y != end_idx.y; y += step.y) {
for (int32 x = beg_idx.x; x != end_idx.x; x += step.x) {
light_voxels[(beg_idx.z - step.z) * dim.y * dim.x + y * dim.x + x] += intensity;
}
}
for (int32 z = beg_idx.z; z != end_idx.z; z += step.z) {
for (int32 y = beg_idx.y; y != end_idx.y; y += step.y) {
for (int32 x = beg_idx.x; x != end_idx.x; x += step.x) {
const int32 src_vol_idx = (z - step.z) * dim.y * dim.x + y * dim.x + x;
const int32 dst_vol_idx = z * dim.y * dim.x + y * dim.x + x;
const vec4_t voxel_rgba = math::convert_color(rgba_voxels[src_vol_idx]);
light_voxels[dst_vol_idx] += (1.f - voxel_rgba.a) * light_voxels[src_vol_idx];
}
}
}
} break;
}
}
void illuminate_voxels_omnidirectional_constant(const vec3& intensity) {
auto dim = cone_trace::volume.dim;
DynamicArray<vec3> light_vol(cone_trace::volume.voxel_data.size(), vec3_t(0));
illuminate_voxels_directional_constant(light_vol, cone_trace::volume.voxel_data, dim, POSITIVE_X, intensity);
illuminate_voxels_directional_constant(light_vol, cone_trace::volume.voxel_data, dim, NEGATIVE_X, intensity);
for (int32 i = 0; i < light_vol.count; i++) {
vec4_t voxel_rgba = math::convert_color(cone_trace::volume.voxel_data[i]);
voxel_rgba *= vec4_t(light_vol[i], 1.f);
cone_trace::volume.voxel_data[i] = math::convert_color(voxel_rgba);
}
// illuminate_voxels_directional_constant(NEGATIVE_X, intensity);
// illuminate_voxels_directional_constant(POSITIVE_Y, intensity);
// illuminate_voxels_directional_constant(NEGATIVE_Y, intensity);
// illuminate_voxels_directional_constant(POSITIVE_Z, intensity);
// illuminate_voxels_directional_constant(NEGATIVE_Z, intensity);
// X-direction sweep plane
DynamicArray<vec4_t> plane_slice_zy[2] = {
{ cone_trace::volume.dim.y * cone_trace::volume.dim.z, vec4_t(intensity, 0) },
{ cone_trace::volume.dim.y * cone_trace::volume.dim.z, vec4_t(intensity, 0) }
};
int curr_plane = 0;
int prev_plane = 1;
const auto dim = cone_trace::volume.dim;
Array<uint32> voxels = cone_trace::volume.voxel_data;
for (int32 x = 1; x < dim.x; x++) {
for (int32 z = 0; z < dim.z; z++) {
for (int32 y = 0; y < dim.y; y++) {
const int32 plane_idx = z * dim.y + y;
const int32 src_vol_idx = z * dim.y * dim.x + y * dim.x + (x - 1);
const int32 dst_vol_idx = z * dim.y * dim.x + y * dim.x + x;
const vec4_t voxel_rgba = math::convert_color(voxels[src_vol_idx]);
const vec4_t& src_light_voxel = plane_slice_zy[prev_plane][plane_idx];
vec4_t& dst_light_voxel = plane_slice_zy[curr_plane][plane_idx];
dst_light_voxel = (1.f - voxel_rgba.a) * src_light_voxel;
vec4_t dst_rgba = math::convert_color(voxels[dst_vol_idx]);
dst_rgba = vec4_t(vec3_t(dst_rgba) * vec3_t(dst_light_voxel), dst_rgba.a);
voxels[dst_vol_idx] = math::convert_color(dst_rgba);
prev_plane = (prev_plane + 1) % 2;
curr_plane = (curr_plane + 1) % 2;
}
}
}
}
void draw_voxelized_scene(const GPUVolume& vol, const mat4_t& view_mat, const mat4_t& proj_mat) {
immediate::set_model_view_matrix(view_mat);
immediate::set_proj_matrix(proj_mat);
immediate::set_material(immediate::MATERIAL_ROUGH_BLACK);
for (int32 z = 0; z < vol.res_z; z++) {
for (int32 y = 0; y < vol.res_y; y++) {
for (int32 x = 0; x < vol.res_x; x++) {
int32 i = compute_voxel_idx(volume.dim, ivec3_t(x, y, z));
if (cone_trace::volume.voxel_data[i] > 0) {
vec3_t min_box = cone_trace::volume.min_box + vec3_t(x, y, z) * cone_trace::volume.voxel_ext;
vec3_t max_box = min_box + cone_trace::volume.voxel_ext;
immediate::draw_aabb_lines(min_box, max_box);
}
}
}
}
immediate::flush();
}
*/
void compute_occupancy_volume(const GPUVolume& vol, const float* x, const float* y, const float* z, const float* rad, int64_t count) {
const int32_t voxel_count = vol.res_x * vol.res_y * vol.res_z;
if (voxel_count == 0) {
md_print(MD_LOG_TYPE_ERROR, "Volume resolution is zero on one or more axes");
return;
}
const float inv_voxel_volume = 1.0f / (vol.voxel_ext.x * vol.voxel_ext.y * vol.voxel_ext.z);
std::atomic_uint32_t* voxel_data = (std::atomic_uint32_t*)md_alloc(default_allocator, voxel_count * sizeof(std::atomic_uint32_t));
defer { md_free(default_allocator, voxel_data, voxel_count * sizeof(std::atomic_uint32_t)); };
#if 0
task_system::ID id = task_system::pool_enqueue(
"Computing occupancy", (uint32_t)count,
[voxel_data, x, y, z, r, &vol, inv_voxel_volume](task_system::TaskSetRange range) {
// We assume atom radius <<< voxel extent and just increment the bin
constexpr float sphere_vol_scl = (4.0f / 3.0f) * 3.1415926535f;
for (uint32_t i = range.beg; i < range.end; i++) {
const int idx = compute_voxel_idx(vol, {x[i], y[i], z[i]});
const float rad = r[i];
const float sphere_vol = sphere_vol_scl * rad * rad * rad;
const uint32_t occ = (uint32_t)(sphere_vol * inv_voxel_volume * 0xFFFFFFFFU);
atomic_fetch_add(&voxel_data[idx], occ);
}
});
task_system::wait_for_task(id);
#else
constexpr float sphere_vol_scl = (4.0f / 3.0f) * 3.1415926535f;
for (int32_t i = 0; i < count; i++) {
const vec3_t pos = {x[i], y[i], z[i]};
const int idx = compute_voxel_idx(vol, pos);
const float r = rad[i];
const float sphere_vol = sphere_vol_scl * r * r * r;
const float fract = sphere_vol * inv_voxel_volume;
const uint32_t occ = uint32_t(fract * 0xFFFFFFFFU);
voxel_data[idx] += occ;
}
#endif
glBindTexture(GL_TEXTURE_3D, vol.texture_id);
glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, vol.res_x, vol.res_y, vol.res_z, GL_RED, GL_UNSIGNED_INT, voxel_data);
glGenerateMipmap(GL_TEXTURE_3D);
glBindTexture(GL_TEXTURE_3D, 0);
}
void render_directional_occlusion(GLuint depth_tex, GLuint normal_tex, const GPUVolume& vol, const mat4_t& view_mat, const mat4_t& proj_mat,
float occlusion_scale, float step_scale) {
const mat4_t inv_view_proj_mat = mat4_inverse(proj_mat * view_mat);
const mat4_t inv_view_mat = mat4_inverse(view_mat);
const vec3_t world_space_camera = mat4_mul_vec3(inv_view_mat, {0,0,0}, 1);
const vec3_t voxel_grid_min = vol.min_box;
const vec3_t voxel_grid_ext = vol.max_box - vol.min_box;
float voxel_ext = MAX(MAX(vol.voxel_ext.x, vol.voxel_ext.y), vol.voxel_ext.z);
GLuint program = directional_occlusion::program;
glUseProgram(program);
glUniform1i(glGetUniformLocation(program, "u_depth_texture"), 0);
glUniform1i(glGetUniformLocation(program, "u_normal_texture"), 1);
glUniform1i(glGetUniformLocation(program, "u_voxel_texture"), 2);
glUniform3fv(glGetUniformLocation(program, "u_voxel_grid_world_min"), 1, &voxel_grid_min[0]);
glUniform3fv(glGetUniformLocation(program, "u_voxel_grid_world_size"), 1, &voxel_grid_ext[0]);
glUniform3i(glGetUniformLocation(program, "u_voxel_dimensions"), vol.res_x, vol.res_y, vol.res_z);
glUniform1f(glGetUniformLocation(program, "u_voxel_extent"), voxel_ext);
glUniform1f(glGetUniformLocation(program, "u_occlusion_scale"), occlusion_scale);
glUniform1f(glGetUniformLocation(program, "u_step_scale"), step_scale);
glUniformMatrix4fv(glGetUniformLocation(program, "u_inv_view_mat"), 1, GL_FALSE, &inv_view_mat[0][0]);
glUniformMatrix4fv(glGetUniformLocation(program, "u_inv_view_proj_mat"), 1, GL_FALSE, &inv_view_proj_mat[0][0]);
glUniform3fv(glGetUniformLocation(program, "u_world_space_camera"), 1, &world_space_camera[0]);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, depth_tex);
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, normal_tex);
glActiveTexture(GL_TEXTURE2);
glBindTexture(GL_TEXTURE_3D, vol.texture_id);
glDisable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glBlendFunc(GL_ZERO, GL_SRC_COLOR);
glColorMask(1, 1, 1, 0);
glDepthMask(GL_FALSE);
glBindVertexArray(vao);
glDrawArrays(GL_TRIANGLES, 0, 3);
glBindVertexArray(0);
glDisable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE);
glColorMask(1, 1, 1, 1);
glDepthMask(GL_TRUE);
glEnable(GL_DEPTH_TEST);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, 0);
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, 0);
glActiveTexture(GL_TEXTURE2);
glBindTexture(GL_TEXTURE_3D, 0);
}
void cone_trace_scene(GLuint depth_tex, GLuint normal_tex, GLuint color_alpha_tex, GLuint f0_smoothness_tex, const GPUVolume& vol,
const mat4_t& view_mat, const mat4_t& proj_mat, float indirect_diffuse_scale, float indirect_specular_scale,
float ambient_occlusion_scale) {
mat4_t inv_view_proj_mat = mat4_inverse(proj_mat * view_mat);
mat4_t inv_view_mat = mat4_inverse(view_mat);
vec3_t world_space_camera = mat4_mul_vec3(inv_view_mat, {0, 0, 0}, 1);
// printf("cam: %.2f %.2f %.2f\n", world_space_camera.x, world_space_camera.y, world_space_camera.z);
vec3_t voxel_grid_min = vol.min_box;
vec3_t voxel_grid_ext = vol.max_box - vol.min_box;
float voxel_ext = MAX(MAX(vol.voxel_ext.x, vol.voxel_ext.y), vol.voxel_ext.z);
// const float cone_angle = 0.07; // 0.2 = 22.6 degrees, 0.1 = 11.4 degrees, 0.07 = 8 degrees angle
glUseProgram(cone_trace::gl.program);
glUniform1i(cone_trace::gl.uniform_location.depth_tex, 0);
glUniform1i(cone_trace::gl.uniform_location.normal_tex, 1);
glUniform1i(cone_trace::gl.uniform_location.color_alpha_tex, 2);
glUniform1i(cone_trace::gl.uniform_location.f0_smoothness_tex, 3);
glUniform1i(cone_trace::gl.uniform_location.voxel_tex, 4);
glUniform3fv(cone_trace::gl.uniform_location.voxel_grid_min, 1, &voxel_grid_min[0]);
glUniform3fv(cone_trace::gl.uniform_location.voxel_grid_size, 1, &voxel_grid_ext[0]);
glUniform3i(cone_trace::gl.uniform_location.voxel_dimensions, vol.res_x, vol.res_y, vol.res_z);
glUniform1f(cone_trace::gl.uniform_location.voxel_extent, voxel_ext);
glUniform1f(cone_trace::gl.uniform_location.indirect_diffuse_scale, indirect_diffuse_scale);
glUniform1f(cone_trace::gl.uniform_location.indirect_specular_scale, indirect_specular_scale);
glUniform1f(cone_trace::gl.uniform_location.ambient_occlusion_scale, ambient_occlusion_scale);
glUniformMatrix4fv(cone_trace::gl.uniform_location.inv_view_mat, 1, GL_FALSE, &inv_view_mat[0][0]);
glUniformMatrix4fv(cone_trace::gl.uniform_location.inv_view_proj_mat, 1, GL_FALSE, &inv_view_proj_mat[0][0]);
glUniform3fv(cone_trace::gl.uniform_location.world_space_camera, 1, &world_space_camera[0]);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, depth_tex);
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, normal_tex);
glActiveTexture(GL_TEXTURE2);
glBindTexture(GL_TEXTURE_2D, color_alpha_tex);
glActiveTexture(GL_TEXTURE3);
glBindTexture(GL_TEXTURE_2D, f0_smoothness_tex);
glActiveTexture(GL_TEXTURE4);
glBindTexture(GL_TEXTURE_3D, vol.texture_id);
glDisable(GL_DEPTH_TEST);
// glEnable(GL_BLEND);
// glBlendFunc(GL_ONE, GL_ONE);
// glColorMask(1, 1, 1, 0);
glDepthMask(GL_FALSE);
glBindVertexArray(vao);
glDrawArrays(GL_TRIANGLES, 0, 3);
glBindVertexArray(0);
// glDisable(GL_BLEND);
// glBlendFunc(GL_ONE, GL_ZERO);
// glColorMask(1, 1, 1, 1);
glDepthMask(GL_TRUE);
glEnable(GL_DEPTH_TEST);
}
} // namespace cone_trace
| 38.859981
| 152
| 0.642045
|
scanberg
|
0705ded8c58594566fd83efaab62fd5ad440f7fa
| 734
|
cpp
|
C++
|
src/DonePullBackTransition.cpp
|
songchaow/starcrat2-ai
|
ac6fbdb0e3d7839a76addea4e6aa50a4545841f3
|
[
"MIT"
] | 3
|
2020-12-19T01:00:33.000Z
|
2021-12-01T01:13:21.000Z
|
src/DonePullBackTransition.cpp
|
songchaow/starcrat2-ai
|
ac6fbdb0e3d7839a76addea4e6aa50a4545841f3
|
[
"MIT"
] | null | null | null |
src/DonePullBackTransition.cpp
|
songchaow/starcrat2-ai
|
ac6fbdb0e3d7839a76addea4e6aa50a4545841f3
|
[
"MIT"
] | 2
|
2021-02-22T18:50:38.000Z
|
2022-03-21T17:37:24.000Z
|
#pragma once
#include "DonePullBackTransition.h"
#include "Util.h"
DonePullBackTransition::DonePullBackTransition(const sc2::Unit * unit, sc2::Point2D position, FocusFireFSMState* nextState)
{
m_unit = unit;
m_nextState = nextState;
m_position = position;
}
bool DonePullBackTransition::isValid(const sc2::Unit * target, const std::vector<const sc2::Unit*> * units, std::unordered_map<sc2::Tag, float> *, CCBot*)
{
bool done(false);
done = m_position == m_unit->pos;
if (Util::Dist(m_position, m_unit->pos) < 1.5f)
return true;
else
return false;
}
FocusFireFSMState* DonePullBackTransition::getNextState()
{
return m_nextState;
}
void DonePullBackTransition::onTransition()
{
}
| 23.677419
| 154
| 0.70436
|
songchaow
|
070deed25ac1f79f3c817fa7d40653f414f79cd1
| 79,397
|
cc
|
C++
|
src/CoordinatorServerList.cc
|
taschik/ramcloud
|
6ef2e1cd61111995881d54bda6f9296b4777b928
|
[
"0BSD"
] | 1
|
2016-01-18T12:41:28.000Z
|
2016-01-18T12:41:28.000Z
|
src/CoordinatorServerList.cc
|
taschik/ramcloud
|
6ef2e1cd61111995881d54bda6f9296b4777b928
|
[
"0BSD"
] | null | null | null |
src/CoordinatorServerList.cc
|
taschik/ramcloud
|
6ef2e1cd61111995881d54bda6f9296b4777b928
|
[
"0BSD"
] | null | null | null |
/* Copyright (c) 2011-2012 Stanford University
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR(S) DISCLAIM ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL AUTHORS BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <list>
#include "Common.h"
#include "ClientException.h"
#include "CoordinatorServerList.h"
#include "Cycles.h"
#include "LogCabinHelper.h"
#include "MasterRecoveryManager.h"
#include "ServerTracker.h"
#include "ShortMacros.h"
#include "TransportManager.h"
#include "Context.h"
namespace RAMCloud {
/**
* Constructor for CoordinatorServerList.
*
* \param context
* Overall information about the RAMCloud server. The constructor
* will modify \c context so that its \c serverList and
* \c coordinatorServerList members refer to this object.
*/
CoordinatorServerList::CoordinatorServerList(Context* context)
: AbstractServerList(context)
, serverList()
, numberOfMasters(0)
, numberOfBackups(0)
, stopUpdater(true)
, lastScan()
, update()
, updates()
, hasUpdatesOrStop()
, listUpToDate()
, updaterThread()
, minConfirmedVersion(0)
, numUpdatingServers(0)
, nextReplicationId(1)
, logIdAppendServerAlive(NO_ID)
, logIdServerListVersion(NO_ID)
, logIdServerUpUpdate(NO_ID)
, logIdServerReplicationUpUpdate(NO_ID)
{
context->coordinatorServerList = this;
startUpdater();
}
/**
* Destructor for CoordinatorServerList.
*/
CoordinatorServerList::~CoordinatorServerList()
{
haltUpdater();
}
//////////////////////////////////////////////////////////////////////
// CoordinatorServerList Public Methods
//////////////////////////////////////////////////////////////////////
/**
* Get the number of backups in the list; does not include servers in
* crashed status.
*/
uint32_t
CoordinatorServerList::backupCount() const
{
Lock _(mutex);
return numberOfBackups;
}
/**
* Implements enlisting a server onto the CoordinatorServerList and
* propagating updates to the cluster.
*
* \param replacesId
* Server id of the server that the enlisting server is replacing.
* A null value means that the enlisting server is not replacing another
* server.
* \param serviceMask
* Services supported by the enlisting server.
* \param readSpeed
* Read speed of the enlisting server.
* \param serviceLocator
* Service Locator of the enlisting server.
*
* \return
* Server id assigned to the enlisting server.
*/
ServerId
CoordinatorServerList::enlistServer(
ServerId replacesId, ServiceMask serviceMask, const uint32_t readSpeed,
const char* serviceLocator)
{
Lock lock(mutex);
// The order of the updates in serverListUpdate is important: the remove
// must be ordered before the add to ensure that as members apply the
// update they will see the removal of the old server id before the
// addition of the new, replacing server id.
if (iget(replacesId)) {
LOG(NOTICE, "%s is enlisting claiming to replace server id "
"%s, which is still in the server list, taking its word "
"for it and assuming the old server has failed",
serviceLocator, replacesId.toString().c_str());
ServerNeedsRecovery(*this, lock, replacesId).execute();
ServerCrashed(*this, lock, replacesId, version + 1).execute();
}
// Indicate that the next server enlistment would have to send out "UP"
// updates to the cluster.
// However:
// I can skip this step if such a log entry is pointed to by the csl's
// logIdServerUpUpdate.
// Because:
// This log entry is is not specific to a particular server that is
// enlisting, rather just meant for the "next" server enlisting.
// If it were meant for a particular server, it would be pointed to
// by the server entry's logIdServerUpUpdate, not csl's logIdServerUpUpdate.
// This situation an arise if the coordinator was in the middle of
// an enlistServer() operation (it had completed ServerUpUpdate::execute(),
// but not EnlistServer::complete()) when it last crashed.
// Reusing such an entry also helps prevent dangling ServerUpUpdate
// log entries.
if (logIdServerUpUpdate == NO_ID) {
ServerUpUpdate(*this, lock).execute();
}
// Enlist the server.
ServerId newServerId = EnlistServer(*this, lock, ServerId(),
serviceMask, readSpeed,
serviceLocator, version + 1).execute();
if (replacesId.isValid()) {
LOG(NOTICE, "Newly enlisted server %s replaces server %s",
newServerId.toString().c_str(),
replacesId.toString().c_str());
}
return newServerId;
}
/**
* Get the number of masters in the list; does not include servers in
* crashed status.
*/
uint32_t
CoordinatorServerList::masterCount() const
{
Lock _(mutex);
return numberOfMasters;
}
/**
* Returns a copy of the details associated with the given ServerId.
*
* Note: This function explictly acquires a lock, and is hence to be used
* only by functions external to CoordinatorServerList to prevent deadlocks.
* If a function in CoordinatorServerList class (that has already acquired
* a lock) wants to use this functionality, it should directly call
* #getEntry function.
*
* \param serverId
* ServerId to look up in the list.
* \throw
* Exception is thrown if the given ServerId is not in this list.
*/
CoordinatorServerList::Entry
CoordinatorServerList::operator[](ServerId serverId) const
{
Lock _(mutex);
Entry* entry = getEntry(serverId);
if (!entry) {
throw ServerListException(HERE,
format("Invalid ServerId (%s)", serverId.toString().c_str()));
}
return *entry;
}
/**
* Returns a copy of the details associated with the given position
* in the server list.
*
* Note: This function explictly acquires a lock, and is hence to be used
* only by functions external to CoordinatorServerList to prevent deadlocks.
* If a function in CoordinatorServerList class (that has already acquired
* a lock) wants to use this functionality, it should directly call
* #getEntry function.
*
* \param index
* Position of entry in the server list to return a copy of.
* \throw
* Exception is thrown if the position in the list is unoccupied.
*/
CoordinatorServerList::Entry
CoordinatorServerList::operator[](size_t index) const
{
Lock _(mutex);
Entry* entry = getEntry(index);
if (!entry) {
throw ServerListException(HERE,
format("Index beyond array length (%zd) or entry"
"doesn't exist", index));
}
return *entry;
}
/**
* Mark a server as REMOVE, typically when it is no longer part of
* the system and we don't care about it anymore (it crashed and has
* been properly recovered).
*
* When the update sent to and acknowledged by the rest of the cluster
* is being pruned, the server list entry for this server will be removed.
*
* This method may actually append two entries to \a update (see below).
*
* The result of this operation will be added in the class's update Protobuffer
* intended for the cluster. To send out the update, call pushUpdate()
* which will also increment the version number. Calls to remove()
* and crashed() must proceed call to add() to ensure ordering guarantees
* about notifications related to servers which re-enlist.
*
* The addition will be pushed to all registered trackers and those with
* callbacks will be notified.
*
* \param serverId
* The ServerId of the server to remove from the CoordinatorServerList.
* It must be in the list (either UP or CRASHED).
*/
void
CoordinatorServerList::recoveryCompleted(ServerId serverId)
{
Lock lock(mutex);
ServerRemoveUpdate(*this, lock, serverId, version + 1).execute();
}
/**
* Serialize this list (or part of it, depending on which services the
* caller wants) to a protocol buffer. Not all state is included, but
* enough to be useful for disseminating cluster membership information
* to other servers.
*
* \param[out] protoBuf
* Reference to the ProtoBuf to fill.
* \param services
* If a server has *any* service included in \a services it will be
* included in the serialization; otherwise, it is skipped.
*/
void
CoordinatorServerList::serialize(ProtoBuf::ServerList& protoBuf,
ServiceMask services) const
{
Lock lock(mutex);
serialize(lock, protoBuf, services);
}
/**
* This method is invoked when a server is determined to have crashed.
* It marks the server as crashed, propagates that information
* (through server trackers and the cluster updater) and invokes recovery.
* It returns before the recovery has completed.
* Once recovery has finished, the server will be removed from the server list.
*
* \param serverId
* ServerId of the server that is suspected to be down.
*/
void
CoordinatorServerList::serverCrashed(ServerId serverId)
{
Lock lock(mutex);
// Indicate that the crashed server needs to be recovered.
// However:
// I can skip this step if such a log entry already exists.
// This situation can arise if the coordinator was in the middle of
// a crashedServer() operation (it had completed
// ServerNeedsRecovery::execute(), but not ServerCrashed::complete())
// or had completed serverCrashed() not completed the recovery for
// the crashed server when it last crashed.
// Reusing this log entry also helps prevent having multiple
// ServerNeedsRecovery log entries for crashed servers.
Entry* entry = getEntry(serverId);
if (entry && entry->logIdServerNeedsRecovery == NO_ID) {
ServerNeedsRecovery(*this, lock, serverId).execute();
}
// Remove the crashed server from the cluster.
ServerCrashed(*this, lock, serverId, version + 1).execute();
}
/**
* Reset extra metadata for \a serverId that will be needed to safely recover
* the master's log.
*
* \param serverId
* ServerId of the server whose master recovery info will be set.
* \param recoveryInfo
* Information the coordinator will need to safely recover the master
* at \a serverId. The information is opaque to the coordinator other
* than its master recovery routines, but, basically, this is used to
* prevent inconsistent open replicas from being used during recovery.
* \return
* Whether the operation succeeded or not (i.e. if the serverId exists).
*/
bool
CoordinatorServerList::setMasterRecoveryInfo(
ServerId serverId, const ProtoBuf::MasterRecoveryInfo& recoveryInfo)
{
Lock lock(mutex);
Entry* entry = getEntry(serverId);
if (entry) {
entry->masterRecoveryInfo = recoveryInfo;
ServerUpdate(*this, lock,
serverId, recoveryInfo,
entry->logIdServerUpdate).execute();
return true;
} else {
return false;
}
}
//////////////////////////////////////////////////////////////////////
// CoordinatorServerList Recovery Methods
//////////////////////////////////////////////////////////////////////
/**
* Complete a ServerCrashed during coordinator recovery.
*
* \param state
* The ProtoBuf that encapsulates the state of the ServerCrashed
* operation to be recovered.
* \param logIdServerCrashed
* The entry id of the LogCabin entry corresponding to the state.
*/
void
CoordinatorServerList::recoverServerCrashed(
ProtoBuf::ServerCrashInfo* state, EntryId logIdServerCrashed)
{
Lock lock(mutex);
LOG(DEBUG, "CoordinatorServerList::recoverServerCrashed()");
ServerCrashed(*this, lock,
ServerId(state->server_id()),
state->update_version()).complete(logIdServerCrashed);
}
void
CoordinatorServerList::recoverServerListVersion(
ProtoBuf::ServerListVersion* state, EntryId logIdServerListVersion)
{
Lock lock(mutex);
uint64_t version = state->version();
PersistServerListVersion(*this, lock, version).complete(
logIdServerListVersion);
// When coordinator recovers, all the server list entries created
// corresponding to all the servers, will have a verified version and
// update version of 0. (Since it It will be too expensive to log the
// most up-to-date value of verified version for each entry during
// normal operation and then recover that later.)
// This would result in the entire server list being sent out to all
// the servers. This is not expected behavior (and the servers will
// shoot themselves in the head).
// Hence:
// Set these versions for every server entry in server list to be the
// ServerListVersion number that was last logged to LogCabin
// (since which was the minimum verified update number).
// This way, some servers might still get some updates they had already
// received, but the number will hopefully be low, and they will at least
// never receive the entire server list again.
for (size_t index = 0; index < isize(); index++) {
Entry* entry = getEntry(index);
if (entry != NULL) {
entry->verifiedVersion = version;
entry->updateVersion = version;
}
}
}
/**
* During coordinator recovery, record in server list that for this server
* (that had crashed), we need to start the master crash recovery.
*
* \param state
* The ProtoBuf that encapsulates the state of the ServerNeedsRecovery
* operation to be recovered.
* \param logIdServerNeedsRecovery
* The entry id of the LogCabin entry corresponding to the state.
*/
void
CoordinatorServerList::recoverServerNeedsRecovery(
ProtoBuf::ServerCrashInfo* state, EntryId logIdServerNeedsRecovery)
{
Lock lock(mutex);
LOG(DEBUG, "CoordinatorServerList::recoverServerNeedsRecovery()");
ServerNeedsRecovery(*this, lock,
ServerId(state->server_id())).complete(
logIdServerNeedsRecovery);
}
/**
* During coordinator recovery, propagate REMOVE updates for a crashed server
* whose recovery had already completed.
*
* \param state
* The ProtoBuf that encapsulates the state of the ServerRemoveUpdate
* operation to be recovered.
* \param logIdServerRemoveUpdate
* The entry id of the LogCabin entry corresponding to the state.
*/
void
CoordinatorServerList::recoverServerRemoveUpdate(
ProtoBuf::ServerCrashInfo* state, EntryId logIdServerRemoveUpdate)
{
Lock lock(mutex);
LOG(DEBUG, "CoordinatorServerList::recoverServerRemoveUpdate()");
ServerRemoveUpdate(*this, lock,
ServerId(state->server_id()),
state->update_version()).complete(
logIdServerRemoveUpdate);
}
/**
* During Coordinator recovery, enlist a server that was either being enlisted
* at the time of crash, or had already successfully enlisted.
*
* \param state
* The ProtoBuf that encapsulates the information about the server to be
* enlisted.
* \param logIdServerUp
* The entry id of the LogCabin entry corresponding to the state.
*/
void
CoordinatorServerList::recoverServerUp(
ProtoBuf::ServerInformation* state, EntryId logIdServerUp)
{
Lock lock(mutex);
LOG(DEBUG, "CoordinatorServerList::recoverServerUp()");
EnlistServer(*this, lock,
ServerId(state->server_id()),
ServiceMask::deserialize(state->service_mask()),
state->read_speed(),
state->service_locator().c_str(),
state->update_version()).complete(logIdServerUp);
}
/**
* During Coordinator recovery, recover the entry that indicates that the
* next server enlistment will have to send out "UP" updates.
*
* \param state
* The ProtoBuf that indicates that the server enlistment will have to
* send out "UP" updates.
* \param logIdServerUpUpdate
* The entry id of the LogCabin entry corresponding to the state.
*/
void
CoordinatorServerList::recoverServerUpUpdate(
ProtoBuf::EntryType* state, EntryId logIdServerUpUpdate)
{
Lock lock(mutex);
LOG(DEBUG, "CoordinatorServerList::recoverServerUpUpdate()");
ServerUpUpdate(*this, lock).complete(logIdServerUpUpdate);
}
/**
* During Coordinator recovery, recover the entry that indicates that the
* replication id update will have to send out updates to the entire cluster.
*
* \param state
* The ProtoBuf that indicates that the coordinator will need to send
* out replication id updates.
* \param logIdServerReplicationUpUpdate
* The entry id of the LogCabin entry corresponding to the state.
*/
void
CoordinatorServerList::recoverServerReplicationUpUpdate(
ProtoBuf::EntryType* state, EntryId logIdServerReplicationUpUpdate)
{
Lock lock(mutex);
LOG(DEBUG, "CoordinatorServerList::recoverServerReplicationUpUpdate()");
ServerReplicationUpUpdate(*this, lock).complete(
logIdServerReplicationUpUpdate);
}
/**
* During Coordinator recovery, set update-able fields for the server.
*
* \param state
* The ProtoBuf that has the updates for the server.
* \param logIdServerUpdate
* The entry id of the LogCabin entry corresponding to serverUpdate.
*/
void
CoordinatorServerList::recoverServerUpdate(
ProtoBuf::ServerUpdate* state, EntryId logIdServerUpdate)
{
Lock lock(mutex);
LOG(DEBUG, "CoordinatorServerList::recoverServerUpdate()");
// If there are other update-able fields in the future, read them in from
// ServerUpdate and update them all.
ServerUpdate(*this, lock, ServerId(state->server_id()),
state->master_recovery_info()).complete(logIdServerUpdate);
}
/**
* During Coordinator recovery, set update-able fields for the server.
*
* \param state
* The ProtoBuf that has the updates for the server.
* \param logIdServerReplicationUpdate
* The entry id of the LogCabin entry corresponding to
* serverReplicationUpdate.
*/
void
CoordinatorServerList::recoverServerReplicationUpdate(
ProtoBuf::ServerReplicationUpdate* state,
EntryId logIdServerReplicationUpdate)
{
Lock lock(mutex);
LOG(DEBUG, "CoordinatorServerList::recoverServerReplicationUpdate()");
// If there are other update-able fields in the future, read them in from
// ServerReplicationUpdate and update them all.
ServerReplicationUpdate(*this, lock, ServerId(state->server_id()),
state->master_recovery_info(),
state->replication_id(),
version + 1).complete(logIdServerReplicationUpdate);
}
//////////////////////////////////////////////////////////////////////
// CoordinatorServerList Private Methods
//////////////////////////////////////////////////////////////////////
/**
* Do everything needed to execute the EnlistServer operation.
* Do any processing required before logging the state
* in LogCabin, log the state in LogCabin, then call #complete().
*/
ServerId
CoordinatorServerList::EnlistServer::execute()
{
newServerId = csl.generateUniqueId(lock);
ProtoBuf::ServerInformation stateServerUp;
stateServerUp.set_entry_type("ServerUp");
stateServerUp.set_server_id(newServerId.getId());
stateServerUp.set_service_mask(serviceMask.serialize());
stateServerUp.set_read_speed(readSpeed);
stateServerUp.set_service_locator(string(serviceLocator));
stateServerUp.set_update_version(updateVersion);
EntryId logIdServerUp =
csl.context->logCabinHelper->appendProtoBuf(
*csl.context->expectedEntryId, stateServerUp);
LOG(DEBUG, "LogCabin: ServerUp entryId: %lu", logIdServerUp);
return complete(logIdServerUp);
}
/**
* Complete the EnlistServer operation after its state has been
* logged in LogCabin.
* This is called internally by #execute() in case of normal operation
* (which is in turn called by #enlistServer()), and
* directly for coordinator recovery (by #recoverEnlistServer()).
*
* \param logIdServerUp
* The entry id of the LogCabin entry that has initial information
* for this server.
*/
ServerId
CoordinatorServerList::EnlistServer::complete(
EntryId logIdServerUp)
{
if (csl.logIdServerUpUpdate == NO_ID) {
// Server had already been successfully enlisted (presumably before a
// coordinator crash) -- hence its "UP" updates had been sent out to the
// cluster and acknowledged. Just add the entry to the coordinator
// server list, and do not send updates to the cluster.
csl.add(lock, newServerId, serviceLocator, serviceMask, readSpeed,
false);
} else {
csl.add(lock, newServerId, serviceLocator, serviceMask, readSpeed);
csl.version = updateVersion;
csl.pushUpdate(lock, updateVersion);
}
Entry* entry = csl.getEntry(newServerId);
entry->logIdServerUp = logIdServerUp;
// No-op if csl.logIdServerUpUpdate is already NO_ID.
entry->logIdServerUpUpdate = csl.logIdServerUpUpdate;
csl.logIdServerUpUpdate = NO_ID;
LOG(NOTICE, "Enlisting server at %s (server id %s) supporting "
"services: %s", serviceLocator, newServerId.toString().c_str(),
entry->services.toString().c_str());
if (entry->isBackup()) {
LOG(DEBUG, "Backup at id %s has %u MB/s read",
newServerId.toString().c_str(), readSpeed);
csl.createReplicationGroup(lock);
}
return newServerId;
}
void
CoordinatorServerList::PersistServerListVersion::execute()
{
ProtoBuf::ServerListVersion state;
state.set_entry_type("ServerListVersion");
state.set_version(version);
vector<EntryId> invalidates;
if (csl.logIdServerListVersion != NO_ID)
invalidates.push_back(csl.logIdServerListVersion);
EntryId entryId =
csl.context->logCabinHelper->appendProtoBuf(
*csl.context->expectedEntryId, state, invalidates);
LOG(DEBUG, "LogCabin: ServerListVersion entryId: %lu", entryId);
complete(entryId);
}
void
CoordinatorServerList::PersistServerListVersion::complete(
EntryId logIdServerListVersion)
{
csl.version = version;
csl.logIdServerListVersion = logIdServerListVersion;
}
/**
* Do everything needed to remove a server from the cluster.
* Do any processing required before logging the state
* in LogCabin, log the state in LogCabin, then call #complete().
*/
void
CoordinatorServerList::ServerCrashed::execute()
{
if (!csl.getEntry(serverId)) {
throw ServerListException(HERE,
format("Invalid ServerId (%s)", serverId.toString().c_str()));
}
ProtoBuf::ServerCrashInfo state;
state.set_entry_type("ServerCrashed");
state.set_server_id(serverId.getId());
state.set_update_version(updateVersion);
EntryId entryId =
csl.context->logCabinHelper->appendProtoBuf(
*csl.context->expectedEntryId, state);
LOG(DEBUG, "LogCabin: ServerCrashed entryId: %lu", entryId);
complete(entryId);
}
/**
* Complete the operation to remove a server from the cluster
* after its state has been logged in LogCabin.
* This is called internally by #execute() in case of normal operation, and
* directly for coordinator recovery (by #recoverServerCrashed()).
*
* \param entryId
* The entry id of the LogCabin entry corresponding to the state
* of the operation to be completed.
*/
void
CoordinatorServerList::ServerCrashed::complete(EntryId entryId)
{
csl.crashed(lock, serverId);
csl.version = updateVersion;
csl.pushUpdate(lock, updateVersion);
// If this machine has a backup and master on the same server it is best
// to remove the dead backup before initiating recovery. Otherwise, other
// servers may try to backup onto a dead machine which will cause delays.
Entry* entry = csl.getEntry(serverId);
entry->logIdServerCrashed = entryId;
if (entry->needsRecovery) {
if (!entry->services.has(WireFormat::MASTER_SERVICE)) {
// If the server being replaced did not have a master then there
// will be no recovery. That means it needs to transition to
// removed status now (usually recoveries remove servers from the
// list when they complete).
CoordinatorServerList::ServerRemoveUpdate(
csl, lock, serverId, ++csl.version).execute();
}
csl.context->recoveryManager->startMasterRecovery(*entry);
} else {
// Don't start recovery when the coordinator is replaying a serverDown
// log entry for a server that had already been recovered.
}
csl.removeReplicationGroup(lock, entry->replicationId);
csl.createReplicationGroup(lock);
}
/**
* Indicate that a crashed server needs to be recovered.
* Log the state in LogCabin, then call #complete().
*/
void
CoordinatorServerList::ServerNeedsRecovery::execute()
{
if (!csl.getEntry(serverId)) {
throw ServerListException(HERE,
format("Invalid ServerId (%s)", serverId.toString().c_str()));
}
ProtoBuf::ServerCrashInfo state;
state.set_entry_type("ServerNeedsRecovery");
state.set_server_id(serverId.getId());
EntryId entryId =
csl.context->logCabinHelper->appendProtoBuf(
*csl.context->expectedEntryId, state);
LOG(DEBUG, "LogCabin: ServerNeedsRecovery entryId: %lu", entryId);
complete(entryId);
}
/**
* Complete the operation to indicate that a crashed server needs to be
* recovered after its state has been logged in LogCabin.
* This is called internally by #execute() in case of normal operation, and
* directly for coordinator recovery (by #recoverServerNeedsRecovery()).
*
* \param entryId
* The entry id of the LogCabin entry corresponding to the state
* of the operation to be completed.
*/
void
CoordinatorServerList::ServerNeedsRecovery::complete(EntryId entryId)
{
Entry* entry = csl.getEntry(serverId);
if (!entry) {
LOG(WARNING, "Server being updated doesn't exist: %s",
serverId.toString().c_str());
csl.context->logCabinHelper->invalidate(
*csl.context->expectedEntryId, vector<EntryId>(entryId));
return;
}
entry->needsRecovery = true;
entry->logIdServerNeedsRecovery = entryId;
}
/**
* Indicate that a crashed server needs to be recovered.
* Log the state in LogCabin, then call #complete().
*/
void
CoordinatorServerList::ServerRemoveUpdate::execute()
{
Entry* entry = csl.getEntry(serverId);
if (!entry) {
throw ServerListException(HERE,
format("Invalid ServerId (%s)", serverId.toString().c_str()));
}
ProtoBuf::ServerCrashInfo state;
state.set_entry_type("ServerRemoveUpdate");
state.set_server_id(serverId.getId());
state.set_update_version(updateVersion);
vector<EntryId> invalidates;
if (entry->logIdServerNeedsRecovery)
invalidates.push_back(entry->logIdServerNeedsRecovery);
EntryId entryId =
csl.context->logCabinHelper->appendProtoBuf(
*csl.context->expectedEntryId, state, invalidates);
LOG(DEBUG, "LogCabin: ServerRemoveUpdate entryId: %lu", entryId);
complete(entryId);
}
/**
* Complete the operation to indicate that a crashed server needs to be
* recovered after its state has been logged in LogCabin.
* This is called internally by #execute() in case of normal operation, and
* directly for coordinator recovery (by #recoverServerRemoveUpdate()).
*
* \param entryId
* The entry id of the LogCabin entry corresponding to the state
* of the operation to be completed.
*/
void
CoordinatorServerList::ServerRemoveUpdate::complete(EntryId entryId)
{
Entry* entry = csl.getEntry(serverId);
if (!entry) {
LOG(WARNING, "Server being updated doesn't exist: %s",
serverId.toString().c_str());
csl.context->logCabinHelper->invalidate(
*csl.context->expectedEntryId, vector<EntryId>(entryId));
return;
}
entry->logIdServerRemoveUpdate = entryId;
// This is a no-op if server was already marked as CRASHED.
csl.crashed(lock, serverId);
// Setting state gets the serialized update message's state field correct.
entry->status = ServerStatus::REMOVE;
LOG(NOTICE, "Removing %s from cluster/coordinator server list",
serverId.toString().c_str());
ProtoBuf::ServerList_Entry& protoBufEntry(*(csl.update).add_server());
entry->serialize(protoBufEntry);
foreach (ServerTrackerInterface* tracker, csl.trackers)
tracker->enqueueChange(*entry, ServerChangeEvent::SERVER_REMOVED);
foreach (ServerTrackerInterface* tracker, csl.trackers)
tracker->fireCallback();
csl.version = updateVersion;
csl.pushUpdate(lock, updateVersion);
}
/**
* Do everything needed to set update-able fields corresponding to a server.
* Do any processing required before logging the state to LogCabin,
* log the state in LogCabin, then call #complete().
*/
void
CoordinatorServerList::ServerUpdate::execute()
{
ProtoBuf::ServerUpdate serverUpdate;
serverUpdate.set_entry_type("ServerUpdate");
serverUpdate.set_server_id(serverId.getId());
(*serverUpdate.mutable_master_recovery_info()) = recoveryInfo;
vector<EntryId> invalidates;
if (oldServerUpdateEntryId != NO_ID)
invalidates.push_back(oldServerUpdateEntryId);
EntryId newEntryId =
csl.context->logCabinHelper->appendProtoBuf(
*csl.context->expectedEntryId, serverUpdate, invalidates);
LOG(DEBUG, "LogCabin: ServerUpdate entryId: %lu", newEntryId);
complete(newEntryId);
}
/**
* Complete the operation to set update-able fields corresponding to a server
* after its state has been logged to LogCabin.
*
* \param entryId
* The entry id of the LogCabin entry corresponding to the state
* of the operation to be completed.
*/
void
CoordinatorServerList::ServerUpdate::complete(EntryId entryId)
{
Entry* entry = csl.getEntry(serverId);
if (entry) {
entry->masterRecoveryInfo = recoveryInfo;
entry->logIdServerUpdate = entryId;
} else {
LOG(WARNING, "Server being updated doesn't exist: %s",
serverId.toString().c_str());
csl.context->logCabinHelper->invalidate(
*csl.context->expectedEntryId, vector<EntryId>(entryId));
}
}
/**
* Do everything needed to set update-able fields corresponding to a server.
* Do any processing required before logging the state to LogCabin,
* log the state in LogCabin, then call #complete().
*/
void
CoordinatorServerList::ServerReplicationUpdate::execute()
{
ProtoBuf::ServerReplicationUpdate serverReplicationUpdate;
serverReplicationUpdate.set_entry_type("ServerReplicationUpdate");
serverReplicationUpdate.set_replication_id(replicationId);
serverReplicationUpdate.set_server_id(serverId.getId());
(*serverReplicationUpdate.mutable_master_recovery_info()) = recoveryInfo;
vector<EntryId> invalidates;
if (oldServerReplicationUpdateEntryId != NO_ID)
invalidates.push_back(oldServerReplicationUpdateEntryId);
EntryId newEntryId =
csl.context->logCabinHelper->appendProtoBuf(
*csl.context->expectedEntryId, serverReplicationUpdate,
invalidates);
LOG(DEBUG, "LogCabin: ServerReplicationUpdate entryId: %lu", newEntryId);
complete(newEntryId);
}
/**
* Complete the operation to set update-able fields corresponding to a server
* after its state has been logged to LogCabin.
*
* \param entryId
* The entry id of the LogCabin entry corresponding to the state
* of the operation to be completed.
*/
void
CoordinatorServerList::ServerReplicationUpdate::complete(EntryId entryId)
{
Entry* entry = csl.getEntry(serverId);
if (entry) {
entry->masterRecoveryInfo = recoveryInfo;
entry->logIdServerReplicationUpdate = entryId;
entry->replicationId = replicationId;
entry->logIdServerReplicationUpUpdate =
csl.logIdServerReplicationUpUpdate;
// We check to see if the replication update field is set in
// Log Cabin. If it is, we can be sure that the replication id
// update hasn't been sent out to the masters.
if (csl.logIdServerReplicationUpUpdate != NO_ID) {
ProtoBuf::ServerList_Entry& protoBufEntry(
*(csl.update).add_server());
entry->serialize(protoBufEntry);
csl.version = updateVersion;
csl.pushUpdate(lock, updateVersion);
csl.logIdServerReplicationUpUpdate = NO_ID;
}
} else {
LOG(WARNING, "Server being updated doesn't exist: %s",
serverId.toString().c_str());
csl.context->logCabinHelper->invalidate(
*csl.context->expectedEntryId, vector<EntryId>(entryId));
}
}
/**
* Indicate that a the next server to be enlisted has to send out "UP" updates
* to the cluster.
* Log the state in LogCabin, then call #complete().
*/
void
CoordinatorServerList::ServerUpUpdate::execute()
{
ProtoBuf::EntryType state;
state.set_entry_type("ServerUpUpdate");
EntryId entryId =
csl.context->logCabinHelper->appendProtoBuf(
*csl.context->expectedEntryId, state);
LOG(DEBUG, "LogCabin: ServerUpUpdate entryId: %lu", entryId);
complete(entryId);
}
/**
* Complete the operation to indicate that the next server to be enlisted
* has to send out "UP" updates to the cluster.
* This is called internally by #execute() in case of normal operation, and
* directly for coordinator recovery (by #recoverServerUpUpdate()).
*
* \param entryId
* The entry id of the LogCabin entry corresponding to the state
* of the operation to be completed.
*/
void
CoordinatorServerList::ServerUpUpdate::complete(EntryId entryId)
{
csl.logIdServerUpUpdate = entryId;
}
ServerDetails*
CoordinatorServerList::iget(ServerId id)
{
return getEntry(id);
}
ServerDetails*
CoordinatorServerList::iget(uint32_t index)
{
return (serverList[index].entry) ? serverList[index].entry.get() : NULL;
}
/**
* Indicate that all servers have already received a replication Id update.
* Log the state in LogCabin, then call #complete().
*/
void
CoordinatorServerList::ServerReplicationUpUpdate::execute()
{
ProtoBuf::EntryType state;
state.set_entry_type("ServerReplicationUpUpdate");
EntryId entryId =
csl.context->logCabinHelper->appendProtoBuf(
*csl.context->expectedEntryId, state);
LOG(DEBUG, "LogCabin: ServerReplicationUpUpdate entryId: %lu", entryId);
complete(entryId);
}
/**
* Complete the operation to indicate that all the servers have already
* received a replication Id update.
* This is called internally by #execute().
*
* \param entryId
* The entry id of the LogCabin entry corresponding to the state
* of the operation to be completed.
*/
void
CoordinatorServerList::ServerReplicationUpUpdate::complete(EntryId entryId)
{
csl.logIdServerReplicationUpUpdate = entryId;
}
/**
* Return the number of valid indexes in this list w/o lock. Valid does not mean
* that they're occupied, only that they are within the bounds of the array.
*/
size_t
CoordinatorServerList::isize() const
{
return serverList.size();
}
/**
* Returns the entry corresponding to a ServerId with bounds checks.
* Assumes caller already has CoordinatorServerList lock.
*
* \param id
* ServerId corresponding to the entry you want to get.
* \return
* The Entry, null if id is invalid.
*/
CoordinatorServerList::Entry*
CoordinatorServerList::getEntry(ServerId id) const {
uint32_t index = id.indexNumber();
if ((index < serverList.size()) && serverList[index].entry) {
Entry* e = const_cast<Entry*>(serverList[index].entry.get());
if (e->serverId == id)
return e;
}
return NULL;
}
/**
* Obtain a pointer to the entry associated with the given position
* in the server list with bounds check. Assumes caller already has
* CoordinatorServerList lock.
*
* \param index
* Position of entry in the server list to return a copy of.
* \return
* The Entry, null if index doesn't have an entry or is out of bounds
*/
CoordinatorServerList::Entry*
CoordinatorServerList::getEntry(size_t index) const {
if ((index < serverList.size()) && serverList[index].entry) {
Entry* e = const_cast<Entry*>(serverList[index].entry.get());
return e;
}
return NULL;
}
/**
* Add a new server to the CoordinatorServerList with a given ServerId.
*
* The result of this operation will be added in the class's update Protobuffer
* intended for the cluster. To send out the update, call pushUpdate()
* which will also increment the version number. Calls to remove()
* and crashed() must precede call to add() to ensure ordering guarantees
* about notifications related to servers which re-enlist.
*
* The addition will be pushed to all registered trackers and those with
* callbacks will be notified.
*
* It doesn't acquire locks and does not send out updates
* since it is used internally.
*
* \param lock
* Explicity needs CoordinatorServerList lock.
* \param serverId
* The serverId to be assigned to the new server.
* \param serviceLocator
* The ServiceLocator string of the server to add.
* \param serviceMask
* Which services this server supports.
* \param readSpeed
* Speed of the storage on the enlisting server if it includes a backup
* service. Argument is ignored otherwise.
* \param enqueueUpdate
* Whether the update (to be sent to the cluster) about the enlisting
* server should be enqueued. This is false during coordinator recovery
* while replaying an AliveServer entry since it only needs local
* (coordinator) change, and the rest of the cluster had already
* acknowledged the update.
*/
void
CoordinatorServerList::add(Lock& lock,
ServerId serverId,
string serviceLocator,
ServiceMask serviceMask,
uint32_t readSpeed,
bool enqueueUpdate)
{
uint32_t index = serverId.indexNumber();
// When add is not preceded by generateUniqueId(),
// for example, during coordinator recovery while adding a server that
// had already enlisted before the previous coordinator leader crashed,
// the serverList might not have space allocated for this index number.
// So we need to resize it explicitly.
if (index >= serverList.size())
serverList.resize(index + 1);
auto& pair = serverList[index];
pair.nextGenerationNumber = serverId.generationNumber();
pair.nextGenerationNumber++;
pair.entry.construct(serverId, serviceLocator, serviceMask);
if (serviceMask.has(WireFormat::MASTER_SERVICE)) {
numberOfMasters++;
}
if (serviceMask.has(WireFormat::BACKUP_SERVICE)) {
numberOfBackups++;
pair.entry->expectedReadMBytesPerSec = readSpeed;
}
if (enqueueUpdate) {
ProtoBuf::ServerList_Entry& protoBufEntry(*update.add_server());
pair.entry->serialize(protoBufEntry);
foreach (ServerTrackerInterface* tracker, trackers)
tracker->enqueueChange(*pair.entry,
ServerChangeEvent::SERVER_ADDED);
foreach (ServerTrackerInterface* tracker, trackers)
tracker->fireCallback();
}
}
/**
* Mark a server as crashed in the list (when it has crashed and is
* being recovered and resources [replicas] for its recovery must be
* retained).
*
* This is a no-op if the server is already marked as crashed;
* the effect is undefined if the server's status is REMOVE.
*
* The result of this operation will be added in the class's update Protobuffer
* intended for the cluster. To send out the update, call pushUpdate()
* which will also increment the version number. Calls to remove()
* and crashed() must proceed call to add() to ensure ordering guarantees
* about notifications related to servers which re-enlist.
*
* It doesn't acquire locks and does not send out updates
* since it is used internally.
*
* The addition will be pushed to all registered trackers and those with
* callbacks will be notified.
*
* \param lock
* Explicity needs CoordinatorServerList lock.
* \param serverId
* The ServerId of the server to remove from the CoordinatorServerList.
* It must not have been removed already (see remove()).
*/
void
CoordinatorServerList::crashed(const Lock& lock,
ServerId serverId)
{
Entry* entry = getEntry(serverId);
if (!entry) {
throw ServerListException(HERE,
format("Invalid ServerId (%s)", serverId.toString().c_str()));
}
if (entry->status == ServerStatus::CRASHED)
return;
assert(entry->status != ServerStatus::REMOVE);
if (entry->isMaster())
numberOfMasters--;
if (entry->isBackup())
numberOfBackups--;
entry->status = ServerStatus::CRASHED;
ProtoBuf::ServerList_Entry& protoBufEntry(*update.add_server());
entry->serialize(protoBufEntry);
foreach (ServerTrackerInterface* tracker, trackers)
tracker->enqueueChange(*entry, ServerChangeEvent::SERVER_CRASHED);
foreach (ServerTrackerInterface* tracker, trackers)
tracker->fireCallback();
}
/**
* Return the first free index in the server list. If the list is
* completely full, resize it and return the next free one.
*
* Note that index 0 is reserved. This method must never return it.
*/
uint32_t
CoordinatorServerList::firstFreeIndex()
{
// Naive, but probably fast enough for a good long while.
size_t index;
for (index = 1; index < serverList.size(); index++) {
if (!serverList[index].entry)
break;
}
if (index >= serverList.size())
serverList.resize(index + 1);
assert(index != 0);
return downCast<uint32_t>(index);
}
/**
* Generate a new, unique ServerId that may later be assigned to a server
* using add().
*
* \param lock
* Explicity needs CoordinatorServerList lock.
* \return
* The unique ServerId generated.
*/
ServerId
CoordinatorServerList::generateUniqueId(Lock& lock)
{
uint32_t index = firstFreeIndex();
auto& pair = serverList[index];
ServerId id(index, pair.nextGenerationNumber);
pair.nextGenerationNumber++;
pair.entry.construct(id, "", ServiceMask());
return id;
}
/**
* Serialize the entire list to a Protocol Buffer form. Only used internally in
* CoordinatorServerList; requires a lock on #mutex is held for duration of call.
*
* \param lock
* Unused, but required to statically check that the caller is aware that
* a lock must be held on #mutex for this call to be safe.
* \param[out] protoBuf
* Reference to the ProtoBuf to fill.
*/
void
CoordinatorServerList::serialize(const Lock& lock,
ProtoBuf::ServerList& protoBuf) const
{
serialize(lock, protoBuf, {WireFormat::MASTER_SERVICE,
WireFormat::BACKUP_SERVICE});
}
/**
* Serialize this list (or part of it, depending on which services the
* caller wants) to a protocol buffer. Not all state is included, but
* enough to be useful for disseminating cluster membership information
* to other servers. Only used internally in CoordinatorServerList; requires
* a lock on #mutex is held for duration of call.
*
* All entries are serialize to the protocol buffer in the order they appear
* in the server list. The order has some important implications. See
* ServerList::applyServerList() for details.
*
* \param lock
* Unused, but required to statically check that the caller is aware that
* a lock must be held on #mutex for this call to be safe.
* \param[out] protoBuf
* Reference to the ProtoBuf to fill.
* \param services
* If a server has *any* service included in \a services it will be
* included in the serialization; otherwise, it is skipped.
*/
void
CoordinatorServerList::serialize(const Lock& lock,
ProtoBuf::ServerList& protoBuf,
ServiceMask services) const
{
for (size_t i = 0; i < serverList.size(); i++) {
if (!serverList[i].entry)
continue;
const Entry& entry = *serverList[i].entry;
if ((entry.services.has(WireFormat::MASTER_SERVICE) &&
services.has(WireFormat::MASTER_SERVICE)) ||
(entry.services.has(WireFormat::BACKUP_SERVICE) &&
services.has(WireFormat::BACKUP_SERVICE)))
{
ProtoBuf::ServerList_Entry& protoBufEntry(*protoBuf.add_server());
entry.serialize(protoBufEntry);
}
}
protoBuf.set_version_number(version);
protoBuf.set_type(ProtoBuf::ServerList_Type_FULL_LIST);
}
/**
* Assign a new replicationId to a backup, and inform the backup which nodes
* are in its replication group.
*
* \param lock
* Explicity needs CoordinatorServerList lock.
* \param replicationId
* New replication group Id that is assigned to backup.
* \param replicationGroupIds
* Includes the ServerId's of all the members of the replication group.
*
* \return
* False if one of the servers is dead, true if all of them are alive.
*/
bool
CoordinatorServerList::assignReplicationGroup(
Lock& lock, uint64_t replicationId,
const vector<ServerId>& replicationGroupIds)
{
foreach (ServerId backupId, replicationGroupIds) {
Entry* e = getEntry(backupId);
if (!e) {
return false;
}
if (e->status == ServerStatus::UP) {
ServerReplicationUpUpdate(*this, lock).execute();
ServerReplicationUpdate(*this, lock, e->serverId,
e->masterRecoveryInfo, replicationId, version + 1).execute();
}
}
return true;
}
/**
* Try to create a new replication group. Look for groups of backups that
* are not assigned a replication group and are up.
* If there are not enough available candidates for a new group, the function
* returns without sending out any Rpcs. If there are enough group members
* to form a new group, but one of the servers is down, hintServerCrashed will
* reset the replication group of that server.
*
* \param lock
* Explicity needs CoordinatorServerList lock.
*/
void
CoordinatorServerList::createReplicationGroup(Lock& lock)
{
// Create a list of all servers who do not belong to a replication group
// and are up. Note that this is a performance optimization and is not
// required for correctness.
vector<ServerId> freeBackups;
for (size_t i = 0; i < isize(); i++) {
if (serverList[i].entry &&
serverList[i].entry->isBackup() &&
serverList[i].entry->replicationId == 0) {
freeBackups.push_back(serverList[i].entry->serverId);
}
}
// TODO(cidon): The coordinator currently has no knowledge of the
// replication factor, so we manually set the replication group size to 3.
// We should make this parameter configurable.
const uint32_t numReplicas = 3;
vector<ServerId> group;
while (freeBackups.size() >= numReplicas) {
group.clear();
for (uint32_t i = 0; i < numReplicas; i++) {
const ServerId& backupId = freeBackups.back();
group.push_back(backupId);
freeBackups.pop_back();
}
assignReplicationGroup(lock, nextReplicationId, group);
nextReplicationId++;
}
}
/**
* Reset the replicationId for all backups with groupId.
*
* \param lock
* Explicity needs CoordinatorServerList lock.
* \param groupId
* Replication group that needs to be reset.
*/
void
CoordinatorServerList::removeReplicationGroup(Lock& lock, uint64_t groupId)
{
// Cannot remove groupId 0, since it is the default groupId.
if (groupId == 0) {
return;
}
vector<ServerId> group;
for (size_t i = 0; i < isize(); i++) {
if (serverList[i].entry &&
serverList[i].entry->isBackup() &&
serverList[i].entry->replicationId == groupId) {
group.push_back(serverList[i].entry->serverId);
}
if (group.size() != 0) {
assignReplicationGroup(lock, 0, group);
}
}
}
/**
* Increments the server list version and notifies the async updater to
* propagate the buffered Protobuf::ServerList update. The buffered update
* will be Clear()ed and empty updates are silently ignored.
*
* \param lock
* Explicity needs CoordinatorServerList lock.
* \param updateVersion
* Server list version number to be assigned to the update being pushed.
*/
void
CoordinatorServerList::pushUpdate(const Lock& lock, uint64_t updateVersion)
{
ProtoBuf::ServerList full;
// If there are no updates, don't generate a send.
if (update.server_size() == 0)
return;
// prepare incremental server list
update.set_version_number(updateVersion);
update.set_type(ProtoBuf::ServerList_Type_UPDATE);
// prepare full server list
serialize(lock, full);
updates.emplace_back(update, full);
// Link the previous tail with the new tail in the deque.
if (updates.size() > 1)
(updates.end()-2)->next = &(updates.back());
hasUpdatesOrStop.notify_one();
update.Clear();
}
/**
* Stops the background updater. It cancel()'s all pending update rpcs
* and leaves the cluster potentially out-of-date. To force a
* synchronization point before halting, call sync() first.
*
* This will block until the updater thread stops.
*/
void
CoordinatorServerList::haltUpdater()
{
// Signal stop
Lock lock(mutex);
stopUpdater = true;
hasUpdatesOrStop.notify_one();
lock.unlock();
// Wait for Thread stop
if (updaterThread && updaterThread->joinable()) {
updaterThread->join();
updaterThread.destroy();
}
}
/**
* Starts the background updater that keeps the cluster's
* server lists up-to-date.
*/
void
CoordinatorServerList::startUpdater()
{
Lock _(mutex);
// Start thread if not started
if (!updaterThread) {
lastScan.reset();
stopUpdater = false;
updaterThread.construct(&CoordinatorServerList::updateLoop, this);
}
// Tell it to start work regardless
hasUpdatesOrStop.notify_one();
}
/**
* Checks if the cluster is up-to-date.
*
* \param lock
* explicity needs CoordinatorServerList lock
* \return
* true if entire list is up-to-date
*/
bool
CoordinatorServerList::isClusterUpToDate(const Lock& lock) {
return (serverList.size() == 0) ||
(numUpdatingServers == 0 &&
minConfirmedVersion == version);
}
/**
* Causes a deletion of server list updates that are no longer needed
* by the coordinator serverlist. This will delete all updates older than
* the CoordinatorServerList's current minConfirmedVersion.
*
* This is safe to invoke whenever, but is typically done so after a
* new minConfirmedVersion is set.
*
* \param lock
* explicity needs CoordinatorServerList lock
*/
void
CoordinatorServerList::pruneUpdates(const Lock& lock)
{
if (minConfirmedVersion == UNINITIALIZED_VERSION)
return;
if (minConfirmedVersion > version) {
LOG(ERROR, "Inconsistent state detected! CoordinatorServerList's "
"minConfirmedVersion %lu is larger than it's current "
"version %lu. This should NEVER happen!",
minConfirmedVersion, version);
// Reset minVersion in the hopes of it being a transient bug.
minConfirmedVersion = 0;
return;
}
if (minConfirmedVersion == version) {
PersistServerListVersion(*this, lock, version).execute();
}
while (!updates.empty() && updates.front().version <= minConfirmedVersion) {
ProtoBuf::ServerList currentUpdate = updates.front().incremental;
assert(currentUpdate.type() ==
ProtoBuf::ServerList::Type::ServerList_Type_UPDATE);
for (int i = 0; i < currentUpdate.server().size(); i++) {
ProtoBuf::ServerList::Entry currentEntry = currentUpdate.server(i);
ServerStatus updateStatus =
ServerStatus(currentEntry.status());
if (updateStatus == ServerStatus::UP) {
// An enlistServer operation has successfully completed.
if (context->logCabinHelper) {
ServerId serverId =
ServerId(currentEntry.server_id());
Entry* entry = getEntry(serverId);
assert(entry != NULL);
// We are relying on the fact that enlistServer has to be
// sent out before the replication id update is sent out by
// the coordinator, and therefore the order of
// acknowledgement has to be in the same order.
// Otherwise, the coordinator will invalidate the wrong
// updates.
bool isUpUpdate = true;
if (entry->logIdServerUpUpdate != NO_ID) {
vector<EntryId> invalidates
{entry->logIdServerUpUpdate};
context->logCabinHelper->invalidate(
*context->expectedEntryId, invalidates);
} else {
isUpUpdate = false;
vector<EntryId> invalidates
{entry->logIdServerReplicationUpUpdate};
context->logCabinHelper->invalidate(
*context->expectedEntryId, invalidates);
}
if (isUpUpdate) {
entry->logIdServerUpUpdate = NO_ID;
} else {
entry->logIdServerReplicationUpUpdate = NO_ID;
}
}
} else if (updateStatus == ServerStatus::CRASHED) {
// A serverCrashed operation has completed. The server that
// crashed may be still recovering.
// So we're not invalidating its LogCabin entries just yet.
} else if (updateStatus == ServerStatus::REMOVE) {
// This marks the final completion of serverCrashed() operation.
// i.e., If the crashed server was a master, then its recovery
// (sparked by a serverCrashed operation) has completed.
// If it was not a master, then the serverCrashed operation
// (which will not spark any recoveries) has completed.
ServerId serverId = ServerId(currentEntry.server_id());
Tub<Entry>& entry = serverList[serverId.indexNumber()].entry;
if (context->logCabinHelper) {
assert(entry);
vector<EntryId> invalidates {
entry->logIdServerUp,
entry->logIdServerCrashed,
entry->logIdServerRemoveUpdate};
if (entry->logIdServerUpdate != NO_ID)
invalidates.push_back(entry->logIdServerUpdate);
context->logCabinHelper->invalidate(
*context->expectedEntryId, invalidates);
}
entry.destroy();
}
}
updates.pop_front();
}
if (updates.empty()) // Empty list = no updates to send
listUpToDate.notify_all();
}
/**
* Blocks until all of the cluster is up-to-date.
*/
void
CoordinatorServerList::sync()
{
startUpdater();
Lock lock(mutex);
while (!isClusterUpToDate(lock)) {
listUpToDate.wait(lock);
}
}
/**
* Main loop that checks for outdated servers and sends out update rpcs.
* This is the top-level method of a dedicated thread separate from the
* main coordinator's.
*
* Once invoked, this loop can be exited by calling haltUpdater() in another
* thread.
*
* The Updater Loop manages starting, stopping, and following up on ServerList
* Update RPCs asynchronous to the main thread with minimal locking of
* Coordinator Server List, CSL. The intention of this mechanism is to
* ensure that the critical sections of the CSL are not delayed while
* waiting for RPCs to finish.
*
* Since Coordinator Server List houses all the information about updatable
* servers, this mechanism requires at least two entry points (conceptual)
* into the server list, a) a way to get info about outdated servers and b)
* a way to signal update success/failure. The former is achieved via
* getWork() and the latter is achieved by workSucceeded()/workFailed().
* For polling efficiency, there is an additional call, waitForWork(), that
* will sleep until more servers get out of date. These are the only calls
* that require locks on the Coordinator Server List that UpdateLoop uses.
* Other than that, the updateLoop operates asynchronously from the CSL.
*
*/
void
CoordinatorServerList::updateLoop()
{
UpdaterWorkUnit wu;
uint64_t max_rpcs = 8;
std::deque<Tub<UpdateServerListRpc>> rpcs_backing;
std::list<Tub<UpdateServerListRpc>*> rpcs;
std::list<Tub<UpdateServerListRpc>*>::iterator it;
/**
* The Updater Loop manages a number of outgoing RPCs. The maximum number
* of concurrent RPCs is determined dynamically in the hopes of finding a
* sweet spot where the time to iterate through the list of outgoing RPCs
* is roughly equivalent to the time of one RPC finishing. The heuristic
* for doing this is simply only allowing one new RPC to be started with
* each pass through the internal list of outgoing RPCs and allowing an
* unlimited number to finish. The intuition for doing this is based on
* the observation that checking whether an RPC is finished and finishing
* it takes ~10-20ns whereas starting a new RPC takes much longer. Thus,
* by limiting the number of RPCs started per iteration, we would allow
* for rapid polling of unfinished RPCs and a rapid ramp up to the steady
* state where roughly one RPC finishes per iteration. This is preferable
* over trying start multiple new RPCs per iteration.
*
* The Updater keeps track of the outgoing RPCs internally in a
* List<Tub<UpdateServerListRPC*>> that is organized as such:
*
* **************************************************....
* * Active RPCS * Inactive RPCs * Unused RPCs ....
* **************************************************
* /\ max_rpcs
*
* Active RPCs are ones that have started but not finished. They are
* compacted to the left so that scans through the list would look at
* the active RPCs first. Inactive RPCs are ones that have not been
* started and are allocated, unoccupied Tubs. Unused RPCs conceptually
* represent RPCs that are unallocated and are outside the max_rpcs range.
*
* The division between Active RPCs and Inactive RPCs is defined as the
* index where the first, leftmost unoccupied Tub resides. The division
* between inactive and unused RPCs is the physical size of the list
* which monotonically increases as the updater determines that more
* RPCs need to be started.
*
* In normal operation, the Updater will start scanning through the list
* left to right. Conceptually, the actions it takes would depend on
* which region of the list it's in. In the active RPCs range, it will
* check for finished RPCs. If it encounters one, it will clean up the
* RPC and place its Tub at the back of the list to compact the active
* range. Once in the inactive range, it will start up one new RPC and
* continue on.
*
* At this point, the iteration will either still be in the inactive
* range or it would have reached the max_rpcs marker (unused range).
* If it's in the unused range, it will allocate more Tubs. Otherwise,
* it will determine if the thread should sleep or not. The thread will
* sleep when the active range is empty.
*/
try {
while (!stopUpdater) {
// Phase 0: Alloc more RPCs to fill max_rpcs.
for (size_t i = rpcs.size(); i < max_rpcs && !stopUpdater; i++) {
rpcs_backing.emplace_back();
rpcs.push_back(&rpcs_backing.back());
}
// Phase 1: Scan through and compact active rpcs to the front.
it = rpcs.begin();
while ( it != rpcs.end() && !stopUpdater ) {
UpdateServerListRpc* rpc = (*it)->get();
// Reached end of active rpcs, enter phase 2.
if (!rpc)
break;
// Skip not-finished rpcs
if (!rpc->isReady()) {
it++;
continue;
}
// Finished rpc found
bool success = false;
try {
rpc->wait();
success = true;
} catch (const ServerNotUpException& e) {}
if (success)
workSuccess(rpc->id);
else
workFailed(rpc->id);
(*it)->destroy();
// Compaction swap
rpcs.push_back(*it);
it = rpcs.erase(it);
}
// Phase 2: Start up to 1 new rpc
if ( it != rpcs.end() && !stopUpdater ) {
if (getWork(&wu)) {
auto* initial_list = (wu.sendFullList) ?
&(wu.firstUpdate->full) : &(wu.firstUpdate->incremental);
(*it)->construct(context, wu.targetServer, initial_list);
// Batch up multiple requests
const ServerListUpdatePair* updatePtr = wu.firstUpdate;
while (updatePtr->version < wu.updateVersionTail) {
updatePtr = updatePtr->next;
(**it)->appendServerList(&(updatePtr->incremental));
}
(**it)->send();
it++;
}
}
// Phase 3: Expand and/or stop
if (it == rpcs.end()) {
max_rpcs += 8;
} else if (it == rpcs.begin()) {
waitForWork();
}
}
// wend; stopUpdater = true
for (size_t i = 0; i < rpcs_backing.size(); i++) {
if (rpcs_backing[i]) {
workFailed(rpcs_backing[i]->id);
rpcs_backing[i]->cancel();
rpcs_backing[i].destroy();
}
}
} catch (const std::exception& e) {
LOG(ERROR, "Fatal error in CoordinatorServerList: %s", e.what());
throw;
} catch (...) {
LOG(ERROR, "Unknown fatal error in CoordinatorServerList.");
throw;
}
}
/**
* Invoked by the updater thread to wait (sleep) until there are
* more updates. This will block until there is more updating work
* to be done and will notify those waiting for the server list to
* be up to date (if any).
*/
void
CoordinatorServerList::waitForWork()
{
Lock lock(mutex);
while (minConfirmedVersion == version && !stopUpdater) {
listUpToDate.notify_all();
hasUpdatesOrStop.wait(lock);
}
}
/**
* Attempts to find servers that require updates that don't already
* have outstanding update rpcs.
*
* This call MUST be followed by a workSuccuss or workFailed call
* with the serverId contained within the WorkUnit at some point in
* the future to ensure that internal metadata is reset for the work
* unit so that the server can receive future updates.
*
* There is a contract that comes with call. All updates that come after-
* and the update that starts on- the iterator in the WorkUnit is
* GUARANTEED to be NOT deleted as long as a workSuccess or workFailed
* is not invoked with the corresponding serverId in the WorkUnit. There
* are no guarantees for updates that come before the iterator's starting
* position, so don't iterate backwards. See documentation on UpdaterWorkUnit
* for more info.
*
* \param wu
* Work Unit that can be filled out by this method
*
* \return
* true if an updatable server (work) was found
*
*/
bool
CoordinatorServerList::getWork(UpdaterWorkUnit* wu) {
Lock lock(mutex);
// Heuristic to prevent duplicate scans when no new work has shown up.
if (serverList.size() == 0 ||
(numUpdatingServers > 0 && lastScan.noWorkFoundForEpoch == version))
return false;
/**
* Searches through the server list for servers that are eligible
* for updates and are currently not updating. The former is defined as
* the server having MEMBERSHIP_SERVICE, is UP, and has a verfiedVersion
* not equal to the current version. The latter is defined as a server
* having verfiedVersion == updateVersion.
*
* The search starts at lastScan.searchIndex, which is a marker for
* where the last invocation of getWork() stopped before returning.
* The search ends when either the entire server list has been scanned
* (when we reach lastScan.searchIndex again) or when an outdated server
* eligible for updates has been found. In the latter case, the function
* will package the update details into a WorkUnit and mark the index it
* left off on in lastScan.searchIndex.
*
* Updates get packed into WorkUnits as one would expect; servers that
* haven't heard from the Coordinator get one full list and those that
* have get a batch of incremental updates. One peculiarity is the version
* of the full list. If the work unit was created during the first scan
* through the server list, the lowest version is used. Otherwise, the
* latest server list is used.
*
* The reason for this is because when the updater thread stops or the
* coordinator crashes, update rpcs may be prematurely canceled. Some
* servers may have actually gotten a full list and applied it but could
* not respond in time. Thus, to prevent sending servers a newer full
* server list they can't process, we send the oldest server list on the
* first scan through the server list and then later patch it up to date
* with a batch of incremental updates. This is called 'slow start.'
*
* While scanning, the loop will also keep track of the minimum
* verifiedVersion in the server list and will propagate this
* value to minConfirmedVersion. This is done to track whether
* the server list is up to date and which old updates, which
* are guaranteed to never be used again, can be pruned. The
* propagation occurs only when the minVersion in the scan is
* interesting, i.e. not MAX64 and not UNINITIALIZED_VERSION.
* The former means that there are no updatable servers and the
* latter means there are updatable servers with uninitialized
* server lists. Neither contribute to the knowledge of what
* the minimum server list version in the cluster is and what
* can be pruned.
*/
size_t i = lastScan.searchIndex;
uint64_t numUpdatableServers = 0;
do {
Entry* server = serverList[i].entry.get();
// Does server exist and is it updatable?
if (server && server->status == ServerStatus::UP &&
server->services.has(WireFormat::MEMBERSHIP_SERVICE)) {
// Record Stats
numUpdatableServers++;
if (server->verifiedVersion < lastScan.minVersion) {
lastScan.minVersion = server->verifiedVersion;
}
// update required
if (server->updateVersion != version &&
server->updateVersion == server->verifiedVersion) {
// New server, send full server list
if (server->verifiedVersion == UNINITIALIZED_VERSION) {
wu->sendFullList = true;
// 'slow start'
if (lastScan.completeScansSinceStart == 0) {
wu->firstUpdate = &(updates.front());
} else {
wu->firstUpdate = &(updates.back());
}
} else {
// Incremental update(s).
wu->sendFullList = false;
uint64_t firstVersion = server->verifiedVersion + 1;
size_t offset = firstVersion - updates.front().version;
wu->firstUpdate = &*(updates.begin()+=offset);
}
wu->targetServer = server->serverId;
wu->updateVersionTail = std::min(version,
wu->firstUpdate->version + MAX_UPDATES_PER_RPC-1);
numUpdatingServers++;
lastScan.searchIndex = i;
server->updateVersion = wu->updateVersionTail;
return true;
}
}
i = (i+1)%serverList.size();
// update statistics
if (i == 0) {
// Record min version only if it's interesting
if ( lastScan.minVersion != UNINITIALIZED_VERSION &&
lastScan.minVersion != MAX64)
minConfirmedVersion = lastScan.minVersion;
lastScan.completeScansSinceStart++;
lastScan.minVersion = MAX64;
pruneUpdates(lock);
}
// While we haven't reached a full scan through the list yet.
} while (i != lastScan.searchIndex);
// If no one is updating, then it's safe to prune ALL updates.
if (numUpdatableServers == 0) {
minConfirmedVersion = version;
pruneUpdates(lock);
}
lastScan.noWorkFoundForEpoch = version;
return false;
}
/**
* Signals the success of updater to complete a work unit. This
* will update internal metadata to allow the server described by
* the work unit to be updatable again.
*
* Note that this should only be invoked AT MOST ONCE for each WorkUnit.
*
* \param id
* The serverId originally contained in the work unit
* that just succeeded.
*/
void
CoordinatorServerList::workSuccess(ServerId id) {
Lock lock(mutex);
// Error checking for next 3 blocks
if (numUpdatingServers > 0) {
numUpdatingServers--;
} else {
LOG(ERROR, "Bookeeping issue detected; server's count of "
"numUpdatingServers just went negative. Not total failure "
"but will cause the updater thread to spin even w/o work. "
"Cause is mismatch # of getWork() and workSuccess/Failed()");
}
Entry* server = getEntry(id);
if (server == NULL) {
// Typically not an error, but this is UNUSUAL in normal cases.
LOG(DEBUG, "Server %s responded to a server list update but "
"is no longer in the server list...",
id.toString().c_str());
return;
}
if (server->verifiedVersion == server->updateVersion) {
LOG(ERROR, "Invoked for server %s even though either no update "
"was sent out or it has already been invoked. Possible "
"race/bookeeping issue.",
server->serverId.toString().c_str());
} else {
// Meat of actual functionality
LOG(DEBUG, "ServerList Update Success: %s update (%ld => %ld)",
server->serverId.toString().c_str(),
server->verifiedVersion,
server->updateVersion);
server->verifiedVersion = server->updateVersion;
}
// If update didn't update all the way or it's the last server updating,
// hint for a full scan to update minConfirmedVersion.
if (server->verifiedVersion < version)
lastScan.noWorkFoundForEpoch = 0;
}
/**
* Signals the failure of the updater to execute a work unit. Causes
* an internal rollback on metadata so that the server involved will
* be retried later.
*
* \param id
* The serverId contained within the work unit that the updater
* had failed to send out.
*/
void
CoordinatorServerList::workFailed(ServerId id) {
Lock lock(mutex);
if (numUpdatingServers > 0) {
numUpdatingServers--;
} else {
LOG(ERROR, "Bookeeping issue detected; server's count of "
"numUpdatingServers just went negative. Not total failure "
"but will cause the updater thread to spin even w/o work. "
"Cause is mismatch # of getWork() and workSuccess/Failed()");
}
Entry* server = getEntry(id);
if (server) {
server->updateVersion = server->verifiedVersion;
LOG(DEBUG, "ServerList Update Failed : %s update (%ld => %ld)",
server->serverId.toString().c_str(),
server->verifiedVersion,
server->updateVersion);
}
lastScan.noWorkFoundForEpoch = 0;
}
//////////////////////////////////////////////////////////////////////
// CoordinatorServerList::UpdateServerListRpc Methods
//////////////////////////////////////////////////////////////////////
/**
* Constructor for UpdateServerListRpc that creates but does not send()
* a server list update rpc. It initially accepts one protobuf to ensure
* that the rpc would never be sent empty and provides a convenient way to
* send only a single full list.
*
* After invoking the constructor, it is up to the caller to invoke
* as many appendServerList() calls as necessary to batch up multiple
* updates and follow it up with a send().
*
* \param context
* Overall information about this RAMCloud server.
* \param serverId
* Identifies the server to which this update should be sent.
* \param list
* The complete server list representing all cluster membership.
*/
CoordinatorServerList::UpdateServerListRpc::UpdateServerListRpc(
Context* context,
ServerId serverId,
const ProtoBuf::ServerList* list)
: ServerIdRpcWrapper(context, serverId,
sizeof(WireFormat::UpdateServerList::Response))
{
allocHeader<WireFormat::UpdateServerList>(serverId);
auto* part = new(&request, APPEND)
WireFormat::UpdateServerList::Request::Part();
part->serverListLength = serializeToRequest(&request, list);
}
/**
* Appends a server list update ProtoBuf to the request rpc. This is used
* to batch up multiple server list updates into one rpc for the server and
* can be invoked multiple times on the same rpc.
*
* It is the caller's responsibility invoke send() on the rpc when enough
* updates have been appended and to ensure that this append is invoked only
* when the RPC has not been started yet.
*
* \param list
* ProtoBuf::ServerList to append to the new RPC
* \return
* true if append succeeded, false if it didn't fit in the current rpc
* and has been removed. In the later case, it's time to call send().
*/
bool
CoordinatorServerList::UpdateServerListRpc::appendServerList(
const ProtoBuf::ServerList* list)
{
assert(this->getState() == NOT_STARTED);
uint32_t sizeBefore = request.getTotalLength();
auto* part = new(&request, APPEND)
WireFormat::UpdateServerList::Request::Part();
part->serverListLength = serializeToRequest(&request, list);
uint32_t sizeAfter = request.getTotalLength();
if (sizeAfter > Transport::MAX_RPC_LEN) {
request.truncateEnd(sizeAfter - sizeBefore);
return false;
}
return true;
}
//////////////////////////////////////////////////////////////////////
// CoordinatorServerList::Entry Methods
//////////////////////////////////////////////////////////////////////
/**
* Construct a new Entry, which contains no valid information.
*/
CoordinatorServerList::Entry::Entry()
: ServerDetails()
, masterRecoveryInfo()
, needsRecovery(false)
, verifiedVersion(UNINITIALIZED_VERSION)
, updateVersion(UNINITIALIZED_VERSION)
, logIdServerCrashed(NO_ID)
, logIdServerNeedsRecovery(NO_ID)
, logIdServerRemoveUpdate(NO_ID)
, logIdServerUp(NO_ID)
, logIdServerUpdate(NO_ID)
, logIdServerUpUpdate(NO_ID)
, logIdServerReplicationUpdate(NO_ID)
, logIdServerReplicationUpUpdate(NO_ID)
{
}
/**
* Construct a new Entry, which contains the data a coordinator
* needs to maintain about an enlisted server.
*
* \param serverId
* The ServerId of the server this entry describes.
*
* \param serviceLocator
* The ServiceLocator string that can be used to address this
* entry's server.
*
* \param services
* Which services this server supports.
*/
CoordinatorServerList::Entry::Entry(ServerId serverId,
const string& serviceLocator,
ServiceMask services)
: ServerDetails(serverId,
serviceLocator,
services,
0,
ServerStatus::UP)
, masterRecoveryInfo()
, needsRecovery(false)
, verifiedVersion(UNINITIALIZED_VERSION)
, updateVersion(UNINITIALIZED_VERSION)
, logIdServerCrashed(NO_ID)
, logIdServerNeedsRecovery(NO_ID)
, logIdServerRemoveUpdate(NO_ID)
, logIdServerUp(NO_ID)
, logIdServerUpdate(NO_ID)
, logIdServerUpUpdate(NO_ID)
, logIdServerReplicationUpdate(NO_ID)
, logIdServerReplicationUpUpdate(NO_ID)
{
}
/**
* Serialize this entry into the given ProtoBuf.
*/
void
CoordinatorServerList::Entry::serialize(ProtoBuf::ServerList_Entry& dest) const
{
dest.set_services(services.serialize());
dest.set_server_id(serverId.getId());
dest.set_service_locator(serviceLocator);
dest.set_status(uint32_t(status));
if (isBackup())
dest.set_expected_read_mbytes_per_sec(expectedReadMBytesPerSec);
else
dest.set_expected_read_mbytes_per_sec(0); // Tests expect the field.
dest.set_replication_id(replicationId);
}
} // namespace RAMCloud
| 35.381907
| 81
| 0.658199
|
taschik
|
070e227492af93823042ca32da4c98d057bebc36
| 1,155
|
cpp
|
C++
|
d639.cpp
|
puyuliao/ZJ-d879
|
bead48e0a500f21bc78f745992f137706d15abf8
|
[
"MIT"
] | null | null | null |
d639.cpp
|
puyuliao/ZJ-d879
|
bead48e0a500f21bc78f745992f137706d15abf8
|
[
"MIT"
] | null | null | null |
d639.cpp
|
puyuliao/ZJ-d879
|
bead48e0a500f21bc78f745992f137706d15abf8
|
[
"MIT"
] | null | null | null |
#include <bits/stdc++.h>
#include <stdint.h>
#define IOS {cin.tie(0); ios_base::sync_with_stdio(false);}
using namespace std;
#define MOD 10007
int in[3][1] = {1,1,1};
int a[3][3] = {
{1,1,1},
{1,0,0},
{0,1,0}
};
int ans[3][3];
void smul(int cmd,int n){
int c[n][n];
memset(c,0,sizeof(c));
if(cmd==1){
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
for(int k=0;k<n;k++){
c[i][j] += a[i][k]*ans[k][j];
c[i][j] %= MOD;
}
}
}
memcpy(ans,c,n*n<<2);
}
else{
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
for(int k=0;k<n;k++){
c[i][j] += a[i][k]*a[k][j];
c[i][j] %= MOD;
}
}
}
memcpy(a,c,n*n<<2);
}
}
int main()
{
int n;
cin >> n;
if(n<4) cout << 1;
else{
for(int i=0;i<3;i++) ans[i][i]=1;
int b = n-3;
for(;b;b>>=1){
if(b&1){
smul(1,3);
}
smul(2,3);
}
int tmp[3][1];
memset(tmp,0,sizeof(tmp));
for(int i=0;i<3;i++){
for(int j=0;j<1;j++){
for(int k=0;k<3;k++){
tmp[i][j] += ans[i][k]*in[k][j];
tmp[i][j] %= MOD;
}
}
}
cout << tmp[0][0];
}
return 0;
}
| 15.608108
| 60
| 0.415584
|
puyuliao
|
0718c00818e0f711b465c54464e451619c0c61d2
| 30,427
|
cpp
|
C++
|
src/zimg/graph/filtergraph.cpp
|
dubhater/zimg
|
59ca0556789656a439f32b4cdfc8e26db32b8252
|
[
"WTFPL"
] | null | null | null |
src/zimg/graph/filtergraph.cpp
|
dubhater/zimg
|
59ca0556789656a439f32b4cdfc8e26db32b8252
|
[
"WTFPL"
] | null | null | null |
src/zimg/graph/filtergraph.cpp
|
dubhater/zimg
|
59ca0556789656a439f32b4cdfc8e26db32b8252
|
[
"WTFPL"
] | null | null | null |
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <vector>
#include "common/align.h"
#include "common/alloc.h"
#include "common/except.h"
#include "common/make_unique.h"
#include "common/pixel.h"
#include "common/zassert.h"
#include "basic_filter.h"
#include "filtergraph.h"
#include "image_filter.h"
namespace zimg {
namespace graph {
namespace {
class ColorExtendFilter : public CopyFilter {
bool m_rgb;
public:
ColorExtendFilter(const image_attributes &attr, bool rgb) :
CopyFilter{ attr.width, attr.height, attr.type },
m_rgb{ rgb }
{
}
filter_flags get_flags() const override
{
filter_flags flags = CopyFilter::get_flags();
flags.in_place = false;
flags.color = true;
return flags;
}
void process(void *, const ImageBuffer<const void> src[], const ImageBuffer<void> dst[], void *, unsigned i, unsigned left, unsigned right) const override
{
CopyFilter::process(nullptr, src, dst + 0, nullptr, i, left, right);
if (m_rgb) {
CopyFilter::process(nullptr, src, dst + 1, nullptr, i, left, right);
CopyFilter::process(nullptr, src, dst + 2, nullptr, i, left, right);
}
}
};
class ChromaInitializeFilter : public ImageFilterBase {
image_attributes m_attr;
unsigned m_subsample_w;
unsigned m_subsample_h;
union {
uint8_t b;
uint16_t w;
float f;
} m_value;
template <class T>
void fill(T *ptr, const T &val, unsigned left, unsigned right) const
{
std::fill(ptr + left, ptr + right, val);
}
public:
ChromaInitializeFilter(image_attributes attr, unsigned subsample_w, unsigned subsample_h, unsigned depth) :
m_attr{ attr.width >> subsample_w, attr.height >> subsample_h, attr.type },
m_subsample_w{ subsample_w },
m_subsample_h{ subsample_h },
m_value{}
{
if (attr.type == PixelType::BYTE)
m_value.b = static_cast<uint8_t>(1U << (depth - 1));
else if (attr.type == PixelType::WORD)
m_value.w = static_cast<uint8_t>(1U << (depth - 1));
else if (attr.type == PixelType::HALF)
m_value.w = 0;
else if (attr.type == PixelType::FLOAT)
m_value.f = 0.0f;
}
filter_flags get_flags() const override
{
filter_flags flags{};
flags.same_row = true;
flags.in_place = true;
return flags;
}
image_attributes get_image_attributes() const override
{
return m_attr;
}
pair_unsigned get_required_row_range(unsigned i) const
{
return{ i << m_subsample_h, (i + 1) << m_subsample_h };
}
pair_unsigned get_required_col_range(unsigned left, unsigned right) const
{
return{ left << m_subsample_w, right << m_subsample_w };
}
void process(void *, const ImageBuffer<const void> src[], const ImageBuffer<void> dst[], void *, unsigned i, unsigned left, unsigned right) const override
{
void *dst_p = (*dst)[i];
if (m_attr.type == PixelType::BYTE)
fill(static_cast<uint8_t *>(dst_p), m_value.b, left, right);
else if (m_attr.type == PixelType::WORD || m_attr.type == PixelType::HALF)
fill(static_cast<uint16_t *>(dst_p), m_value.w, left, right);
else if (m_attr.type == PixelType::FLOAT)
fill(static_cast<float *>(dst_p), m_value.f, left, right);
}
};
class SimulationState {
std::vector<unsigned> m_cache_pos;
public:
explicit SimulationState(unsigned size) : m_cache_pos(size)
{
}
unsigned &pos(unsigned id)
{
return m_cache_pos[id];
}
};
class ExecutionState {
LinearAllocator m_alloc;
const ImageBuffer<const void> *m_src_buf;
const ImageBuffer<void> *m_dst_buf;
FilterGraph::callback m_unpack_cb;
FilterGraph::callback m_pack_cb;
void **m_context_table;
void *m_base;
public:
ExecutionState(unsigned id_counter, const ImageBuffer<const void> src_buf[], const ImageBuffer<void> dst_buf[], void *pool,
FilterGraph::callback unpack_cb, FilterGraph::callback pack_cb) :
m_alloc{ pool },
m_src_buf{ src_buf },
m_dst_buf{ dst_buf },
m_unpack_cb{ unpack_cb },
m_pack_cb{ pack_cb },
m_context_table{},
m_base{ pool }
{
m_context_table = m_alloc.allocate_n<void *>(id_counter);
std::fill_n(m_context_table, id_counter, nullptr);
}
void *alloc_context(unsigned id, size_t size)
{
_zassert(!m_context_table[id], "context already allocated");
m_context_table[id] = m_alloc.allocate(size);
return m_context_table[id];
}
void *get_context(unsigned id) const
{
return m_context_table[id];
}
const ImageBuffer<const void> *get_input_buffer() const
{
return m_src_buf;
}
const ImageBuffer<void> *get_output_buffer() const
{
return m_dst_buf;
}
void *get_tmp() const
{
return static_cast<char *>(m_base) + m_alloc.count();
}
FilterGraph::callback get_unpack_cb() const
{
return m_unpack_cb;
}
FilterGraph::callback get_pack_cb() const
{
return m_pack_cb;
}
static size_t context_table_size(unsigned id_counter)
{
return ceil_n(sizeof(void *) * id_counter, ALIGNMENT);
}
};
class GraphNode {
protected:
struct node_context {
static const uint64_t GUARD_PATTERN = 0xDEADBEEFDEADBEEFULL;
const uint64_t guard_pattern = GUARD_PATTERN;
unsigned cache_pos;
unsigned source_left;
unsigned source_right;
void assert_guard_pattern() const
{
_zassert(guard_pattern == GUARD_PATTERN, "buffer overflow detected");
}
};
private:
unsigned m_id;
unsigned m_ref_count;
unsigned m_cache_lines;
protected:
GraphNode(unsigned id) :
m_id{ id },
m_ref_count{},
m_cache_lines{}
{
}
unsigned get_id() const
{
return m_id;
}
unsigned get_real_cache_lines() const
{
return get_cache_lines() == BUFFER_MAX ? get_image_attributes(false).height : get_cache_lines();
}
ptrdiff_t get_cache_stride() const
{
auto attr = get_image_attributes(false);
return ceil_n(attr.width * pixel_size(attr.type), ALIGNMENT);
}
void set_cache_lines(unsigned n)
{
if (n > m_cache_lines) {
if (n >= get_image_attributes().height)
m_cache_lines = BUFFER_MAX;
else
m_cache_lines = select_zimg_buffer_mask(n) + 1;
}
}
void init_context_base(node_context *ctx) const
{
ctx->cache_pos = 0;
ctx->source_left = 0;
ctx->source_right = 0;
}
void reset_context_base(node_context *ctx) const
{
auto attr = get_image_attributes(false);
ctx->cache_pos = 0;
ctx->source_left = attr.width;
ctx->source_right = 0;
}
public:
virtual ~GraphNode() = default;
unsigned add_ref()
{
return ++m_ref_count;
}
unsigned get_ref() const
{
return m_ref_count;
}
unsigned get_cache_lines() const
{
return m_cache_lines;
}
virtual ImageFilter::image_attributes get_image_attributes(bool uv = false) const = 0;
virtual bool entire_row() const = 0;
virtual void simulate(SimulationState *sim, unsigned first, unsigned last, bool uv = false) = 0;
virtual size_t get_context_size() const = 0;
virtual size_t get_tmp_size(unsigned left, unsigned right) const = 0;
virtual void init_context(ExecutionState *state) const = 0;
virtual void reset_context(ExecutionState *state) const = 0;
virtual void set_tile_region(ExecutionState *state, unsigned left, unsigned right, bool uv) const = 0;
virtual const ImageBuffer<const void> *generate_line(ExecutionState *state, const ImageBuffer<void> *external, unsigned i, bool uv) const = 0;
};
class SourceNode final : public GraphNode {
ImageFilter::image_attributes m_attr;
unsigned m_subsample_w;
unsigned m_subsample_h;
bool m_color;
public:
SourceNode(unsigned id, unsigned width, unsigned height, PixelType type, unsigned subsample_w, unsigned subsample_h, bool color) :
GraphNode(id),
m_attr{ width, height, type },
m_subsample_w{ subsample_w },
m_subsample_h{ subsample_h },
m_color{ color }
{
}
ImageFilter::image_attributes get_image_attributes(bool uv) const override
{
auto attr = m_attr;
if (uv) {
attr.width >>= m_subsample_w;
attr.height >>= m_subsample_h;
}
return attr;
}
bool entire_row() const override
{
return false;
}
void simulate(SimulationState *sim, unsigned first, unsigned last, bool uv) override
{
unsigned step = 1 << m_subsample_h;
unsigned pos = sim->pos(get_id());
first <<= uv ? m_subsample_h : 0;
last <<= uv ? m_subsample_h : 0;
if (pos < last)
pos = floor_n(last - 1, step) + step;
sim->pos(get_id()) = pos;
set_cache_lines(pos - first);
}
size_t get_context_size() const override
{
return ceil_n(sizeof(node_context), zimg::ALIGNMENT);
}
size_t get_tmp_size(unsigned left, unsigned right) const override
{
return 0;
}
void init_context(ExecutionState *state) const override
{
size_t context_size = get_context_size();
LinearAllocator alloc{ state->alloc_context(get_id(), get_context_size()) };
node_context *context = new (alloc.allocate_n<node_context>(1)) node_context{};
init_context_base(context);
_zassert(alloc.count() <= context_size, "buffer overflow detected");
_zassert_d(alloc.count() == context_size, "allocation mismatch");
}
void reset_context(ExecutionState *state) const override
{
node_context *context = static_cast<node_context *>(state->get_context(get_id()));
reset_context_base(context);
}
void set_tile_region(ExecutionState *state, unsigned left, unsigned right, bool uv) const override
{
node_context *context = static_cast<node_context *>(state->get_context(get_id()));
context->assert_guard_pattern();
if (uv) {
left <<= m_subsample_w;
right <<= m_subsample_w;
}
context->source_left = std::min(context->source_left, left);
context->source_right = std::max(context->source_right, right);
}
const ImageBuffer<const void> *generate_line(ExecutionState *state, const ImageBuffer<void> *external, unsigned i, bool uv) const override
{
node_context *context = static_cast<node_context *>(state->get_context(get_id()));
context->assert_guard_pattern();
unsigned step = 1 << m_subsample_h;
unsigned line = uv ? i * step : i;
unsigned pos = context->cache_pos;
if (line >= pos) {
if (state->get_unpack_cb()) {
for (; pos <= line; pos += step) {
state->get_unpack_cb()(pos, context->source_left, context->source_right);
}
} else {
pos = floor_n(line, step) + step;
}
context->cache_pos = pos;
}
return static_buffer_cast<const void>(state->get_input_buffer());
}
};
class FilterNode final : public GraphNode {
struct node_context : public GraphNode::node_context {
void *filter_ctx;
ImageBuffer<void> cache_buf[3];
};
std::unique_ptr<ImageFilter> m_filter;
ImageFilter::filter_flags m_flags;
GraphNode *m_parent;
GraphNode *m_parent_uv;
unsigned m_step;
unsigned get_num_planes() const
{
return m_flags.color ? 3U : 1U;
}
public:
FilterNode(unsigned id, std::unique_ptr<ImageFilter> &&filter, GraphNode *parent, GraphNode *parent_uv) :
GraphNode(id),
m_flags(filter->get_flags()),
m_parent{ parent },
m_parent_uv{ parent_uv },
m_step{ filter->get_simultaneous_lines() }
{
m_filter = std::move(filter);
}
ImageFilter::image_attributes get_image_attributes(bool) const override
{
return m_filter->get_image_attributes();
}
bool entire_row() const override
{
return m_flags.entire_row || m_parent->entire_row() || (m_parent_uv && m_parent_uv->entire_row());
}
void simulate(SimulationState *sim, unsigned first, unsigned last, bool) override
{
unsigned pos = sim->pos(get_id());
for (; pos < last; pos += m_step) {
auto range = m_filter->get_required_row_range(pos);
m_parent->simulate(sim, range.first, range.second, false);
if (m_parent_uv)
m_parent_uv->simulate(sim, range.first, range.second, true);
}
sim->pos(get_id()) = pos;
set_cache_lines(pos - first);
}
size_t get_context_size() const override
{
FakeAllocator alloc;
alloc.allocate_n<node_context>(1);
unsigned num_planes = get_num_planes();
unsigned cache_lines = get_real_cache_lines();
ptrdiff_t stride = get_cache_stride();
alloc.allocate((size_t)num_planes * cache_lines * stride);
alloc.allocate(m_filter->get_context_size());
return alloc.count();
}
size_t get_tmp_size(unsigned left, unsigned right) const override
{
size_t tmp_size = 0;
auto range = m_filter->get_required_col_range(left, right);
tmp_size = std::max(tmp_size, m_filter->get_tmp_size(left, right));
tmp_size = std::max(tmp_size, m_parent->get_tmp_size(range.first, range.second));
if (m_parent_uv)
tmp_size = std::max(tmp_size, m_parent_uv->get_tmp_size(range.first, range.second));
return tmp_size;
}
void init_context(ExecutionState *state) const override
{
size_t context_size = get_context_size();
LinearAllocator alloc{ state->alloc_context(get_id(), context_size) };
node_context *context = new (alloc.allocate_n<node_context>(1)) node_context{};
init_context_base(context);
ptrdiff_t stride = get_cache_stride();
unsigned cache_lines = get_real_cache_lines();
unsigned mask = select_zimg_buffer_mask(get_cache_lines());
context->filter_ctx = alloc.allocate(m_filter->get_context_size());
for (unsigned p = 0; p < get_num_planes(); ++p) {
context->cache_buf[p] = ImageBuffer<void>{ alloc.allocate((size_t)cache_lines * stride), stride, mask };
}
_zassert(alloc.count() <= context_size, "buffer overflow detected");
_zassert_d(alloc.count() == context_size, "allocation mismatch");
}
void reset_context(ExecutionState *state) const override
{
node_context *context = static_cast<node_context *>(state->get_context(get_id()));
reset_context_base(context);
m_filter->init_context(context->filter_ctx);
}
void set_tile_region(ExecutionState *state, unsigned left, unsigned right, bool uv) const override
{
node_context *context = static_cast<node_context *>(state->get_context(get_id()));
context->assert_guard_pattern();
auto range = m_filter->get_required_col_range(left, right);
m_parent->set_tile_region(state, range.first, range.second, false);
if (m_parent_uv)
m_parent_uv->set_tile_region(state, range.first, range.second, true);
context->source_left = std::min(context->source_left, left);
context->source_right = std::max(context->source_right, right);
}
const ImageBuffer<const void> *generate_line(ExecutionState *state, const ImageBuffer<void> *external, unsigned i, bool uv) const override
{
node_context *context = static_cast<node_context *>(state->get_context(get_id()));
context->assert_guard_pattern();
const ImageBuffer<void> *output_buffer = external ? external : context->cache_buf;
unsigned pos = context->cache_pos;
for (; pos <= i; pos += m_step) {
const ImageBuffer<const void> *input_buffer = nullptr;
const ImageBuffer<const void> *input_buffer_uv = nullptr;
auto range = m_filter->get_required_row_range(pos);
_zassert_d(range.first < range.second, "bad row range");
for (unsigned ii = range.first; ii < range.second; ++ii) {
input_buffer = m_parent->generate_line(state, nullptr, ii, false);
if (m_parent_uv)
input_buffer_uv = m_parent_uv->generate_line(state, nullptr, ii, true);
}
if (m_parent_uv) {
ImageBuffer<const void> input_buffer_yuv[3] = { input_buffer[0], input_buffer_uv[1], input_buffer_uv[2] };
m_filter->process(context->filter_ctx, input_buffer_yuv, output_buffer, state->get_tmp(), pos, context->source_left, context->source_right);
} else {
m_filter->process(context->filter_ctx, input_buffer, output_buffer, state->get_tmp(), pos, context->source_left, context->source_right);
}
}
context->cache_pos = pos;
return static_buffer_cast<const void>(output_buffer);
}
};
class FilterNodeUV final : public GraphNode {
struct node_context : public GraphNode::node_context {
void *filter_ctx_u;
void *filter_ctx_v;
ImageBuffer<void> cache_buf[3];
};
std::unique_ptr<ImageFilter> m_filter;
ImageFilter::filter_flags m_flags;
GraphNode *m_parent;
unsigned m_step;
unsigned get_num_planes() const
{
return 2;
}
public:
FilterNodeUV(unsigned id, std::unique_ptr<ImageFilter> &&filter, GraphNode *parent) :
GraphNode(id),
m_flags(filter->get_flags()),
m_parent{ parent },
m_step{ filter->get_simultaneous_lines() }
{
m_filter = std::move(filter);
}
ImageFilter::image_attributes get_image_attributes(bool) const override
{
return m_filter->get_image_attributes();
}
bool entire_row() const override
{
return m_flags.entire_row || m_parent->entire_row();
}
void simulate(SimulationState *sim, unsigned first, unsigned last, bool) override
{
unsigned pos = sim->pos(get_id());
for (; pos < last; pos += m_step) {
auto range = m_filter->get_required_row_range(pos);
m_parent->simulate(sim, range.first, range.second, true);
}
sim->pos(get_id()) = pos;
set_cache_lines(pos - first);
}
size_t get_context_size() const override
{
FakeAllocator alloc;
alloc.allocate_n<node_context>(1);
unsigned num_planes = get_num_planes();
unsigned cache_lines = get_real_cache_lines();
ptrdiff_t stride = get_cache_stride();
alloc.allocate((size_t)num_planes * cache_lines * stride);
alloc.allocate(m_filter->get_context_size());
alloc.allocate(m_filter->get_context_size());
return alloc.count();
}
size_t get_tmp_size(unsigned left, unsigned right) const override
{
size_t tmp_size = 0;
auto range = m_filter->get_required_col_range(left, right);
tmp_size = std::max(tmp_size, m_filter->get_tmp_size(left, right));
tmp_size = std::max(tmp_size, m_parent->get_tmp_size(range.first, range.second));
return tmp_size;
}
void init_context(ExecutionState *state) const override
{
size_t context_size = get_context_size();
LinearAllocator alloc{ state->alloc_context(get_id(), context_size) };
node_context *context = new (alloc.allocate_n<node_context>(1)) node_context{};
init_context_base(context);
ptrdiff_t stride = get_cache_stride();
unsigned cache_lines = get_real_cache_lines();
unsigned mask = select_zimg_buffer_mask(get_cache_lines());
context->filter_ctx_u = alloc.allocate(m_filter->get_context_size());
context->filter_ctx_v = alloc.allocate(m_filter->get_context_size());
context->cache_buf[1] = ImageBuffer<void>{ alloc.allocate((size_t)cache_lines * stride), stride, mask };
context->cache_buf[2] = ImageBuffer<void>{ alloc.allocate((size_t)cache_lines * stride), stride, mask };
_zassert(alloc.count() <= context_size, "buffer overflow detected");
_zassert_d(alloc.count() == context_size, "allocation mismatch");
}
void reset_context(ExecutionState *state) const override
{
node_context *context = static_cast<node_context *>(state->get_context(get_id()));
reset_context_base(context);
m_filter->init_context(context->filter_ctx_u);
m_filter->init_context(context->filter_ctx_v);
}
void set_tile_region(ExecutionState *state, unsigned left, unsigned right, bool uv) const override
{
node_context *context = static_cast<node_context *>(state->get_context(get_id()));
context->assert_guard_pattern();
auto range = m_filter->get_required_col_range(left, right);
m_parent->set_tile_region(state, range.first, range.second, true);
context->source_left = std::min(context->source_left, left);
context->source_right = std::max(context->source_right, right);
}
const ImageBuffer<const void> *generate_line(ExecutionState *state, const ImageBuffer<void> *external, unsigned i, bool uv) const override
{
node_context *context = static_cast<node_context *>(state->get_context(get_id()));
context->assert_guard_pattern();
const ImageBuffer<void> *output_buffer = external ? external : context->cache_buf;
unsigned pos = context->cache_pos;
for (; pos <= i; pos += m_step) {
const ImageBuffer<const void> *input_buffer = nullptr;
auto range = m_filter->get_required_row_range(pos);
_zassert_d(range.first < range.second, "bad row range");
for (unsigned ii = range.first; ii < range.second; ++ii) {
input_buffer = m_parent->generate_line(state, nullptr, ii, true);
}
m_filter->process(context->filter_ctx_u, input_buffer + 1, output_buffer + 1, state->get_tmp(), pos, context->source_left, context->source_right);
m_filter->process(context->filter_ctx_v, input_buffer + 2, output_buffer + 2, state->get_tmp(), pos, context->source_left, context->source_right);
}
context->cache_pos = pos;
return static_buffer_cast<const void>(output_buffer);
}
};
} // namespace
class FilterGraph::impl {
static const unsigned HORIZONTAL_STEP = 512;
static const unsigned TILE_MIN = 64;
std::vector<std::unique_ptr<GraphNode>> m_node_set;
GraphNode *m_head;
GraphNode *m_node;
GraphNode *m_node_uv;
unsigned m_id_counter;
unsigned m_subsample_w;
unsigned m_subsample_h;
bool m_is_complete;
unsigned get_horizontal_step() const
{
auto head_attr = m_head->get_image_attributes();
auto tail_attr = m_node->get_image_attributes();
bool entire_row = m_node->entire_row() || (m_node_uv && m_node_uv->entire_row());
if (!entire_row) {
double scale = std::max((double)tail_attr.width / head_attr.width, 1.0);
unsigned step = floor_n((unsigned)std::lrint(HORIZONTAL_STEP * scale), ALIGNMENT);
return std::min(step, tail_attr.width);
} else {
return tail_attr.width;
}
}
void check_incomplete() const
{
if (m_is_complete)
throw error::InternalError{ "cannot modify completed graph" };
}
void check_complete() const
{
if (!m_is_complete)
throw error::InternalError{ "cannot query properties on incomplete graph" };
}
public:
impl(unsigned width, unsigned height, PixelType type, unsigned subsample_w, unsigned subsample_h, bool color) :
m_head{},
m_node{},
m_node_uv{},
m_id_counter{},
m_subsample_w{},
m_subsample_h{},
m_is_complete{}
{
if (!color && (subsample_w || subsample_h))
throw error::InternalError{ "greyscale images can not be subsampled" };
if (subsample_w > 2 || subsample_h > 2)
throw error::UnsupportedSubsampling{ "subsampling factor must not exceed 4" };
m_node_set.emplace_back(
ztd::make_unique<SourceNode>(m_id_counter++, width, height, type, subsample_w, subsample_h, color));
m_head = m_node_set.back().get();
m_node = m_head;
if (color)
m_node_uv = m_head;
}
void attach_filter(std::unique_ptr<ImageFilter> &&filter)
{
check_incomplete();
ImageFilter::filter_flags flags = filter->get_flags();
GraphNode *parent = m_node;
GraphNode *parent_uv = nullptr;
if (flags.color) {
auto attr = m_node->get_image_attributes();
auto attr_uv = m_node->get_image_attributes();
if (!m_node_uv)
throw error::InternalError{ "cannot use color filter in greyscale graph" };
if (attr.width != attr_uv.width || attr.height != attr_uv.height || attr.type != attr_uv.type)
throw error::InternalError{ "cannot use color filter with mismatching Y and UV format" };
parent_uv = m_node_uv;
}
m_node_set.reserve(m_node_set.size() + 1);
m_node_set.emplace_back(
ztd::make_unique<FilterNode>(m_id_counter++, std::move(filter), parent, parent_uv));
m_node = m_node_set.back().get();
parent->add_ref();
if (parent_uv)
parent_uv->add_ref();
if (flags.color)
m_node_uv = m_node;
}
void attach_filter_uv(std::unique_ptr<ImageFilter> &&filter)
{
check_incomplete();
if (filter->get_flags().color)
throw error::InternalError{ "cannot use color filter as UV filter" };
GraphNode *parent = m_node_uv;
m_node_set.reserve(m_node_set.size() + 1);
m_node_set.emplace_back(
ztd::make_unique<FilterNodeUV>(m_id_counter++, std::move(filter), parent));
m_node_uv = m_node_set.back().get();
parent->add_ref();
}
void color_to_grey()
{
check_incomplete();
if (!m_node_uv)
throw error::InternalError{ "cannot remove chroma from greyscale image" };
ImageFilter::image_attributes attr = m_node->get_image_attributes();
GraphNode *parent = m_node;
m_node_set.reserve(m_node_set.size() + 1);
m_node_set.emplace_back(
ztd::make_unique<FilterNode>(m_id_counter++, ztd::make_unique<CopyFilter>(attr.width, attr.height, attr.type), parent, nullptr));
m_node = m_node_set.back().get();
m_node_uv = nullptr;
parent->add_ref();
}
void grey_to_color(bool yuv, unsigned subsample_w, unsigned subsample_h, unsigned depth)
{
check_incomplete();
if (m_node_uv)
throw error::InternalError{ "cannot add chroma to color image" };
ImageFilter::image_attributes attr = m_node->get_image_attributes();
GraphNode *parent = m_node;
m_node_set.emplace_back(
ztd::make_unique<FilterNode>(m_id_counter++, ztd::make_unique<ColorExtendFilter>(attr, !yuv), parent, nullptr));
m_node = m_node_set.back().get();
m_node_uv = m_node;
parent->add_ref();
if (yuv)
attach_filter_uv(ztd::make_unique<ChromaInitializeFilter>(attr, subsample_w, subsample_h, depth));
}
void complete()
{
check_incomplete();
auto node_attr = m_node->get_image_attributes(false);
auto node_attr_uv = m_node_uv ? m_node_uv->get_image_attributes(true) : node_attr;
unsigned subsample_w = 0;
unsigned subsample_h = 0;
for (unsigned ss = 0; ss < 3; ++ss) {
if (node_attr.width == node_attr_uv.width << ss)
subsample_w = ss;
if (node_attr.height == node_attr_uv.height << ss)
subsample_h = ss;
}
if (node_attr.width != node_attr_uv.width << subsample_w)
throw error::InternalError{ "unsupported horizontal subsampling" };
if (node_attr.height != node_attr_uv.height << subsample_h)
throw error::InternalError{ "unsupported vertical subsampling" };
if (node_attr.type != node_attr_uv.type)
throw error::InternalError{ "UV pixel type can not differ" };
if (m_node == m_head || m_node->get_ref())
attach_filter(ztd::make_unique<CopyFilter>(node_attr.width, node_attr.height, node_attr.type));
if (m_node_uv && (m_node_uv == m_head || m_node_uv->get_ref()))
attach_filter_uv(ztd::make_unique<CopyFilter>(node_attr_uv.width, node_attr_uv.height, node_attr_uv.type));
SimulationState sim{ m_id_counter };
for (unsigned i = 0; i < node_attr.height; i += (1 << subsample_h)) {
m_node->simulate(&sim, i, i + (1 << subsample_h));
if (m_node_uv)
m_node_uv->simulate(&sim, i >> subsample_h, (i >> subsample_h) + 1, true);
}
m_subsample_w = subsample_w;
m_subsample_h = subsample_h;
m_is_complete = true;
}
size_t get_tmp_size() const
{
check_complete();
auto attr = m_node->get_image_attributes();
unsigned step = get_horizontal_step();
FakeAllocator alloc;
size_t tmp_size = 0;
alloc.allocate(ExecutionState::context_table_size(m_id_counter));
for (const auto &node : m_node_set) {
alloc.allocate(node->get_context_size());
}
for (unsigned j = 0; j < attr.width; j += step) {
unsigned j_end = std::min(j + step, attr.width);
if (attr.width - j_end < TILE_MIN) {
j_end = attr.width;
step = attr.width - j;
}
tmp_size = std::max(tmp_size, m_node->get_tmp_size(j, j_end));
if (m_node_uv)
tmp_size = std::max(tmp_size, m_node_uv->get_tmp_size(j >> m_subsample_w, j_end >> m_subsample_w));
}
alloc.allocate(tmp_size);
return alloc.count();
}
unsigned get_input_buffering() const
{
check_complete();
return m_head->get_cache_lines();
}
unsigned get_output_buffering() const
{
check_complete();
unsigned lines = m_node->get_cache_lines();
if (m_node_uv) {
unsigned lines_uv = m_node_uv->get_cache_lines();
lines_uv = (lines_uv == BUFFER_MAX) ? lines_uv : lines_uv << m_subsample_h;
lines = std::max(lines, lines_uv);
}
return lines;
}
void process(const ImageBuffer<const void> src[], const ImageBuffer<void> dst[], void *tmp, callback unpack_cb, callback pack_cb) const
{
check_complete();
ExecutionState state{ m_id_counter, src, dst, tmp, unpack_cb, pack_cb };
auto attr = m_node->get_image_attributes();
unsigned h_step = get_horizontal_step();
unsigned v_step = 1 << m_subsample_h;
for (const auto &node : m_node_set) {
node->init_context(&state);
}
for (unsigned j = 0; j < attr.width; j += h_step) {
unsigned j_end = std::min(j + h_step, attr.width);
if (attr.width - j_end < TILE_MIN) {
j_end = attr.width;
h_step = attr.width - j;
}
for (const auto &node : m_node_set) {
node->reset_context(&state);
}
m_node->set_tile_region(&state, j, j_end, false);
if (m_node_uv)
m_node_uv->set_tile_region(&state, j >> m_subsample_w, j_end >> m_subsample_w, true);
for (unsigned i = 0; i < attr.height; i += v_step) {
for (unsigned ii = i; ii < i + v_step; ++ii) {
m_node->generate_line(&state, state.get_output_buffer(), ii, false);
}
if (m_node_uv)
m_node_uv->generate_line(&state, state.get_output_buffer(), i / v_step, true);
if (state.get_pack_cb())
state.get_pack_cb()(i, j, j_end);
}
}
}
};
FilterGraph::callback::callback(std::nullptr_t) :
m_func{},
m_user{}
{
}
FilterGraph::callback::callback(func_type func, void *user) :
m_func{ func },
m_user{ user }
{
}
FilterGraph::callback::operator bool() const
{
return m_func != nullptr;
}
void FilterGraph::callback::operator()(unsigned i, unsigned left, unsigned right) const
{
if (m_func(m_user, i, left, right))
throw error::UserCallbackFailed{ "user callback failed" };
}
FilterGraph::FilterGraph(unsigned width, unsigned height, PixelType type, unsigned subsample_w, unsigned subsample_h, bool color) :
m_impl{ ztd::make_unique<impl>(width, height, type, subsample_w, subsample_h, color) }
{
}
FilterGraph::FilterGraph(FilterGraph &&other) = default;
FilterGraph::~FilterGraph() = default;
FilterGraph &FilterGraph::operator=(FilterGraph &&other) = default;
void FilterGraph::attach_filter(std::unique_ptr<ImageFilter> &&filter)
{
m_impl->attach_filter(std::move(filter));
}
void FilterGraph::attach_filter_uv(std::unique_ptr<ImageFilter> &&filter)
{
m_impl->attach_filter_uv(std::move(filter));
}
void FilterGraph::color_to_grey()
{
m_impl->color_to_grey();
}
void FilterGraph::grey_to_color(bool yuv, unsigned subsample_w, unsigned subsample_h, unsigned depth)
{
m_impl->grey_to_color(yuv, subsample_w, subsample_h, depth);
}
void FilterGraph::complete()
{
m_impl->complete();
}
size_t FilterGraph::get_tmp_size() const
{
return m_impl->get_tmp_size();
}
unsigned FilterGraph::get_input_buffering() const
{
return m_impl->get_input_buffering();
}
unsigned FilterGraph::get_output_buffering() const
{
return m_impl->get_output_buffering();
}
void FilterGraph::process(const ImageBuffer<const void> *src, const ImageBuffer<void> *dst, void *tmp, callback unpack_cb, callback pack_cb) const
{
m_impl->process(src, dst, tmp, unpack_cb, pack_cb);
}
} // namespace graph
} // namespace zimg
| 27.166964
| 155
| 0.717685
|
dubhater
|
071acf7b15d940c30e26b7e142a93f1d516e8f91
| 2,272
|
hpp
|
C++
|
android-28/android/widget/NumberPicker.hpp
|
YJBeetle/QtAndroidAPI
|
1468b5dc6eafaf7709f0b00ba1a6ec2b70684266
|
[
"Apache-2.0"
] | 12
|
2020-03-26T02:38:56.000Z
|
2022-03-14T08:17:26.000Z
|
android-28/android/widget/NumberPicker.hpp
|
YJBeetle/QtAndroidAPI
|
1468b5dc6eafaf7709f0b00ba1a6ec2b70684266
|
[
"Apache-2.0"
] | 1
|
2021-01-27T06:07:45.000Z
|
2021-11-13T19:19:43.000Z
|
android-28/android/widget/NumberPicker.hpp
|
YJBeetle/QtAndroidAPI
|
1468b5dc6eafaf7709f0b00ba1a6ec2b70684266
|
[
"Apache-2.0"
] | 3
|
2021-02-02T12:34:55.000Z
|
2022-03-08T07:45:57.000Z
|
#pragma once
#include "./LinearLayout.hpp"
class JArray;
namespace android::content
{
class Context;
}
namespace android::graphics
{
class Canvas;
}
namespace android::view
{
class KeyEvent;
}
namespace android::view
{
class MotionEvent;
}
namespace android::view::accessibility
{
class AccessibilityNodeProvider;
}
namespace android::widget
{
class NumberPicker : public android::widget::LinearLayout
{
public:
// Fields
// QJniObject forward
template<typename ...Ts> explicit NumberPicker(const char *className, const char *sig, Ts...agv) : android::widget::LinearLayout(className, sig, std::forward<Ts>(agv)...) {}
NumberPicker(QJniObject obj);
// Constructors
NumberPicker(android::content::Context arg0);
NumberPicker(android::content::Context arg0, JObject arg1);
NumberPicker(android::content::Context arg0, JObject arg1, jint arg2);
NumberPicker(android::content::Context arg0, JObject arg1, jint arg2, jint arg3);
// Methods
void computeScroll() const;
jboolean dispatchKeyEvent(android::view::KeyEvent arg0) const;
jboolean dispatchTouchEvent(android::view::MotionEvent arg0) const;
jboolean dispatchTrackballEvent(android::view::MotionEvent arg0) const;
android::view::accessibility::AccessibilityNodeProvider getAccessibilityNodeProvider() const;
JArray getDisplayedValues() const;
jint getMaxValue() const;
jint getMinValue() const;
jint getSolidColor() const;
jint getValue() const;
jboolean getWrapSelectorWheel() const;
void jumpDrawablesToCurrentState() const;
jboolean onInterceptTouchEvent(android::view::MotionEvent arg0) const;
jboolean onTouchEvent(android::view::MotionEvent arg0) const;
jboolean performClick() const;
jboolean performLongClick() const;
void scrollBy(jint arg0, jint arg1) const;
void setDisplayedValues(JArray arg0) const;
void setEnabled(jboolean arg0) const;
void setFormatter(JObject arg0) const;
void setMaxValue(jint arg0) const;
void setMinValue(jint arg0) const;
void setOnLongPressUpdateInterval(jlong arg0) const;
void setOnScrollListener(JObject arg0) const;
void setOnValueChangedListener(JObject arg0) const;
void setValue(jint arg0) const;
void setWrapSelectorWheel(jboolean arg0) const;
};
} // namespace android::widget
| 30.293333
| 175
| 0.766285
|
YJBeetle
|
071ca975acd4d8f19bb9c6e09446bbd8b9f07cc6
| 3,285
|
hh
|
C++
|
packages/Alea/mc_solvers/ForwardMcKernel.hh
|
GCZhang/Profugus
|
d4d8fe295a92a257b26b6082224226ca1edbff5d
|
[
"BSD-2-Clause"
] | 19
|
2015-06-04T09:02:41.000Z
|
2021-04-27T19:32:55.000Z
|
packages/Alea/mc_solvers/ForwardMcKernel.hh
|
GCZhang/Profugus
|
d4d8fe295a92a257b26b6082224226ca1edbff5d
|
[
"BSD-2-Clause"
] | null | null | null |
packages/Alea/mc_solvers/ForwardMcKernel.hh
|
GCZhang/Profugus
|
d4d8fe295a92a257b26b6082224226ca1edbff5d
|
[
"BSD-2-Clause"
] | 5
|
2016-10-05T20:48:28.000Z
|
2021-06-21T12:00:54.000Z
|
//----------------------------------*-C++-*----------------------------------//
/*!
* \file Alea/mc_solvers/ForwardMcKernel.hh
* \author Steven Hamilton
* \brief Perform adjoint MC histories to solve linear system.
*/
//---------------------------------------------------------------------------//
#ifndef Alea_mc_solvers_ForwardMcKernel_hh
#define Alea_mc_solvers_ForwardMcKernel_hh
#include "MC_Data.hh"
#include "AleaSolver.hh"
#include "Teuchos_RCP.hpp"
#include "Teuchos_ParameterList.hpp"
#include "Teuchos_ArrayView.hpp"
#include "Kokkos_Parallel.hpp"
#include "AleaTypedefs.hh"
namespace alea
{
//---------------------------------------------------------------------------//
/*!
* \class ForwardMcKernel
* \brief Perform Monte Carlo random walks on linear system.
*
* This class performs random walks using the forward Monte Carlo algorithm.
* The interface of this function conforms to the Kokkos "parallel_reduce"
* functor API to enable automated shared memory parallelism over MC histories.
*/
//---------------------------------------------------------------------------//
class ForwardMcKernel
{
public:
// Required typedefs for Kokkos functor API
//! Type of device where kernel will be executed
typedef Kokkos::TeamPolicy<DEVICE> policy_type;
typedef policy_type::member_type member_type;
ForwardMcKernel(const Teuchos::ArrayView<const Teuchos::ArrayView<const SCALAR> > P,
const Teuchos::ArrayView<const Teuchos::ArrayView<const SCALAR> > W,
const Teuchos::ArrayView<const Teuchos::ArrayView<const LO> > inds,
const Teuchos::ArrayView<const SCALAR> coeffs,
const LO local_length,
const Teuchos::ArrayView<const SCALAR> x,
const Teuchos::ArrayView<SCALAR> y,
const int histories_per_state,
bool print);
// Kokkos "parallel_for" API functions
//! \brief Compute kernel
KOKKOS_INLINE_FUNCTION
void operator()(member_type member) const;
private:
inline void getNewRow(const GO state,
Teuchos::ArrayView<const SCALAR> &p_vals,
Teuchos::ArrayView<const SCALAR> &w_vals,
Teuchos::ArrayView<const LO> &inds) const;
inline GO getNewState(const Teuchos::ArrayView<const SCALAR> cdf,
const int thread ) const;
const LO d_local_length;
// Warning, these are non reference-counted views
// The underlying reference-counted objects from which they were
// created must stay alive for the entire life of this object
const Teuchos::ArrayView<const Teuchos::ArrayView<const SCALAR> > d_P;
const Teuchos::ArrayView<const Teuchos::ArrayView<const SCALAR> > d_W;
const Teuchos::ArrayView<const Teuchos::ArrayView<const LO> > d_inds;
const Teuchos::ArrayView<const SCALAR> d_coeffs;
const Teuchos::ArrayView<const SCALAR> d_x;
const Teuchos::ArrayView<SCALAR> d_y;
//const ThreadedRNG d_rng;
const int d_histories_per_state;
const bool d_print;
const int d_max_history_length;
};
} // namespace alea
#include "ForwardMcKernel.i.hh"
#endif // Alea_mc_solvers_ForwardMcKernel_hh
| 33.865979
| 88
| 0.620091
|
GCZhang
|
071d364afaa90c88adc4731ad4709eb2f3b9a775
| 9,643
|
cpp
|
C++
|
SinkTheFleet/SinkTheFleet/CPlayer.cpp
|
MJBrune/RandomProjects
|
c24d8aa78aa9d5a6df8ae186a92a82165a96c50c
|
[
"WTFPL"
] | null | null | null |
SinkTheFleet/SinkTheFleet/CPlayer.cpp
|
MJBrune/RandomProjects
|
c24d8aa78aa9d5a6df8ae186a92a82165a96c50c
|
[
"WTFPL"
] | null | null | null |
SinkTheFleet/SinkTheFleet/CPlayer.cpp
|
MJBrune/RandomProjects
|
c24d8aa78aa9d5a6df8ae186a92a82165a96c50c
|
[
"WTFPL"
] | null | null | null |
#include "CPlayer.h"
using namespace JP_CSHIPINFO;
CPlayer::CPlayer(unsigned short whichPlayer, char gridSize)
:m_whichPlayer(whichPlayer),
m_gridSize(gridSize)
{
for (short i = 0; i < 2; i++)
m_gameGrid[i] = NULL;
allocateMemory();
for (short j = 0; j < 6; j++)//SHIP_SIZE_ARRAYSIZE
{
m_ships[j].setName((MB_CSHIP::Ship)j);
m_ships[j].setPiecesLeft(MB_CSHIP::shipSize[j + 1]);
}
m_piecesLeft = 17; //TOTALPIECES
}
CPlayer::~CPlayer()
{
deleteMemory();
}
CPlayer::CPlayer(const CPlayer & player)
: m_whichPlayer(player.m_whichPlayer),
m_gridSize(player.m_gridSize)
{
for (short i = 0; i < 2; i++)
m_gameGrid[i] = NULL;
allocateMemory();
for (short j = 0; j < 6; j++)//6 = SHIP_SIZE_ARRAYSIZE
{
m_ships[j] = player.m_ships[j];
}
m_piecesLeft = player.m_piecesLeft;
}
void CPlayer::allocateMemory()
{
short numberOfRows = LARGEROWS;
short numberOfCols = LARGECOLS;
try
{
m_gameGrid[0] = new MB_CSHIP::CShip*[numberOfRows];
m_gameGrid[1] = new MB_CSHIP::CShip*[numberOfRows];
for(short j = 0; j < numberOfRows; ++j)
{
m_gameGrid[0][j] = new MB_CSHIP::CShip[numberOfCols];
m_gameGrid[1][j] = new MB_CSHIP::CShip[numberOfCols];
for(short k = 0; k < numberOfCols; ++k)
{
m_gameGrid[0][j][k] = MB_CSHIP::CShip(MB_CSHIP::NOSHIP);
m_gameGrid[1][j][k] = MB_CSHIP::CShip(MB_CSHIP::NOSHIP);
} // end for k
} // end for j
}
catch(exception e)
{
deleteMemory();
cerr << "exception: " << e.what() << endl;
cout << "shutting down" << endl;
cin.ignore(BUFFER_SIZE, '\n');
exit(EXIT_FAILURE);
}
}
void CPlayer::deleteMemory()
{
short numberOfRows = LARGEROWS;
for (short j = 0; j < numberOfRows; j++)
{
if (this[m_whichPlayer].m_gameGrid[0][j] != NULL)
delete[] this[m_whichPlayer].m_gameGrid[0][j];
}
if (this[m_whichPlayer].m_gameGrid[0] != NULL)
delete[] this[m_whichPlayer].m_gameGrid[0];
}
bool CPlayer::isValidLocation(short whichShip)
{
short numberOfRows = (toupper(m_gridSize)=='L') ? LARGEROWS : SMALLROWS;
short numberOfCols = (toupper(m_gridSize)=='L') ? LARGECOLS : SMALLCOLS;
if(m_ships[whichShip].getOrientaion() == MB_CDIRECTION::HORIZONTAL &&
m_ships[whichShip].getBowLocation().getCol() + MB_CSHIP::shipSize[whichShip]
<= numberOfCols)
{
for(short i = 0; i < MB_CSHIP::shipSize[whichShip]; i++)
if(m_gameGrid[0][m_ships[whichShip].getBowLocation().getRow()]
[m_ships[whichShip].getBowLocation().getCol() + i] != MB_CSHIP::NOSHIP)
{
return false;
}
}
else if(m_ships[whichShip].getOrientaion() == MB_CDIRECTION::VERTICAL &&
m_ships[whichShip].getBowLocation().getRow() + MB_CSHIP::shipSize[whichShip]
<= numberOfRows)
{
for(short i = 0; i < MB_CSHIP::shipSize[whichShip]; i++)
if(m_gameGrid[0]
[m_ships[whichShip].getBowLocation().getRow() + i]
[m_ships[whichShip].getBowLocation().getCol()]
!= MB_CSHIP::NOSHIP)
{
return false;
}
}
else
{
return false;
}
return true;
}
void CPlayer::printGrid(std::ostream& sout, short whichGrid)
{
short numberOfRows = (toupper(m_gridSize)=='L') ? LARGEROWS : SMALLROWS;
short numberOfCols = (toupper(m_gridSize)=='L') ? LARGECOLS : SMALLCOLS;
sout << ' ';
for (short j = 1; j <= numberOfCols; ++j)
sout << setw(3) << j;
sout << endl;
sout << HORIZ << CROSS << HORIZ << HORIZ << CROSS;
for (short l = 0; l < numberOfCols - 1; l++)
sout << HORIZ << HORIZ << CROSS;
sout << endl;
for (short i = 0; i < numberOfRows; i++)
{
sout << static_cast<char>(i + 65) << VERT;
for (short h = 0; h < numberOfCols; h++)
{
m_gameGrid[whichGrid][i][h].print(sout);
}
sout << endl;
sout << HORIZ << CROSS << HORIZ << HORIZ;
for (short j = 0; j < numberOfCols - 1; j++)
sout << CROSS << HORIZ << HORIZ;
sout << CROSS;
sout << endl;
}
}
bool CPlayer::getGrid(std::string filename)
{
char ship;
std::ifstream ifs;
short shipCount[MB_CSHIP::SHIP_SIZE_ARRAYSIZE] = {0};
char cell = ' ';
char fsize = 'S';
char line[256];
char choice = 'N';
short numberOfRows = (toupper(m_gridSize)=='L') ? LARGEROWS : SMALLROWS;
short numberOfCols = (toupper(m_gridSize)=='L') ? LARGECOLS : SMALLCOLS;
int totalCells = numberOfRows * numberOfCols;
ifs.open(filename);
if (!ifs)
{
cout << "could not open file " << filename << endl
<< "press <enter> to continue" << endl;
cin.ignore(256, '\n');//256 = BUFFER_SIZE
return false;
}
fsize = ifs.get();
if (fsize != m_gridSize)
{
cout << "saved grid is not the correct size " << filename << endl
<< " press <enter> to continue" << endl;
cin.get();
return false;
}
ifs.ignore(256, '\n');//magic number
ifs.getline(line, 256);//magic number
for (int rows = 0; rows != numberOfRows; rows++)
{
ifs.getline(line, 256);
for (int cols = 0; cols != numberOfCols; cols++)
{
ship = ifs.get();
while (ship != ' ')
ship = ifs.get();
ship = ifs.get();
switch (ship)
{
case 'M':
this[m_whichPlayer].m_gameGrid[0][rows][cols] = MB_CSHIP::MINESWEEPER;
break;
case 'S':
this[m_whichPlayer].m_gameGrid[0][rows][cols] = MB_CSHIP::SUB;
break;
case 'F':
this[m_whichPlayer].m_gameGrid[0][rows][cols] = MB_CSHIP::FRIGATE;
break;
case 'B':
this[m_whichPlayer].m_gameGrid[0][rows][cols] = MB_CSHIP::BATTLESHIP;
break;
case 'C':
this[m_whichPlayer].m_gameGrid[0][rows][cols] = MB_CSHIP::CARRIER;
break;
case ' ':
this[m_whichPlayer].m_gameGrid[0][rows][cols] = MB_CSHIP::NOSHIP;
break;
default:
cout << "The file has become corrupt. Sorry" << endl
<< " press <enter> to continue" << endl;
return false;
}
}
}
system("cls");
printGrid(cout, m_whichPlayer);
cin.ignore(256, '\n');//BUFFER_SIZE
choice = safeChoice("is this the grid you wanted?", 'Y', 'N');
if (choice == 'Y')
return true;
else
{
system("cls");
return false;
}
}
void CPlayer::saveGrid()
{
short numberOfRows = (toupper(m_gridSize)=='L') ? LARGEROWS : SMALLROWS;
short numberOfCols = (toupper(m_gridSize)=='L') ? LARGECOLS : SMALLCOLS;
std::ofstream file;
std::string filename;
std::cout << "NOTE: .shp will be appended to the filename" << std::endl;
std::cout << "What should this grid be saved as? ";
std::cin >> filename;
file.open(filename + ".shp");
if (file)
{
file << m_gridSize << endl;
printGrid(file, m_whichPlayer);
file.close();
std::cout << "Grid has been saved as " << filename + ".shp" << std::endl;
std::cin.get();
}
else
{
std::cout << "could not open file " << filename + ".shp" << std::endl;
std::cout << "Press <enter> to continue" << endl;
std::cin.ignore(256, '\n');//BUFFER_SIZE
}
std::cin.ignore(256, '\n');//BUFFER_SIZE
}
void CPlayer::setShips(short whichplayer)
{
char input = 'V';
char save = 'N';
MB_CCELL::CCell location(0,0);
MB_CSHIP::Ship name = MB_CSHIP::NOSHIP;
m_whichPlayer = whichplayer;
for(short j = 1; j < MB_CSHIP::SHIP_SIZE_ARRAYSIZE; j++)
{
system("cls");
printGrid(cout, 0);
//outSStream.str("");
cout << "Player " << m_whichPlayer + 1 << " Enter ";
m_ships[j].getName().printName(cout);
cout << " orientation";
input = safeChoice("", 'V', 'H');
m_ships[j].setOrientaion((input == 'V') ? MB_CDIRECTION::VERTICAL : MB_CDIRECTION::HORIZONTAL);
cout << "Player " << m_whichPlayer + 1 << " Enter " << m_ships[j].getName() <<
" bow coordinates <row letter><col #>\n";
location.inputCoordinates(cin, m_gridSize);
m_ships[j].setBowLocation(location);
// if ok
if(!isValidLocation(j))
{
cout << "invalid location. Press <enter>" ;
cin.get();
j--; // try again
continue;
}
if(m_ships[j].getOrientaion() == MB_CDIRECTION::VERTICAL)
{
for(int i = 0; i < MB_CSHIP::shipSize[j]; i++)
{
m_gameGrid[0][location.getRow() + i][location.getCol()] = (MB_CSHIP::Ship)j;
}
}
else
{
for(int i = 0; i < MB_CSHIP::shipSize[j]; i++)
{
m_gameGrid[0][location.getRow()][location.getCol() + i] = (MB_CSHIP::Ship)j;
}
}
system("cls");
printGrid(cout, 0);
} // end for j
save = safeChoice("\nSave starting grid?", 'Y', 'N');
if(save == 'Y')
saveGrid();
system("cls");
}
void CPlayer::randGrid()
{
char input = 'V';
char save = 'N';
MB_CCELL::CCell location(0,0);
MB_CSHIP::Ship name = MB_CSHIP::NOSHIP;
for(short j = 1; j < MB_CSHIP::SHIP_SIZE_ARRAYSIZE; j++)
{
system("cls");
printGrid(cout, 0);
cout << "Player " << m_whichPlayer + 1 << " Enter ";
m_ships[j].getName().printName(cout);
cout << " orientation";
m_ships[j].setOrientaion((rand() % 2 == 0) ? MB_CDIRECTION::VERTICAL : MB_CDIRECTION::HORIZONTAL);
cout << "Player " << m_whichPlayer + 1 << " Enter " << m_ships[j].getName() <<
" bow coordinates <row letter><col #>\n";
location.randomCell(m_gridSize);
m_ships[j].setBowLocation(location);
// if ok
if(!isValidLocation(j))
{
j--; // try again
continue;
}
if(m_ships[j].getOrientaion() == MB_CDIRECTION::VERTICAL)
{
for(int i = 0; i < MB_CSHIP::shipSize[j]; i++)
{
m_gameGrid[0][location.getRow() + i][location.getCol()] = (MB_CSHIP::Ship)j;
}
}
else
{
for(int i = 0; i < MB_CSHIP::shipSize[j]; i++)
{
m_gameGrid[0][location.getRow()][location.getCol() + i] = (MB_CSHIP::Ship)j;
}
}
system("cls");
printGrid(cout, 0);
} // end for j
save = safeChoice("\nSave starting grid?", 'Y', 'N');
if(save == 'Y')
saveGrid();
system("cls");
}
CShipInfo CPlayer::operator[](short index) const
{
if (index >= 6)//SHIP_SIZE_ARRAYSIZE
throw range_error("index out of range");
return m_ships[index];
}
| 24.1075
| 100
| 0.619724
|
MJBrune
|
072745020649226af6dd2f0f5e63cc5cd212aab1
| 1,420
|
cpp
|
C++
|
src/queries/model/not.cpp
|
enerc/zsearch
|
60cdcd245b66d14fe4e2be1d26eb2b1877d4b098
|
[
"Apache-2.0"
] | null | null | null |
src/queries/model/not.cpp
|
enerc/zsearch
|
60cdcd245b66d14fe4e2be1d26eb2b1877d4b098
|
[
"Apache-2.0"
] | null | null | null |
src/queries/model/not.cpp
|
enerc/zsearch
|
60cdcd245b66d14fe4e2be1d26eb2b1877d4b098
|
[
"Apache-2.0"
] | null | null | null |
#include "not.hpp"
#include "../../queries/builders/ast.hpp"
using namespace std;
using namespace indexes;
namespace queries::model {
void NotModel::execute(queries::builders::AST *ast) {
if (exprList.size() != 1) {
Log::error(ast->getQueryStatus(),"SQL query NOT should have 1 children. "+ast->getSaveqQuery());
return;
}
auto a = exprList.at(0)->getWorkingSet();
if (a == nullptr) {
Log::error(ast->getQueryStatus(),"SQL subexpression NOT failed "+ast->getSaveqQuery());
return;
}
allocWorkingSet(exprList.at(0)->getWorkingSetSize());
for (int chunk=0; chunk < workingSetSize*8/CHUNK_SIZE; chunk ++) {
shared_ptr<IndexChunk> c = exprList.at(0)->getIndexManager(0)->getChunkForRead(chunk);
uint32_t l = 128*(c->getBase()->getNbDocuments()/1024);
uint64_t p = chunk*CHUNK_SIZE/64;
fastNot(workingSet+p,exprList.at(0)->getWorkingSet()+p, l);
for (uint32_t i=l*8; i < c->getBase()->getNbDocuments(); i++) {
uint32_t k = i >> 6;
uint32_t x = i&63;
uint64_t b = (exprList.at(0)->getWorkingSet()[p+k] >> x) &1;
b = b == 0 ? 1 : 0;
workingSet[p+k] |= b << x;
}
fastAnd(workingSet+p,workingSet+p,c->getBase()->getDeletedInfo(),CHUNK_SIZE/8);
}
exprList.at(0)->freeWorkingSet();
nbResults = fastCount(workingSet,workingSetSize);
}
}
| 34.634146
| 104
| 0.602113
|
enerc
|
072e60f746552c111c7bc04bf4cb3d53b3ca989a
| 5,018
|
cpp
|
C++
|
test/test_mrt.cpp
|
balsini/FREDSim
|
720dc30d4c2f8a51a05ec74584aef352f029c19f
|
[
"Naumen",
"Condor-1.1",
"MS-PL"
] | 1
|
2020-05-24T15:20:53.000Z
|
2020-05-24T15:20:53.000Z
|
test/test_mrt.cpp
|
balsini/rtlib2.0
|
720dc30d4c2f8a51a05ec74584aef352f029c19f
|
[
"Naumen",
"Condor-1.1",
"MS-PL"
] | null | null | null |
test/test_mrt.cpp
|
balsini/rtlib2.0
|
720dc30d4c2f8a51a05ec74584aef352f029c19f
|
[
"Naumen",
"Condor-1.1",
"MS-PL"
] | null | null | null |
#include "catch.hpp"
#include <metasim.hpp>
#include <rttask.hpp>
#include <mrtkernel.hpp>
#include <edfsched.hpp>
#include <cbserver.hpp>
using namespace MetaSim;
using namespace RTSim;
TEST_CASE("multicore")
{
EDFScheduler sched;
MRTKernel kern(&sched, 2);
PeriodicTask t1(10, 10, 0, "task 1");
t1.insertCode("fixed(4);");
t1.setAbort(false);
PeriodicTask t2(15, 15, 0, "task 2");
t2.insertCode("fixed(5);");
t2.setAbort(false);
PeriodicTask t3(25, 25, 0, "task 3");
t3.insertCode("fixed(4);");
t3.setAbort(false);
kern.addTask(t1);
kern.addTask(t2);
kern.addTask(t3);
SIMUL.initSingleRun();
SIMUL.run_to(4);
REQUIRE(t1.getExecTime() == 4);
REQUIRE(t2.getExecTime() == 4);
REQUIRE(t3.getExecTime() == 0);
SIMUL.run_to(5);
REQUIRE(t1.getExecTime() == 4);
REQUIRE(t3.getExecTime() == 1);
REQUIRE(t2.getExecTime() == 5);
SIMUL.run_to(8);
REQUIRE(t1.getExecTime() == 4);
REQUIRE(t3.getExecTime() == 4);
REQUIRE(t2.getExecTime() == 5);
SIMUL.endSingleRun();
}
TEST_CASE("multicore with cbs")
{
EDFScheduler sched;
MRTKernel kern(&sched, 2);
PeriodicTask t1(10, 10, 0, "task 1");
t1.insertCode("fixed(4);");
t1.setAbort(false);
PeriodicTask t2(15, 15, 0, "task 2");
t2.insertCode("fixed(5);");
t2.setAbort(false);
PeriodicTask t3(25, 25, 0, "task 3");
t3.insertCode("fixed(4);");
t3.setAbort(false);
CBServer serv1(4, 10, 10, true, "server1", "FIFOSched");
CBServer serv2(5, 15, 15, true, "server2", "FIFOSched");
CBServer serv3(2, 12, 12, true, "server3", "FIFOSched");
serv1.addTask(t1);
serv2.addTask(t2);
serv3.addTask(t3);
kern.addTask(serv1);
kern.addTask(serv2);
kern.addTask(serv3);
SIMUL.initSingleRun();
SIMUL.run_to(1);
REQUIRE(t1.getExecTime() == 1);
REQUIRE(t2.getExecTime() == 0);
REQUIRE(t3.getExecTime() == 1);
REQUIRE(serv1.get_remaining_budget() == 3);
REQUIRE(serv1.getDeadline() == 10);
REQUIRE(serv2.get_remaining_budget() == 5);
REQUIRE(serv2.getDeadline() == 15);
REQUIRE(serv3.get_remaining_budget() == 1);
REQUIRE(serv3.getDeadline() == 12);
SIMUL.run_to(2);
REQUIRE(t1.getExecTime() == 2);
REQUIRE(t2.getExecTime() == 0);
REQUIRE(t3.getExecTime() == 2);
REQUIRE(serv1.get_remaining_budget() == 2);
REQUIRE(serv1.getDeadline() == 10);
REQUIRE(serv2.get_remaining_budget() == 5);
REQUIRE(serv2.getDeadline() == 15);
REQUIRE(serv3.get_remaining_budget() == 2);
REQUIRE(serv3.getDeadline() == 24);
SIMUL.run_to(4);
REQUIRE(t1.getExecTime() == 4);
REQUIRE(t2.getExecTime() == 2);
REQUIRE(t3.getExecTime() == 2);
REQUIRE(serv1.get_remaining_budget() == 4);
REQUIRE(serv1.getDeadline() == 20);
REQUIRE(serv2.get_remaining_budget() == 3);
REQUIRE(serv2.getDeadline() == 15);
REQUIRE(serv3.get_remaining_budget() == 2);
REQUIRE(serv3.getDeadline() == 24);
SIMUL.run_to(5);
REQUIRE(t1.getExecTime() == 4);
REQUIRE(t2.getExecTime() == 3);
REQUIRE(t3.getExecTime() == 2);
REQUIRE(serv1.get_remaining_budget() == 4);
REQUIRE(serv1.getDeadline() == 20);
REQUIRE(serv2.get_remaining_budget() == 2);
REQUIRE(serv2.getDeadline() == 15);
REQUIRE(serv3.get_remaining_budget() == 2);
REQUIRE(serv3.getDeadline() == 24);
SIMUL.run_to(7);
REQUIRE(t1.getExecTime() == 4);
REQUIRE(t2.getExecTime() == 5);
REQUIRE(t3.getExecTime() == 2);
REQUIRE(serv1.get_remaining_budget() == 4);
REQUIRE(serv1.getDeadline() == 20);
REQUIRE(serv2.get_remaining_budget() == 5);
REQUIRE(serv2.getDeadline() == 30);
REQUIRE(serv3.get_remaining_budget() == 2);
REQUIRE(serv3.getDeadline() == 24);
SIMUL.run_to(10);
REQUIRE(t1.getExecTime() == 0);
REQUIRE(t2.getExecTime() == 5);
REQUIRE(t3.getExecTime() == 2);
REQUIRE(serv1.get_remaining_budget() == 4);
REQUIRE(serv1.getDeadline() == 20);
REQUIRE(serv2.get_remaining_budget() == 5);
REQUIRE(serv2.getDeadline() == 30);
REQUIRE(serv3.get_remaining_budget() == 2);
REQUIRE(serv3.getDeadline() == 24);
SIMUL.run_to(12);
REQUIRE(t1.getExecTime() == 2);
REQUIRE(t2.getExecTime() == 5);
REQUIRE(t3.getExecTime() == 2);
REQUIRE(serv1.get_remaining_budget() == 2);
REQUIRE(serv1.getDeadline() == 20);
REQUIRE(serv2.get_remaining_budget() == 5);
REQUIRE(serv2.getDeadline() == 30);
REQUIRE(serv3.get_remaining_budget() == 2);
REQUIRE(serv3.getDeadline() == 24);
SIMUL.run_to(14);
REQUIRE(t1.getExecTime() == 4);
REQUIRE(t2.getExecTime() == 5);
REQUIRE(t3.getExecTime() == 4);
REQUIRE(serv1.get_remaining_budget() == 4);
REQUIRE(serv1.getDeadline() == 30);
REQUIRE(serv2.get_remaining_budget() == 5);
REQUIRE(serv2.getDeadline() == 30);
REQUIRE(serv3.get_remaining_budget() == 2);
REQUIRE(serv3.getDeadline() == 36);
SIMUL.endSingleRun();
}
| 29.174419
| 61
| 0.624352
|
balsini
|
073004cd565b9f199516972e25a6a3aba0258f63
| 2,800
|
cpp
|
C++
|
src/speedex/LiquidityPoolSetFrame.cpp
|
sandymule/stellar-core
|
d5f0abf8d78770aec1f6d0b8f3718f4dc0462a13
|
[
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0",
"BSL-1.0",
"BSD-3-Clause"
] | 4
|
2021-11-05T07:18:21.000Z
|
2021-12-13T01:16:25.000Z
|
src/speedex/LiquidityPoolSetFrame.cpp
|
sandymule/stellar-core
|
d5f0abf8d78770aec1f6d0b8f3718f4dc0462a13
|
[
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0",
"BSL-1.0",
"BSD-3-Clause"
] | 1
|
2021-12-09T04:33:19.000Z
|
2021-12-09T04:33:19.000Z
|
src/speedex/LiquidityPoolSetFrame.cpp
|
sandymule/stellar-core
|
d5f0abf8d78770aec1f6d0b8f3718f4dc0462a13
|
[
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0",
"BSL-1.0",
"BSD-3-Clause"
] | 1
|
2021-12-08T23:16:19.000Z
|
2021-12-08T23:16:19.000Z
|
#include "speedex/LiquidityPoolSetFrame.h"
#include "ledger/LedgerTxn.h"
#include "speedex/DemandUtils.h"
#include "speedex/sim_utils.h"
#include <utility>
#include "util/types.h"
namespace stellar
{
LiquidityPoolSetFrame::LiquidityPoolSetFrame(std::vector<Asset> const& assets, AbstractLedgerTxn& ltx)
{
for (auto const& sellAsset : assets) {
for (auto const& buyAsset : assets) {
if (sellAsset < buyAsset) {
AssetPair pair1 {
.selling = sellAsset,
.buying = buyAsset
};
AssetPair pair2 {
.selling = buyAsset,
.buying = sellAsset
};
mBaseFrames.emplace_back(std::make_unique<LiquidityPoolFrameBaseLtx>(ltx, pair1));
mLiquidityPools.emplace(std::piecewise_construct,
std::forward_as_tuple(pair1),
std::forward_as_tuple(*mBaseFrames.back(), pair1));
mLiquidityPools.emplace(std::piecewise_construct,
std::forward_as_tuple(pair2),
std::forward_as_tuple(*mBaseFrames.back(), pair2));
}
}
}
}
LiquidityPoolSetFrame::LiquidityPoolSetFrame(SpeedexSimConfig const& sim)
{
for (auto const& ammconfig : sim.ammConfigs)
{
AssetPair p = AssetPair{
.selling = makeSimAsset(ammconfig.assetA),
.buying = makeSimAsset(ammconfig.assetB)
};
if (p.buying < p.selling) {
p = p.reverse();
}
mBaseFrames.emplace_back(std::make_unique<LiquidityPoolFrameBaseSim>(ammconfig));
mLiquidityPools.emplace(std::piecewise_construct,
std::forward_as_tuple(p),
std::forward_as_tuple(*mBaseFrames.back(), p));
p = p.reverse();
mLiquidityPools.emplace(std::piecewise_construct,
std::forward_as_tuple(p),
std::forward_as_tuple(*mBaseFrames.back(), p));
}
}
void
LiquidityPoolSetFrame::demandQuery(std::map<Asset, uint64_t> const& prices, SupplyDemand& supplyDemand) const
{
for (auto const& [tradingPair, lpFrame] : mLiquidityPools)
{
int128_t sellAmountTimesPrice = lpFrame.amountOfferedForSaleTimesSellPrice(prices.at(tradingPair.selling), prices.at(tradingPair.buying));
//std::printf("lp sell %s buy %s: %lf %ld\n",
// assetToString(tradingPair.selling).c_str(),
// assetToString(tradingPair.buying).c_str(),
// (double) sellAmountTimesPrice,
// (int64_t) sellAmountTimesPrice);
supplyDemand.addSupplyDemand(tradingPair, sellAmountTimesPrice);
}
}
LiquidityPoolSetFrame::int128_t
LiquidityPoolSetFrame::demandQueryOneAssetPair(AssetPair const& tradingPair, std::map<Asset, uint64_t> const& prices) const
{
auto iter = mLiquidityPools.find(tradingPair);
if (iter == mLiquidityPools.end()) {
return 0;
}
return iter->second.amountOfferedForSaleTimesSellPrice(prices.at(tradingPair.selling), prices.at(tradingPair.buying));
}
LiquidityPoolFrame&
LiquidityPoolSetFrame::getFrame(AssetPair const& tradingPair) {
return mLiquidityPools.at(tradingPair);
}
} /* stellar */
| 27.184466
| 140
| 0.735714
|
sandymule
|
0730fb13c4c0c48914c88c97430ecfff43d01c53
| 657
|
cpp
|
C++
|
src/cpp/2016-12-3/Code9-240-SearchA2DMatrix2.cpp
|
spurscoder/forTest
|
2ab069d6740f9d7636c6988a5a0bd3825518335d
|
[
"MIT"
] | null | null | null |
src/cpp/2016-12-3/Code9-240-SearchA2DMatrix2.cpp
|
spurscoder/forTest
|
2ab069d6740f9d7636c6988a5a0bd3825518335d
|
[
"MIT"
] | 1
|
2018-10-24T05:48:27.000Z
|
2018-10-24T05:52:14.000Z
|
src/cpp/2016-12-3/Code9-240-SearchA2DMatrix2.cpp
|
spurscoder/forTest
|
2ab069d6740f9d7636c6988a5a0bd3825518335d
|
[
"MIT"
] | null | null | null |
/*
Description: Write an efficient algorithm that searches for a value in an
m*n matrix, this matrix has the following properties:
* integers in each row are sorted in ascending from left to right;
* integers in each column are sorted in ascending from top to bottom.
*/
// O(M+N)
class Solution {
public:
bool searchMatrix(vector<vector<int>>& matrix, int target) {
int m = matrix.size();
if (m == 0) return false;
int n = matrix[0].size();
int i = 0 , j = n - 1;
while (i < m && j >= 0) {
if (matrix[i][j] == target) return true;
else if (matrix[i][j] > target) j--;
else ++i;
}
return false;
}
}
| 24.333333
| 73
| 0.613394
|
spurscoder
|
0732a25a1d8aa2ecb1706820e779cf60b1e30811
| 116,763
|
cpp
|
C++
|
ToolKit/SyntaxEdit/XTPSyntaxEditLexParser.cpp
|
11Zero/DemoBCG
|
8f41d5243899cf1c82990ca9863fb1cb9f76491c
|
[
"MIT"
] | 2
|
2018-03-30T06:40:08.000Z
|
2022-02-23T12:40:13.000Z
|
ToolKit/SyntaxEdit/XTPSyntaxEditLexParser.cpp
|
11Zero/DemoBCG
|
8f41d5243899cf1c82990ca9863fb1cb9f76491c
|
[
"MIT"
] | null | null | null |
ToolKit/SyntaxEdit/XTPSyntaxEditLexParser.cpp
|
11Zero/DemoBCG
|
8f41d5243899cf1c82990ca9863fb1cb9f76491c
|
[
"MIT"
] | 1
|
2020-08-11T05:48:02.000Z
|
2020-08-11T05:48:02.000Z
|
// XTPSyntaxEditLexParser.cpp : implementation file
//
// This file is a part of the XTREME TOOLKIT PRO MFC class library.
// (c)1998-2011 Codejock Software, All Rights Reserved.
//
// THIS SOURCE FILE IS THE PROPERTY OF CODEJOCK SOFTWARE AND IS NOT TO BE
// RE-DISTRIBUTED BY ANY MEANS WHATSOEVER WITHOUT THE EXPRESSED WRITTEN
// CONSENT OF CODEJOCK SOFTWARE.
//
// THIS SOURCE CODE CAN ONLY BE USED UNDER THE TERMS AND CONDITIONS OUTLINED
// IN THE XTREME SYNTAX EDIT LICENSE AGREEMENT. CODEJOCK SOFTWARE GRANTS TO
// YOU (ONE SOFTWARE DEVELOPER) THE LIMITED RIGHT TO USE THIS SOFTWARE ON A
// SINGLE COMPUTER.
//
// CONTACT INFORMATION:
// support@codejock.com
// http://www.codejock.com
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
// common includes
#include "Common/XTPNotifyConnection.h"
#include "Common/XTPSmartPtrInternalT.h"
// syntax editor includes
#include "XTPSyntaxEditDefines.h"
#include "XTPSyntaxEditStruct.h"
#include "XTPSyntaxEditLexPtrs.h"
#include "XTPSyntaxEditLexClassSubObjT.h"
#include "XTPSyntaxEditTextIterator.h"
#include "XTPSyntaxEditSectionManager.h"
#include "XTPSyntaxEditLexCfgFileReader.h"
#include "XTPSyntaxEditLexClassSubObjDef.h"
#include "XTPSyntaxEditLexClass.h"
#include "XTPSyntaxEditLexParser.h"
#include "XTPSyntaxEditLexColorFileReader.h"
#include "XTPSyntaxEditBufferManager.h"
#include "XTPSyntaxEditCtrl.h"
#include <afxmt.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#ifdef _DEBUG
// #define DBG_TRACE_LOAD_CLASS_SCH
// Trace text blocks start,end when parser running;
// #define DBG_TRACE_PARSE_START_STOP TRACE
// Trace text blocks start,end when parser running;
// #define DBG_TRACE_PARSE_RUN_BLOCKS TRACE
// Trace updating schema mechanism when parser running;
// #define DBG_TRACE_PARSE_RUN_UPDATE TRACE
// #define DBG_TRACE_PARSE_RUN_RESULTS
// #define DBG_TRACE_PARSE_TIME
// #define DBG_TRACE_PARSE_TIME_DLG
// #define DBG_TRACE_DRAW_BLOCKS
#endif
#ifndef DBG_TRACE_PARSE_RUN_BLOCKS
#define DBG_TRACE_PARSE_RUN_BLOCKS
#endif
#ifndef DBG_TRACE_PARSE_RUN_UPDATE
#define DBG_TRACE_PARSE_RUN_UPDATE
#endif
#ifndef DBG_TRACE_PARSE_START_STOP
#define DBG_TRACE_PARSE_START_STOP
#endif
////////////////////////////////////////////////////////////////////////////
#ifdef _DEBUG
#define DBG_TRACE_TIME_BEGIN(nID) DWORD dbg_TT_##nID##_dwTime_0 = ::GetTickCount();
#define DBG_TRACE_TIME_END(nID, strComment) { DWORD dwTime1 = ::GetTickCount(); \
TRACE(_T("%s (%.3f sec) \n"), strComment, labs(dwTime1-dbg_TT_##nID##_dwTime_0)/1000.0); }
class C_DBG_Time {
CString m_strComment;
DWORD m_dwTime0;
public:
C_DBG_Time(LPCTSTR lpcszComment)
{
m_dwTime0 = ::GetTickCount();
m_strComment = lpcszComment;
};
~C_DBG_Time()
{
DWORD dwTime1 = ::GetTickCount();
TRACE(_T("%s (%.3f sec) \n"), (LPCTSTR)m_strComment, labs(dwTime1-m_dwTime0)/1000.0);
};
};
//#define DBG_TRACE_TIME(nID, strComment) C_DBG_Time dbg_TT_##nID(strComment);
#endif
#ifndef DBG_TRACE_TIME
#define DBG_TRACE_TIME(nID, strComment)
#endif
////////////////////////////////////////////////////////////////////////////
using namespace XTPSyntaxEditLexAnalyser;
namespace XTPSyntaxEditLexAnalyser
{
extern CXTPSyntaxEditLexAutomatMemMan* XTPGetLexAutomatMemMan();
extern void ConcatenateLVArrays(CXTPSyntaxEditLexVariantPtrArray* pArDest,
CXTPSyntaxEditLexVariantPtrArray* pAr2, int nMaxCount = INT_MAX);
extern BOOL SortTagsInLexVarArray(CXTPSyntaxEditLexVariantPtrArray& rarTags,
BOOL bAscending, BOOL bNoCase);
int FindStrCount(const CStringArray& rarData, LPCTSTR pcszStr, BOOL bCase = FALSE)
{
int nStrCount = 0;
int nCount = (int)rarData.GetSize();
for (int i = 0; i < nCount; i++)
{
const CString& strI = rarData[i];
if (bCase)
{
if (strI.Compare(pcszStr) == 0)
{
nStrCount++;
}
}
else
{
if (strI.CompareNoCase(pcszStr) == 0)
{
nStrCount++;
}
}
}
return nStrCount;
}
int FindStr(const CStringArray& rarData, LPCTSTR pcszStr, BOOL bCase = FALSE)
{
int nCount = (int)rarData.GetSize();
for (int i = 0; i < nCount; i++)
{
const CString& strI = rarData[i];
if (bCase)
{
if (strI.Compare(pcszStr) == 0)
{
return i;
}
}
else
{
if (strI.CompareNoCase(pcszStr) == 0)
{
return i;
}
}
}
return -1;
}
int Find_noCase(CStringArray& rarData, LPCTSTR strData)
{
return FindStr(rarData, strData, FALSE);
}
void AddIfNeed_noCase(CStringArray& rarData, LPCTSTR strNew)
{
int nFIdx = Find_noCase(rarData, strNew);
if (nFIdx < 0)
{
rarData.Add(strNew);
}
}
void ConcatenateArrays_noCase(CStringArray& rarDest, CStringArray& rarSrc)
{
int nCount = (int)rarSrc.GetSize();
for (int i = 0; i < nCount; i++)
{
CString strI = rarSrc[i];
AddIfNeed_noCase(rarDest, strI);
}
}
BOOL IsEventSet(HANDLE hEvent)
{
DWORD dwRes = ::WaitForSingleObject(hEvent, 0);
return dwRes == WAIT_OBJECT_0;
}
BOOL IsMutexLocked(CMutex* pMu)
{
if (!pMu)
{
ASSERT(FALSE);
return FALSE;
}
BOOL bEntered = pMu->Lock(0);
if (bEntered)
{
pMu->Unlock();
}
return !bEntered;
}
CString DBG_TraceIZone(const XTP_EDIT_LINECOL* pLCStart, const XTP_EDIT_LINECOL* pLCEnd)
{
CString sDBGpos, sTmp;
if (pLCStart && !pLCEnd && pLCStart->GetXLC() == XTP_EDIT_XLC(1, 0) )
{
sDBGpos = _T("All:(1,0 - NULL)");
}
else if (pLCStart || pLCEnd)
{
sDBGpos = _T("Part:(");
sTmp = _T("NULL");
if (pLCStart)
{
sTmp.Format(_T("%d,%d"), pLCStart->nLine, pLCStart->nCol);
}
sDBGpos += sTmp + _T(" - ");
sTmp = _T("NULL");
if (pLCEnd)
{
sTmp.Format(_T("%d,%d"), pLCEnd->nLine, pLCEnd->nCol);
}
sDBGpos += sTmp;
sDBGpos += _T(")");
} else {
sDBGpos = _T("Rest(NULL - NULL)");
}
return sDBGpos;
}
CString DBG_TraceTB_StartEndCls(CXTPSyntaxEditLexTextBlock* pTB)
{
if (!pTB)
{
return _T("?<NULL> (? - ?) - ?");
}
CString str;
str.Format(_T("(%d,%d - %d,%d) - %s"), pTB->m_PosStartLC.nLine,
pTB->m_PosStartLC.nCol, pTB->m_PosEndLC.nLine, pTB->m_PosEndLC.nCol,
pTB->m_ptrLexClass ? (LPCTSTR)pTB->m_ptrLexClass->GetClassName() : _T("???<NULL>") );
return str;
}
}
//BEGIN_IMPLEMENT_XTPSINK(CXTPSyntaxEditLexParser, m_SinkMT)
// ON_XTP_NOTIFICATION(xtpEditOnParserStarted, OnParseEvent_NotificationHandler)
// ON_XTP_NOTIFICATION(xtpEditOnTextBlockParsed, OnParseEvent_NotificationHandler)
// ON_XTP_NOTIFICATION(xtpEditOnParserEnded, OnParseEvent_NotificationHandler)
//END_IMPLEMENT_XTPSINK
////////////////////////////////////////////////////////////////////////////
// CXTPSyntaxEditLexTextSchema
void CXTPSyntaxEditTextRegion::Clear()
{
m_posStart.Clear();
m_posEnd.Clear();
}
void CXTPSyntaxEditTextRegion::Set(const XTP_EDIT_LINECOL* pLCStart, const XTP_EDIT_LINECOL* pLCEnd)
{
m_posStart.nLine = INT_MAX;
m_posStart.nCol = 0;
m_posEnd.Clear();
if (pLCStart)
{
m_posStart = *pLCStart;
}
if (pLCEnd)
{
m_posEnd = *pLCEnd;
}
}
CXTPSyntaxEditLexTokensDef::~CXTPSyntaxEditLexTokensDef()
{
}
CXTPSyntaxEditLexTokensDef::CXTPSyntaxEditLexTokensDef(const CXTPSyntaxEditLexTokensDef& rSrc)
{
m_arTokens.Copy(rSrc.m_arTokens);
m_arStartSeps.Copy(rSrc.m_arStartSeps);
m_arEndSeps.Copy(rSrc.m_arEndSeps);
}
const CXTPSyntaxEditLexTokensDef& CXTPSyntaxEditLexTokensDef::operator=(const CXTPSyntaxEditLexTokensDef& rSrc)
{
m_arTokens.RemoveAll();
m_arStartSeps.RemoveAll();
m_arEndSeps.RemoveAll();
m_arTokens.Append(rSrc.m_arTokens);
m_arStartSeps.Append(rSrc.m_arStartSeps);
m_arEndSeps.Append(rSrc.m_arEndSeps);
return *this;
}
CXTPSyntaxEditLexTextSchema::CXTPSyntaxEditLexTextSchema(LPCTSTR pcszSchName):
m_evBreakParsing(FALSE, TRUE)
{
//m_CloserManager.SetParentObject(this);
m_pClassSchema = new CXTPSyntaxEditLexClassSchema();
m_pConnectMT = new CXTPNotifyConnectionMT();
m_nNoEndedClassesCount = 0;
m_curInvalidZone.Clear();
m_mapLastParsedBlocks.InitHashTable(101);
m_nSeekNext_TagWaitChars = 0;
m_strSchName = pcszSchName;
m_bSendProgressEvents = FALSE;
}
CXTPSyntaxEditLexTextSchema::~CXTPSyntaxEditLexTextSchema()
{
Close();
CMDTARGET_RELEASE(m_pClassSchema);
CMDTARGET_RELEASE(m_pConnectMT);
}
CString CXTPSyntaxEditLexTextSchema::GetSchName() const
{
return m_strSchName;
}
//CXTPSyntaxEditLexTextSchemaCloserManPtr CXTPSyntaxEditLexTextSchema::GetCloserManager()
//{
// CSingleLock singleLockCls(GetClassSchLoker(), TRUE);
// CSingleLock singleLock(GetDataLoker(), TRUE);
//
// ASSERT(m_CloserManager.m_ptrParentObj || m_CloserManager.m_dwRef == 0);
// ASSERT(this == (CXTPSyntaxEditLexTextSchema*)m_CloserManager.m_ptrParentObj || !m_CloserManager.m_ptrParentObj);
//
// m_CloserManager.SetParentObject(this);
//
// CXTPSyntaxEditLexTextSchemaCloserManPtr ptrRes(&m_CloserManager, TRUE);
// return ptrRes;
//}
CXTPNotifyConnection* CXTPSyntaxEditLexTextSchema::GetConnection()
{
return m_pConnectMT;
}
CXTPSyntaxEditLexClassSchema* CXTPSyntaxEditLexTextSchema::GetClassSchema()
{
return m_pClassSchema;
}
CXTPSyntaxEditLexTextSchema* CXTPSyntaxEditLexTextSchema::Clone()
{
CXTPSyntaxEditLexTextSchema* ptrNewSch = new CXTPSyntaxEditLexTextSchema(m_strSchName);
if (!ptrNewSch)
{
return NULL;
}
CSingleLock singleLockCls(GetClassSchLoker(), TRUE);
CSingleLock singleLock(GetDataLoker(), TRUE);
if (!m_pClassSchema->Copy(ptrNewSch->m_pClassSchema))
{
ptrNewSch->InternalRelease();
return NULL;
}
return ptrNewSch;
}
void CXTPSyntaxEditLexTextSchema::Close()
{
CSingleLock singleLockCls(GetClassSchLoker(), TRUE);
CSingleLock singleLock(GetDataLoker(), TRUE);
RemoveAll();
m_pClassSchema->Close();
}
void CXTPSyntaxEditLexTextSchema::RemoveAll()
{
CSingleLock singleLockCls(GetClassSchLoker(), TRUE);
CSingleLock singleLock(GetDataLoker(), TRUE);
Close(m_ptrFirstBlock);
m_ptrFirstBlock = NULL;
m_mapLastParsedBlocks.RemoveAll();
m_ptrLastParsedBlock = NULL;
}
void CXTPSyntaxEditLexTextSchema::Close(CXTPSyntaxEditLexTextBlock* pFirst)
{
CXTPSyntaxEditLexTextBlockPtr ptrChTB(pFirst, TRUE);
while (ptrChTB)
{
CXTPSyntaxEditLexTextBlockPtr ptrChTBnext = ptrChTB->m_ptrNext;
ptrChTB->Close();
ptrChTB = ptrChTBnext;
}
}
BOOL CXTPSyntaxEditLexTextSchema::IsBlockStartStillHere(CTextIter* pTxtIter, CXTPSyntaxEditLexTextBlock* pTB)
{
if (!pTxtIter || !pTB || !pTB->m_ptrLexClass)
{
ASSERT(FALSE);
return FALSE;
}
if (!pTxtIter->SeekPos(pTB->m_PosStartLC, m_evBreakParsing))
{
return FALSE;
}
CXTPSyntaxEditLexTextBlockPtr ptrTBtmp;
int nPres = pTB->m_ptrLexClass->RunParse(pTxtIter, this, ptrTBtmp);
BOOL bStarted = (nPres & xtpEditLPR_StartFound) != 0;
return bStarted;
}
// DEBUG ////////////////////////////////////////////////////////////////
#ifdef DBG_TRACE_PARSE_RUN_RESULTS
#define DBG_TRACE_PARSE_RUN_RESULTS_PROC(bFull) TraceTxtBlocks(bFull);
#else
#define DBG_TRACE_PARSE_RUN_RESULTS_PROC(bFull)
#endif
// END DEBUG ////////////////////////////////////////////////////////////
void CXTPSyntaxEditLexTextSchema::TraceTxtBlocks(BOOL bFull)
{
TRACE(_T("\n*** DBG_TRACE_PARSE_RUN_RESULTS *** --( %s )---------\n"),
bFull ? _T("FULL") : _T("updated part") );
CXTPSyntaxEditLexTextBlockPtr ptrTB = bFull ? m_ptrFirstBlock : m_ptrNewChainTB1;
for (int i = 0; ptrTB && (bFull || ptrTB->m_ptrPrev != m_ptrNewChainTB2); i++)
{
TRACE(_T("(%05d) startPos=(%d,%d) endPos=(%d,%d), [%s]\n"), i,
ptrTB->m_PosStartLC.nLine, ptrTB->m_PosStartLC.nCol,
ptrTB->m_PosEndLC.nLine, ptrTB->m_PosEndLC.nCol,
(LPCTSTR)ptrTB->m_ptrLexClass->m_strClassName);
ptrTB = ptrTB->m_ptrNext;
}
}
int CXTPSyntaxEditLexTextSchema::RunParseUpdate(BOOL bShort, CTextIter* pTxtIter,
const XTP_EDIT_LINECOL* pLCStart,
const XTP_EDIT_LINECOL* pLCEnd,
BOOL bSendProgressEvents)
{
CSingleLock singleLock(GetDataLoker(), TRUE);
m_mapLastParsedBlocks.RemoveAll();
singleLock.Unlock();
if (bSendProgressEvents)
{
m_pConnectMT->PostEvent(xtpEditOnParserStarted, 0, 0,
xtpNotifyGuarantyPost | xtpNotifyDirectCallForOneThread);
}
int nParseRes = Run_ParseUpdate0(bShort, pTxtIter, pLCStart, pLCEnd, bSendProgressEvents);
if (bSendProgressEvents)
{
m_pConnectMT->PostEvent(xtpEditOnParserEnded, nParseRes, 0,
xtpNotifyGuarantyPost|xtpNotifyDirectCallForOneThread);
}
return nParseRes;
}
int CXTPSyntaxEditLexTextSchema::Run_ParseUpdate0(BOOL bShort, CTextIter* pTxtIter,
const XTP_EDIT_LINECOL* pLCStart,
const XTP_EDIT_LINECOL* pLCEnd,
BOOL bSendProgressEvents)
{
if (!pTxtIter)
{
ASSERT(FALSE);
return xtpEditLPR_Error;
}
CSingleLock singleLockCls(GetClassSchLoker(), TRUE);
//-------------------------
m_curInvalidZone.Set(pLCStart, pLCEnd);
m_ptrNewChainTB1 = NULL;
m_ptrNewChainTB2 = NULL;
m_ptrOldChainTBFirst = NULL;
m_nNoEndedClassesCount = 0;
m_bSendProgressEvents = bSendProgressEvents;
int nParseRes = 0;
//** (1) ** -------------------------
CXTPSyntaxEditLexTextBlockPtr ptrStartTB = FindNearestTextBlock(m_curInvalidZone.m_posStart);
if (ptrStartTB)
{
nParseRes = Run_ClassesUpdate1(pTxtIter, ptrStartTB, FALSE);
if (nParseRes != -1)
{
if (nParseRes & (xtpEditLPR_Error|xtpEditLPR_RunBreaked|xtpEditLPR_RunFinished))
{
DBG_TRACE_PARSE_RUN_RESULTS_PROC(TRUE);
DBG_TRACE_PARSE_RUN_RESULTS_PROC(FALSE);
if (m_ptrNewChainTB1)
{
BOOL bByBreak = (nParseRes & (xtpEditLPR_Error|xtpEditLPR_RunBreaked)) != 0;
FinishNewChain(bByBreak, pTxtIter->IsEOF());
}
return nParseRes;
}
}
}
if (!pLCStart || *pLCStart == XTP_EDIT_LINECOL::Pos1 ||
nParseRes == -1 || !ptrStartTB )
{
nParseRes = 0;
m_ptrOldChainTBFirst = m_ptrFirstBlock ? m_ptrFirstBlock->m_ptrNext : NULL;
//** (2) ** -------------------------
CXTPSyntaxEditLexClassPtrArray* ptrArClasses = m_pClassSchema->GetClasses(bShort);
int nCCount = ptrArClasses ? (int)ptrArClasses->GetSize() : 0;
CXTPSyntaxEditLexClassPtr ptrTopClass = nCCount ? ptrArClasses->GetAt(0) : NULL;
BOOL bRunEOF = TRUE;
while (nCCount && (!pTxtIter->IsEOF() || bRunEOF) )
{
bRunEOF = !pTxtIter->IsEOF();
nParseRes = Run_ClassesUpdate2(pTxtIter, ptrArClasses, m_ptrFirstBlock);
if (nParseRes & (xtpEditLPR_Error|xtpEditLPR_RunBreaked|xtpEditLPR_RunFinished))
{
DBG_TRACE_PARSE_RUN_RESULTS_PROC(TRUE);
DBG_TRACE_PARSE_RUN_RESULTS_PROC(FALSE);
if (m_ptrNewChainTB1)
{
BOOL bByBreak = (nParseRes & (xtpEditLPR_Error|xtpEditLPR_RunBreaked)) != 0;
FinishNewChain(bByBreak, pTxtIter->IsEOF());
}
return nParseRes;
}
//** -------------------------------------------------------------
if (!pTxtIter->IsEOF() && nCCount && !(nParseRes & xtpEditLPR_Iterated))
{
if (IsEventSet(m_evBreakParsing))
{
return xtpEditLPR_RunBreaked;
}
SeekNextEx(pTxtIter, ptrTopClass);
}
}
}
DBG_TRACE_PARSE_RUN_RESULTS_PROC(TRUE);
DBG_TRACE_PARSE_RUN_RESULTS_PROC(FALSE);
if (m_ptrNewChainTB1)
{
BOOL bByBreak = (nParseRes & (xtpEditLPR_Error|xtpEditLPR_RunBreaked)) != 0;
FinishNewChain(bByBreak, pTxtIter->IsEOF());
}
return xtpEditLPR_RunFinished;
}
int CXTPSyntaxEditLexTextSchema::Run_ClassesUpdate1(CTextIter* pTxtIter,
CXTPSyntaxEditLexTextBlockPtr ptrStartTB,
BOOL bStarted)
{
if (!pTxtIter || !ptrStartTB || !ptrStartTB->m_ptrLexClass)
{
return xtpEditLPR_Error;
}
BOOL bIterated = FALSE;
int nPres = 0;
BOOL bRunEOF = TRUE;
BOOL bEnded = FALSE;
BOOL bStarted1 = bStarted;
if (!bStarted)
{
CXTPSyntaxEditLexTextBlockPtr ptrTB = ptrStartTB;
XTP_EDIT_LINECOL posStart = ptrStartTB->m_PosStartLC;
bStarted1 = IsBlockStartStillHere(pTxtIter, ptrTB);
while (!bStarted1 && ptrTB->m_ptrPrev)
{
ptrTB = ptrTB->m_ptrPrev;
posStart = ptrTB->m_PosStartLC;
bStarted1 = IsBlockStartStillHere(pTxtIter, ptrTB);
if (IsEventSet(m_evBreakParsing))
{
return xtpEditLPR_RunBreaked;
}
}
if (!bStarted1)
{
return -1; // Full reparse
}
if (m_curInvalidZone.m_posEnd.IsValidData() &&
ptrTB->m_PosEndLC > m_curInvalidZone.m_posEnd)
{
if (ptrTB->m_ptrParent || !ptrTB->m_ptrNext)
{
m_curInvalidZone.m_posEnd = ptrTB->m_PosEndLC;
}
else
{ // level: file
ASSERT(ptrTB->m_ptrNext);
if (ptrTB->m_ptrNext->m_PosEndLC > m_curInvalidZone.m_posEnd)
{
m_curInvalidZone.m_posEnd = ptrTB->m_ptrNext->m_PosEndLC;
}
}
}
m_curInvalidZone.m_posStart = posStart;
DBG_TRACE_PARSE_RUN_BLOCKS(_T("\nREPARSE will start from pos =(%d,%d), Run class [%s] {%d}-noEndedStack \n"),
posStart.nLine, posStart.nCol,
ptrTB->m_ptrParent ?
(ptrTB->m_ptrParent->m_ptrLexClass ?
ptrTB->m_ptrParent->m_ptrLexClass->m_strClassName : _T("?<NULL> (parent)") )
:( ptrTB->m_ptrLexClass ?
ptrTB->m_ptrLexClass->m_strClassName : _T("?<NULL>") )
, m_nNoEndedClassesCount );
CString sDBGzone = DBG_TraceIZone(&m_curInvalidZone.m_posStart, &m_curInvalidZone.m_posEnd);
DBG_TRACE_PARSE_RUN_UPDATE(_T("- Parser change invalid Zone [ %s ] \n"), sDBGzone);
// Seek iterator to begin of the block
if (!pTxtIter->SeekPos(posStart, m_evBreakParsing))
{
return xtpEditLPR_Error;
}
if (IsEventSet(m_evBreakParsing))
{
return xtpEditLPR_RunBreaked;
}
ASSERT(!m_ptrNewChainTB1);
m_ptrNewChainTB1 = ptrTB;
if (ptrTB->m_ptrPrev)
{
m_ptrNewChainTB1 = ptrTB->m_ptrPrev;
}
m_ptrOldChainTBFirst = m_ptrNewChainTB1->m_ptrNext;
DBG_TRACE_PARSE_RUN_UPDATE(_T(" NewChainTB1: %s \n"), DBG_TraceTB_StartEndCls(m_ptrNewChainTB1));
DBG_TRACE_PARSE_RUN_UPDATE(_T(" OldChainTBFirst: %s \n"), DBG_TraceTB_StartEndCls(m_ptrOldChainTBFirst));
ptrStartTB = ptrTB;
}
CXTPSyntaxEditLexClassPtr ptrRunClass = ptrStartTB->m_ptrLexClass;
//** 1 **// Run existing block with children until block end
while (bStarted && !bEnded && (bRunEOF || !pTxtIter->IsEOF()) )
{
if (IsEventSet(m_evBreakParsing))
{
return xtpEditLPR_RunBreaked;
}
bRunEOF = !pTxtIter->IsEOF();
BOOL bSkipIterate = FALSE;
nPres = ptrRunClass->RunParse(pTxtIter, this, ptrStartTB);
if (nPres & (xtpEditLPR_Error|/*xtpEditLPR_RunBreaked|*/xtpEditLPR_RunFinished))
{
return nPres;
}
//---------------------------------------------------------------------------
if (nPres & xtpEditLPR_Iterated)
{
bSkipIterate = TRUE;
bIterated = TRUE;
}
//---------------------------------------------------------------------------
bEnded = (nPres & xtpEditLPR_EndFound) != 0;
if (bEnded)
{
CSingleLock singleLock(GetDataLoker(), TRUE);
m_nNoEndedClassesCount--;
int nECount = ptrStartTB->EndChildren(this);
m_nNoEndedClassesCount -= nECount;
//*** VALIDATION (when reparsing)
if (m_ptrNewChainTB2 && m_ptrNewChainTB2->m_ptrNext)
{
while (m_ptrNewChainTB2->m_ptrNext &&
m_ptrNewChainTB2->m_ptrNext->m_PosStartLC < ptrStartTB->m_PosEndLC)
{
m_ptrNewChainTB2->m_ptrNext = m_ptrNewChainTB2->m_ptrNext->m_ptrNext;
}
}
DBG_TRACE_PARSE_RUN_BLOCKS(_T("(%08x) ENDED startPos=(%d,%d) endPos=(%d,%d), [%s] {%d}-noEndedStack \n"),
(CXTPSyntaxEditLexTextBlock*)ptrStartTB,
ptrStartTB->m_PosStartLC.nLine, ptrStartTB->m_PosStartLC.nCol, ptrStartTB->m_PosEndLC.nLine,
ptrStartTB->m_PosEndLC.nCol, ptrStartTB->m_ptrLexClass->m_strClassName, m_nNoEndedClassesCount);
SendEvent_OnTextBlockParsed(ptrStartTB);
}
//---------------------------------------------------------------------------
if (!bEnded && !bSkipIterate)
{
if (IsEventSet(m_evBreakParsing))
{
return xtpEditLPR_RunBreaked;
}
SeekNextEx(pTxtIter, ptrRunClass);
}
}
//** end run existing **//
if (bStarted && !bEnded && pTxtIter->IsEOF())
{
CXTPSyntaxEditLexTextBlock* pTB2end = ptrStartTB;
for (; pTB2end; pTB2end = pTB2end->m_ptrParent)
{
pTB2end->m_PosEndLC = pTxtIter->GetPosLC();
}
return xtpEditLPR_RunFinished;
}
if (bStarted && bEnded || pTxtIter->IsEOF())
{
return xtpEditLPR_RunFinished;
}
//===========================================================================
CXTPSyntaxEditLexTextBlockPtr ptrTBrun = ptrStartTB;
if (ptrStartTB->m_ptrParent)
{
ptrTBrun = ptrStartTB->m_ptrParent;
bEnded = FALSE;
if (ptrTBrun->m_PosEndLC >= m_curInvalidZone.m_posStart &&
ptrTBrun->m_PosEndLC <= m_curInvalidZone.m_posEnd)
{
m_nNoEndedClassesCount++;
}
}
if (!bEnded && !pTxtIter->IsEOF())
{
if (IsEventSet(m_evBreakParsing))
{
return xtpEditLPR_RunBreaked;
}
nPres = Run_ClassesUpdate1(pTxtIter, ptrTBrun, bStarted1);
if (nPres & (xtpEditLPR_Error|xtpEditLPR_RunBreaked|xtpEditLPR_RunFinished))
{
return nPres;
}
//---------------------------------
if (nPres & xtpEditLPR_Iterated)
{
bIterated = TRUE;
}
}
//---------------------------------------------------------------------------
return (bIterated ? xtpEditLPR_Iterated : 0) | (pTxtIter->IsEOF() ? xtpEditLPR_RunFinished : 0);
}
int CXTPSyntaxEditLexTextSchema::Run_ClassesUpdate2(CTextIter* pTxtIter,
CXTPSyntaxEditLexClassPtrArray* pArClasses,
CXTPSyntaxEditLexTextBlockPtr ptrParentTB,
CXTPSyntaxEditLexOnScreenParseCnt* pOnScreenRunCnt)
{
int nCCount = (int)pArClasses->GetSize();
BOOL bIterated = FALSE;
int nReturn = 0;
for (int i = 0; i < nCCount; i++)
{
CXTPSyntaxEditLexClass* pClass = pArClasses->GetAt(i, FALSE);
ASSERT(pClass);
if (!pClass)
continue;
CXTPSyntaxEditLexTextBlockPtr ptrTB = NULL;
int nPres = 0;
BOOL bStarted = FALSE;
BOOL bEnded = FALSE;
BOOL bRunEOF = FALSE;
do
{
if (IsEventSet(m_evBreakParsing))
{
return xtpEditLPR_RunBreaked;
}
bRunEOF = !pTxtIter->IsEOF();
BOOL bSkipIterate = FALSE;
nPres = pClass->RunParse(pTxtIter, this, ptrTB, pOnScreenRunCnt);
if (nPres & (xtpEditLPR_Error|/*xtpEditLPR_RunBreaked|*/xtpEditLPR_RunFinished))
{
return nPres;
}
//---------------------------------------------------------------------------
if ((nPres & xtpEditLPR_StartFound) && ptrTB && !ptrTB->m_ptrPrev)
{
bStarted = TRUE;
CSingleLock singleLock(GetDataLoker(), TRUE);
ptrTB->m_ptrParent = ptrParentTB;
if (ptrTB->m_ptrParent)
{
ptrTB->m_ptrParent->m_ptrLastChild = ptrTB;
}
if (!pOnScreenRunCnt)
{
//*** VALIDATION (when reparsing)
if (m_ptrNewChainTB2 && m_ptrNewChainTB2->m_ptrNext)
{
while (m_ptrNewChainTB2->m_ptrNext &&
m_ptrNewChainTB2->m_ptrNext->m_PosStartLC < ptrTB->m_PosStartLC)
{
m_ptrNewChainTB2->m_ptrNext = m_ptrNewChainTB2->m_ptrNext->m_ptrNext;
}
if (m_ptrNewChainTB2->m_ptrNext && m_curInvalidZone.m_posEnd.IsValidData() )
{
DBG_TRACE_PARSE_RUN_UPDATE(_T("\n <VALIDATE> TB current: %s \n"), DBG_TraceTB_StartEndCls(ptrTB));
DBG_TRACE_PARSE_RUN_UPDATE(_T(" <VALIDATE> TB next OLD: %s [NoEndedStack=%d]\n"),
DBG_TraceTB_StartEndCls(m_ptrNewChainTB2->m_ptrNext), m_nNoEndedClassesCount);
if (m_ptrNewChainTB2->m_ptrNext->m_PosStartLC == ptrTB->m_PosStartLC &&
ptrTB->IsEqualLexClasses(m_ptrNewChainTB2->m_ptrNext) &&
m_curInvalidZone.m_posEnd.IsValidData() &&
m_ptrNewChainTB2->m_ptrNext->m_PosStartLC > m_curInvalidZone.m_posEnd)
{
// BREAK.
if (m_nNoEndedClassesCount <= 0)
{
FinishNewChain(FALSE, pTxtIter->IsEOF());
return xtpEditLPR_RunFinished;
}
}
}
}
//***
m_nNoEndedClassesCount++;
//**************************
if (!m_ptrNewChainTB1)
{
// Full reparse
m_ptrNewChainTB1 = ptrTB;
m_ptrNewChainTB2 = NULL;
//ASSERT(m_ptrFirstBlock == NULL);
m_ptrFirstBlock = ptrTB;
DBG_TRACE_PARSE_RUN_UPDATE(_T(" NewChainTB1 (&FirstBlock): %s \n"), DBG_TraceTB_StartEndCls(m_ptrNewChainTB1));
}
else if (!m_ptrNewChainTB2)
{
m_ptrNewChainTB2 = m_ptrNewChainTB1;
}
if (nPres&xtpEditLPR_TBpop1)
{
if (m_ptrNewChainTB2)
{
if (m_ptrNewChainTB2->m_ptrPrev)
{
m_ptrNewChainTB2->m_ptrPrev->m_ptrNext = ptrTB;
}
ptrTB->m_ptrPrev = m_ptrNewChainTB2->m_ptrPrev;
ptrTB->m_ptrNext = m_ptrNewChainTB2;
m_ptrNewChainTB2->m_ptrPrev = ptrTB;
m_ptrNewChainTB2->m_ptrParent = ptrTB;
}
else
{
m_ptrNewChainTB2 = ptrTB; //SetPrevBlock(ptrTB);
}
}
else
{
if (m_ptrNewChainTB2)
{
ptrTB->m_ptrNext = m_ptrNewChainTB2->m_ptrNext;
ptrTB->m_ptrPrev = m_ptrNewChainTB2; //GetPrevBlock(); //
m_ptrNewChainTB2->m_ptrNext = ptrTB;
}
m_ptrNewChainTB2 = ptrTB; //SetPrevBlock(ptrTB);
}
//**************************
}
else
{
if (nPres&xtpEditLPR_TBpop1)
{
if (pOnScreenRunCnt->m_ptrTBLast)
{
if (pOnScreenRunCnt->m_ptrTBLast->m_ptrPrev)
{
pOnScreenRunCnt->m_ptrTBLast->m_ptrPrev->m_ptrNext = ptrTB;
}
ptrTB->m_ptrPrev = pOnScreenRunCnt->m_ptrTBLast->m_ptrPrev;
ptrTB->m_ptrNext = pOnScreenRunCnt->m_ptrTBLast;
pOnScreenRunCnt->m_ptrTBLast->m_ptrPrev = ptrTB;
pOnScreenRunCnt->m_ptrTBLast->m_ptrParent = ptrTB;
}
else
{
pOnScreenRunCnt->m_ptrTBLast = ptrTB;
}
}
else
{
ptrTB->m_ptrPrev = pOnScreenRunCnt->m_ptrTBLast;
if (pOnScreenRunCnt->m_ptrTBLast)
{
pOnScreenRunCnt->m_ptrTBLast->m_ptrNext = ptrTB;
}
pOnScreenRunCnt->m_ptrTBLast = ptrTB;
}
}
// DEBUG ////////////////////////////////////////////////////////////////
DBG_TRACE_PARSE_RUN_BLOCKS(_T("(%08x) START startPos=(%d,%d), ______________ [%s] {%d}-noEndedStack \n"),
(CXTPSyntaxEditLexTextBlock*)ptrTB,
ptrTB->m_PosStartLC.nLine, ptrTB->m_PosStartLC.nCol,
ptrTB->m_ptrLexClass->m_strClassName, m_nNoEndedClassesCount);
// END DEBUG ////////////////////////////////////////////////////////////
}
//---------------------------------------------------------------------------
if (nPres & xtpEditLPR_Iterated)
{
bSkipIterate = TRUE;
bIterated = TRUE;
}
//---------------------------------------------------------------------------
bEnded = (nPres & xtpEditLPR_EndFound) != 0;
if (bEnded)
{
CSingleLock singleLock(GetDataLoker(), TRUE);
m_nNoEndedClassesCount--;
int nECount = ptrTB->EndChildren(pOnScreenRunCnt ? NULL : this);
m_nNoEndedClassesCount -= nECount;
// DEBUG ////////////////////////////////////////////////////////////////
DBG_TRACE_PARSE_RUN_BLOCKS(_T("(%08x) ENDED startPos=(%d,%d) endPos=(%d,%d), [%s] {%d}-noEndedStack \n"),
(CXTPSyntaxEditLexTextBlock*)ptrTB,
ptrTB->m_PosStartLC.nLine, ptrTB->m_PosStartLC.nCol,
ptrTB->m_PosEndLC.nLine, ptrTB->m_PosEndLC.nCol,
ptrTB->m_ptrLexClass->m_strClassName, m_nNoEndedClassesCount);
// END DEBUG ////////////////////////////////////////////////////////////
if (!pOnScreenRunCnt)
{
SendEvent_OnTextBlockParsed(ptrTB);
}
}
if (nPres & xtpEditLPR_RunBreaked)
{
return nPres;
}
//---------------------------------------------------------------------------
if (bStarted && !bEnded && !bSkipIterate)
{
if (IsEventSet(m_evBreakParsing))
{
return xtpEditLPR_RunBreaked;
}
SeekNextEx(pTxtIter, pClass, pOnScreenRunCnt);
bIterated = TRUE;
}
//---------------------------------------------------------------------------
if (pOnScreenRunCnt)
{
XTP_EDIT_LINECOL lcTextPos = pTxtIter->GetPosLC();
if (lcTextPos.nLine > pOnScreenRunCnt->m_nRowEnd)
{
return xtpEditLPR_RunFinished;
}
}
}
while (bStarted && !bEnded && (bRunEOF || !pTxtIter->IsEOF()) );
if (bEnded && pClass->IsRestartRunLoop())
{
nReturn |= xtpEditLPR_RunRestart;
break;
}
}
return nReturn | (bIterated ? xtpEditLPR_Iterated : 0);
}
UINT CXTPSyntaxEditLexTextSchema::SendEvent_OnTextBlockParsed(CXTPSyntaxEditLexTextBlock* pTB)
{
CSingleLock singleLock(GetDataLoker(), TRUE);
if (!m_bSendProgressEvents)
{
return 0;
}
CXTPSyntaxEditLexTextBlockPtr ptrTB(pTB, TRUE);
WPARAM dwTBid = (WPARAM)pTB;
m_mapLastParsedBlocks[dwTBid] = ptrTB;
m_ptrLastParsedBlock.SetPtr(pTB, TRUE);
BOOL bIsSubscribers = m_pConnectMT->PostEvent(xtpEditOnTextBlockParsed, dwTBid,
0, xtpNotifyDirectCallForOneThread);
if (bIsSubscribers)
{
// WARNING: Why? EventsWnd must call GetLastParsedBlock()
// to withdraw objects from the map!
//ASSERT(m_mapLastParsedBlocks.GetCount() < 10*1000);
static BOOL s_bAssert = FALSE;
if (!s_bAssert && m_mapLastParsedBlocks.GetCount() > 10*1000)
{
s_bAssert = TRUE;
ASSERT(FALSE);
}
}
else
{
m_mapLastParsedBlocks.RemoveAll();
}
return 0;
}
CXTPSyntaxEditLexTextBlock* CXTPSyntaxEditLexTextSchema::GetLastParsedBlock(WPARAM dwID)
{
CSingleLock singleLock(GetDataLoker(), TRUE);
if (dwID)
{
CXTPSyntaxEditLexTextBlockPtr ptrTB;
if (m_mapLastParsedBlocks.Lookup(dwID, ptrTB))
{
m_mapLastParsedBlocks.RemoveKey(dwID);
return ptrTB.Detach();
}
}
else
{
return m_ptrLastParsedBlock.GetInterface(TRUE);
}
// ASSERT(FALSE);
return NULL;
}
void CXTPSyntaxEditLexTextSchema::FinishNewChain(BOOL bByBreak, BOOL bEOF)
{
CSingleLock singleLock(GetDataLoker(), TRUE);
CXTPSyntaxEditLexTextBlockPtr ptrTBOldLast = NULL;
DBG_TRACE_PARSE_RUN_UPDATE(_T(" <F> NewChainTB1: %s \n"), DBG_TraceTB_StartEndCls(m_ptrNewChainTB1));
if (m_ptrNewChainTB2)
{
DBG_TRACE_PARSE_RUN_UPDATE(_T(" <F> NewChainTB2-raw: %s \n"), DBG_TraceTB_StartEndCls(m_ptrNewChainTB2));
if (bByBreak && !bEOF)
{
// roll back no-ended blocks
while ( !m_ptrNewChainTB2->m_PosEndLC.IsValidData() &&
m_ptrNewChainTB2->m_ptrPrev &&
m_ptrNewChainTB2 != m_ptrNewChainTB1)
{
CXTPSyntaxEditLexTextBlockPtr ptrTBclose = m_ptrNewChainTB2;
m_ptrNewChainTB2 = m_ptrNewChainTB2->m_ptrPrev;
m_ptrNewChainTB2->m_ptrNext = ptrTBclose->m_ptrNext;
DBG_TRACE_PARSE_RUN_UPDATE(_T(" <F> CLOSE TB-RollBacked: %s \n"), DBG_TraceTB_StartEndCls(ptrTBclose));
ptrTBclose->Close();
}
DBG_TRACE_PARSE_RUN_UPDATE(_T(" <F> NewChainTB2-RollBacked: %s \n"), DBG_TraceTB_StartEndCls(m_ptrNewChainTB2));
}
// end no-ended blocks
EndBlocksByParent(m_ptrNewChainTB1, m_ptrNewChainTB2);
if (m_ptrNewChainTB2 == m_ptrNewChainTB1)
{
UpdateLastSchBlock(m_ptrNewChainTB2);
m_ptrOldChainTBFirst = NULL;
return;
}
// synchronize new and old chains
while (m_ptrNewChainTB2->m_ptrNext &&
(m_ptrNewChainTB2->m_ptrNext->m_PosStartLC < m_ptrNewChainTB2->m_PosStartLC ||
m_ptrNewChainTB2->m_ptrNext->m_PosStartLC == m_ptrNewChainTB2->m_PosStartLC &&
m_ptrNewChainTB2->m_ptrNext->IsEqualLexClasses(m_ptrNewChainTB2) )
)
{
m_ptrNewChainTB2->m_ptrNext = m_ptrNewChainTB2->m_ptrNext->m_ptrNext;
}
if (m_ptrNewChainTB2->m_ptrNext)
{
m_ptrNewChainTB2->m_ptrNext->m_ptrPrev = m_ptrNewChainTB2;
m_curInvalidZone.m_posEnd = m_ptrNewChainTB2->m_ptrNext->m_PosStartLC;
}
else
{
m_curInvalidZone.m_posEnd = m_ptrNewChainTB2->m_PosStartLC;
}
if (!bEOF)
{
ptrTBOldLast = m_ptrNewChainTB2->m_ptrNext;
}
}
else if (bByBreak)
{
if (m_ptrNewChainTB2)
{
UpdateLastSchBlock(m_ptrNewChainTB2);
}
m_ptrOldChainTBFirst = NULL;
m_ptrNewChainTB1 = NULL;
m_ptrNewChainTB2 = NULL;
m_nNoEndedClassesCount = 0;
return;
}
else
{
// No new blocks found after chain branch.
// (All rest blocks where deleted)
if (m_ptrNewChainTB1)
{
m_ptrNewChainTB1->m_ptrNext = NULL;
UpdateLastSchBlock(m_ptrNewChainTB1, TRUE);
}
else if (m_ptrFirstBlock)
{
m_ptrFirstBlock->m_ptrNext = NULL;
UpdateLastSchBlock(m_ptrFirstBlock, TRUE);
}
}
DBG_TRACE_PARSE_RUN_UPDATE(_T(" <F> OldChainTBFirst: %s \n"), DBG_TraceTB_StartEndCls(m_ptrOldChainTBFirst));
DBG_TRACE_PARSE_RUN_UPDATE(_T(" <F> TBOldLast: %s \n"), DBG_TraceTB_StartEndCls(ptrTBOldLast));
CXTPSyntaxEditLexTextBlockPtr ptrTBOld = m_ptrOldChainTBFirst;
while (ptrTBOld && ptrTBOld != ptrTBOldLast)
{
CXTPSyntaxEditLexTextBlockPtr ptrTBclose = ptrTBOld;
ptrTBOld = ptrTBOld->m_ptrNext;
ptrTBclose->Close();
}
if (m_ptrNewChainTB2 && m_ptrNewChainTB2->m_ptrNext &&
m_ptrNewChainTB2->m_ptrNext->IsLookLikeClosed())
{
m_ptrNewChainTB2->m_ptrNext = NULL;
UpdateLastSchBlock(m_ptrNewChainTB2, TRUE);
}
//===================================
if (m_ptrNewChainTB2 && m_ptrNewChainTB1)
{
UpdateNewChainParentsChildren();
}
//===================================
if (m_ptrNewChainTB2)
{ // && m_ptrNewChainTB2->m_ptrNext == NULL)
UpdateLastSchBlock(m_ptrNewChainTB2);
}
//-----------------------------------
m_ptrOldChainTBFirst = NULL;
m_ptrNewChainTB1 = NULL;
m_ptrNewChainTB2 = NULL;
m_nNoEndedClassesCount = 0;
}
void CXTPSyntaxEditLexTextSchema::UpdateNewChainParentsChildren()
{
CSingleLock singleLock(GetDataLoker(), TRUE);
if (!m_ptrNewChainTB2 || !m_ptrNewChainTB1)
{
return;
}
if (m_ptrNewChainTB1 != m_ptrFirstBlock)
{
//update children for new chain blocks
CXTPSyntaxEditLexTextBlock* pTB_chi = m_ptrNewChainTB2->m_ptrNext;
for (; pTB_chi; pTB_chi = pTB_chi->m_ptrNext)
{
if (pTB_chi->m_ptrParent && pTB_chi->m_ptrParent->IsLookLikeClosed())
{
CXTPSyntaxEditLexTextBlock* pTB_Par = pTB_chi->m_ptrPrev;
for (; pTB_Par; pTB_Par = pTB_Par->m_ptrPrev)
{
if (pTB_Par->IsInclude(pTB_chi))
{
pTB_chi->m_ptrParent.SetPtr(pTB_Par, TRUE);
ASSERT(!pTB_Par->IsLookLikeClosed());
break;
}
}
}
}
}
}
void CXTPSyntaxEditLexTextSchema::EndBlocksByParent(CXTPSyntaxEditLexTextBlock* pTBStart, CXTPSyntaxEditLexTextBlock* pTBEnd)
{
CSingleLock singleLock(GetDataLoker(), TRUE);
if (!pTBStart)
{
return;
}
CXTPSyntaxEditLexTextBlock* pTB_chi = pTBStart;
for (; pTB_chi != pTBEnd->m_ptrNext; pTB_chi = pTB_chi->m_ptrNext)
{
if (!pTB_chi->m_PosEndLC.IsValidData())
{
//ASSERT(pTB_chi->m_ptrParent && pTB_chi->m_ptrParent->m_PosEndLC.IsValidData());
if (pTB_chi->m_ptrParent && pTB_chi->m_ptrParent->m_PosEndLC.IsValidData())
{
pTB_chi->m_PosEndLC = pTB_chi->m_ptrParent->m_PosEndLC;
}
}
}
}
int CXTPSyntaxEditLexTextSchema::RunChildren(CTextIter* pTxtIter,
CXTPSyntaxEditLexTextBlockPtr ptrTxtBlock,
CXTPSyntaxEditLexClass* pBase,
CXTPSyntaxEditLexOnScreenParseCnt* pOnScreenRunCnt)
{
if (!pTxtIter || !pBase)
{
ASSERT(FALSE);
return xtpEditLPR_Error;
}
int nRes = 0;
CXTPSyntaxEditLexClassPtrArray* pArClasses[3];
pArClasses[0] = pBase->GetChildren();
pArClasses[1] = pBase->GetChildrenDyn();
pArClasses[2] = pBase->GetChildrenSelfRef();
for (int i = 0; i < _countof(pArClasses); i++)
{
if (pArClasses[i] && pArClasses[i]->GetSize())
{
int nResLocal = Run_ClassesUpdate2(pTxtIter, pArClasses[i],
ptrTxtBlock, pOnScreenRunCnt);
nRes |= nResLocal;
if (nRes & (xtpEditLPR_Error|xtpEditLPR_RunBreaked|xtpEditLPR_RunFinished|xtpEditLPR_RunRestart))
{
break;
}
}
}
return nRes;
}
void CXTPSyntaxEditLexTextSchema::SeekNextEx(CTextIter* pTxtIter,
CXTPSyntaxEditLexClass* pRunClass,
CXTPSyntaxEditLexOnScreenParseCnt* pOnScreenRunCnt,
int nChars )
{
if (!pTxtIter || !pRunClass)
{
ASSERT(FALSE);
return;
}
pTxtIter->SeekNext(nChars);
m_nSeekNext_TagWaitChars -= nChars;
CXTPSyntaxEditLexObj_ActiveTags* pAT = m_pClassSchema->GetActiveTagsFor(pRunClass);
if (pAT && m_nSeekNext_TagWaitChars)
{
int i = 0;
//BOOL bCase = FALSE; //pRunClass->IsCaseSensitive();
CString strTmp;
BOOL bTag = FALSE;
while (!bTag && !pTxtIter->IsEOF() && m_nSeekNext_TagWaitChars)
{
//bTag = CXTPSyntaxEditLexClass::Run_Tags1(pTxtIter, pAT, strTmp, bCase, FALSE);
//
bTag = pAT->FindMinWord(pTxtIter->GetText(1024), strTmp, 1024, TRUE, FALSE);
// for test(DEBUG) Only
#ifdef DBG_AUTOMAT
BOOL bCase = FALSE; //pRunClass->IsCaseSensitive();
CString strTmpX;
BOOL bTagX = CXTPSyntaxEditLexClass::Run_Tags1(pTxtIter, pAT, strTmpX, bCase, FALSE);
if (bTagX != bTag)
{
//ASSERT(FALSE);
pAT->BuildAutomat(TRUE);
bTag = pAT->FindMinWord(pTxtIter->GetText(1024), strTmp, 1024, TRUE, FALSE);
}
if (bTag)
{
strTmp.Empty();
bTag = CXTPSyntaxEditLexClass::Run_Tags1(pTxtIter, pAT, strTmp, bCase, FALSE);
}
#endif
if (!bTag)
{
pTxtIter->SeekNext(1);
m_nSeekNext_TagWaitChars--;
}
if (++i%10 == 0 && IsEventSet(m_evBreakParsing))
{
return;
}
if (pOnScreenRunCnt)
{
XTP_EDIT_LINECOL lcTextPos = pTxtIter->GetPosLC();
if (lcTextPos.nLine > pOnScreenRunCnt->m_nRowEnd)
{
return;
}
}
}
ASSERT(bTag || pTxtIter->IsEOF() || !m_nSeekNext_TagWaitChars);
//----------------------
if (bTag)
{
m_nSeekNext_TagWaitChars = (int)_tcsclen(strTmp);
ASSERT(m_nSeekNext_TagWaitChars > 0);
}
}
}
CXTPSyntaxEditLexTextBlock* CXTPSyntaxEditLexTextSchema::GetPrevBlock(BOOL bWithAddRef)
{
CSingleLock singleLock(GetDataLoker(), TRUE);
return m_ptrNewChainTB2.GetInterface(bWithAddRef);
}
void CXTPSyntaxEditLexTextSchema::UpdateLastSchBlock(CXTPSyntaxEditLexTextBlock* pLastTB, BOOL bPermanently)
{
CSingleLock singleLock(GetDataLoker(), TRUE);
if (!pLastTB || !m_ptrLastSchBlock || bPermanently)
{
m_ptrLastSchBlock.SetPtr(pLastTB, TRUE);
return;
}
if (pLastTB->m_PosStartLC >= m_ptrLastSchBlock->m_PosStartLC)
{
m_ptrLastSchBlock.SetPtr(pLastTB, TRUE);
}
}
CXTPSyntaxEditLexTextBlock* CXTPSyntaxEditLexTextSchema::GetLastSchBlock(BOOL bWithAddRef)
{
CSingleLock singleLock(GetDataLoker(), TRUE);
if (m_ptrLastSchBlock && !m_ptrNewChainTB2)
{
return m_ptrLastSchBlock.GetInterface(bWithAddRef);
}
if (!m_ptrLastSchBlock && m_ptrNewChainTB2)
{
return m_ptrNewChainTB2.GetInterface(bWithAddRef);
}
if (m_ptrLastSchBlock && m_ptrNewChainTB2)
{
if (m_ptrLastSchBlock->m_PosStartLC < m_ptrNewChainTB2->m_PosStartLC)
{
return m_ptrNewChainTB2.GetInterface(bWithAddRef);
}
else
{
return m_ptrLastSchBlock.GetInterface(bWithAddRef);
}
}
return NULL;
}
CXTPSyntaxEditLexTextBlock* CXTPSyntaxEditLexTextSchema::GetNewBlock()
{
CXTPSyntaxEditLexTextBlock* p = new CXTPSyntaxEditLexTextBlock();
return p;
}
void CXTPSyntaxEditLexTextSchema::GetTextAttributes(XTP_EDIT_TEXTBLOCK& rTB, CXTPSyntaxEditLexTextBlock* pTextBlock)
{
if (!pTextBlock || !pTextBlock->m_ptrLexClass)
{
return;
}
pTextBlock->m_ptrLexClass->GetTextAttributes(rTB);
}
void CXTPSyntaxEditLexTextSchema::TraceClrBlocks(CXTPSyntaxEditTextBlockArray& arBlocks)
{
// DEBUG ////////////////////////////////////////////////////////////////
#ifdef DBG_TRACE_DRAW_BLOCKS
TRACE(_T("\n*** bloks --------------------\n"));
for (int i = 0; i < arBlocks.GetSize(); i++)
{
XTP_EDIT_TEXTBLOCK BlkI = arBlocks[i];
TRACE(_T("(%02d) start =%d, ?end=%d, color=%X \n"), i, BlkI.nPos,
BlkI.nNextBlockPos, BlkI.clrBlock.crText);
}
TRACE(_T("***\n"));
#else
UNREFERENCED_PARAMETER(arBlocks);
#endif
// END DEBUG ////////////////////////////////////////////////////////////
}
void CXTPSyntaxEditLexTextSchema::AddClrBlock(XTP_EDIT_TEXTBLOCK& rClrB,
CXTPSyntaxEditTextBlockArray& arBlocks)
{
#ifdef DBG_TRACE_DRAW_BLOCKS
TRACE(_T(" --- ADD --- start =%d, ?end=%d, color=%X \n"), rClrB.nPos,
rClrB.nNextBlockPos, rClrB.clrBlock.crText);
#endif
int nCount = (int)arBlocks.GetSize();
//** A. ** new block is included in the existing block
int i;
for (i = 0; i < nCount; i++)
{
XTP_EDIT_TEXTBLOCK& BlkI = arBlocks[i];
if (rClrB.nNextBlockPos < BlkI.nPos ||
rClrB.nPos >= BlkI.nNextBlockPos )
{
continue;
}
XTP_EDIT_TEXTBLOCK BlkI2;// = BlkI;
if (rClrB.nPos >= BlkI.nPos &&
rClrB.nNextBlockPos <= BlkI.nNextBlockPos)
{
// override equal block
if (rClrB.nPos == BlkI.nPos &&
rClrB.nNextBlockPos == BlkI.nNextBlockPos)
{
BlkI = rClrB; //arBlocks[i] = rClrB;
return;
}
// override BEGIN of the existing block
if (rClrB.nPos == BlkI.nPos &&
rClrB.nNextBlockPos < BlkI.nNextBlockPos)
{
BlkI.nPos = rClrB.nNextBlockPos;
//arBlocks[i] = BlkI;
arBlocks.InsertAt(i, rClrB);
return;
}
// override END of the existing block
if (rClrB.nPos > BlkI.nPos &&
rClrB.nNextBlockPos == BlkI.nNextBlockPos)
{
BlkI.nNextBlockPos = rClrB.nPos;
//arBlocks[i] = BlkI;
arBlocks.InsertAt(i+1, rClrB);
return;
}
BlkI2 = BlkI;
// INSERT inside to the existing block
BlkI2.nPos = rClrB.nNextBlockPos;
BlkI.nNextBlockPos = rClrB.nPos;
//arBlocks[i] = BlkI;
arBlocks.InsertAt(i+1, BlkI2);
arBlocks.InsertAt(i+1, rClrB);
return;
}
}
//** B. ** new block is bigger then existing block
nCount = (int)arBlocks.GetSize();
BOOL bInserted = FALSE;
for (i = nCount-1; i >= 0; i--)
{
XTP_EDIT_TEXTBLOCK BlkI = arBlocks[i];
if (rClrB.nNextBlockPos > BlkI.nPos && rClrB.nNextBlockPos < BlkI.nNextBlockPos)
{
BlkI.nPos = rClrB.nNextBlockPos;
arBlocks[i] = BlkI;
if (!bInserted)
{
arBlocks.InsertAt(i, rClrB);
bInserted = TRUE;
}
} else
if (rClrB.nPos <= BlkI.nPos && rClrB.nNextBlockPos >= BlkI.nNextBlockPos)
{
arBlocks.RemoveAt(i);
} else
if (rClrB.nNextBlockPos > BlkI.nPos && rClrB.nNextBlockPos < BlkI.nNextBlockPos )
{
BlkI.nNextBlockPos = rClrB.nPos;
arBlocks[i] = BlkI;
if (!bInserted)
{
arBlocks.InsertAt(i+1, rClrB);
bInserted = TRUE;
}
}
}
//----------------
if (!bInserted)
{
arBlocks.Add(rClrB);
}
}
void CXTPSyntaxEditLexTextSchema::GetRowColors(CTextIter* pTxtIter, int nRow,
int nColFrom, int nColTo,
const XTP_EDIT_COLORVALUES& clrDefault,
CXTPSyntaxEditTextBlockList* rBlocks,
CXTPSyntaxEditLexTextBlockPtr* pptrTBStartCache,
CXTPSyntaxEditLexTextBlock* pFirstSchTB)
{
if (!pTxtIter)
{
ASSERT(FALSE);
return;
}
XTP_EDIT_TEXTBLOCK tmpBlk;
tmpBlk.nPos = 0;
tmpBlk.nNextBlockPos = 0;
tmpBlk.clrBlock = clrDefault;
int nLineLen = pTxtIter->GetLineLen(nRow, FALSE);
if (!nLineLen)
{
return;
}
XTP_EDIT_LINECOL LCStart= {nRow, nColFrom};
XTP_EDIT_LINECOL LCEnd = {nRow, nLineLen};
if (nColTo > 0 && nColTo < nLineLen)
{
LCEnd.nCol = nColTo;
}
CXTPSyntaxEditTextBlockArray arBlocks;
arBlocks.SetSize(0, 4096);
XTP_EDIT_TEXTBLOCK bltTB;
bltTB.nPos = 0;
CSingleLock singleLock(GetDataLoker());
//BOOL bLocked = TryLockCS(&singleLock, GetDataLoker(), 30, 5);
BOOL bLocked = singleLock.Lock(30);
//---------------------------------------------------------------------------
CXTPSyntaxEditLexTextBlockPtr ptrTBfirst, ptrTBstart;
if (bLocked)
{
ptrTBfirst = GetBlocks();
if (pFirstSchTB)
{
ptrTBfirst.SetPtr(pFirstSchTB, TRUE);
}
if (pptrTBStartCache)
{
ptrTBstart = *pptrTBStartCache;
}
if (!ptrTBstart || ptrTBstart == ptrTBfirst ||
ptrTBstart->IsLookLikeClosed())
{
ptrTBstart = ptrTBfirst ? ptrTBfirst->m_ptrNext : NULL;
}
}
//= process first blk ====================================================
//
if (ptrTBfirst)
{
bltTB.clrBlock = clrDefault;
bltTB.lf = tmpBlk.lf;
GetTextAttributes(bltTB, ptrTBfirst);
bltTB.nPos = 0;
bltTB.nNextBlockPos = nLineLen;
AddClrBlock(bltTB, arBlocks);
TraceClrBlocks(arBlocks);
}
//========================================================================
CXTPSyntaxEditLexTextBlockPtrArray arTBStack;
CXTPSyntaxEditLexTextBlockPtr ptrTBStartCache;
for (CXTPSyntaxEditLexTextBlock* pTB = ptrTBstart; pTB; pTB = pTB->m_ptrNext)
{
//BOOL bEndValid = pTB->m_PosEndLC.IsValidData();
//if (bEndValid &&
// (pTB->m_PosEndLC < LCStart || pTB->m_PosEndLC < pTB->m_PosStartLC) ||
// !bEndValid && pTB->m_ptrParent)
if (pTB->GetPosEndLC() < LCStart || pTB->m_PosEndLC < pTB->m_PosStartLC)
{
continue;
}
if (LCEnd < pTB->m_PosStartLC)
{
break;
}
XTP_EDIT_LINECOL TB_PosEndLC = pTB->m_PosEndLC;
if (!pTB->m_PosEndLC.IsValidData() && !pTB->m_ptrParent)
{
TB_PosEndLC.nLine = nRow;
TB_PosEndLC.nCol = nLineLen;
}
if (!ptrTBStartCache)
{
ptrTBStartCache.SetPtr(pTB, TRUE);
ASSERT(pTB->m_ptrParent);
}
CXTPSyntaxEditLexTextBlock* pTBStackLast = NULL;
while (pTB->m_ptrNext && pTB->m_ptrNext->m_PosStartLC <= pTB->m_PosStartLC &&
pTB->m_ptrNext->m_PosEndLC.IsValidData() && pTB->m_PosEndLC.IsValidData() &&
pTB->m_ptrNext->m_PosEndLC > pTB->m_PosEndLC)
{
if (arTBStack.GetSize() == 0)
{
arTBStack.AddPtr(pTB, TRUE);
}
arTBStack.Add(pTB->m_ptrNext);
pTBStackLast = pTB->m_ptrNext;
pTB = pTB->m_ptrNext;
}
int nStackCount = (int)arTBStack.GetSize();
for (;nStackCount >= 0;)
{
if (nStackCount > 0)
{
pTB = arTBStack[nStackCount-1];
}
nStackCount--;
if (nStackCount >= 0)
{
arTBStack.RemoveAt(nStackCount);
TB_PosEndLC = pTB->m_PosEndLC;
if (!pTB->m_PosEndLC.IsValidData() /*&& !pTB->m_ptrParent*/)
{
TB_PosEndLC.nLine = nRow;
TB_PosEndLC.nCol = nLineLen;
}
}
//restore default values
bltTB.clrBlock = clrDefault;
bltTB.lf = tmpBlk.lf;
GetTextAttributes(bltTB, pTB);
if (pTB->m_PosStartLC > LCStart)
{
bltTB.nNextBlockPos = TB_PosEndLC.nLine == nRow ?
min(TB_PosEndLC.nCol+1, nLineLen) : nLineLen;
bltTB.nPos = pTB->m_PosStartLC.nCol;
AddClrBlock(bltTB, arBlocks);
TraceClrBlocks(arBlocks);
}
else
{
bltTB.nNextBlockPos = TB_PosEndLC.nLine == nRow ?
min(TB_PosEndLC.nCol+1, nLineLen) : nLineLen;
bltTB.nPos = 0;
AddClrBlock(bltTB, arBlocks);
TraceClrBlocks(arBlocks);
}
}
//--------------------
if (pTBStackLast)
{
pTB = pTBStackLast;
}
}
//----------------------------------------
if (pptrTBStartCache)
{
ptrTBstart = *pptrTBStartCache;
if (!ptrTBstart || ptrTBstart->IsLookLikeClosed())
{
*pptrTBStartCache = ptrTBStartCache;
ASSERT(!ptrTBStartCache || !ptrTBStartCache->IsLookLikeClosed());
}
}
//-----------------------------
if (bLocked)
{
singleLock.Unlock();
}
//===========================================================================
int nPos = 0;
int i;
for (i = 0; i < arBlocks.GetSize(); i++)
{
XTP_EDIT_TEXTBLOCK BlkI = arBlocks[i];
if (nPos < BlkI.nPos)
{
tmpBlk.nPos = nPos;
tmpBlk.nNextBlockPos = BlkI.nPos;
AddClrBlock(tmpBlk, arBlocks);
TraceClrBlocks(arBlocks);
i++;
}
nPos = BlkI.nNextBlockPos;
}
//===========================================================================
if (arBlocks.GetSize() == 0)
{
tmpBlk.nPos = 0;
tmpBlk.nNextBlockPos = nLineLen;
arBlocks.Add(tmpBlk);
}
else
{
//---------------------------------------------------------------------------
XTP_EDIT_TEXTBLOCK BlkI = arBlocks[arBlocks.GetSize()-1];
if (BlkI.nNextBlockPos < nLineLen)
{
tmpBlk.nPos = BlkI.nNextBlockPos;
tmpBlk.nNextBlockPos = nLineLen;
AddClrBlock(tmpBlk, arBlocks);
TraceClrBlocks(arBlocks);
}
}
//**************************************************************************
// DEBUG ////////////////////////////////////////////////////////////////
#ifdef DBG_TRACE_DRAW_BLOCKS
TRACE(_T("\n*** DBG_TRACE_DRAW_BLOCKS *** --------------------\n"));
TRACE(_T("row=%d, row_len = %d \n"), nRow, nLineLen);
#endif
// END DEBUG ////////////////////////////////////////////////////////////
for (i = 0; i < arBlocks.GetSize(); i++)
{
XTP_EDIT_TEXTBLOCK& BlkI = arBlocks[i];
rBlocks->AddTail(BlkI);
// DEBUG ////////////////////////////////////////////////////////////////
#ifdef DBG_TRACE_DRAW_BLOCKS
TRACE(_T("(%02d) start =%d, ?end=%d, color=%X \n"), i, BlkI.nPos,
BlkI.nNextBlockPos, BlkI.clrBlock.crText);
#endif
// END DEBUG ////////////////////////////////////////////////////////////
}
}
void CXTPSyntaxEditLexTextSchema::GetCollapsableBlocksInfo(int nRow,
CXTPSyntaxEditRowsBlockArray& rArBlocks,
CXTPSyntaxEditLexTextBlockPtr* pptrTBStartCache)
{
static const CString s_strCollapsedText_def = _T("[..]");
rArBlocks.RemoveAll();
CSingleLock singleLock(GetDataLoker());
//BOOL bLocked = TryLockCS(&singleLock, GetDataLoker(), 30);
BOOL bLocked = singleLock.Lock(30);
if (!bLocked)
{
return;
}
XTP_EDIT_ROWSBLOCK tmpCoBlk;
//---------------------------------------------------------------------------
ASSERT(bLocked);
CXTPSyntaxEditLexTextBlockPtr ptrTBstart;
if (pptrTBStartCache)
{
ptrTBstart = *pptrTBStartCache;
}
if (!ptrTBstart || ptrTBstart->IsLookLikeClosed())
{
ptrTBstart = GetBlocks();
}
CXTPSyntaxEditLexTextBlockPtr ptrTBStartCache;
for (CXTPSyntaxEditLexTextBlock* pTB = ptrTBstart; pTB; pTB = pTB->m_ptrNext)
{
if (nRow >= 0 && nRow < pTB->m_PosStartLC.nLine)
{
break;
}
XTP_EDIT_LINECOL TB_PosEndLC = pTB->GetPosEndLC(); // pTB->m_PosEndLC;
if (nRow < 0 || (nRow >= pTB->m_PosStartLC.nLine &&
nRow <= TB_PosEndLC.nLine) )
{
if (!ptrTBStartCache && pTB->m_ptrParent)
{
ptrTBStartCache.SetPtr(pTB, TRUE);
}
if (pTB->m_PosStartLC.nLine < TB_PosEndLC.nLine &&
pTB->m_ptrParent )
{
CXTPSyntaxEditLexClass* pLexClass = pTB->m_ptrLexClass;
ASSERT(pLexClass);
int nCollapsable = pLexClass->IsCollapsable();
if (pLexClass && nCollapsable &&
(nCollapsable == 2 || !pTB->m_bEndByParent && TB_PosEndLC != XTP_EDIT_LINECOL::MAXPOS))
{
tmpCoBlk.lcStart = pTB->m_PosStartLC;
tmpCoBlk.lcEnd = TB_PosEndLC;
CXTPSyntaxEditLexVariantPtr ptrLVtext;
ptrLVtext = pLexClass->GetAttribute(XTPLEX_ATTR_COLLAPSEDTEXT, FALSE);
if (ptrLVtext && ptrLVtext->IsStrType())
{
tmpCoBlk.strCollapsedText = ptrLVtext->GetStr();
} else {
tmpCoBlk.strCollapsedText = s_strCollapsedText_def;
}
rArBlocks.Add(tmpCoBlk);
}
}
}
}
//----------------------------------------
if (pptrTBStartCache)
{
ptrTBstart = *pptrTBStartCache;
if (!ptrTBstart || ptrTBstart->IsLookLikeClosed())
{
*pptrTBStartCache = ptrTBStartCache;
ASSERT(!ptrTBStartCache || !ptrTBStartCache->IsLookLikeClosed());
}
}
}
void CXTPSyntaxEditLexTextSchema::ApplyThemeRecursive(CXTPSyntaxEditColorTheme* pTheme,
CXTPSyntaxEditLexClassPtrArray* ptrClasses)
{
// if pTheme == NULL - Restore default values only
const static CString strAttrPref = XTPLEX_ATTR_TXTPREFIX;
ASSERT(ptrClasses);
int nCount = ptrClasses ? (int)ptrClasses->GetSize() : 0;
for (int i = 0; i < nCount; i++)
{
CXTPSyntaxEditLexClassPtr ptrC = ptrClasses->GetAt(i);
if (!ptrC)
{
ASSERT(FALSE);
continue;
}
// Traverse the tree
ApplyThemeRecursive(pTheme, ptrC->GetChildren());
ApplyThemeRecursive(pTheme, ptrC->GetChildrenDyn());
//-------------------------------------------------------
const CString strCName = ptrC->GetClassName();
// restore default attributes (colors)
CXTPSyntaxEditLexClassPtr ptrCDefault = m_pClassSchema->GetPreBuildClass(strCName);
ASSERT(ptrCDefault);
if (ptrCDefault)
{
ptrC->CopyAttributes(ptrCDefault, XTPLEX_ATTR_TXTPREFIX);
}
CXTPSyntaxEditColorInfo* pColors = pTheme ? pTheme->GetColorInfo(strCName, pTheme->GetFileName()) : NULL;
if (!pColors)
{
continue;
}
// Apply new attributes (colors)
POSITION posParam = pColors->GetFirstParamNamePosition();
while (posParam)
{
static const int c_nClrPrefLen = (int)_tcsclen(XTPLEX_ATTR_COLORPREFIX);
CString strParamName = pColors->GetNextParamName(posParam);
DWORD dwValue = pColors->GetHexParam(strParamName);
CString strAttrName = strAttrPref + strParamName;
if (_tcsnicmp(strAttrName, XTPLEX_ATTR_COLORPREFIX, c_nClrPrefLen) == 0)
{
dwValue = XTP_EDIT_RGB_INT2CLR(dwValue);
}
CXTPSyntaxEditLexVariant lvAttr((int)dwValue);
ptrC->SetAttribute(strAttrName, lvAttr);
}
}
}
void CXTPSyntaxEditLexTextSchema::ApplyTheme(CXTPSyntaxEditColorTheme* pTheme)
{
// if pTheme == NULL - Restore default values only
CSingleLock singleLockCls(GetClassSchLoker(), TRUE);
CSingleLock singleLock(GetDataLoker(), TRUE);
CXTPSyntaxEditLexClassPtrArray* ptrClassesFull = m_pClassSchema->GetClasses(FALSE);
CXTPSyntaxEditLexClassPtrArray* ptrClassesShort = m_pClassSchema->GetClasses(TRUE);
ApplyThemeRecursive(pTheme, ptrClassesFull);
ApplyThemeRecursive(pTheme, ptrClassesShort);
}
////////////////////////////////////////////////////////////////////////////
// CXTPSyntaxEditLexClassSchema
CXTPSyntaxEditLexClassSchema::CXTPSyntaxEditLexClassSchema()
{
XTPGetLexAutomatMemMan()->Lock();
}
CXTPSyntaxEditLexClassSchema::~CXTPSyntaxEditLexClassSchema()
{
XTPGetLexAutomatMemMan()->Unlok();
}
void CXTPSyntaxEditLexClassSchema::AddPreBuildClass(CXTPSyntaxEditLexClass* pClass)
{
CXTPSyntaxEditLexClassPtr ptrC(pClass, TRUE);
m_arPreBuildClassesList.Add(ptrC);
}
CXTPSyntaxEditLexClassPtrArray* CXTPSyntaxEditLexClassSchema::GetChildrenFor(CXTPSyntaxEditLexClass* pClass,
BOOL& rbSelfChild)
{
rbSelfChild = FALSE;
CXTPSyntaxEditLexClassPtrArray arChildren;
BOOL bForFile = pClass == NULL;
int nChidrenOpt = xtpEditOptChildren_Any;
CStringArray arChidrenData;
CString strParentName;
if (pClass)
{
pClass->GetChildrenOpt(nChidrenOpt, arChidrenData);
strParentName = pClass->GetClassName();
}
if (nChidrenOpt == xtpEditOptChildren_No)
{
return NULL;
}
int nCCount = (int)m_arPreBuildClassesList.GetSize();
for (int i = 0; i < nCCount; i++)
{
CXTPSyntaxEditLexClassPtr ptrC = m_arPreBuildClassesList[i];
int nParentOpt;
CStringArray arParentData;
ptrC->GetParentOpt(nParentOpt, arParentData);
CString strCName = ptrC->GetClassName();
if (bForFile && nParentOpt == xtpEditOptParent_file)
{
arChildren.Add(ptrC);
}
else if (!bForFile && nParentOpt == xtpEditOptParent_direct)
{
ASSERT(pClass);
if (nChidrenOpt == xtpEditOptChildren_List)
{
if (Find_noCase(arChidrenData, strCName) < 0)
{
continue;
}
}
int nNCount = (int)arParentData.GetSize();
for (int n = 0; n < nNCount; n++)
{
CString strCN = arParentData[n];
if (strCN.CompareNoCase(strParentName) == 0)
{
if (strCName.CompareNoCase(strParentName) == 0)
{
rbSelfChild = TRUE;
}
else
{
arChildren.Add(ptrC);
}
break;
}
}
}
}
//--------------------------------
CXTPSyntaxEditLexClassPtrArray* pArChildren = NULL;
if (arChildren.GetSize())
{
pArChildren = new CXTPSyntaxEditLexClassPtrArray;
if (pArChildren)
{
pArChildren->Append(arChildren);
}
}
return pArChildren;
}
int CXTPSyntaxEditLexClassSchema::CanBeParentDynForChild(CString strParentName,
CXTPSyntaxEditLexClass* pCChild)
{
if (!pCChild)
{
ASSERT(FALSE);
return FALSE;
}
int nParentOpt;
CStringArray arParentData;
pCChild->GetParentOpt(nParentOpt, arParentData);
if (nParentOpt != xtpEditOptParent_dyn)
{
return -1;
}
int nCCount = (int)m_arPreBuildClassesList.GetSize(), n;
for (int i = 0; i < nCCount; i++)
{
CXTPSyntaxEditLexClassPtr ptrC = m_arPreBuildClassesList[i];
CString strCName = ptrC->GetClassName();
int nNCount = (int)arParentData.GetSize();
for (n = 0; n < nNCount; n++)
{
CString strCN = arParentData[n];
if (strParentName.CompareNoCase(strCN) == 0)
{
return TRUE;
}
}
//-------------------------------------------------------
if (nParentOpt == xtpEditOptParent_dyn )
{
int nDataCount = (int)arParentData.GetSize();
for (n = 0; n < nDataCount; n++)
{
CString strCN = arParentData[n];
if (strCName.CompareNoCase(strCN) == 0)
{
BOOL bCanDyn = CanBeParentDynForChild(strParentName, ptrC);
if (bCanDyn)
{
return TRUE;
}
}
}
}
}
return FALSE;
}
CXTPSyntaxEditLexClass* CXTPSyntaxEditLexClassSchema::GetPreBuildClass(const CString& strName)
{
int nCCount = (int)m_arPreBuildClassesList.GetSize();
for (int i = 0; i < nCCount; i++)
{
CXTPSyntaxEditLexClassPtr ptrC = m_arPreBuildClassesList[i];
const CString strCName = ptrC->GetClassName();
if (strName.CompareNoCase(strCName) == 0)
{
return ptrC.Detach();
}
}
return NULL;
}
void CXTPSyntaxEditLexClassSchema::GetDynParentsList(CXTPSyntaxEditLexClass* pClass,
CStringArray& rarDynParents,
CStringArray& rarProcessedClasses)
{
if (!pClass)
{
ASSERT(FALSE);
return;
}
CString strClassName = pClass->GetClassName();
if (Find_noCase(rarProcessedClasses, strClassName) >= 0)
{
return;
}
rarProcessedClasses.Add(strClassName);
int nParentOpt;
CStringArray arParentData;
pClass->GetParentOpt(nParentOpt, arParentData);
if (nParentOpt == xtpEditOptParent_file)
{
return;
}
ConcatenateArrays_noCase(rarDynParents, arParentData);
int nNCount = (int)arParentData.GetSize();
for (int n = 0; n < nNCount; n++)
{
CString strParent1 = arParentData[n];
if (strClassName.CompareNoCase(strParent1) == 0)
{
continue;
}
CXTPSyntaxEditLexClassPtr ptrC = GetPreBuildClass(strParent1);
if (ptrC)
{
GetDynParentsList(ptrC, rarDynParents, rarProcessedClasses);
}
else
{
//TRACE
}
}
}
CXTPSyntaxEditLexClassPtrArray* CXTPSyntaxEditLexClassSchema::GetDynChildrenFor(CXTPSyntaxEditLexClass* pClass,
BOOL& rbSelfChild)
{
rbSelfChild = FALSE;
int nChidrenOpt = xtpEditOptChildren_Any;
CStringArray arChidrenData;
if (pClass)
{
pClass->GetChildrenOpt(nChidrenOpt, arChidrenData);
}
if (nChidrenOpt == xtpEditOptChildren_No)
{
return NULL;
}
if (!pClass)
return NULL;
CString strMainCName = pClass->GetClassName();
CStringArray arMainParents;
CStringArray arProcessedClasses;
GetDynParentsList(pClass, arMainParents, arProcessedClasses);
CXTPSyntaxEditLexClassPtrArray arDynChildren;
int nCCount = (int)m_arPreBuildClassesList.GetSize();
for (int i = 0; i < nCCount; i++)
{
CXTPSyntaxEditLexClassPtr ptrC = m_arPreBuildClassesList[i];
CString strCName = ptrC->GetClassName();
if (nChidrenOpt == xtpEditOptChildren_List)
{
if (Find_noCase(arChidrenData, strCName) < 0)
{
continue;
}
}
int nCanRes = CanBeParentDynForChild(strMainCName, ptrC);
if (nCanRes > 0)
{
if (strMainCName.CompareNoCase(strCName) == 0)
{
rbSelfChild = TRUE;
}
else
{
arDynChildren.Add(ptrC);
}
continue;
}
if (nCanRes < 0)
{
continue;
}
int nMPCount = (int)arMainParents.GetSize();
for (int n = 0; n < nMPCount; n++)
{
CString strMPName = arMainParents[n];
if (CanBeParentDynForChild(strMPName, ptrC))
{
arDynChildren.Add(ptrC);
break;
}
}
}
//--------------------------------
CXTPSyntaxEditLexClassPtrArray* pArDynChildren = NULL;
if (arDynChildren.GetSize())
{
pArDynChildren = new CXTPSyntaxEditLexClassPtrArray;
if (pArDynChildren)
{
pArDynChildren->Append(arDynChildren);
}
}
return pArDynChildren;
}
CXTPSyntaxEditLexObj_ActiveTags* CXTPSyntaxEditLexClassSchema::GetActiveTagsFor(
CXTPSyntaxEditLexClass* pTopClass)
{
if (!pTopClass)
{
ASSERT(FALSE);
return NULL;
}
return pTopClass->GetActiveTags();
}
BOOL CXTPSyntaxEditLexClassSchema::Copy(CXTPSyntaxEditLexClassSchema* pDest)
{
if (!pDest)
{
ASSERT(FALSE);
return FALSE;
}
//------------------------------------------------------------------------
int nCount = (int)m_arPreBuildClassesList.GetSize();
int i;
for (i = 0; i < nCount; i++)
{
CXTPSyntaxEditLexClassPtr ptrC0 = m_arPreBuildClassesList.GetAt(i);
if (!ptrC0)
{
continue;
}
CXTPSyntaxEditLexClassPtr ptrC0_new = ptrC0->Clone(this);
if (!ptrC0_new)
{
return FALSE;
}
pDest->m_arPreBuildClassesList.Add(ptrC0_new);
}
//------------------------------------------------------------------------
nCount = (int)m_arClassesTreeFull.GetSize();
for (i = 0; i < nCount; i++)
{
CXTPSyntaxEditLexClassPtr ptrCfile = m_arClassesTreeFull.GetAt(i);
if (!ptrCfile)
{
continue;
}
CXTPSyntaxEditLexClassPtr ptrCFnew = ptrCfile->Clone(this);
if (!CopyChildrenFor(FALSE, ptrCFnew, ptrCfile, 0))
{
return FALSE;
}
int nStartCount = 0;
ptrCFnew->BuildActiveTags(nStartCount);
// //CXTPSyntaxEditLexVariantPtrArray* ptrAT = ptrCFnew->BuildActiveTags(nStartCount);
// //ConcatenateLVArrays(&pDest->m_arAllActiveTagsFull, ptrAT, nStartCount);
pDest->m_arClassesTreeFull.Add(ptrCFnew);
}
//------------------------------------------------------------------------
BOOL bResShortTree = pDest->Build_ShortTree();
//-* Post Build processing ----------------------------
if (!PostBuild_Step(&pDest->m_arClassesTreeShort))
{
return FALSE;
}
if (!PostBuild_Step(&pDest->m_arClassesTreeFull))
{
return FALSE;
}
return bResShortTree;
}
BOOL CXTPSyntaxEditLexClassSchema::Build()
{
CXTPSyntaxEditLexClass::CloseClasses(&m_arClassesTreeFull);
CXTPSyntaxEditLexClass::CloseClasses(&m_arClassesTreeShort);
int nClassID = 1;
BOOL bUnused;
CXTPSyntaxEditLexClassPtrArray* ptrArCfile = GetChildrenFor(NULL, bUnused);
int nCount = ptrArCfile ? (int)ptrArCfile->GetSize() : 0;
for (int i = 0; i < nCount; i++)
{
CXTPSyntaxEditLexClassPtr ptrCfile = ptrArCfile->GetAt(i);
CXTPSyntaxEditLexClassPtr ptrCFnew = GetNewClass(TRUE);
if (!ptrCFnew)
{
delete ptrArCfile;
return FALSE;
}
ptrCFnew->CopyFrom(ptrCfile);
CXTPSyntaxEditLexVariant lvID(nClassID++);
ptrCFnew->SetAttribute(XTPLEX_ATTRCLASSID, lvID);
#ifdef DBG_TRACE_LOAD_CLASS_SCH
ptrCFnew->Dump(_T(""));
#endif
CString strCNnew = ptrCFnew->GetClassName();
CStringArray arAddedStack;
arAddedStack.Add(strCNnew);
if (!Build_ChildrenFor(FALSE, ptrCFnew, arAddedStack, nClassID, 0))
{
delete ptrArCfile;
return FALSE;
}
arAddedStack.RemoveAll();
if (!Build_ChildrenFor(TRUE, ptrCFnew, arAddedStack, nClassID, 0))
{
delete ptrArCfile;
return FALSE;
}
int nStartCount = 0;
ptrCFnew->BuildActiveTags(nStartCount);
//CXTPSyntaxEditLexVariantPtrArray* ptrAT = ptrCFnew->BuildActiveTags(nStartCount);
//ConcatenateLVArrays(&m_arAllActiveTagsFull, ptrAT, nStartCount);
m_arClassesTreeFull.Add(ptrCFnew);
}
delete ptrArCfile;
#ifdef DBG_TRACE_LOAD_CLASS_SCH
// m_arAllActiveTagsFull.Dump(_T("AllActiveTags FULL=: "));
#endif
if (!Build_ShortTree())
{
return FALSE;
}
//-* Post Build processing ----------------------------
if (!PostBuild_Step(&m_arClassesTreeShort))
{
return FALSE;
}
if (!PostBuild_Step(&m_arClassesTreeFull))
{
return FALSE;
}
//----------------------
//BOOL bAsc = TRUE, bNoCase = FALSE;
//SortTagsInLexVarArray(m_arAllActiveTagsFull, bAsc, bNoCase);
//SortTagsInLexVarArray(m_arAllActiveTagsShort, bAsc, bNoCase);
// m_arAllActiveTagsFull.BuildAutomat();
// m_arAllActiveTagsShort.BuildAutomat();
//-* Post Build END ------------------------------------------------------
#ifdef _DEBUG
AfxDump(XTPGetLexAutomatMemMan());
#endif
//------------------------------------------------------------------------
return TRUE;
}
BOOL CXTPSyntaxEditLexClassSchema::Build_ShortTree()
{
#ifdef DBG_TRACE_LOAD_CLASS_SCH
TRACE(_T("\n****************** Short classes Tree ********************** \n"));
#endif
int nCount = (int)m_arClassesTreeFull.GetSize();
for (int i = 0; i < nCount; i++)
{
CXTPSyntaxEditLexClassPtr ptrCfile = m_arClassesTreeFull.GetAt(i);
if (!ptrCfile || ptrCfile->GetAttribute_BOOL(XTPLEX_ATTR_PARSEONSCREEN, FALSE))
{
continue;
}
CXTPSyntaxEditLexClassPtr ptrCFnew = GetNewClass(TRUE);
if (!ptrCFnew)
{
return FALSE;
}
ptrCFnew->CopyFrom(ptrCfile);
#ifdef DBG_TRACE_LOAD_CLASS_SCH
ptrCFnew->Dump(_T(""));
#endif
if (!CopyChildrenFor(TRUE, ptrCFnew, ptrCfile, 0))
{
return FALSE;
}
int nStartCount = 0;
ptrCFnew->BuildActiveTags(nStartCount);
//CXTPSyntaxEditLexVariantPtrArray* ptrAT = ptrCFnew->BuildActiveTags(nStartCount);
//ConcatenateLVArrays(&m_arAllActiveTagsShort, ptrAT, nStartCount);
m_arClassesTreeShort.Add(ptrCFnew);
}
#ifdef DBG_TRACE_LOAD_CLASS_SCH
// m_arAllActiveTagsShort.Dump(_T("AllActiveTags Short=: "));
#endif
return TRUE;
}
BOOL CXTPSyntaxEditLexClassSchema::CopyChildrenFor(BOOL bShort, CXTPSyntaxEditLexClass* pCDest,
CXTPSyntaxEditLexClass* pCSrc, int nLevel)
{
#ifdef DBG_TRACE_LOAD_CLASS_SCH
CString strTraceOffset0, strTraceOffset;
for (int t = 0; t <= nLevel; t++)
{
strTraceOffset0 += _T(" ");
}
#endif
CXTPSyntaxEditLexClassPtrArray* pArClasses[3];
pArClasses[0] = pCSrc->GetChildren();
pArClasses[1] = pCSrc->GetChildrenDyn();
pArClasses[2] = pCSrc->GetChildrenSelfRef();
for (int nC = 0; nC < _countof(pArClasses); nC++)
{
BOOL bDynamic = (nC == 1);
BOOL bSelf = (nC == 2);
#ifdef DBG_TRACE_LOAD_CLASS_SCH
if (bDynamic)
{
strTraceOffset = strTraceOffset0 + _T("dyn: ");
}
else if (bSelf)
{
strTraceOffset = strTraceOffset0 + _T("self: ");
}
else
{
strTraceOffset = strTraceOffset0;
}
#endif
int nCount = pArClasses[nC] ? (int)pArClasses[nC]->GetSize() : 0;
for (int i = 0; i < nCount; i++)
{
CXTPSyntaxEditLexClassPtr ptrCsrc = pArClasses[nC]->GetAt(i);
if (!ptrCsrc ||
bShort && ptrCsrc->GetAttribute_BOOL(XTPLEX_ATTR_PARSEONSCREEN, FALSE))
{
continue;
}
if (bSelf)
{
pCDest->AddChild(pCDest, FALSE);
#ifdef DBG_TRACE_LOAD_CLASS_SCH
pCDest->Dump(strTraceOffset);
#endif
}
else
{
CXTPSyntaxEditLexClassPtr ptrCnew = GetNewClass(FALSE);
if (!ptrCnew)
{
return FALSE;
}
ptrCnew->CopyFrom(ptrCsrc);
pCDest->AddChild(ptrCnew, bDynamic);
#ifdef DBG_TRACE_LOAD_CLASS_SCH
ptrCnew->Dump(strTraceOffset);
#endif
ASSERT(pCSrc != ptrCsrc);
if (!CopyChildrenFor(bShort, ptrCnew, ptrCsrc, nLevel+1))
{
return FALSE;
}
}
}
}
return TRUE;
}
BOOL CXTPSyntaxEditLexClassSchema::Build_ChildrenFor(BOOL bDynamic,
CXTPSyntaxEditLexClass* pCBase,
CStringArray& rarAdded,
int& rnNextClassID,
int nLevel)
{
if (!pCBase)
{
ASSERT(FALSE);
return FALSE;
}
#ifdef DBG_TRACE_LOAD_CLASS_SCH
CString strTraceOffset;
for (int t = 0; t <= nLevel; t++)
{
strTraceOffset += _T(" ");
}
if (bDynamic)
{
strTraceOffset += _T("dyn: ");
}
#endif
BOOL bSelfChild = FALSE;
CXTPSyntaxEditLexClassPtrArray* ptrArChildren;
if (bDynamic)
{
ptrArChildren = GetDynChildrenFor(pCBase, bSelfChild);
}
else
{
ptrArChildren = GetChildrenFor(pCBase, bSelfChild);
}
int nCount = ptrArChildren ? (int)ptrArChildren->GetSize() : 0;
for (int i = 0; i < nCount; i++)
{
CXTPSyntaxEditLexClassPtr ptrCsrc = ptrArChildren->GetAt(i);
CString strCNsrc = ptrCsrc->GetClassName();
if (nLevel == 0)
{
rarAdded.RemoveAll();
}
//int nFIdx = Find_noCase(rarAdded, strCNsrc);
//if (nFIdx >= 0)
int nClsCount = FindStrCount(rarAdded, strCNsrc, FALSE);
int nRecurrenceDepth = ptrCsrc->GetAttribute_int(XTPLEX_ATTR_RECURRENCEDEPTH, TRUE, 1);;
if (nClsCount >= nRecurrenceDepth)
{
//CXTPSyntaxEditLexClassPtr ptrC(pCBase->FindParent(strCNsrc), TRUE);
//if (ptrC) {
// pCBase->GetChildrenSelfRef()->Add(ptrC);
//#ifdef DBG_TRACE_LOAD_CLASS_SCH
// strTraceOffset += _T("self: ");
// ptrC->Dump(strTraceOffset);
//#endif
//}
continue;
}
rarAdded.Add(strCNsrc);
CXTPSyntaxEditLexClassPtr ptrCnew = GetNewClass(FALSE);
if (!ptrCnew)
{
delete ptrArChildren;
return FALSE;
}
ptrCnew->CopyFrom(ptrCsrc);
CXTPSyntaxEditLexVariant lvID(rnNextClassID++);
ptrCnew->SetAttribute(XTPLEX_ATTRCLASSID, lvID);
pCBase->AddChild(ptrCnew, bDynamic);
#ifdef DBG_TRACE_LOAD_CLASS_SCH
ptrCnew->Dump(strTraceOffset);
#endif
Build_ChildrenFor(bDynamic, ptrCnew, rarAdded, rnNextClassID, nLevel+1);
Build_ChildrenFor(!bDynamic, ptrCnew, rarAdded, rnNextClassID, nLevel+1);
int nStackCount = (int)rarAdded.GetSize();
if (nStackCount > 0)
{
rarAdded.RemoveAt(nStackCount - 1);
}
}
delete ptrArChildren;
//----------------------------------
if (bSelfChild)
{
if (pCBase->AddChild(pCBase, bDynamic))
{
#ifdef DBG_TRACE_LOAD_CLASS_SCH
strTraceOffset += _T("self: ");
pCBase->Dump(strTraceOffset);
#endif
}
}
return TRUE;
}
BOOL CXTPSyntaxEditLexClassSchema::PostBuild_Step(CXTPSyntaxEditLexClassPtrArray* pArClasses)
{
if (!pArClasses)
{
return TRUE;
}
int nCount = (int)pArClasses->GetSize();
for (int i = 0; i < nCount; i++)
{
CXTPSyntaxEditLexClassPtr ptrC = pArClasses->GetAt(i);
ptrC->SortTags();
CXTPSyntaxEditLexClassPtrArray* ptrCh1 = ptrC->GetChildren();
CXTPSyntaxEditLexClassPtrArray* ptrCh2 = ptrC->GetChildrenDyn();
if (!PostBuild_Step(ptrCh1))
{
return FALSE;
}
if (!PostBuild_Step(ptrCh2))
{
return FALSE;
}
}
return TRUE;
}
void CXTPSyntaxEditLexClassSchema::Close()
{
RemoveAll();
}
void CXTPSyntaxEditLexClassSchema::RemoveAll()
{
CXTPSyntaxEditLexClass::CloseClasses(&m_arPreBuildClassesList);
CXTPSyntaxEditLexClass::CloseClasses(&m_arClassesTreeFull);
CXTPSyntaxEditLexClass::CloseClasses(&m_arClassesTreeShort);
}
CXTPSyntaxEditLexClassPtrArray* CXTPSyntaxEditLexClassSchema::GetClasses(BOOL bShortSch)
{
return bShortSch? &m_arClassesTreeShort: &m_arClassesTreeFull;
}
CXTPSyntaxEditLexClassPtrArray* CXTPSyntaxEditLexClassSchema::GetPreBuildClasses()
{
return &m_arPreBuildClassesList;
}
CXTPSyntaxEditLexClass* CXTPSyntaxEditLexClassSchema::GetNewClass(BOOL bForFile)
{
if (bForFile)
{
return new CXTPSyntaxEditLexClass_file();
}
return new CXTPSyntaxEditLexClass();
}
////////////////////////////////////////////////////////////////////////////
// CXTPSyntaxEditLexParseContext
//class CXTPSyntaxEditLexParseContext : public CXTPInternalUnknown
//CXTPSyntaxEditLexParseContext::CXTPSyntaxEditLexParseContext(CXTPSyntaxEditLexTextBlock* pBlock) :
// CXTPInternalUnknown(pBlock)
//{
// ASSERT(pBlock);
//
// m_pTextBlock = pBlock;
//}
//
//CXTPSyntaxEditLexParseContext::~CXTPSyntaxEditLexParseContext()
//{
//}
//
//void CXTPSyntaxEditLexParseContext::Set(LPCTSTR pcszParopPath, CXTPSyntaxEditLexVariant* pVar)
//{
// if (pVar == NULL) {
// m_mapVars.RemoveKey(pcszParopPath);
//
// }
// else {
// CXTPSyntaxEditLexVariantPtr ptrVar = new CXTPSyntaxEditLexVariant(*pVar);
//
// m_mapVars.SetAt(pcszParopPath, ptrVar);
// }
//}
//
//CXTPSyntaxEditLexVariant* CXTPSyntaxEditLexParseContext::Get(LPCTSTR pcszParopPath)
//{
// CXTPSyntaxEditLexVariantPtr ptrVar;
//
// if (m_mapVars.Lookup(pcszParopPath, ptrVar)) {
// return ptrVar.Detach();
// }
// return NULL;
//}
//
//
//CXTPSyntaxEditLexTextBlock* CXTPSyntaxEditLexParseContext::GetTextBlock()
//{
// if (m_pTextBlock) {
// m_pTextBlock->InternalAddRef();
// }
// return m_pTextBlock;
//}
//
//void CXTPSyntaxEditLexParseContext::Close()
//{
// m_pTextBlock = NULL;
// m_mapVars.RemoveAll();
//}
////////////////////////////////////////////////////////////////////////////
// CXTPSyntaxEditLexTextBlock
CXTPSyntaxEditLexTextBlock::CXTPSyntaxEditLexTextBlock() //:
//m_parseContext(this)
{
m_PosStartLC.nLine = 0;
m_PosStartLC.nCol = 0;
m_PosEndLC.nLine = 0;
m_PosEndLC.nCol = 0;
m_nStartTagLen = 0;
m_nEndTagXLCLen = 0;
m_bEndByParent = FALSE;
}
CXTPSyntaxEditLexTextBlock::~CXTPSyntaxEditLexTextBlock()
{
}
void CXTPSyntaxEditLexTextBlock::Close()
{
m_ptrLexClass = NULL;
m_ptrParent = NULL;
m_ptrPrev = NULL;
m_ptrNext= NULL;
m_ptrLastChild = NULL;
}
CXTPSyntaxEditLexTextBlock* CXTPSyntaxEditLexTextBlock::GetPrevChild(CXTPSyntaxEditLexTextBlock* pChild,
BOOL bWithAddRef)
{
while (pChild && pChild != this)
{
if (!pChild->m_ptrPrev)
{
return NULL;
}
pChild = pChild->m_ptrPrev;
if (pChild && (CXTPSyntaxEditLexTextBlock*)pChild->m_ptrParent == this)
{
if (bWithAddRef)
{
pChild->InternalAddRef();
}
return pChild;
}
}
return NULL;
}
int CXTPSyntaxEditLexTextBlock::EndChildren(CXTPSyntaxEditLexTextSchema* pTxtSch, BOOL bEndByParent)
{
int nCount = 0;
//CSingleLock singleLock(GetDataLoker(), TRUE);
CXTPSyntaxEditLexTextBlock* pChTB = m_ptrLastChild;
while (pChTB)
{
if (!pChTB->m_PosEndLC.IsValidData())
{
pChTB->m_PosEndLC = m_PosEndLC;
pChTB->m_nEndTagXLCLen = m_nEndTagXLCLen;
pChTB->m_bEndByParent = bEndByParent;
nCount++;
if (pTxtSch)
{
pTxtSch->SendEvent_OnTextBlockParsed(pChTB);
}
nCount += pChTB->EndChildren(pTxtSch, bEndByParent);
}
pChTB = GetPrevChild(pChTB, FALSE);
}
return nCount;
}
BOOL CXTPSyntaxEditLexTextBlock::IsLookLikeClosed() const
{
if (!m_ptrLexClass && !m_ptrPrev && !m_ptrNext && !m_ptrLastChild &&
!m_ptrParent)
{
return TRUE;
}
return FALSE;
}
BOOL CXTPSyntaxEditLexTextBlock::IsInclude(CXTPSyntaxEditLexTextBlock* pTB2) const
{
if (!pTB2)
{
ASSERT(FALSE);
return FALSE;
}
ASSERT(m_PosStartLC.IsValidData() && pTB2->m_PosStartLC.IsValidData());
if (m_PosStartLC <= pTB2->m_PosStartLC && m_PosEndLC >= pTB2->m_PosEndLC &&
m_PosEndLC.IsValidData() && pTB2->m_PosEndLC.IsValidData() )
{
return TRUE;
}
return FALSE;
}
BOOL CXTPSyntaxEditLexTextBlock::IsEqualLexClasses(CXTPSyntaxEditLexTextBlock* pTB2) const
{
if (!m_ptrLexClass || !pTB2 || !pTB2->m_ptrLexClass)
{
ASSERT(FALSE);
return FALSE;
}
CString strThisClass = m_ptrLexClass->GetClassName();
CString strTB2Class = pTB2->m_ptrLexClass->GetClassName();
int nCmpRes = strThisClass.CompareNoCase(strTB2Class);
return nCmpRes==0;
}
////////////////////////////////////////////////////////////////////////////
// CXTPSyntaxEditLexAnalyser
CXTPSyntaxEditLexParser::CXTPSyntaxEditLexParser()
{
m_pParseThread = NULL;
m_nParseThreadPriority = THREAD_PRIORITY_NORMAL;
// THREAD_PRIORITY_BELOW_NORMAL
// THREAD_PRIORITY_ABOVE_NORMAL;
// m_SinkMT.SetOuter(this);
m_pConnect = new CXTPNotifyConnection;
m_ptrTextSchema = 0;
m_pSchOptions_default = new CXTPSyntaxEditLexParserSchemaOptions();
}
CXTPSyntaxEditLexParser::~CXTPSyntaxEditLexParser()
{
Close();
ASSERT(m_ptrTextSchema == 0);
#ifdef XTP_DBG_DUMP_OBJ
afxDump.SetDepth( 1 );
#endif
CMDTARGET_RELEASE(m_pConnect);
CMDTARGET_RELEASE(m_pSchOptions_default);
RemoveAllOptions();
}
void CXTPSyntaxEditLexParser::RemoveAllOptions()
{
POSITION pos = m_mapSchOptions.GetStartPosition();
while (pos)
{
CXTPSyntaxEditLexParserSchemaOptions* pOptions = NULL;
CString key;
m_mapSchOptions.GetNextAssoc(pos, key, pOptions);
CMDTARGET_RELEASE(pOptions);
}
m_mapSchOptions.RemoveAll();
}
CXTPNotifyConnection* CXTPSyntaxEditLexParser::GetConnection()
{
return m_pConnect;
}
CXTPSyntaxEditLexParser::CXTPSyntaxEditParseThreadParams::CXTPSyntaxEditParseThreadParams()
{
ptrBuffer = NULL;
}
void CXTPSyntaxEditLexParser::CXTPSyntaxEditParseThreadParams::AddParseZone(const CXTPSyntaxEditTextRegion& rZone)
{
const int cnEpsilon = XTP_EDIT_XLC(3, 0);
int nCount = (int)arInvalidZones.GetSize();
for (int i = 0; i < nCount; i++)
{
CXTPSyntaxEditTextRegion zoneI = arInvalidZones[i];
if (rZone.m_posEnd >= zoneI.m_posStart &&
rZone.m_posStart <= zoneI.m_posStart
||
rZone.m_posEnd.GetXLC()+cnEpsilon >= zoneI.m_posStart.GetXLC() &&
rZone.m_posStart <= zoneI.m_posStart
)
{
zoneI.m_posStart = rZone.m_posStart;
arInvalidZones[i] = zoneI;
return;
}
else if (rZone.m_posStart <= zoneI.m_posEnd &&
rZone.m_posEnd >= zoneI.m_posEnd
||
rZone.m_posStart.GetXLC()-cnEpsilon <= zoneI.m_posEnd.GetXLC() &&
rZone.m_posEnd >= zoneI.m_posEnd
)
{
zoneI.m_posEnd = rZone.m_posEnd;
arInvalidZones[i] = zoneI;
return;
}
else if (rZone.m_posStart >= zoneI.m_posStart
&& rZone.m_posEnd <= zoneI.m_posEnd)
{
return; //nothing
}
}
arInvalidZones.Add(rZone);
}
void CXTPSyntaxEditLexParser::Close()
{
CSingleLock singLockMain(&m_csParserData);
CloseParseThread();
m_SinkMT.UnadviseAll();
CMDTARGET_RELEASE(m_ptrTextSchema);
}
void CXTPSyntaxEditLexParser::SelfCloseParseThread()
{
ASSERT(m_pParseThread);
if (m_pParseThread)
{
m_pParseThread = NULL;
m_PThreadParams.evExitThread.ResetEvent();
ASSERT(m_PThreadParams.arInvalidZones.GetSize() == 0);
if (m_ptrTextSchema)
{
m_ptrTextSchema->GetBreakParsingEvent()->ResetEvent();
}
}
}
//===========================================================================
//#pragma warning(push)
#pragma warning(disable: 4702) // warning C4702: unreachable code
//----------------------------
void CXTPSyntaxEditLexParser::CloseParseThread()
{
StopParseInThread();
CSingleLock singLockMain(&m_csParserData);
if (m_pParseThread)
{
HANDLE hThread = NULL;
try
{
hThread = m_pParseThread->m_hThread;
}
catch (...)
{
TRACE(_T("ERROR! Parse Thread is not exist. [CloseParseThread()]\n"));
}
m_pParseThread = NULL;
DWORD dwThreadRes = WAIT_TIMEOUT;
for (int i = 0; i < 10 && dwThreadRes == WAIT_TIMEOUT; i++)
{
m_PThreadParams.evParseRun.ResetEvent();
m_PThreadParams.evExitThread.SetEvent();
if (m_ptrTextSchema)
{
m_ptrTextSchema->GetBreakParsingEvent()->SetEvent();
}
if (hThread)
{
dwThreadRes = ::WaitForSingleObject(hThread, 20*1000);
}
else
{
Sleep(5000);
break;
}
}
if (dwThreadRes == WAIT_TIMEOUT && hThread)
{
::TerminateThread(hThread, 0);
TRACE(_T("ERROR! Parser thread was not ended by normal way. It was terminated. \n"));
}
m_PThreadParams.evExitThread.ResetEvent();
m_PThreadParams.arInvalidZones.RemoveAll();
if (m_ptrTextSchema)
{
m_ptrTextSchema->GetBreakParsingEvent()->ResetEvent();
}
}
}
//#pragma warning(pop)
//===========================================================================
CXTPSyntaxEditLexTextBlock* CXTPSyntaxEditLexTextSchema::GetBlocks()
{
return m_ptrFirstBlock.GetInterface(TRUE);
}
CXTPSyntaxEditLexTextBlock* CXTPSyntaxEditLexTextSchema::FindNearestTextBlock(XTP_EDIT_LINECOL posText)
{
CSingleLock singleLock(GetDataLoker(), TRUE);
//---------------------------------------------------------------------------
CXTPSyntaxEditLexTextBlockPtr ptrTBstart = GetBlocks();
CXTPSyntaxEditLexTextBlock* pTBnearest = ptrTBstart;
for (CXTPSyntaxEditLexTextBlock* pTB = ptrTBstart; pTB; pTB = pTB->m_ptrNext)
{
if (posText < pTB->m_PosStartLC)
{
break;
}
pTBnearest = pTB;
}
//--------------------------
while (pTBnearest && pTBnearest->m_ptrPrev &&
pTBnearest->m_PosStartLC == pTBnearest->m_ptrPrev->m_PosStartLC)
{
pTBnearest = pTBnearest->m_ptrPrev;
}
//--------------------------
if (pTBnearest)
{
pTBnearest->InternalAddRef();
}
return pTBnearest;
}
BOOL CXTPSyntaxEditLexTextSchema::UpdateTBNearest(CXTPSyntaxEditLexTextBlock* pNarestTB1,
int nLineDiff, int nColDiff,
XTP_EDIT_LINECOL posFrom, XTP_EDIT_LINECOL posTo,
int eEditAction )
{
int nResult = xtpEditUTBNothing;
CXTPSyntaxEditLexTextBlock* pTB;
for (pTB = pNarestTB1; pTB; pTB = pTB->m_ptrParent)
{
ASSERT(pTB != pTB->m_ptrParent);
//-------------------------------------------------------------
BOOL bIsBlockStartIntersected = eEditAction == xtpEditActDelete &&
pTB->m_PosStartLC >= posFrom && pTB->m_PosStartLC < posTo
||
eEditAction == xtpEditActInsert &&
pTB->m_PosStartLC < posFrom &&
posFrom.GetXLC() < pTB->GetStartTagEndXLC();
if (bIsBlockStartIntersected)
{
nResult |= xtpEditUTBReparse;
if (pTB == pNarestTB1)
{
nResult |= xtpEditUTBNearestUpdated;
}
// set empty
pTB->m_PosEndLC.nLine = pTB->m_PosStartLC.nLine;
pTB->m_PosEndLC.nCol = pTB->m_PosStartLC.nCol-1;
continue;
}
//-------------------------------------------------------------
BOOL bIsEditingFullyInside = eEditAction == xtpEditActInsert &&
pTB->GetStartTagEndXLC() <= posFrom.GetXLC() &&
posFrom.GetXLC() <= pTB->GetEndTagBeginXLC()
||
eEditAction == xtpEditActDelete &&
pTB->GetStartTagEndXLC() <= posFrom.GetXLC() &&
posTo.GetXLC() <= pTB->GetEndTagBeginXLC();
if (bIsEditingFullyInside)
{
if (pTB == pNarestTB1)
{
nResult |= xtpEditUTBNearestUpdated;
}
BOOL bEmpty = FALSE;
pTB->m_PosEndLC.nLine += nLineDiff;
if (pTB->m_PosEndLC.nLine < pTB->m_PosStartLC.nLine)
{
// set empty
bEmpty = TRUE;
pTB->m_PosEndLC.nLine = pTB->m_PosStartLC.nLine;
pTB->m_PosEndLC.nCol = pTB->m_PosStartLC.nCol-1;
}
int nELine = eEditAction == xtpEditActInsert ? posTo.nLine : posFrom.nLine;
if (!bEmpty && pTB->m_PosEndLC.nLine == nELine)
{
pTB->m_PosEndLC.nCol += nColDiff;
if (pTB->m_PosEndLC.nCol < 0)
{
pTB->m_PosEndLC.nCol = 0;
}
}
continue;
}
//-------------------------------------------------------------
BOOL bIsBlockEndIntersected = eEditAction == xtpEditActDelete &&
(!(posTo.GetXLC() <= pTB->GetEndTagBeginXLC() ||
posFrom.GetXLC() > pTB->GetEndTagEndXLC() )
)
||
eEditAction == xtpEditActInsert &&
posFrom.GetXLC() > pTB->GetEndTagBeginXLC() &&
posFrom.GetXLC() <= pTB->GetEndTagEndXLC();
if (bIsBlockEndIntersected)
{
nResult |= xtpEditUTBReparse;
if (pTB == pNarestTB1)
{
nResult |= xtpEditUTBNearestUpdated;
}
// set empty
pTB->m_PosEndLC.nLine = 0;
pTB->m_PosEndLC.nCol = 0;
continue;
}
}
//--------------------
return nResult;
}
int CXTPSyntaxEditLexTextSchema::UpdateTextBlocks(XTP_EDIT_LINECOL posFrom, XTP_EDIT_LINECOL posTo,
int eEditAction )
{
CSingleLock singleLock(GetDataLoker());
//BOOL bLocked = TryLockCS(&singleLock, GetDataLoker(), 5000, 50);
BOOL bLocked = singleLock.Lock(5000);
if (!bLocked)
{
ASSERT(FALSE);
TRACE(_T("ERROR! Cannot enter critical section. [Dead lock, hang up???] CXTPSyntaxEditLexTextSchema::UpdateTextBlocks() \n"));
return xtpEditUTBError;
}
CXTPSyntaxEditLexTextBlockPtr ptrNarestTB1 = FindNearestTextBlock(posFrom);
if (!ptrNarestTB1)
{
return xtpEditUTBNothing;
}
int nLineDiff = posTo.nLine - posFrom.nLine;
int nColDiff = posTo.nCol - posFrom.nCol;
ASSERT(nLineDiff >= 0);
if (eEditAction == xtpEditActDelete)
{
nLineDiff *= -1;
nColDiff *= -1;
}
//- (1)- update FullyInside nearest and parents blocks
int nURes = UpdateTBNearest(ptrNarestTB1, nLineDiff,
nColDiff, posFrom, posTo, eEditAction);
//- (2)- update block after nearest
CXTPSyntaxEditLexTextBlock* pTB = (nURes & xtpEditUTBNearestUpdated) ? ptrNarestTB1->m_ptrNext :
ptrNarestTB1;
for (; pTB; pTB = pTB->m_ptrNext)
{
//-------------------------------------------------------------
BOOL bIsBlockStartIntersected = eEditAction == xtpEditActDelete &&
(!(posTo <= pTB->m_PosStartLC ||
posFrom.GetXLC() >= pTB->GetStartTagEndXLC())
)
||
eEditAction == xtpEditActInsert &&
pTB->m_PosStartLC < posFrom &&
posFrom.GetXLC() < pTB->GetStartTagEndXLC();
if (bIsBlockStartIntersected)
{
nURes |= xtpEditUTBReparse;
// set empty
pTB->m_PosEndLC.nLine = pTB->m_PosStartLC.nLine;
pTB->m_PosEndLC.nCol = pTB->m_PosStartLC.nCol-1;
continue;
}
//-------------------------------------------------------------
BOOL bIsEditingFullyInside = eEditAction == xtpEditActInsert &&
pTB->GetStartTagEndXLC() <= posFrom.GetXLC() &&
posFrom.GetXLC() <= pTB->GetEndTagBeginXLC()
||
eEditAction == xtpEditActDelete &&
pTB->GetStartTagEndXLC() <= posFrom.GetXLC() &&
posTo.GetXLC() <= pTB->GetEndTagBeginXLC(); // ??? +- 1;
if (bIsEditingFullyInside)
{
BOOL bEmpty = FALSE;
pTB->m_PosEndLC.nLine += nLineDiff;
if (pTB->m_PosEndLC.nLine < pTB->m_PosStartLC.nLine)
{
// set empty
bEmpty = TRUE;
pTB->m_PosEndLC.nLine = pTB->m_PosStartLC.nLine;
pTB->m_PosEndLC.nCol = pTB->m_PosStartLC.nCol-1;
}
int nELine = eEditAction == xtpEditActInsert ? posTo.nLine : posFrom.nLine;
if (!bEmpty && pTB->m_PosEndLC.nLine == nELine)
{
pTB->m_PosEndLC.nCol += nColDiff;
if (pTB->m_PosEndLC.nCol < 0)
{
pTB->m_PosEndLC.nCol = 0;
}
}
continue;
}
//-------------------------------------------------------------
BOOL bIsBlockEndIntersected = eEditAction == xtpEditActDelete &&
(!(posTo.GetXLC() <= pTB->GetEndTagBeginXLC() ||
posFrom.GetXLC() > pTB->GetEndTagEndXLC() )
)
||
eEditAction == xtpEditActInsert &&
posFrom.GetXLC() > pTB->GetEndTagBeginXLC() &&
posFrom.GetXLC() <= pTB->GetEndTagEndXLC();
if (bIsBlockEndIntersected)
{
nURes |= xtpEditUTBReparse;
// set empty
pTB->m_PosEndLC.nLine = 0;
pTB->m_PosEndLC.nCol = 0;
continue;
}
//-------------------------------------------------------------------
BOOL bIsBlockOutside = eEditAction == xtpEditActInsert &&
pTB->m_PosStartLC >= posFrom ||
eEditAction == xtpEditActDelete && pTB->m_PosStartLC >= posTo;
//-----------------------------
int nELine = eEditAction == xtpEditActInsert ? posTo.nLine : posFrom.nLine;
if (bIsBlockOutside && nLineDiff == 0 &&
pTB->m_PosStartLC.nLine != nELine &&
pTB->m_PosEndLC.nLine != nELine)
{
break;
}
//-------------------------------------------------------------------
if (bIsBlockOutside )
{
pTB->m_PosStartLC.nLine += nLineDiff;
pTB->m_PosEndLC.nLine += nLineDiff;
if (pTB->m_PosStartLC.nLine == nELine)
{
pTB->m_PosStartLC.nCol += nColDiff;
}
if (pTB->m_PosEndLC.nLine == nELine)
{
pTB->m_PosEndLC.nCol += nColDiff;
}
}
//-------------------------------------------------------------------
}
return nURes;
}
BOOL CXTPSyntaxEditLexTextSchema::LoadClassSchema(CXTPSyntaxEditLexClassInfoArray* arClassInfo)
{
CSingleLock singleLockCls(GetClassSchLoker(), TRUE);
CSingleLock singleLock(GetDataLoker(), TRUE);
RemoveAll();
m_pClassSchema->RemoveAll();
int nCCount = (int)arClassInfo->GetSize();
for (int i = 0; i < nCCount; i++)
{
const XTP_EDIT_LEXCLASSINFO& infoClass = arClassInfo->GetAt(i);
CXTPSyntaxEditLexClassPtr ptrLexClass = m_pClassSchema->GetNewClass(FALSE);
if (!ptrLexClass)
{
return FALSE;
}
ptrLexClass->m_strClassName = infoClass.csClassName;
int nPCount = (int)infoClass.arPropertyDesc.GetSize();
for (int k = 0; k < nPCount; k++)
{
const XTP_EDIT_LEXPROPINFO& infoProp = infoClass.arPropertyDesc[k];
if (!ptrLexClass->SetProp(&infoProp))
{
ASSERT(FALSE);
}
}
m_pClassSchema->AddPreBuildClass(ptrLexClass);
#ifdef DBG_TRACE_LOAD_CLASS_SCH
{
BOOL bEmpty = ptrLexClass->IsEmpty() && ptrLexClass->m_Parent.eOpt != xtpEditOptParent_file;
LPCTSTR cszPref = bEmpty ? _T("* !EMPTY! (it is not used)* ") : _T("* ");
ptrLexClass->Dump(cszPref);
}
#endif
}
return TRUE;
//BOOL bRes = m_pClassSchema->Build();
//return bRes;
}
void CXTPSyntaxEditLexTextSchema::BuildIfNeed()
{
CSingleLock singleLockCls(GetClassSchLoker(), TRUE);
CSingleLock singleLock(GetDataLoker(), TRUE);
CXTPSyntaxEditLexClassPtrArray* ptrArCfile = m_pClassSchema->GetClasses(FALSE);
if (!ptrArCfile || ptrArCfile->GetSize() == 0)
{
m_pClassSchema->Build();
}
}
BOOL CXTPSyntaxEditLexTextSchema::IsFileExtSupported(const CString& strExt)
{
CXTPSyntaxEditLexClassPtr ptrTopCls = GetTopClassForFileExt(strExt);
return ptrTopCls != NULL;
}
CXTPSyntaxEditLexClass* CXTPSyntaxEditLexTextSchema::GetTopClassForFileExt(const CString& strExt)
{
CString strPropName = _T("IsExt=") + strExt;
CXTPSyntaxEditLexClassPtrArray arTopClasses;
CXTPSyntaxEditLexClassPtrArray* ptrArCfile = m_pClassSchema->GetClasses(TRUE);
int nCount = ptrArCfile ? (int)ptrArCfile->GetSize() : 0;
int i;
if (nCount == 0)
{
BOOL bUnused;
ptrArCfile = m_pClassSchema->GetChildrenFor(NULL, bUnused);
nCount = ptrArCfile ? (int)ptrArCfile->GetSize() : 0;
for (i = 0; i < nCount; i++)
{
CXTPSyntaxEditLexClassPtr ptrCfile = ptrArCfile->GetAt(i);
CXTPSyntaxEditLexClassPtr ptrCFnew = m_pClassSchema->GetNewClass(TRUE);
if (ptrCFnew)
{
ptrCFnew->CopyFrom(ptrCfile);
arTopClasses.AddPtr(ptrCFnew, TRUE);
}
}
SAFE_DELETE(ptrArCfile);
ptrArCfile = &arTopClasses;
}
nCount = ptrArCfile ? (int)ptrArCfile->GetSize() : 0;
for (i = 0; i < nCount; i++)
{
CXTPSyntaxEditLexClassPtr ptrCfile = ptrArCfile->GetAt(i);
CXTPSyntaxEditLexVariantPtr ptrRes = ptrCfile->PropV(strPropName);
if (!ptrRes || ptrRes->m_nObjType != xtpEditLVT_valInt)
{
ASSERT(FALSE);
continue;
}
if (ptrRes->m_nValue)
{
return ptrCfile.Detach();
}
}
return NULL;
}
CXTPSyntaxEditLexTextSchema* CXTPSyntaxEditLexParser::GetTextSchema()
{
return m_ptrTextSchema;
}
void CXTPSyntaxEditLexParser::SetTextSchema(CXTPSyntaxEditLexTextSchema* pTextSchema)
{
CSingleLock singLockMain(&m_csParserData);
CloseParseThread();
if (m_ptrTextSchema)
{
m_ptrTextSchema->RemoveAll();
}
m_SinkMT.UnadviseAll();
CMDTARGET_RELEASE(m_ptrTextSchema);
RemoveAllOptions();
if (pTextSchema)
{
pTextSchema->BuildIfNeed();
m_ptrTextSchema = pTextSchema->Clone();
CXTPNotifyConnection* ptrConn = m_ptrTextSchema ? m_ptrTextSchema->GetConnection() : NULL;
if (ptrConn)
{
m_SinkMT.Advise(ptrConn, xtpEditOnParserStarted, &XTPSyntaxEditLexAnalyser::CXTPSyntaxEditLexParser::OnParseEvent_NotificationHandler);
m_SinkMT.Advise(ptrConn, xtpEditOnTextBlockParsed, &XTPSyntaxEditLexAnalyser::CXTPSyntaxEditLexParser::OnParseEvent_NotificationHandler);
m_SinkMT.Advise(ptrConn, xtpEditOnParserEnded, &XTPSyntaxEditLexAnalyser::CXTPSyntaxEditLexParser::OnParseEvent_NotificationHandler);
}
}
#ifdef _DEBUG
AfxDump(XTPGetLexAutomatMemMan());
#endif
}
BOOL CXTPSyntaxEditLexParser::GetTokensForAutoCompleate(CXTPSyntaxEditLexTokensDefArray& rArTokens,
BOOL bAppend)
{
CSingleLock singLockMain(&m_csParserData);
if (!bAppend)
{
rArTokens.RemoveAll();
}
CXTPSyntaxEditLexTextSchema* ptrTxtSch = GetTextSchema();
CXTPSyntaxEditLexClassSchema* ptrClsSch = ptrTxtSch ? ptrTxtSch->GetClassSchema() : NULL;
CXTPSyntaxEditLexClassPtrArray* ptrArCls = ptrClsSch ? ptrClsSch->GetPreBuildClasses() : NULL;
if (!ptrArCls)
{
return FALSE;
}
//--------------------------------------------------
int nCCount = (int)ptrArCls->GetSize();
for (int i = 0; i < nCCount; i++)
{
CXTPSyntaxEditLexTokensDef tmpTkDef;
CXTPSyntaxEditLexClassPtr ptrCls = ptrArCls->GetAt(i);
CXTPSyntaxEditLexVariantPtr ptrTags = ptrCls->PropV(_T("token:tag"));
if (!ptrTags)
{
continue;
}
GetStrsFromLVArray(ptrTags, tmpTkDef.m_arTokens);
//--------------------
CXTPSyntaxEditLexVariantPtr ptrSartSeps = ptrCls->PropV(_T("token:start:separators"));
CXTPSyntaxEditLexVariantPtr ptrEndSeps = ptrCls->PropV(_T("token:end:separators"));
if (ptrSartSeps)
{
GetStrsFromLVArray(ptrSartSeps, tmpTkDef.m_arStartSeps);
}
if (ptrEndSeps)
{
GetStrsFromLVArray(ptrEndSeps, tmpTkDef.m_arEndSeps);
}
//=================
rArTokens.Add(tmpTkDef);
}
return TRUE;
}
void CXTPSyntaxEditLexParser::GetStrsFromLVArray(CXTPSyntaxEditLexVariant* pLVArray,
CStringArray& rArStrs) const
{
if (!pLVArray || pLVArray->m_nObjType != xtpEditLVT_LVArrayPtr ||
!pLVArray->m_ptrLVArrayPtr)
{
ASSERT(FALSE);
return;
}
int nCount = (int)pLVArray->m_ptrLVArrayPtr->GetSize();
for (int i = 0; i < nCount; i++)
{
CXTPSyntaxEditLexVariantPtr ptrLVVal = pLVArray->m_ptrLVArrayPtr->GetAt(i);
ASSERT(ptrLVVal);
if (ptrLVVal && ptrLVVal->m_nObjType == xtpEditLVT_valStr)
{
for (int k = 0; k < ptrLVVal->m_arStrVals.GetSize(); k++)
{
CString strVal = ptrLVVal->m_arStrVals[k];
ASSERT(strVal.GetLength());
if (strVal.GetLength())
{
rArStrs.Add(strVal);
}
}
}
}
}
////////////////////////////////////////////////////////////////////////////
CXTPSyntaxEditLexParser::CXTPSyntaxEditParseThreadParams* CXTPSyntaxEditLexParser::GetParseInThreadParams()
{
return &m_PThreadParams;
}
void CXTPSyntaxEditLexParser::StartParseInThread(CXTPSyntaxEditBufferManager* pBuffer,
const XTP_EDIT_LINECOL* pLCStart, const XTP_EDIT_LINECOL* pLCEnd,
int eEdinAction, BOOL bRunWithoutWait)
{
UNREFERENCED_PARAMETER(eEdinAction);
DBG_TRACE_TIME(1, _T("### ### ### StartParseInThread time = "));
CSingleLock singLockMain(&m_csParserData);
if (!m_ptrTextSchema)
{
return;
}
CSingleLock singLockPrm(&m_PThreadParams.lockThreadParams);
//if (IsCSLocked(m_PThreadParams.lockThreadParams)) {
if (IsMutexLocked(&m_PThreadParams.lockThreadParams))
{
DBG_TRACE_PARSE_START_STOP(_T("- Parser set BREAK Event. \n"));
VERIFY( m_ptrTextSchema->GetBreakParsingEvent()->SetEvent() );
}
if (!singLockPrm.Lock())
{
ASSERT(FALSE);
return;
}
m_PThreadParams.ptrBuffer = pBuffer;
CXTPSyntaxEditTextRegion invZone;
if (pLCStart && !pLCEnd && pLCStart->GetXLC() == XTP_EDIT_XLC(1, 0) )
{
invZone.Set(pLCStart, pLCEnd);
m_PThreadParams.arInvalidZones.RemoveAll();
m_PThreadParams.AddParseZone(invZone);
}
else if (pLCStart || pLCEnd)
{
invZone.Set(pLCStart, pLCEnd);
m_PThreadParams.AddParseZone(invZone);
}
if (!m_pParseThread)
{// create thread
m_pParseThread = AfxBeginThread(ThreadParseProc, this, m_nParseThreadPriority);
if (!m_pParseThread)
{
ASSERT(FALSE);
return;
}
}
if (!SetParseThreadPriority(m_nParseThreadPriority))
{
// try to start a new thread
StartParseInThread(pBuffer, pLCStart, pLCEnd, eEdinAction, bRunWithoutWait);
}
CString sDBGpos = DBG_TraceIZone(pLCStart, pLCEnd);
DBG_TRACE_PARSE_START_STOP(_T("- Parser set START Event. Add invalid Zone [ %s ] \n"), (LPCTSTR)sDBGpos);
if (bRunWithoutWait)
{
VERIFY( m_PThreadParams.evRunWithoutWait.SetEvent() );
}
VERIFY( m_PThreadParams.evParseRun.SetEvent() );
}
void CXTPSyntaxEditLexParser::StopParseInThread()
{
DBG_TRACE_TIME(1, _T("### ### ### STOP Parse In Thread time = "));
CSingleLock singLockMain(&m_csParserData);
if (!m_ptrTextSchema)
{
return;
}
CSingleLock singLockPrm(&m_PThreadParams.lockThreadParams);
CEvent* pBreakEvent = m_ptrTextSchema->GetBreakParsingEvent();
ASSERT(pBreakEvent);
if (!pBreakEvent)
return;
if (IsMutexLocked(&m_PThreadParams.lockThreadParams))
{
VERIFY( pBreakEvent->SetEvent() );
DBG_TRACE_PARSE_START_STOP(_T("- STOP Parser set BREAK Event. \n"));
}
if (!singLockPrm.Lock())
{
ASSERT(FALSE);
return;
}
if (IsEventSet(*pBreakEvent))
{
VERIFY( pBreakEvent->ResetEvent() );
DBG_TRACE_PARSE_START_STOP(_T("- STOP Parser REset BREAK Event. \n"));
}
DBG_TRACE_PARSE_START_STOP(_T("- STOP Parser finished. \n"));
}
int CXTPSyntaxEditLexParser::GetParseThreadPriority()
{
try
{
if (m_pParseThread)
{
int nPriority = m_pParseThread->GetThreadPriority();
return nPriority;
}
}
catch (...)
{
m_pParseThread = NULL;
TRACE(_T("ERROR! Parse Thread is not exist. \n"));
};
return m_nParseThreadPriority;
}
BOOL CXTPSyntaxEditLexParser::SetParseThreadPriority(int nPriority)
{
m_nParseThreadPriority = nPriority;
try
{
if (m_pParseThread)
{
if (m_nParseThreadPriority != m_pParseThread->GetThreadPriority())
{
m_pParseThread->SetThreadPriority(m_nParseThreadPriority);
}
}
}
catch (...)
{
TRACE(_T("ERROR! Parse Thread is not exist. \n"));
m_pParseThread = NULL;
return FALSE;
}
return TRUE;
}
void CXTPSyntaxEditLexParser::OnBeforeEditChanged()
{
//CSingleLock singLockMain(&m_csParserData);
StopParseInThread();
}
void CXTPSyntaxEditLexParser::OnEditChanged(const XTP_EDIT_LINECOL& posFrom,
const XTP_EDIT_LINECOL& posTo, int eEditAction,
CXTPSyntaxEditBufferManager* pBuffer)
{
DBG_TRACE_TIME(1, _T("### ### ### OnEditChanged time = "));
CSingleLock singLockMain(&m_csParserData);
if (!m_ptrTextSchema)
{
return;
}
if (!pBuffer)
{
ASSERT(FALSE);
return;
}
m_ptrTextSchema->UpdateTextBlocks(posFrom, posTo, eEditAction);
BOOL bThreadParse = GetSchemaOptions(pBuffer->GetFileExt())->m_bEditReparceInSeparateThread;
if (bThreadParse)
{
StartParseInThread(pBuffer, &posFrom, &posTo, eEditAction, FALSE);
}
else
{
CXTPSyntaxEditTextIterator txtIter(pBuffer);
m_ptrTextSchema->RunParseUpdate(TRUE, &txtIter, &posFrom, &posTo);
}
}
void CXTPSyntaxEditLexParser::OnParseEvent_NotificationHandler(XTP_NOTIFY_CODE Event,
WPARAM wParam, LPARAM lParam)
{
if (Event == xtpEditOnTextBlockParsed)
{
CXTPSyntaxEditLexTextBlockPtr ptrTBended;
CXTPSyntaxEditLexTextSchema* ptrTextSch = GetTextSchema();
ptrTBended = ptrTextSch ? ptrTextSch->GetLastParsedBlock(wParam) : NULL;
if (ptrTBended)
{
m_pConnect->SendEvent(Event, (WPARAM)(CXTPSyntaxEditLexTextBlock*)ptrTBended, 0);
}
}
else
{
m_pConnect->SendEvent(Event, wParam, lParam);
}
}
UINT CXTPSyntaxEditLexParser::ThreadParseProc(LPVOID pParentParser)
{
DBG_TRACE_PARSE_START_STOP(_T("*** Parser Thread is started. %08x\n"), ::GetCurrentThreadId());
if (!pParentParser)
{
ASSERT(FALSE);
return 111;
}
// try
{
CXTPSyntaxEditLexParserPtr ptrParser((CXTPSyntaxEditLexParser*)pParentParser, TRUE);
CXTPSyntaxEditLexParser::CXTPSyntaxEditParseThreadParams* pPRMs = NULL;
pPRMs = ptrParser->GetParseInThreadParams();
if (!pPRMs)
{
ASSERT(FALSE);
return 222;
}
CSingleLock lockPRMs(&pPRMs->lockThreadParams, TRUE);
HANDLE arWaiters[] = {pPRMs->evParseRun, pPRMs->evExitThread};
HANDLE hRunWithoutWait = pPRMs->evRunWithoutWait;
DWORD dwSelfCloseTimeout_ms = ptrParser->GetSchemaOptions(
pPRMs->ptrBuffer->GetFileExt())->m_dwParserThreadIdleLifeTime_ms;
DWORD dwWaitFilter_ms = ptrParser->GetSchemaOptions(
pPRMs->ptrBuffer->GetFileExt())->m_dwEditReparceTimeout_ms;
lockPRMs.Unlock();
DWORD dwWaitRes = 0;
do
{
dwWaitRes = WaitForMultipleObjects(2, arWaiters, FALSE, dwSelfCloseTimeout_ms);
if (dwWaitRes == WAIT_TIMEOUT)
{
CSingleLock lockPRMs1(&pPRMs->lockThreadParams, TRUE);
if (pPRMs->arInvalidZones.GetSize() == 0)
{
ptrParser->SelfCloseParseThread();
return 1;
}
else
{
continue;
}
}
//=== Wait Filter === (for keyboard input)
if (dwWaitRes == WAIT_OBJECT_0 && !IsEventSet(hRunWithoutWait))
{
do {
dwWaitRes = WaitForMultipleObjects(2, arWaiters, FALSE, dwWaitFilter_ms);
}
while (dwWaitRes == WAIT_OBJECT_0 && !IsEventSet(hRunWithoutWait));
if (dwWaitRes == WAIT_TIMEOUT)
{
dwWaitRes = WAIT_OBJECT_0;
}
}
//=== Wait Filter === (for keyboard input)
if (dwWaitRes == WAIT_OBJECT_0)
{
//***
CSingleLock lockPRMs2(&pPRMs->lockThreadParams, TRUE);
//***
// Update Options
dwSelfCloseTimeout_ms = ptrParser->GetSchemaOptions(
pPRMs->ptrBuffer->GetFileExt())->m_dwParserThreadIdleLifeTime_ms;
dwWaitFilter_ms = ptrParser->GetSchemaOptions(
pPRMs->ptrBuffer->GetFileExt())->m_dwEditReparceTimeout_ms;
// END Update Options
CXTPSyntaxEditTextIterator txtIter(pPRMs->ptrBuffer);
CXTPSyntaxEditLexTextSchema* ptrTextSch = ptrParser->GetTextSchema();
if (!ptrTextSch)
{
continue;
}
CEvent* pBreakEvent = ptrTextSch->GetBreakParsingEvent();
ASSERT(pBreakEvent);
int nZonesCount = 0;
BOOL bParseRestedBlock = FALSE;
BOOL bBreaked = FALSE;
do
{
if (IsEventSet(*pBreakEvent))
{
VERIFY( pBreakEvent->ResetEvent() );
DBG_TRACE_PARSE_START_STOP(_T("* Parser Start BREAKED. \n"));
break;
}
XTP_EDIT_LINECOL* pLCStart = NULL;
XTP_EDIT_LINECOL* pLCEnd = NULL;
CXTPSyntaxEditTextRegion iZone;
nZonesCount = (int)pPRMs->arInvalidZones.GetSize();
//bParseRestedBlock = FALSE; //nZonesCount > 0;
if (nZonesCount)
{
iZone = pPRMs->arInvalidZones[nZonesCount-1];
if (iZone.m_posStart.IsValidData())
{
pLCStart = &iZone.m_posStart;
}
if (iZone.m_posEnd.IsValidData())
{
pLCEnd = &iZone.m_posEnd;
}
}
CString sDBGpos = DBG_TraceIZone(pLCStart, pLCEnd);
DBG_TRACE_PARSE_START_STOP(_T("* Parser Started. Invalid Zone [%s] \n"), sDBGpos);
// run parser
/*DEBUG*/ DWORD dwTime0 = GetTickCount(); //DEBUG
int nParseRes = ptrTextSch->RunParseUpdate(TRUE, &txtIter,
pLCStart, pLCEnd, TRUE);
if (nParseRes & xtpEditLPR_Error)
{
//ASSERT(FALSE);
//::MessageBeep((UINT)-1);
TRACE(_T("Lex Parser ERROR! Try Full reparse. \n"));
ptrTextSch->RemoveAll();
XTP_EDIT_LINECOL posLC1 = {1,0};
txtIter.SeekBegin();
nParseRes = ptrTextSch->RunParseUpdate(TRUE, &txtIter,
&posLC1, NULL);
pPRMs->arInvalidZones.RemoveAll();
nZonesCount = 0;
if (nParseRes & xtpEditLPR_RunFinished)
{
TRACE(_T("Full reparse - (OK) <F I N I S H E D> \n"));
}
else if (nParseRes & xtpEditLPR_RunBreaked)
{
TRACE(_T("Full reparse - BREAKED \n"));
iZone.Set(NULL, NULL);
pPRMs->arInvalidZones.Add(iZone);
}
else if (nParseRes & xtpEditLPR_Error)
{
TRACE(_T("Full reparse - ERROR \n"));
}
nZonesCount = (int)pPRMs->arInvalidZones.GetSize();
}
/*DEBUG*/ DWORD dwTime1 = GetTickCount();//DEBUG
bBreaked = (nParseRes & xtpEditLPR_RunFinished) == 0 ||
(nParseRes & (xtpEditLPR_RunBreaked|xtpEditLPR_Error)) > 0 ||
IsEventSet(*pBreakEvent);
VERIFY( pBreakEvent->ResetEvent() );
CXTPSyntaxEditTextRegion zoneValid = ptrTextSch->GetUpdatedTextRegion();
if ((nParseRes&xtpEditLPR_RunFinished) && nZonesCount)
{
pPRMs->arInvalidZones.RemoveAt(nZonesCount-1);
nZonesCount--; //pPRMs->UpdateZones(zoneValid);
}
//DEBUG
{
CString sDBGzone = DBG_TraceIZone(&zoneValid.m_posStart, &zoneValid.m_posEnd);
//TRACE(_T("- Parser set START Event. Add invalid Zone [ %s ] \n"), sDBGpos);
DBG_TRACE_PARSE_START_STOP(_T("* Parser Ended. (result=%x) %s%s%s (%.3f sec) VALID Zone[ %s ] \n"),
nParseRes,
(nParseRes&xtpEditLPR_RunBreaked) ? _T(" BREAKED ") : _T(""),
(nParseRes&xtpEditLPR_Error) ? _T(" ERROR ") : _T(""),
(nParseRes&xtpEditLPR_RunFinished) ? _T(" <F I N I S H E D> ") : _T(""),
labs(dwTime1-dwTime0)/1000.0, (LPCTSTR)sDBGzone);
}
}
while ((bParseRestedBlock || nZonesCount) && !bBreaked);
}
}
while (dwWaitRes != WAIT_OBJECT_0+1);
}
// catch(...) {
// TRACE(_T("* EXCEPTION!!! CXTPSyntaxEditLexParser::ThreadParseProc(2)\n"));
// return 333;
// }
DBG_TRACE_PARSE_START_STOP(_T("*** Parser Thread is Ended. (%x)\n"), ::GetCurrentThreadId());
return 0;
}
#ifdef _DEBUG
void CXTPSyntaxEditLexTextBlock::Dump( CDumpContext& dc ) const
{
CObject::Dump( dc );
// Now do the stuff for our specific class.
dc << "\t <<TB>>";
dc << " (ref=" << m_dwRef << ") \n";
dc << "\t start(" << m_PosStartLC.nLine << ", " << m_PosStartLC.nCol << ") ";
dc << "\t end(" << m_PosEndLC.nLine << ", " << m_PosEndLC.nCol << ") \n";
#if _MSC_VER >= 1300
dc << "\t Parent="; dc.DumpAsHex((INT_PTR)(CXTPSyntaxEditLexTextBlock*)m_ptrParent);
dc << ", Prev="; dc.DumpAsHex((INT_PTR)(CXTPSyntaxEditLexTextBlock*)m_ptrPrev);
dc << ", Next="; dc.DumpAsHex((INT_PTR)(CXTPSyntaxEditLexTextBlock*)m_ptrNext);
dc << ", LastChild="; dc.DumpAsHex((INT_PTR)(CXTPSyntaxEditLexTextBlock*)m_ptrLastChild);
#endif
}
#endif
BOOL CXTPSyntaxEditLexTextSchema::RunParseOnScreen(CTextIter* pTxtIter,
int nRowStart, int nRowEnd,
CXTPSyntaxEditLexTextBlockPtr& rPtrScreenSchFirstTB
)
{
if (!pTxtIter || nRowStart <= 0 || nRowEnd <= 0)
{
ASSERT(FALSE);
return FALSE;
}
CSingleLock singleLock(GetDataLoker());
if (!singleLock.Lock(30))
{
TRACE(_T("Cannot enter critical section. CXTPSyntaxEditLexTextSchema::RunParseOnScreen() \n"));
return FALSE;
}
//---------------------------------------------------------------------------
//** (1) ** -------------------------
CXTPSyntaxEditLexTextBlockPtr ptrTBParentToRun;
BOOL bInit = InitScreenSch(pTxtIter, nRowStart, nRowEnd, rPtrScreenSchFirstTB,
ptrTBParentToRun);
if (!bInit)
{
//TRACE(_T("- parser::InitScreenSch return FALSE res.\n"));
return FALSE;
}
XTP_EDIT_LINECOL startLC = {nRowStart, 0};
if (!pTxtIter->SeekPos(startLC))
{
return FALSE;
}
int nParseRes = 0;
CXTPSyntaxEditLexOnScreenParseCnt runCnt;
runCnt.m_nRowStart = nRowStart;
runCnt.m_nRowEnd = nRowEnd;
runCnt.m_ptrTBLast = ptrTBParentToRun;
//** (2) ** -------------------------
CXTPSyntaxEditLexClassPtrArray* ptrArClasses = m_pClassSchema->GetClasses(FALSE);
int nCCount = ptrArClasses ? (int)ptrArClasses->GetSize() : 0;
BOOL bRunEOF = TRUE;
XTP_EDIT_LINECOL lcTextPos = {0,0};
while (!pTxtIter->IsEOF() && nCCount && bRunEOF)
{
bRunEOF = !pTxtIter->IsEOF();
nParseRes = Run_OnScreenTBStack(pTxtIter, ptrTBParentToRun, &runCnt);
if (nParseRes & (xtpEditLPR_Error|xtpEditLPR_RunBreaked)) // |xtpEditLPR_RunFinished))
{
TRACE(_T("- parser::RunParseOnScreen return by erroe or BREAK. \n"));
return !(nParseRes&xtpEditLPR_Error);
}
//** -------------------------------------------------------------
if (!pTxtIter->IsEOF() && !(nParseRes & xtpEditLPR_Iterated))
{
SeekNextEx(pTxtIter, ptrTBParentToRun->m_ptrLexClass, &runCnt);
}
//---------------------------------------------------------------------------
lcTextPos = pTxtIter->GetPosLC();
if (lcTextPos.nLine > runCnt.m_nRowEnd)
{
break;
}
//---------------------------------------------------------------------------
if (ptrTBParentToRun->m_ptrParent)
{
ptrTBParentToRun = ptrTBParentToRun->m_ptrParent;
}
}
return TRUE;
}
CXTPSyntaxEditLexTextBlockPtr CXTPSyntaxEditLexTextSchema::InitScreenSch_RunTopClass(CTextIter* pTxtIter)
{
CXTPSyntaxEditLexTextBlockPtr ptrTBtop;
CXTPSyntaxEditLexClassPtrArray* ptrClsAr = m_pClassSchema->GetClasses(FALSE);
int nCount = ptrClsAr ? (int)ptrClsAr->GetSize() : 0;
for (int i = 0; i < nCount; i++)
{
CXTPSyntaxEditLexClassPtr ptrC = ptrClsAr->GetAt(i);
if (!ptrC)
{
ASSERT(FALSE);
continue;
}
ASSERT(ptrTBtop == NULL);
int nParseRes = ptrC->RunParse(pTxtIter, this, ptrTBtop);
if ((nParseRes & xtpEditLPR_StartFound) && ptrTBtop)
{
return ptrTBtop;
}
}
return NULL;
}
BOOL CXTPSyntaxEditLexTextSchema::InitScreenSch(CTextIter* pTxtIter, int nRowStart, int nRowEnd,
CXTPSyntaxEditLexTextBlockPtr& rPtrScreenSchFirstTB,
CXTPSyntaxEditLexTextBlockPtr& rPtrTBParentToRun)
{
CXTPSyntaxEditLexTextBlockPtr ptrTBstart = GetBlocks();
// process first screen parse in the main thread
if (nRowStart == 1 && !ptrTBstart)
{
rPtrTBParentToRun = rPtrScreenSchFirstTB = InitScreenSch_RunTopClass(pTxtIter);
return (rPtrTBParentToRun != NULL);
}
CXTPSyntaxEditLexTextBlock* pLastSchBlock = GetLastSchBlock(FALSE);
if (m_ptrNewChainTB2 && pLastSchBlock &&
(pLastSchBlock->m_PosEndLC.IsValidData() && nRowStart > pLastSchBlock->m_PosEndLC.nLine ||
!pLastSchBlock->m_PosEndLC.IsValidData() && nRowStart > pLastSchBlock->m_PosStartLC.nLine)
)
{
return FALSE;
}
//=======================================================================
CXTPSyntaxEditLexTextBlock* pTBLast = NULL;
XTP_EDIT_LINECOL lcStart = {nRowStart, 0};
// (1) ---
CXTPSyntaxEditLexTextBlock* pTB;
for (pTB = ptrTBstart; pTB; pTB = pTB->m_ptrNext)
{
if (pTB->m_PosStartLC < lcStart &&
pTB->GetPosEndLC() >= lcStart ||
pTB == ptrTBstart )
{
pTBLast = pTB;
}
if (pTB->m_PosStartLC.nLine > nRowEnd)
{
break;
}
}
// (2) ---
CXTPSyntaxEditLexTextBlockPtr ptrTBCopyNext;
for (pTB = pTBLast; pTB; pTB = pTB->m_ptrParent)
{
CXTPSyntaxEditLexTextBlockPtr ptrTBCopy = CopyShortTBtoFull(pTB);
if (!ptrTBCopy)
{
return FALSE;
}
if (pTB == pTBLast)
{
rPtrTBParentToRun = ptrTBCopy;
if (pTB->m_PosStartLC.nLine <= nRowStart &&
pTB->m_PosEndLC.nLine >= nRowStart ||
pTB == ptrTBstart)
{
pTBLast = pTB;
}
}
else
{
ptrTBCopy->m_ptrNext = ptrTBCopyNext;
ptrTBCopyNext->m_ptrPrev = ptrTBCopy;
ptrTBCopyNext->m_ptrParent = ptrTBCopy;
}
rPtrScreenSchFirstTB = ptrTBCopy;
ptrTBCopyNext = ptrTBCopy;
}
return (rPtrTBParentToRun != NULL);
}
CXTPSyntaxEditLexTextBlock* CXTPSyntaxEditLexTextSchema::CopyShortTBtoFull(CXTPSyntaxEditLexTextBlock* pTB)
{
CXTPSyntaxEditLexTextBlockPtr ptrCopyTB = GetNewBlock();
if (!ptrCopyTB || !pTB || !pTB->m_ptrLexClass)
{
#ifdef XTP_FIXED // sometime popup this assert message.
// ASSERT(pTB && pTB->m_ptrLexClass);
#else
ASSERT(pTB && pTB->m_ptrLexClass);
#endif
return NULL;
}
ptrCopyTB->m_PosStartLC = pTB->m_PosStartLC;
ptrCopyTB->m_PosEndLC = pTB->m_PosEndLC;
int nClassID = pTB->m_ptrLexClass->GetAttribute_int(XTPLEX_ATTRCLASSID, FALSE, -1);
ASSERT(nClassID > 0);
CXTPSyntaxEditLexClassPtrArray* ptrTopClassesAr = m_pClassSchema->GetClasses(FALSE);
ptrCopyTB->m_ptrLexClass = FindLexClassByID(ptrTopClassesAr, nClassID);
if (!ptrCopyTB->m_ptrLexClass)
{
ASSERT(FALSE);
return NULL;
}
return ptrCopyTB.Detach();
}
CXTPSyntaxEditLexClass* CXTPSyntaxEditLexTextSchema::FindLexClassByID(CXTPSyntaxEditLexClassPtrArray* pClassesAr, int nClassID)
{
if (!pClassesAr)
{
return NULL;
}
int nCount = (int)pClassesAr->GetSize();
for (int i = 0; i < nCount; i++)
{
CXTPSyntaxEditLexClass* pC = pClassesAr->GetAt(i, FALSE);
int nC_ID = pC->GetAttribute_int(XTPLEX_ATTRCLASSID, FALSE);
if (nC_ID == nClassID)
{
pC->InternalAddRef();
return pC;
}
//-------------------------------------------------------
CXTPSyntaxEditLexClass* pCF2 = FindLexClassByID(pC->GetChildren(), nClassID);
if (pCF2)
{
return pCF2;
}
pCF2 = FindLexClassByID(pC->GetChildrenDyn(), nClassID);
if (pCF2)
{
return pCF2;
}
}
return NULL;
}
int CXTPSyntaxEditLexTextSchema::Run_OnScreenTBStack(CTextIter* pTxtIter,
CXTPSyntaxEditLexTextBlock* pTBParentToRun,
CXTPSyntaxEditLexOnScreenParseCnt* pRunCnt)
{
if (!pTBParentToRun || !pTBParentToRun->m_ptrLexClass || !pRunCnt)
{
ASSERT(FALSE);
return xtpEditLPR_Error;
}
CXTPSyntaxEditLexTextBlockPtr ptrTBParentToRun(pTBParentToRun, TRUE);
CXTPSyntaxEditLexClassPtr ptrRunClass = pTBParentToRun->m_ptrLexClass;
int nPres = 0;
BOOL bIterated = FALSE;
BOOL bEnded = FALSE;
BOOL bRunEOF = TRUE;
XTP_EDIT_LINECOL lcTextPos = {0,0};
//** 1 **// Run existing block with children until block end
while (!bEnded && (bRunEOF || !pTxtIter->IsEOF()) )
{
bRunEOF = !pTxtIter->IsEOF();
BOOL bSkipIterate = FALSE;
nPres = ptrRunClass->RunParse(pTxtIter, this, ptrTBParentToRun, pRunCnt);
if (nPres & (xtpEditLPR_Error|xtpEditLPR_RunBreaked)) //|xtpEditLPR_RunFinished))
{
return nPres;
}
//---------------------------------------------------------------------------
if (nPres & xtpEditLPR_Iterated)
{
bSkipIterate = TRUE;
bIterated = TRUE;
}
//---------------------------------------------------------------------------
bEnded = (nPres & xtpEditLPR_EndFound) != 0;
if (bEnded)
{
CSingleLock singleLock(GetDataLoker(), TRUE);
ptrTBParentToRun->EndChildren(); //this);
DBG_TRACE_PARSE_RUN_BLOCKS(_T("(%08x) ENDED startPos=(%d,%d) endPos=(%d,%d), [%s] {%d}-noEndedStack \n"),
(CXTPSyntaxEditLexTextBlock*)ptrTBParentToRun,
ptrTBParentToRun->m_PosStartLC.nLine, ptrTBParentToRun->m_PosStartLC.nCol, ptrTBParentToRun->m_PosEndLC.nLine,
ptrTBParentToRun->m_PosEndLC.nCol, ptrTBParentToRun->m_ptrLexClass->m_strClassName, m_nNoEndedClassesCount);
}
//---------------------------------------------------------------------------
if (!bEnded && !bSkipIterate)
{
SeekNextEx(pTxtIter, ptrRunClass, pRunCnt);
}
//---------------------------------------------------------------------------
lcTextPos = pTxtIter->GetPosLC();
if (lcTextPos.nLine > pRunCnt->m_nRowEnd)
{
break;
}
}
// ** end run existing ** //
if (!bEnded)
{
ptrTBParentToRun->m_PosEndLC = pTxtIter->GetPosLC();
ptrTBParentToRun->EndChildren(); //this);
return xtpEditLPR_RunFinished;
}
//===========================================================================
return (bIterated ? xtpEditLPR_Iterated : 0) | (pTxtIter->IsEOF() ? xtpEditLPR_RunFinished : 0);
}
CXTPSyntaxEditLexParserSchemaOptions::CXTPSyntaxEditLexParserSchemaOptions()
{
m_bFirstParseInSeparateThread = TRUE;
m_bEditReparceInSeparateThread = TRUE;
m_bConfigChangedReparceInSeparateThread = TRUE;
m_dwMaxBackParseOffset = XTP_EDIT_LEXPARSER_MAXBACKOFFSETDEFAULT;
m_dwEditReparceTimeout_ms = XTP_EDIT_LEXPARSER_REPARSETIMEOUTMS;
m_dwOnScreenSchCacheLifeTime_sec = XTP_EDIT_LEXPARSER_ONSCREENSCHCACHELIFETIMESEC;
m_dwParserThreadIdleLifeTime_ms = XTP_EDIT_LEXPARSER_THREADIDLELIFETIMESEC * 1000;
}
CXTPSyntaxEditLexParserSchemaOptions::CXTPSyntaxEditLexParserSchemaOptions(const CXTPSyntaxEditLexParserSchemaOptions& rSrc)
{
m_bFirstParseInSeparateThread = rSrc.m_bFirstParseInSeparateThread;
m_bEditReparceInSeparateThread = rSrc.m_bEditReparceInSeparateThread;
m_bConfigChangedReparceInSeparateThread = rSrc.m_bConfigChangedReparceInSeparateThread;
m_dwMaxBackParseOffset = rSrc.m_dwMaxBackParseOffset;
m_dwEditReparceTimeout_ms = rSrc.m_dwEditReparceTimeout_ms;
m_dwOnScreenSchCacheLifeTime_sec = rSrc.m_dwOnScreenSchCacheLifeTime_sec;
m_dwParserThreadIdleLifeTime_ms = rSrc.m_dwParserThreadIdleLifeTime_ms;
}
const CXTPSyntaxEditLexParserSchemaOptions& CXTPSyntaxEditLexParserSchemaOptions::operator=(const CXTPSyntaxEditLexParserSchemaOptions& rSrc)
{
m_bFirstParseInSeparateThread = rSrc.m_bFirstParseInSeparateThread;
m_bEditReparceInSeparateThread = rSrc.m_bEditReparceInSeparateThread;
m_bConfigChangedReparceInSeparateThread = rSrc.m_bConfigChangedReparceInSeparateThread;
m_dwMaxBackParseOffset = rSrc.m_dwMaxBackParseOffset;
m_dwEditReparceTimeout_ms = rSrc.m_dwEditReparceTimeout_ms;
m_dwOnScreenSchCacheLifeTime_sec = rSrc.m_dwOnScreenSchCacheLifeTime_sec;
m_dwParserThreadIdleLifeTime_ms = rSrc.m_dwParserThreadIdleLifeTime_ms;
return *this;
}
BOOL CXTPSyntaxEditLexParser::ReadSchemaOptions(const CString& strExt,
CXTPSyntaxEditLexTextSchema* pTextSchema,
CXTPSyntaxEditLexParserSchemaOptions* pOpt)
{
if (pOpt)
{
*pOpt = *m_pSchOptions_default;
}
if (!pTextSchema || !pOpt)
{
ASSERT(FALSE);
return FALSE;
}
CXTPSyntaxEditLexClassPtr ptrTopCls = pTextSchema->GetTopClassForFileExt(strExt);
if (!ptrTopCls)
{
return FALSE;
}
pOpt->m_bFirstParseInSeparateThread = ptrTopCls->GetAttribute_BOOL(
XTPLEX_ATTRG_FIRSTPARSEINSEPARATETHREAD, FALSE, TRUE);
pOpt->m_bEditReparceInSeparateThread = ptrTopCls->GetAttribute_BOOL(
XTPLEX_ATTRG_EDITREPARCEINSEPARATETHREAD, FALSE, TRUE);
pOpt->m_bConfigChangedReparceInSeparateThread = ptrTopCls->GetAttribute_BOOL(
XTPLEX_ATTRG_CONFIGCHANGEDREPARCEINSEPARATETHREAD, FALSE, TRUE);
pOpt->m_dwMaxBackParseOffset = (DWORD)ptrTopCls->GetAttribute_int(
XTPLEX_ATTRG_MAXBACKPARSEOFFSET, FALSE,
XTP_EDIT_LEXPARSER_MAXBACKOFFSETDEFAULT);
pOpt->m_dwEditReparceTimeout_ms = (DWORD)ptrTopCls->GetAttribute_int(
XTPLEX_ATTRG_EDITREPARCETIMEOUT_MS, FALSE,
XTP_EDIT_LEXPARSER_REPARSETIMEOUTMS);
pOpt->m_dwOnScreenSchCacheLifeTime_sec = (DWORD)ptrTopCls->GetAttribute_int(
XTPLEX_ATTRG_ONSCREENSCHCACHELIFETIME_SEC, FALSE,
XTP_EDIT_LEXPARSER_ONSCREENSCHCACHELIFETIMESEC);
pOpt->m_dwParserThreadIdleLifeTime_ms = (DWORD)ptrTopCls->GetAttribute_int(
XTPLEX_ATTRG_PARSERTHREADIDLELIFETIME_SEC, FALSE,
XTP_EDIT_LEXPARSER_THREADIDLELIFETIMESEC);
if (pOpt->m_dwParserThreadIdleLifeTime_ms != INFINITE)
{
pOpt->m_dwParserThreadIdleLifeTime_ms *= 1000;
}
if (pOpt->m_dwParserThreadIdleLifeTime_ms == 0)
{
pOpt->m_dwParserThreadIdleLifeTime_ms = INFINITE;
}
return TRUE;
}
const CXTPSyntaxEditLexParserSchemaOptions* CXTPSyntaxEditLexParser::GetSchemaOptions(const CString& strExt)
{
CSingleLock singLockMain(&m_csParserData);
if (!m_ptrTextSchema)
{
RemoveAllOptions();
}
CXTPSyntaxEditLexParserSchemaOptions* pOptions = NULL;
if (m_mapSchOptions.Lookup(strExt, pOptions))
{
ASSERT(pOptions);
return pOptions;
}
else if (m_ptrTextSchema)
{
pOptions = new CXTPSyntaxEditLexParserSchemaOptions();
if (ReadSchemaOptions(strExt, m_ptrTextSchema, pOptions))
{
m_mapSchOptions.SetAt(strExt, pOptions);
return pOptions;
}
else
{
CMDTARGET_RELEASE(pOptions);
}
}
return m_pSchOptions_default;
}
| 25.126533
| 141
| 0.668491
|
11Zero
|
0733f85dcd68299e7d441edff00d18c459dddfab
| 5,888
|
cpp
|
C++
|
DynacoeSrc/srcs/Dynacoe/Image.cpp
|
jcorks/Dynacoe
|
2d606620e8072d8ae76aa2ecdc31512ac90362d9
|
[
"Apache-2.0",
"MIT",
"Libpng",
"FTL",
"BSD-3-Clause"
] | 1
|
2015-11-06T18:10:11.000Z
|
2015-11-06T18:10:11.000Z
|
DynacoeSrc/srcs/Dynacoe/Image.cpp
|
jcorks/Dynacoe
|
2d606620e8072d8ae76aa2ecdc31512ac90362d9
|
[
"Apache-2.0",
"MIT",
"Libpng",
"FTL",
"BSD-3-Clause"
] | 8
|
2018-01-25T03:54:32.000Z
|
2018-09-17T01:55:35.000Z
|
DynacoeSrc/srcs/Dynacoe/Image.cpp
|
jcorks/Dynacoe
|
2d606620e8072d8ae76aa2ecdc31512ac90362d9
|
[
"Apache-2.0",
"MIT",
"Libpng",
"FTL",
"BSD-3-Clause"
] | null | null | null |
/*
Copyright (c) 2018, Johnathan Corkery. (jcorkery@umich.edu)
All rights reserved.
This file is part of the Dynacoe project (https://github.com/jcorks/Dynacoe)
Dynacoe was released under the MIT License, as detailed below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall
be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#include <Dynacoe/Image.h>
#include <Dynacoe/Modules/Graphics.h>
#include <Dynacoe/Dynacoe.h>
#include <Dynacoe/Util/RefBank.h>
#include <cstdint>
#include <cmath>
using namespace std;
using namespace Dynacoe;
static int badTexture = -1;
class FreeTexture : public RefBank<int>::AccountRemover {
public:
void operator()(const int & id) {
if (id != badTexture)
Graphics::GetRenderer()->RemoveTexture(id);
}
};
static RefBank<int> * textureBank = nullptr;
static FreeTexture * textureRemover = nullptr;
Image::Frame::Frame(int textureObject) {
if (!textureBank) {
badTexture = Graphics::GetRenderer()->AddTexture(16, 16, nullptr);
textureBank = new RefBank<int>();
textureRemover = new FreeTexture;
textureBank->SetAccountRemover(textureRemover);
if (textureObject == -1)
textureObject = badTexture;
}
textureBank->Deposit(textureObject);
object = textureObject;
}
Image::Frame::Frame() : Frame(badTexture) {}
Image::Frame::Frame(uint32_t w, uint32_t h) :
Frame(Graphics::GetRenderer()->AddTexture(w, h, nullptr)) {}
Image::Frame::Frame(uint32_t w, uint32_t h, const std::vector<uint8_t> & data) : Frame(w, h) {
SetData(data);
}
Image::Frame::Frame(const Frame & other) : Frame(other.object) {}
Image::Frame::~Frame() {
if (object != -1)
textureBank->Withdraw(object);
}
Image::Frame & Image::Frame::operator=(const Image::Frame & other) {
textureBank->Deposit(other.object);
object = other.object;
return *this;
}
std::vector<uint8_t> Image::Frame::GetData() const {
std::vector<uint8_t> out;
// Original texture size may not be current image size.
uint32_t w = Width();
uint32_t h = Height();
out.resize(h * w * 4);
Graphics::GetRenderer()->GetTexture(object, &out[0]);
return out;
}
void Image::Frame::SetData(const std::vector<uint8_t> & data) {
uint32_t w, h;
w = Width();
h = Height();
if (data.size() != w*h*4) {
Console::Error() << "Image::Frame::SetData : given data does not match image dimensions. Ignoring request.\n";
return;
}
Graphics::GetRenderer()->UpdateTexture(object, &data[0]);
}
uint32_t Image::Frame::Width() const {
return Graphics::GetRenderer()->GetTextureWidth(object);
}
uint32_t Image::Frame::Height() const {
return Graphics::GetRenderer()->GetTextureHeight(object);
}
std::vector<Image::Frame> Image::Frame::Detilize(uint32_t ws, uint32_t hs) const {
uint32_t w = Width();
uint32_t h = Height();
uint32_t countW = ceil(w / (float)ws);
uint32_t countH = ceil(h / (float)hs);
std::vector<uint8_t> subImage;
subImage.resize(ws*hs*4);
const std::vector<uint8_t> & sourceImage = GetData();
uint8_t * subData = &subImage[0];
uint8_t * subIter = subData;
const uint8_t * srcData = &sourceImage[0];
const uint8_t * srcIter = srcData;
uint32_t srcIndex;
uint32_t srcX; // pixel x of src image
uint32_t srcY; // pixel y or src image
std::vector<Frame> out;
for(uint32_t y = 0; y < countH; ++y) {
for(uint32_t x = 0; x < countW; ++x) {
subIter = subData;
srcX = x*ws;
srcY = y*hs;
for(uint32_t subY = 0; subY < hs; ++subY, ++srcY) {
srcX = x*ws;
for(uint32_t subX = 0; subX < ws; ++subX, ++srcX) {
if (srcY >= h) continue;
if (srcX >= w) continue;
srcIter = srcData + (srcX + srcY*w)*4;
subIter[0] = srcIter[0];
subIter[1] = srcIter[1];
subIter[2] = srcIter[2];
subIter[3] = srcIter[3];
subIter += 4;
}
}
out.push_back(Frame(ws, hs, subImage));
}
}
return out;
}
int Image::Frame::GetHandle() const {
return object;
}
class FrameCounter : public Entity {
public:
FrameCounter() {
frame = 0;
}
void OnStep() {
frame++;
}
uint64_t frame;
};
static FrameCounter * frameCounter = nullptr;
Image::Image(const std::string & n) : Asset(n) {
if (!frameCounter) {
frameCounter = Entity::CreateReference<FrameCounter>();
Engine::AttachManager(frameCounter->GetID());
}
index = frameCounter->frame;
}
Image::Frame & Image::CurrentFrame(){
if (!frames.size()) {
static Frame bad;
return bad;
}
uint64_t frame = frameCounter->frame - index;
return frames[frame%frames.size()];
}
| 26.763636
| 118
| 0.633492
|
jcorks
|
0734ddf23edf805925573bd9f0ad8fbd88c8ffe2
| 295
|
cpp
|
C++
|
src/common/copypaste_obj.cpp
|
krogenth/G2DataGUI
|
6bf4ef7bc90e72cf8fd33b9028cf00859dd8aa28
|
[
"MIT"
] | 1
|
2021-04-20T04:34:59.000Z
|
2021-04-20T04:34:59.000Z
|
src/common/copypaste_obj.cpp
|
krogenth/G2DataGUI
|
6bf4ef7bc90e72cf8fd33b9028cf00859dd8aa28
|
[
"MIT"
] | 3
|
2020-05-22T12:34:35.000Z
|
2021-07-02T15:46:42.000Z
|
src/common/copypaste_obj.cpp
|
krogenth/G2DataGUI
|
6bf4ef7bc90e72cf8fd33b9028cf00859dd8aa28
|
[
"MIT"
] | 1
|
2020-05-20T00:29:38.000Z
|
2020-05-20T00:29:38.000Z
|
#include "..\include\common\copypaste_obj.h"
void* clipboard = nullptr;
std::string objType = "";
void copyObj(void* obj, std::string type) {
clipboard = obj;
objType = type;
}
void* pasteObj() {
return clipboard;
}
bool checkObjType(std::string type) {
return (objType == type);
}
| 12.826087
| 44
| 0.667797
|
krogenth
|
0752246cd28c89516c6ed24d8a75050699115d71
| 1,186
|
hpp
|
C++
|
climate-change/src/VS-Project/Libraries/godot-cpp-bindings/include/gen/CurveTexture.hpp
|
jerry871002/CSE201-project
|
c42cc0e51d0c8367e4d06fc33756ab2ec4118ff4
|
[
"MIT"
] | 5
|
2021-05-27T21:50:33.000Z
|
2022-01-28T11:54:32.000Z
|
climate-change/src/VS-Project/Libraries/godot-cpp-bindings/include/gen/CurveTexture.hpp
|
jerry871002/CSE201-project
|
c42cc0e51d0c8367e4d06fc33756ab2ec4118ff4
|
[
"MIT"
] | null | null | null |
climate-change/src/VS-Project/Libraries/godot-cpp-bindings/include/gen/CurveTexture.hpp
|
jerry871002/CSE201-project
|
c42cc0e51d0c8367e4d06fc33756ab2ec4118ff4
|
[
"MIT"
] | 1
|
2021-01-04T21:12:05.000Z
|
2021-01-04T21:12:05.000Z
|
#ifndef GODOT_CPP_CURVETEXTURE_HPP
#define GODOT_CPP_CURVETEXTURE_HPP
#include <gdnative_api_struct.gen.h>
#include <stdint.h>
#include <core/CoreTypes.hpp>
#include <core/Ref.hpp>
#include "Texture.hpp"
namespace godot {
class Curve;
class CurveTexture : public Texture {
struct ___method_bindings {
godot_method_bind *mb__update;
godot_method_bind *mb_get_curve;
godot_method_bind *mb_set_curve;
godot_method_bind *mb_set_width;
};
static ___method_bindings ___mb;
static void *_detail_class_tag;
public:
static void ___init_method_bindings();
inline static size_t ___get_id() { return (size_t)_detail_class_tag; }
static inline const char *___get_class_name() { return (const char *) "CurveTexture"; }
static inline Object *___get_from_variant(Variant a) { godot_object *o = (godot_object*) a; return (o) ? (Object *) godot::nativescript_1_1_api->godot_nativescript_get_instance_binding_data(godot::_RegisterState::language_index, o) : nullptr; }
// enums
// constants
static CurveTexture *_new();
// methods
void _update();
Ref<Curve> get_curve() const;
void set_curve(const Ref<Curve> curve);
void set_width(const int64_t width);
};
}
#endif
| 23.72
| 245
| 0.766442
|
jerry871002
|
07540d3da3c2bc6c01f7efbae4a369df0b7a4229
| 1,919
|
cpp
|
C++
|
FSE/PhysContactListener.cpp
|
Alia5/FSE
|
e53565aa1bbf0235dfcd2c3209d18b64c1fb2df1
|
[
"MIT"
] | 17
|
2017-04-02T00:17:47.000Z
|
2021-11-23T21:42:48.000Z
|
FSE/PhysContactListener.cpp
|
Alia5/FSE
|
e53565aa1bbf0235dfcd2c3209d18b64c1fb2df1
|
[
"MIT"
] | null | null | null |
FSE/PhysContactListener.cpp
|
Alia5/FSE
|
e53565aa1bbf0235dfcd2c3209d18b64c1fb2df1
|
[
"MIT"
] | 5
|
2017-08-06T12:47:18.000Z
|
2020-08-14T14:16:22.000Z
|
#include "PhysContactListener.h"
#include "FSEObject/FSEObject.h"
namespace fse
{
PhysContactListener::PhysContactListener() {
}
PhysContactListener::~PhysContactListener()
{
}
void PhysContactListener::BeginContact(b2Contact* contact)
{
FSEObject * objectA = static_cast<FSEObject*>(contact->GetFixtureA()->GetBody()->GetUserData());
FSEObject * objectB = static_cast<FSEObject*>(contact->GetFixtureB()->GetBody()->GetUserData());
if (objectA != nullptr && objectB != nullptr)
{
objectA->BeginContact(objectB, contact);
objectB->BeginContact(objectA, contact);
}
}
void PhysContactListener::EndContact(b2Contact* contact)
{
FSEObject * objectA = static_cast<FSEObject*>(contact->GetFixtureA()->GetBody()->GetUserData());
FSEObject * objectB = static_cast<FSEObject*>(contact->GetFixtureB()->GetBody()->GetUserData());
if (objectA != nullptr && objectB != nullptr)
{
objectA->EndContact(objectB, contact);
objectB->EndContact(objectA, contact);
}
}
void PhysContactListener::PreSolve(b2Contact* contact, const b2Manifold* oldManifold)
{
FSEObject * objectA = static_cast<FSEObject*>(contact->GetFixtureA()->GetBody()->GetUserData());
FSEObject * objectB = static_cast<FSEObject*>(contact->GetFixtureB()->GetBody()->GetUserData());
if (objectA != nullptr && objectB != nullptr)
{
objectA->PreSolve(objectB, contact, oldManifold);
objectB->PreSolve(objectA, contact, oldManifold);
}
}
void PhysContactListener::PostSolve(b2Contact* contact, const b2ContactImpulse* impulse)
{
FSEObject * objectA = static_cast<FSEObject*>(contact->GetFixtureA()->GetBody()->GetUserData());
FSEObject * objectB = static_cast<FSEObject*>(contact->GetFixtureB()->GetBody()->GetUserData());
if (objectA != nullptr && objectB != nullptr)
{
objectA->PostSolve(objectB, contact, impulse);
objectB->PostSolve(objectA, contact, impulse);
}
}
}
| 29.523077
| 98
| 0.712871
|
Alia5
|
075a2e0253776a5cfbfa84b5f98579518e184fc8
| 221
|
hpp
|
C++
|
lbench/include/likely.hpp
|
milad621/livehd
|
370b4274809ef95f880da07a603245bffcadf05e
|
[
"BSD-3-Clause"
] | 115
|
2019-09-28T13:39:41.000Z
|
2022-03-24T11:08:53.000Z
|
lbench/include/likely.hpp
|
milad621/livehd
|
370b4274809ef95f880da07a603245bffcadf05e
|
[
"BSD-3-Clause"
] | 120
|
2018-05-16T23:11:09.000Z
|
2019-09-25T18:52:49.000Z
|
lbench/include/likely.hpp
|
milad621/livehd
|
370b4274809ef95f880da07a603245bffcadf05e
|
[
"BSD-3-Clause"
] | 44
|
2019-09-28T07:53:21.000Z
|
2022-02-13T23:21:12.000Z
|
// This file is distributed under the BSD 3-Clause License. See LICENSE for details.
#ifndef likely
#define likely(x) __builtin_expect((x), 1)
#endif
#ifndef unlikely
#define unlikely(x) __builtin_expect((x), 0)
#endif
| 24.555556
| 85
| 0.751131
|
milad621
|
075b5f156f565a1f9be5c2700c0f2b8a57985269
| 1,610
|
cpp
|
C++
|
pochi_libs_and_includes/include/fastinterp/fastinterp_tpl_throw_exception.cpp
|
dghosef/taco
|
c5074c359af51242d76724f97bb5fe7d9b638658
|
[
"MIT"
] | null | null | null |
pochi_libs_and_includes/include/fastinterp/fastinterp_tpl_throw_exception.cpp
|
dghosef/taco
|
c5074c359af51242d76724f97bb5fe7d9b638658
|
[
"MIT"
] | null | null | null |
pochi_libs_and_includes/include/fastinterp/fastinterp_tpl_throw_exception.cpp
|
dghosef/taco
|
c5074c359af51242d76724f97bb5fe7d9b638658
|
[
"MIT"
] | null | null | null |
#define POCHIVM_INSIDE_FASTINTERP_TPL_CPP
#include "fastinterp_tpl_common.hpp"
#include "fastinterp_function_alignment.h"
#include "fastinterp_tpl_return_type.h"
namespace PochiVM
{
struct FIThrowExceptionImpl
{
template<bool isQuickAccess>
static constexpr bool cond()
{
return true;
}
// Placeholder rules:
// constant placeholder 0: stack offset, if the exnAddr is not quickaccess
// cpp placeholder 0: the cpp helper that sets std::exception_ptr
// boilerplate placeholder 0: continuation to cleanup logic
//
template<bool isQuickAccess>
static void f(uintptr_t stackframe, [[maybe_unused]] uintptr_t qa) noexcept
{
uintptr_t exnAddr;
if constexpr(isQuickAccess)
{
exnAddr = qa;
}
else
{
DEFINE_INDEX_CONSTANT_PLACEHOLDER_0;
exnAddr = stackframe + CONSTANT_PLACEHOLDER_0;
}
using CppFnPrototype = void(*)(uintptr_t) noexcept;
DEFINE_BOILERPLATE_FNPTR_PLACEHOLDER_1_NO_TAILCALL(CppFnPrototype);
BOILERPLATE_FNPTR_PLACEHOLDER_1(exnAddr);
DEFINE_BOILERPLATE_FNPTR_PLACEHOLDER_0(void(*)(uintptr_t) noexcept);
BOILERPLATE_FNPTR_PLACEHOLDER_0(stackframe);
}
static auto metavars()
{
return CreateMetaVarList(
CreateBoolMetaVar("isQuickAccess")
);
}
};
} // namespace PochiVM
// build_fast_interp_lib.cpp JIT entry point
//
extern "C"
void __pochivm_build_fast_interp_library__()
{
using namespace PochiVM;
RegisterBoilerplate<FIThrowExceptionImpl>();
}
| 25.555556
| 79
| 0.685093
|
dghosef
|
075fb5c1655e594d033995cff4bcc35fb672c506
| 681
|
cpp
|
C++
|
1027.cpp
|
gysss/PAT
|
1652927317b35f86eb10d399042c2289e65d8d70
|
[
"Apache-2.0"
] | null | null | null |
1027.cpp
|
gysss/PAT
|
1652927317b35f86eb10d399042c2289e65d8d70
|
[
"Apache-2.0"
] | null | null | null |
1027.cpp
|
gysss/PAT
|
1652927317b35f86eb10d399042c2289e65d8d70
|
[
"Apache-2.0"
] | null | null | null |
#include <iostream>
#include <stdio.h>
#include <cmath>
#include <string>
using namespace std;
int main(int argc, char * argv[]){
int N;
char t;
cin>>N>>t;
int i=sqrt((N+1)/2);
for (int j = 0;j<i;j++)
{
for (int n = 0; n < j; ++n)
{
cout<<" ";
}
for (int m = 0; m < 2*i-1-2*j-1; ++m)
{
cout<<t<<" ";
}
cout<<t;
for (int n = 0; n < j; ++n)
{
cout<<" ";
}
cout<<endl;
}
for (int j = i-2; j >=0; j--)
{
for (int n = 0; n < j; ++n)
{
cout<<" ";
}
for (int m = 0; m < 2*i-1-2*j-1; ++m)
{
cout<<t<<" ";
}
cout<<t;
for (int n = 0; n < j; ++n)
{
cout<<" ";
}
cout<<endl;
}
cout<<N-(2*i*i-1)<<endl;
return 0;
}
| 14.1875
| 39
| 0.422907
|
gysss
|
79e32a9967b1821e49733abcbbc72c012d7dc10f
| 1,205
|
cpp
|
C++
|
esp32s-wroom/Webthings-Controller/src/main.cpp
|
raushanraja/IOTExmaples
|
1973381b99e4a4bd3303b9e3c2739c7482b27ea4
|
[
"Unlicense"
] | null | null | null |
esp32s-wroom/Webthings-Controller/src/main.cpp
|
raushanraja/IOTExmaples
|
1973381b99e4a4bd3303b9e3c2739c7482b27ea4
|
[
"Unlicense"
] | null | null | null |
esp32s-wroom/Webthings-Controller/src/main.cpp
|
raushanraja/IOTExmaples
|
1973381b99e4a4bd3303b9e3c2739c7482b27ea4
|
[
"Unlicense"
] | null | null | null |
#include <Arduino.h>
#include <WiFi.h>
#include <ArduinoHttpClient.h>
const char *ssid = "dlink_DWR-920V_7EE5";
const char *password = "nhaza95645";
const int hostPort = 80;
const char *hostAddress = "192.168.0.24";
WiFiClient wifi;
HttpClient client = HttpClient(wifi, hostAddress, hostPort);
int touchInput;
int value=0;
void setup()
{
Serial.begin(9600);
delay(100);
Serial.print("connection to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.print("WiFi Connected:");
Serial.println(WiFi.localIP());
Serial.println("Starting Communication with WebServer");
}
void loop()
{
touchInput = touchRead(T0);
String on = "{\"on\":true}";
String off = "{\"on\":false}";
Serial.println(touchInput);
if (touchInput < 15 && touchInput > 10)
{
String contentType = "text/plain";
Serial.println("making PUT request");
client.put("/things/switc/properties/on", contentType, value==0?on:off);
value=value==0?1:0;
client.responseBody();
Serial.println();
Serial.println("closing connection");
delay(1);
}
Serial.flush();
}
| 21.140351
| 76
| 0.661411
|
raushanraja
|
79ebf4f7fc80fba0e2ea0599a01d1ef57f8b53a6
| 5,109
|
cpp
|
C++
|
Engine/Src/Memory/MemoryProfiler.cpp
|
felipegodias/PlutoEngine
|
0ee5304b35f8b5edb0cb6d2635285daff9e35b21
|
[
"MIT"
] | null | null | null |
Engine/Src/Memory/MemoryProfiler.cpp
|
felipegodias/PlutoEngine
|
0ee5304b35f8b5edb0cb6d2635285daff9e35b21
|
[
"MIT"
] | 5
|
2021-12-10T23:27:43.000Z
|
2021-12-23T00:49:04.000Z
|
Engine/Src/Memory/MemoryProfiler.cpp
|
felipegodias/PlutoEngine
|
0ee5304b35f8b5edb0cb6d2635285daff9e35b21
|
[
"MIT"
] | null | null | null |
#include "Pluto/Engine/Memory/MemoryProfiler.h"
#include <algorithm>
#include <iostream>
#include <map>
#include <unordered_map>
#include <vector>
namespace Pluto::Engine
{
namespace
{
size_t totalUsedBytes = 0;
template <class Ty>
class MPAllocator
{
public:
using value_type = Ty;
MPAllocator() noexcept = default;
template <class RebindTy>
MPAllocator(const MPAllocator<RebindTy>&) noexcept
{
}
// ReSharper disable once CppInconsistentNaming
// ReSharper disable once CppMemberFunctionMayBeStatic
value_type* allocate(const std::size_t n)
{
const size_t size = n * sizeof(value_type);
totalUsedBytes += size;
return static_cast<value_type*>(std::malloc(size));
}
// ReSharper disable once CppInconsistentNaming
// ReSharper disable once CppMemberFunctionMayBeStatic
void deallocate(value_type* p, const std::size_t n) noexcept
{
const size_t size = n * sizeof(value_type);
totalUsedBytes -= size;
std::free(p);
}
};
template <class Ty, class RebindTy>
bool operator==(const MPAllocator<Ty>&, const MPAllocator<RebindTy>&) noexcept
{
return true;
}
template <class Ty, class RebindTy>
bool operator!=(const MPAllocator<Ty>& x, const MPAllocator<RebindTy>& y) noexcept
{
return !(x == y);
}
using MPString = std::basic_string<char, std::char_traits<char>, MPAllocator<char>>;
template <typename Ty>
using MPVector = std::vector<Ty, MPAllocator<Ty>>;
template <typename KTy, typename VTy>
using MPMap = std::map<KTy, VTy, std::less<KTy>, MPAllocator<std::pair<const KTy, VTy>>>;
template <typename KTy, typename VTy>
using MPUnorderedMap = std::unordered_map<KTy, VTy, std::hash<KTy>, std::equal_to<KTy>, MPAllocator<std::pair<
const KTy, VTy>>>;
struct PointerMetaData
{
size_t size;
MPMap<MPString, MPString> tags;
explicit PointerMetaData(const size_t size)
: size(size)
{
}
friend std::ostream& operator<<(std::ostream& os, const PointerMetaData& pointerMetaData)
{
os << "<<<<<<<<<<<<<<<<<<<<<<<\n";
os << "Size: " << pointerMetaData.size << " bytes\n";
for (auto& tag : pointerMetaData.tags)
{
os << tag.first << ": " << tag.second << "\n";
}
os << ">>>>>>>>>>>>>>>>>>>>>>>\n";
return os;
}
};
bool PointerMetaDataComparator(const PointerMetaData* lhs, const PointerMetaData* rhs)
{
return lhs->size > rhs->size;
}
MPUnorderedMap<uintptr_t, PointerMetaData> pointersMetaData;
}
void MemoryProfiler::Track(void* ptr, const size_t size)
{
totalUsedBytes += size;
pointersMetaData.emplace(reinterpret_cast<uintptr_t>(ptr), PointerMetaData(size));
}
void MemoryProfiler::Untrack(void* ptr)
{
if (const auto it = pointersMetaData.find(reinterpret_cast<uintptr_t>(ptr)); it != pointersMetaData.end())
{
totalUsedBytes -= it->second.size;
pointersMetaData.erase(it);
}
}
void MemoryProfiler::AddTag(void* ptr, const StringView name, const StringView value)
{
const auto it = pointersMetaData.find(reinterpret_cast<uintptr_t>(ptr));
if (it == pointersMetaData.end())
{
return;
}
MPMap<MPString, MPString>& tags = it->second.tags;
MPString nameStr = name.data();
MPString valueStr = value.data();
if (const auto tagsIt = tags.find(nameStr); tagsIt == tags.end())
{
tags.emplace(std::move(nameStr), std::move(valueStr));
}
else
{
tagsIt->second = std::move(valueStr);
}
}
size_t MemoryProfiler::GetUsedMemory()
{
return totalUsedBytes;
}
void MemoryProfiler::DumpMemorySummary(std::ostream& os)
{
MPVector<PointerMetaData*> pointerMetaDataHeap;
pointerMetaDataHeap.reserve(pointersMetaData.size());
for (auto& [size, pointerMetaData] : pointersMetaData)
{
pointerMetaDataHeap.push_back(&pointerMetaData);
std::push_heap(pointerMetaDataHeap.begin(), pointerMetaDataHeap.end(), PointerMetaDataComparator);
}
while (pointerMetaDataHeap.empty() == false)
{
os << *pointerMetaDataHeap.front() << "\n";
std::pop_heap(pointerMetaDataHeap.begin(), pointerMetaDataHeap.end(), PointerMetaDataComparator);
pointerMetaDataHeap.pop_back();
}
}
}
| 31.732919
| 118
| 0.557056
|
felipegodias
|
79ed0d94f4ce09d7aca47bbd4d52f7e72f5778b8
| 6,335
|
hpp
|
C++
|
vox_nav_planning/include/vox_nav_planning/planner_core.hpp
|
NMBURobotics/vox_nav
|
7d71c97166ce57680bf2e637cca7c745d55b045a
|
[
"Apache-2.0"
] | 47
|
2021-06-03T08:46:51.000Z
|
2022-03-31T08:07:09.000Z
|
vox_nav_planning/include/vox_nav_planning/planner_core.hpp
|
BADAL244/vox_nav
|
cd88c8a921feed65a92355d6246cf6cb8dd27939
|
[
"Apache-2.0"
] | 6
|
2021-06-06T01:17:38.000Z
|
2022-01-06T10:01:53.000Z
|
vox_nav_planning/include/vox_nav_planning/planner_core.hpp
|
BADAL244/vox_nav
|
cd88c8a921feed65a92355d6246cf6cb8dd27939
|
[
"Apache-2.0"
] | 10
|
2021-06-03T08:46:53.000Z
|
2022-03-04T00:57:51.000Z
|
// Copyright (c) 2020 Fetullah Atas, Norwegian University of Life Sciences
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef VOX_NAV_PLANNING__PLANNER_CORE_HPP_
#define VOX_NAV_PLANNING__PLANNER_CORE_HPP_
#pragma once
// ROS
#include <rclcpp/rclcpp.hpp>
#include <rclcpp/service.hpp>
#include <rclcpp/client.hpp>
#include <tf2_geometry_msgs/tf2_geometry_msgs.h>
#include <geometry_msgs/msg/pose.hpp>
#include <sensor_msgs/msg/point_cloud2.hpp>
#include <visualization_msgs/msg/marker_array.hpp>
#include <vox_nav_utilities/tf_helpers.hpp>
#include <vox_nav_utilities/pcl_helpers.hpp>
#include <vox_nav_utilities/planner_helpers.hpp>
#include <vox_nav_msgs/srv/get_maps_and_surfels.hpp>
// PCL
#include <pcl/common/common.h>
#include <pcl/common/transforms.h>
#include <pcl/conversions.h>
#include <pcl/filters/voxel_grid.h>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl_conversions/pcl_conversions.h>
// OMPL GEOMETRIC
#include <ompl/geometric/planners/fmt/BFMT.h>
#include <ompl/geometric/planners/rrt/RRTstar.h>
#include <ompl/geometric/planners/rrt/RRTsharp.h>
#include <ompl/geometric/planners/rrt/InformedRRTstar.h>
#include <ompl/geometric/planners/rrt/LBTRRT.h>
#include <ompl/geometric/planners/rrt/TRRT.h>
#include <ompl/geometric/planners/sst/SST.h>
#include <ompl/geometric/planners/fmt/FMT.h>
#include <ompl/geometric/planners/prm/SPARS.h>
#include <ompl/geometric/planners/prm/SPARStwo.h>
#include <ompl/geometric/planners/prm/PRMstar.h>
#include <ompl/geometric/planners/prm/LazyPRMstar.h>
#include <ompl/geometric/planners/AnytimePathShortening.h>
#include <ompl/geometric/planners/cforest/CForest.h>
#include <ompl/geometric/planners/informedtrees/BITstar.h>
#include <ompl/geometric/planners/informedtrees/ABITstar.h>
#include <ompl/geometric/planners/informedtrees/AITstar.h>
#include <ompl/geometric/SimpleSetup.h>
#include <ompl/base/OptimizationObjective.h>
// OMPL BASE
#include <ompl/base/samplers/ObstacleBasedValidStateSampler.h>
#include <ompl/base/OptimizationObjective.h>
#include <ompl/base/objectives/PathLengthOptimizationObjective.h>
#include <ompl/base/objectives/MaximizeMinClearanceObjective.h>
#include <ompl/base/samplers/MaximizeClearanceValidStateSampler.h>
#include <ompl/base/objectives/StateCostIntegralObjective.h>
#include <ompl/base/spaces/SE2StateSpace.h>
#include <ompl/base/spaces/DubinsStateSpace.h>
#include <ompl/base/spaces/ReedsSheppStateSpace.h>
#include <ompl/base/spaces/SE3StateSpace.h>
#include <ompl/tools/benchmark/Benchmark.h>
#include <ompl/base/StateSampler.h>
// OCTOMAP
#include <octomap_msgs/msg/octomap.hpp>
#include <octomap_msgs/conversions.h>
#include <octomap/octomap.h>
#include <octomap/octomap_utils.h>
// FCL
#include <fcl/config.h>
#include <fcl/octree.h>
#include <fcl/traversal/traversal_node_octree.h>
#include <fcl/collision.h>
#include <fcl/broadphase/broadphase.h>
#include <fcl/math/transform.h>
// STL
#include <string>
#include <iostream>
#include <memory>
#include <vector>
namespace vox_nav_planning
{
/**
* @brief Base class for creating a planner plugins
*
*/
class PlannerCore
{
public:
using Ptr = std::shared_ptr<PlannerCore>;
/**
* @brief Construct a new Planner Core object
*
*/
PlannerCore() {}
/**
* @brief Destroy the Planner Core object
*
*/
virtual ~PlannerCore() {}
/**
* @brief
*
* @param parent
* @param plugin_name
*/
virtual void initialize(
rclcpp::Node * parent,
const std::string & plugin_name) = 0;
/**
* @brief Method create the plan from a starting and ending goal.
*
* @param start The starting pose of the robot
* @param goal The goal pose of the robot
* @return std::vector<geometry_msgs::msg::PoseStamped> The sequence of poses to get from start to goal, if any
*/
virtual std::vector<geometry_msgs::msg::PoseStamped> createPlan(
const geometry_msgs::msg::PoseStamped & start,
const geometry_msgs::msg::PoseStamped & goal) = 0;
/**
* @brief
*
* @param state
* @return true
* @return false
*/
virtual bool isStateValid(const ompl::base::State * state) = 0;
/**
* @brief Get the Overlayed Start and Goal poses, only x and y are provided for goal ,
* but internally planner finds closest valid node on octomap and reassigns goal to this pose
*
* @return std::vector<geometry_msgs::msg::PoseStamped>
*/
virtual std::vector<geometry_msgs::msg::PoseStamped> getOverlayedStartandGoal() = 0;
/**
* @brief
*
*/
virtual void setupMap() = 0;
protected:
rclcpp::Client<vox_nav_msgs::srv::GetMapsAndSurfels>::SharedPtr get_maps_and_surfels_client_;
rclcpp::Node::SharedPtr get_maps_and_surfels_client_node_;
// octomap acquired from original PCD map
std::shared_ptr<octomap::OcTree> original_octomap_octree_;
std::shared_ptr<fcl::CollisionObject> original_octomap_collision_object_;
std::shared_ptr<fcl::CollisionObject> robot_collision_object_;
std::shared_ptr<fcl::CollisionObject> robot_collision_object_minimal_;
ompl::geometric::SimpleSetupPtr simple_setup_;
// to ensure safety when accessing global var curr_frame_
std::mutex global_mutex_;
// the topic to subscribe in order capture a frame
std::string planner_name_;
// Better t keep this parameter consistent with map_server, 0.2 is a OK default fo this
double octomap_voxel_size_;
// related to density of created path
int interpolation_parameter_;
// max time the planner can spend before coming up with a solution
double planner_timeout_;
// global mutex to guard octomap
std::mutex octomap_mutex_;
volatile bool is_map_ready_;
};
} // namespace vox_nav_planning
#endif // VOX_NAV_PLANNING__PLANNER_CORE_HPP_
| 34.807692
| 117
| 0.74412
|
NMBURobotics
|
79f1d251fe95783f271c6f7de50452135402a571
| 2,439
|
cpp
|
C++
|
source/geom/border.cpp
|
taogashi/mlib
|
56d0ac08205b3a09cac7ed97209454cc6262c924
|
[
"Unlicense",
"MIT"
] | 12
|
2020-07-08T04:21:44.000Z
|
2022-03-24T10:02:03.000Z
|
source/geom/border.cpp
|
taogashi/mlib
|
56d0ac08205b3a09cac7ed97209454cc6262c924
|
[
"Unlicense",
"MIT"
] | null | null | null |
source/geom/border.cpp
|
taogashi/mlib
|
56d0ac08205b3a09cac7ed97209454cc6262c924
|
[
"Unlicense",
"MIT"
] | 2
|
2020-07-22T09:00:40.000Z
|
2021-06-29T13:54:10.000Z
|
/*!
\file border.cpp Implementation of Border object
(c) Mircea Neacsu 2017
*/
#include <mlib/border.h>
#include <stdio.h>
#include <algorithm>
#include <utf8/utf8.h>
using namespace std;
/*!
\defgroup geom Geometry
\brief Geometry concepts and algorithms
*/
namespace mlib {
/*!
\class Border
\ingroup geom
\brief Representation of a simple, non-intersecting polygon that
partitions the 2D space in two regions.
The polygon is represented by its vertexes and it is always assumed that
there is a segment joining the last point with the first point. A Border object
can be stored in a text file where each line represents a vertex. The last
vertex defines what is considered the "inside" of the polygon: if the point
lays inside the polygon, it is an "island" border. If the last point is
outside the polygon, it is a "hole" border.
*/
/*!
Create an empty border object
*/
Border::Border ()
{
closing.x = 0;
closing.y = 0;
closing_outside = 0;
}
/*!
Load a border object from a text file.
*/
Border::Border (const char *fname)
{
dpoint p;
closing.x = 0;
closing.y = 0;
closing_outside = 0;
FILE *f = utf8::fopen (fname, "r");
if (!f)
return;
while (!feof (f))
{
char ln[256];
fgets (ln, sizeof (ln), f);
sscanf (ln, "%lf%lf", &p.x, &p.y);
vertex.push_back (p);
}
fclose (f);
closing = vertex.back ();
vertex.pop_back ();
closing_outside = !inside (closing.x, closing.y);
}
void Border::add (double x, double y)
{
dpoint p;
p.x = x;
p.y = y;
vertex.push_back (p);
}
void Border::close (double x, double y)
{
closing.x = x;
closing.y = y;
closing_outside = !inside (closing.x, closing.y);
}
/*!
Check if a point is inside the border.
\param x - X coordinate of the point
\param y - Y coordinate of the point
\return true if point is inside the border
Algorithm adapted from W. Randolph Franklin <wrf@ecse.rpi.edu>
http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html
*/
bool Border::inside (double x, double y)
{
int c = 0;
deque<dpoint>::iterator pi = vertex.begin ();
deque<dpoint>::iterator pj = vertex.end ();
if (pi == pj)
return 0; //empty border
pj--;
while (pi != vertex.end ())
{
if (((pi->y > y) != (pj->y > y)) &&
(x < (pj->x - pi->x) * (y - pi->y) / (pj->y - pi->y) + pi->x))
c = !c;
pj = pi++;
}
return (c != closing_outside);
}
}
| 19.991803
| 81
| 0.633046
|
taogashi
|
79f856cdd4b92251b567035ef65143e58204e868
| 8,330
|
cpp
|
C++
|
Simulation/src/manipulator/src/RobotHWInterface.cpp
|
Cinek28/Manipulator
|
de42d956edb9c5a26f61cee605023cd71bddc581
|
[
"MIT"
] | null | null | null |
Simulation/src/manipulator/src/RobotHWInterface.cpp
|
Cinek28/Manipulator
|
de42d956edb9c5a26f61cee605023cd71bddc581
|
[
"MIT"
] | null | null | null |
Simulation/src/manipulator/src/RobotHWInterface.cpp
|
Cinek28/Manipulator
|
de42d956edb9c5a26f61cee605023cd71bddc581
|
[
"MIT"
] | null | null | null |
#include <sstream>
#include <std_msgs/Float64.h>
#include "RobotHWInterface.h"
using namespace hardware_interface;
using joint_limits_interface::JointLimits;
using joint_limits_interface::PositionJointSoftLimitsHandle;
using joint_limits_interface::PositionJointSoftLimitsInterface;
using joint_limits_interface::SoftJointLimits;
RobotHWInterface::RobotHWInterface(ros::NodeHandle &nh) : nodeHandle(nh)
{
init();
controllerManager.reset(new controller_manager::ControllerManager(this, nodeHandle));
nodeHandle.param("/manipulator/hardware_interface/rate", rate, 0.1);
kinematicChain.addSegment(KDL::Segment(KDL::Joint(KDL::Joint::None), KDL::Frame( KDL::Vector(0, 0, 0.13))));
KDL::Frame frame = KDL::Frame(KDL::Rotation::RPY(-KDL::PI/2,0.0,0.0),KDL::Vector(0, 0.00175, 0.0705));
kinematicChain.addSegment(KDL::Segment(KDL::Joint(KDL::Joint::RotZ), frame));
frame = KDL::Frame(KDL::Rotation::RPY(0.0,0.0,1.283),KDL::Vector(0, -0.6, 0.0));
kinematicChain.addSegment(KDL::Segment(KDL::Joint(KDL::Joint::RotZ), frame));
frame = KDL::Frame(KDL::Rotation::EulerZYX(0.0,-KDL::PI/2,0.0),KDL::Vector(0.408, 0.005, 0.0));
kinematicChain.addSegment(KDL::Segment(KDL::Joint(KDL::Joint::RotZ), frame));
frame = KDL::Frame(KDL::Rotation::EulerZYX(-KDL::PI/2,0.0,3*KDL::PI/2),KDL::Vector(0.0, 0.0, -0.129));
kinematicChain.addSegment(KDL::Segment(KDL::Joint(KDL::Joint::RotZ), frame));
frame = KDL::Frame(KDL::Rotation::EulerZYX(0.0,-KDL::PI/2,0.0),KDL::Vector(0.0643, 0.0, 0.0));
kinematicChain.addSegment(KDL::Segment(KDL::Joint(KDL::Joint::RotZ), frame));
frame = KDL::Frame(KDL::Rotation::EulerZYX(0.0,KDL::PI/2,0.0),KDL::Vector(0.0, 0.0, -0.15));
kinematicChain.addSegment(KDL::Segment(KDL::Joint(KDL::Joint::RotZ), frame));
jointVelocities = KDL::JntArray(kinematicChain.getNrOfJoints());
// Sub geometry_msgs::Twist
twistSub = nodeHandle.subscribe("/spacenav/twist",1,&RobotHWInterface::newVelCallback, this);
// // Pub geometry_msgs/PoseStamped
// poseStampedPub = nodeHandle.advertise<geometry_msgs::PoseStamped>("/robot_pose", 1);
//
// jointStatePub = nodeHandle.advertise<sensor_msgs::JointState>("/joint_states", 1);
// Pub external controller steering commands:
commandPub[0] = nodeHandle.advertise<std_msgs::Float64>("/manipulator/shoulder_rotation_controller/command", 1);
commandPub[1] = nodeHandle.advertise<std_msgs::Float64>("/manipulator/forearm_rotation_controller/command", 1);
commandPub[2] = nodeHandle.advertise<std_msgs::Float64>("/manipulator/arm_rotation_controller/command", 1);
commandPub[3] = nodeHandle.advertise<std_msgs::Float64>("/manipulator/wrist_rotation_controller/command", 1);
commandPub[4] = nodeHandle.advertise<std_msgs::Float64>("/manipulator/wrist_pitch_controller/command", 1);
commandPub[5] = nodeHandle.advertise<std_msgs::Float64>("/manipulator/gripper_rotation_controller/command", 1);
std_msgs::Float64 initial_vel;
initial_vel.data = 0.0;
for(int i = 0; i < 6; ++i)
commandPub[i].publish(initial_vel);
nonRealtimeTask = nodeHandle.createTimer(ros::Duration(1.0 / rate), &RobotHWInterface::update, this);
}
RobotHWInterface::~RobotHWInterface()
{
}
void RobotHWInterface::init()
{
// Get joint names
nodeHandle.getParam("/manipulator/hardware_interface/joints", jointNames);
numJoints = jointNames.size();
ROS_INFO("Number of joints: %d", numJoints);
// Resize vectors
jointPosition.resize(numJoints);
jointVelocity.resize(numJoints);
jointEffort.resize(numJoints);
jointPositionCommands.resize(numJoints);
jointVelocityCommands.resize(numJoints);
jointEffortCommands.resize(numJoints);
// Initialize Controller
for (int i = 0; i < numJoints; ++i)
{
// Create joint state interface
JointStateHandle jointStateHandle(jointNames[i], &jointPosition[i], &jointVelocity[i], &jointEffort[i]);
jointStateInt.registerHandle(jointStateHandle);
// Create position joint interface
JointHandle jointPositionHandle(jointStateHandle, &jointPositionCommands[i]);
// JointLimits limits;
// SoftJointLimits softLimits;
// getJointLimits(jointNames[i], nodeHandle, limits);
// PositionJointSoftLimitsHandle jointLimitsHandle(jointPositionHandle, limits, softLimits);
// positionJointSoftLimitsInterface.registerHandle(jointLimitsHandle);
positionJointInt.registerHandle(jointPositionHandle);
//Create velocity joint interface:
JointHandle jointVelocityHandle(jointStateHandle, &jointVelocityCommands[i]);
velocityJointInt.registerHandle(jointVelocityHandle);
// Create effort joint interface
JointHandle jointEffortHandle(jointStateHandle, &jointEffortCommands[i]);
effortJointInt.registerHandle(jointEffortHandle);
}
registerInterface(&jointStateInt);
registerInterface(&velocityJointInt);
registerInterface(&positionJointInt);
registerInterface(&effortJointInt);
// registerInterface(&positionJointSoftLimitsInterface);
robot.openPort(0, BAUDRATE);
}
void RobotHWInterface::update(const ros::TimerEvent &e)
{
elapsedTime = ros::Duration(e.current_real - e.last_real);
read();
controllerManager->update(ros::Time::now(), elapsedTime);
write(elapsedTime);
}
void RobotHWInterface::read()
{
ManipulatorMsg msg;
if(isRobotConnected() && robot.readData(&msg))
{
for (int i = 0; i < numJoints; i++)
{
jointVelocity[i] = (double)(msg.params[i] | (msg.params[i+1] << 8));
}
}
}
void RobotHWInterface::write(ros::Duration elapsed_time)
{
// positionJointSoftLimitsInterface.enforceLimits(elapsed_time);
if(!isRobotConnected() || mode == IDLE)
{
for(int i = 0; i < numJoints; ++i)
{
ROS_INFO("Setting command to %s, %d: %f",jointNames[i].c_str(), i, jointVelocities(i));
velocityJointInt.getHandle(jointNames[i]).setCommand(jointVelocities(i));
}
}
else
{ ManipulatorMsg msg;
uint16_t velocity = 0;
msg.type = mode;
msg.length = 2*numJoints;
msg.checksum = msg.type + msg.length;
for (int i = 0; i < numJoints; i++)
{
// TODO: Write joints velocities/efforts
msg.params[i] = (uint8_t)jointVelocities(i);
msg.params[i+1] = (uint8_t)((uint16_t)jointVelocities(i) >> 8);
msg.checksum += msg.params[i] + msg.params[i+1];
}
msg.checksum = ~msg.checksum;
robot.sendData(&msg);
}
}
KDL::JntArray RobotHWInterface::solveIndirectKinematics(const geometry_msgs::Twist &msg) {
KDL::Twist temp_twist;
temp_twist.vel.x(msg.linear.x);
temp_twist.vel.y(msg.linear.y);
temp_twist.vel.z(msg.linear.z);
temp_twist.rot.x(msg.angular.x);
temp_twist.rot.y(msg.angular.y);
temp_twist.rot.z(msg.angular.z);
//Create joint array
KDL::JntArray joint_positions = KDL::JntArray(kinematicChain.getNrOfJoints());
for(int i = 0; i < numJoints; ++i)
{
joint_positions(i)=jointPosition[i];
}
// Create the frame that will contain the results
KDL::Frame cartpos;
KDL::ChainFkSolverPos_recursive fksolver(kinematicChain);
KDL::ChainIkSolverVel_pinv iksolver(kinematicChain); //Inverse velocity solver
KDL::JntArray joint_velocities = KDL::JntArray(kinematicChain.getNrOfJoints());
iksolver.CartToJnt(joint_positions, temp_twist, joint_velocities);
return joint_velocities;
}
void RobotHWInterface::newVelCallback(const geometry_msgs::Twist &msg) {
if(mode == TOOL)
{
// Calculate indirect kinematics
jointVelocities = solveIndirectKinematics(msg);
}
else
{
jointVelocities(0) = msg.linear.x;
jointVelocities(1) = msg.linear.y;
jointVelocities(2) = msg.linear.z;
jointVelocities(3) = msg.angular.x;
jointVelocities(4) = msg.angular.y;
jointVelocities(5) = msg.angular.z;
}
for (int i = 0; i < 6; ++i)
{
if(fabs(jointVelocities(i)) < 0.5)
jointVelocities(i) = 0.0;
std_msgs::Float64 velocity;
velocity.data = jointVelocities(i);
// commandPub[i].publish(velocity);
}
}
| 37.522523
| 116
| 0.685714
|
Cinek28
|
0302acb3cb76ec9f92d2dce3bd8efdd63ce082c2
| 2,065
|
cpp
|
C++
|
wpilibc/src/main/native/cpp/Compressor.cpp
|
lhvy/allwpilib
|
cc31079a1123498faf1acfb7f12b5976c6a686af
|
[
"BSD-3-Clause"
] | 39
|
2021-06-18T03:22:30.000Z
|
2022-03-21T15:23:43.000Z
|
wpilibc/src/main/native/cpp/Compressor.cpp
|
lhvy/allwpilib
|
cc31079a1123498faf1acfb7f12b5976c6a686af
|
[
"BSD-3-Clause"
] | 10
|
2021-06-18T03:22:19.000Z
|
2022-03-18T22:14:15.000Z
|
wpilibc/src/main/native/cpp/Compressor.cpp
|
lhvy/allwpilib
|
cc31079a1123498faf1acfb7f12b5976c6a686af
|
[
"BSD-3-Clause"
] | 4
|
2021-08-19T19:20:04.000Z
|
2022-03-08T07:33:18.000Z
|
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "frc/Compressor.h"
#include <hal/FRCUsageReporting.h>
#include <hal/Ports.h>
#include <wpi/sendable/SendableBuilder.h>
#include <wpi/sendable/SendableRegistry.h>
#include "frc/Errors.h"
using namespace frc;
Compressor::Compressor(int module, PneumaticsModuleType moduleType)
: m_module{PneumaticsBase::GetForType(module, moduleType)} {
if (!m_module->ReserveCompressor()) {
throw FRC_MakeError(err::ResourceAlreadyAllocated, "{}", module);
}
SetClosedLoopControl(true);
HAL_Report(HALUsageReporting::kResourceType_Compressor, module + 1);
wpi::SendableRegistry::AddLW(this, "Compressor", module);
}
Compressor::Compressor(PneumaticsModuleType moduleType)
: Compressor{PneumaticsBase::GetDefaultForType(moduleType), moduleType} {}
Compressor::~Compressor() {
m_module->UnreserveCompressor();
}
void Compressor::Start() {
SetClosedLoopControl(true);
}
void Compressor::Stop() {
SetClosedLoopControl(false);
}
bool Compressor::Enabled() const {
return m_module->GetCompressor();
}
bool Compressor::GetPressureSwitchValue() const {
return m_module->GetPressureSwitch();
}
double Compressor::GetCompressorCurrent() const {
return m_module->GetCompressorCurrent();
}
void Compressor::SetClosedLoopControl(bool on) {
m_module->SetClosedLoopControl(on);
}
bool Compressor::GetClosedLoopControl() const {
return m_module->GetClosedLoopControl();
}
void Compressor::InitSendable(wpi::SendableBuilder& builder) {
builder.SetSmartDashboardType("Compressor");
builder.AddBooleanProperty(
"Closed Loop Control", [=]() { return GetClosedLoopControl(); },
[=](bool value) { SetClosedLoopControl(value); });
builder.AddBooleanProperty(
"Enabled", [=] { return Enabled(); }, nullptr);
builder.AddBooleanProperty(
"Pressure switch", [=]() { return GetPressureSwitchValue(); }, nullptr);
}
| 28.287671
| 78
| 0.743341
|
lhvy
|
03033a70d7d6c863f038d38a0f8745b2ede7df17
| 4,817
|
hpp
|
C++
|
query_optimizer/logical/TableReference.hpp
|
Hacker0912/quickstep-datalog
|
1de22e7ab787b5efa619861a167a097ff6a4f549
|
[
"Apache-2.0"
] | 82
|
2016-04-18T03:59:06.000Z
|
2019-02-04T11:46:08.000Z
|
query_optimizer/logical/TableReference.hpp
|
Hacker0912/quickstep-datalog
|
1de22e7ab787b5efa619861a167a097ff6a4f549
|
[
"Apache-2.0"
] | 265
|
2016-04-19T17:52:43.000Z
|
2018-10-11T17:55:08.000Z
|
query_optimizer/logical/TableReference.hpp
|
Hacker0912/quickstep-datalog
|
1de22e7ab787b5efa619861a167a097ff6a4f549
|
[
"Apache-2.0"
] | 68
|
2016-04-18T05:00:34.000Z
|
2018-10-30T12:41:02.000Z
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
**/
#ifndef QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_LOGICAL_TABLE_REFERENCE_HPP_
#define QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_LOGICAL_TABLE_REFERENCE_HPP_
#include <memory>
#include <string>
#include <vector>
#include "query_optimizer/OptimizerTree.hpp"
#include "query_optimizer/expressions/AttributeReference.hpp"
#include "query_optimizer/logical/Logical.hpp"
#include "query_optimizer/logical/LogicalType.hpp"
#include "utility/Macros.hpp"
#include "glog/logging.h"
namespace quickstep {
class CatalogRelation;
namespace optimizer {
class OptimizerContext;
namespace logical {
/** \addtogroup OptimizerLogical
* @{
*/
class TableReference;
typedef std::shared_ptr<const TableReference> TableReferencePtr;
/**
* @brief Leaf logical operator that represents a reference to
* a catalog relation.
*/
class TableReference : public Logical {
public:
LogicalType getLogicalType() const override { return LogicalType::kTableReference; }
std::string getName() const override { return "TableReference"; }
/**
* @return The catalog relation which the operator scans.
*/
const CatalogRelation* catalog_relation() const { return catalog_relation_; }
/**
* @return The relation alias.
*/
const std::string& relation_alias() const { return relation_alias_; }
/**
* @return The references to the attributes in the relation.
*/
const std::vector<expressions::AttributeReferencePtr>& attribute_list() const {
return attribute_list_;
}
LogicalPtr copyWithNewChildren(
const std::vector<LogicalPtr> &new_children) const override;
std::vector<expressions::AttributeReferencePtr> getOutputAttributes() const override {
return attribute_list_;
}
std::vector<expressions::AttributeReferencePtr> getReferencedAttributes() const override {
return getOutputAttributes();
}
/**
* @brief Generates a AttributeRerference for each CatalogAttribute in the \p
* catalog_relation and creates a TableReference on it.
*
* @param catalog_relation The catalog relation to be scanned.
* @param relation_alias The relation alias. This is stored here for the printing purpose only.
* @param optimizer_context The OptimizerContext for the query.
* @return An immutable TableReference.
*/
static TableReferencePtr Create(const CatalogRelation *catalog_relation,
const std::string &relation_alias,
OptimizerContext *optimizer_context) {
DCHECK(!relation_alias.empty());
return TableReferencePtr(
new TableReference(catalog_relation, relation_alias, optimizer_context));
}
protected:
void getFieldStringItems(
std::vector<std::string> *inline_field_names,
std::vector<std::string> *inline_field_values,
std::vector<std::string> *non_container_child_field_names,
std::vector<OptimizerTreeBaseNodePtr> *non_container_child_fields,
std::vector<std::string> *container_child_field_names,
std::vector<std::vector<OptimizerTreeBaseNodePtr>> *container_child_fields) const override;
private:
TableReference(const CatalogRelation *catalog_relation,
const std::string &relation_alias,
OptimizerContext *optimizer_context);
// Constructor where the attribute list is explicitly given.
TableReference(
const CatalogRelation *catalog_relation,
const std::string &relation_alias,
const std::vector<expressions::AttributeReferencePtr> &attribute_list)
: catalog_relation_(catalog_relation),
relation_alias_(relation_alias),
attribute_list_(attribute_list) {}
const CatalogRelation *catalog_relation_;
const std::string relation_alias_;
std::vector<expressions::AttributeReferencePtr> attribute_list_;
DISALLOW_COPY_AND_ASSIGN(TableReference);
};
/** @} */
} // namespace logical
} // namespace optimizer
} // namespace quickstep
#endif /* QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_LOGICAL_TABLE_REFERENCE_HPP_ */
| 33.451389
| 97
| 0.744032
|
Hacker0912
|
03059a397b411fb7e5880a29eb03be4cbaefedf9
| 2,601
|
hpp
|
C++
|
libs/pika/async_cuda/include/pika/async_cuda/cuda_event.hpp
|
pika-org/pika
|
c80f542b2432a7f108fcfba31a5fe5073ad2b3e1
|
[
"BSL-1.0"
] | 13
|
2022-01-17T12:01:48.000Z
|
2022-03-16T10:03:14.000Z
|
libs/pika/async_cuda/include/pika/async_cuda/cuda_event.hpp
|
pika-org/pika
|
c80f542b2432a7f108fcfba31a5fe5073ad2b3e1
|
[
"BSL-1.0"
] | 163
|
2022-01-17T17:36:45.000Z
|
2022-03-31T17:42:57.000Z
|
libs/pika/async_cuda/include/pika/async_cuda/cuda_event.hpp
|
pika-org/pika
|
c80f542b2432a7f108fcfba31a5fe5073ad2b3e1
|
[
"BSL-1.0"
] | 4
|
2022-01-19T08:44:22.000Z
|
2022-01-31T23:16:21.000Z
|
// Copyright (c) 2020 John Biddiscombe
// Copyright (c) 2020 Teodor Nikolov
//
// SPDX-License-Identifier: BSL-1.0
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#pragma once
#include <pika/async_cuda/cuda_exception.hpp>
#include <pika/async_cuda/custom_gpu_api.hpp>
#include <boost/lockfree/stack.hpp>
namespace pika::cuda::experimental::detail {
// a pool of cudaEvent_t objects.
// Since allocation of a cuda event passes into the cuda runtime
// it might be an expensive operation, so we pre-allocate a pool
// of them at startup.
struct cuda_event_pool
{
static constexpr int initial_events_in_pool = 128;
static cuda_event_pool& get_event_pool()
{
static cuda_event_pool event_pool_;
return event_pool_;
}
// create a bunch of events on initialization
cuda_event_pool()
: free_list_(initial_events_in_pool)
{
for (int i = 0; i < initial_events_in_pool; ++i)
{
add_event_to_pool();
}
}
// on destruction, all objects in stack will be freed
~cuda_event_pool()
{
cudaEvent_t event;
bool ok = true;
while (ok)
{
ok = free_list_.pop(event);
if (ok)
check_cuda_error(cudaEventDestroy(event));
}
}
inline bool pop(cudaEvent_t& event)
{
// pop an event off the pool, if that fails, create a new one
while (!free_list_.pop(event))
{
add_event_to_pool();
}
return true;
}
inline bool push(cudaEvent_t event)
{
return free_list_.push(event);
}
private:
void add_event_to_pool()
{
cudaEvent_t event;
// Create an cuda_event to query a CUDA/CUBLAS kernel for completion.
// Timing is disabled for performance. [1]
//
// [1]: CUDA Runtime API, section 5.5 cuda_event Management
check_cuda_error(
cudaEventCreateWithFlags(&event, cudaEventDisableTiming));
free_list_.push(event);
}
// pool is dynamically sized and can grow if needed
boost::lockfree::stack<cudaEvent_t, boost::lockfree::fixed_sized<false>>
free_list_;
};
} // namespace pika::cuda::experimental::detail
| 29.896552
| 81
| 0.576701
|
pika-org
|
0306b8266d2e2748f1549e9e751e5f9551a5fa87
| 1,091
|
hpp
|
C++
|
AudioKit/Core/Devoloop/FFTReal/FFTRealSelect.hpp
|
ethi1989/AudioKit
|
97acc8da6dfb75408b2276998073de7a4511d480
|
[
"MIT"
] | 206
|
2020-10-28T12:47:49.000Z
|
2022-03-26T14:09:30.000Z
|
AudioKit/Core/Devoloop/FFTReal/FFTRealSelect.hpp
|
ethi1989/AudioKit
|
97acc8da6dfb75408b2276998073de7a4511d480
|
[
"MIT"
] | 7
|
2020-10-29T10:29:23.000Z
|
2021-08-07T00:22:03.000Z
|
AudioKit/Core/Devoloop/FFTReal/FFTRealSelect.hpp
|
ethi1989/AudioKit
|
97acc8da6dfb75408b2276998073de7a4511d480
|
[
"MIT"
] | 30
|
2020-10-28T16:11:40.000Z
|
2021-12-28T01:15:23.000Z
|
/*****************************************************************************
FFTRealSelect.hpp
By Laurent de Soras
--- Legal stuff ---
This program is free software. It comes without any warranty, to
the extent permitted by applicable law. You can redistribute it
and/or modify it under the terms of the Do What The Fuck You Want
To Public License, Version 2, as published by Sam Hocevar. See
http://sam.zoy.org/wtfpl/COPYING for more details.
*Tab=3***********************************************************************/
#if defined(ffft_FFTRealSelect_CURRENT_CODEHEADER)
#error Recursive inclusion of FFTRealSelect code header.
#endif
#define ffft_FFTRealSelect_CURRENT_CODEHEADER
#if !defined(ffft_FFTRealSelect_CODEHEADER_INCLUDED)
#define ffft_FFTRealSelect_CODEHEADER_INCLUDED
namespace ffft {
template <int P> float *FFTRealSelect<P>::sel_bin(float *e_ptr, float *o_ptr) {
return (o_ptr);
}
template <>
inline float *FFTRealSelect<0>::sel_bin(float *e_ptr, float *o_ptr) {
return (e_ptr);
}
}
#endif
#undef ffft_FFTRealSelect_CURRENT_CODEHEADER
| 24.795455
| 79
| 0.662695
|
ethi1989
|
0307638490f51f2f3ee12d67be17b4211ab1146f
| 6,917
|
cpp
|
C++
|
uwsim_resources/uwsim_osgworks/src/osgwTools/CameraConfigObject.cpp
|
epsilonorion/usv_lsa_sim_copy
|
d189f172dc1d265b7688c7dc8375a65ac4a9c048
|
[
"Apache-2.0"
] | 1
|
2020-11-30T09:55:33.000Z
|
2020-11-30T09:55:33.000Z
|
uwsim_resources/uwsim_osgworks/src/osgwTools/CameraConfigObject.cpp
|
epsilonorion/usv_lsa_sim_copy
|
d189f172dc1d265b7688c7dc8375a65ac4a9c048
|
[
"Apache-2.0"
] | null | null | null |
uwsim_resources/uwsim_osgworks/src/osgwTools/CameraConfigObject.cpp
|
epsilonorion/usv_lsa_sim_copy
|
d189f172dc1d265b7688c7dc8375a65ac4a9c048
|
[
"Apache-2.0"
] | 2
|
2020-11-21T19:50:54.000Z
|
2020-12-27T09:35:29.000Z
|
/*************** <auto-copyright.pl BEGIN do not edit this line> **************
*
* osgWorks is (C) Copyright 2009-2012 by Kenneth Mark Bryden
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*************** <auto-copyright.pl END do not edit this line> ***************/
#include <osgwTools/CameraConfigObject.h>
#include <osgwTools/Version.h>
#include <osgDB/ReadFile>
#include <osg/Object>
#include <osgViewer/Viewer>
#include <osg/Matrixd>
#include <vector>
#include <string>
#include <osg/io_utils>
namespace osgwTools
{
CameraConfigInfo::CameraConfigInfo()
: _version( 1 )
{
}
CameraConfigInfo::CameraConfigInfo( const osgwTools::CameraConfigInfo& rhs, const osg::CopyOp& )
: _viewOffset( rhs._viewOffset ),
_projectionOffset( rhs._projectionOffset ),
_version( rhs._version )
{
}
CameraConfigInfo::~CameraConfigInfo()
{
}
CameraConfigObject::CameraConfigObject()
: _version( 1 )
{
}
CameraConfigObject::CameraConfigObject( const osgwTools::CameraConfigObject& rhs, const osg::CopyOp& copyop )
: _version( rhs._version ),
_slaveConfigInfo( rhs._slaveConfigInfo )
{
}
CameraConfigObject::~CameraConfigObject()
{
}
void
CameraConfigObject::take( const osgViewer::Viewer& viewer )
{
if( viewer.getNumSlaves() == 0 )
return;
if( _slaveConfigInfo.size() != viewer.getNumSlaves() )
_slaveConfigInfo.resize( viewer.getNumSlaves() );
unsigned int idx;
for( idx=0; idx<viewer.getNumSlaves(); idx++ )
{
_slaveConfigInfo[ idx ] = new osgwTools::CameraConfigInfo;
osgwTools::CameraConfigInfo* cci( _slaveConfigInfo[ idx ].get() );
const osg::View::Slave& slave = viewer.getSlave( idx );
cci->_viewOffset = slave._viewOffset;
cci->_projectionOffset = slave._projectionOffset;
}
}
void
CameraConfigObject::store( osgViewer::Viewer& viewer )
{
osg::Camera* masterCamera = viewer.getCamera();
//
// What follows is taken from View::setUpViewAcrossAllScreens()
// and modified as needed to work with what we're doing.
//
osg::GraphicsContext::WindowingSystemInterface* wsi = osg::GraphicsContext::getWindowingSystemInterface();
if (!wsi)
{
osg::notify(osg::NOTICE)<<"View::setUpViewAcrossAllScreens() : Error, no WindowSystemInterface available, cannot create windows."<<std::endl;
return;
}
osg::DisplaySettings* ds = masterCamera->getDisplaySettings() != NULL ?
masterCamera->getDisplaySettings() :
#if( OSGWORKS_OSG_VERSION > 20907 )
// 2.9.7 2/22/2010
// r11399, 4/30/2010 Changed DisplaySetting::instance() to return a ref_ptr<>& rathern than a raw C pointer to enable apps to delete the singleton or assign their own.
// 2.9.8 6/18/2010
osg::DisplaySettings::instance().get();
#else
osg::DisplaySettings::instance();
#endif
double fovy, aspectRatio, zNear, zFar;
masterCamera->getProjectionMatrixAsPerspective(fovy, aspectRatio, zNear, zFar);
osg::GraphicsContext::ScreenIdentifier si;
si.readDISPLAY();
// displayNum has not been set so reset it to 0.
if (si.displayNum<0) si.displayNum = 0;
unsigned int numScreens = wsi->getNumScreens(si);
if( numScreens != _slaveConfigInfo.size() )
{
osg::notify( osg::WARN ) << "Number of screens not equal to number of config slaves." << std::endl;
return;
}
for(unsigned int i=0; i<numScreens; ++i)
{
si.screenNum = i;
unsigned int width, height;
wsi->getScreenResolution(si, width, height);
#if ( OSGWORKS_OSG_VERSION >= 20906 )
osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits(ds);
#else
osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits;
#endif
traits->hostName = si.hostName;
traits->displayNum = si.displayNum;
traits->screenNum = si.screenNum;
traits->screenNum = i;
traits->x = 0;
traits->y = 0;
traits->width = width;
traits->height = height;
traits->windowDecoration = false;
traits->doubleBuffer = true;
traits->sharedContext = 0;
osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get());
osg::ref_ptr<osg::Camera> camera = new osg::Camera;
camera->setGraphicsContext(gc.get());
osgViewer::GraphicsWindow* gw = dynamic_cast<osgViewer::GraphicsWindow*>(gc.get());
if (gw)
{
osg::notify(osg::INFO)<<" GraphicsWindow has been created successfully."<<gw<<std::endl;
gw->getEventQueue()->getCurrentEventState()->setWindowRectangle(traits->x, traits->y, traits->width, traits->height );
}
else
{
osg::notify(osg::NOTICE)<<" GraphicsWindow has not been created successfully."<<std::endl;
}
camera->setViewport(new osg::Viewport(0, 0, traits->width, traits->height));
GLenum buffer = traits->doubleBuffer ? GL_BACK : GL_FRONT;
camera->setDrawBuffer(buffer);
camera->setReadBuffer(buffer);
const osgwTools::CameraConfigInfo* cci = _slaveConfigInfo[ i ].get();
viewer.addSlave( camera.get(), cci->_projectionOffset, cci->_viewOffset );
}
viewer.assignSceneDataToCameras();
}
bool
configureViewer( osgViewer::Viewer& viewer, const std::string& configFile )
{
std::string fileName;
if( !configFile.empty() )
fileName = configFile;
else
{
const char* buffer( getenv( "OSGW_VIEWER_CONFIG" ) );
if( buffer != NULL )
fileName = std::string( buffer );
}
if( fileName.empty() )
{
osg::notify( osg::INFO ) << "configureViewer: No Viewer config file." << std::endl;
return( false );
}
osg::ref_ptr< osgwTools::CameraConfigObject > cco =
dynamic_cast< osgwTools::CameraConfigObject* >(
osgDB::readObjectFile( fileName ) );
if( !cco.valid() )
{
osg::notify( osg::WARN ) << "configureViewer: Can't load config object from \"" << fileName << "\"." << std::endl;
return( false );
}
cco->store( viewer );
return( true );
}
// namespace osgwTools
}
| 30.879464
| 179
| 0.649414
|
epsilonorion
|
030eafb0b7ac23687c5efb8afc68be333019151f
| 157
|
hpp
|
C++
|
examples/Basics/Objects/MultipleConstructors/Spot.hpp
|
RedErr404/cprocessing
|
ab8ef25ea3e4bcd915f9c086b649696866ea77ca
|
[
"BSD-2-Clause"
] | 12
|
2015-01-12T07:43:22.000Z
|
2022-03-08T06:43:20.000Z
|
examples/Basics/Objects/MultipleConstructors/Spot.hpp
|
RedErr404/cprocessing
|
ab8ef25ea3e4bcd915f9c086b649696866ea77ca
|
[
"BSD-2-Clause"
] | null | null | null |
examples/Basics/Objects/MultipleConstructors/Spot.hpp
|
RedErr404/cprocessing
|
ab8ef25ea3e4bcd915f9c086b649696866ea77ca
|
[
"BSD-2-Clause"
] | 7
|
2015-02-09T15:44:10.000Z
|
2019-07-07T11:48:10.000Z
|
#ifndef SPOT_H_
#define SPOT_H_
class Spot {
public:
float x, y, radius;
Spot();
Spot(float xpos, float ypos, float r);
void display();
};
#endif
| 11.214286
| 40
| 0.649682
|
RedErr404
|
030efcd4bd56bbf3445de59d7ef7886102b22d89
| 4,502
|
cpp
|
C++
|
Source/FieldSolver/SpectralSolver/WrapCuFFT.cpp
|
hklion/WarpX
|
3c2d0ee2815ab1df21b9f78d899fe7b1a9651758
|
[
"BSD-3-Clause-LBNL"
] | null | null | null |
Source/FieldSolver/SpectralSolver/WrapCuFFT.cpp
|
hklion/WarpX
|
3c2d0ee2815ab1df21b9f78d899fe7b1a9651758
|
[
"BSD-3-Clause-LBNL"
] | null | null | null |
Source/FieldSolver/SpectralSolver/WrapCuFFT.cpp
|
hklion/WarpX
|
3c2d0ee2815ab1df21b9f78d899fe7b1a9651758
|
[
"BSD-3-Clause-LBNL"
] | null | null | null |
/* Copyright 2019-2020
*
* This file is part of WarpX.
*
* License: BSD-3-Clause-LBNL
*/
#include "AnyFFT.H"
#include "Utils/TextMsg.H"
namespace AnyFFT
{
#ifdef AMREX_USE_FLOAT
cufftType VendorR2C = CUFFT_R2C;
cufftType VendorC2R = CUFFT_C2R;
#else
cufftType VendorR2C = CUFFT_D2Z;
cufftType VendorC2R = CUFFT_Z2D;
#endif
std::string cufftErrorToString (const cufftResult& err);
FFTplan CreatePlan(const amrex::IntVect& real_size, amrex::Real * const real_array,
Complex * const complex_array, const direction dir, const int dim)
{
FFTplan fft_plan;
// Initialize fft_plan.m_plan with the vendor fft plan.
cufftResult result;
if (dir == direction::R2C){
if (dim == 3) {
result = cufftPlan3d(
&(fft_plan.m_plan), real_size[2], real_size[1], real_size[0], VendorR2C);
} else if (dim == 2) {
result = cufftPlan2d(
&(fft_plan.m_plan), real_size[1], real_size[0], VendorR2C);
} else {
amrex::Abort(Utils::TextMsg::Err("only dim=2 and dim=3 have been implemented"));
}
} else {
if (dim == 3) {
result = cufftPlan3d(
&(fft_plan.m_plan), real_size[2], real_size[1], real_size[0], VendorC2R);
} else if (dim == 2) {
result = cufftPlan2d(
&(fft_plan.m_plan), real_size[1], real_size[0], VendorC2R);
} else {
amrex::Abort(Utils::TextMsg::Err("only dim=2 and dim=3 have been implemented"));
}
}
if ( result != CUFFT_SUCCESS ) {
amrex::Print() << Utils::TextMsg::Err(
"cufftplan failed! Error: "
+ cufftErrorToString(result));
}
// Store meta-data in fft_plan
fft_plan.m_real_array = real_array;
fft_plan.m_complex_array = complex_array;
fft_plan.m_dir = dir;
fft_plan.m_dim = dim;
return fft_plan;
}
void DestroyPlan(FFTplan& fft_plan)
{
cufftDestroy( fft_plan.m_plan );
}
void Execute(FFTplan& fft_plan){
// make sure that this is done on the same GPU stream as the above copy
cudaStream_t stream = amrex::Gpu::Device::cudaStream();
cufftSetStream ( fft_plan.m_plan, stream);
cufftResult result;
if (fft_plan.m_dir == direction::R2C){
#ifdef AMREX_USE_FLOAT
result = cufftExecR2C(fft_plan.m_plan, fft_plan.m_real_array, fft_plan.m_complex_array);
#else
result = cufftExecD2Z(fft_plan.m_plan, fft_plan.m_real_array, fft_plan.m_complex_array);
#endif
} else if (fft_plan.m_dir == direction::C2R){
#ifdef AMREX_USE_FLOAT
result = cufftExecC2R(fft_plan.m_plan, fft_plan.m_complex_array, fft_plan.m_real_array);
#else
result = cufftExecZ2D(fft_plan.m_plan, fft_plan.m_complex_array, fft_plan.m_real_array);
#endif
} else {
amrex::Abort(Utils::TextMsg::Err(
"direction must be AnyFFT::direction::R2C or AnyFFT::direction::C2R"));
}
if ( result != CUFFT_SUCCESS ) {
amrex::Print() << Utils::TextMsg::Err(
"forward transform using cufftExec failed ! Error: "
+cufftErrorToString(result));
}
}
/** \brief This method converts a cufftResult
* into the corresponding string
*
* @param[in] err a cufftResult
* @return an std::string
*/
std::string cufftErrorToString (const cufftResult& err)
{
const auto res2string = std::map<cufftResult, std::string>{
{CUFFT_SUCCESS, "CUFFT_SUCCESS"},
{CUFFT_INVALID_PLAN,"CUFFT_INVALID_PLAN"},
{CUFFT_ALLOC_FAILED,"CUFFT_ALLOC_FAILED"},
{CUFFT_INVALID_TYPE,"CUFFT_INVALID_TYPE"},
{CUFFT_INVALID_VALUE,"CUFFT_INVALID_VALUE"},
{CUFFT_INTERNAL_ERROR,"CUFFT_INTERNAL_ERROR"},
{CUFFT_EXEC_FAILED,"CUFFT_EXEC_FAILED"},
{CUFFT_SETUP_FAILED,"CUFFT_SETUP_FAILED"},
{CUFFT_INVALID_SIZE,"CUFFT_INVALID_SIZE"},
{CUFFT_UNALIGNED_DATA,"CUFFT_UNALIGNED_DATA"}};
const auto it = res2string.find(err);
if(it != res2string.end()){
return it->second;
}
else{
return std::to_string(err) +
" (unknown error code)";
}
}
}
| 34.106061
| 100
| 0.585962
|
hklion
|
03175d0092112734f5bb759fc792973c9de43d16
| 6,356
|
cpp
|
C++
|
Core/PawnEngine/engine/data/AssimpLoader.cpp
|
obivan43/pawnengine
|
ec092fa855d41705f3fb55fcf1aa5e515d093405
|
[
"MIT"
] | null | null | null |
Core/PawnEngine/engine/data/AssimpLoader.cpp
|
obivan43/pawnengine
|
ec092fa855d41705f3fb55fcf1aa5e515d093405
|
[
"MIT"
] | null | null | null |
Core/PawnEngine/engine/data/AssimpLoader.cpp
|
obivan43/pawnengine
|
ec092fa855d41705f3fb55fcf1aa5e515d093405
|
[
"MIT"
] | null | null | null |
#include "AssimpLoader.h"
#include "MeshNodeData.h"
#include "assimp/Importer.hpp"
#include "assimp/scene.h"
#include "assimp/postprocess.h"
#include "PawnGraphics/graphics/GraphicsBuffer.h"
#include "PawnGraphics/graphics/GraphicsInputLayout.h"
#include "PawnGraphics/graphics/GraphicsShader.h"
#include "PawnUtils/utils/logger/Logger.h"
namespace pawn::engine {
glm::mat4 convertAssimpTransformation(const aiMatrix4x4& matrix) {
glm::mat4 result;
result[0][0] = matrix.a1; result[1][0] = matrix.a2; result[2][0] = matrix.a3; result[3][0] = matrix.a4;
result[0][1] = matrix.b1; result[1][1] = matrix.b2; result[2][1] = matrix.b3; result[3][1] = matrix.b4;
result[0][2] = matrix.c1; result[1][2] = matrix.c2; result[2][2] = matrix.c3; result[3][2] = matrix.c4;
result[0][3] = matrix.d1; result[1][3] = matrix.d2; result[2][3] = matrix.d3; result[3][3] = matrix.d4;
return result;
}
AssimpLoader::AssimpLoader() {
m_Importer = new Assimp::Importer();
m_ModelScene = nullptr;
m_ModelNode = nullptr;
}
AssimpLoader::~AssimpLoader() {
Flush();
delete m_Importer;
}
void AssimpLoader::Flush() {
m_ModelScene = nullptr;
m_ModelNode = nullptr;
m_Verticies.clear();
m_Indices.clear();
m_Nodes.clear();
m_MeshNodeData.clear();
}
std::shared_ptr<Mesh> AssimpLoader::LoadModel(const char* file, std::shared_ptr<graphics::GraphicsContext>& context, std::shared_ptr<graphics::GraphicsShader>& shader) {
Flush();
m_ModelScene = m_Importer->ReadFile(file,
aiProcess_CalcTangentSpace |
aiProcess_Triangulate |
aiProcess_SortByPType |
aiProcess_GenNormals |
aiProcess_GenUVCoords |
aiProcess_OptimizeMeshes |
aiProcess_ValidateDataStructure
);
if (!m_ModelScene) {
CONSOLE_INFO("Assimp loader: Model not loaded {}", file)
return false;
}
return ProcessData(context, shader);
}
std::shared_ptr<Mesh> AssimpLoader::ProcessData(std::shared_ptr<graphics::GraphicsContext>& context, std::shared_ptr<graphics::GraphicsShader>& shader) {
if (m_ModelScene->mNumMeshes > 0) {
uint32_t vertexCount = 0;
uint32_t indexCount = 0;
m_MeshNodeData.reserve(m_ModelScene->mNumMeshes);
for (uint32_t i = 0; i < m_ModelScene->mNumMeshes; ++i) {
const aiMesh* mesh = m_ModelScene->mMeshes[i];
MeshNodeData& meshNodeData = m_MeshNodeData.emplace_back();
meshNodeData.VertexShift = vertexCount;
meshNodeData.IndexShift = indexCount;
meshNodeData.IndexCount = m_ModelScene->mMeshes[i]->mNumFaces * 3;
meshNodeData.Name = mesh->mName.C_Str();
vertexCount += mesh->mNumVertices;
indexCount += meshNodeData.IndexCount;
GetAssimpMeshData(mesh);
}
UpdateMeshDataInfo(m_ModelScene->mRootNode, glm::mat4(1.0));
static const std::initializer_list<graphics::GraphicsInputElement> inputElements = {
{ "Position", graphics::GraphicsInputElementType::Float3 },
{ "Normal", graphics::GraphicsInputElementType::Float3 },
{ "Tangent", graphics::GraphicsInputElementType::Float3 },
{ "Binormal", graphics::GraphicsInputElementType::Float3 },
{ "TextureCoordinate", graphics::GraphicsInputElementType::Float2 }
};
std::shared_ptr<graphics::GraphicsBuffer> vertexBuffer = graphics::GraphicsBuffer::Create(graphics::GraphicsBufferEnum::VertexBuffer);
std::shared_ptr<graphics::GraphicsBuffer> indexBuffer = graphics::GraphicsBuffer::Create(graphics::GraphicsBufferEnum::IndexBuffer);
std::shared_ptr<graphics::GraphicsInputLayout> inputLayout = graphics::GraphicsInputLayout::Create();
vertexBuffer->Init(context, m_Verticies.data(), static_cast<uint32_t>(m_Verticies.size()), sizeof(Vertex), graphics::GraphicsBufferUsageTypeEnum::StaticBuffer);
vertexBuffer->Bind(context);
indexBuffer->Init(context, m_Indices.data(), static_cast<uint32_t>(m_Indices.size()), sizeof(uint32_t), graphics::GraphicsBufferUsageTypeEnum::StaticBuffer);
indexBuffer->Bind(context);
inputLayout->Init(context, inputElements, shader->GetVertexShaderInfo());
inputLayout->Bind(context);
Mesh* mesh = new Mesh();
mesh->m_MeshNodeData = m_MeshNodeData;
mesh->m_GraphicsMesh.reset(new graphics::GraphicsMesh(vertexBuffer, indexBuffer, inputLayout));
return std::shared_ptr<Mesh>(mesh);
}
return std::shared_ptr<Mesh>();
}
void AssimpLoader::UpdateMeshDataInfo(const aiNode* node, const glm::mat4& transformation) {
glm::mat4 resultTransformation = transformation * convertAssimpTransformation(node->mTransformation);
for (uint32_t i = 0; i < node->mNumMeshes; i++) {
uint32_t index = node->mMeshes[i];
MeshNodeData& meshNodeData = m_MeshNodeData[index];
meshNodeData.Name = node->mName.C_Str();
meshNodeData.Transformation = resultTransformation;
}
for (uint32_t i = 0; i < node->mNumChildren; i++) {
UpdateMeshDataInfo(node->mChildren[i], resultTransformation);
}
}
void AssimpLoader::GetAssimpMeshData(const aiMesh* mesh) {
for (uint32_t i = 0; i < mesh->mNumVertices; i++) {
Vertex vertex;
vertex.Position.x = mesh->mVertices[i].x;
vertex.Position.y = mesh->mVertices[i].y;
vertex.Position.z = mesh->mVertices[i].z;
vertex.Normal.x = mesh->mNormals[i].x;
vertex.Normal.y = mesh->mNormals[i].y;
vertex.Normal.z = mesh->mNormals[i].z;
if (mesh->HasTangentsAndBitangents()) {
vertex.Tangent.x = mesh->mTangents[i].x;
vertex.Tangent.y = mesh->mTangents[i].y;
vertex.Tangent.z = mesh->mTangents[i].z;
vertex.Binormal.x = mesh->mBitangents[i].x;
vertex.Binormal.y = mesh->mBitangents[i].y;
vertex.Binormal.z = mesh->mBitangents[i].z;
}
if (mesh->HasTextureCoords(0)) {
vertex.TextureCoordinate.x = mesh->mTextureCoords[0][i].x;
vertex.TextureCoordinate.y = mesh->mTextureCoords[0][i].y;
}
else {
vertex.TextureCoordinate.x = 0.0f;
vertex.TextureCoordinate.y = 0.0f;
}
m_Verticies.push_back(vertex);
}
aiFace* face;
for (uint32_t i = 0; i < mesh->mNumFaces; i++) {
face = &mesh->mFaces[i];
if (face->mNumIndices < 3) {
continue;
}
m_Indices.push_back(face->mIndices[0]);
m_Indices.push_back(face->mIndices[1]);
m_Indices.push_back(face->mIndices[2]);
}
}
}
| 33.989305
| 171
| 0.689899
|
obivan43
|
0317628ab7974cb8dc9f3e4d1c23ad6aea2bd20d
| 2,975
|
cpp
|
C++
|
src/base/CollisionManager.cpp
|
serserar/ModelConverter
|
23e6237a347dc959de191d4cc378defb0a9d044b
|
[
"MIT"
] | null | null | null |
src/base/CollisionManager.cpp
|
serserar/ModelConverter
|
23e6237a347dc959de191d4cc378defb0a9d044b
|
[
"MIT"
] | null | null | null |
src/base/CollisionManager.cpp
|
serserar/ModelConverter
|
23e6237a347dc959de191d4cc378defb0a9d044b
|
[
"MIT"
] | null | null | null |
/*
* Copyright 2018 <copyright holder> <email>
*
* 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 "CollisionManager.h"
using namespace std;
CollisionManager::CollisionManager()
{
}
CollisionManager::~CollisionManager()
{
}
bool CollisionManager::RayIntersectsTriangle(MVector3<float>& rayOrigin, MVector3<float>& rayDest, Triangle& triangle, MVector3<float>& intersectionPoint)
{
MVector3<float> vertex0 = triangle.v1;
MVector3<float> vertex1 = triangle.v2;
MVector3<float> vertex2 = triangle.v3;
MVector3<float> edge1, edge2, h, s, q;
// float a,f,u,v;
edge1 = vertex1 - vertex0;
edge2 = vertex2 - vertex0;
MVector3<float> normal = edge1.CrossProduct(edge2);
normal.normalize();
MPlane<float> plane(normal,vertex0);
bool intersects = plane.IntersectsRay(rayOrigin, rayDest, intersectionPoint);
if(intersects) {
//check barycentric coords
MVector3<float> bcoords = MeshUtils::GetBaryCentricCoords(triangle, intersectionPoint);
// // Compute vectors
// MVector3<float> v2 = intersectionPoint - vertex0;
// // Compute dot products
// float dot00 = edge2.dotProduct(edge2);
// float dot01 = edge2.dotProduct(edge1);
// float dot02 = edge2.dotProduct(v2);
// float dot11 = edge1.dotProduct(edge1);
// float dot12 = edge1.dotProduct(v2);
//
// // Compute barycentric coordinates
// float invDenom = 1 / (dot00 * dot11 - dot01 * dot01);
// double u = (dot11 * dot02 - dot01 * dot12) * invDenom;
// double v = (dot00 * dot12 - dot01 * dot02) * invDenom;
// Check if point is in triangle
//intersects = (u >= 0) && (v >= 0) && (u + v < 1);
float u = bcoords.GetX();
float v = bcoords.GetY();
float w = bcoords.GetZ();
intersects = (u >= 0) && (v >= 0) && (u + v <= 1) && (u + v + w == 1);
if(intersects) {
MVector3<float> check1 = edge1 * u;
MVector3<float> check2 = edge2 * v;
MVector3<float> res = vertex0 + check1 + check2;
//vertex0 + ((edge1 * u) + (edge2 * v));
cout << "u : " << u << " v : " << v << " w : " << w << endl;
}
}
return intersects;
}
bool CollisionManager::RayIntersectsMesh(MVector3<float>& rayOrigin, MVector3<float>& rayDest, Mesh& mesh, MVector3<float>& intersectionPoint)
{
return mesh.intersect(rayOrigin, rayDest, intersectionPoint);
}
| 35.416667
| 154
| 0.631933
|
serserar
|
03190068520782c4c3c2e061e34bad33800edf0d
| 1,110
|
hpp
|
C++
|
src/server/server.hpp
|
TheSonOfDeimos/TCP-File-Transfer
|
1bd258e05767cb96a6b8d9739ff319a328f7198b
|
[
"MIT"
] | null | null | null |
src/server/server.hpp
|
TheSonOfDeimos/TCP-File-Transfer
|
1bd258e05767cb96a6b8d9739ff319a328f7198b
|
[
"MIT"
] | 8
|
2020-05-21T22:03:27.000Z
|
2020-06-28T20:30:03.000Z
|
src/server/server.hpp
|
TheSonOfDeimos/TCP-File-Transfer
|
1bd258e05767cb96a6b8d9739ff319a328f7198b
|
[
"MIT"
] | null | null | null |
#ifndef SERVER_H
#define SERVER_H
#include <boost/asio.hpp>
class Session
{
public:
Session(boost::asio::io_service& t_io_service, const std::string& t_file_dir_path);
boost::asio::ip::tcp::socket& socket();
void start();
private:
void handleReadFileSize(const boost::system::error_code& t_error, const std::size_t t_bytes_transferred);
void handleReadFileData(const boost::system::error_code& t_error, const std::size_t t_bytes_transferred);
void mapNewFile(const std::size_t t_file_size);
boost::asio::ip::tcp::socket m_socket;
char* m_mapped_file_ptr;
char m_file_size[sizeof(std::size_t)];
std::string m_file_dir_path;
};
class Server
{
public:
Server(boost::asio::io_service& t_io_service, const std::string& t_file_dir_path, std::size_t t_port, const boost::asio::ip::tcp& t_protocol_type = boost::asio::ip::tcp::v4());
private:
void startAccept();
void handleAccept(Session* t_new_session, const boost::system::error_code& t_error);
boost::asio::io_service& m_io_service;
boost::asio::ip::tcp::acceptor m_acceptor;
std::string m_file_dir_path;
};
#endif
| 25.813953
| 178
| 0.741441
|
TheSonOfDeimos
|
031a9cb64baaba5ba400c78f1bc822396b90ae90
| 1,993
|
cpp
|
C++
|
lib/bson/src/Element/Timestamp.cpp
|
astateful/dyplat
|
37c37c7ee9f55cc2a3abaa0f8ebbde34588d2f44
|
[
"BSD-3-Clause"
] | null | null | null |
lib/bson/src/Element/Timestamp.cpp
|
astateful/dyplat
|
37c37c7ee9f55cc2a3abaa0f8ebbde34588d2f44
|
[
"BSD-3-Clause"
] | null | null | null |
lib/bson/src/Element/Timestamp.cpp
|
astateful/dyplat
|
37c37c7ee9f55cc2a3abaa0f8ebbde34588d2f44
|
[
"BSD-3-Clause"
] | null | null | null |
#include "astateful/bson/Element/Timestamp.hpp"
namespace astateful {
namespace bson {
ElementTimestamp::ElementTimestamp( const std::string& key,
int32_t increment, int32_t second ) :
m_increment( increment ),
m_second( second ),
Element( key ) {}
ElementTimestamp::ElementTimestamp( ElementTimestamp&& rhs ) :
Element( std::move( rhs ) ),
m_increment( std::move( rhs.m_increment ) ),
m_second( std::move( rhs.m_second ) ) {}
ElementTimestamp::operator std::vector<uint8_t>() const {
int32_t increment = m_increment;
int32_t second = m_second;
std::size_t size = sizeof( int32_t );
uint8_t * data;
std::vector<uint8_t> output;
output.resize( size * 2 );
data = reinterpret_cast<uint8_t *>( &increment );
for ( std::size_t i = 0; i < size; ++i ) {
output[i] = *data;
data++;
}
data = reinterpret_cast<uint8_t *>( &second );
for ( std::size_t i = size; i < size * 2; ++i ) {
output[i] = *data;
data++;
}
return output;
}
std::wstring ElementTimestamp::json( bool format,
const std::wstring& tab,
const std::wstring& indent,
const int depth ) const {
auto increment( std::to_wstring( m_increment ) );
auto second( std::to_wstring( m_second ) );
std::wstring output( L"" );
output += ( format ) ? L"Timestamp({\n" : L"\n" + tab + L"{\n";
output += tab + indent;
output += L"\"increment\":";
output += ( format ) ? L"Int(" + increment + L")" : increment;
output += L",\n";
output += tab + indent;
output += L"\"seconds\":";
output += ( format ) ? L"Int(" + second + L")" : second;
output += L"\n";
output += tab;
output += ( format ) ? L"})" : L"}";
return output;
}
std::vector<uint8_t> ElementTimestamp::bson( error_e& ) const {
return *this;
}
}
}
| 29.308824
| 75
| 0.545409
|
astateful
|
03247edd45d05df98526828eed142e8e0b145d84
| 221
|
cpp
|
C++
|
Cplusplus/week_four/homework/inventory.cpp
|
nexusstar/SoftUni
|
b97bdb08a227fd335df5b7869940c14717f760f2
|
[
"MIT"
] | 1
|
2016-12-20T19:53:03.000Z
|
2016-12-20T19:53:03.000Z
|
Cplusplus/week_four/homework/inventory.cpp
|
nexusstar/SoftUni
|
b97bdb08a227fd335df5b7869940c14717f760f2
|
[
"MIT"
] | null | null | null |
Cplusplus/week_four/homework/inventory.cpp
|
nexusstar/SoftUni
|
b97bdb08a227fd335df5b7869940c14717f760f2
|
[
"MIT"
] | null | null | null |
#include "inventory.h"
#include <iostream>
Inventory::Inventory() {
}
Inventory::~Inventory(){
for(Item* item : items){
delete item;
}
}
void Inventory::addItem(Item* item){
items.push_back(item);
}
| 14.733333
| 36
| 0.633484
|
nexusstar
|
0326e70b4dcd95027a0fdc621d549570f737347e
| 978
|
cpp
|
C++
|
solutions/1286.iterator-for-combination.326123792.ac.cpp
|
satu0king/Leetcode-Solutions
|
2edff60d76c2898d912197044f6284efeeb34119
|
[
"MIT"
] | 78
|
2020-10-22T11:31:53.000Z
|
2022-02-22T13:27:49.000Z
|
solutions/1286.iterator-for-combination.326123792.ac.cpp
|
satu0king/Leetcode-Solutions
|
2edff60d76c2898d912197044f6284efeeb34119
|
[
"MIT"
] | null | null | null |
solutions/1286.iterator-for-combination.326123792.ac.cpp
|
satu0king/Leetcode-Solutions
|
2edff60d76c2898d912197044f6284efeeb34119
|
[
"MIT"
] | 26
|
2020-10-23T15:10:44.000Z
|
2021-11-07T16:13:50.000Z
|
class CombinationIterator {
string s;
int l;
vector<int> indices;
bool _hasNext = true;
void _setNext() {
for (int i = l - 1; i >= 0; i--) {
if (indices[i] != s.size() - (l - i)) {
indices[i]++;
for (int j = i + 1; j < l; j++) {
indices[j] = indices[j - 1] + 1;
}
return;
}
}
_hasNext = false;
}
public:
CombinationIterator(string characters, int combinationLength)
: s(characters), l(combinationLength), indices(l) {
for (int i = 0; i < l; i++)
indices[i] = i;
}
string next() {
string result = "";
for (int idx : indices)
result += s[idx];
_setNext();
return result;
}
bool hasNext() { return _hasNext; }
};
/**
* Your CombinationIterator object will be instantiated and called as such:
* CombinationIterator* obj = new CombinationIterator(characters,
* combinationLength); string param_1 = obj->next(); bool param_2 =
* obj->hasNext();
*/
| 22.227273
| 75
| 0.562372
|
satu0king
|
0331df4b05dfecb4d359fe750865eedf6597cebe
| 7,322
|
cpp
|
C++
|
src/storage/page/hash_table_directory_page.cpp
|
epis2048/cmu_15445_2021
|
48b56b2e139facfbad99b45fca3e26f3aef9cf72
|
[
"MIT"
] | 3
|
2022-02-18T04:38:40.000Z
|
2022-03-22T12:40:51.000Z
|
src/storage/page/hash_table_directory_page.cpp
|
epis2048/cmu_15445_2021
|
48b56b2e139facfbad99b45fca3e26f3aef9cf72
|
[
"MIT"
] | null | null | null |
src/storage/page/hash_table_directory_page.cpp
|
epis2048/cmu_15445_2021
|
48b56b2e139facfbad99b45fca3e26f3aef9cf72
|
[
"MIT"
] | 3
|
2022-03-06T18:31:28.000Z
|
2022-03-27T13:16:05.000Z
|
//===----------------------------------------------------------------------===//
//
// BusTub
//
// hash_table_header_page.cpp
//
// Identification: src/storage/page/hash_table_header_page.cpp
//
// Copyright (c) 2015-2021, Carnegie Mellon University Database Group
//
//===----------------------------------------------------------------------===//
#include "storage/page/hash_table_directory_page.h"
#include <algorithm>
#include <unordered_map>
#include "common/logger.h"
namespace bustub {
page_id_t HashTableDirectoryPage::GetPageId() const { return page_id_; }
void HashTableDirectoryPage::SetPageId(bustub::page_id_t page_id) { page_id_ = page_id; }
lsn_t HashTableDirectoryPage::GetLSN() const { return lsn_; }
void HashTableDirectoryPage::SetLSN(lsn_t lsn) { lsn_ = lsn; }
uint32_t HashTableDirectoryPage::GetGlobalDepth() { return global_depth_; }
/**
* GetGlobalDepthMask - returns a mask of global_depth 1's and the rest 0's.
*
* In Extendible Hashing we map a key to a directory index
* using the following hash + mask function.
*
* DirectoryIndex = Hash(key) & GLOBAL_DEPTH_MASK
*
* where GLOBAL_DEPTH_MASK is a mask with exactly GLOBAL_DEPTH 1's from LSB
* upwards. For example, global depth 3 corresponds to 0x00000007 in a 32-bit
* representation.
*
* @return mask of global_depth 1's and the rest 0's (with 1's from LSB upwards)
*/
uint32_t HashTableDirectoryPage::GetGlobalDepthMask() {
// 这里根据注释中的示例写就行
// Example: 当global_depth_是3的时候
// 0000...000001 << global_depeth_ = 0000...01000
// 再减1即可
return ((1 << global_depth_) - 1);
}
uint32_t HashTableDirectoryPage::GetLocalDepthMask(uint32_t bucket_idx) {
uint8_t depth = local_depths_[bucket_idx];
return (1 << depth) - 1;
}
/**
* Increment the global depth of the directory
*/
void HashTableDirectoryPage::IncrGlobalDepth() {
assert(global_depth_ < MAX_BUCKET_DEPTH);
// 这里主要是需要将bucket_page_ids_和local_depths_的数据在现有数组的末尾再复制一份
// 扩容时没有进行数据迁移,两个bucket对应一个page
int org_num = Size();
for (int org_index = 0, new_index = org_num; org_index < org_num; new_index++, org_index++) {
bucket_page_ids_[new_index] = bucket_page_ids_[org_index];
local_depths_[new_index] = local_depths_[org_index];
}
global_depth_++;
}
void HashTableDirectoryPage::DecrGlobalDepth() { global_depth_--; }
/**
* Lookup a bucket page using a directory index
*
* @param bucket_idx the index in the directory to lookup
* @return bucket page_id corresponding to bucket_idx
*/
page_id_t HashTableDirectoryPage::GetBucketPageId(uint32_t bucket_idx) { return bucket_page_ids_[bucket_idx]; }
/**
* Updates the directory index using a bucket index and page_id
*
* @param bucket_idx directory index at which to insert page_id
* @param bucket_page_id page_id to insert
*/
void HashTableDirectoryPage::SetBucketPageId(uint32_t bucket_idx, page_id_t bucket_page_id) {
bucket_page_ids_[bucket_idx] = bucket_page_id;
}
/**
* @return the current directory size
*/
uint32_t HashTableDirectoryPage::Size() {
// 2 ^ global_depth_
return (1 << global_depth_);
}
/**
* @return true if the directory can be shrunk
*/
bool HashTableDirectoryPage::CanShrink() {
// 整个Directory能不能收缩取决于每个localdepth是否都比globaldepth小
// 循环判断即可
for (uint32_t i = 0; i < Size(); i++) {
if (local_depths_[i] == global_depth_) {
return false;
}
}
return true;
}
/**
* Gets the local depth of the bucket at bucket_idx
*
* @param bucket_idx the bucket index to lookup
* @return the local depth of the bucket at bucket_idx
*/
uint32_t HashTableDirectoryPage::GetLocalDepth(uint32_t bucket_idx) { return local_depths_[bucket_idx]; }
/**
* Set the local depth of the bucket at bucket_idx to local_depth
*
* @param bucket_idx bucket index to update
* @param local_depth new local depth
*/
void HashTableDirectoryPage::SetLocalDepth(uint32_t bucket_idx, uint8_t local_depth) {
assert(local_depth <= global_depth_);
local_depths_[bucket_idx] = local_depth;
}
/**
* Increment the local depth of the bucket at bucket_idx
* @param bucket_idx bucket index to increment
*/
void HashTableDirectoryPage::IncrLocalDepth(uint32_t bucket_idx) {
assert(local_depths_[bucket_idx] < global_depth_);
local_depths_[bucket_idx]++;
}
/**
* Decrement the local depth of the bucket at bucket_idx
* @param bucket_idx bucket index to decrement
*/
void HashTableDirectoryPage::DecrLocalDepth(uint32_t bucket_idx) { local_depths_[bucket_idx]--; }
/**
* Gets the split image of an index
* SplitImage可以理解为兄弟bucket
*
* @param bucket_idx the directory index for which to find the split image
* @return the directory index of the split image
**/
uint32_t HashTableDirectoryPage::GetSplitImageIndex(uint32_t bucket_idx) {
// Example: 当对应的localdepth是3时:
// 1<<(3-1) = 0000....00100
// 具体用途后面再说
return bucket_idx ^ (1 << (local_depths_[bucket_idx] - 1));
}
/**
* VerifyIntegrity - Use this for debugging but **DO NOT CHANGE**
*
* If you want to make changes to this, make a new function and extend it.
*
* Verify the following invariants:
* (1) All LD <= GD.
* (2) Each bucket has precisely 2^(GD - LD) pointers pointing to it.
* (3) The LD is the same at each index with the same bucket_page_id
*/
void HashTableDirectoryPage::VerifyIntegrity() {
// build maps of {bucket_page_id : pointer_count} and {bucket_page_id : local_depth}
std::unordered_map<page_id_t, uint32_t> page_id_to_count = std::unordered_map<page_id_t, uint32_t>();
std::unordered_map<page_id_t, uint32_t> page_id_to_ld = std::unordered_map<page_id_t, uint32_t>();
// verify for each bucket_page_id, pointer
for (uint32_t curr_idx = 0; curr_idx < Size(); curr_idx++) {
page_id_t curr_page_id = bucket_page_ids_[curr_idx];
uint32_t curr_ld = local_depths_[curr_idx];
assert(curr_ld <= global_depth_);
++page_id_to_count[curr_page_id];
if (page_id_to_ld.count(curr_page_id) > 0 && curr_ld != page_id_to_ld[curr_page_id]) {
uint32_t old_ld = page_id_to_ld[curr_page_id];
LOG_WARN("Verify Integrity: curr_local_depth: %u, old_local_depth %u, for page_id: %u", curr_ld, old_ld,
curr_page_id);
PrintDirectory();
assert(curr_ld == page_id_to_ld[curr_page_id]);
} else {
page_id_to_ld[curr_page_id] = curr_ld;
}
}
auto it = page_id_to_count.begin();
while (it != page_id_to_count.end()) {
page_id_t curr_page_id = it->first;
uint32_t curr_count = it->second;
uint32_t curr_ld = page_id_to_ld[curr_page_id];
uint32_t required_count = 0x1 << (global_depth_ - curr_ld);
if (curr_count != required_count) {
LOG_WARN("Verify Integrity: curr_count: %u, required_count %u, for page_id: %u", curr_ld, required_count,
curr_page_id);
PrintDirectory();
assert(curr_count == required_count);
}
it++;
}
}
void HashTableDirectoryPage::PrintDirectory() {
LOG_DEBUG("======== DIRECTORY (global_depth_: %u) ========", global_depth_);
LOG_DEBUG("| bucket_idx | page_id | local_depth |");
for (uint32_t idx = 0; idx < static_cast<uint32_t>(0x1 << global_depth_); idx++) {
LOG_DEBUG("| %u | %u | %u |", idx, bucket_page_ids_[idx], local_depths_[idx]);
}
LOG_DEBUG("================ END DIRECTORY ================");
}
} // namespace bustub
| 32.834081
| 111
| 0.699399
|
epis2048
|
033a15ef7f18cd379dae8b94658905a468f855e2
| 97
|
cpp
|
C++
|
Foundation/Test/TestFixture.cpp
|
cristian-szabo/benchmark-numeric-conversion
|
837c9a483b18523e2660a4102ba714c0ff1bf16e
|
[
"MIT"
] | null | null | null |
Foundation/Test/TestFixture.cpp
|
cristian-szabo/benchmark-numeric-conversion
|
837c9a483b18523e2660a4102ba714c0ff1bf16e
|
[
"MIT"
] | null | null | null |
Foundation/Test/TestFixture.cpp
|
cristian-szabo/benchmark-numeric-conversion
|
837c9a483b18523e2660a4102ba714c0ff1bf16e
|
[
"MIT"
] | null | null | null |
#include "TestFixture.hpp"
void TestFixture::Setup()
{}
void TestFixture::Teardown()
{}
| 12.125
| 29
| 0.659794
|
cristian-szabo
|
033a2824770e7f6bc1e873ae1d4f35cd7fbb0af0
| 1,448
|
hpp
|
C++
|
sycl/include/CL/sycl/detail/event_info.hpp
|
jcranmer-intel/llvm-sycl
|
45dbbd128e4793681ed9d40a3c018f44c17449ec
|
[
"Apache-2.0"
] | 1
|
2020-09-25T23:33:05.000Z
|
2020-09-25T23:33:05.000Z
|
sycl/include/CL/sycl/detail/event_info.hpp
|
Ralender/sycl
|
1fcd1e6d3da10024be92148501aced30ae3aa2be
|
[
"Apache-2.0"
] | null | null | null |
sycl/include/CL/sycl/detail/event_info.hpp
|
Ralender/sycl
|
1fcd1e6d3da10024be92148501aced30ae3aa2be
|
[
"Apache-2.0"
] | null | null | null |
//==---------------- event_info.hpp - SYCL event ---------------------------==//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#pragma once
#include <CL/sycl/detail/common.hpp>
#include <CL/sycl/info/info_desc.hpp>
namespace cl {
namespace sycl {
namespace detail {
template <info::event_profiling Param> struct get_event_profiling_info {
using RetType =
typename info::param_traits<info::event_profiling, Param>::return_type;
static RetType _(RT::PiEvent Event) {
RetType Result = 0;
// TODO catch an exception and put it to list of asynchronous exceptions
PI_CALL(RT::piEventGetProfilingInfo(
Event, cl_profiling_info(Param), sizeof(Result), &Result, nullptr));
return Result;
}
};
template <info::event Param> struct get_event_info {
using RetType = typename info::param_traits<info::event, Param>::return_type;
static RetType _(RT::PiEvent Event) {
RetType Result = (RetType)0;
// TODO catch an exception and put it to list of asynchronous exceptions
PI_CALL(RT::piEventGetInfo(
Event, cl_profiling_info(Param), sizeof(Result), &Result, nullptr));
return Result;
}
};
} // namespace detail
} // namespace sycl
} // namespace cl
| 31.478261
| 80
| 0.654006
|
jcranmer-intel
|
033ffddc8db4e8d377d0c608147e51769606973d
| 4,908
|
cpp
|
C++
|
utils/vvcompose/lua_tvec3d.cpp
|
rosik/vvflow
|
87caadf3973b31058a16a1372365ae8a7a157cdb
|
[
"MIT"
] | 29
|
2020-08-05T16:08:35.000Z
|
2022-02-21T06:43:01.000Z
|
utils/vvcompose/lua_tvec3d.cpp
|
rosik/vvflow
|
87caadf3973b31058a16a1372365ae8a7a157cdb
|
[
"MIT"
] | 6
|
2021-01-07T21:29:57.000Z
|
2021-06-28T20:54:04.000Z
|
utils/vvcompose/lua_tvec3d.cpp
|
rosik/vvflow
|
87caadf3973b31058a16a1372365ae8a7a157cdb
|
[
"MIT"
] | 6
|
2020-07-24T06:53:54.000Z
|
2022-01-06T06:12:45.000Z
|
#include "lua_tvec3d.h"
#include "lua_tvec.h"
#include "getset.h"
#include "elementary.h"
// #include <cstdio>
#include <cstring>
static int tvec3d_tostring(lua_State *L) {
TVec3D* vec = lua_checkTVec3D(L, 1);
lua_pushfstring(L, "TVec3D(%f,%f,%f)", vec->r.x, vec->r.y, vec->o);
return 1;
}
static int tvec3d_totable(lua_State *L) {
TVec3D* vec = lua_checkTVec3D(L, 1);
lua_newtable(L);
lua_pushnumber(L, vec->r.x);
lua_rawseti(L, -2, 1);
lua_pushnumber(L, vec->r.y);
lua_rawseti(L, -2, 2);
lua_pushnumber(L, vec->o);
lua_rawseti(L, -2, 3);
return 1;
}
int luavvd_setdegree(lua_State *L) {
double* dbl = (double*)lua_touserdata(L, 1);
int isnum;
lua_Number val = lua_tonumberx(L, 2, &isnum);
if (!isnum) {
lua_pushfstring(L, "number expected, got %s", luaL_typename(L, 2));
return 1;
}
*dbl = val*C_PI/180.0;
return 0;
}
int luavvd_getdegree(lua_State *L) {
double* dbl = (double*)lua_touserdata(L, 1);
lua_pushnumber(L, *dbl*180.0/C_PI);
return 1;
}
static const struct luavvd_member tvec3d_members[] = {
{"r", luavvd_getTVec, luavvd_setTVec, offsetof(TVec3D, r) },
{"o", luavvd_getdouble, luavvd_setdouble, offsetof(TVec3D, o) },
{"d", luavvd_getdegree, luavvd_setdegree, offsetof(TVec3D, o) },
{NULL, NULL, NULL, 0} /* sentinel */
};
static const struct luavvd_method tvec3d_methods[] = {
{"tostring", tvec3d_tostring},
{"totable", tvec3d_totable},
{NULL, NULL}
};
static int tvec3d_newindex(lua_State *L) {
TVec3D* vec = lua_checkTVec3D(L, 1);
const char *name = luaL_checkstring(L, 2);
for (auto f = tvec3d_members; f->name; f++) {
if (strcmp(name, f->name)) continue;
lua_pushcfunction(L, f->setter);
lua_pushlightuserdata(L, (char*)vec + f->offset);
lua_pushvalue(L, 3);
lua_call(L, 2, 1);
if (!lua_isnil(L, -1)) {
luaL_error(L, "bad value for TVec3D.%s (%s)", name, lua_tostring(L, -1));
}
return 0;
}
luaL_error(L, "TVec3D can not assign '%s'", name);
return 0;
}
static int tvec3d_getindex(lua_State *L) {
TVec3D* vec = lua_checkTVec3D(L, 1);
const char *name = luaL_checkstring(L, 2);
for (auto f = tvec3d_members; f->name; f++) {
if (strcmp(name, f->name)) continue;
lua_pushcfunction(L, f->getter);
lua_pushlightuserdata(L, (char*)vec + f->offset);
lua_call(L, 1, 1);
return 1;
}
for (auto f = tvec3d_methods; f->name; f++) {
if (strcmp(name, f->name)) continue;
lua_pushcfunction(L, f->func);
return 1;
}
lua_pushnil(L);
return 1;
}
static const struct luaL_Reg luavvd_tvec3d [] = {
{"__tostring", tvec3d_tostring},
{"__newindex", tvec3d_newindex},
{"__index", tvec3d_getindex},
{NULL, NULL} /* sentinel */
};
/* PUBLIC FUNCTIONS */
/* vvvvvvvvvvvvvvvv */
int luaopen_tvec3d (lua_State *L) {
luaL_newmetatable(L, "TVec3D"); // push 1
luaL_setfuncs(L, luavvd_tvec3d, 0); /* register metamethods */
return 0;
}
void lua_pushTVec3D(lua_State *L, TVec3D* vec) {
TVec3D** udat = (TVec3D**)lua_newuserdata(L, sizeof(TVec3D*));
*udat = vec;
luaL_getmetatable(L, "TVec3D");
lua_setmetatable(L, -2);
}
TVec3D* lua_checkTVec3D(lua_State *L, int idx) {
TVec3D** udat = (TVec3D**)luaL_checkudata(L, idx, "TVec3D");
return *udat;
}
TVec3D lua_toTVec3Dx(lua_State *L, int idx, int* isvec) {
if (!isvec) {
isvec = (int*)&isvec;
}
if (lua_type(L, idx) == LUA_TTABLE) {
size_t rawlen = lua_rawlen(L, idx);
if (rawlen != 3)
goto fail;
int isnum[3];
lua_rawgeti(L, idx, 1); // push table[1]
lua_rawgeti(L, idx, 2); // push table[2]
lua_rawgeti(L, idx, 3); // push table[3]
TVec3D res;
res.r.x = lua_tonumberx(L, -3, &isnum[0]);
res.r.y = lua_tonumberx(L, -2, &isnum[1]);
res.o = lua_tonumberx(L, -1, &isnum[2]);
lua_pop(L, 3);
if (!isnum[0] || !isnum[1] || !isnum[2])
goto fail;
*isvec = 1;
return res;
} else if (lua_type(L, idx) == LUA_TUSERDATA) {
TVec3D** udata = (TVec3D**)luaL_testudata(L, idx, "TVec3D");
if (!udata)
goto fail;
*isvec = 1;
return **udata;
}
fail:
*isvec = 0;
return TVec3D();
}
/* setter */
int luavvd_setTVec3D(lua_State *L) {
TVec3D* ptr = (TVec3D*)lua_touserdata(L, 1);
int isvec;
TVec3D vec = lua_toTVec3Dx(L, 2, &isvec);
if (!isvec) {
lua_pushfstring(L, "TVec3D needs table with three numbers");
return 1;
}
*ptr = vec;
return 0;
}
/* getter */
int luavvd_getTVec3D(lua_State *L) {
TVec3D* vec = (TVec3D*)lua_touserdata(L, 1);
lua_pushTVec3D(L, vec);
return 1;
}
| 25.696335
| 85
| 0.582315
|
rosik
|
03403139a85d8ec489c4ed2463b6797e8d9a66d5
| 8,111
|
cpp
|
C++
|
Tests/DiligentCoreAPITest/src/D3D11/DrawCommandReferenceD3D11.cpp
|
AndreyMlashkin/DiligentCore
|
20d5d7d2866e831a73437db2dec16bdc61413eb0
|
[
"Apache-2.0"
] | null | null | null |
Tests/DiligentCoreAPITest/src/D3D11/DrawCommandReferenceD3D11.cpp
|
AndreyMlashkin/DiligentCore
|
20d5d7d2866e831a73437db2dec16bdc61413eb0
|
[
"Apache-2.0"
] | null | null | null |
Tests/DiligentCoreAPITest/src/D3D11/DrawCommandReferenceD3D11.cpp
|
AndreyMlashkin/DiligentCore
|
20d5d7d2866e831a73437db2dec16bdc61413eb0
|
[
"Apache-2.0"
] | null | null | null |
/*
* Copyright 2019-2021 Diligent Graphics LLC
* Copyright 2015-2019 Egor Yusov
*
* 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.
*
* In no event and under no legal theory, whether in tort (including negligence),
* contract, or otherwise, unless required by applicable law (such as deliberate
* and grossly negligent acts) or agreed to in writing, shall any Contributor be
* liable for any damages, including any direct, indirect, special, incidental,
* or consequential damages of any character arising as a result of this License or
* out of the use or inability to use the software (including but not limited to damages
* for loss of goodwill, work stoppage, computer failure or malfunction, or any and
* all other commercial damages or losses), even if such Contributor has been advised
* of the possibility of such damages.
*/
#include "D3D11/TestingEnvironmentD3D11.hpp"
#include "D3D11/TestingSwapChainD3D11.hpp"
#include "InlineShaders/DrawCommandTestHLSL.h"
namespace Diligent
{
namespace Testing
{
static void DrawProceduralTriangles(ID3D11DeviceContext* pd3d11Context,
ISwapChain* pSwapChain,
ID3D11RenderTargetView* pRTV,
Uint32 Width,
Uint32 Height,
const float ClearColor[])
{
auto* pEnvD3D11 = TestingEnvironmentD3D11::GetInstance();
auto pVS = pEnvD3D11->CreateVertexShader(HLSL::DrawTest_ProceduralTriangleVS);
ASSERT_NE(pVS, nullptr);
auto pPS = pEnvD3D11->CreatePixelShader(HLSL::DrawTest_PS);
ASSERT_NE(pPS, nullptr);
pd3d11Context->VSSetShader(pVS, nullptr, 0);
pd3d11Context->PSSetShader(pPS, nullptr, 0);
pd3d11Context->RSSetState(pEnvD3D11->GetNoCullRS());
pd3d11Context->OMSetBlendState(pEnvD3D11->GetDefaultBS(), nullptr, 0xFFFFFFFF);
pd3d11Context->OMSetDepthStencilState(pEnvD3D11->GetDisableDepthDSS(), 0);
pd3d11Context->IASetInputLayout(nullptr);
ID3D11RenderTargetView* pd3d11RTVs[] = {pRTV};
pd3d11Context->OMSetRenderTargets(1, pd3d11RTVs, nullptr);
pd3d11Context->ClearRenderTargetView(pd3d11RTVs[0], ClearColor);
D3D11_VIEWPORT d3dVP = {};
d3dVP.Width = static_cast<float>(Width);
d3dVP.Height = static_cast<float>(Height);
d3dVP.MaxDepth = 1;
pd3d11Context->RSSetViewports(1, &d3dVP);
pd3d11Context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
pd3d11Context->Draw(6, 0);
}
void RenderDrawCommandReferenceD3D11(ISwapChain* pSwapChain, const float* pClearColor)
{
auto* pEnvD3D11 = TestingEnvironmentD3D11::GetInstance();
auto* pd3d11Context = pEnvD3D11->GetD3D11Context();
auto* pTestingSwapChainD3D11 = ValidatedCast<TestingSwapChainD3D11>(pSwapChain);
pd3d11Context->ClearState();
const auto& SCDesc = pTestingSwapChainD3D11->GetDesc();
float Zero[] = {0, 0, 0, 0};
DrawProceduralTriangles(pd3d11Context, pTestingSwapChainD3D11, pTestingSwapChainD3D11->GetD3D11RTV(), SCDesc.Width, SCDesc.Height, pClearColor != nullptr ? pClearColor : Zero);
pd3d11Context->ClearState();
}
void RenderPassMSResolveReferenceD3D11(ISwapChain* pSwapChain, const float* pClearColor)
{
auto* pEnvD3D11 = TestingEnvironmentD3D11::GetInstance();
auto* pd3d11Context = pEnvD3D11->GetD3D11Context();
auto* pd3d11Device = pEnvD3D11->GetD3D11Device();
auto* pTestingSwapChainD3D11 = ValidatedCast<TestingSwapChainD3D11>(pSwapChain);
const auto& SCDesc = pTestingSwapChainD3D11->GetDesc();
D3D11_TEXTURE2D_DESC MSTexDesc = {};
MSTexDesc.Width = SCDesc.Width;
MSTexDesc.Height = SCDesc.Height;
MSTexDesc.MipLevels = 1;
MSTexDesc.ArraySize = 1;
switch (SCDesc.ColorBufferFormat)
{
case TEX_FORMAT_RGBA8_UNORM:
MSTexDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
break;
default:
UNSUPPORTED("Unsupported swap chain format");
}
MSTexDesc.SampleDesc.Count = 4;
MSTexDesc.SampleDesc.Quality = 0;
MSTexDesc.Usage = D3D11_USAGE_DEFAULT;
MSTexDesc.BindFlags = D3D11_BIND_RENDER_TARGET;
MSTexDesc.CPUAccessFlags = 0;
MSTexDesc.MiscFlags = 0;
CComPtr<ID3D11Texture2D> pd3d11MSTex;
pd3d11Device->CreateTexture2D(&MSTexDesc, nullptr, &pd3d11MSTex);
ASSERT_TRUE(pd3d11MSTex != nullptr);
CComPtr<ID3D11RenderTargetView> pd3d11RTV;
pd3d11Device->CreateRenderTargetView(pd3d11MSTex, nullptr, &pd3d11RTV);
ASSERT_TRUE(pd3d11RTV != nullptr);
pd3d11Context->ClearState();
DrawProceduralTriangles(pd3d11Context, pTestingSwapChainD3D11, pd3d11RTV, SCDesc.Width, SCDesc.Height, pClearColor);
pd3d11Context->ResolveSubresource(pTestingSwapChainD3D11->GetD3D11RenderTarget(), 0, pd3d11MSTex, 0, MSTexDesc.Format);
pd3d11Context->ClearState();
}
void RenderPassInputAttachmentReferenceD3D11(ISwapChain* pSwapChain, const float* pClearColor)
{
auto* pEnvD3D11 = TestingEnvironmentD3D11::GetInstance();
auto* pd3d11Context = pEnvD3D11->GetD3D11Context();
auto* pd3d11Device = pEnvD3D11->GetD3D11Device();
auto* pTestingSwapChainD3D11 = ValidatedCast<TestingSwapChainD3D11>(pSwapChain);
const auto& SCDesc = pTestingSwapChainD3D11->GetDesc();
D3D11_TEXTURE2D_DESC InptAttTexDesc = {};
InptAttTexDesc.Width = SCDesc.Width;
InptAttTexDesc.Height = SCDesc.Height;
InptAttTexDesc.MipLevels = 1;
InptAttTexDesc.ArraySize = 1;
switch (SCDesc.ColorBufferFormat)
{
case TEX_FORMAT_RGBA8_UNORM:
InptAttTexDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
break;
default:
UNSUPPORTED("Unsupported swap chain format");
}
InptAttTexDesc.SampleDesc.Count = 1;
InptAttTexDesc.SampleDesc.Quality = 0;
InptAttTexDesc.Usage = D3D11_USAGE_DEFAULT;
InptAttTexDesc.BindFlags = D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE;
InptAttTexDesc.CPUAccessFlags = 0;
InptAttTexDesc.MiscFlags = 0;
CComPtr<ID3D11Texture2D> pd3d11InptAtt;
pd3d11Device->CreateTexture2D(&InptAttTexDesc, nullptr, &pd3d11InptAtt);
ASSERT_TRUE(pd3d11InptAtt != nullptr);
CComPtr<ID3D11RenderTargetView> pd3d11RTV;
pd3d11Device->CreateRenderTargetView(pd3d11InptAtt, nullptr, &pd3d11RTV);
ASSERT_TRUE(pd3d11RTV != nullptr);
CComPtr<ID3D11ShaderResourceView> pd3d11SRV;
pd3d11Device->CreateShaderResourceView(pd3d11InptAtt, nullptr, &pd3d11SRV);
ASSERT_TRUE(pd3d11SRV != nullptr);
pd3d11Context->ClearState();
float Zero[] = {0, 0, 0, 0};
DrawProceduralTriangles(pd3d11Context, pTestingSwapChainD3D11, pd3d11RTV, SCDesc.Width, SCDesc.Height, Zero);
ID3D11RenderTargetView* pd3d11RTVs[] = {pTestingSwapChainD3D11->GetD3D11RTV()};
pd3d11Context->OMSetRenderTargets(1, pd3d11RTVs, nullptr);
pd3d11Context->ClearRenderTargetView(pd3d11RTVs[0], pClearColor);
auto pInputAttachmentPS = pEnvD3D11->CreatePixelShader(HLSL::InputAttachmentTest_PS);
ASSERT_NE(pInputAttachmentPS, nullptr);
pd3d11Context->PSSetShader(pInputAttachmentPS, nullptr, 0);
ID3D11ShaderResourceView* pSRVs[] = {pd3d11SRV};
pd3d11Context->PSSetShaderResources(0, 1, pSRVs);
pd3d11Context->Draw(6, 0);
pd3d11Context->ClearState();
}
} // namespace Testing
} // namespace Diligent
| 39.373786
| 180
| 0.707311
|
AndreyMlashkin
|
03403507413db328a98871561454d7721cef3ae8
| 2,654
|
cpp
|
C++
|
src/tracer/render_task.cpp
|
JakMobius/zeta_path_tracer
|
f17ac4e882319c6dd7dff545f7f1e1bf9cb045e1
|
[
"MIT"
] | 3
|
2021-09-13T14:41:22.000Z
|
2021-09-18T07:59:15.000Z
|
src/tracer/render_task.cpp
|
JakMobius/zeta_path_tracer
|
f17ac4e882319c6dd7dff545f7f1e1bf9cb045e1
|
[
"MIT"
] | 2
|
2021-03-26T15:04:54.000Z
|
2021-09-13T13:20:59.000Z
|
src/tracer/render_task.cpp
|
JakMobius/zeta_path_tracer
|
f17ac4e882319c6dd7dff545f7f1e1bf9cb045e1
|
[
"MIT"
] | 3
|
2021-03-23T22:42:43.000Z
|
2021-12-18T21:58:58.000Z
|
#include "render_task.h"
RenderTask::RenderTask():
id(0),
min_x(0),
max_x(0),
min_y(0),
max_y(0)
{}
RenderTask::RenderTask(const int min_x_, const int max_x_, const int min_y_, const int max_y_, const int id_):
id(id_),
min_x(min_x_),
max_x(max_x_),
min_y(min_y_),
max_y(max_y_)
{}
int RenderTask::width() const {
return std::abs(max_x - min_x);
}
int RenderTask::height() const {
return std::abs(max_y - min_y);
}
void RenderTask::dump(FILE *fout) {
fprintf(fout, "RTask[ % 5d ]\n", id);
fprintf(fout, "min_x[ % 5d ]_max_x_[ % 5d ]\n", min_x, max_x);
fprintf(fout, "min_y[ % 5d ]_max_y_[ % 5d ]\n", min_y, max_y);
}
bool RenderTask::is_valid(const int strict_mode) {
if (min_x < 0 || min_x > max_x || min_y < 0 || min_y > max_y) {
if (strict_mode) {
return false;
}
if (min_x > max_x) {
std::swap(min_x, max_x);
}
if (min_y > max_y) {
std::swap(min_y, max_y);
}
}
return true;
}
void RenderTask::save(const char *filename) {
assert(filename);
FILE *fout = fopen(filename, "w");
assert(fout);
fprintf(fout, "RTask[ % 5d ]\n", id);
fprintf(fout, "min_x[ % 5d ]_max_x_[ % 5d ]\n", min_x, max_x);
fprintf(fout, "min_y[ % 5d ]_max_y_[ % 5d ]\n", min_y, max_y);
fclose(fout);
}
void RenderTask::load(const char *filename) {
assert(filename);
FILE *fin = fopen(filename, "r");
assert(fin);
char strdump[50];
fscanf(fin, "%s %d %s", strdump, &id, strdump);
fscanf(fin, "%s %d %s", strdump, &min_x, strdump);
fscanf(fin, "%d %s", &max_x, strdump);
fscanf(fin, "%s %d %s", strdump, &min_y, strdump);
fscanf(fin, "%d %s", &max_y, strdump);
fclose(fin);
}
void RenderTask::linear_split(const int parts_cnt, const int random_name_modifier) {
is_valid();
char rtask_ext[50] = {};
sprintf(rtask_ext, "_%d.rt", random_name_modifier);
int width = max_x - min_x;
int height = max_y - min_y;
linear_render_task_split(width, height, parts_cnt, rtask_ext, min_x, min_y);
}
void linear_render_task_split(const int width, const int height, const int parts_cnt, const char *rtask_ext,
const int offset_x, const int offset_y) {
char rtask_file_name[50] = {};
int rt_height_cnt = height / parts_cnt;
int rt_width_cnt = width;
for (int i = 0; i < parts_cnt - 1; ++i) {
sprintf(rtask_file_name, "%d%s", i, rtask_ext);
RenderTask rt(offset_x, offset_x + rt_width_cnt, offset_y + i * rt_height_cnt, offset_y + (i + 1) * rt_height_cnt, i);
rt.save(rtask_file_name);
}
sprintf(rtask_file_name, "%d%s", parts_cnt - 1, rtask_ext);
RenderTask rt(offset_x, offset_x + rt_width_cnt, offset_y + (parts_cnt - 1) * rt_height_cnt, offset_y + height, parts_cnt - 1);
rt.save(rtask_file_name);
}
| 24.574074
| 128
| 0.661643
|
JakMobius
|
034253fd6e198f6d89a9511f173043d70f8263b0
| 1,416
|
cpp
|
C++
|
code/mdma_c++98/src/objects/eventmanager.cpp
|
Amxx/MDMA
|
3be4269e252712081c70522f2af56463da5ac868
|
[
"CECILL-B"
] | 1
|
2022-01-17T06:39:22.000Z
|
2022-01-17T06:39:22.000Z
|
code/mdma_c++98/src/objects/eventmanager.cpp
|
Amxx/MDMA
|
3be4269e252712081c70522f2af56463da5ac868
|
[
"CECILL-B"
] | null | null | null |
code/mdma_c++98/src/objects/eventmanager.cpp
|
Amxx/MDMA
|
3be4269e252712081c70522f2af56463da5ac868
|
[
"CECILL-B"
] | null | null | null |
#include "eventmanager.h"
EventManager::EventManager(QObject* parent) :
QObject(parent)
{
}
void EventManager::run_messages(EventZone& evz, QList<MDMA::event> msgs)
{
//for(MDMA::event msg: msgs)
for(QList<MDMA::event>::Iterator it = msgs.begin() ; it != msgs.end() ; ++it)
{
switch(evz.active[*it])
{
case MDMA::GOTO_TAB1:
Configuration::config().setCurrentTab(0);
break;
case MDMA::GOTO_TAB2:
Configuration::config().setCurrentTab(1);
break;
case MDMA::GOTO_TAB3:
Configuration::config().setCurrentTab(2);
break;
default:
{
MDMA::signal midi = evz.getMidi(*it);
if(midi) emit sendMidi(midi);
}
}
}
}
void EventManager::detection()
{
int current_tab = Configuration::config().data.current_tab;
//for(EventZone& evz : Configuration::config().data.zones)
for(QMap<QString, EventZone>::Iterator it = Configuration::config().data.zones.begin() ; it != Configuration::config().data.zones.end() ; ++it)
{
if(it->tab == current_tab)
{
if(Configuration::config().track_hand)
{
run_messages(*it, it->update(Configuration::config().left_hand));
run_messages(*it, it->update(Configuration::config().right_hand));
}
if(Configuration::config().track_mouse)
{
run_messages(*it, it->update(Configuration::config().mouse_hand));
}
}
}
}
| 25.745455
| 147
| 0.622175
|
Amxx
|
0347800199d44960f266096d0a62b989232a1432
| 57,150
|
cpp
|
C++
|
beam/node.cpp
|
akhavr/beam
|
99e427f6ba0a0ee1a0dbe598d0fa6d642e571d62
|
[
"Apache-2.0"
] | null | null | null |
beam/node.cpp
|
akhavr/beam
|
99e427f6ba0a0ee1a0dbe598d0fa6d642e571d62
|
[
"Apache-2.0"
] | null | null | null |
beam/node.cpp
|
akhavr/beam
|
99e427f6ba0a0ee1a0dbe598d0fa6d642e571d62
|
[
"Apache-2.0"
] | null | null | null |
// Copyright 2018 The Beam Team
//
// 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 "node.h"
#include "../core/serialization_adapters.h"
#include "../core/proto.h"
#include "../core/ecc_native.h"
#include "../p2p/protocol.h"
#include "../p2p/connection.h"
#include "../utility/io/tcpserver.h"
#include "../utility/logger.h"
#include "../utility/logger_checkpoints.h"
namespace beam {
void Node::RefreshCongestions()
{
for (TaskSet::iterator it = m_setTasks.begin(); m_setTasks.end() != it; it++)
it->m_bRelevant = false;
m_Processor.EnumCongestions();
for (TaskList::iterator it = m_lstTasksUnassigned.begin(); m_lstTasksUnassigned.end() != it; )
{
Task& t = *(it++);
if (!t.m_bRelevant)
DeleteUnassignedTask(t);
}
}
void Node::DeleteUnassignedTask(Task& t)
{
assert(!t.m_pOwner);
m_lstTasksUnassigned.erase(TaskList::s_iterator_to(t));
m_setTasks.erase(TaskSet::s_iterator_to(t));
delete &t;
}
uint32_t Node::WantedTx::get_Timeout_ms()
{
return get_ParentObj().m_Cfg.m_Timeout.m_GetTx_ms;
}
void Node::WantedTx::OnExpired(const KeyType& key)
{
proto::GetTransaction msg;
msg.m_ID = key;
for (PeerList::iterator it = get_ParentObj().m_lstPeers.begin(); get_ParentObj().m_lstPeers.end() != it; it++)
{
Peer& peer = *it;
if (peer.m_Config.m_SpreadingTransactions)
peer.Send(msg);
}
}
void Node::Bbs::CalcMsgKey(NodeDB::WalkerBbs::Data& d)
{
ECC::Hash::Processor hp;
hp.Write(d.m_Message.p, d.m_Message.n);
hp << d.m_Channel >> d.m_Key;
}
uint32_t Node::Bbs::WantedMsg::get_Timeout_ms()
{
return get_ParentObj().get_ParentObj().m_Cfg.m_Timeout.m_GetBbsMsg_ms;
}
void Node::Bbs::WantedMsg::OnExpired(const KeyType& key)
{
proto::BbsGetMsg msg;
msg.m_Key = key;
for (PeerList::iterator it = get_ParentObj().get_ParentObj().m_lstPeers.begin(); get_ParentObj().get_ParentObj().m_lstPeers.end() != it; it++)
{
Peer& peer = *it;
if (peer.m_Config.m_Bbs)
peer.Send(msg);
}
get_ParentObj().MaybeCleanup();
}
void Node::Wanted::Clear()
{
while (!m_lst.empty())
DeleteInternal(m_lst.back());
}
void Node::Wanted::DeleteInternal(Item& n)
{
m_lst.erase(List::s_iterator_to(n));
m_set.erase(Set::s_iterator_to(n));
delete &n;
}
void Node::Wanted::Delete(Item& n)
{
bool bFront = (&m_lst.front() == &n);
DeleteInternal(n);
if (bFront)
SetTimer();
}
bool Node::Wanted::Delete(const KeyType& key)
{
Item n;
n.m_Key = key;
Set::iterator it = m_set.find(n);
if (m_set.end() == it)
return false;
Delete(*it);
return true;
}
bool Node::Wanted::Add(const KeyType& key)
{
Item n;
n.m_Key = key;
Set::iterator it = m_set.find(n);
if (m_set.end() != it)
return false; // already waiting for it
bool bEmpty = m_lst.empty();
Item* p = new Item;
p->m_Key = key;
p->m_Advertised_ms = GetTime_ms();
m_set.insert(*p);
m_lst.push_back(*p);
if (bEmpty)
SetTimer();
return true;
}
void Node::Wanted::SetTimer()
{
if (m_lst.empty())
{
if (m_pTimer)
m_pTimer->cancel();
}
else
{
if (!m_pTimer)
m_pTimer = io::Timer::create(io::Reactor::get_Current().shared_from_this());
uint32_t dt = GetTime_ms() - m_lst.front().m_Advertised_ms;
const uint32_t timeout_ms = get_Timeout_ms();
m_pTimer->start((timeout_ms > dt) ? (timeout_ms - dt) : 0, false, [this]() { OnTimer(); });
}
}
void Node::Wanted::OnTimer()
{
uint32_t t_ms = GetTime_ms();
const uint32_t timeout_ms = get_Timeout_ms();
while (!m_lst.empty())
{
Item& n = m_lst.front();
if (t_ms - n.m_Advertised_ms < timeout_ms)
break;
OnExpired(n.m_Key); // should not invalidate our structure
Delete(n); // will also reschedule the timer
}
}
void Node::TryAssignTask(Task& t, const PeerID* pPeerID)
{
while (true)
{
Peer* pSel = NULL;
if (pPeerID)
{
bool bCreate = false;
PeerMan::PeerInfoPlus* pInfo = (PeerMan::PeerInfoPlus*) m_PeerMan.Find(*pPeerID, bCreate);
if (pInfo && pInfo->m_pLive && pInfo->m_pLive->m_bPiRcvd)
pSel = pInfo->m_pLive;
}
for (PeerList::iterator it = m_lstPeers.begin(); !pSel && (m_lstPeers.end() != it); it++)
{
Peer& p = *it;
if (ShouldAssignTask(t, p))
{
pSel = &p;
break;
}
}
if (!pSel)
break;
try {
AssignTask(t, *pSel);
return; // done
}
catch (const std::exception& e) {
pSel->OnExc(e);
}
// retry
}
}
void Node::AssignTask(Task& t, Peer& p)
{
if (t.m_Key.second)
{
proto::GetBody msg;
msg.m_ID = t.m_Key.first;
p.Send(msg);
}
else
{
proto::GetHdr msg;
msg.m_ID = t.m_Key.first;
p.Send(msg);
}
bool bEmpty = p.m_lstTasks.empty();
assert(!t.m_pOwner);
t.m_pOwner = &p;
m_lstTasksUnassigned.erase(TaskList::s_iterator_to(t));
p.m_lstTasks.push_back(t);
if (bEmpty)
p.SetTimerWrtFirstTask();
}
void Node::Peer::SetTimerWrtFirstTask()
{
if (m_lstTasks.empty())
KillTimer();
else
SetTimer(m_lstTasks.front().m_Key.second ? m_This.m_Cfg.m_Timeout.m_GetBlock_ms : m_This.m_Cfg.m_Timeout.m_GetState_ms);
}
bool Node::ShouldAssignTask(Task& t, Peer& p)
{
if (p.m_TipHeight < t.m_Key.first.m_Height)
return false;
// Current design: don't ask anything from non-authenticated peers
if (!(p.m_bPiRcvd && p.m_pInfo))
return false;
// check if the peer currently transfers a block
for (TaskList::iterator it = p.m_lstTasks.begin(); p.m_lstTasks.end() != it; it++)
if (it->m_Key.second)
return false;
return p.m_setRejected.end() == p.m_setRejected.find(t.m_Key);
}
void Node::Processor::RequestData(const Block::SystemState::ID& id, bool bBlock, const PeerID* pPreferredPeer)
{
Task tKey;
tKey.m_Key.first = id;
tKey.m_Key.second = bBlock;
TaskSet::iterator it = get_ParentObj().m_setTasks.find(tKey);
if (get_ParentObj().m_setTasks.end() == it)
{
LOG_INFO() << "Requesting " << (bBlock ? "block" : "header") << " " << id;
Task* pTask = new Task;
pTask->m_Key = tKey.m_Key;
pTask->m_bRelevant = true;
pTask->m_pOwner = NULL;
get_ParentObj().m_setTasks.insert(*pTask);
get_ParentObj().m_lstTasksUnassigned.push_back(*pTask);
get_ParentObj().TryAssignTask(*pTask, pPreferredPeer);
int diff = static_cast<int>(id.m_Height - m_Cursor.m_ID.m_Height);
m_RequestedCount = std::max(m_RequestedCount, diff);
ReportProgress();
} else
it->m_bRelevant = true;
}
void Node::Processor::OnPeerInsane(const PeerID& peerID)
{
bool bCreate = false;
PeerMan::PeerInfoPlus* pInfo = (PeerMan::PeerInfoPlus*) get_ParentObj().m_PeerMan.Find(peerID, bCreate);
if (pInfo)
{
if (pInfo->m_pLive)
pInfo->m_pLive->DeleteSelf(true, proto::NodeConnection::ByeReason::Ban);
else
get_ParentObj().m_PeerMan.Ban(*pInfo);
}
}
void Node::Processor::OnNewState()
{
m_Cwp.Reset();
if (!m_Cursor.m_Sid.m_Row)
return;
proto::Hdr msgHdr;
msgHdr.m_Description = m_Cursor.m_Full;
proto::NewTip msg;
msgHdr.m_Description.get_ID(msg.m_ID);
msg.m_ChainWork = m_Cursor.m_Full.m_ChainWork;
LOG_INFO() << "My Tip: " << msg.m_ID;
get_ParentObj().m_TxPool.DeleteOutOfBound(msg.m_ID.m_Height + 1);
get_ParentObj().m_Miner.HardAbortSafe();
get_ParentObj().m_Miner.SetTimer(0, true); // don't start mined block construction, because we're called in the context of NodeProcessor, which holds the DB transaction.
for (PeerList::iterator it = get_ParentObj().m_lstPeers.begin(); get_ParentObj().m_lstPeers.end() != it; it++)
{
Peer& peer = *it;
if (peer.m_bConnected && (peer.m_TipWork <= msg.m_ChainWork))
{
peer.Send(msg);
if (peer.m_Config.m_AutoSendHdr)
peer.Send(msgHdr);
}
}
if (get_ParentObj().m_Compressor.m_bEnabled)
get_ParentObj().m_Compressor.OnNewState();
get_ParentObj().RefreshCongestions();
}
void Node::Processor::OnRolledBack()
{
LOG_INFO() << "Rolled back to: " << m_Cursor.m_ID;
if (get_ParentObj().m_Compressor.m_bEnabled)
get_ParentObj().m_Compressor.OnRolledBack();
}
bool Node::Processor::VerifyBlock(const Block::BodyBase& block, TxBase::IReader&& r, const HeightRange& hr)
{
uint32_t nThreads = get_ParentObj().m_Cfg.m_VerificationThreads;
if (!nThreads)
{
std::unique_ptr<Verifier::MyBatch> p(new Verifier::MyBatch);
p->m_bEnableBatch = true;
Verifier::MyBatch::Scope scope(*p);
return
NodeProcessor::VerifyBlock(block, std::move(r), hr) &&
p->Flush();
}
Verifier& v = m_Verifier; // alias
std::unique_lock<std::mutex> scope(v.m_Mutex);
if (v.m_vThreads.empty())
{
v.m_iTask = 1;
v.m_vThreads.resize(nThreads);
for (uint32_t i = 0; i < nThreads; i++)
v.m_vThreads[i] = std::thread(&Verifier::Thread, &v, i);
}
v.m_iTask ^= 2;
v.m_pTx = █
v.m_pR = &r;
v.m_bFail = false;
v.m_Remaining = nThreads;
v.m_Context.m_bBlockMode = true;
v.m_Context.m_Height = hr;
v.m_Context.m_nVerifiers = nThreads;
v.m_TaskNew.notify_all();
while (v.m_Remaining)
v.m_TaskFinished.wait(scope);
return !v.m_bFail && v.m_Context.IsValidBlock(block, m_Cursor.m_SubsidyOpen);
}
void Node::Processor::Verifier::Thread(uint32_t iVerifier)
{
std::unique_ptr<Verifier::MyBatch> p(new Verifier::MyBatch);
p->m_bEnableBatch = true;
Verifier::MyBatch::Scope scope(*p);
for (uint32_t iTask = 1; ; )
{
{
std::unique_lock<std::mutex> scope(m_Mutex);
while (m_iTask == iTask)
m_TaskNew.wait(scope);
if (!m_iTask)
return;
iTask = m_iTask;
}
p->Reset();
assert(m_Remaining);
TxBase::Context ctx;
ctx.m_bBlockMode = true;
ctx.m_Height = m_Context.m_Height;
ctx.m_nVerifiers = m_Context.m_nVerifiers;
ctx.m_iVerifier = iVerifier;
ctx.m_pAbort = &m_bFail; // obsolete actually
TxBase::IReader::Ptr pR;
m_pR->Clone(pR);
bool bValid = ctx.ValidateAndSummarize(*m_pTx, std::move(*pR)) && p->Flush();
std::unique_lock<std::mutex> scope(m_Mutex);
verify(m_Remaining--);
if (bValid && !m_bFail)
bValid = m_Context.Merge(ctx);
if (!bValid)
m_bFail = true;
if (!m_Remaining)
m_TaskFinished.notify_one();
}
}
bool Node::Processor::ApproveState(const Block::SystemState::ID& id)
{
const Block::SystemState::ID& idCtl = get_ParentObj().m_Cfg.m_ControlState;
return
(idCtl.m_Height != id.m_Height) ||
(idCtl.m_Hash == id.m_Hash);
}
void Node::Processor::OnStateData()
{
++m_DownloadedHeaders;
ReportProgress();
}
void Node::Processor::OnBlockData()
{
++m_DownloadedBlocks;
ReportProgress();
}
void Node::Processor::ReportProgress()
{
auto observer = get_ParentObj().m_Cfg.m_Observer;
if (observer)
{
int total = m_RequestedCount * 2;
int done = m_DownloadedHeaders + m_DownloadedBlocks;
if (total >= done)
{
observer->OnSyncProgress(done, total);
}
if (done >= total)
{
m_RequestedCount = m_DownloadedHeaders = m_DownloadedBlocks;
}
}
}
Node::Peer* Node::AllocPeer(const beam::io::Address& addr)
{
Peer* pPeer = new Peer(*this);
m_lstPeers.push_back(*pPeer);
pPeer->m_pInfo = NULL;
pPeer->m_bConnected = false;
pPeer->m_bPiRcvd = false;
pPeer->m_bOwner = false;
pPeer->m_Port = 0;
pPeer->m_TipHeight = 0;
pPeer->m_TipWork = Zero;
pPeer->m_RemoteAddr = addr;
ZeroObject(pPeer->m_Config);
LOG_INFO() << "+Peer " << addr;
return pPeer;
}
void Node::Initialize()
{
m_Processor.m_Horizon = m_Cfg.m_Horizon;
m_Processor.Initialize(m_Cfg.m_sPathLocal.c_str());
m_Processor.m_Kdf.m_Secret = m_Cfg.m_WalletKey;
ECC::GenRandom(m_SChannelSeed.V.m_pData, m_SChannelSeed.V.nBytes);
m_MyPrivateID.V.m_Value = Zero;
NodeDB::Blob blob(m_MyPrivateID.V.m_Value);
bool bNewID = !m_Processor.get_DB().ParamGet(NodeDB::ParamID::MyID, NULL, &blob);
if (bNewID)
ECC::Hash::Processor() << "myid" << m_SChannelSeed.V >> m_MyPrivateID.V.m_Value;
ECC::Scalar::Native sk = m_MyPrivateID.V;
proto::Sk2Pk(m_MyPublicID, sk);
if (bNewID)
{
m_MyPrivateID.V = sk; // may have been negated
m_Processor.get_DB().ParamSet(NodeDB::ParamID::MyID, NULL, &blob);
}
ECC::Kdf& kdf = m_Processor.m_Kdf;
DeriveKey(sk, kdf, 0, KeyType::Identity);
proto::Sk2Pk(m_MyOwnerID, sk);
LOG_INFO() << "Node ID=" << m_MyPublicID << ", Owner=" << m_MyOwnerID;
LOG_INFO() << "Initial Tip: " << m_Processor.m_Cursor.m_ID;
if (m_Cfg.m_VerificationThreads < 0)
{
uint32_t numCores = std::thread::hardware_concurrency();
m_Cfg.m_VerificationThreads = (numCores > m_Cfg.m_MiningThreads + 1) ? (numCores - m_Cfg.m_MiningThreads) : 0;
}
RefreshCongestions();
if (m_Cfg.m_Listen.port())
{
m_Server.Listen(m_Cfg.m_Listen);
if (m_Cfg.m_BeaconPeriod_ms)
m_Beacon.Start();
}
for (uint32_t i = 0; i < m_Cfg.m_Connect.size(); i++)
{
PeerID id0(Zero);
m_PeerMan.OnPeer(id0, m_Cfg.m_Connect[i], true);
}
// peers
m_PeerMan.m_pTimerUpd = io::Timer::create(io::Reactor::get_Current().shared_from_this());
m_PeerMan.m_pTimerUpd->start(m_Cfg.m_Timeout.m_PeersUpdate_ms, true, [this]() { m_PeerMan.Update(); });
m_PeerMan.m_pTimerFlush = io::Timer::create(io::Reactor::get_Current().shared_from_this());
m_PeerMan.m_pTimerFlush->start(m_Cfg.m_Timeout.m_PeersDbFlush_ms, true, [this]() { m_PeerMan.OnFlush(); });
{
NodeDB::WalkerPeer wlk(m_Processor.get_DB());
for (m_Processor.get_DB().EnumPeers(wlk); wlk.MoveNext(); )
{
if (wlk.m_Data.m_ID == m_MyPublicID)
continue; // could be left from previous run?
PeerMan::PeerInfo* pPi = m_PeerMan.OnPeer(wlk.m_Data.m_ID, io::Address::from_u64(wlk.m_Data.m_Address), false);
if (!pPi)
continue;
// set rating (akward, TODO - fix this)
uint32_t r = wlk.m_Data.m_Rating;
if (!r)
m_PeerMan.Ban(*pPi);
else
if (r > pPi->m_RawRating.m_Value)
m_PeerMan.ModifyRating(*pPi, r - pPi->m_RawRating.m_Value, true);
else
m_PeerMan.ModifyRating(*pPi, pPi->m_RawRating.m_Value - r, false);
pPi->m_LastSeen = wlk.m_Data.m_LastSeen;
}
}
if (m_Cfg.m_MiningThreads)
{
m_Miner.m_pEvtMined = io::AsyncEvent::create(io::Reactor::get_Current().shared_from_this(), [this]() { m_Miner.OnMined(); });
m_Miner.m_vThreads.resize(m_Cfg.m_MiningThreads);
for (uint32_t i = 0; i < m_Cfg.m_MiningThreads; i++)
{
PerThread& pt = m_Miner.m_vThreads[i];
pt.m_pReactor = io::Reactor::create();
pt.m_pEvt = io::AsyncEvent::create(pt.m_pReactor, [this, i]() { m_Miner.OnRefresh(i); });
pt.m_Thread = std::thread(&io::Reactor::run, pt.m_pReactor);
}
m_Miner.SetTimer(0, true); // async start mining, since this method may be followed by ImportMacroblock.
}
ZeroObject(m_Compressor.m_hrNew);
m_Compressor.m_bEnabled = !m_Cfg.m_HistoryCompression.m_sPathOutput.empty();
if (m_Compressor.m_bEnabled)
m_Compressor.Init();
m_Bbs.Cleanup();
}
void Node::Bbs::Cleanup()
{
get_ParentObj().m_Processor.get_DB().BbsDelOld(getTimestamp() - get_ParentObj().m_Cfg.m_Timeout.m_BbsMessageTimeout_s);
m_LastCleanup_ms = GetTime_ms();
FindRecommendedChannel();
}
void Node::Bbs::FindRecommendedChannel()
{
NodeDB& db = get_ParentObj().m_Processor.get_DB(); // alias
uint32_t nChannel = 0, nCount = 0, nCountFound;
bool bFound = false;
NodeDB::WalkerBbs wlk(db);
for (db.EnumAllBbs(wlk); ; )
{
bool bMoved = wlk.MoveNext();
if (bMoved && (wlk.m_Data.m_Channel == nChannel))
nCount++;
else
{
if ((nCount <= get_ParentObj().m_Cfg.m_BbsIdealChannelPopulation) && (!bFound || (nCountFound < nCount)))
{
bFound = true;
nCountFound = nCount;
m_RecommendedChannel = nChannel;
}
if (!bFound && (nChannel + 1 != wlk.m_Data.m_Channel)) // fine also for !bMoved
{
bFound = true;
nCountFound = 0;
m_RecommendedChannel = nChannel + 1;
}
if (!bMoved)
break;
nChannel = wlk.m_Data.m_Channel;
nCount = 1;
}
}
assert(bFound);
}
void Node::Bbs::MaybeCleanup()
{
uint32_t dt_ms = GetTime_ms() - m_LastCleanup_ms;
if (dt_ms >= get_ParentObj().m_Cfg.m_Timeout.m_BbsCleanupPeriod_ms)
Cleanup();
}
void Node::ImportMacroblock(Height h)
{
if (!m_Compressor.m_bEnabled)
throw std::runtime_error("History path not specified");
Block::BodyBase::RW rw;
m_Compressor.FmtPath(rw, h, NULL);
if (!rw.Open(true))
std::ThrowIoError();
if (!m_Processor.ImportMacroBlock(rw))
throw std::runtime_error("import failed");
if (m_Processor.m_Cursor.m_Sid.m_Row)
m_Processor.get_DB().MacroblockIns(m_Processor.m_Cursor.m_Sid.m_Row);
}
Node::~Node()
{
LOG_INFO() << "Node stopping...";
m_Miner.HardAbortSafe();
for (size_t i = 0; i < m_Miner.m_vThreads.size(); i++)
{
PerThread& pt = m_Miner.m_vThreads[i];
if (pt.m_pReactor)
pt.m_pReactor->stop();
if (pt.m_Thread.joinable())
pt.m_Thread.join();
}
m_Miner.m_vThreads.clear();
m_Compressor.StopCurrent();
for (PeerList::iterator it = m_lstPeers.begin(); m_lstPeers.end() != it; it++)
ZeroObject(it->m_Config); // prevent re-assigning of tasks in the next loop
while (!m_lstPeers.empty())
m_lstPeers.front().DeleteSelf(false, proto::NodeConnection::ByeReason::Stopping);
while (!m_lstTasksUnassigned.empty())
DeleteUnassignedTask(m_lstTasksUnassigned.front());
assert(m_setTasks.empty());
Processor::Verifier& v = m_Processor.m_Verifier; // alias
if (!v.m_vThreads.empty())
{
{
std::unique_lock<std::mutex> scope(v.m_Mutex);
v.m_iTask = 0;
v.m_TaskNew.notify_all();
}
for (size_t i = 0; i < v.m_vThreads.size(); i++)
if (v.m_vThreads[i].joinable())
v.m_vThreads[i].join();
}
LOG_INFO() << "Node stopped";
}
void Node::Peer::SetTimer(uint32_t timeout_ms)
{
if (!m_pTimer)
m_pTimer = io::Timer::create(io::Reactor::get_Current().shared_from_this());
m_pTimer->start(timeout_ms, false, [this]() { OnTimer(); });
}
void Node::Peer::KillTimer()
{
assert(m_pTimer);
m_pTimer->cancel();
}
void Node::Peer::OnTimer()
{
if (m_bConnected)
{
assert(!m_lstTasks.empty());
LOG_WARNING() << "Peer " << m_RemoteAddr << " request timeout";
if (m_pInfo)
m_This.m_PeerMan.ModifyRating(*m_pInfo, PeerMan::Rating::PenaltyTimeout, false); // task (request) wasn't handled in time.
DeleteSelf(false, ByeReason::Timeout);
}
else
// Connect didn't finish in time
DeleteSelf(true, 0);
}
void Node::Peer::OnResendPeers()
{
PeerMan& pm = m_This.m_PeerMan;
const PeerMan::RawRatingSet& rs = pm.get_Ratings();
uint32_t nRemaining = pm.m_Cfg.m_DesiredHighest;
for (PeerMan::RawRatingSet::const_iterator it = rs.begin(); nRemaining && (rs.end() != it); it++)
{
const PeerMan::PeerInfo& pi = it->get_ParentObj();
if (m_bPiRcvd && (&pi == m_pInfo))
continue; // skip
proto::PeerInfo msg;
msg.m_ID = pi.m_ID.m_Key;
msg.m_LastAddr = pi.m_Addr.m_Value;
Send(msg);
}
}
void Node::Peer::GenerateSChannelNonce(ECC::Scalar::Native& nonce)
{
ECC::uintBig& hv = m_This.m_SChannelSeed.V; // alias
ECC::Hash::Processor() << "sch.nonce" << hv << GetTime_ms() >> hv;
nonce.GenerateNonce(m_This.m_Cfg.m_WalletKey.V, hv, NULL);
}
void Node::Peer::OnConnectedSecure()
{
LOG_INFO() << "Peer " << m_RemoteAddr << " Connected";
m_bConnected = true;
if (m_Port && m_This.m_Cfg.m_Listen.port())
{
// we've connected to the peer, let it now know our port
proto::PeerInfoSelf msgPi;
msgPi.m_Port = m_This.m_Cfg.m_Listen.port();
Send(msgPi);
}
ECC::Scalar::Native sk = m_This.m_MyPrivateID.V;
ProveID(sk, proto::IDType::Node);
proto::Config msgCfg;
msgCfg.m_CfgChecksum = Rules::get().Checksum;
msgCfg.m_SpreadingTransactions = true;
msgCfg.m_Bbs = true;
msgCfg.m_SendPeers = true;
Send(msgCfg);
if (m_This.m_Processor.m_Cursor.m_Sid.m_Row)
{
proto::NewTip msg;
msg.m_ID = m_This.m_Processor.m_Cursor.m_ID;
msg.m_ChainWork = m_This.m_Processor.m_Cursor.m_Full.m_ChainWork;
Send(msg);
}
}
void Node::Peer::OnMsg(proto::Authentication&& msg)
{
proto::NodeConnection::OnMsg(std::move(msg));
LOG_INFO() << "Peer " << m_RemoteAddr << " Auth. Type=" << msg.m_IDType << ", ID=" << msg.m_ID;
if (proto::IDType::Owner == msg.m_IDType)
{
if (msg.m_ID == m_This.m_MyOwnerID)
m_bOwner = true;
}
if (proto::IDType::Node != msg.m_IDType)
return;
if (m_bPiRcvd || (msg.m_ID == Zero))
ThrowUnexpected();
m_bPiRcvd = true;
LOG_INFO() << m_RemoteAddr << " received PI";
PeerMan& pm = m_This.m_PeerMan; // alias
if (m_pInfo)
{
// probably we connected by the address
if (m_pInfo->m_ID.m_Key == msg.m_ID)
{
pm.OnSeen(*m_pInfo);
return; // all settled (already)
}
// detach from it
m_pInfo->m_pLive = NULL;
if (m_pInfo->m_ID.m_Key == Zero)
{
LOG_INFO() << "deleted anonymous PI";
pm.Delete(*m_pInfo); // it's anonymous.
}
else
{
LOG_INFO() << "PeerID is different";
pm.OnActive(*m_pInfo, false);
pm.RemoveAddr(*m_pInfo); // turned-out to be wrong
}
m_pInfo = NULL;
}
if (msg.m_ID == m_This.m_MyPublicID)
{
LOG_WARNING() << "Loopback connection";
DeleteSelf(false, ByeReason::Loopback);
return;
}
io::Address addr;
bool bAddrValid = (m_Port > 0);
if (bAddrValid)
{
addr = m_RemoteAddr;
addr.port(m_Port);
} else
LOG_INFO() << "No PI port"; // doesn't accept incoming connections?
PeerMan::PeerInfoPlus* pPi = (PeerMan::PeerInfoPlus*) pm.OnPeer(msg.m_ID, addr, bAddrValid);
assert(pPi);
if (pPi->m_pLive)
{
LOG_INFO() << "Duplicate connection with the same PI.";
// Duplicate connection. In this case we have to choose wether to terminate this connection, or the previous. The best is to do it asymmetrically.
// We decide this based on our Node IDs.
if (m_This.m_MyPublicID > msg.m_ID)
{
pPi->m_pLive->DeleteSelf(false, ByeReason::Duplicate);
assert(!pPi->m_pLive);
}
else
{
DeleteSelf(false, ByeReason::Duplicate);
return;
}
}
if (!pPi->m_RawRating.m_Value)
{
LOG_INFO() << "Banned PI. Ignoring";
DeleteSelf(false, ByeReason::Ban);
return;
}
// attach to it
pPi->m_pLive = this;
m_pInfo = pPi;
pm.OnActive(*pPi, true);
pm.OnSeen(*pPi);
LOG_INFO() << *m_pInfo << " connected, info updated";
}
void Node::Peer::OnDisconnect(const DisconnectReason& dr)
{
LOG_WARNING() << m_RemoteAddr << ": " << dr;
bool bIsErr = true;
uint8_t nByeReason = 0;
switch (dr.m_Type)
{
default: assert(false);
case DisconnectReason::Io:
break;
case DisconnectReason::Bye:
bIsErr = false;
break;
case DisconnectReason::ProcessingExc:
case DisconnectReason::Protocol:
nByeReason = ByeReason::Ban;
break;
}
DeleteSelf(bIsErr, nByeReason);
}
void Node::Peer::ReleaseTasks()
{
while (!m_lstTasks.empty())
ReleaseTask(m_lstTasks.front());
}
void Node::Peer::ReleaseTask(Task& t)
{
assert(this == t.m_pOwner);
t.m_pOwner = NULL;
m_lstTasks.erase(TaskList::s_iterator_to(t));
m_This.m_lstTasksUnassigned.push_back(t);
if (t.m_bRelevant)
m_This.TryAssignTask(t, NULL);
else
m_This.DeleteUnassignedTask(t);
}
void Node::Peer::DeleteSelf(bool bIsError, uint8_t nByeReason)
{
LOG_INFO() << "-Peer " << m_RemoteAddr;
if (nByeReason && m_bConnected)
{
proto::Bye msg;
msg.m_Reason = nByeReason;
Send(msg);
}
m_TipHeight = 0; // prevent reassigning the tasks
m_TipWork = Zero;
ReleaseTasks();
Unsubscribe();
if (m_pInfo)
{
// detach
assert(this == m_pInfo->m_pLive);
m_pInfo->m_pLive = NULL;
m_This.m_PeerMan.OnActive(*m_pInfo, false);
if (bIsError)
m_This.m_PeerMan.OnRemoteError(*m_pInfo, ByeReason::Ban == nByeReason);
}
m_This.m_lstPeers.erase(PeerList::s_iterator_to(*this));
delete this;
}
void Node::Peer::Unsubscribe(Bbs::Subscription& s)
{
m_This.m_Bbs.m_Subscribed.erase(Bbs::Subscription::BbsSet::s_iterator_to(s.m_Bbs));
m_Subscriptions.erase(Bbs::Subscription::PeerSet::s_iterator_to(s.m_Peer));
delete &s;
}
void Node::Peer::Unsubscribe()
{
while (!m_Subscriptions.empty())
Unsubscribe(m_Subscriptions.begin()->get_ParentObj());
}
void Node::Peer::TakeTasks()
{
for (TaskList::iterator it = m_This.m_lstTasksUnassigned.begin(); m_This.m_lstTasksUnassigned.end() != it; )
{
Task& t = *(it++);
if (m_This.ShouldAssignTask(t, *this))
m_This.AssignTask(t, *this);
}
}
void Node::Peer::OnMsg(proto::Ping&&)
{
proto::Pong msg(Zero);
Send(msg);
}
void Node::Peer::OnMsg(proto::NewTip&& msg)
{
if (msg.m_ChainWork < m_TipWork)
ThrowUnexpected();
m_TipHeight = msg.m_ID.m_Height;
m_TipWork = msg.m_ChainWork;
m_setRejected.clear();
LOG_INFO() << "Peer " << m_RemoteAddr << " Tip: " << msg.m_ID;
TakeTasks();
if (m_This.m_Processor.IsStateNeeded(msg.m_ID))
m_This.m_Processor.RequestData(msg.m_ID, false, m_pInfo ? &m_pInfo->m_ID.m_Key : NULL);
}
Node::Task& Node::Peer::get_FirstTask()
{
if (m_lstTasks.empty())
ThrowUnexpected();
return m_lstTasks.front();
}
void Node::Peer::OnFirstTaskDone()
{
ReleaseTask(get_FirstTask());
SetTimerWrtFirstTask();
}
void Node::Peer::OnMsg(proto::DataMissing&&)
{
Task& t = get_FirstTask();
m_setRejected.insert(t.m_Key);
OnFirstTaskDone();
}
void Node::Peer::OnMsg(proto::GetHdr&& msg)
{
uint64_t rowid = m_This.m_Processor.get_DB().StateFindSafe(msg.m_ID);
if (rowid)
{
proto::Hdr msgHdr;
m_This.m_Processor.get_DB().get_State(rowid, msgHdr.m_Description);
Send(msgHdr);
} else
{
proto::DataMissing msgMiss(Zero);
Send(msgMiss);
}
}
void Node::Peer::OnMsg(proto::Hdr&& msg)
{
Task& t = get_FirstTask();
if (t.m_Key.second)
ThrowUnexpected();
Block::SystemState::ID id;
msg.m_Description.get_ID(id);
if (id != t.m_Key.first)
ThrowUnexpected();
assert(m_bPiRcvd && m_pInfo);
m_This.m_PeerMan.ModifyRating(*m_pInfo, PeerMan::Rating::RewardHeader, true);
NodeProcessor::DataStatus::Enum eStatus = m_This.m_Processor.OnState(msg.m_Description, m_pInfo->m_ID.m_Key);
OnFirstTaskDone(eStatus);
}
void Node::Peer::OnMsg(proto::GetBody&& msg)
{
uint64_t rowid = m_This.m_Processor.get_DB().StateFindSafe(msg.m_ID);
if (rowid)
{
proto::Body msgBody;
ByteBuffer bbRollback;
m_This.m_Processor.get_DB().GetStateBlock(rowid, msgBody.m_Buffer, bbRollback);
if (!msgBody.m_Buffer.empty())
{
Send(msgBody);
return;
}
}
proto::DataMissing msgMiss(Zero);
Send(msgMiss);
}
void Node::Peer::OnMsg(proto::Body&& msg)
{
Task& t = get_FirstTask();
if (!t.m_Key.second)
ThrowUnexpected();
assert(m_bPiRcvd && m_pInfo);
m_This.m_PeerMan.ModifyRating(*m_pInfo, PeerMan::Rating::RewardBlock, true);
const Block::SystemState::ID& id = t.m_Key.first;
NodeProcessor::DataStatus::Enum eStatus = m_This.m_Processor.OnBlock(id, msg.m_Buffer, m_pInfo->m_ID.m_Key);
OnFirstTaskDone(eStatus);
}
void Node::Peer::OnFirstTaskDone(NodeProcessor::DataStatus::Enum eStatus)
{
if (NodeProcessor::DataStatus::Invalid == eStatus)
ThrowUnexpected();
get_FirstTask().m_bRelevant = false;
OnFirstTaskDone();
if (NodeProcessor::DataStatus::Accepted == eStatus)
m_This.RefreshCongestions(); // NOTE! Can call OnPeerInsane()
}
void Node::Peer::OnMsg(proto::NewTransaction&& msg)
{
if (!msg.m_Transaction)
ThrowUnexpected(); // our deserialization permits NULL Ptrs.
// However the transaction body must have already been checked for NULLs
proto::Boolean msgOut;
msgOut.m_Value = OnNewTransaction(std::move(msg.m_Transaction));
Send(msgOut);
}
bool Node::Peer::OnNewTransaction(Transaction::Ptr&& ptx)
{
NodeProcessor::TxPool::Element::Tx key;
ptx->get_Key(key.m_Key);
NodeProcessor::TxPool::TxSet::iterator it = m_This.m_TxPool.m_setTxs.find(key);
if (m_This.m_TxPool.m_setTxs.end() != it)
return true;
m_This.m_Wtx.Delete(key.m_Key);
// new transaction
const Transaction& tx = *ptx;
Transaction::Context ctx;
bool bValid = !tx.m_vInputs.empty() && !tx.m_vKernelsOutput.empty();
if (bValid)
bValid = m_This.m_Processor.ValidateTx(tx, ctx);
{
// Log it
std::ostringstream os;
os << "Tx " << key.m_Key << " from " << m_RemoteAddr;
for (size_t i = 0; i < tx.m_vInputs.size(); i++)
os << "\n\tI: " << tx.m_vInputs[i]->m_Commitment;
for (size_t i = 0; i < tx.m_vOutputs.size(); i++)
{
const Output& outp = *tx.m_vOutputs[i];
os << "\n\tO: " << outp.m_Commitment;
if (outp.m_Incubation)
os << ", Incubation +" << outp.m_Incubation;
if (outp.m_pPublic)
os << ", Sum=" << outp.m_pPublic->m_Value;
if (outp.m_pConfidential)
os << ", Confidential";
}
for (size_t i = 0; i < tx.m_vKernelsOutput.size(); i++)
os << "\n\tK: Fee=" << tx.m_vKernelsOutput[i]->m_Fee;
os << "\n\tValid: " << bValid;
LOG_INFO() << os.str();
}
if (!bValid)
return false;
proto::HaveTransaction msgOut;
msgOut.m_ID = key.m_Key;
for (PeerList::iterator it = m_This.m_lstPeers.begin(); m_This.m_lstPeers.end() != it; it++)
{
Peer& peer = *it;
if (this == &peer)
continue;
if (!peer.m_Config.m_SpreadingTransactions)
continue;
peer.Send(msgOut);
}
m_This.m_TxPool.AddValidTx(std::move(ptx), ctx, key.m_Key);
m_This.m_TxPool.ShrinkUpTo(m_This.m_Cfg.m_MaxPoolTransactions);
m_This.m_Miner.SetTimer(m_This.m_Cfg.m_Timeout.m_MiningSoftRestart_ms, false);
return true;
}
void Node::Peer::OnMsg(proto::Config&& msg)
{
if (msg.m_CfgChecksum != Rules::get().Checksum)
ThrowUnexpected("Incompatible peer cfg!");
if (!m_Config.m_AutoSendHdr && msg.m_AutoSendHdr && m_This.m_Processor.m_Cursor.m_Sid.m_Row)
{
proto::Hdr msgHdr;
msgHdr.m_Description = m_This.m_Processor.m_Cursor.m_Full;
Send(msgHdr);
}
if (!m_Config.m_SpreadingTransactions && msg.m_SpreadingTransactions)
{
proto::HaveTransaction msgOut;
for (NodeProcessor::TxPool::TxSet::iterator it = m_This.m_TxPool.m_setTxs.begin(); m_This.m_TxPool.m_setTxs.end() != it; it++)
{
msgOut.m_ID = it->m_Key;
Send(msgOut);
}
}
if (m_Config.m_SendPeers != msg.m_SendPeers)
{
if (msg.m_SendPeers)
{
if (!m_pTimerPeers)
m_pTimerPeers = io::Timer::create(io::Reactor::get_Current().shared_from_this());
m_pTimerPeers->start(m_This.m_Cfg.m_Timeout.m_TopPeersUpd_ms, true, [this]() { OnResendPeers(); });
OnResendPeers();
}
else
if (m_pTimerPeers)
m_pTimerPeers->cancel();
}
if (!m_Config.m_Bbs && msg.m_Bbs)
{
proto::BbsHaveMsg msgOut;
NodeDB& db = m_This.m_Processor.get_DB();
NodeDB::WalkerBbs wlk(db);
for (db.EnumAllBbs(wlk); wlk.MoveNext(); )
{
msgOut.m_Key = wlk.m_Data.m_Key;
Send(msgOut);
}
}
m_Config = msg;
}
void Node::Peer::OnMsg(proto::HaveTransaction&& msg)
{
NodeProcessor::TxPool::Element::Tx key;
key.m_Key = msg.m_ID;
NodeProcessor::TxPool::TxSet::iterator it = m_This.m_TxPool.m_setTxs.find(key);
if (m_This.m_TxPool.m_setTxs.end() != it)
return; // already have it
if (!m_This.m_Wtx.Add(key.m_Key))
return; // already waiting for it
proto::GetTransaction msgOut;
msgOut.m_ID = msg.m_ID;
Send(msgOut);
}
void Node::Peer::OnMsg(proto::GetTransaction&& msg)
{
NodeProcessor::TxPool::Element::Tx key;
key.m_Key = msg.m_ID;
NodeProcessor::TxPool::TxSet::iterator it = m_This.m_TxPool.m_setTxs.find(key);
if (m_This.m_TxPool.m_setTxs.end() == it)
return; // don't have it
// temporarily move the transaction to the Msg object, but make sure it'll be restored back, even in case of the exception.
struct Guard
{
proto::NewTransaction m_Msg;
Transaction::Ptr* m_ppVal;
void Swap() { m_ppVal->swap(m_Msg.m_Transaction); }
~Guard() { Swap(); }
};
Guard g;
g.m_ppVal = &it->get_ParentObj().m_pValue;
g.Swap();
Send(g.m_Msg);
}
void Node::Peer::OnMsg(proto::GetMined&& msg)
{
proto::Mined msgOut;
if (m_bOwner || !m_This.m_Cfg.m_RestrictMinedReportToOwner)
{
NodeDB& db = m_This.m_Processor.get_DB();
NodeDB::WalkerMined wlk(db);
for (db.EnumMined(wlk, msg.m_HeightMin); wlk.MoveNext(); )
{
msgOut.m_Entries.resize(msgOut.m_Entries.size() + 1);
proto::PerMined& x = msgOut.m_Entries.back();
x.m_Fees = wlk.m_Amount;
x.m_Active = 0 != (db.GetStateFlags(wlk.m_Sid.m_Row) & NodeDB::StateFlags::Active);
Block::SystemState::Full s;
db.get_State(wlk.m_Sid.m_Row, s);
s.get_ID(x.m_ID);
if (msgOut.m_Entries.size() == proto::PerMined::s_EntriesMax)
break;
}
} else
LOG_WARNING() << "Peer " << m_RemoteAddr << " Unauthorized Mining report request. Returned empty result.";
Send(msgOut);
}
void Node::Peer::OnMsg(proto::GetProofState&& msg)
{
if (msg.m_Height < Rules::HeightGenesis)
ThrowUnexpected();
proto::ProofState msgOut;
Processor& p = m_This.m_Processor;
const NodeDB::StateID& sid = p.m_Cursor.m_Sid;
if (sid.m_Row && (msg.m_Height < sid.m_Height))
{
Merkle::ProofBuilderHard bld;
p.get_DB().get_Proof(bld, sid, msg.m_Height);
msgOut.m_Proof.swap(bld.m_Proof);
msgOut.m_Proof.resize(msgOut.m_Proof.size() + 1);
p.get_CurrentLive(msgOut.m_Proof.back());
}
Send(msgOut);
}
void Node::Peer::OnMsg(proto::GetProofKernel&& msg)
{
proto::ProofKernel msgOut;
RadixHashOnlyTree& t = m_This.m_Processor.get_Kernels();
RadixHashOnlyTree::Cursor cu;
bool bCreate = false;
if (t.Find(cu, msg.m_ID, bCreate))
{
t.get_Proof(msgOut.m_Proof, cu);
msgOut.m_Proof.reserve(msgOut.m_Proof.size() + 2);
msgOut.m_Proof.resize(msgOut.m_Proof.size() + 1);
msgOut.m_Proof.back().first = false;
m_This.m_Processor.get_Utxos().get_Hash(msgOut.m_Proof.back().second);
msgOut.m_Proof.resize(msgOut.m_Proof.size() + 1);
msgOut.m_Proof.back().first = false;
msgOut.m_Proof.back().second = m_This.m_Processor.m_Cursor.m_History;
if (msg.m_RequestHashPreimage)
m_This.m_Processor.get_KernelHashPreimage(msg.m_ID, msgOut.m_HashPreimage);
}
Send(msgOut);
}
void Node::Peer::OnMsg(proto::GetProofUtxo&& msg)
{
struct Traveler :public UtxoTree::ITraveler
{
proto::ProofUtxo m_Msg;
UtxoTree* m_pTree;
Merkle::Hash m_hvHistory;
Merkle::Hash m_hvKernels;
virtual bool OnLeaf(const RadixTree::Leaf& x) override {
const UtxoTree::MyLeaf& v = (UtxoTree::MyLeaf&) x;
UtxoTree::Key::Data d;
d = v.m_Key;
m_Msg.m_Proofs.resize(m_Msg.m_Proofs.size() + 1);
Input::Proof& ret = m_Msg.m_Proofs.back();
ret.m_State.m_Count = v.m_Value.m_Count;
ret.m_State.m_Maturity = d.m_Maturity;
m_pTree->get_Proof(ret.m_Proof, *m_pCu);
ret.m_Proof.reserve(ret.m_Proof.size() + 2);
ret.m_Proof.resize(ret.m_Proof.size() + 1);
ret.m_Proof.back().first = true;
ret.m_Proof.back().second = m_hvKernels;
ret.m_Proof.resize(ret.m_Proof.size() + 1);
ret.m_Proof.back().first = false;
ret.m_Proof.back().second = m_hvHistory;
return m_Msg.m_Proofs.size() < Input::Proof::s_EntriesMax;
}
} t;
t.m_pTree = &m_This.m_Processor.get_Utxos();
m_This.m_Processor.get_Kernels().get_Hash(t.m_hvKernels);
t.m_hvHistory = m_This.m_Processor.m_Cursor.m_History;
UtxoTree::Cursor cu;
t.m_pCu = &cu;
// bounds
UtxoTree::Key kMin, kMax;
UtxoTree::Key::Data d;
d.m_Commitment = msg.m_Utxo.m_Commitment;
d.m_Maturity = msg.m_MaturityMin;
kMin = d;
d.m_Maturity = Height(-1);
kMax = d;
t.m_pBound[0] = kMin.m_pArr;
t.m_pBound[1] = kMax.m_pArr;
t.m_pTree->Traverse(t);
Send(t.m_Msg);
}
bool Node::Processor::BuildCwp()
{
if (!m_Cwp.IsEmpty())
return true; // already built
if (m_Cursor.m_Full.m_Height < Rules::HeightGenesis)
return false;
struct Source
:public Block::ChainWorkProof::ISource
{
Processor& m_Proc;
Source(Processor& proc) :m_Proc(proc) {}
virtual void get_StateAt(Block::SystemState::Full& s, const Difficulty::Raw& d) override
{
uint64_t rowid = m_Proc.get_DB().FindStateWorkGreater(d);
m_Proc.get_DB().get_State(rowid, s);
}
virtual void get_Proof(Merkle::IProofBuilder& bld, Height h) override
{
const NodeDB::StateID& sid = m_Proc.m_Cursor.m_Sid;
m_Proc.get_DB().get_Proof(bld, sid, h);
}
};
Source src(*this);
m_Cwp.Create(src, m_Cursor.m_Full);
get_CurrentLive(m_Cwp.m_hvRootLive);
return true;
}
void Node::Peer::OnMsg(proto::GetProofChainWork&& msg)
{
proto::ProofChainWork msgOut;
Processor& p = m_This.m_Processor;
if (p.BuildCwp())
{
msgOut.m_Proof = p.m_Cwp; // full copy
if (!(msg.m_LowerBound == Zero))
{
msgOut.m_Proof.m_LowerBound = msg.m_LowerBound;
verify(msgOut.m_Proof.Crop());
}
}
Send(msgOut);
}
void Node::Peer::OnMsg(proto::PeerInfoSelf&& msg)
{
m_Port = msg.m_Port;
}
void Node::Peer::OnMsg(proto::PeerInfo&& msg)
{
if (msg.m_ID != m_This.m_MyPublicID)
m_This.m_PeerMan.OnPeer(msg.m_ID, msg.m_LastAddr, false);
}
void Node::Peer::OnMsg(proto::GetTime&& msg)
{
proto::Time msgOut;
msgOut.m_Value = getTimestamp();
Send(msgOut);
}
void Node::Peer::OnMsg(proto::GetExternalAddr&& msg)
{
proto::ExternalAddr msgOut;
msgOut.m_Value = m_RemoteAddr.ip();
Send(msgOut);
}
void Node::Peer::OnMsg(proto::BbsMsg&& msg)
{
Timestamp t = getTimestamp();
Timestamp t0 = t - m_This.m_Cfg.m_Timeout.m_BbsMessageTimeout_s;
Timestamp t1 = t + m_This.m_Cfg.m_Timeout.m_BbsMessageMaxAhead_s;
if ((msg.m_TimePosted <= t0) || (msg.m_TimePosted > t1))
return;
NodeDB& db = m_This.m_Processor.get_DB();
NodeDB::WalkerBbs wlk(db);
wlk.m_Data.m_Channel = msg.m_Channel;
wlk.m_Data.m_TimePosted = msg.m_TimePosted;
wlk.m_Data.m_Message = NodeDB::Blob(msg.m_Message);
Bbs::CalcMsgKey(wlk.m_Data);
if (db.BbsFind(wlk))
return; // already have it
m_This.m_Bbs.MaybeCleanup();
db.BbsIns(wlk.m_Data);
m_This.m_Bbs.m_W.Delete(wlk.m_Data.m_Key);
// 1. Send to other BBS-es
proto::BbsHaveMsg msgOut;
msgOut.m_Key = wlk.m_Data.m_Key;
for (PeerList::iterator it = m_This.m_lstPeers.begin(); m_This.m_lstPeers.end() != it; it++)
{
Peer& peer = *it;
if (this == &peer)
continue;
if (!peer.m_Config.m_Bbs)
continue;
peer.Send(msgOut);
}
// 2. Send to subscribed
typedef Bbs::Subscription::BbsSet::iterator It;
Bbs::Subscription::InBbs key;
key.m_Channel = msg.m_Channel;
for (std::pair<It, It> range = m_This.m_Bbs.m_Subscribed.equal_range(key); range.first != range.second; range.first++)
{
Bbs::Subscription& s = range.first->get_ParentObj();
if (this == s.m_pPeer)
continue;
s.m_pPeer->SendBbsMsg(wlk.m_Data);
}
}
void Node::Peer::OnMsg(proto::BbsHaveMsg&& msg)
{
NodeDB& db = m_This.m_Processor.get_DB();
NodeDB::WalkerBbs wlk(db);
wlk.m_Data.m_Key = msg.m_Key;
if (db.BbsFind(wlk))
return; // already have it
if (!m_This.m_Bbs.m_W.Add(msg.m_Key))
return; // already waiting for it
proto::BbsGetMsg msgOut;
msgOut.m_Key = msg.m_Key;
Send(msgOut);
}
void Node::Peer::OnMsg(proto::BbsGetMsg&& msg)
{
NodeDB& db = m_This.m_Processor.get_DB();
NodeDB::WalkerBbs wlk(db);
wlk.m_Data.m_Key = msg.m_Key;
if (!db.BbsFind(wlk))
return; // don't have it
SendBbsMsg(wlk.m_Data);
}
void Node::Peer::SendBbsMsg(const NodeDB::WalkerBbs::Data& d)
{
proto::BbsMsg msgOut;
msgOut.m_Channel = d.m_Channel;
msgOut.m_TimePosted = d.m_TimePosted;
d.m_Message.Export(msgOut.m_Message); // TODO: avoid buf allocation
Send(msgOut);
}
void Node::Peer::OnMsg(proto::BbsSubscribe&& msg)
{
Bbs::Subscription::InPeer key;
key.m_Channel = msg.m_Channel;
Bbs::Subscription::PeerSet::iterator it = m_Subscriptions.find(key);
if ((m_Subscriptions.end() == it) != msg.m_On)
return;
if (msg.m_On)
{
Bbs::Subscription* pS = new Bbs::Subscription;
pS->m_pPeer = this;
pS->m_Bbs.m_Channel = msg.m_Channel;
pS->m_Peer.m_Channel = msg.m_Channel;
m_This.m_Bbs.m_Subscribed.insert(pS->m_Bbs);
m_Subscriptions.insert(pS->m_Peer);
NodeDB& db = m_This.m_Processor.get_DB();
NodeDB::WalkerBbs wlk(db);
wlk.m_Data.m_Channel = msg.m_Channel;
wlk.m_Data.m_TimePosted = msg.m_TimeFrom;
for (db.EnumBbs(wlk); wlk.MoveNext(); )
SendBbsMsg(wlk.m_Data);
}
else
Unsubscribe(it->get_ParentObj());
}
void Node::Peer::OnMsg(proto::BbsPickChannel&& msg)
{
proto::BbsPickChannelRes msgOut;
msgOut.m_Channel = m_This.m_Bbs.m_RecommendedChannel;
Send(msgOut);
}
void Node::Server::OnAccepted(io::TcpStream::Ptr&& newStream, int errorCode)
{
if (newStream)
{
LOG_DEBUG() << "New peer connected: " << newStream->address();
Peer* p = get_ParentObj().AllocPeer(newStream->peer_address());
p->Accept(std::move(newStream));
p->SecureConnect();
}
}
void Node::Miner::OnRefresh(uint32_t iIdx)
{
while (true)
{
Task::Ptr pTask;
Block::SystemState::Full s;
{
std::scoped_lock<std::mutex> scope(m_Mutex);
if (!m_pTask || *m_pTask->m_pStop)
break;
pTask = m_pTask;
s = pTask->m_Hdr; // local copy
}
ECC::Hash::Value hv; // pick pseudo-random initial nonce for mining.
ECC::Hash::Processor()
<< get_ParentObj().m_Cfg.m_MinerID
<< get_ParentObj().m_Processor.m_Kdf.m_Secret.V
<< iIdx
<< s.m_Height
>> hv;
static_assert(s.m_PoW.m_Nonce.nBytes <= hv.nBytes);
s.m_PoW.m_Nonce = hv;
LOG_INFO() << "Mining nonce = " << s.m_PoW.m_Nonce;
Block::PoW::Cancel fnCancel = [this, pTask](bool bRetrying)
{
if (*pTask->m_pStop)
return true;
if (bRetrying)
{
std::scoped_lock<std::mutex> scope(m_Mutex);
if (pTask != m_pTask)
return true; // soft restart triggered
}
return false;
};
if (Rules::get().FakePoW)
{
uint32_t timeout_ms = get_ParentObj().m_Cfg.m_TestMode.m_FakePowSolveTime_ms;
bool bSolved = false;
for (uint32_t t0_ms = GetTime_ms(); ; )
{
if (fnCancel(false))
break;
std::this_thread::sleep_for(std::chrono::milliseconds(50));
uint32_t dt_ms = GetTime_ms() - t0_ms;
if (dt_ms >= timeout_ms)
{
bSolved = true;
break;
}
}
if (!bSolved)
continue;
ZeroObject(s.m_PoW.m_Indices); // keep the difficulty intact
}
else
{
if (!s.GeneratePoW(fnCancel))
continue;
}
std::scoped_lock<std::mutex> scope(m_Mutex);
if (*pTask->m_pStop)
continue; // either aborted, or other thread was faster
pTask->m_Hdr = s; // save the result
*pTask->m_pStop = true;
m_pTask = pTask; // In case there was a soft restart we restore the one that we mined.
m_pEvtMined->post();
break;
}
}
void Node::Miner::HardAbortSafe()
{
std::scoped_lock<std::mutex> scope(m_Mutex);
if (m_pTask)
{
*m_pTask->m_pStop = true;
m_pTask = NULL;
}
}
void Node::Miner::SetTimer(uint32_t timeout_ms, bool bHard)
{
if (!m_pTimer)
m_pTimer = io::Timer::create(io::Reactor::get_Current().shared_from_this());
else
if (m_bTimerPending && !bHard)
return;
m_pTimer->start(timeout_ms, false, [this]() { OnTimer(); });
m_bTimerPending = true;
}
void Node::Miner::OnTimer()
{
m_bTimerPending = false;
Restart();
}
bool Node::Miner::Restart()
{
if (m_vThreads.empty())
return false; // n/a
Block::Body* pTreasury = NULL;
if (get_ParentObj().m_Processor.m_Cursor.m_SubsidyOpen)
{
Height dh = get_ParentObj().m_Processor.m_Cursor.m_Sid.m_Height + 1 - Rules::HeightGenesis;
std::vector<Block::Body>& vTreasury = get_ParentObj().m_Cfg.m_vTreasury;
if (dh >= vTreasury.size())
return false;
pTreasury = &vTreasury[dh];
pTreasury->m_SubsidyClosing = (dh + 1 == vTreasury.size());
}
Task::Ptr pTask(std::make_shared<Task>());
bool bRes = pTreasury ?
get_ParentObj().m_Processor.GenerateNewBlock(get_ParentObj().m_TxPool, pTask->m_Hdr, pTask->m_Body, pTask->m_Fees, *pTreasury) :
get_ParentObj().m_Processor.GenerateNewBlock(get_ParentObj().m_TxPool, pTask->m_Hdr, pTask->m_Body, pTask->m_Fees);
if (!bRes)
{
LOG_WARNING() << "Block generation failed, can't mine!";
return false;
}
LOG_INFO() << "Block generated: Height=" << pTask->m_Hdr.m_Height << ", Fee=" << pTask->m_Fees << ", Difficulty=" << pTask->m_Hdr.m_PoW.m_Difficulty << ", Size=" << pTask->m_Body.size();
// let's mine it.
std::scoped_lock<std::mutex> scope(m_Mutex);
if (m_pTask)
{
if (*m_pTask->m_pStop)
return true; // block already mined, probably notification to this thread on its way. Ignore the newly-constructed block
pTask->m_pStop = m_pTask->m_pStop; // use the same soft-restart indicator
}
else
{
pTask->m_pStop.reset(new volatile bool);
*pTask->m_pStop = false;
}
m_pTask = pTask;
for (size_t i = 0; i < m_vThreads.size(); i++)
m_vThreads[i].m_pEvt->post();
return true;
}
void Node::Miner::OnMined()
{
Task::Ptr pTask;
{
std::scoped_lock<std::mutex> scope(m_Mutex);
if (!(m_pTask && *m_pTask->m_pStop))
return; //?!
pTask.swap(m_pTask);
}
Block::SystemState::ID id;
pTask->m_Hdr.get_ID(id);
LOG_INFO() << "New block mined: " << id;
NodeProcessor::DataStatus::Enum eStatus = get_ParentObj().m_Processor.OnState(pTask->m_Hdr, get_ParentObj().m_MyPublicID);
switch (eStatus)
{
default:
case NodeProcessor::DataStatus::Invalid:
// Some bug?
LOG_WARNING() << "Mined block rejected as invalid!";
return;
case NodeProcessor::DataStatus::Rejected:
// Someone else mined exactly the same block!
LOG_WARNING() << "Mined block duplicated";
return;
case NodeProcessor::DataStatus::Accepted:
break; // ok
}
assert(NodeProcessor::DataStatus::Accepted == eStatus);
NodeDB::StateID sid;
verify(sid.m_Row = get_ParentObj().m_Processor.get_DB().StateFindSafe(id));
sid.m_Height = id.m_Height;
get_ParentObj().m_Processor.get_DB().SetMined(sid, pTask->m_Fees); // ding!
eStatus = get_ParentObj().m_Processor.OnBlock(id, pTask->m_Body, get_ParentObj().m_MyPublicID); // will likely trigger OnNewState(), and spread this block to the network
assert(NodeProcessor::DataStatus::Accepted == eStatus);
}
void Node::Compressor::Init()
{
m_bStop = true;
OnRolledBack(); // delete potentially ahead-of-time macroblocks
Cleanup(); // delete exceeding backlog, broken files
OnNewState();
}
void Node::Compressor::Cleanup()
{
// delete missing datas, delete exceeding backlog
Processor& p = get_ParentObj().m_Processor;
uint32_t nBacklog = get_ParentObj().m_Cfg.m_HistoryCompression.m_MaxBacklog + 1;
NodeDB::WalkerState ws(p.get_DB());
for (p.get_DB().EnumMacroblocks(ws); ws.MoveNext(); )
{
Block::BodyBase::RW rw;
FmtPath(rw, ws.m_Sid.m_Height, NULL);
if (nBacklog && rw.Open(true))
nBacklog--; // ok
else
{
LOG_WARNING() << "History at height " << ws.m_Sid.m_Height << " not found";
Delete(ws.m_Sid);
}
}
}
void Node::Compressor::OnRolledBack()
{
Processor& p = get_ParentObj().m_Processor;
if (m_hrNew.m_Max > p.m_Cursor.m_ID.m_Height)
StopCurrent();
NodeDB::WalkerState ws(p.get_DB());
p.get_DB().EnumMacroblocks(ws);
while (ws.MoveNext() && (ws.m_Sid.m_Height > p.m_Cursor.m_ID.m_Height))
Delete(ws.m_Sid);
// wait for OnNewState callback to realize new task
}
void Node::Compressor::Delete(const NodeDB::StateID& sid)
{
NodeDB& db = get_ParentObj().m_Processor.get_DB();
db.MacroblockDel(sid.m_Row);
Block::BodyBase::RW rw;
FmtPath(rw, sid.m_Height, NULL);
rw.Delete();
LOG_WARNING() << "History at height " << sid.m_Height << " deleted";
}
void Node::Compressor::OnNewState()
{
if (m_hrNew.m_Max)
return; // alreaddy in progress
const Config::HistoryCompression& cfg = get_ParentObj().m_Cfg.m_HistoryCompression;
Processor& p = get_ParentObj().m_Processor;
if (p.m_Cursor.m_ID.m_Height - Rules::HeightGenesis + 1 <= cfg.m_Threshold)
return;
HeightRange hr;
hr.m_Max = p.m_Cursor.m_ID.m_Height - cfg.m_Threshold;
// last macroblock
NodeDB::WalkerState ws(p.get_DB());
p.get_DB().EnumMacroblocks(ws);
hr.m_Min = ws.MoveNext() ? ws.m_Sid.m_Height : 0;
if (hr.m_Min + cfg.m_MinAggregate > hr.m_Max)
return;
LOG_INFO() << "History generation started up to height " << hr.m_Max;
// Start aggregation
m_hrNew = hr;
m_bStop = false;
m_bSuccess = false;
ZeroObject(m_hrInplaceRequest);
m_Link.m_pReactor = io::Reactor::get_Current().shared_from_this();
m_Link.m_pEvt = io::AsyncEvent::create(m_Link.m_pReactor, [this]() { OnNotify(); });;
m_Link.m_Thread = std::thread(&Compressor::Proceed, this);
}
void Node::Compressor::FmtPath(Block::BodyBase::RW& rw, Height h, const Height* pH0)
{
std::stringstream str;
if (!pH0)
str << get_ParentObj().m_Cfg.m_HistoryCompression.m_sPathOutput << "mb_";
else
str << get_ParentObj().m_Cfg.m_HistoryCompression.m_sPathTmp << "tmp_" << *pH0 << "_";
str << h;
rw.m_sPath = str.str();
}
void Node::Compressor::OnNotify()
{
assert(m_hrNew.m_Max);
if (m_hrInplaceRequest.m_Max)
{
// extract & resume
try
{
Block::Body::RW rw;
FmtPath(rw, m_hrInplaceRequest.m_Max, &m_hrInplaceRequest.m_Min);
if (!rw.Open(false))
std::ThrowIoError();
get_ParentObj().m_Processor.ExportMacroBlock(rw, m_hrInplaceRequest);
}
catch (const std::exception& e) {
m_bStop = true; // error indication
LOG_WARNING() << "History add " << e.what();
}
{
// lock is aqcuired by the other thread before it trigger the events. The following line guarantees it won't miss our notification
std::unique_lock<std::mutex> scope(m_Mutex);
}
m_Cond.notify_one();
}
else
{
Height h = m_hrNew.m_Max;
StopCurrent();
if (m_bSuccess)
{
std::string pSrc[Block::Body::RW::s_Datas];
std::string pTrg[Block::Body::RW::s_Datas];
Block::Body::RW rwSrc, rwTrg;
FmtPath(rwSrc, h, &Rules::HeightGenesis);
FmtPath(rwTrg, h, NULL);
rwSrc.GetPathes(pSrc);
rwTrg.GetPathes(pTrg);
for (int i = 0; i < Block::Body::RW::s_Datas; i++)
{
#ifdef WIN32
bool bOk = (FALSE != MoveFileExA(pSrc[i].c_str(), pTrg[i].c_str(), MOVEFILE_REPLACE_EXISTING));
#else // WIN32
bool bOk = !rename(pSrc[i].c_str(), pTrg[i].c_str());
#endif // WIN32
if (!bOk)
{
LOG_WARNING() << "History file move/rename failed";
m_bSuccess = false;
break;
}
}
if (!m_bSuccess)
{
rwSrc.Delete();
rwTrg.Delete();
}
}
if (m_bSuccess)
{
uint64_t rowid = get_ParentObj().m_Processor.FindActiveAtStrict(h);
get_ParentObj().m_Processor.get_DB().MacroblockIns(rowid);
LOG_INFO() << "History generated up to height " << h;
Cleanup();
}
else
LOG_WARNING() << "History generation failed";
}
}
void Node::Compressor::StopCurrent()
{
if (!m_hrNew.m_Max)
return;
{
std::unique_lock<std::mutex> scope(m_Mutex);
m_bStop = true;
}
m_Cond.notify_one();
if (m_Link.m_Thread.joinable())
m_Link.m_Thread.join();
ZeroObject(m_hrNew);
m_Link.m_pEvt = NULL; // should prevent "spurious" calls
}
void Node::Compressor::Proceed()
{
try {
m_bSuccess = ProceedInternal();
} catch (const std::exception& e) {
LOG_WARNING() << e.what();
}
if (!(m_bSuccess || m_bStop))
LOG_WARNING() << "History generation failed";
ZeroObject(m_hrInplaceRequest);
m_Link.m_pEvt->post();
}
bool Node::Compressor::ProceedInternal()
{
assert(m_hrNew.m_Max);
const Config::HistoryCompression& cfg = get_ParentObj().m_Cfg.m_HistoryCompression;
std::vector<HeightRange> v;
uint32_t i = 0;
for (Height hPos = m_hrNew.m_Min; hPos < m_hrNew.m_Max; i++)
{
HeightRange hr;
hr.m_Min = hPos + 1; // convention is boundary-inclusive, whereas m_hrNew excludes min bound
hr.m_Max = std::min(hPos + cfg.m_Naggling, m_hrNew.m_Max);
{
std::unique_lock<std::mutex> scope(m_Mutex);
m_hrInplaceRequest = hr;
m_Link.m_pEvt->post();
m_Cond.wait(scope);
if (m_bStop)
return false;
}
v.push_back(hr);
hPos = hr.m_Max;
for (uint32_t j = i; 1 & j; j >>= 1)
SquashOnce(v);
}
while (v.size() > 1)
SquashOnce(v);
if (m_hrNew.m_Min >= Rules::HeightGenesis)
{
Block::Body::RW rw, rwSrc0, rwSrc1;
FmtPath(rw, m_hrNew.m_Max, &Rules::HeightGenesis);
FmtPath(rwSrc0, m_hrNew.m_Min, NULL);
Height h0 = m_hrNew.m_Min + 1;
FmtPath(rwSrc1, m_hrNew.m_Max, &h0);
rw.m_bAutoDelete = rwSrc1.m_bAutoDelete = true;
if (!SquashOnce(rw, rwSrc0, rwSrc1))
return false;
rw.m_bAutoDelete = false;
}
return true;
}
bool Node::Compressor::SquashOnce(std::vector<HeightRange>& v)
{
assert(v.size() >= 2);
HeightRange& hr0 = v[v.size() - 2];
HeightRange& hr1 = v[v.size() - 1];
Block::Body::RW rw, rwSrc0, rwSrc1;
FmtPath(rw, hr1.m_Max, &hr0.m_Min);
FmtPath(rwSrc0, hr0.m_Max, &hr0.m_Min);
FmtPath(rwSrc1, hr1.m_Max, &hr1.m_Min);
hr0.m_Max = hr1.m_Max;
v.pop_back();
rw.m_bAutoDelete = rwSrc0.m_bAutoDelete = rwSrc1.m_bAutoDelete = true;
if (!SquashOnce(rw, rwSrc0, rwSrc1))
return false;
rw.m_bAutoDelete = false;
return true;
}
bool Node::Compressor::SquashOnce(Block::BodyBase::RW& rw, Block::BodyBase::RW& rwSrc0, Block::BodyBase::RW& rwSrc1)
{
if (!rw.Open(false) ||
!rwSrc0.Open(true) ||
!rwSrc1.Open(true))
std::ThrowIoError();
if (!rw.CombineHdr(std::move(rwSrc0), std::move(rwSrc1), m_bStop))
return false;
if (!rw.Combine(std::move(rwSrc0), std::move(rwSrc1), m_bStop))
return false;
return true;
}
struct Node::Beacon::OutCtx
{
int m_Refs;
OutCtx() :m_Refs(0) {}
struct UvRequest
:public uv_udp_send_t
{
IMPLEMENT_GET_PARENT_OBJ(OutCtx, m_Request)
} m_Request;
uv_buf_t m_BufDescr;
#pragma pack (push, 1)
struct Message
{
Merkle::Hash m_CfgChecksum;
PeerID m_NodeID;
uint16_t m_Port; // in network byte order
};
#pragma pack (pop)
Message m_Message; // the message broadcasted
void Release()
{
assert(m_Refs > 0);
if (!--m_Refs)
delete this;
}
static void OnDone(uv_udp_send_t* req, int status);
};
Node::Beacon::Beacon()
:m_pUdp(NULL)
,m_pOut(NULL)
{
}
Node::Beacon::~Beacon()
{
if (m_pUdp)
uv_close((uv_handle_t*) m_pUdp, OnClosed);
if (m_pOut)
m_pOut->Release();
}
uint16_t Node::Beacon::get_Port()
{
uint16_t nPort = get_ParentObj().m_Cfg.m_BeaconPort;
return nPort ? nPort : get_ParentObj().m_Cfg.m_Listen.port();
}
void Node::Beacon::Start()
{
assert(!m_pUdp);
m_pUdp = new uv_udp_t;
uv_udp_init(&io::Reactor::get_Current().get_UvLoop(), m_pUdp);
m_pUdp->data = this;
m_BufRcv.resize(sizeof(OutCtx::Message));
io::Address addr;
addr.port(get_Port());
sockaddr_in sa;
addr.fill_sockaddr_in(sa);
if (uv_udp_bind(m_pUdp, (sockaddr*)&sa, UV_UDP_REUSEADDR)) // should allow multiple nodes on the same machine (for testing)
std::ThrowIoError();
if (uv_udp_recv_start(m_pUdp, AllocBuf, OnRcv))
std::ThrowIoError();
if (uv_udp_set_broadcast(m_pUdp, 1))
std::ThrowIoError();
m_pTimer = io::Timer::create(io::Reactor::get_Current().shared_from_this());
m_pTimer->start(get_ParentObj().m_Cfg.m_BeaconPeriod_ms, true, [this]() { OnTimer(); }); // periodic timer
OnTimer();
}
void Node::Beacon::OnTimer()
{
if (!m_pOut)
{
m_pOut = new OutCtx;
m_pOut->m_Refs = 1;
m_pOut->m_Message.m_CfgChecksum = Rules::get().Checksum;
m_pOut->m_Message.m_NodeID = get_ParentObj().m_MyPublicID;
m_pOut->m_Message.m_Port = htons(get_ParentObj().m_Cfg.m_Listen.port());
m_pOut->m_BufDescr.base = (char*) &m_pOut->m_Message;
m_pOut->m_BufDescr.len = sizeof(m_pOut->m_Message);
}
else
if (m_pOut->m_Refs > 1)
return; // send still pending
io::Address addr;
addr.port(get_Port());
addr.ip(INADDR_BROADCAST);
sockaddr_in sa;
addr.fill_sockaddr_in(sa);
m_pOut->m_Refs++;
int nErr = uv_udp_send(&m_pOut->m_Request, m_pUdp, &m_pOut->m_BufDescr, 1, (sockaddr*) &sa, OutCtx::OnDone);
if (nErr)
m_pOut->Release();
}
void Node::Beacon::OutCtx::OnDone(uv_udp_send_t* req, int /* status */)
{
UvRequest* pVal = (UvRequest*)req;
assert(pVal);
pVal->get_ParentObj().Release();
}
void Node::Beacon::OnRcv(uv_udp_t* handle, ssize_t nread, const uv_buf_t* buf, const struct sockaddr* pSa, unsigned flags)
{
OutCtx::Message msg;
if (sizeof(msg) != nread)
return;
memcpy(&msg, buf->base, sizeof(msg)); // copy it to prevent (potential) datatype misallignment and etc.
if (msg.m_CfgChecksum != Rules::get().Checksum)
return;
Beacon* pThis = (Beacon*)handle->data;
if (pThis->get_ParentObj().m_MyPublicID == msg.m_NodeID)
return;
io::Address addr(*(sockaddr_in*)pSa);
addr.port(ntohs(msg.m_Port));
pThis->get_ParentObj().m_PeerMan.OnPeer(msg.m_NodeID, addr, true);
}
void Node::Beacon::AllocBuf(uv_handle_t* handle, size_t suggested_size, uv_buf_t* buf)
{
Beacon* pThis = (Beacon*)handle->data;
assert(pThis);
buf->base = (char*) &pThis->m_BufRcv.at(0);
buf->len = sizeof(OutCtx::Message);
}
void Node::Beacon::OnClosed(uv_handle_t* p)
{
assert(p);
delete (uv_udp_t*) p;
}
void Node::PeerMan::OnFlush()
{
NodeDB& db = get_ParentObj().m_Processor.get_DB();
NodeDB::Transaction t(db);
db.PeersDel();
const PeerMan::RawRatingSet& rs = get_Ratings();
for (PeerMan::RawRatingSet::const_iterator it = rs.begin(); rs.end() != it; it++)
{
const PeerMan::PeerInfo& pi = it->get_ParentObj();
NodeDB::WalkerPeer::Data d;
d.m_ID = pi.m_ID.m_Key;
d.m_Rating = pi.m_RawRating.m_Value;
d.m_Address = pi.m_Addr.m_Value.u64();
d.m_LastSeen = pi.m_LastSeen;
db.PeerIns(d);
}
t.Commit();
}
void Node::PeerMan::ActivatePeer(PeerInfo& pi)
{
PeerInfoPlus& pip = (PeerInfoPlus&)pi;
if (pip.m_pLive)
return; //?
Peer* p = get_ParentObj().AllocPeer(pip.m_Addr.m_Value);
p->m_pInfo = &pip;
pip.m_pLive = p;
p->Connect(pip.m_Addr.m_Value);
p->m_Port = pip.m_Addr.m_Value.port();
}
void Node::PeerMan::DeactivatePeer(PeerInfo& pi)
{
PeerInfoPlus& pip = (PeerInfoPlus&)pi;
if (!pip.m_pLive)
return; //?
pip.m_pLive->DeleteSelf(false, proto::NodeConnection::ByeReason::Other);
}
proto::PeerManager::PeerInfo* Node::PeerMan::AllocPeer()
{
PeerInfoPlus* p = new PeerInfoPlus;
p->m_pLive = NULL;
return p;
}
void Node::PeerMan::DeletePeer(PeerInfo& pi)
{
delete (PeerInfoPlus*)π
}
} // namespace beam
| 22.823482
| 187
| 0.684934
|
akhavr
|
034bab886bab27c6d6d9d0eb41429f083ce419b8
| 771,638
|
cc
|
C++
|
cpp/pdpb.pb.cc
|
Xavier1994/kvproto
|
cd1e088a4e0452ffb021b8985a4fca8dad48120a
|
[
"Apache-2.0"
] | null | null | null |
cpp/pdpb.pb.cc
|
Xavier1994/kvproto
|
cd1e088a4e0452ffb021b8985a4fca8dad48120a
|
[
"Apache-2.0"
] | null | null | null |
cpp/pdpb.pb.cc
|
Xavier1994/kvproto
|
cd1e088a4e0452ffb021b8985a4fca8dad48120a
|
[
"Apache-2.0"
] | null | null | null |
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: pdpb.proto
#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
#include "pdpb.pb.h"
#include <algorithm>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/port.h>
#include <google/protobuf/stubs/once.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/wire_format_lite_inl.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format.h>
// @@protoc_insertion_point(includes)
namespace pdpb {
namespace {
const ::google::protobuf::Descriptor* RequestHeader_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
RequestHeader_reflection_ = NULL;
const ::google::protobuf::Descriptor* ResponseHeader_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
ResponseHeader_reflection_ = NULL;
const ::google::protobuf::Descriptor* Error_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
Error_reflection_ = NULL;
const ::google::protobuf::Descriptor* TsoRequest_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
TsoRequest_reflection_ = NULL;
const ::google::protobuf::Descriptor* Timestamp_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
Timestamp_reflection_ = NULL;
const ::google::protobuf::Descriptor* TsoResponse_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
TsoResponse_reflection_ = NULL;
const ::google::protobuf::Descriptor* BootstrapRequest_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
BootstrapRequest_reflection_ = NULL;
const ::google::protobuf::Descriptor* BootstrapResponse_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
BootstrapResponse_reflection_ = NULL;
const ::google::protobuf::Descriptor* IsBootstrappedRequest_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
IsBootstrappedRequest_reflection_ = NULL;
const ::google::protobuf::Descriptor* IsBootstrappedResponse_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
IsBootstrappedResponse_reflection_ = NULL;
const ::google::protobuf::Descriptor* AllocIDRequest_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
AllocIDRequest_reflection_ = NULL;
const ::google::protobuf::Descriptor* AllocIDResponse_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
AllocIDResponse_reflection_ = NULL;
const ::google::protobuf::Descriptor* GetStoreRequest_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
GetStoreRequest_reflection_ = NULL;
const ::google::protobuf::Descriptor* GetStoreResponse_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
GetStoreResponse_reflection_ = NULL;
const ::google::protobuf::Descriptor* PutStoreRequest_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
PutStoreRequest_reflection_ = NULL;
const ::google::protobuf::Descriptor* PutStoreResponse_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
PutStoreResponse_reflection_ = NULL;
const ::google::protobuf::Descriptor* GetAllStoresRequest_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
GetAllStoresRequest_reflection_ = NULL;
const ::google::protobuf::Descriptor* GetAllStoresResponse_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
GetAllStoresResponse_reflection_ = NULL;
const ::google::protobuf::Descriptor* GetRegionRequest_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
GetRegionRequest_reflection_ = NULL;
const ::google::protobuf::Descriptor* GetRegionResponse_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
GetRegionResponse_reflection_ = NULL;
const ::google::protobuf::Descriptor* GetRegionByIDRequest_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
GetRegionByIDRequest_reflection_ = NULL;
const ::google::protobuf::Descriptor* GetClusterConfigRequest_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
GetClusterConfigRequest_reflection_ = NULL;
const ::google::protobuf::Descriptor* GetClusterConfigResponse_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
GetClusterConfigResponse_reflection_ = NULL;
const ::google::protobuf::Descriptor* PutClusterConfigRequest_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
PutClusterConfigRequest_reflection_ = NULL;
const ::google::protobuf::Descriptor* PutClusterConfigResponse_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
PutClusterConfigResponse_reflection_ = NULL;
const ::google::protobuf::Descriptor* Member_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
Member_reflection_ = NULL;
const ::google::protobuf::Descriptor* GetMembersRequest_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
GetMembersRequest_reflection_ = NULL;
const ::google::protobuf::Descriptor* GetMembersResponse_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
GetMembersResponse_reflection_ = NULL;
const ::google::protobuf::Descriptor* PeerStats_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
PeerStats_reflection_ = NULL;
const ::google::protobuf::Descriptor* RegionHeartbeatRequest_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
RegionHeartbeatRequest_reflection_ = NULL;
const ::google::protobuf::Descriptor* ChangePeer_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
ChangePeer_reflection_ = NULL;
const ::google::protobuf::Descriptor* TransferLeader_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
TransferLeader_reflection_ = NULL;
const ::google::protobuf::Descriptor* Merge_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
Merge_reflection_ = NULL;
const ::google::protobuf::Descriptor* SplitRegion_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
SplitRegion_reflection_ = NULL;
const ::google::protobuf::Descriptor* RegionHeartbeatResponse_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
RegionHeartbeatResponse_reflection_ = NULL;
const ::google::protobuf::Descriptor* AskSplitRequest_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
AskSplitRequest_reflection_ = NULL;
const ::google::protobuf::Descriptor* AskSplitResponse_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
AskSplitResponse_reflection_ = NULL;
const ::google::protobuf::Descriptor* ReportSplitRequest_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
ReportSplitRequest_reflection_ = NULL;
const ::google::protobuf::Descriptor* ReportSplitResponse_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
ReportSplitResponse_reflection_ = NULL;
const ::google::protobuf::Descriptor* AskBatchSplitRequest_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
AskBatchSplitRequest_reflection_ = NULL;
const ::google::protobuf::Descriptor* SplitID_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
SplitID_reflection_ = NULL;
const ::google::protobuf::Descriptor* AskBatchSplitResponse_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
AskBatchSplitResponse_reflection_ = NULL;
const ::google::protobuf::Descriptor* ReportBatchSplitRequest_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
ReportBatchSplitRequest_reflection_ = NULL;
const ::google::protobuf::Descriptor* ReportBatchSplitResponse_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
ReportBatchSplitResponse_reflection_ = NULL;
const ::google::protobuf::Descriptor* TimeInterval_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
TimeInterval_reflection_ = NULL;
const ::google::protobuf::Descriptor* StoreStats_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
StoreStats_reflection_ = NULL;
const ::google::protobuf::Descriptor* StoreHeartbeatRequest_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
StoreHeartbeatRequest_reflection_ = NULL;
const ::google::protobuf::Descriptor* StoreHeartbeatResponse_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
StoreHeartbeatResponse_reflection_ = NULL;
const ::google::protobuf::Descriptor* ScatterRegionRequest_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
ScatterRegionRequest_reflection_ = NULL;
const ::google::protobuf::Descriptor* ScatterRegionResponse_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
ScatterRegionResponse_reflection_ = NULL;
const ::google::protobuf::Descriptor* GetGCSafePointRequest_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
GetGCSafePointRequest_reflection_ = NULL;
const ::google::protobuf::Descriptor* GetGCSafePointResponse_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
GetGCSafePointResponse_reflection_ = NULL;
const ::google::protobuf::Descriptor* UpdateGCSafePointRequest_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
UpdateGCSafePointRequest_reflection_ = NULL;
const ::google::protobuf::Descriptor* UpdateGCSafePointResponse_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
UpdateGCSafePointResponse_reflection_ = NULL;
const ::google::protobuf::Descriptor* SyncRegionRequest_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
SyncRegionRequest_reflection_ = NULL;
const ::google::protobuf::Descriptor* SyncRegionResponse_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
SyncRegionResponse_reflection_ = NULL;
const ::google::protobuf::EnumDescriptor* ErrorType_descriptor_ = NULL;
const ::google::protobuf::EnumDescriptor* CheckPolicy_descriptor_ = NULL;
} // namespace
void protobuf_AssignDesc_pdpb_2eproto() GOOGLE_ATTRIBUTE_COLD;
void protobuf_AssignDesc_pdpb_2eproto() {
protobuf_AddDesc_pdpb_2eproto();
const ::google::protobuf::FileDescriptor* file =
::google::protobuf::DescriptorPool::generated_pool()->FindFileByName(
"pdpb.proto");
GOOGLE_CHECK(file != NULL);
RequestHeader_descriptor_ = file->message_type(0);
static const int RequestHeader_offsets_[1] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RequestHeader, cluster_id_),
};
RequestHeader_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
RequestHeader_descriptor_,
RequestHeader::internal_default_instance(),
RequestHeader_offsets_,
-1,
-1,
-1,
sizeof(RequestHeader),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RequestHeader, _internal_metadata_));
ResponseHeader_descriptor_ = file->message_type(1);
static const int ResponseHeader_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ResponseHeader, cluster_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ResponseHeader, error_),
};
ResponseHeader_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
ResponseHeader_descriptor_,
ResponseHeader::internal_default_instance(),
ResponseHeader_offsets_,
-1,
-1,
-1,
sizeof(ResponseHeader),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ResponseHeader, _internal_metadata_));
Error_descriptor_ = file->message_type(2);
static const int Error_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Error, type_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Error, message_),
};
Error_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
Error_descriptor_,
Error::internal_default_instance(),
Error_offsets_,
-1,
-1,
-1,
sizeof(Error),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Error, _internal_metadata_));
TsoRequest_descriptor_ = file->message_type(3);
static const int TsoRequest_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TsoRequest, header_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TsoRequest, count_),
};
TsoRequest_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
TsoRequest_descriptor_,
TsoRequest::internal_default_instance(),
TsoRequest_offsets_,
-1,
-1,
-1,
sizeof(TsoRequest),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TsoRequest, _internal_metadata_));
Timestamp_descriptor_ = file->message_type(4);
static const int Timestamp_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Timestamp, physical_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Timestamp, logical_),
};
Timestamp_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
Timestamp_descriptor_,
Timestamp::internal_default_instance(),
Timestamp_offsets_,
-1,
-1,
-1,
sizeof(Timestamp),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Timestamp, _internal_metadata_));
TsoResponse_descriptor_ = file->message_type(5);
static const int TsoResponse_offsets_[3] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TsoResponse, header_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TsoResponse, count_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TsoResponse, timestamp_),
};
TsoResponse_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
TsoResponse_descriptor_,
TsoResponse::internal_default_instance(),
TsoResponse_offsets_,
-1,
-1,
-1,
sizeof(TsoResponse),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TsoResponse, _internal_metadata_));
BootstrapRequest_descriptor_ = file->message_type(6);
static const int BootstrapRequest_offsets_[3] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(BootstrapRequest, header_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(BootstrapRequest, store_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(BootstrapRequest, region_),
};
BootstrapRequest_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
BootstrapRequest_descriptor_,
BootstrapRequest::internal_default_instance(),
BootstrapRequest_offsets_,
-1,
-1,
-1,
sizeof(BootstrapRequest),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(BootstrapRequest, _internal_metadata_));
BootstrapResponse_descriptor_ = file->message_type(7);
static const int BootstrapResponse_offsets_[1] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(BootstrapResponse, header_),
};
BootstrapResponse_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
BootstrapResponse_descriptor_,
BootstrapResponse::internal_default_instance(),
BootstrapResponse_offsets_,
-1,
-1,
-1,
sizeof(BootstrapResponse),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(BootstrapResponse, _internal_metadata_));
IsBootstrappedRequest_descriptor_ = file->message_type(8);
static const int IsBootstrappedRequest_offsets_[1] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(IsBootstrappedRequest, header_),
};
IsBootstrappedRequest_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
IsBootstrappedRequest_descriptor_,
IsBootstrappedRequest::internal_default_instance(),
IsBootstrappedRequest_offsets_,
-1,
-1,
-1,
sizeof(IsBootstrappedRequest),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(IsBootstrappedRequest, _internal_metadata_));
IsBootstrappedResponse_descriptor_ = file->message_type(9);
static const int IsBootstrappedResponse_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(IsBootstrappedResponse, header_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(IsBootstrappedResponse, bootstrapped_),
};
IsBootstrappedResponse_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
IsBootstrappedResponse_descriptor_,
IsBootstrappedResponse::internal_default_instance(),
IsBootstrappedResponse_offsets_,
-1,
-1,
-1,
sizeof(IsBootstrappedResponse),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(IsBootstrappedResponse, _internal_metadata_));
AllocIDRequest_descriptor_ = file->message_type(10);
static const int AllocIDRequest_offsets_[1] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AllocIDRequest, header_),
};
AllocIDRequest_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
AllocIDRequest_descriptor_,
AllocIDRequest::internal_default_instance(),
AllocIDRequest_offsets_,
-1,
-1,
-1,
sizeof(AllocIDRequest),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AllocIDRequest, _internal_metadata_));
AllocIDResponse_descriptor_ = file->message_type(11);
static const int AllocIDResponse_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AllocIDResponse, header_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AllocIDResponse, id_),
};
AllocIDResponse_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
AllocIDResponse_descriptor_,
AllocIDResponse::internal_default_instance(),
AllocIDResponse_offsets_,
-1,
-1,
-1,
sizeof(AllocIDResponse),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AllocIDResponse, _internal_metadata_));
GetStoreRequest_descriptor_ = file->message_type(12);
static const int GetStoreRequest_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GetStoreRequest, header_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GetStoreRequest, store_id_),
};
GetStoreRequest_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
GetStoreRequest_descriptor_,
GetStoreRequest::internal_default_instance(),
GetStoreRequest_offsets_,
-1,
-1,
-1,
sizeof(GetStoreRequest),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GetStoreRequest, _internal_metadata_));
GetStoreResponse_descriptor_ = file->message_type(13);
static const int GetStoreResponse_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GetStoreResponse, header_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GetStoreResponse, store_),
};
GetStoreResponse_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
GetStoreResponse_descriptor_,
GetStoreResponse::internal_default_instance(),
GetStoreResponse_offsets_,
-1,
-1,
-1,
sizeof(GetStoreResponse),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GetStoreResponse, _internal_metadata_));
PutStoreRequest_descriptor_ = file->message_type(14);
static const int PutStoreRequest_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PutStoreRequest, header_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PutStoreRequest, store_),
};
PutStoreRequest_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
PutStoreRequest_descriptor_,
PutStoreRequest::internal_default_instance(),
PutStoreRequest_offsets_,
-1,
-1,
-1,
sizeof(PutStoreRequest),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PutStoreRequest, _internal_metadata_));
PutStoreResponse_descriptor_ = file->message_type(15);
static const int PutStoreResponse_offsets_[1] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PutStoreResponse, header_),
};
PutStoreResponse_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
PutStoreResponse_descriptor_,
PutStoreResponse::internal_default_instance(),
PutStoreResponse_offsets_,
-1,
-1,
-1,
sizeof(PutStoreResponse),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PutStoreResponse, _internal_metadata_));
GetAllStoresRequest_descriptor_ = file->message_type(16);
static const int GetAllStoresRequest_offsets_[1] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GetAllStoresRequest, header_),
};
GetAllStoresRequest_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
GetAllStoresRequest_descriptor_,
GetAllStoresRequest::internal_default_instance(),
GetAllStoresRequest_offsets_,
-1,
-1,
-1,
sizeof(GetAllStoresRequest),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GetAllStoresRequest, _internal_metadata_));
GetAllStoresResponse_descriptor_ = file->message_type(17);
static const int GetAllStoresResponse_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GetAllStoresResponse, header_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GetAllStoresResponse, stores_),
};
GetAllStoresResponse_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
GetAllStoresResponse_descriptor_,
GetAllStoresResponse::internal_default_instance(),
GetAllStoresResponse_offsets_,
-1,
-1,
-1,
sizeof(GetAllStoresResponse),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GetAllStoresResponse, _internal_metadata_));
GetRegionRequest_descriptor_ = file->message_type(18);
static const int GetRegionRequest_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GetRegionRequest, header_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GetRegionRequest, region_key_),
};
GetRegionRequest_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
GetRegionRequest_descriptor_,
GetRegionRequest::internal_default_instance(),
GetRegionRequest_offsets_,
-1,
-1,
-1,
sizeof(GetRegionRequest),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GetRegionRequest, _internal_metadata_));
GetRegionResponse_descriptor_ = file->message_type(19);
static const int GetRegionResponse_offsets_[3] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GetRegionResponse, header_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GetRegionResponse, region_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GetRegionResponse, leader_),
};
GetRegionResponse_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
GetRegionResponse_descriptor_,
GetRegionResponse::internal_default_instance(),
GetRegionResponse_offsets_,
-1,
-1,
-1,
sizeof(GetRegionResponse),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GetRegionResponse, _internal_metadata_));
GetRegionByIDRequest_descriptor_ = file->message_type(20);
static const int GetRegionByIDRequest_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GetRegionByIDRequest, header_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GetRegionByIDRequest, region_id_),
};
GetRegionByIDRequest_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
GetRegionByIDRequest_descriptor_,
GetRegionByIDRequest::internal_default_instance(),
GetRegionByIDRequest_offsets_,
-1,
-1,
-1,
sizeof(GetRegionByIDRequest),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GetRegionByIDRequest, _internal_metadata_));
GetClusterConfigRequest_descriptor_ = file->message_type(21);
static const int GetClusterConfigRequest_offsets_[1] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GetClusterConfigRequest, header_),
};
GetClusterConfigRequest_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
GetClusterConfigRequest_descriptor_,
GetClusterConfigRequest::internal_default_instance(),
GetClusterConfigRequest_offsets_,
-1,
-1,
-1,
sizeof(GetClusterConfigRequest),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GetClusterConfigRequest, _internal_metadata_));
GetClusterConfigResponse_descriptor_ = file->message_type(22);
static const int GetClusterConfigResponse_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GetClusterConfigResponse, header_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GetClusterConfigResponse, cluster_),
};
GetClusterConfigResponse_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
GetClusterConfigResponse_descriptor_,
GetClusterConfigResponse::internal_default_instance(),
GetClusterConfigResponse_offsets_,
-1,
-1,
-1,
sizeof(GetClusterConfigResponse),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GetClusterConfigResponse, _internal_metadata_));
PutClusterConfigRequest_descriptor_ = file->message_type(23);
static const int PutClusterConfigRequest_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PutClusterConfigRequest, header_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PutClusterConfigRequest, cluster_),
};
PutClusterConfigRequest_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
PutClusterConfigRequest_descriptor_,
PutClusterConfigRequest::internal_default_instance(),
PutClusterConfigRequest_offsets_,
-1,
-1,
-1,
sizeof(PutClusterConfigRequest),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PutClusterConfigRequest, _internal_metadata_));
PutClusterConfigResponse_descriptor_ = file->message_type(24);
static const int PutClusterConfigResponse_offsets_[1] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PutClusterConfigResponse, header_),
};
PutClusterConfigResponse_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
PutClusterConfigResponse_descriptor_,
PutClusterConfigResponse::internal_default_instance(),
PutClusterConfigResponse_offsets_,
-1,
-1,
-1,
sizeof(PutClusterConfigResponse),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PutClusterConfigResponse, _internal_metadata_));
Member_descriptor_ = file->message_type(25);
static const int Member_offsets_[5] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Member, name_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Member, member_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Member, peer_urls_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Member, client_urls_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Member, leader_priority_),
};
Member_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
Member_descriptor_,
Member::internal_default_instance(),
Member_offsets_,
-1,
-1,
-1,
sizeof(Member),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Member, _internal_metadata_));
GetMembersRequest_descriptor_ = file->message_type(26);
static const int GetMembersRequest_offsets_[1] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GetMembersRequest, header_),
};
GetMembersRequest_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
GetMembersRequest_descriptor_,
GetMembersRequest::internal_default_instance(),
GetMembersRequest_offsets_,
-1,
-1,
-1,
sizeof(GetMembersRequest),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GetMembersRequest, _internal_metadata_));
GetMembersResponse_descriptor_ = file->message_type(27);
static const int GetMembersResponse_offsets_[4] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GetMembersResponse, header_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GetMembersResponse, members_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GetMembersResponse, leader_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GetMembersResponse, etcd_leader_),
};
GetMembersResponse_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
GetMembersResponse_descriptor_,
GetMembersResponse::internal_default_instance(),
GetMembersResponse_offsets_,
-1,
-1,
-1,
sizeof(GetMembersResponse),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GetMembersResponse, _internal_metadata_));
PeerStats_descriptor_ = file->message_type(28);
static const int PeerStats_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PeerStats, peer_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PeerStats, down_seconds_),
};
PeerStats_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
PeerStats_descriptor_,
PeerStats::internal_default_instance(),
PeerStats_offsets_,
-1,
-1,
-1,
sizeof(PeerStats),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PeerStats, _internal_metadata_));
RegionHeartbeatRequest_descriptor_ = file->message_type(29);
static const int RegionHeartbeatRequest_offsets_[12] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RegionHeartbeatRequest, header_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RegionHeartbeatRequest, region_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RegionHeartbeatRequest, leader_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RegionHeartbeatRequest, down_peers_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RegionHeartbeatRequest, pending_peers_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RegionHeartbeatRequest, bytes_written_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RegionHeartbeatRequest, bytes_read_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RegionHeartbeatRequest, keys_written_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RegionHeartbeatRequest, keys_read_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RegionHeartbeatRequest, approximate_size_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RegionHeartbeatRequest, interval_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RegionHeartbeatRequest, approximate_keys_),
};
RegionHeartbeatRequest_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
RegionHeartbeatRequest_descriptor_,
RegionHeartbeatRequest::internal_default_instance(),
RegionHeartbeatRequest_offsets_,
-1,
-1,
-1,
sizeof(RegionHeartbeatRequest),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RegionHeartbeatRequest, _internal_metadata_));
ChangePeer_descriptor_ = file->message_type(30);
static const int ChangePeer_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ChangePeer, peer_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ChangePeer, change_type_),
};
ChangePeer_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
ChangePeer_descriptor_,
ChangePeer::internal_default_instance(),
ChangePeer_offsets_,
-1,
-1,
-1,
sizeof(ChangePeer),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ChangePeer, _internal_metadata_));
TransferLeader_descriptor_ = file->message_type(31);
static const int TransferLeader_offsets_[1] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TransferLeader, peer_),
};
TransferLeader_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
TransferLeader_descriptor_,
TransferLeader::internal_default_instance(),
TransferLeader_offsets_,
-1,
-1,
-1,
sizeof(TransferLeader),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TransferLeader, _internal_metadata_));
Merge_descriptor_ = file->message_type(32);
static const int Merge_offsets_[1] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Merge, target_),
};
Merge_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
Merge_descriptor_,
Merge::internal_default_instance(),
Merge_offsets_,
-1,
-1,
-1,
sizeof(Merge),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Merge, _internal_metadata_));
SplitRegion_descriptor_ = file->message_type(33);
static const int SplitRegion_offsets_[1] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SplitRegion, policy_),
};
SplitRegion_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
SplitRegion_descriptor_,
SplitRegion::internal_default_instance(),
SplitRegion_offsets_,
-1,
-1,
-1,
sizeof(SplitRegion),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SplitRegion, _internal_metadata_));
RegionHeartbeatResponse_descriptor_ = file->message_type(34);
static const int RegionHeartbeatResponse_offsets_[8] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RegionHeartbeatResponse, header_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RegionHeartbeatResponse, change_peer_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RegionHeartbeatResponse, transfer_leader_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RegionHeartbeatResponse, region_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RegionHeartbeatResponse, region_epoch_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RegionHeartbeatResponse, target_peer_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RegionHeartbeatResponse, merge_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RegionHeartbeatResponse, split_region_),
};
RegionHeartbeatResponse_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
RegionHeartbeatResponse_descriptor_,
RegionHeartbeatResponse::internal_default_instance(),
RegionHeartbeatResponse_offsets_,
-1,
-1,
-1,
sizeof(RegionHeartbeatResponse),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RegionHeartbeatResponse, _internal_metadata_));
AskSplitRequest_descriptor_ = file->message_type(35);
static const int AskSplitRequest_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AskSplitRequest, header_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AskSplitRequest, region_),
};
AskSplitRequest_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
AskSplitRequest_descriptor_,
AskSplitRequest::internal_default_instance(),
AskSplitRequest_offsets_,
-1,
-1,
-1,
sizeof(AskSplitRequest),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AskSplitRequest, _internal_metadata_));
AskSplitResponse_descriptor_ = file->message_type(36);
static const int AskSplitResponse_offsets_[3] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AskSplitResponse, header_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AskSplitResponse, new_region_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AskSplitResponse, new_peer_ids_),
};
AskSplitResponse_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
AskSplitResponse_descriptor_,
AskSplitResponse::internal_default_instance(),
AskSplitResponse_offsets_,
-1,
-1,
-1,
sizeof(AskSplitResponse),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AskSplitResponse, _internal_metadata_));
ReportSplitRequest_descriptor_ = file->message_type(37);
static const int ReportSplitRequest_offsets_[3] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ReportSplitRequest, header_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ReportSplitRequest, left_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ReportSplitRequest, right_),
};
ReportSplitRequest_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
ReportSplitRequest_descriptor_,
ReportSplitRequest::internal_default_instance(),
ReportSplitRequest_offsets_,
-1,
-1,
-1,
sizeof(ReportSplitRequest),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ReportSplitRequest, _internal_metadata_));
ReportSplitResponse_descriptor_ = file->message_type(38);
static const int ReportSplitResponse_offsets_[1] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ReportSplitResponse, header_),
};
ReportSplitResponse_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
ReportSplitResponse_descriptor_,
ReportSplitResponse::internal_default_instance(),
ReportSplitResponse_offsets_,
-1,
-1,
-1,
sizeof(ReportSplitResponse),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ReportSplitResponse, _internal_metadata_));
AskBatchSplitRequest_descriptor_ = file->message_type(39);
static const int AskBatchSplitRequest_offsets_[3] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AskBatchSplitRequest, header_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AskBatchSplitRequest, region_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AskBatchSplitRequest, split_count_),
};
AskBatchSplitRequest_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
AskBatchSplitRequest_descriptor_,
AskBatchSplitRequest::internal_default_instance(),
AskBatchSplitRequest_offsets_,
-1,
-1,
-1,
sizeof(AskBatchSplitRequest),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AskBatchSplitRequest, _internal_metadata_));
SplitID_descriptor_ = file->message_type(40);
static const int SplitID_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SplitID, new_region_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SplitID, new_peer_ids_),
};
SplitID_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
SplitID_descriptor_,
SplitID::internal_default_instance(),
SplitID_offsets_,
-1,
-1,
-1,
sizeof(SplitID),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SplitID, _internal_metadata_));
AskBatchSplitResponse_descriptor_ = file->message_type(41);
static const int AskBatchSplitResponse_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AskBatchSplitResponse, header_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AskBatchSplitResponse, ids_),
};
AskBatchSplitResponse_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
AskBatchSplitResponse_descriptor_,
AskBatchSplitResponse::internal_default_instance(),
AskBatchSplitResponse_offsets_,
-1,
-1,
-1,
sizeof(AskBatchSplitResponse),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AskBatchSplitResponse, _internal_metadata_));
ReportBatchSplitRequest_descriptor_ = file->message_type(42);
static const int ReportBatchSplitRequest_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ReportBatchSplitRequest, header_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ReportBatchSplitRequest, regions_),
};
ReportBatchSplitRequest_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
ReportBatchSplitRequest_descriptor_,
ReportBatchSplitRequest::internal_default_instance(),
ReportBatchSplitRequest_offsets_,
-1,
-1,
-1,
sizeof(ReportBatchSplitRequest),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ReportBatchSplitRequest, _internal_metadata_));
ReportBatchSplitResponse_descriptor_ = file->message_type(43);
static const int ReportBatchSplitResponse_offsets_[1] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ReportBatchSplitResponse, header_),
};
ReportBatchSplitResponse_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
ReportBatchSplitResponse_descriptor_,
ReportBatchSplitResponse::internal_default_instance(),
ReportBatchSplitResponse_offsets_,
-1,
-1,
-1,
sizeof(ReportBatchSplitResponse),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ReportBatchSplitResponse, _internal_metadata_));
TimeInterval_descriptor_ = file->message_type(44);
static const int TimeInterval_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TimeInterval, start_timestamp_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TimeInterval, end_timestamp_),
};
TimeInterval_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
TimeInterval_descriptor_,
TimeInterval::internal_default_instance(),
TimeInterval_offsets_,
-1,
-1,
-1,
sizeof(TimeInterval),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TimeInterval, _internal_metadata_));
StoreStats_descriptor_ = file->message_type(45);
static const int StoreStats_offsets_[15] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StoreStats, store_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StoreStats, capacity_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StoreStats, available_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StoreStats, region_count_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StoreStats, sending_snap_count_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StoreStats, receiving_snap_count_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StoreStats, start_time_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StoreStats, applying_snap_count_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StoreStats, is_busy_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StoreStats, used_size_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StoreStats, bytes_written_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StoreStats, keys_written_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StoreStats, bytes_read_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StoreStats, keys_read_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StoreStats, interval_),
};
StoreStats_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
StoreStats_descriptor_,
StoreStats::internal_default_instance(),
StoreStats_offsets_,
-1,
-1,
-1,
sizeof(StoreStats),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StoreStats, _internal_metadata_));
StoreHeartbeatRequest_descriptor_ = file->message_type(46);
static const int StoreHeartbeatRequest_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StoreHeartbeatRequest, header_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StoreHeartbeatRequest, stats_),
};
StoreHeartbeatRequest_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
StoreHeartbeatRequest_descriptor_,
StoreHeartbeatRequest::internal_default_instance(),
StoreHeartbeatRequest_offsets_,
-1,
-1,
-1,
sizeof(StoreHeartbeatRequest),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StoreHeartbeatRequest, _internal_metadata_));
StoreHeartbeatResponse_descriptor_ = file->message_type(47);
static const int StoreHeartbeatResponse_offsets_[1] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StoreHeartbeatResponse, header_),
};
StoreHeartbeatResponse_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
StoreHeartbeatResponse_descriptor_,
StoreHeartbeatResponse::internal_default_instance(),
StoreHeartbeatResponse_offsets_,
-1,
-1,
-1,
sizeof(StoreHeartbeatResponse),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StoreHeartbeatResponse, _internal_metadata_));
ScatterRegionRequest_descriptor_ = file->message_type(48);
static const int ScatterRegionRequest_offsets_[4] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ScatterRegionRequest, header_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ScatterRegionRequest, region_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ScatterRegionRequest, region_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ScatterRegionRequest, leader_),
};
ScatterRegionRequest_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
ScatterRegionRequest_descriptor_,
ScatterRegionRequest::internal_default_instance(),
ScatterRegionRequest_offsets_,
-1,
-1,
-1,
sizeof(ScatterRegionRequest),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ScatterRegionRequest, _internal_metadata_));
ScatterRegionResponse_descriptor_ = file->message_type(49);
static const int ScatterRegionResponse_offsets_[1] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ScatterRegionResponse, header_),
};
ScatterRegionResponse_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
ScatterRegionResponse_descriptor_,
ScatterRegionResponse::internal_default_instance(),
ScatterRegionResponse_offsets_,
-1,
-1,
-1,
sizeof(ScatterRegionResponse),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ScatterRegionResponse, _internal_metadata_));
GetGCSafePointRequest_descriptor_ = file->message_type(50);
static const int GetGCSafePointRequest_offsets_[1] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GetGCSafePointRequest, header_),
};
GetGCSafePointRequest_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
GetGCSafePointRequest_descriptor_,
GetGCSafePointRequest::internal_default_instance(),
GetGCSafePointRequest_offsets_,
-1,
-1,
-1,
sizeof(GetGCSafePointRequest),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GetGCSafePointRequest, _internal_metadata_));
GetGCSafePointResponse_descriptor_ = file->message_type(51);
static const int GetGCSafePointResponse_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GetGCSafePointResponse, header_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GetGCSafePointResponse, safe_point_),
};
GetGCSafePointResponse_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
GetGCSafePointResponse_descriptor_,
GetGCSafePointResponse::internal_default_instance(),
GetGCSafePointResponse_offsets_,
-1,
-1,
-1,
sizeof(GetGCSafePointResponse),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GetGCSafePointResponse, _internal_metadata_));
UpdateGCSafePointRequest_descriptor_ = file->message_type(52);
static const int UpdateGCSafePointRequest_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UpdateGCSafePointRequest, header_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UpdateGCSafePointRequest, safe_point_),
};
UpdateGCSafePointRequest_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
UpdateGCSafePointRequest_descriptor_,
UpdateGCSafePointRequest::internal_default_instance(),
UpdateGCSafePointRequest_offsets_,
-1,
-1,
-1,
sizeof(UpdateGCSafePointRequest),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UpdateGCSafePointRequest, _internal_metadata_));
UpdateGCSafePointResponse_descriptor_ = file->message_type(53);
static const int UpdateGCSafePointResponse_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UpdateGCSafePointResponse, header_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UpdateGCSafePointResponse, new_safe_point_),
};
UpdateGCSafePointResponse_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
UpdateGCSafePointResponse_descriptor_,
UpdateGCSafePointResponse::internal_default_instance(),
UpdateGCSafePointResponse_offsets_,
-1,
-1,
-1,
sizeof(UpdateGCSafePointResponse),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UpdateGCSafePointResponse, _internal_metadata_));
SyncRegionRequest_descriptor_ = file->message_type(54);
static const int SyncRegionRequest_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SyncRegionRequest, header_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SyncRegionRequest, member_),
};
SyncRegionRequest_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
SyncRegionRequest_descriptor_,
SyncRegionRequest::internal_default_instance(),
SyncRegionRequest_offsets_,
-1,
-1,
-1,
sizeof(SyncRegionRequest),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SyncRegionRequest, _internal_metadata_));
SyncRegionResponse_descriptor_ = file->message_type(55);
static const int SyncRegionResponse_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SyncRegionResponse, header_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SyncRegionResponse, regions_),
};
SyncRegionResponse_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
SyncRegionResponse_descriptor_,
SyncRegionResponse::internal_default_instance(),
SyncRegionResponse_offsets_,
-1,
-1,
-1,
sizeof(SyncRegionResponse),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SyncRegionResponse, _internal_metadata_));
ErrorType_descriptor_ = file->enum_type(0);
CheckPolicy_descriptor_ = file->enum_type(1);
}
namespace {
GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_);
void protobuf_AssignDescriptorsOnce() {
::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_,
&protobuf_AssignDesc_pdpb_2eproto);
}
void protobuf_RegisterTypes(const ::std::string&) GOOGLE_ATTRIBUTE_COLD;
void protobuf_RegisterTypes(const ::std::string&) {
protobuf_AssignDescriptorsOnce();
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
RequestHeader_descriptor_, RequestHeader::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
ResponseHeader_descriptor_, ResponseHeader::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
Error_descriptor_, Error::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
TsoRequest_descriptor_, TsoRequest::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
Timestamp_descriptor_, Timestamp::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
TsoResponse_descriptor_, TsoResponse::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
BootstrapRequest_descriptor_, BootstrapRequest::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
BootstrapResponse_descriptor_, BootstrapResponse::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
IsBootstrappedRequest_descriptor_, IsBootstrappedRequest::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
IsBootstrappedResponse_descriptor_, IsBootstrappedResponse::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
AllocIDRequest_descriptor_, AllocIDRequest::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
AllocIDResponse_descriptor_, AllocIDResponse::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
GetStoreRequest_descriptor_, GetStoreRequest::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
GetStoreResponse_descriptor_, GetStoreResponse::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
PutStoreRequest_descriptor_, PutStoreRequest::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
PutStoreResponse_descriptor_, PutStoreResponse::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
GetAllStoresRequest_descriptor_, GetAllStoresRequest::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
GetAllStoresResponse_descriptor_, GetAllStoresResponse::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
GetRegionRequest_descriptor_, GetRegionRequest::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
GetRegionResponse_descriptor_, GetRegionResponse::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
GetRegionByIDRequest_descriptor_, GetRegionByIDRequest::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
GetClusterConfigRequest_descriptor_, GetClusterConfigRequest::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
GetClusterConfigResponse_descriptor_, GetClusterConfigResponse::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
PutClusterConfigRequest_descriptor_, PutClusterConfigRequest::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
PutClusterConfigResponse_descriptor_, PutClusterConfigResponse::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
Member_descriptor_, Member::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
GetMembersRequest_descriptor_, GetMembersRequest::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
GetMembersResponse_descriptor_, GetMembersResponse::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
PeerStats_descriptor_, PeerStats::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
RegionHeartbeatRequest_descriptor_, RegionHeartbeatRequest::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
ChangePeer_descriptor_, ChangePeer::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
TransferLeader_descriptor_, TransferLeader::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
Merge_descriptor_, Merge::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
SplitRegion_descriptor_, SplitRegion::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
RegionHeartbeatResponse_descriptor_, RegionHeartbeatResponse::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
AskSplitRequest_descriptor_, AskSplitRequest::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
AskSplitResponse_descriptor_, AskSplitResponse::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
ReportSplitRequest_descriptor_, ReportSplitRequest::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
ReportSplitResponse_descriptor_, ReportSplitResponse::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
AskBatchSplitRequest_descriptor_, AskBatchSplitRequest::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
SplitID_descriptor_, SplitID::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
AskBatchSplitResponse_descriptor_, AskBatchSplitResponse::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
ReportBatchSplitRequest_descriptor_, ReportBatchSplitRequest::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
ReportBatchSplitResponse_descriptor_, ReportBatchSplitResponse::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
TimeInterval_descriptor_, TimeInterval::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
StoreStats_descriptor_, StoreStats::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
StoreHeartbeatRequest_descriptor_, StoreHeartbeatRequest::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
StoreHeartbeatResponse_descriptor_, StoreHeartbeatResponse::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
ScatterRegionRequest_descriptor_, ScatterRegionRequest::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
ScatterRegionResponse_descriptor_, ScatterRegionResponse::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
GetGCSafePointRequest_descriptor_, GetGCSafePointRequest::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
GetGCSafePointResponse_descriptor_, GetGCSafePointResponse::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
UpdateGCSafePointRequest_descriptor_, UpdateGCSafePointRequest::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
UpdateGCSafePointResponse_descriptor_, UpdateGCSafePointResponse::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
SyncRegionRequest_descriptor_, SyncRegionRequest::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
SyncRegionResponse_descriptor_, SyncRegionResponse::internal_default_instance());
}
} // namespace
void protobuf_ShutdownFile_pdpb_2eproto() {
RequestHeader_default_instance_.Shutdown();
delete RequestHeader_reflection_;
ResponseHeader_default_instance_.Shutdown();
delete ResponseHeader_reflection_;
Error_default_instance_.Shutdown();
delete Error_reflection_;
TsoRequest_default_instance_.Shutdown();
delete TsoRequest_reflection_;
Timestamp_default_instance_.Shutdown();
delete Timestamp_reflection_;
TsoResponse_default_instance_.Shutdown();
delete TsoResponse_reflection_;
BootstrapRequest_default_instance_.Shutdown();
delete BootstrapRequest_reflection_;
BootstrapResponse_default_instance_.Shutdown();
delete BootstrapResponse_reflection_;
IsBootstrappedRequest_default_instance_.Shutdown();
delete IsBootstrappedRequest_reflection_;
IsBootstrappedResponse_default_instance_.Shutdown();
delete IsBootstrappedResponse_reflection_;
AllocIDRequest_default_instance_.Shutdown();
delete AllocIDRequest_reflection_;
AllocIDResponse_default_instance_.Shutdown();
delete AllocIDResponse_reflection_;
GetStoreRequest_default_instance_.Shutdown();
delete GetStoreRequest_reflection_;
GetStoreResponse_default_instance_.Shutdown();
delete GetStoreResponse_reflection_;
PutStoreRequest_default_instance_.Shutdown();
delete PutStoreRequest_reflection_;
PutStoreResponse_default_instance_.Shutdown();
delete PutStoreResponse_reflection_;
GetAllStoresRequest_default_instance_.Shutdown();
delete GetAllStoresRequest_reflection_;
GetAllStoresResponse_default_instance_.Shutdown();
delete GetAllStoresResponse_reflection_;
GetRegionRequest_default_instance_.Shutdown();
delete GetRegionRequest_reflection_;
GetRegionResponse_default_instance_.Shutdown();
delete GetRegionResponse_reflection_;
GetRegionByIDRequest_default_instance_.Shutdown();
delete GetRegionByIDRequest_reflection_;
GetClusterConfigRequest_default_instance_.Shutdown();
delete GetClusterConfigRequest_reflection_;
GetClusterConfigResponse_default_instance_.Shutdown();
delete GetClusterConfigResponse_reflection_;
PutClusterConfigRequest_default_instance_.Shutdown();
delete PutClusterConfigRequest_reflection_;
PutClusterConfigResponse_default_instance_.Shutdown();
delete PutClusterConfigResponse_reflection_;
Member_default_instance_.Shutdown();
delete Member_reflection_;
GetMembersRequest_default_instance_.Shutdown();
delete GetMembersRequest_reflection_;
GetMembersResponse_default_instance_.Shutdown();
delete GetMembersResponse_reflection_;
PeerStats_default_instance_.Shutdown();
delete PeerStats_reflection_;
RegionHeartbeatRequest_default_instance_.Shutdown();
delete RegionHeartbeatRequest_reflection_;
ChangePeer_default_instance_.Shutdown();
delete ChangePeer_reflection_;
TransferLeader_default_instance_.Shutdown();
delete TransferLeader_reflection_;
Merge_default_instance_.Shutdown();
delete Merge_reflection_;
SplitRegion_default_instance_.Shutdown();
delete SplitRegion_reflection_;
RegionHeartbeatResponse_default_instance_.Shutdown();
delete RegionHeartbeatResponse_reflection_;
AskSplitRequest_default_instance_.Shutdown();
delete AskSplitRequest_reflection_;
AskSplitResponse_default_instance_.Shutdown();
delete AskSplitResponse_reflection_;
ReportSplitRequest_default_instance_.Shutdown();
delete ReportSplitRequest_reflection_;
ReportSplitResponse_default_instance_.Shutdown();
delete ReportSplitResponse_reflection_;
AskBatchSplitRequest_default_instance_.Shutdown();
delete AskBatchSplitRequest_reflection_;
SplitID_default_instance_.Shutdown();
delete SplitID_reflection_;
AskBatchSplitResponse_default_instance_.Shutdown();
delete AskBatchSplitResponse_reflection_;
ReportBatchSplitRequest_default_instance_.Shutdown();
delete ReportBatchSplitRequest_reflection_;
ReportBatchSplitResponse_default_instance_.Shutdown();
delete ReportBatchSplitResponse_reflection_;
TimeInterval_default_instance_.Shutdown();
delete TimeInterval_reflection_;
StoreStats_default_instance_.Shutdown();
delete StoreStats_reflection_;
StoreHeartbeatRequest_default_instance_.Shutdown();
delete StoreHeartbeatRequest_reflection_;
StoreHeartbeatResponse_default_instance_.Shutdown();
delete StoreHeartbeatResponse_reflection_;
ScatterRegionRequest_default_instance_.Shutdown();
delete ScatterRegionRequest_reflection_;
ScatterRegionResponse_default_instance_.Shutdown();
delete ScatterRegionResponse_reflection_;
GetGCSafePointRequest_default_instance_.Shutdown();
delete GetGCSafePointRequest_reflection_;
GetGCSafePointResponse_default_instance_.Shutdown();
delete GetGCSafePointResponse_reflection_;
UpdateGCSafePointRequest_default_instance_.Shutdown();
delete UpdateGCSafePointRequest_reflection_;
UpdateGCSafePointResponse_default_instance_.Shutdown();
delete UpdateGCSafePointResponse_reflection_;
SyncRegionRequest_default_instance_.Shutdown();
delete SyncRegionRequest_reflection_;
SyncRegionResponse_default_instance_.Shutdown();
delete SyncRegionResponse_reflection_;
}
void protobuf_InitDefaults_pdpb_2eproto_impl() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
::metapb::protobuf_InitDefaults_metapb_2eproto();
::eraftpb::protobuf_InitDefaults_eraftpb_2eproto();
::gogoproto::protobuf_InitDefaults_gogoproto_2fgogo_2eproto();
RequestHeader_default_instance_.DefaultConstruct();
ResponseHeader_default_instance_.DefaultConstruct();
::google::protobuf::internal::GetEmptyString();
Error_default_instance_.DefaultConstruct();
TsoRequest_default_instance_.DefaultConstruct();
Timestamp_default_instance_.DefaultConstruct();
TsoResponse_default_instance_.DefaultConstruct();
BootstrapRequest_default_instance_.DefaultConstruct();
BootstrapResponse_default_instance_.DefaultConstruct();
IsBootstrappedRequest_default_instance_.DefaultConstruct();
IsBootstrappedResponse_default_instance_.DefaultConstruct();
AllocIDRequest_default_instance_.DefaultConstruct();
AllocIDResponse_default_instance_.DefaultConstruct();
GetStoreRequest_default_instance_.DefaultConstruct();
GetStoreResponse_default_instance_.DefaultConstruct();
PutStoreRequest_default_instance_.DefaultConstruct();
PutStoreResponse_default_instance_.DefaultConstruct();
GetAllStoresRequest_default_instance_.DefaultConstruct();
GetAllStoresResponse_default_instance_.DefaultConstruct();
::google::protobuf::internal::GetEmptyString();
GetRegionRequest_default_instance_.DefaultConstruct();
GetRegionResponse_default_instance_.DefaultConstruct();
GetRegionByIDRequest_default_instance_.DefaultConstruct();
GetClusterConfigRequest_default_instance_.DefaultConstruct();
GetClusterConfigResponse_default_instance_.DefaultConstruct();
PutClusterConfigRequest_default_instance_.DefaultConstruct();
PutClusterConfigResponse_default_instance_.DefaultConstruct();
::google::protobuf::internal::GetEmptyString();
Member_default_instance_.DefaultConstruct();
GetMembersRequest_default_instance_.DefaultConstruct();
GetMembersResponse_default_instance_.DefaultConstruct();
PeerStats_default_instance_.DefaultConstruct();
RegionHeartbeatRequest_default_instance_.DefaultConstruct();
ChangePeer_default_instance_.DefaultConstruct();
TransferLeader_default_instance_.DefaultConstruct();
Merge_default_instance_.DefaultConstruct();
SplitRegion_default_instance_.DefaultConstruct();
RegionHeartbeatResponse_default_instance_.DefaultConstruct();
AskSplitRequest_default_instance_.DefaultConstruct();
AskSplitResponse_default_instance_.DefaultConstruct();
ReportSplitRequest_default_instance_.DefaultConstruct();
ReportSplitResponse_default_instance_.DefaultConstruct();
AskBatchSplitRequest_default_instance_.DefaultConstruct();
SplitID_default_instance_.DefaultConstruct();
AskBatchSplitResponse_default_instance_.DefaultConstruct();
ReportBatchSplitRequest_default_instance_.DefaultConstruct();
ReportBatchSplitResponse_default_instance_.DefaultConstruct();
TimeInterval_default_instance_.DefaultConstruct();
StoreStats_default_instance_.DefaultConstruct();
StoreHeartbeatRequest_default_instance_.DefaultConstruct();
StoreHeartbeatResponse_default_instance_.DefaultConstruct();
ScatterRegionRequest_default_instance_.DefaultConstruct();
ScatterRegionResponse_default_instance_.DefaultConstruct();
GetGCSafePointRequest_default_instance_.DefaultConstruct();
GetGCSafePointResponse_default_instance_.DefaultConstruct();
UpdateGCSafePointRequest_default_instance_.DefaultConstruct();
UpdateGCSafePointResponse_default_instance_.DefaultConstruct();
SyncRegionRequest_default_instance_.DefaultConstruct();
SyncRegionResponse_default_instance_.DefaultConstruct();
RequestHeader_default_instance_.get_mutable()->InitAsDefaultInstance();
ResponseHeader_default_instance_.get_mutable()->InitAsDefaultInstance();
Error_default_instance_.get_mutable()->InitAsDefaultInstance();
TsoRequest_default_instance_.get_mutable()->InitAsDefaultInstance();
Timestamp_default_instance_.get_mutable()->InitAsDefaultInstance();
TsoResponse_default_instance_.get_mutable()->InitAsDefaultInstance();
BootstrapRequest_default_instance_.get_mutable()->InitAsDefaultInstance();
BootstrapResponse_default_instance_.get_mutable()->InitAsDefaultInstance();
IsBootstrappedRequest_default_instance_.get_mutable()->InitAsDefaultInstance();
IsBootstrappedResponse_default_instance_.get_mutable()->InitAsDefaultInstance();
AllocIDRequest_default_instance_.get_mutable()->InitAsDefaultInstance();
AllocIDResponse_default_instance_.get_mutable()->InitAsDefaultInstance();
GetStoreRequest_default_instance_.get_mutable()->InitAsDefaultInstance();
GetStoreResponse_default_instance_.get_mutable()->InitAsDefaultInstance();
PutStoreRequest_default_instance_.get_mutable()->InitAsDefaultInstance();
PutStoreResponse_default_instance_.get_mutable()->InitAsDefaultInstance();
GetAllStoresRequest_default_instance_.get_mutable()->InitAsDefaultInstance();
GetAllStoresResponse_default_instance_.get_mutable()->InitAsDefaultInstance();
GetRegionRequest_default_instance_.get_mutable()->InitAsDefaultInstance();
GetRegionResponse_default_instance_.get_mutable()->InitAsDefaultInstance();
GetRegionByIDRequest_default_instance_.get_mutable()->InitAsDefaultInstance();
GetClusterConfigRequest_default_instance_.get_mutable()->InitAsDefaultInstance();
GetClusterConfigResponse_default_instance_.get_mutable()->InitAsDefaultInstance();
PutClusterConfigRequest_default_instance_.get_mutable()->InitAsDefaultInstance();
PutClusterConfigResponse_default_instance_.get_mutable()->InitAsDefaultInstance();
Member_default_instance_.get_mutable()->InitAsDefaultInstance();
GetMembersRequest_default_instance_.get_mutable()->InitAsDefaultInstance();
GetMembersResponse_default_instance_.get_mutable()->InitAsDefaultInstance();
PeerStats_default_instance_.get_mutable()->InitAsDefaultInstance();
RegionHeartbeatRequest_default_instance_.get_mutable()->InitAsDefaultInstance();
ChangePeer_default_instance_.get_mutable()->InitAsDefaultInstance();
TransferLeader_default_instance_.get_mutable()->InitAsDefaultInstance();
Merge_default_instance_.get_mutable()->InitAsDefaultInstance();
SplitRegion_default_instance_.get_mutable()->InitAsDefaultInstance();
RegionHeartbeatResponse_default_instance_.get_mutable()->InitAsDefaultInstance();
AskSplitRequest_default_instance_.get_mutable()->InitAsDefaultInstance();
AskSplitResponse_default_instance_.get_mutable()->InitAsDefaultInstance();
ReportSplitRequest_default_instance_.get_mutable()->InitAsDefaultInstance();
ReportSplitResponse_default_instance_.get_mutable()->InitAsDefaultInstance();
AskBatchSplitRequest_default_instance_.get_mutable()->InitAsDefaultInstance();
SplitID_default_instance_.get_mutable()->InitAsDefaultInstance();
AskBatchSplitResponse_default_instance_.get_mutable()->InitAsDefaultInstance();
ReportBatchSplitRequest_default_instance_.get_mutable()->InitAsDefaultInstance();
ReportBatchSplitResponse_default_instance_.get_mutable()->InitAsDefaultInstance();
TimeInterval_default_instance_.get_mutable()->InitAsDefaultInstance();
StoreStats_default_instance_.get_mutable()->InitAsDefaultInstance();
StoreHeartbeatRequest_default_instance_.get_mutable()->InitAsDefaultInstance();
StoreHeartbeatResponse_default_instance_.get_mutable()->InitAsDefaultInstance();
ScatterRegionRequest_default_instance_.get_mutable()->InitAsDefaultInstance();
ScatterRegionResponse_default_instance_.get_mutable()->InitAsDefaultInstance();
GetGCSafePointRequest_default_instance_.get_mutable()->InitAsDefaultInstance();
GetGCSafePointResponse_default_instance_.get_mutable()->InitAsDefaultInstance();
UpdateGCSafePointRequest_default_instance_.get_mutable()->InitAsDefaultInstance();
UpdateGCSafePointResponse_default_instance_.get_mutable()->InitAsDefaultInstance();
SyncRegionRequest_default_instance_.get_mutable()->InitAsDefaultInstance();
SyncRegionResponse_default_instance_.get_mutable()->InitAsDefaultInstance();
}
GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_InitDefaults_pdpb_2eproto_once_);
void protobuf_InitDefaults_pdpb_2eproto() {
::google::protobuf::GoogleOnceInit(&protobuf_InitDefaults_pdpb_2eproto_once_,
&protobuf_InitDefaults_pdpb_2eproto_impl);
}
void protobuf_AddDesc_pdpb_2eproto_impl() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
protobuf_InitDefaults_pdpb_2eproto();
::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
"\n\npdpb.proto\022\004pdpb\032\014metapb.proto\032\reraftp"
"b.proto\032\024gogoproto/gogo.proto\"#\n\rRequest"
"Header\022\022\n\ncluster_id\030\001 \001(\004\"@\n\016ResponseHe"
"ader\022\022\n\ncluster_id\030\001 \001(\004\022\032\n\005error\030\002 \001(\0132"
"\013.pdpb.Error\"7\n\005Error\022\035\n\004type\030\001 \001(\0162\017.pd"
"pb.ErrorType\022\017\n\007message\030\002 \001(\t\"@\n\nTsoRequ"
"est\022#\n\006header\030\001 \001(\0132\023.pdpb.RequestHeader"
"\022\r\n\005count\030\002 \001(\r\".\n\tTimestamp\022\020\n\010physical"
"\030\001 \001(\003\022\017\n\007logical\030\002 \001(\003\"f\n\013TsoResponse\022$"
"\n\006header\030\001 \001(\0132\024.pdpb.ResponseHeader\022\r\n\005"
"count\030\002 \001(\r\022\"\n\ttimestamp\030\003 \001(\0132\017.pdpb.Ti"
"mestamp\"u\n\020BootstrapRequest\022#\n\006header\030\001 "
"\001(\0132\023.pdpb.RequestHeader\022\034\n\005store\030\002 \001(\0132"
"\r.metapb.Store\022\036\n\006region\030\003 \001(\0132\016.metapb."
"Region\"9\n\021BootstrapResponse\022$\n\006header\030\001 "
"\001(\0132\024.pdpb.ResponseHeader\"<\n\025IsBootstrap"
"pedRequest\022#\n\006header\030\001 \001(\0132\023.pdpb.Reques"
"tHeader\"T\n\026IsBootstrappedResponse\022$\n\006hea"
"der\030\001 \001(\0132\024.pdpb.ResponseHeader\022\024\n\014boots"
"trapped\030\002 \001(\010\"5\n\016AllocIDRequest\022#\n\006heade"
"r\030\001 \001(\0132\023.pdpb.RequestHeader\"C\n\017AllocIDR"
"esponse\022$\n\006header\030\001 \001(\0132\024.pdpb.ResponseH"
"eader\022\n\n\002id\030\002 \001(\004\"H\n\017GetStoreRequest\022#\n\006"
"header\030\001 \001(\0132\023.pdpb.RequestHeader\022\020\n\010sto"
"re_id\030\002 \001(\004\"V\n\020GetStoreResponse\022$\n\006heade"
"r\030\001 \001(\0132\024.pdpb.ResponseHeader\022\034\n\005store\030\002"
" \001(\0132\r.metapb.Store\"T\n\017PutStoreRequest\022#"
"\n\006header\030\001 \001(\0132\023.pdpb.RequestHeader\022\034\n\005s"
"tore\030\002 \001(\0132\r.metapb.Store\"8\n\020PutStoreRes"
"ponse\022$\n\006header\030\001 \001(\0132\024.pdpb.ResponseHea"
"der\":\n\023GetAllStoresRequest\022#\n\006header\030\001 \001"
"(\0132\023.pdpb.RequestHeader\"[\n\024GetAllStoresR"
"esponse\022$\n\006header\030\001 \001(\0132\024.pdpb.ResponseH"
"eader\022\035\n\006stores\030\002 \003(\0132\r.metapb.Store\"K\n\020"
"GetRegionRequest\022#\n\006header\030\001 \001(\0132\023.pdpb."
"RequestHeader\022\022\n\nregion_key\030\002 \001(\014\"w\n\021Get"
"RegionResponse\022$\n\006header\030\001 \001(\0132\024.pdpb.Re"
"sponseHeader\022\036\n\006region\030\002 \001(\0132\016.metapb.Re"
"gion\022\034\n\006leader\030\003 \001(\0132\014.metapb.Peer\"N\n\024Ge"
"tRegionByIDRequest\022#\n\006header\030\001 \001(\0132\023.pdp"
"b.RequestHeader\022\021\n\tregion_id\030\002 \001(\004\">\n\027Ge"
"tClusterConfigRequest\022#\n\006header\030\001 \001(\0132\023."
"pdpb.RequestHeader\"b\n\030GetClusterConfigRe"
"sponse\022$\n\006header\030\001 \001(\0132\024.pdpb.ResponseHe"
"ader\022 \n\007cluster\030\002 \001(\0132\017.metapb.Cluster\"`"
"\n\027PutClusterConfigRequest\022#\n\006header\030\001 \001("
"\0132\023.pdpb.RequestHeader\022 \n\007cluster\030\002 \001(\0132"
"\017.metapb.Cluster\"@\n\030PutClusterConfigResp"
"onse\022$\n\006header\030\001 \001(\0132\024.pdpb.ResponseHead"
"er\"j\n\006Member\022\014\n\004name\030\001 \001(\t\022\021\n\tmember_id\030"
"\002 \001(\004\022\021\n\tpeer_urls\030\003 \003(\t\022\023\n\013client_urls\030"
"\004 \003(\t\022\027\n\017leader_priority\030\005 \001(\005\"8\n\021GetMem"
"bersRequest\022#\n\006header\030\001 \001(\0132\023.pdpb.Reque"
"stHeader\"\232\001\n\022GetMembersResponse\022$\n\006heade"
"r\030\001 \001(\0132\024.pdpb.ResponseHeader\022\035\n\007members"
"\030\002 \003(\0132\014.pdpb.Member\022\034\n\006leader\030\003 \001(\0132\014.p"
"dpb.Member\022!\n\013etcd_leader\030\004 \001(\0132\014.pdpb.M"
"ember\"=\n\tPeerStats\022\032\n\004peer\030\001 \001(\0132\014.metap"
"b.Peer\022\024\n\014down_seconds\030\002 \001(\004\"\371\002\n\026RegionH"
"eartbeatRequest\022#\n\006header\030\001 \001(\0132\023.pdpb.R"
"equestHeader\022\036\n\006region\030\002 \001(\0132\016.metapb.Re"
"gion\022\034\n\006leader\030\003 \001(\0132\014.metapb.Peer\022#\n\ndo"
"wn_peers\030\004 \003(\0132\017.pdpb.PeerStats\022#\n\rpendi"
"ng_peers\030\005 \003(\0132\014.metapb.Peer\022\025\n\rbytes_wr"
"itten\030\006 \001(\004\022\022\n\nbytes_read\030\007 \001(\004\022\024\n\014keys_"
"written\030\010 \001(\004\022\021\n\tkeys_read\030\t \001(\004\022\030\n\020appr"
"oximate_size\030\n \001(\004\022$\n\010interval\030\014 \001(\0132\022.p"
"dpb.TimeInterval\022\030\n\020approximate_keys\030\r \001"
"(\004J\004\010\013\020\014\"V\n\nChangePeer\022\032\n\004peer\030\001 \001(\0132\014.m"
"etapb.Peer\022,\n\013change_type\030\002 \001(\0162\027.eraftp"
"b.ConfChangeType\",\n\016TransferLeader\022\032\n\004pe"
"er\030\001 \001(\0132\014.metapb.Peer\"\'\n\005Merge\022\036\n\006targe"
"t\030\001 \001(\0132\016.metapb.Region\"0\n\013SplitRegion\022!"
"\n\006policy\030\001 \001(\0162\021.pdpb.CheckPolicy\"\273\002\n\027Re"
"gionHeartbeatResponse\022$\n\006header\030\001 \001(\0132\024."
"pdpb.ResponseHeader\022%\n\013change_peer\030\002 \001(\013"
"2\020.pdpb.ChangePeer\022-\n\017transfer_leader\030\003 "
"\001(\0132\024.pdpb.TransferLeader\022\021\n\tregion_id\030\004"
" \001(\004\022)\n\014region_epoch\030\005 \001(\0132\023.metapb.Regi"
"onEpoch\022!\n\013target_peer\030\006 \001(\0132\014.metapb.Pe"
"er\022\032\n\005merge\030\007 \001(\0132\013.pdpb.Merge\022\'\n\014split_"
"region\030\010 \001(\0132\021.pdpb.SplitRegion\"V\n\017AskSp"
"litRequest\022#\n\006header\030\001 \001(\0132\023.pdpb.Reques"
"tHeader\022\036\n\006region\030\002 \001(\0132\016.metapb.Region\""
"e\n\020AskSplitResponse\022$\n\006header\030\001 \001(\0132\024.pd"
"pb.ResponseHeader\022\025\n\rnew_region_id\030\002 \001(\004"
"\022\024\n\014new_peer_ids\030\003 \003(\004\"v\n\022ReportSplitReq"
"uest\022#\n\006header\030\001 \001(\0132\023.pdpb.RequestHeade"
"r\022\034\n\004left\030\002 \001(\0132\016.metapb.Region\022\035\n\005right"
"\030\003 \001(\0132\016.metapb.Region\";\n\023ReportSplitRes"
"ponse\022$\n\006header\030\001 \001(\0132\024.pdpb.ResponseHea"
"der\"p\n\024AskBatchSplitRequest\022#\n\006header\030\001 "
"\001(\0132\023.pdpb.RequestHeader\022\036\n\006region\030\002 \001(\013"
"2\016.metapb.Region\022\023\n\013split_count\030\003 \001(\r\"6\n"
"\007SplitID\022\025\n\rnew_region_id\030\001 \001(\004\022\024\n\014new_p"
"eer_ids\030\002 \003(\004\"Y\n\025AskBatchSplitResponse\022$"
"\n\006header\030\001 \001(\0132\024.pdpb.ResponseHeader\022\032\n\003"
"ids\030\002 \003(\0132\r.pdpb.SplitID\"_\n\027ReportBatchS"
"plitRequest\022#\n\006header\030\001 \001(\0132\023.pdpb.Reque"
"stHeader\022\037\n\007regions\030\002 \003(\0132\016.metapb.Regio"
"n\"@\n\030ReportBatchSplitResponse\022$\n\006header\030"
"\001 \001(\0132\024.pdpb.ResponseHeader\">\n\014TimeInter"
"val\022\027\n\017start_timestamp\030\001 \001(\004\022\025\n\rend_time"
"stamp\030\002 \001(\004\"\342\002\n\nStoreStats\022\020\n\010store_id\030\001"
" \001(\004\022\020\n\010capacity\030\002 \001(\004\022\021\n\tavailable\030\003 \001("
"\004\022\024\n\014region_count\030\004 \001(\r\022\032\n\022sending_snap_"
"count\030\005 \001(\r\022\034\n\024receiving_snap_count\030\006 \001("
"\r\022\022\n\nstart_time\030\007 \001(\r\022\033\n\023applying_snap_c"
"ount\030\010 \001(\r\022\017\n\007is_busy\030\t \001(\010\022\021\n\tused_size"
"\030\n \001(\004\022\025\n\rbytes_written\030\013 \001(\004\022\024\n\014keys_wr"
"itten\030\014 \001(\004\022\022\n\nbytes_read\030\r \001(\004\022\021\n\tkeys_"
"read\030\016 \001(\004\022$\n\010interval\030\017 \001(\0132\022.pdpb.Time"
"Interval\"]\n\025StoreHeartbeatRequest\022#\n\006hea"
"der\030\001 \001(\0132\023.pdpb.RequestHeader\022\037\n\005stats\030"
"\002 \001(\0132\020.pdpb.StoreStats\">\n\026StoreHeartbea"
"tResponse\022$\n\006header\030\001 \001(\0132\024.pdpb.Respons"
"eHeader\"\214\001\n\024ScatterRegionRequest\022#\n\006head"
"er\030\001 \001(\0132\023.pdpb.RequestHeader\022\021\n\tregion_"
"id\030\002 \001(\004\022\036\n\006region\030\003 \001(\0132\016.metapb.Region"
"\022\034\n\006leader\030\004 \001(\0132\014.metapb.Peer\"=\n\025Scatte"
"rRegionResponse\022$\n\006header\030\001 \001(\0132\024.pdpb.R"
"esponseHeader\"<\n\025GetGCSafePointRequest\022#"
"\n\006header\030\001 \001(\0132\023.pdpb.RequestHeader\"R\n\026G"
"etGCSafePointResponse\022$\n\006header\030\001 \001(\0132\024."
"pdpb.ResponseHeader\022\022\n\nsafe_point\030\002 \001(\004\""
"S\n\030UpdateGCSafePointRequest\022#\n\006header\030\001 "
"\001(\0132\023.pdpb.RequestHeader\022\022\n\nsafe_point\030\002"
" \001(\004\"Y\n\031UpdateGCSafePointResponse\022$\n\006hea"
"der\030\001 \001(\0132\024.pdpb.ResponseHeader\022\026\n\016new_s"
"afe_point\030\002 \001(\004\"V\n\021SyncRegionRequest\022#\n\006"
"header\030\001 \001(\0132\023.pdpb.RequestHeader\022\034\n\006mem"
"ber\030\002 \001(\0132\014.pdpb.Member\"[\n\022SyncRegionRes"
"ponse\022$\n\006header\030\001 \001(\0132\024.pdpb.ResponseHea"
"der\022\037\n\007regions\030\002 \003(\0132\016.metapb.Region*\177\n\t"
"ErrorType\022\006\n\002OK\020\000\022\013\n\007UNKNOWN\020\001\022\024\n\020NOT_BO"
"OTSTRAPPED\020\002\022\023\n\017STORE_TOMBSTONE\020\003\022\030\n\024ALR"
"EADY_BOOTSTRAPPED\020\004\022\030\n\024INCOMPATIBLE_VERS"
"ION\020\005*(\n\013CheckPolicy\022\010\n\004SCAN\020\000\022\017\n\013APPROX"
"IMATE\020\0012\205\r\n\002PD\022A\n\nGetMembers\022\027.pdpb.GetM"
"embersRequest\032\030.pdpb.GetMembersResponse\""
"\000\0220\n\003Tso\022\020.pdpb.TsoRequest\032\021.pdpb.TsoRes"
"ponse\"\000(\0010\001\022>\n\tBootstrap\022\026.pdpb.Bootstra"
"pRequest\032\027.pdpb.BootstrapResponse\"\000\022M\n\016I"
"sBootstrapped\022\033.pdpb.IsBootstrappedReque"
"st\032\034.pdpb.IsBootstrappedResponse\"\000\0228\n\007Al"
"locID\022\024.pdpb.AllocIDRequest\032\025.pdpb.Alloc"
"IDResponse\"\000\022;\n\010GetStore\022\025.pdpb.GetStore"
"Request\032\026.pdpb.GetStoreResponse\"\000\022;\n\010Put"
"Store\022\025.pdpb.PutStoreRequest\032\026.pdpb.PutS"
"toreResponse\"\000\022G\n\014GetAllStores\022\031.pdpb.Ge"
"tAllStoresRequest\032\032.pdpb.GetAllStoresRes"
"ponse\"\000\022M\n\016StoreHeartbeat\022\033.pdpb.StoreHe"
"artbeatRequest\032\034.pdpb.StoreHeartbeatResp"
"onse\"\000\022T\n\017RegionHeartbeat\022\034.pdpb.RegionH"
"eartbeatRequest\032\035.pdpb.RegionHeartbeatRe"
"sponse\"\000(\0010\001\022>\n\tGetRegion\022\026.pdpb.GetRegi"
"onRequest\032\027.pdpb.GetRegionResponse\"\000\022B\n\r"
"GetPrevRegion\022\026.pdpb.GetRegionRequest\032\027."
"pdpb.GetRegionResponse\"\000\022F\n\rGetRegionByI"
"D\022\032.pdpb.GetRegionByIDRequest\032\027.pdpb.Get"
"RegionResponse\"\000\022>\n\010AskSplit\022\025.pdpb.AskS"
"plitRequest\032\026.pdpb.AskSplitResponse\"\003\210\002\001"
"\022G\n\013ReportSplit\022\030.pdpb.ReportSplitReques"
"t\032\031.pdpb.ReportSplitResponse\"\003\210\002\001\022J\n\rAsk"
"BatchSplit\022\032.pdpb.AskBatchSplitRequest\032\033"
".pdpb.AskBatchSplitResponse\"\000\022S\n\020ReportB"
"atchSplit\022\035.pdpb.ReportBatchSplitRequest"
"\032\036.pdpb.ReportBatchSplitResponse\"\000\022S\n\020Ge"
"tClusterConfig\022\035.pdpb.GetClusterConfigRe"
"quest\032\036.pdpb.GetClusterConfigResponse\"\000\022"
"S\n\020PutClusterConfig\022\035.pdpb.PutClusterCon"
"figRequest\032\036.pdpb.PutClusterConfigRespon"
"se\"\000\022J\n\rScatterRegion\022\032.pdpb.ScatterRegi"
"onRequest\032\033.pdpb.ScatterRegionResponse\"\000"
"\022M\n\016GetGCSafePoint\022\033.pdpb.GetGCSafePoint"
"Request\032\034.pdpb.GetGCSafePointResponse\"\000\022"
"V\n\021UpdateGCSafePoint\022\036.pdpb.UpdateGCSafe"
"PointRequest\032\037.pdpb.UpdateGCSafePointRes"
"ponse\"\000\022F\n\013SyncRegions\022\027.pdpb.SyncRegion"
"Request\032\030.pdpb.SyncRegionResponse\"\000(\0010\001B"
"&\n\030com.pingcap.tikv.kvproto\340\342\036\001\310\342\036\001\320\342\036\001b"
"\006proto3", 7247);
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"pdpb.proto", &protobuf_RegisterTypes);
::metapb::protobuf_AddDesc_metapb_2eproto();
::eraftpb::protobuf_AddDesc_eraftpb_2eproto();
::gogoproto::protobuf_AddDesc_gogoproto_2fgogo_2eproto();
::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_pdpb_2eproto);
}
GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AddDesc_pdpb_2eproto_once_);
void protobuf_AddDesc_pdpb_2eproto() {
::google::protobuf::GoogleOnceInit(&protobuf_AddDesc_pdpb_2eproto_once_,
&protobuf_AddDesc_pdpb_2eproto_impl);
}
// Force AddDescriptors() to be called at static initialization time.
struct StaticDescriptorInitializer_pdpb_2eproto {
StaticDescriptorInitializer_pdpb_2eproto() {
protobuf_AddDesc_pdpb_2eproto();
}
} static_descriptor_initializer_pdpb_2eproto_;
const ::google::protobuf::EnumDescriptor* ErrorType_descriptor() {
protobuf_AssignDescriptorsOnce();
return ErrorType_descriptor_;
}
bool ErrorType_IsValid(int value) {
switch (value) {
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
return true;
default:
return false;
}
}
const ::google::protobuf::EnumDescriptor* CheckPolicy_descriptor() {
protobuf_AssignDescriptorsOnce();
return CheckPolicy_descriptor_;
}
bool CheckPolicy_IsValid(int value) {
switch (value) {
case 0:
case 1:
return true;
default:
return false;
}
}
namespace {
static void MergeFromFail(int line) GOOGLE_ATTRIBUTE_COLD GOOGLE_ATTRIBUTE_NORETURN;
static void MergeFromFail(int line) {
::google::protobuf::internal::MergeFromFail(__FILE__, line);
}
} // namespace
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int RequestHeader::kClusterIdFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
RequestHeader::RequestHeader()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.RequestHeader)
}
void RequestHeader::InitAsDefaultInstance() {
}
RequestHeader::RequestHeader(const RequestHeader& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.RequestHeader)
}
void RequestHeader::SharedCtor() {
cluster_id_ = GOOGLE_ULONGLONG(0);
_cached_size_ = 0;
}
RequestHeader::~RequestHeader() {
// @@protoc_insertion_point(destructor:pdpb.RequestHeader)
SharedDtor();
}
void RequestHeader::SharedDtor() {
}
void RequestHeader::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* RequestHeader::descriptor() {
protobuf_AssignDescriptorsOnce();
return RequestHeader_descriptor_;
}
const RequestHeader& RequestHeader::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<RequestHeader> RequestHeader_default_instance_;
RequestHeader* RequestHeader::New(::google::protobuf::Arena* arena) const {
RequestHeader* n = new RequestHeader;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void RequestHeader::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.RequestHeader)
cluster_id_ = GOOGLE_ULONGLONG(0);
}
bool RequestHeader::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.RequestHeader)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint64 cluster_id = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &cluster_id_)));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.RequestHeader)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.RequestHeader)
return false;
#undef DO_
}
void RequestHeader::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.RequestHeader)
// optional uint64 cluster_id = 1;
if (this->cluster_id() != 0) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(1, this->cluster_id(), output);
}
// @@protoc_insertion_point(serialize_end:pdpb.RequestHeader)
}
::google::protobuf::uint8* RequestHeader::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.RequestHeader)
// optional uint64 cluster_id = 1;
if (this->cluster_id() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(1, this->cluster_id(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.RequestHeader)
return target;
}
size_t RequestHeader::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.RequestHeader)
size_t total_size = 0;
// optional uint64 cluster_id = 1;
if (this->cluster_id() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->cluster_id());
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void RequestHeader::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.RequestHeader)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const RequestHeader* source =
::google::protobuf::internal::DynamicCastToGenerated<const RequestHeader>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.RequestHeader)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.RequestHeader)
UnsafeMergeFrom(*source);
}
}
void RequestHeader::MergeFrom(const RequestHeader& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.RequestHeader)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void RequestHeader::UnsafeMergeFrom(const RequestHeader& from) {
GOOGLE_DCHECK(&from != this);
if (from.cluster_id() != 0) {
set_cluster_id(from.cluster_id());
}
}
void RequestHeader::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.RequestHeader)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void RequestHeader::CopyFrom(const RequestHeader& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.RequestHeader)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool RequestHeader::IsInitialized() const {
return true;
}
void RequestHeader::Swap(RequestHeader* other) {
if (other == this) return;
InternalSwap(other);
}
void RequestHeader::InternalSwap(RequestHeader* other) {
std::swap(cluster_id_, other->cluster_id_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata RequestHeader::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = RequestHeader_descriptor_;
metadata.reflection = RequestHeader_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// RequestHeader
// optional uint64 cluster_id = 1;
void RequestHeader::clear_cluster_id() {
cluster_id_ = GOOGLE_ULONGLONG(0);
}
::google::protobuf::uint64 RequestHeader::cluster_id() const {
// @@protoc_insertion_point(field_get:pdpb.RequestHeader.cluster_id)
return cluster_id_;
}
void RequestHeader::set_cluster_id(::google::protobuf::uint64 value) {
cluster_id_ = value;
// @@protoc_insertion_point(field_set:pdpb.RequestHeader.cluster_id)
}
inline const RequestHeader* RequestHeader::internal_default_instance() {
return &RequestHeader_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int ResponseHeader::kClusterIdFieldNumber;
const int ResponseHeader::kErrorFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
ResponseHeader::ResponseHeader()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.ResponseHeader)
}
void ResponseHeader::InitAsDefaultInstance() {
error_ = const_cast< ::pdpb::Error*>(
::pdpb::Error::internal_default_instance());
}
ResponseHeader::ResponseHeader(const ResponseHeader& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.ResponseHeader)
}
void ResponseHeader::SharedCtor() {
error_ = NULL;
cluster_id_ = GOOGLE_ULONGLONG(0);
_cached_size_ = 0;
}
ResponseHeader::~ResponseHeader() {
// @@protoc_insertion_point(destructor:pdpb.ResponseHeader)
SharedDtor();
}
void ResponseHeader::SharedDtor() {
if (this != &ResponseHeader_default_instance_.get()) {
delete error_;
}
}
void ResponseHeader::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* ResponseHeader::descriptor() {
protobuf_AssignDescriptorsOnce();
return ResponseHeader_descriptor_;
}
const ResponseHeader& ResponseHeader::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<ResponseHeader> ResponseHeader_default_instance_;
ResponseHeader* ResponseHeader::New(::google::protobuf::Arena* arena) const {
ResponseHeader* n = new ResponseHeader;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void ResponseHeader::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.ResponseHeader)
cluster_id_ = GOOGLE_ULONGLONG(0);
if (GetArenaNoVirtual() == NULL && error_ != NULL) delete error_;
error_ = NULL;
}
bool ResponseHeader::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.ResponseHeader)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint64 cluster_id = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &cluster_id_)));
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_error;
break;
}
// optional .pdpb.Error error = 2;
case 2: {
if (tag == 18) {
parse_error:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_error()));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.ResponseHeader)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.ResponseHeader)
return false;
#undef DO_
}
void ResponseHeader::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.ResponseHeader)
// optional uint64 cluster_id = 1;
if (this->cluster_id() != 0) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(1, this->cluster_id(), output);
}
// optional .pdpb.Error error = 2;
if (this->has_error()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, *this->error_, output);
}
// @@protoc_insertion_point(serialize_end:pdpb.ResponseHeader)
}
::google::protobuf::uint8* ResponseHeader::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.ResponseHeader)
// optional uint64 cluster_id = 1;
if (this->cluster_id() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(1, this->cluster_id(), target);
}
// optional .pdpb.Error error = 2;
if (this->has_error()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
2, *this->error_, false, target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.ResponseHeader)
return target;
}
size_t ResponseHeader::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.ResponseHeader)
size_t total_size = 0;
// optional uint64 cluster_id = 1;
if (this->cluster_id() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->cluster_id());
}
// optional .pdpb.Error error = 2;
if (this->has_error()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->error_);
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void ResponseHeader::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.ResponseHeader)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const ResponseHeader* source =
::google::protobuf::internal::DynamicCastToGenerated<const ResponseHeader>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.ResponseHeader)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.ResponseHeader)
UnsafeMergeFrom(*source);
}
}
void ResponseHeader::MergeFrom(const ResponseHeader& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.ResponseHeader)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void ResponseHeader::UnsafeMergeFrom(const ResponseHeader& from) {
GOOGLE_DCHECK(&from != this);
if (from.cluster_id() != 0) {
set_cluster_id(from.cluster_id());
}
if (from.has_error()) {
mutable_error()->::pdpb::Error::MergeFrom(from.error());
}
}
void ResponseHeader::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.ResponseHeader)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void ResponseHeader::CopyFrom(const ResponseHeader& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.ResponseHeader)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool ResponseHeader::IsInitialized() const {
return true;
}
void ResponseHeader::Swap(ResponseHeader* other) {
if (other == this) return;
InternalSwap(other);
}
void ResponseHeader::InternalSwap(ResponseHeader* other) {
std::swap(cluster_id_, other->cluster_id_);
std::swap(error_, other->error_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata ResponseHeader::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = ResponseHeader_descriptor_;
metadata.reflection = ResponseHeader_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// ResponseHeader
// optional uint64 cluster_id = 1;
void ResponseHeader::clear_cluster_id() {
cluster_id_ = GOOGLE_ULONGLONG(0);
}
::google::protobuf::uint64 ResponseHeader::cluster_id() const {
// @@protoc_insertion_point(field_get:pdpb.ResponseHeader.cluster_id)
return cluster_id_;
}
void ResponseHeader::set_cluster_id(::google::protobuf::uint64 value) {
cluster_id_ = value;
// @@protoc_insertion_point(field_set:pdpb.ResponseHeader.cluster_id)
}
// optional .pdpb.Error error = 2;
bool ResponseHeader::has_error() const {
return this != internal_default_instance() && error_ != NULL;
}
void ResponseHeader::clear_error() {
if (GetArenaNoVirtual() == NULL && error_ != NULL) delete error_;
error_ = NULL;
}
const ::pdpb::Error& ResponseHeader::error() const {
// @@protoc_insertion_point(field_get:pdpb.ResponseHeader.error)
return error_ != NULL ? *error_
: *::pdpb::Error::internal_default_instance();
}
::pdpb::Error* ResponseHeader::mutable_error() {
if (error_ == NULL) {
error_ = new ::pdpb::Error;
}
// @@protoc_insertion_point(field_mutable:pdpb.ResponseHeader.error)
return error_;
}
::pdpb::Error* ResponseHeader::release_error() {
// @@protoc_insertion_point(field_release:pdpb.ResponseHeader.error)
::pdpb::Error* temp = error_;
error_ = NULL;
return temp;
}
void ResponseHeader::set_allocated_error(::pdpb::Error* error) {
delete error_;
error_ = error;
if (error) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.ResponseHeader.error)
}
inline const ResponseHeader* ResponseHeader::internal_default_instance() {
return &ResponseHeader_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int Error::kTypeFieldNumber;
const int Error::kMessageFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
Error::Error()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.Error)
}
void Error::InitAsDefaultInstance() {
}
Error::Error(const Error& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.Error)
}
void Error::SharedCtor() {
message_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
type_ = 0;
_cached_size_ = 0;
}
Error::~Error() {
// @@protoc_insertion_point(destructor:pdpb.Error)
SharedDtor();
}
void Error::SharedDtor() {
message_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void Error::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* Error::descriptor() {
protobuf_AssignDescriptorsOnce();
return Error_descriptor_;
}
const Error& Error::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<Error> Error_default_instance_;
Error* Error::New(::google::protobuf::Arena* arena) const {
Error* n = new Error;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void Error::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.Error)
type_ = 0;
message_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
bool Error::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.Error)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .pdpb.ErrorType type = 1;
case 1: {
if (tag == 8) {
int value;
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
input, &value)));
set_type(static_cast< ::pdpb::ErrorType >(value));
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_message;
break;
}
// optional string message = 2;
case 2: {
if (tag == 18) {
parse_message:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_message()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->message().data(), this->message().length(),
::google::protobuf::internal::WireFormatLite::PARSE,
"pdpb.Error.message"));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.Error)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.Error)
return false;
#undef DO_
}
void Error::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.Error)
// optional .pdpb.ErrorType type = 1;
if (this->type() != 0) {
::google::protobuf::internal::WireFormatLite::WriteEnum(
1, this->type(), output);
}
// optional string message = 2;
if (this->message().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->message().data(), this->message().length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"pdpb.Error.message");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
2, this->message(), output);
}
// @@protoc_insertion_point(serialize_end:pdpb.Error)
}
::google::protobuf::uint8* Error::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.Error)
// optional .pdpb.ErrorType type = 1;
if (this->type() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
1, this->type(), target);
}
// optional string message = 2;
if (this->message().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->message().data(), this->message().length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"pdpb.Error.message");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
2, this->message(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.Error)
return target;
}
size_t Error::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.Error)
size_t total_size = 0;
// optional .pdpb.ErrorType type = 1;
if (this->type() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::EnumSize(this->type());
}
// optional string message = 2;
if (this->message().size() > 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->message());
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void Error::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.Error)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const Error* source =
::google::protobuf::internal::DynamicCastToGenerated<const Error>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.Error)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.Error)
UnsafeMergeFrom(*source);
}
}
void Error::MergeFrom(const Error& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.Error)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void Error::UnsafeMergeFrom(const Error& from) {
GOOGLE_DCHECK(&from != this);
if (from.type() != 0) {
set_type(from.type());
}
if (from.message().size() > 0) {
message_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.message_);
}
}
void Error::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.Error)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void Error::CopyFrom(const Error& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.Error)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool Error::IsInitialized() const {
return true;
}
void Error::Swap(Error* other) {
if (other == this) return;
InternalSwap(other);
}
void Error::InternalSwap(Error* other) {
std::swap(type_, other->type_);
message_.Swap(&other->message_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata Error::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = Error_descriptor_;
metadata.reflection = Error_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// Error
// optional .pdpb.ErrorType type = 1;
void Error::clear_type() {
type_ = 0;
}
::pdpb::ErrorType Error::type() const {
// @@protoc_insertion_point(field_get:pdpb.Error.type)
return static_cast< ::pdpb::ErrorType >(type_);
}
void Error::set_type(::pdpb::ErrorType value) {
type_ = value;
// @@protoc_insertion_point(field_set:pdpb.Error.type)
}
// optional string message = 2;
void Error::clear_message() {
message_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
const ::std::string& Error::message() const {
// @@protoc_insertion_point(field_get:pdpb.Error.message)
return message_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void Error::set_message(const ::std::string& value) {
message_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:pdpb.Error.message)
}
void Error::set_message(const char* value) {
message_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:pdpb.Error.message)
}
void Error::set_message(const char* value, size_t size) {
message_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:pdpb.Error.message)
}
::std::string* Error::mutable_message() {
// @@protoc_insertion_point(field_mutable:pdpb.Error.message)
return message_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
::std::string* Error::release_message() {
// @@protoc_insertion_point(field_release:pdpb.Error.message)
return message_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void Error::set_allocated_message(::std::string* message) {
if (message != NULL) {
} else {
}
message_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), message);
// @@protoc_insertion_point(field_set_allocated:pdpb.Error.message)
}
inline const Error* Error::internal_default_instance() {
return &Error_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int TsoRequest::kHeaderFieldNumber;
const int TsoRequest::kCountFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
TsoRequest::TsoRequest()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.TsoRequest)
}
void TsoRequest::InitAsDefaultInstance() {
header_ = const_cast< ::pdpb::RequestHeader*>(
::pdpb::RequestHeader::internal_default_instance());
}
TsoRequest::TsoRequest(const TsoRequest& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.TsoRequest)
}
void TsoRequest::SharedCtor() {
header_ = NULL;
count_ = 0u;
_cached_size_ = 0;
}
TsoRequest::~TsoRequest() {
// @@protoc_insertion_point(destructor:pdpb.TsoRequest)
SharedDtor();
}
void TsoRequest::SharedDtor() {
if (this != &TsoRequest_default_instance_.get()) {
delete header_;
}
}
void TsoRequest::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* TsoRequest::descriptor() {
protobuf_AssignDescriptorsOnce();
return TsoRequest_descriptor_;
}
const TsoRequest& TsoRequest::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<TsoRequest> TsoRequest_default_instance_;
TsoRequest* TsoRequest::New(::google::protobuf::Arena* arena) const {
TsoRequest* n = new TsoRequest;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void TsoRequest::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.TsoRequest)
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
count_ = 0u;
}
bool TsoRequest::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.TsoRequest)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .pdpb.RequestHeader header = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_header()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_count;
break;
}
// optional uint32 count = 2;
case 2: {
if (tag == 16) {
parse_count:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &count_)));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.TsoRequest)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.TsoRequest)
return false;
#undef DO_
}
void TsoRequest::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.TsoRequest)
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->header_, output);
}
// optional uint32 count = 2;
if (this->count() != 0) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->count(), output);
}
// @@protoc_insertion_point(serialize_end:pdpb.TsoRequest)
}
::google::protobuf::uint8* TsoRequest::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.TsoRequest)
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->header_, false, target);
}
// optional uint32 count = 2;
if (this->count() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->count(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.TsoRequest)
return target;
}
size_t TsoRequest::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.TsoRequest)
size_t total_size = 0;
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->header_);
}
// optional uint32 count = 2;
if (this->count() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->count());
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void TsoRequest::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.TsoRequest)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const TsoRequest* source =
::google::protobuf::internal::DynamicCastToGenerated<const TsoRequest>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.TsoRequest)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.TsoRequest)
UnsafeMergeFrom(*source);
}
}
void TsoRequest::MergeFrom(const TsoRequest& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.TsoRequest)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void TsoRequest::UnsafeMergeFrom(const TsoRequest& from) {
GOOGLE_DCHECK(&from != this);
if (from.has_header()) {
mutable_header()->::pdpb::RequestHeader::MergeFrom(from.header());
}
if (from.count() != 0) {
set_count(from.count());
}
}
void TsoRequest::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.TsoRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void TsoRequest::CopyFrom(const TsoRequest& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.TsoRequest)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool TsoRequest::IsInitialized() const {
return true;
}
void TsoRequest::Swap(TsoRequest* other) {
if (other == this) return;
InternalSwap(other);
}
void TsoRequest::InternalSwap(TsoRequest* other) {
std::swap(header_, other->header_);
std::swap(count_, other->count_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata TsoRequest::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = TsoRequest_descriptor_;
metadata.reflection = TsoRequest_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// TsoRequest
// optional .pdpb.RequestHeader header = 1;
bool TsoRequest::has_header() const {
return this != internal_default_instance() && header_ != NULL;
}
void TsoRequest::clear_header() {
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
const ::pdpb::RequestHeader& TsoRequest::header() const {
// @@protoc_insertion_point(field_get:pdpb.TsoRequest.header)
return header_ != NULL ? *header_
: *::pdpb::RequestHeader::internal_default_instance();
}
::pdpb::RequestHeader* TsoRequest::mutable_header() {
if (header_ == NULL) {
header_ = new ::pdpb::RequestHeader;
}
// @@protoc_insertion_point(field_mutable:pdpb.TsoRequest.header)
return header_;
}
::pdpb::RequestHeader* TsoRequest::release_header() {
// @@protoc_insertion_point(field_release:pdpb.TsoRequest.header)
::pdpb::RequestHeader* temp = header_;
header_ = NULL;
return temp;
}
void TsoRequest::set_allocated_header(::pdpb::RequestHeader* header) {
delete header_;
header_ = header;
if (header) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.TsoRequest.header)
}
// optional uint32 count = 2;
void TsoRequest::clear_count() {
count_ = 0u;
}
::google::protobuf::uint32 TsoRequest::count() const {
// @@protoc_insertion_point(field_get:pdpb.TsoRequest.count)
return count_;
}
void TsoRequest::set_count(::google::protobuf::uint32 value) {
count_ = value;
// @@protoc_insertion_point(field_set:pdpb.TsoRequest.count)
}
inline const TsoRequest* TsoRequest::internal_default_instance() {
return &TsoRequest_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int Timestamp::kPhysicalFieldNumber;
const int Timestamp::kLogicalFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
Timestamp::Timestamp()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.Timestamp)
}
void Timestamp::InitAsDefaultInstance() {
}
Timestamp::Timestamp(const Timestamp& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.Timestamp)
}
void Timestamp::SharedCtor() {
::memset(&physical_, 0, reinterpret_cast<char*>(&logical_) -
reinterpret_cast<char*>(&physical_) + sizeof(logical_));
_cached_size_ = 0;
}
Timestamp::~Timestamp() {
// @@protoc_insertion_point(destructor:pdpb.Timestamp)
SharedDtor();
}
void Timestamp::SharedDtor() {
}
void Timestamp::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* Timestamp::descriptor() {
protobuf_AssignDescriptorsOnce();
return Timestamp_descriptor_;
}
const Timestamp& Timestamp::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<Timestamp> Timestamp_default_instance_;
Timestamp* Timestamp::New(::google::protobuf::Arena* arena) const {
Timestamp* n = new Timestamp;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void Timestamp::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.Timestamp)
#if defined(__clang__)
#define ZR_HELPER_(f) \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Winvalid-offsetof\"") \
__builtin_offsetof(Timestamp, f) \
_Pragma("clang diagnostic pop")
#else
#define ZR_HELPER_(f) reinterpret_cast<char*>(\
&reinterpret_cast<Timestamp*>(16)->f)
#endif
#define ZR_(first, last) do {\
::memset(&(first), 0,\
ZR_HELPER_(last) - ZR_HELPER_(first) + sizeof(last));\
} while (0)
ZR_(physical_, logical_);
#undef ZR_HELPER_
#undef ZR_
}
bool Timestamp::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.Timestamp)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional int64 physical = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>(
input, &physical_)));
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_logical;
break;
}
// optional int64 logical = 2;
case 2: {
if (tag == 16) {
parse_logical:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>(
input, &logical_)));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.Timestamp)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.Timestamp)
return false;
#undef DO_
}
void Timestamp::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.Timestamp)
// optional int64 physical = 1;
if (this->physical() != 0) {
::google::protobuf::internal::WireFormatLite::WriteInt64(1, this->physical(), output);
}
// optional int64 logical = 2;
if (this->logical() != 0) {
::google::protobuf::internal::WireFormatLite::WriteInt64(2, this->logical(), output);
}
// @@protoc_insertion_point(serialize_end:pdpb.Timestamp)
}
::google::protobuf::uint8* Timestamp::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.Timestamp)
// optional int64 physical = 1;
if (this->physical() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteInt64ToArray(1, this->physical(), target);
}
// optional int64 logical = 2;
if (this->logical() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteInt64ToArray(2, this->logical(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.Timestamp)
return target;
}
size_t Timestamp::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.Timestamp)
size_t total_size = 0;
// optional int64 physical = 1;
if (this->physical() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::Int64Size(
this->physical());
}
// optional int64 logical = 2;
if (this->logical() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::Int64Size(
this->logical());
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void Timestamp::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.Timestamp)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const Timestamp* source =
::google::protobuf::internal::DynamicCastToGenerated<const Timestamp>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.Timestamp)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.Timestamp)
UnsafeMergeFrom(*source);
}
}
void Timestamp::MergeFrom(const Timestamp& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.Timestamp)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void Timestamp::UnsafeMergeFrom(const Timestamp& from) {
GOOGLE_DCHECK(&from != this);
if (from.physical() != 0) {
set_physical(from.physical());
}
if (from.logical() != 0) {
set_logical(from.logical());
}
}
void Timestamp::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.Timestamp)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void Timestamp::CopyFrom(const Timestamp& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.Timestamp)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool Timestamp::IsInitialized() const {
return true;
}
void Timestamp::Swap(Timestamp* other) {
if (other == this) return;
InternalSwap(other);
}
void Timestamp::InternalSwap(Timestamp* other) {
std::swap(physical_, other->physical_);
std::swap(logical_, other->logical_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata Timestamp::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = Timestamp_descriptor_;
metadata.reflection = Timestamp_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// Timestamp
// optional int64 physical = 1;
void Timestamp::clear_physical() {
physical_ = GOOGLE_LONGLONG(0);
}
::google::protobuf::int64 Timestamp::physical() const {
// @@protoc_insertion_point(field_get:pdpb.Timestamp.physical)
return physical_;
}
void Timestamp::set_physical(::google::protobuf::int64 value) {
physical_ = value;
// @@protoc_insertion_point(field_set:pdpb.Timestamp.physical)
}
// optional int64 logical = 2;
void Timestamp::clear_logical() {
logical_ = GOOGLE_LONGLONG(0);
}
::google::protobuf::int64 Timestamp::logical() const {
// @@protoc_insertion_point(field_get:pdpb.Timestamp.logical)
return logical_;
}
void Timestamp::set_logical(::google::protobuf::int64 value) {
logical_ = value;
// @@protoc_insertion_point(field_set:pdpb.Timestamp.logical)
}
inline const Timestamp* Timestamp::internal_default_instance() {
return &Timestamp_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int TsoResponse::kHeaderFieldNumber;
const int TsoResponse::kCountFieldNumber;
const int TsoResponse::kTimestampFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
TsoResponse::TsoResponse()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.TsoResponse)
}
void TsoResponse::InitAsDefaultInstance() {
header_ = const_cast< ::pdpb::ResponseHeader*>(
::pdpb::ResponseHeader::internal_default_instance());
timestamp_ = const_cast< ::pdpb::Timestamp*>(
::pdpb::Timestamp::internal_default_instance());
}
TsoResponse::TsoResponse(const TsoResponse& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.TsoResponse)
}
void TsoResponse::SharedCtor() {
header_ = NULL;
timestamp_ = NULL;
count_ = 0u;
_cached_size_ = 0;
}
TsoResponse::~TsoResponse() {
// @@protoc_insertion_point(destructor:pdpb.TsoResponse)
SharedDtor();
}
void TsoResponse::SharedDtor() {
if (this != &TsoResponse_default_instance_.get()) {
delete header_;
delete timestamp_;
}
}
void TsoResponse::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* TsoResponse::descriptor() {
protobuf_AssignDescriptorsOnce();
return TsoResponse_descriptor_;
}
const TsoResponse& TsoResponse::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<TsoResponse> TsoResponse_default_instance_;
TsoResponse* TsoResponse::New(::google::protobuf::Arena* arena) const {
TsoResponse* n = new TsoResponse;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void TsoResponse::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.TsoResponse)
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
count_ = 0u;
if (GetArenaNoVirtual() == NULL && timestamp_ != NULL) delete timestamp_;
timestamp_ = NULL;
}
bool TsoResponse::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.TsoResponse)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .pdpb.ResponseHeader header = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_header()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_count;
break;
}
// optional uint32 count = 2;
case 2: {
if (tag == 16) {
parse_count:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &count_)));
} else {
goto handle_unusual;
}
if (input->ExpectTag(26)) goto parse_timestamp;
break;
}
// optional .pdpb.Timestamp timestamp = 3;
case 3: {
if (tag == 26) {
parse_timestamp:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_timestamp()));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.TsoResponse)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.TsoResponse)
return false;
#undef DO_
}
void TsoResponse::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.TsoResponse)
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->header_, output);
}
// optional uint32 count = 2;
if (this->count() != 0) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->count(), output);
}
// optional .pdpb.Timestamp timestamp = 3;
if (this->has_timestamp()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, *this->timestamp_, output);
}
// @@protoc_insertion_point(serialize_end:pdpb.TsoResponse)
}
::google::protobuf::uint8* TsoResponse::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.TsoResponse)
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->header_, false, target);
}
// optional uint32 count = 2;
if (this->count() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->count(), target);
}
// optional .pdpb.Timestamp timestamp = 3;
if (this->has_timestamp()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
3, *this->timestamp_, false, target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.TsoResponse)
return target;
}
size_t TsoResponse::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.TsoResponse)
size_t total_size = 0;
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->header_);
}
// optional uint32 count = 2;
if (this->count() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->count());
}
// optional .pdpb.Timestamp timestamp = 3;
if (this->has_timestamp()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->timestamp_);
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void TsoResponse::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.TsoResponse)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const TsoResponse* source =
::google::protobuf::internal::DynamicCastToGenerated<const TsoResponse>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.TsoResponse)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.TsoResponse)
UnsafeMergeFrom(*source);
}
}
void TsoResponse::MergeFrom(const TsoResponse& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.TsoResponse)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void TsoResponse::UnsafeMergeFrom(const TsoResponse& from) {
GOOGLE_DCHECK(&from != this);
if (from.has_header()) {
mutable_header()->::pdpb::ResponseHeader::MergeFrom(from.header());
}
if (from.count() != 0) {
set_count(from.count());
}
if (from.has_timestamp()) {
mutable_timestamp()->::pdpb::Timestamp::MergeFrom(from.timestamp());
}
}
void TsoResponse::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.TsoResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void TsoResponse::CopyFrom(const TsoResponse& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.TsoResponse)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool TsoResponse::IsInitialized() const {
return true;
}
void TsoResponse::Swap(TsoResponse* other) {
if (other == this) return;
InternalSwap(other);
}
void TsoResponse::InternalSwap(TsoResponse* other) {
std::swap(header_, other->header_);
std::swap(count_, other->count_);
std::swap(timestamp_, other->timestamp_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata TsoResponse::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = TsoResponse_descriptor_;
metadata.reflection = TsoResponse_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// TsoResponse
// optional .pdpb.ResponseHeader header = 1;
bool TsoResponse::has_header() const {
return this != internal_default_instance() && header_ != NULL;
}
void TsoResponse::clear_header() {
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
const ::pdpb::ResponseHeader& TsoResponse::header() const {
// @@protoc_insertion_point(field_get:pdpb.TsoResponse.header)
return header_ != NULL ? *header_
: *::pdpb::ResponseHeader::internal_default_instance();
}
::pdpb::ResponseHeader* TsoResponse::mutable_header() {
if (header_ == NULL) {
header_ = new ::pdpb::ResponseHeader;
}
// @@protoc_insertion_point(field_mutable:pdpb.TsoResponse.header)
return header_;
}
::pdpb::ResponseHeader* TsoResponse::release_header() {
// @@protoc_insertion_point(field_release:pdpb.TsoResponse.header)
::pdpb::ResponseHeader* temp = header_;
header_ = NULL;
return temp;
}
void TsoResponse::set_allocated_header(::pdpb::ResponseHeader* header) {
delete header_;
header_ = header;
if (header) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.TsoResponse.header)
}
// optional uint32 count = 2;
void TsoResponse::clear_count() {
count_ = 0u;
}
::google::protobuf::uint32 TsoResponse::count() const {
// @@protoc_insertion_point(field_get:pdpb.TsoResponse.count)
return count_;
}
void TsoResponse::set_count(::google::protobuf::uint32 value) {
count_ = value;
// @@protoc_insertion_point(field_set:pdpb.TsoResponse.count)
}
// optional .pdpb.Timestamp timestamp = 3;
bool TsoResponse::has_timestamp() const {
return this != internal_default_instance() && timestamp_ != NULL;
}
void TsoResponse::clear_timestamp() {
if (GetArenaNoVirtual() == NULL && timestamp_ != NULL) delete timestamp_;
timestamp_ = NULL;
}
const ::pdpb::Timestamp& TsoResponse::timestamp() const {
// @@protoc_insertion_point(field_get:pdpb.TsoResponse.timestamp)
return timestamp_ != NULL ? *timestamp_
: *::pdpb::Timestamp::internal_default_instance();
}
::pdpb::Timestamp* TsoResponse::mutable_timestamp() {
if (timestamp_ == NULL) {
timestamp_ = new ::pdpb::Timestamp;
}
// @@protoc_insertion_point(field_mutable:pdpb.TsoResponse.timestamp)
return timestamp_;
}
::pdpb::Timestamp* TsoResponse::release_timestamp() {
// @@protoc_insertion_point(field_release:pdpb.TsoResponse.timestamp)
::pdpb::Timestamp* temp = timestamp_;
timestamp_ = NULL;
return temp;
}
void TsoResponse::set_allocated_timestamp(::pdpb::Timestamp* timestamp) {
delete timestamp_;
timestamp_ = timestamp;
if (timestamp) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.TsoResponse.timestamp)
}
inline const TsoResponse* TsoResponse::internal_default_instance() {
return &TsoResponse_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int BootstrapRequest::kHeaderFieldNumber;
const int BootstrapRequest::kStoreFieldNumber;
const int BootstrapRequest::kRegionFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
BootstrapRequest::BootstrapRequest()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.BootstrapRequest)
}
void BootstrapRequest::InitAsDefaultInstance() {
header_ = const_cast< ::pdpb::RequestHeader*>(
::pdpb::RequestHeader::internal_default_instance());
store_ = const_cast< ::metapb::Store*>(
::metapb::Store::internal_default_instance());
region_ = const_cast< ::metapb::Region*>(
::metapb::Region::internal_default_instance());
}
BootstrapRequest::BootstrapRequest(const BootstrapRequest& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.BootstrapRequest)
}
void BootstrapRequest::SharedCtor() {
header_ = NULL;
store_ = NULL;
region_ = NULL;
_cached_size_ = 0;
}
BootstrapRequest::~BootstrapRequest() {
// @@protoc_insertion_point(destructor:pdpb.BootstrapRequest)
SharedDtor();
}
void BootstrapRequest::SharedDtor() {
if (this != &BootstrapRequest_default_instance_.get()) {
delete header_;
delete store_;
delete region_;
}
}
void BootstrapRequest::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* BootstrapRequest::descriptor() {
protobuf_AssignDescriptorsOnce();
return BootstrapRequest_descriptor_;
}
const BootstrapRequest& BootstrapRequest::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<BootstrapRequest> BootstrapRequest_default_instance_;
BootstrapRequest* BootstrapRequest::New(::google::protobuf::Arena* arena) const {
BootstrapRequest* n = new BootstrapRequest;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void BootstrapRequest::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.BootstrapRequest)
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
if (GetArenaNoVirtual() == NULL && store_ != NULL) delete store_;
store_ = NULL;
if (GetArenaNoVirtual() == NULL && region_ != NULL) delete region_;
region_ = NULL;
}
bool BootstrapRequest::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.BootstrapRequest)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .pdpb.RequestHeader header = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_header()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_store;
break;
}
// optional .metapb.Store store = 2;
case 2: {
if (tag == 18) {
parse_store:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_store()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(26)) goto parse_region;
break;
}
// optional .metapb.Region region = 3;
case 3: {
if (tag == 26) {
parse_region:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_region()));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.BootstrapRequest)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.BootstrapRequest)
return false;
#undef DO_
}
void BootstrapRequest::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.BootstrapRequest)
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->header_, output);
}
// optional .metapb.Store store = 2;
if (this->has_store()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, *this->store_, output);
}
// optional .metapb.Region region = 3;
if (this->has_region()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, *this->region_, output);
}
// @@protoc_insertion_point(serialize_end:pdpb.BootstrapRequest)
}
::google::protobuf::uint8* BootstrapRequest::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.BootstrapRequest)
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->header_, false, target);
}
// optional .metapb.Store store = 2;
if (this->has_store()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
2, *this->store_, false, target);
}
// optional .metapb.Region region = 3;
if (this->has_region()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
3, *this->region_, false, target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.BootstrapRequest)
return target;
}
size_t BootstrapRequest::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.BootstrapRequest)
size_t total_size = 0;
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->header_);
}
// optional .metapb.Store store = 2;
if (this->has_store()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->store_);
}
// optional .metapb.Region region = 3;
if (this->has_region()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->region_);
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void BootstrapRequest::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.BootstrapRequest)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const BootstrapRequest* source =
::google::protobuf::internal::DynamicCastToGenerated<const BootstrapRequest>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.BootstrapRequest)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.BootstrapRequest)
UnsafeMergeFrom(*source);
}
}
void BootstrapRequest::MergeFrom(const BootstrapRequest& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.BootstrapRequest)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void BootstrapRequest::UnsafeMergeFrom(const BootstrapRequest& from) {
GOOGLE_DCHECK(&from != this);
if (from.has_header()) {
mutable_header()->::pdpb::RequestHeader::MergeFrom(from.header());
}
if (from.has_store()) {
mutable_store()->::metapb::Store::MergeFrom(from.store());
}
if (from.has_region()) {
mutable_region()->::metapb::Region::MergeFrom(from.region());
}
}
void BootstrapRequest::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.BootstrapRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void BootstrapRequest::CopyFrom(const BootstrapRequest& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.BootstrapRequest)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool BootstrapRequest::IsInitialized() const {
return true;
}
void BootstrapRequest::Swap(BootstrapRequest* other) {
if (other == this) return;
InternalSwap(other);
}
void BootstrapRequest::InternalSwap(BootstrapRequest* other) {
std::swap(header_, other->header_);
std::swap(store_, other->store_);
std::swap(region_, other->region_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata BootstrapRequest::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = BootstrapRequest_descriptor_;
metadata.reflection = BootstrapRequest_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// BootstrapRequest
// optional .pdpb.RequestHeader header = 1;
bool BootstrapRequest::has_header() const {
return this != internal_default_instance() && header_ != NULL;
}
void BootstrapRequest::clear_header() {
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
const ::pdpb::RequestHeader& BootstrapRequest::header() const {
// @@protoc_insertion_point(field_get:pdpb.BootstrapRequest.header)
return header_ != NULL ? *header_
: *::pdpb::RequestHeader::internal_default_instance();
}
::pdpb::RequestHeader* BootstrapRequest::mutable_header() {
if (header_ == NULL) {
header_ = new ::pdpb::RequestHeader;
}
// @@protoc_insertion_point(field_mutable:pdpb.BootstrapRequest.header)
return header_;
}
::pdpb::RequestHeader* BootstrapRequest::release_header() {
// @@protoc_insertion_point(field_release:pdpb.BootstrapRequest.header)
::pdpb::RequestHeader* temp = header_;
header_ = NULL;
return temp;
}
void BootstrapRequest::set_allocated_header(::pdpb::RequestHeader* header) {
delete header_;
header_ = header;
if (header) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.BootstrapRequest.header)
}
// optional .metapb.Store store = 2;
bool BootstrapRequest::has_store() const {
return this != internal_default_instance() && store_ != NULL;
}
void BootstrapRequest::clear_store() {
if (GetArenaNoVirtual() == NULL && store_ != NULL) delete store_;
store_ = NULL;
}
const ::metapb::Store& BootstrapRequest::store() const {
// @@protoc_insertion_point(field_get:pdpb.BootstrapRequest.store)
return store_ != NULL ? *store_
: *::metapb::Store::internal_default_instance();
}
::metapb::Store* BootstrapRequest::mutable_store() {
if (store_ == NULL) {
store_ = new ::metapb::Store;
}
// @@protoc_insertion_point(field_mutable:pdpb.BootstrapRequest.store)
return store_;
}
::metapb::Store* BootstrapRequest::release_store() {
// @@protoc_insertion_point(field_release:pdpb.BootstrapRequest.store)
::metapb::Store* temp = store_;
store_ = NULL;
return temp;
}
void BootstrapRequest::set_allocated_store(::metapb::Store* store) {
delete store_;
store_ = store;
if (store) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.BootstrapRequest.store)
}
// optional .metapb.Region region = 3;
bool BootstrapRequest::has_region() const {
return this != internal_default_instance() && region_ != NULL;
}
void BootstrapRequest::clear_region() {
if (GetArenaNoVirtual() == NULL && region_ != NULL) delete region_;
region_ = NULL;
}
const ::metapb::Region& BootstrapRequest::region() const {
// @@protoc_insertion_point(field_get:pdpb.BootstrapRequest.region)
return region_ != NULL ? *region_
: *::metapb::Region::internal_default_instance();
}
::metapb::Region* BootstrapRequest::mutable_region() {
if (region_ == NULL) {
region_ = new ::metapb::Region;
}
// @@protoc_insertion_point(field_mutable:pdpb.BootstrapRequest.region)
return region_;
}
::metapb::Region* BootstrapRequest::release_region() {
// @@protoc_insertion_point(field_release:pdpb.BootstrapRequest.region)
::metapb::Region* temp = region_;
region_ = NULL;
return temp;
}
void BootstrapRequest::set_allocated_region(::metapb::Region* region) {
delete region_;
region_ = region;
if (region) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.BootstrapRequest.region)
}
inline const BootstrapRequest* BootstrapRequest::internal_default_instance() {
return &BootstrapRequest_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int BootstrapResponse::kHeaderFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
BootstrapResponse::BootstrapResponse()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.BootstrapResponse)
}
void BootstrapResponse::InitAsDefaultInstance() {
header_ = const_cast< ::pdpb::ResponseHeader*>(
::pdpb::ResponseHeader::internal_default_instance());
}
BootstrapResponse::BootstrapResponse(const BootstrapResponse& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.BootstrapResponse)
}
void BootstrapResponse::SharedCtor() {
header_ = NULL;
_cached_size_ = 0;
}
BootstrapResponse::~BootstrapResponse() {
// @@protoc_insertion_point(destructor:pdpb.BootstrapResponse)
SharedDtor();
}
void BootstrapResponse::SharedDtor() {
if (this != &BootstrapResponse_default_instance_.get()) {
delete header_;
}
}
void BootstrapResponse::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* BootstrapResponse::descriptor() {
protobuf_AssignDescriptorsOnce();
return BootstrapResponse_descriptor_;
}
const BootstrapResponse& BootstrapResponse::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<BootstrapResponse> BootstrapResponse_default_instance_;
BootstrapResponse* BootstrapResponse::New(::google::protobuf::Arena* arena) const {
BootstrapResponse* n = new BootstrapResponse;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void BootstrapResponse::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.BootstrapResponse)
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
bool BootstrapResponse::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.BootstrapResponse)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .pdpb.ResponseHeader header = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_header()));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.BootstrapResponse)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.BootstrapResponse)
return false;
#undef DO_
}
void BootstrapResponse::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.BootstrapResponse)
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->header_, output);
}
// @@protoc_insertion_point(serialize_end:pdpb.BootstrapResponse)
}
::google::protobuf::uint8* BootstrapResponse::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.BootstrapResponse)
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->header_, false, target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.BootstrapResponse)
return target;
}
size_t BootstrapResponse::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.BootstrapResponse)
size_t total_size = 0;
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->header_);
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void BootstrapResponse::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.BootstrapResponse)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const BootstrapResponse* source =
::google::protobuf::internal::DynamicCastToGenerated<const BootstrapResponse>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.BootstrapResponse)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.BootstrapResponse)
UnsafeMergeFrom(*source);
}
}
void BootstrapResponse::MergeFrom(const BootstrapResponse& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.BootstrapResponse)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void BootstrapResponse::UnsafeMergeFrom(const BootstrapResponse& from) {
GOOGLE_DCHECK(&from != this);
if (from.has_header()) {
mutable_header()->::pdpb::ResponseHeader::MergeFrom(from.header());
}
}
void BootstrapResponse::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.BootstrapResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void BootstrapResponse::CopyFrom(const BootstrapResponse& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.BootstrapResponse)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool BootstrapResponse::IsInitialized() const {
return true;
}
void BootstrapResponse::Swap(BootstrapResponse* other) {
if (other == this) return;
InternalSwap(other);
}
void BootstrapResponse::InternalSwap(BootstrapResponse* other) {
std::swap(header_, other->header_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata BootstrapResponse::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = BootstrapResponse_descriptor_;
metadata.reflection = BootstrapResponse_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// BootstrapResponse
// optional .pdpb.ResponseHeader header = 1;
bool BootstrapResponse::has_header() const {
return this != internal_default_instance() && header_ != NULL;
}
void BootstrapResponse::clear_header() {
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
const ::pdpb::ResponseHeader& BootstrapResponse::header() const {
// @@protoc_insertion_point(field_get:pdpb.BootstrapResponse.header)
return header_ != NULL ? *header_
: *::pdpb::ResponseHeader::internal_default_instance();
}
::pdpb::ResponseHeader* BootstrapResponse::mutable_header() {
if (header_ == NULL) {
header_ = new ::pdpb::ResponseHeader;
}
// @@protoc_insertion_point(field_mutable:pdpb.BootstrapResponse.header)
return header_;
}
::pdpb::ResponseHeader* BootstrapResponse::release_header() {
// @@protoc_insertion_point(field_release:pdpb.BootstrapResponse.header)
::pdpb::ResponseHeader* temp = header_;
header_ = NULL;
return temp;
}
void BootstrapResponse::set_allocated_header(::pdpb::ResponseHeader* header) {
delete header_;
header_ = header;
if (header) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.BootstrapResponse.header)
}
inline const BootstrapResponse* BootstrapResponse::internal_default_instance() {
return &BootstrapResponse_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int IsBootstrappedRequest::kHeaderFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
IsBootstrappedRequest::IsBootstrappedRequest()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.IsBootstrappedRequest)
}
void IsBootstrappedRequest::InitAsDefaultInstance() {
header_ = const_cast< ::pdpb::RequestHeader*>(
::pdpb::RequestHeader::internal_default_instance());
}
IsBootstrappedRequest::IsBootstrappedRequest(const IsBootstrappedRequest& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.IsBootstrappedRequest)
}
void IsBootstrappedRequest::SharedCtor() {
header_ = NULL;
_cached_size_ = 0;
}
IsBootstrappedRequest::~IsBootstrappedRequest() {
// @@protoc_insertion_point(destructor:pdpb.IsBootstrappedRequest)
SharedDtor();
}
void IsBootstrappedRequest::SharedDtor() {
if (this != &IsBootstrappedRequest_default_instance_.get()) {
delete header_;
}
}
void IsBootstrappedRequest::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* IsBootstrappedRequest::descriptor() {
protobuf_AssignDescriptorsOnce();
return IsBootstrappedRequest_descriptor_;
}
const IsBootstrappedRequest& IsBootstrappedRequest::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<IsBootstrappedRequest> IsBootstrappedRequest_default_instance_;
IsBootstrappedRequest* IsBootstrappedRequest::New(::google::protobuf::Arena* arena) const {
IsBootstrappedRequest* n = new IsBootstrappedRequest;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void IsBootstrappedRequest::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.IsBootstrappedRequest)
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
bool IsBootstrappedRequest::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.IsBootstrappedRequest)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .pdpb.RequestHeader header = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_header()));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.IsBootstrappedRequest)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.IsBootstrappedRequest)
return false;
#undef DO_
}
void IsBootstrappedRequest::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.IsBootstrappedRequest)
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->header_, output);
}
// @@protoc_insertion_point(serialize_end:pdpb.IsBootstrappedRequest)
}
::google::protobuf::uint8* IsBootstrappedRequest::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.IsBootstrappedRequest)
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->header_, false, target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.IsBootstrappedRequest)
return target;
}
size_t IsBootstrappedRequest::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.IsBootstrappedRequest)
size_t total_size = 0;
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->header_);
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void IsBootstrappedRequest::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.IsBootstrappedRequest)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const IsBootstrappedRequest* source =
::google::protobuf::internal::DynamicCastToGenerated<const IsBootstrappedRequest>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.IsBootstrappedRequest)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.IsBootstrappedRequest)
UnsafeMergeFrom(*source);
}
}
void IsBootstrappedRequest::MergeFrom(const IsBootstrappedRequest& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.IsBootstrappedRequest)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void IsBootstrappedRequest::UnsafeMergeFrom(const IsBootstrappedRequest& from) {
GOOGLE_DCHECK(&from != this);
if (from.has_header()) {
mutable_header()->::pdpb::RequestHeader::MergeFrom(from.header());
}
}
void IsBootstrappedRequest::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.IsBootstrappedRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void IsBootstrappedRequest::CopyFrom(const IsBootstrappedRequest& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.IsBootstrappedRequest)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool IsBootstrappedRequest::IsInitialized() const {
return true;
}
void IsBootstrappedRequest::Swap(IsBootstrappedRequest* other) {
if (other == this) return;
InternalSwap(other);
}
void IsBootstrappedRequest::InternalSwap(IsBootstrappedRequest* other) {
std::swap(header_, other->header_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata IsBootstrappedRequest::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = IsBootstrappedRequest_descriptor_;
metadata.reflection = IsBootstrappedRequest_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// IsBootstrappedRequest
// optional .pdpb.RequestHeader header = 1;
bool IsBootstrappedRequest::has_header() const {
return this != internal_default_instance() && header_ != NULL;
}
void IsBootstrappedRequest::clear_header() {
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
const ::pdpb::RequestHeader& IsBootstrappedRequest::header() const {
// @@protoc_insertion_point(field_get:pdpb.IsBootstrappedRequest.header)
return header_ != NULL ? *header_
: *::pdpb::RequestHeader::internal_default_instance();
}
::pdpb::RequestHeader* IsBootstrappedRequest::mutable_header() {
if (header_ == NULL) {
header_ = new ::pdpb::RequestHeader;
}
// @@protoc_insertion_point(field_mutable:pdpb.IsBootstrappedRequest.header)
return header_;
}
::pdpb::RequestHeader* IsBootstrappedRequest::release_header() {
// @@protoc_insertion_point(field_release:pdpb.IsBootstrappedRequest.header)
::pdpb::RequestHeader* temp = header_;
header_ = NULL;
return temp;
}
void IsBootstrappedRequest::set_allocated_header(::pdpb::RequestHeader* header) {
delete header_;
header_ = header;
if (header) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.IsBootstrappedRequest.header)
}
inline const IsBootstrappedRequest* IsBootstrappedRequest::internal_default_instance() {
return &IsBootstrappedRequest_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int IsBootstrappedResponse::kHeaderFieldNumber;
const int IsBootstrappedResponse::kBootstrappedFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
IsBootstrappedResponse::IsBootstrappedResponse()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.IsBootstrappedResponse)
}
void IsBootstrappedResponse::InitAsDefaultInstance() {
header_ = const_cast< ::pdpb::ResponseHeader*>(
::pdpb::ResponseHeader::internal_default_instance());
}
IsBootstrappedResponse::IsBootstrappedResponse(const IsBootstrappedResponse& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.IsBootstrappedResponse)
}
void IsBootstrappedResponse::SharedCtor() {
header_ = NULL;
bootstrapped_ = false;
_cached_size_ = 0;
}
IsBootstrappedResponse::~IsBootstrappedResponse() {
// @@protoc_insertion_point(destructor:pdpb.IsBootstrappedResponse)
SharedDtor();
}
void IsBootstrappedResponse::SharedDtor() {
if (this != &IsBootstrappedResponse_default_instance_.get()) {
delete header_;
}
}
void IsBootstrappedResponse::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* IsBootstrappedResponse::descriptor() {
protobuf_AssignDescriptorsOnce();
return IsBootstrappedResponse_descriptor_;
}
const IsBootstrappedResponse& IsBootstrappedResponse::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<IsBootstrappedResponse> IsBootstrappedResponse_default_instance_;
IsBootstrappedResponse* IsBootstrappedResponse::New(::google::protobuf::Arena* arena) const {
IsBootstrappedResponse* n = new IsBootstrappedResponse;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void IsBootstrappedResponse::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.IsBootstrappedResponse)
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
bootstrapped_ = false;
}
bool IsBootstrappedResponse::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.IsBootstrappedResponse)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .pdpb.ResponseHeader header = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_header()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_bootstrapped;
break;
}
// optional bool bootstrapped = 2;
case 2: {
if (tag == 16) {
parse_bootstrapped:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &bootstrapped_)));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.IsBootstrappedResponse)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.IsBootstrappedResponse)
return false;
#undef DO_
}
void IsBootstrappedResponse::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.IsBootstrappedResponse)
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->header_, output);
}
// optional bool bootstrapped = 2;
if (this->bootstrapped() != 0) {
::google::protobuf::internal::WireFormatLite::WriteBool(2, this->bootstrapped(), output);
}
// @@protoc_insertion_point(serialize_end:pdpb.IsBootstrappedResponse)
}
::google::protobuf::uint8* IsBootstrappedResponse::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.IsBootstrappedResponse)
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->header_, false, target);
}
// optional bool bootstrapped = 2;
if (this->bootstrapped() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(2, this->bootstrapped(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.IsBootstrappedResponse)
return target;
}
size_t IsBootstrappedResponse::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.IsBootstrappedResponse)
size_t total_size = 0;
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->header_);
}
// optional bool bootstrapped = 2;
if (this->bootstrapped() != 0) {
total_size += 1 + 1;
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void IsBootstrappedResponse::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.IsBootstrappedResponse)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const IsBootstrappedResponse* source =
::google::protobuf::internal::DynamicCastToGenerated<const IsBootstrappedResponse>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.IsBootstrappedResponse)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.IsBootstrappedResponse)
UnsafeMergeFrom(*source);
}
}
void IsBootstrappedResponse::MergeFrom(const IsBootstrappedResponse& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.IsBootstrappedResponse)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void IsBootstrappedResponse::UnsafeMergeFrom(const IsBootstrappedResponse& from) {
GOOGLE_DCHECK(&from != this);
if (from.has_header()) {
mutable_header()->::pdpb::ResponseHeader::MergeFrom(from.header());
}
if (from.bootstrapped() != 0) {
set_bootstrapped(from.bootstrapped());
}
}
void IsBootstrappedResponse::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.IsBootstrappedResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void IsBootstrappedResponse::CopyFrom(const IsBootstrappedResponse& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.IsBootstrappedResponse)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool IsBootstrappedResponse::IsInitialized() const {
return true;
}
void IsBootstrappedResponse::Swap(IsBootstrappedResponse* other) {
if (other == this) return;
InternalSwap(other);
}
void IsBootstrappedResponse::InternalSwap(IsBootstrappedResponse* other) {
std::swap(header_, other->header_);
std::swap(bootstrapped_, other->bootstrapped_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata IsBootstrappedResponse::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = IsBootstrappedResponse_descriptor_;
metadata.reflection = IsBootstrappedResponse_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// IsBootstrappedResponse
// optional .pdpb.ResponseHeader header = 1;
bool IsBootstrappedResponse::has_header() const {
return this != internal_default_instance() && header_ != NULL;
}
void IsBootstrappedResponse::clear_header() {
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
const ::pdpb::ResponseHeader& IsBootstrappedResponse::header() const {
// @@protoc_insertion_point(field_get:pdpb.IsBootstrappedResponse.header)
return header_ != NULL ? *header_
: *::pdpb::ResponseHeader::internal_default_instance();
}
::pdpb::ResponseHeader* IsBootstrappedResponse::mutable_header() {
if (header_ == NULL) {
header_ = new ::pdpb::ResponseHeader;
}
// @@protoc_insertion_point(field_mutable:pdpb.IsBootstrappedResponse.header)
return header_;
}
::pdpb::ResponseHeader* IsBootstrappedResponse::release_header() {
// @@protoc_insertion_point(field_release:pdpb.IsBootstrappedResponse.header)
::pdpb::ResponseHeader* temp = header_;
header_ = NULL;
return temp;
}
void IsBootstrappedResponse::set_allocated_header(::pdpb::ResponseHeader* header) {
delete header_;
header_ = header;
if (header) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.IsBootstrappedResponse.header)
}
// optional bool bootstrapped = 2;
void IsBootstrappedResponse::clear_bootstrapped() {
bootstrapped_ = false;
}
bool IsBootstrappedResponse::bootstrapped() const {
// @@protoc_insertion_point(field_get:pdpb.IsBootstrappedResponse.bootstrapped)
return bootstrapped_;
}
void IsBootstrappedResponse::set_bootstrapped(bool value) {
bootstrapped_ = value;
// @@protoc_insertion_point(field_set:pdpb.IsBootstrappedResponse.bootstrapped)
}
inline const IsBootstrappedResponse* IsBootstrappedResponse::internal_default_instance() {
return &IsBootstrappedResponse_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int AllocIDRequest::kHeaderFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
AllocIDRequest::AllocIDRequest()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.AllocIDRequest)
}
void AllocIDRequest::InitAsDefaultInstance() {
header_ = const_cast< ::pdpb::RequestHeader*>(
::pdpb::RequestHeader::internal_default_instance());
}
AllocIDRequest::AllocIDRequest(const AllocIDRequest& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.AllocIDRequest)
}
void AllocIDRequest::SharedCtor() {
header_ = NULL;
_cached_size_ = 0;
}
AllocIDRequest::~AllocIDRequest() {
// @@protoc_insertion_point(destructor:pdpb.AllocIDRequest)
SharedDtor();
}
void AllocIDRequest::SharedDtor() {
if (this != &AllocIDRequest_default_instance_.get()) {
delete header_;
}
}
void AllocIDRequest::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* AllocIDRequest::descriptor() {
protobuf_AssignDescriptorsOnce();
return AllocIDRequest_descriptor_;
}
const AllocIDRequest& AllocIDRequest::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<AllocIDRequest> AllocIDRequest_default_instance_;
AllocIDRequest* AllocIDRequest::New(::google::protobuf::Arena* arena) const {
AllocIDRequest* n = new AllocIDRequest;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void AllocIDRequest::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.AllocIDRequest)
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
bool AllocIDRequest::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.AllocIDRequest)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .pdpb.RequestHeader header = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_header()));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.AllocIDRequest)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.AllocIDRequest)
return false;
#undef DO_
}
void AllocIDRequest::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.AllocIDRequest)
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->header_, output);
}
// @@protoc_insertion_point(serialize_end:pdpb.AllocIDRequest)
}
::google::protobuf::uint8* AllocIDRequest::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.AllocIDRequest)
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->header_, false, target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.AllocIDRequest)
return target;
}
size_t AllocIDRequest::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.AllocIDRequest)
size_t total_size = 0;
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->header_);
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void AllocIDRequest::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.AllocIDRequest)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const AllocIDRequest* source =
::google::protobuf::internal::DynamicCastToGenerated<const AllocIDRequest>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.AllocIDRequest)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.AllocIDRequest)
UnsafeMergeFrom(*source);
}
}
void AllocIDRequest::MergeFrom(const AllocIDRequest& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.AllocIDRequest)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void AllocIDRequest::UnsafeMergeFrom(const AllocIDRequest& from) {
GOOGLE_DCHECK(&from != this);
if (from.has_header()) {
mutable_header()->::pdpb::RequestHeader::MergeFrom(from.header());
}
}
void AllocIDRequest::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.AllocIDRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void AllocIDRequest::CopyFrom(const AllocIDRequest& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.AllocIDRequest)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool AllocIDRequest::IsInitialized() const {
return true;
}
void AllocIDRequest::Swap(AllocIDRequest* other) {
if (other == this) return;
InternalSwap(other);
}
void AllocIDRequest::InternalSwap(AllocIDRequest* other) {
std::swap(header_, other->header_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata AllocIDRequest::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = AllocIDRequest_descriptor_;
metadata.reflection = AllocIDRequest_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// AllocIDRequest
// optional .pdpb.RequestHeader header = 1;
bool AllocIDRequest::has_header() const {
return this != internal_default_instance() && header_ != NULL;
}
void AllocIDRequest::clear_header() {
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
const ::pdpb::RequestHeader& AllocIDRequest::header() const {
// @@protoc_insertion_point(field_get:pdpb.AllocIDRequest.header)
return header_ != NULL ? *header_
: *::pdpb::RequestHeader::internal_default_instance();
}
::pdpb::RequestHeader* AllocIDRequest::mutable_header() {
if (header_ == NULL) {
header_ = new ::pdpb::RequestHeader;
}
// @@protoc_insertion_point(field_mutable:pdpb.AllocIDRequest.header)
return header_;
}
::pdpb::RequestHeader* AllocIDRequest::release_header() {
// @@protoc_insertion_point(field_release:pdpb.AllocIDRequest.header)
::pdpb::RequestHeader* temp = header_;
header_ = NULL;
return temp;
}
void AllocIDRequest::set_allocated_header(::pdpb::RequestHeader* header) {
delete header_;
header_ = header;
if (header) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.AllocIDRequest.header)
}
inline const AllocIDRequest* AllocIDRequest::internal_default_instance() {
return &AllocIDRequest_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int AllocIDResponse::kHeaderFieldNumber;
const int AllocIDResponse::kIdFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
AllocIDResponse::AllocIDResponse()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.AllocIDResponse)
}
void AllocIDResponse::InitAsDefaultInstance() {
header_ = const_cast< ::pdpb::ResponseHeader*>(
::pdpb::ResponseHeader::internal_default_instance());
}
AllocIDResponse::AllocIDResponse(const AllocIDResponse& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.AllocIDResponse)
}
void AllocIDResponse::SharedCtor() {
header_ = NULL;
id_ = GOOGLE_ULONGLONG(0);
_cached_size_ = 0;
}
AllocIDResponse::~AllocIDResponse() {
// @@protoc_insertion_point(destructor:pdpb.AllocIDResponse)
SharedDtor();
}
void AllocIDResponse::SharedDtor() {
if (this != &AllocIDResponse_default_instance_.get()) {
delete header_;
}
}
void AllocIDResponse::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* AllocIDResponse::descriptor() {
protobuf_AssignDescriptorsOnce();
return AllocIDResponse_descriptor_;
}
const AllocIDResponse& AllocIDResponse::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<AllocIDResponse> AllocIDResponse_default_instance_;
AllocIDResponse* AllocIDResponse::New(::google::protobuf::Arena* arena) const {
AllocIDResponse* n = new AllocIDResponse;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void AllocIDResponse::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.AllocIDResponse)
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
id_ = GOOGLE_ULONGLONG(0);
}
bool AllocIDResponse::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.AllocIDResponse)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .pdpb.ResponseHeader header = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_header()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_id;
break;
}
// optional uint64 id = 2;
case 2: {
if (tag == 16) {
parse_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &id_)));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.AllocIDResponse)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.AllocIDResponse)
return false;
#undef DO_
}
void AllocIDResponse::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.AllocIDResponse)
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->header_, output);
}
// optional uint64 id = 2;
if (this->id() != 0) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(2, this->id(), output);
}
// @@protoc_insertion_point(serialize_end:pdpb.AllocIDResponse)
}
::google::protobuf::uint8* AllocIDResponse::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.AllocIDResponse)
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->header_, false, target);
}
// optional uint64 id = 2;
if (this->id() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(2, this->id(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.AllocIDResponse)
return target;
}
size_t AllocIDResponse::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.AllocIDResponse)
size_t total_size = 0;
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->header_);
}
// optional uint64 id = 2;
if (this->id() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->id());
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void AllocIDResponse::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.AllocIDResponse)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const AllocIDResponse* source =
::google::protobuf::internal::DynamicCastToGenerated<const AllocIDResponse>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.AllocIDResponse)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.AllocIDResponse)
UnsafeMergeFrom(*source);
}
}
void AllocIDResponse::MergeFrom(const AllocIDResponse& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.AllocIDResponse)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void AllocIDResponse::UnsafeMergeFrom(const AllocIDResponse& from) {
GOOGLE_DCHECK(&from != this);
if (from.has_header()) {
mutable_header()->::pdpb::ResponseHeader::MergeFrom(from.header());
}
if (from.id() != 0) {
set_id(from.id());
}
}
void AllocIDResponse::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.AllocIDResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void AllocIDResponse::CopyFrom(const AllocIDResponse& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.AllocIDResponse)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool AllocIDResponse::IsInitialized() const {
return true;
}
void AllocIDResponse::Swap(AllocIDResponse* other) {
if (other == this) return;
InternalSwap(other);
}
void AllocIDResponse::InternalSwap(AllocIDResponse* other) {
std::swap(header_, other->header_);
std::swap(id_, other->id_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata AllocIDResponse::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = AllocIDResponse_descriptor_;
metadata.reflection = AllocIDResponse_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// AllocIDResponse
// optional .pdpb.ResponseHeader header = 1;
bool AllocIDResponse::has_header() const {
return this != internal_default_instance() && header_ != NULL;
}
void AllocIDResponse::clear_header() {
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
const ::pdpb::ResponseHeader& AllocIDResponse::header() const {
// @@protoc_insertion_point(field_get:pdpb.AllocIDResponse.header)
return header_ != NULL ? *header_
: *::pdpb::ResponseHeader::internal_default_instance();
}
::pdpb::ResponseHeader* AllocIDResponse::mutable_header() {
if (header_ == NULL) {
header_ = new ::pdpb::ResponseHeader;
}
// @@protoc_insertion_point(field_mutable:pdpb.AllocIDResponse.header)
return header_;
}
::pdpb::ResponseHeader* AllocIDResponse::release_header() {
// @@protoc_insertion_point(field_release:pdpb.AllocIDResponse.header)
::pdpb::ResponseHeader* temp = header_;
header_ = NULL;
return temp;
}
void AllocIDResponse::set_allocated_header(::pdpb::ResponseHeader* header) {
delete header_;
header_ = header;
if (header) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.AllocIDResponse.header)
}
// optional uint64 id = 2;
void AllocIDResponse::clear_id() {
id_ = GOOGLE_ULONGLONG(0);
}
::google::protobuf::uint64 AllocIDResponse::id() const {
// @@protoc_insertion_point(field_get:pdpb.AllocIDResponse.id)
return id_;
}
void AllocIDResponse::set_id(::google::protobuf::uint64 value) {
id_ = value;
// @@protoc_insertion_point(field_set:pdpb.AllocIDResponse.id)
}
inline const AllocIDResponse* AllocIDResponse::internal_default_instance() {
return &AllocIDResponse_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int GetStoreRequest::kHeaderFieldNumber;
const int GetStoreRequest::kStoreIdFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
GetStoreRequest::GetStoreRequest()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.GetStoreRequest)
}
void GetStoreRequest::InitAsDefaultInstance() {
header_ = const_cast< ::pdpb::RequestHeader*>(
::pdpb::RequestHeader::internal_default_instance());
}
GetStoreRequest::GetStoreRequest(const GetStoreRequest& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.GetStoreRequest)
}
void GetStoreRequest::SharedCtor() {
header_ = NULL;
store_id_ = GOOGLE_ULONGLONG(0);
_cached_size_ = 0;
}
GetStoreRequest::~GetStoreRequest() {
// @@protoc_insertion_point(destructor:pdpb.GetStoreRequest)
SharedDtor();
}
void GetStoreRequest::SharedDtor() {
if (this != &GetStoreRequest_default_instance_.get()) {
delete header_;
}
}
void GetStoreRequest::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* GetStoreRequest::descriptor() {
protobuf_AssignDescriptorsOnce();
return GetStoreRequest_descriptor_;
}
const GetStoreRequest& GetStoreRequest::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<GetStoreRequest> GetStoreRequest_default_instance_;
GetStoreRequest* GetStoreRequest::New(::google::protobuf::Arena* arena) const {
GetStoreRequest* n = new GetStoreRequest;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void GetStoreRequest::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.GetStoreRequest)
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
store_id_ = GOOGLE_ULONGLONG(0);
}
bool GetStoreRequest::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.GetStoreRequest)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .pdpb.RequestHeader header = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_header()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_store_id;
break;
}
// optional uint64 store_id = 2;
case 2: {
if (tag == 16) {
parse_store_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &store_id_)));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.GetStoreRequest)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.GetStoreRequest)
return false;
#undef DO_
}
void GetStoreRequest::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.GetStoreRequest)
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->header_, output);
}
// optional uint64 store_id = 2;
if (this->store_id() != 0) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(2, this->store_id(), output);
}
// @@protoc_insertion_point(serialize_end:pdpb.GetStoreRequest)
}
::google::protobuf::uint8* GetStoreRequest::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.GetStoreRequest)
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->header_, false, target);
}
// optional uint64 store_id = 2;
if (this->store_id() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(2, this->store_id(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.GetStoreRequest)
return target;
}
size_t GetStoreRequest::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.GetStoreRequest)
size_t total_size = 0;
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->header_);
}
// optional uint64 store_id = 2;
if (this->store_id() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->store_id());
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void GetStoreRequest::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.GetStoreRequest)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const GetStoreRequest* source =
::google::protobuf::internal::DynamicCastToGenerated<const GetStoreRequest>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.GetStoreRequest)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.GetStoreRequest)
UnsafeMergeFrom(*source);
}
}
void GetStoreRequest::MergeFrom(const GetStoreRequest& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.GetStoreRequest)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void GetStoreRequest::UnsafeMergeFrom(const GetStoreRequest& from) {
GOOGLE_DCHECK(&from != this);
if (from.has_header()) {
mutable_header()->::pdpb::RequestHeader::MergeFrom(from.header());
}
if (from.store_id() != 0) {
set_store_id(from.store_id());
}
}
void GetStoreRequest::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.GetStoreRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void GetStoreRequest::CopyFrom(const GetStoreRequest& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.GetStoreRequest)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool GetStoreRequest::IsInitialized() const {
return true;
}
void GetStoreRequest::Swap(GetStoreRequest* other) {
if (other == this) return;
InternalSwap(other);
}
void GetStoreRequest::InternalSwap(GetStoreRequest* other) {
std::swap(header_, other->header_);
std::swap(store_id_, other->store_id_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata GetStoreRequest::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = GetStoreRequest_descriptor_;
metadata.reflection = GetStoreRequest_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// GetStoreRequest
// optional .pdpb.RequestHeader header = 1;
bool GetStoreRequest::has_header() const {
return this != internal_default_instance() && header_ != NULL;
}
void GetStoreRequest::clear_header() {
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
const ::pdpb::RequestHeader& GetStoreRequest::header() const {
// @@protoc_insertion_point(field_get:pdpb.GetStoreRequest.header)
return header_ != NULL ? *header_
: *::pdpb::RequestHeader::internal_default_instance();
}
::pdpb::RequestHeader* GetStoreRequest::mutable_header() {
if (header_ == NULL) {
header_ = new ::pdpb::RequestHeader;
}
// @@protoc_insertion_point(field_mutable:pdpb.GetStoreRequest.header)
return header_;
}
::pdpb::RequestHeader* GetStoreRequest::release_header() {
// @@protoc_insertion_point(field_release:pdpb.GetStoreRequest.header)
::pdpb::RequestHeader* temp = header_;
header_ = NULL;
return temp;
}
void GetStoreRequest::set_allocated_header(::pdpb::RequestHeader* header) {
delete header_;
header_ = header;
if (header) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.GetStoreRequest.header)
}
// optional uint64 store_id = 2;
void GetStoreRequest::clear_store_id() {
store_id_ = GOOGLE_ULONGLONG(0);
}
::google::protobuf::uint64 GetStoreRequest::store_id() const {
// @@protoc_insertion_point(field_get:pdpb.GetStoreRequest.store_id)
return store_id_;
}
void GetStoreRequest::set_store_id(::google::protobuf::uint64 value) {
store_id_ = value;
// @@protoc_insertion_point(field_set:pdpb.GetStoreRequest.store_id)
}
inline const GetStoreRequest* GetStoreRequest::internal_default_instance() {
return &GetStoreRequest_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int GetStoreResponse::kHeaderFieldNumber;
const int GetStoreResponse::kStoreFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
GetStoreResponse::GetStoreResponse()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.GetStoreResponse)
}
void GetStoreResponse::InitAsDefaultInstance() {
header_ = const_cast< ::pdpb::ResponseHeader*>(
::pdpb::ResponseHeader::internal_default_instance());
store_ = const_cast< ::metapb::Store*>(
::metapb::Store::internal_default_instance());
}
GetStoreResponse::GetStoreResponse(const GetStoreResponse& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.GetStoreResponse)
}
void GetStoreResponse::SharedCtor() {
header_ = NULL;
store_ = NULL;
_cached_size_ = 0;
}
GetStoreResponse::~GetStoreResponse() {
// @@protoc_insertion_point(destructor:pdpb.GetStoreResponse)
SharedDtor();
}
void GetStoreResponse::SharedDtor() {
if (this != &GetStoreResponse_default_instance_.get()) {
delete header_;
delete store_;
}
}
void GetStoreResponse::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* GetStoreResponse::descriptor() {
protobuf_AssignDescriptorsOnce();
return GetStoreResponse_descriptor_;
}
const GetStoreResponse& GetStoreResponse::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<GetStoreResponse> GetStoreResponse_default_instance_;
GetStoreResponse* GetStoreResponse::New(::google::protobuf::Arena* arena) const {
GetStoreResponse* n = new GetStoreResponse;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void GetStoreResponse::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.GetStoreResponse)
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
if (GetArenaNoVirtual() == NULL && store_ != NULL) delete store_;
store_ = NULL;
}
bool GetStoreResponse::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.GetStoreResponse)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .pdpb.ResponseHeader header = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_header()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_store;
break;
}
// optional .metapb.Store store = 2;
case 2: {
if (tag == 18) {
parse_store:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_store()));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.GetStoreResponse)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.GetStoreResponse)
return false;
#undef DO_
}
void GetStoreResponse::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.GetStoreResponse)
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->header_, output);
}
// optional .metapb.Store store = 2;
if (this->has_store()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, *this->store_, output);
}
// @@protoc_insertion_point(serialize_end:pdpb.GetStoreResponse)
}
::google::protobuf::uint8* GetStoreResponse::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.GetStoreResponse)
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->header_, false, target);
}
// optional .metapb.Store store = 2;
if (this->has_store()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
2, *this->store_, false, target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.GetStoreResponse)
return target;
}
size_t GetStoreResponse::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.GetStoreResponse)
size_t total_size = 0;
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->header_);
}
// optional .metapb.Store store = 2;
if (this->has_store()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->store_);
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void GetStoreResponse::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.GetStoreResponse)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const GetStoreResponse* source =
::google::protobuf::internal::DynamicCastToGenerated<const GetStoreResponse>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.GetStoreResponse)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.GetStoreResponse)
UnsafeMergeFrom(*source);
}
}
void GetStoreResponse::MergeFrom(const GetStoreResponse& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.GetStoreResponse)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void GetStoreResponse::UnsafeMergeFrom(const GetStoreResponse& from) {
GOOGLE_DCHECK(&from != this);
if (from.has_header()) {
mutable_header()->::pdpb::ResponseHeader::MergeFrom(from.header());
}
if (from.has_store()) {
mutable_store()->::metapb::Store::MergeFrom(from.store());
}
}
void GetStoreResponse::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.GetStoreResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void GetStoreResponse::CopyFrom(const GetStoreResponse& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.GetStoreResponse)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool GetStoreResponse::IsInitialized() const {
return true;
}
void GetStoreResponse::Swap(GetStoreResponse* other) {
if (other == this) return;
InternalSwap(other);
}
void GetStoreResponse::InternalSwap(GetStoreResponse* other) {
std::swap(header_, other->header_);
std::swap(store_, other->store_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata GetStoreResponse::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = GetStoreResponse_descriptor_;
metadata.reflection = GetStoreResponse_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// GetStoreResponse
// optional .pdpb.ResponseHeader header = 1;
bool GetStoreResponse::has_header() const {
return this != internal_default_instance() && header_ != NULL;
}
void GetStoreResponse::clear_header() {
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
const ::pdpb::ResponseHeader& GetStoreResponse::header() const {
// @@protoc_insertion_point(field_get:pdpb.GetStoreResponse.header)
return header_ != NULL ? *header_
: *::pdpb::ResponseHeader::internal_default_instance();
}
::pdpb::ResponseHeader* GetStoreResponse::mutable_header() {
if (header_ == NULL) {
header_ = new ::pdpb::ResponseHeader;
}
// @@protoc_insertion_point(field_mutable:pdpb.GetStoreResponse.header)
return header_;
}
::pdpb::ResponseHeader* GetStoreResponse::release_header() {
// @@protoc_insertion_point(field_release:pdpb.GetStoreResponse.header)
::pdpb::ResponseHeader* temp = header_;
header_ = NULL;
return temp;
}
void GetStoreResponse::set_allocated_header(::pdpb::ResponseHeader* header) {
delete header_;
header_ = header;
if (header) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.GetStoreResponse.header)
}
// optional .metapb.Store store = 2;
bool GetStoreResponse::has_store() const {
return this != internal_default_instance() && store_ != NULL;
}
void GetStoreResponse::clear_store() {
if (GetArenaNoVirtual() == NULL && store_ != NULL) delete store_;
store_ = NULL;
}
const ::metapb::Store& GetStoreResponse::store() const {
// @@protoc_insertion_point(field_get:pdpb.GetStoreResponse.store)
return store_ != NULL ? *store_
: *::metapb::Store::internal_default_instance();
}
::metapb::Store* GetStoreResponse::mutable_store() {
if (store_ == NULL) {
store_ = new ::metapb::Store;
}
// @@protoc_insertion_point(field_mutable:pdpb.GetStoreResponse.store)
return store_;
}
::metapb::Store* GetStoreResponse::release_store() {
// @@protoc_insertion_point(field_release:pdpb.GetStoreResponse.store)
::metapb::Store* temp = store_;
store_ = NULL;
return temp;
}
void GetStoreResponse::set_allocated_store(::metapb::Store* store) {
delete store_;
store_ = store;
if (store) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.GetStoreResponse.store)
}
inline const GetStoreResponse* GetStoreResponse::internal_default_instance() {
return &GetStoreResponse_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int PutStoreRequest::kHeaderFieldNumber;
const int PutStoreRequest::kStoreFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
PutStoreRequest::PutStoreRequest()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.PutStoreRequest)
}
void PutStoreRequest::InitAsDefaultInstance() {
header_ = const_cast< ::pdpb::RequestHeader*>(
::pdpb::RequestHeader::internal_default_instance());
store_ = const_cast< ::metapb::Store*>(
::metapb::Store::internal_default_instance());
}
PutStoreRequest::PutStoreRequest(const PutStoreRequest& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.PutStoreRequest)
}
void PutStoreRequest::SharedCtor() {
header_ = NULL;
store_ = NULL;
_cached_size_ = 0;
}
PutStoreRequest::~PutStoreRequest() {
// @@protoc_insertion_point(destructor:pdpb.PutStoreRequest)
SharedDtor();
}
void PutStoreRequest::SharedDtor() {
if (this != &PutStoreRequest_default_instance_.get()) {
delete header_;
delete store_;
}
}
void PutStoreRequest::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* PutStoreRequest::descriptor() {
protobuf_AssignDescriptorsOnce();
return PutStoreRequest_descriptor_;
}
const PutStoreRequest& PutStoreRequest::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<PutStoreRequest> PutStoreRequest_default_instance_;
PutStoreRequest* PutStoreRequest::New(::google::protobuf::Arena* arena) const {
PutStoreRequest* n = new PutStoreRequest;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void PutStoreRequest::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.PutStoreRequest)
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
if (GetArenaNoVirtual() == NULL && store_ != NULL) delete store_;
store_ = NULL;
}
bool PutStoreRequest::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.PutStoreRequest)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .pdpb.RequestHeader header = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_header()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_store;
break;
}
// optional .metapb.Store store = 2;
case 2: {
if (tag == 18) {
parse_store:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_store()));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.PutStoreRequest)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.PutStoreRequest)
return false;
#undef DO_
}
void PutStoreRequest::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.PutStoreRequest)
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->header_, output);
}
// optional .metapb.Store store = 2;
if (this->has_store()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, *this->store_, output);
}
// @@protoc_insertion_point(serialize_end:pdpb.PutStoreRequest)
}
::google::protobuf::uint8* PutStoreRequest::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.PutStoreRequest)
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->header_, false, target);
}
// optional .metapb.Store store = 2;
if (this->has_store()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
2, *this->store_, false, target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.PutStoreRequest)
return target;
}
size_t PutStoreRequest::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.PutStoreRequest)
size_t total_size = 0;
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->header_);
}
// optional .metapb.Store store = 2;
if (this->has_store()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->store_);
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void PutStoreRequest::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.PutStoreRequest)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const PutStoreRequest* source =
::google::protobuf::internal::DynamicCastToGenerated<const PutStoreRequest>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.PutStoreRequest)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.PutStoreRequest)
UnsafeMergeFrom(*source);
}
}
void PutStoreRequest::MergeFrom(const PutStoreRequest& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.PutStoreRequest)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void PutStoreRequest::UnsafeMergeFrom(const PutStoreRequest& from) {
GOOGLE_DCHECK(&from != this);
if (from.has_header()) {
mutable_header()->::pdpb::RequestHeader::MergeFrom(from.header());
}
if (from.has_store()) {
mutable_store()->::metapb::Store::MergeFrom(from.store());
}
}
void PutStoreRequest::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.PutStoreRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void PutStoreRequest::CopyFrom(const PutStoreRequest& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.PutStoreRequest)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool PutStoreRequest::IsInitialized() const {
return true;
}
void PutStoreRequest::Swap(PutStoreRequest* other) {
if (other == this) return;
InternalSwap(other);
}
void PutStoreRequest::InternalSwap(PutStoreRequest* other) {
std::swap(header_, other->header_);
std::swap(store_, other->store_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata PutStoreRequest::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = PutStoreRequest_descriptor_;
metadata.reflection = PutStoreRequest_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// PutStoreRequest
// optional .pdpb.RequestHeader header = 1;
bool PutStoreRequest::has_header() const {
return this != internal_default_instance() && header_ != NULL;
}
void PutStoreRequest::clear_header() {
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
const ::pdpb::RequestHeader& PutStoreRequest::header() const {
// @@protoc_insertion_point(field_get:pdpb.PutStoreRequest.header)
return header_ != NULL ? *header_
: *::pdpb::RequestHeader::internal_default_instance();
}
::pdpb::RequestHeader* PutStoreRequest::mutable_header() {
if (header_ == NULL) {
header_ = new ::pdpb::RequestHeader;
}
// @@protoc_insertion_point(field_mutable:pdpb.PutStoreRequest.header)
return header_;
}
::pdpb::RequestHeader* PutStoreRequest::release_header() {
// @@protoc_insertion_point(field_release:pdpb.PutStoreRequest.header)
::pdpb::RequestHeader* temp = header_;
header_ = NULL;
return temp;
}
void PutStoreRequest::set_allocated_header(::pdpb::RequestHeader* header) {
delete header_;
header_ = header;
if (header) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.PutStoreRequest.header)
}
// optional .metapb.Store store = 2;
bool PutStoreRequest::has_store() const {
return this != internal_default_instance() && store_ != NULL;
}
void PutStoreRequest::clear_store() {
if (GetArenaNoVirtual() == NULL && store_ != NULL) delete store_;
store_ = NULL;
}
const ::metapb::Store& PutStoreRequest::store() const {
// @@protoc_insertion_point(field_get:pdpb.PutStoreRequest.store)
return store_ != NULL ? *store_
: *::metapb::Store::internal_default_instance();
}
::metapb::Store* PutStoreRequest::mutable_store() {
if (store_ == NULL) {
store_ = new ::metapb::Store;
}
// @@protoc_insertion_point(field_mutable:pdpb.PutStoreRequest.store)
return store_;
}
::metapb::Store* PutStoreRequest::release_store() {
// @@protoc_insertion_point(field_release:pdpb.PutStoreRequest.store)
::metapb::Store* temp = store_;
store_ = NULL;
return temp;
}
void PutStoreRequest::set_allocated_store(::metapb::Store* store) {
delete store_;
store_ = store;
if (store) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.PutStoreRequest.store)
}
inline const PutStoreRequest* PutStoreRequest::internal_default_instance() {
return &PutStoreRequest_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int PutStoreResponse::kHeaderFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
PutStoreResponse::PutStoreResponse()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.PutStoreResponse)
}
void PutStoreResponse::InitAsDefaultInstance() {
header_ = const_cast< ::pdpb::ResponseHeader*>(
::pdpb::ResponseHeader::internal_default_instance());
}
PutStoreResponse::PutStoreResponse(const PutStoreResponse& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.PutStoreResponse)
}
void PutStoreResponse::SharedCtor() {
header_ = NULL;
_cached_size_ = 0;
}
PutStoreResponse::~PutStoreResponse() {
// @@protoc_insertion_point(destructor:pdpb.PutStoreResponse)
SharedDtor();
}
void PutStoreResponse::SharedDtor() {
if (this != &PutStoreResponse_default_instance_.get()) {
delete header_;
}
}
void PutStoreResponse::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* PutStoreResponse::descriptor() {
protobuf_AssignDescriptorsOnce();
return PutStoreResponse_descriptor_;
}
const PutStoreResponse& PutStoreResponse::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<PutStoreResponse> PutStoreResponse_default_instance_;
PutStoreResponse* PutStoreResponse::New(::google::protobuf::Arena* arena) const {
PutStoreResponse* n = new PutStoreResponse;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void PutStoreResponse::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.PutStoreResponse)
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
bool PutStoreResponse::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.PutStoreResponse)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .pdpb.ResponseHeader header = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_header()));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.PutStoreResponse)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.PutStoreResponse)
return false;
#undef DO_
}
void PutStoreResponse::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.PutStoreResponse)
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->header_, output);
}
// @@protoc_insertion_point(serialize_end:pdpb.PutStoreResponse)
}
::google::protobuf::uint8* PutStoreResponse::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.PutStoreResponse)
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->header_, false, target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.PutStoreResponse)
return target;
}
size_t PutStoreResponse::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.PutStoreResponse)
size_t total_size = 0;
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->header_);
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void PutStoreResponse::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.PutStoreResponse)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const PutStoreResponse* source =
::google::protobuf::internal::DynamicCastToGenerated<const PutStoreResponse>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.PutStoreResponse)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.PutStoreResponse)
UnsafeMergeFrom(*source);
}
}
void PutStoreResponse::MergeFrom(const PutStoreResponse& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.PutStoreResponse)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void PutStoreResponse::UnsafeMergeFrom(const PutStoreResponse& from) {
GOOGLE_DCHECK(&from != this);
if (from.has_header()) {
mutable_header()->::pdpb::ResponseHeader::MergeFrom(from.header());
}
}
void PutStoreResponse::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.PutStoreResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void PutStoreResponse::CopyFrom(const PutStoreResponse& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.PutStoreResponse)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool PutStoreResponse::IsInitialized() const {
return true;
}
void PutStoreResponse::Swap(PutStoreResponse* other) {
if (other == this) return;
InternalSwap(other);
}
void PutStoreResponse::InternalSwap(PutStoreResponse* other) {
std::swap(header_, other->header_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata PutStoreResponse::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = PutStoreResponse_descriptor_;
metadata.reflection = PutStoreResponse_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// PutStoreResponse
// optional .pdpb.ResponseHeader header = 1;
bool PutStoreResponse::has_header() const {
return this != internal_default_instance() && header_ != NULL;
}
void PutStoreResponse::clear_header() {
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
const ::pdpb::ResponseHeader& PutStoreResponse::header() const {
// @@protoc_insertion_point(field_get:pdpb.PutStoreResponse.header)
return header_ != NULL ? *header_
: *::pdpb::ResponseHeader::internal_default_instance();
}
::pdpb::ResponseHeader* PutStoreResponse::mutable_header() {
if (header_ == NULL) {
header_ = new ::pdpb::ResponseHeader;
}
// @@protoc_insertion_point(field_mutable:pdpb.PutStoreResponse.header)
return header_;
}
::pdpb::ResponseHeader* PutStoreResponse::release_header() {
// @@protoc_insertion_point(field_release:pdpb.PutStoreResponse.header)
::pdpb::ResponseHeader* temp = header_;
header_ = NULL;
return temp;
}
void PutStoreResponse::set_allocated_header(::pdpb::ResponseHeader* header) {
delete header_;
header_ = header;
if (header) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.PutStoreResponse.header)
}
inline const PutStoreResponse* PutStoreResponse::internal_default_instance() {
return &PutStoreResponse_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int GetAllStoresRequest::kHeaderFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
GetAllStoresRequest::GetAllStoresRequest()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.GetAllStoresRequest)
}
void GetAllStoresRequest::InitAsDefaultInstance() {
header_ = const_cast< ::pdpb::RequestHeader*>(
::pdpb::RequestHeader::internal_default_instance());
}
GetAllStoresRequest::GetAllStoresRequest(const GetAllStoresRequest& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.GetAllStoresRequest)
}
void GetAllStoresRequest::SharedCtor() {
header_ = NULL;
_cached_size_ = 0;
}
GetAllStoresRequest::~GetAllStoresRequest() {
// @@protoc_insertion_point(destructor:pdpb.GetAllStoresRequest)
SharedDtor();
}
void GetAllStoresRequest::SharedDtor() {
if (this != &GetAllStoresRequest_default_instance_.get()) {
delete header_;
}
}
void GetAllStoresRequest::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* GetAllStoresRequest::descriptor() {
protobuf_AssignDescriptorsOnce();
return GetAllStoresRequest_descriptor_;
}
const GetAllStoresRequest& GetAllStoresRequest::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<GetAllStoresRequest> GetAllStoresRequest_default_instance_;
GetAllStoresRequest* GetAllStoresRequest::New(::google::protobuf::Arena* arena) const {
GetAllStoresRequest* n = new GetAllStoresRequest;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void GetAllStoresRequest::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.GetAllStoresRequest)
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
bool GetAllStoresRequest::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.GetAllStoresRequest)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .pdpb.RequestHeader header = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_header()));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.GetAllStoresRequest)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.GetAllStoresRequest)
return false;
#undef DO_
}
void GetAllStoresRequest::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.GetAllStoresRequest)
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->header_, output);
}
// @@protoc_insertion_point(serialize_end:pdpb.GetAllStoresRequest)
}
::google::protobuf::uint8* GetAllStoresRequest::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.GetAllStoresRequest)
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->header_, false, target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.GetAllStoresRequest)
return target;
}
size_t GetAllStoresRequest::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.GetAllStoresRequest)
size_t total_size = 0;
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->header_);
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void GetAllStoresRequest::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.GetAllStoresRequest)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const GetAllStoresRequest* source =
::google::protobuf::internal::DynamicCastToGenerated<const GetAllStoresRequest>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.GetAllStoresRequest)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.GetAllStoresRequest)
UnsafeMergeFrom(*source);
}
}
void GetAllStoresRequest::MergeFrom(const GetAllStoresRequest& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.GetAllStoresRequest)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void GetAllStoresRequest::UnsafeMergeFrom(const GetAllStoresRequest& from) {
GOOGLE_DCHECK(&from != this);
if (from.has_header()) {
mutable_header()->::pdpb::RequestHeader::MergeFrom(from.header());
}
}
void GetAllStoresRequest::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.GetAllStoresRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void GetAllStoresRequest::CopyFrom(const GetAllStoresRequest& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.GetAllStoresRequest)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool GetAllStoresRequest::IsInitialized() const {
return true;
}
void GetAllStoresRequest::Swap(GetAllStoresRequest* other) {
if (other == this) return;
InternalSwap(other);
}
void GetAllStoresRequest::InternalSwap(GetAllStoresRequest* other) {
std::swap(header_, other->header_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata GetAllStoresRequest::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = GetAllStoresRequest_descriptor_;
metadata.reflection = GetAllStoresRequest_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// GetAllStoresRequest
// optional .pdpb.RequestHeader header = 1;
bool GetAllStoresRequest::has_header() const {
return this != internal_default_instance() && header_ != NULL;
}
void GetAllStoresRequest::clear_header() {
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
const ::pdpb::RequestHeader& GetAllStoresRequest::header() const {
// @@protoc_insertion_point(field_get:pdpb.GetAllStoresRequest.header)
return header_ != NULL ? *header_
: *::pdpb::RequestHeader::internal_default_instance();
}
::pdpb::RequestHeader* GetAllStoresRequest::mutable_header() {
if (header_ == NULL) {
header_ = new ::pdpb::RequestHeader;
}
// @@protoc_insertion_point(field_mutable:pdpb.GetAllStoresRequest.header)
return header_;
}
::pdpb::RequestHeader* GetAllStoresRequest::release_header() {
// @@protoc_insertion_point(field_release:pdpb.GetAllStoresRequest.header)
::pdpb::RequestHeader* temp = header_;
header_ = NULL;
return temp;
}
void GetAllStoresRequest::set_allocated_header(::pdpb::RequestHeader* header) {
delete header_;
header_ = header;
if (header) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.GetAllStoresRequest.header)
}
inline const GetAllStoresRequest* GetAllStoresRequest::internal_default_instance() {
return &GetAllStoresRequest_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int GetAllStoresResponse::kHeaderFieldNumber;
const int GetAllStoresResponse::kStoresFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
GetAllStoresResponse::GetAllStoresResponse()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.GetAllStoresResponse)
}
void GetAllStoresResponse::InitAsDefaultInstance() {
header_ = const_cast< ::pdpb::ResponseHeader*>(
::pdpb::ResponseHeader::internal_default_instance());
}
GetAllStoresResponse::GetAllStoresResponse(const GetAllStoresResponse& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.GetAllStoresResponse)
}
void GetAllStoresResponse::SharedCtor() {
header_ = NULL;
_cached_size_ = 0;
}
GetAllStoresResponse::~GetAllStoresResponse() {
// @@protoc_insertion_point(destructor:pdpb.GetAllStoresResponse)
SharedDtor();
}
void GetAllStoresResponse::SharedDtor() {
if (this != &GetAllStoresResponse_default_instance_.get()) {
delete header_;
}
}
void GetAllStoresResponse::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* GetAllStoresResponse::descriptor() {
protobuf_AssignDescriptorsOnce();
return GetAllStoresResponse_descriptor_;
}
const GetAllStoresResponse& GetAllStoresResponse::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<GetAllStoresResponse> GetAllStoresResponse_default_instance_;
GetAllStoresResponse* GetAllStoresResponse::New(::google::protobuf::Arena* arena) const {
GetAllStoresResponse* n = new GetAllStoresResponse;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void GetAllStoresResponse::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.GetAllStoresResponse)
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
stores_.Clear();
}
bool GetAllStoresResponse::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.GetAllStoresResponse)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .pdpb.ResponseHeader header = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_header()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_stores;
break;
}
// repeated .metapb.Store stores = 2;
case 2: {
if (tag == 18) {
parse_stores:
DO_(input->IncrementRecursionDepth());
parse_loop_stores:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth(
input, add_stores()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_loop_stores;
input->UnsafeDecrementRecursionDepth();
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.GetAllStoresResponse)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.GetAllStoresResponse)
return false;
#undef DO_
}
void GetAllStoresResponse::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.GetAllStoresResponse)
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->header_, output);
}
// repeated .metapb.Store stores = 2;
for (unsigned int i = 0, n = this->stores_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, this->stores(i), output);
}
// @@protoc_insertion_point(serialize_end:pdpb.GetAllStoresResponse)
}
::google::protobuf::uint8* GetAllStoresResponse::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.GetAllStoresResponse)
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->header_, false, target);
}
// repeated .metapb.Store stores = 2;
for (unsigned int i = 0, n = this->stores_size(); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
2, this->stores(i), false, target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.GetAllStoresResponse)
return target;
}
size_t GetAllStoresResponse::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.GetAllStoresResponse)
size_t total_size = 0;
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->header_);
}
// repeated .metapb.Store stores = 2;
{
unsigned int count = this->stores_size();
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->stores(i));
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void GetAllStoresResponse::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.GetAllStoresResponse)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const GetAllStoresResponse* source =
::google::protobuf::internal::DynamicCastToGenerated<const GetAllStoresResponse>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.GetAllStoresResponse)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.GetAllStoresResponse)
UnsafeMergeFrom(*source);
}
}
void GetAllStoresResponse::MergeFrom(const GetAllStoresResponse& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.GetAllStoresResponse)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void GetAllStoresResponse::UnsafeMergeFrom(const GetAllStoresResponse& from) {
GOOGLE_DCHECK(&from != this);
stores_.MergeFrom(from.stores_);
if (from.has_header()) {
mutable_header()->::pdpb::ResponseHeader::MergeFrom(from.header());
}
}
void GetAllStoresResponse::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.GetAllStoresResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void GetAllStoresResponse::CopyFrom(const GetAllStoresResponse& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.GetAllStoresResponse)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool GetAllStoresResponse::IsInitialized() const {
return true;
}
void GetAllStoresResponse::Swap(GetAllStoresResponse* other) {
if (other == this) return;
InternalSwap(other);
}
void GetAllStoresResponse::InternalSwap(GetAllStoresResponse* other) {
std::swap(header_, other->header_);
stores_.UnsafeArenaSwap(&other->stores_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata GetAllStoresResponse::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = GetAllStoresResponse_descriptor_;
metadata.reflection = GetAllStoresResponse_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// GetAllStoresResponse
// optional .pdpb.ResponseHeader header = 1;
bool GetAllStoresResponse::has_header() const {
return this != internal_default_instance() && header_ != NULL;
}
void GetAllStoresResponse::clear_header() {
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
const ::pdpb::ResponseHeader& GetAllStoresResponse::header() const {
// @@protoc_insertion_point(field_get:pdpb.GetAllStoresResponse.header)
return header_ != NULL ? *header_
: *::pdpb::ResponseHeader::internal_default_instance();
}
::pdpb::ResponseHeader* GetAllStoresResponse::mutable_header() {
if (header_ == NULL) {
header_ = new ::pdpb::ResponseHeader;
}
// @@protoc_insertion_point(field_mutable:pdpb.GetAllStoresResponse.header)
return header_;
}
::pdpb::ResponseHeader* GetAllStoresResponse::release_header() {
// @@protoc_insertion_point(field_release:pdpb.GetAllStoresResponse.header)
::pdpb::ResponseHeader* temp = header_;
header_ = NULL;
return temp;
}
void GetAllStoresResponse::set_allocated_header(::pdpb::ResponseHeader* header) {
delete header_;
header_ = header;
if (header) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.GetAllStoresResponse.header)
}
// repeated .metapb.Store stores = 2;
int GetAllStoresResponse::stores_size() const {
return stores_.size();
}
void GetAllStoresResponse::clear_stores() {
stores_.Clear();
}
const ::metapb::Store& GetAllStoresResponse::stores(int index) const {
// @@protoc_insertion_point(field_get:pdpb.GetAllStoresResponse.stores)
return stores_.Get(index);
}
::metapb::Store* GetAllStoresResponse::mutable_stores(int index) {
// @@protoc_insertion_point(field_mutable:pdpb.GetAllStoresResponse.stores)
return stores_.Mutable(index);
}
::metapb::Store* GetAllStoresResponse::add_stores() {
// @@protoc_insertion_point(field_add:pdpb.GetAllStoresResponse.stores)
return stores_.Add();
}
::google::protobuf::RepeatedPtrField< ::metapb::Store >*
GetAllStoresResponse::mutable_stores() {
// @@protoc_insertion_point(field_mutable_list:pdpb.GetAllStoresResponse.stores)
return &stores_;
}
const ::google::protobuf::RepeatedPtrField< ::metapb::Store >&
GetAllStoresResponse::stores() const {
// @@protoc_insertion_point(field_list:pdpb.GetAllStoresResponse.stores)
return stores_;
}
inline const GetAllStoresResponse* GetAllStoresResponse::internal_default_instance() {
return &GetAllStoresResponse_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int GetRegionRequest::kHeaderFieldNumber;
const int GetRegionRequest::kRegionKeyFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
GetRegionRequest::GetRegionRequest()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.GetRegionRequest)
}
void GetRegionRequest::InitAsDefaultInstance() {
header_ = const_cast< ::pdpb::RequestHeader*>(
::pdpb::RequestHeader::internal_default_instance());
}
GetRegionRequest::GetRegionRequest(const GetRegionRequest& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.GetRegionRequest)
}
void GetRegionRequest::SharedCtor() {
region_key_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
header_ = NULL;
_cached_size_ = 0;
}
GetRegionRequest::~GetRegionRequest() {
// @@protoc_insertion_point(destructor:pdpb.GetRegionRequest)
SharedDtor();
}
void GetRegionRequest::SharedDtor() {
region_key_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (this != &GetRegionRequest_default_instance_.get()) {
delete header_;
}
}
void GetRegionRequest::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* GetRegionRequest::descriptor() {
protobuf_AssignDescriptorsOnce();
return GetRegionRequest_descriptor_;
}
const GetRegionRequest& GetRegionRequest::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<GetRegionRequest> GetRegionRequest_default_instance_;
GetRegionRequest* GetRegionRequest::New(::google::protobuf::Arena* arena) const {
GetRegionRequest* n = new GetRegionRequest;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void GetRegionRequest::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.GetRegionRequest)
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
region_key_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
bool GetRegionRequest::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.GetRegionRequest)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .pdpb.RequestHeader header = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_header()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_region_key;
break;
}
// optional bytes region_key = 2;
case 2: {
if (tag == 18) {
parse_region_key:
DO_(::google::protobuf::internal::WireFormatLite::ReadBytes(
input, this->mutable_region_key()));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.GetRegionRequest)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.GetRegionRequest)
return false;
#undef DO_
}
void GetRegionRequest::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.GetRegionRequest)
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->header_, output);
}
// optional bytes region_key = 2;
if (this->region_key().size() > 0) {
::google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased(
2, this->region_key(), output);
}
// @@protoc_insertion_point(serialize_end:pdpb.GetRegionRequest)
}
::google::protobuf::uint8* GetRegionRequest::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.GetRegionRequest)
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->header_, false, target);
}
// optional bytes region_key = 2;
if (this->region_key().size() > 0) {
target =
::google::protobuf::internal::WireFormatLite::WriteBytesToArray(
2, this->region_key(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.GetRegionRequest)
return target;
}
size_t GetRegionRequest::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.GetRegionRequest)
size_t total_size = 0;
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->header_);
}
// optional bytes region_key = 2;
if (this->region_key().size() > 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::BytesSize(
this->region_key());
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void GetRegionRequest::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.GetRegionRequest)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const GetRegionRequest* source =
::google::protobuf::internal::DynamicCastToGenerated<const GetRegionRequest>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.GetRegionRequest)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.GetRegionRequest)
UnsafeMergeFrom(*source);
}
}
void GetRegionRequest::MergeFrom(const GetRegionRequest& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.GetRegionRequest)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void GetRegionRequest::UnsafeMergeFrom(const GetRegionRequest& from) {
GOOGLE_DCHECK(&from != this);
if (from.has_header()) {
mutable_header()->::pdpb::RequestHeader::MergeFrom(from.header());
}
if (from.region_key().size() > 0) {
region_key_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.region_key_);
}
}
void GetRegionRequest::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.GetRegionRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void GetRegionRequest::CopyFrom(const GetRegionRequest& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.GetRegionRequest)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool GetRegionRequest::IsInitialized() const {
return true;
}
void GetRegionRequest::Swap(GetRegionRequest* other) {
if (other == this) return;
InternalSwap(other);
}
void GetRegionRequest::InternalSwap(GetRegionRequest* other) {
std::swap(header_, other->header_);
region_key_.Swap(&other->region_key_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata GetRegionRequest::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = GetRegionRequest_descriptor_;
metadata.reflection = GetRegionRequest_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// GetRegionRequest
// optional .pdpb.RequestHeader header = 1;
bool GetRegionRequest::has_header() const {
return this != internal_default_instance() && header_ != NULL;
}
void GetRegionRequest::clear_header() {
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
const ::pdpb::RequestHeader& GetRegionRequest::header() const {
// @@protoc_insertion_point(field_get:pdpb.GetRegionRequest.header)
return header_ != NULL ? *header_
: *::pdpb::RequestHeader::internal_default_instance();
}
::pdpb::RequestHeader* GetRegionRequest::mutable_header() {
if (header_ == NULL) {
header_ = new ::pdpb::RequestHeader;
}
// @@protoc_insertion_point(field_mutable:pdpb.GetRegionRequest.header)
return header_;
}
::pdpb::RequestHeader* GetRegionRequest::release_header() {
// @@protoc_insertion_point(field_release:pdpb.GetRegionRequest.header)
::pdpb::RequestHeader* temp = header_;
header_ = NULL;
return temp;
}
void GetRegionRequest::set_allocated_header(::pdpb::RequestHeader* header) {
delete header_;
header_ = header;
if (header) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.GetRegionRequest.header)
}
// optional bytes region_key = 2;
void GetRegionRequest::clear_region_key() {
region_key_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
const ::std::string& GetRegionRequest::region_key() const {
// @@protoc_insertion_point(field_get:pdpb.GetRegionRequest.region_key)
return region_key_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void GetRegionRequest::set_region_key(const ::std::string& value) {
region_key_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:pdpb.GetRegionRequest.region_key)
}
void GetRegionRequest::set_region_key(const char* value) {
region_key_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:pdpb.GetRegionRequest.region_key)
}
void GetRegionRequest::set_region_key(const void* value, size_t size) {
region_key_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:pdpb.GetRegionRequest.region_key)
}
::std::string* GetRegionRequest::mutable_region_key() {
// @@protoc_insertion_point(field_mutable:pdpb.GetRegionRequest.region_key)
return region_key_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
::std::string* GetRegionRequest::release_region_key() {
// @@protoc_insertion_point(field_release:pdpb.GetRegionRequest.region_key)
return region_key_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void GetRegionRequest::set_allocated_region_key(::std::string* region_key) {
if (region_key != NULL) {
} else {
}
region_key_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), region_key);
// @@protoc_insertion_point(field_set_allocated:pdpb.GetRegionRequest.region_key)
}
inline const GetRegionRequest* GetRegionRequest::internal_default_instance() {
return &GetRegionRequest_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int GetRegionResponse::kHeaderFieldNumber;
const int GetRegionResponse::kRegionFieldNumber;
const int GetRegionResponse::kLeaderFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
GetRegionResponse::GetRegionResponse()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.GetRegionResponse)
}
void GetRegionResponse::InitAsDefaultInstance() {
header_ = const_cast< ::pdpb::ResponseHeader*>(
::pdpb::ResponseHeader::internal_default_instance());
region_ = const_cast< ::metapb::Region*>(
::metapb::Region::internal_default_instance());
leader_ = const_cast< ::metapb::Peer*>(
::metapb::Peer::internal_default_instance());
}
GetRegionResponse::GetRegionResponse(const GetRegionResponse& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.GetRegionResponse)
}
void GetRegionResponse::SharedCtor() {
header_ = NULL;
region_ = NULL;
leader_ = NULL;
_cached_size_ = 0;
}
GetRegionResponse::~GetRegionResponse() {
// @@protoc_insertion_point(destructor:pdpb.GetRegionResponse)
SharedDtor();
}
void GetRegionResponse::SharedDtor() {
if (this != &GetRegionResponse_default_instance_.get()) {
delete header_;
delete region_;
delete leader_;
}
}
void GetRegionResponse::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* GetRegionResponse::descriptor() {
protobuf_AssignDescriptorsOnce();
return GetRegionResponse_descriptor_;
}
const GetRegionResponse& GetRegionResponse::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<GetRegionResponse> GetRegionResponse_default_instance_;
GetRegionResponse* GetRegionResponse::New(::google::protobuf::Arena* arena) const {
GetRegionResponse* n = new GetRegionResponse;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void GetRegionResponse::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.GetRegionResponse)
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
if (GetArenaNoVirtual() == NULL && region_ != NULL) delete region_;
region_ = NULL;
if (GetArenaNoVirtual() == NULL && leader_ != NULL) delete leader_;
leader_ = NULL;
}
bool GetRegionResponse::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.GetRegionResponse)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .pdpb.ResponseHeader header = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_header()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_region;
break;
}
// optional .metapb.Region region = 2;
case 2: {
if (tag == 18) {
parse_region:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_region()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(26)) goto parse_leader;
break;
}
// optional .metapb.Peer leader = 3;
case 3: {
if (tag == 26) {
parse_leader:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_leader()));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.GetRegionResponse)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.GetRegionResponse)
return false;
#undef DO_
}
void GetRegionResponse::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.GetRegionResponse)
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->header_, output);
}
// optional .metapb.Region region = 2;
if (this->has_region()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, *this->region_, output);
}
// optional .metapb.Peer leader = 3;
if (this->has_leader()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, *this->leader_, output);
}
// @@protoc_insertion_point(serialize_end:pdpb.GetRegionResponse)
}
::google::protobuf::uint8* GetRegionResponse::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.GetRegionResponse)
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->header_, false, target);
}
// optional .metapb.Region region = 2;
if (this->has_region()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
2, *this->region_, false, target);
}
// optional .metapb.Peer leader = 3;
if (this->has_leader()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
3, *this->leader_, false, target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.GetRegionResponse)
return target;
}
size_t GetRegionResponse::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.GetRegionResponse)
size_t total_size = 0;
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->header_);
}
// optional .metapb.Region region = 2;
if (this->has_region()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->region_);
}
// optional .metapb.Peer leader = 3;
if (this->has_leader()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->leader_);
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void GetRegionResponse::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.GetRegionResponse)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const GetRegionResponse* source =
::google::protobuf::internal::DynamicCastToGenerated<const GetRegionResponse>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.GetRegionResponse)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.GetRegionResponse)
UnsafeMergeFrom(*source);
}
}
void GetRegionResponse::MergeFrom(const GetRegionResponse& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.GetRegionResponse)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void GetRegionResponse::UnsafeMergeFrom(const GetRegionResponse& from) {
GOOGLE_DCHECK(&from != this);
if (from.has_header()) {
mutable_header()->::pdpb::ResponseHeader::MergeFrom(from.header());
}
if (from.has_region()) {
mutable_region()->::metapb::Region::MergeFrom(from.region());
}
if (from.has_leader()) {
mutable_leader()->::metapb::Peer::MergeFrom(from.leader());
}
}
void GetRegionResponse::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.GetRegionResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void GetRegionResponse::CopyFrom(const GetRegionResponse& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.GetRegionResponse)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool GetRegionResponse::IsInitialized() const {
return true;
}
void GetRegionResponse::Swap(GetRegionResponse* other) {
if (other == this) return;
InternalSwap(other);
}
void GetRegionResponse::InternalSwap(GetRegionResponse* other) {
std::swap(header_, other->header_);
std::swap(region_, other->region_);
std::swap(leader_, other->leader_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata GetRegionResponse::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = GetRegionResponse_descriptor_;
metadata.reflection = GetRegionResponse_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// GetRegionResponse
// optional .pdpb.ResponseHeader header = 1;
bool GetRegionResponse::has_header() const {
return this != internal_default_instance() && header_ != NULL;
}
void GetRegionResponse::clear_header() {
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
const ::pdpb::ResponseHeader& GetRegionResponse::header() const {
// @@protoc_insertion_point(field_get:pdpb.GetRegionResponse.header)
return header_ != NULL ? *header_
: *::pdpb::ResponseHeader::internal_default_instance();
}
::pdpb::ResponseHeader* GetRegionResponse::mutable_header() {
if (header_ == NULL) {
header_ = new ::pdpb::ResponseHeader;
}
// @@protoc_insertion_point(field_mutable:pdpb.GetRegionResponse.header)
return header_;
}
::pdpb::ResponseHeader* GetRegionResponse::release_header() {
// @@protoc_insertion_point(field_release:pdpb.GetRegionResponse.header)
::pdpb::ResponseHeader* temp = header_;
header_ = NULL;
return temp;
}
void GetRegionResponse::set_allocated_header(::pdpb::ResponseHeader* header) {
delete header_;
header_ = header;
if (header) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.GetRegionResponse.header)
}
// optional .metapb.Region region = 2;
bool GetRegionResponse::has_region() const {
return this != internal_default_instance() && region_ != NULL;
}
void GetRegionResponse::clear_region() {
if (GetArenaNoVirtual() == NULL && region_ != NULL) delete region_;
region_ = NULL;
}
const ::metapb::Region& GetRegionResponse::region() const {
// @@protoc_insertion_point(field_get:pdpb.GetRegionResponse.region)
return region_ != NULL ? *region_
: *::metapb::Region::internal_default_instance();
}
::metapb::Region* GetRegionResponse::mutable_region() {
if (region_ == NULL) {
region_ = new ::metapb::Region;
}
// @@protoc_insertion_point(field_mutable:pdpb.GetRegionResponse.region)
return region_;
}
::metapb::Region* GetRegionResponse::release_region() {
// @@protoc_insertion_point(field_release:pdpb.GetRegionResponse.region)
::metapb::Region* temp = region_;
region_ = NULL;
return temp;
}
void GetRegionResponse::set_allocated_region(::metapb::Region* region) {
delete region_;
region_ = region;
if (region) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.GetRegionResponse.region)
}
// optional .metapb.Peer leader = 3;
bool GetRegionResponse::has_leader() const {
return this != internal_default_instance() && leader_ != NULL;
}
void GetRegionResponse::clear_leader() {
if (GetArenaNoVirtual() == NULL && leader_ != NULL) delete leader_;
leader_ = NULL;
}
const ::metapb::Peer& GetRegionResponse::leader() const {
// @@protoc_insertion_point(field_get:pdpb.GetRegionResponse.leader)
return leader_ != NULL ? *leader_
: *::metapb::Peer::internal_default_instance();
}
::metapb::Peer* GetRegionResponse::mutable_leader() {
if (leader_ == NULL) {
leader_ = new ::metapb::Peer;
}
// @@protoc_insertion_point(field_mutable:pdpb.GetRegionResponse.leader)
return leader_;
}
::metapb::Peer* GetRegionResponse::release_leader() {
// @@protoc_insertion_point(field_release:pdpb.GetRegionResponse.leader)
::metapb::Peer* temp = leader_;
leader_ = NULL;
return temp;
}
void GetRegionResponse::set_allocated_leader(::metapb::Peer* leader) {
delete leader_;
leader_ = leader;
if (leader) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.GetRegionResponse.leader)
}
inline const GetRegionResponse* GetRegionResponse::internal_default_instance() {
return &GetRegionResponse_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int GetRegionByIDRequest::kHeaderFieldNumber;
const int GetRegionByIDRequest::kRegionIdFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
GetRegionByIDRequest::GetRegionByIDRequest()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.GetRegionByIDRequest)
}
void GetRegionByIDRequest::InitAsDefaultInstance() {
header_ = const_cast< ::pdpb::RequestHeader*>(
::pdpb::RequestHeader::internal_default_instance());
}
GetRegionByIDRequest::GetRegionByIDRequest(const GetRegionByIDRequest& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.GetRegionByIDRequest)
}
void GetRegionByIDRequest::SharedCtor() {
header_ = NULL;
region_id_ = GOOGLE_ULONGLONG(0);
_cached_size_ = 0;
}
GetRegionByIDRequest::~GetRegionByIDRequest() {
// @@protoc_insertion_point(destructor:pdpb.GetRegionByIDRequest)
SharedDtor();
}
void GetRegionByIDRequest::SharedDtor() {
if (this != &GetRegionByIDRequest_default_instance_.get()) {
delete header_;
}
}
void GetRegionByIDRequest::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* GetRegionByIDRequest::descriptor() {
protobuf_AssignDescriptorsOnce();
return GetRegionByIDRequest_descriptor_;
}
const GetRegionByIDRequest& GetRegionByIDRequest::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<GetRegionByIDRequest> GetRegionByIDRequest_default_instance_;
GetRegionByIDRequest* GetRegionByIDRequest::New(::google::protobuf::Arena* arena) const {
GetRegionByIDRequest* n = new GetRegionByIDRequest;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void GetRegionByIDRequest::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.GetRegionByIDRequest)
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
region_id_ = GOOGLE_ULONGLONG(0);
}
bool GetRegionByIDRequest::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.GetRegionByIDRequest)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .pdpb.RequestHeader header = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_header()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_region_id;
break;
}
// optional uint64 region_id = 2;
case 2: {
if (tag == 16) {
parse_region_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, ®ion_id_)));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.GetRegionByIDRequest)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.GetRegionByIDRequest)
return false;
#undef DO_
}
void GetRegionByIDRequest::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.GetRegionByIDRequest)
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->header_, output);
}
// optional uint64 region_id = 2;
if (this->region_id() != 0) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(2, this->region_id(), output);
}
// @@protoc_insertion_point(serialize_end:pdpb.GetRegionByIDRequest)
}
::google::protobuf::uint8* GetRegionByIDRequest::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.GetRegionByIDRequest)
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->header_, false, target);
}
// optional uint64 region_id = 2;
if (this->region_id() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(2, this->region_id(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.GetRegionByIDRequest)
return target;
}
size_t GetRegionByIDRequest::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.GetRegionByIDRequest)
size_t total_size = 0;
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->header_);
}
// optional uint64 region_id = 2;
if (this->region_id() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->region_id());
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void GetRegionByIDRequest::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.GetRegionByIDRequest)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const GetRegionByIDRequest* source =
::google::protobuf::internal::DynamicCastToGenerated<const GetRegionByIDRequest>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.GetRegionByIDRequest)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.GetRegionByIDRequest)
UnsafeMergeFrom(*source);
}
}
void GetRegionByIDRequest::MergeFrom(const GetRegionByIDRequest& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.GetRegionByIDRequest)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void GetRegionByIDRequest::UnsafeMergeFrom(const GetRegionByIDRequest& from) {
GOOGLE_DCHECK(&from != this);
if (from.has_header()) {
mutable_header()->::pdpb::RequestHeader::MergeFrom(from.header());
}
if (from.region_id() != 0) {
set_region_id(from.region_id());
}
}
void GetRegionByIDRequest::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.GetRegionByIDRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void GetRegionByIDRequest::CopyFrom(const GetRegionByIDRequest& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.GetRegionByIDRequest)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool GetRegionByIDRequest::IsInitialized() const {
return true;
}
void GetRegionByIDRequest::Swap(GetRegionByIDRequest* other) {
if (other == this) return;
InternalSwap(other);
}
void GetRegionByIDRequest::InternalSwap(GetRegionByIDRequest* other) {
std::swap(header_, other->header_);
std::swap(region_id_, other->region_id_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata GetRegionByIDRequest::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = GetRegionByIDRequest_descriptor_;
metadata.reflection = GetRegionByIDRequest_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// GetRegionByIDRequest
// optional .pdpb.RequestHeader header = 1;
bool GetRegionByIDRequest::has_header() const {
return this != internal_default_instance() && header_ != NULL;
}
void GetRegionByIDRequest::clear_header() {
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
const ::pdpb::RequestHeader& GetRegionByIDRequest::header() const {
// @@protoc_insertion_point(field_get:pdpb.GetRegionByIDRequest.header)
return header_ != NULL ? *header_
: *::pdpb::RequestHeader::internal_default_instance();
}
::pdpb::RequestHeader* GetRegionByIDRequest::mutable_header() {
if (header_ == NULL) {
header_ = new ::pdpb::RequestHeader;
}
// @@protoc_insertion_point(field_mutable:pdpb.GetRegionByIDRequest.header)
return header_;
}
::pdpb::RequestHeader* GetRegionByIDRequest::release_header() {
// @@protoc_insertion_point(field_release:pdpb.GetRegionByIDRequest.header)
::pdpb::RequestHeader* temp = header_;
header_ = NULL;
return temp;
}
void GetRegionByIDRequest::set_allocated_header(::pdpb::RequestHeader* header) {
delete header_;
header_ = header;
if (header) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.GetRegionByIDRequest.header)
}
// optional uint64 region_id = 2;
void GetRegionByIDRequest::clear_region_id() {
region_id_ = GOOGLE_ULONGLONG(0);
}
::google::protobuf::uint64 GetRegionByIDRequest::region_id() const {
// @@protoc_insertion_point(field_get:pdpb.GetRegionByIDRequest.region_id)
return region_id_;
}
void GetRegionByIDRequest::set_region_id(::google::protobuf::uint64 value) {
region_id_ = value;
// @@protoc_insertion_point(field_set:pdpb.GetRegionByIDRequest.region_id)
}
inline const GetRegionByIDRequest* GetRegionByIDRequest::internal_default_instance() {
return &GetRegionByIDRequest_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int GetClusterConfigRequest::kHeaderFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
GetClusterConfigRequest::GetClusterConfigRequest()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.GetClusterConfigRequest)
}
void GetClusterConfigRequest::InitAsDefaultInstance() {
header_ = const_cast< ::pdpb::RequestHeader*>(
::pdpb::RequestHeader::internal_default_instance());
}
GetClusterConfigRequest::GetClusterConfigRequest(const GetClusterConfigRequest& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.GetClusterConfigRequest)
}
void GetClusterConfigRequest::SharedCtor() {
header_ = NULL;
_cached_size_ = 0;
}
GetClusterConfigRequest::~GetClusterConfigRequest() {
// @@protoc_insertion_point(destructor:pdpb.GetClusterConfigRequest)
SharedDtor();
}
void GetClusterConfigRequest::SharedDtor() {
if (this != &GetClusterConfigRequest_default_instance_.get()) {
delete header_;
}
}
void GetClusterConfigRequest::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* GetClusterConfigRequest::descriptor() {
protobuf_AssignDescriptorsOnce();
return GetClusterConfigRequest_descriptor_;
}
const GetClusterConfigRequest& GetClusterConfigRequest::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<GetClusterConfigRequest> GetClusterConfigRequest_default_instance_;
GetClusterConfigRequest* GetClusterConfigRequest::New(::google::protobuf::Arena* arena) const {
GetClusterConfigRequest* n = new GetClusterConfigRequest;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void GetClusterConfigRequest::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.GetClusterConfigRequest)
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
bool GetClusterConfigRequest::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.GetClusterConfigRequest)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .pdpb.RequestHeader header = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_header()));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.GetClusterConfigRequest)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.GetClusterConfigRequest)
return false;
#undef DO_
}
void GetClusterConfigRequest::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.GetClusterConfigRequest)
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->header_, output);
}
// @@protoc_insertion_point(serialize_end:pdpb.GetClusterConfigRequest)
}
::google::protobuf::uint8* GetClusterConfigRequest::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.GetClusterConfigRequest)
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->header_, false, target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.GetClusterConfigRequest)
return target;
}
size_t GetClusterConfigRequest::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.GetClusterConfigRequest)
size_t total_size = 0;
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->header_);
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void GetClusterConfigRequest::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.GetClusterConfigRequest)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const GetClusterConfigRequest* source =
::google::protobuf::internal::DynamicCastToGenerated<const GetClusterConfigRequest>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.GetClusterConfigRequest)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.GetClusterConfigRequest)
UnsafeMergeFrom(*source);
}
}
void GetClusterConfigRequest::MergeFrom(const GetClusterConfigRequest& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.GetClusterConfigRequest)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void GetClusterConfigRequest::UnsafeMergeFrom(const GetClusterConfigRequest& from) {
GOOGLE_DCHECK(&from != this);
if (from.has_header()) {
mutable_header()->::pdpb::RequestHeader::MergeFrom(from.header());
}
}
void GetClusterConfigRequest::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.GetClusterConfigRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void GetClusterConfigRequest::CopyFrom(const GetClusterConfigRequest& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.GetClusterConfigRequest)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool GetClusterConfigRequest::IsInitialized() const {
return true;
}
void GetClusterConfigRequest::Swap(GetClusterConfigRequest* other) {
if (other == this) return;
InternalSwap(other);
}
void GetClusterConfigRequest::InternalSwap(GetClusterConfigRequest* other) {
std::swap(header_, other->header_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata GetClusterConfigRequest::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = GetClusterConfigRequest_descriptor_;
metadata.reflection = GetClusterConfigRequest_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// GetClusterConfigRequest
// optional .pdpb.RequestHeader header = 1;
bool GetClusterConfigRequest::has_header() const {
return this != internal_default_instance() && header_ != NULL;
}
void GetClusterConfigRequest::clear_header() {
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
const ::pdpb::RequestHeader& GetClusterConfigRequest::header() const {
// @@protoc_insertion_point(field_get:pdpb.GetClusterConfigRequest.header)
return header_ != NULL ? *header_
: *::pdpb::RequestHeader::internal_default_instance();
}
::pdpb::RequestHeader* GetClusterConfigRequest::mutable_header() {
if (header_ == NULL) {
header_ = new ::pdpb::RequestHeader;
}
// @@protoc_insertion_point(field_mutable:pdpb.GetClusterConfigRequest.header)
return header_;
}
::pdpb::RequestHeader* GetClusterConfigRequest::release_header() {
// @@protoc_insertion_point(field_release:pdpb.GetClusterConfigRequest.header)
::pdpb::RequestHeader* temp = header_;
header_ = NULL;
return temp;
}
void GetClusterConfigRequest::set_allocated_header(::pdpb::RequestHeader* header) {
delete header_;
header_ = header;
if (header) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.GetClusterConfigRequest.header)
}
inline const GetClusterConfigRequest* GetClusterConfigRequest::internal_default_instance() {
return &GetClusterConfigRequest_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int GetClusterConfigResponse::kHeaderFieldNumber;
const int GetClusterConfigResponse::kClusterFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
GetClusterConfigResponse::GetClusterConfigResponse()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.GetClusterConfigResponse)
}
void GetClusterConfigResponse::InitAsDefaultInstance() {
header_ = const_cast< ::pdpb::ResponseHeader*>(
::pdpb::ResponseHeader::internal_default_instance());
cluster_ = const_cast< ::metapb::Cluster*>(
::metapb::Cluster::internal_default_instance());
}
GetClusterConfigResponse::GetClusterConfigResponse(const GetClusterConfigResponse& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.GetClusterConfigResponse)
}
void GetClusterConfigResponse::SharedCtor() {
header_ = NULL;
cluster_ = NULL;
_cached_size_ = 0;
}
GetClusterConfigResponse::~GetClusterConfigResponse() {
// @@protoc_insertion_point(destructor:pdpb.GetClusterConfigResponse)
SharedDtor();
}
void GetClusterConfigResponse::SharedDtor() {
if (this != &GetClusterConfigResponse_default_instance_.get()) {
delete header_;
delete cluster_;
}
}
void GetClusterConfigResponse::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* GetClusterConfigResponse::descriptor() {
protobuf_AssignDescriptorsOnce();
return GetClusterConfigResponse_descriptor_;
}
const GetClusterConfigResponse& GetClusterConfigResponse::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<GetClusterConfigResponse> GetClusterConfigResponse_default_instance_;
GetClusterConfigResponse* GetClusterConfigResponse::New(::google::protobuf::Arena* arena) const {
GetClusterConfigResponse* n = new GetClusterConfigResponse;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void GetClusterConfigResponse::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.GetClusterConfigResponse)
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
if (GetArenaNoVirtual() == NULL && cluster_ != NULL) delete cluster_;
cluster_ = NULL;
}
bool GetClusterConfigResponse::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.GetClusterConfigResponse)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .pdpb.ResponseHeader header = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_header()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_cluster;
break;
}
// optional .metapb.Cluster cluster = 2;
case 2: {
if (tag == 18) {
parse_cluster:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_cluster()));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.GetClusterConfigResponse)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.GetClusterConfigResponse)
return false;
#undef DO_
}
void GetClusterConfigResponse::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.GetClusterConfigResponse)
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->header_, output);
}
// optional .metapb.Cluster cluster = 2;
if (this->has_cluster()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, *this->cluster_, output);
}
// @@protoc_insertion_point(serialize_end:pdpb.GetClusterConfigResponse)
}
::google::protobuf::uint8* GetClusterConfigResponse::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.GetClusterConfigResponse)
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->header_, false, target);
}
// optional .metapb.Cluster cluster = 2;
if (this->has_cluster()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
2, *this->cluster_, false, target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.GetClusterConfigResponse)
return target;
}
size_t GetClusterConfigResponse::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.GetClusterConfigResponse)
size_t total_size = 0;
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->header_);
}
// optional .metapb.Cluster cluster = 2;
if (this->has_cluster()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->cluster_);
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void GetClusterConfigResponse::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.GetClusterConfigResponse)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const GetClusterConfigResponse* source =
::google::protobuf::internal::DynamicCastToGenerated<const GetClusterConfigResponse>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.GetClusterConfigResponse)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.GetClusterConfigResponse)
UnsafeMergeFrom(*source);
}
}
void GetClusterConfigResponse::MergeFrom(const GetClusterConfigResponse& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.GetClusterConfigResponse)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void GetClusterConfigResponse::UnsafeMergeFrom(const GetClusterConfigResponse& from) {
GOOGLE_DCHECK(&from != this);
if (from.has_header()) {
mutable_header()->::pdpb::ResponseHeader::MergeFrom(from.header());
}
if (from.has_cluster()) {
mutable_cluster()->::metapb::Cluster::MergeFrom(from.cluster());
}
}
void GetClusterConfigResponse::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.GetClusterConfigResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void GetClusterConfigResponse::CopyFrom(const GetClusterConfigResponse& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.GetClusterConfigResponse)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool GetClusterConfigResponse::IsInitialized() const {
return true;
}
void GetClusterConfigResponse::Swap(GetClusterConfigResponse* other) {
if (other == this) return;
InternalSwap(other);
}
void GetClusterConfigResponse::InternalSwap(GetClusterConfigResponse* other) {
std::swap(header_, other->header_);
std::swap(cluster_, other->cluster_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata GetClusterConfigResponse::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = GetClusterConfigResponse_descriptor_;
metadata.reflection = GetClusterConfigResponse_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// GetClusterConfigResponse
// optional .pdpb.ResponseHeader header = 1;
bool GetClusterConfigResponse::has_header() const {
return this != internal_default_instance() && header_ != NULL;
}
void GetClusterConfigResponse::clear_header() {
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
const ::pdpb::ResponseHeader& GetClusterConfigResponse::header() const {
// @@protoc_insertion_point(field_get:pdpb.GetClusterConfigResponse.header)
return header_ != NULL ? *header_
: *::pdpb::ResponseHeader::internal_default_instance();
}
::pdpb::ResponseHeader* GetClusterConfigResponse::mutable_header() {
if (header_ == NULL) {
header_ = new ::pdpb::ResponseHeader;
}
// @@protoc_insertion_point(field_mutable:pdpb.GetClusterConfigResponse.header)
return header_;
}
::pdpb::ResponseHeader* GetClusterConfigResponse::release_header() {
// @@protoc_insertion_point(field_release:pdpb.GetClusterConfigResponse.header)
::pdpb::ResponseHeader* temp = header_;
header_ = NULL;
return temp;
}
void GetClusterConfigResponse::set_allocated_header(::pdpb::ResponseHeader* header) {
delete header_;
header_ = header;
if (header) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.GetClusterConfigResponse.header)
}
// optional .metapb.Cluster cluster = 2;
bool GetClusterConfigResponse::has_cluster() const {
return this != internal_default_instance() && cluster_ != NULL;
}
void GetClusterConfigResponse::clear_cluster() {
if (GetArenaNoVirtual() == NULL && cluster_ != NULL) delete cluster_;
cluster_ = NULL;
}
const ::metapb::Cluster& GetClusterConfigResponse::cluster() const {
// @@protoc_insertion_point(field_get:pdpb.GetClusterConfigResponse.cluster)
return cluster_ != NULL ? *cluster_
: *::metapb::Cluster::internal_default_instance();
}
::metapb::Cluster* GetClusterConfigResponse::mutable_cluster() {
if (cluster_ == NULL) {
cluster_ = new ::metapb::Cluster;
}
// @@protoc_insertion_point(field_mutable:pdpb.GetClusterConfigResponse.cluster)
return cluster_;
}
::metapb::Cluster* GetClusterConfigResponse::release_cluster() {
// @@protoc_insertion_point(field_release:pdpb.GetClusterConfigResponse.cluster)
::metapb::Cluster* temp = cluster_;
cluster_ = NULL;
return temp;
}
void GetClusterConfigResponse::set_allocated_cluster(::metapb::Cluster* cluster) {
delete cluster_;
cluster_ = cluster;
if (cluster) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.GetClusterConfigResponse.cluster)
}
inline const GetClusterConfigResponse* GetClusterConfigResponse::internal_default_instance() {
return &GetClusterConfigResponse_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int PutClusterConfigRequest::kHeaderFieldNumber;
const int PutClusterConfigRequest::kClusterFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
PutClusterConfigRequest::PutClusterConfigRequest()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.PutClusterConfigRequest)
}
void PutClusterConfigRequest::InitAsDefaultInstance() {
header_ = const_cast< ::pdpb::RequestHeader*>(
::pdpb::RequestHeader::internal_default_instance());
cluster_ = const_cast< ::metapb::Cluster*>(
::metapb::Cluster::internal_default_instance());
}
PutClusterConfigRequest::PutClusterConfigRequest(const PutClusterConfigRequest& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.PutClusterConfigRequest)
}
void PutClusterConfigRequest::SharedCtor() {
header_ = NULL;
cluster_ = NULL;
_cached_size_ = 0;
}
PutClusterConfigRequest::~PutClusterConfigRequest() {
// @@protoc_insertion_point(destructor:pdpb.PutClusterConfigRequest)
SharedDtor();
}
void PutClusterConfigRequest::SharedDtor() {
if (this != &PutClusterConfigRequest_default_instance_.get()) {
delete header_;
delete cluster_;
}
}
void PutClusterConfigRequest::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* PutClusterConfigRequest::descriptor() {
protobuf_AssignDescriptorsOnce();
return PutClusterConfigRequest_descriptor_;
}
const PutClusterConfigRequest& PutClusterConfigRequest::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<PutClusterConfigRequest> PutClusterConfigRequest_default_instance_;
PutClusterConfigRequest* PutClusterConfigRequest::New(::google::protobuf::Arena* arena) const {
PutClusterConfigRequest* n = new PutClusterConfigRequest;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void PutClusterConfigRequest::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.PutClusterConfigRequest)
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
if (GetArenaNoVirtual() == NULL && cluster_ != NULL) delete cluster_;
cluster_ = NULL;
}
bool PutClusterConfigRequest::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.PutClusterConfigRequest)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .pdpb.RequestHeader header = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_header()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_cluster;
break;
}
// optional .metapb.Cluster cluster = 2;
case 2: {
if (tag == 18) {
parse_cluster:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_cluster()));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.PutClusterConfigRequest)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.PutClusterConfigRequest)
return false;
#undef DO_
}
void PutClusterConfigRequest::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.PutClusterConfigRequest)
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->header_, output);
}
// optional .metapb.Cluster cluster = 2;
if (this->has_cluster()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, *this->cluster_, output);
}
// @@protoc_insertion_point(serialize_end:pdpb.PutClusterConfigRequest)
}
::google::protobuf::uint8* PutClusterConfigRequest::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.PutClusterConfigRequest)
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->header_, false, target);
}
// optional .metapb.Cluster cluster = 2;
if (this->has_cluster()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
2, *this->cluster_, false, target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.PutClusterConfigRequest)
return target;
}
size_t PutClusterConfigRequest::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.PutClusterConfigRequest)
size_t total_size = 0;
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->header_);
}
// optional .metapb.Cluster cluster = 2;
if (this->has_cluster()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->cluster_);
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void PutClusterConfigRequest::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.PutClusterConfigRequest)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const PutClusterConfigRequest* source =
::google::protobuf::internal::DynamicCastToGenerated<const PutClusterConfigRequest>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.PutClusterConfigRequest)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.PutClusterConfigRequest)
UnsafeMergeFrom(*source);
}
}
void PutClusterConfigRequest::MergeFrom(const PutClusterConfigRequest& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.PutClusterConfigRequest)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void PutClusterConfigRequest::UnsafeMergeFrom(const PutClusterConfigRequest& from) {
GOOGLE_DCHECK(&from != this);
if (from.has_header()) {
mutable_header()->::pdpb::RequestHeader::MergeFrom(from.header());
}
if (from.has_cluster()) {
mutable_cluster()->::metapb::Cluster::MergeFrom(from.cluster());
}
}
void PutClusterConfigRequest::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.PutClusterConfigRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void PutClusterConfigRequest::CopyFrom(const PutClusterConfigRequest& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.PutClusterConfigRequest)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool PutClusterConfigRequest::IsInitialized() const {
return true;
}
void PutClusterConfigRequest::Swap(PutClusterConfigRequest* other) {
if (other == this) return;
InternalSwap(other);
}
void PutClusterConfigRequest::InternalSwap(PutClusterConfigRequest* other) {
std::swap(header_, other->header_);
std::swap(cluster_, other->cluster_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata PutClusterConfigRequest::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = PutClusterConfigRequest_descriptor_;
metadata.reflection = PutClusterConfigRequest_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// PutClusterConfigRequest
// optional .pdpb.RequestHeader header = 1;
bool PutClusterConfigRequest::has_header() const {
return this != internal_default_instance() && header_ != NULL;
}
void PutClusterConfigRequest::clear_header() {
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
const ::pdpb::RequestHeader& PutClusterConfigRequest::header() const {
// @@protoc_insertion_point(field_get:pdpb.PutClusterConfigRequest.header)
return header_ != NULL ? *header_
: *::pdpb::RequestHeader::internal_default_instance();
}
::pdpb::RequestHeader* PutClusterConfigRequest::mutable_header() {
if (header_ == NULL) {
header_ = new ::pdpb::RequestHeader;
}
// @@protoc_insertion_point(field_mutable:pdpb.PutClusterConfigRequest.header)
return header_;
}
::pdpb::RequestHeader* PutClusterConfigRequest::release_header() {
// @@protoc_insertion_point(field_release:pdpb.PutClusterConfigRequest.header)
::pdpb::RequestHeader* temp = header_;
header_ = NULL;
return temp;
}
void PutClusterConfigRequest::set_allocated_header(::pdpb::RequestHeader* header) {
delete header_;
header_ = header;
if (header) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.PutClusterConfigRequest.header)
}
// optional .metapb.Cluster cluster = 2;
bool PutClusterConfigRequest::has_cluster() const {
return this != internal_default_instance() && cluster_ != NULL;
}
void PutClusterConfigRequest::clear_cluster() {
if (GetArenaNoVirtual() == NULL && cluster_ != NULL) delete cluster_;
cluster_ = NULL;
}
const ::metapb::Cluster& PutClusterConfigRequest::cluster() const {
// @@protoc_insertion_point(field_get:pdpb.PutClusterConfigRequest.cluster)
return cluster_ != NULL ? *cluster_
: *::metapb::Cluster::internal_default_instance();
}
::metapb::Cluster* PutClusterConfigRequest::mutable_cluster() {
if (cluster_ == NULL) {
cluster_ = new ::metapb::Cluster;
}
// @@protoc_insertion_point(field_mutable:pdpb.PutClusterConfigRequest.cluster)
return cluster_;
}
::metapb::Cluster* PutClusterConfigRequest::release_cluster() {
// @@protoc_insertion_point(field_release:pdpb.PutClusterConfigRequest.cluster)
::metapb::Cluster* temp = cluster_;
cluster_ = NULL;
return temp;
}
void PutClusterConfigRequest::set_allocated_cluster(::metapb::Cluster* cluster) {
delete cluster_;
cluster_ = cluster;
if (cluster) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.PutClusterConfigRequest.cluster)
}
inline const PutClusterConfigRequest* PutClusterConfigRequest::internal_default_instance() {
return &PutClusterConfigRequest_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int PutClusterConfigResponse::kHeaderFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
PutClusterConfigResponse::PutClusterConfigResponse()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.PutClusterConfigResponse)
}
void PutClusterConfigResponse::InitAsDefaultInstance() {
header_ = const_cast< ::pdpb::ResponseHeader*>(
::pdpb::ResponseHeader::internal_default_instance());
}
PutClusterConfigResponse::PutClusterConfigResponse(const PutClusterConfigResponse& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.PutClusterConfigResponse)
}
void PutClusterConfigResponse::SharedCtor() {
header_ = NULL;
_cached_size_ = 0;
}
PutClusterConfigResponse::~PutClusterConfigResponse() {
// @@protoc_insertion_point(destructor:pdpb.PutClusterConfigResponse)
SharedDtor();
}
void PutClusterConfigResponse::SharedDtor() {
if (this != &PutClusterConfigResponse_default_instance_.get()) {
delete header_;
}
}
void PutClusterConfigResponse::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* PutClusterConfigResponse::descriptor() {
protobuf_AssignDescriptorsOnce();
return PutClusterConfigResponse_descriptor_;
}
const PutClusterConfigResponse& PutClusterConfigResponse::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<PutClusterConfigResponse> PutClusterConfigResponse_default_instance_;
PutClusterConfigResponse* PutClusterConfigResponse::New(::google::protobuf::Arena* arena) const {
PutClusterConfigResponse* n = new PutClusterConfigResponse;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void PutClusterConfigResponse::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.PutClusterConfigResponse)
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
bool PutClusterConfigResponse::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.PutClusterConfigResponse)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .pdpb.ResponseHeader header = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_header()));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.PutClusterConfigResponse)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.PutClusterConfigResponse)
return false;
#undef DO_
}
void PutClusterConfigResponse::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.PutClusterConfigResponse)
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->header_, output);
}
// @@protoc_insertion_point(serialize_end:pdpb.PutClusterConfigResponse)
}
::google::protobuf::uint8* PutClusterConfigResponse::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.PutClusterConfigResponse)
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->header_, false, target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.PutClusterConfigResponse)
return target;
}
size_t PutClusterConfigResponse::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.PutClusterConfigResponse)
size_t total_size = 0;
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->header_);
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void PutClusterConfigResponse::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.PutClusterConfigResponse)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const PutClusterConfigResponse* source =
::google::protobuf::internal::DynamicCastToGenerated<const PutClusterConfigResponse>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.PutClusterConfigResponse)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.PutClusterConfigResponse)
UnsafeMergeFrom(*source);
}
}
void PutClusterConfigResponse::MergeFrom(const PutClusterConfigResponse& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.PutClusterConfigResponse)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void PutClusterConfigResponse::UnsafeMergeFrom(const PutClusterConfigResponse& from) {
GOOGLE_DCHECK(&from != this);
if (from.has_header()) {
mutable_header()->::pdpb::ResponseHeader::MergeFrom(from.header());
}
}
void PutClusterConfigResponse::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.PutClusterConfigResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void PutClusterConfigResponse::CopyFrom(const PutClusterConfigResponse& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.PutClusterConfigResponse)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool PutClusterConfigResponse::IsInitialized() const {
return true;
}
void PutClusterConfigResponse::Swap(PutClusterConfigResponse* other) {
if (other == this) return;
InternalSwap(other);
}
void PutClusterConfigResponse::InternalSwap(PutClusterConfigResponse* other) {
std::swap(header_, other->header_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata PutClusterConfigResponse::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = PutClusterConfigResponse_descriptor_;
metadata.reflection = PutClusterConfigResponse_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// PutClusterConfigResponse
// optional .pdpb.ResponseHeader header = 1;
bool PutClusterConfigResponse::has_header() const {
return this != internal_default_instance() && header_ != NULL;
}
void PutClusterConfigResponse::clear_header() {
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
const ::pdpb::ResponseHeader& PutClusterConfigResponse::header() const {
// @@protoc_insertion_point(field_get:pdpb.PutClusterConfigResponse.header)
return header_ != NULL ? *header_
: *::pdpb::ResponseHeader::internal_default_instance();
}
::pdpb::ResponseHeader* PutClusterConfigResponse::mutable_header() {
if (header_ == NULL) {
header_ = new ::pdpb::ResponseHeader;
}
// @@protoc_insertion_point(field_mutable:pdpb.PutClusterConfigResponse.header)
return header_;
}
::pdpb::ResponseHeader* PutClusterConfigResponse::release_header() {
// @@protoc_insertion_point(field_release:pdpb.PutClusterConfigResponse.header)
::pdpb::ResponseHeader* temp = header_;
header_ = NULL;
return temp;
}
void PutClusterConfigResponse::set_allocated_header(::pdpb::ResponseHeader* header) {
delete header_;
header_ = header;
if (header) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.PutClusterConfigResponse.header)
}
inline const PutClusterConfigResponse* PutClusterConfigResponse::internal_default_instance() {
return &PutClusterConfigResponse_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int Member::kNameFieldNumber;
const int Member::kMemberIdFieldNumber;
const int Member::kPeerUrlsFieldNumber;
const int Member::kClientUrlsFieldNumber;
const int Member::kLeaderPriorityFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
Member::Member()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.Member)
}
void Member::InitAsDefaultInstance() {
}
Member::Member(const Member& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.Member)
}
void Member::SharedCtor() {
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
::memset(&member_id_, 0, reinterpret_cast<char*>(&leader_priority_) -
reinterpret_cast<char*>(&member_id_) + sizeof(leader_priority_));
_cached_size_ = 0;
}
Member::~Member() {
// @@protoc_insertion_point(destructor:pdpb.Member)
SharedDtor();
}
void Member::SharedDtor() {
name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void Member::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* Member::descriptor() {
protobuf_AssignDescriptorsOnce();
return Member_descriptor_;
}
const Member& Member::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<Member> Member_default_instance_;
Member* Member::New(::google::protobuf::Arena* arena) const {
Member* n = new Member;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void Member::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.Member)
#if defined(__clang__)
#define ZR_HELPER_(f) \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Winvalid-offsetof\"") \
__builtin_offsetof(Member, f) \
_Pragma("clang diagnostic pop")
#else
#define ZR_HELPER_(f) reinterpret_cast<char*>(\
&reinterpret_cast<Member*>(16)->f)
#endif
#define ZR_(first, last) do {\
::memset(&(first), 0,\
ZR_HELPER_(last) - ZR_HELPER_(first) + sizeof(last));\
} while (0)
ZR_(member_id_, leader_priority_);
name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
#undef ZR_HELPER_
#undef ZR_
peer_urls_.Clear();
client_urls_.Clear();
}
bool Member::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.Member)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional string name = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_name()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormatLite::PARSE,
"pdpb.Member.name"));
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_member_id;
break;
}
// optional uint64 member_id = 2;
case 2: {
if (tag == 16) {
parse_member_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &member_id_)));
} else {
goto handle_unusual;
}
if (input->ExpectTag(26)) goto parse_peer_urls;
break;
}
// repeated string peer_urls = 3;
case 3: {
if (tag == 26) {
parse_peer_urls:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->add_peer_urls()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->peer_urls(this->peer_urls_size() - 1).data(),
this->peer_urls(this->peer_urls_size() - 1).length(),
::google::protobuf::internal::WireFormatLite::PARSE,
"pdpb.Member.peer_urls"));
} else {
goto handle_unusual;
}
if (input->ExpectTag(26)) goto parse_peer_urls;
if (input->ExpectTag(34)) goto parse_client_urls;
break;
}
// repeated string client_urls = 4;
case 4: {
if (tag == 34) {
parse_client_urls:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->add_client_urls()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->client_urls(this->client_urls_size() - 1).data(),
this->client_urls(this->client_urls_size() - 1).length(),
::google::protobuf::internal::WireFormatLite::PARSE,
"pdpb.Member.client_urls"));
} else {
goto handle_unusual;
}
if (input->ExpectTag(34)) goto parse_client_urls;
if (input->ExpectTag(40)) goto parse_leader_priority;
break;
}
// optional int32 leader_priority = 5;
case 5: {
if (tag == 40) {
parse_leader_priority:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
input, &leader_priority_)));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.Member)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.Member)
return false;
#undef DO_
}
void Member::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.Member)
// optional string name = 1;
if (this->name().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"pdpb.Member.name");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
1, this->name(), output);
}
// optional uint64 member_id = 2;
if (this->member_id() != 0) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(2, this->member_id(), output);
}
// repeated string peer_urls = 3;
for (int i = 0; i < this->peer_urls_size(); i++) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->peer_urls(i).data(), this->peer_urls(i).length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"pdpb.Member.peer_urls");
::google::protobuf::internal::WireFormatLite::WriteString(
3, this->peer_urls(i), output);
}
// repeated string client_urls = 4;
for (int i = 0; i < this->client_urls_size(); i++) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->client_urls(i).data(), this->client_urls(i).length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"pdpb.Member.client_urls");
::google::protobuf::internal::WireFormatLite::WriteString(
4, this->client_urls(i), output);
}
// optional int32 leader_priority = 5;
if (this->leader_priority() != 0) {
::google::protobuf::internal::WireFormatLite::WriteInt32(5, this->leader_priority(), output);
}
// @@protoc_insertion_point(serialize_end:pdpb.Member)
}
::google::protobuf::uint8* Member::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.Member)
// optional string name = 1;
if (this->name().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"pdpb.Member.name");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
1, this->name(), target);
}
// optional uint64 member_id = 2;
if (this->member_id() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(2, this->member_id(), target);
}
// repeated string peer_urls = 3;
for (int i = 0; i < this->peer_urls_size(); i++) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->peer_urls(i).data(), this->peer_urls(i).length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"pdpb.Member.peer_urls");
target = ::google::protobuf::internal::WireFormatLite::
WriteStringToArray(3, this->peer_urls(i), target);
}
// repeated string client_urls = 4;
for (int i = 0; i < this->client_urls_size(); i++) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->client_urls(i).data(), this->client_urls(i).length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"pdpb.Member.client_urls");
target = ::google::protobuf::internal::WireFormatLite::
WriteStringToArray(4, this->client_urls(i), target);
}
// optional int32 leader_priority = 5;
if (this->leader_priority() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(5, this->leader_priority(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.Member)
return target;
}
size_t Member::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.Member)
size_t total_size = 0;
// optional string name = 1;
if (this->name().size() > 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->name());
}
// optional uint64 member_id = 2;
if (this->member_id() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->member_id());
}
// optional int32 leader_priority = 5;
if (this->leader_priority() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::Int32Size(
this->leader_priority());
}
// repeated string peer_urls = 3;
total_size += 1 *
::google::protobuf::internal::FromIntSize(this->peer_urls_size());
for (int i = 0; i < this->peer_urls_size(); i++) {
total_size += ::google::protobuf::internal::WireFormatLite::StringSize(
this->peer_urls(i));
}
// repeated string client_urls = 4;
total_size += 1 *
::google::protobuf::internal::FromIntSize(this->client_urls_size());
for (int i = 0; i < this->client_urls_size(); i++) {
total_size += ::google::protobuf::internal::WireFormatLite::StringSize(
this->client_urls(i));
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void Member::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.Member)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const Member* source =
::google::protobuf::internal::DynamicCastToGenerated<const Member>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.Member)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.Member)
UnsafeMergeFrom(*source);
}
}
void Member::MergeFrom(const Member& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.Member)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void Member::UnsafeMergeFrom(const Member& from) {
GOOGLE_DCHECK(&from != this);
peer_urls_.UnsafeMergeFrom(from.peer_urls_);
client_urls_.UnsafeMergeFrom(from.client_urls_);
if (from.name().size() > 0) {
name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_);
}
if (from.member_id() != 0) {
set_member_id(from.member_id());
}
if (from.leader_priority() != 0) {
set_leader_priority(from.leader_priority());
}
}
void Member::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.Member)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void Member::CopyFrom(const Member& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.Member)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool Member::IsInitialized() const {
return true;
}
void Member::Swap(Member* other) {
if (other == this) return;
InternalSwap(other);
}
void Member::InternalSwap(Member* other) {
name_.Swap(&other->name_);
std::swap(member_id_, other->member_id_);
peer_urls_.UnsafeArenaSwap(&other->peer_urls_);
client_urls_.UnsafeArenaSwap(&other->client_urls_);
std::swap(leader_priority_, other->leader_priority_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata Member::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = Member_descriptor_;
metadata.reflection = Member_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// Member
// optional string name = 1;
void Member::clear_name() {
name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
const ::std::string& Member::name() const {
// @@protoc_insertion_point(field_get:pdpb.Member.name)
return name_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void Member::set_name(const ::std::string& value) {
name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:pdpb.Member.name)
}
void Member::set_name(const char* value) {
name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:pdpb.Member.name)
}
void Member::set_name(const char* value, size_t size) {
name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:pdpb.Member.name)
}
::std::string* Member::mutable_name() {
// @@protoc_insertion_point(field_mutable:pdpb.Member.name)
return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
::std::string* Member::release_name() {
// @@protoc_insertion_point(field_release:pdpb.Member.name)
return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void Member::set_allocated_name(::std::string* name) {
if (name != NULL) {
} else {
}
name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name);
// @@protoc_insertion_point(field_set_allocated:pdpb.Member.name)
}
// optional uint64 member_id = 2;
void Member::clear_member_id() {
member_id_ = GOOGLE_ULONGLONG(0);
}
::google::protobuf::uint64 Member::member_id() const {
// @@protoc_insertion_point(field_get:pdpb.Member.member_id)
return member_id_;
}
void Member::set_member_id(::google::protobuf::uint64 value) {
member_id_ = value;
// @@protoc_insertion_point(field_set:pdpb.Member.member_id)
}
// repeated string peer_urls = 3;
int Member::peer_urls_size() const {
return peer_urls_.size();
}
void Member::clear_peer_urls() {
peer_urls_.Clear();
}
const ::std::string& Member::peer_urls(int index) const {
// @@protoc_insertion_point(field_get:pdpb.Member.peer_urls)
return peer_urls_.Get(index);
}
::std::string* Member::mutable_peer_urls(int index) {
// @@protoc_insertion_point(field_mutable:pdpb.Member.peer_urls)
return peer_urls_.Mutable(index);
}
void Member::set_peer_urls(int index, const ::std::string& value) {
// @@protoc_insertion_point(field_set:pdpb.Member.peer_urls)
peer_urls_.Mutable(index)->assign(value);
}
void Member::set_peer_urls(int index, const char* value) {
peer_urls_.Mutable(index)->assign(value);
// @@protoc_insertion_point(field_set_char:pdpb.Member.peer_urls)
}
void Member::set_peer_urls(int index, const char* value, size_t size) {
peer_urls_.Mutable(index)->assign(
reinterpret_cast<const char*>(value), size);
// @@protoc_insertion_point(field_set_pointer:pdpb.Member.peer_urls)
}
::std::string* Member::add_peer_urls() {
// @@protoc_insertion_point(field_add_mutable:pdpb.Member.peer_urls)
return peer_urls_.Add();
}
void Member::add_peer_urls(const ::std::string& value) {
peer_urls_.Add()->assign(value);
// @@protoc_insertion_point(field_add:pdpb.Member.peer_urls)
}
void Member::add_peer_urls(const char* value) {
peer_urls_.Add()->assign(value);
// @@protoc_insertion_point(field_add_char:pdpb.Member.peer_urls)
}
void Member::add_peer_urls(const char* value, size_t size) {
peer_urls_.Add()->assign(reinterpret_cast<const char*>(value), size);
// @@protoc_insertion_point(field_add_pointer:pdpb.Member.peer_urls)
}
const ::google::protobuf::RepeatedPtrField< ::std::string>&
Member::peer_urls() const {
// @@protoc_insertion_point(field_list:pdpb.Member.peer_urls)
return peer_urls_;
}
::google::protobuf::RepeatedPtrField< ::std::string>*
Member::mutable_peer_urls() {
// @@protoc_insertion_point(field_mutable_list:pdpb.Member.peer_urls)
return &peer_urls_;
}
// repeated string client_urls = 4;
int Member::client_urls_size() const {
return client_urls_.size();
}
void Member::clear_client_urls() {
client_urls_.Clear();
}
const ::std::string& Member::client_urls(int index) const {
// @@protoc_insertion_point(field_get:pdpb.Member.client_urls)
return client_urls_.Get(index);
}
::std::string* Member::mutable_client_urls(int index) {
// @@protoc_insertion_point(field_mutable:pdpb.Member.client_urls)
return client_urls_.Mutable(index);
}
void Member::set_client_urls(int index, const ::std::string& value) {
// @@protoc_insertion_point(field_set:pdpb.Member.client_urls)
client_urls_.Mutable(index)->assign(value);
}
void Member::set_client_urls(int index, const char* value) {
client_urls_.Mutable(index)->assign(value);
// @@protoc_insertion_point(field_set_char:pdpb.Member.client_urls)
}
void Member::set_client_urls(int index, const char* value, size_t size) {
client_urls_.Mutable(index)->assign(
reinterpret_cast<const char*>(value), size);
// @@protoc_insertion_point(field_set_pointer:pdpb.Member.client_urls)
}
::std::string* Member::add_client_urls() {
// @@protoc_insertion_point(field_add_mutable:pdpb.Member.client_urls)
return client_urls_.Add();
}
void Member::add_client_urls(const ::std::string& value) {
client_urls_.Add()->assign(value);
// @@protoc_insertion_point(field_add:pdpb.Member.client_urls)
}
void Member::add_client_urls(const char* value) {
client_urls_.Add()->assign(value);
// @@protoc_insertion_point(field_add_char:pdpb.Member.client_urls)
}
void Member::add_client_urls(const char* value, size_t size) {
client_urls_.Add()->assign(reinterpret_cast<const char*>(value), size);
// @@protoc_insertion_point(field_add_pointer:pdpb.Member.client_urls)
}
const ::google::protobuf::RepeatedPtrField< ::std::string>&
Member::client_urls() const {
// @@protoc_insertion_point(field_list:pdpb.Member.client_urls)
return client_urls_;
}
::google::protobuf::RepeatedPtrField< ::std::string>*
Member::mutable_client_urls() {
// @@protoc_insertion_point(field_mutable_list:pdpb.Member.client_urls)
return &client_urls_;
}
// optional int32 leader_priority = 5;
void Member::clear_leader_priority() {
leader_priority_ = 0;
}
::google::protobuf::int32 Member::leader_priority() const {
// @@protoc_insertion_point(field_get:pdpb.Member.leader_priority)
return leader_priority_;
}
void Member::set_leader_priority(::google::protobuf::int32 value) {
leader_priority_ = value;
// @@protoc_insertion_point(field_set:pdpb.Member.leader_priority)
}
inline const Member* Member::internal_default_instance() {
return &Member_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int GetMembersRequest::kHeaderFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
GetMembersRequest::GetMembersRequest()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.GetMembersRequest)
}
void GetMembersRequest::InitAsDefaultInstance() {
header_ = const_cast< ::pdpb::RequestHeader*>(
::pdpb::RequestHeader::internal_default_instance());
}
GetMembersRequest::GetMembersRequest(const GetMembersRequest& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.GetMembersRequest)
}
void GetMembersRequest::SharedCtor() {
header_ = NULL;
_cached_size_ = 0;
}
GetMembersRequest::~GetMembersRequest() {
// @@protoc_insertion_point(destructor:pdpb.GetMembersRequest)
SharedDtor();
}
void GetMembersRequest::SharedDtor() {
if (this != &GetMembersRequest_default_instance_.get()) {
delete header_;
}
}
void GetMembersRequest::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* GetMembersRequest::descriptor() {
protobuf_AssignDescriptorsOnce();
return GetMembersRequest_descriptor_;
}
const GetMembersRequest& GetMembersRequest::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<GetMembersRequest> GetMembersRequest_default_instance_;
GetMembersRequest* GetMembersRequest::New(::google::protobuf::Arena* arena) const {
GetMembersRequest* n = new GetMembersRequest;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void GetMembersRequest::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.GetMembersRequest)
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
bool GetMembersRequest::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.GetMembersRequest)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .pdpb.RequestHeader header = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_header()));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.GetMembersRequest)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.GetMembersRequest)
return false;
#undef DO_
}
void GetMembersRequest::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.GetMembersRequest)
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->header_, output);
}
// @@protoc_insertion_point(serialize_end:pdpb.GetMembersRequest)
}
::google::protobuf::uint8* GetMembersRequest::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.GetMembersRequest)
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->header_, false, target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.GetMembersRequest)
return target;
}
size_t GetMembersRequest::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.GetMembersRequest)
size_t total_size = 0;
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->header_);
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void GetMembersRequest::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.GetMembersRequest)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const GetMembersRequest* source =
::google::protobuf::internal::DynamicCastToGenerated<const GetMembersRequest>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.GetMembersRequest)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.GetMembersRequest)
UnsafeMergeFrom(*source);
}
}
void GetMembersRequest::MergeFrom(const GetMembersRequest& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.GetMembersRequest)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void GetMembersRequest::UnsafeMergeFrom(const GetMembersRequest& from) {
GOOGLE_DCHECK(&from != this);
if (from.has_header()) {
mutable_header()->::pdpb::RequestHeader::MergeFrom(from.header());
}
}
void GetMembersRequest::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.GetMembersRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void GetMembersRequest::CopyFrom(const GetMembersRequest& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.GetMembersRequest)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool GetMembersRequest::IsInitialized() const {
return true;
}
void GetMembersRequest::Swap(GetMembersRequest* other) {
if (other == this) return;
InternalSwap(other);
}
void GetMembersRequest::InternalSwap(GetMembersRequest* other) {
std::swap(header_, other->header_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata GetMembersRequest::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = GetMembersRequest_descriptor_;
metadata.reflection = GetMembersRequest_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// GetMembersRequest
// optional .pdpb.RequestHeader header = 1;
bool GetMembersRequest::has_header() const {
return this != internal_default_instance() && header_ != NULL;
}
void GetMembersRequest::clear_header() {
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
const ::pdpb::RequestHeader& GetMembersRequest::header() const {
// @@protoc_insertion_point(field_get:pdpb.GetMembersRequest.header)
return header_ != NULL ? *header_
: *::pdpb::RequestHeader::internal_default_instance();
}
::pdpb::RequestHeader* GetMembersRequest::mutable_header() {
if (header_ == NULL) {
header_ = new ::pdpb::RequestHeader;
}
// @@protoc_insertion_point(field_mutable:pdpb.GetMembersRequest.header)
return header_;
}
::pdpb::RequestHeader* GetMembersRequest::release_header() {
// @@protoc_insertion_point(field_release:pdpb.GetMembersRequest.header)
::pdpb::RequestHeader* temp = header_;
header_ = NULL;
return temp;
}
void GetMembersRequest::set_allocated_header(::pdpb::RequestHeader* header) {
delete header_;
header_ = header;
if (header) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.GetMembersRequest.header)
}
inline const GetMembersRequest* GetMembersRequest::internal_default_instance() {
return &GetMembersRequest_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int GetMembersResponse::kHeaderFieldNumber;
const int GetMembersResponse::kMembersFieldNumber;
const int GetMembersResponse::kLeaderFieldNumber;
const int GetMembersResponse::kEtcdLeaderFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
GetMembersResponse::GetMembersResponse()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.GetMembersResponse)
}
void GetMembersResponse::InitAsDefaultInstance() {
header_ = const_cast< ::pdpb::ResponseHeader*>(
::pdpb::ResponseHeader::internal_default_instance());
leader_ = const_cast< ::pdpb::Member*>(
::pdpb::Member::internal_default_instance());
etcd_leader_ = const_cast< ::pdpb::Member*>(
::pdpb::Member::internal_default_instance());
}
GetMembersResponse::GetMembersResponse(const GetMembersResponse& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.GetMembersResponse)
}
void GetMembersResponse::SharedCtor() {
header_ = NULL;
leader_ = NULL;
etcd_leader_ = NULL;
_cached_size_ = 0;
}
GetMembersResponse::~GetMembersResponse() {
// @@protoc_insertion_point(destructor:pdpb.GetMembersResponse)
SharedDtor();
}
void GetMembersResponse::SharedDtor() {
if (this != &GetMembersResponse_default_instance_.get()) {
delete header_;
delete leader_;
delete etcd_leader_;
}
}
void GetMembersResponse::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* GetMembersResponse::descriptor() {
protobuf_AssignDescriptorsOnce();
return GetMembersResponse_descriptor_;
}
const GetMembersResponse& GetMembersResponse::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<GetMembersResponse> GetMembersResponse_default_instance_;
GetMembersResponse* GetMembersResponse::New(::google::protobuf::Arena* arena) const {
GetMembersResponse* n = new GetMembersResponse;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void GetMembersResponse::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.GetMembersResponse)
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
if (GetArenaNoVirtual() == NULL && leader_ != NULL) delete leader_;
leader_ = NULL;
if (GetArenaNoVirtual() == NULL && etcd_leader_ != NULL) delete etcd_leader_;
etcd_leader_ = NULL;
members_.Clear();
}
bool GetMembersResponse::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.GetMembersResponse)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .pdpb.ResponseHeader header = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_header()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_members;
break;
}
// repeated .pdpb.Member members = 2;
case 2: {
if (tag == 18) {
parse_members:
DO_(input->IncrementRecursionDepth());
parse_loop_members:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth(
input, add_members()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_loop_members;
input->UnsafeDecrementRecursionDepth();
if (input->ExpectTag(26)) goto parse_leader;
break;
}
// optional .pdpb.Member leader = 3;
case 3: {
if (tag == 26) {
parse_leader:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_leader()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(34)) goto parse_etcd_leader;
break;
}
// optional .pdpb.Member etcd_leader = 4;
case 4: {
if (tag == 34) {
parse_etcd_leader:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_etcd_leader()));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.GetMembersResponse)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.GetMembersResponse)
return false;
#undef DO_
}
void GetMembersResponse::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.GetMembersResponse)
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->header_, output);
}
// repeated .pdpb.Member members = 2;
for (unsigned int i = 0, n = this->members_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, this->members(i), output);
}
// optional .pdpb.Member leader = 3;
if (this->has_leader()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, *this->leader_, output);
}
// optional .pdpb.Member etcd_leader = 4;
if (this->has_etcd_leader()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
4, *this->etcd_leader_, output);
}
// @@protoc_insertion_point(serialize_end:pdpb.GetMembersResponse)
}
::google::protobuf::uint8* GetMembersResponse::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.GetMembersResponse)
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->header_, false, target);
}
// repeated .pdpb.Member members = 2;
for (unsigned int i = 0, n = this->members_size(); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
2, this->members(i), false, target);
}
// optional .pdpb.Member leader = 3;
if (this->has_leader()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
3, *this->leader_, false, target);
}
// optional .pdpb.Member etcd_leader = 4;
if (this->has_etcd_leader()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
4, *this->etcd_leader_, false, target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.GetMembersResponse)
return target;
}
size_t GetMembersResponse::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.GetMembersResponse)
size_t total_size = 0;
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->header_);
}
// optional .pdpb.Member leader = 3;
if (this->has_leader()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->leader_);
}
// optional .pdpb.Member etcd_leader = 4;
if (this->has_etcd_leader()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->etcd_leader_);
}
// repeated .pdpb.Member members = 2;
{
unsigned int count = this->members_size();
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->members(i));
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void GetMembersResponse::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.GetMembersResponse)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const GetMembersResponse* source =
::google::protobuf::internal::DynamicCastToGenerated<const GetMembersResponse>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.GetMembersResponse)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.GetMembersResponse)
UnsafeMergeFrom(*source);
}
}
void GetMembersResponse::MergeFrom(const GetMembersResponse& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.GetMembersResponse)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void GetMembersResponse::UnsafeMergeFrom(const GetMembersResponse& from) {
GOOGLE_DCHECK(&from != this);
members_.MergeFrom(from.members_);
if (from.has_header()) {
mutable_header()->::pdpb::ResponseHeader::MergeFrom(from.header());
}
if (from.has_leader()) {
mutable_leader()->::pdpb::Member::MergeFrom(from.leader());
}
if (from.has_etcd_leader()) {
mutable_etcd_leader()->::pdpb::Member::MergeFrom(from.etcd_leader());
}
}
void GetMembersResponse::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.GetMembersResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void GetMembersResponse::CopyFrom(const GetMembersResponse& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.GetMembersResponse)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool GetMembersResponse::IsInitialized() const {
return true;
}
void GetMembersResponse::Swap(GetMembersResponse* other) {
if (other == this) return;
InternalSwap(other);
}
void GetMembersResponse::InternalSwap(GetMembersResponse* other) {
std::swap(header_, other->header_);
members_.UnsafeArenaSwap(&other->members_);
std::swap(leader_, other->leader_);
std::swap(etcd_leader_, other->etcd_leader_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata GetMembersResponse::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = GetMembersResponse_descriptor_;
metadata.reflection = GetMembersResponse_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// GetMembersResponse
// optional .pdpb.ResponseHeader header = 1;
bool GetMembersResponse::has_header() const {
return this != internal_default_instance() && header_ != NULL;
}
void GetMembersResponse::clear_header() {
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
const ::pdpb::ResponseHeader& GetMembersResponse::header() const {
// @@protoc_insertion_point(field_get:pdpb.GetMembersResponse.header)
return header_ != NULL ? *header_
: *::pdpb::ResponseHeader::internal_default_instance();
}
::pdpb::ResponseHeader* GetMembersResponse::mutable_header() {
if (header_ == NULL) {
header_ = new ::pdpb::ResponseHeader;
}
// @@protoc_insertion_point(field_mutable:pdpb.GetMembersResponse.header)
return header_;
}
::pdpb::ResponseHeader* GetMembersResponse::release_header() {
// @@protoc_insertion_point(field_release:pdpb.GetMembersResponse.header)
::pdpb::ResponseHeader* temp = header_;
header_ = NULL;
return temp;
}
void GetMembersResponse::set_allocated_header(::pdpb::ResponseHeader* header) {
delete header_;
header_ = header;
if (header) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.GetMembersResponse.header)
}
// repeated .pdpb.Member members = 2;
int GetMembersResponse::members_size() const {
return members_.size();
}
void GetMembersResponse::clear_members() {
members_.Clear();
}
const ::pdpb::Member& GetMembersResponse::members(int index) const {
// @@protoc_insertion_point(field_get:pdpb.GetMembersResponse.members)
return members_.Get(index);
}
::pdpb::Member* GetMembersResponse::mutable_members(int index) {
// @@protoc_insertion_point(field_mutable:pdpb.GetMembersResponse.members)
return members_.Mutable(index);
}
::pdpb::Member* GetMembersResponse::add_members() {
// @@protoc_insertion_point(field_add:pdpb.GetMembersResponse.members)
return members_.Add();
}
::google::protobuf::RepeatedPtrField< ::pdpb::Member >*
GetMembersResponse::mutable_members() {
// @@protoc_insertion_point(field_mutable_list:pdpb.GetMembersResponse.members)
return &members_;
}
const ::google::protobuf::RepeatedPtrField< ::pdpb::Member >&
GetMembersResponse::members() const {
// @@protoc_insertion_point(field_list:pdpb.GetMembersResponse.members)
return members_;
}
// optional .pdpb.Member leader = 3;
bool GetMembersResponse::has_leader() const {
return this != internal_default_instance() && leader_ != NULL;
}
void GetMembersResponse::clear_leader() {
if (GetArenaNoVirtual() == NULL && leader_ != NULL) delete leader_;
leader_ = NULL;
}
const ::pdpb::Member& GetMembersResponse::leader() const {
// @@protoc_insertion_point(field_get:pdpb.GetMembersResponse.leader)
return leader_ != NULL ? *leader_
: *::pdpb::Member::internal_default_instance();
}
::pdpb::Member* GetMembersResponse::mutable_leader() {
if (leader_ == NULL) {
leader_ = new ::pdpb::Member;
}
// @@protoc_insertion_point(field_mutable:pdpb.GetMembersResponse.leader)
return leader_;
}
::pdpb::Member* GetMembersResponse::release_leader() {
// @@protoc_insertion_point(field_release:pdpb.GetMembersResponse.leader)
::pdpb::Member* temp = leader_;
leader_ = NULL;
return temp;
}
void GetMembersResponse::set_allocated_leader(::pdpb::Member* leader) {
delete leader_;
leader_ = leader;
if (leader) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.GetMembersResponse.leader)
}
// optional .pdpb.Member etcd_leader = 4;
bool GetMembersResponse::has_etcd_leader() const {
return this != internal_default_instance() && etcd_leader_ != NULL;
}
void GetMembersResponse::clear_etcd_leader() {
if (GetArenaNoVirtual() == NULL && etcd_leader_ != NULL) delete etcd_leader_;
etcd_leader_ = NULL;
}
const ::pdpb::Member& GetMembersResponse::etcd_leader() const {
// @@protoc_insertion_point(field_get:pdpb.GetMembersResponse.etcd_leader)
return etcd_leader_ != NULL ? *etcd_leader_
: *::pdpb::Member::internal_default_instance();
}
::pdpb::Member* GetMembersResponse::mutable_etcd_leader() {
if (etcd_leader_ == NULL) {
etcd_leader_ = new ::pdpb::Member;
}
// @@protoc_insertion_point(field_mutable:pdpb.GetMembersResponse.etcd_leader)
return etcd_leader_;
}
::pdpb::Member* GetMembersResponse::release_etcd_leader() {
// @@protoc_insertion_point(field_release:pdpb.GetMembersResponse.etcd_leader)
::pdpb::Member* temp = etcd_leader_;
etcd_leader_ = NULL;
return temp;
}
void GetMembersResponse::set_allocated_etcd_leader(::pdpb::Member* etcd_leader) {
delete etcd_leader_;
etcd_leader_ = etcd_leader;
if (etcd_leader) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.GetMembersResponse.etcd_leader)
}
inline const GetMembersResponse* GetMembersResponse::internal_default_instance() {
return &GetMembersResponse_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int PeerStats::kPeerFieldNumber;
const int PeerStats::kDownSecondsFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
PeerStats::PeerStats()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.PeerStats)
}
void PeerStats::InitAsDefaultInstance() {
peer_ = const_cast< ::metapb::Peer*>(
::metapb::Peer::internal_default_instance());
}
PeerStats::PeerStats(const PeerStats& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.PeerStats)
}
void PeerStats::SharedCtor() {
peer_ = NULL;
down_seconds_ = GOOGLE_ULONGLONG(0);
_cached_size_ = 0;
}
PeerStats::~PeerStats() {
// @@protoc_insertion_point(destructor:pdpb.PeerStats)
SharedDtor();
}
void PeerStats::SharedDtor() {
if (this != &PeerStats_default_instance_.get()) {
delete peer_;
}
}
void PeerStats::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* PeerStats::descriptor() {
protobuf_AssignDescriptorsOnce();
return PeerStats_descriptor_;
}
const PeerStats& PeerStats::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<PeerStats> PeerStats_default_instance_;
PeerStats* PeerStats::New(::google::protobuf::Arena* arena) const {
PeerStats* n = new PeerStats;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void PeerStats::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.PeerStats)
if (GetArenaNoVirtual() == NULL && peer_ != NULL) delete peer_;
peer_ = NULL;
down_seconds_ = GOOGLE_ULONGLONG(0);
}
bool PeerStats::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.PeerStats)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .metapb.Peer peer = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_peer()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_down_seconds;
break;
}
// optional uint64 down_seconds = 2;
case 2: {
if (tag == 16) {
parse_down_seconds:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &down_seconds_)));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.PeerStats)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.PeerStats)
return false;
#undef DO_
}
void PeerStats::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.PeerStats)
// optional .metapb.Peer peer = 1;
if (this->has_peer()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->peer_, output);
}
// optional uint64 down_seconds = 2;
if (this->down_seconds() != 0) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(2, this->down_seconds(), output);
}
// @@protoc_insertion_point(serialize_end:pdpb.PeerStats)
}
::google::protobuf::uint8* PeerStats::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.PeerStats)
// optional .metapb.Peer peer = 1;
if (this->has_peer()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->peer_, false, target);
}
// optional uint64 down_seconds = 2;
if (this->down_seconds() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(2, this->down_seconds(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.PeerStats)
return target;
}
size_t PeerStats::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.PeerStats)
size_t total_size = 0;
// optional .metapb.Peer peer = 1;
if (this->has_peer()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->peer_);
}
// optional uint64 down_seconds = 2;
if (this->down_seconds() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->down_seconds());
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void PeerStats::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.PeerStats)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const PeerStats* source =
::google::protobuf::internal::DynamicCastToGenerated<const PeerStats>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.PeerStats)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.PeerStats)
UnsafeMergeFrom(*source);
}
}
void PeerStats::MergeFrom(const PeerStats& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.PeerStats)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void PeerStats::UnsafeMergeFrom(const PeerStats& from) {
GOOGLE_DCHECK(&from != this);
if (from.has_peer()) {
mutable_peer()->::metapb::Peer::MergeFrom(from.peer());
}
if (from.down_seconds() != 0) {
set_down_seconds(from.down_seconds());
}
}
void PeerStats::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.PeerStats)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void PeerStats::CopyFrom(const PeerStats& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.PeerStats)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool PeerStats::IsInitialized() const {
return true;
}
void PeerStats::Swap(PeerStats* other) {
if (other == this) return;
InternalSwap(other);
}
void PeerStats::InternalSwap(PeerStats* other) {
std::swap(peer_, other->peer_);
std::swap(down_seconds_, other->down_seconds_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata PeerStats::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = PeerStats_descriptor_;
metadata.reflection = PeerStats_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// PeerStats
// optional .metapb.Peer peer = 1;
bool PeerStats::has_peer() const {
return this != internal_default_instance() && peer_ != NULL;
}
void PeerStats::clear_peer() {
if (GetArenaNoVirtual() == NULL && peer_ != NULL) delete peer_;
peer_ = NULL;
}
const ::metapb::Peer& PeerStats::peer() const {
// @@protoc_insertion_point(field_get:pdpb.PeerStats.peer)
return peer_ != NULL ? *peer_
: *::metapb::Peer::internal_default_instance();
}
::metapb::Peer* PeerStats::mutable_peer() {
if (peer_ == NULL) {
peer_ = new ::metapb::Peer;
}
// @@protoc_insertion_point(field_mutable:pdpb.PeerStats.peer)
return peer_;
}
::metapb::Peer* PeerStats::release_peer() {
// @@protoc_insertion_point(field_release:pdpb.PeerStats.peer)
::metapb::Peer* temp = peer_;
peer_ = NULL;
return temp;
}
void PeerStats::set_allocated_peer(::metapb::Peer* peer) {
delete peer_;
peer_ = peer;
if (peer) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.PeerStats.peer)
}
// optional uint64 down_seconds = 2;
void PeerStats::clear_down_seconds() {
down_seconds_ = GOOGLE_ULONGLONG(0);
}
::google::protobuf::uint64 PeerStats::down_seconds() const {
// @@protoc_insertion_point(field_get:pdpb.PeerStats.down_seconds)
return down_seconds_;
}
void PeerStats::set_down_seconds(::google::protobuf::uint64 value) {
down_seconds_ = value;
// @@protoc_insertion_point(field_set:pdpb.PeerStats.down_seconds)
}
inline const PeerStats* PeerStats::internal_default_instance() {
return &PeerStats_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int RegionHeartbeatRequest::kHeaderFieldNumber;
const int RegionHeartbeatRequest::kRegionFieldNumber;
const int RegionHeartbeatRequest::kLeaderFieldNumber;
const int RegionHeartbeatRequest::kDownPeersFieldNumber;
const int RegionHeartbeatRequest::kPendingPeersFieldNumber;
const int RegionHeartbeatRequest::kBytesWrittenFieldNumber;
const int RegionHeartbeatRequest::kBytesReadFieldNumber;
const int RegionHeartbeatRequest::kKeysWrittenFieldNumber;
const int RegionHeartbeatRequest::kKeysReadFieldNumber;
const int RegionHeartbeatRequest::kApproximateSizeFieldNumber;
const int RegionHeartbeatRequest::kIntervalFieldNumber;
const int RegionHeartbeatRequest::kApproximateKeysFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
RegionHeartbeatRequest::RegionHeartbeatRequest()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.RegionHeartbeatRequest)
}
void RegionHeartbeatRequest::InitAsDefaultInstance() {
header_ = const_cast< ::pdpb::RequestHeader*>(
::pdpb::RequestHeader::internal_default_instance());
region_ = const_cast< ::metapb::Region*>(
::metapb::Region::internal_default_instance());
leader_ = const_cast< ::metapb::Peer*>(
::metapb::Peer::internal_default_instance());
interval_ = const_cast< ::pdpb::TimeInterval*>(
::pdpb::TimeInterval::internal_default_instance());
}
RegionHeartbeatRequest::RegionHeartbeatRequest(const RegionHeartbeatRequest& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.RegionHeartbeatRequest)
}
void RegionHeartbeatRequest::SharedCtor() {
header_ = NULL;
region_ = NULL;
leader_ = NULL;
interval_ = NULL;
::memset(&bytes_written_, 0, reinterpret_cast<char*>(&approximate_keys_) -
reinterpret_cast<char*>(&bytes_written_) + sizeof(approximate_keys_));
_cached_size_ = 0;
}
RegionHeartbeatRequest::~RegionHeartbeatRequest() {
// @@protoc_insertion_point(destructor:pdpb.RegionHeartbeatRequest)
SharedDtor();
}
void RegionHeartbeatRequest::SharedDtor() {
if (this != &RegionHeartbeatRequest_default_instance_.get()) {
delete header_;
delete region_;
delete leader_;
delete interval_;
}
}
void RegionHeartbeatRequest::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* RegionHeartbeatRequest::descriptor() {
protobuf_AssignDescriptorsOnce();
return RegionHeartbeatRequest_descriptor_;
}
const RegionHeartbeatRequest& RegionHeartbeatRequest::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<RegionHeartbeatRequest> RegionHeartbeatRequest_default_instance_;
RegionHeartbeatRequest* RegionHeartbeatRequest::New(::google::protobuf::Arena* arena) const {
RegionHeartbeatRequest* n = new RegionHeartbeatRequest;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void RegionHeartbeatRequest::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.RegionHeartbeatRequest)
#if defined(__clang__)
#define ZR_HELPER_(f) \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Winvalid-offsetof\"") \
__builtin_offsetof(RegionHeartbeatRequest, f) \
_Pragma("clang diagnostic pop")
#else
#define ZR_HELPER_(f) reinterpret_cast<char*>(\
&reinterpret_cast<RegionHeartbeatRequest*>(16)->f)
#endif
#define ZR_(first, last) do {\
::memset(&(first), 0,\
ZR_HELPER_(last) - ZR_HELPER_(first) + sizeof(last));\
} while (0)
ZR_(bytes_written_, keys_written_);
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
if (GetArenaNoVirtual() == NULL && region_ != NULL) delete region_;
region_ = NULL;
if (GetArenaNoVirtual() == NULL && leader_ != NULL) delete leader_;
leader_ = NULL;
ZR_(keys_read_, approximate_keys_);
if (GetArenaNoVirtual() == NULL && interval_ != NULL) delete interval_;
interval_ = NULL;
#undef ZR_HELPER_
#undef ZR_
down_peers_.Clear();
pending_peers_.Clear();
}
bool RegionHeartbeatRequest::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.RegionHeartbeatRequest)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .pdpb.RequestHeader header = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_header()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_region;
break;
}
// optional .metapb.Region region = 2;
case 2: {
if (tag == 18) {
parse_region:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_region()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(26)) goto parse_leader;
break;
}
// optional .metapb.Peer leader = 3;
case 3: {
if (tag == 26) {
parse_leader:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_leader()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(34)) goto parse_down_peers;
break;
}
// repeated .pdpb.PeerStats down_peers = 4;
case 4: {
if (tag == 34) {
parse_down_peers:
DO_(input->IncrementRecursionDepth());
parse_loop_down_peers:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth(
input, add_down_peers()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(34)) goto parse_loop_down_peers;
if (input->ExpectTag(42)) goto parse_loop_pending_peers;
input->UnsafeDecrementRecursionDepth();
break;
}
// repeated .metapb.Peer pending_peers = 5;
case 5: {
if (tag == 42) {
DO_(input->IncrementRecursionDepth());
parse_loop_pending_peers:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth(
input, add_pending_peers()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(42)) goto parse_loop_pending_peers;
input->UnsafeDecrementRecursionDepth();
if (input->ExpectTag(48)) goto parse_bytes_written;
break;
}
// optional uint64 bytes_written = 6;
case 6: {
if (tag == 48) {
parse_bytes_written:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &bytes_written_)));
} else {
goto handle_unusual;
}
if (input->ExpectTag(56)) goto parse_bytes_read;
break;
}
// optional uint64 bytes_read = 7;
case 7: {
if (tag == 56) {
parse_bytes_read:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &bytes_read_)));
} else {
goto handle_unusual;
}
if (input->ExpectTag(64)) goto parse_keys_written;
break;
}
// optional uint64 keys_written = 8;
case 8: {
if (tag == 64) {
parse_keys_written:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &keys_written_)));
} else {
goto handle_unusual;
}
if (input->ExpectTag(72)) goto parse_keys_read;
break;
}
// optional uint64 keys_read = 9;
case 9: {
if (tag == 72) {
parse_keys_read:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &keys_read_)));
} else {
goto handle_unusual;
}
if (input->ExpectTag(80)) goto parse_approximate_size;
break;
}
// optional uint64 approximate_size = 10;
case 10: {
if (tag == 80) {
parse_approximate_size:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &approximate_size_)));
} else {
goto handle_unusual;
}
if (input->ExpectTag(98)) goto parse_interval;
break;
}
// optional .pdpb.TimeInterval interval = 12;
case 12: {
if (tag == 98) {
parse_interval:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_interval()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(104)) goto parse_approximate_keys;
break;
}
// optional uint64 approximate_keys = 13;
case 13: {
if (tag == 104) {
parse_approximate_keys:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &approximate_keys_)));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.RegionHeartbeatRequest)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.RegionHeartbeatRequest)
return false;
#undef DO_
}
void RegionHeartbeatRequest::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.RegionHeartbeatRequest)
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->header_, output);
}
// optional .metapb.Region region = 2;
if (this->has_region()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, *this->region_, output);
}
// optional .metapb.Peer leader = 3;
if (this->has_leader()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, *this->leader_, output);
}
// repeated .pdpb.PeerStats down_peers = 4;
for (unsigned int i = 0, n = this->down_peers_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
4, this->down_peers(i), output);
}
// repeated .metapb.Peer pending_peers = 5;
for (unsigned int i = 0, n = this->pending_peers_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
5, this->pending_peers(i), output);
}
// optional uint64 bytes_written = 6;
if (this->bytes_written() != 0) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(6, this->bytes_written(), output);
}
// optional uint64 bytes_read = 7;
if (this->bytes_read() != 0) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(7, this->bytes_read(), output);
}
// optional uint64 keys_written = 8;
if (this->keys_written() != 0) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(8, this->keys_written(), output);
}
// optional uint64 keys_read = 9;
if (this->keys_read() != 0) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(9, this->keys_read(), output);
}
// optional uint64 approximate_size = 10;
if (this->approximate_size() != 0) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(10, this->approximate_size(), output);
}
// optional .pdpb.TimeInterval interval = 12;
if (this->has_interval()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
12, *this->interval_, output);
}
// optional uint64 approximate_keys = 13;
if (this->approximate_keys() != 0) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(13, this->approximate_keys(), output);
}
// @@protoc_insertion_point(serialize_end:pdpb.RegionHeartbeatRequest)
}
::google::protobuf::uint8* RegionHeartbeatRequest::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.RegionHeartbeatRequest)
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->header_, false, target);
}
// optional .metapb.Region region = 2;
if (this->has_region()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
2, *this->region_, false, target);
}
// optional .metapb.Peer leader = 3;
if (this->has_leader()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
3, *this->leader_, false, target);
}
// repeated .pdpb.PeerStats down_peers = 4;
for (unsigned int i = 0, n = this->down_peers_size(); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
4, this->down_peers(i), false, target);
}
// repeated .metapb.Peer pending_peers = 5;
for (unsigned int i = 0, n = this->pending_peers_size(); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
5, this->pending_peers(i), false, target);
}
// optional uint64 bytes_written = 6;
if (this->bytes_written() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(6, this->bytes_written(), target);
}
// optional uint64 bytes_read = 7;
if (this->bytes_read() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(7, this->bytes_read(), target);
}
// optional uint64 keys_written = 8;
if (this->keys_written() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(8, this->keys_written(), target);
}
// optional uint64 keys_read = 9;
if (this->keys_read() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(9, this->keys_read(), target);
}
// optional uint64 approximate_size = 10;
if (this->approximate_size() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(10, this->approximate_size(), target);
}
// optional .pdpb.TimeInterval interval = 12;
if (this->has_interval()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
12, *this->interval_, false, target);
}
// optional uint64 approximate_keys = 13;
if (this->approximate_keys() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(13, this->approximate_keys(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.RegionHeartbeatRequest)
return target;
}
size_t RegionHeartbeatRequest::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.RegionHeartbeatRequest)
size_t total_size = 0;
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->header_);
}
// optional .metapb.Region region = 2;
if (this->has_region()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->region_);
}
// optional .metapb.Peer leader = 3;
if (this->has_leader()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->leader_);
}
// optional uint64 bytes_written = 6;
if (this->bytes_written() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->bytes_written());
}
// optional uint64 bytes_read = 7;
if (this->bytes_read() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->bytes_read());
}
// optional uint64 keys_written = 8;
if (this->keys_written() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->keys_written());
}
// optional uint64 keys_read = 9;
if (this->keys_read() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->keys_read());
}
// optional uint64 approximate_size = 10;
if (this->approximate_size() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->approximate_size());
}
// optional .pdpb.TimeInterval interval = 12;
if (this->has_interval()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->interval_);
}
// optional uint64 approximate_keys = 13;
if (this->approximate_keys() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->approximate_keys());
}
// repeated .pdpb.PeerStats down_peers = 4;
{
unsigned int count = this->down_peers_size();
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->down_peers(i));
}
}
// repeated .metapb.Peer pending_peers = 5;
{
unsigned int count = this->pending_peers_size();
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->pending_peers(i));
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void RegionHeartbeatRequest::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.RegionHeartbeatRequest)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const RegionHeartbeatRequest* source =
::google::protobuf::internal::DynamicCastToGenerated<const RegionHeartbeatRequest>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.RegionHeartbeatRequest)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.RegionHeartbeatRequest)
UnsafeMergeFrom(*source);
}
}
void RegionHeartbeatRequest::MergeFrom(const RegionHeartbeatRequest& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.RegionHeartbeatRequest)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void RegionHeartbeatRequest::UnsafeMergeFrom(const RegionHeartbeatRequest& from) {
GOOGLE_DCHECK(&from != this);
down_peers_.MergeFrom(from.down_peers_);
pending_peers_.MergeFrom(from.pending_peers_);
if (from.has_header()) {
mutable_header()->::pdpb::RequestHeader::MergeFrom(from.header());
}
if (from.has_region()) {
mutable_region()->::metapb::Region::MergeFrom(from.region());
}
if (from.has_leader()) {
mutable_leader()->::metapb::Peer::MergeFrom(from.leader());
}
if (from.bytes_written() != 0) {
set_bytes_written(from.bytes_written());
}
if (from.bytes_read() != 0) {
set_bytes_read(from.bytes_read());
}
if (from.keys_written() != 0) {
set_keys_written(from.keys_written());
}
if (from.keys_read() != 0) {
set_keys_read(from.keys_read());
}
if (from.approximate_size() != 0) {
set_approximate_size(from.approximate_size());
}
if (from.has_interval()) {
mutable_interval()->::pdpb::TimeInterval::MergeFrom(from.interval());
}
if (from.approximate_keys() != 0) {
set_approximate_keys(from.approximate_keys());
}
}
void RegionHeartbeatRequest::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.RegionHeartbeatRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void RegionHeartbeatRequest::CopyFrom(const RegionHeartbeatRequest& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.RegionHeartbeatRequest)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool RegionHeartbeatRequest::IsInitialized() const {
return true;
}
void RegionHeartbeatRequest::Swap(RegionHeartbeatRequest* other) {
if (other == this) return;
InternalSwap(other);
}
void RegionHeartbeatRequest::InternalSwap(RegionHeartbeatRequest* other) {
std::swap(header_, other->header_);
std::swap(region_, other->region_);
std::swap(leader_, other->leader_);
down_peers_.UnsafeArenaSwap(&other->down_peers_);
pending_peers_.UnsafeArenaSwap(&other->pending_peers_);
std::swap(bytes_written_, other->bytes_written_);
std::swap(bytes_read_, other->bytes_read_);
std::swap(keys_written_, other->keys_written_);
std::swap(keys_read_, other->keys_read_);
std::swap(approximate_size_, other->approximate_size_);
std::swap(interval_, other->interval_);
std::swap(approximate_keys_, other->approximate_keys_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata RegionHeartbeatRequest::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = RegionHeartbeatRequest_descriptor_;
metadata.reflection = RegionHeartbeatRequest_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// RegionHeartbeatRequest
// optional .pdpb.RequestHeader header = 1;
bool RegionHeartbeatRequest::has_header() const {
return this != internal_default_instance() && header_ != NULL;
}
void RegionHeartbeatRequest::clear_header() {
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
const ::pdpb::RequestHeader& RegionHeartbeatRequest::header() const {
// @@protoc_insertion_point(field_get:pdpb.RegionHeartbeatRequest.header)
return header_ != NULL ? *header_
: *::pdpb::RequestHeader::internal_default_instance();
}
::pdpb::RequestHeader* RegionHeartbeatRequest::mutable_header() {
if (header_ == NULL) {
header_ = new ::pdpb::RequestHeader;
}
// @@protoc_insertion_point(field_mutable:pdpb.RegionHeartbeatRequest.header)
return header_;
}
::pdpb::RequestHeader* RegionHeartbeatRequest::release_header() {
// @@protoc_insertion_point(field_release:pdpb.RegionHeartbeatRequest.header)
::pdpb::RequestHeader* temp = header_;
header_ = NULL;
return temp;
}
void RegionHeartbeatRequest::set_allocated_header(::pdpb::RequestHeader* header) {
delete header_;
header_ = header;
if (header) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.RegionHeartbeatRequest.header)
}
// optional .metapb.Region region = 2;
bool RegionHeartbeatRequest::has_region() const {
return this != internal_default_instance() && region_ != NULL;
}
void RegionHeartbeatRequest::clear_region() {
if (GetArenaNoVirtual() == NULL && region_ != NULL) delete region_;
region_ = NULL;
}
const ::metapb::Region& RegionHeartbeatRequest::region() const {
// @@protoc_insertion_point(field_get:pdpb.RegionHeartbeatRequest.region)
return region_ != NULL ? *region_
: *::metapb::Region::internal_default_instance();
}
::metapb::Region* RegionHeartbeatRequest::mutable_region() {
if (region_ == NULL) {
region_ = new ::metapb::Region;
}
// @@protoc_insertion_point(field_mutable:pdpb.RegionHeartbeatRequest.region)
return region_;
}
::metapb::Region* RegionHeartbeatRequest::release_region() {
// @@protoc_insertion_point(field_release:pdpb.RegionHeartbeatRequest.region)
::metapb::Region* temp = region_;
region_ = NULL;
return temp;
}
void RegionHeartbeatRequest::set_allocated_region(::metapb::Region* region) {
delete region_;
region_ = region;
if (region) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.RegionHeartbeatRequest.region)
}
// optional .metapb.Peer leader = 3;
bool RegionHeartbeatRequest::has_leader() const {
return this != internal_default_instance() && leader_ != NULL;
}
void RegionHeartbeatRequest::clear_leader() {
if (GetArenaNoVirtual() == NULL && leader_ != NULL) delete leader_;
leader_ = NULL;
}
const ::metapb::Peer& RegionHeartbeatRequest::leader() const {
// @@protoc_insertion_point(field_get:pdpb.RegionHeartbeatRequest.leader)
return leader_ != NULL ? *leader_
: *::metapb::Peer::internal_default_instance();
}
::metapb::Peer* RegionHeartbeatRequest::mutable_leader() {
if (leader_ == NULL) {
leader_ = new ::metapb::Peer;
}
// @@protoc_insertion_point(field_mutable:pdpb.RegionHeartbeatRequest.leader)
return leader_;
}
::metapb::Peer* RegionHeartbeatRequest::release_leader() {
// @@protoc_insertion_point(field_release:pdpb.RegionHeartbeatRequest.leader)
::metapb::Peer* temp = leader_;
leader_ = NULL;
return temp;
}
void RegionHeartbeatRequest::set_allocated_leader(::metapb::Peer* leader) {
delete leader_;
leader_ = leader;
if (leader) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.RegionHeartbeatRequest.leader)
}
// repeated .pdpb.PeerStats down_peers = 4;
int RegionHeartbeatRequest::down_peers_size() const {
return down_peers_.size();
}
void RegionHeartbeatRequest::clear_down_peers() {
down_peers_.Clear();
}
const ::pdpb::PeerStats& RegionHeartbeatRequest::down_peers(int index) const {
// @@protoc_insertion_point(field_get:pdpb.RegionHeartbeatRequest.down_peers)
return down_peers_.Get(index);
}
::pdpb::PeerStats* RegionHeartbeatRequest::mutable_down_peers(int index) {
// @@protoc_insertion_point(field_mutable:pdpb.RegionHeartbeatRequest.down_peers)
return down_peers_.Mutable(index);
}
::pdpb::PeerStats* RegionHeartbeatRequest::add_down_peers() {
// @@protoc_insertion_point(field_add:pdpb.RegionHeartbeatRequest.down_peers)
return down_peers_.Add();
}
::google::protobuf::RepeatedPtrField< ::pdpb::PeerStats >*
RegionHeartbeatRequest::mutable_down_peers() {
// @@protoc_insertion_point(field_mutable_list:pdpb.RegionHeartbeatRequest.down_peers)
return &down_peers_;
}
const ::google::protobuf::RepeatedPtrField< ::pdpb::PeerStats >&
RegionHeartbeatRequest::down_peers() const {
// @@protoc_insertion_point(field_list:pdpb.RegionHeartbeatRequest.down_peers)
return down_peers_;
}
// repeated .metapb.Peer pending_peers = 5;
int RegionHeartbeatRequest::pending_peers_size() const {
return pending_peers_.size();
}
void RegionHeartbeatRequest::clear_pending_peers() {
pending_peers_.Clear();
}
const ::metapb::Peer& RegionHeartbeatRequest::pending_peers(int index) const {
// @@protoc_insertion_point(field_get:pdpb.RegionHeartbeatRequest.pending_peers)
return pending_peers_.Get(index);
}
::metapb::Peer* RegionHeartbeatRequest::mutable_pending_peers(int index) {
// @@protoc_insertion_point(field_mutable:pdpb.RegionHeartbeatRequest.pending_peers)
return pending_peers_.Mutable(index);
}
::metapb::Peer* RegionHeartbeatRequest::add_pending_peers() {
// @@protoc_insertion_point(field_add:pdpb.RegionHeartbeatRequest.pending_peers)
return pending_peers_.Add();
}
::google::protobuf::RepeatedPtrField< ::metapb::Peer >*
RegionHeartbeatRequest::mutable_pending_peers() {
// @@protoc_insertion_point(field_mutable_list:pdpb.RegionHeartbeatRequest.pending_peers)
return &pending_peers_;
}
const ::google::protobuf::RepeatedPtrField< ::metapb::Peer >&
RegionHeartbeatRequest::pending_peers() const {
// @@protoc_insertion_point(field_list:pdpb.RegionHeartbeatRequest.pending_peers)
return pending_peers_;
}
// optional uint64 bytes_written = 6;
void RegionHeartbeatRequest::clear_bytes_written() {
bytes_written_ = GOOGLE_ULONGLONG(0);
}
::google::protobuf::uint64 RegionHeartbeatRequest::bytes_written() const {
// @@protoc_insertion_point(field_get:pdpb.RegionHeartbeatRequest.bytes_written)
return bytes_written_;
}
void RegionHeartbeatRequest::set_bytes_written(::google::protobuf::uint64 value) {
bytes_written_ = value;
// @@protoc_insertion_point(field_set:pdpb.RegionHeartbeatRequest.bytes_written)
}
// optional uint64 bytes_read = 7;
void RegionHeartbeatRequest::clear_bytes_read() {
bytes_read_ = GOOGLE_ULONGLONG(0);
}
::google::protobuf::uint64 RegionHeartbeatRequest::bytes_read() const {
// @@protoc_insertion_point(field_get:pdpb.RegionHeartbeatRequest.bytes_read)
return bytes_read_;
}
void RegionHeartbeatRequest::set_bytes_read(::google::protobuf::uint64 value) {
bytes_read_ = value;
// @@protoc_insertion_point(field_set:pdpb.RegionHeartbeatRequest.bytes_read)
}
// optional uint64 keys_written = 8;
void RegionHeartbeatRequest::clear_keys_written() {
keys_written_ = GOOGLE_ULONGLONG(0);
}
::google::protobuf::uint64 RegionHeartbeatRequest::keys_written() const {
// @@protoc_insertion_point(field_get:pdpb.RegionHeartbeatRequest.keys_written)
return keys_written_;
}
void RegionHeartbeatRequest::set_keys_written(::google::protobuf::uint64 value) {
keys_written_ = value;
// @@protoc_insertion_point(field_set:pdpb.RegionHeartbeatRequest.keys_written)
}
// optional uint64 keys_read = 9;
void RegionHeartbeatRequest::clear_keys_read() {
keys_read_ = GOOGLE_ULONGLONG(0);
}
::google::protobuf::uint64 RegionHeartbeatRequest::keys_read() const {
// @@protoc_insertion_point(field_get:pdpb.RegionHeartbeatRequest.keys_read)
return keys_read_;
}
void RegionHeartbeatRequest::set_keys_read(::google::protobuf::uint64 value) {
keys_read_ = value;
// @@protoc_insertion_point(field_set:pdpb.RegionHeartbeatRequest.keys_read)
}
// optional uint64 approximate_size = 10;
void RegionHeartbeatRequest::clear_approximate_size() {
approximate_size_ = GOOGLE_ULONGLONG(0);
}
::google::protobuf::uint64 RegionHeartbeatRequest::approximate_size() const {
// @@protoc_insertion_point(field_get:pdpb.RegionHeartbeatRequest.approximate_size)
return approximate_size_;
}
void RegionHeartbeatRequest::set_approximate_size(::google::protobuf::uint64 value) {
approximate_size_ = value;
// @@protoc_insertion_point(field_set:pdpb.RegionHeartbeatRequest.approximate_size)
}
// optional .pdpb.TimeInterval interval = 12;
bool RegionHeartbeatRequest::has_interval() const {
return this != internal_default_instance() && interval_ != NULL;
}
void RegionHeartbeatRequest::clear_interval() {
if (GetArenaNoVirtual() == NULL && interval_ != NULL) delete interval_;
interval_ = NULL;
}
const ::pdpb::TimeInterval& RegionHeartbeatRequest::interval() const {
// @@protoc_insertion_point(field_get:pdpb.RegionHeartbeatRequest.interval)
return interval_ != NULL ? *interval_
: *::pdpb::TimeInterval::internal_default_instance();
}
::pdpb::TimeInterval* RegionHeartbeatRequest::mutable_interval() {
if (interval_ == NULL) {
interval_ = new ::pdpb::TimeInterval;
}
// @@protoc_insertion_point(field_mutable:pdpb.RegionHeartbeatRequest.interval)
return interval_;
}
::pdpb::TimeInterval* RegionHeartbeatRequest::release_interval() {
// @@protoc_insertion_point(field_release:pdpb.RegionHeartbeatRequest.interval)
::pdpb::TimeInterval* temp = interval_;
interval_ = NULL;
return temp;
}
void RegionHeartbeatRequest::set_allocated_interval(::pdpb::TimeInterval* interval) {
delete interval_;
interval_ = interval;
if (interval) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.RegionHeartbeatRequest.interval)
}
// optional uint64 approximate_keys = 13;
void RegionHeartbeatRequest::clear_approximate_keys() {
approximate_keys_ = GOOGLE_ULONGLONG(0);
}
::google::protobuf::uint64 RegionHeartbeatRequest::approximate_keys() const {
// @@protoc_insertion_point(field_get:pdpb.RegionHeartbeatRequest.approximate_keys)
return approximate_keys_;
}
void RegionHeartbeatRequest::set_approximate_keys(::google::protobuf::uint64 value) {
approximate_keys_ = value;
// @@protoc_insertion_point(field_set:pdpb.RegionHeartbeatRequest.approximate_keys)
}
inline const RegionHeartbeatRequest* RegionHeartbeatRequest::internal_default_instance() {
return &RegionHeartbeatRequest_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int ChangePeer::kPeerFieldNumber;
const int ChangePeer::kChangeTypeFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
ChangePeer::ChangePeer()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.ChangePeer)
}
void ChangePeer::InitAsDefaultInstance() {
peer_ = const_cast< ::metapb::Peer*>(
::metapb::Peer::internal_default_instance());
}
ChangePeer::ChangePeer(const ChangePeer& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.ChangePeer)
}
void ChangePeer::SharedCtor() {
peer_ = NULL;
change_type_ = 0;
_cached_size_ = 0;
}
ChangePeer::~ChangePeer() {
// @@protoc_insertion_point(destructor:pdpb.ChangePeer)
SharedDtor();
}
void ChangePeer::SharedDtor() {
if (this != &ChangePeer_default_instance_.get()) {
delete peer_;
}
}
void ChangePeer::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* ChangePeer::descriptor() {
protobuf_AssignDescriptorsOnce();
return ChangePeer_descriptor_;
}
const ChangePeer& ChangePeer::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<ChangePeer> ChangePeer_default_instance_;
ChangePeer* ChangePeer::New(::google::protobuf::Arena* arena) const {
ChangePeer* n = new ChangePeer;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void ChangePeer::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.ChangePeer)
if (GetArenaNoVirtual() == NULL && peer_ != NULL) delete peer_;
peer_ = NULL;
change_type_ = 0;
}
bool ChangePeer::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.ChangePeer)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .metapb.Peer peer = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_peer()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_change_type;
break;
}
// optional .eraftpb.ConfChangeType change_type = 2;
case 2: {
if (tag == 16) {
parse_change_type:
int value;
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
input, &value)));
set_change_type(static_cast< ::eraftpb::ConfChangeType >(value));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.ChangePeer)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.ChangePeer)
return false;
#undef DO_
}
void ChangePeer::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.ChangePeer)
// optional .metapb.Peer peer = 1;
if (this->has_peer()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->peer_, output);
}
// optional .eraftpb.ConfChangeType change_type = 2;
if (this->change_type() != 0) {
::google::protobuf::internal::WireFormatLite::WriteEnum(
2, this->change_type(), output);
}
// @@protoc_insertion_point(serialize_end:pdpb.ChangePeer)
}
::google::protobuf::uint8* ChangePeer::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.ChangePeer)
// optional .metapb.Peer peer = 1;
if (this->has_peer()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->peer_, false, target);
}
// optional .eraftpb.ConfChangeType change_type = 2;
if (this->change_type() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
2, this->change_type(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.ChangePeer)
return target;
}
size_t ChangePeer::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.ChangePeer)
size_t total_size = 0;
// optional .metapb.Peer peer = 1;
if (this->has_peer()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->peer_);
}
// optional .eraftpb.ConfChangeType change_type = 2;
if (this->change_type() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::EnumSize(this->change_type());
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void ChangePeer::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.ChangePeer)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const ChangePeer* source =
::google::protobuf::internal::DynamicCastToGenerated<const ChangePeer>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.ChangePeer)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.ChangePeer)
UnsafeMergeFrom(*source);
}
}
void ChangePeer::MergeFrom(const ChangePeer& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.ChangePeer)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void ChangePeer::UnsafeMergeFrom(const ChangePeer& from) {
GOOGLE_DCHECK(&from != this);
if (from.has_peer()) {
mutable_peer()->::metapb::Peer::MergeFrom(from.peer());
}
if (from.change_type() != 0) {
set_change_type(from.change_type());
}
}
void ChangePeer::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.ChangePeer)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void ChangePeer::CopyFrom(const ChangePeer& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.ChangePeer)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool ChangePeer::IsInitialized() const {
return true;
}
void ChangePeer::Swap(ChangePeer* other) {
if (other == this) return;
InternalSwap(other);
}
void ChangePeer::InternalSwap(ChangePeer* other) {
std::swap(peer_, other->peer_);
std::swap(change_type_, other->change_type_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata ChangePeer::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = ChangePeer_descriptor_;
metadata.reflection = ChangePeer_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// ChangePeer
// optional .metapb.Peer peer = 1;
bool ChangePeer::has_peer() const {
return this != internal_default_instance() && peer_ != NULL;
}
void ChangePeer::clear_peer() {
if (GetArenaNoVirtual() == NULL && peer_ != NULL) delete peer_;
peer_ = NULL;
}
const ::metapb::Peer& ChangePeer::peer() const {
// @@protoc_insertion_point(field_get:pdpb.ChangePeer.peer)
return peer_ != NULL ? *peer_
: *::metapb::Peer::internal_default_instance();
}
::metapb::Peer* ChangePeer::mutable_peer() {
if (peer_ == NULL) {
peer_ = new ::metapb::Peer;
}
// @@protoc_insertion_point(field_mutable:pdpb.ChangePeer.peer)
return peer_;
}
::metapb::Peer* ChangePeer::release_peer() {
// @@protoc_insertion_point(field_release:pdpb.ChangePeer.peer)
::metapb::Peer* temp = peer_;
peer_ = NULL;
return temp;
}
void ChangePeer::set_allocated_peer(::metapb::Peer* peer) {
delete peer_;
peer_ = peer;
if (peer) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.ChangePeer.peer)
}
// optional .eraftpb.ConfChangeType change_type = 2;
void ChangePeer::clear_change_type() {
change_type_ = 0;
}
::eraftpb::ConfChangeType ChangePeer::change_type() const {
// @@protoc_insertion_point(field_get:pdpb.ChangePeer.change_type)
return static_cast< ::eraftpb::ConfChangeType >(change_type_);
}
void ChangePeer::set_change_type(::eraftpb::ConfChangeType value) {
change_type_ = value;
// @@protoc_insertion_point(field_set:pdpb.ChangePeer.change_type)
}
inline const ChangePeer* ChangePeer::internal_default_instance() {
return &ChangePeer_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int TransferLeader::kPeerFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
TransferLeader::TransferLeader()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.TransferLeader)
}
void TransferLeader::InitAsDefaultInstance() {
peer_ = const_cast< ::metapb::Peer*>(
::metapb::Peer::internal_default_instance());
}
TransferLeader::TransferLeader(const TransferLeader& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.TransferLeader)
}
void TransferLeader::SharedCtor() {
peer_ = NULL;
_cached_size_ = 0;
}
TransferLeader::~TransferLeader() {
// @@protoc_insertion_point(destructor:pdpb.TransferLeader)
SharedDtor();
}
void TransferLeader::SharedDtor() {
if (this != &TransferLeader_default_instance_.get()) {
delete peer_;
}
}
void TransferLeader::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* TransferLeader::descriptor() {
protobuf_AssignDescriptorsOnce();
return TransferLeader_descriptor_;
}
const TransferLeader& TransferLeader::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<TransferLeader> TransferLeader_default_instance_;
TransferLeader* TransferLeader::New(::google::protobuf::Arena* arena) const {
TransferLeader* n = new TransferLeader;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void TransferLeader::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.TransferLeader)
if (GetArenaNoVirtual() == NULL && peer_ != NULL) delete peer_;
peer_ = NULL;
}
bool TransferLeader::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.TransferLeader)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .metapb.Peer peer = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_peer()));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.TransferLeader)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.TransferLeader)
return false;
#undef DO_
}
void TransferLeader::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.TransferLeader)
// optional .metapb.Peer peer = 1;
if (this->has_peer()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->peer_, output);
}
// @@protoc_insertion_point(serialize_end:pdpb.TransferLeader)
}
::google::protobuf::uint8* TransferLeader::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.TransferLeader)
// optional .metapb.Peer peer = 1;
if (this->has_peer()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->peer_, false, target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.TransferLeader)
return target;
}
size_t TransferLeader::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.TransferLeader)
size_t total_size = 0;
// optional .metapb.Peer peer = 1;
if (this->has_peer()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->peer_);
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void TransferLeader::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.TransferLeader)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const TransferLeader* source =
::google::protobuf::internal::DynamicCastToGenerated<const TransferLeader>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.TransferLeader)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.TransferLeader)
UnsafeMergeFrom(*source);
}
}
void TransferLeader::MergeFrom(const TransferLeader& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.TransferLeader)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void TransferLeader::UnsafeMergeFrom(const TransferLeader& from) {
GOOGLE_DCHECK(&from != this);
if (from.has_peer()) {
mutable_peer()->::metapb::Peer::MergeFrom(from.peer());
}
}
void TransferLeader::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.TransferLeader)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void TransferLeader::CopyFrom(const TransferLeader& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.TransferLeader)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool TransferLeader::IsInitialized() const {
return true;
}
void TransferLeader::Swap(TransferLeader* other) {
if (other == this) return;
InternalSwap(other);
}
void TransferLeader::InternalSwap(TransferLeader* other) {
std::swap(peer_, other->peer_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata TransferLeader::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = TransferLeader_descriptor_;
metadata.reflection = TransferLeader_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// TransferLeader
// optional .metapb.Peer peer = 1;
bool TransferLeader::has_peer() const {
return this != internal_default_instance() && peer_ != NULL;
}
void TransferLeader::clear_peer() {
if (GetArenaNoVirtual() == NULL && peer_ != NULL) delete peer_;
peer_ = NULL;
}
const ::metapb::Peer& TransferLeader::peer() const {
// @@protoc_insertion_point(field_get:pdpb.TransferLeader.peer)
return peer_ != NULL ? *peer_
: *::metapb::Peer::internal_default_instance();
}
::metapb::Peer* TransferLeader::mutable_peer() {
if (peer_ == NULL) {
peer_ = new ::metapb::Peer;
}
// @@protoc_insertion_point(field_mutable:pdpb.TransferLeader.peer)
return peer_;
}
::metapb::Peer* TransferLeader::release_peer() {
// @@protoc_insertion_point(field_release:pdpb.TransferLeader.peer)
::metapb::Peer* temp = peer_;
peer_ = NULL;
return temp;
}
void TransferLeader::set_allocated_peer(::metapb::Peer* peer) {
delete peer_;
peer_ = peer;
if (peer) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.TransferLeader.peer)
}
inline const TransferLeader* TransferLeader::internal_default_instance() {
return &TransferLeader_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int Merge::kTargetFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
Merge::Merge()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.Merge)
}
void Merge::InitAsDefaultInstance() {
target_ = const_cast< ::metapb::Region*>(
::metapb::Region::internal_default_instance());
}
Merge::Merge(const Merge& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.Merge)
}
void Merge::SharedCtor() {
target_ = NULL;
_cached_size_ = 0;
}
Merge::~Merge() {
// @@protoc_insertion_point(destructor:pdpb.Merge)
SharedDtor();
}
void Merge::SharedDtor() {
if (this != &Merge_default_instance_.get()) {
delete target_;
}
}
void Merge::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* Merge::descriptor() {
protobuf_AssignDescriptorsOnce();
return Merge_descriptor_;
}
const Merge& Merge::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<Merge> Merge_default_instance_;
Merge* Merge::New(::google::protobuf::Arena* arena) const {
Merge* n = new Merge;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void Merge::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.Merge)
if (GetArenaNoVirtual() == NULL && target_ != NULL) delete target_;
target_ = NULL;
}
bool Merge::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.Merge)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .metapb.Region target = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_target()));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.Merge)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.Merge)
return false;
#undef DO_
}
void Merge::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.Merge)
// optional .metapb.Region target = 1;
if (this->has_target()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->target_, output);
}
// @@protoc_insertion_point(serialize_end:pdpb.Merge)
}
::google::protobuf::uint8* Merge::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.Merge)
// optional .metapb.Region target = 1;
if (this->has_target()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->target_, false, target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.Merge)
return target;
}
size_t Merge::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.Merge)
size_t total_size = 0;
// optional .metapb.Region target = 1;
if (this->has_target()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->target_);
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void Merge::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.Merge)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const Merge* source =
::google::protobuf::internal::DynamicCastToGenerated<const Merge>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.Merge)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.Merge)
UnsafeMergeFrom(*source);
}
}
void Merge::MergeFrom(const Merge& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.Merge)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void Merge::UnsafeMergeFrom(const Merge& from) {
GOOGLE_DCHECK(&from != this);
if (from.has_target()) {
mutable_target()->::metapb::Region::MergeFrom(from.target());
}
}
void Merge::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.Merge)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void Merge::CopyFrom(const Merge& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.Merge)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool Merge::IsInitialized() const {
return true;
}
void Merge::Swap(Merge* other) {
if (other == this) return;
InternalSwap(other);
}
void Merge::InternalSwap(Merge* other) {
std::swap(target_, other->target_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata Merge::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = Merge_descriptor_;
metadata.reflection = Merge_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// Merge
// optional .metapb.Region target = 1;
bool Merge::has_target() const {
return this != internal_default_instance() && target_ != NULL;
}
void Merge::clear_target() {
if (GetArenaNoVirtual() == NULL && target_ != NULL) delete target_;
target_ = NULL;
}
const ::metapb::Region& Merge::target() const {
// @@protoc_insertion_point(field_get:pdpb.Merge.target)
return target_ != NULL ? *target_
: *::metapb::Region::internal_default_instance();
}
::metapb::Region* Merge::mutable_target() {
if (target_ == NULL) {
target_ = new ::metapb::Region;
}
// @@protoc_insertion_point(field_mutable:pdpb.Merge.target)
return target_;
}
::metapb::Region* Merge::release_target() {
// @@protoc_insertion_point(field_release:pdpb.Merge.target)
::metapb::Region* temp = target_;
target_ = NULL;
return temp;
}
void Merge::set_allocated_target(::metapb::Region* target) {
delete target_;
target_ = target;
if (target) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.Merge.target)
}
inline const Merge* Merge::internal_default_instance() {
return &Merge_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int SplitRegion::kPolicyFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
SplitRegion::SplitRegion()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.SplitRegion)
}
void SplitRegion::InitAsDefaultInstance() {
}
SplitRegion::SplitRegion(const SplitRegion& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.SplitRegion)
}
void SplitRegion::SharedCtor() {
policy_ = 0;
_cached_size_ = 0;
}
SplitRegion::~SplitRegion() {
// @@protoc_insertion_point(destructor:pdpb.SplitRegion)
SharedDtor();
}
void SplitRegion::SharedDtor() {
}
void SplitRegion::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* SplitRegion::descriptor() {
protobuf_AssignDescriptorsOnce();
return SplitRegion_descriptor_;
}
const SplitRegion& SplitRegion::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<SplitRegion> SplitRegion_default_instance_;
SplitRegion* SplitRegion::New(::google::protobuf::Arena* arena) const {
SplitRegion* n = new SplitRegion;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void SplitRegion::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.SplitRegion)
policy_ = 0;
}
bool SplitRegion::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.SplitRegion)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .pdpb.CheckPolicy policy = 1;
case 1: {
if (tag == 8) {
int value;
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
input, &value)));
set_policy(static_cast< ::pdpb::CheckPolicy >(value));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.SplitRegion)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.SplitRegion)
return false;
#undef DO_
}
void SplitRegion::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.SplitRegion)
// optional .pdpb.CheckPolicy policy = 1;
if (this->policy() != 0) {
::google::protobuf::internal::WireFormatLite::WriteEnum(
1, this->policy(), output);
}
// @@protoc_insertion_point(serialize_end:pdpb.SplitRegion)
}
::google::protobuf::uint8* SplitRegion::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.SplitRegion)
// optional .pdpb.CheckPolicy policy = 1;
if (this->policy() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
1, this->policy(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.SplitRegion)
return target;
}
size_t SplitRegion::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.SplitRegion)
size_t total_size = 0;
// optional .pdpb.CheckPolicy policy = 1;
if (this->policy() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::EnumSize(this->policy());
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void SplitRegion::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.SplitRegion)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const SplitRegion* source =
::google::protobuf::internal::DynamicCastToGenerated<const SplitRegion>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.SplitRegion)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.SplitRegion)
UnsafeMergeFrom(*source);
}
}
void SplitRegion::MergeFrom(const SplitRegion& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.SplitRegion)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void SplitRegion::UnsafeMergeFrom(const SplitRegion& from) {
GOOGLE_DCHECK(&from != this);
if (from.policy() != 0) {
set_policy(from.policy());
}
}
void SplitRegion::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.SplitRegion)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void SplitRegion::CopyFrom(const SplitRegion& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.SplitRegion)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool SplitRegion::IsInitialized() const {
return true;
}
void SplitRegion::Swap(SplitRegion* other) {
if (other == this) return;
InternalSwap(other);
}
void SplitRegion::InternalSwap(SplitRegion* other) {
std::swap(policy_, other->policy_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata SplitRegion::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = SplitRegion_descriptor_;
metadata.reflection = SplitRegion_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// SplitRegion
// optional .pdpb.CheckPolicy policy = 1;
void SplitRegion::clear_policy() {
policy_ = 0;
}
::pdpb::CheckPolicy SplitRegion::policy() const {
// @@protoc_insertion_point(field_get:pdpb.SplitRegion.policy)
return static_cast< ::pdpb::CheckPolicy >(policy_);
}
void SplitRegion::set_policy(::pdpb::CheckPolicy value) {
policy_ = value;
// @@protoc_insertion_point(field_set:pdpb.SplitRegion.policy)
}
inline const SplitRegion* SplitRegion::internal_default_instance() {
return &SplitRegion_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int RegionHeartbeatResponse::kHeaderFieldNumber;
const int RegionHeartbeatResponse::kChangePeerFieldNumber;
const int RegionHeartbeatResponse::kTransferLeaderFieldNumber;
const int RegionHeartbeatResponse::kRegionIdFieldNumber;
const int RegionHeartbeatResponse::kRegionEpochFieldNumber;
const int RegionHeartbeatResponse::kTargetPeerFieldNumber;
const int RegionHeartbeatResponse::kMergeFieldNumber;
const int RegionHeartbeatResponse::kSplitRegionFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
RegionHeartbeatResponse::RegionHeartbeatResponse()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.RegionHeartbeatResponse)
}
void RegionHeartbeatResponse::InitAsDefaultInstance() {
header_ = const_cast< ::pdpb::ResponseHeader*>(
::pdpb::ResponseHeader::internal_default_instance());
change_peer_ = const_cast< ::pdpb::ChangePeer*>(
::pdpb::ChangePeer::internal_default_instance());
transfer_leader_ = const_cast< ::pdpb::TransferLeader*>(
::pdpb::TransferLeader::internal_default_instance());
region_epoch_ = const_cast< ::metapb::RegionEpoch*>(
::metapb::RegionEpoch::internal_default_instance());
target_peer_ = const_cast< ::metapb::Peer*>(
::metapb::Peer::internal_default_instance());
merge_ = const_cast< ::pdpb::Merge*>(
::pdpb::Merge::internal_default_instance());
split_region_ = const_cast< ::pdpb::SplitRegion*>(
::pdpb::SplitRegion::internal_default_instance());
}
RegionHeartbeatResponse::RegionHeartbeatResponse(const RegionHeartbeatResponse& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.RegionHeartbeatResponse)
}
void RegionHeartbeatResponse::SharedCtor() {
header_ = NULL;
change_peer_ = NULL;
transfer_leader_ = NULL;
region_epoch_ = NULL;
target_peer_ = NULL;
merge_ = NULL;
split_region_ = NULL;
region_id_ = GOOGLE_ULONGLONG(0);
_cached_size_ = 0;
}
RegionHeartbeatResponse::~RegionHeartbeatResponse() {
// @@protoc_insertion_point(destructor:pdpb.RegionHeartbeatResponse)
SharedDtor();
}
void RegionHeartbeatResponse::SharedDtor() {
if (this != &RegionHeartbeatResponse_default_instance_.get()) {
delete header_;
delete change_peer_;
delete transfer_leader_;
delete region_epoch_;
delete target_peer_;
delete merge_;
delete split_region_;
}
}
void RegionHeartbeatResponse::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* RegionHeartbeatResponse::descriptor() {
protobuf_AssignDescriptorsOnce();
return RegionHeartbeatResponse_descriptor_;
}
const RegionHeartbeatResponse& RegionHeartbeatResponse::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<RegionHeartbeatResponse> RegionHeartbeatResponse_default_instance_;
RegionHeartbeatResponse* RegionHeartbeatResponse::New(::google::protobuf::Arena* arena) const {
RegionHeartbeatResponse* n = new RegionHeartbeatResponse;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void RegionHeartbeatResponse::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.RegionHeartbeatResponse)
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
if (GetArenaNoVirtual() == NULL && change_peer_ != NULL) delete change_peer_;
change_peer_ = NULL;
if (GetArenaNoVirtual() == NULL && transfer_leader_ != NULL) delete transfer_leader_;
transfer_leader_ = NULL;
region_id_ = GOOGLE_ULONGLONG(0);
if (GetArenaNoVirtual() == NULL && region_epoch_ != NULL) delete region_epoch_;
region_epoch_ = NULL;
if (GetArenaNoVirtual() == NULL && target_peer_ != NULL) delete target_peer_;
target_peer_ = NULL;
if (GetArenaNoVirtual() == NULL && merge_ != NULL) delete merge_;
merge_ = NULL;
if (GetArenaNoVirtual() == NULL && split_region_ != NULL) delete split_region_;
split_region_ = NULL;
}
bool RegionHeartbeatResponse::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.RegionHeartbeatResponse)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .pdpb.ResponseHeader header = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_header()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_change_peer;
break;
}
// optional .pdpb.ChangePeer change_peer = 2;
case 2: {
if (tag == 18) {
parse_change_peer:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_change_peer()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(26)) goto parse_transfer_leader;
break;
}
// optional .pdpb.TransferLeader transfer_leader = 3;
case 3: {
if (tag == 26) {
parse_transfer_leader:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_transfer_leader()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(32)) goto parse_region_id;
break;
}
// optional uint64 region_id = 4;
case 4: {
if (tag == 32) {
parse_region_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, ®ion_id_)));
} else {
goto handle_unusual;
}
if (input->ExpectTag(42)) goto parse_region_epoch;
break;
}
// optional .metapb.RegionEpoch region_epoch = 5;
case 5: {
if (tag == 42) {
parse_region_epoch:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_region_epoch()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(50)) goto parse_target_peer;
break;
}
// optional .metapb.Peer target_peer = 6;
case 6: {
if (tag == 50) {
parse_target_peer:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_target_peer()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(58)) goto parse_merge;
break;
}
// optional .pdpb.Merge merge = 7;
case 7: {
if (tag == 58) {
parse_merge:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_merge()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(66)) goto parse_split_region;
break;
}
// optional .pdpb.SplitRegion split_region = 8;
case 8: {
if (tag == 66) {
parse_split_region:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_split_region()));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.RegionHeartbeatResponse)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.RegionHeartbeatResponse)
return false;
#undef DO_
}
void RegionHeartbeatResponse::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.RegionHeartbeatResponse)
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->header_, output);
}
// optional .pdpb.ChangePeer change_peer = 2;
if (this->has_change_peer()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, *this->change_peer_, output);
}
// optional .pdpb.TransferLeader transfer_leader = 3;
if (this->has_transfer_leader()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, *this->transfer_leader_, output);
}
// optional uint64 region_id = 4;
if (this->region_id() != 0) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(4, this->region_id(), output);
}
// optional .metapb.RegionEpoch region_epoch = 5;
if (this->has_region_epoch()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
5, *this->region_epoch_, output);
}
// optional .metapb.Peer target_peer = 6;
if (this->has_target_peer()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
6, *this->target_peer_, output);
}
// optional .pdpb.Merge merge = 7;
if (this->has_merge()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
7, *this->merge_, output);
}
// optional .pdpb.SplitRegion split_region = 8;
if (this->has_split_region()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
8, *this->split_region_, output);
}
// @@protoc_insertion_point(serialize_end:pdpb.RegionHeartbeatResponse)
}
::google::protobuf::uint8* RegionHeartbeatResponse::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.RegionHeartbeatResponse)
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->header_, false, target);
}
// optional .pdpb.ChangePeer change_peer = 2;
if (this->has_change_peer()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
2, *this->change_peer_, false, target);
}
// optional .pdpb.TransferLeader transfer_leader = 3;
if (this->has_transfer_leader()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
3, *this->transfer_leader_, false, target);
}
// optional uint64 region_id = 4;
if (this->region_id() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(4, this->region_id(), target);
}
// optional .metapb.RegionEpoch region_epoch = 5;
if (this->has_region_epoch()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
5, *this->region_epoch_, false, target);
}
// optional .metapb.Peer target_peer = 6;
if (this->has_target_peer()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
6, *this->target_peer_, false, target);
}
// optional .pdpb.Merge merge = 7;
if (this->has_merge()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
7, *this->merge_, false, target);
}
// optional .pdpb.SplitRegion split_region = 8;
if (this->has_split_region()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
8, *this->split_region_, false, target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.RegionHeartbeatResponse)
return target;
}
size_t RegionHeartbeatResponse::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.RegionHeartbeatResponse)
size_t total_size = 0;
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->header_);
}
// optional .pdpb.ChangePeer change_peer = 2;
if (this->has_change_peer()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->change_peer_);
}
// optional .pdpb.TransferLeader transfer_leader = 3;
if (this->has_transfer_leader()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->transfer_leader_);
}
// optional uint64 region_id = 4;
if (this->region_id() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->region_id());
}
// optional .metapb.RegionEpoch region_epoch = 5;
if (this->has_region_epoch()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->region_epoch_);
}
// optional .metapb.Peer target_peer = 6;
if (this->has_target_peer()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->target_peer_);
}
// optional .pdpb.Merge merge = 7;
if (this->has_merge()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->merge_);
}
// optional .pdpb.SplitRegion split_region = 8;
if (this->has_split_region()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->split_region_);
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void RegionHeartbeatResponse::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.RegionHeartbeatResponse)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const RegionHeartbeatResponse* source =
::google::protobuf::internal::DynamicCastToGenerated<const RegionHeartbeatResponse>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.RegionHeartbeatResponse)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.RegionHeartbeatResponse)
UnsafeMergeFrom(*source);
}
}
void RegionHeartbeatResponse::MergeFrom(const RegionHeartbeatResponse& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.RegionHeartbeatResponse)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void RegionHeartbeatResponse::UnsafeMergeFrom(const RegionHeartbeatResponse& from) {
GOOGLE_DCHECK(&from != this);
if (from.has_header()) {
mutable_header()->::pdpb::ResponseHeader::MergeFrom(from.header());
}
if (from.has_change_peer()) {
mutable_change_peer()->::pdpb::ChangePeer::MergeFrom(from.change_peer());
}
if (from.has_transfer_leader()) {
mutable_transfer_leader()->::pdpb::TransferLeader::MergeFrom(from.transfer_leader());
}
if (from.region_id() != 0) {
set_region_id(from.region_id());
}
if (from.has_region_epoch()) {
mutable_region_epoch()->::metapb::RegionEpoch::MergeFrom(from.region_epoch());
}
if (from.has_target_peer()) {
mutable_target_peer()->::metapb::Peer::MergeFrom(from.target_peer());
}
if (from.has_merge()) {
mutable_merge()->::pdpb::Merge::MergeFrom(from.merge());
}
if (from.has_split_region()) {
mutable_split_region()->::pdpb::SplitRegion::MergeFrom(from.split_region());
}
}
void RegionHeartbeatResponse::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.RegionHeartbeatResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void RegionHeartbeatResponse::CopyFrom(const RegionHeartbeatResponse& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.RegionHeartbeatResponse)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool RegionHeartbeatResponse::IsInitialized() const {
return true;
}
void RegionHeartbeatResponse::Swap(RegionHeartbeatResponse* other) {
if (other == this) return;
InternalSwap(other);
}
void RegionHeartbeatResponse::InternalSwap(RegionHeartbeatResponse* other) {
std::swap(header_, other->header_);
std::swap(change_peer_, other->change_peer_);
std::swap(transfer_leader_, other->transfer_leader_);
std::swap(region_id_, other->region_id_);
std::swap(region_epoch_, other->region_epoch_);
std::swap(target_peer_, other->target_peer_);
std::swap(merge_, other->merge_);
std::swap(split_region_, other->split_region_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata RegionHeartbeatResponse::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = RegionHeartbeatResponse_descriptor_;
metadata.reflection = RegionHeartbeatResponse_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// RegionHeartbeatResponse
// optional .pdpb.ResponseHeader header = 1;
bool RegionHeartbeatResponse::has_header() const {
return this != internal_default_instance() && header_ != NULL;
}
void RegionHeartbeatResponse::clear_header() {
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
const ::pdpb::ResponseHeader& RegionHeartbeatResponse::header() const {
// @@protoc_insertion_point(field_get:pdpb.RegionHeartbeatResponse.header)
return header_ != NULL ? *header_
: *::pdpb::ResponseHeader::internal_default_instance();
}
::pdpb::ResponseHeader* RegionHeartbeatResponse::mutable_header() {
if (header_ == NULL) {
header_ = new ::pdpb::ResponseHeader;
}
// @@protoc_insertion_point(field_mutable:pdpb.RegionHeartbeatResponse.header)
return header_;
}
::pdpb::ResponseHeader* RegionHeartbeatResponse::release_header() {
// @@protoc_insertion_point(field_release:pdpb.RegionHeartbeatResponse.header)
::pdpb::ResponseHeader* temp = header_;
header_ = NULL;
return temp;
}
void RegionHeartbeatResponse::set_allocated_header(::pdpb::ResponseHeader* header) {
delete header_;
header_ = header;
if (header) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.RegionHeartbeatResponse.header)
}
// optional .pdpb.ChangePeer change_peer = 2;
bool RegionHeartbeatResponse::has_change_peer() const {
return this != internal_default_instance() && change_peer_ != NULL;
}
void RegionHeartbeatResponse::clear_change_peer() {
if (GetArenaNoVirtual() == NULL && change_peer_ != NULL) delete change_peer_;
change_peer_ = NULL;
}
const ::pdpb::ChangePeer& RegionHeartbeatResponse::change_peer() const {
// @@protoc_insertion_point(field_get:pdpb.RegionHeartbeatResponse.change_peer)
return change_peer_ != NULL ? *change_peer_
: *::pdpb::ChangePeer::internal_default_instance();
}
::pdpb::ChangePeer* RegionHeartbeatResponse::mutable_change_peer() {
if (change_peer_ == NULL) {
change_peer_ = new ::pdpb::ChangePeer;
}
// @@protoc_insertion_point(field_mutable:pdpb.RegionHeartbeatResponse.change_peer)
return change_peer_;
}
::pdpb::ChangePeer* RegionHeartbeatResponse::release_change_peer() {
// @@protoc_insertion_point(field_release:pdpb.RegionHeartbeatResponse.change_peer)
::pdpb::ChangePeer* temp = change_peer_;
change_peer_ = NULL;
return temp;
}
void RegionHeartbeatResponse::set_allocated_change_peer(::pdpb::ChangePeer* change_peer) {
delete change_peer_;
change_peer_ = change_peer;
if (change_peer) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.RegionHeartbeatResponse.change_peer)
}
// optional .pdpb.TransferLeader transfer_leader = 3;
bool RegionHeartbeatResponse::has_transfer_leader() const {
return this != internal_default_instance() && transfer_leader_ != NULL;
}
void RegionHeartbeatResponse::clear_transfer_leader() {
if (GetArenaNoVirtual() == NULL && transfer_leader_ != NULL) delete transfer_leader_;
transfer_leader_ = NULL;
}
const ::pdpb::TransferLeader& RegionHeartbeatResponse::transfer_leader() const {
// @@protoc_insertion_point(field_get:pdpb.RegionHeartbeatResponse.transfer_leader)
return transfer_leader_ != NULL ? *transfer_leader_
: *::pdpb::TransferLeader::internal_default_instance();
}
::pdpb::TransferLeader* RegionHeartbeatResponse::mutable_transfer_leader() {
if (transfer_leader_ == NULL) {
transfer_leader_ = new ::pdpb::TransferLeader;
}
// @@protoc_insertion_point(field_mutable:pdpb.RegionHeartbeatResponse.transfer_leader)
return transfer_leader_;
}
::pdpb::TransferLeader* RegionHeartbeatResponse::release_transfer_leader() {
// @@protoc_insertion_point(field_release:pdpb.RegionHeartbeatResponse.transfer_leader)
::pdpb::TransferLeader* temp = transfer_leader_;
transfer_leader_ = NULL;
return temp;
}
void RegionHeartbeatResponse::set_allocated_transfer_leader(::pdpb::TransferLeader* transfer_leader) {
delete transfer_leader_;
transfer_leader_ = transfer_leader;
if (transfer_leader) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.RegionHeartbeatResponse.transfer_leader)
}
// optional uint64 region_id = 4;
void RegionHeartbeatResponse::clear_region_id() {
region_id_ = GOOGLE_ULONGLONG(0);
}
::google::protobuf::uint64 RegionHeartbeatResponse::region_id() const {
// @@protoc_insertion_point(field_get:pdpb.RegionHeartbeatResponse.region_id)
return region_id_;
}
void RegionHeartbeatResponse::set_region_id(::google::protobuf::uint64 value) {
region_id_ = value;
// @@protoc_insertion_point(field_set:pdpb.RegionHeartbeatResponse.region_id)
}
// optional .metapb.RegionEpoch region_epoch = 5;
bool RegionHeartbeatResponse::has_region_epoch() const {
return this != internal_default_instance() && region_epoch_ != NULL;
}
void RegionHeartbeatResponse::clear_region_epoch() {
if (GetArenaNoVirtual() == NULL && region_epoch_ != NULL) delete region_epoch_;
region_epoch_ = NULL;
}
const ::metapb::RegionEpoch& RegionHeartbeatResponse::region_epoch() const {
// @@protoc_insertion_point(field_get:pdpb.RegionHeartbeatResponse.region_epoch)
return region_epoch_ != NULL ? *region_epoch_
: *::metapb::RegionEpoch::internal_default_instance();
}
::metapb::RegionEpoch* RegionHeartbeatResponse::mutable_region_epoch() {
if (region_epoch_ == NULL) {
region_epoch_ = new ::metapb::RegionEpoch;
}
// @@protoc_insertion_point(field_mutable:pdpb.RegionHeartbeatResponse.region_epoch)
return region_epoch_;
}
::metapb::RegionEpoch* RegionHeartbeatResponse::release_region_epoch() {
// @@protoc_insertion_point(field_release:pdpb.RegionHeartbeatResponse.region_epoch)
::metapb::RegionEpoch* temp = region_epoch_;
region_epoch_ = NULL;
return temp;
}
void RegionHeartbeatResponse::set_allocated_region_epoch(::metapb::RegionEpoch* region_epoch) {
delete region_epoch_;
region_epoch_ = region_epoch;
if (region_epoch) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.RegionHeartbeatResponse.region_epoch)
}
// optional .metapb.Peer target_peer = 6;
bool RegionHeartbeatResponse::has_target_peer() const {
return this != internal_default_instance() && target_peer_ != NULL;
}
void RegionHeartbeatResponse::clear_target_peer() {
if (GetArenaNoVirtual() == NULL && target_peer_ != NULL) delete target_peer_;
target_peer_ = NULL;
}
const ::metapb::Peer& RegionHeartbeatResponse::target_peer() const {
// @@protoc_insertion_point(field_get:pdpb.RegionHeartbeatResponse.target_peer)
return target_peer_ != NULL ? *target_peer_
: *::metapb::Peer::internal_default_instance();
}
::metapb::Peer* RegionHeartbeatResponse::mutable_target_peer() {
if (target_peer_ == NULL) {
target_peer_ = new ::metapb::Peer;
}
// @@protoc_insertion_point(field_mutable:pdpb.RegionHeartbeatResponse.target_peer)
return target_peer_;
}
::metapb::Peer* RegionHeartbeatResponse::release_target_peer() {
// @@protoc_insertion_point(field_release:pdpb.RegionHeartbeatResponse.target_peer)
::metapb::Peer* temp = target_peer_;
target_peer_ = NULL;
return temp;
}
void RegionHeartbeatResponse::set_allocated_target_peer(::metapb::Peer* target_peer) {
delete target_peer_;
target_peer_ = target_peer;
if (target_peer) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.RegionHeartbeatResponse.target_peer)
}
// optional .pdpb.Merge merge = 7;
bool RegionHeartbeatResponse::has_merge() const {
return this != internal_default_instance() && merge_ != NULL;
}
void RegionHeartbeatResponse::clear_merge() {
if (GetArenaNoVirtual() == NULL && merge_ != NULL) delete merge_;
merge_ = NULL;
}
const ::pdpb::Merge& RegionHeartbeatResponse::merge() const {
// @@protoc_insertion_point(field_get:pdpb.RegionHeartbeatResponse.merge)
return merge_ != NULL ? *merge_
: *::pdpb::Merge::internal_default_instance();
}
::pdpb::Merge* RegionHeartbeatResponse::mutable_merge() {
if (merge_ == NULL) {
merge_ = new ::pdpb::Merge;
}
// @@protoc_insertion_point(field_mutable:pdpb.RegionHeartbeatResponse.merge)
return merge_;
}
::pdpb::Merge* RegionHeartbeatResponse::release_merge() {
// @@protoc_insertion_point(field_release:pdpb.RegionHeartbeatResponse.merge)
::pdpb::Merge* temp = merge_;
merge_ = NULL;
return temp;
}
void RegionHeartbeatResponse::set_allocated_merge(::pdpb::Merge* merge) {
delete merge_;
merge_ = merge;
if (merge) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.RegionHeartbeatResponse.merge)
}
// optional .pdpb.SplitRegion split_region = 8;
bool RegionHeartbeatResponse::has_split_region() const {
return this != internal_default_instance() && split_region_ != NULL;
}
void RegionHeartbeatResponse::clear_split_region() {
if (GetArenaNoVirtual() == NULL && split_region_ != NULL) delete split_region_;
split_region_ = NULL;
}
const ::pdpb::SplitRegion& RegionHeartbeatResponse::split_region() const {
// @@protoc_insertion_point(field_get:pdpb.RegionHeartbeatResponse.split_region)
return split_region_ != NULL ? *split_region_
: *::pdpb::SplitRegion::internal_default_instance();
}
::pdpb::SplitRegion* RegionHeartbeatResponse::mutable_split_region() {
if (split_region_ == NULL) {
split_region_ = new ::pdpb::SplitRegion;
}
// @@protoc_insertion_point(field_mutable:pdpb.RegionHeartbeatResponse.split_region)
return split_region_;
}
::pdpb::SplitRegion* RegionHeartbeatResponse::release_split_region() {
// @@protoc_insertion_point(field_release:pdpb.RegionHeartbeatResponse.split_region)
::pdpb::SplitRegion* temp = split_region_;
split_region_ = NULL;
return temp;
}
void RegionHeartbeatResponse::set_allocated_split_region(::pdpb::SplitRegion* split_region) {
delete split_region_;
split_region_ = split_region;
if (split_region) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.RegionHeartbeatResponse.split_region)
}
inline const RegionHeartbeatResponse* RegionHeartbeatResponse::internal_default_instance() {
return &RegionHeartbeatResponse_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int AskSplitRequest::kHeaderFieldNumber;
const int AskSplitRequest::kRegionFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
AskSplitRequest::AskSplitRequest()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.AskSplitRequest)
}
void AskSplitRequest::InitAsDefaultInstance() {
header_ = const_cast< ::pdpb::RequestHeader*>(
::pdpb::RequestHeader::internal_default_instance());
region_ = const_cast< ::metapb::Region*>(
::metapb::Region::internal_default_instance());
}
AskSplitRequest::AskSplitRequest(const AskSplitRequest& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.AskSplitRequest)
}
void AskSplitRequest::SharedCtor() {
header_ = NULL;
region_ = NULL;
_cached_size_ = 0;
}
AskSplitRequest::~AskSplitRequest() {
// @@protoc_insertion_point(destructor:pdpb.AskSplitRequest)
SharedDtor();
}
void AskSplitRequest::SharedDtor() {
if (this != &AskSplitRequest_default_instance_.get()) {
delete header_;
delete region_;
}
}
void AskSplitRequest::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* AskSplitRequest::descriptor() {
protobuf_AssignDescriptorsOnce();
return AskSplitRequest_descriptor_;
}
const AskSplitRequest& AskSplitRequest::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<AskSplitRequest> AskSplitRequest_default_instance_;
AskSplitRequest* AskSplitRequest::New(::google::protobuf::Arena* arena) const {
AskSplitRequest* n = new AskSplitRequest;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void AskSplitRequest::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.AskSplitRequest)
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
if (GetArenaNoVirtual() == NULL && region_ != NULL) delete region_;
region_ = NULL;
}
bool AskSplitRequest::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.AskSplitRequest)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .pdpb.RequestHeader header = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_header()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_region;
break;
}
// optional .metapb.Region region = 2;
case 2: {
if (tag == 18) {
parse_region:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_region()));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.AskSplitRequest)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.AskSplitRequest)
return false;
#undef DO_
}
void AskSplitRequest::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.AskSplitRequest)
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->header_, output);
}
// optional .metapb.Region region = 2;
if (this->has_region()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, *this->region_, output);
}
// @@protoc_insertion_point(serialize_end:pdpb.AskSplitRequest)
}
::google::protobuf::uint8* AskSplitRequest::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.AskSplitRequest)
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->header_, false, target);
}
// optional .metapb.Region region = 2;
if (this->has_region()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
2, *this->region_, false, target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.AskSplitRequest)
return target;
}
size_t AskSplitRequest::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.AskSplitRequest)
size_t total_size = 0;
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->header_);
}
// optional .metapb.Region region = 2;
if (this->has_region()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->region_);
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void AskSplitRequest::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.AskSplitRequest)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const AskSplitRequest* source =
::google::protobuf::internal::DynamicCastToGenerated<const AskSplitRequest>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.AskSplitRequest)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.AskSplitRequest)
UnsafeMergeFrom(*source);
}
}
void AskSplitRequest::MergeFrom(const AskSplitRequest& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.AskSplitRequest)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void AskSplitRequest::UnsafeMergeFrom(const AskSplitRequest& from) {
GOOGLE_DCHECK(&from != this);
if (from.has_header()) {
mutable_header()->::pdpb::RequestHeader::MergeFrom(from.header());
}
if (from.has_region()) {
mutable_region()->::metapb::Region::MergeFrom(from.region());
}
}
void AskSplitRequest::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.AskSplitRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void AskSplitRequest::CopyFrom(const AskSplitRequest& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.AskSplitRequest)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool AskSplitRequest::IsInitialized() const {
return true;
}
void AskSplitRequest::Swap(AskSplitRequest* other) {
if (other == this) return;
InternalSwap(other);
}
void AskSplitRequest::InternalSwap(AskSplitRequest* other) {
std::swap(header_, other->header_);
std::swap(region_, other->region_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata AskSplitRequest::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = AskSplitRequest_descriptor_;
metadata.reflection = AskSplitRequest_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// AskSplitRequest
// optional .pdpb.RequestHeader header = 1;
bool AskSplitRequest::has_header() const {
return this != internal_default_instance() && header_ != NULL;
}
void AskSplitRequest::clear_header() {
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
const ::pdpb::RequestHeader& AskSplitRequest::header() const {
// @@protoc_insertion_point(field_get:pdpb.AskSplitRequest.header)
return header_ != NULL ? *header_
: *::pdpb::RequestHeader::internal_default_instance();
}
::pdpb::RequestHeader* AskSplitRequest::mutable_header() {
if (header_ == NULL) {
header_ = new ::pdpb::RequestHeader;
}
// @@protoc_insertion_point(field_mutable:pdpb.AskSplitRequest.header)
return header_;
}
::pdpb::RequestHeader* AskSplitRequest::release_header() {
// @@protoc_insertion_point(field_release:pdpb.AskSplitRequest.header)
::pdpb::RequestHeader* temp = header_;
header_ = NULL;
return temp;
}
void AskSplitRequest::set_allocated_header(::pdpb::RequestHeader* header) {
delete header_;
header_ = header;
if (header) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.AskSplitRequest.header)
}
// optional .metapb.Region region = 2;
bool AskSplitRequest::has_region() const {
return this != internal_default_instance() && region_ != NULL;
}
void AskSplitRequest::clear_region() {
if (GetArenaNoVirtual() == NULL && region_ != NULL) delete region_;
region_ = NULL;
}
const ::metapb::Region& AskSplitRequest::region() const {
// @@protoc_insertion_point(field_get:pdpb.AskSplitRequest.region)
return region_ != NULL ? *region_
: *::metapb::Region::internal_default_instance();
}
::metapb::Region* AskSplitRequest::mutable_region() {
if (region_ == NULL) {
region_ = new ::metapb::Region;
}
// @@protoc_insertion_point(field_mutable:pdpb.AskSplitRequest.region)
return region_;
}
::metapb::Region* AskSplitRequest::release_region() {
// @@protoc_insertion_point(field_release:pdpb.AskSplitRequest.region)
::metapb::Region* temp = region_;
region_ = NULL;
return temp;
}
void AskSplitRequest::set_allocated_region(::metapb::Region* region) {
delete region_;
region_ = region;
if (region) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.AskSplitRequest.region)
}
inline const AskSplitRequest* AskSplitRequest::internal_default_instance() {
return &AskSplitRequest_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int AskSplitResponse::kHeaderFieldNumber;
const int AskSplitResponse::kNewRegionIdFieldNumber;
const int AskSplitResponse::kNewPeerIdsFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
AskSplitResponse::AskSplitResponse()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.AskSplitResponse)
}
void AskSplitResponse::InitAsDefaultInstance() {
header_ = const_cast< ::pdpb::ResponseHeader*>(
::pdpb::ResponseHeader::internal_default_instance());
}
AskSplitResponse::AskSplitResponse(const AskSplitResponse& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.AskSplitResponse)
}
void AskSplitResponse::SharedCtor() {
header_ = NULL;
new_region_id_ = GOOGLE_ULONGLONG(0);
_cached_size_ = 0;
}
AskSplitResponse::~AskSplitResponse() {
// @@protoc_insertion_point(destructor:pdpb.AskSplitResponse)
SharedDtor();
}
void AskSplitResponse::SharedDtor() {
if (this != &AskSplitResponse_default_instance_.get()) {
delete header_;
}
}
void AskSplitResponse::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* AskSplitResponse::descriptor() {
protobuf_AssignDescriptorsOnce();
return AskSplitResponse_descriptor_;
}
const AskSplitResponse& AskSplitResponse::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<AskSplitResponse> AskSplitResponse_default_instance_;
AskSplitResponse* AskSplitResponse::New(::google::protobuf::Arena* arena) const {
AskSplitResponse* n = new AskSplitResponse;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void AskSplitResponse::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.AskSplitResponse)
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
new_region_id_ = GOOGLE_ULONGLONG(0);
new_peer_ids_.Clear();
}
bool AskSplitResponse::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.AskSplitResponse)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .pdpb.ResponseHeader header = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_header()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_new_region_id;
break;
}
// optional uint64 new_region_id = 2;
case 2: {
if (tag == 16) {
parse_new_region_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &new_region_id_)));
} else {
goto handle_unusual;
}
if (input->ExpectTag(26)) goto parse_new_peer_ids;
break;
}
// repeated uint64 new_peer_ids = 3;
case 3: {
if (tag == 26) {
parse_new_peer_ids:
DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, this->mutable_new_peer_ids())));
} else if (tag == 24) {
DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
1, 26, input, this->mutable_new_peer_ids())));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.AskSplitResponse)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.AskSplitResponse)
return false;
#undef DO_
}
void AskSplitResponse::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.AskSplitResponse)
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->header_, output);
}
// optional uint64 new_region_id = 2;
if (this->new_region_id() != 0) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(2, this->new_region_id(), output);
}
// repeated uint64 new_peer_ids = 3;
if (this->new_peer_ids_size() > 0) {
::google::protobuf::internal::WireFormatLite::WriteTag(3, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output);
output->WriteVarint32(_new_peer_ids_cached_byte_size_);
}
for (int i = 0; i < this->new_peer_ids_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteUInt64NoTag(
this->new_peer_ids(i), output);
}
// @@protoc_insertion_point(serialize_end:pdpb.AskSplitResponse)
}
::google::protobuf::uint8* AskSplitResponse::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.AskSplitResponse)
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->header_, false, target);
}
// optional uint64 new_region_id = 2;
if (this->new_region_id() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(2, this->new_region_id(), target);
}
// repeated uint64 new_peer_ids = 3;
if (this->new_peer_ids_size() > 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray(
3,
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
target);
target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray(
_new_peer_ids_cached_byte_size_, target);
}
for (int i = 0; i < this->new_peer_ids_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteUInt64NoTagToArray(this->new_peer_ids(i), target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.AskSplitResponse)
return target;
}
size_t AskSplitResponse::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.AskSplitResponse)
size_t total_size = 0;
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->header_);
}
// optional uint64 new_region_id = 2;
if (this->new_region_id() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->new_region_id());
}
// repeated uint64 new_peer_ids = 3;
{
size_t data_size = 0;
unsigned int count = this->new_peer_ids_size();
for (unsigned int i = 0; i < count; i++) {
data_size += ::google::protobuf::internal::WireFormatLite::
UInt64Size(this->new_peer_ids(i));
}
if (data_size > 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::Int32Size(data_size);
}
int cached_size = ::google::protobuf::internal::ToCachedSize(data_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_new_peer_ids_cached_byte_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
total_size += data_size;
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void AskSplitResponse::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.AskSplitResponse)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const AskSplitResponse* source =
::google::protobuf::internal::DynamicCastToGenerated<const AskSplitResponse>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.AskSplitResponse)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.AskSplitResponse)
UnsafeMergeFrom(*source);
}
}
void AskSplitResponse::MergeFrom(const AskSplitResponse& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.AskSplitResponse)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void AskSplitResponse::UnsafeMergeFrom(const AskSplitResponse& from) {
GOOGLE_DCHECK(&from != this);
new_peer_ids_.UnsafeMergeFrom(from.new_peer_ids_);
if (from.has_header()) {
mutable_header()->::pdpb::ResponseHeader::MergeFrom(from.header());
}
if (from.new_region_id() != 0) {
set_new_region_id(from.new_region_id());
}
}
void AskSplitResponse::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.AskSplitResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void AskSplitResponse::CopyFrom(const AskSplitResponse& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.AskSplitResponse)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool AskSplitResponse::IsInitialized() const {
return true;
}
void AskSplitResponse::Swap(AskSplitResponse* other) {
if (other == this) return;
InternalSwap(other);
}
void AskSplitResponse::InternalSwap(AskSplitResponse* other) {
std::swap(header_, other->header_);
std::swap(new_region_id_, other->new_region_id_);
new_peer_ids_.UnsafeArenaSwap(&other->new_peer_ids_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata AskSplitResponse::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = AskSplitResponse_descriptor_;
metadata.reflection = AskSplitResponse_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// AskSplitResponse
// optional .pdpb.ResponseHeader header = 1;
bool AskSplitResponse::has_header() const {
return this != internal_default_instance() && header_ != NULL;
}
void AskSplitResponse::clear_header() {
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
const ::pdpb::ResponseHeader& AskSplitResponse::header() const {
// @@protoc_insertion_point(field_get:pdpb.AskSplitResponse.header)
return header_ != NULL ? *header_
: *::pdpb::ResponseHeader::internal_default_instance();
}
::pdpb::ResponseHeader* AskSplitResponse::mutable_header() {
if (header_ == NULL) {
header_ = new ::pdpb::ResponseHeader;
}
// @@protoc_insertion_point(field_mutable:pdpb.AskSplitResponse.header)
return header_;
}
::pdpb::ResponseHeader* AskSplitResponse::release_header() {
// @@protoc_insertion_point(field_release:pdpb.AskSplitResponse.header)
::pdpb::ResponseHeader* temp = header_;
header_ = NULL;
return temp;
}
void AskSplitResponse::set_allocated_header(::pdpb::ResponseHeader* header) {
delete header_;
header_ = header;
if (header) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.AskSplitResponse.header)
}
// optional uint64 new_region_id = 2;
void AskSplitResponse::clear_new_region_id() {
new_region_id_ = GOOGLE_ULONGLONG(0);
}
::google::protobuf::uint64 AskSplitResponse::new_region_id() const {
// @@protoc_insertion_point(field_get:pdpb.AskSplitResponse.new_region_id)
return new_region_id_;
}
void AskSplitResponse::set_new_region_id(::google::protobuf::uint64 value) {
new_region_id_ = value;
// @@protoc_insertion_point(field_set:pdpb.AskSplitResponse.new_region_id)
}
// repeated uint64 new_peer_ids = 3;
int AskSplitResponse::new_peer_ids_size() const {
return new_peer_ids_.size();
}
void AskSplitResponse::clear_new_peer_ids() {
new_peer_ids_.Clear();
}
::google::protobuf::uint64 AskSplitResponse::new_peer_ids(int index) const {
// @@protoc_insertion_point(field_get:pdpb.AskSplitResponse.new_peer_ids)
return new_peer_ids_.Get(index);
}
void AskSplitResponse::set_new_peer_ids(int index, ::google::protobuf::uint64 value) {
new_peer_ids_.Set(index, value);
// @@protoc_insertion_point(field_set:pdpb.AskSplitResponse.new_peer_ids)
}
void AskSplitResponse::add_new_peer_ids(::google::protobuf::uint64 value) {
new_peer_ids_.Add(value);
// @@protoc_insertion_point(field_add:pdpb.AskSplitResponse.new_peer_ids)
}
const ::google::protobuf::RepeatedField< ::google::protobuf::uint64 >&
AskSplitResponse::new_peer_ids() const {
// @@protoc_insertion_point(field_list:pdpb.AskSplitResponse.new_peer_ids)
return new_peer_ids_;
}
::google::protobuf::RepeatedField< ::google::protobuf::uint64 >*
AskSplitResponse::mutable_new_peer_ids() {
// @@protoc_insertion_point(field_mutable_list:pdpb.AskSplitResponse.new_peer_ids)
return &new_peer_ids_;
}
inline const AskSplitResponse* AskSplitResponse::internal_default_instance() {
return &AskSplitResponse_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int ReportSplitRequest::kHeaderFieldNumber;
const int ReportSplitRequest::kLeftFieldNumber;
const int ReportSplitRequest::kRightFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
ReportSplitRequest::ReportSplitRequest()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.ReportSplitRequest)
}
void ReportSplitRequest::InitAsDefaultInstance() {
header_ = const_cast< ::pdpb::RequestHeader*>(
::pdpb::RequestHeader::internal_default_instance());
left_ = const_cast< ::metapb::Region*>(
::metapb::Region::internal_default_instance());
right_ = const_cast< ::metapb::Region*>(
::metapb::Region::internal_default_instance());
}
ReportSplitRequest::ReportSplitRequest(const ReportSplitRequest& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.ReportSplitRequest)
}
void ReportSplitRequest::SharedCtor() {
header_ = NULL;
left_ = NULL;
right_ = NULL;
_cached_size_ = 0;
}
ReportSplitRequest::~ReportSplitRequest() {
// @@protoc_insertion_point(destructor:pdpb.ReportSplitRequest)
SharedDtor();
}
void ReportSplitRequest::SharedDtor() {
if (this != &ReportSplitRequest_default_instance_.get()) {
delete header_;
delete left_;
delete right_;
}
}
void ReportSplitRequest::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* ReportSplitRequest::descriptor() {
protobuf_AssignDescriptorsOnce();
return ReportSplitRequest_descriptor_;
}
const ReportSplitRequest& ReportSplitRequest::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<ReportSplitRequest> ReportSplitRequest_default_instance_;
ReportSplitRequest* ReportSplitRequest::New(::google::protobuf::Arena* arena) const {
ReportSplitRequest* n = new ReportSplitRequest;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void ReportSplitRequest::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.ReportSplitRequest)
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
if (GetArenaNoVirtual() == NULL && left_ != NULL) delete left_;
left_ = NULL;
if (GetArenaNoVirtual() == NULL && right_ != NULL) delete right_;
right_ = NULL;
}
bool ReportSplitRequest::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.ReportSplitRequest)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .pdpb.RequestHeader header = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_header()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_left;
break;
}
// optional .metapb.Region left = 2;
case 2: {
if (tag == 18) {
parse_left:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_left()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(26)) goto parse_right;
break;
}
// optional .metapb.Region right = 3;
case 3: {
if (tag == 26) {
parse_right:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_right()));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.ReportSplitRequest)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.ReportSplitRequest)
return false;
#undef DO_
}
void ReportSplitRequest::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.ReportSplitRequest)
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->header_, output);
}
// optional .metapb.Region left = 2;
if (this->has_left()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, *this->left_, output);
}
// optional .metapb.Region right = 3;
if (this->has_right()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, *this->right_, output);
}
// @@protoc_insertion_point(serialize_end:pdpb.ReportSplitRequest)
}
::google::protobuf::uint8* ReportSplitRequest::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.ReportSplitRequest)
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->header_, false, target);
}
// optional .metapb.Region left = 2;
if (this->has_left()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
2, *this->left_, false, target);
}
// optional .metapb.Region right = 3;
if (this->has_right()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
3, *this->right_, false, target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.ReportSplitRequest)
return target;
}
size_t ReportSplitRequest::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.ReportSplitRequest)
size_t total_size = 0;
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->header_);
}
// optional .metapb.Region left = 2;
if (this->has_left()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->left_);
}
// optional .metapb.Region right = 3;
if (this->has_right()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->right_);
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void ReportSplitRequest::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.ReportSplitRequest)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const ReportSplitRequest* source =
::google::protobuf::internal::DynamicCastToGenerated<const ReportSplitRequest>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.ReportSplitRequest)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.ReportSplitRequest)
UnsafeMergeFrom(*source);
}
}
void ReportSplitRequest::MergeFrom(const ReportSplitRequest& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.ReportSplitRequest)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void ReportSplitRequest::UnsafeMergeFrom(const ReportSplitRequest& from) {
GOOGLE_DCHECK(&from != this);
if (from.has_header()) {
mutable_header()->::pdpb::RequestHeader::MergeFrom(from.header());
}
if (from.has_left()) {
mutable_left()->::metapb::Region::MergeFrom(from.left());
}
if (from.has_right()) {
mutable_right()->::metapb::Region::MergeFrom(from.right());
}
}
void ReportSplitRequest::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.ReportSplitRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void ReportSplitRequest::CopyFrom(const ReportSplitRequest& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.ReportSplitRequest)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool ReportSplitRequest::IsInitialized() const {
return true;
}
void ReportSplitRequest::Swap(ReportSplitRequest* other) {
if (other == this) return;
InternalSwap(other);
}
void ReportSplitRequest::InternalSwap(ReportSplitRequest* other) {
std::swap(header_, other->header_);
std::swap(left_, other->left_);
std::swap(right_, other->right_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata ReportSplitRequest::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = ReportSplitRequest_descriptor_;
metadata.reflection = ReportSplitRequest_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// ReportSplitRequest
// optional .pdpb.RequestHeader header = 1;
bool ReportSplitRequest::has_header() const {
return this != internal_default_instance() && header_ != NULL;
}
void ReportSplitRequest::clear_header() {
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
const ::pdpb::RequestHeader& ReportSplitRequest::header() const {
// @@protoc_insertion_point(field_get:pdpb.ReportSplitRequest.header)
return header_ != NULL ? *header_
: *::pdpb::RequestHeader::internal_default_instance();
}
::pdpb::RequestHeader* ReportSplitRequest::mutable_header() {
if (header_ == NULL) {
header_ = new ::pdpb::RequestHeader;
}
// @@protoc_insertion_point(field_mutable:pdpb.ReportSplitRequest.header)
return header_;
}
::pdpb::RequestHeader* ReportSplitRequest::release_header() {
// @@protoc_insertion_point(field_release:pdpb.ReportSplitRequest.header)
::pdpb::RequestHeader* temp = header_;
header_ = NULL;
return temp;
}
void ReportSplitRequest::set_allocated_header(::pdpb::RequestHeader* header) {
delete header_;
header_ = header;
if (header) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.ReportSplitRequest.header)
}
// optional .metapb.Region left = 2;
bool ReportSplitRequest::has_left() const {
return this != internal_default_instance() && left_ != NULL;
}
void ReportSplitRequest::clear_left() {
if (GetArenaNoVirtual() == NULL && left_ != NULL) delete left_;
left_ = NULL;
}
const ::metapb::Region& ReportSplitRequest::left() const {
// @@protoc_insertion_point(field_get:pdpb.ReportSplitRequest.left)
return left_ != NULL ? *left_
: *::metapb::Region::internal_default_instance();
}
::metapb::Region* ReportSplitRequest::mutable_left() {
if (left_ == NULL) {
left_ = new ::metapb::Region;
}
// @@protoc_insertion_point(field_mutable:pdpb.ReportSplitRequest.left)
return left_;
}
::metapb::Region* ReportSplitRequest::release_left() {
// @@protoc_insertion_point(field_release:pdpb.ReportSplitRequest.left)
::metapb::Region* temp = left_;
left_ = NULL;
return temp;
}
void ReportSplitRequest::set_allocated_left(::metapb::Region* left) {
delete left_;
left_ = left;
if (left) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.ReportSplitRequest.left)
}
// optional .metapb.Region right = 3;
bool ReportSplitRequest::has_right() const {
return this != internal_default_instance() && right_ != NULL;
}
void ReportSplitRequest::clear_right() {
if (GetArenaNoVirtual() == NULL && right_ != NULL) delete right_;
right_ = NULL;
}
const ::metapb::Region& ReportSplitRequest::right() const {
// @@protoc_insertion_point(field_get:pdpb.ReportSplitRequest.right)
return right_ != NULL ? *right_
: *::metapb::Region::internal_default_instance();
}
::metapb::Region* ReportSplitRequest::mutable_right() {
if (right_ == NULL) {
right_ = new ::metapb::Region;
}
// @@protoc_insertion_point(field_mutable:pdpb.ReportSplitRequest.right)
return right_;
}
::metapb::Region* ReportSplitRequest::release_right() {
// @@protoc_insertion_point(field_release:pdpb.ReportSplitRequest.right)
::metapb::Region* temp = right_;
right_ = NULL;
return temp;
}
void ReportSplitRequest::set_allocated_right(::metapb::Region* right) {
delete right_;
right_ = right;
if (right) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.ReportSplitRequest.right)
}
inline const ReportSplitRequest* ReportSplitRequest::internal_default_instance() {
return &ReportSplitRequest_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int ReportSplitResponse::kHeaderFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
ReportSplitResponse::ReportSplitResponse()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.ReportSplitResponse)
}
void ReportSplitResponse::InitAsDefaultInstance() {
header_ = const_cast< ::pdpb::ResponseHeader*>(
::pdpb::ResponseHeader::internal_default_instance());
}
ReportSplitResponse::ReportSplitResponse(const ReportSplitResponse& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.ReportSplitResponse)
}
void ReportSplitResponse::SharedCtor() {
header_ = NULL;
_cached_size_ = 0;
}
ReportSplitResponse::~ReportSplitResponse() {
// @@protoc_insertion_point(destructor:pdpb.ReportSplitResponse)
SharedDtor();
}
void ReportSplitResponse::SharedDtor() {
if (this != &ReportSplitResponse_default_instance_.get()) {
delete header_;
}
}
void ReportSplitResponse::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* ReportSplitResponse::descriptor() {
protobuf_AssignDescriptorsOnce();
return ReportSplitResponse_descriptor_;
}
const ReportSplitResponse& ReportSplitResponse::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<ReportSplitResponse> ReportSplitResponse_default_instance_;
ReportSplitResponse* ReportSplitResponse::New(::google::protobuf::Arena* arena) const {
ReportSplitResponse* n = new ReportSplitResponse;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void ReportSplitResponse::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.ReportSplitResponse)
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
bool ReportSplitResponse::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.ReportSplitResponse)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .pdpb.ResponseHeader header = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_header()));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.ReportSplitResponse)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.ReportSplitResponse)
return false;
#undef DO_
}
void ReportSplitResponse::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.ReportSplitResponse)
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->header_, output);
}
// @@protoc_insertion_point(serialize_end:pdpb.ReportSplitResponse)
}
::google::protobuf::uint8* ReportSplitResponse::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.ReportSplitResponse)
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->header_, false, target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.ReportSplitResponse)
return target;
}
size_t ReportSplitResponse::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.ReportSplitResponse)
size_t total_size = 0;
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->header_);
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void ReportSplitResponse::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.ReportSplitResponse)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const ReportSplitResponse* source =
::google::protobuf::internal::DynamicCastToGenerated<const ReportSplitResponse>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.ReportSplitResponse)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.ReportSplitResponse)
UnsafeMergeFrom(*source);
}
}
void ReportSplitResponse::MergeFrom(const ReportSplitResponse& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.ReportSplitResponse)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void ReportSplitResponse::UnsafeMergeFrom(const ReportSplitResponse& from) {
GOOGLE_DCHECK(&from != this);
if (from.has_header()) {
mutable_header()->::pdpb::ResponseHeader::MergeFrom(from.header());
}
}
void ReportSplitResponse::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.ReportSplitResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void ReportSplitResponse::CopyFrom(const ReportSplitResponse& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.ReportSplitResponse)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool ReportSplitResponse::IsInitialized() const {
return true;
}
void ReportSplitResponse::Swap(ReportSplitResponse* other) {
if (other == this) return;
InternalSwap(other);
}
void ReportSplitResponse::InternalSwap(ReportSplitResponse* other) {
std::swap(header_, other->header_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata ReportSplitResponse::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = ReportSplitResponse_descriptor_;
metadata.reflection = ReportSplitResponse_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// ReportSplitResponse
// optional .pdpb.ResponseHeader header = 1;
bool ReportSplitResponse::has_header() const {
return this != internal_default_instance() && header_ != NULL;
}
void ReportSplitResponse::clear_header() {
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
const ::pdpb::ResponseHeader& ReportSplitResponse::header() const {
// @@protoc_insertion_point(field_get:pdpb.ReportSplitResponse.header)
return header_ != NULL ? *header_
: *::pdpb::ResponseHeader::internal_default_instance();
}
::pdpb::ResponseHeader* ReportSplitResponse::mutable_header() {
if (header_ == NULL) {
header_ = new ::pdpb::ResponseHeader;
}
// @@protoc_insertion_point(field_mutable:pdpb.ReportSplitResponse.header)
return header_;
}
::pdpb::ResponseHeader* ReportSplitResponse::release_header() {
// @@protoc_insertion_point(field_release:pdpb.ReportSplitResponse.header)
::pdpb::ResponseHeader* temp = header_;
header_ = NULL;
return temp;
}
void ReportSplitResponse::set_allocated_header(::pdpb::ResponseHeader* header) {
delete header_;
header_ = header;
if (header) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.ReportSplitResponse.header)
}
inline const ReportSplitResponse* ReportSplitResponse::internal_default_instance() {
return &ReportSplitResponse_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int AskBatchSplitRequest::kHeaderFieldNumber;
const int AskBatchSplitRequest::kRegionFieldNumber;
const int AskBatchSplitRequest::kSplitCountFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
AskBatchSplitRequest::AskBatchSplitRequest()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.AskBatchSplitRequest)
}
void AskBatchSplitRequest::InitAsDefaultInstance() {
header_ = const_cast< ::pdpb::RequestHeader*>(
::pdpb::RequestHeader::internal_default_instance());
region_ = const_cast< ::metapb::Region*>(
::metapb::Region::internal_default_instance());
}
AskBatchSplitRequest::AskBatchSplitRequest(const AskBatchSplitRequest& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.AskBatchSplitRequest)
}
void AskBatchSplitRequest::SharedCtor() {
header_ = NULL;
region_ = NULL;
split_count_ = 0u;
_cached_size_ = 0;
}
AskBatchSplitRequest::~AskBatchSplitRequest() {
// @@protoc_insertion_point(destructor:pdpb.AskBatchSplitRequest)
SharedDtor();
}
void AskBatchSplitRequest::SharedDtor() {
if (this != &AskBatchSplitRequest_default_instance_.get()) {
delete header_;
delete region_;
}
}
void AskBatchSplitRequest::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* AskBatchSplitRequest::descriptor() {
protobuf_AssignDescriptorsOnce();
return AskBatchSplitRequest_descriptor_;
}
const AskBatchSplitRequest& AskBatchSplitRequest::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<AskBatchSplitRequest> AskBatchSplitRequest_default_instance_;
AskBatchSplitRequest* AskBatchSplitRequest::New(::google::protobuf::Arena* arena) const {
AskBatchSplitRequest* n = new AskBatchSplitRequest;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void AskBatchSplitRequest::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.AskBatchSplitRequest)
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
if (GetArenaNoVirtual() == NULL && region_ != NULL) delete region_;
region_ = NULL;
split_count_ = 0u;
}
bool AskBatchSplitRequest::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.AskBatchSplitRequest)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .pdpb.RequestHeader header = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_header()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_region;
break;
}
// optional .metapb.Region region = 2;
case 2: {
if (tag == 18) {
parse_region:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_region()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(24)) goto parse_split_count;
break;
}
// optional uint32 split_count = 3;
case 3: {
if (tag == 24) {
parse_split_count:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &split_count_)));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.AskBatchSplitRequest)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.AskBatchSplitRequest)
return false;
#undef DO_
}
void AskBatchSplitRequest::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.AskBatchSplitRequest)
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->header_, output);
}
// optional .metapb.Region region = 2;
if (this->has_region()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, *this->region_, output);
}
// optional uint32 split_count = 3;
if (this->split_count() != 0) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(3, this->split_count(), output);
}
// @@protoc_insertion_point(serialize_end:pdpb.AskBatchSplitRequest)
}
::google::protobuf::uint8* AskBatchSplitRequest::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.AskBatchSplitRequest)
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->header_, false, target);
}
// optional .metapb.Region region = 2;
if (this->has_region()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
2, *this->region_, false, target);
}
// optional uint32 split_count = 3;
if (this->split_count() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(3, this->split_count(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.AskBatchSplitRequest)
return target;
}
size_t AskBatchSplitRequest::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.AskBatchSplitRequest)
size_t total_size = 0;
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->header_);
}
// optional .metapb.Region region = 2;
if (this->has_region()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->region_);
}
// optional uint32 split_count = 3;
if (this->split_count() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->split_count());
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void AskBatchSplitRequest::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.AskBatchSplitRequest)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const AskBatchSplitRequest* source =
::google::protobuf::internal::DynamicCastToGenerated<const AskBatchSplitRequest>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.AskBatchSplitRequest)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.AskBatchSplitRequest)
UnsafeMergeFrom(*source);
}
}
void AskBatchSplitRequest::MergeFrom(const AskBatchSplitRequest& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.AskBatchSplitRequest)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void AskBatchSplitRequest::UnsafeMergeFrom(const AskBatchSplitRequest& from) {
GOOGLE_DCHECK(&from != this);
if (from.has_header()) {
mutable_header()->::pdpb::RequestHeader::MergeFrom(from.header());
}
if (from.has_region()) {
mutable_region()->::metapb::Region::MergeFrom(from.region());
}
if (from.split_count() != 0) {
set_split_count(from.split_count());
}
}
void AskBatchSplitRequest::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.AskBatchSplitRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void AskBatchSplitRequest::CopyFrom(const AskBatchSplitRequest& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.AskBatchSplitRequest)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool AskBatchSplitRequest::IsInitialized() const {
return true;
}
void AskBatchSplitRequest::Swap(AskBatchSplitRequest* other) {
if (other == this) return;
InternalSwap(other);
}
void AskBatchSplitRequest::InternalSwap(AskBatchSplitRequest* other) {
std::swap(header_, other->header_);
std::swap(region_, other->region_);
std::swap(split_count_, other->split_count_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata AskBatchSplitRequest::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = AskBatchSplitRequest_descriptor_;
metadata.reflection = AskBatchSplitRequest_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// AskBatchSplitRequest
// optional .pdpb.RequestHeader header = 1;
bool AskBatchSplitRequest::has_header() const {
return this != internal_default_instance() && header_ != NULL;
}
void AskBatchSplitRequest::clear_header() {
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
const ::pdpb::RequestHeader& AskBatchSplitRequest::header() const {
// @@protoc_insertion_point(field_get:pdpb.AskBatchSplitRequest.header)
return header_ != NULL ? *header_
: *::pdpb::RequestHeader::internal_default_instance();
}
::pdpb::RequestHeader* AskBatchSplitRequest::mutable_header() {
if (header_ == NULL) {
header_ = new ::pdpb::RequestHeader;
}
// @@protoc_insertion_point(field_mutable:pdpb.AskBatchSplitRequest.header)
return header_;
}
::pdpb::RequestHeader* AskBatchSplitRequest::release_header() {
// @@protoc_insertion_point(field_release:pdpb.AskBatchSplitRequest.header)
::pdpb::RequestHeader* temp = header_;
header_ = NULL;
return temp;
}
void AskBatchSplitRequest::set_allocated_header(::pdpb::RequestHeader* header) {
delete header_;
header_ = header;
if (header) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.AskBatchSplitRequest.header)
}
// optional .metapb.Region region = 2;
bool AskBatchSplitRequest::has_region() const {
return this != internal_default_instance() && region_ != NULL;
}
void AskBatchSplitRequest::clear_region() {
if (GetArenaNoVirtual() == NULL && region_ != NULL) delete region_;
region_ = NULL;
}
const ::metapb::Region& AskBatchSplitRequest::region() const {
// @@protoc_insertion_point(field_get:pdpb.AskBatchSplitRequest.region)
return region_ != NULL ? *region_
: *::metapb::Region::internal_default_instance();
}
::metapb::Region* AskBatchSplitRequest::mutable_region() {
if (region_ == NULL) {
region_ = new ::metapb::Region;
}
// @@protoc_insertion_point(field_mutable:pdpb.AskBatchSplitRequest.region)
return region_;
}
::metapb::Region* AskBatchSplitRequest::release_region() {
// @@protoc_insertion_point(field_release:pdpb.AskBatchSplitRequest.region)
::metapb::Region* temp = region_;
region_ = NULL;
return temp;
}
void AskBatchSplitRequest::set_allocated_region(::metapb::Region* region) {
delete region_;
region_ = region;
if (region) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.AskBatchSplitRequest.region)
}
// optional uint32 split_count = 3;
void AskBatchSplitRequest::clear_split_count() {
split_count_ = 0u;
}
::google::protobuf::uint32 AskBatchSplitRequest::split_count() const {
// @@protoc_insertion_point(field_get:pdpb.AskBatchSplitRequest.split_count)
return split_count_;
}
void AskBatchSplitRequest::set_split_count(::google::protobuf::uint32 value) {
split_count_ = value;
// @@protoc_insertion_point(field_set:pdpb.AskBatchSplitRequest.split_count)
}
inline const AskBatchSplitRequest* AskBatchSplitRequest::internal_default_instance() {
return &AskBatchSplitRequest_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int SplitID::kNewRegionIdFieldNumber;
const int SplitID::kNewPeerIdsFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
SplitID::SplitID()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.SplitID)
}
void SplitID::InitAsDefaultInstance() {
}
SplitID::SplitID(const SplitID& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.SplitID)
}
void SplitID::SharedCtor() {
new_region_id_ = GOOGLE_ULONGLONG(0);
_cached_size_ = 0;
}
SplitID::~SplitID() {
// @@protoc_insertion_point(destructor:pdpb.SplitID)
SharedDtor();
}
void SplitID::SharedDtor() {
}
void SplitID::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* SplitID::descriptor() {
protobuf_AssignDescriptorsOnce();
return SplitID_descriptor_;
}
const SplitID& SplitID::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<SplitID> SplitID_default_instance_;
SplitID* SplitID::New(::google::protobuf::Arena* arena) const {
SplitID* n = new SplitID;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void SplitID::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.SplitID)
new_region_id_ = GOOGLE_ULONGLONG(0);
new_peer_ids_.Clear();
}
bool SplitID::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.SplitID)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint64 new_region_id = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &new_region_id_)));
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_new_peer_ids;
break;
}
// repeated uint64 new_peer_ids = 2;
case 2: {
if (tag == 18) {
parse_new_peer_ids:
DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, this->mutable_new_peer_ids())));
} else if (tag == 16) {
DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
1, 18, input, this->mutable_new_peer_ids())));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.SplitID)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.SplitID)
return false;
#undef DO_
}
void SplitID::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.SplitID)
// optional uint64 new_region_id = 1;
if (this->new_region_id() != 0) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(1, this->new_region_id(), output);
}
// repeated uint64 new_peer_ids = 2;
if (this->new_peer_ids_size() > 0) {
::google::protobuf::internal::WireFormatLite::WriteTag(2, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output);
output->WriteVarint32(_new_peer_ids_cached_byte_size_);
}
for (int i = 0; i < this->new_peer_ids_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteUInt64NoTag(
this->new_peer_ids(i), output);
}
// @@protoc_insertion_point(serialize_end:pdpb.SplitID)
}
::google::protobuf::uint8* SplitID::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.SplitID)
// optional uint64 new_region_id = 1;
if (this->new_region_id() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(1, this->new_region_id(), target);
}
// repeated uint64 new_peer_ids = 2;
if (this->new_peer_ids_size() > 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray(
2,
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
target);
target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray(
_new_peer_ids_cached_byte_size_, target);
}
for (int i = 0; i < this->new_peer_ids_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteUInt64NoTagToArray(this->new_peer_ids(i), target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.SplitID)
return target;
}
size_t SplitID::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.SplitID)
size_t total_size = 0;
// optional uint64 new_region_id = 1;
if (this->new_region_id() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->new_region_id());
}
// repeated uint64 new_peer_ids = 2;
{
size_t data_size = 0;
unsigned int count = this->new_peer_ids_size();
for (unsigned int i = 0; i < count; i++) {
data_size += ::google::protobuf::internal::WireFormatLite::
UInt64Size(this->new_peer_ids(i));
}
if (data_size > 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::Int32Size(data_size);
}
int cached_size = ::google::protobuf::internal::ToCachedSize(data_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_new_peer_ids_cached_byte_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
total_size += data_size;
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void SplitID::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.SplitID)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const SplitID* source =
::google::protobuf::internal::DynamicCastToGenerated<const SplitID>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.SplitID)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.SplitID)
UnsafeMergeFrom(*source);
}
}
void SplitID::MergeFrom(const SplitID& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.SplitID)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void SplitID::UnsafeMergeFrom(const SplitID& from) {
GOOGLE_DCHECK(&from != this);
new_peer_ids_.UnsafeMergeFrom(from.new_peer_ids_);
if (from.new_region_id() != 0) {
set_new_region_id(from.new_region_id());
}
}
void SplitID::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.SplitID)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void SplitID::CopyFrom(const SplitID& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.SplitID)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool SplitID::IsInitialized() const {
return true;
}
void SplitID::Swap(SplitID* other) {
if (other == this) return;
InternalSwap(other);
}
void SplitID::InternalSwap(SplitID* other) {
std::swap(new_region_id_, other->new_region_id_);
new_peer_ids_.UnsafeArenaSwap(&other->new_peer_ids_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata SplitID::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = SplitID_descriptor_;
metadata.reflection = SplitID_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// SplitID
// optional uint64 new_region_id = 1;
void SplitID::clear_new_region_id() {
new_region_id_ = GOOGLE_ULONGLONG(0);
}
::google::protobuf::uint64 SplitID::new_region_id() const {
// @@protoc_insertion_point(field_get:pdpb.SplitID.new_region_id)
return new_region_id_;
}
void SplitID::set_new_region_id(::google::protobuf::uint64 value) {
new_region_id_ = value;
// @@protoc_insertion_point(field_set:pdpb.SplitID.new_region_id)
}
// repeated uint64 new_peer_ids = 2;
int SplitID::new_peer_ids_size() const {
return new_peer_ids_.size();
}
void SplitID::clear_new_peer_ids() {
new_peer_ids_.Clear();
}
::google::protobuf::uint64 SplitID::new_peer_ids(int index) const {
// @@protoc_insertion_point(field_get:pdpb.SplitID.new_peer_ids)
return new_peer_ids_.Get(index);
}
void SplitID::set_new_peer_ids(int index, ::google::protobuf::uint64 value) {
new_peer_ids_.Set(index, value);
// @@protoc_insertion_point(field_set:pdpb.SplitID.new_peer_ids)
}
void SplitID::add_new_peer_ids(::google::protobuf::uint64 value) {
new_peer_ids_.Add(value);
// @@protoc_insertion_point(field_add:pdpb.SplitID.new_peer_ids)
}
const ::google::protobuf::RepeatedField< ::google::protobuf::uint64 >&
SplitID::new_peer_ids() const {
// @@protoc_insertion_point(field_list:pdpb.SplitID.new_peer_ids)
return new_peer_ids_;
}
::google::protobuf::RepeatedField< ::google::protobuf::uint64 >*
SplitID::mutable_new_peer_ids() {
// @@protoc_insertion_point(field_mutable_list:pdpb.SplitID.new_peer_ids)
return &new_peer_ids_;
}
inline const SplitID* SplitID::internal_default_instance() {
return &SplitID_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int AskBatchSplitResponse::kHeaderFieldNumber;
const int AskBatchSplitResponse::kIdsFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
AskBatchSplitResponse::AskBatchSplitResponse()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.AskBatchSplitResponse)
}
void AskBatchSplitResponse::InitAsDefaultInstance() {
header_ = const_cast< ::pdpb::ResponseHeader*>(
::pdpb::ResponseHeader::internal_default_instance());
}
AskBatchSplitResponse::AskBatchSplitResponse(const AskBatchSplitResponse& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.AskBatchSplitResponse)
}
void AskBatchSplitResponse::SharedCtor() {
header_ = NULL;
_cached_size_ = 0;
}
AskBatchSplitResponse::~AskBatchSplitResponse() {
// @@protoc_insertion_point(destructor:pdpb.AskBatchSplitResponse)
SharedDtor();
}
void AskBatchSplitResponse::SharedDtor() {
if (this != &AskBatchSplitResponse_default_instance_.get()) {
delete header_;
}
}
void AskBatchSplitResponse::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* AskBatchSplitResponse::descriptor() {
protobuf_AssignDescriptorsOnce();
return AskBatchSplitResponse_descriptor_;
}
const AskBatchSplitResponse& AskBatchSplitResponse::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<AskBatchSplitResponse> AskBatchSplitResponse_default_instance_;
AskBatchSplitResponse* AskBatchSplitResponse::New(::google::protobuf::Arena* arena) const {
AskBatchSplitResponse* n = new AskBatchSplitResponse;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void AskBatchSplitResponse::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.AskBatchSplitResponse)
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
ids_.Clear();
}
bool AskBatchSplitResponse::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.AskBatchSplitResponse)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .pdpb.ResponseHeader header = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_header()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_ids;
break;
}
// repeated .pdpb.SplitID ids = 2;
case 2: {
if (tag == 18) {
parse_ids:
DO_(input->IncrementRecursionDepth());
parse_loop_ids:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth(
input, add_ids()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_loop_ids;
input->UnsafeDecrementRecursionDepth();
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.AskBatchSplitResponse)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.AskBatchSplitResponse)
return false;
#undef DO_
}
void AskBatchSplitResponse::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.AskBatchSplitResponse)
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->header_, output);
}
// repeated .pdpb.SplitID ids = 2;
for (unsigned int i = 0, n = this->ids_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, this->ids(i), output);
}
// @@protoc_insertion_point(serialize_end:pdpb.AskBatchSplitResponse)
}
::google::protobuf::uint8* AskBatchSplitResponse::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.AskBatchSplitResponse)
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->header_, false, target);
}
// repeated .pdpb.SplitID ids = 2;
for (unsigned int i = 0, n = this->ids_size(); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
2, this->ids(i), false, target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.AskBatchSplitResponse)
return target;
}
size_t AskBatchSplitResponse::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.AskBatchSplitResponse)
size_t total_size = 0;
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->header_);
}
// repeated .pdpb.SplitID ids = 2;
{
unsigned int count = this->ids_size();
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->ids(i));
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void AskBatchSplitResponse::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.AskBatchSplitResponse)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const AskBatchSplitResponse* source =
::google::protobuf::internal::DynamicCastToGenerated<const AskBatchSplitResponse>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.AskBatchSplitResponse)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.AskBatchSplitResponse)
UnsafeMergeFrom(*source);
}
}
void AskBatchSplitResponse::MergeFrom(const AskBatchSplitResponse& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.AskBatchSplitResponse)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void AskBatchSplitResponse::UnsafeMergeFrom(const AskBatchSplitResponse& from) {
GOOGLE_DCHECK(&from != this);
ids_.MergeFrom(from.ids_);
if (from.has_header()) {
mutable_header()->::pdpb::ResponseHeader::MergeFrom(from.header());
}
}
void AskBatchSplitResponse::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.AskBatchSplitResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void AskBatchSplitResponse::CopyFrom(const AskBatchSplitResponse& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.AskBatchSplitResponse)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool AskBatchSplitResponse::IsInitialized() const {
return true;
}
void AskBatchSplitResponse::Swap(AskBatchSplitResponse* other) {
if (other == this) return;
InternalSwap(other);
}
void AskBatchSplitResponse::InternalSwap(AskBatchSplitResponse* other) {
std::swap(header_, other->header_);
ids_.UnsafeArenaSwap(&other->ids_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata AskBatchSplitResponse::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = AskBatchSplitResponse_descriptor_;
metadata.reflection = AskBatchSplitResponse_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// AskBatchSplitResponse
// optional .pdpb.ResponseHeader header = 1;
bool AskBatchSplitResponse::has_header() const {
return this != internal_default_instance() && header_ != NULL;
}
void AskBatchSplitResponse::clear_header() {
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
const ::pdpb::ResponseHeader& AskBatchSplitResponse::header() const {
// @@protoc_insertion_point(field_get:pdpb.AskBatchSplitResponse.header)
return header_ != NULL ? *header_
: *::pdpb::ResponseHeader::internal_default_instance();
}
::pdpb::ResponseHeader* AskBatchSplitResponse::mutable_header() {
if (header_ == NULL) {
header_ = new ::pdpb::ResponseHeader;
}
// @@protoc_insertion_point(field_mutable:pdpb.AskBatchSplitResponse.header)
return header_;
}
::pdpb::ResponseHeader* AskBatchSplitResponse::release_header() {
// @@protoc_insertion_point(field_release:pdpb.AskBatchSplitResponse.header)
::pdpb::ResponseHeader* temp = header_;
header_ = NULL;
return temp;
}
void AskBatchSplitResponse::set_allocated_header(::pdpb::ResponseHeader* header) {
delete header_;
header_ = header;
if (header) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.AskBatchSplitResponse.header)
}
// repeated .pdpb.SplitID ids = 2;
int AskBatchSplitResponse::ids_size() const {
return ids_.size();
}
void AskBatchSplitResponse::clear_ids() {
ids_.Clear();
}
const ::pdpb::SplitID& AskBatchSplitResponse::ids(int index) const {
// @@protoc_insertion_point(field_get:pdpb.AskBatchSplitResponse.ids)
return ids_.Get(index);
}
::pdpb::SplitID* AskBatchSplitResponse::mutable_ids(int index) {
// @@protoc_insertion_point(field_mutable:pdpb.AskBatchSplitResponse.ids)
return ids_.Mutable(index);
}
::pdpb::SplitID* AskBatchSplitResponse::add_ids() {
// @@protoc_insertion_point(field_add:pdpb.AskBatchSplitResponse.ids)
return ids_.Add();
}
::google::protobuf::RepeatedPtrField< ::pdpb::SplitID >*
AskBatchSplitResponse::mutable_ids() {
// @@protoc_insertion_point(field_mutable_list:pdpb.AskBatchSplitResponse.ids)
return &ids_;
}
const ::google::protobuf::RepeatedPtrField< ::pdpb::SplitID >&
AskBatchSplitResponse::ids() const {
// @@protoc_insertion_point(field_list:pdpb.AskBatchSplitResponse.ids)
return ids_;
}
inline const AskBatchSplitResponse* AskBatchSplitResponse::internal_default_instance() {
return &AskBatchSplitResponse_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int ReportBatchSplitRequest::kHeaderFieldNumber;
const int ReportBatchSplitRequest::kRegionsFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
ReportBatchSplitRequest::ReportBatchSplitRequest()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.ReportBatchSplitRequest)
}
void ReportBatchSplitRequest::InitAsDefaultInstance() {
header_ = const_cast< ::pdpb::RequestHeader*>(
::pdpb::RequestHeader::internal_default_instance());
}
ReportBatchSplitRequest::ReportBatchSplitRequest(const ReportBatchSplitRequest& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.ReportBatchSplitRequest)
}
void ReportBatchSplitRequest::SharedCtor() {
header_ = NULL;
_cached_size_ = 0;
}
ReportBatchSplitRequest::~ReportBatchSplitRequest() {
// @@protoc_insertion_point(destructor:pdpb.ReportBatchSplitRequest)
SharedDtor();
}
void ReportBatchSplitRequest::SharedDtor() {
if (this != &ReportBatchSplitRequest_default_instance_.get()) {
delete header_;
}
}
void ReportBatchSplitRequest::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* ReportBatchSplitRequest::descriptor() {
protobuf_AssignDescriptorsOnce();
return ReportBatchSplitRequest_descriptor_;
}
const ReportBatchSplitRequest& ReportBatchSplitRequest::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<ReportBatchSplitRequest> ReportBatchSplitRequest_default_instance_;
ReportBatchSplitRequest* ReportBatchSplitRequest::New(::google::protobuf::Arena* arena) const {
ReportBatchSplitRequest* n = new ReportBatchSplitRequest;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void ReportBatchSplitRequest::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.ReportBatchSplitRequest)
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
regions_.Clear();
}
bool ReportBatchSplitRequest::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.ReportBatchSplitRequest)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .pdpb.RequestHeader header = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_header()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_regions;
break;
}
// repeated .metapb.Region regions = 2;
case 2: {
if (tag == 18) {
parse_regions:
DO_(input->IncrementRecursionDepth());
parse_loop_regions:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth(
input, add_regions()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_loop_regions;
input->UnsafeDecrementRecursionDepth();
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.ReportBatchSplitRequest)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.ReportBatchSplitRequest)
return false;
#undef DO_
}
void ReportBatchSplitRequest::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.ReportBatchSplitRequest)
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->header_, output);
}
// repeated .metapb.Region regions = 2;
for (unsigned int i = 0, n = this->regions_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, this->regions(i), output);
}
// @@protoc_insertion_point(serialize_end:pdpb.ReportBatchSplitRequest)
}
::google::protobuf::uint8* ReportBatchSplitRequest::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.ReportBatchSplitRequest)
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->header_, false, target);
}
// repeated .metapb.Region regions = 2;
for (unsigned int i = 0, n = this->regions_size(); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
2, this->regions(i), false, target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.ReportBatchSplitRequest)
return target;
}
size_t ReportBatchSplitRequest::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.ReportBatchSplitRequest)
size_t total_size = 0;
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->header_);
}
// repeated .metapb.Region regions = 2;
{
unsigned int count = this->regions_size();
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->regions(i));
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void ReportBatchSplitRequest::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.ReportBatchSplitRequest)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const ReportBatchSplitRequest* source =
::google::protobuf::internal::DynamicCastToGenerated<const ReportBatchSplitRequest>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.ReportBatchSplitRequest)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.ReportBatchSplitRequest)
UnsafeMergeFrom(*source);
}
}
void ReportBatchSplitRequest::MergeFrom(const ReportBatchSplitRequest& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.ReportBatchSplitRequest)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void ReportBatchSplitRequest::UnsafeMergeFrom(const ReportBatchSplitRequest& from) {
GOOGLE_DCHECK(&from != this);
regions_.MergeFrom(from.regions_);
if (from.has_header()) {
mutable_header()->::pdpb::RequestHeader::MergeFrom(from.header());
}
}
void ReportBatchSplitRequest::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.ReportBatchSplitRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void ReportBatchSplitRequest::CopyFrom(const ReportBatchSplitRequest& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.ReportBatchSplitRequest)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool ReportBatchSplitRequest::IsInitialized() const {
return true;
}
void ReportBatchSplitRequest::Swap(ReportBatchSplitRequest* other) {
if (other == this) return;
InternalSwap(other);
}
void ReportBatchSplitRequest::InternalSwap(ReportBatchSplitRequest* other) {
std::swap(header_, other->header_);
regions_.UnsafeArenaSwap(&other->regions_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata ReportBatchSplitRequest::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = ReportBatchSplitRequest_descriptor_;
metadata.reflection = ReportBatchSplitRequest_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// ReportBatchSplitRequest
// optional .pdpb.RequestHeader header = 1;
bool ReportBatchSplitRequest::has_header() const {
return this != internal_default_instance() && header_ != NULL;
}
void ReportBatchSplitRequest::clear_header() {
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
const ::pdpb::RequestHeader& ReportBatchSplitRequest::header() const {
// @@protoc_insertion_point(field_get:pdpb.ReportBatchSplitRequest.header)
return header_ != NULL ? *header_
: *::pdpb::RequestHeader::internal_default_instance();
}
::pdpb::RequestHeader* ReportBatchSplitRequest::mutable_header() {
if (header_ == NULL) {
header_ = new ::pdpb::RequestHeader;
}
// @@protoc_insertion_point(field_mutable:pdpb.ReportBatchSplitRequest.header)
return header_;
}
::pdpb::RequestHeader* ReportBatchSplitRequest::release_header() {
// @@protoc_insertion_point(field_release:pdpb.ReportBatchSplitRequest.header)
::pdpb::RequestHeader* temp = header_;
header_ = NULL;
return temp;
}
void ReportBatchSplitRequest::set_allocated_header(::pdpb::RequestHeader* header) {
delete header_;
header_ = header;
if (header) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.ReportBatchSplitRequest.header)
}
// repeated .metapb.Region regions = 2;
int ReportBatchSplitRequest::regions_size() const {
return regions_.size();
}
void ReportBatchSplitRequest::clear_regions() {
regions_.Clear();
}
const ::metapb::Region& ReportBatchSplitRequest::regions(int index) const {
// @@protoc_insertion_point(field_get:pdpb.ReportBatchSplitRequest.regions)
return regions_.Get(index);
}
::metapb::Region* ReportBatchSplitRequest::mutable_regions(int index) {
// @@protoc_insertion_point(field_mutable:pdpb.ReportBatchSplitRequest.regions)
return regions_.Mutable(index);
}
::metapb::Region* ReportBatchSplitRequest::add_regions() {
// @@protoc_insertion_point(field_add:pdpb.ReportBatchSplitRequest.regions)
return regions_.Add();
}
::google::protobuf::RepeatedPtrField< ::metapb::Region >*
ReportBatchSplitRequest::mutable_regions() {
// @@protoc_insertion_point(field_mutable_list:pdpb.ReportBatchSplitRequest.regions)
return ®ions_;
}
const ::google::protobuf::RepeatedPtrField< ::metapb::Region >&
ReportBatchSplitRequest::regions() const {
// @@protoc_insertion_point(field_list:pdpb.ReportBatchSplitRequest.regions)
return regions_;
}
inline const ReportBatchSplitRequest* ReportBatchSplitRequest::internal_default_instance() {
return &ReportBatchSplitRequest_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int ReportBatchSplitResponse::kHeaderFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
ReportBatchSplitResponse::ReportBatchSplitResponse()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.ReportBatchSplitResponse)
}
void ReportBatchSplitResponse::InitAsDefaultInstance() {
header_ = const_cast< ::pdpb::ResponseHeader*>(
::pdpb::ResponseHeader::internal_default_instance());
}
ReportBatchSplitResponse::ReportBatchSplitResponse(const ReportBatchSplitResponse& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.ReportBatchSplitResponse)
}
void ReportBatchSplitResponse::SharedCtor() {
header_ = NULL;
_cached_size_ = 0;
}
ReportBatchSplitResponse::~ReportBatchSplitResponse() {
// @@protoc_insertion_point(destructor:pdpb.ReportBatchSplitResponse)
SharedDtor();
}
void ReportBatchSplitResponse::SharedDtor() {
if (this != &ReportBatchSplitResponse_default_instance_.get()) {
delete header_;
}
}
void ReportBatchSplitResponse::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* ReportBatchSplitResponse::descriptor() {
protobuf_AssignDescriptorsOnce();
return ReportBatchSplitResponse_descriptor_;
}
const ReportBatchSplitResponse& ReportBatchSplitResponse::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<ReportBatchSplitResponse> ReportBatchSplitResponse_default_instance_;
ReportBatchSplitResponse* ReportBatchSplitResponse::New(::google::protobuf::Arena* arena) const {
ReportBatchSplitResponse* n = new ReportBatchSplitResponse;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void ReportBatchSplitResponse::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.ReportBatchSplitResponse)
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
bool ReportBatchSplitResponse::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.ReportBatchSplitResponse)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .pdpb.ResponseHeader header = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_header()));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.ReportBatchSplitResponse)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.ReportBatchSplitResponse)
return false;
#undef DO_
}
void ReportBatchSplitResponse::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.ReportBatchSplitResponse)
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->header_, output);
}
// @@protoc_insertion_point(serialize_end:pdpb.ReportBatchSplitResponse)
}
::google::protobuf::uint8* ReportBatchSplitResponse::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.ReportBatchSplitResponse)
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->header_, false, target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.ReportBatchSplitResponse)
return target;
}
size_t ReportBatchSplitResponse::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.ReportBatchSplitResponse)
size_t total_size = 0;
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->header_);
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void ReportBatchSplitResponse::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.ReportBatchSplitResponse)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const ReportBatchSplitResponse* source =
::google::protobuf::internal::DynamicCastToGenerated<const ReportBatchSplitResponse>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.ReportBatchSplitResponse)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.ReportBatchSplitResponse)
UnsafeMergeFrom(*source);
}
}
void ReportBatchSplitResponse::MergeFrom(const ReportBatchSplitResponse& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.ReportBatchSplitResponse)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void ReportBatchSplitResponse::UnsafeMergeFrom(const ReportBatchSplitResponse& from) {
GOOGLE_DCHECK(&from != this);
if (from.has_header()) {
mutable_header()->::pdpb::ResponseHeader::MergeFrom(from.header());
}
}
void ReportBatchSplitResponse::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.ReportBatchSplitResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void ReportBatchSplitResponse::CopyFrom(const ReportBatchSplitResponse& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.ReportBatchSplitResponse)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool ReportBatchSplitResponse::IsInitialized() const {
return true;
}
void ReportBatchSplitResponse::Swap(ReportBatchSplitResponse* other) {
if (other == this) return;
InternalSwap(other);
}
void ReportBatchSplitResponse::InternalSwap(ReportBatchSplitResponse* other) {
std::swap(header_, other->header_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata ReportBatchSplitResponse::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = ReportBatchSplitResponse_descriptor_;
metadata.reflection = ReportBatchSplitResponse_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// ReportBatchSplitResponse
// optional .pdpb.ResponseHeader header = 1;
bool ReportBatchSplitResponse::has_header() const {
return this != internal_default_instance() && header_ != NULL;
}
void ReportBatchSplitResponse::clear_header() {
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
const ::pdpb::ResponseHeader& ReportBatchSplitResponse::header() const {
// @@protoc_insertion_point(field_get:pdpb.ReportBatchSplitResponse.header)
return header_ != NULL ? *header_
: *::pdpb::ResponseHeader::internal_default_instance();
}
::pdpb::ResponseHeader* ReportBatchSplitResponse::mutable_header() {
if (header_ == NULL) {
header_ = new ::pdpb::ResponseHeader;
}
// @@protoc_insertion_point(field_mutable:pdpb.ReportBatchSplitResponse.header)
return header_;
}
::pdpb::ResponseHeader* ReportBatchSplitResponse::release_header() {
// @@protoc_insertion_point(field_release:pdpb.ReportBatchSplitResponse.header)
::pdpb::ResponseHeader* temp = header_;
header_ = NULL;
return temp;
}
void ReportBatchSplitResponse::set_allocated_header(::pdpb::ResponseHeader* header) {
delete header_;
header_ = header;
if (header) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.ReportBatchSplitResponse.header)
}
inline const ReportBatchSplitResponse* ReportBatchSplitResponse::internal_default_instance() {
return &ReportBatchSplitResponse_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int TimeInterval::kStartTimestampFieldNumber;
const int TimeInterval::kEndTimestampFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
TimeInterval::TimeInterval()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.TimeInterval)
}
void TimeInterval::InitAsDefaultInstance() {
}
TimeInterval::TimeInterval(const TimeInterval& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.TimeInterval)
}
void TimeInterval::SharedCtor() {
::memset(&start_timestamp_, 0, reinterpret_cast<char*>(&end_timestamp_) -
reinterpret_cast<char*>(&start_timestamp_) + sizeof(end_timestamp_));
_cached_size_ = 0;
}
TimeInterval::~TimeInterval() {
// @@protoc_insertion_point(destructor:pdpb.TimeInterval)
SharedDtor();
}
void TimeInterval::SharedDtor() {
}
void TimeInterval::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* TimeInterval::descriptor() {
protobuf_AssignDescriptorsOnce();
return TimeInterval_descriptor_;
}
const TimeInterval& TimeInterval::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<TimeInterval> TimeInterval_default_instance_;
TimeInterval* TimeInterval::New(::google::protobuf::Arena* arena) const {
TimeInterval* n = new TimeInterval;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void TimeInterval::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.TimeInterval)
#if defined(__clang__)
#define ZR_HELPER_(f) \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Winvalid-offsetof\"") \
__builtin_offsetof(TimeInterval, f) \
_Pragma("clang diagnostic pop")
#else
#define ZR_HELPER_(f) reinterpret_cast<char*>(\
&reinterpret_cast<TimeInterval*>(16)->f)
#endif
#define ZR_(first, last) do {\
::memset(&(first), 0,\
ZR_HELPER_(last) - ZR_HELPER_(first) + sizeof(last));\
} while (0)
ZR_(start_timestamp_, end_timestamp_);
#undef ZR_HELPER_
#undef ZR_
}
bool TimeInterval::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.TimeInterval)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint64 start_timestamp = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &start_timestamp_)));
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_end_timestamp;
break;
}
// optional uint64 end_timestamp = 2;
case 2: {
if (tag == 16) {
parse_end_timestamp:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &end_timestamp_)));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.TimeInterval)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.TimeInterval)
return false;
#undef DO_
}
void TimeInterval::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.TimeInterval)
// optional uint64 start_timestamp = 1;
if (this->start_timestamp() != 0) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(1, this->start_timestamp(), output);
}
// optional uint64 end_timestamp = 2;
if (this->end_timestamp() != 0) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(2, this->end_timestamp(), output);
}
// @@protoc_insertion_point(serialize_end:pdpb.TimeInterval)
}
::google::protobuf::uint8* TimeInterval::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.TimeInterval)
// optional uint64 start_timestamp = 1;
if (this->start_timestamp() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(1, this->start_timestamp(), target);
}
// optional uint64 end_timestamp = 2;
if (this->end_timestamp() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(2, this->end_timestamp(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.TimeInterval)
return target;
}
size_t TimeInterval::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.TimeInterval)
size_t total_size = 0;
// optional uint64 start_timestamp = 1;
if (this->start_timestamp() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->start_timestamp());
}
// optional uint64 end_timestamp = 2;
if (this->end_timestamp() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->end_timestamp());
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void TimeInterval::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.TimeInterval)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const TimeInterval* source =
::google::protobuf::internal::DynamicCastToGenerated<const TimeInterval>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.TimeInterval)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.TimeInterval)
UnsafeMergeFrom(*source);
}
}
void TimeInterval::MergeFrom(const TimeInterval& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.TimeInterval)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void TimeInterval::UnsafeMergeFrom(const TimeInterval& from) {
GOOGLE_DCHECK(&from != this);
if (from.start_timestamp() != 0) {
set_start_timestamp(from.start_timestamp());
}
if (from.end_timestamp() != 0) {
set_end_timestamp(from.end_timestamp());
}
}
void TimeInterval::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.TimeInterval)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void TimeInterval::CopyFrom(const TimeInterval& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.TimeInterval)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool TimeInterval::IsInitialized() const {
return true;
}
void TimeInterval::Swap(TimeInterval* other) {
if (other == this) return;
InternalSwap(other);
}
void TimeInterval::InternalSwap(TimeInterval* other) {
std::swap(start_timestamp_, other->start_timestamp_);
std::swap(end_timestamp_, other->end_timestamp_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata TimeInterval::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = TimeInterval_descriptor_;
metadata.reflection = TimeInterval_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// TimeInterval
// optional uint64 start_timestamp = 1;
void TimeInterval::clear_start_timestamp() {
start_timestamp_ = GOOGLE_ULONGLONG(0);
}
::google::protobuf::uint64 TimeInterval::start_timestamp() const {
// @@protoc_insertion_point(field_get:pdpb.TimeInterval.start_timestamp)
return start_timestamp_;
}
void TimeInterval::set_start_timestamp(::google::protobuf::uint64 value) {
start_timestamp_ = value;
// @@protoc_insertion_point(field_set:pdpb.TimeInterval.start_timestamp)
}
// optional uint64 end_timestamp = 2;
void TimeInterval::clear_end_timestamp() {
end_timestamp_ = GOOGLE_ULONGLONG(0);
}
::google::protobuf::uint64 TimeInterval::end_timestamp() const {
// @@protoc_insertion_point(field_get:pdpb.TimeInterval.end_timestamp)
return end_timestamp_;
}
void TimeInterval::set_end_timestamp(::google::protobuf::uint64 value) {
end_timestamp_ = value;
// @@protoc_insertion_point(field_set:pdpb.TimeInterval.end_timestamp)
}
inline const TimeInterval* TimeInterval::internal_default_instance() {
return &TimeInterval_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int StoreStats::kStoreIdFieldNumber;
const int StoreStats::kCapacityFieldNumber;
const int StoreStats::kAvailableFieldNumber;
const int StoreStats::kRegionCountFieldNumber;
const int StoreStats::kSendingSnapCountFieldNumber;
const int StoreStats::kReceivingSnapCountFieldNumber;
const int StoreStats::kStartTimeFieldNumber;
const int StoreStats::kApplyingSnapCountFieldNumber;
const int StoreStats::kIsBusyFieldNumber;
const int StoreStats::kUsedSizeFieldNumber;
const int StoreStats::kBytesWrittenFieldNumber;
const int StoreStats::kKeysWrittenFieldNumber;
const int StoreStats::kBytesReadFieldNumber;
const int StoreStats::kKeysReadFieldNumber;
const int StoreStats::kIntervalFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
StoreStats::StoreStats()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.StoreStats)
}
void StoreStats::InitAsDefaultInstance() {
interval_ = const_cast< ::pdpb::TimeInterval*>(
::pdpb::TimeInterval::internal_default_instance());
}
StoreStats::StoreStats(const StoreStats& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.StoreStats)
}
void StoreStats::SharedCtor() {
interval_ = NULL;
::memset(&store_id_, 0, reinterpret_cast<char*>(&keys_read_) -
reinterpret_cast<char*>(&store_id_) + sizeof(keys_read_));
_cached_size_ = 0;
}
StoreStats::~StoreStats() {
// @@protoc_insertion_point(destructor:pdpb.StoreStats)
SharedDtor();
}
void StoreStats::SharedDtor() {
if (this != &StoreStats_default_instance_.get()) {
delete interval_;
}
}
void StoreStats::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* StoreStats::descriptor() {
protobuf_AssignDescriptorsOnce();
return StoreStats_descriptor_;
}
const StoreStats& StoreStats::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<StoreStats> StoreStats_default_instance_;
StoreStats* StoreStats::New(::google::protobuf::Arena* arena) const {
StoreStats* n = new StoreStats;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void StoreStats::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.StoreStats)
#if defined(__clang__)
#define ZR_HELPER_(f) \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Winvalid-offsetof\"") \
__builtin_offsetof(StoreStats, f) \
_Pragma("clang diagnostic pop")
#else
#define ZR_HELPER_(f) reinterpret_cast<char*>(\
&reinterpret_cast<StoreStats*>(16)->f)
#endif
#define ZR_(first, last) do {\
::memset(&(first), 0,\
ZR_HELPER_(last) - ZR_HELPER_(first) + sizeof(last));\
} while (0)
ZR_(store_id_, applying_snap_count_);
ZR_(is_busy_, keys_read_);
if (GetArenaNoVirtual() == NULL && interval_ != NULL) delete interval_;
interval_ = NULL;
#undef ZR_HELPER_
#undef ZR_
}
bool StoreStats::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.StoreStats)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint64 store_id = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &store_id_)));
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_capacity;
break;
}
// optional uint64 capacity = 2;
case 2: {
if (tag == 16) {
parse_capacity:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &capacity_)));
} else {
goto handle_unusual;
}
if (input->ExpectTag(24)) goto parse_available;
break;
}
// optional uint64 available = 3;
case 3: {
if (tag == 24) {
parse_available:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &available_)));
} else {
goto handle_unusual;
}
if (input->ExpectTag(32)) goto parse_region_count;
break;
}
// optional uint32 region_count = 4;
case 4: {
if (tag == 32) {
parse_region_count:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, ®ion_count_)));
} else {
goto handle_unusual;
}
if (input->ExpectTag(40)) goto parse_sending_snap_count;
break;
}
// optional uint32 sending_snap_count = 5;
case 5: {
if (tag == 40) {
parse_sending_snap_count:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &sending_snap_count_)));
} else {
goto handle_unusual;
}
if (input->ExpectTag(48)) goto parse_receiving_snap_count;
break;
}
// optional uint32 receiving_snap_count = 6;
case 6: {
if (tag == 48) {
parse_receiving_snap_count:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &receiving_snap_count_)));
} else {
goto handle_unusual;
}
if (input->ExpectTag(56)) goto parse_start_time;
break;
}
// optional uint32 start_time = 7;
case 7: {
if (tag == 56) {
parse_start_time:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &start_time_)));
} else {
goto handle_unusual;
}
if (input->ExpectTag(64)) goto parse_applying_snap_count;
break;
}
// optional uint32 applying_snap_count = 8;
case 8: {
if (tag == 64) {
parse_applying_snap_count:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &applying_snap_count_)));
} else {
goto handle_unusual;
}
if (input->ExpectTag(72)) goto parse_is_busy;
break;
}
// optional bool is_busy = 9;
case 9: {
if (tag == 72) {
parse_is_busy:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &is_busy_)));
} else {
goto handle_unusual;
}
if (input->ExpectTag(80)) goto parse_used_size;
break;
}
// optional uint64 used_size = 10;
case 10: {
if (tag == 80) {
parse_used_size:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &used_size_)));
} else {
goto handle_unusual;
}
if (input->ExpectTag(88)) goto parse_bytes_written;
break;
}
// optional uint64 bytes_written = 11;
case 11: {
if (tag == 88) {
parse_bytes_written:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &bytes_written_)));
} else {
goto handle_unusual;
}
if (input->ExpectTag(96)) goto parse_keys_written;
break;
}
// optional uint64 keys_written = 12;
case 12: {
if (tag == 96) {
parse_keys_written:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &keys_written_)));
} else {
goto handle_unusual;
}
if (input->ExpectTag(104)) goto parse_bytes_read;
break;
}
// optional uint64 bytes_read = 13;
case 13: {
if (tag == 104) {
parse_bytes_read:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &bytes_read_)));
} else {
goto handle_unusual;
}
if (input->ExpectTag(112)) goto parse_keys_read;
break;
}
// optional uint64 keys_read = 14;
case 14: {
if (tag == 112) {
parse_keys_read:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &keys_read_)));
} else {
goto handle_unusual;
}
if (input->ExpectTag(122)) goto parse_interval;
break;
}
// optional .pdpb.TimeInterval interval = 15;
case 15: {
if (tag == 122) {
parse_interval:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_interval()));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.StoreStats)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.StoreStats)
return false;
#undef DO_
}
void StoreStats::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.StoreStats)
// optional uint64 store_id = 1;
if (this->store_id() != 0) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(1, this->store_id(), output);
}
// optional uint64 capacity = 2;
if (this->capacity() != 0) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(2, this->capacity(), output);
}
// optional uint64 available = 3;
if (this->available() != 0) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(3, this->available(), output);
}
// optional uint32 region_count = 4;
if (this->region_count() != 0) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(4, this->region_count(), output);
}
// optional uint32 sending_snap_count = 5;
if (this->sending_snap_count() != 0) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(5, this->sending_snap_count(), output);
}
// optional uint32 receiving_snap_count = 6;
if (this->receiving_snap_count() != 0) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(6, this->receiving_snap_count(), output);
}
// optional uint32 start_time = 7;
if (this->start_time() != 0) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(7, this->start_time(), output);
}
// optional uint32 applying_snap_count = 8;
if (this->applying_snap_count() != 0) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(8, this->applying_snap_count(), output);
}
// optional bool is_busy = 9;
if (this->is_busy() != 0) {
::google::protobuf::internal::WireFormatLite::WriteBool(9, this->is_busy(), output);
}
// optional uint64 used_size = 10;
if (this->used_size() != 0) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(10, this->used_size(), output);
}
// optional uint64 bytes_written = 11;
if (this->bytes_written() != 0) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(11, this->bytes_written(), output);
}
// optional uint64 keys_written = 12;
if (this->keys_written() != 0) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(12, this->keys_written(), output);
}
// optional uint64 bytes_read = 13;
if (this->bytes_read() != 0) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(13, this->bytes_read(), output);
}
// optional uint64 keys_read = 14;
if (this->keys_read() != 0) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(14, this->keys_read(), output);
}
// optional .pdpb.TimeInterval interval = 15;
if (this->has_interval()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
15, *this->interval_, output);
}
// @@protoc_insertion_point(serialize_end:pdpb.StoreStats)
}
::google::protobuf::uint8* StoreStats::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.StoreStats)
// optional uint64 store_id = 1;
if (this->store_id() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(1, this->store_id(), target);
}
// optional uint64 capacity = 2;
if (this->capacity() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(2, this->capacity(), target);
}
// optional uint64 available = 3;
if (this->available() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(3, this->available(), target);
}
// optional uint32 region_count = 4;
if (this->region_count() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(4, this->region_count(), target);
}
// optional uint32 sending_snap_count = 5;
if (this->sending_snap_count() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(5, this->sending_snap_count(), target);
}
// optional uint32 receiving_snap_count = 6;
if (this->receiving_snap_count() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(6, this->receiving_snap_count(), target);
}
// optional uint32 start_time = 7;
if (this->start_time() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(7, this->start_time(), target);
}
// optional uint32 applying_snap_count = 8;
if (this->applying_snap_count() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(8, this->applying_snap_count(), target);
}
// optional bool is_busy = 9;
if (this->is_busy() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(9, this->is_busy(), target);
}
// optional uint64 used_size = 10;
if (this->used_size() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(10, this->used_size(), target);
}
// optional uint64 bytes_written = 11;
if (this->bytes_written() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(11, this->bytes_written(), target);
}
// optional uint64 keys_written = 12;
if (this->keys_written() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(12, this->keys_written(), target);
}
// optional uint64 bytes_read = 13;
if (this->bytes_read() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(13, this->bytes_read(), target);
}
// optional uint64 keys_read = 14;
if (this->keys_read() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(14, this->keys_read(), target);
}
// optional .pdpb.TimeInterval interval = 15;
if (this->has_interval()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
15, *this->interval_, false, target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.StoreStats)
return target;
}
size_t StoreStats::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.StoreStats)
size_t total_size = 0;
// optional uint64 store_id = 1;
if (this->store_id() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->store_id());
}
// optional uint64 capacity = 2;
if (this->capacity() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->capacity());
}
// optional uint64 available = 3;
if (this->available() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->available());
}
// optional uint32 region_count = 4;
if (this->region_count() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->region_count());
}
// optional uint32 sending_snap_count = 5;
if (this->sending_snap_count() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->sending_snap_count());
}
// optional uint32 receiving_snap_count = 6;
if (this->receiving_snap_count() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->receiving_snap_count());
}
// optional uint32 start_time = 7;
if (this->start_time() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->start_time());
}
// optional uint32 applying_snap_count = 8;
if (this->applying_snap_count() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->applying_snap_count());
}
// optional bool is_busy = 9;
if (this->is_busy() != 0) {
total_size += 1 + 1;
}
// optional uint64 used_size = 10;
if (this->used_size() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->used_size());
}
// optional uint64 bytes_written = 11;
if (this->bytes_written() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->bytes_written());
}
// optional uint64 keys_written = 12;
if (this->keys_written() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->keys_written());
}
// optional uint64 bytes_read = 13;
if (this->bytes_read() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->bytes_read());
}
// optional uint64 keys_read = 14;
if (this->keys_read() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->keys_read());
}
// optional .pdpb.TimeInterval interval = 15;
if (this->has_interval()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->interval_);
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void StoreStats::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.StoreStats)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const StoreStats* source =
::google::protobuf::internal::DynamicCastToGenerated<const StoreStats>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.StoreStats)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.StoreStats)
UnsafeMergeFrom(*source);
}
}
void StoreStats::MergeFrom(const StoreStats& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.StoreStats)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void StoreStats::UnsafeMergeFrom(const StoreStats& from) {
GOOGLE_DCHECK(&from != this);
if (from.store_id() != 0) {
set_store_id(from.store_id());
}
if (from.capacity() != 0) {
set_capacity(from.capacity());
}
if (from.available() != 0) {
set_available(from.available());
}
if (from.region_count() != 0) {
set_region_count(from.region_count());
}
if (from.sending_snap_count() != 0) {
set_sending_snap_count(from.sending_snap_count());
}
if (from.receiving_snap_count() != 0) {
set_receiving_snap_count(from.receiving_snap_count());
}
if (from.start_time() != 0) {
set_start_time(from.start_time());
}
if (from.applying_snap_count() != 0) {
set_applying_snap_count(from.applying_snap_count());
}
if (from.is_busy() != 0) {
set_is_busy(from.is_busy());
}
if (from.used_size() != 0) {
set_used_size(from.used_size());
}
if (from.bytes_written() != 0) {
set_bytes_written(from.bytes_written());
}
if (from.keys_written() != 0) {
set_keys_written(from.keys_written());
}
if (from.bytes_read() != 0) {
set_bytes_read(from.bytes_read());
}
if (from.keys_read() != 0) {
set_keys_read(from.keys_read());
}
if (from.has_interval()) {
mutable_interval()->::pdpb::TimeInterval::MergeFrom(from.interval());
}
}
void StoreStats::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.StoreStats)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void StoreStats::CopyFrom(const StoreStats& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.StoreStats)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool StoreStats::IsInitialized() const {
return true;
}
void StoreStats::Swap(StoreStats* other) {
if (other == this) return;
InternalSwap(other);
}
void StoreStats::InternalSwap(StoreStats* other) {
std::swap(store_id_, other->store_id_);
std::swap(capacity_, other->capacity_);
std::swap(available_, other->available_);
std::swap(region_count_, other->region_count_);
std::swap(sending_snap_count_, other->sending_snap_count_);
std::swap(receiving_snap_count_, other->receiving_snap_count_);
std::swap(start_time_, other->start_time_);
std::swap(applying_snap_count_, other->applying_snap_count_);
std::swap(is_busy_, other->is_busy_);
std::swap(used_size_, other->used_size_);
std::swap(bytes_written_, other->bytes_written_);
std::swap(keys_written_, other->keys_written_);
std::swap(bytes_read_, other->bytes_read_);
std::swap(keys_read_, other->keys_read_);
std::swap(interval_, other->interval_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata StoreStats::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = StoreStats_descriptor_;
metadata.reflection = StoreStats_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// StoreStats
// optional uint64 store_id = 1;
void StoreStats::clear_store_id() {
store_id_ = GOOGLE_ULONGLONG(0);
}
::google::protobuf::uint64 StoreStats::store_id() const {
// @@protoc_insertion_point(field_get:pdpb.StoreStats.store_id)
return store_id_;
}
void StoreStats::set_store_id(::google::protobuf::uint64 value) {
store_id_ = value;
// @@protoc_insertion_point(field_set:pdpb.StoreStats.store_id)
}
// optional uint64 capacity = 2;
void StoreStats::clear_capacity() {
capacity_ = GOOGLE_ULONGLONG(0);
}
::google::protobuf::uint64 StoreStats::capacity() const {
// @@protoc_insertion_point(field_get:pdpb.StoreStats.capacity)
return capacity_;
}
void StoreStats::set_capacity(::google::protobuf::uint64 value) {
capacity_ = value;
// @@protoc_insertion_point(field_set:pdpb.StoreStats.capacity)
}
// optional uint64 available = 3;
void StoreStats::clear_available() {
available_ = GOOGLE_ULONGLONG(0);
}
::google::protobuf::uint64 StoreStats::available() const {
// @@protoc_insertion_point(field_get:pdpb.StoreStats.available)
return available_;
}
void StoreStats::set_available(::google::protobuf::uint64 value) {
available_ = value;
// @@protoc_insertion_point(field_set:pdpb.StoreStats.available)
}
// optional uint32 region_count = 4;
void StoreStats::clear_region_count() {
region_count_ = 0u;
}
::google::protobuf::uint32 StoreStats::region_count() const {
// @@protoc_insertion_point(field_get:pdpb.StoreStats.region_count)
return region_count_;
}
void StoreStats::set_region_count(::google::protobuf::uint32 value) {
region_count_ = value;
// @@protoc_insertion_point(field_set:pdpb.StoreStats.region_count)
}
// optional uint32 sending_snap_count = 5;
void StoreStats::clear_sending_snap_count() {
sending_snap_count_ = 0u;
}
::google::protobuf::uint32 StoreStats::sending_snap_count() const {
// @@protoc_insertion_point(field_get:pdpb.StoreStats.sending_snap_count)
return sending_snap_count_;
}
void StoreStats::set_sending_snap_count(::google::protobuf::uint32 value) {
sending_snap_count_ = value;
// @@protoc_insertion_point(field_set:pdpb.StoreStats.sending_snap_count)
}
// optional uint32 receiving_snap_count = 6;
void StoreStats::clear_receiving_snap_count() {
receiving_snap_count_ = 0u;
}
::google::protobuf::uint32 StoreStats::receiving_snap_count() const {
// @@protoc_insertion_point(field_get:pdpb.StoreStats.receiving_snap_count)
return receiving_snap_count_;
}
void StoreStats::set_receiving_snap_count(::google::protobuf::uint32 value) {
receiving_snap_count_ = value;
// @@protoc_insertion_point(field_set:pdpb.StoreStats.receiving_snap_count)
}
// optional uint32 start_time = 7;
void StoreStats::clear_start_time() {
start_time_ = 0u;
}
::google::protobuf::uint32 StoreStats::start_time() const {
// @@protoc_insertion_point(field_get:pdpb.StoreStats.start_time)
return start_time_;
}
void StoreStats::set_start_time(::google::protobuf::uint32 value) {
start_time_ = value;
// @@protoc_insertion_point(field_set:pdpb.StoreStats.start_time)
}
// optional uint32 applying_snap_count = 8;
void StoreStats::clear_applying_snap_count() {
applying_snap_count_ = 0u;
}
::google::protobuf::uint32 StoreStats::applying_snap_count() const {
// @@protoc_insertion_point(field_get:pdpb.StoreStats.applying_snap_count)
return applying_snap_count_;
}
void StoreStats::set_applying_snap_count(::google::protobuf::uint32 value) {
applying_snap_count_ = value;
// @@protoc_insertion_point(field_set:pdpb.StoreStats.applying_snap_count)
}
// optional bool is_busy = 9;
void StoreStats::clear_is_busy() {
is_busy_ = false;
}
bool StoreStats::is_busy() const {
// @@protoc_insertion_point(field_get:pdpb.StoreStats.is_busy)
return is_busy_;
}
void StoreStats::set_is_busy(bool value) {
is_busy_ = value;
// @@protoc_insertion_point(field_set:pdpb.StoreStats.is_busy)
}
// optional uint64 used_size = 10;
void StoreStats::clear_used_size() {
used_size_ = GOOGLE_ULONGLONG(0);
}
::google::protobuf::uint64 StoreStats::used_size() const {
// @@protoc_insertion_point(field_get:pdpb.StoreStats.used_size)
return used_size_;
}
void StoreStats::set_used_size(::google::protobuf::uint64 value) {
used_size_ = value;
// @@protoc_insertion_point(field_set:pdpb.StoreStats.used_size)
}
// optional uint64 bytes_written = 11;
void StoreStats::clear_bytes_written() {
bytes_written_ = GOOGLE_ULONGLONG(0);
}
::google::protobuf::uint64 StoreStats::bytes_written() const {
// @@protoc_insertion_point(field_get:pdpb.StoreStats.bytes_written)
return bytes_written_;
}
void StoreStats::set_bytes_written(::google::protobuf::uint64 value) {
bytes_written_ = value;
// @@protoc_insertion_point(field_set:pdpb.StoreStats.bytes_written)
}
// optional uint64 keys_written = 12;
void StoreStats::clear_keys_written() {
keys_written_ = GOOGLE_ULONGLONG(0);
}
::google::protobuf::uint64 StoreStats::keys_written() const {
// @@protoc_insertion_point(field_get:pdpb.StoreStats.keys_written)
return keys_written_;
}
void StoreStats::set_keys_written(::google::protobuf::uint64 value) {
keys_written_ = value;
// @@protoc_insertion_point(field_set:pdpb.StoreStats.keys_written)
}
// optional uint64 bytes_read = 13;
void StoreStats::clear_bytes_read() {
bytes_read_ = GOOGLE_ULONGLONG(0);
}
::google::protobuf::uint64 StoreStats::bytes_read() const {
// @@protoc_insertion_point(field_get:pdpb.StoreStats.bytes_read)
return bytes_read_;
}
void StoreStats::set_bytes_read(::google::protobuf::uint64 value) {
bytes_read_ = value;
// @@protoc_insertion_point(field_set:pdpb.StoreStats.bytes_read)
}
// optional uint64 keys_read = 14;
void StoreStats::clear_keys_read() {
keys_read_ = GOOGLE_ULONGLONG(0);
}
::google::protobuf::uint64 StoreStats::keys_read() const {
// @@protoc_insertion_point(field_get:pdpb.StoreStats.keys_read)
return keys_read_;
}
void StoreStats::set_keys_read(::google::protobuf::uint64 value) {
keys_read_ = value;
// @@protoc_insertion_point(field_set:pdpb.StoreStats.keys_read)
}
// optional .pdpb.TimeInterval interval = 15;
bool StoreStats::has_interval() const {
return this != internal_default_instance() && interval_ != NULL;
}
void StoreStats::clear_interval() {
if (GetArenaNoVirtual() == NULL && interval_ != NULL) delete interval_;
interval_ = NULL;
}
const ::pdpb::TimeInterval& StoreStats::interval() const {
// @@protoc_insertion_point(field_get:pdpb.StoreStats.interval)
return interval_ != NULL ? *interval_
: *::pdpb::TimeInterval::internal_default_instance();
}
::pdpb::TimeInterval* StoreStats::mutable_interval() {
if (interval_ == NULL) {
interval_ = new ::pdpb::TimeInterval;
}
// @@protoc_insertion_point(field_mutable:pdpb.StoreStats.interval)
return interval_;
}
::pdpb::TimeInterval* StoreStats::release_interval() {
// @@protoc_insertion_point(field_release:pdpb.StoreStats.interval)
::pdpb::TimeInterval* temp = interval_;
interval_ = NULL;
return temp;
}
void StoreStats::set_allocated_interval(::pdpb::TimeInterval* interval) {
delete interval_;
interval_ = interval;
if (interval) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.StoreStats.interval)
}
inline const StoreStats* StoreStats::internal_default_instance() {
return &StoreStats_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int StoreHeartbeatRequest::kHeaderFieldNumber;
const int StoreHeartbeatRequest::kStatsFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
StoreHeartbeatRequest::StoreHeartbeatRequest()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.StoreHeartbeatRequest)
}
void StoreHeartbeatRequest::InitAsDefaultInstance() {
header_ = const_cast< ::pdpb::RequestHeader*>(
::pdpb::RequestHeader::internal_default_instance());
stats_ = const_cast< ::pdpb::StoreStats*>(
::pdpb::StoreStats::internal_default_instance());
}
StoreHeartbeatRequest::StoreHeartbeatRequest(const StoreHeartbeatRequest& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.StoreHeartbeatRequest)
}
void StoreHeartbeatRequest::SharedCtor() {
header_ = NULL;
stats_ = NULL;
_cached_size_ = 0;
}
StoreHeartbeatRequest::~StoreHeartbeatRequest() {
// @@protoc_insertion_point(destructor:pdpb.StoreHeartbeatRequest)
SharedDtor();
}
void StoreHeartbeatRequest::SharedDtor() {
if (this != &StoreHeartbeatRequest_default_instance_.get()) {
delete header_;
delete stats_;
}
}
void StoreHeartbeatRequest::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* StoreHeartbeatRequest::descriptor() {
protobuf_AssignDescriptorsOnce();
return StoreHeartbeatRequest_descriptor_;
}
const StoreHeartbeatRequest& StoreHeartbeatRequest::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<StoreHeartbeatRequest> StoreHeartbeatRequest_default_instance_;
StoreHeartbeatRequest* StoreHeartbeatRequest::New(::google::protobuf::Arena* arena) const {
StoreHeartbeatRequest* n = new StoreHeartbeatRequest;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void StoreHeartbeatRequest::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.StoreHeartbeatRequest)
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
if (GetArenaNoVirtual() == NULL && stats_ != NULL) delete stats_;
stats_ = NULL;
}
bool StoreHeartbeatRequest::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.StoreHeartbeatRequest)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .pdpb.RequestHeader header = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_header()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_stats;
break;
}
// optional .pdpb.StoreStats stats = 2;
case 2: {
if (tag == 18) {
parse_stats:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_stats()));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.StoreHeartbeatRequest)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.StoreHeartbeatRequest)
return false;
#undef DO_
}
void StoreHeartbeatRequest::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.StoreHeartbeatRequest)
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->header_, output);
}
// optional .pdpb.StoreStats stats = 2;
if (this->has_stats()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, *this->stats_, output);
}
// @@protoc_insertion_point(serialize_end:pdpb.StoreHeartbeatRequest)
}
::google::protobuf::uint8* StoreHeartbeatRequest::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.StoreHeartbeatRequest)
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->header_, false, target);
}
// optional .pdpb.StoreStats stats = 2;
if (this->has_stats()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
2, *this->stats_, false, target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.StoreHeartbeatRequest)
return target;
}
size_t StoreHeartbeatRequest::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.StoreHeartbeatRequest)
size_t total_size = 0;
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->header_);
}
// optional .pdpb.StoreStats stats = 2;
if (this->has_stats()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->stats_);
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void StoreHeartbeatRequest::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.StoreHeartbeatRequest)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const StoreHeartbeatRequest* source =
::google::protobuf::internal::DynamicCastToGenerated<const StoreHeartbeatRequest>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.StoreHeartbeatRequest)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.StoreHeartbeatRequest)
UnsafeMergeFrom(*source);
}
}
void StoreHeartbeatRequest::MergeFrom(const StoreHeartbeatRequest& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.StoreHeartbeatRequest)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void StoreHeartbeatRequest::UnsafeMergeFrom(const StoreHeartbeatRequest& from) {
GOOGLE_DCHECK(&from != this);
if (from.has_header()) {
mutable_header()->::pdpb::RequestHeader::MergeFrom(from.header());
}
if (from.has_stats()) {
mutable_stats()->::pdpb::StoreStats::MergeFrom(from.stats());
}
}
void StoreHeartbeatRequest::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.StoreHeartbeatRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void StoreHeartbeatRequest::CopyFrom(const StoreHeartbeatRequest& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.StoreHeartbeatRequest)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool StoreHeartbeatRequest::IsInitialized() const {
return true;
}
void StoreHeartbeatRequest::Swap(StoreHeartbeatRequest* other) {
if (other == this) return;
InternalSwap(other);
}
void StoreHeartbeatRequest::InternalSwap(StoreHeartbeatRequest* other) {
std::swap(header_, other->header_);
std::swap(stats_, other->stats_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata StoreHeartbeatRequest::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = StoreHeartbeatRequest_descriptor_;
metadata.reflection = StoreHeartbeatRequest_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// StoreHeartbeatRequest
// optional .pdpb.RequestHeader header = 1;
bool StoreHeartbeatRequest::has_header() const {
return this != internal_default_instance() && header_ != NULL;
}
void StoreHeartbeatRequest::clear_header() {
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
const ::pdpb::RequestHeader& StoreHeartbeatRequest::header() const {
// @@protoc_insertion_point(field_get:pdpb.StoreHeartbeatRequest.header)
return header_ != NULL ? *header_
: *::pdpb::RequestHeader::internal_default_instance();
}
::pdpb::RequestHeader* StoreHeartbeatRequest::mutable_header() {
if (header_ == NULL) {
header_ = new ::pdpb::RequestHeader;
}
// @@protoc_insertion_point(field_mutable:pdpb.StoreHeartbeatRequest.header)
return header_;
}
::pdpb::RequestHeader* StoreHeartbeatRequest::release_header() {
// @@protoc_insertion_point(field_release:pdpb.StoreHeartbeatRequest.header)
::pdpb::RequestHeader* temp = header_;
header_ = NULL;
return temp;
}
void StoreHeartbeatRequest::set_allocated_header(::pdpb::RequestHeader* header) {
delete header_;
header_ = header;
if (header) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.StoreHeartbeatRequest.header)
}
// optional .pdpb.StoreStats stats = 2;
bool StoreHeartbeatRequest::has_stats() const {
return this != internal_default_instance() && stats_ != NULL;
}
void StoreHeartbeatRequest::clear_stats() {
if (GetArenaNoVirtual() == NULL && stats_ != NULL) delete stats_;
stats_ = NULL;
}
const ::pdpb::StoreStats& StoreHeartbeatRequest::stats() const {
// @@protoc_insertion_point(field_get:pdpb.StoreHeartbeatRequest.stats)
return stats_ != NULL ? *stats_
: *::pdpb::StoreStats::internal_default_instance();
}
::pdpb::StoreStats* StoreHeartbeatRequest::mutable_stats() {
if (stats_ == NULL) {
stats_ = new ::pdpb::StoreStats;
}
// @@protoc_insertion_point(field_mutable:pdpb.StoreHeartbeatRequest.stats)
return stats_;
}
::pdpb::StoreStats* StoreHeartbeatRequest::release_stats() {
// @@protoc_insertion_point(field_release:pdpb.StoreHeartbeatRequest.stats)
::pdpb::StoreStats* temp = stats_;
stats_ = NULL;
return temp;
}
void StoreHeartbeatRequest::set_allocated_stats(::pdpb::StoreStats* stats) {
delete stats_;
stats_ = stats;
if (stats) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.StoreHeartbeatRequest.stats)
}
inline const StoreHeartbeatRequest* StoreHeartbeatRequest::internal_default_instance() {
return &StoreHeartbeatRequest_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int StoreHeartbeatResponse::kHeaderFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
StoreHeartbeatResponse::StoreHeartbeatResponse()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.StoreHeartbeatResponse)
}
void StoreHeartbeatResponse::InitAsDefaultInstance() {
header_ = const_cast< ::pdpb::ResponseHeader*>(
::pdpb::ResponseHeader::internal_default_instance());
}
StoreHeartbeatResponse::StoreHeartbeatResponse(const StoreHeartbeatResponse& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.StoreHeartbeatResponse)
}
void StoreHeartbeatResponse::SharedCtor() {
header_ = NULL;
_cached_size_ = 0;
}
StoreHeartbeatResponse::~StoreHeartbeatResponse() {
// @@protoc_insertion_point(destructor:pdpb.StoreHeartbeatResponse)
SharedDtor();
}
void StoreHeartbeatResponse::SharedDtor() {
if (this != &StoreHeartbeatResponse_default_instance_.get()) {
delete header_;
}
}
void StoreHeartbeatResponse::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* StoreHeartbeatResponse::descriptor() {
protobuf_AssignDescriptorsOnce();
return StoreHeartbeatResponse_descriptor_;
}
const StoreHeartbeatResponse& StoreHeartbeatResponse::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<StoreHeartbeatResponse> StoreHeartbeatResponse_default_instance_;
StoreHeartbeatResponse* StoreHeartbeatResponse::New(::google::protobuf::Arena* arena) const {
StoreHeartbeatResponse* n = new StoreHeartbeatResponse;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void StoreHeartbeatResponse::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.StoreHeartbeatResponse)
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
bool StoreHeartbeatResponse::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.StoreHeartbeatResponse)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .pdpb.ResponseHeader header = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_header()));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.StoreHeartbeatResponse)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.StoreHeartbeatResponse)
return false;
#undef DO_
}
void StoreHeartbeatResponse::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.StoreHeartbeatResponse)
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->header_, output);
}
// @@protoc_insertion_point(serialize_end:pdpb.StoreHeartbeatResponse)
}
::google::protobuf::uint8* StoreHeartbeatResponse::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.StoreHeartbeatResponse)
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->header_, false, target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.StoreHeartbeatResponse)
return target;
}
size_t StoreHeartbeatResponse::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.StoreHeartbeatResponse)
size_t total_size = 0;
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->header_);
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void StoreHeartbeatResponse::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.StoreHeartbeatResponse)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const StoreHeartbeatResponse* source =
::google::protobuf::internal::DynamicCastToGenerated<const StoreHeartbeatResponse>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.StoreHeartbeatResponse)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.StoreHeartbeatResponse)
UnsafeMergeFrom(*source);
}
}
void StoreHeartbeatResponse::MergeFrom(const StoreHeartbeatResponse& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.StoreHeartbeatResponse)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void StoreHeartbeatResponse::UnsafeMergeFrom(const StoreHeartbeatResponse& from) {
GOOGLE_DCHECK(&from != this);
if (from.has_header()) {
mutable_header()->::pdpb::ResponseHeader::MergeFrom(from.header());
}
}
void StoreHeartbeatResponse::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.StoreHeartbeatResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void StoreHeartbeatResponse::CopyFrom(const StoreHeartbeatResponse& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.StoreHeartbeatResponse)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool StoreHeartbeatResponse::IsInitialized() const {
return true;
}
void StoreHeartbeatResponse::Swap(StoreHeartbeatResponse* other) {
if (other == this) return;
InternalSwap(other);
}
void StoreHeartbeatResponse::InternalSwap(StoreHeartbeatResponse* other) {
std::swap(header_, other->header_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata StoreHeartbeatResponse::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = StoreHeartbeatResponse_descriptor_;
metadata.reflection = StoreHeartbeatResponse_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// StoreHeartbeatResponse
// optional .pdpb.ResponseHeader header = 1;
bool StoreHeartbeatResponse::has_header() const {
return this != internal_default_instance() && header_ != NULL;
}
void StoreHeartbeatResponse::clear_header() {
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
const ::pdpb::ResponseHeader& StoreHeartbeatResponse::header() const {
// @@protoc_insertion_point(field_get:pdpb.StoreHeartbeatResponse.header)
return header_ != NULL ? *header_
: *::pdpb::ResponseHeader::internal_default_instance();
}
::pdpb::ResponseHeader* StoreHeartbeatResponse::mutable_header() {
if (header_ == NULL) {
header_ = new ::pdpb::ResponseHeader;
}
// @@protoc_insertion_point(field_mutable:pdpb.StoreHeartbeatResponse.header)
return header_;
}
::pdpb::ResponseHeader* StoreHeartbeatResponse::release_header() {
// @@protoc_insertion_point(field_release:pdpb.StoreHeartbeatResponse.header)
::pdpb::ResponseHeader* temp = header_;
header_ = NULL;
return temp;
}
void StoreHeartbeatResponse::set_allocated_header(::pdpb::ResponseHeader* header) {
delete header_;
header_ = header;
if (header) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.StoreHeartbeatResponse.header)
}
inline const StoreHeartbeatResponse* StoreHeartbeatResponse::internal_default_instance() {
return &StoreHeartbeatResponse_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int ScatterRegionRequest::kHeaderFieldNumber;
const int ScatterRegionRequest::kRegionIdFieldNumber;
const int ScatterRegionRequest::kRegionFieldNumber;
const int ScatterRegionRequest::kLeaderFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
ScatterRegionRequest::ScatterRegionRequest()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.ScatterRegionRequest)
}
void ScatterRegionRequest::InitAsDefaultInstance() {
header_ = const_cast< ::pdpb::RequestHeader*>(
::pdpb::RequestHeader::internal_default_instance());
region_ = const_cast< ::metapb::Region*>(
::metapb::Region::internal_default_instance());
leader_ = const_cast< ::metapb::Peer*>(
::metapb::Peer::internal_default_instance());
}
ScatterRegionRequest::ScatterRegionRequest(const ScatterRegionRequest& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.ScatterRegionRequest)
}
void ScatterRegionRequest::SharedCtor() {
header_ = NULL;
region_ = NULL;
leader_ = NULL;
region_id_ = GOOGLE_ULONGLONG(0);
_cached_size_ = 0;
}
ScatterRegionRequest::~ScatterRegionRequest() {
// @@protoc_insertion_point(destructor:pdpb.ScatterRegionRequest)
SharedDtor();
}
void ScatterRegionRequest::SharedDtor() {
if (this != &ScatterRegionRequest_default_instance_.get()) {
delete header_;
delete region_;
delete leader_;
}
}
void ScatterRegionRequest::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* ScatterRegionRequest::descriptor() {
protobuf_AssignDescriptorsOnce();
return ScatterRegionRequest_descriptor_;
}
const ScatterRegionRequest& ScatterRegionRequest::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<ScatterRegionRequest> ScatterRegionRequest_default_instance_;
ScatterRegionRequest* ScatterRegionRequest::New(::google::protobuf::Arena* arena) const {
ScatterRegionRequest* n = new ScatterRegionRequest;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void ScatterRegionRequest::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.ScatterRegionRequest)
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
region_id_ = GOOGLE_ULONGLONG(0);
if (GetArenaNoVirtual() == NULL && region_ != NULL) delete region_;
region_ = NULL;
if (GetArenaNoVirtual() == NULL && leader_ != NULL) delete leader_;
leader_ = NULL;
}
bool ScatterRegionRequest::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.ScatterRegionRequest)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .pdpb.RequestHeader header = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_header()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_region_id;
break;
}
// optional uint64 region_id = 2;
case 2: {
if (tag == 16) {
parse_region_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, ®ion_id_)));
} else {
goto handle_unusual;
}
if (input->ExpectTag(26)) goto parse_region;
break;
}
// optional .metapb.Region region = 3;
case 3: {
if (tag == 26) {
parse_region:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_region()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(34)) goto parse_leader;
break;
}
// optional .metapb.Peer leader = 4;
case 4: {
if (tag == 34) {
parse_leader:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_leader()));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.ScatterRegionRequest)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.ScatterRegionRequest)
return false;
#undef DO_
}
void ScatterRegionRequest::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.ScatterRegionRequest)
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->header_, output);
}
// optional uint64 region_id = 2;
if (this->region_id() != 0) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(2, this->region_id(), output);
}
// optional .metapb.Region region = 3;
if (this->has_region()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, *this->region_, output);
}
// optional .metapb.Peer leader = 4;
if (this->has_leader()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
4, *this->leader_, output);
}
// @@protoc_insertion_point(serialize_end:pdpb.ScatterRegionRequest)
}
::google::protobuf::uint8* ScatterRegionRequest::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.ScatterRegionRequest)
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->header_, false, target);
}
// optional uint64 region_id = 2;
if (this->region_id() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(2, this->region_id(), target);
}
// optional .metapb.Region region = 3;
if (this->has_region()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
3, *this->region_, false, target);
}
// optional .metapb.Peer leader = 4;
if (this->has_leader()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
4, *this->leader_, false, target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.ScatterRegionRequest)
return target;
}
size_t ScatterRegionRequest::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.ScatterRegionRequest)
size_t total_size = 0;
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->header_);
}
// optional uint64 region_id = 2;
if (this->region_id() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->region_id());
}
// optional .metapb.Region region = 3;
if (this->has_region()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->region_);
}
// optional .metapb.Peer leader = 4;
if (this->has_leader()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->leader_);
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void ScatterRegionRequest::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.ScatterRegionRequest)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const ScatterRegionRequest* source =
::google::protobuf::internal::DynamicCastToGenerated<const ScatterRegionRequest>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.ScatterRegionRequest)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.ScatterRegionRequest)
UnsafeMergeFrom(*source);
}
}
void ScatterRegionRequest::MergeFrom(const ScatterRegionRequest& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.ScatterRegionRequest)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void ScatterRegionRequest::UnsafeMergeFrom(const ScatterRegionRequest& from) {
GOOGLE_DCHECK(&from != this);
if (from.has_header()) {
mutable_header()->::pdpb::RequestHeader::MergeFrom(from.header());
}
if (from.region_id() != 0) {
set_region_id(from.region_id());
}
if (from.has_region()) {
mutable_region()->::metapb::Region::MergeFrom(from.region());
}
if (from.has_leader()) {
mutable_leader()->::metapb::Peer::MergeFrom(from.leader());
}
}
void ScatterRegionRequest::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.ScatterRegionRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void ScatterRegionRequest::CopyFrom(const ScatterRegionRequest& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.ScatterRegionRequest)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool ScatterRegionRequest::IsInitialized() const {
return true;
}
void ScatterRegionRequest::Swap(ScatterRegionRequest* other) {
if (other == this) return;
InternalSwap(other);
}
void ScatterRegionRequest::InternalSwap(ScatterRegionRequest* other) {
std::swap(header_, other->header_);
std::swap(region_id_, other->region_id_);
std::swap(region_, other->region_);
std::swap(leader_, other->leader_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata ScatterRegionRequest::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = ScatterRegionRequest_descriptor_;
metadata.reflection = ScatterRegionRequest_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// ScatterRegionRequest
// optional .pdpb.RequestHeader header = 1;
bool ScatterRegionRequest::has_header() const {
return this != internal_default_instance() && header_ != NULL;
}
void ScatterRegionRequest::clear_header() {
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
const ::pdpb::RequestHeader& ScatterRegionRequest::header() const {
// @@protoc_insertion_point(field_get:pdpb.ScatterRegionRequest.header)
return header_ != NULL ? *header_
: *::pdpb::RequestHeader::internal_default_instance();
}
::pdpb::RequestHeader* ScatterRegionRequest::mutable_header() {
if (header_ == NULL) {
header_ = new ::pdpb::RequestHeader;
}
// @@protoc_insertion_point(field_mutable:pdpb.ScatterRegionRequest.header)
return header_;
}
::pdpb::RequestHeader* ScatterRegionRequest::release_header() {
// @@protoc_insertion_point(field_release:pdpb.ScatterRegionRequest.header)
::pdpb::RequestHeader* temp = header_;
header_ = NULL;
return temp;
}
void ScatterRegionRequest::set_allocated_header(::pdpb::RequestHeader* header) {
delete header_;
header_ = header;
if (header) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.ScatterRegionRequest.header)
}
// optional uint64 region_id = 2;
void ScatterRegionRequest::clear_region_id() {
region_id_ = GOOGLE_ULONGLONG(0);
}
::google::protobuf::uint64 ScatterRegionRequest::region_id() const {
// @@protoc_insertion_point(field_get:pdpb.ScatterRegionRequest.region_id)
return region_id_;
}
void ScatterRegionRequest::set_region_id(::google::protobuf::uint64 value) {
region_id_ = value;
// @@protoc_insertion_point(field_set:pdpb.ScatterRegionRequest.region_id)
}
// optional .metapb.Region region = 3;
bool ScatterRegionRequest::has_region() const {
return this != internal_default_instance() && region_ != NULL;
}
void ScatterRegionRequest::clear_region() {
if (GetArenaNoVirtual() == NULL && region_ != NULL) delete region_;
region_ = NULL;
}
const ::metapb::Region& ScatterRegionRequest::region() const {
// @@protoc_insertion_point(field_get:pdpb.ScatterRegionRequest.region)
return region_ != NULL ? *region_
: *::metapb::Region::internal_default_instance();
}
::metapb::Region* ScatterRegionRequest::mutable_region() {
if (region_ == NULL) {
region_ = new ::metapb::Region;
}
// @@protoc_insertion_point(field_mutable:pdpb.ScatterRegionRequest.region)
return region_;
}
::metapb::Region* ScatterRegionRequest::release_region() {
// @@protoc_insertion_point(field_release:pdpb.ScatterRegionRequest.region)
::metapb::Region* temp = region_;
region_ = NULL;
return temp;
}
void ScatterRegionRequest::set_allocated_region(::metapb::Region* region) {
delete region_;
region_ = region;
if (region) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.ScatterRegionRequest.region)
}
// optional .metapb.Peer leader = 4;
bool ScatterRegionRequest::has_leader() const {
return this != internal_default_instance() && leader_ != NULL;
}
void ScatterRegionRequest::clear_leader() {
if (GetArenaNoVirtual() == NULL && leader_ != NULL) delete leader_;
leader_ = NULL;
}
const ::metapb::Peer& ScatterRegionRequest::leader() const {
// @@protoc_insertion_point(field_get:pdpb.ScatterRegionRequest.leader)
return leader_ != NULL ? *leader_
: *::metapb::Peer::internal_default_instance();
}
::metapb::Peer* ScatterRegionRequest::mutable_leader() {
if (leader_ == NULL) {
leader_ = new ::metapb::Peer;
}
// @@protoc_insertion_point(field_mutable:pdpb.ScatterRegionRequest.leader)
return leader_;
}
::metapb::Peer* ScatterRegionRequest::release_leader() {
// @@protoc_insertion_point(field_release:pdpb.ScatterRegionRequest.leader)
::metapb::Peer* temp = leader_;
leader_ = NULL;
return temp;
}
void ScatterRegionRequest::set_allocated_leader(::metapb::Peer* leader) {
delete leader_;
leader_ = leader;
if (leader) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.ScatterRegionRequest.leader)
}
inline const ScatterRegionRequest* ScatterRegionRequest::internal_default_instance() {
return &ScatterRegionRequest_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int ScatterRegionResponse::kHeaderFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
ScatterRegionResponse::ScatterRegionResponse()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.ScatterRegionResponse)
}
void ScatterRegionResponse::InitAsDefaultInstance() {
header_ = const_cast< ::pdpb::ResponseHeader*>(
::pdpb::ResponseHeader::internal_default_instance());
}
ScatterRegionResponse::ScatterRegionResponse(const ScatterRegionResponse& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.ScatterRegionResponse)
}
void ScatterRegionResponse::SharedCtor() {
header_ = NULL;
_cached_size_ = 0;
}
ScatterRegionResponse::~ScatterRegionResponse() {
// @@protoc_insertion_point(destructor:pdpb.ScatterRegionResponse)
SharedDtor();
}
void ScatterRegionResponse::SharedDtor() {
if (this != &ScatterRegionResponse_default_instance_.get()) {
delete header_;
}
}
void ScatterRegionResponse::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* ScatterRegionResponse::descriptor() {
protobuf_AssignDescriptorsOnce();
return ScatterRegionResponse_descriptor_;
}
const ScatterRegionResponse& ScatterRegionResponse::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<ScatterRegionResponse> ScatterRegionResponse_default_instance_;
ScatterRegionResponse* ScatterRegionResponse::New(::google::protobuf::Arena* arena) const {
ScatterRegionResponse* n = new ScatterRegionResponse;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void ScatterRegionResponse::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.ScatterRegionResponse)
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
bool ScatterRegionResponse::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.ScatterRegionResponse)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .pdpb.ResponseHeader header = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_header()));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.ScatterRegionResponse)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.ScatterRegionResponse)
return false;
#undef DO_
}
void ScatterRegionResponse::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.ScatterRegionResponse)
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->header_, output);
}
// @@protoc_insertion_point(serialize_end:pdpb.ScatterRegionResponse)
}
::google::protobuf::uint8* ScatterRegionResponse::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.ScatterRegionResponse)
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->header_, false, target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.ScatterRegionResponse)
return target;
}
size_t ScatterRegionResponse::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.ScatterRegionResponse)
size_t total_size = 0;
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->header_);
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void ScatterRegionResponse::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.ScatterRegionResponse)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const ScatterRegionResponse* source =
::google::protobuf::internal::DynamicCastToGenerated<const ScatterRegionResponse>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.ScatterRegionResponse)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.ScatterRegionResponse)
UnsafeMergeFrom(*source);
}
}
void ScatterRegionResponse::MergeFrom(const ScatterRegionResponse& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.ScatterRegionResponse)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void ScatterRegionResponse::UnsafeMergeFrom(const ScatterRegionResponse& from) {
GOOGLE_DCHECK(&from != this);
if (from.has_header()) {
mutable_header()->::pdpb::ResponseHeader::MergeFrom(from.header());
}
}
void ScatterRegionResponse::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.ScatterRegionResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void ScatterRegionResponse::CopyFrom(const ScatterRegionResponse& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.ScatterRegionResponse)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool ScatterRegionResponse::IsInitialized() const {
return true;
}
void ScatterRegionResponse::Swap(ScatterRegionResponse* other) {
if (other == this) return;
InternalSwap(other);
}
void ScatterRegionResponse::InternalSwap(ScatterRegionResponse* other) {
std::swap(header_, other->header_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata ScatterRegionResponse::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = ScatterRegionResponse_descriptor_;
metadata.reflection = ScatterRegionResponse_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// ScatterRegionResponse
// optional .pdpb.ResponseHeader header = 1;
bool ScatterRegionResponse::has_header() const {
return this != internal_default_instance() && header_ != NULL;
}
void ScatterRegionResponse::clear_header() {
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
const ::pdpb::ResponseHeader& ScatterRegionResponse::header() const {
// @@protoc_insertion_point(field_get:pdpb.ScatterRegionResponse.header)
return header_ != NULL ? *header_
: *::pdpb::ResponseHeader::internal_default_instance();
}
::pdpb::ResponseHeader* ScatterRegionResponse::mutable_header() {
if (header_ == NULL) {
header_ = new ::pdpb::ResponseHeader;
}
// @@protoc_insertion_point(field_mutable:pdpb.ScatterRegionResponse.header)
return header_;
}
::pdpb::ResponseHeader* ScatterRegionResponse::release_header() {
// @@protoc_insertion_point(field_release:pdpb.ScatterRegionResponse.header)
::pdpb::ResponseHeader* temp = header_;
header_ = NULL;
return temp;
}
void ScatterRegionResponse::set_allocated_header(::pdpb::ResponseHeader* header) {
delete header_;
header_ = header;
if (header) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.ScatterRegionResponse.header)
}
inline const ScatterRegionResponse* ScatterRegionResponse::internal_default_instance() {
return &ScatterRegionResponse_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int GetGCSafePointRequest::kHeaderFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
GetGCSafePointRequest::GetGCSafePointRequest()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.GetGCSafePointRequest)
}
void GetGCSafePointRequest::InitAsDefaultInstance() {
header_ = const_cast< ::pdpb::RequestHeader*>(
::pdpb::RequestHeader::internal_default_instance());
}
GetGCSafePointRequest::GetGCSafePointRequest(const GetGCSafePointRequest& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.GetGCSafePointRequest)
}
void GetGCSafePointRequest::SharedCtor() {
header_ = NULL;
_cached_size_ = 0;
}
GetGCSafePointRequest::~GetGCSafePointRequest() {
// @@protoc_insertion_point(destructor:pdpb.GetGCSafePointRequest)
SharedDtor();
}
void GetGCSafePointRequest::SharedDtor() {
if (this != &GetGCSafePointRequest_default_instance_.get()) {
delete header_;
}
}
void GetGCSafePointRequest::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* GetGCSafePointRequest::descriptor() {
protobuf_AssignDescriptorsOnce();
return GetGCSafePointRequest_descriptor_;
}
const GetGCSafePointRequest& GetGCSafePointRequest::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<GetGCSafePointRequest> GetGCSafePointRequest_default_instance_;
GetGCSafePointRequest* GetGCSafePointRequest::New(::google::protobuf::Arena* arena) const {
GetGCSafePointRequest* n = new GetGCSafePointRequest;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void GetGCSafePointRequest::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.GetGCSafePointRequest)
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
bool GetGCSafePointRequest::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.GetGCSafePointRequest)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .pdpb.RequestHeader header = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_header()));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.GetGCSafePointRequest)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.GetGCSafePointRequest)
return false;
#undef DO_
}
void GetGCSafePointRequest::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.GetGCSafePointRequest)
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->header_, output);
}
// @@protoc_insertion_point(serialize_end:pdpb.GetGCSafePointRequest)
}
::google::protobuf::uint8* GetGCSafePointRequest::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.GetGCSafePointRequest)
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->header_, false, target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.GetGCSafePointRequest)
return target;
}
size_t GetGCSafePointRequest::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.GetGCSafePointRequest)
size_t total_size = 0;
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->header_);
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void GetGCSafePointRequest::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.GetGCSafePointRequest)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const GetGCSafePointRequest* source =
::google::protobuf::internal::DynamicCastToGenerated<const GetGCSafePointRequest>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.GetGCSafePointRequest)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.GetGCSafePointRequest)
UnsafeMergeFrom(*source);
}
}
void GetGCSafePointRequest::MergeFrom(const GetGCSafePointRequest& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.GetGCSafePointRequest)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void GetGCSafePointRequest::UnsafeMergeFrom(const GetGCSafePointRequest& from) {
GOOGLE_DCHECK(&from != this);
if (from.has_header()) {
mutable_header()->::pdpb::RequestHeader::MergeFrom(from.header());
}
}
void GetGCSafePointRequest::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.GetGCSafePointRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void GetGCSafePointRequest::CopyFrom(const GetGCSafePointRequest& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.GetGCSafePointRequest)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool GetGCSafePointRequest::IsInitialized() const {
return true;
}
void GetGCSafePointRequest::Swap(GetGCSafePointRequest* other) {
if (other == this) return;
InternalSwap(other);
}
void GetGCSafePointRequest::InternalSwap(GetGCSafePointRequest* other) {
std::swap(header_, other->header_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata GetGCSafePointRequest::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = GetGCSafePointRequest_descriptor_;
metadata.reflection = GetGCSafePointRequest_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// GetGCSafePointRequest
// optional .pdpb.RequestHeader header = 1;
bool GetGCSafePointRequest::has_header() const {
return this != internal_default_instance() && header_ != NULL;
}
void GetGCSafePointRequest::clear_header() {
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
const ::pdpb::RequestHeader& GetGCSafePointRequest::header() const {
// @@protoc_insertion_point(field_get:pdpb.GetGCSafePointRequest.header)
return header_ != NULL ? *header_
: *::pdpb::RequestHeader::internal_default_instance();
}
::pdpb::RequestHeader* GetGCSafePointRequest::mutable_header() {
if (header_ == NULL) {
header_ = new ::pdpb::RequestHeader;
}
// @@protoc_insertion_point(field_mutable:pdpb.GetGCSafePointRequest.header)
return header_;
}
::pdpb::RequestHeader* GetGCSafePointRequest::release_header() {
// @@protoc_insertion_point(field_release:pdpb.GetGCSafePointRequest.header)
::pdpb::RequestHeader* temp = header_;
header_ = NULL;
return temp;
}
void GetGCSafePointRequest::set_allocated_header(::pdpb::RequestHeader* header) {
delete header_;
header_ = header;
if (header) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.GetGCSafePointRequest.header)
}
inline const GetGCSafePointRequest* GetGCSafePointRequest::internal_default_instance() {
return &GetGCSafePointRequest_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int GetGCSafePointResponse::kHeaderFieldNumber;
const int GetGCSafePointResponse::kSafePointFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
GetGCSafePointResponse::GetGCSafePointResponse()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.GetGCSafePointResponse)
}
void GetGCSafePointResponse::InitAsDefaultInstance() {
header_ = const_cast< ::pdpb::ResponseHeader*>(
::pdpb::ResponseHeader::internal_default_instance());
}
GetGCSafePointResponse::GetGCSafePointResponse(const GetGCSafePointResponse& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.GetGCSafePointResponse)
}
void GetGCSafePointResponse::SharedCtor() {
header_ = NULL;
safe_point_ = GOOGLE_ULONGLONG(0);
_cached_size_ = 0;
}
GetGCSafePointResponse::~GetGCSafePointResponse() {
// @@protoc_insertion_point(destructor:pdpb.GetGCSafePointResponse)
SharedDtor();
}
void GetGCSafePointResponse::SharedDtor() {
if (this != &GetGCSafePointResponse_default_instance_.get()) {
delete header_;
}
}
void GetGCSafePointResponse::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* GetGCSafePointResponse::descriptor() {
protobuf_AssignDescriptorsOnce();
return GetGCSafePointResponse_descriptor_;
}
const GetGCSafePointResponse& GetGCSafePointResponse::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<GetGCSafePointResponse> GetGCSafePointResponse_default_instance_;
GetGCSafePointResponse* GetGCSafePointResponse::New(::google::protobuf::Arena* arena) const {
GetGCSafePointResponse* n = new GetGCSafePointResponse;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void GetGCSafePointResponse::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.GetGCSafePointResponse)
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
safe_point_ = GOOGLE_ULONGLONG(0);
}
bool GetGCSafePointResponse::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.GetGCSafePointResponse)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .pdpb.ResponseHeader header = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_header()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_safe_point;
break;
}
// optional uint64 safe_point = 2;
case 2: {
if (tag == 16) {
parse_safe_point:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &safe_point_)));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.GetGCSafePointResponse)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.GetGCSafePointResponse)
return false;
#undef DO_
}
void GetGCSafePointResponse::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.GetGCSafePointResponse)
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->header_, output);
}
// optional uint64 safe_point = 2;
if (this->safe_point() != 0) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(2, this->safe_point(), output);
}
// @@protoc_insertion_point(serialize_end:pdpb.GetGCSafePointResponse)
}
::google::protobuf::uint8* GetGCSafePointResponse::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.GetGCSafePointResponse)
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->header_, false, target);
}
// optional uint64 safe_point = 2;
if (this->safe_point() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(2, this->safe_point(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.GetGCSafePointResponse)
return target;
}
size_t GetGCSafePointResponse::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.GetGCSafePointResponse)
size_t total_size = 0;
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->header_);
}
// optional uint64 safe_point = 2;
if (this->safe_point() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->safe_point());
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void GetGCSafePointResponse::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.GetGCSafePointResponse)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const GetGCSafePointResponse* source =
::google::protobuf::internal::DynamicCastToGenerated<const GetGCSafePointResponse>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.GetGCSafePointResponse)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.GetGCSafePointResponse)
UnsafeMergeFrom(*source);
}
}
void GetGCSafePointResponse::MergeFrom(const GetGCSafePointResponse& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.GetGCSafePointResponse)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void GetGCSafePointResponse::UnsafeMergeFrom(const GetGCSafePointResponse& from) {
GOOGLE_DCHECK(&from != this);
if (from.has_header()) {
mutable_header()->::pdpb::ResponseHeader::MergeFrom(from.header());
}
if (from.safe_point() != 0) {
set_safe_point(from.safe_point());
}
}
void GetGCSafePointResponse::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.GetGCSafePointResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void GetGCSafePointResponse::CopyFrom(const GetGCSafePointResponse& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.GetGCSafePointResponse)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool GetGCSafePointResponse::IsInitialized() const {
return true;
}
void GetGCSafePointResponse::Swap(GetGCSafePointResponse* other) {
if (other == this) return;
InternalSwap(other);
}
void GetGCSafePointResponse::InternalSwap(GetGCSafePointResponse* other) {
std::swap(header_, other->header_);
std::swap(safe_point_, other->safe_point_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata GetGCSafePointResponse::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = GetGCSafePointResponse_descriptor_;
metadata.reflection = GetGCSafePointResponse_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// GetGCSafePointResponse
// optional .pdpb.ResponseHeader header = 1;
bool GetGCSafePointResponse::has_header() const {
return this != internal_default_instance() && header_ != NULL;
}
void GetGCSafePointResponse::clear_header() {
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
const ::pdpb::ResponseHeader& GetGCSafePointResponse::header() const {
// @@protoc_insertion_point(field_get:pdpb.GetGCSafePointResponse.header)
return header_ != NULL ? *header_
: *::pdpb::ResponseHeader::internal_default_instance();
}
::pdpb::ResponseHeader* GetGCSafePointResponse::mutable_header() {
if (header_ == NULL) {
header_ = new ::pdpb::ResponseHeader;
}
// @@protoc_insertion_point(field_mutable:pdpb.GetGCSafePointResponse.header)
return header_;
}
::pdpb::ResponseHeader* GetGCSafePointResponse::release_header() {
// @@protoc_insertion_point(field_release:pdpb.GetGCSafePointResponse.header)
::pdpb::ResponseHeader* temp = header_;
header_ = NULL;
return temp;
}
void GetGCSafePointResponse::set_allocated_header(::pdpb::ResponseHeader* header) {
delete header_;
header_ = header;
if (header) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.GetGCSafePointResponse.header)
}
// optional uint64 safe_point = 2;
void GetGCSafePointResponse::clear_safe_point() {
safe_point_ = GOOGLE_ULONGLONG(0);
}
::google::protobuf::uint64 GetGCSafePointResponse::safe_point() const {
// @@protoc_insertion_point(field_get:pdpb.GetGCSafePointResponse.safe_point)
return safe_point_;
}
void GetGCSafePointResponse::set_safe_point(::google::protobuf::uint64 value) {
safe_point_ = value;
// @@protoc_insertion_point(field_set:pdpb.GetGCSafePointResponse.safe_point)
}
inline const GetGCSafePointResponse* GetGCSafePointResponse::internal_default_instance() {
return &GetGCSafePointResponse_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int UpdateGCSafePointRequest::kHeaderFieldNumber;
const int UpdateGCSafePointRequest::kSafePointFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
UpdateGCSafePointRequest::UpdateGCSafePointRequest()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.UpdateGCSafePointRequest)
}
void UpdateGCSafePointRequest::InitAsDefaultInstance() {
header_ = const_cast< ::pdpb::RequestHeader*>(
::pdpb::RequestHeader::internal_default_instance());
}
UpdateGCSafePointRequest::UpdateGCSafePointRequest(const UpdateGCSafePointRequest& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.UpdateGCSafePointRequest)
}
void UpdateGCSafePointRequest::SharedCtor() {
header_ = NULL;
safe_point_ = GOOGLE_ULONGLONG(0);
_cached_size_ = 0;
}
UpdateGCSafePointRequest::~UpdateGCSafePointRequest() {
// @@protoc_insertion_point(destructor:pdpb.UpdateGCSafePointRequest)
SharedDtor();
}
void UpdateGCSafePointRequest::SharedDtor() {
if (this != &UpdateGCSafePointRequest_default_instance_.get()) {
delete header_;
}
}
void UpdateGCSafePointRequest::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* UpdateGCSafePointRequest::descriptor() {
protobuf_AssignDescriptorsOnce();
return UpdateGCSafePointRequest_descriptor_;
}
const UpdateGCSafePointRequest& UpdateGCSafePointRequest::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<UpdateGCSafePointRequest> UpdateGCSafePointRequest_default_instance_;
UpdateGCSafePointRequest* UpdateGCSafePointRequest::New(::google::protobuf::Arena* arena) const {
UpdateGCSafePointRequest* n = new UpdateGCSafePointRequest;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void UpdateGCSafePointRequest::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.UpdateGCSafePointRequest)
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
safe_point_ = GOOGLE_ULONGLONG(0);
}
bool UpdateGCSafePointRequest::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.UpdateGCSafePointRequest)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .pdpb.RequestHeader header = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_header()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_safe_point;
break;
}
// optional uint64 safe_point = 2;
case 2: {
if (tag == 16) {
parse_safe_point:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &safe_point_)));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.UpdateGCSafePointRequest)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.UpdateGCSafePointRequest)
return false;
#undef DO_
}
void UpdateGCSafePointRequest::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.UpdateGCSafePointRequest)
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->header_, output);
}
// optional uint64 safe_point = 2;
if (this->safe_point() != 0) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(2, this->safe_point(), output);
}
// @@protoc_insertion_point(serialize_end:pdpb.UpdateGCSafePointRequest)
}
::google::protobuf::uint8* UpdateGCSafePointRequest::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.UpdateGCSafePointRequest)
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->header_, false, target);
}
// optional uint64 safe_point = 2;
if (this->safe_point() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(2, this->safe_point(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.UpdateGCSafePointRequest)
return target;
}
size_t UpdateGCSafePointRequest::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.UpdateGCSafePointRequest)
size_t total_size = 0;
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->header_);
}
// optional uint64 safe_point = 2;
if (this->safe_point() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->safe_point());
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void UpdateGCSafePointRequest::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.UpdateGCSafePointRequest)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const UpdateGCSafePointRequest* source =
::google::protobuf::internal::DynamicCastToGenerated<const UpdateGCSafePointRequest>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.UpdateGCSafePointRequest)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.UpdateGCSafePointRequest)
UnsafeMergeFrom(*source);
}
}
void UpdateGCSafePointRequest::MergeFrom(const UpdateGCSafePointRequest& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.UpdateGCSafePointRequest)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void UpdateGCSafePointRequest::UnsafeMergeFrom(const UpdateGCSafePointRequest& from) {
GOOGLE_DCHECK(&from != this);
if (from.has_header()) {
mutable_header()->::pdpb::RequestHeader::MergeFrom(from.header());
}
if (from.safe_point() != 0) {
set_safe_point(from.safe_point());
}
}
void UpdateGCSafePointRequest::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.UpdateGCSafePointRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void UpdateGCSafePointRequest::CopyFrom(const UpdateGCSafePointRequest& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.UpdateGCSafePointRequest)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool UpdateGCSafePointRequest::IsInitialized() const {
return true;
}
void UpdateGCSafePointRequest::Swap(UpdateGCSafePointRequest* other) {
if (other == this) return;
InternalSwap(other);
}
void UpdateGCSafePointRequest::InternalSwap(UpdateGCSafePointRequest* other) {
std::swap(header_, other->header_);
std::swap(safe_point_, other->safe_point_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata UpdateGCSafePointRequest::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = UpdateGCSafePointRequest_descriptor_;
metadata.reflection = UpdateGCSafePointRequest_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// UpdateGCSafePointRequest
// optional .pdpb.RequestHeader header = 1;
bool UpdateGCSafePointRequest::has_header() const {
return this != internal_default_instance() && header_ != NULL;
}
void UpdateGCSafePointRequest::clear_header() {
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
const ::pdpb::RequestHeader& UpdateGCSafePointRequest::header() const {
// @@protoc_insertion_point(field_get:pdpb.UpdateGCSafePointRequest.header)
return header_ != NULL ? *header_
: *::pdpb::RequestHeader::internal_default_instance();
}
::pdpb::RequestHeader* UpdateGCSafePointRequest::mutable_header() {
if (header_ == NULL) {
header_ = new ::pdpb::RequestHeader;
}
// @@protoc_insertion_point(field_mutable:pdpb.UpdateGCSafePointRequest.header)
return header_;
}
::pdpb::RequestHeader* UpdateGCSafePointRequest::release_header() {
// @@protoc_insertion_point(field_release:pdpb.UpdateGCSafePointRequest.header)
::pdpb::RequestHeader* temp = header_;
header_ = NULL;
return temp;
}
void UpdateGCSafePointRequest::set_allocated_header(::pdpb::RequestHeader* header) {
delete header_;
header_ = header;
if (header) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.UpdateGCSafePointRequest.header)
}
// optional uint64 safe_point = 2;
void UpdateGCSafePointRequest::clear_safe_point() {
safe_point_ = GOOGLE_ULONGLONG(0);
}
::google::protobuf::uint64 UpdateGCSafePointRequest::safe_point() const {
// @@protoc_insertion_point(field_get:pdpb.UpdateGCSafePointRequest.safe_point)
return safe_point_;
}
void UpdateGCSafePointRequest::set_safe_point(::google::protobuf::uint64 value) {
safe_point_ = value;
// @@protoc_insertion_point(field_set:pdpb.UpdateGCSafePointRequest.safe_point)
}
inline const UpdateGCSafePointRequest* UpdateGCSafePointRequest::internal_default_instance() {
return &UpdateGCSafePointRequest_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int UpdateGCSafePointResponse::kHeaderFieldNumber;
const int UpdateGCSafePointResponse::kNewSafePointFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
UpdateGCSafePointResponse::UpdateGCSafePointResponse()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.UpdateGCSafePointResponse)
}
void UpdateGCSafePointResponse::InitAsDefaultInstance() {
header_ = const_cast< ::pdpb::ResponseHeader*>(
::pdpb::ResponseHeader::internal_default_instance());
}
UpdateGCSafePointResponse::UpdateGCSafePointResponse(const UpdateGCSafePointResponse& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.UpdateGCSafePointResponse)
}
void UpdateGCSafePointResponse::SharedCtor() {
header_ = NULL;
new_safe_point_ = GOOGLE_ULONGLONG(0);
_cached_size_ = 0;
}
UpdateGCSafePointResponse::~UpdateGCSafePointResponse() {
// @@protoc_insertion_point(destructor:pdpb.UpdateGCSafePointResponse)
SharedDtor();
}
void UpdateGCSafePointResponse::SharedDtor() {
if (this != &UpdateGCSafePointResponse_default_instance_.get()) {
delete header_;
}
}
void UpdateGCSafePointResponse::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* UpdateGCSafePointResponse::descriptor() {
protobuf_AssignDescriptorsOnce();
return UpdateGCSafePointResponse_descriptor_;
}
const UpdateGCSafePointResponse& UpdateGCSafePointResponse::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<UpdateGCSafePointResponse> UpdateGCSafePointResponse_default_instance_;
UpdateGCSafePointResponse* UpdateGCSafePointResponse::New(::google::protobuf::Arena* arena) const {
UpdateGCSafePointResponse* n = new UpdateGCSafePointResponse;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void UpdateGCSafePointResponse::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.UpdateGCSafePointResponse)
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
new_safe_point_ = GOOGLE_ULONGLONG(0);
}
bool UpdateGCSafePointResponse::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.UpdateGCSafePointResponse)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .pdpb.ResponseHeader header = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_header()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_new_safe_point;
break;
}
// optional uint64 new_safe_point = 2;
case 2: {
if (tag == 16) {
parse_new_safe_point:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &new_safe_point_)));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.UpdateGCSafePointResponse)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.UpdateGCSafePointResponse)
return false;
#undef DO_
}
void UpdateGCSafePointResponse::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.UpdateGCSafePointResponse)
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->header_, output);
}
// optional uint64 new_safe_point = 2;
if (this->new_safe_point() != 0) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(2, this->new_safe_point(), output);
}
// @@protoc_insertion_point(serialize_end:pdpb.UpdateGCSafePointResponse)
}
::google::protobuf::uint8* UpdateGCSafePointResponse::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.UpdateGCSafePointResponse)
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->header_, false, target);
}
// optional uint64 new_safe_point = 2;
if (this->new_safe_point() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(2, this->new_safe_point(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.UpdateGCSafePointResponse)
return target;
}
size_t UpdateGCSafePointResponse::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.UpdateGCSafePointResponse)
size_t total_size = 0;
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->header_);
}
// optional uint64 new_safe_point = 2;
if (this->new_safe_point() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->new_safe_point());
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void UpdateGCSafePointResponse::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.UpdateGCSafePointResponse)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const UpdateGCSafePointResponse* source =
::google::protobuf::internal::DynamicCastToGenerated<const UpdateGCSafePointResponse>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.UpdateGCSafePointResponse)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.UpdateGCSafePointResponse)
UnsafeMergeFrom(*source);
}
}
void UpdateGCSafePointResponse::MergeFrom(const UpdateGCSafePointResponse& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.UpdateGCSafePointResponse)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void UpdateGCSafePointResponse::UnsafeMergeFrom(const UpdateGCSafePointResponse& from) {
GOOGLE_DCHECK(&from != this);
if (from.has_header()) {
mutable_header()->::pdpb::ResponseHeader::MergeFrom(from.header());
}
if (from.new_safe_point() != 0) {
set_new_safe_point(from.new_safe_point());
}
}
void UpdateGCSafePointResponse::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.UpdateGCSafePointResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void UpdateGCSafePointResponse::CopyFrom(const UpdateGCSafePointResponse& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.UpdateGCSafePointResponse)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool UpdateGCSafePointResponse::IsInitialized() const {
return true;
}
void UpdateGCSafePointResponse::Swap(UpdateGCSafePointResponse* other) {
if (other == this) return;
InternalSwap(other);
}
void UpdateGCSafePointResponse::InternalSwap(UpdateGCSafePointResponse* other) {
std::swap(header_, other->header_);
std::swap(new_safe_point_, other->new_safe_point_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata UpdateGCSafePointResponse::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = UpdateGCSafePointResponse_descriptor_;
metadata.reflection = UpdateGCSafePointResponse_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// UpdateGCSafePointResponse
// optional .pdpb.ResponseHeader header = 1;
bool UpdateGCSafePointResponse::has_header() const {
return this != internal_default_instance() && header_ != NULL;
}
void UpdateGCSafePointResponse::clear_header() {
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
const ::pdpb::ResponseHeader& UpdateGCSafePointResponse::header() const {
// @@protoc_insertion_point(field_get:pdpb.UpdateGCSafePointResponse.header)
return header_ != NULL ? *header_
: *::pdpb::ResponseHeader::internal_default_instance();
}
::pdpb::ResponseHeader* UpdateGCSafePointResponse::mutable_header() {
if (header_ == NULL) {
header_ = new ::pdpb::ResponseHeader;
}
// @@protoc_insertion_point(field_mutable:pdpb.UpdateGCSafePointResponse.header)
return header_;
}
::pdpb::ResponseHeader* UpdateGCSafePointResponse::release_header() {
// @@protoc_insertion_point(field_release:pdpb.UpdateGCSafePointResponse.header)
::pdpb::ResponseHeader* temp = header_;
header_ = NULL;
return temp;
}
void UpdateGCSafePointResponse::set_allocated_header(::pdpb::ResponseHeader* header) {
delete header_;
header_ = header;
if (header) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.UpdateGCSafePointResponse.header)
}
// optional uint64 new_safe_point = 2;
void UpdateGCSafePointResponse::clear_new_safe_point() {
new_safe_point_ = GOOGLE_ULONGLONG(0);
}
::google::protobuf::uint64 UpdateGCSafePointResponse::new_safe_point() const {
// @@protoc_insertion_point(field_get:pdpb.UpdateGCSafePointResponse.new_safe_point)
return new_safe_point_;
}
void UpdateGCSafePointResponse::set_new_safe_point(::google::protobuf::uint64 value) {
new_safe_point_ = value;
// @@protoc_insertion_point(field_set:pdpb.UpdateGCSafePointResponse.new_safe_point)
}
inline const UpdateGCSafePointResponse* UpdateGCSafePointResponse::internal_default_instance() {
return &UpdateGCSafePointResponse_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int SyncRegionRequest::kHeaderFieldNumber;
const int SyncRegionRequest::kMemberFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
SyncRegionRequest::SyncRegionRequest()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.SyncRegionRequest)
}
void SyncRegionRequest::InitAsDefaultInstance() {
header_ = const_cast< ::pdpb::RequestHeader*>(
::pdpb::RequestHeader::internal_default_instance());
member_ = const_cast< ::pdpb::Member*>(
::pdpb::Member::internal_default_instance());
}
SyncRegionRequest::SyncRegionRequest(const SyncRegionRequest& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.SyncRegionRequest)
}
void SyncRegionRequest::SharedCtor() {
header_ = NULL;
member_ = NULL;
_cached_size_ = 0;
}
SyncRegionRequest::~SyncRegionRequest() {
// @@protoc_insertion_point(destructor:pdpb.SyncRegionRequest)
SharedDtor();
}
void SyncRegionRequest::SharedDtor() {
if (this != &SyncRegionRequest_default_instance_.get()) {
delete header_;
delete member_;
}
}
void SyncRegionRequest::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* SyncRegionRequest::descriptor() {
protobuf_AssignDescriptorsOnce();
return SyncRegionRequest_descriptor_;
}
const SyncRegionRequest& SyncRegionRequest::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<SyncRegionRequest> SyncRegionRequest_default_instance_;
SyncRegionRequest* SyncRegionRequest::New(::google::protobuf::Arena* arena) const {
SyncRegionRequest* n = new SyncRegionRequest;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void SyncRegionRequest::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.SyncRegionRequest)
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
if (GetArenaNoVirtual() == NULL && member_ != NULL) delete member_;
member_ = NULL;
}
bool SyncRegionRequest::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.SyncRegionRequest)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .pdpb.RequestHeader header = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_header()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_member;
break;
}
// optional .pdpb.Member member = 2;
case 2: {
if (tag == 18) {
parse_member:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_member()));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.SyncRegionRequest)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.SyncRegionRequest)
return false;
#undef DO_
}
void SyncRegionRequest::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.SyncRegionRequest)
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->header_, output);
}
// optional .pdpb.Member member = 2;
if (this->has_member()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, *this->member_, output);
}
// @@protoc_insertion_point(serialize_end:pdpb.SyncRegionRequest)
}
::google::protobuf::uint8* SyncRegionRequest::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.SyncRegionRequest)
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->header_, false, target);
}
// optional .pdpb.Member member = 2;
if (this->has_member()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
2, *this->member_, false, target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.SyncRegionRequest)
return target;
}
size_t SyncRegionRequest::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.SyncRegionRequest)
size_t total_size = 0;
// optional .pdpb.RequestHeader header = 1;
if (this->has_header()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->header_);
}
// optional .pdpb.Member member = 2;
if (this->has_member()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->member_);
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void SyncRegionRequest::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.SyncRegionRequest)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const SyncRegionRequest* source =
::google::protobuf::internal::DynamicCastToGenerated<const SyncRegionRequest>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.SyncRegionRequest)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.SyncRegionRequest)
UnsafeMergeFrom(*source);
}
}
void SyncRegionRequest::MergeFrom(const SyncRegionRequest& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.SyncRegionRequest)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void SyncRegionRequest::UnsafeMergeFrom(const SyncRegionRequest& from) {
GOOGLE_DCHECK(&from != this);
if (from.has_header()) {
mutable_header()->::pdpb::RequestHeader::MergeFrom(from.header());
}
if (from.has_member()) {
mutable_member()->::pdpb::Member::MergeFrom(from.member());
}
}
void SyncRegionRequest::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.SyncRegionRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void SyncRegionRequest::CopyFrom(const SyncRegionRequest& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.SyncRegionRequest)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool SyncRegionRequest::IsInitialized() const {
return true;
}
void SyncRegionRequest::Swap(SyncRegionRequest* other) {
if (other == this) return;
InternalSwap(other);
}
void SyncRegionRequest::InternalSwap(SyncRegionRequest* other) {
std::swap(header_, other->header_);
std::swap(member_, other->member_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata SyncRegionRequest::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = SyncRegionRequest_descriptor_;
metadata.reflection = SyncRegionRequest_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// SyncRegionRequest
// optional .pdpb.RequestHeader header = 1;
bool SyncRegionRequest::has_header() const {
return this != internal_default_instance() && header_ != NULL;
}
void SyncRegionRequest::clear_header() {
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
const ::pdpb::RequestHeader& SyncRegionRequest::header() const {
// @@protoc_insertion_point(field_get:pdpb.SyncRegionRequest.header)
return header_ != NULL ? *header_
: *::pdpb::RequestHeader::internal_default_instance();
}
::pdpb::RequestHeader* SyncRegionRequest::mutable_header() {
if (header_ == NULL) {
header_ = new ::pdpb::RequestHeader;
}
// @@protoc_insertion_point(field_mutable:pdpb.SyncRegionRequest.header)
return header_;
}
::pdpb::RequestHeader* SyncRegionRequest::release_header() {
// @@protoc_insertion_point(field_release:pdpb.SyncRegionRequest.header)
::pdpb::RequestHeader* temp = header_;
header_ = NULL;
return temp;
}
void SyncRegionRequest::set_allocated_header(::pdpb::RequestHeader* header) {
delete header_;
header_ = header;
if (header) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.SyncRegionRequest.header)
}
// optional .pdpb.Member member = 2;
bool SyncRegionRequest::has_member() const {
return this != internal_default_instance() && member_ != NULL;
}
void SyncRegionRequest::clear_member() {
if (GetArenaNoVirtual() == NULL && member_ != NULL) delete member_;
member_ = NULL;
}
const ::pdpb::Member& SyncRegionRequest::member() const {
// @@protoc_insertion_point(field_get:pdpb.SyncRegionRequest.member)
return member_ != NULL ? *member_
: *::pdpb::Member::internal_default_instance();
}
::pdpb::Member* SyncRegionRequest::mutable_member() {
if (member_ == NULL) {
member_ = new ::pdpb::Member;
}
// @@protoc_insertion_point(field_mutable:pdpb.SyncRegionRequest.member)
return member_;
}
::pdpb::Member* SyncRegionRequest::release_member() {
// @@protoc_insertion_point(field_release:pdpb.SyncRegionRequest.member)
::pdpb::Member* temp = member_;
member_ = NULL;
return temp;
}
void SyncRegionRequest::set_allocated_member(::pdpb::Member* member) {
delete member_;
member_ = member;
if (member) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.SyncRegionRequest.member)
}
inline const SyncRegionRequest* SyncRegionRequest::internal_default_instance() {
return &SyncRegionRequest_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int SyncRegionResponse::kHeaderFieldNumber;
const int SyncRegionResponse::kRegionsFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
SyncRegionResponse::SyncRegionResponse()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_pdpb_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:pdpb.SyncRegionResponse)
}
void SyncRegionResponse::InitAsDefaultInstance() {
header_ = const_cast< ::pdpb::ResponseHeader*>(
::pdpb::ResponseHeader::internal_default_instance());
}
SyncRegionResponse::SyncRegionResponse(const SyncRegionResponse& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:pdpb.SyncRegionResponse)
}
void SyncRegionResponse::SharedCtor() {
header_ = NULL;
_cached_size_ = 0;
}
SyncRegionResponse::~SyncRegionResponse() {
// @@protoc_insertion_point(destructor:pdpb.SyncRegionResponse)
SharedDtor();
}
void SyncRegionResponse::SharedDtor() {
if (this != &SyncRegionResponse_default_instance_.get()) {
delete header_;
}
}
void SyncRegionResponse::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* SyncRegionResponse::descriptor() {
protobuf_AssignDescriptorsOnce();
return SyncRegionResponse_descriptor_;
}
const SyncRegionResponse& SyncRegionResponse::default_instance() {
protobuf_InitDefaults_pdpb_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<SyncRegionResponse> SyncRegionResponse_default_instance_;
SyncRegionResponse* SyncRegionResponse::New(::google::protobuf::Arena* arena) const {
SyncRegionResponse* n = new SyncRegionResponse;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void SyncRegionResponse::Clear() {
// @@protoc_insertion_point(message_clear_start:pdpb.SyncRegionResponse)
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
regions_.Clear();
}
bool SyncRegionResponse::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:pdpb.SyncRegionResponse)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .pdpb.ResponseHeader header = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_header()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_regions;
break;
}
// repeated .metapb.Region regions = 2;
case 2: {
if (tag == 18) {
parse_regions:
DO_(input->IncrementRecursionDepth());
parse_loop_regions:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth(
input, add_regions()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_loop_regions;
input->UnsafeDecrementRecursionDepth();
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:pdpb.SyncRegionResponse)
return true;
failure:
// @@protoc_insertion_point(parse_failure:pdpb.SyncRegionResponse)
return false;
#undef DO_
}
void SyncRegionResponse::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:pdpb.SyncRegionResponse)
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->header_, output);
}
// repeated .metapb.Region regions = 2;
for (unsigned int i = 0, n = this->regions_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, this->regions(i), output);
}
// @@protoc_insertion_point(serialize_end:pdpb.SyncRegionResponse)
}
::google::protobuf::uint8* SyncRegionResponse::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:pdpb.SyncRegionResponse)
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->header_, false, target);
}
// repeated .metapb.Region regions = 2;
for (unsigned int i = 0, n = this->regions_size(); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
2, this->regions(i), false, target);
}
// @@protoc_insertion_point(serialize_to_array_end:pdpb.SyncRegionResponse)
return target;
}
size_t SyncRegionResponse::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pdpb.SyncRegionResponse)
size_t total_size = 0;
// optional .pdpb.ResponseHeader header = 1;
if (this->has_header()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->header_);
}
// repeated .metapb.Region regions = 2;
{
unsigned int count = this->regions_size();
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->regions(i));
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void SyncRegionResponse::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pdpb.SyncRegionResponse)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const SyncRegionResponse* source =
::google::protobuf::internal::DynamicCastToGenerated<const SyncRegionResponse>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:pdpb.SyncRegionResponse)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:pdpb.SyncRegionResponse)
UnsafeMergeFrom(*source);
}
}
void SyncRegionResponse::MergeFrom(const SyncRegionResponse& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pdpb.SyncRegionResponse)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void SyncRegionResponse::UnsafeMergeFrom(const SyncRegionResponse& from) {
GOOGLE_DCHECK(&from != this);
regions_.MergeFrom(from.regions_);
if (from.has_header()) {
mutable_header()->::pdpb::ResponseHeader::MergeFrom(from.header());
}
}
void SyncRegionResponse::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pdpb.SyncRegionResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void SyncRegionResponse::CopyFrom(const SyncRegionResponse& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pdpb.SyncRegionResponse)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool SyncRegionResponse::IsInitialized() const {
return true;
}
void SyncRegionResponse::Swap(SyncRegionResponse* other) {
if (other == this) return;
InternalSwap(other);
}
void SyncRegionResponse::InternalSwap(SyncRegionResponse* other) {
std::swap(header_, other->header_);
regions_.UnsafeArenaSwap(&other->regions_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata SyncRegionResponse::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = SyncRegionResponse_descriptor_;
metadata.reflection = SyncRegionResponse_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// SyncRegionResponse
// optional .pdpb.ResponseHeader header = 1;
bool SyncRegionResponse::has_header() const {
return this != internal_default_instance() && header_ != NULL;
}
void SyncRegionResponse::clear_header() {
if (GetArenaNoVirtual() == NULL && header_ != NULL) delete header_;
header_ = NULL;
}
const ::pdpb::ResponseHeader& SyncRegionResponse::header() const {
// @@protoc_insertion_point(field_get:pdpb.SyncRegionResponse.header)
return header_ != NULL ? *header_
: *::pdpb::ResponseHeader::internal_default_instance();
}
::pdpb::ResponseHeader* SyncRegionResponse::mutable_header() {
if (header_ == NULL) {
header_ = new ::pdpb::ResponseHeader;
}
// @@protoc_insertion_point(field_mutable:pdpb.SyncRegionResponse.header)
return header_;
}
::pdpb::ResponseHeader* SyncRegionResponse::release_header() {
// @@protoc_insertion_point(field_release:pdpb.SyncRegionResponse.header)
::pdpb::ResponseHeader* temp = header_;
header_ = NULL;
return temp;
}
void SyncRegionResponse::set_allocated_header(::pdpb::ResponseHeader* header) {
delete header_;
header_ = header;
if (header) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:pdpb.SyncRegionResponse.header)
}
// repeated .metapb.Region regions = 2;
int SyncRegionResponse::regions_size() const {
return regions_.size();
}
void SyncRegionResponse::clear_regions() {
regions_.Clear();
}
const ::metapb::Region& SyncRegionResponse::regions(int index) const {
// @@protoc_insertion_point(field_get:pdpb.SyncRegionResponse.regions)
return regions_.Get(index);
}
::metapb::Region* SyncRegionResponse::mutable_regions(int index) {
// @@protoc_insertion_point(field_mutable:pdpb.SyncRegionResponse.regions)
return regions_.Mutable(index);
}
::metapb::Region* SyncRegionResponse::add_regions() {
// @@protoc_insertion_point(field_add:pdpb.SyncRegionResponse.regions)
return regions_.Add();
}
::google::protobuf::RepeatedPtrField< ::metapb::Region >*
SyncRegionResponse::mutable_regions() {
// @@protoc_insertion_point(field_mutable_list:pdpb.SyncRegionResponse.regions)
return ®ions_;
}
const ::google::protobuf::RepeatedPtrField< ::metapb::Region >&
SyncRegionResponse::regions() const {
// @@protoc_insertion_point(field_list:pdpb.SyncRegionResponse.regions)
return regions_;
}
inline const SyncRegionResponse* SyncRegionResponse::internal_default_instance() {
return &SyncRegionResponse_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// @@protoc_insertion_point(namespace_scope)
} // namespace pdpb
// @@protoc_insertion_point(global_scope)
| 34.149318
| 143
| 0.720905
|
Xavier1994
|
03554db1d88a8c08e0932d8cc0824f1e60253b65
| 11,985
|
cc
|
C++
|
hackt_docker/hackt/src/misc/sudoku.cc
|
broken-wheel/hacktist
|
36e832ae7dd38b27bca9be7d0889d06054dc2806
|
[
"MIT"
] | null | null | null |
hackt_docker/hackt/src/misc/sudoku.cc
|
broken-wheel/hacktist
|
36e832ae7dd38b27bca9be7d0889d06054dc2806
|
[
"MIT"
] | null | null | null |
hackt_docker/hackt/src/misc/sudoku.cc
|
broken-wheel/hacktist
|
36e832ae7dd38b27bca9be7d0889d06054dc2806
|
[
"MIT"
] | null | null | null |
/**
\file "sudoku.cc"
$Id: sudoku.cc,v 1.3 2006/04/03 19:36:24 fang Exp $
*/
#include <iostream>
#include <iomanip>
#include <algorithm>
#include "misc/sudoku.hh"
// some handy compile-switches
#define DEBUG_LOAD 0
#define STEP_SOLVE 0
#define DEBUG_SOLVE 0
#define REVEAL_SOLUTION 1 // print as they are found
namespace sudoku {
using std::ios_base;
using std::cerr;
using std::endl;
//=============================================================================
// class avail_set member definitions
const ushort
avail_set::masks[9] = {
0x001, 0x002, 0x004, 0x008,
0x010, 0x020, 0x040, 0x080,
0x100
};
#define FIRST 0
#define THIRD 2
#define LAST 8
//=============================================================================
// internal classes
/**
Initialize with one element on stack.
*/
board::cell_type::cell_type() : cell_type_base() {
push(avail_set());
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/**
Undo moves in a stack-managed tracker.
TODO: give this class hidden visibility.
*/
class board::undo_list {
board& bd;
// maximum number of cells to undo
pair<uchar,uchar> cell[20];
//
size_t count;
public:
explicit
undo_list(board& b) : bd(b), count(0) { }
~undo_list();
void
push(const uchar x, const uchar y) {
SUDOKU_ASSERT(count < 20);
cell[count].first = x;
cell[count].second = y;
++count;
}
}; // end class board::undo_list
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/**
Representation of an attempted placement of a number
and position.
TODO: give this class hidden visibility.
*/
class board::move {
board::undo_list ul;
/// true if move was accepted
uchar x, y;
uchar val;
bool accept;
public:
/**
Don't really need to remember val.
*/
move(board&, const uchar, const uchar, const uchar);
~move();
bool
accepted(void) const { return accept; }
}; // end class board::move
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
struct board::pivot_finder {
size_t best_x;
size_t best_y;
uchar min_avail;
pivot_finder() : best_x(9), best_y(9), min_avail(9) { }
/**
\param i, j the coordinates of the cell.
*/
void
operator () (cell_type& c, const size_t i, const size_t j) {
const avail_set& scan(c.top());
if (!scan.is_assigned()) {
const uchar avail = scan.num_avail();
SUDOKU_ASSERT(avail);
if (avail < min_avail) {
best_x = i;
best_y = j;
min_avail = avail;
}
}
}
bool
valid(void) const {
return best_x < 9 && best_y < 9;
}
}; // end struct board::pivot_finder
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
struct board::value_dumper {
ostream& o;
size_t count;
value_dumper(ostream& _o) : o(_o), count(0) { }
void
operator () (const cell_type& cell, const size_t, const size_t) {
if (!(count % 9)) o << '\t';
++count;
const avail_set& c(cell.top());
if (c.is_assigned())
o << c.printed_value();
else o << '-';
if (!(count % 9)) o << endl;
else o << ' ';
}
}; // end struct value_dumper
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
struct board::state_dumper {
ostream& o;
size_t count;
state_dumper(ostream& _o) : o(_o), count(0) { }
void
operator () (const cell_type& cell, const size_t, const size_t) {
o << '\t';
const avail_set& c(cell.top());
const size_t val = c.printed_value();
if (c.is_assigned())
o << val;
else {
o << std::setbase(16);
o << '(' << c.get_mask() << ')';
o << std::setbase(10);
}
++count;
if (!(count % 9)) o << endl;
}
}; // end struct state_dumper
//=============================================================================
// class solution method definitions
solution::solution(const board& b) {
size_t i = FIRST;
for ( ; i<=LAST; i++) {
size_t j = FIRST;
for ( ; j<=LAST; j++)
cell[i][j] = b.probe(i,j);
}
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ostream&
solution::dump(ostream& o) const {
size_t i = FIRST;
for ( ; i<=LAST; i++) {
o << '\t';
size_t j = FIRST;
for ( ; j<=LAST; j++) {
const size_t val = cell[i][j];
if (val < 9) o << val+1;
else o << '-';
o << ' ';
}
o << endl;
}
return o;
}
//=============================================================================
// class board method definitions
/**
Initially, stack matrix is empty, so we need to
initialize each cell with at least a top element.
Done in each cell's default constructor already.
*/
board::board() { }
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
board::~board() {
// just default clear everything
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/**
Non-modifying visitor acceptor.
*/
template <class F>
void
board::accept(F& f) const {
size_t i = FIRST;
for ( ; i<=LAST; i++) {
size_t j = FIRST;
for ( ; j<=LAST; j++)
f(cell[i][j], i, j);
}
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/**
Modifying visitor acceptor.
*/
template <class F>
void
board::accept(F& f) {
size_t i = FIRST;
for ( ; i<=LAST; i++) {
size_t j = FIRST;
for ( ; j<=LAST; j++)
f(cell[i][j], i, j);
}
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
inline
bool
board::conditional_assign_cell(const uchar x, const uchar y, const uchar v,
undo_list& ul) {
// if unassigned, then modify its state, else skip
cell_type& c(cell[x][y]);
if (!c.top().is_assigned()) {
ul.push(x, y);
c.push(c.top());
return c.top().set(v);
} else return true;
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/**
TODO: return early when avail goes false.
\return true if assignment was accepted.
*/
bool
board::assign(const uchar x, const uchar y, const uchar v, undo_list& ul) {
SUDOKU_ASSERT(x < 9);
SUDOKU_ASSERT(y < 9);
SUDOKU_ASSERT(v < 9);
cell_type& c(cell[x][y]);
c.push(c.top());
c.top().assign(v);
ul.push(x, y);
// tighten constraints on row, col, blocks
bool avail = true;
// cerr << "updating rows/cols..." << endl;
{
uchar i = FIRST;
for ( ; i<=LAST; i++) {
if (i != y) avail &= conditional_assign_cell(x, i, v, ul);
if (i != x) avail &= conditional_assign_cell(i, y, v, ul);
}
}
// cerr << "updating blocks..." << endl;
{
const uchar bx = (x/3)*3;
const uchar by = (y/3)*3;
uchar j = FIRST;
for ( ; j<=THIRD; j++) {
uchar k = FIRST;
for ( ; k<=THIRD; k++) {
const uchar cx = bx+j;
const uchar cy = by+k;
if (cx != x && cy != y)
avail &= conditional_assign_cell(cx, cy, v, ul);
}
}
}
return avail;
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/**
Irreversible modification of the board.
Used for loading the initial board.
\return true if this cell assignment was accepted.
*/
bool
board::commit(const uchar x, const uchar y, const uchar v) {
SUDOKU_ASSERT(x < 9);
SUDOKU_ASSERT(y < 9);
SUDOKU_ASSERT(v < 9);
cell[x][y].top().assign(v);
// tighten constraints on row, col, blocks
bool avail = true;
// cerr << "updating rows/cols..." << endl;
{
size_t i = FIRST;
for ( ; i<=LAST; i++) {
if (i != y) {
avail &= cell[x][i].top().set(v);
if (!avail)
cerr << "reject by " << size_t(x)
<< ',' << i << endl;
}
if (i != x) {
avail &= cell[i][y].top().set(v);
if (!avail)
cerr << "reject by " << i << ','
<< size_t(y) << endl;
}
}
}
// cerr << "updating blocks..." << endl;
{
const uchar bx = (x/3)*3;
const uchar by = (y/3)*3;
uchar j = FIRST;
for ( ; j<=THIRD; j++) {
uchar k = FIRST;
for ( ; k<=THIRD; k++) {
const size_t cx = bx+j;
const size_t cy = by+k;
if (cx != x && cy != y) {
avail &= cell[cx][cy].top().set(v);
if (!avail)
cerr << "reject by " <<
cx << ',' << cy << endl;
}
}
}
}
return avail;
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/**
Undo of assign.
*/
void
board::unassign(const uchar x, const uchar y) {
SUDOKU_ASSERT(x < 9);
SUDOKU_ASSERT(y < 9);
cell_type& c(cell[x][y]);
SUDOKU_ASSERT(!c.empty());
c.pop();
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void
board::solve(list<solution>& sols) const {
board copy(*this);
copy.__solve(sols);
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/**
Recursive brute-force solver.
\pre some positions have already been assigned legally.
(Previous moves have all been accepted.)
*/
void
board::__solve(list<solution>& sols) {
// to minimize recursion breadth, we find some pivot cell
// with the tightest constraints (fewest possible values).
// later optimization: memoize priority list to minimize re-evaluation
pivot_finder pf; // visitor functor
accept(pf);
#if STEP_SOLVE
{
char c;
dump_state(cerr << "Examining: " << endl);
std::cin >> c;
}
#endif
if (pf.valid()) {
#if DEBUG_SOLVE
cerr << "Cell [" << pf.best_x << "][" << pf.best_y << "] has " <<
size_t(min_avail) << " choices." << endl;
#endif
// cell[best_x][best_y] has the fewest number of available values
const avail_set& pivot(cell[pf.best_x][pf.best_y].top());
// extract list of possible values and recursively try one-by-one
ushort mask = pivot.get_mask();
SUDOKU_ASSERT(mask);
uchar val = FIRST;
for ( ; mask; mask >>= 1, ++val) {
if (mask & 0x1) {
const move m(*this, pf.best_x, pf.best_y, val);
if (m.accepted())
__solve(sols); // recursion here
// else just undo it upon move destruction
}
}
} else {
// this board position is accepted!
sols.push_back(solution());
new (&sols.back()) solution(*this); // in-place construction!
// we save a copy away in the solution set
#if REVEAL_SOLUTION
sols.back().dump(cerr << "SOLUTION " << sols.size() << ":" << endl);
#endif
}
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/**
\return true if there is an error.
*/
bool
board::load(istream& f) {
while (f.good()) {
ushort x, y, z;
f >> x >> y >> z;
if (!f.good())
break;
--x, --y, --z; // normalize to 0-8
if (x >=9 || y >= 9 || z >= 9) {
cerr << "ERROR: all input numbers must be 1-9." << endl;
return true;
}
if (f.good()) {
#if DEBUG_LOAD
cerr << "placing: [" << x << ',' << y << "]="
<< z << endl;
#endif
if (!commit(x,y,z)) {
cerr << "ERROR: [" << x << ',' << y << "]="
<< z << " was rejected!" << endl;
return true;
}
#if DEBUG_LOAD
dump_state(cerr) << endl;
#endif
}
}
return false;
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ostream&
board::dump(ostream& o) const {
value_dumper d(o);
accept(d);
return o;
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ostream&
board::dump_state(ostream& o) const {
state_dumper d(o);
accept(d);
return o;
}
//=============================================================================
// class board::undo_list method definitions
board::undo_list::~undo_list() {
size_t i = 0;
for ( ; i < count; i++) {
bd.unassign(cell[i].first, cell[i].second);
}
}
//=============================================================================
// class board::move method definitions
/**
Non-trivial constructor. :)
*/
board::move::move(board& b, const uchar _x, const uchar _y, const uchar _v) :
ul(b), x(_x), y(_y), val(_v), accept(b.assign(x, y, val, ul)) {
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/**
The undo work is done by ~undo_list().
*/
board::move::~move() {
}
//=============================================================================
} // end namespace sudoku
| 23.454012
| 79
| 0.48761
|
broken-wheel
|
03579941da381427fecd548493e09e3e3a4b4501
| 2,613
|
cpp
|
C++
|
editor.cpp
|
erikbryant/mines
|
bd27ca7775581dab769a27f90dd88d965392886e
|
[
"MIT"
] | null | null | null |
editor.cpp
|
erikbryant/mines
|
bd27ca7775581dab769a27f90dd88d965392886e
|
[
"MIT"
] | null | null | null |
editor.cpp
|
erikbryant/mines
|
bd27ca7775581dab769a27f90dd88d965392886e
|
[
"MIT"
] | null | null | null |
//
// Copyright Erik Bryant (erikbryantology@gmail.com)
// GPLv2 http://www.gnu.org/licenses/gpl-2.0.html
//
#include <iostream>
#include <stdio.h>
#include <unistd.h>
#include <termios.h>
#include <stdlib.h>
#include <string.h>
#include "board.hpp"
using namespace std;
//
// Copied from the web.
// Write your own!
//
char readkbd( void ) {
char ch;
struct termios oldt;
struct termios newt;
tcgetattr( STDIN_FILENO, &oldt );
newt = oldt;
newt.c_lflag &= ~(ICANON | ECHO);
tcsetattr( STDIN_FILENO, TCSANOW, &newt );
ch = getchar();
tcsetattr( STDIN_FILENO, TCSANOW, &oldt );
return ch;
}
int main( int argc, char **argv ) {
bool done = 0;
while ( !done ) {
Board b;
char boardName[255];
bool useColor = true;
bool gameOver = false;
system( "ls boards" );
cout << "Board name: ";
cin >> boardName;
b.readFile( boardName );
while ( !gameOver ) {
char op;
system( "clear" );
b.print( useColor );
cout << "Your move [<arrows> ";
for ( int i=1; i<=9; i++ ) {
cout << char(27) << "[" << 40 + i << "m";
cout << i;
cout << char(27) << "[0m";
}
cout << "0 c xdIiOo w q]";
op = readkbd();
if ( op == 27 ) {
op = readkbd();
if ( op == '[' ) {
op = readkbd();
switch ( op ) {
case 'A':
b.move( -1, 0 );
break;
case 'B':
b.move( 1, 0 );
break;
case 'C':
b.move( 0, 1 );
break;
case 'D':
b.move( 0, -1 );
break;
}
continue;
}
}
cout << endl;
switch ( op ) {
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
b.setCell( op - '0' );
break;
case ' ':
b.setCell( 0 );
break;
case 'c':
useColor = !useColor;
break;
case 'd':
break;
case 'I':
break;
case 'i':
break;
case 'O':
break;
case 'o':
break;
case 'x':
break;
case 'w':
char filename[255];
cout << endl;
cout << "Enter a file name: ";
cin >> filename;
b.writeFile( filename );
break;
case 'q':
gameOver = 1;
done = 1;
break;
}
}
}
return 0;
}
| 19.355556
| 52
| 0.420972
|
erikbryant
|
0357dad3c38b2e3d4b4bd5aed5332716affbbe0b
| 1,356
|
cpp
|
C++
|
POJ/3304/code.cpp
|
sjj118/OI-Code
|
964ea6e799d14010f305c7e4aee269d860a781f7
|
[
"MIT"
] | null | null | null |
POJ/3304/code.cpp
|
sjj118/OI-Code
|
964ea6e799d14010f305c7e4aee269d860a781f7
|
[
"MIT"
] | null | null | null |
POJ/3304/code.cpp
|
sjj118/OI-Code
|
964ea6e799d14010f305c7e4aee269d860a781f7
|
[
"MIT"
] | null | null | null |
#include<iostream>
#include<cstdio>
#include<cmath>
#define maxn 110
#define eps 1e-8
#define abs(x) ((x)<0?(-(x)):(x))
#define sqr(x) ((x)*(x))
using namespace std;
int n;
struct Point{
double x,y;
Point(double _x=0,double _y=0){x=_x;y=_y;}
}a[maxn],b[maxn];
Point operator-(Point a,Point b){return Point(a.x-b.x,a.y-b.y);}
Point operator+(Point a,Point b){return Point(a.x+b.x,a.y+b.y);}
double operator*(Point a,Point b){return a.x*b.x+a.y*b.y;}
double operator^(Point a,Point b){return a.x*b.y-a.y*b.x;}
int dblcmp(double x){
if(abs(x)<eps)return 0;
return x>0?1:-1;
}
bool hasInsect(Point a1,Point a2,Point b1,Point b2){
return dblcmp((b1-a1)^(a2-a1))*dblcmp((a2-a1)^(b2-a1))>=0;
}
bool check(Point a1,Point a2){
for(int i=1;i<=n;++i)if(!hasInsect(a1,a2,a[i],b[i]))return 0;
return 1;
}
double dis(Point a,Point b){return sqrt(sqr(a.x-b.x)+sqr(a.y-b.y));}
int main(){
int T;scanf("%d",&T);
while(T--){
scanf("%d",&n);
for(int i=1;i<=n;++i)scanf("%lf%lf%lf%lf",&a[i].x,&a[i].y,&b[i].x,&b[i].y);
bool ans=0;
for(int i=1;i<=n;++i)for(int j=1;j<=n;++j){
if(dis(a[i],a[j])>=eps)ans|=check(a[i],a[j]);
if(dis(a[i],b[j])>=eps)ans|=check(a[i],b[j]);
if(dis(b[i],a[j])>=eps)ans|=check(b[i],a[j]);
if(dis(b[i],b[j])>=eps)ans|=check(b[i],b[j]);
if(ans)break;
}
if(ans)printf("Yes!\n");else printf("No!\n");
}
return 0;
}
| 27.12
| 77
| 0.594395
|
sjj118
|
0359da506f3ffaf34921342d9c06ef6fe0c598d0
| 14,127
|
cpp
|
C++
|
llvm/tools/clang/test/CM_diagnostics/member_functions/select.cpp
|
dmitryryintel/cm-compiler
|
1ef7651dc1c33d3e4853f8779d6a720e45e20e19
|
[
"Intel",
"MIT"
] | 115
|
2018-02-01T18:56:44.000Z
|
2022-03-21T13:23:00.000Z
|
llvm/tools/clang/test/CM_diagnostics/member_functions/select.cpp
|
dmitryryintel/cm-compiler
|
1ef7651dc1c33d3e4853f8779d6a720e45e20e19
|
[
"Intel",
"MIT"
] | 27
|
2018-09-17T17:49:49.000Z
|
2021-11-03T04:31:51.000Z
|
llvm/tools/clang/test/CM_diagnostics/member_functions/select.cpp
|
dmitryryintel/cm-compiler
|
1ef7651dc1c33d3e4853f8779d6a720e45e20e19
|
[
"Intel",
"MIT"
] | 55
|
2018-02-01T07:11:49.000Z
|
2022-03-04T01:20:23.000Z
|
// RUN: %cmc -ferror-limit=99 %w 2>&1 | FileCheck %w
#include <cm/cm.h>
vector<int,16> v1;
vector<short,15> v2;
matrix<int,16,4> m1;
struct S1 {
int a;
} s1;
struct S2 {
int select;
} s2;
int i, j;
const int two = 2;
const int minus_two = -2;
_GENX_MAIN_
void test() {
vector_ref<int,8> r1 = v1.select; // expected '<'
vector_ref<int,8> r2 = v1.select<; // expected expression
vector_ref<int,8> r3 = v1.select<>(); // expected expression
vector_ref<int,8> r4 = v1.select<8; // expected '>'
vector_ref<int,8> r5 = v1.select<8,; // expected expression
vector_ref<int,8> r6 = v1.select<8,2; // expected '>'
vector_ref<int,8> r7 = v1.select<8,2>; // expected '('
vector_ref<int,8> r8 = v1.select<8,2>(; // expected ')'
vector_ref<int,8> r9 = v1.select<8,2>(); // OK
vector_ref<int,8> r10 = v1.select<8>(); // too few constant args
vector_ref<int,8> r11 = v1.select<8,1,2,1>(); // too many constant args
vector_ref<int,8> r12 = v1.select<4+i,2>(); // size not constant int
vector_ref<int,8> r13 = v1.select<4,j>(); // stride not constant int
vector_ref<int,2> r14 = v1.select<two,2>(); // OK
vector_ref<int,4> r15 = v1.select<4,two>(); // OK
vector_ref<int,8> r16 = v1.select<0,2>(); // size must be > 0
vector_ref<int,8> r17 = v1.select<4,0>(); // stride must be > 0
vector_ref<int,8> r18 = v1.select<minus_two,2>(); // size must be > 0
vector_ref<int,8> r19 = v1.select<4,minus_two>(); // stride must be > 0
vector_ref<int,8> r20 = v1.select<8,2>(1); // OK
vector_ref<int,8> r21 = v1.select<8,2>(,0); // expected expression
vector_ref<int,8> r22 = v1.select<8,2>(1,2); // too many offsets
vector_ref<int,4> r23 = v1.select<4,2>(2,3,1,2); // too many offsets
vector_ref<int,1> r24 = v1.select<1,2>(); // if size is 1 then stride must be 1
vector_ref<int,8> r25 = v1.select<8,1>(minus_two); // negative offset
vector_ref<int,17> r26 = v1.select<17,1>(); // size too large
vector_ref<int,8> r27 = v1.select<8,3>(); // stride causes out of bounds
vector_ref<int,8> r28 = v1.select<8,2>(2); // offset causes out of bounds
vector_ref<int,8> r29 = v1.select<8,1>(14+two); // offset out of bounds
matrix_ref<int,8,3> r41 = m1.select; // expected '<'
matrix_ref<int,8,3> r42 = m1.select<; // expected expression
matrix_ref<int,8,3> r43 = m1.select<>(); // expected expression
matrix_ref<int,8,3> r44 = m1.select<8; // expected '>'
matrix_ref<int,8,3> r45 = m1.select<8,; // expected expression
matrix_ref<int,8,3> r46 = m1.select<8,2; // expected '>'
matrix_ref<int,8,3> r47 = m1.select<8,2,3; // expected '>'
matrix_ref<int,8,3> r48 = m1.select<8,2,3,1; // expected '>'
matrix_ref<int,8,3> r49 = m1.select<8,2,3,1>; // expected '('
matrix_ref<int,8,3> r50 = m1.select<8,2,3,1>(; // expected ')'
matrix_ref<int,8,3> r51 = m1.select<8>(); // too few constant args
matrix_ref<int,8,3> r52 = m1.select<8,2>(); // too few constant args
matrix_ref<int,8,3> r53 = m1.select<8,2,3>(); // too few constant args
matrix_ref<int,8,3> r54 = m1.select<8,1,3,1,2,1>(); // too many constant args
matrix_ref<int,8,3> r55 = m1.select<4+i,2,3,1>(); // v_size not constant int
matrix_ref<int,8,3> r56 = m1.select<4,j>(); // v_stride not constant int
matrix_ref<int,8,3> r57 = m1.select<two,2,3,1>(); // OK
matrix_ref<int,8,3> r58 = m1.select<8,two,3,1>(); // OK
matrix_ref<int,8,3> r59 = m1.select<8,2,two+1,1>(); // OK
matrix_ref<int,8,3> r60 = m1.select<8,1,3,two-1>(); // OK
matrix_ref<int,8,2> r61 = m1.select<0,2,3,1>(); // v_size must be > 0
matrix_ref<int,8,3> r62 = m1.select<4,0,3,1>(); // v_stride must be > 0
matrix_ref<int,8,2> r63 = m1.select<8,2,0,1>(); // h_size must be > 0
matrix_ref<int,8,3> r64 = m1.select<4,2,3,0>(); // h_stride must be > 0
matrix_ref<int,8,3> r65 = m1.select<minus_two,2,3,1>(); // v_size must be > 0
matrix_ref<int,8,3> r66 = m1.select<4,minus_two,3,1>(); // v_stride must be > 0
matrix_ref<int,8,3> r67 = m1.select<8,2,minus_two,1>(); // h_size must be > 0
matrix_ref<int,8,3> r68 = m1.select<8,2,3,minus_two>(); // h_stride must be > 0
matrix_ref<int,8,3> r69 = m1.select<8,2,3,1>(1); // OK
matrix_ref<int,8,3> r70 = m1.select<8,2,3,1>(,0); // expected expression
matrix_ref<int,8,3> r71 = m1.select<8,1,3,1>(3,1); // OK
matrix_ref<int,4,3> r72 = m1.select<4,3,3,1>(2,3,1,2); // too many offsets
matrix_ref<int,1,1> r73 = m1.select<1,2,3,1>(); // if v_size is 1 then v_stride must be 1
matrix_ref<int,1,1> r74 = m1.select<1,1,1,3>(); // if h_size is 1 then h_stride must be 1
matrix_ref<int,8,3> r75 = m1.select<8,1,3,1>(minus_two); // negative row offset
matrix_ref<int,8,3> r77 = m1.select<8,1,3,1>(0,1+minus_two); // negative column offset
matrix_ref<int,17,3> r78 = m1.select<17,1,3,1>(); // row size too large
matrix_ref<int,8,5> r79 = m1.select<8,1,5,1>(); // column size too large
matrix_ref<int,8,3> r80 = m1.select<8,3,3,1>(); // v_stride causes out of bounds
matrix_ref<int,8,3> r81 = m1.select<8,1,3,3>(); // h_stride causes out of bounds
matrix_ref<int,8,3> r82 = m1.select<8,2,3,1>(2); // row offset causes out of bounds
matrix_ref<int,8,3> r83 = m1.select<8,2,3,3>(0,2); // column offset causes out of bounds
matrix_ref<int,8,3> r84 = m1.select<8,1,3,1>(15+two,0); // row offset out of bounds
matrix_ref<int,8,3> r85 = m1.select<8,1,3,1>(0,3+two); // column offset out of bounds
int r101 = s1.select; // no member select in s1
int r102 = s1.select(); // no member select in s1
int r103 = s1.template select; // select not a template
int r104 = s2.select; // OK
int r105 = s2.select<4; // OK
int r106 = s2.select(); // select not a function
int r107 = s2.template select(); // select not a template
v1.select<8,2>(); // expression result unused
m1.select<4,2,2,1>(); // expression result unused,
v2.select<4,1>() = 9; // OK
m1.select<3,2,2,1>() = 1; // OK
}
// CHECK: select.cpp(20,35): error: expected '<'
// CHECK: select.cpp(21,36): error: expected expression
// CHECK: select.cpp(22,36): error: expected expression
// CHECK: select.cpp(23,37): error: expected '>'
// CHECK: select.cpp(24,38): error: expected expression
// CHECK: select.cpp(25,39): error: expected '>'
// CHECK: select.cpp(26,40): error: expected '('
// CHECK: select.cpp(27,41): error: expected expression
// CHECK: select.cpp(29,37): error: too few values: vector select expects 2 integer constant values
// CHECK: select.cpp(30,41): error: too many values: vector select expects 2 integer constant values
// CHECK: select.cpp(31,39): error: select size value must be a constant integer expression
// CHECK: select.cpp(32,39): error: select stride value must be a constant integer expression
// CHECK: select.cpp(35,37): error: select size must be greater than zero
// CHECK: select.cpp(36,39): error: select stride must be greater than zero
// CHECK: select.cpp(37,37): error: select size must be greater than zero
// CHECK: select.cpp(38,39): error: select stride must be greater than zero
// CHECK: select.cpp(40,42): error: expected expression
// CHECK: select.cpp(41,44): error: too many offsets: vector select expects 1 integer offsets
// CHECK: select.cpp(42,44): error: too many offsets: vector select expects 1 integer offsets
// CHECK: select.cpp(43,39): error: when select size is 1, the stride must also be 1
// CHECK: select.cpp(44,42): error: select offset cannot be negative (-2)
// CHECK: select.cpp(45,31): warning: vector select out of bounds [-Wcm-bounds-check]
// CHECK: select.cpp(46,30): warning: vector select out of bounds [-Wcm-bounds-check]
// CHECK: select.cpp(47,30): warning: vector select out of bounds [-Wcm-bounds-check]
// CHECK: select.cpp(48,30): warning: select offset out of bounds (offset 16, bounds 0..15) [-Wcm-bounds-check]
// CHECK: select.cpp(48,30): warning: vector select out of bounds [-Wcm-bounds-check]
// CHECK: select.cpp(50,38): error: expected '<'
// CHECK: select.cpp(51,39): error: expected expression
// CHECK: select.cpp(52,39): error: expected expression
// CHECK: select.cpp(53,40): error: expected '>'
// CHECK: select.cpp(54,41): error: expected expression
// CHECK: select.cpp(55,42): error: expected '>'
// CHECK: select.cpp(56,44): error: expected '>'
// CHECK: select.cpp(57,46): error: expected '>'
// CHECK: select.cpp(58,47): error: expected '('
// CHECK: select.cpp(59,48): error: expected expression
// CHECK: select.cpp(60,39): error: too few values: matrix select expects 4 integer constant values
// CHECK: select.cpp(61,41): error: too few values: matrix select expects 4 integer constant values
// CHECK: select.cpp(62,43): error: too few values: matrix select expects 4 integer constant values
// CHECK: select.cpp(63,47): error: too many values: matrix select expects 4 integer constant values
// CHECK: select.cpp(64,41): error: select size value must be a constant integer expression
// CHECK: select.cpp(65,41): error: too few values: matrix select expects 4 integer constant values
// CHECK: select.cpp(66,23): error: cannot initialize a variable of type 'matrix_ref<int,8,3>' with an lvalue of type 'matrix_ref<int,2,3>'
// CHECK: select.cpp(70,39): error: select v_size must be greater than zero
// CHECK: select.cpp(71,41): error: select v_stride must be greater than zero
// CHECK: select.cpp(72,43): error: select h_size must be greater than zero
// CHECK: select.cpp(73,45): error: select h_stride must be greater than zero
// CHECK: select.cpp(74,39): error: select v_size must be greater than zero
// CHECK: select.cpp(75,41): error: select v_stride must be greater than zero
// CHECK: select.cpp(76,43): error: select h_size must be greater than zero
// CHECK: select.cpp(77,45): error: select h_stride must be greater than zero
// CHECK: select.cpp(79,48): error: expected expression
// CHECK: select.cpp(81,52): error: too many offsets: matrix select expects 2 integer offsets
// CHECK: select.cpp(82,41): error: when select v_size is 1, the v_stride must also be 1
// CHECK: select.cpp(83,45): error: when select h_size is 1, the h_stride must also be 1
// CHECK: select.cpp(84,48): error: select row offset cannot be negative (-2)
// CHECK: select.cpp(85,51): error: select column offset cannot be negative (-1)
// CHECK: select.cpp(86,33): warning: matrix select out of bounds in rows [-Wcm-bounds-check]
// CHECK: select.cpp(87,32): warning: matrix select out of bounds in columns [-Wcm-bounds-check]
// CHECK: select.cpp(88,32): warning: matrix select out of bounds in rows [-Wcm-bounds-check]
// CHECK: select.cpp(89,32): warning: matrix select out of bounds in columns [-Wcm-bounds-check]
// CHECK: select.cpp(90,32): warning: matrix select out of bounds in rows [-Wcm-bounds-check]
// CHECK: select.cpp(91,32): warning: matrix select out of bounds in columns [-Wcm-bounds-check]
// CHECK: select.cpp(92,32): warning: select row offset out of bounds (offset 17, bounds 0..15) [-Wcm-bounds-check]
// CHECK: select.cpp(93,32): warning: select column offset out of bounds (offset 5, bounds 0..3) [-Wcm-bounds-check]
// CHECK: select.cpp(95,17): error: no member named 'select' in 'S1'
// CHECK: select.cpp(96,17): error: no member named 'select' in 'S1'
// CHECK: select.cpp(97,26): error: 'select' following the 'template' keyword does not refer to a template
// CHECK: select.cpp(100,23): error: called object type 'int' is not a function or function pointer
// CHECK: select.cpp(101,26): error: 'select' following the 'template' keyword does not refer to a template
// CHECK: select.cpp(103,3): warning: expression result unused [-Wunused-value]
// CHECK: select.cpp(104,3): warning: expression result unused [-Wunused-value]
// CHECK: 17 warnings and 57 errors generated.
| 78.049724
| 140
| 0.560487
|
dmitryryintel
|
035cb2cbbc514dfc7f704158894b86c17b2d7897
| 5,094
|
hpp
|
C++
|
include/exchcxx/util/param_macros.hpp
|
ValeevGroup/ExchCXX
|
7a8f7ac8d2e9384706975b8fa02d23770c20aa44
|
[
"BSD-3-Clause-LBNL"
] | 16
|
2020-08-26T00:40:50.000Z
|
2022-03-05T01:16:43.000Z
|
include/exchcxx/util/param_macros.hpp
|
ValeevGroup/ExchCXX
|
7a8f7ac8d2e9384706975b8fa02d23770c20aa44
|
[
"BSD-3-Clause-LBNL"
] | 6
|
2020-10-13T22:14:57.000Z
|
2021-09-15T19:59:19.000Z
|
include/exchcxx/util/param_macros.hpp
|
ValeevGroup/ExchCXX
|
7a8f7ac8d2e9384706975b8fa02d23770c20aa44
|
[
"BSD-3-Clause-LBNL"
] | 5
|
2019-05-09T21:03:17.000Z
|
2020-10-09T16:55:03.000Z
|
#pragma once
#ifdef EXCHCXX_HAS_CONFIG_H
#include <exchcxx/exchcxx_config.hpp>
#endif
namespace ExchCXX {
using host_buffer_type = double*;
using const_host_buffer_type = const double*;
#ifdef EXCHCXX_ENABLE_CUDA
using device_buffer_type = double*;
using const_device_buffer_type = const double*;
#endif
}
#define NOTYPE
// LDA Parameters
#define TYPED_LDA_IPARAMS(INTT,BUFFER) INTT N, BUFFER rho
#define TYPED_LDA_OPARAMS_EXC(BUFFER) BUFFER eps
#define TYPED_LDA_OPARAMS_VXC(BUFFER) BUFFER vxc
#define TYPED_LDA_OPARAMS_FXC(BUFFER) BUFFER fxc
#define TYPED_LDA_OPARAMS_KXC(BUFFER) BUFFER kxc
#define TYPED_LDA_OPARAMS_EXC_VXC(BUFFER) \
TYPED_LDA_OPARAMS_EXC(BUFFER), TYPED_LDA_OPARAMS_VXC(BUFFER)
#define LDA_IPARAMS TYPED_LDA_IPARAMS(int,const_host_buffer_type)
#define LDA_OPARAMS_EXC TYPED_LDA_OPARAMS_EXC(host_buffer_type)
#define LDA_OPARAMS_VXC TYPED_LDA_OPARAMS_VXC(host_buffer_type)
#define LDA_OPARAMS_FXC TYPED_LDA_OPARAMS_FXC(host_buffer_type)
#define LDA_OPARAMS_KXC TYPED_LDA_OPARAMS_KXC(host_buffer_type)
#define LDA_OPARAMS_EXC_VXC TYPED_LDA_OPARAMS_EXC_VXC(host_buffer_type)
#define DEV_LDA_IPARAMS TYPED_LDA_IPARAMS(int,const_device_buffer_type)
#define DEV_LDA_OPARAMS_EXC TYPED_LDA_OPARAMS_EXC(device_buffer_type)
#define DEV_LDA_OPARAMS_VXC TYPED_LDA_OPARAMS_VXC(device_buffer_type)
#define DEV_LDA_OPARAMS_FXC TYPED_LDA_OPARAMS_FXC(device_buffer_type)
#define DEV_LDA_OPARAMS_KXC TYPED_LDA_OPARAMS_KXC(device_buffer_type)
#define DEV_LDA_OPARAMS_EXC_VXC TYPED_LDA_OPARAMS_EXC_VXC(device_buffer_type)
#define LDA_IPARAMS_NOTYPE TYPED_LDA_IPARAMS(NOTYPE,NOTYPE)
#define LDA_OPARAMS_EXC_NOTYPE TYPED_LDA_OPARAMS_EXC(NOTYPE)
#define LDA_OPARAMS_VXC_NOTYPE TYPED_LDA_OPARAMS_VXC(NOTYPE)
#define LDA_OPARAMS_FXC_NOTYPE TYPED_LDA_OPARAMS_FXC(NOTYPE)
#define LDA_OPARAMS_KXC_NOTYPE TYPED_LDA_OPARAMS_KXC(NOTYPE)
#define LDA_OPARAMS_EXC_VXC_NOTYPE TYPED_LDA_OPARAMS_EXC_VXC(NOTYPE)
// GGA Parameters
#define TYPED_GGA_IPARAMS(INTT,BUFFER) INTT N, BUFFER rho, BUFFER sigma
#define TYPED_GGA_OPARAMS_EXC(BUFFER) BUFFER eps
#define TYPED_GGA_OPARAMS_VXC(BUFFER) BUFFER vrho, BUFFER vsigma
#define TYPED_GGA_OPARAMS_FXC(BUFFER) \
BUFFER v2rho2, BUFFER v2rhosigma, BUFFER v2sigma2
#define TYPED_GGA_OPARAMS_KXC(BUFFER) \
BUFFER v3rho3, BUFFER v3rho2sigma, BUFFER v3rhosigma2, BUFFER v3sigma3
#define TYPED_GGA_OPARAMS_EXC_VXC(BUFFER) \
TYPED_GGA_OPARAMS_EXC(BUFFER), TYPED_GGA_OPARAMS_VXC(BUFFER)
#define GGA_IPARAMS TYPED_GGA_IPARAMS(int,const_host_buffer_type)
#define GGA_OPARAMS_EXC TYPED_GGA_OPARAMS_EXC(host_buffer_type)
#define GGA_OPARAMS_VXC TYPED_GGA_OPARAMS_VXC(host_buffer_type)
#define GGA_OPARAMS_FXC TYPED_GGA_OPARAMS_FXC(host_buffer_type)
#define GGA_OPARAMS_KXC TYPED_GGA_OPARAMS_KXC(host_buffer_type)
#define GGA_OPARAMS_EXC_VXC TYPED_GGA_OPARAMS_EXC_VXC(host_buffer_type)
#define DEV_GGA_IPARAMS TYPED_GGA_IPARAMS(int,const_device_buffer_type)
#define DEV_GGA_OPARAMS_EXC TYPED_GGA_OPARAMS_EXC(device_buffer_type)
#define DEV_GGA_OPARAMS_VXC TYPED_GGA_OPARAMS_VXC(device_buffer_type)
#define DEV_GGA_OPARAMS_FXC TYPED_GGA_OPARAMS_FXC(device_buffer_type)
#define DEV_GGA_OPARAMS_KXC TYPED_GGA_OPARAMS_KXC(device_buffer_type)
#define DEV_GGA_OPARAMS_EXC_VXC TYPED_GGA_OPARAMS_EXC_VXC(device_buffer_type)
#define GGA_IPARAMS_NOTYPE TYPED_GGA_IPARAMS(NOTYPE,NOTYPE)
#define GGA_OPARAMS_EXC_NOTYPE TYPED_GGA_OPARAMS_EXC(NOTYPE)
#define GGA_OPARAMS_VXC_NOTYPE TYPED_GGA_OPARAMS_VXC(NOTYPE)
#define GGA_OPARAMS_FXC_NOTYPE TYPED_GGA_OPARAMS_FXC(NOTYPE)
#define GGA_OPARAMS_KXC_NOTYPE TYPED_GGA_OPARAMS_KXC(NOTYPE)
#define GGA_OPARAMS_EXC_VXC_NOTYPE TYPED_GGA_OPARAMS_EXC_VXC(NOTYPE)
// MGGA Parameters
#define TYPED_MGGA_IPARAMS(INTT,BUFFER) \
INTT N, BUFFER rho, BUFFER sigma, BUFFER lapl, BUFFER tau
#define TYPED_MGGA_OPARAMS_EXC(BUFFER) BUFFER eps
#define TYPED_MGGA_OPARAMS_VXC(BUFFER) \
BUFFER vrho, BUFFER vsigma, BUFFER vlapl, BUFFER vtau
#define TYPED_MGGA_OPARAMS_EXC_VXC(BUFFER) \
TYPED_MGGA_OPARAMS_EXC(BUFFER), TYPED_MGGA_OPARAMS_VXC(BUFFER)
#define MGGA_IPARAMS TYPED_MGGA_IPARAMS(int,const_host_buffer_type)
#define MGGA_OPARAMS_EXC TYPED_MGGA_OPARAMS_EXC(host_buffer_type)
#define MGGA_OPARAMS_VXC TYPED_MGGA_OPARAMS_VXC(host_buffer_type)
#define MGGA_OPARAMS_EXC_VXC TYPED_MGGA_OPARAMS_EXC_VXC(host_buffer_type)
#define DEV_MGGA_IPARAMS TYPED_MGGA_IPARAMS(int,const_device_buffer_type)
#define DEV_MGGA_OPARAMS_EXC TYPED_MGGA_OPARAMS_EXC(device_buffer_type)
#define DEV_MGGA_OPARAMS_VXC TYPED_MGGA_OPARAMS_VXC(device_buffer_type)
#define DEV_MGGA_OPARAMS_EXC_VXC TYPED_MGGA_OPARAMS_EXC_VXC(device_buffer_type)
#define MGGA_IPARAMS_NOTYPE TYPED_MGGA_IPARAMS(NOTYPE,NOTYPE)
#define MGGA_OPARAMS_EXC_NOTYPE TYPED_MGGA_OPARAMS_EXC(NOTYPE)
#define MGGA_OPARAMS_VXC_NOTYPE TYPED_MGGA_OPARAMS_VXC(NOTYPE)
#define MGGA_OPARAMS_EXC_VXC_NOTYPE TYPED_MGGA_OPARAMS_EXC_VXC(NOTYPE)
| 44.295652
| 81
| 0.832744
|
ValeevGroup
|
035d29f268c6ad436cca792c7ab87ef8c5cd9e1c
| 4,506
|
hpp
|
C++
|
include/HMUI/HierarchyManager.hpp
|
darknight1050/BeatSaber-Quest-Codegen
|
a6eeecc3f0e8f6079630f9a9a72b3121ac7b2032
|
[
"Unlicense"
] | null | null | null |
include/HMUI/HierarchyManager.hpp
|
darknight1050/BeatSaber-Quest-Codegen
|
a6eeecc3f0e8f6079630f9a9a72b3121ac7b2032
|
[
"Unlicense"
] | null | null | null |
include/HMUI/HierarchyManager.hpp
|
darknight1050/BeatSaber-Quest-Codegen
|
a6eeecc3f0e8f6079630f9a9a72b3121ac7b2032
|
[
"Unlicense"
] | null | null | null |
// Autogenerated from CppHeaderCreator
// Created by Sc2ad
// =========================================================================
#pragma once
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: UnityEngine.MonoBehaviour
#include "UnityEngine/MonoBehaviour.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils-methods.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils-properties.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils-fields.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Begin forward declares
// Forward declaring namespace: HMUI
namespace HMUI {
// Forward declaring type: ScreenSystem
class ScreenSystem;
// Forward declaring type: FlowCoordinator
class FlowCoordinator;
}
// Forward declaring namespace: GlobalNamespace
namespace GlobalNamespace {
// Forward declaring type: GameScenesManager
class GameScenesManager;
// Forward declaring type: ScenesTransitionSetupDataSO
class ScenesTransitionSetupDataSO;
}
// Forward declaring namespace: Zenject
namespace Zenject {
// Forward declaring type: DiContainer
class DiContainer;
}
// Completed forward declares
// Type namespace: HMUI
namespace HMUI {
// Size: 0x30
#pragma pack(push, 1)
// Autogenerated type: HMUI.HierarchyManager
class HierarchyManager : public UnityEngine::MonoBehaviour {
public:
// private HMUI.ScreenSystem _screenSystem
// Size: 0x8
// Offset: 0x18
HMUI::ScreenSystem* screenSystem;
// Field size check
static_assert(sizeof(HMUI::ScreenSystem*) == 0x8);
// [InjectAttribute] Offset: 0xDF6A6C
// private GameScenesManager _gameScenesManager
// Size: 0x8
// Offset: 0x20
GlobalNamespace::GameScenesManager* gameScenesManager;
// Field size check
static_assert(sizeof(GlobalNamespace::GameScenesManager*) == 0x8);
// private HMUI.FlowCoordinator _rootFlowCoordinator
// Size: 0x8
// Offset: 0x28
HMUI::FlowCoordinator* rootFlowCoordinator;
// Field size check
static_assert(sizeof(HMUI::FlowCoordinator*) == 0x8);
// Creating value type constructor for type: HierarchyManager
HierarchyManager(HMUI::ScreenSystem* screenSystem_ = {}, GlobalNamespace::GameScenesManager* gameScenesManager_ = {}, HMUI::FlowCoordinator* rootFlowCoordinator_ = {}) noexcept : screenSystem{screenSystem_}, gameScenesManager{gameScenesManager_}, rootFlowCoordinator{rootFlowCoordinator_} {}
// Deleting conversion operator: operator System::IntPtr
constexpr operator System::IntPtr() const noexcept = delete;
// protected System.Void Start()
// Offset: 0x12FDDB4
void Start();
// protected System.Void OnDestroy()
// Offset: 0x12FDF70
void OnDestroy();
// private System.Void HandleSceneTransitionDidFinish(ScenesTransitionSetupDataSO scenesTransitionSetupData, Zenject.DiContainer container)
// Offset: 0x12FDEB4
void HandleSceneTransitionDidFinish(GlobalNamespace::ScenesTransitionSetupDataSO* scenesTransitionSetupData, Zenject::DiContainer* container);
// private System.Void HandleBeforeDismissingScenes()
// Offset: 0x12FE048
void HandleBeforeDismissingScenes();
// public System.Void StartWithFlowCoordinator(HMUI.FlowCoordinator flowCoordinator)
// Offset: 0x12FE104
void StartWithFlowCoordinator(HMUI::FlowCoordinator* flowCoordinator);
// public System.Void .ctor()
// Offset: 0x12FE128
// Implemented from: UnityEngine.MonoBehaviour
// Base method: System.Void MonoBehaviour::.ctor()
// Base method: System.Void Behaviour::.ctor()
// Base method: System.Void Component::.ctor()
// Base method: System.Void Object::.ctor()
// Base method: System.Void Object::.ctor()
template<::il2cpp_utils::CreationType creationType = ::il2cpp_utils::CreationType::Temporary>
static HierarchyManager* New_ctor() {
static auto ___internal__logger = ::Logger::get().WithContext("HMUI::HierarchyManager::.ctor");
return THROW_UNLESS((::il2cpp_utils::New<HierarchyManager*, creationType>()));
}
}; // HMUI.HierarchyManager
#pragma pack(pop)
static check_size<sizeof(HierarchyManager), 40 + sizeof(HMUI::FlowCoordinator*)> __HMUI_HierarchyManagerSizeCheck;
static_assert(sizeof(HierarchyManager) == 0x30);
}
DEFINE_IL2CPP_ARG_TYPE(HMUI::HierarchyManager*, "HMUI", "HierarchyManager");
| 45.515152
| 296
| 0.723924
|
darknight1050
|
035f33ef7770e1a320dcc898718632cadb45c099
| 1,326
|
hpp
|
C++
|
datastructures/datastructures/is_iterator.hpp
|
mraasvel/data_structures_cpp
|
4324d103c46c6e29ee37a4c0e681f1468e90364f
|
[
"MIT"
] | null | null | null |
datastructures/datastructures/is_iterator.hpp
|
mraasvel/data_structures_cpp
|
4324d103c46c6e29ee37a4c0e681f1468e90364f
|
[
"MIT"
] | null | null | null |
datastructures/datastructures/is_iterator.hpp
|
mraasvel/data_structures_cpp
|
4324d103c46c6e29ee37a4c0e681f1468e90364f
|
[
"MIT"
] | null | null | null |
#pragma once
#include <type_traits>
#include <iterator>
namespace DS {
namespace Detail {
template <typename T>
struct MakeType {
using type = void;
};
template <typename Iterator>
struct _IsIterator {
using valid = char[1];
using invalid = char[2];
template <typename T>
static valid& test(
typename Detail::MakeType<typename T::difference_type>::type*,
typename Detail::MakeType<typename T::value_type>::type*,
typename Detail::MakeType<typename T::pointer>::type*,
typename Detail::MakeType<typename T::reference>::type*,
typename Detail::MakeType<typename T::iterator_category>::type*);
template <typename>
static invalid& test(...);
static constexpr bool value = sizeof(test<Iterator>(nullptr, nullptr, nullptr, nullptr, nullptr)) == sizeof(valid);
};
template <typename T>
struct _IsIterator<T*> {
static constexpr bool value = true;
};
}
/*
This is how STL checks it: only validates that the category is valid
*/
template<typename InputIterator>
using RequireInputIterator = typename std::enable_if<std::is_convertible<
typename std::iterator_traits<InputIterator>::iterator_category,
std::input_iterator_tag>::value>::type;
template <typename Iterator>
struct IsIterator : public Detail::_IsIterator<typename std::remove_cv<Iterator>::type> {};
}
| 24.555556
| 117
| 0.72549
|
mraasvel
|
0362b152aec9bc475555a3547584ff04528d7995
| 779
|
hpp
|
C++
|
include/eosio/float.hpp
|
swang-b1/abieos
|
52ea28c0c2d771d101a2fe0ae4d176bb35a2f0cb
|
[
"MIT"
] | 40
|
2018-07-19T02:40:21.000Z
|
2022-03-31T19:30:52.000Z
|
include/eosio/float.hpp
|
swang-b1/abieos
|
52ea28c0c2d771d101a2fe0ae4d176bb35a2f0cb
|
[
"MIT"
] | 36
|
2018-06-30T14:06:01.000Z
|
2022-01-22T05:21:33.000Z
|
include/eosio/float.hpp
|
swang-b1/abieos
|
52ea28c0c2d771d101a2fe0ae4d176bb35a2f0cb
|
[
"MIT"
] | 36
|
2018-07-19T02:40:22.000Z
|
2022-03-14T13:51:59.000Z
|
#pragma once
#ifdef __eosio_cdt__
namespace eosio {
using float32 = float;
using float64 = double;
using float128 = long double;
} // namespace eosio
#else
# include <eosio/fixed_bytes.hpp>
# include <limits>
namespace eosio {
using float32 = float;
using float64 = double;
using float128 = fixed_bytes<16>;
static_assert(sizeof(float32) == 4 && std::numeric_limits<float32>::is_iec559 &&
std::numeric_limits<float32>::digits == 24,
"Unexpected float representation");
static_assert(sizeof(float64) == 8 && std::numeric_limits<float64>::is_iec559 &&
std::numeric_limits<float64>::digits == 53,
"Unexpected double representation");
EOSIO_REFLECT(float128, value);
} // namespace eosio
#endif
| 21.638889
| 80
| 0.667522
|
swang-b1
|
24e9961a20b65ad7cfaf9c45bbeeb1af676b94dd
| 2,394
|
hh
|
C++
|
CosmicRayShieldGeom/inc/CRSScintillatorLayer.hh
|
bonventre/Offline
|
77db9d6368f27ab9401c690c2c2a4257ade6c231
|
[
"Apache-2.0"
] | 1
|
2021-05-25T19:10:10.000Z
|
2021-05-25T19:10:10.000Z
|
CosmicRayShieldGeom/inc/CRSScintillatorLayer.hh
|
bonventre/Offline
|
77db9d6368f27ab9401c690c2c2a4257ade6c231
|
[
"Apache-2.0"
] | 1
|
2019-11-22T14:45:51.000Z
|
2019-11-22T14:50:03.000Z
|
CosmicRayShieldGeom/inc/CRSScintillatorLayer.hh
|
bonventre/Offline
|
77db9d6368f27ab9401c690c2c2a4257ade6c231
|
[
"Apache-2.0"
] | 2
|
2019-10-14T17:46:58.000Z
|
2020-03-30T21:05:15.000Z
|
#ifndef CosmicRayShieldGeom_CRSScintillatorLayer_hh
#define CosmicRayShieldGeom_CRSScintillatorLayer_hh
//
// Representation of one Scintillator Layer in CosmicRayShield
//
// $Id: CRSScintillatorLayer.hh,v 1.10 2014/02/10 14:23:03 ehrlich Exp $
// $Author: ehrlich $
// $Date: 2014/02/10 14:23:03 $
//
// Original author KLG; somewhat based on Rob Kutschke's Layer
//
#include <vector>
#include "CosmicRayShieldGeom/inc/CRSScintillatorLayerId.hh"
#include "CosmicRayShieldGeom/inc/CRSScintillatorBar.hh"
#include "CLHEP/Vector/ThreeVector.h"
namespace mu2e
{
class CRSScintillatorLayer
{
friend class CRSScintillatorModule;
friend class CRSScintillatorShield;
friend class CosmicRayShieldMaker;
CRSScintillatorLayer();
public:
CRSScintillatorLayer(CRSScintillatorLayerId const & id);
// Accept the compiler generated destructor, copy constructor and assignment operators
CRSScintillatorLayerId const & id() const { return _id;}
int nBars() const { return _bars.size(); }
CRSScintillatorBar const & getBar( int n ) const
{
return *_bars.at(n);
}
CRSScintillatorBar const & getBar( const CRSScintillatorBarId& id ) const
{
return getBar(id.getBarNumber());
}
const std::vector<std::shared_ptr<CRSScintillatorBar> >& getBars() const { return _bars; }
const CLHEP::Hep3Vector &getPosition() const {return _position;}
const std::vector<double> &getHalfLengths() const {return _halfLengths;}
double getHalfThickness() const { return _halfLengths[_localToWorld[0]];}
double getHalfWidth() const { return _halfLengths[_localToWorld[1]];}
double getHalfLength() const { return _halfLengths[_localToWorld[2]];}
// Formatted string embedding the id of the layer.
std::string name( std::string const & base ) const;
private:
CRSScintillatorLayerId _id;
// Pointers to the bars in this layer.
// They refer to the same objects as the bars in CosmicRayShield (which holds all CRV bars)
std::vector<std::shared_ptr<CRSScintillatorBar> > _bars;
CLHEP::Hep3Vector _position;
std::vector<double> _halfLengths;
std::vector<int> _localToWorld; //0th entry: thickness
//1st entry: width
//2nd entry: length
};
}
#endif /* CosmicRayShieldGeom_CRSScintillatorLayer_hh */
| 29.555556
| 95
| 0.703425
|
bonventre
|
24ed1deb54775af6eaa3378f80fd930767955237
| 39,996
|
cpp
|
C++
|
Cpp/SDK/UISettingsWindow_functions.cpp
|
MrManiak/Squad-SDK
|
742feb5991ae43d6f0cedd2d6b32b949923ca4f9
|
[
"Apache-2.0"
] | 1
|
2020-08-15T08:31:55.000Z
|
2020-08-15T08:31:55.000Z
|
Cpp/SDK/UISettingsWindow_functions.cpp
|
MrManiak/Squad-SDK
|
742feb5991ae43d6f0cedd2d6b32b949923ca4f9
|
[
"Apache-2.0"
] | 2
|
2020-08-15T08:43:56.000Z
|
2021-01-15T05:04:48.000Z
|
Cpp/SDK/UISettingsWindow_functions.cpp
|
MrManiak/Squad-SDK
|
742feb5991ae43d6f0cedd2d6b32b949923ca4f9
|
[
"Apache-2.0"
] | 2
|
2020-08-10T12:05:42.000Z
|
2021-02-12T19:56:10.000Z
|
// Name: S, Version: b
#include "../SDK.h"
#ifdef _MSC_VER
#pragma pack(push, 0x01)
#endif
/*!!HELPER_DEF!!*/
/*!!DEFINE!!*/
namespace UFT
{
//---------------------------------------------------------------------------
// Functions
//---------------------------------------------------------------------------
// Function UISettingsWindow.UISettingsWindow_C.Get_ToggleStreamerMode_ToolTipWidget_1
// (Public, HasOutParms, BlueprintCallable, BlueprintEvent, BlueprintPure)
// Parameters:
// class UWidget* ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash)
class UWidget* UUISettingsWindow_C::Get_ToggleStreamerMode_ToolTipWidget_1()
{
static auto fn = UObject::FindObject<UFunction>("Function UISettingsWindow.UISettingsWindow_C.Get_ToggleStreamerMode_ToolTipWidget_1");
UUISettingsWindow_C_Get_ToggleStreamerMode_ToolTipWidget_1_Params params;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
return params.ReturnValue;
}
// Function UISettingsWindow.UISettingsWindow_C.Get_ToggleGameHelp_ToolTipWidget_1
// (Public, HasOutParms, BlueprintCallable, BlueprintEvent, BlueprintPure)
// Parameters:
// class UWidget* ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash)
class UWidget* UUISettingsWindow_C::Get_ToggleGameHelp_ToolTipWidget_1()
{
static auto fn = UObject::FindObject<UFunction>("Function UISettingsWindow.UISettingsWindow_C.Get_ToggleGameHelp_ToolTipWidget_1");
UUISettingsWindow_C_Get_ToggleGameHelp_ToolTipWidget_1_Params params;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
return params.ReturnValue;
}
// Function UISettingsWindow.UISettingsWindow_C.Get_ToggleRadialTips_ToolTipWidget_1
// (Public, HasOutParms, BlueprintCallable, BlueprintEvent, BlueprintPure)
// Parameters:
// class UWidget* ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash)
class UWidget* UUISettingsWindow_C::Get_ToggleRadialTips_ToolTipWidget_1()
{
static auto fn = UObject::FindObject<UFunction>("Function UISettingsWindow.UISettingsWindow_C.Get_ToggleRadialTips_ToolTipWidget_1");
UUISettingsWindow_C_Get_ToggleRadialTips_ToolTipWidget_1_Params params;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
return params.ReturnValue;
}
// Function UISettingsWindow.UISettingsWindow_C.Get_ToggleMenuTips_ToolTipWidget_1
// (Public, HasOutParms, BlueprintCallable, BlueprintEvent, BlueprintPure)
// Parameters:
// class UWidget* ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash)
class UWidget* UUISettingsWindow_C::Get_ToggleMenuTips_ToolTipWidget_1()
{
static auto fn = UObject::FindObject<UFunction>("Function UISettingsWindow.UISettingsWindow_C.Get_ToggleMenuTips_ToolTipWidget_1");
UUISettingsWindow_C_Get_ToggleMenuTips_ToolTipWidget_1_Params params;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
return params.ReturnValue;
}
// Function UISettingsWindow.UISettingsWindow_C.UpdateButtons
// (Public, BlueprintCallable, BlueprintEvent)
void UUISettingsWindow_C::UpdateButtons()
{
static auto fn = UObject::FindObject<UFunction>("Function UISettingsWindow.UISettingsWindow_C.UpdateButtons");
UUISettingsWindow_C_UpdateButtons_Params params;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function UISettingsWindow.UISettingsWindow_C.Construct
// (BlueprintCosmetic, Event, Public, BlueprintEvent)
void UUISettingsWindow_C::Construct()
{
static auto fn = UObject::FindObject<UFunction>("Function UISettingsWindow.UISettingsWindow_C.Construct");
UUISettingsWindow_C_Construct_Params params;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function UISettingsWindow.UISettingsWindow_C.APPLY
// (BlueprintCallable, BlueprintEvent)
void UUISettingsWindow_C::APPLY()
{
static auto fn = UObject::FindObject<UFunction>("Function UISettingsWindow.UISettingsWindow_C.APPLY");
UUISettingsWindow_C_APPLY_Params params;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function UISettingsWindow.UISettingsWindow_C.Revert
// (BlueprintCallable, BlueprintEvent)
void UUISettingsWindow_C::Revert()
{
static auto fn = UObject::FindObject<UFunction>("Function UISettingsWindow.UISettingsWindow_C.Revert");
UUISettingsWindow_C_Revert_Params params;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function UISettingsWindow.UISettingsWindow_C.RESTORE DEFAULTS
// (BlueprintCallable, BlueprintEvent)
void UUISettingsWindow_C::RESTORE_DEFAULTS()
{
static auto fn = UObject::FindObject<UFunction>("Function UISettingsWindow.UISettingsWindow_C.RESTORE DEFAULTS");
UUISettingsWindow_C_RESTORE_DEFAULTS_Params params;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function UISettingsWindow.UISettingsWindow_C.Show Debugs
// (BlueprintCallable, BlueprintEvent)
void UUISettingsWindow_C::Show_Debugs()
{
static auto fn = UObject::FindObject<UFunction>("Function UISettingsWindow.UISettingsWindow_C.Show Debugs");
UUISettingsWindow_C_Show_Debugs_Params params;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function UISettingsWindow.UISettingsWindow_C.BndEvt__ToggleCrouch_K2Node_ComponentBoundEvent_11_OnClicked__DelegateSignature
// (BlueprintEvent)
// Parameters:
// bool bSelected (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor)
// class USettingsItem_TickBox_C* Button (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash)
void UUISettingsWindow_C::BndEvt__ToggleCrouch_K2Node_ComponentBoundEvent_11_OnClicked__DelegateSignature(bool bSelected, class USettingsItem_TickBox_C* Button)
{
static auto fn = UObject::FindObject<UFunction>("Function UISettingsWindow.UISettingsWindow_C.BndEvt__ToggleCrouch_K2Node_ComponentBoundEvent_11_OnClicked__DelegateSignature");
UUISettingsWindow_C_BndEvt__ToggleCrouch_K2Node_ComponentBoundEvent_11_OnClicked__DelegateSignature_Params params;
params.bSelected = bSelected;
params.Button = Button;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function UISettingsWindow.UISettingsWindow_C.BndEvt__ToggleADS_K2Node_ComponentBoundEvent_12_OnClicked__DelegateSignature
// (BlueprintEvent)
// Parameters:
// bool bSelected (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor)
// class USettingsItem_TickBox_C* Button (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash)
void UUISettingsWindow_C::BndEvt__ToggleADS_K2Node_ComponentBoundEvent_12_OnClicked__DelegateSignature(bool bSelected, class USettingsItem_TickBox_C* Button)
{
static auto fn = UObject::FindObject<UFunction>("Function UISettingsWindow.UISettingsWindow_C.BndEvt__ToggleADS_K2Node_ComponentBoundEvent_12_OnClicked__DelegateSignature");
UUISettingsWindow_C_BndEvt__ToggleADS_K2Node_ComponentBoundEvent_12_OnClicked__DelegateSignature_Params params;
params.bSelected = bSelected;
params.Button = Button;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function UISettingsWindow.UISettingsWindow_C.BndEvt__ToggleDoubleTapWalk_K2Node_ComponentBoundEvent_13_OnClicked__DelegateSignature
// (BlueprintEvent)
// Parameters:
// bool bSelected (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor)
// class USettingsItem_TickBox_C* Button (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash)
void UUISettingsWindow_C::BndEvt__ToggleDoubleTapWalk_K2Node_ComponentBoundEvent_13_OnClicked__DelegateSignature(bool bSelected, class USettingsItem_TickBox_C* Button)
{
static auto fn = UObject::FindObject<UFunction>("Function UISettingsWindow.UISettingsWindow_C.BndEvt__ToggleDoubleTapWalk_K2Node_ComponentBoundEvent_13_OnClicked__DelegateSignature");
UUISettingsWindow_C_BndEvt__ToggleDoubleTapWalk_K2Node_ComponentBoundEvent_13_OnClicked__DelegateSignature_Params params;
params.bSelected = bSelected;
params.Button = Button;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function UISettingsWindow.UISettingsWindow_C.BndEvt__ToggleGameHelp_K2Node_ComponentBoundEvent_14_OnClicked__DelegateSignature
// (BlueprintEvent)
// Parameters:
// bool bSelected (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor)
// class USettingsItem_TickBox_C* Button (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash)
void UUISettingsWindow_C::BndEvt__ToggleGameHelp_K2Node_ComponentBoundEvent_14_OnClicked__DelegateSignature(bool bSelected, class USettingsItem_TickBox_C* Button)
{
static auto fn = UObject::FindObject<UFunction>("Function UISettingsWindow.UISettingsWindow_C.BndEvt__ToggleGameHelp_K2Node_ComponentBoundEvent_14_OnClicked__DelegateSignature");
UUISettingsWindow_C_BndEvt__ToggleGameHelp_K2Node_ComponentBoundEvent_14_OnClicked__DelegateSignature_Params params;
params.bSelected = bSelected;
params.Button = Button;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function UISettingsWindow.UISettingsWindow_C.BndEvt__ToggleJumpUncrouch_K2Node_ComponentBoundEvent_17_OnClicked__DelegateSignature
// (BlueprintEvent)
// Parameters:
// bool bSelected (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor)
// class USettingsItem_TickBox_C* Button (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash)
void UUISettingsWindow_C::BndEvt__ToggleJumpUncrouch_K2Node_ComponentBoundEvent_17_OnClicked__DelegateSignature(bool bSelected, class USettingsItem_TickBox_C* Button)
{
static auto fn = UObject::FindObject<UFunction>("Function UISettingsWindow.UISettingsWindow_C.BndEvt__ToggleJumpUncrouch_K2Node_ComponentBoundEvent_17_OnClicked__DelegateSignature");
UUISettingsWindow_C_BndEvt__ToggleJumpUncrouch_K2Node_ComponentBoundEvent_17_OnClicked__DelegateSignature_Params params;
params.bSelected = bSelected;
params.Button = Button;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function UISettingsWindow.UISettingsWindow_C.BndEvt__ToggleJumpUnprone_K2Node_ComponentBoundEvent_18_OnClicked__DelegateSignature
// (BlueprintEvent)
// Parameters:
// bool bSelected (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor)
// class USettingsItem_TickBox_C* Button (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash)
void UUISettingsWindow_C::BndEvt__ToggleJumpUnprone_K2Node_ComponentBoundEvent_18_OnClicked__DelegateSignature(bool bSelected, class USettingsItem_TickBox_C* Button)
{
static auto fn = UObject::FindObject<UFunction>("Function UISettingsWindow.UISettingsWindow_C.BndEvt__ToggleJumpUnprone_K2Node_ComponentBoundEvent_18_OnClicked__DelegateSignature");
UUISettingsWindow_C_BndEvt__ToggleJumpUnprone_K2Node_ComponentBoundEvent_18_OnClicked__DelegateSignature_Params params;
params.bSelected = bSelected;
params.Button = Button;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function UISettingsWindow.UISettingsWindow_C.BndEvt__ToggleLean_K2Node_ComponentBoundEvent_19_OnClicked__DelegateSignature
// (BlueprintEvent)
// Parameters:
// bool bSelected (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor)
// class USettingsItem_TickBox_C* Button (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash)
void UUISettingsWindow_C::BndEvt__ToggleLean_K2Node_ComponentBoundEvent_19_OnClicked__DelegateSignature(bool bSelected, class USettingsItem_TickBox_C* Button)
{
static auto fn = UObject::FindObject<UFunction>("Function UISettingsWindow.UISettingsWindow_C.BndEvt__ToggleLean_K2Node_ComponentBoundEvent_19_OnClicked__DelegateSignature");
UUISettingsWindow_C_BndEvt__ToggleLean_K2Node_ComponentBoundEvent_19_OnClicked__DelegateSignature_Params params;
params.bSelected = bSelected;
params.Button = Button;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function UISettingsWindow.UISettingsWindow_C.BndEvt__ToggleMenuTips_K2Node_ComponentBoundEvent_20_OnClicked__DelegateSignature
// (BlueprintEvent)
// Parameters:
// bool bSelected (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor)
// class USettingsItem_TickBox_C* Button (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash)
void UUISettingsWindow_C::BndEvt__ToggleMenuTips_K2Node_ComponentBoundEvent_20_OnClicked__DelegateSignature(bool bSelected, class USettingsItem_TickBox_C* Button)
{
static auto fn = UObject::FindObject<UFunction>("Function UISettingsWindow.UISettingsWindow_C.BndEvt__ToggleMenuTips_K2Node_ComponentBoundEvent_20_OnClicked__DelegateSignature");
UUISettingsWindow_C_BndEvt__ToggleMenuTips_K2Node_ComponentBoundEvent_20_OnClicked__DelegateSignature_Params params;
params.bSelected = bSelected;
params.Button = Button;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function UISettingsWindow.UISettingsWindow_C.BndEvt__ToggleRadialTips_K2Node_ComponentBoundEvent_22_OnClicked__DelegateSignature
// (BlueprintEvent)
// Parameters:
// bool bSelected (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor)
// class USettingsItem_TickBox_C* Button (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash)
void UUISettingsWindow_C::BndEvt__ToggleRadialTips_K2Node_ComponentBoundEvent_22_OnClicked__DelegateSignature(bool bSelected, class USettingsItem_TickBox_C* Button)
{
static auto fn = UObject::FindObject<UFunction>("Function UISettingsWindow.UISettingsWindow_C.BndEvt__ToggleRadialTips_K2Node_ComponentBoundEvent_22_OnClicked__DelegateSignature");
UUISettingsWindow_C_BndEvt__ToggleRadialTips_K2Node_ComponentBoundEvent_22_OnClicked__DelegateSignature_Params params;
params.bSelected = bSelected;
params.Button = Button;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function UISettingsWindow.UISettingsWindow_C.BndEvt__ToggleStreamerMode_K2Node_ComponentBoundEvent_23_OnClicked__DelegateSignature
// (BlueprintEvent)
// Parameters:
// bool bSelected (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor)
// class USettingsItem_TickBox_C* Button (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash)
void UUISettingsWindow_C::BndEvt__ToggleStreamerMode_K2Node_ComponentBoundEvent_23_OnClicked__DelegateSignature(bool bSelected, class USettingsItem_TickBox_C* Button)
{
static auto fn = UObject::FindObject<UFunction>("Function UISettingsWindow.UISettingsWindow_C.BndEvt__ToggleStreamerMode_K2Node_ComponentBoundEvent_23_OnClicked__DelegateSignature");
UUISettingsWindow_C_BndEvt__ToggleStreamerMode_K2Node_ComponentBoundEvent_23_OnClicked__DelegateSignature_Params params;
params.bSelected = bSelected;
params.Button = Button;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function UISettingsWindow.UISettingsWindow_C.BndEvt__ToggleFreelook_K2Node_ComponentBoundEvent_163_OnClicked__DelegateSignature
// (BlueprintEvent)
// Parameters:
// bool bSelected (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor)
// class USettingsItem_TickBox_C* Button (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash)
void UUISettingsWindow_C::BndEvt__ToggleFreelook_K2Node_ComponentBoundEvent_163_OnClicked__DelegateSignature(bool bSelected, class USettingsItem_TickBox_C* Button)
{
static auto fn = UObject::FindObject<UFunction>("Function UISettingsWindow.UISettingsWindow_C.BndEvt__ToggleFreelook_K2Node_ComponentBoundEvent_163_OnClicked__DelegateSignature");
UUISettingsWindow_C_BndEvt__ToggleFreelook_K2Node_ComponentBoundEvent_163_OnClicked__DelegateSignature_Params params;
params.bSelected = bSelected;
params.Button = Button;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function UISettingsWindow.UISettingsWindow_C.BndEvt__ToggleFreelookRecenter_K2Node_ComponentBoundEvent_143_OnClicked__DelegateSignature
// (BlueprintEvent)
// Parameters:
// bool bSelected (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor)
// class USettingsItem_TickBox_C* Button (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash)
void UUISettingsWindow_C::BndEvt__ToggleFreelookRecenter_K2Node_ComponentBoundEvent_143_OnClicked__DelegateSignature(bool bSelected, class USettingsItem_TickBox_C* Button)
{
static auto fn = UObject::FindObject<UFunction>("Function UISettingsWindow.UISettingsWindow_C.BndEvt__ToggleFreelookRecenter_K2Node_ComponentBoundEvent_143_OnClicked__DelegateSignature");
UUISettingsWindow_C_BndEvt__ToggleFreelookRecenter_K2Node_ComponentBoundEvent_143_OnClicked__DelegateSignature_Params params;
params.bSelected = bSelected;
params.Button = Button;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function UISettingsWindow.UISettingsWindow_C.BndEvt__SettingsItem_Slider_C_0_K2Node_ComponentBoundEvent_1031_OnValueChanged__DelegateSignature
// (BlueprintEvent)
// Parameters:
// float Value (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash)
void UUISettingsWindow_C::BndEvt__SettingsItem_Slider_C_0_K2Node_ComponentBoundEvent_1031_OnValueChanged__DelegateSignature(float Value)
{
static auto fn = UObject::FindObject<UFunction>("Function UISettingsWindow.UISettingsWindow_C.BndEvt__SettingsItem_Slider_C_0_K2Node_ComponentBoundEvent_1031_OnValueChanged__DelegateSignature");
UUISettingsWindow_C_BndEvt__SettingsItem_Slider_C_0_K2Node_ComponentBoundEvent_1031_OnValueChanged__DelegateSignature_Params params;
params.Value = Value;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function UISettingsWindow.UISettingsWindow_C.BndEvt__NameTagSLOnly_K2Node_ComponentBoundEvent_508_OnClicked__DelegateSignature
// (BlueprintEvent)
// Parameters:
// bool bSelected (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor)
// class USettingsItem_TickBox_C* Button (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash)
void UUISettingsWindow_C::BndEvt__NameTagSLOnly_K2Node_ComponentBoundEvent_508_OnClicked__DelegateSignature(bool bSelected, class USettingsItem_TickBox_C* Button)
{
static auto fn = UObject::FindObject<UFunction>("Function UISettingsWindow.UISettingsWindow_C.BndEvt__NameTagSLOnly_K2Node_ComponentBoundEvent_508_OnClicked__DelegateSignature");
UUISettingsWindow_C_BndEvt__NameTagSLOnly_K2Node_ComponentBoundEvent_508_OnClicked__DelegateSignature_Params params;
params.bSelected = bSelected;
params.Button = Button;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function UISettingsWindow.UISettingsWindow_C.BndEvt__NameTagShowKit_K2Node_ComponentBoundEvent_758_OnClicked__DelegateSignature
// (BlueprintEvent)
// Parameters:
// bool bSelected (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor)
// class USettingsItem_TickBox_C* Button (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash)
void UUISettingsWindow_C::BndEvt__NameTagShowKit_K2Node_ComponentBoundEvent_758_OnClicked__DelegateSignature(bool bSelected, class USettingsItem_TickBox_C* Button)
{
static auto fn = UObject::FindObject<UFunction>("Function UISettingsWindow.UISettingsWindow_C.BndEvt__NameTagShowKit_K2Node_ComponentBoundEvent_758_OnClicked__DelegateSignature");
UUISettingsWindow_C_BndEvt__NameTagShowKit_K2Node_ComponentBoundEvent_758_OnClicked__DelegateSignature_Params params;
params.bSelected = bSelected;
params.Button = Button;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function UISettingsWindow.UISettingsWindow_C.BndEvt__NameTagScale_K2Node_ComponentBoundEvent_1104_OnValueChanged__DelegateSignature
// (BlueprintEvent)
// Parameters:
// float Value (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash)
void UUISettingsWindow_C::BndEvt__NameTagScale_K2Node_ComponentBoundEvent_1104_OnValueChanged__DelegateSignature(float Value)
{
static auto fn = UObject::FindObject<UFunction>("Function UISettingsWindow.UISettingsWindow_C.BndEvt__NameTagScale_K2Node_ComponentBoundEvent_1104_OnValueChanged__DelegateSignature");
UUISettingsWindow_C_BndEvt__NameTagScale_K2Node_ComponentBoundEvent_1104_OnValueChanged__DelegateSignature_Params params;
params.Value = Value;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function UISettingsWindow.UISettingsWindow_C.BndEvt__Keyboardhilite_K2Node_ComponentBoundEvent_1305_OnClicked__DelegateSignature
// (BlueprintEvent)
// Parameters:
// bool bSelected (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor)
// class USettingsItem_TickBox_C* Button (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash)
void UUISettingsWindow_C::BndEvt__Keyboardhilite_K2Node_ComponentBoundEvent_1305_OnClicked__DelegateSignature(bool bSelected, class USettingsItem_TickBox_C* Button)
{
static auto fn = UObject::FindObject<UFunction>("Function UISettingsWindow.UISettingsWindow_C.BndEvt__Keyboardhilite_K2Node_ComponentBoundEvent_1305_OnClicked__DelegateSignature");
UUISettingsWindow_C_BndEvt__Keyboardhilite_K2Node_ComponentBoundEvent_1305_OnClicked__DelegateSignature_Params params;
params.bSelected = bSelected;
params.Button = Button;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function UISettingsWindow.UISettingsWindow_C.BndEvt__NameTagSLAlwaysVisible_K2Node_ComponentBoundEvent_0_OnClicked__DelegateSignature
// (BlueprintEvent)
// Parameters:
// bool bSelected (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor)
// class USettingsItem_TickBox_C* Button (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash)
void UUISettingsWindow_C::BndEvt__NameTagSLAlwaysVisible_K2Node_ComponentBoundEvent_0_OnClicked__DelegateSignature(bool bSelected, class USettingsItem_TickBox_C* Button)
{
static auto fn = UObject::FindObject<UFunction>("Function UISettingsWindow.UISettingsWindow_C.BndEvt__NameTagSLAlwaysVisible_K2Node_ComponentBoundEvent_0_OnClicked__DelegateSignature");
UUISettingsWindow_C_BndEvt__NameTagSLAlwaysVisible_K2Node_ComponentBoundEvent_0_OnClicked__DelegateSignature_Params params;
params.bSelected = bSelected;
params.Button = Button;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function UISettingsWindow.UISettingsWindow_C.BndEvt__ShowStanceIndicator_K2Node_ComponentBoundEvent_1226_OnClicked__DelegateSignature
// (BlueprintEvent)
// Parameters:
// bool bSelected (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor)
// class USettingsItem_TickBox_C* Button (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash)
void UUISettingsWindow_C::BndEvt__ShowStanceIndicator_K2Node_ComponentBoundEvent_1226_OnClicked__DelegateSignature(bool bSelected, class USettingsItem_TickBox_C* Button)
{
static auto fn = UObject::FindObject<UFunction>("Function UISettingsWindow.UISettingsWindow_C.BndEvt__ShowStanceIndicator_K2Node_ComponentBoundEvent_1226_OnClicked__DelegateSignature");
UUISettingsWindow_C_BndEvt__ShowStanceIndicator_K2Node_ComponentBoundEvent_1226_OnClicked__DelegateSignature_Params params;
params.bSelected = bSelected;
params.Button = Button;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function UISettingsWindow.UISettingsWindow_C.BndEvt__AlwaysShowWeaponsinDeployment_K2Node_ComponentBoundEvent_1275_OnClicked__DelegateSignature
// (BlueprintEvent)
// Parameters:
// bool bSelected (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor)
// class USettingsItem_TickBox_C* Button (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash)
void UUISettingsWindow_C::BndEvt__AlwaysShowWeaponsinDeployment_K2Node_ComponentBoundEvent_1275_OnClicked__DelegateSignature(bool bSelected, class USettingsItem_TickBox_C* Button)
{
static auto fn = UObject::FindObject<UFunction>("Function UISettingsWindow.UISettingsWindow_C.BndEvt__AlwaysShowWeaponsinDeployment_K2Node_ComponentBoundEvent_1275_OnClicked__DelegateSignature");
UUISettingsWindow_C_BndEvt__AlwaysShowWeaponsinDeployment_K2Node_ComponentBoundEvent_1275_OnClicked__DelegateSignature_Params params;
params.bSelected = bSelected;
params.Button = Button;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function UISettingsWindow.UISettingsWindow_C.BndEvt__MapMarkerScale_K2Node_ComponentBoundEvent_212_OnValueChanged__DelegateSignature
// (BlueprintEvent)
// Parameters:
// float Value (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash)
void UUISettingsWindow_C::BndEvt__MapMarkerScale_K2Node_ComponentBoundEvent_212_OnValueChanged__DelegateSignature(float Value)
{
static auto fn = UObject::FindObject<UFunction>("Function UISettingsWindow.UISettingsWindow_C.BndEvt__MapMarkerScale_K2Node_ComponentBoundEvent_212_OnValueChanged__DelegateSignature");
UUISettingsWindow_C_BndEvt__MapMarkerScale_K2Node_ComponentBoundEvent_212_OnValueChanged__DelegateSignature_Params params;
params.Value = Value;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function UISettingsWindow.UISettingsWindow_C.BndEvt__NameTagsShowFTID_K2Node_ComponentBoundEvent_0_OnClicked__DelegateSignature
// (BlueprintEvent)
// Parameters:
// bool bSelected (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor)
// class USettingsItem_TickBox_C* Button (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash)
void UUISettingsWindow_C::BndEvt__NameTagsShowFTID_K2Node_ComponentBoundEvent_0_OnClicked__DelegateSignature(bool bSelected, class USettingsItem_TickBox_C* Button)
{
static auto fn = UObject::FindObject<UFunction>("Function UISettingsWindow.UISettingsWindow_C.BndEvt__NameTagsShowFTID_K2Node_ComponentBoundEvent_0_OnClicked__DelegateSignature");
UUISettingsWindow_C_BndEvt__NameTagsShowFTID_K2Node_ComponentBoundEvent_0_OnClicked__DelegateSignature_Params params;
params.bSelected = bSelected;
params.Button = Button;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function UISettingsWindow.UISettingsWindow_C.BndEvt__SkipGiveupConfirm_K2Node_ComponentBoundEvent_0_OnClicked__DelegateSignature
// (BlueprintEvent)
// Parameters:
// bool bSelected (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor)
// class USettingsItem_TickBox_C* Button (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash)
void UUISettingsWindow_C::BndEvt__SkipGiveupConfirm_K2Node_ComponentBoundEvent_0_OnClicked__DelegateSignature(bool bSelected, class USettingsItem_TickBox_C* Button)
{
static auto fn = UObject::FindObject<UFunction>("Function UISettingsWindow.UISettingsWindow_C.BndEvt__SkipGiveupConfirm_K2Node_ComponentBoundEvent_0_OnClicked__DelegateSignature");
UUISettingsWindow_C_BndEvt__SkipGiveupConfirm_K2Node_ComponentBoundEvent_0_OnClicked__DelegateSignature_Params params;
params.bSelected = bSelected;
params.Button = Button;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function UISettingsWindow.UISettingsWindow_C.BndEvt__ShowFireteamLetters_K2Node_ComponentBoundEvent_0_OnClicked__DelegateSignature
// (BlueprintEvent)
// Parameters:
// bool bSelected (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor)
// class USettingsItem_TickBox_C* Button (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash)
void UUISettingsWindow_C::BndEvt__ShowFireteamLetters_K2Node_ComponentBoundEvent_0_OnClicked__DelegateSignature(bool bSelected, class USettingsItem_TickBox_C* Button)
{
static auto fn = UObject::FindObject<UFunction>("Function UISettingsWindow.UISettingsWindow_C.BndEvt__ShowFireteamLetters_K2Node_ComponentBoundEvent_0_OnClicked__DelegateSignature");
UUISettingsWindow_C_BndEvt__ShowFireteamLetters_K2Node_ComponentBoundEvent_0_OnClicked__DelegateSignature_Params params;
params.bSelected = bSelected;
params.Button = Button;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function UISettingsWindow.UISettingsWindow_C.BndEvt__ToggleDeploymentTutorial_K2Node_ComponentBoundEvent_1_OnClicked__DelegateSignature
// (BlueprintEvent)
// Parameters:
// bool bSelected (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor)
// class USettingsItem_TickBox_C* Button (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash)
void UUISettingsWindow_C::BndEvt__ToggleDeploymentTutorial_K2Node_ComponentBoundEvent_1_OnClicked__DelegateSignature(bool bSelected, class USettingsItem_TickBox_C* Button)
{
static auto fn = UObject::FindObject<UFunction>("Function UISettingsWindow.UISettingsWindow_C.BndEvt__ToggleDeploymentTutorial_K2Node_ComponentBoundEvent_1_OnClicked__DelegateSignature");
UUISettingsWindow_C_BndEvt__ToggleDeploymentTutorial_K2Node_ComponentBoundEvent_1_OnClicked__DelegateSignature_Params params;
params.bSelected = bSelected;
params.Button = Button;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function UISettingsWindow.UISettingsWindow_C.BndEvt__SkipModeIntroAnimation_K2Node_ComponentBoundEvent_2_OnClicked__DelegateSignature
// (BlueprintEvent)
// Parameters:
// bool bSelected (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor)
// class USettingsItem_TickBox_C* Button (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash)
void UUISettingsWindow_C::BndEvt__SkipModeIntroAnimation_K2Node_ComponentBoundEvent_2_OnClicked__DelegateSignature(bool bSelected, class USettingsItem_TickBox_C* Button)
{
static auto fn = UObject::FindObject<UFunction>("Function UISettingsWindow.UISettingsWindow_C.BndEvt__SkipModeIntroAnimation_K2Node_ComponentBoundEvent_2_OnClicked__DelegateSignature");
UUISettingsWindow_C_BndEvt__SkipModeIntroAnimation_K2Node_ComponentBoundEvent_2_OnClicked__DelegateSignature_Params params;
params.bSelected = bSelected;
params.Button = Button;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function UISettingsWindow.UISettingsWindow_C.BndEvt__ShowVehicleKeybinds_K2Node_ComponentBoundEvent_4_OnClicked__DelegateSignature
// (BlueprintEvent)
// Parameters:
// bool bSelected (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor)
// class USettingsItem_TickBox_C* Button (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash)
void UUISettingsWindow_C::BndEvt__ShowVehicleKeybinds_K2Node_ComponentBoundEvent_4_OnClicked__DelegateSignature(bool bSelected, class USettingsItem_TickBox_C* Button)
{
static auto fn = UObject::FindObject<UFunction>("Function UISettingsWindow.UISettingsWindow_C.BndEvt__ShowVehicleKeybinds_K2Node_ComponentBoundEvent_4_OnClicked__DelegateSignature");
UUISettingsWindow_C_BndEvt__ShowVehicleKeybinds_K2Node_ComponentBoundEvent_4_OnClicked__DelegateSignature_Params params;
params.bSelected = bSelected;
params.Button = Button;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function UISettingsWindow.UISettingsWindow_C.BndEvt__PlayCaptureSounds_K2Node_ComponentBoundEvent_3_OnClicked__DelegateSignature
// (BlueprintEvent)
// Parameters:
// bool bSelected (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor)
// class USettingsItem_TickBox_C* Button (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash)
void UUISettingsWindow_C::BndEvt__PlayCaptureSounds_K2Node_ComponentBoundEvent_3_OnClicked__DelegateSignature(bool bSelected, class USettingsItem_TickBox_C* Button)
{
static auto fn = UObject::FindObject<UFunction>("Function UISettingsWindow.UISettingsWindow_C.BndEvt__PlayCaptureSounds_K2Node_ComponentBoundEvent_3_OnClicked__DelegateSignature");
UUISettingsWindow_C_BndEvt__PlayCaptureSounds_K2Node_ComponentBoundEvent_3_OnClicked__DelegateSignature_Params params;
params.bSelected = bSelected;
params.Button = Button;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function UISettingsWindow.UISettingsWindow_C.BndEvt__SettingsItem_TickBox_C_0_K2Node_ComponentBoundEvent_5_OnClicked__DelegateSignature
// (BlueprintEvent)
// Parameters:
// bool bSelected (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor)
// class USettingsItem_TickBox_C* Button (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash)
void UUISettingsWindow_C::BndEvt__SettingsItem_TickBox_C_0_K2Node_ComponentBoundEvent_5_OnClicked__DelegateSignature(bool bSelected, class USettingsItem_TickBox_C* Button)
{
static auto fn = UObject::FindObject<UFunction>("Function UISettingsWindow.UISettingsWindow_C.BndEvt__SettingsItem_TickBox_C_0_K2Node_ComponentBoundEvent_5_OnClicked__DelegateSignature");
UUISettingsWindow_C_BndEvt__SettingsItem_TickBox_C_0_K2Node_ComponentBoundEvent_5_OnClicked__DelegateSignature_Params params;
params.bSelected = bSelected;
params.Button = Button;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function UISettingsWindow.UISettingsWindow_C.ExecuteUbergraph_UISettingsWindow
// (Final)
// Parameters:
// int EntryPoint (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash)
void UUISettingsWindow_C::ExecuteUbergraph_UISettingsWindow(int EntryPoint)
{
static auto fn = UObject::FindObject<UFunction>("Function UISettingsWindow.UISettingsWindow_C.ExecuteUbergraph_UISettingsWindow");
UUISettingsWindow_C_ExecuteUbergraph_UISettingsWindow_Params params;
params.EntryPoint = EntryPoint;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function UISettingsWindow.UISettingsWindow_C.Reset Appdata OnClicked__DelegateSignature
// (Public, Delegate, BlueprintCallable, BlueprintEvent)
void UUISettingsWindow_C::Reset_Appdata_OnClicked__DelegateSignature()
{
static auto fn = UObject::FindObject<UFunction>("Function UISettingsWindow.UISettingsWindow_C.Reset Appdata OnClicked__DelegateSignature");
UUISettingsWindow_C_Reset_Appdata_OnClicked__DelegateSignature_Params params;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
}
#ifdef _MSC_VER
#pragma pack(pop)
#endif
| 47.727924
| 196
| 0.806431
|
MrManiak
|
24eec7547221dd877c40c009cdbfe807097b3cb8
| 954
|
cpp
|
C++
|
test/plugin/dynlib_A.cpp
|
ggerganov/dynamix
|
7530d2d6a39a0824410f2535ab5fc95d3821488f
|
[
"MIT"
] | 580
|
2016-06-26T20:44:17.000Z
|
2022-03-30T01:26:51.000Z
|
test/plugin/dynlib_A.cpp
|
ggerganov/dynamix
|
7530d2d6a39a0824410f2535ab5fc95d3821488f
|
[
"MIT"
] | 35
|
2016-06-28T11:15:49.000Z
|
2022-01-28T14:03:30.000Z
|
test/plugin/dynlib_A.cpp
|
ggerganov/dynamix
|
7530d2d6a39a0824410f2535ab5fc95d3821488f
|
[
"MIT"
] | 52
|
2016-06-26T19:49:24.000Z
|
2022-01-25T18:18:31.000Z
|
// DynaMix
// Copyright (c) 2013-2019 Borislav Stanimirov, Zahary Karadjov
//
// Distributed under the MIT Software License
// See accompanying file LICENSE.txt or copy at
// https://opensource.org/licenses/MIT
//
#define DYNLIB_A_SRC
#include "dynlib_A.hpp"
#include <dynamix/define_message.hpp>
#include <dynamix/define_mixin.hpp>
DYNAMIX_DEFINE_MESSAGE(dl_a_mixin_specific);
DYNAMIX_DEFINE_MESSAGE(dl_a_exported);
DYNAMIX_DEFINE_MESSAGE(dl_a_multicast);
class dynlib_a_mixin1
{
public:
int dl_a_mixin_specific()
{
return 101;
}
int dl_a_multicast()
{
return 11;
}
};
DYNAMIX_DEFINE_MIXIN(dynlib_a_mixin1, dl_a_mixin_specific_msg & dl_a_multicast_msg);
class dynlib_a_mixin2
{
public:
int dl_a_mixin_specific()
{
return 102;
}
int dl_a_multicast()
{
return 12;
}
};
DYNAMIX_DEFINE_MIXIN(dynlib_a_mixin2, priority(1, dl_a_mixin_specific_msg) & dl_a_multicast_msg);
| 19.469388
| 97
| 0.726415
|
ggerganov
|
24ef90aab4b6b24bf0ce801d8b4668e34c83f89b
| 3,947
|
hpp
|
C++
|
tcob/include/tcob/script/LuaFunction.hpp
|
TobiasBohnen/tcob
|
53092b3c8e657f1ff5e48ce961659edf7cb1cb05
|
[
"MIT"
] | 2
|
2021-08-18T19:14:35.000Z
|
2021-12-01T14:14:49.000Z
|
tcob/include/tcob/script/LuaFunction.hpp
|
TobiasBohnen/tcob
|
53092b3c8e657f1ff5e48ce961659edf7cb1cb05
|
[
"MIT"
] | null | null | null |
tcob/include/tcob/script/LuaFunction.hpp
|
TobiasBohnen/tcob
|
53092b3c8e657f1ff5e48ce961659edf7cb1cb05
|
[
"MIT"
] | null | null | null |
// Copyright (c) 2021 Tobias Bohnen
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#pragma once
#include <tcob/tcob_config.hpp>
#include <future>
#include <tcob/core/io/Logger.hpp>
#include <tcob/script/LuaRef.hpp>
namespace tcob::script::lua::detail {
////////////////////////////////////////////////////////////
class FunctionBase : public Ref {
public:
void dump(OutputFileStreamB& stream) const;
protected:
auto do_call(i32 nargs) const -> ResultState;
};
}
////////////////////////////////////////////////////////////
namespace tcob::script::lua {
template <typename R>
class Function final : public detail::FunctionBase {
public:
template <typename... P>
auto operator()(P&&... params) -> R
{
if constexpr (std::is_void_v<R>) {
static_cast<void>(call(params...));
} else {
return call(params...).Value;
}
}
template <typename... P>
auto call(P&&... params) const -> Result<R>
{
const auto& ls { get_state() };
const auto guard { ls.create_stack_guard() };
push_self();
//push parameters to lua
const i32 oldTop { ls.get_top() };
ls.push(params...);
const i32 paramsCount { ls.get_top() - oldTop };
//call lua function
auto result { do_call(paramsCount) };
if constexpr (std::is_void_v<R>) {
return { result };
} else {
R retValue {};
if (result == ResultState::Ok) {
if (!ls.try_get(1, retValue)) {
result = ResultState::TypeMismatch;
}
}
return { retValue, result };
}
}
template <typename... P>
auto call_async(P&&... params) const -> std::future<Result<R>>
{
return std::async(std::launch::async, [this, params...] {
return call<R>(params...);
});
}
};
////////////////////////////////////////////////////////////
enum class CoroutineState {
Ok,
Suspended,
Error
};
class Coroutine final : public Ref {
public:
template <typename R = void, typename... P>
auto resume(P&&... params) const -> Result<R>
{
const State t { get_thread() };
const auto guard { t.create_stack_guard() };
//push parameters to lua
const i32 oldTop { t.get_top() };
t.push(params...);
const i32 paramsCount { t.get_top() - oldTop };
//call lua function
i32 nresults { 0 };
const auto err { t.resume(paramsCount, &nresults) };
if (err == ThreadState::Ok || err == ThreadState::Yielded) {
if constexpr (std::is_void_v<R>) {
return { ResultState::Ok };
} else {
R retValue {};
if (t.try_get(1, retValue)) {
return { retValue, err == ThreadState::Ok ? ResultState::Ok : ResultState::Yielded };
} else {
return { R {}, ResultState::TypeMismatch };
}
}
} else {
ResultState result;
switch (err) {
case ThreadState::RuntimeError:
result = ResultState::RuntimeError;
break;
case ThreadState::MemError:
result = ResultState::MemAllocError;
break;
default:
result = ResultState::RuntimeError;
break;
}
if constexpr (std::is_void_v<R>) {
return { result };
} else {
return { R {}, result };
}
}
}
template <typename... T>
void push(T&&... t) const
{
get_thread().push(t...);
}
auto close() const -> CoroutineState;
auto get_current_state() const -> CoroutineState;
private:
auto get_thread() const -> State;
};
}
| 26.139073
| 105
| 0.496073
|
TobiasBohnen
|
24f02e37fe84002cf445f55f23f2427a6e77677a
| 4,571
|
cc
|
C++
|
wayland/shell/xdg_shell_surface.cc
|
kalyankondapally/ozone-wayland
|
f4f72d4e5ba932c04ec714942f9e75ed5b54d271
|
[
"BSD-3-Clause"
] | 1
|
2016-05-20T09:52:27.000Z
|
2016-05-20T09:52:27.000Z
|
wayland/shell/xdg_shell_surface.cc
|
rakuco/ozone-wayland
|
4a1ab0b14bc63752e2b303a5098758d48f0fe49e
|
[
"BSD-3-Clause"
] | null | null | null |
wayland/shell/xdg_shell_surface.cc
|
rakuco/ozone-wayland
|
4a1ab0b14bc63752e2b303a5098758d48f0fe49e
|
[
"BSD-3-Clause"
] | null | null | null |
// Copyright 2014 Intel Corporation. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ozone/wayland/shell/xdg_shell_surface.h"
#include "base/logging.h"
#include "base/strings/utf_string_conversions.h"
#include "ozone/wayland/display.h"
#include "ozone/wayland/input_device.h"
#include "ozone/wayland/shell/shell.h"
#include "ozone/wayland/shell/xdg-shell-client-protocol.h"
namespace ozonewayland {
XDGShellSurface::XDGShellSurface()
: WaylandShellSurface(),
xdg_surface_(NULL),
xdg_popup_(NULL),
maximized_(false) {
}
XDGShellSurface::~XDGShellSurface() {
if (xdg_surface_)
xdg_surface_destroy(xdg_surface_);
if (xdg_popup_)
xdg_popup_destroy(xdg_popup_);
}
void XDGShellSurface::InitializeShellSurface(WaylandWindow* window) {
DCHECK(!xdg_surface_);
WaylandDisplay* display = WaylandDisplay::GetInstance();
DCHECK(display);
WaylandShell* shell = WaylandDisplay::GetInstance()->GetShell();
DCHECK(shell && shell->GetXDGShell());
xdg_surface_ = xdg_shell_get_xdg_surface(shell->GetXDGShell(),
GetWLSurface());
static const xdg_surface_listener xdg_surface_listener = {
XDGShellSurface::HandlePing,
XDGShellSurface::HandleConfigure,
};
xdg_surface_add_listener(xdg_surface_,
&xdg_surface_listener,
window);
DCHECK(xdg_surface_);
}
void XDGShellSurface::UpdateShellSurface(WaylandWindow::ShellType type,
WaylandShellSurface* shell_parent,
unsigned x,
unsigned y) {
switch (type) {
case WaylandWindow::TOPLEVEL: {
if (maximized_) {
xdg_surface_unset_maximized(xdg_surface_);
maximized_ = false;
}
break;
}
case WaylandWindow::POPUP: {
WaylandDisplay* display = WaylandDisplay::GetInstance();
WaylandInputDevice* input_device = display->PrimaryInput();
wl_surface* surface = GetWLSurface();
wl_surface* parent_surface = shell_parent->GetWLSurface();
xdg_popup_ = xdg_shell_get_xdg_popup(display->GetShell()->GetXDGShell(),
surface,
parent_surface,
input_device->GetInputSeat(),
display->GetSerial(),
x,
y,
0);
static const xdg_popup_listener xdg_popup_listener = {
XDGShellSurface::HandlePopupPing,
XDGShellSurface::HandlePopupPopupDone
};
xdg_popup_add_listener(xdg_popup_,
&xdg_popup_listener,
NULL);
DCHECK(xdg_popup_);
break;
}
case WaylandWindow::FULLSCREEN:
xdg_surface_set_fullscreen(xdg_surface_);
break;
case WaylandWindow::CUSTOM:
NOTREACHED() << "Unsupported shell type: " << type;
break;
default:
break;
}
WaylandShellSurface::FlushDisplay();
}
void XDGShellSurface::SetWindowTitle(const base::string16& title) {
xdg_surface_set_title(xdg_surface_, UTF16ToUTF8(title).c_str());
WaylandShellSurface::FlushDisplay();
}
void XDGShellSurface::Maximize() {
xdg_surface_set_maximized(xdg_surface_);
maximized_ = true;
WaylandShellSurface::FlushDisplay();
}
void XDGShellSurface::Minimize() {
xdg_surface_set_minimized(xdg_surface_);
}
void XDGShellSurface::HandleConfigure(void* data,
struct xdg_surface* xdg_surface,
uint32_t edges,
int32_t width,
int32_t height) {
WaylandShellSurface::WindowResized(data, width, height);
}
void XDGShellSurface::HandlePing(void* data,
struct xdg_surface* xdg_surface,
uint32_t serial) {
xdg_surface_pong(xdg_surface, serial);
}
void XDGShellSurface::HandlePopupPopupDone(void* data,
struct xdg_popup* xdg_popup,
uint32_t serial) {
WaylandShellSurface::PopupDone();
}
void XDGShellSurface::HandlePopupPing(void* data,
struct xdg_popup* xdg_popup,
uint32_t serial) {
xdg_popup_pong(xdg_popup, serial);
}
} // namespace ozonewayland
| 32.190141
| 76
| 0.607088
|
kalyankondapally
|
24fdca8dad7b7db2c4853ca3a19a760854a4c1e3
| 1,573
|
cpp
|
C++
|
Source/ActionsLib/SpecialPurposeActions.cpp
|
hawkjk/AI
|
9386b8d310f75779d75376bc25c7db810ef77c8e
|
[
"RSA-MD"
] | 1
|
2021-07-06T02:57:10.000Z
|
2021-07-06T02:57:10.000Z
|
Source/ActionsLib/SpecialPurposeActions.cpp
|
hawkjk/AI
|
9386b8d310f75779d75376bc25c7db810ef77c8e
|
[
"RSA-MD"
] | null | null | null |
Source/ActionsLib/SpecialPurposeActions.cpp
|
hawkjk/AI
|
9386b8d310f75779d75376bc25c7db810ef77c8e
|
[
"RSA-MD"
] | null | null | null |
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.
//
// EsotericActions.cpp -- CNTK actions that are deprecated
//
#define _CRT_NONSTDC_NO_DEPRECATE // make VS accept POSIX functions without _
#include "stdafx.h"
#include "Basics.h"
#include "Actions.h"
#include "ComputationNetwork.h"
#include "ComputationNode.h"
#include "DataReader.h"
#include "DataWriter.h"
#include "SimpleNetworkBuilder.h"
#include "Config.h"
#include "ScriptableObjects.h"
#include <string>
#include <chrono>
#include <algorithm>
#include <vector>
#include <iostream>
#include <queue>
#include <set>
#include <memory>
#ifndef let
#define let const auto
#endif
using namespace std;
using namespace Microsoft::MSR;
using namespace Microsoft::MSR::CNTK;
// ===========================================================================
// DoConvertFromDbn() - implements CNTK "convertdbn" command
// ===========================================================================
template <typename ElemType>
void DoConvertFromDbn(const ConfigParameters& config)
{
wstring modelPath = config(L"modelPath");
wstring dbnModelPath = config(L"dbnModelPath");
auto netBuilder = make_shared<SimpleNetworkBuilder<ElemType>>(config);
ComputationNetworkPtr net = netBuilder->BuildNetworkFromDbnFile(dbnModelPath);
net->Save(modelPath);
}
template void DoConvertFromDbn<float>(const ConfigParameters& config);
template void DoConvertFromDbn<double>(const ConfigParameters& config);
| 28.6
| 104
| 0.691672
|
hawkjk
|
700077c83373c659d0a93ed2267e139f241b01d0
| 68,824
|
hpp
|
C++
|
src/core/exact_m3ig_encoder.hpp
|
xianghex/also
|
b223adc430de0ca04e16699e8f8295e4a4cb366c
|
[
"MIT"
] | 48
|
2019-02-24T07:22:23.000Z
|
2022-03-18T05:42:18.000Z
|
src/core/exact_m3ig_encoder.hpp
|
xianghex/also
|
b223adc430de0ca04e16699e8f8295e4a4cb366c
|
[
"MIT"
] | 10
|
2020-03-07T01:39:28.000Z
|
2022-02-22T12:57:18.000Z
|
src/core/exact_m3ig_encoder.hpp
|
xianghex/also
|
b223adc430de0ca04e16699e8f8295e4a4cb366c
|
[
"MIT"
] | 38
|
2019-02-24T07:10:57.000Z
|
2022-03-27T08:44:28.000Z
|
/* also: Advanced Logic Synthesis and Optimization tool
* Copyright (C) 2019- Ningbo University, Ningbo, China */
/**
* @file mig_three_encoder.hpp
*
* @brief enonde SAT formulation to construct a MIG
*
* @author Zhufei Chu
* @since 0.1
*/
#ifndef MIG_THREE_ENCODER_HPP
#define MIG_THREE_ENCODER_HPP
#include <vector>
#include <mockturtle/mockturtle.hpp>
#include "misc.hpp"
#include "m3ig_helper.hpp"
using namespace percy;
using namespace mockturtle;
namespace also
{
/******************************************************************************
* The main encoder *
******************************************************************************/
class mig_three_encoder
{
private:
int nr_sel_vars;
int nr_sim_vars;
int nr_op_vars;
int nr_res_vars;
int nr_out_vars;
int sel_offset;
int sim_offset;
int op_offset;
int res_offset;
int out_offset;
int total_nr_vars;
bool dirty = false;
bool print_clause = false;
bool write_cnf_file = false;
FILE* f = NULL;
int num_clauses = 0;
std::vector<std::vector<int>> clauses;
pabc::Vec_Int_t* vLits; //dynamic vector of literals
pabc::lit pLits[2048];
solver_wrapper* solver;
int maj_input = 3;
bool dev = false;
std::map<int, std::vector<unsigned>> sel_map;
int level_dist[32]; // How many steps are below a certain level
int nr_levels; // The number of levels in the Boolean fence
// There are 4 possible operators for each MIG node:
// <abc> (0)
// <!abc> (1)
// <a!bc> (2)
// <ab!c> (3)
// All other input patterns can be obained from these
// by output inversion. Therefore we consider
// them symmetries and do not encode them.
const int MIG_OP_VARS_PER_STEP = 4;
//const int NR_SIM_TTS = 32;
std::vector<kitty::dynamic_truth_table> sim_tts { 32 };
/*
* private functions
* */
int get_sim_var( const spec& spec, int step_idx, int t ) const
{
return sim_offset + spec.tt_size * step_idx + t;
}
int get_op_var( const spec& spec, int step_idx, int var_idx) const
{
return op_offset + step_idx * MIG_OP_VARS_PER_STEP + var_idx;
}
int get_sel_var(const spec& spec, int step_idx, int var_idx) const
{
assert(step_idx < spec.nr_steps);
const auto nr_svars_for_idx = nr_svars_for_step(spec, step_idx);
assert(var_idx < nr_svars_for_idx);
auto offset = 0;
for (int i = 0; i < step_idx; i++)
{
offset += nr_svars_for_step(spec, i);
}
return sel_offset + offset + var_idx;
}
int get_sel_var( const int i, const int j, const int k, const int l ) const
{
for( const auto& e : sel_map )
{
auto sel_var = e.first;
auto array = e.second;
auto ip = array[0];
auto jp = array[1];
auto kp = array[2];
auto lp = array[3];
if( i == ip && j == jp && k == kp && l == lp )
{
return sel_var;
}
}
assert( false && "sel var is not existed" );
return -1;
}
int get_out_var( const spec& spec, int h, int i ) const
{
assert( h < spec.nr_nontriv );
assert( i < spec.nr_steps );
return out_offset + spec.nr_steps * h + i;
}
int get_res_var(const spec& spec, int step_idx, int res_var_idx) const
{
auto offset = 0;
for (int i = 0; i < step_idx; i++) {
offset += (nr_svars_for_step(spec, i) + 1) * (1 + 2);
}
return res_offset + offset + res_var_idx;
}
public:
mig_three_encoder( solver_wrapper& solver )
{
vLits = pabc::Vec_IntAlloc( 128 );
this->solver = &solver;
}
~mig_three_encoder()
{
pabc::Vec_IntFree( vLits );
}
void create_variables( const spec& spec )
{
/* number of simulation variables, s_out_in1_in2_in3 */
sel_map = comput_select_vars_map3( spec.nr_steps, spec.nr_in );
nr_sel_vars = sel_map.size();
/* number of operators per step */
nr_op_vars = spec.nr_steps * MIG_OP_VARS_PER_STEP;
/* number of truth table simulation variables */
nr_sim_vars = spec.nr_steps * spec.tt_size;
/* number of output selection variables */
nr_out_vars = spec.nr_nontriv * spec.nr_steps;
/* offsets, this is used to find varibles correspondence */
sel_offset = 0;
op_offset = nr_sel_vars;
sim_offset = nr_sel_vars + nr_op_vars;
out_offset = nr_sel_vars + nr_op_vars + nr_sim_vars;
/* total variables used in SAT formulation */
total_nr_vars = nr_op_vars + nr_sel_vars + nr_sim_vars + nr_out_vars;
if( spec.verbosity > 1 )
{
printf( "Creating variables (mig)\n");
printf( "nr steps = %d\n", spec.nr_steps );
printf( "nr_in = %d\n", spec.nr_in );
printf( "nr_sel_vars = %d\n", nr_sel_vars );
printf( "nr_op_vars = %d\n", nr_op_vars );
printf( "nr_out_vars = %d\n", nr_out_vars );
printf( "nr_sim_vars = %d\n", nr_sim_vars );
printf( "tt_size = %d\n", spec.tt_size );
printf( "creating %d total variables\n", total_nr_vars);
}
/* declare in the solver */
solver->set_nr_vars(total_nr_vars);
}
void fence_create_variables( const spec& spec )
{
/* number of simulation variables, s_out_in1_in2_in3 */
nr_sel_vars = 0;
for (int i = 0; i < spec.nr_steps; i++)
{
nr_sel_vars += nr_svars_for_step(spec, i);
}
/* number of operators per step */
nr_op_vars = spec.nr_steps * MIG_OP_VARS_PER_STEP;
/* number of truth table simulation variables */
nr_sim_vars = spec.nr_steps * spec.tt_size;
/* offsets, this is used to find varibles correspondence */
sel_offset = 0;
op_offset = nr_sel_vars;
sim_offset = nr_sel_vars + nr_op_vars;
/* total variables used in SAT formulation */
total_nr_vars = nr_op_vars + nr_sel_vars + nr_sim_vars;
if( spec.verbosity > 1 )
{
printf( "Creating variables (mig)\n");
printf( "nr steps = %d\n", spec.nr_steps );
printf( "nr_in = %d\n", spec.nr_in );
printf( "nr_sel_vars = %d\n", nr_sel_vars );
printf( "nr_op_vars = %d\n", nr_op_vars );
printf( "nr_sim_vars = %d\n", nr_sim_vars );
printf( "tt_size = %d\n", spec.tt_size );
printf( "creating %d total variables\n", total_nr_vars);
}
/* declare in the solver */
solver->set_nr_vars(total_nr_vars);
}
void cegar_fence_create_variables(const spec& spec)
{
nr_op_vars = spec.nr_steps * MIG_OP_VARS_PER_STEP;
nr_sim_vars = spec.nr_steps * spec.tt_size;
nr_sel_vars = 0;
nr_res_vars = 0;
for (int i = 0; i < spec.nr_steps; i++)
{
const auto nr_svars_for_i = nr_svars_for_step(spec, i);
nr_sel_vars += nr_svars_for_i;
nr_res_vars += (nr_svars_for_i + 1) * (1 + 2);
}
sel_offset = 0;
res_offset = nr_sel_vars;
op_offset = nr_sel_vars + nr_res_vars;
sim_offset = nr_sel_vars + nr_res_vars + nr_op_vars;
total_nr_vars = nr_sel_vars + nr_res_vars + nr_op_vars + nr_sim_vars;
if (spec.verbosity) {
printf("Creating variables (MIG)\n");
printf("nr steps = %d\n", spec.nr_steps);
printf("nr_sel_vars=%d\n", nr_sel_vars);
printf("nr_res_vars=%d\n", nr_res_vars);
printf("nr_op_vars = %d\n", nr_op_vars);
printf("nr_sim_vars = %d\n", nr_sim_vars);
printf("creating %d total variables\n", total_nr_vars);
}
solver->set_nr_vars(total_nr_vars);
}
int first_step_on_level(int level) const
{
if (level == 0) { return 0; }
return level_dist[level-1];
}
int nr_svars_for_step(const spec& spec, int i) const
{
// Determine the level of this step.
const auto level = get_level(spec, i + spec.nr_in + 1);
auto nr_svars_for_i = 0;
assert(level > 0);
for (auto l = first_step_on_level(level - 1); l < first_step_on_level(level); l++)
{
// We select l as fanin 3, so have (l choose 2) options
// (j,k in {0,...,(l-1)}) left for fanin 1 and 2.
nr_svars_for_i += (l * (l - 1)) / 2;
}
return nr_svars_for_i;
}
void update_level_map(const spec& spec, const fence& f)
{
nr_levels = f.nr_levels();
level_dist[0] = spec.nr_in + 1;
for (int i = 1; i <= nr_levels; i++) {
level_dist[i] = level_dist[i-1] + f.at(i-1);
}
}
int get_level(const spec& spec, int step_idx) const
{
// PIs are considered to be on level zero.
if (step_idx <= spec.nr_in)
{
return 0;
}
else if (step_idx == spec.nr_in + 1)
{
// First step is always on level one
return 1;
}
for (int i = 0; i <= nr_levels; i++)
{
if (level_dist[i] > step_idx)
{
return i;
}
}
return -1;
}
/// Ensures that each gate has the proper number of fanins.
bool create_fanin_clauses(const spec& spec)
{
auto status = true;
if (spec.verbosity > 2)
{
printf("Creating fanin clauses (mig)\n");
printf("Nr. clauses = %d (PRE)\n", solver->nr_clauses());
}
int svar = 0;
for (int i = 0; i < spec.nr_steps; i++)
{
auto ctr = 0;
auto num_svar_in_current_step = comput_select_vars_for_each_step3( spec.nr_steps, spec.nr_in, i );
for( int j = svar; j < svar + num_svar_in_current_step; j++ )
{
pLits[ctr++] = pabc::Abc_Var2Lit(j, 0);
}
svar += num_svar_in_current_step;
status &= solver->add_clause(pLits, pLits + ctr);
if( print_clause ) { print_sat_clause( solver, pLits, pLits + ctr ); }
if( write_cnf_file ) { add_print_clause( clauses, pLits, pLits + ctr ); }
}
if (spec.verbosity > 2)
{
printf("Nr. clauses = %d (POST)\n", solver->nr_clauses());
}
return status;
}
void fence_create_fanin_clauses(const spec& spec)
{
for (int i = 0; i < spec.nr_steps; i++)
{
const auto nr_svars_for_i = nr_svars_for_step(spec, i);
for (int j = 0; j < nr_svars_for_i; j++)
{
const auto sel_var = get_sel_var(spec, i, j);
pLits[j] = pabc::Abc_Var2Lit(sel_var, 0);
}
const auto res = solver->add_clause(pLits, pLits + nr_svars_for_i);
//assert(res);
}
}
void show_variable_correspondence( const spec& spec )
{
printf( "**************************************\n" );
printf( "selection variables \n");
for( const auto e : sel_map )
{
auto array = e.second;
printf( "s_%d_%d%d%d is %d\n", array[0], array[1], array[2], array[3], e.first );
}
printf( "\noperators variables\n\n" );
for( auto i = 0; i < spec.nr_steps; i++ )
{
for( auto j = 0; j < MIG_OP_VARS_PER_STEP; j++ )
{
printf( "op_%d_%d is %d\n", i + spec.nr_in, j, get_op_var( spec, i, j ) );
}
}
printf( "\nsimulation variables\n\n" );
for( auto i = 0; i < spec.nr_steps; i++ )
{
for( int t = 0; t < spec.tt_size; t++ )
{
printf( "tt_%d_%d is %d\n", i + spec.nr_in, t + 1, get_sim_var( spec, i, t ) );
}
}
printf( "\noutput variables\n\n" );
for( auto h = 0; h < spec.nr_nontriv; h++ )
{
for( int i = 0; i < spec.nr_steps; i++ )
{
printf( "g_%d_%d is %d\n", h, i + spec.nr_in, get_out_var( spec, h, i ) );
}
}
printf( "**************************************\n" );
}
void show_verbose_result()
{
for( auto i = 0u; i < total_nr_vars; i++ )
{
printf( "var %d : %d\n", i, solver->var_value( i ) );
}
}
/* the function works for a single-output function */
bool fix_output_sim_vars(const spec& spec, int t)
{
const auto ilast_step = spec.nr_steps - 1;
auto outbit = kitty::get_bit( spec[spec.synth_func(0)], t + 1);
if ( (spec.out_inv >> spec.synth_func(0) ) & 1 )
{
outbit = 1 - outbit;
}
const auto sim_var = get_sim_var(spec, ilast_step, t);
pabc::lit sim_lit = pabc::Abc_Var2Lit(sim_var, 1 - outbit);
if( print_clause ) { print_sat_clause( solver, &sim_lit, &sim_lit + 1); }
if( write_cnf_file ) { add_print_clause( clauses, &sim_lit, &sim_lit + 1); }
return solver->add_clause(&sim_lit, &sim_lit + 1);
}
/* for multi-output function */
bool multi_fix_output_sim_vars( const spec& spec, int h, int step_id, int t )
{
auto outbit = kitty::get_bit( spec[spec.synth_func( h )], t + 1 );
if( ( spec.out_inv >> spec.synth_func( h ) ) & 1 )
{
outbit = 1 - outbit;
}
pLits[0] = pabc::Abc_Var2Lit( get_out_var( spec, h, step_id ), 1 );
pLits[1] = pabc::Abc_Var2Lit( get_sim_var( spec, step_id, t ), 1 - outbit );
if( print_clause ) { print_sat_clause( solver, pLits, pLits + 2 ); }
return solver->add_clause( pLits, pLits + 2 );
}
/*
* for multi-output functions, create clauses:
* (1) all outputs show have at least one output var to be
* true,
* g_0_3 + g_0_4
* g_1_3 + g_1_4
*
* g_0_4 + g_1_4, at lease one output is the last step
* function
* */
bool create_output_clauses( const spec& spec )
{
auto status = true;
if( spec.nr_nontriv > 1 )
{
// Every output points to an operand
for( int h = 0; h < spec.nr_nontriv; h++ )
{
for( int i = 0; i < spec.nr_steps; i++ )
{
pabc::Vec_IntSetEntry( vLits, i, pabc::Abc_Var2Lit( get_out_var( spec, h, i ), 0 ) );
}
status &= solver->add_clause(
pabc::Vec_IntArray( vLits ),
pabc::Vec_IntArray( vLits ) + spec.nr_steps );
/* print clauses */
if( print_clause )
{
std::cout << "Add clause: ";
for( int i = 0; i < spec.nr_steps; i++ )
{
std::cout << " " << get_out_var( spec, h, i );
}
std::cout << std::endl;
}
}
// Every output can have only one be true
// e.g., g_0_1, g_0_2 can have at most one be true
// !g_0_1 + !g_0_2
for( int h = 0; h < spec.nr_nontriv; h++ )
{
for( int i = 0; i < spec.nr_steps - 1; i++ )
{
for( int j = i + 1; j < spec.nr_steps; j++ )
{
pLits[0] = pabc::Abc_Var2Lit( get_out_var( spec, h, i ), 1 );
pLits[1] = pabc::Abc_Var2Lit( get_out_var( spec, h, j ), 1 );
status &= solver->add_clause( pLits, pLits + 2 );
}
}
}
}
//At least one of the outputs has to refer to the final
//operator
const auto last_op = spec.nr_steps - 1;
for( int h = 0; h < spec.nr_nontriv; h++ )
{
pabc::Vec_IntSetEntry( vLits, h, pabc::Abc_Var2Lit( get_out_var( spec, h, last_op ), 0 ) );
}
status &= solver->add_clause(
pabc::Vec_IntArray( vLits ),
pabc::Vec_IntArray( vLits ) + spec.nr_nontriv );
if( print_clause )
{
std::cout << "Add clause: ";
for( int h = 0; h < spec.nr_nontriv; h++ )
{
std::cout << " " << get_out_var( spec, h, last_op );
}
std::cout << std::endl;
}
return status;
}
std::vector<int> idx_to_op_var( const spec& spec, const std::vector<int>& set, const int i )
{
std::vector<int> r;
for( const auto e : set )
{
r.push_back( get_op_var( spec, i, e ) );
}
return r;
}
std::vector<int> get_set_diff( const std::vector<int>& onset )
{
std::vector<int> all;
all.resize( 4 );
std::iota( all.begin(), all.end(), 0 );
if( onset.size() == 0 )
{
return all;
}
std::vector<int> diff;
std::set_difference(all.begin(), all.end(), onset.begin(), onset.end(),
std::inserter(diff, diff.begin()));
return diff;
}
/*
* for the select variable S_i_jkl
* */
bool add_consistency_clause(
const spec& spec,
const int t,
const int i,
const int j,
const int k,
const int l,
const int s, //sel var
const std::vector<int> entry, //truth table entry
const std::vector<int> onset, //the entry to make which ops on
const std::vector<int> offset //the entry to make which ops off
)
{
int ctr = 0;
assert( entry.size() == 3 );
/* truth table computation main */
if (j <= spec.nr_in)
{
if ((((t + 1) & (1 << (j - 1))) ? 1 : 0) != entry[2]) { return true; }
}
else
{
pLits[ctr++] = pabc::Abc_Var2Lit( get_sim_var(spec, j - spec.nr_in - 1, t), entry[2] );
}
if (k <= spec.nr_in)
{
if ((((t + 1) & (1 << (k - 1))) ? 1 : 0) != entry[1] ) { return true; }
}
else
{
pLits[ctr++] = pabc::Abc_Var2Lit( get_sim_var(spec, k - spec.nr_in - 1, t), entry[1] );
}
if (l <= spec.nr_in)
{
if ((((t + 1) & (1 << (l - 1))) ? 1 : 0) != entry[0] ) { return true; }
}
else
{
pLits[ctr++] = pabc::Abc_Var2Lit( get_sim_var(spec, l - spec.nr_in - 1, t), entry[0] );
}
/********************************************************************************************
* impossibility clauses, 000 results all offset....
* *****************************************************************************************/
if( onset.size() == 0 || offset.size() == 0)
{
auto a = ( onset.size() == 0 ) ? 1 : 0;
pLits[ctr++] = pabc::Abc_Var2Lit(s, 1);
pLits[ctr++] = pabc::Abc_Var2Lit(get_sim_var(spec, i, t), a);
auto ret = solver->add_clause(pLits, pLits + ctr);
if( print_clause ) { print_sat_clause( solver, pLits, pLits + ctr ); }
if( write_cnf_file ) { add_print_clause( clauses, pLits, pLits + ctr ); }
return ret;
}
int ctr_idx_main = ctr;
/* output 1 */
pLits[ctr++] = pabc::Abc_Var2Lit(s, 1 );
pLits[ctr++] = pabc::Abc_Var2Lit(get_sim_var(spec, i, t), 1);
for( const auto onvar : onset )
{
pLits[ctr++] = pabc::Abc_Var2Lit( onvar, 0 );
}
auto ret = solver->add_clause(pLits, pLits + ctr);
if( print_clause ) { print_sat_clause( solver, pLits, pLits + ctr ); }
if( write_cnf_file ) { add_print_clause( clauses, pLits, pLits + ctr ); }
for( const auto offvar : offset )
{
pLits[ctr_idx_main + 2] = pabc::Abc_Var2Lit( offvar, 1 );
ret &= solver->add_clause(pLits, pLits + ctr_idx_main + 3 );
if( print_clause ) { print_sat_clause( solver, pLits, pLits + ctr_idx_main + 3 ); }
if( write_cnf_file ) { add_print_clause( clauses, pLits, pLits + ctr_idx_main + 3 ); }
}
/* output 0 */
pLits[ctr_idx_main + 1] = pabc::Abc_Var2Lit(get_sim_var(spec, i, t), 0 );
ctr = ctr_idx_main + 2;
for( const auto offvar : offset )
{
pLits[ctr++] = pabc::Abc_Var2Lit( offvar, 0 );
}
ret = solver->add_clause(pLits, pLits + ctr);
if( print_clause ) { print_sat_clause( solver, pLits, pLits + ctr ); }
if( write_cnf_file ) { add_print_clause( clauses, pLits, pLits + ctr ); }
for( const auto onvar : onset )
{
pLits[ctr_idx_main + 2] = pabc::Abc_Var2Lit( onvar, 1 );
ret &= solver->add_clause(pLits, pLits + ctr_idx_main + 3 );
if( print_clause ) { print_sat_clause( solver, pLits, pLits + ctr_idx_main + 3 ); }
if( write_cnf_file ) { add_print_clause( clauses, pLits, pLits + ctr_idx_main + 3 ); }
}
assert(ret);
return ret;
}
bool is_element_duplicate( const std::vector<unsigned>& array )
{
auto copy = array;
copy.erase( copy.begin() ); //remove the first element that indicates step index
auto last = std::unique( copy.begin(), copy.end() );
return ( last == copy.end() ) ? false : true;
}
bool add_consistency_clause_init( const spec& spec, const int t, std::pair<int, std::vector<unsigned>> svar )
{
auto ret = true;
/* for sel val S_i_jkl*/
auto s = svar.first;
auto array = svar.second;
auto i = array[0];
auto j = array[1];
auto k = array[2];
auto l = array[3];
std::map<std::vector<int>, std::vector<int>> input_set_map;
if( j != 0 ) /* no consts */
{
input_set_map = comput_input_and_set_map3( none_const );
}
else if( j == 0)
{
input_set_map = comput_input_and_set_map3( first_const );
}
else
{
assert( false && "the selection variable is not supported." );
}
/* entrys, onset, offset */
for( const auto e : input_set_map )
{
auto entry = e.first;
auto onset = e.second;
auto offset = get_set_diff( onset );
ret &= add_consistency_clause( spec, t, i, j, k, l, s, entry,
idx_to_op_var( spec, onset, i ),
idx_to_op_var( spec, offset, i ) );
}
return ret;
}
bool create_tt_clauses(const spec& spec, const int t)
{
bool ret = true;
for( const auto svar : sel_map )
{
ret &= add_consistency_clause_init( spec, t, svar );
}
//ret &= fix_output_sim_vars(spec, t);
for( int h = 0; h < spec.nr_nontriv; h++ )
{
for( int i = 0; i < spec.nr_steps; i++ )
{
ret &= multi_fix_output_sim_vars( spec, h, i, t );
}
}
return ret;
}
bool fence_create_tt_clauses(const spec& spec, const int t)
{
bool ret = true;
for (int i = 0; i < spec.nr_steps; i++)
{
const auto level = get_level(spec, i + spec.nr_in + 1);
int ctr = 0;
for (int l = first_step_on_level(level - 1); l < first_step_on_level(level); l++)
{
for (int k = 1; k < l; k++)
{
for (int j = 0; j < k; j++)
{
const auto sel_var = get_sel_var(spec, i, ctr++);
std::pair<int, std::vector<unsigned>> v;
v.first = sel_var;
v.second.push_back(i);
v.second.push_back(j);
v.second.push_back(k);
v.second.push_back(l);
ret &= add_consistency_clause_init( spec, t, v );
}
}
}
assert(ret);
}
ret &= fix_output_sim_vars(spec, t);
return ret;
}
void create_main_clauses( const spec& spec )
{
for( int t = 0; t < spec.tt_size; t++ )
{
(void) create_tt_clauses( spec, t );
}
}
bool fence_create_main_clauses(const spec& spec)
{
bool ret = true;
for (int t = 0; t < spec.tt_size; t++)
{
ret &= fence_create_tt_clauses(spec, t);
}
return ret;
}
//block solution
bool block_solution(const spec& spec)
{
int ctr = 0;
int svar = 0;
for (int i = 0; i < spec.nr_steps; i++)
{
auto num_svar_in_current_step = comput_select_vars_for_each_step3( spec.nr_steps, spec.nr_in, i );
for( int j = svar; j < svar + num_svar_in_current_step; j++ )
{
//std::cout << "var: " << j << std::endl;
if( solver->var_value( j ) )
{
pLits[ctr++] = pabc::Abc_Var2Lit(j, 1);
break;
}
}
svar += num_svar_in_current_step;
}
assert(ctr == spec.nr_steps);
return solver->add_clause(pLits, pLits + ctr);
}
bool encode( const spec& spec )
{
if( write_cnf_file )
{
f = fopen( "out.cnf", "w" );
if( f == NULL )
{
printf( "Cannot open output cnf file\n" );
assert( false );
}
clauses.clear();
}
assert( spec.nr_in >= 3 );
create_variables( spec );
create_main_clauses( spec );
if( !create_output_clauses( spec ) )
{
return false;
}
if( !create_fanin_clauses( spec ) )
{
return false;
}
if (spec.add_alonce_clauses)
{
create_alonce_clauses(spec);
}
if (spec.add_colex_clauses)
{
create_colex_clauses(spec);
}
if (spec.add_lex_func_clauses)
{
create_lex_func_clauses(spec);
}
if (spec.add_symvar_clauses && !create_symvar_clauses(spec))
{
return false;
}
if( print_clause )
{
show_variable_correspondence( spec );
}
if( write_cnf_file )
{
to_dimacs( f, solver, clauses );
fclose( f );
}
return true;
}
bool encode(const spec& spec, const fence& f)
{
assert(spec.nr_in >= 3);
assert(spec.nr_steps == f.nr_nodes());
update_level_map(spec, f);
fence_create_variables(spec);
if (!fence_create_main_clauses(spec))
{
return false;
}
if (spec.add_alonce_clauses)
{
fence_create_alonce_clauses(spec);
}
if (spec.add_colex_clauses)
{
fence_create_colex_clauses(spec);
}
if (spec.add_lex_func_clauses)
{
fence_create_lex_func_clauses(spec);
}
if (spec.add_symvar_clauses)
{
fence_create_symvar_clauses(spec);
}
fence_create_fanin_clauses(spec);
return true;
}
bool cegar_encode( const spec& spec )
{
if( write_cnf_file )
{
f = fopen( "out.cnf", "w" );
if( f == NULL )
{
printf( "Cannot open output cnf file\n" );
assert( false );
}
clauses.clear();
}
assert( spec.nr_in >= 3 );
create_variables( spec );
if( !create_fanin_clauses( spec ) )
{
return false;
}
if( !create_output_clauses( spec ) )
{
return false;
}
if (spec.add_alonce_clauses)
{
create_alonce_clauses(spec);
}
if (spec.add_colex_clauses)
{
create_colex_clauses(spec);
}
if (spec.add_lex_func_clauses)
{
create_lex_func_clauses(spec);
}
if (spec.add_symvar_clauses && !create_symvar_clauses(spec))
{
return false;
}
if( print_clause )
{
show_variable_correspondence( spec );
}
if( write_cnf_file )
{
to_dimacs( f, solver, clauses );
fclose( f );
}
return true;
}
void create_cardinality_constraints(const spec& spec)
{
std::vector<int> svars;
std::vector<int> rvars;
for (int i = 0; i < spec.nr_steps; i++)
{
svars.clear();
rvars.clear();
const auto level = get_level(spec, spec.nr_in + i + 1);
auto svar_ctr = 0;
for (int l = first_step_on_level(level - 1); l < first_step_on_level(level); l++)
{
for (int k = 1; k < l; k++)
{
for (int j = 0; j < k; j++)
{
const auto sel_var = get_sel_var(spec, i, svar_ctr++);
svars.push_back(sel_var);
}
}
}
assert(svars.size() == nr_svars_for_step(spec, i));
const auto nr_res_vars = (1 + 2) * (svars.size() + 1);
for (int j = 0; j < nr_res_vars; j++)
{
rvars.push_back(get_res_var(spec, i, j));
}
create_cardinality_circuit(solver, svars, rvars, 1);
// Ensure that the fanin cardinality for each step i
// is exactly FI.
const auto fi_var =
get_res_var(spec, i, svars.size() * (1 + 2) + 1);
auto fi_lit = pabc::Abc_Var2Lit(fi_var, 0);
(void)solver->add_clause(&fi_lit, &fi_lit + 1);
}
}
bool cegar_encode(const spec& spec, const fence& f)
{
update_level_map(spec, f);
cegar_fence_create_variables(spec);
fence_create_fanin_clauses(spec);
create_cardinality_constraints(spec);
if (spec.add_alonce_clauses)
{
fence_create_alonce_clauses(spec);
}
if (spec.add_colex_clauses)
{
fence_create_colex_clauses(spec);
}
if (spec.add_lex_func_clauses)
{
fence_create_lex_func_clauses(spec);
}
if (spec.add_symvar_clauses)
{
fence_create_symvar_clauses(spec);
}
return true;
}
void construct_mig( const spec& spec, mig_network& mig )
{
//to be implement
}
void extract_mig3(const spec& spec, mig3& chain )
{
int op_inputs[3] = { 0, 0, 0 };
chain.reset( spec.nr_in, spec.get_nr_out(), spec.nr_steps );
int svar = 0;
for (int i = 0; i < spec.nr_steps; i++)
{
int op = 0;
for (int j = 0; j < MIG_OP_VARS_PER_STEP; j++)
{
if ( solver->var_value( get_op_var( spec, i, j ) ) )
{
op = j;
break;
}
}
auto num_svar_in_current_step = comput_select_vars_for_each_step3( spec.nr_steps, spec.nr_in, i );
for( int j = svar; j < svar + num_svar_in_current_step; j++ )
{
if( solver->var_value( j ) )
{
auto array = sel_map[j];
op_inputs[0] = array[1];
op_inputs[1] = array[2];
op_inputs[2] = array[3];
break;
}
}
svar += num_svar_in_current_step;
chain.set_step(i, op_inputs[0], op_inputs[1], op_inputs[2], op);
if( spec.verbosity > 2 )
{
printf("[i] Step %d performs op %d, inputs are:%d%d%d\n", i, op, op_inputs[0], op_inputs[1], op_inputs[2] );
}
}
//set outputs
auto triv_count = 0;
auto nontriv_count = 0;
for( int h = 0; h < spec.get_nr_out(); h++ )
{
if( ( spec.triv_flag >> h ) & 1 )
{
chain.set_output( h, ( spec.triv_func( triv_count++ ) << 1 ) + ( ( spec.out_inv >> h ) & 1 ) );
if( spec.verbosity > 2 )
{
printf( "[i] PO %d is a trivial function.\n" );
}
continue;
}
for( int i = 0; i < spec.nr_steps; i++ )
{
if( solver->var_value( get_out_var( spec, nontriv_count, i ) ) )
{
chain.set_output( h, (( i + spec.get_nr_in() + 1 ) << 1 ) + (( spec.out_inv >> h ) & 1 ) );
if( spec.verbosity > 2 )
{
printf("[i] PO %d is step %d\n", h, spec.nr_in + i + 1 );
}
nontriv_count++;
break;
}
}
}
}
void fence_extract_mig3(const spec& spec, mig3& chain)
{
int op_inputs[3] = { 0, 0, 0 };
chain.reset(spec.nr_in, 1, spec.nr_steps);
for (int i = 0; i < spec.nr_steps; i++)
{
int op = 0;
for (int j = 0; j < MIG_OP_VARS_PER_STEP; j++)
{
if (solver->var_value(get_op_var(spec, i, j)))
{
op = j;
break;
}
}
int ctr = 0;
const auto level = get_level(spec, spec.nr_in + i + 1);
for (int l = first_step_on_level(level - 1); l < first_step_on_level(level); l++)
{
for (int k = 1; k < l; k++)
{
for (int j = 0; j < k; j++)
{
const auto sel_var = get_sel_var(spec, i, ctr++);
if (solver->var_value(sel_var))
{
op_inputs[0] = j;
op_inputs[1] = k;
op_inputs[2] = l;
break;
}
}
}
}
chain.set_step(i, op_inputs[0], op_inputs[1], op_inputs[2], op);
}
chain.set_output(0,
((spec.nr_steps + spec.nr_in) << 1) +
((spec.out_inv) & 1));
}
/*
* additional constraints for symmetry breaking
* */
void create_alonce_clauses(const spec& spec)
{
for (int i = 0; i < spec.nr_steps - 1; i++)
{
int ctr = 0;
const auto idx = spec.nr_in + i + 1;
for (int ip = i + 1; ip < spec.nr_steps; ip++)
{
for (int l = spec.nr_in + i; l <= spec.nr_in + ip; l++)
{
for (int k = 1; k < l; k++)
{
for (int j = 0; j < k; j++)
{
if (j == idx || k == idx || l == idx)
{
const auto sel_var = get_sel_var( ip, j, k, l);
pLits[ctr++] = pabc::Abc_Var2Lit(sel_var, 0);
}
}
}
}
}
const auto res = solver->add_clause(pLits, pLits + ctr);
assert(res);
}
}
void fence_create_alonce_clauses(const spec& spec)
{
for (int i = 0; i < spec.nr_steps - 1; i++) {
auto ctr = 0;
const auto idx = spec.nr_in + i + 1;
const auto level = get_level(spec, idx);
for (int ip = i + 1; ip < spec.nr_steps; ip++) {
auto levelp = get_level(spec, ip + spec.nr_in + 1);
assert(levelp >= level);
if (levelp == level) {
continue;
}
auto svctr = 0;
for (int l = first_step_on_level(levelp - 1);
l < first_step_on_level(levelp); l++) {
for (int k = 1; k < l; k++) {
for (int j = 0; j < k; j++) {
if (j == idx || k == idx || l == idx) {
const auto sel_var = get_sel_var(spec, ip, svctr);
pLits[ctr++] = pabc::Abc_Var2Lit(sel_var, 0);
}
svctr++;
}
}
}
assert(svctr == nr_svars_for_step(spec, ip));
}
solver->add_clause(pLits, pLits + ctr);
}
}
void create_colex_clauses(const spec& spec)
{
for (int i = 0; i < spec.nr_steps - 1; i++)
{
for (int l = 2; l <= spec.nr_in + i; l++)
{
for (int k = 1; k < l; k++)
{
for (int j = 0; j < k; j++)
{
pLits[0] = pabc::Abc_Var2Lit(get_sel_var( i, j, k, l), 1);
// Cannot have lp < l
for (int lp = 2; lp < l; lp++)
{
for (int kp = 1; kp < lp; kp++)
{
for (int jp = 0; jp < kp; jp++)
{
pLits[1] = pabc::Abc_Var2Lit(get_sel_var( i + 1, jp, kp, lp), 1);
const auto res = solver->add_clause(pLits, pLits + 2);
assert(res);
}
}
}
// May have lp == l and kp > k
for (int kp = 1; kp < k; kp++)
{
for (int jp = 0; jp < kp; jp++)
{
pLits[1] = pabc::Abc_Var2Lit(get_sel_var( i + 1, jp, kp, l), 1);
const auto res = solver->add_clause(pLits, pLits + 2);
assert(res);
}
}
// OR lp == l and kp == k
for (int jp = 0; jp < j; jp++)
{
pLits[1] = pabc::Abc_Var2Lit(get_sel_var( i + 1, jp, k, l), 1);
const auto res = solver->add_clause(pLits, pLits + 2);
assert(res);
}
}
}
}
}
}
void fence_create_colex_clauses(const spec& spec)
{
for (int i = 0; i < spec.nr_steps - 1; i++)
{
const auto level = get_level(spec, i + spec.nr_in + 1);
const auto levelp = get_level(spec, i + 1 + spec.nr_in + 1);
int svar_ctr = 0;
for (int l = first_step_on_level(level-1);
l < first_step_on_level(level); l++)
{
for (int k = 1; k < l; k++)
{
for (int j = 0; j < k; j++)
{
if (l < 3)
{
svar_ctr++;
continue;
}
const auto sel_var = get_sel_var(spec, i, svar_ctr);
pLits[0] = pabc::Abc_Var2Lit(sel_var, 1);
int svar_ctrp = 0;
for (int lp = first_step_on_level(levelp - 1);
lp < first_step_on_level(levelp); lp++)
{
for (int kp = 1; kp < lp; kp++)
{
for (int jp = 0; jp < kp; jp++)
{
if ((lp == l && kp == k && jp < j) || (lp == l && kp < k) || (lp < l))
{
const auto sel_varp = get_sel_var(spec, i + 1, svar_ctrp);
pLits[1] = pabc::Abc_Var2Lit(sel_varp, 1);
(void)solver->add_clause(pLits, pLits + 2);
}
svar_ctrp++;
}
}
}
svar_ctr++;
}
}
}
}
}
void create_lex_func_clauses(const spec& spec)
{
for (int i = 0; i < spec.nr_steps - 1; i++)
{
for (int l = 2; l <= spec.nr_in + i; l++)
{
for (int k = 1; k < l; k++)
{
for (int j = 0; j < k; j++)
{
pLits[0] = pabc::Abc_Var2Lit(get_sel_var(i, j, k, l), 1);
pLits[1] = pabc::Abc_Var2Lit(get_sel_var(i + 1, j, k, l), 1);
pLits[2] = pabc::Abc_Var2Lit(get_op_var(spec, i, 3), 1);
pLits[3] = pabc::Abc_Var2Lit(get_op_var(spec, i + 1, 3), 1);
auto status = solver->add_clause(pLits, pLits + 4);
assert(status);
pLits[2] = pabc::Abc_Var2Lit(get_op_var(spec, i, 2), 1);
pLits[3] = pabc::Abc_Var2Lit(get_op_var(spec, i + 1, 0), 0);
pLits[4] = pabc::Abc_Var2Lit(get_op_var(spec, i + 1, 1), 0);
status = solver->add_clause(pLits, pLits + 5);
assert(status);
pLits[2] = pabc::Abc_Var2Lit(get_op_var(spec, i, 1), 1);
pLits[3] = pabc::Abc_Var2Lit(get_op_var(spec, i + 1, 0), 0);
status = solver->add_clause(pLits, pLits + 4);
assert(status);
pLits[2] = pabc::Abc_Var2Lit(get_op_var(spec, i, 0), 1);
status = solver->add_clause(pLits, pLits + 3);
assert(status);
}
}
}
}
}
void fence_create_lex_func_clauses(const spec& spec)
{
for (int i = 0; i < spec.nr_steps - 1; i++)
{
const auto level = get_level(spec, spec.nr_in + i + 1);
const auto levelp = get_level(spec, spec.nr_in + i + 2);
int svar_ctr = 0;
for (int l = first_step_on_level(level - 1);
l < first_step_on_level(level); l++)
{
for (int k = 1; k < l; k++)
{
for (int j = 0; j < k; j++)
{
const auto sel_var = get_sel_var(spec, i, svar_ctr++);
pLits[0] = pabc::Abc_Var2Lit(sel_var, 1);
int svar_ctrp = 0;
for (int lp = first_step_on_level(levelp - 1);
lp < first_step_on_level(levelp); lp++)
{
for (int kp = 1; kp < lp; kp++)
{
for (int jp = 0; jp < kp; jp++)
{
const auto sel_varp = get_sel_var(spec, i + 1, svar_ctrp++);
if (j != jp || k != kp || l != lp)
{
continue;
}
pLits[1] = pabc::Abc_Var2Lit(sel_varp, 1);
pLits[2] = pabc::Abc_Var2Lit(get_op_var(spec, i, 3), 1);
pLits[3] = pabc::Abc_Var2Lit(get_op_var(spec, i + 1, 3), 1);
auto status = solver->add_clause(pLits, pLits + 4);
assert(status);
pLits[2] = pabc::Abc_Var2Lit(get_op_var(spec, i, 2), 1);
pLits[3] = pabc::Abc_Var2Lit(get_op_var(spec, i + 1, 0), 0);
pLits[4] = pabc::Abc_Var2Lit(get_op_var(spec, i + 1, 1), 0);
status = solver->add_clause(pLits, pLits + 5);
assert(status);
pLits[2] = pabc::Abc_Var2Lit(get_op_var(spec, i, 1), 1);
pLits[3] = pabc::Abc_Var2Lit(get_op_var(spec, i + 1, 0), 0);
status = solver->add_clause(pLits, pLits + 4);
assert(status);
pLits[2] = pabc::Abc_Var2Lit(get_op_var(spec, i, 0), 1);
status = solver->add_clause(pLits, pLits + 3);
assert(status);
}
}
}
}
}
}
}
}
bool create_symvar_clauses(const spec& spec)
{
for (int q = 2; q <= spec.nr_in; q++)
{
for (int p = 1; p < q; p++)
{
auto symm = true;
for (int i = 0; i < spec.nr_nontriv; i++)
{
auto f = spec[spec.synth_func(i)];
if (!(swap(f, p - 1, q - 1) == f))
{
symm = false;
break;
}
}
if (!symm)
{
continue;
}
for (int i = 1; i < spec.nr_steps; i++)
{
for (int l = 2; l <= spec.nr_in + i; l++)
{
for (int k = 1; k < l; k++)
{
for (int j = 0; j < k; j++)
{
if (!(j == q || k == q || l == q) || (j == p || k == p))
{
continue;
}
pLits[0] = pabc::Abc_Var2Lit(get_sel_var(i, j, k, l), 1);
auto ctr = 1;
for (int ip = 0; ip < i; ip++)
{
for (int lp = 2; lp <= spec.nr_in + ip; lp++)
{
for (int kp = 1; kp < lp; kp++)
{
for (int jp = 0; jp < kp; jp++)
{
if (jp == p || kp == p || lp == p)
{
pLits[ctr++] = pabc::Abc_Var2Lit(get_sel_var(ip, jp, kp, lp), 0);
}
}
}
}
}
if (!solver->add_clause(pLits, pLits + ctr)) {
return false;
}
}
}
}
}
}
}
return true;
}
void fence_create_symvar_clauses(const spec& spec)
{
for (int q = 2; q <= spec.nr_in; q++) {
for (int p = 1; p < q; p++) {
auto symm = true;
for (int i = 0; i < spec.nr_nontriv; i++) {
auto& f = spec[spec.synth_func(i)];
if (!(swap(f, p - 1, q - 1) == f)) {
symm = false;
break;
}
}
if (!symm) {
continue;
}
for (int i = 1; i < spec.nr_steps; i++) {
const auto level = get_level(spec, i + spec.nr_in + 1);
int svar_ctr = 0;
for (int l = first_step_on_level(level - 1);
l < first_step_on_level(level); l++) {
for (int k = 1; k < l; k++) {
for (int j = 0; j < k; j++) {
if (!(j == q || k == q || l == q) || (j == p || k == p)) {
svar_ctr++;
continue;
}
const auto sel_var = get_sel_var(spec, i, svar_ctr);
pLits[0] = pabc::Abc_Var2Lit(sel_var, 1);
auto ctr = 1;
for (int ip = 0; ip < i; ip++) {
const auto levelp = get_level(spec, spec.nr_in + ip + 1);
auto svar_ctrp = 0;
for (int lp = first_step_on_level(levelp - 1);
lp < first_step_on_level(levelp); lp++) {
for (int kp = 1; kp < lp; kp++) {
for (int jp = 0; jp < kp; jp++) {
if (jp == p || kp == p || lp == p) {
const auto sel_varp = get_sel_var(spec, ip, svar_ctrp);
pLits[ctr++] = pabc::Abc_Var2Lit(sel_varp, 0);
}
svar_ctrp++;
}
}
}
}
(void)solver->add_clause(pLits, pLits + ctr);
svar_ctr++;
}
}
}
}
}
}
}
/* end of symmetry breaking clauses */
bool is_dirty()
{
return dirty;
}
void set_dirty(bool _dirty)
{
dirty = _dirty;
}
void set_print_clause(bool _print_clause)
{
print_clause = _print_clause;
}
int get_maj_input()
{
return maj_input;
}
void set_maj_input( int _maj_input )
{
maj_input = _maj_input;
}
};
/******************************************************************************
* Public functions *
******************************************************************************/
synth_result mig_three_synthesize( spec& spec, mig3& mig3, solver_wrapper& solver, mig_three_encoder& encoder )
{
spec.preprocess();
// The special case when the Boolean chain to be synthesized
// consists entirely of trivial functions.
if (spec.nr_triv == spec.get_nr_out())
{
spec.nr_steps = 0;
mig3.reset(spec.get_nr_in(), spec.get_nr_out(), 0);
for (int h = 0; h < spec.get_nr_out(); h++)
{
mig3.set_output(h, (spec.triv_func(h) << 1) +
((spec.out_inv >> h) & 1));
}
return success;
}
spec.nr_steps = spec.initial_steps;
while( true )
{
solver.restart();
if( !encoder.encode( spec ) )
{
spec.nr_steps++;
break;
}
const auto status = solver.solve( spec.conflict_limit );
if( status == success )
{
//encoder.show_verbose_result();
encoder.extract_mig3( spec, mig3 );
return success;
}
else if( status == failure )
{
spec.nr_steps++;
if( spec.nr_steps == 20 )
{
break;
}
}
else
{
return timeout;
}
}
return success;
}
/* cegar synthesis */
synth_result mig_three_cegar_synthesize( spec& spec, mig3& mig3, solver_wrapper& solver, mig_three_encoder& encoder )
{
spec.preprocess();
// The special case when the Boolean chain to be synthesized
// consists entirely of trivial functions.
if (spec.nr_triv == spec.get_nr_out())
{
spec.nr_steps = 0;
mig3.reset(spec.get_nr_in(), spec.get_nr_out(), 0);
for (int h = 0; h < spec.get_nr_out(); h++)
{
mig3.set_output(h, (spec.triv_func(h) << 1) +
((spec.out_inv >> h) & 1));
}
return success;
}
spec.nr_steps = spec.initial_steps;
while( true )
{
solver.restart();
if( !encoder.cegar_encode( spec ) )
{
spec.nr_steps++;
continue;
}
while( true )
{
const auto status = solver.solve( spec.conflict_limit );
if( status == success )
{
encoder.extract_mig3( spec, mig3 );
auto sim_tt = mig3.simulate()[0];
auto xot_tt = sim_tt ^ ( spec[0] );
auto first_one = kitty::find_first_one_bit( xot_tt );
if( first_one == -1 )
{
return success;
}
if( !encoder.create_tt_clauses( spec, first_one - 1 ) )
{
spec.nr_steps++;
break;
}
}
else if( status == failure )
{
spec.nr_steps++;
if( spec.nr_steps == 10 )
{
break;
}
break;
}
else
{
return timeout;
}
}
}
return success;
}
/* cegar synthesis for approximate computing
* Given a n-bit truth table, and the allowed error rate, say
* 10%, then the synthesized tt is acceptable for n * (1 - 10%)
* * n correct outputs.
* */
synth_result mig_three_cegar_approximate_synthesize( spec& spec, mig3& mig3, solver_wrapper& solver, mig_three_encoder& encoder, float error_rate )
{
spec.preprocess();
int error_thres = ( spec.tt_size + 1 ) * error_rate;
std::cout << " tt_size: " << spec.tt_size + 1
<< " error_thres: " << error_thres << std::endl;
// The special case when the Boolean chain to be synthesized
// consists entirely of trivial functions.
if (spec.nr_triv == spec.get_nr_out())
{
spec.nr_steps = 0;
mig3.reset(spec.get_nr_in(), spec.get_nr_out(), 0);
for (int h = 0; h < spec.get_nr_out(); h++)
{
mig3.set_output(h, (spec.triv_func(h) << 1) +
((spec.out_inv >> h) & 1));
}
return success;
}
spec.nr_steps = spec.initial_steps;
while( true )
{
solver.restart();
if( !encoder.cegar_encode( spec ) )
{
spec.nr_steps++;
continue;
}
while( true )
{
const auto status = solver.solve( spec.conflict_limit );
if( status == success )
{
encoder.extract_mig3( spec, mig3 );
auto sim_tt = mig3.simulate()[0];
auto xor_tt = sim_tt ^ ( spec[0] );
auto first_one = kitty::find_first_one_bit( xor_tt );
auto num_diff = kitty::count_ones( xor_tt );
std::cout << "[i] step: " << spec.nr_steps << " #errors: " << num_diff << std::endl;
if( num_diff <= error_thres )
{
return success;
}
if( !encoder.create_tt_clauses( spec, first_one - 1 ) )
{
spec.nr_steps++;
break;
}
}
else if( status == failure )
{
spec.nr_steps++;
if( spec.nr_steps == 10 )
{
break;
}
break;
}
else
{
return timeout;
}
}
std::cout << std::endl;
}
return success;
}
synth_result next_solution( spec& spec, mig3& mig3, solver_wrapper& solver, mig_three_encoder& encoder )
{
//spec.verbosity = 3;
if (!encoder.is_dirty())
{
encoder.set_dirty(true);
return mig_three_synthesize(spec, mig3, solver, encoder);
}
// The special case when the Boolean chain to be synthesized
// consists entirely of trivial functions.
// In this case, only one solution exists.
if (spec.nr_triv == spec.get_nr_out()) {
return failure;
}
if (encoder.block_solution(spec))
{
const auto status = solver.solve(spec.conflict_limit);
if (status == success)
{
encoder.extract_mig3(spec, mig3);
return success;
}
else
{
return status;
}
}
return failure;
}
synth_result mig_three_fence_synthesize(spec& spec, mig3& mig3, solver_wrapper& solver, mig_three_encoder& encoder)
{
spec.preprocess();
// The special case when the Boolean chain to be synthesized
// consists entirely of trivial functions.
if (spec.nr_triv == spec.get_nr_out())
{
spec.nr_steps = 0;
mig3.reset(spec.get_nr_in(), spec.get_nr_out(), 0);
for (int h = 0; h < spec.get_nr_out(); h++)
{
mig3.set_output(h, (spec.triv_func(h) << 1) +
((spec.out_inv >> h) & 1));
}
return success;
}
// As the topological synthesizer decomposes the synthesis
// problem, to fairly count the total number of conflicts we
// should keep track of all conflicts in existence checks.
fence f;
po_filter<unbounded_generator> g( unbounded_generator(spec.initial_steps), spec.get_nr_out(), 3);
auto fence_ctr = 0;
while (true)
{
++fence_ctr;
g.next_fence(f);
spec.nr_steps = f.nr_nodes();
solver.restart();
if (!encoder.encode(spec, f))
{
continue;
}
if (spec.verbosity)
{
printf("next fence (%d):\n", fence_ctr);
print_fence(f);
printf("\n");
printf("nr_nodes=%d, nr_levels=%d\n", f.nr_nodes(),
f.nr_levels());
for (int i = 0; i < f.nr_levels(); i++) {
printf("f[%d] = %d\n", i, f[i]);
}
}
auto status = solver.solve(spec.conflict_limit);
if (status == success)
{
std::cout << " success " << std::endl;
encoder.fence_extract_mig3(spec, mig3);
//encoder.show_variable_correspondence( spec );
//encoder.show_verbose_result();
return success;
}
else if (status == failure)
{
continue;
}
else
{
return timeout;
}
}
}
synth_result mig_three_cegar_fence_synthesize( spec& spec, mig3& mig3, solver_wrapper& solver, mig_three_encoder& encoder)
{
assert(spec.get_nr_in() >= spec.fanin);
spec.preprocess();
// The special case when the Boolean chain to be synthesized
// consists entirely of trivial functions.
if (spec.nr_triv == spec.get_nr_out()) {
spec.nr_steps = 0;
mig3.reset(spec.get_nr_in(), spec.get_nr_out(), 0);
for (int h = 0; h < spec.get_nr_out(); h++) {
mig3.set_output(h, (spec.triv_func(h) << 1) +
((spec.out_inv >> h) & 1));
}
return success;
}
fence f;
po_filter<unbounded_generator> g( unbounded_generator(spec.initial_steps), spec.get_nr_out(), 3);
int fence_ctr = 0;
while (true)
{
++fence_ctr;
g.next_fence(f);
spec.nr_steps = f.nr_nodes();
if (spec.verbosity)
{
printf(" next fence (%d):\n", fence_ctr);
print_fence(f);
printf("\n");
printf("nr_nodes=%d, nr_levels=%d\n", f.nr_nodes(),
f.nr_levels());
for (int i = 0; i < f.nr_levels(); i++) {
printf("f[%d] = %d\n", i, f[i]);
}
}
solver.restart();
if (!encoder.cegar_encode(spec, f))
{
continue;
}
while (true)
{
auto status = solver.solve(spec.conflict_limit);
if (status == success)
{
encoder.fence_extract_mig3(spec, mig3);
auto sim_tt = mig3.simulate()[0];
//auto sim_tt = encoder.simulate(spec);
//if (spec.out_inv) {
// sim_tt = ~sim_tt;
//}
auto xor_tt = sim_tt ^ (spec[0]);
auto first_one = kitty::find_first_one_bit(xor_tt);
if (first_one == -1)
{
return success;
}
if (!encoder.fence_create_tt_clauses(spec, first_one - 1))
{
break;
}
}
else if (status == failure)
{
break;
}
else
{
return timeout;
}
}
}
}
/* parallel fence-based synthesis */
/// Performs fence-based parallel synthesis.
/// One thread generates fences and places them on a concurrent
/// queue. The remaining threads dequeue fences and try to
/// synthesize chains with them.
synth_result parallel_nocegar_mig_three_fence_synthesize( spec& spec, mig3& mig3,
int num_threads = std::thread::hardware_concurrency() )
{
spec.preprocess();
// The special case when the Boolean chain to be synthesized
// consists entirely of trivial functions.
if (spec.nr_triv == spec.get_nr_out()) {
spec.nr_steps = 0;
mig3.reset(spec.get_nr_in(), spec.get_nr_out(), 0);
for (int h = 0; h < spec.get_nr_out(); h++) {
mig3.set_output(h, (spec.triv_func(h) << 1) +
((spec.out_inv >> h) & 1));
}
return success;
}
std::vector<std::thread> threads(num_threads);
moodycamel::ConcurrentQueue<fence> q(num_threads * 3);
bool finished_generating = false;
bool* pfinished = &finished_generating;
bool found = false;
bool* pfound = &found;
std::mutex found_mutex;
spec.fanin = 3;
spec.nr_steps = spec.initial_steps;
while (true)
{
for (int i = 0; i < num_threads; i++)
{
//std::cout << "thread: " << i << std::endl;
threads[i] = std::thread([&spec, pfinished, pfound, &found_mutex, &mig3, &q]
{
bmcg_wrapper solver;
mig_three_encoder encoder(solver);
fence local_fence;
while (!(*pfound))
{
if (!q.try_dequeue(local_fence))
{
if (*pfinished)
{
std::this_thread::yield();
if (!q.try_dequeue(local_fence))
{
break;
}
}
else
{
std::this_thread::yield();
continue;
}
}
if (spec.verbosity)
{
std::lock_guard<std::mutex> vlock(found_mutex);
printf(" next fence:\n");
print_fence(local_fence);
printf("\n");
printf("nr_nodes=%d, nr_levels=%d\n",
local_fence.nr_nodes(),
local_fence.nr_levels());
}
synth_result status;
solver.restart();
if (!encoder.encode(spec, local_fence))
{
continue;
}
do
{
status = solver.solve(10);
if (*pfound)
{
break;
}
else if (status == success)
{
std::lock_guard<std::mutex> vlock(found_mutex);
if (!(*pfound))
{
encoder.fence_extract_mig3(spec, mig3);
*pfound = true;
}
}
} while (status == timeout);
}
});
}
generate_fences(spec, q);
finished_generating = true;
for (auto& thread : threads)
{
thread.join();
}
if (found)
{
break;
}
finished_generating = false;
spec.nr_steps++;
}
return success;
}
synth_result parallel_mig_three_fence_synthesize( spec& spec, mig3& mig3,
int num_threads = std::thread::hardware_concurrency())
{
spec.preprocess();
// The special case when the Boolean chain to be synthesized
// consists entirely of trivial functions.
if (spec.nr_triv == spec.get_nr_out())
{
spec.nr_steps = 0;
mig3.reset(spec.get_nr_in(), spec.get_nr_out(), 0);
for (int h = 0; h < spec.get_nr_out(); h++)
{
mig3.set_output(h, (spec.triv_func(h) << 1) +
((spec.out_inv >> h) & 1));
}
return success;
}
std::vector<std::thread> threads(num_threads);
moodycamel::ConcurrentQueue<fence> q(num_threads * 3);
bool finished_generating = false;
bool* pfinished = &finished_generating;
bool found = false;
bool* pfound = &found;
std::mutex found_mutex;
spec.nr_rand_tt_assigns = 0;// 2 * spec.get_nr_in();
spec.fanin = 3;
spec.nr_steps = spec.initial_steps;
while (true) {
for (int i = 0; i < num_threads; i++)
{
threads[i] = std::thread([&spec, pfinished, pfound, &found_mutex, &mig3, &q] {
also::mig3 local_mig;
bmcg_wrapper solver;
mig_three_encoder encoder(solver);
fence local_fence;
while (!(*pfound)) {
if (!q.try_dequeue(local_fence)) {
if (*pfinished) {
std::this_thread::yield();
if (!q.try_dequeue(local_fence)) {
break;
}
} else {
std::this_thread::yield();
continue;
}
}
if (spec.verbosity)
{
std::lock_guard<std::mutex> vlock(found_mutex);
printf(" next fence:\n");
print_fence(local_fence);
printf("\n");
printf("nr_nodes=%d, nr_levels=%d\n",
local_fence.nr_nodes(),
local_fence.nr_levels());
}
synth_result status;
solver.restart();
if (!encoder.cegar_encode(spec, local_fence)) {
continue;
}
do {
status = solver.solve(10);
if (*pfound) {
break;
} else if (status == success) {
encoder.fence_extract_mig3(spec, local_mig);
auto sim_tt = local_mig.simulate()[0];
//auto sim_tt = encoder.simulate(spec);
//if (spec.out_inv) {
// sim_tt = ~sim_tt;
//}
auto xor_tt = sim_tt ^ (spec[0]);
auto first_one = kitty::find_first_one_bit(xor_tt);
if (first_one != -1) {
if (!encoder.fence_create_tt_clauses(spec, first_one - 1)) {
break;
}
status = timeout;
continue;
}
std::lock_guard<std::mutex> vlock(found_mutex);
if (!(*pfound)) {
encoder.fence_extract_mig3(spec, mig3);
*pfound = true;
}
}
} while (status == timeout);
}
});
}
generate_fences(spec, q);
finished_generating = true;
for (auto& thread : threads) {
thread.join();
}
if (found) {
break;
}
finished_generating = false;
spec.nr_steps++;
}
return success;
}
}
#endif
| 30.876626
| 150
| 0.442883
|
xianghex
|
7001434bcbafac90ebad440de2c7b993523f8dc4
| 867
|
hpp
|
C++
|
SDK/ARKSurvivalEvolved_BossTeleporter_Dragon_Easy_classes.hpp
|
2bite/ARK-SDK
|
c38ca9925309516b2093ad8c3a70ed9489e1d573
|
[
"MIT"
] | 10
|
2020-02-17T19:08:46.000Z
|
2021-07-31T11:07:19.000Z
|
SDK/ARKSurvivalEvolved_BossTeleporter_Dragon_Easy_classes.hpp
|
2bite/ARK-SDK
|
c38ca9925309516b2093ad8c3a70ed9489e1d573
|
[
"MIT"
] | 9
|
2020-02-17T18:15:41.000Z
|
2021-06-06T19:17:34.000Z
|
SDK/ARKSurvivalEvolved_BossTeleporter_Dragon_Easy_classes.hpp
|
2bite/ARK-SDK
|
c38ca9925309516b2093ad8c3a70ed9489e1d573
|
[
"MIT"
] | 3
|
2020-07-22T17:42:07.000Z
|
2021-06-19T17:16:13.000Z
|
#pragma once
// ARKSurvivalEvolved (329.9) SDK
#ifdef _MSC_VER
#pragma pack(push, 0x8)
#endif
#include "ARKSurvivalEvolved_BossTeleporter_Dragon_Easy_structs.hpp"
namespace sdk
{
//---------------------------------------------------------------------------
//Classes
//---------------------------------------------------------------------------
// BlueprintGeneratedClass BossTeleporter_Dragon_Easy.BossTeleporter_Dragon_Easy_C
// 0x0000 (0x0A30 - 0x0A30)
class ABossTeleporter_Dragon_Easy_C : public ABossTeleporter_Dragon_C
{
public:
static UClass* StaticClass()
{
static auto ptr = UObject::FindClass("BlueprintGeneratedClass BossTeleporter_Dragon_Easy.BossTeleporter_Dragon_Easy_C");
return ptr;
}
void UserConstructionScript();
void ExecuteUbergraph_BossTeleporter_Dragon_Easy(int EntryPoint);
};
}
#ifdef _MSC_VER
#pragma pack(pop)
#endif
| 21.675
| 122
| 0.659746
|
2bite
|
700d31a9a5fe181e314f009049413c1a206ca5d7
| 54
|
cpp
|
C++
|
Atropos/source/engine/IEngine.cpp
|
redagito/Atropos
|
eaf926d5826fd5d5d38a7f8e6aceda64808ba27d
|
[
"MIT"
] | null | null | null |
Atropos/source/engine/IEngine.cpp
|
redagito/Atropos
|
eaf926d5826fd5d5d38a7f8e6aceda64808ba27d
|
[
"MIT"
] | null | null | null |
Atropos/source/engine/IEngine.cpp
|
redagito/Atropos
|
eaf926d5826fd5d5d38a7f8e6aceda64808ba27d
|
[
"MIT"
] | null | null | null |
#include "IEngine.h"
IEngine::~IEngine()
{
return;
}
| 9
| 20
| 0.648148
|
redagito
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.