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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f19d7bd952a77946ee379e6cf579f6702f5f291a | 2,304 | cc | C++ | code/Modules/LocalFS/UnitTests/FSWrapperTest.cc | FrogAC/oryol | 7254c59411e97bbb6f2363aa685718def9f13827 | [
"MIT"
] | 1,707 | 2015-01-01T14:56:08.000Z | 2022-03-28T06:44:09.000Z | code/Modules/LocalFS/UnitTests/FSWrapperTest.cc | FrogAC/oryol | 7254c59411e97bbb6f2363aa685718def9f13827 | [
"MIT"
] | 256 | 2015-01-03T14:55:53.000Z | 2020-09-09T10:43:46.000Z | code/Modules/LocalFS/UnitTests/FSWrapperTest.cc | FrogAC/oryol | 7254c59411e97bbb6f2363aa685718def9f13827 | [
"MIT"
] | 222 | 2015-01-05T00:20:54.000Z | 2022-02-06T01:41:37.000Z | //------------------------------------------------------------------------------
// FSWrapperTest.cc
//------------------------------------------------------------------------------
#include "Pre.h"
#include "UnitTest++/src/UnitTest++.h"
#include "LocalFS/private/fsWrapper.h"
#include "Core/String/StringBuilder.h"
#include <string.h>
using namespace Oryol;
using namespace _priv;
TEST(FSWrapperTest) {
String exePath = fsWrapper::getExecutableDir();
CHECK(!exePath.Empty());
String cwdPath = fsWrapper::getCwd();
CHECK(!cwdPath.Empty());
StringBuilder strBuilder;
strBuilder.Format(4096, "%s/test.txt", cwdPath.AsCStr());
const fsWrapper::handle hw = fsWrapper::openWrite(strBuilder.AsCStr());
CHECK(hw != fsWrapper::invalidHandle);
const char* str = "Hello World\n";
const int len = int(strlen(str));
int bytesWritten = fsWrapper::write(hw, str, len);
CHECK(bytesWritten == len);
fsWrapper::close(hw);
char buf[256];
Memory::Clear(buf, sizeof(buf));
const fsWrapper::handle hr = fsWrapper::openRead(strBuilder.AsCStr());
CHECK(hr != fsWrapper::invalidHandle);
int bytesRead = fsWrapper::read(hr, buf, sizeof(buf));
CHECK(bytesRead == len);
String readStr(buf, 0, len);
CHECK(readStr == "Hello World\n");
CHECK(fsWrapper::read(hr, buf, sizeof(buf)) == 0);
CHECK(fsWrapper::seek(hr, 0));
CHECK(fsWrapper::read(hr, buf, sizeof(buf)) == len);
Memory::Clear(buf, sizeof(buf));
CHECK(fsWrapper::seek(hr, 0));
CHECK(fsWrapper::read(hr, buf, 5) == 5);
readStr.Assign(buf, 0, 5);
CHECK(readStr == "Hello");
Memory::Clear(buf, sizeof(buf));
CHECK(fsWrapper::seek(hr, 6));
CHECK(fsWrapper::read(hr, buf, sizeof(buf)) == 6);
readStr.Assign(buf, 0, 6);
CHECK(readStr == "World\n");
CHECK(fsWrapper::seek(hr, 128));
CHECK(fsWrapper::read(hr, buf, sizeof(buf)) == 0);
fsWrapper::close(hr);
const fsWrapper::handle hs = fsWrapper::openRead(strBuilder.AsCStr());
int size = fsWrapper::size(hs);
CHECK(size == 12);
CHECK(fsWrapper::seek(hs, 6));
size = fsWrapper::size(hs);
CHECK(size == 12);
CHECK(fsWrapper::read(hs, buf, sizeof(buf)) == 6);
readStr.Assign(buf, 0, 6);
CHECK(readStr == "World\n");
fsWrapper::close(hs);
}
| 34.909091 | 80 | 0.594618 | FrogAC |
f1a019cae192e5df2838a6e5a19b46e41e5efa40 | 1,347 | hpp | C++ | src/pitts_tensor2_random.hpp | melven/pitts | 491f503a99a7d1161a27672955ae53ca6b5d3412 | [
"BSD-3-Clause"
] | 2 | 2021-12-31T08:28:17.000Z | 2022-01-12T14:48:49.000Z | src/pitts_tensor2_random.hpp | melven/pitts | 491f503a99a7d1161a27672955ae53ca6b5d3412 | [
"BSD-3-Clause"
] | null | null | null | src/pitts_tensor2_random.hpp | melven/pitts | 491f503a99a7d1161a27672955ae53ca6b5d3412 | [
"BSD-3-Clause"
] | null | null | null | /*! @file pitts_tensor2_random.hpp
* @brief fill simple rank-2 tensor with random values
* @author Melven Roehrig-Zoellner <[email protected]>
* @date 2019-10-10
* @copyright Deutsches Zentrum fuer Luft- und Raumfahrt e. V. (DLR), German Aerospace Center
*
**/
// include guard
#ifndef PITTS_TENSOR2_RANDOM_HPP
#define PITTS_TENSOR2_RANDOM_HPP
// includes
#include <random>
#include "pitts_tensor2.hpp"
#include "pitts_performance.hpp"
//! namespace for the library PITTS (parallel iterative tensor train solvers)
namespace PITTS
{
//! fill a rank-2 tensor with random values
//!
//! @tparam T underlying data type (double, complex, ...)
//!
template<typename T>
void randomize(Tensor2<T>& t2)
{
const auto r1 = t2.r1();
const auto r2 = t2.r2();
const auto timer = PITTS::performance::createScopedTimer<Tensor2<T>>(
{{"r1", "r2"}, {r1, r2}}, // arguments
{{r1*r2*kernel_info::NoOp<T>()}, // flops
{r1*r2*kernel_info::Store<T>()}} // data
);
std::random_device randomSeed;
std::mt19937 randomGenerator(randomSeed());
std::uniform_real_distribution<T> distribution(T(-1), T(1));
for(long long i = 0; i < r1; i++)
for(long long j = 0; j < r2; j++)
t2(i,j) = distribution(randomGenerator);
}
}
#endif // PITTS_TENSOR2_RANDOM_HPP
| 26.94 | 92 | 0.657758 | melven |
f1a35ce4be1e7e4db135a547cd5eb3a0377ec814 | 4,694 | cpp | C++ | SRC/wfc_read_xml_from_file.cpp | SammyB428/WFC | 64aee7c7953e38c8a418ba9530339e8f4faac046 | [
"BSD-2-Clause"
] | 1 | 2021-03-29T06:09:19.000Z | 2021-03-29T06:09:19.000Z | SRC/wfc_read_xml_from_file.cpp | SammyB428/WFC | 64aee7c7953e38c8a418ba9530339e8f4faac046 | [
"BSD-2-Clause"
] | null | null | null | SRC/wfc_read_xml_from_file.cpp | SammyB428/WFC | 64aee7c7953e38c8a418ba9530339e8f4faac046 | [
"BSD-2-Clause"
] | null | null | null | /*
** Author: Samuel R. Blackburn
** Internet: [email protected]
**
** Copyright, 1995-2019, Samuel R. Blackburn
**
** "You can get credit for something or get it done, but not both."
** Dr. Richard Garwin
**
** BSD License follows.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions
** are met:
**
** Redistributions of source code must retain the above copyright notice,
** this list of conditions and the following disclaimer. Redistributions
** in binary form must reproduce the above copyright notice, this list
** of conditions and the following disclaimer in the documentation and/or
** other materials provided with the distribution. Neither the name of
** the WFC 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.
**
** $Workfile: wfc_start_screen_saver.cpp $
** $Revision: 12 $
** $Modtime: 6/26/01 10:59a $
** $Reuse Tracing Code: 1 $
*/
/* SPDX-License-Identifier: BSD-2-Clause */
#include <wfc.h>
#pragma hdrstop
#if defined( _DEBUG ) && defined( _INC_CRTDBG )
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#define new DEBUG_NEW
#endif // _DEBUG
_Check_return_ bool Win32FoundationClasses::wfc_read_xml_from_file(_In_ std::wstring_view filename, _Inout_ CExtensibleMarkupLanguageDocument& document ) noexcept
{
CMemoryFile memory_mapped_file;
if ( memory_mapped_file.Open( filename, static_cast<UINT>(CFile64::OpenFlags::modeRead) ) == true )
{
CDataParser parser;
if ( parser.Initialize(static_cast<uint8_t const *>(memory_mapped_file.GetPointer()), memory_mapped_file.Size ) == false )
{
return( false );
}
return( document.Parse( parser ) );
}
else
{
// Can't map the file for some reason....
CFile64 input_file;
if ( input_file.Open( filename, static_cast<UINT>(CFile64::OpenFlags::modeRead) ) == true )
{
return( input_file.Read( document ) );
}
}
return( true );
}
void Win32FoundationClasses::wfc_get_program_data_directory(_Out_ std::wstring& application_data_directory) noexcept
{
application_data_directory.clear();
PWSTR directory_name = nullptr;
if (SUCCEEDED(::SHGetKnownFolderPath(FOLDERID_ProgramData, 0, nullptr, &directory_name)))
{
application_data_directory.assign(directory_name);
::CoTaskMemFree(directory_name);
directory_name = nullptr;
if (application_data_directory.empty() == true)
{
// RATS! The directory is empty
return;
}
if (ends_with(application_data_directory, '\\' ) == false)
{
application_data_directory.push_back(L'\\');
}
}
else
{
application_data_directory.clear();
}
}
// End of source
/*
<HTML>
<HEAD>
<TITLE>WFC - wfc_read_xml_from_file</TITLE>
<META name="keywords" content="WFC, MFC extension library, freeware class library, Win32">
<META name="description" content="Simple C function that reads XML from a file.">
</HEAD>
<BODY>
<H1>wfc_read_xml_from_file</H1>
$Revision: 12 $<HR>
<H2>Declaration</H2>
<PRE>bool <B>wfc_read_xml_from_file</B>( LPCTSTR filename, CExtensibleMarkupLanguageDocument& xml )</PRE>
<H2>Description</H2>
This function reads the XML from the specified file.
<H2>Example</H2>
<PRE><CODE>int _tmain( int number_of_command_line_arguments, LPCTSTR command_line_arguments[] )
{
<A HREF="WfcTrace.htm">WFCTRACEINIT</A>( TEXT( "_tmain()" ) );
<B>wfc_read_xml_from_file</B>( argv[ 1 ] );
return( EXIT_SUCCESS );
}</CODE></PRE>
<HR><I>Copyright, 203, <A HREF="mailto:[email protected]">Samuel R. Blackburn</A></I><BR>
$Workfile: wfc_start_screen_saver.cpp $<BR>
$Modtime: 6/26/01 10:59a $
</BODY>
</HTML>
*/
| 30.480519 | 162 | 0.703877 | SammyB428 |
f1a9e8a3c404cf290fda6598f3e53f74db2f1d39 | 1,559 | cpp | C++ | EntityComponentSystem/Core/Core/ShaderPreprocessor.cpp | Spheya/Slamanander-Engine | d0708399eacab26b243045b33b51ff30d614b7bd | [
"MIT"
] | null | null | null | EntityComponentSystem/Core/Core/ShaderPreprocessor.cpp | Spheya/Slamanander-Engine | d0708399eacab26b243045b33b51ff30d614b7bd | [
"MIT"
] | null | null | null | EntityComponentSystem/Core/Core/ShaderPreprocessor.cpp | Spheya/Slamanander-Engine | d0708399eacab26b243045b33b51ff30d614b7bd | [
"MIT"
] | null | null | null | #include "ShaderPreprocessor.hpp"
#include <unordered_map>
#include <filesystem>
#include <fstream>
#include <sstream>
#include <iostream>
namespace {
std::string processFile(std::string shaderFile, std::unordered_map<std::string, bool>& includedFiles) {
// Get the absolute path to this file
std::filesystem::path p = shaderFile;
std::string absolutePath = std::filesystem::absolute(p).u8string();
#ifdef _DEBUG
{
std::ifstream f(absolutePath);
if (!f.good()) {
std::cout << "shader file \"" << absolutePath << "\" not found!" << std::endl;
std::terminate();
}
}
#endif
// If the file is already included, do nothing
if (includedFiles[absolutePath])
return "";
// Mark the file as included
includedFiles[absolutePath] = true;
// Read all the text in the file
std::ifstream fileStream(shaderFile);
std::ostringstream processedCode;
std::string line;
while (std::getline(fileStream, line)) {
std::istringstream iss(line);
std::string statement;
iss >> statement;
if (statement == "#include") {
iss >> statement;
std::string relativeFilePath = statement.substr(1, statement.size() - 2);
processedCode << processFile(p.parent_path().u8string() + '\\' + relativeFilePath, includedFiles);
} else {
processedCode << line;
processedCode << '\n';
}
}
return processedCode.str();
}
}
std::string renderer::ShaderPreprocessor::process(std::string shaderFile) {
std::unordered_map<std::string, bool> includedFiles;
return processFile(shaderFile, includedFiles);
}
| 25.983333 | 104 | 0.681206 | Spheya |
f1ae10ec908a7170b8ce3c96f0c0fdd2e234bb84 | 285 | cpp | C++ | scgi_server.cpp | fraxer/scgi-server | 9f26eea5bb4e27c500bffddae5e91aec0f18ab52 | [
"MIT"
] | null | null | null | scgi_server.cpp | fraxer/scgi-server | 9f26eea5bb4e27c500bffddae5e91aec0f18ab52 | [
"MIT"
] | null | null | null | scgi_server.cpp | fraxer/scgi-server | 9f26eea5bb4e27c500bffddae5e91aec0f18ab52 | [
"MIT"
] | null | null | null | #include "lib/scgi.hpp"
using namespace std;
int main(int argc, char **argv) {
locale system("");
locale::global(system);
//If You started server as daemon You must to use demonize() method
if (demonize() < 1) {
return 0;
}
init((char*)"127.0.0.1", 8080);
return 0;
} | 16.764706 | 69 | 0.635088 | fraxer |
f1af6b2a4e3259748702d39b2097fccbf3800cd0 | 2,149 | cpp | C++ | Chapter_2_Data_Structures/Non-Linear_DS_with_Built-in_Libraries/kattis_stockprices.cpp | BrandonTang89/CP4_Code | 5114471f439978dd11f6f2cbf6af20ca654593da | [
"MIT"
] | 2 | 2021-12-29T04:12:59.000Z | 2022-03-30T09:32:19.000Z | Chapter_2_Data_Structures/Non-Linear_DS_with_Built-in_Libraries/kattis_stockprices.cpp | BrandonTang89/CP4_Code | 5114471f439978dd11f6f2cbf6af20ca654593da | [
"MIT"
] | null | null | null | Chapter_2_Data_Structures/Non-Linear_DS_with_Built-in_Libraries/kattis_stockprices.cpp | BrandonTang89/CP4_Code | 5114471f439978dd11f6f2cbf6af20ca654593da | [
"MIT"
] | 1 | 2022-03-01T06:12:46.000Z | 2022-03-01T06:12:46.000Z | #pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
priority_queue<pair<int,int> > bids; // price, quantity, max heap
priority_queue<pair<int,int>, vector<pair<int,int>>, greater<pair<int,int>> > asks; // price, quantity, min heap
int stock_price = -1;
int num_tc, n;
string op, d;
int q, p;
int main(){
fast_cin();
cin >> num_tc;
for (int tc=0;tc<num_tc;tc++){
while (!bids.empty()) bids.pop();
while (!asks.empty()) asks.pop();
stock_price = -1;
cin >> n;
for (int i=0;i<n;i++){
cin >> op >> q >> d >> d >> p;
if (op == "buy"){
bids.push(make_pair(p, q));
}
else{
asks.push({p, q});
}
while ((!(asks.empty() || bids.empty())) && asks.top().first <= bids.top().first){
int ask_price = asks.top().first;
int bid_price = bids.top().first;
int ask_quantity = asks.top().second;
int bid_quantity = bids.top().second;
asks.pop();
bids.pop();
int q_transacted = min(ask_quantity, bid_quantity);
stock_price = ask_price;
if (q_transacted < ask_quantity){
asks.push({ask_price, ask_quantity - q_transacted});
}
if (q_transacted < bid_quantity){
bids.push({bid_price, bid_quantity - q_transacted});
}
}
if (asks.empty()){
cout << "- ";
}
else cout << asks.top().first << " ";
if (bids.empty()){
cout << "- ";
}
else cout << bids.top().first << " ";
if (stock_price == -1){
cout << "-\n";
}
else cout << stock_price << "\n";
}
}
return 0;
} | 32.074627 | 112 | 0.469521 | BrandonTang89 |
f1b439a17a536e0ebfdb639369e72dc7cd36d1e0 | 3,713 | hpp | C++ | include/HoudiniEngineUnity/HEU_PreAssetEventData.hpp | RedBrumbler/BeatSaber-Quest-Codegen | 73dda50b5a3e51f10d86b766dcaa24b0c6226e25 | [
"Unlicense"
] | null | null | null | include/HoudiniEngineUnity/HEU_PreAssetEventData.hpp | RedBrumbler/BeatSaber-Quest-Codegen | 73dda50b5a3e51f10d86b766dcaa24b0c6226e25 | [
"Unlicense"
] | null | null | null | include/HoudiniEngineUnity/HEU_PreAssetEventData.hpp | RedBrumbler/BeatSaber-Quest-Codegen | 73dda50b5a3e51f10d86b766dcaa24b0c6226e25 | [
"Unlicense"
] | null | null | null | // Autogenerated from CppHeaderCreator
// Created by Sc2ad
// =========================================================================
#pragma once
// Begin includes
#include "beatsaber-hook/shared/utils/typedefs.h"
#include "beatsaber-hook/shared/utils/byref.hpp"
// Including type: HoudiniEngineUnity.HEU_AssetEventType
#include "HoudiniEngineUnity/HEU_AssetEventType.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils-methods.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils-properties.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils-fields.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Begin forward declares
// Forward declaring namespace: HoudiniEngineUnity
namespace HoudiniEngineUnity {
// Forward declaring type: HEU_HoudiniAsset
class HEU_HoudiniAsset;
}
// Completed forward declares
// Type namespace: HoudiniEngineUnity
namespace HoudiniEngineUnity {
// Forward declaring type: HEU_PreAssetEventData
class HEU_PreAssetEventData;
}
#include "beatsaber-hook/shared/utils/il2cpp-type-check.hpp"
NEED_NO_BOX(::HoudiniEngineUnity::HEU_PreAssetEventData);
DEFINE_IL2CPP_ARG_TYPE(::HoudiniEngineUnity::HEU_PreAssetEventData*, "HoudiniEngineUnity", "HEU_PreAssetEventData");
// Type namespace: HoudiniEngineUnity
namespace HoudiniEngineUnity {
// Size: 0x1C
#pragma pack(push, 1)
// Autogenerated type: HoudiniEngineUnity.HEU_PreAssetEventData
// [TokenAttribute] Offset: FFFFFFFF
class HEU_PreAssetEventData : public ::Il2CppObject {
public:
#ifdef USE_CODEGEN_FIELDS
public:
#else
#ifdef CODEGEN_FIELD_ACCESSIBILITY
CODEGEN_FIELD_ACCESSIBILITY:
#else
protected:
#endif
#endif
// public HoudiniEngineUnity.HEU_HoudiniAsset Asset
// Size: 0x8
// Offset: 0x10
::HoudiniEngineUnity::HEU_HoudiniAsset* Asset;
// Field size check
static_assert(sizeof(::HoudiniEngineUnity::HEU_HoudiniAsset*) == 0x8);
// public HoudiniEngineUnity.HEU_AssetEventType AssetType
// Size: 0x4
// Offset: 0x18
::HoudiniEngineUnity::HEU_AssetEventType AssetType;
// Field size check
static_assert(sizeof(::HoudiniEngineUnity::HEU_AssetEventType) == 0x4);
public:
// Get instance field reference: public HoudiniEngineUnity.HEU_HoudiniAsset Asset
::HoudiniEngineUnity::HEU_HoudiniAsset*& dyn_Asset();
// Get instance field reference: public HoudiniEngineUnity.HEU_AssetEventType AssetType
::HoudiniEngineUnity::HEU_AssetEventType& dyn_AssetType();
// public System.Void .ctor(HoudiniEngineUnity.HEU_HoudiniAsset asset, HoudiniEngineUnity.HEU_AssetEventType assetType)
// Offset: 0x1AC8144
template<::il2cpp_utils::CreationType creationType = ::il2cpp_utils::CreationType::Temporary>
static HEU_PreAssetEventData* New_ctor(::HoudiniEngineUnity::HEU_HoudiniAsset* asset, ::HoudiniEngineUnity::HEU_AssetEventType assetType) {
static auto ___internal__logger = ::Logger::get().WithContext("::HoudiniEngineUnity::HEU_PreAssetEventData::.ctor");
return THROW_UNLESS((::il2cpp_utils::New<HEU_PreAssetEventData*, creationType>(asset, assetType)));
}
}; // HoudiniEngineUnity.HEU_PreAssetEventData
#pragma pack(pop)
static check_size<sizeof(HEU_PreAssetEventData), 24 + sizeof(::HoudiniEngineUnity::HEU_AssetEventType)> __HoudiniEngineUnity_HEU_PreAssetEventDataSizeCheck;
static_assert(sizeof(HEU_PreAssetEventData) == 0x1C);
}
#include "beatsaber-hook/shared/utils/il2cpp-utils-methods.hpp"
// Writing MetadataGetter for method: HoudiniEngineUnity::HEU_PreAssetEventData::New_ctor
// Il2CppName: .ctor
// Cannot get method pointer of value based method overload from template for constructor!
// Try using FindMethod instead!
| 45.839506 | 158 | 0.765957 | RedBrumbler |
f1baad929509c64ebb97e07d6b7589e2b13b39da | 3,000 | cpp | C++ | main/main.cpp | mrdunk/m5stack_homeautomation | 49e414039c666a595f81b66c73e2b4e7e72f3e16 | [
"MIT"
] | null | null | null | main/main.cpp | mrdunk/m5stack_homeautomation | 49e414039c666a595f81b66c73e2b4e7e72f3e16 | [
"MIT"
] | null | null | null | main/main.cpp | mrdunk/m5stack_homeautomation | 49e414039c666a595f81b66c73e2b4e7e72f3e16 | [
"MIT"
] | 1 | 2020-04-02T13:49:45.000Z | 2020-04-02T13:49:45.000Z | #include <M5Stack.h>
#include "nvs_flash.h"
#include "esp_wifi.h"
#include "esp_event_loop.h"
#include "freertos/event_groups.h"
#include "menu.h"
#include "occupancy.h"
#include "mqtt.h"
#include "temparature.h"
#include "outlet.h"
#include "googleSheet.h"
#include "config.h"
#include "getUrl.h"
#if CONFIG_FREERTOS_UNICORE
#define ARDUINO_RUNNING_CORE 0
#else
#define ARDUINO_RUNNING_CORE 1
#endif
#define BOILER_TOPIC GLOBAL_ID "/heating/state"
mrdunk::Temperature* temperature;
mrdunk::OutletKankun* outletBoiler;
mrdunk::HttpRequest* httpRequest;
// The setup routine runs once when M5Stack starts up
void setup() {
esp_log_level_set("phy_init", ESP_LOG_INFO);
// Initialize the M5Stack object
M5.begin(true, false);
// LCD display
M5.Lcd.clearDisplay();
M5.Lcd.setTextColor(WHITE);
M5.Lcd.setTextSize(4);
M5.Lcd.setCursor(10, 10);
M5.Lcd.print("Loading...\n");
setupMenu();
// Networking
wifi_init();
mqtt_app_start();
temperature = new mrdunk::Temperature("inside/downstairs/livingroom");
outletBoiler = new mrdunk::OutletKankun(BOILER_TOPIC, false);
}
// Every 20ms.
void loopTask(void *pvParameters) {
while(1) {
micros(); // update overflow
M5.update(); // Reads buttons, updates speaker.
occupancy_update();
updateMenu();
delay(20 / portTICK_PERIOD_MS);
}
}
// Every few seconds. 15 * 1000ms
void loopTask15sec(void *pvParameters) {
char currentTemp[20] = "";
while(1) {
float temp = temperature->average();
if(isnan(temp)) {
snprintf(currentTemp, 20, "Waiting for update.");
} else {
snprintf(currentTemp, 16, "%.1fC\n", temp);
}
setButton0(currentTemp, nullptr);
setButton1(outletBoiler->getState());
delay(15 * 1000 / portTICK_PERIOD_MS);
}
}
void loopTask30min(void *pvParameters) {
while(1) {
if(outletBoiler->getState()) {
googleSheet_connect(WEB_URL, "?topic=" BOILER_TOPIC "&state=1");
} else {
googleSheet_connect(WEB_URL, "?topic=" BOILER_TOPIC "&state=0");
}
delay(30 * 60 * 1000 / portTICK_PERIOD_MS);
}
}
extern "C" void app_main() {
esp_chip_info_t chip_info;
esp_chip_info(&chip_info);
printf("This is ESP32 chip with %d CPU cores, WiFi%s%s, ",
chip_info.cores,
(chip_info.features & CHIP_FEATURE_BT) ? "/BT" : "",
(chip_info.features & CHIP_FEATURE_BLE) ? "/BLE" : "");
printf("silicon revision %d, ", chip_info.revision);
printf("%dMB %s flash\n\n", spi_flash_get_chip_size() / (1024 * 1024),
(chip_info.features & CHIP_FEATURE_EMB_FLASH) ? "embedded" : "external");
//initArduino();
setup();
xTaskCreatePinnedToCore(
loopTask, "loopTask", 8192, NULL, 1, NULL, ARDUINO_RUNNING_CORE);
xTaskCreatePinnedToCore(
loopTask15sec, "loopTask15sec", 8192, NULL, 10, NULL, ARDUINO_RUNNING_CORE);
xTaskCreatePinnedToCore(
loopTask30min, "loopTask30min", 8192, NULL, 10, NULL, ARDUINO_RUNNING_CORE);
while(1) {
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
}
| 25.210084 | 82 | 0.684 | mrdunk |
f1bde8db188380ef2fb7b8a91dbaf194e1872e84 | 6,405 | cpp | C++ | eeprom_config.cpp | nnaumenko/room_monitor_esp8266 | 41aa2f5b8803a546a8426390147090582b4ae7be | [
"MIT"
] | 2 | 2017-11-17T07:17:17.000Z | 2021-03-15T12:38:55.000Z | eeprom_config.cpp | nnaumenko/iot_ambit | 41aa2f5b8803a546a8426390147090582b4ae7be | [
"MIT"
] | 11 | 2016-08-07T16:04:34.000Z | 2017-12-30T00:57:16.000Z | eeprom_config.cpp | nnaumenko/room_monitor_esp8266 | 41aa2f5b8803a546a8426390147090582b4ae7be | [
"MIT"
] | 1 | 2017-09-29T17:44:19.000Z | 2017-09-29T17:44:19.000Z | /*
* Copyright (C) 2016-2017 Nick Naumenko (https://github.com/nnaumenko)
* All rights reserved
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/
#include "diag.h"
#include "version.h"
#include "eeprom_config.h"
#include "util_data.h"
#include <EEPROM.h>
using DiagLog = diag::DiagLog<>;
EepromSavedParametersStorage eepromSavedParametersStorage;
const PROGMEM QuickStringMapItem stringMapEepromSavedParameterInternalNames[] {
{(StringMapKey)EepromSavedParameter::BLYNK_AUTH_TOKEN, "blynkauth"},
{(StringMapKey)EepromSavedParameter::WIFI_SSID, "wifissid"},
{(StringMapKey)EepromSavedParameter::WIFI_PASSWORD, "wifipass"},
{(StringMapKey)EepromSavedParameter::MG811_CALPOINT0_CAL, "adccal0cal"},
{(StringMapKey)EepromSavedParameter::MG811_CALPOINT0_RAW, "adccal0raw"},
{(StringMapKey)EepromSavedParameter::MG811_CALPOINT1_CAL, "adccal1cal"},
{(StringMapKey)EepromSavedParameter::MG811_CALPOINT1_RAW, "adccal1raw"},
{(StringMapKey)EepromSavedParameter::MG811FILTER_TYPE, "adcfilter"},
{(StringMapKey)EepromSavedParameter::MG811FILTER_LOWPASS_FREQ, "adcfiltfreq"},
{(StringMapKey)EepromSavedParameter::MG811_REJECT_CALIBRATION, "adcrejectcal"},
{(StringMapKey)EepromSavedParameter::MISC_SERIAL_OUT, "miscserout"},
{(StringMapKey)EepromSavedParameter::BLYNK_SERVER, "blynkserver"},
{(StringMapKey)EepromSavedParameter::BLYNK_SERVER_PORT, "blynkport"},
{(StringMapKey)EepromSavedParameter::STARTUP_DELAY, "stdel"},
{(StringMapKey)EepromSavedParameter::UNKNOWN, ""}
};
void saveToEEPROM (int address, const void * parameter, size_t length) {
byte * parameterBytes = (byte *) parameter;
for (size_t i = 0; i < length; i++) {
EEPROM.write(address + i, parameterBytes[i]);
}
}
void loadFromEEPROM (int address, void * parameter, size_t length) {
byte * parameterBytes = (byte *) parameter;
for (size_t i = 0; i < length; i++) {
parameterBytes[i] = EEPROM.read(address + i);
}
}
uint16_t calculateCheckSum (void) {
return (util::checksum::crc16(&eepromSavedParametersStorage, sizeof(EepromSavedParametersStorage)));
}
void saveConfig(void) {
eepromSavedParametersStorage.versionMajor = FIRMWARE_VERSION_MAJOR;
eepromSavedParametersStorage.versionMinor = FIRMWARE_VERSION_MINOR;
eepromSavedParametersStorage.checkSum = calculateCheckSum();
EEPROM.begin(sizeof(eepromSavedParametersStorage) + EEPROM_SAVED_PARAMETERS_ADDRESS);
saveToEEPROM(EEPROM_SAVED_PARAMETERS_ADDRESS,
(void *)&eepromSavedParametersStorage,
sizeof(eepromSavedParametersStorage));
EEPROM.end();
DiagLog::instance()->log(DiagLog::Severity::INFORMATIONAL, F("Config saved to EEPROM"));
}
void loadConfig(void) {
EEPROM.begin(sizeof(eepromSavedParametersStorage));
loadFromEEPROM(EEPROM_SAVED_PARAMETERS_ADDRESS,
(void *)&eepromSavedParametersStorage,
sizeof(eepromSavedParametersStorage));
EEPROM.end();
DiagLog::instance()->log(DiagLog::Severity::INFORMATIONAL, F("Config loaded from EEPROM"));
DiagLog::instance()->log(DiagLog::Severity::DEBUG,
F("Config was saved with firmware version "),
eepromSavedParametersStorage.versionMajor,
'.',
eepromSavedParametersStorage.versionMinor);
if ((eepromSavedParametersStorage.versionMajor != FIRMWARE_VERSION_MAJOR) ||
(eepromSavedParametersStorage.versionMinor != FIRMWARE_VERSION_MINOR))
DiagLog::instance()->log(DiagLog::Severity::WARNING, F("CONFIG SAVED WITH DIFFERENT FIRMWARE VERSION, PLEASE ACTIVATE CONFIG MODE AND REVIEW DATA"));
DiagLog::instance()->log(DiagLog::Severity::NOTICE, F("Checksum: "), eepromSavedParametersStorage.checkSum);
uint16_t actualCheckSum = calculateCheckSum();
if (actualCheckSum != eepromSavedParametersStorage.checkSum) {
DiagLog::instance()->log(DiagLog::Severity::WARNING, F("Actual checksum: "), actualCheckSum);
DiagLog::instance()->log(DiagLog::Severity::WARNING, F("CONFIG CHECKSUM MISMATCH, PLEASE ACTIVATE CONFIG MODE AND REVIEW DATA"));
}
DiagLog::instance()->log(DiagLog::Severity::DEBUG, F("WIFI network: "), eepromSavedParametersStorage.wifiSsid);
if (EEPROM_DEBUG_PRINT_INSECURE) {
DiagLog::instance()->log(DiagLog::Severity::DEBUG, F("WIFI password: "), eepromSavedParametersStorage.wifiPassword);
DiagLog::instance()->log(DiagLog::Severity::DEBUG, F("Auth token: "), eepromSavedParametersStorage.authToken);
}
DiagLog::instance()->log(DiagLog::Severity::DEBUG, F("MG811 cal points: "),
F("Raw="), eepromSavedParametersStorage.MG811CalPoint0Raw,
F(" Calibrated="), eepromSavedParametersStorage.MG811CalPoint0Calibrated,
F("ppm / Raw="), eepromSavedParametersStorage.MG811CalPoint1Raw,
F(" Calibrated="), eepromSavedParametersStorage.MG811CalPoint1Calibrated,
F("ppm"));
switch (eepromSavedParametersStorage.filterMG811) {
case ADCFilter::OFF:
DiagLog::instance()->log(DiagLog::Severity::DEBUG, F("MG811 filter: off"));
break;
case ADCFilter::AVERAGE:
DiagLog::instance()->log(DiagLog::Severity::DEBUG, F("MG811 filter: moving average"));
break;
case ADCFilter::LOWPASS:
DiagLog::instance()->log(DiagLog::Severity::DEBUG, F("MG811 filter: low-pass, limit frequency: "), eepromSavedParametersStorage.filterMG811LowPassFrequency, F(" x 0.01 Hz"));
break;
default:
DiagLog::instance()->log(DiagLog::Severity::DEBUG, F("MG811 filter: unknown ("), (int)eepromSavedParametersStorage.filterMG811, ')');
break;
}
if (!eepromSavedParametersStorage.rejectCalibrationMG811)
DiagLog::instance()->log(DiagLog::Severity::DEBUG, F("MG811 calibration mode: use calibration data"));
else
DiagLog::instance()->log(DiagLog::Severity::DEBUG, F("MG811 calibration mode: use uncalibrated value"));
if (!eepromSavedParametersStorage.sensorSerialOutput)
DiagLog::instance()->log(DiagLog::Severity::DEBUG, F("Sensor readings' serial output: off"));
else
DiagLog::instance()->log(DiagLog::Severity::DEBUG, F("Sensor readings' serial output: on"));
}
| 51.653226 | 181 | 0.707884 | nnaumenko |
f1bf39d84489f5ce333093288394a4c08749dafa | 431 | cc | C++ | editor/win.cc | hankhank/exys | a515784ab3c673dceb34e8b286963e48d471c48d | [
"MIT"
] | null | null | null | editor/win.cc | hankhank/exys | a515784ab3c673dceb34e8b286963e48d471c48d | [
"MIT"
] | null | null | null | editor/win.cc | hankhank/exys | a515784ab3c673dceb34e8b286963e48d471c48d | [
"MIT"
] | null | null | null | #include "gvplugin.h"
extern gvplugin_library_t gvplugin_dot_layout_LTX_library;
extern gvplugin_library_t gvplugin_neato_layout_LTX_library;
extern gvplugin_library_t gvplugin_core_LTX_library;
extern gvplugin_library_t gvplugin_quartz_LTX_library;
extern gvplugin_library_t gvplugin_visio_LTX_library;
lt_symlist_t lt_preloaded_symbols[] =
{
{ "gvplugin_dot_layout_LTX_library", &gvplugin_dot_layout_LTX_library},
{ 0, 0}
};
| 30.785714 | 72 | 0.867749 | hankhank |
f1c290db97fd84b31c4c7824da401711a52cbeab | 555 | hpp | C++ | lib/RayTracer/Rendering/Lighting/Light.hpp | ei06125/ray-tracer-challenge | 54475def8c6f82c3559871f7fce00248128bb5ba | [
"MIT"
] | null | null | null | lib/RayTracer/Rendering/Lighting/Light.hpp | ei06125/ray-tracer-challenge | 54475def8c6f82c3559871f7fce00248128bb5ba | [
"MIT"
] | null | null | null | lib/RayTracer/Rendering/Lighting/Light.hpp | ei06125/ray-tracer-challenge | 54475def8c6f82c3559871f7fce00248128bb5ba | [
"MIT"
] | null | null | null | #pragma once
#include "RayTracerPCH.hpp"
// Project Library
#include "RayTracer/Math/Tuple.hpp"
#include "RayTracer/Rendering/Color.hpp"
namespace RayTracer {
namespace Rendering {
namespace Lighting {
using namespace RayTracer::Math;
using namespace RayTracer::Rendering::Colors;
struct PointLight
{
Tuple position;
Color intensity;
};
std::ostream& operator<<(std::ostream& os, const PointLight& aLight);
bool operator==(const PointLight& lhs, const PointLight& rhs);
} // namespace Lighting
} // namespace Rendering
} // namespace RayTracer
| 19.821429 | 69 | 0.756757 | ei06125 |
f1c7013995cc7c140d693bf45d299634baa971a0 | 19,718 | cpp | C++ | source/LibFgBase/src/FgTopology.cpp | SingularInversions/FaceGenBaseLibrary | e928b482fa78597cfcf3923f7252f7902ec0dfa9 | [
"MIT"
] | 41 | 2016-04-09T07:48:10.000Z | 2022-03-01T15:46:08.000Z | source/LibFgBase/src/FgTopology.cpp | SingularInversions/FaceGenBaseLibrary | e928b482fa78597cfcf3923f7252f7902ec0dfa9 | [
"MIT"
] | 9 | 2015-09-23T10:54:50.000Z | 2020-01-04T21:16:57.000Z | source/LibFgBase/src/FgTopology.cpp | SingularInversions/FaceGenBaseLibrary | e928b482fa78597cfcf3923f7252f7902ec0dfa9 | [
"MIT"
] | 29 | 2015-10-01T14:44:42.000Z | 2022-01-05T01:28:43.000Z | //
// Coypright (c) 2021 Singular Inversions Inc. (facegen.com)
// Use, modification and distribution is subject to the MIT License,
// see accompanying file LICENSE.txt or facegen.com/base_library_license.txt
//
#include "stdafx.h"
#include "FgStdSet.hpp"
#include "FgTopology.hpp"
#include "FgOpt.hpp"
#include "FgStdVector.hpp"
#include "FgCommand.hpp"
#include "Fg3dMeshIo.hpp"
#include "Fg3dDisplay.hpp"
#include "FgImgDisplay.hpp"
using namespace std;
namespace Fg {
Vec2UI
directEdgeVertInds(Vec2UI vertInds,Vec3UI tri)
{
uint idx0 = findFirstIdx(tri,vertInds[0]),
idx1 = findFirstIdx(tri,vertInds[1]),
del = (idx1+3-idx0) % 3;
if (del == 2)
swap(vertInds[0],vertInds[1]);
else if (del != 1)
FGASSERT_FALSE;
return vertInds;
}
Vec2UI
SurfTopo::Tri::edge(uint relIdx) const
{
if (relIdx == 0)
return Vec2UI(vertInds[0],vertInds[1]);
else if (relIdx == 1)
return Vec2UI(vertInds[1],vertInds[2]);
else if (relIdx == 2)
return Vec2UI(vertInds[2],vertInds[0]);
else
FGASSERT_FALSE;
return Vec2UI();
}
uint
SurfTopo::Edge::otherVertIdx(uint vertIdx) const
{
if (vertIdx == vertInds[0])
return vertInds[1];
else if (vertIdx == vertInds[1])
return vertInds[0];
else
FGASSERT_FALSE;
return 0; // make compiler happy
}
struct EdgeVerts
{
uint loIdx;
uint hiIdx;
EdgeVerts(uint i0,uint i1)
{
if (i0 < i1) {
loIdx = i0;
hiIdx = i1;
}
else {
loIdx = i1;
hiIdx = i0;
}
FGASSERT(i0 != i1);
}
// Comparison operator to use as a key for std::map:
bool operator<(const EdgeVerts & rhs) const
{
if (loIdx < rhs.loIdx)
return true;
else if (loIdx == rhs.loIdx)
return (hiIdx < rhs.hiIdx);
else
return false;
}
bool
contains(uint idx) const
{return ((idx == loIdx) || (idx == hiIdx)); }
};
struct TriVerts
{
Vec3UI inds;
TriVerts(Vec3UI i)
{
if (i[1] < i[0])
std::swap(i[0],i[1]);
if (i[2] < i[1])
std::swap(i[1],i[2]);
if (i[1] < i[0])
std::swap(i[0],i[1]);
inds = i;
}
bool operator<(const TriVerts & rhs) const
{
for (uint ii=0; ii<3; ++ii) {
if (inds[ii] < rhs.inds[ii])
return true;
else if (inds[ii] == rhs.inds[ii])
continue;
else
return false;
}
return false;
}
};
SurfTopo::SurfTopo(Vec3UIs const & tris)
{
setup(0,tris); // 0 means just use max reference
}
SurfTopo::SurfTopo(size_t numVerts,Vec3UIs const & tris)
{
setup(uint(numVerts),tris);
}
void
SurfTopo::setup(uint numVerts,Vec3UIs const & tris)
{
uint maxVertReferenced = 0;
for (Vec3UI const & tri : tris)
for (uint idx : tri.m)
updateMax_(maxVertReferenced,idx);
if (numVerts == 0)
numVerts = maxVertReferenced + 1;
else if (numVerts < maxVertReferenced+1)
fgThrow("SurfTopo called with vertex count smaller than max index reference");
// Detect null or duplicate tris:
uint duplicates = 0,
nulls = 0;
set<TriVerts> vset;
for (size_t ii=0; ii<tris.size(); ++ii) {
Vec3UI vis = tris[ii];
if ((vis[0] == vis[1]) || (vis[1] == vis[2]) || (vis[2] == vis[0]))
++nulls;
else {
TriVerts tv(vis);
if (vset.find(tv) == vset.end()) {
vset.insert(tv);
Tri tri;
tri.vertInds = vis;
m_tris.push_back(tri);
}
else
++duplicates;
}
}
if (duplicates > 0)
fgout << fgnl << "WARNING Ignored " << duplicates << " duplicate tris";
if (nulls > 0)
fgout << fgnl << "WARNING Ignored " << nulls << " null tris.";
m_verts.resize(numVerts);
std::map<EdgeVerts,Uints > edgesToTris;
for (size_t ii=0; ii<m_tris.size(); ++ii) {
Vec3UI vertInds = m_tris[ii].vertInds;
m_tris[ii].edgeInds = Vec3UI(std::numeric_limits<uint>::max());
for (uint jj=0; jj<3; ++jj) {
m_verts[vertInds[jj]].triInds.push_back(uint(ii));
EdgeVerts edge(vertInds[jj],vertInds[(jj+1)%3]);
edgesToTris[edge].push_back(uint(ii));
}
}
for (map<EdgeVerts,Uints >::const_iterator it=edgesToTris.begin(); it!=edgesToTris.end(); ++it) {
EdgeVerts edgeVerts = it->first;
Edge edge;
edge.vertInds = Vec2UI(edgeVerts.loIdx,edgeVerts.hiIdx);
edge.triInds = it->second;
m_edges.push_back(edge);
}
for (size_t ii=0; ii<m_edges.size(); ++ii) {
Vec2UI vts = m_edges[ii].vertInds;
m_verts[vts[0]].edgeInds.push_back(uint(ii));
m_verts[vts[1]].edgeInds.push_back(uint(ii));
EdgeVerts edge(vts[0],vts[1]);
Uints const & triInds = edgesToTris.find(edge)->second;
for (size_t jj=0; jj<triInds.size(); ++jj) {
uint triIdx = triInds[jj];
Vec3UI tri = m_tris[triIdx].vertInds;
for (uint ee=0; ee<3; ++ee)
if ((edge.contains(tri[ee]) && edge.contains(tri[(ee+1)%3])))
m_tris[triIdx].edgeInds[ee] = uint(ii);
}
}
// validate:
for (size_t ii=0; ii<m_verts.size(); ++ii) {
Uints const & edgeInds = m_verts[ii].edgeInds;
if (edgeInds.size() > 1)
for (size_t jj=0; jj<edgeInds.size(); ++jj)
m_edges[edgeInds[jj]].otherVertIdx(uint(ii)); // throws if index ii not found in edge verts
}
for (size_t ii=0; ii<m_tris.size(); ++ii)
for (uint jj=0; jj<3; ++jj)
FGASSERT(m_tris[ii].edgeInds[jj] != std::numeric_limits<uint>::max());
for (size_t ii=0; ii<m_edges.size(); ++ii)
FGASSERT(m_edges[ii].triInds.size() > 0);
}
Vec2UI
SurfTopo::edgeFacingVertInds(uint edgeIdx) const
{
Uints const & triInds = m_edges[edgeIdx].triInds;
FGASSERT(triInds.size() == 2);
uint ov0 = oppositeVert(triInds[0],edgeIdx),
ov1 = oppositeVert(triInds[1],edgeIdx);
return Vec2UI(ov0,ov1);
}
bool
SurfTopo::vertOnBoundary(uint vertIdx) const
{
Uints const & eis = m_verts[vertIdx].edgeInds;
// If this vert is unused it is not on a boundary:
for (size_t ii=0; ii<eis.size(); ++ii)
if (m_edges[eis[ii]].triInds.size() == 1)
return true;
return false;
}
Uints
SurfTopo::vertBoundaryNeighbours(uint vertIdx) const
{
Uints neighs;
Uints const & edgeInds = m_verts[vertIdx].edgeInds;
for (size_t ee=0; ee<edgeInds.size(); ++ee) {
Edge edge = m_edges[edgeInds[ee]];
if (edge.triInds.size() == 1)
neighs.push_back(edge.otherVertIdx(vertIdx));
}
return neighs;
}
Uints
SurfTopo::vertNeighbours(uint vertIdx) const
{
Uints ret;
Uints const & edgeInds = m_verts[vertIdx].edgeInds;
for (size_t ee=0; ee<edgeInds.size(); ++ee)
ret.push_back(m_edges[edgeInds[ee]].otherVertIdx(vertIdx));
return ret;
}
SurfTopo::BoundEdges
SurfTopo::boundaryContainingEdgeP(uint boundEdgeIdx) const
{
BoundEdges boundEdges;
bool moreEdges = false;
do {
Edge const & boundEdge = m_edges[boundEdgeIdx];
Tri const & tri = m_tris[boundEdge.triInds[0]]; // Every boundary edge has exactly 1
Vec2UI vertInds = directEdgeVertInds(boundEdge.vertInds,tri.vertInds);
boundEdges.push_back({boundEdgeIdx,vertInds[1]});
Vert const & vert = m_verts[vertInds[1]]; // Follow edge direction to vert
moreEdges = false;
for (uint edgeIdx : vert.edgeInds) {
if (edgeIdx != boundEdgeIdx) {
if (m_edges[edgeIdx].triInds.size() == 1) { // Another boundary edge
if (!containsMember(boundEdges,&BoundEdge::edgeIdx,edgeIdx)) {
boundEdgeIdx = edgeIdx;
moreEdges = true;
continue;
}
}
}
}
} while (moreEdges);
return boundEdges;
}
SurfTopo::BoundEdges
SurfTopo::boundaryContainingVert(uint vertIdx) const
{
FGASSERT(vertIdx < m_verts.size());
Vert const & vert = m_verts[vertIdx];
for (uint edgeIdx : vert.edgeInds) {
Edge const & edge = m_edges[edgeIdx];
if (edge.triInds.size() == 1) // boundary
return boundaryContainingEdgeP(edgeIdx);
}
return SurfTopo::BoundEdges{};
}
Svec<SurfTopo::BoundEdges>
SurfTopo::boundaries() const
{
Svec<BoundEdges> ret;
auto alreadyAdded = [&ret](uint edgeIdx)
{
for (BoundEdges const & bes : ret)
if (containsMember(bes,&BoundEdge::edgeIdx,edgeIdx))
return true;
return false;
};
for (uint ee=0; ee<m_edges.size(); ++ee) {
if (m_edges[ee].triInds.size() == 1) // Boundary edge
if (!alreadyAdded(ee))
ret.push_back(boundaryContainingEdgeP(ee));
}
return ret;
}
Bools
SurfTopo::boundaryVertFlags() const
{
Svec<BoundEdges> bess = boundaries();
Bools ret (m_verts.size(),false);
for (BoundEdges const & bes : bess) {
for (BoundEdge const & be : bes) {
Edge const & edge = m_edges[be.edgeIdx];
ret[edge.vertInds[0]] = true;
ret[edge.vertInds[1]] = true;
}
}
return ret;
}
set<uint>
SurfTopo::traceFold(
MeshNormals const & norms,
vector<FatBool> & done,
uint vertIdx)
const
{
set<uint> ret;
if (done[vertIdx])
return ret;
done[vertIdx] = true;
Uints const & edgeInds = m_verts[vertIdx].edgeInds;
for (size_t ii=0; ii<edgeInds.size(); ++ii) {
const Edge & edge = m_edges[edgeInds[ii]];
if (edge.triInds.size() == 2) { // Can not be part of a fold otherwise
const FacetNormals & facetNorms = norms.facet[0];
float dot = cDot(facetNorms.tri[edge.triInds[0]],facetNorms.tri[edge.triInds[1]]);
if (dot < 0.5f) { // > 60 degrees
ret.insert(vertIdx);
cUnion_(ret,traceFold(norms,done,edge.otherVertIdx(vertIdx)));
}
}
}
return ret;
}
uint
SurfTopo::oppositeVert(uint triIdx,uint edgeIdx) const
{
Vec3UI tri = m_tris[triIdx].vertInds;
Vec2UI vertInds = m_edges[edgeIdx].vertInds;
for (uint ii=0; ii<3; ++ii)
if ((tri[ii] != vertInds[0]) && (tri[ii] != vertInds[1]))
return tri[ii];
FGASSERT_FALSE;
return 0;
}
Vec3UI
SurfTopo::isManifold() const
{
Vec3UI ret(0);
for (size_t ee=0; ee<m_edges.size(); ++ee) {
const Edge & edge = m_edges[ee];
if (edge.triInds.size() == 1)
++ret[0];
else if (edge.triInds.size() > 2)
++ret[1];
else {
// Check that winding directions of the two facets are opposite on this edge:
Tri tri0 = m_tris[edge.triInds[0]],
tri1 = m_tris[edge.triInds[1]];
uint edgeIdx0 = findFirstIdx(tri0.edgeInds,uint(ee)),
edgeIdx1 = findFirstIdx(tri1.edgeInds,uint(ee));
if (tri0.edge(edgeIdx0) == tri1.edge(edgeIdx1))
++ret[2];
// Worked on all 3DP meshes but doesn't work for some screwy input (eg. frameforge base):
// FGASSERT(tri0.edge(edgeIdx0)[0] == tri1.edge(edgeIdx1)[1]);
// FGASSERT(tri0.edge(edgeIdx0)[1] == tri1.edge(edgeIdx1)[0]);
}
}
return ret;
}
size_t
SurfTopo::unusedVerts() const
{
size_t ret = 0;
for (size_t ii=0; ii<m_verts.size(); ++ii)
if (m_verts[ii].triInds.empty())
++ret;
return ret;
}
Floats
SurfTopo::edgeDistanceMap(Vec3Fs const & verts,size_t vertIdx) const
{
Floats ret(verts.size(),floatMax());
FGASSERT(vertIdx < verts.size());
ret[vertIdx] = 0;
edgeDistanceMap(verts,ret);
return ret;
}
void
SurfTopo::edgeDistanceMap(Vec3Fs const & verts,Floats & vertDists) const
{
FGASSERT(verts.size() == m_verts.size());
FGASSERT(vertDists.size() == verts.size());
bool done = false;
while (!done) {
done = true;
for (size_t vv=0; vv<vertDists.size(); ++vv) {
// Important: check each vertex each time since the topology will often result in
// the first such assignment not being the optimal:
if (vertDists[vv] < floatMax()) {
Uints const & edges = m_verts[vv].edgeInds;
for (size_t ee=0; ee<edges.size(); ++ee) {
uint neighVertIdx = m_edges[edges[ee]].otherVertIdx(uint(vv));
float neighDist = vertDists[vv] + (verts[neighVertIdx]-verts[vv]).len();
if (neighDist < vertDists[neighVertIdx]) {
vertDists[neighVertIdx] = neighDist;
done = false;
}
}
}
}
}
}
Vec3Ds
SurfTopo::boundaryVertNormals(BoundEdges const & boundary,Vec3Ds const & verts) const
{
Vec3Ds edgeNorms; edgeNorms.reserve(boundary.size());
Vec3D v0 = verts[boundary.back().vertIdx];
for (BoundEdge const & be : boundary) {
Vec3D v1 = verts[be.vertIdx];
Edge const & edge = m_edges[be.edgeIdx];
Tri const & tri = m_tris[edge.triInds[0]]; // must be exactly 1 tri
Vec3D triNorm = cTriNorm(tri.vertInds,verts),
xp = crossProduct(v1-v0,triNorm);
edgeNorms.push_back(normalize(xp));
v0 = v1;
}
Vec3Ds vertNorms; vertNorms.reserve(boundary.size());
for (size_t e0=0; e0<boundary.size(); ++e0) {
size_t e1 = (e0 + 1) % boundary.size();
Vec3D dir = edgeNorms[e0] + edgeNorms[e1];
vertNorms.push_back(normalize(dir));
}
return vertNorms;
}
set<uint>
cFillMarkedVertRegion(Mesh const & mesh,SurfTopo const & topo,uint seedIdx)
{
FGASSERT(seedIdx < topo.m_verts.size());
set<uint> ret;
for (MarkedVert const & mv : mesh.markedVerts)
ret.insert(uint(mv.idx));
set<uint> todo;
todo.insert(seedIdx);
while (!todo.empty()) {
set<uint> next;
for (uint idx : todo) {
if (!contains(ret,idx)) {
for (uint n : topo.vertNeighbours(idx))
next.insert(n);
ret.insert(idx);
}
}
todo = next;
}
return ret;
}
void
testmSurfTopo(CLArgs const & args)
{
// Test boundary vert normals by adding marked verts along normals and viewing:
Mesh mesh = loadTri(dataDir()+"base/JaneLoresFace.tri");
TriSurf triSurf = mesh.asTriSurf();
Vec3Ds verts = mapCast<Vec3D>(triSurf.verts);
double scale = cMax(cDims(verts).m) * 0.01; // Extend norms 1% of max dim
SurfTopo topo {triSurf.verts.size(),triSurf.tris};
Svec<SurfTopo::BoundEdges> boundaries = topo.boundaries();
for (auto const & boundary : boundaries) {
Vec3Ds vertNorms = topo.boundaryVertNormals(boundary,verts);
for (size_t bb=0; bb<boundary.size(); ++bb) {
auto const & be = boundary[bb];
Vec3D vert = verts[be.vertIdx] + vertNorms[bb] * scale;
mesh.addMarkedVert(Vec3F(vert),"");
}
}
if (!isAutomated(args))
viewMesh(mesh);
}
void
testmEdgeDist(CLArgs const & args)
{
Mesh mesh = loadTri(dataDir()+"base/Jane.tri");
Surf surf = mergeSurfaces(mesh.surfaces).convertToTris();
SurfTopo topo {mesh.verts.size(),surf.tris.posInds};
size_t vertIdx = 0; // Randomly choose the first
Floats edgeDists = topo.edgeDistanceMap(mesh.verts,vertIdx);
float distMax = 0;
for (size_t ii=0; ii<edgeDists.size(); ++ii)
if (edgeDists[ii] < floatMax())
updateMax_(distMax,edgeDists[ii]);
float distToCol = 255.99f / distMax;
Uchars colVal(edgeDists.size(),255);
for (size_t ii=0; ii<colVal.size(); ++ii)
if (edgeDists[ii] < floatMax())
colVal[ii] = uint(distToCol * edgeDists[ii]);
mesh.surfaces[0].setAlbedoMap(ImgRgba8(128,128,Rgba8(255)));
AffineEw2F otcsToIpcs = cOtcsToIpcs(Vec2UI(128));
for (size_t tt=0; tt<surf.tris.size(); ++tt) {
Vec3UI vertInds = surf.tris.posInds[tt];
Vec3UI uvInds = surf.tris.uvInds[tt];
for (uint ii=0; ii<3; ++ii) {
Rgba8 col(255);
col.red() = colVal[vertInds[ii]];
col.green() = 255 - col.red();
mesh.surfaces[0].material.albedoMap->paint(Vec2UI(otcsToIpcs*mesh.uvs[uvInds[ii]]),col);
}
}
if (!isAutomated(args))
viewMesh(mesh);
}
void
testmBoundVertFlags(CLArgs const & args)
{
Mesh mesh = loadTri(dataDir()+"base/JaneLoresFace.tri"); // 1 surface, all tris
Tris const & tris = mesh.surfaces[0].tris;
SurfTopo topo {mesh.verts.size(),tris.posInds};
Bools boundVertFlags = topo.boundaryVertFlags();
Vec2UI sz {64};
ImgRgba8 map {sz,Rgba8{255}};
AffineEw2F otcsToIpcs = cOtcsToIpcs(sz);
auto paintFn = [&](uint uvIdx)
{
Vec2F otcs = mesh.uvs[uvIdx];
Vec2UI ircs = Vec2UI(otcsToIpcs * otcs);
map.paint(ircs,{255,0,0,255});
};
for (size_t tt=0; tt<tris.size(); ++tt) {
Vec3UI uv = tris.uvInds[tt],
tri = tris.posInds[tt];
for (uint vv=0; vv<3; ++vv)
if (boundVertFlags[tri[vv]])
paintFn(uv[vv]);
}
//viewImage(map);
mesh.surfaces[0].setAlbedoMap(map);
if (!isAutomated(args))
viewMesh(mesh);
}
void
testSurfTopo(CLArgs const & args)
{
Cmds cmds {
{testmSurfTopo,"bnorm","view boundary vertex normals"},
{testmEdgeDist,"edist","view edge distances"},
{testmBoundVertFlags,"bvf","view boundary vertex flags"},
};
return doMenu(args,cmds,true);
}
}
// */
| 33.534014 | 110 | 0.522822 | SingularInversions |
f1ce0e7856384222730a9ca3d4ea779478b2460c | 1,872 | cpp | C++ | src/_leetcode/leet_740.cpp | turesnake/leetPractice | a87b9b90eb8016038d7e5d3ad8e50e4ceb54d69b | [
"MIT"
] | null | null | null | src/_leetcode/leet_740.cpp | turesnake/leetPractice | a87b9b90eb8016038d7e5d3ad8e50e4ceb54d69b | [
"MIT"
] | null | null | null | src/_leetcode/leet_740.cpp | turesnake/leetPractice | a87b9b90eb8016038d7e5d3ad8e50e4ceb54d69b | [
"MIT"
] | null | null | null | /*
* ====================== leet_740.cpp ==========================
* -- tpr --
* CREATE -- 2020.06.29
* MODIFY --
* ----------------------------------------------------------
* 740. 删除与获得点数
*/
#include "innLeet.h"
namespace leet_740 {//~
// dp,思路上类似 “打家劫舍” 题
// 47% 100%
class S{
struct Elem{
int val {};
int num {};
};
public:
// nums 的长度最大为 20000
// 每个整数 nums[i] 的大小都在 [1, 10000] 范围内
int deleteAndEarn( std::vector<int>& nums ){
if( nums.empty() ){ return 0; }
// 整理原始数据
std::sort( nums.begin(), nums.end() );
std::vector<Elem> elems {};
int tval = nums[0];
int tnum = 1;
for( size_t i=1; i<nums.size(); i++ ){
if( nums[i] == tval ){
tnum++;
}else{
elems.push_back(Elem{ tval, tnum });
tval = nums[i];
tnum = 1;
}
}
elems.push_back(Elem{ tval, tnum });
// 正式 dp
int N = static_cast<int>(elems.size());
std::vector<std::vector<int>> dp (N, std::vector<int>(2,0));
dp[0][1] = elems[0].val * elems[0].num;
for( int i=1; i<N; i++ ){// [i-1], [i]
// [0]
dp[i][0] = std::max( dp[i-1][0], dp[i-1][1] );
// [1]
int val = elems[i].val*elems[i].num;
if( elems[i].val-elems[i-1].val == 1 ){// 相邻
dp[i][1] = dp[i-1][0] + val;
}else{// 不相邻
dp[i][1] = std::max(dp[i-1][0], dp[i-1][1]) + val;
}
}
return std::max( dp[N-1][0], dp[N-1][1] );
}
};
//=========================================================//
void main_(){
debug::log( "\n~~~~ leet: 740 :end ~~~~\n" );
}
}//~
| 23.4 | 68 | 0.350427 | turesnake |
f1cf8fc105c5da9f00cf2059bff4bf5b0abb3815 | 2,293 | hpp | C++ | test/svscan/mock_service.hpp | taylorb-microsoft/winss | ede93f84a5d9585502db5190f2ec6365858f695a | [
"Apache-2.0"
] | 52 | 2017-01-05T23:39:38.000Z | 2020-06-04T03:00:11.000Z | test/svscan/mock_service.hpp | morganstanley/winss | ede93f84a5d9585502db5190f2ec6365858f695a | [
"Apache-2.0"
] | 24 | 2017-01-05T05:07:34.000Z | 2018-03-09T00:50:58.000Z | test/svscan/mock_service.hpp | morganstanley/winss | ede93f84a5d9585502db5190f2ec6365858f695a | [
"Apache-2.0"
] | 7 | 2016-12-27T20:55:20.000Z | 2018-03-09T00:32:19.000Z | /*
* Copyright 2016-2017 Morgan Stanley
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef TEST_SVSCAN_MOCK_SERVICE_HPP_
#define TEST_SVSCAN_MOCK_SERVICE_HPP_
#include <filesystem>
#include <utility>
#include <string>
#include "gmock/gmock.h"
#include "winss/svscan/service.hpp"
namespace fs = std::experimental::filesystem;
using ::testing::NiceMock;
using ::testing::ReturnRef;
namespace winss {
class MockService : public virtual winss::Service {
public:
MockService() {
ON_CALL(*this, GetName()).WillByDefault(ReturnRef(name));
}
explicit MockService(std::string name) :
winss::Service::ServiceTmpl(name) {}
MockService(const MockService&) = delete;
MockService(MockService&& s) :
winss::Service::ServiceTmpl(std::move(s)) {}
MOCK_CONST_METHOD0(GetName, const std::string&());
MOCK_CONST_METHOD0(IsFlagged, bool());
MOCK_METHOD0(Reset, void());
MOCK_METHOD0(Check, void());
MOCK_METHOD1(Close, bool(bool ignore_flagged));
MockService& operator=(const MockService&) = delete;
MockService& operator=(MockService&& p) {
winss::Service::operator=(std::move(p));
return *this;
}
};
class NiceMockService : public NiceMock<MockService> {
public:
NiceMockService() {}
explicit NiceMockService(std::string name) :
winss::Service::ServiceTmpl(name) {}
NiceMockService(const NiceMockService&) = delete;
NiceMockService(NiceMockService&& p) :
winss::Service::ServiceTmpl(std::move(p)) {}
NiceMockService& operator=(const NiceMockService&) = delete;
NiceMockService& operator=(NiceMockService&& p) {
winss::Service::operator=(std::move(p));
return *this;
}
};
} // namespace winss
#endif // TEST_SVSCAN_MOCK_SERVICE_HPP_
| 27.963415 | 74 | 0.703009 | taylorb-microsoft |
f1da495c55dca34d529f8248b1990f02491ea1c7 | 3,330 | hpp | C++ | source/include/coffee/http/HttpResponse.hpp | ciscoruiz/wepa | e6d922157543c91b6804f11073424a0a9c6e8f51 | [
"MIT"
] | 2 | 2018-02-03T06:56:29.000Z | 2021-04-20T10:28:32.000Z | source/include/coffee/http/HttpResponse.hpp | ciscoruiz/wepa | e6d922157543c91b6804f11073424a0a9c6e8f51 | [
"MIT"
] | 8 | 2018-02-18T21:00:07.000Z | 2018-02-20T15:31:24.000Z | source/include/coffee/http/HttpResponse.hpp | ciscoruiz/wepa | e6d922157543c91b6804f11073424a0a9c6e8f51 | [
"MIT"
] | 1 | 2018-02-09T07:09:26.000Z | 2018-02-09T07:09:26.000Z | // MIT License
//
// Copyright (c) 2018 Francisco Ruiz ([email protected])
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
#ifndef _coffee_http_HttpResponse_hpp_
#define _coffee_http_HttpResponse_hpp_
#include <coffee/http/HttpMessage.hpp>
namespace coffee {
namespace http {
namespace protocol {
namespace state {
class HttpProtocolWaitingMessage;
}
}
class HttpRequest;
/**
* General definition for HTTP requests following RFC 2616.
*
* The first line of any HTTP-request will be:
* /code
* <METHOD> <URI> HTTP/<MAYOR VERSION>.<MINOR VERSION>
* /endcode
*
* \author [email protected]
*/
class HttpResponse : public HttpMessage {
public:
static std::shared_ptr<HttpResponse> instantiate(const std::shared_ptr<HttpRequest>& request)
noexcept
{
std::shared_ptr<HttpResponse> result(new HttpResponse(request));
return result;
}
static std::shared_ptr<HttpResponse> instantiate(const uint16_t majorVersion, const uint16_t minorVersion, const int statusCode, const std::string& errorDescription)
noexcept
{
std::shared_ptr<HttpResponse> result(new HttpResponse(majorVersion, minorVersion, statusCode, errorDescription));
return result;
}
HttpResponse& setStatusCode(const int statusCode) noexcept { m_statusCode = statusCode; return *this; }
HttpResponse& setErrorDescription(const std::string& errorDescription) noexcept { m_errorDescription = errorDescription; return *this; }
bool isOk() const noexcept { return m_statusCode == 200; }
int getStatusCode() const noexcept { return m_statusCode; }
const std::string& getErrorDescription() const noexcept { return m_errorDescription; }
protected:
/**
* Constructor.
*/
explicit HttpResponse(const std::shared_ptr<HttpRequest>& request);
HttpResponse(const uint16_t majorVersion, const uint16_t minorVersion, const int statusCode, const std::string& errorDescription);
/**
* @return the first line in the HTTP message.
*/
std::string encodeFirstLine() const throw(basis::RuntimeException);
private:
int m_statusCode;
std::shared_ptr<HttpRequest> m_request;
std::string m_errorDescription;
friend class protocol::state::HttpProtocolWaitingMessage;
};
}
}
#endif // _coffee_http_HttpResponse_hpp_
| 35.052632 | 168 | 0.751351 | ciscoruiz |
f1de45a3fbe4bbbbc6097c1095eb0a2c14f47b53 | 2,305 | cpp | C++ | POJ/10 - 13/poj1185.cpp | bilibiliShen/CodeBank | 49a69b2b2c3603bf105140a9d924946ed3193457 | [
"MIT"
] | 1 | 2017-08-19T16:02:15.000Z | 2017-08-19T16:02:15.000Z | POJ/10 - 13/poj1185.cpp | bilibiliShen/CodeBank | 49a69b2b2c3603bf105140a9d924946ed3193457 | [
"MIT"
] | null | null | null | POJ/10 - 13/poj1185.cpp | bilibiliShen/CodeBank | 49a69b2b2c3603bf105140a9d924946ed3193457 | [
"MIT"
] | 1 | 2018-01-05T23:37:23.000Z | 2018-01-05T23:37:23.000Z | #include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long int64;
template<class T>inline bool updateMin(T& a, T b){ return a > b ? a = b, 1: 0; }
template<class T>inline bool updateMax(T& a, T b){ return a < b ? a = b, 1: 0; }
int n, m;
char map[101][11];
int s[101][1024];
int num[101], v[1024];
int maxx;
int ok(int s, int t)
{
for (int i = 0, j = 0; i < m; )
{
j = t & (1 << i);
if (j)
{
if (map[s][i + 1] == 'H') return 0;
if (i + 1 < m && (t & (1 << (i + 1)))) return 0;
if (i + 2 < m && (t & (1 << (i + 2)))) return 0;
i += 3;
}
else i++;
}
return 1;
}
void init(){
for (int i = 1; i <= n; i++) for (int j = 0; j < maxx; j++)
if (ok (i, j))
{
s[i][num[i]] = j;
num[i]++;
}
for (int i = 0; i < maxx; i++) for (int j = 0; j < m; j++)
if (i & (1 << j)) v[i]++;
}
int ok2(int s, int t)
{
for (int i = 0, j = 0, k = 0; i < m; i++)
{
j = s & (1 << i);
k = t & (1 << i);
if (j && k) return 0;
}
return 1;
}
int dp[101][1024][1024];
void solve (){
int i, j, k, t;
char c;
cin >> n >> m;
for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++)
cin >> map[i][j];
maxx = pow(2.0, m);
init();
if (n == 1)
{
int ans = 0;
for (int i = 0; i < num[1]; i++)
ans = max(ans, v[s[1][i]]);
cout << ans << endl;
return;
}
for (int i = 0; i < num[1]; i++) for (int j = 0; j < num[2]; j++)
if (ok2(s[1][i], s[2][j]))
dp[2][j][i] = v[s[1][i]] + v[s[2][j]];
for (int i = 3; i <= n; i++) for (int j = 0; j < num[i]; j++)
for (int k = 0; k < num[i - 1]; k++)
if (ok2(s[i][j], s[i - 1][k]))
{
for (int t = 0; t < num[i - 2]; t++)
if (ok2(s[i][j], s[i - 2][t]) && ok2(s[i - 1][k], s[i - 2][t]))
updateMax(dp[i][j][k], dp[i - 1][k][t] + v[s[i][j]]);
}
int ans = 0;
for (int i = 0; i < num[n]; i++)
for (int j = 0; j < num[n - 1]; j++)
updateMax(ans, dp[n][i][j]);
cout << ans << endl;
}
int main()
{
solve();
return 0;
} | 23.282828 | 80 | 0.390889 | bilibiliShen |
f1e07af3cb00c29e622d43fef704df02a835263e | 821 | cpp | C++ | src/classwork/03_assign/main.cpp | IrvinBeltranACC/acc-cosc-1337-spring-2021-IrvinBeltranACC | 379a48eb330bd00b307a67fca182d588a13b00ff | [
"MIT"
] | null | null | null | src/classwork/03_assign/main.cpp | IrvinBeltranACC/acc-cosc-1337-spring-2021-IrvinBeltranACC | 379a48eb330bd00b307a67fca182d588a13b00ff | [
"MIT"
] | null | null | null | src/classwork/03_assign/main.cpp | IrvinBeltranACC/acc-cosc-1337-spring-2021-IrvinBeltranACC | 379a48eb330bd00b307a67fca182d588a13b00ff | [
"MIT"
] | 1 | 2021-02-05T03:03:49.000Z | 2021-02-05T03:03:49.000Z | //Write the include statement for decisions.h here
#include <iostream>
#include "decision.h"
//Write namespace using statements for cout and cin
using std:: cout; using std::cin ;
int main()
{
int grade;
std::string letter_grade_if;
std::string letter_grade_switch;
cout<<"\nEnter a numerical grade between 0-100 and I will tell you what letter grade it is! Grade: ";
cin>> grade;
if (grade >= 0 && grade <= 100)
{
letter_grade_if = get_letter_grade_using_if(grade);
letter_grade_switch = get_letter_grade_using_switch(grade);
cout<<"\nYour numerical grade of "<<grade<<" turned into a letter grade is: "<<letter_grade_if<<"! Congrats on the "<<letter_grade_switch<<"!\n\nHope you are happy with your grade.\n";
}
else
cout<<"\nThe numbered you entered was out of range.\n";
return 0;
}
| 22.805556 | 186 | 0.711328 | IrvinBeltranACC |
f1e536af449a94bfcb37487fbb4d120d8c96090c | 848 | cpp | C++ | Group-Video/OpenVideoCall-Linux/sample/OpenVideoCall/OpenVideoCallApp.cpp | 635342478/Basic-Video-Call | d4013342e176df268c7b5030bf8168f95cf664c2 | [
"MIT"
] | 666 | 2018-10-03T19:51:47.000Z | 2022-03-29T04:27:02.000Z | Group-Video/OpenVideoCall-Linux/sample/OpenVideoCall/OpenVideoCallApp.cpp | 635342478/Basic-Video-Call | d4013342e176df268c7b5030bf8168f95cf664c2 | [
"MIT"
] | 180 | 2018-10-09T23:17:10.000Z | 2022-03-31T13:21:42.000Z | Group-Video/OpenVideoCall-Linux/sample/OpenVideoCall/OpenVideoCallApp.cpp | 635342478/Basic-Video-Call | d4013342e176df268c7b5030bf8168f95cf664c2 | [
"MIT"
] | 1,128 | 2018-10-01T05:50:12.000Z | 2022-03-24T09:13:33.000Z | #include "AgoraDefs.h"
#include "OpenVideoCallApp.h"
#include "View/CommandLineView.h"
#include "Controller/EngineController.h"
#include "EngineModel/AGEngineModel.h"
OpenVideoCallApp::OpenVideoCallApp() {
m_view = new CommandLineView();
m_controller = new EngineController();
m_controller->setView(m_view);
m_controller->setModel(AGEngineModel::Get());
}
OpenVideoCallApp::~OpenVideoCallApp() {
if(m_view) {
delete m_view;
m_view = NULL;
}
if(m_controller) {
m_controller->setView(NULL);
m_controller->setModel(NULL);
delete m_controller;
m_controller = NULL;
}
}
void OpenVideoCallApp::loadConfig(const AppConfig& cfg) {
m_view->configure(cfg);
}
void OpenVideoCallApp::run(bool open) {
AGEngineModel::Get()->initialize();
m_view->run(open);
}
| 21.74359 | 57 | 0.676887 | 635342478 |
f1effaa9a7ee21e4822ea94125ca78227be51f4c | 1,125 | cpp | C++ | Actions/SaveByTypeAction.cpp | D4rk1n/Project | c2dcfd0fc52cb0c7d755e5fc387171fc09bc3aae | [
"Apache-2.0"
] | 2 | 2019-06-15T21:46:56.000Z | 2019-06-22T02:20:28.000Z | Actions/SaveByTypeAction.cpp | D4rk1n/Project | c2dcfd0fc52cb0c7d755e5fc387171fc09bc3aae | [
"Apache-2.0"
] | 1 | 2019-06-22T03:31:52.000Z | 2019-06-22T03:44:14.000Z | Actions/SaveByTypeAction.cpp | D4rk1n/Paint-For-Kids-Project | c2dcfd0fc52cb0c7d755e5fc387171fc09bc3aae | [
"Apache-2.0"
] | 1 | 2018-12-30T09:47:25.000Z | 2018-12-30T09:47:25.000Z | #include "SaveByTypeAction.h"
#include "..\ApplicationManager.h"
#include "..\Figures\CElipse.h"
#include "..\Figures\CRectangle.h"
#include "..\Figures\CTriangle.h"
#include "..\Figures\CRhombus.h"
#include "..\Figures\CLine.h"
#include "..\GUI\UI_Info.h"
#include "..\GUI\input.h"
#include "..\GUI\Output.h"
#include "..\DEFS.h"
SaveByTypeAction::SaveByTypeAction(ApplicationManager *pApp):Action(pApp)
{
}
void SaveByTypeAction::ReadActionParameters(){
pOut = pManager->GetOutput();
pOut->PrintMessage("Choose the type of the figure you want to save");
pIn = pManager->GetInput();
ActionType a;
do{
a=pIn->GetUserAction();
switch(a){
case DRAW_RECT:
type=1;
break;
case DRAW_LINE:
type=2;
break;
case DRAW_TRI:
type=3;
break;
case DRAW_ELLIPSE:
type=5;
break;
case DRAW_RHOMBUS:
type=4;
break;
default:
break;
}
}
while(type!=1&&type!=2&&type!=3&&type!=4&&type!=5);
FileName = pIn->GetSrting(pOut);
OutFile.open(FileName);
}
void SaveByTypeAction::Execute(){
ReadActionParameters();
pManager->SaveType(type,OutFile,colors, figures);
OutFile.close();
}
| 19.396552 | 73 | 0.68 | D4rk1n |
f1f226b7679f8e35dd4ad10646256f600e1a1c0f | 5,101 | cpp | C++ | rdf3x/src/rts/GroupBy.cpp | dkw-aau/trident-clone | 18f896db2be05870069ae7b3aa6b4837c74fff0f | [
"Apache-2.0"
] | 20 | 2018-10-17T21:39:40.000Z | 2021-11-10T11:07:23.000Z | rdf3x/src/rts/GroupBy.cpp | dkw-aau/trident-clone | 18f896db2be05870069ae7b3aa6b4837c74fff0f | [
"Apache-2.0"
] | 5 | 2020-07-06T22:50:04.000Z | 2022-03-17T10:34:15.000Z | rdf3x/src/rts/GroupBy.cpp | dkw-aau/trident-clone | 18f896db2be05870069ae7b3aa6b4837c74fff0f | [
"Apache-2.0"
] | 9 | 2018-09-18T11:37:35.000Z | 2022-03-29T07:46:41.000Z | #include <algorithm>
#include <rts/operator/GroupBy.hpp>
#include <rts/operator/PlanPrinter.hpp>
#include <algorithm>
GroupBy::GroupBy(Operator* child,
std::map<unsigned, Register*> bindings,
std::vector<unsigned> regs,
bool distinct,
double expectedOutputCardinality) : Operator(expectedOutputCardinality), child(child), bindings(bindings), regs(regs), distinct(distinct) {
// initialize keys: index is position number, value is register number
for (auto v = bindings.begin(); v != bindings.end(); v++) {
keys.push_back(v->first);
}
}
/// Destructor
GroupBy::~GroupBy() {
delete child;
}
std::vector<unsigned> GroupBy::calculateFieldsToCompare(
std::vector<unsigned> &keys,
std::vector<unsigned> ®s) {
std::vector<unsigned> fields;
// regs contains the register numbers on which to sort, in order.
// We need to find them in the keys vector, and remember the index.
for (auto v = regs.begin(); v != regs.end(); v++) {
bool found = false;
for (unsigned i = 0; i < keys.size(); i++) {
if (keys[i] == *v) {
// Found it, remember the index
fields.push_back(i);
found = true;
break;
}
}
if (! found) {
// This should not happen, obviously. Trying to sort on a register that is not
// present???
throw 10;
}
}
return fields;
}
struct ValueSorter {
// The sorter requires a list of indices in sort-field order
std::vector<unsigned> fields;
ValueSorter(std::vector<unsigned> &fields) : fields(fields) {
}
bool operator() (const std::unique_ptr<std::vector<uint64_t>> &v1,
const std::unique_ptr<std::vector<uint64_t>> &v2) {
for (auto v = fields.begin(); v != fields.end(); v++) {
if ((*v1)[*v] < (*v2)[*v]) {
return true;
}
if ((*v1)[*v] > (*v2)[*v]) {
return false;
}
}
// Don't care ...
return false;
}
};
bool GroupBy::sameThanPrevious(uint64_t index) {
for(uint8_t i = 0; i < fields.size(); ++i) {
unsigned fieldId = fields[i];
if (values[index-1]->at(fieldId) != values[index]->at(fieldId)) {
return false;
}
}
return true;
}
/// Produce the first tuple
uint64_t GroupBy::first() {
observedOutputCardinality=0;
uint64_t cnt = child->first();
while (cnt > 0) {
std::unique_ptr<std::vector<uint64_t>> tuple = std::unique_ptr<
std::vector<uint64_t>>(new std::vector<uint64_t>());
// Get value from bindings
for (int i = 0; i < bindings.size(); i++) {
tuple->push_back(bindings[keys[i]]->value);
}
// And save count if needed
if (!distinct) {
tuple->push_back(cnt);
}
// Store into values vector
values.push_back(std::move(tuple));
// Get next value from child
cnt = child->next();
}
// sort values vector according to regs
fields = calculateFieldsToCompare(keys, regs);
std::sort(values.begin(), values.end(), ValueSorter(fields));
// initialize
index = 1;
// Restore first value into bindings
if (!values.empty()) {
for (int i = 0; i < bindings.size(); i++) {
bindings[keys[i]]->value = (*values[0])[i];
}
// Restore count if needed
cnt = distinct ? 1 : (*values[0])[bindings.size()];
// Destroy saved value, it is no longer needed
//delete values[0];
//values[0] = NULL;
observedOutputCardinality += cnt;
return cnt;
} else {
return 0;
}
}
/// Produce the next tuple
uint64_t GroupBy::next() {
//if "distinct == 1" then move to the first row with a different key
while (distinct && index < values.size() && sameThanPrevious(index)) {
index++;
}
if (index >= values.size()) {
// No more values available
return 0;
}
// Restore count if needed
uint64_t sz = distinct ? 1 : (*values[index])[bindings.size()];
// Restore value into bindings
for (int i = 0; i < bindings.size(); i++) {
bindings[keys[i]]->value = (*values[index])[i];
}
// Destroy saved value, it is no longer needed
//delete values[index];
//values[index] = NULL;
// Prepare for next next() call.
index++;
// and return
observedOutputCardinality += sz;
return sz;
}
/// Print the operator tree. Debugging only.
void GroupBy::print(PlanPrinter& out) {
out.beginOperator("GroupBy",expectedOutputCardinality, observedOutputCardinality);
child->print(out);
out.endOperator();
}
/// Add a merge join hint
void GroupBy::addMergeHint(Register* reg1,Register* reg2) {
child->addMergeHint(reg1, reg2);
}
/// Register parts of the tree that can be executed asynchronous
void GroupBy::getAsyncInputCandidates(Scheduler& scheduler) {
child->getAsyncInputCandidates(scheduler);
}
| 29.148571 | 147 | 0.576162 | dkw-aau |
f1f95ab7ceac4f70a394d48d6d8be9dcbcd6ccd6 | 2,668 | cpp | C++ | source/language/scope.cpp | ThatGuyMike7/masonc | 43a3a69cd64f52fda8a629360c52a222549d6368 | [
"BSL-1.0"
] | 3 | 2020-08-10T13:37:48.000Z | 2021-07-06T10:14:39.000Z | source/language/scope.cpp | ThatGuyMike7/masonc | 43a3a69cd64f52fda8a629360c52a222549d6368 | [
"BSL-1.0"
] | null | null | null | source/language/scope.cpp | ThatGuyMike7/masonc | 43a3a69cd64f52fda8a629360c52a222549d6368 | [
"BSL-1.0"
] | null | null | null | #include <scope.hpp>
#include <logger.hpp>
#include <common.hpp>
#include <mod.hpp>
#include <iostream>
#include <optional>
namespace masonc
{
scope_index scope::index()
{
return m_index;
}
const mod& scope::get_module()
{
return *m_module;
}
const char* scope::name()
{
if (name_handle)
return m_module->scope_names.at(name_handle.value());
else
return nullptr;
}
void scope::set_name(const char* name, u16 name_length)
{
if (name_handle)
return;
name_handle = m_module->scope_names.copy_back(name, name_length);
}
// TODO: Instead of doing this, just keep a vector of pointers to parents in the scope.
std::vector<scope*> scope::parents()
{
scope* current_scope = &m_module->module_scope;
std::vector<scope*> parents = { current_scope };
for (u64 i = 0; i < m_index.size(); i += 1) {
current_scope = ¤t_scope->children[m_index[i]];
parents.push_back(current_scope);
}
return parents;
}
scope_index scope::add_child(const scope& child)
{
u64 added_child_index = children.size();
scope* added_child = &children.emplace_back(child);
added_child->m_index = m_index;
added_child->m_index.push_back(added_child_index);
added_child->m_module = m_module;
return added_child->m_index;
}
scope* scope::get_child(const scope_index& index)
{
scope* child = this;
for (u64 i = child->m_index.size(); i < index.size(); i += 1) {
child = &child->children[index[i]];
}
return child;
}
bool scope::add_symbol(symbol element)
{
if (is_symbol_defined(element))
return false;
symbols.insert(element);
return true;
}
bool scope::find_symbol(symbol element, u64 offset)
{
auto parent_scopes = parents();
// TODO: Look at imported modules as well.
if (parent_scopes.size() <= offset)
return false;
for (u64 i = parent_scopes.size() - offset; i >= 0; i -= 1) {
scope* current_parent_scope = parent_scopes[i];
auto symbol_search = current_parent_scope->symbols.find(element);
if (symbol_search != current_parent_scope->symbols.end())
return true;
}
return false;
}
bool scope::is_symbol_defined(symbol element)
{
return (symbols.find(element) != symbols.end());
//return (symbols_lookup.find(element) != symbols_lookup.end());
}
} | 24.036036 | 91 | 0.583958 | ThatGuyMike7 |
f1fadb7d0fdf8d7f5326fda99653732f2199563c | 5,795 | cpp | C++ | src/animation_runner/animation_runner.cpp | Mercotui/truncated-cube-lamp | 0fbccd0f5189b0c6aed530569c77e22cdfec92cd | [
"MIT"
] | 1 | 2021-11-30T16:20:29.000Z | 2021-11-30T16:20:29.000Z | src/animation_runner/animation_runner.cpp | Mercotui/truncated-cube-lamp | 0fbccd0f5189b0c6aed530569c77e22cdfec92cd | [
"MIT"
] | 1 | 2022-02-27T13:27:44.000Z | 2022-02-27T13:27:44.000Z | src/animation_runner/animation_runner.cpp | Mercotui/truncated-cube-lamp | 0fbccd0f5189b0c6aed530569c77e22cdfec92cd | [
"MIT"
] | null | null | null | #include "animation_runner.hpp"
#include <QtCore/QCoreApplication>
#include <QtCore/QDir>
#include <QtCore/QDirIterator>
#include <QtCore/QLoggingCategory>
#include <QtCore/QThread>
#include <algorithm>
#include <utility>
Q_LOGGING_CATEGORY(AnimationRunnerLog, "animation.runner", QtInfoMsg)
namespace {
constexpr int kMinimumFrameIntervalMS = 16; // for max 60 fps
constexpr std::string_view kLibrariesResourceDir = ":/libraries";
constexpr auto kClearColor = "black";
QJSValue createAnimationContext(QJSEngine *engine,
const QDateTime &previous_frame_time,
const QDateTime ¤t_frame_time,
ScreenInterfaceJs *screen) {
auto context = engine->newObject();
auto libs = engine->newObject();
libs.setProperty("chroma", engine->globalObject().property("chroma"));
context.setProperty("libs", libs);
context.setProperty("current_frame_time",
engine->toScriptValue(current_frame_time));
context.setProperty("previous_frame_time",
engine->toScriptValue(previous_frame_time));
context.setProperty("screen", engine->newQObject(screen));
return context;
}
} // namespace
AnimationRunner::AnimationRunner(
std::unique_ptr<ScreenControllerInterface> screen_controller)
: QObject(),
do_loop_(false),
loop_timer_(new QTimer(this)),
engine_(new QJSEngine(this)),
screen_interface_js_(
new ScreenInterfaceJs(screen_controller->getResolution(), this)),
screen_(std::move(screen_controller)) {
Q_INIT_RESOURCE(libraries);
loadLibraries();
engine_->installExtensions(QJSEngine::ConsoleExtension);
loop_timer_->setSingleShot(true);
connect(loop_timer_, &QTimer::timeout, this, &AnimationRunner::loop);
connect(screen_interface_js_, &ScreenInterfaceJs::draw,
[this]() { screen_->draw(screen_interface_js_->pixels()); });
}
AnimationRunner::~AnimationRunner() { Q_CLEANUP_RESOURCE(libraries); }
void AnimationRunner::loadLibraries() {
auto website_dir = QDir(kLibrariesResourceDir.data());
QDirIterator dir_it(website_dir.path(), {}, QDir::Files,
QDirIterator::Subdirectories);
while (dir_it.hasNext()) {
auto file_path = dir_it.next();
auto file_path_without_resource =
file_path.mid(kLibrariesResourceDir.size());
QFile scriptFile(file_path);
if (!scriptFile.open(QIODevice::ReadOnly)) {
qCWarning(AnimationRunnerLog) << "Tried to load library" << file_path
<< "but could not open the file";
continue;
}
qCInfo(AnimationRunnerLog)
<< "Loading library" << file_path_without_resource << "from"
<< file_path;
QTextStream stream(&scriptFile);
QString contents = stream.readAll();
scriptFile.close();
auto result = engine_->evaluate(contents, file_path);
if (result.isError()) {
qCWarning(AnimationRunnerLog)
<< "Loading" << file_path_without_resource << "failed at line"
<< result.property("lineNumber").toInt() << ":" << result.toString();
}
}
}
void AnimationRunner::stopScript() {
engine_->setInterrupted(true);
do_loop_ = false;
loop_timer_->stop();
}
void AnimationRunner::runScript(QString animation_script) {
// reset screen
screen_interface_js_->setAllPixels(kClearColor);
screen_->clear();
// reset runner
stopScript();
engine_->setInterrupted(false);
previous_frame_time_ = QDateTime::currentDateTime();
animation_obj_ = QJSValue();
// create new animation runner from script
auto eval_result = engine_->evaluate("\"use strict\";\n" + animation_script +
"\nnew Animation();");
if (eval_result.isError()) {
// this error can be caused by the user, so it's only logged in debug mode
qCDebug(AnimationRunnerLog)
<< "eval error at line" << eval_result.property("lineNumber").toInt()
<< ":" << eval_result.toString();
} else if (eval_result.property("update").isCallable()) {
// everything seems fine, start loop
animation_obj_ = eval_result;
do_loop_ = true;
loop();
} else {
qCDebug(AnimationRunnerLog)
<< "Created instance does not have update function:"
<< eval_result.toString();
}
}
void AnimationRunner::loop() {
qCDebug(AnimationRunnerLog)
<< "looping on thread:" << QThread::currentThread()
<< "application thread is:" << QCoreApplication::instance()->thread();
// create context
auto current_frame_time = QDateTime::currentDateTime();
auto animation_params = createAnimationContext(
engine_, previous_frame_time_, current_frame_time, screen_interface_js_);
previous_frame_time_ = current_frame_time;
// run animation fucntion
auto animation_function = animation_obj_.property("update");
auto result =
animation_function.callWithInstance(animation_obj_, {animation_params});
// handle result
if (result.isDate()) {
int requested_interval =
QDateTime::currentDateTime().msecsTo(result.toDateTime());
int corrected_interval =
std::max(requested_interval, kMinimumFrameIntervalMS);
qCDebug(AnimationRunnerLog)
<< "loop sleeping for " << corrected_interval << "ms";
// start timer for next loop itteration
if (do_loop_) {
loop_timer_->start(corrected_interval);
}
} else if (result.isUndefined()) {
qCDebug(AnimationRunnerLog) << "got \"undefined\" loop ending";
do_loop_ = false;
} else {
qCDebug(AnimationRunnerLog)
<< "loop error at line" << result.property("lineNumber").toInt() << ":"
<< result.toString();
do_loop_ = false;
}
}
QSize AnimationRunner::getResolution() { return screen_->getResolution(); }
| 34.909639 | 79 | 0.679034 | Mercotui |
f1fd08670f58b9ec04eaa0c75e096215f8ad1993 | 1,773 | hpp | C++ | libs/network/include/network/generics/callbacks.hpp | devjsc/ledger-1 | 2aa68e05b9f9c10a9971fc8ddf4848695511af3c | [
"Apache-2.0"
] | 3 | 2019-07-11T08:49:27.000Z | 2021-09-07T16:49:15.000Z | libs/network/include/network/generics/callbacks.hpp | devjsc/ledger-1 | 2aa68e05b9f9c10a9971fc8ddf4848695511af3c | [
"Apache-2.0"
] | null | null | null | libs/network/include/network/generics/callbacks.hpp | devjsc/ledger-1 | 2aa68e05b9f9c10a9971fc8ddf4848695511af3c | [
"Apache-2.0"
] | 2 | 2019-11-13T10:55:24.000Z | 2019-11-13T11:37:09.000Z | #pragma once
//------------------------------------------------------------------------------
//
// Copyright 2018-2019 Fetch.AI Limited
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//------------------------------------------------------------------------------
#include <utility>
#include <vector>
namespace fetch {
namespace generics {
template <typename FUNC>
class Callbacks
{
public:
Callbacks(const Callbacks &rhs) = delete;
Callbacks(Callbacks &&rhs) = delete;
Callbacks &operator=(const Callbacks &rhs) = delete;
Callbacks &operator=(Callbacks &&rhs) = delete;
bool operator==(const Callbacks &rhs) const = delete;
bool operator<(const Callbacks &rhs) const = delete;
Callbacks &operator=(FUNC func)
{
callbacks_.push_back(func);
return *this;
}
operator bool() const
{
return !callbacks_.empty();
}
template <class... U>
void operator()(U &&... u)
{
for (auto func : callbacks_)
{
func(std::forward<U>(u)...);
}
}
void clear(void)
{
callbacks_.clear();
}
explicit Callbacks() = default;
virtual ~Callbacks() = default;
private:
std::vector<FUNC> callbacks_;
};
} // namespace generics
} // namespace fetch
| 24.625 | 80 | 0.601241 | devjsc |
f1fd9de1155d653a44ccb0e04cf7767249e9a536 | 2,493 | cpp | C++ | src/LG/lg-P1175.cpp | krishukr/cpp-code | 1c94401682227bd86c0d9295134d43582247794e | [
"MIT"
] | 1 | 2021-08-13T14:27:39.000Z | 2021-08-13T14:27:39.000Z | src/LG/lg-P1175.cpp | krishukr/cpp-code | 1c94401682227bd86c0d9295134d43582247794e | [
"MIT"
] | null | null | null | src/LG/lg-P1175.cpp | krishukr/cpp-code | 1c94401682227bd86c0d9295134d43582247794e | [
"MIT"
] | null | null | null | #include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <list>
#include <stack>
void out(std::string s);
int pri(char x);
int num(int a, int b, char op);
std::string trans(std::string s);
void calc(std::string s);
int main() {
std::ios::sync_with_stdio(false);
std::string s;
std::cin >> s;
calc(trans(s));
return 0;
}
void out(std::string s) {
for (auto i : s) {
std::cout << i << ' ';
}
std::cout << '\n';
}
int pri(char x) {
switch (x) {
case '(':
case ')':
return 0;
case '+':
case '-':
return 1;
case '*':
case '/':
return 2;
case '^':
return 3;
default:
return -1;
}
}
std::string trans(std::string s) {
std::string res{};
std::stack<char> stk;
for (auto i : s) {
if (isdigit(i)) {
res.push_back(i);
} else if (i == '(') {
stk.push(i);
} else if (i == ')') {
while (!stk.empty() and stk.top() != '(') {
res.push_back(stk.top());
stk.pop();
}
stk.pop();
} else {
while (!stk.empty() and pri(stk.top()) >= pri(i)) {
res.push_back(stk.top());
stk.pop();
}
stk.push(i);
}
}
while (!stk.empty()) {
res.push_back(stk.top());
stk.pop();
}
return res;
}
int num(int a, int b, char op) {
switch (op) {
case '+':
return a + b;
case '-':
return a - b;
case '*':
return a * b;
case '/':
return a / b;
case '^':
return std::pow(a, b);
default:
return -1;
}
}
void calc(std::string s) {
out(s);
std::list<int> stk;
for (auto it = s.begin(); it != s.end(); it++) {
auto i = *it;
if (isdigit(i)) {
stk.push_back(i - 48);
} else {
int b = stk.back();
stk.pop_back();
int a = stk.back();
stk.pop_back();
stk.push_back(num(a, b, i));
for (auto j : stk) {
std::cout << j << ' ';
}
for (auto jt = it + 1; jt != s.end(); jt++) {
auto j = *jt;
std::cout << j << ' ';
}
std::cout << '\n';
}
}
}
| 19.629921 | 63 | 0.384276 | krishukr |
f1ff1dd453499abb5396b20b59f4a38318c663a1 | 419 | cpp | C++ | Chapter01/philosophy/time/good_time.cpp | gbellizio/Software-Architecture-with-Cpp | eb0f7a52ef1253d9b0091714eee9c94c156b02bc | [
"MIT"
] | 193 | 2021-03-27T00:46:13.000Z | 2022-03-29T07:25:00.000Z | Chapter01/philosophy/time/good_time.cpp | gbellizio/Software-Architecture-with-Cpp | eb0f7a52ef1253d9b0091714eee9c94c156b02bc | [
"MIT"
] | 6 | 2021-03-26T05:48:17.000Z | 2022-02-15T12:16:54.000Z | Chapter01/philosophy/time/good_time.cpp | gbellizio/Software-Architecture-with-Cpp | eb0f7a52ef1253d9b0091714eee9c94c156b02bc | [
"MIT"
] | 64 | 2021-04-01T02:18:55.000Z | 2022-03-14T12:32:29.000Z | #include <chrono>
using namespace std::literals::chrono_literals;
struct Duration {
std::chrono::milliseconds millis_;
};
void example() {
auto d = Duration{};
// d.millis_ = 100; // compilation error, as 100 could mean anything
d.millis_ = 100ms; // okay
auto timeout = 1s; // or std::chrono::seconds(1);
d.millis_ =
timeout; // okay, seconds will be converted automatically to milliseconds
}
| 23.277778 | 80 | 0.680191 | gbellizio |
7b02d0cfd49fa5a663c0e2ba782f3ead058c2813 | 2,116 | cpp | C++ | library/cpp/coroutine/engine/stack/ut/stack_ut.cpp | wikman/catboost | 984989d556a92f4978df193b835dfe98afa77bc2 | [
"Apache-2.0"
] | null | null | null | library/cpp/coroutine/engine/stack/ut/stack_ut.cpp | wikman/catboost | 984989d556a92f4978df193b835dfe98afa77bc2 | [
"Apache-2.0"
] | null | null | null | library/cpp/coroutine/engine/stack/ut/stack_ut.cpp | wikman/catboost | 984989d556a92f4978df193b835dfe98afa77bc2 | [
"Apache-2.0"
] | null | null | null | #include <library/cpp/coroutine/engine/stack/stack.h>
#include <library/cpp/coroutine/engine/stack/stack_common.h>
#include <library/cpp/coroutine/engine/stack/stack_guards.h>
#include <library/cpp/coroutine/engine/stack/stack_utils.h>
#include <library/cpp/testing/gtest/gtest.h>
using namespace testing;
namespace NCoro::NStack::Tests {
constexpr size_t StackSizeInPages = 4;
template <class TGuard>
class TStackFixture : public Test {
protected: // methods
TStackFixture()
: Guard_(GetGuard<TGuard>())
, StackSize_(StackSizeInPages * PageSize)
{}
void SetUp() override {
ASSERT_TRUE(GetAlignedMemory(StackSizeInPages, RawMemory_, AlignedMemory_));
Stack_ = MakeHolder<NDetails::TStack>(RawMemory_, AlignedMemory_, StackSize_, "test_stack");
Guard_.Protect(AlignedMemory_, StackSize_, false);
}
void TearDown() override {
Guard_.RemoveProtection(AlignedMemory_, StackSize_);
free(Stack_->GetRawMemory());
Stack_->Reset();
EXPECT_EQ(Stack_->GetRawMemory(), nullptr);
}
protected: // data
const TGuard& Guard_;
const size_t StackSize_ = 0;
char* RawMemory_ = nullptr;
char* AlignedMemory_ = nullptr;
THolder<NDetails::TStack> Stack_;
};
typedef Types<TCanaryGuard, TPageGuard> Implementations;
TYPED_TEST_SUITE(TStackFixture, Implementations);
TYPED_TEST(TStackFixture, PointersAndSize) {
EXPECT_EQ(this->Stack_->GetRawMemory(), this->RawMemory_);
EXPECT_EQ(this->Stack_->GetAlignedMemory(), this->AlignedMemory_);
EXPECT_EQ(this->Stack_->GetSize(), this->StackSize_);
}
TYPED_TEST(TStackFixture, WriteStack) {
auto workspace = this->Guard_.GetWorkspace(this->Stack_->GetAlignedMemory(), this->Stack_->GetSize());
for (size_t i = 0; i < workspace.size(); i += 512) {
workspace[i] = 42;
}
EXPECT_TRUE(this->Guard_.CheckOverride(this->Stack_->GetAlignedMemory(), this->Stack_->GetSize()));
}
}
| 34.688525 | 110 | 0.657372 | wikman |
7b0894ccc6c79bd4a7ccce8881253bc547da3658 | 4,223 | cc | C++ | garbage_collector.cc | jkominek/fdbfs | 0a347cc63f99428ff37348486a29b11ea13d9292 | [
"0BSD"
] | 12 | 2019-09-11T09:32:31.000Z | 2022-01-14T05:26:38.000Z | garbage_collector.cc | jkominek/fdbfs | 0a347cc63f99428ff37348486a29b11ea13d9292 | [
"0BSD"
] | 18 | 2019-12-17T22:32:01.000Z | 2022-03-14T06:03:15.000Z | garbage_collector.cc | jkominek/fdbfs | 0a347cc63f99428ff37348486a29b11ea13d9292 | [
"0BSD"
] | null | null | null |
#define FUSE_USE_VERSION 26
#include <fuse_lowlevel.h>
#define FDB_API_VERSION 630
#include <foundationdb/fdb_c.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <assert.h>
#include <time.h>
#include "util.h"
#include "inflight.h"
/*************************************************************
* garbage collector
*************************************************************
* scan the garbage key space
* TODO we need another thread to regularly refresh our local
* copy of the PID table, and 'ping' any other processes which
* appear to be dead. we should also regularly check that our
* entry in the PID table hasn't been marked with a flag telling
* us to die. and if we haven't been able to check that for
* awhile, we should die.
*/
void *garbage_scanner(void *ignore)
{
uint8_t scan_spot = random() & 0xF;
struct timespec ts;
ts.tv_sec = 1;
ts.tv_nsec = 0;
#if DEBUG
printf("gc starting\n");
#endif
while(database != NULL) {
// TODO vary this or do something to slow things down.
ts.tv_sec = 1; nanosleep(&ts, NULL);
unique_transaction t = make_transaction();
// we'll pick a random spot in the garbage space, and
// then we'll scan a bit past that.
auto start = key_prefix;
start.push_back('g');
auto stop = start;
uint8_t b = (scan_spot & 0xF) << 4;
start.push_back(b);
stop.push_back(b | 0x0F);
//printf("starting gc at %02x\n", b);
scan_spot = (scan_spot + 1) % 16;
FDBFuture *f =
fdb_transaction_get_range(t.get(),
start.data(), start.size(), 0, 1,
stop.data(), stop.size(), 0, 1,
1, 0,
FDB_STREAMING_MODE_SMALL, 0,
0,
// flip between forwards and backwards
// scanning of our randomly chosen range
random() & 0x1);
const FDBKeyValue *kvs;
int kvcount;
fdb_bool_t more;
if(fdb_future_block_until_ready(f) ||
fdb_future_get_keyvalue_array(f, &kvs, &kvcount, &more) ||
(kvcount <= 0)) {
// errors, or nothing to do. take a longer break.
fdb_future_destroy(f);
// sleep extra, though.
ts.tv_sec = 3; nanosleep(&ts, NULL);
continue;
}
if(kvs[0].key_length != inode_key_length) {
// we found malformed junk in the garbage space. ironic.
fdb_transaction_clear(t.get(),
kvs[0].key,
kvs[0].key_length);
FDBFuture *g = fdb_transaction_commit(t.get());
// if it fails, it fails, we'll try again the next time we
// stumble across it.
(void)fdb_future_block_until_ready(g);
fdb_future_destroy(f);
fdb_future_destroy(g);
continue;
}
// ok we found a garbage-collectible inode.
// fetch the in-use records for it.
fuse_ino_t ino;
bcopy(kvs[0].key + key_prefix.size() + 1,
&ino, sizeof(fuse_ino_t));
ino = be64toh(ino);
#if DEBUG
printf("found garbage inode %lx\n", ino);
#endif
start = pack_inode_key(ino);
start.push_back(0x01);
stop = pack_inode_key(ino);
stop.push_back(0x02);
// scan the use range of the inode
// TODO we actually need to pull all use records, and compare
// them against
f = fdb_transaction_get_range(t.get(),
start.data(), start.size(), 0, 1,
stop.data(), stop.size(), 0, 1,
1, 0,
FDB_STREAMING_MODE_SMALL, 0,
0, 0);
if(fdb_future_block_until_ready(f) ||
fdb_future_get_keyvalue_array(f, &kvs, &kvcount, &more) ||
kvcount>0) {
// welp. nothing to do.
#if DEBUG
printf("nothing to do on the garbage inode\n");
#endif
fdb_future_destroy(f);
continue;
}
// wooo no usage, we get to erase it.
#if DEBUG
printf("cleaning garbage inode\n");
#endif
auto garbagekey = pack_garbage_key(ino);
fdb_transaction_clear(t.get(), garbagekey.data(), garbagekey.size());
erase_inode(t.get(), ino);
f = fdb_transaction_commit(t.get());
// if the commit fails, it doesn't matter. we'll try again
// later.
if(fdb_future_block_until_ready(f)) {
printf("error when commiting a garbage collection transaction\n");
}
fdb_future_destroy(f);
}
#if DEBUG
printf("gc done\n");
#endif
return NULL;
}
| 27.966887 | 73 | 0.621596 | jkominek |
7b09f0886cd8473cc9d9089adf2fb616e3ade3d4 | 2,926 | cpp | C++ | source/interactables/nodeController.cpp | theKlanc/Z3 | 97c28f31483d1d5c8c7d1aa61155b256b3d4094a | [
"MIT"
] | 4 | 2020-08-09T20:34:28.000Z | 2021-07-22T23:30:40.000Z | source/interactables/nodeController.cpp | theKlanc/Z3 | 97c28f31483d1d5c8c7d1aa61155b256b3d4094a | [
"MIT"
] | 5 | 2020-02-18T23:19:14.000Z | 2020-02-18T23:26:24.000Z | source/interactables/nodeController.cpp | theKlanc/Z3 | 97c28f31483d1d5c8c7d1aa61155b256b3d4094a | [
"MIT"
] | null | null | null | #include "interactables/nodeController.hpp"
#include "services.hpp"
#include "components/brain.hpp"
#include "jsonTools.hpp"
#include "universeNode.hpp"
#include "icecream.hpp"
#include "components/velocity.hpp"
nodeController::nodeController()
{
_thrustViewer = std::make_shared<fddDisplay>(fddDisplay({},240,{},{-1,-1,-1,-1},{1,1,1,1},5,5,10));
_thrustViewer->setPosition({HI2::getScreenWidth()-_thrustViewer->getSize().x,0});
_scene.addGadget(_thrustViewer);
_spdViewer = std::make_shared<fddDisplay>(fddDisplay({0,HI2::getScreenHeight()-240},240,{},{-1,-1,-1,-1},{1,1,1,1},5,5,10));
_spdViewer->setPosition({HI2::getScreenWidth()-_spdViewer->getSize().x,HI2::getScreenHeight()-240});
_scene.addGadget(_spdViewer);
}
nodeController::~nodeController()
{
}
void nodeController::interact(entt::entity e)
{
Services::enttRegistry->get<std::unique_ptr<brain>>(e)->setControlling(this);
Services::enttRegistry->get<velocity>(e).spd = {};
}
nlohmann::json nodeController::getJson() const
{
return nlohmann::json{{"type",interactableType::NODE_CONTROLLER},{"interactable",{
{"positions",_positions},{"thrustTarget",_thrustTarget}
}}};
}
void nodeController::fix(point3Di dist)
{
for(fdd& pos : _positions){
pos+=fdd(dist);
}
}
void nodeController::update(double dt, const std::bitset<HI2::BUTTON_SIZE> &down, const std::bitset<HI2::BUTTON_SIZE> &up, const std::bitset<HI2::BUTTON_SIZE> &held)
{
if((down[HI2::BUTTON::KEY_BACKSPACE] || down[HI2::BUTTON::BUTTON_B]) && _exitCallback)
_exitCallback();
else{
if(held[HI2::BUTTON::KEY_W] || held[HI2::BUTTON::UP]){
_thrustTarget.y-=dt*agility;
if(_thrustTarget.y < -1)
_thrustTarget.y=-1;
}
if(held[HI2::BUTTON::KEY_A] || held[HI2::BUTTON::LEFT]){
_thrustTarget.x-=dt*agility;
if(_thrustTarget.x < -1)
_thrustTarget.x=-1;
}
if(held[HI2::BUTTON::KEY_S] || held[HI2::BUTTON::DOWN]){
_thrustTarget.y+=dt*agility;
if(_thrustTarget.y > 1)
_thrustTarget.y=1;
}
if(held[HI2::BUTTON::KEY_D] || held[HI2::BUTTON::RIGHT]){
_thrustTarget.x+=dt*agility;
if(_thrustTarget.x > 1)
_thrustTarget.x=1;
}
if(held[HI2::BUTTON::KEY_R] || held[HI2::BUTTON::BUTTON_L]){
_thrustTarget.z+=dt*agility;
if(_thrustTarget.z > 1)
_thrustTarget.z=1;
}
if(held[HI2::BUTTON::KEY_F] || held[HI2::BUTTON::BUTTON_ZL]){
_thrustTarget.z-=dt*agility;
if(_thrustTarget.z < -1)
_thrustTarget.z=-1;
}
if(held[HI2::BUTTON::KEY_X] || held[HI2::BUTTON::BUTTON_X]){
_thrustTarget = {};
}
}
_parent->getThrustSystem()->setThrustTarget(_thrustTarget);
}
void nodeController::drawUI()
{
_thrustViewer->setFdd({_thrustTarget.x,_thrustTarget.y,_thrustTarget.z,0});
_spdViewer->setFdd(_parent->getVelocity());
_scene.draw();
}
void from_json(const nlohmann::json &j, nodeController &nc)
{
nc._positions = j.at("positions").get<std::vector<fdd>>();
nc._thrustTarget = j.at("thrustTarget").get<point3Dd>();
}
| 29.26 | 165 | 0.692413 | theKlanc |
7b137d262e1112bb8b7e846f8c61bacc10b28aec | 2,480 | cpp | C++ | ProceduralTerrainGen/Plugins/RuntimeMeshComponent/Intermediate/Build/Win64/UE4/Shipping/RuntimeMeshComponent/Module.RuntimeMeshComponent.gen.3_of_4.cpp | RFornalik/ProceduralTerrain | 017b8df6606eef242a399192518dcd9ebd3bbcc9 | [
"MIT"
] | null | null | null | ProceduralTerrainGen/Plugins/RuntimeMeshComponent/Intermediate/Build/Win64/UE4/Shipping/RuntimeMeshComponent/Module.RuntimeMeshComponent.gen.3_of_4.cpp | RFornalik/ProceduralTerrain | 017b8df6606eef242a399192518dcd9ebd3bbcc9 | [
"MIT"
] | null | null | null | ProceduralTerrainGen/Plugins/RuntimeMeshComponent/Intermediate/Build/Win64/UE4/Shipping/RuntimeMeshComponent/Module.RuntimeMeshComponent.gen.3_of_4.cpp | RFornalik/ProceduralTerrain | 017b8df6606eef242a399192518dcd9ebd3bbcc9 | [
"MIT"
] | null | null | null | // This file is automatically generated at compile-time to include some subset of the user-created cpp files.
#include "C:/Users/rufus/Documents/ProceduralTerrainDemo/ProceduralTerrainGen/Plugins/RuntimeMeshComponent/Intermediate/Build/Win64/UE4/Inc/RuntimeMeshComponent/RuntimeMeshModifierAdjacency.gen.cpp"
#include "C:/Users/rufus/Documents/ProceduralTerrainDemo/ProceduralTerrainGen/Plugins/RuntimeMeshComponent/Intermediate/Build/Win64/UE4/Inc/RuntimeMeshComponent/RuntimeMeshModifierNormals.gen.cpp"
#include "C:/Users/rufus/Documents/ProceduralTerrainDemo/ProceduralTerrainGen/Plugins/RuntimeMeshComponent/Intermediate/Build/Win64/UE4/Inc/RuntimeMeshComponent/RuntimeMeshProvider.gen.cpp"
#include "C:/Users/rufus/Documents/ProceduralTerrainDemo/ProceduralTerrainGen/Plugins/RuntimeMeshComponent/Intermediate/Build/Win64/UE4/Inc/RuntimeMeshComponent/RuntimeMeshProviderBox.gen.cpp"
#include "C:/Users/rufus/Documents/ProceduralTerrainDemo/ProceduralTerrainGen/Plugins/RuntimeMeshComponent/Intermediate/Build/Win64/UE4/Inc/RuntimeMeshComponent/RuntimeMeshProviderCollision.gen.cpp"
#include "C:/Users/rufus/Documents/ProceduralTerrainDemo/ProceduralTerrainGen/Plugins/RuntimeMeshComponent/Intermediate/Build/Win64/UE4/Inc/RuntimeMeshComponent/RuntimeMeshProviderMemoryCache.gen.cpp"
#include "C:/Users/rufus/Documents/ProceduralTerrainDemo/ProceduralTerrainGen/Plugins/RuntimeMeshComponent/Intermediate/Build/Win64/UE4/Inc/RuntimeMeshComponent/RuntimeMeshProviderModifiers.gen.cpp"
#include "C:/Users/rufus/Documents/ProceduralTerrainDemo/ProceduralTerrainGen/Plugins/RuntimeMeshComponent/Intermediate/Build/Win64/UE4/Inc/RuntimeMeshComponent/RuntimeMeshProviderPlane.gen.cpp"
#include "C:/Users/rufus/Documents/ProceduralTerrainDemo/ProceduralTerrainGen/Plugins/RuntimeMeshComponent/Intermediate/Build/Win64/UE4/Inc/RuntimeMeshComponent/RuntimeMeshProviderSphere.gen.cpp"
#include "C:/Users/rufus/Documents/ProceduralTerrainDemo/ProceduralTerrainGen/Plugins/RuntimeMeshComponent/Intermediate/Build/Win64/UE4/Inc/RuntimeMeshComponent/RuntimeMeshProviderStatic.gen.cpp"
#include "C:/Users/rufus/Documents/ProceduralTerrainDemo/ProceduralTerrainGen/Plugins/RuntimeMeshComponent/Intermediate/Build/Win64/UE4/Inc/RuntimeMeshComponent/RuntimeMeshProviderStaticMesh.gen.cpp"
#include "C:/Users/rufus/Documents/ProceduralTerrainDemo/ProceduralTerrainGen/Plugins/RuntimeMeshComponent/Intermediate/Build/Win64/UE4/Inc/RuntimeMeshComponent/RuntimeMeshProviderTargetInterface.gen.cpp"
| 177.142857 | 204 | 0.884677 | RFornalik |
7b1b5667e6390299e7c6ddc1399ff49ab1e52527 | 338 | hpp | C++ | src/utility/test_coroutine.hpp | RamchandraApte/OmniTemplate | f150f451871b0ab43ac39a798186278106da1527 | [
"MIT"
] | 14 | 2019-04-23T21:44:12.000Z | 2022-03-04T22:48:59.000Z | src/utility/test_coroutine.hpp | RamchandraApte/OmniTemplate | f150f451871b0ab43ac39a798186278106da1527 | [
"MIT"
] | 3 | 2019-04-25T10:45:32.000Z | 2020-08-05T22:40:39.000Z | src/utility/test_coroutine.hpp | RamchandraApte/OmniTemplate | f150f451871b0ab43ac39a798186278106da1527 | [
"MIT"
] | 1 | 2020-07-16T22:16:33.000Z | 2020-07-16T22:16:33.000Z | #pragma once
#include "coroutine.hpp"
namespace coroutine::test {
void test_coroutine() {
const ll a = 4;
vector<ll> v;
try {
while (true) {
v.push_back(coro(a));
}
} catch (out_of_range &) {
}
assert((v == vector<ll>{404, 0 * 0, 1 * 1, 2 * 2, 3 * 3, 505}));
}
} // namespace coroutine::test
using namespace coroutine::test;
| 19.882353 | 65 | 0.618343 | RamchandraApte |
7b1cb9a6cdf4f2590e1b54256b90137a810d8242 | 1,091 | hpp | C++ | saga/saga/replica.hpp | saga-project/saga-cpp | 7376c0de0529e7d7b80cf08b94ec484c2e56d38e | [
"BSL-1.0"
] | 5 | 2015-09-15T16:24:14.000Z | 2021-08-12T11:05:55.000Z | saga/saga/replica.hpp | saga-project/saga-cpp | 7376c0de0529e7d7b80cf08b94ec484c2e56d38e | [
"BSL-1.0"
] | null | null | null | saga/saga/replica.hpp | saga-project/saga-cpp | 7376c0de0529e7d7b80cf08b94ec484c2e56d38e | [
"BSL-1.0"
] | 3 | 2016-11-17T04:38:38.000Z | 2021-04-10T17:23:52.000Z | // Copyright (c) 2005-2008 Hartmut Kaiser
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef SAGA_SAGA_REPLICA_HPP
#define SAGA_SAGA_REPLICA_HPP
#include <saga/saga-defs.hpp>
# ifdef SAGA_HAVE_PACKAGE_REPLICA
// logicalfile comes from the data package
#include <saga/saga/packages/replica/version.hpp>
#include <saga/saga/packages/replica/logical_file.hpp>
#include <saga/saga/packages/replica/logical_directory.hpp>
#if !defined(SAGA_REPLICA_PACKAGE_EXPORTS) || defined(SAGA_USE_AUTO_LINKING)
#define SAGA_AUTOLINK_LIB_NAME "replica"
#include <saga/saga/autolink.hpp>
#endif
#else
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__DMC__)
# pragma message ("Warning: The saga-replica package has been disabled at configuration time.")
#elif defined(__GNUC__) || defined(__HP_aCC) || defined(__SUNPRO_CC) || defined(__IBMCPP__)
# warning "The saga-replica package has been disabled at configuration time."
#endif
#endif
#endif // SAGA_SAGA_REPLICA_HPP
| 32.088235 | 96 | 0.780018 | saga-project |
7b1f6d4d45b0f4b1131204d17f536ded7e9d97c1 | 493,240 | cc | C++ | protobufs/dota_gcmessages_client_tournament.pb.cc | devilesk/dota-replay-parser | e83b96ee513a7193e6703615df4f676e27b1b8a0 | [
"0BSD"
] | 2 | 2017-02-03T16:57:17.000Z | 2020-10-28T21:13:12.000Z | protobufs/dota_gcmessages_client_tournament.pb.cc | invokr/dota-replay-parser | 6260aa834fb47f0f1a8c713f4edada6baeb9dcfa | [
"0BSD"
] | 1 | 2017-02-03T22:44:17.000Z | 2017-02-04T08:58:13.000Z | protobufs/dota_gcmessages_client_tournament.pb.cc | invokr/dota-replay-parser | 6260aa834fb47f0f1a8c713f4edada6baeb9dcfa | [
"0BSD"
] | 2 | 2017-02-03T17:51:57.000Z | 2021-05-22T02:40:00.000Z | // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: dota_gcmessages_client_tournament.proto
#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
#include "dota_gcmessages_client_tournament.pb.h"
#include <algorithm>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/once.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/wire_format_lite_inl.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format.h>
// @@protoc_insertion_point(includes)
namespace {
const ::google::protobuf::Descriptor* CMsgDOTATournamentInfo_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTATournamentInfo_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgDOTATournamentInfo_PhaseGroup_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTATournamentInfo_PhaseGroup_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgDOTATournamentInfo_Phase_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTATournamentInfo_Phase_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgDOTATournamentInfo_Team_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTATournamentInfo_Team_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgDOTATournamentInfo_UpcomingMatch_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTATournamentInfo_UpcomingMatch_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgDOTATournamentInfo_News_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTATournamentInfo_News_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgRequestWeekendTourneySchedule_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgRequestWeekendTourneySchedule_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgWeekendTourneySchedule_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgWeekendTourneySchedule_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgWeekendTourneySchedule_Division_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgWeekendTourneySchedule_Division_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgWeekendTourneyOpts_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgWeekendTourneyOpts_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgWeekendTourneyLeave_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgWeekendTourneyLeave_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgDOTATournament_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTATournament_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgDOTATournament_Team_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTATournament_Team_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgDOTATournament_Game_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTATournament_Game_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgDOTATournament_Node_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTATournament_Node_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgDOTATournamentStateChange_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTATournamentStateChange_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgDOTATournamentStateChange_GameChange_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTATournamentStateChange_GameChange_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgDOTATournamentStateChange_TeamChange_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTATournamentStateChange_TeamChange_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgDOTATournamentRequest_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTATournamentRequest_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgDOTATournamentResponse_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTATournamentResponse_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgDOTAClearTournamentGame_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTAClearTournamentGame_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgDOTAWeekendTourneyPlayerSkillLevelStats_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTAWeekendTourneyPlayerSkillLevelStats_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgDOTAWeekendTourneyPlayerStats_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTAWeekendTourneyPlayerStats_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgDOTAWeekendTourneyPlayerStatsRequest_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTAWeekendTourneyPlayerStatsRequest_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgDOTAWeekendTourneyPlayerHistoryRequest_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTAWeekendTourneyPlayerHistoryRequest_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgDOTAWeekendTourneyPlayerHistory_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTAWeekendTourneyPlayerHistory_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgDOTAWeekendTourneyPlayerHistory_Tournament_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTAWeekendTourneyPlayerHistory_Tournament_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgDOTAWeekendTourneyParticipationDetails_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTAWeekendTourneyParticipationDetails_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgDOTAWeekendTourneyParticipationDetails_Tier_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTAWeekendTourneyParticipationDetails_Tier_reflection_ = NULL;
const ::google::protobuf::Descriptor* CMsgDOTAWeekendTourneyParticipationDetails_Division_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CMsgDOTAWeekendTourneyParticipationDetails_Division_reflection_ = NULL;
const ::google::protobuf::EnumDescriptor* ETournamentEvent_descriptor_ = NULL;
} // namespace
void protobuf_AssignDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto() {
protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
const ::google::protobuf::FileDescriptor* file =
::google::protobuf::DescriptorPool::generated_pool()->FindFileByName(
"dota_gcmessages_client_tournament.proto");
GOOGLE_CHECK(file != NULL);
CMsgDOTATournamentInfo_descriptor_ = file->message_type(0);
static const int CMsgDOTATournamentInfo_offsets_[5] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo, league_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo, phase_list_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo, teams_list_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo, upcoming_matches_list_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo, news_list_),
};
CMsgDOTATournamentInfo_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTATournamentInfo_descriptor_,
CMsgDOTATournamentInfo::default_instance_,
CMsgDOTATournamentInfo_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTATournamentInfo));
CMsgDOTATournamentInfo_PhaseGroup_descriptor_ = CMsgDOTATournamentInfo_descriptor_->nested_type(0);
static const int CMsgDOTATournamentInfo_PhaseGroup_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_PhaseGroup, group_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_PhaseGroup, group_name_),
};
CMsgDOTATournamentInfo_PhaseGroup_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTATournamentInfo_PhaseGroup_descriptor_,
CMsgDOTATournamentInfo_PhaseGroup::default_instance_,
CMsgDOTATournamentInfo_PhaseGroup_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_PhaseGroup, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_PhaseGroup, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTATournamentInfo_PhaseGroup));
CMsgDOTATournamentInfo_Phase_descriptor_ = CMsgDOTATournamentInfo_descriptor_->nested_type(1);
static const int CMsgDOTATournamentInfo_Phase_offsets_[7] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_Phase, phase_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_Phase, phase_name_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_Phase, type_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_Phase, iterations_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_Phase, min_start_time_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_Phase, max_start_time_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_Phase, group_list_),
};
CMsgDOTATournamentInfo_Phase_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTATournamentInfo_Phase_descriptor_,
CMsgDOTATournamentInfo_Phase::default_instance_,
CMsgDOTATournamentInfo_Phase_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_Phase, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_Phase, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTATournamentInfo_Phase));
CMsgDOTATournamentInfo_Team_descriptor_ = CMsgDOTATournamentInfo_descriptor_->nested_type(2);
static const int CMsgDOTATournamentInfo_Team_offsets_[5] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_Team, team_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_Team, name_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_Team, tag_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_Team, team_logo_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_Team, eliminated_),
};
CMsgDOTATournamentInfo_Team_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTATournamentInfo_Team_descriptor_,
CMsgDOTATournamentInfo_Team::default_instance_,
CMsgDOTATournamentInfo_Team_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_Team, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_Team, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTATournamentInfo_Team));
CMsgDOTATournamentInfo_UpcomingMatch_descriptor_ = CMsgDOTATournamentInfo_descriptor_->nested_type(3);
static const int CMsgDOTATournamentInfo_UpcomingMatch_offsets_[26] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, series_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, team1_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, team2_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, bo_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, stage_name_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, start_time_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, winner_stage_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, loser_stage_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, team1_tag_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, team2_tag_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, team1_prev_opponent_tag_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, team2_prev_opponent_tag_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, team1_logo_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, team2_logo_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, team1_prev_opponent_logo_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, team2_prev_opponent_logo_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, team1_prev_opponent_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, team2_prev_opponent_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, team1_prev_match_score_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, team1_prev_match_opponent_score_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, team2_prev_match_score_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, team2_prev_match_opponent_score_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, phase_type_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, team1_score_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, team2_score_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, phase_id_),
};
CMsgDOTATournamentInfo_UpcomingMatch_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTATournamentInfo_UpcomingMatch_descriptor_,
CMsgDOTATournamentInfo_UpcomingMatch::default_instance_,
CMsgDOTATournamentInfo_UpcomingMatch_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_UpcomingMatch, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTATournamentInfo_UpcomingMatch));
CMsgDOTATournamentInfo_News_descriptor_ = CMsgDOTATournamentInfo_descriptor_->nested_type(4);
static const int CMsgDOTATournamentInfo_News_offsets_[4] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_News, link_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_News, title_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_News, image_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_News, timestamp_),
};
CMsgDOTATournamentInfo_News_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTATournamentInfo_News_descriptor_,
CMsgDOTATournamentInfo_News::default_instance_,
CMsgDOTATournamentInfo_News_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_News, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentInfo_News, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTATournamentInfo_News));
CMsgRequestWeekendTourneySchedule_descriptor_ = file->message_type(1);
static const int CMsgRequestWeekendTourneySchedule_offsets_[1] = {
};
CMsgRequestWeekendTourneySchedule_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgRequestWeekendTourneySchedule_descriptor_,
CMsgRequestWeekendTourneySchedule::default_instance_,
CMsgRequestWeekendTourneySchedule_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgRequestWeekendTourneySchedule, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgRequestWeekendTourneySchedule, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgRequestWeekendTourneySchedule));
CMsgWeekendTourneySchedule_descriptor_ = file->message_type(2);
static const int CMsgWeekendTourneySchedule_offsets_[1] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgWeekendTourneySchedule, divisions_),
};
CMsgWeekendTourneySchedule_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgWeekendTourneySchedule_descriptor_,
CMsgWeekendTourneySchedule::default_instance_,
CMsgWeekendTourneySchedule_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgWeekendTourneySchedule, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgWeekendTourneySchedule, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgWeekendTourneySchedule));
CMsgWeekendTourneySchedule_Division_descriptor_ = CMsgWeekendTourneySchedule_descriptor_->nested_type(0);
static const int CMsgWeekendTourneySchedule_Division_offsets_[4] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgWeekendTourneySchedule_Division, division_code_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgWeekendTourneySchedule_Division, time_window_open_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgWeekendTourneySchedule_Division, time_window_close_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgWeekendTourneySchedule_Division, time_window_open_next_),
};
CMsgWeekendTourneySchedule_Division_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgWeekendTourneySchedule_Division_descriptor_,
CMsgWeekendTourneySchedule_Division::default_instance_,
CMsgWeekendTourneySchedule_Division_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgWeekendTourneySchedule_Division, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgWeekendTourneySchedule_Division, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgWeekendTourneySchedule_Division));
CMsgWeekendTourneyOpts_descriptor_ = file->message_type(3);
static const int CMsgWeekendTourneyOpts_offsets_[8] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgWeekendTourneyOpts, participating_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgWeekendTourneyOpts, division_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgWeekendTourneyOpts, buyin_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgWeekendTourneyOpts, skill_level_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgWeekendTourneyOpts, match_groups_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgWeekendTourneyOpts, team_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgWeekendTourneyOpts, pickup_team_name_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgWeekendTourneyOpts, pickup_team_logo_),
};
CMsgWeekendTourneyOpts_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgWeekendTourneyOpts_descriptor_,
CMsgWeekendTourneyOpts::default_instance_,
CMsgWeekendTourneyOpts_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgWeekendTourneyOpts, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgWeekendTourneyOpts, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgWeekendTourneyOpts));
CMsgWeekendTourneyLeave_descriptor_ = file->message_type(4);
static const int CMsgWeekendTourneyLeave_offsets_[1] = {
};
CMsgWeekendTourneyLeave_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgWeekendTourneyLeave_descriptor_,
CMsgWeekendTourneyLeave::default_instance_,
CMsgWeekendTourneyLeave_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgWeekendTourneyLeave, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgWeekendTourneyLeave, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgWeekendTourneyLeave));
CMsgDOTATournament_descriptor_ = file->message_type(5);
static const int CMsgDOTATournament_offsets_[11] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament, tournament_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament, division_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament, schedule_time_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament, skill_level_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament, tournament_template_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament, state_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament, state_seq_num_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament, season_trophy_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament, teams_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament, games_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament, nodes_),
};
CMsgDOTATournament_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTATournament_descriptor_,
CMsgDOTATournament::default_instance_,
CMsgDOTATournament_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTATournament));
CMsgDOTATournament_Team_descriptor_ = CMsgDOTATournament_descriptor_->nested_type(0);
static const int CMsgDOTATournament_Team_offsets_[11] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Team, team_gid_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Team, node_or_state_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Team, players_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Team, player_buyin_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Team, player_skill_level_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Team, match_group_mask_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Team, team_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Team, team_name_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Team, team_base_logo_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Team, team_ui_logo_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Team, team_date_),
};
CMsgDOTATournament_Team_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTATournament_Team_descriptor_,
CMsgDOTATournament_Team::default_instance_,
CMsgDOTATournament_Team_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Team, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Team, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTATournament_Team));
CMsgDOTATournament_Game_descriptor_ = CMsgDOTATournament_descriptor_->nested_type(1);
static const int CMsgDOTATournament_Game_offsets_[6] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Game, node_idx_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Game, lobby_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Game, match_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Game, team_a_good_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Game, state_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Game, start_time_),
};
CMsgDOTATournament_Game_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTATournament_Game_descriptor_,
CMsgDOTATournament_Game::default_instance_,
CMsgDOTATournament_Game_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Game, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Game, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTATournament_Game));
CMsgDOTATournament_Node_descriptor_ = CMsgDOTATournament_descriptor_->nested_type(2);
static const int CMsgDOTATournament_Node_offsets_[4] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Node, node_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Node, team_idx_a_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Node, team_idx_b_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Node, node_state_),
};
CMsgDOTATournament_Node_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTATournament_Node_descriptor_,
CMsgDOTATournament_Node::default_instance_,
CMsgDOTATournament_Node_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Node, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournament_Node, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTATournament_Node));
CMsgDOTATournamentStateChange_descriptor_ = file->message_type(6);
static const int CMsgDOTATournamentStateChange_offsets_[7] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentStateChange, new_tournament_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentStateChange, event_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentStateChange, new_tournament_state_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentStateChange, game_changes_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentStateChange, team_changes_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentStateChange, merged_tournament_ids_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentStateChange, state_seq_num_),
};
CMsgDOTATournamentStateChange_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTATournamentStateChange_descriptor_,
CMsgDOTATournamentStateChange::default_instance_,
CMsgDOTATournamentStateChange_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentStateChange, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentStateChange, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTATournamentStateChange));
CMsgDOTATournamentStateChange_GameChange_descriptor_ = CMsgDOTATournamentStateChange_descriptor_->nested_type(0);
static const int CMsgDOTATournamentStateChange_GameChange_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentStateChange_GameChange, match_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentStateChange_GameChange, new_state_),
};
CMsgDOTATournamentStateChange_GameChange_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTATournamentStateChange_GameChange_descriptor_,
CMsgDOTATournamentStateChange_GameChange::default_instance_,
CMsgDOTATournamentStateChange_GameChange_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentStateChange_GameChange, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentStateChange_GameChange, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTATournamentStateChange_GameChange));
CMsgDOTATournamentStateChange_TeamChange_descriptor_ = CMsgDOTATournamentStateChange_descriptor_->nested_type(1);
static const int CMsgDOTATournamentStateChange_TeamChange_offsets_[3] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentStateChange_TeamChange, team_gid_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentStateChange_TeamChange, new_node_or_state_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentStateChange_TeamChange, old_node_or_state_),
};
CMsgDOTATournamentStateChange_TeamChange_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTATournamentStateChange_TeamChange_descriptor_,
CMsgDOTATournamentStateChange_TeamChange::default_instance_,
CMsgDOTATournamentStateChange_TeamChange_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentStateChange_TeamChange, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentStateChange_TeamChange, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTATournamentStateChange_TeamChange));
CMsgDOTATournamentRequest_descriptor_ = file->message_type(7);
static const int CMsgDOTATournamentRequest_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentRequest, tournament_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentRequest, client_tournament_gid_),
};
CMsgDOTATournamentRequest_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTATournamentRequest_descriptor_,
CMsgDOTATournamentRequest::default_instance_,
CMsgDOTATournamentRequest_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentRequest, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentRequest, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTATournamentRequest));
CMsgDOTATournamentResponse_descriptor_ = file->message_type(8);
static const int CMsgDOTATournamentResponse_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentResponse, result_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentResponse, tournament_),
};
CMsgDOTATournamentResponse_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTATournamentResponse_descriptor_,
CMsgDOTATournamentResponse::default_instance_,
CMsgDOTATournamentResponse_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentResponse, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTATournamentResponse, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTATournamentResponse));
CMsgDOTAClearTournamentGame_descriptor_ = file->message_type(9);
static const int CMsgDOTAClearTournamentGame_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAClearTournamentGame, tournament_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAClearTournamentGame, game_id_),
};
CMsgDOTAClearTournamentGame_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTAClearTournamentGame_descriptor_,
CMsgDOTAClearTournamentGame::default_instance_,
CMsgDOTAClearTournamentGame_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAClearTournamentGame, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAClearTournamentGame, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTAClearTournamentGame));
CMsgDOTAWeekendTourneyPlayerSkillLevelStats_descriptor_ = file->message_type(10);
static const int CMsgDOTAWeekendTourneyPlayerSkillLevelStats_offsets_[9] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerSkillLevelStats, skill_level_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerSkillLevelStats, times_won_0_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerSkillLevelStats, times_won_1_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerSkillLevelStats, times_won_2_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerSkillLevelStats, times_won_3_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerSkillLevelStats, times_bye_and_lost_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerSkillLevelStats, times_bye_and_won_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerSkillLevelStats, total_games_won_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerSkillLevelStats, score_),
};
CMsgDOTAWeekendTourneyPlayerSkillLevelStats_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTAWeekendTourneyPlayerSkillLevelStats_descriptor_,
CMsgDOTAWeekendTourneyPlayerSkillLevelStats::default_instance_,
CMsgDOTAWeekendTourneyPlayerSkillLevelStats_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerSkillLevelStats, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerSkillLevelStats, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTAWeekendTourneyPlayerSkillLevelStats));
CMsgDOTAWeekendTourneyPlayerStats_descriptor_ = file->message_type(11);
static const int CMsgDOTAWeekendTourneyPlayerStats_offsets_[4] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerStats, account_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerStats, season_trophy_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerStats, skill_levels_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerStats, current_tier_),
};
CMsgDOTAWeekendTourneyPlayerStats_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTAWeekendTourneyPlayerStats_descriptor_,
CMsgDOTAWeekendTourneyPlayerStats::default_instance_,
CMsgDOTAWeekendTourneyPlayerStats_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerStats, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerStats, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTAWeekendTourneyPlayerStats));
CMsgDOTAWeekendTourneyPlayerStatsRequest_descriptor_ = file->message_type(12);
static const int CMsgDOTAWeekendTourneyPlayerStatsRequest_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerStatsRequest, account_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerStatsRequest, season_trophy_id_),
};
CMsgDOTAWeekendTourneyPlayerStatsRequest_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTAWeekendTourneyPlayerStatsRequest_descriptor_,
CMsgDOTAWeekendTourneyPlayerStatsRequest::default_instance_,
CMsgDOTAWeekendTourneyPlayerStatsRequest_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerStatsRequest, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerStatsRequest, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTAWeekendTourneyPlayerStatsRequest));
CMsgDOTAWeekendTourneyPlayerHistoryRequest_descriptor_ = file->message_type(13);
static const int CMsgDOTAWeekendTourneyPlayerHistoryRequest_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerHistoryRequest, account_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerHistoryRequest, season_trophy_id_),
};
CMsgDOTAWeekendTourneyPlayerHistoryRequest_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTAWeekendTourneyPlayerHistoryRequest_descriptor_,
CMsgDOTAWeekendTourneyPlayerHistoryRequest::default_instance_,
CMsgDOTAWeekendTourneyPlayerHistoryRequest_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerHistoryRequest, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerHistoryRequest, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTAWeekendTourneyPlayerHistoryRequest));
CMsgDOTAWeekendTourneyPlayerHistory_descriptor_ = file->message_type(14);
static const int CMsgDOTAWeekendTourneyPlayerHistory_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerHistory, account_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerHistory, tournaments_),
};
CMsgDOTAWeekendTourneyPlayerHistory_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTAWeekendTourneyPlayerHistory_descriptor_,
CMsgDOTAWeekendTourneyPlayerHistory::default_instance_,
CMsgDOTAWeekendTourneyPlayerHistory_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerHistory, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerHistory, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTAWeekendTourneyPlayerHistory));
CMsgDOTAWeekendTourneyPlayerHistory_Tournament_descriptor_ = CMsgDOTAWeekendTourneyPlayerHistory_descriptor_->nested_type(0);
static const int CMsgDOTAWeekendTourneyPlayerHistory_Tournament_offsets_[9] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerHistory_Tournament, tournament_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerHistory_Tournament, start_time_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerHistory_Tournament, tournament_tier_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerHistory_Tournament, team_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerHistory_Tournament, team_date_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerHistory_Tournament, team_result_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerHistory_Tournament, account_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerHistory_Tournament, team_name_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerHistory_Tournament, season_trophy_id_),
};
CMsgDOTAWeekendTourneyPlayerHistory_Tournament_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTAWeekendTourneyPlayerHistory_Tournament_descriptor_,
CMsgDOTAWeekendTourneyPlayerHistory_Tournament::default_instance_,
CMsgDOTAWeekendTourneyPlayerHistory_Tournament_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerHistory_Tournament, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyPlayerHistory_Tournament, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTAWeekendTourneyPlayerHistory_Tournament));
CMsgDOTAWeekendTourneyParticipationDetails_descriptor_ = file->message_type(15);
static const int CMsgDOTAWeekendTourneyParticipationDetails_offsets_[1] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyParticipationDetails, divisions_),
};
CMsgDOTAWeekendTourneyParticipationDetails_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTAWeekendTourneyParticipationDetails_descriptor_,
CMsgDOTAWeekendTourneyParticipationDetails::default_instance_,
CMsgDOTAWeekendTourneyParticipationDetails_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyParticipationDetails, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyParticipationDetails, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTAWeekendTourneyParticipationDetails));
CMsgDOTAWeekendTourneyParticipationDetails_Tier_descriptor_ = CMsgDOTAWeekendTourneyParticipationDetails_descriptor_->nested_type(0);
static const int CMsgDOTAWeekendTourneyParticipationDetails_Tier_offsets_[8] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyParticipationDetails_Tier, tier_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyParticipationDetails_Tier, players_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyParticipationDetails_Tier, teams_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyParticipationDetails_Tier, winning_teams_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyParticipationDetails_Tier, players_streak_2_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyParticipationDetails_Tier, players_streak_3_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyParticipationDetails_Tier, players_streak_4_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyParticipationDetails_Tier, players_streak_5_),
};
CMsgDOTAWeekendTourneyParticipationDetails_Tier_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTAWeekendTourneyParticipationDetails_Tier_descriptor_,
CMsgDOTAWeekendTourneyParticipationDetails_Tier::default_instance_,
CMsgDOTAWeekendTourneyParticipationDetails_Tier_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyParticipationDetails_Tier, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyParticipationDetails_Tier, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTAWeekendTourneyParticipationDetails_Tier));
CMsgDOTAWeekendTourneyParticipationDetails_Division_descriptor_ = CMsgDOTAWeekendTourneyParticipationDetails_descriptor_->nested_type(1);
static const int CMsgDOTAWeekendTourneyParticipationDetails_Division_offsets_[3] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyParticipationDetails_Division, division_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyParticipationDetails_Division, schedule_time_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyParticipationDetails_Division, tiers_),
};
CMsgDOTAWeekendTourneyParticipationDetails_Division_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CMsgDOTAWeekendTourneyParticipationDetails_Division_descriptor_,
CMsgDOTAWeekendTourneyParticipationDetails_Division::default_instance_,
CMsgDOTAWeekendTourneyParticipationDetails_Division_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyParticipationDetails_Division, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CMsgDOTAWeekendTourneyParticipationDetails_Division, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CMsgDOTAWeekendTourneyParticipationDetails_Division));
ETournamentEvent_descriptor_ = file->enum_type(0);
}
namespace {
GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_);
inline void protobuf_AssignDescriptorsOnce() {
::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_,
&protobuf_AssignDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto);
}
void protobuf_RegisterTypes(const ::std::string&) {
protobuf_AssignDescriptorsOnce();
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTATournamentInfo_descriptor_, &CMsgDOTATournamentInfo::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTATournamentInfo_PhaseGroup_descriptor_, &CMsgDOTATournamentInfo_PhaseGroup::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTATournamentInfo_Phase_descriptor_, &CMsgDOTATournamentInfo_Phase::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTATournamentInfo_Team_descriptor_, &CMsgDOTATournamentInfo_Team::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTATournamentInfo_UpcomingMatch_descriptor_, &CMsgDOTATournamentInfo_UpcomingMatch::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTATournamentInfo_News_descriptor_, &CMsgDOTATournamentInfo_News::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgRequestWeekendTourneySchedule_descriptor_, &CMsgRequestWeekendTourneySchedule::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgWeekendTourneySchedule_descriptor_, &CMsgWeekendTourneySchedule::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgWeekendTourneySchedule_Division_descriptor_, &CMsgWeekendTourneySchedule_Division::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgWeekendTourneyOpts_descriptor_, &CMsgWeekendTourneyOpts::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgWeekendTourneyLeave_descriptor_, &CMsgWeekendTourneyLeave::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTATournament_descriptor_, &CMsgDOTATournament::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTATournament_Team_descriptor_, &CMsgDOTATournament_Team::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTATournament_Game_descriptor_, &CMsgDOTATournament_Game::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTATournament_Node_descriptor_, &CMsgDOTATournament_Node::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTATournamentStateChange_descriptor_, &CMsgDOTATournamentStateChange::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTATournamentStateChange_GameChange_descriptor_, &CMsgDOTATournamentStateChange_GameChange::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTATournamentStateChange_TeamChange_descriptor_, &CMsgDOTATournamentStateChange_TeamChange::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTATournamentRequest_descriptor_, &CMsgDOTATournamentRequest::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTATournamentResponse_descriptor_, &CMsgDOTATournamentResponse::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTAClearTournamentGame_descriptor_, &CMsgDOTAClearTournamentGame::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTAWeekendTourneyPlayerSkillLevelStats_descriptor_, &CMsgDOTAWeekendTourneyPlayerSkillLevelStats::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTAWeekendTourneyPlayerStats_descriptor_, &CMsgDOTAWeekendTourneyPlayerStats::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTAWeekendTourneyPlayerStatsRequest_descriptor_, &CMsgDOTAWeekendTourneyPlayerStatsRequest::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTAWeekendTourneyPlayerHistoryRequest_descriptor_, &CMsgDOTAWeekendTourneyPlayerHistoryRequest::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTAWeekendTourneyPlayerHistory_descriptor_, &CMsgDOTAWeekendTourneyPlayerHistory::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTAWeekendTourneyPlayerHistory_Tournament_descriptor_, &CMsgDOTAWeekendTourneyPlayerHistory_Tournament::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTAWeekendTourneyParticipationDetails_descriptor_, &CMsgDOTAWeekendTourneyParticipationDetails::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTAWeekendTourneyParticipationDetails_Tier_descriptor_, &CMsgDOTAWeekendTourneyParticipationDetails_Tier::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CMsgDOTAWeekendTourneyParticipationDetails_Division_descriptor_, &CMsgDOTAWeekendTourneyParticipationDetails_Division::default_instance());
}
} // namespace
void protobuf_ShutdownFile_dota_5fgcmessages_5fclient_5ftournament_2eproto() {
delete CMsgDOTATournamentInfo::default_instance_;
delete CMsgDOTATournamentInfo_reflection_;
delete CMsgDOTATournamentInfo_PhaseGroup::default_instance_;
delete CMsgDOTATournamentInfo_PhaseGroup_reflection_;
delete CMsgDOTATournamentInfo_Phase::default_instance_;
delete CMsgDOTATournamentInfo_Phase_reflection_;
delete CMsgDOTATournamentInfo_Team::default_instance_;
delete CMsgDOTATournamentInfo_Team_reflection_;
delete CMsgDOTATournamentInfo_UpcomingMatch::default_instance_;
delete CMsgDOTATournamentInfo_UpcomingMatch_reflection_;
delete CMsgDOTATournamentInfo_News::default_instance_;
delete CMsgDOTATournamentInfo_News_reflection_;
delete CMsgRequestWeekendTourneySchedule::default_instance_;
delete CMsgRequestWeekendTourneySchedule_reflection_;
delete CMsgWeekendTourneySchedule::default_instance_;
delete CMsgWeekendTourneySchedule_reflection_;
delete CMsgWeekendTourneySchedule_Division::default_instance_;
delete CMsgWeekendTourneySchedule_Division_reflection_;
delete CMsgWeekendTourneyOpts::default_instance_;
delete CMsgWeekendTourneyOpts_reflection_;
delete CMsgWeekendTourneyLeave::default_instance_;
delete CMsgWeekendTourneyLeave_reflection_;
delete CMsgDOTATournament::default_instance_;
delete CMsgDOTATournament_reflection_;
delete CMsgDOTATournament_Team::default_instance_;
delete CMsgDOTATournament_Team_reflection_;
delete CMsgDOTATournament_Game::default_instance_;
delete CMsgDOTATournament_Game_reflection_;
delete CMsgDOTATournament_Node::default_instance_;
delete CMsgDOTATournament_Node_reflection_;
delete CMsgDOTATournamentStateChange::default_instance_;
delete CMsgDOTATournamentStateChange_reflection_;
delete CMsgDOTATournamentStateChange_GameChange::default_instance_;
delete CMsgDOTATournamentStateChange_GameChange_reflection_;
delete CMsgDOTATournamentStateChange_TeamChange::default_instance_;
delete CMsgDOTATournamentStateChange_TeamChange_reflection_;
delete CMsgDOTATournamentRequest::default_instance_;
delete CMsgDOTATournamentRequest_reflection_;
delete CMsgDOTATournamentResponse::default_instance_;
delete CMsgDOTATournamentResponse_reflection_;
delete CMsgDOTAClearTournamentGame::default_instance_;
delete CMsgDOTAClearTournamentGame_reflection_;
delete CMsgDOTAWeekendTourneyPlayerSkillLevelStats::default_instance_;
delete CMsgDOTAWeekendTourneyPlayerSkillLevelStats_reflection_;
delete CMsgDOTAWeekendTourneyPlayerStats::default_instance_;
delete CMsgDOTAWeekendTourneyPlayerStats_reflection_;
delete CMsgDOTAWeekendTourneyPlayerStatsRequest::default_instance_;
delete CMsgDOTAWeekendTourneyPlayerStatsRequest_reflection_;
delete CMsgDOTAWeekendTourneyPlayerHistoryRequest::default_instance_;
delete CMsgDOTAWeekendTourneyPlayerHistoryRequest_reflection_;
delete CMsgDOTAWeekendTourneyPlayerHistory::default_instance_;
delete CMsgDOTAWeekendTourneyPlayerHistory_reflection_;
delete CMsgDOTAWeekendTourneyPlayerHistory_Tournament::default_instance_;
delete CMsgDOTAWeekendTourneyPlayerHistory_Tournament_reflection_;
delete CMsgDOTAWeekendTourneyParticipationDetails::default_instance_;
delete CMsgDOTAWeekendTourneyParticipationDetails_reflection_;
delete CMsgDOTAWeekendTourneyParticipationDetails_Tier::default_instance_;
delete CMsgDOTAWeekendTourneyParticipationDetails_Tier_reflection_;
delete CMsgDOTAWeekendTourneyParticipationDetails_Division::default_instance_;
delete CMsgDOTAWeekendTourneyParticipationDetails_Division_reflection_;
}
void protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto() {
static bool already_here = false;
if (already_here) return;
already_here = true;
GOOGLE_PROTOBUF_VERIFY_VERSION;
::protobuf_AddDesc_dota_5fclient_5fenums_2eproto();
::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
"\n\'dota_gcmessages_client_tournament.prot"
"o\032\027dota_client_enums.proto\"\270\n\n\026CMsgDOTAT"
"ournamentInfo\022\021\n\tleague_id\030\001 \001(\r\0221\n\nphas"
"e_list\030\002 \003(\0132\035.CMsgDOTATournamentInfo.Ph"
"ase\0220\n\nteams_list\030\003 \003(\0132\034.CMsgDOTATourna"
"mentInfo.Team\022D\n\025upcoming_matches_list\030\004"
" \003(\0132%.CMsgDOTATournamentInfo.UpcomingMa"
"tch\022/\n\tnews_list\030\005 \003(\0132\034.CMsgDOTATournam"
"entInfo.News\0322\n\nPhaseGroup\022\020\n\010group_id\030\001"
" \001(\r\022\022\n\ngroup_name\030\002 \001(\t\032\272\001\n\005Phase\022\020\n\010ph"
"ase_id\030\001 \001(\r\022\022\n\nphase_name\030\002 \001(\t\022\017\n\007type"
"_id\030\003 \001(\r\022\022\n\niterations\030\004 \001(\r\022\026\n\016min_sta"
"rt_time\030\005 \001(\r\022\026\n\016max_start_time\030\006 \001(\r\0226\n"
"\ngroup_list\030\007 \003(\0132\".CMsgDOTATournamentIn"
"fo.PhaseGroup\032Y\n\004Team\022\017\n\007team_id\030\001 \001(\r\022\014"
"\n\004name\030\002 \001(\t\022\013\n\003tag\030\003 \001(\t\022\021\n\tteam_logo\030\004"
" \001(\004\022\022\n\neliminated\030\005 \001(\010\032\233\005\n\rUpcomingMat"
"ch\022\021\n\tseries_id\030\001 \001(\r\022\020\n\010team1_id\030\002 \001(\r\022"
"\020\n\010team2_id\030\003 \001(\r\022\n\n\002bo\030\004 \001(\r\022\022\n\nstage_n"
"ame\030\005 \001(\t\022\022\n\nstart_time\030\006 \001(\r\022\024\n\014winner_"
"stage\030\007 \001(\t\022\023\n\013loser_stage\030\010 \001(\t\022\021\n\tteam"
"1_tag\030\t \001(\t\022\021\n\tteam2_tag\030\n \001(\t\022\037\n\027team1_"
"prev_opponent_tag\030\013 \001(\t\022\037\n\027team2_prev_op"
"ponent_tag\030\014 \001(\t\022\022\n\nteam1_logo\030\r \001(\004\022\022\n\n"
"team2_logo\030\016 \001(\004\022 \n\030team1_prev_opponent_"
"logo\030\017 \001(\004\022 \n\030team2_prev_opponent_logo\030\020"
" \001(\004\022\036\n\026team1_prev_opponent_id\030\021 \001(\r\022\036\n\026"
"team2_prev_opponent_id\030\022 \001(\r\022\036\n\026team1_pr"
"ev_match_score\030\023 \001(\r\022\'\n\037team1_prev_match"
"_opponent_score\030\024 \001(\r\022\036\n\026team2_prev_matc"
"h_score\030\025 \001(\r\022\'\n\037team2_prev_match_oppone"
"nt_score\030\026 \001(\r\022\022\n\nphase_type\030\027 \001(\r\022\023\n\013te"
"am1_score\030\030 \001(\r\022\023\n\013team2_score\030\031 \001(\r\022\020\n\010"
"phase_id\030\032 \001(\r\032E\n\004News\022\014\n\004link\030\001 \001(\t\022\r\n\005"
"title\030\002 \001(\t\022\r\n\005image\030\003 \001(\t\022\021\n\ttimestamp\030"
"\004 \001(\r\"#\n!CMsgRequestWeekendTourneySchedu"
"le\"\314\001\n\032CMsgWeekendTourneySchedule\0227\n\tdiv"
"isions\030\001 \003(\0132$.CMsgWeekendTourneySchedul"
"e.Division\032u\n\010Division\022\025\n\rdivision_code\030"
"\001 \001(\r\022\030\n\020time_window_open\030\002 \001(\r\022\031\n\021time_"
"window_close\030\003 \001(\r\022\035\n\025time_window_open_n"
"ext\030\004 \001(\r\"\303\001\n\026CMsgWeekendTourneyOpts\022\025\n\r"
"participating\030\001 \001(\010\022\023\n\013division_id\030\002 \001(\r"
"\022\r\n\005buyin\030\003 \001(\r\022\023\n\013skill_level\030\004 \001(\r\022\024\n\014"
"match_groups\030\005 \001(\r\022\017\n\007team_id\030\006 \001(\r\022\030\n\020p"
"ickup_team_name\030\007 \001(\t\022\030\n\020pickup_team_log"
"o\030\010 \001(\004\"\031\n\027CMsgWeekendTourneyLeave\"\340\007\n\022C"
"MsgDOTATournament\022\025\n\rtournament_id\030\001 \001(\r"
"\022\023\n\013division_id\030\002 \001(\r\022\025\n\rschedule_time\030\003"
" \001(\r\022\023\n\013skill_level\030\004 \001(\r\022M\n\023tournament_"
"template\030\005 \001(\0162\024.ETournamentTemplate:\032k_"
"ETournamentTemplate_None\022<\n\005state\030\006 \001(\0162"
"\021.ETournamentState:\032k_ETournamentState_U"
"nknown\022\025\n\rstate_seq_num\030\n \001(\r\022\030\n\020season_"
"trophy_id\030\013 \001(\r\022\'\n\005teams\030\007 \003(\0132\030.CMsgDOT"
"ATournament.Team\022\'\n\005games\030\010 \003(\0132\030.CMsgDO"
"TATournament.Game\022\'\n\005nodes\030\t \003(\0132\030.CMsgD"
"OTATournament.Node\032\375\001\n\004Team\022\020\n\010team_gid\030"
"\001 \001(\006\022\025\n\rnode_or_state\030\002 \001(\r\022\023\n\007players\030"
"\003 \003(\rB\002\020\001\022\030\n\014player_buyin\030\t \003(\rB\002\020\001\022\036\n\022p"
"layer_skill_level\030\n \003(\rB\002\020\001\022\030\n\020match_gro"
"up_mask\030\014 \001(\r\022\017\n\007team_id\030\004 \001(\r\022\021\n\tteam_n"
"ame\030\005 \001(\t\022\026\n\016team_base_logo\030\007 \001(\004\022\024\n\014tea"
"m_ui_logo\030\010 \001(\004\022\021\n\tteam_date\030\013 \001(\r\032\253\001\n\004G"
"ame\022\020\n\010node_idx\030\001 \001(\r\022\020\n\010lobby_id\030\002 \001(\006\022"
"\020\n\010match_id\030\003 \001(\004\022\023\n\013team_a_good\030\004 \001(\010\022D"
"\n\005state\030\005 \001(\0162\025.ETournamentGameState:\036k_"
"ETournamentGameState_Unknown\022\022\n\nstart_ti"
"me\030\006 \001(\r\032\212\001\n\004Node\022\017\n\007node_id\030\001 \001(\r\022\022\n\nte"
"am_idx_a\030\002 \001(\r\022\022\n\nteam_idx_b\030\003 \001(\r\022I\n\nno"
"de_state\030\004 \001(\0162\025.ETournamentNodeState:\036k"
"_ETournamentNodeState_Unknown\"\276\004\n\035CMsgDO"
"TATournamentStateChange\022\031\n\021new_tournamen"
"t_id\030\001 \001(\r\0229\n\005event\030\002 \001(\0162\021.ETournamentE"
"vent:\027k_ETournamentEvent_None\022K\n\024new_tou"
"rnament_state\030\003 \001(\0162\021.ETournamentState:\032"
"k_ETournamentState_Unknown\022\?\n\014game_chang"
"es\030\004 \003(\0132).CMsgDOTATournamentStateChange"
".GameChange\022\?\n\014team_changes\030\005 \003(\0132).CMsg"
"DOTATournamentStateChange.TeamChange\022!\n\025"
"merged_tournament_ids\030\006 \003(\rB\002\020\001\022\025\n\rstate"
"_seq_num\030\007 \001(\r\032h\n\nGameChange\022\020\n\010match_id"
"\030\001 \001(\004\022H\n\tnew_state\030\002 \001(\0162\025.ETournamentG"
"ameState:\036k_ETournamentGameState_Unknown"
"\032T\n\nTeamChange\022\020\n\010team_gid\030\001 \001(\004\022\031\n\021new_"
"node_or_state\030\002 \001(\r\022\031\n\021old_node_or_state"
"\030\003 \001(\r\"Q\n\031CMsgDOTATournamentRequest\022\025\n\rt"
"ournament_id\030\001 \001(\r\022\035\n\025client_tournament_"
"gid\030\002 \001(\004\"X\n\032CMsgDOTATournamentResponse\022"
"\021\n\006result\030\001 \001(\r:\0012\022\'\n\ntournament\030\002 \001(\0132\023"
".CMsgDOTATournament\"E\n\033CMsgDOTAClearTour"
"namentGame\022\025\n\rtournament_id\030\001 \001(\r\022\017\n\007gam"
"e_id\030\002 \001(\r\"\365\001\n+CMsgDOTAWeekendTourneyPla"
"yerSkillLevelStats\022\023\n\013skill_level\030\001 \001(\r\022"
"\023\n\013times_won_0\030\002 \001(\r\022\023\n\013times_won_1\030\003 \001("
"\r\022\023\n\013times_won_2\030\004 \001(\r\022\023\n\013times_won_3\030\005 "
"\001(\r\022\032\n\022times_bye_and_lost\030\006 \001(\r\022\031\n\021times"
"_bye_and_won\030\007 \001(\r\022\027\n\017total_games_won\030\010 "
"\001(\r\022\r\n\005score\030\t \001(\r\"\253\001\n!CMsgDOTAWeekendTo"
"urneyPlayerStats\022\022\n\naccount_id\030\001 \001(\r\022\030\n\020"
"season_trophy_id\030\002 \001(\r\022B\n\014skill_levels\030\003"
" \003(\0132,.CMsgDOTAWeekendTourneyPlayerSkill"
"LevelStats\022\024\n\014current_tier\030\004 \001(\r\"X\n(CMsg"
"DOTAWeekendTourneyPlayerStatsRequest\022\022\n\n"
"account_id\030\001 \001(\r\022\030\n\020season_trophy_id\030\002 \001"
"(\r\"Z\n*CMsgDOTAWeekendTourneyPlayerHistor"
"yRequest\022\022\n\naccount_id\030\001 \001(\r\022\030\n\020season_t"
"rophy_id\030\002 \001(\r\"\314\002\n#CMsgDOTAWeekendTourne"
"yPlayerHistory\022\022\n\naccount_id\030\001 \001(\r\022D\n\013to"
"urnaments\030\003 \003(\0132/.CMsgDOTAWeekendTourney"
"PlayerHistory.Tournament\032\312\001\n\nTournament\022"
"\025\n\rtournament_id\030\001 \001(\r\022\022\n\nstart_time\030\002 \001"
"(\r\022\027\n\017tournament_tier\030\003 \001(\r\022\017\n\007team_id\030\004"
" \001(\r\022\021\n\tteam_date\030\005 \001(\r\022\023\n\013team_result\030\006"
" \001(\r\022\022\n\naccount_id\030\007 \003(\r\022\021\n\tteam_name\030\010 "
"\001(\t\022\030\n\020season_trophy_id\030\t \001(\r\"\244\003\n*CMsgDO"
"TAWeekendTourneyParticipationDetails\022G\n\t"
"divisions\030\001 \003(\01324.CMsgDOTAWeekendTourney"
"ParticipationDetails.Division\032\263\001\n\004Tier\022\014"
"\n\004tier\030\001 \001(\r\022\017\n\007players\030\002 \001(\r\022\r\n\005teams\030\003"
" \001(\r\022\025\n\rwinning_teams\030\004 \001(\r\022\030\n\020players_s"
"treak_2\030\005 \001(\r\022\030\n\020players_streak_3\030\006 \001(\r\022"
"\030\n\020players_streak_4\030\007 \001(\r\022\030\n\020players_str"
"eak_5\030\010 \001(\r\032w\n\010Division\022\023\n\013division_id\030\001"
" \001(\r\022\025\n\rschedule_time\030\002 \001(\r\022\?\n\005tiers\030\003 \003"
"(\01320.CMsgDOTAWeekendTourneyParticipation"
"Details.Tier*\365\003\n\020ETournamentEvent\022\033\n\027k_E"
"TournamentEvent_None\020\000\022(\n$k_ETournamentE"
"vent_TournamentCreated\020\001\022(\n$k_ETournamen"
"tEvent_TournamentsMerged\020\002\022\"\n\036k_ETournam"
"entEvent_GameOutcome\020\003\022#\n\037k_ETournamentE"
"vent_TeamGivenBye\020\004\0220\n,k_ETournamentEven"
"t_TournamentCanceledByAdmin\020\005\022$\n k_ETour"
"namentEvent_TeamAbandoned\020\006\022+\n\'k_ETourna"
"mentEvent_ScheduledGameStarted\020\007\022\037\n\033k_ET"
"ournamentEvent_Canceled\020\010\022\?\n;k_ETourname"
"ntEvent_TeamParticipationTimedOut_EntryF"
"eeRefund\020\t\022@\n<k_ETournamentEvent_TeamPar"
"ticipationTimedOut_EntryFeeForfeit\020\nB\005H\001"
"\200\001\000", 5563);
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"dota_gcmessages_client_tournament.proto", &protobuf_RegisterTypes);
CMsgDOTATournamentInfo::default_instance_ = new CMsgDOTATournamentInfo();
CMsgDOTATournamentInfo_PhaseGroup::default_instance_ = new CMsgDOTATournamentInfo_PhaseGroup();
CMsgDOTATournamentInfo_Phase::default_instance_ = new CMsgDOTATournamentInfo_Phase();
CMsgDOTATournamentInfo_Team::default_instance_ = new CMsgDOTATournamentInfo_Team();
CMsgDOTATournamentInfo_UpcomingMatch::default_instance_ = new CMsgDOTATournamentInfo_UpcomingMatch();
CMsgDOTATournamentInfo_News::default_instance_ = new CMsgDOTATournamentInfo_News();
CMsgRequestWeekendTourneySchedule::default_instance_ = new CMsgRequestWeekendTourneySchedule();
CMsgWeekendTourneySchedule::default_instance_ = new CMsgWeekendTourneySchedule();
CMsgWeekendTourneySchedule_Division::default_instance_ = new CMsgWeekendTourneySchedule_Division();
CMsgWeekendTourneyOpts::default_instance_ = new CMsgWeekendTourneyOpts();
CMsgWeekendTourneyLeave::default_instance_ = new CMsgWeekendTourneyLeave();
CMsgDOTATournament::default_instance_ = new CMsgDOTATournament();
CMsgDOTATournament_Team::default_instance_ = new CMsgDOTATournament_Team();
CMsgDOTATournament_Game::default_instance_ = new CMsgDOTATournament_Game();
CMsgDOTATournament_Node::default_instance_ = new CMsgDOTATournament_Node();
CMsgDOTATournamentStateChange::default_instance_ = new CMsgDOTATournamentStateChange();
CMsgDOTATournamentStateChange_GameChange::default_instance_ = new CMsgDOTATournamentStateChange_GameChange();
CMsgDOTATournamentStateChange_TeamChange::default_instance_ = new CMsgDOTATournamentStateChange_TeamChange();
CMsgDOTATournamentRequest::default_instance_ = new CMsgDOTATournamentRequest();
CMsgDOTATournamentResponse::default_instance_ = new CMsgDOTATournamentResponse();
CMsgDOTAClearTournamentGame::default_instance_ = new CMsgDOTAClearTournamentGame();
CMsgDOTAWeekendTourneyPlayerSkillLevelStats::default_instance_ = new CMsgDOTAWeekendTourneyPlayerSkillLevelStats();
CMsgDOTAWeekendTourneyPlayerStats::default_instance_ = new CMsgDOTAWeekendTourneyPlayerStats();
CMsgDOTAWeekendTourneyPlayerStatsRequest::default_instance_ = new CMsgDOTAWeekendTourneyPlayerStatsRequest();
CMsgDOTAWeekendTourneyPlayerHistoryRequest::default_instance_ = new CMsgDOTAWeekendTourneyPlayerHistoryRequest();
CMsgDOTAWeekendTourneyPlayerHistory::default_instance_ = new CMsgDOTAWeekendTourneyPlayerHistory();
CMsgDOTAWeekendTourneyPlayerHistory_Tournament::default_instance_ = new CMsgDOTAWeekendTourneyPlayerHistory_Tournament();
CMsgDOTAWeekendTourneyParticipationDetails::default_instance_ = new CMsgDOTAWeekendTourneyParticipationDetails();
CMsgDOTAWeekendTourneyParticipationDetails_Tier::default_instance_ = new CMsgDOTAWeekendTourneyParticipationDetails_Tier();
CMsgDOTAWeekendTourneyParticipationDetails_Division::default_instance_ = new CMsgDOTAWeekendTourneyParticipationDetails_Division();
CMsgDOTATournamentInfo::default_instance_->InitAsDefaultInstance();
CMsgDOTATournamentInfo_PhaseGroup::default_instance_->InitAsDefaultInstance();
CMsgDOTATournamentInfo_Phase::default_instance_->InitAsDefaultInstance();
CMsgDOTATournamentInfo_Team::default_instance_->InitAsDefaultInstance();
CMsgDOTATournamentInfo_UpcomingMatch::default_instance_->InitAsDefaultInstance();
CMsgDOTATournamentInfo_News::default_instance_->InitAsDefaultInstance();
CMsgRequestWeekendTourneySchedule::default_instance_->InitAsDefaultInstance();
CMsgWeekendTourneySchedule::default_instance_->InitAsDefaultInstance();
CMsgWeekendTourneySchedule_Division::default_instance_->InitAsDefaultInstance();
CMsgWeekendTourneyOpts::default_instance_->InitAsDefaultInstance();
CMsgWeekendTourneyLeave::default_instance_->InitAsDefaultInstance();
CMsgDOTATournament::default_instance_->InitAsDefaultInstance();
CMsgDOTATournament_Team::default_instance_->InitAsDefaultInstance();
CMsgDOTATournament_Game::default_instance_->InitAsDefaultInstance();
CMsgDOTATournament_Node::default_instance_->InitAsDefaultInstance();
CMsgDOTATournamentStateChange::default_instance_->InitAsDefaultInstance();
CMsgDOTATournamentStateChange_GameChange::default_instance_->InitAsDefaultInstance();
CMsgDOTATournamentStateChange_TeamChange::default_instance_->InitAsDefaultInstance();
CMsgDOTATournamentRequest::default_instance_->InitAsDefaultInstance();
CMsgDOTATournamentResponse::default_instance_->InitAsDefaultInstance();
CMsgDOTAClearTournamentGame::default_instance_->InitAsDefaultInstance();
CMsgDOTAWeekendTourneyPlayerSkillLevelStats::default_instance_->InitAsDefaultInstance();
CMsgDOTAWeekendTourneyPlayerStats::default_instance_->InitAsDefaultInstance();
CMsgDOTAWeekendTourneyPlayerStatsRequest::default_instance_->InitAsDefaultInstance();
CMsgDOTAWeekendTourneyPlayerHistoryRequest::default_instance_->InitAsDefaultInstance();
CMsgDOTAWeekendTourneyPlayerHistory::default_instance_->InitAsDefaultInstance();
CMsgDOTAWeekendTourneyPlayerHistory_Tournament::default_instance_->InitAsDefaultInstance();
CMsgDOTAWeekendTourneyParticipationDetails::default_instance_->InitAsDefaultInstance();
CMsgDOTAWeekendTourneyParticipationDetails_Tier::default_instance_->InitAsDefaultInstance();
CMsgDOTAWeekendTourneyParticipationDetails_Division::default_instance_->InitAsDefaultInstance();
::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_dota_5fgcmessages_5fclient_5ftournament_2eproto);
}
// Force AddDescriptors() to be called at static initialization time.
struct StaticDescriptorInitializer_dota_5fgcmessages_5fclient_5ftournament_2eproto {
StaticDescriptorInitializer_dota_5fgcmessages_5fclient_5ftournament_2eproto() {
protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
}
} static_descriptor_initializer_dota_5fgcmessages_5fclient_5ftournament_2eproto_;
const ::google::protobuf::EnumDescriptor* ETournamentEvent_descriptor() {
protobuf_AssignDescriptorsOnce();
return ETournamentEvent_descriptor_;
}
bool ETournamentEvent_IsValid(int value) {
switch(value) {
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
case 10:
return true;
default:
return false;
}
}
// ===================================================================
#ifndef _MSC_VER
const int CMsgDOTATournamentInfo_PhaseGroup::kGroupIdFieldNumber;
const int CMsgDOTATournamentInfo_PhaseGroup::kGroupNameFieldNumber;
#endif // !_MSC_VER
CMsgDOTATournamentInfo_PhaseGroup::CMsgDOTATournamentInfo_PhaseGroup()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTATournamentInfo.PhaseGroup)
}
void CMsgDOTATournamentInfo_PhaseGroup::InitAsDefaultInstance() {
}
CMsgDOTATournamentInfo_PhaseGroup::CMsgDOTATournamentInfo_PhaseGroup(const CMsgDOTATournamentInfo_PhaseGroup& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTATournamentInfo.PhaseGroup)
}
void CMsgDOTATournamentInfo_PhaseGroup::SharedCtor() {
::google::protobuf::internal::GetEmptyString();
_cached_size_ = 0;
group_id_ = 0u;
group_name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTATournamentInfo_PhaseGroup::~CMsgDOTATournamentInfo_PhaseGroup() {
// @@protoc_insertion_point(destructor:CMsgDOTATournamentInfo.PhaseGroup)
SharedDtor();
}
void CMsgDOTATournamentInfo_PhaseGroup::SharedDtor() {
if (group_name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete group_name_;
}
if (this != default_instance_) {
}
}
void CMsgDOTATournamentInfo_PhaseGroup::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTATournamentInfo_PhaseGroup::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTATournamentInfo_PhaseGroup_descriptor_;
}
const CMsgDOTATournamentInfo_PhaseGroup& CMsgDOTATournamentInfo_PhaseGroup::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTATournamentInfo_PhaseGroup* CMsgDOTATournamentInfo_PhaseGroup::default_instance_ = NULL;
CMsgDOTATournamentInfo_PhaseGroup* CMsgDOTATournamentInfo_PhaseGroup::New() const {
return new CMsgDOTATournamentInfo_PhaseGroup;
}
void CMsgDOTATournamentInfo_PhaseGroup::Clear() {
if (_has_bits_[0 / 32] & 3) {
group_id_ = 0u;
if (has_group_name()) {
if (group_name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
group_name_->clear();
}
}
}
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTATournamentInfo_PhaseGroup::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTATournamentInfo.PhaseGroup)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint32 group_id = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &group_id_)));
set_has_group_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_group_name;
break;
}
// optional string group_name = 2;
case 2: {
if (tag == 18) {
parse_group_name:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_group_name()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->group_name().data(), this->group_name().length(),
::google::protobuf::internal::WireFormat::PARSE,
"group_name");
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTATournamentInfo.PhaseGroup)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTATournamentInfo.PhaseGroup)
return false;
#undef DO_
}
void CMsgDOTATournamentInfo_PhaseGroup::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTATournamentInfo.PhaseGroup)
// optional uint32 group_id = 1;
if (has_group_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->group_id(), output);
}
// optional string group_name = 2;
if (has_group_name()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->group_name().data(), this->group_name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"group_name");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
2, this->group_name(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTATournamentInfo.PhaseGroup)
}
::google::protobuf::uint8* CMsgDOTATournamentInfo_PhaseGroup::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTATournamentInfo.PhaseGroup)
// optional uint32 group_id = 1;
if (has_group_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->group_id(), target);
}
// optional string group_name = 2;
if (has_group_name()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->group_name().data(), this->group_name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"group_name");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
2, this->group_name(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTATournamentInfo.PhaseGroup)
return target;
}
int CMsgDOTATournamentInfo_PhaseGroup::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional uint32 group_id = 1;
if (has_group_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->group_id());
}
// optional string group_name = 2;
if (has_group_name()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->group_name());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTATournamentInfo_PhaseGroup::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTATournamentInfo_PhaseGroup* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTATournamentInfo_PhaseGroup*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTATournamentInfo_PhaseGroup::MergeFrom(const CMsgDOTATournamentInfo_PhaseGroup& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_group_id()) {
set_group_id(from.group_id());
}
if (from.has_group_name()) {
set_group_name(from.group_name());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTATournamentInfo_PhaseGroup::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTATournamentInfo_PhaseGroup::CopyFrom(const CMsgDOTATournamentInfo_PhaseGroup& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTATournamentInfo_PhaseGroup::IsInitialized() const {
return true;
}
void CMsgDOTATournamentInfo_PhaseGroup::Swap(CMsgDOTATournamentInfo_PhaseGroup* other) {
if (other != this) {
std::swap(group_id_, other->group_id_);
std::swap(group_name_, other->group_name_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTATournamentInfo_PhaseGroup::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTATournamentInfo_PhaseGroup_descriptor_;
metadata.reflection = CMsgDOTATournamentInfo_PhaseGroup_reflection_;
return metadata;
}
// -------------------------------------------------------------------
#ifndef _MSC_VER
const int CMsgDOTATournamentInfo_Phase::kPhaseIdFieldNumber;
const int CMsgDOTATournamentInfo_Phase::kPhaseNameFieldNumber;
const int CMsgDOTATournamentInfo_Phase::kTypeIdFieldNumber;
const int CMsgDOTATournamentInfo_Phase::kIterationsFieldNumber;
const int CMsgDOTATournamentInfo_Phase::kMinStartTimeFieldNumber;
const int CMsgDOTATournamentInfo_Phase::kMaxStartTimeFieldNumber;
const int CMsgDOTATournamentInfo_Phase::kGroupListFieldNumber;
#endif // !_MSC_VER
CMsgDOTATournamentInfo_Phase::CMsgDOTATournamentInfo_Phase()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTATournamentInfo.Phase)
}
void CMsgDOTATournamentInfo_Phase::InitAsDefaultInstance() {
}
CMsgDOTATournamentInfo_Phase::CMsgDOTATournamentInfo_Phase(const CMsgDOTATournamentInfo_Phase& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTATournamentInfo.Phase)
}
void CMsgDOTATournamentInfo_Phase::SharedCtor() {
::google::protobuf::internal::GetEmptyString();
_cached_size_ = 0;
phase_id_ = 0u;
phase_name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
type_id_ = 0u;
iterations_ = 0u;
min_start_time_ = 0u;
max_start_time_ = 0u;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTATournamentInfo_Phase::~CMsgDOTATournamentInfo_Phase() {
// @@protoc_insertion_point(destructor:CMsgDOTATournamentInfo.Phase)
SharedDtor();
}
void CMsgDOTATournamentInfo_Phase::SharedDtor() {
if (phase_name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete phase_name_;
}
if (this != default_instance_) {
}
}
void CMsgDOTATournamentInfo_Phase::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTATournamentInfo_Phase::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTATournamentInfo_Phase_descriptor_;
}
const CMsgDOTATournamentInfo_Phase& CMsgDOTATournamentInfo_Phase::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTATournamentInfo_Phase* CMsgDOTATournamentInfo_Phase::default_instance_ = NULL;
CMsgDOTATournamentInfo_Phase* CMsgDOTATournamentInfo_Phase::New() const {
return new CMsgDOTATournamentInfo_Phase;
}
void CMsgDOTATournamentInfo_Phase::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<CMsgDOTATournamentInfo_Phase*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
if (_has_bits_[0 / 32] & 63) {
ZR_(phase_id_, min_start_time_);
if (has_phase_name()) {
if (phase_name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
phase_name_->clear();
}
}
max_start_time_ = 0u;
}
#undef OFFSET_OF_FIELD_
#undef ZR_
group_list_.Clear();
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTATournamentInfo_Phase::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTATournamentInfo.Phase)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint32 phase_id = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &phase_id_)));
set_has_phase_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_phase_name;
break;
}
// optional string phase_name = 2;
case 2: {
if (tag == 18) {
parse_phase_name:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_phase_name()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->phase_name().data(), this->phase_name().length(),
::google::protobuf::internal::WireFormat::PARSE,
"phase_name");
} else {
goto handle_unusual;
}
if (input->ExpectTag(24)) goto parse_type_id;
break;
}
// optional uint32 type_id = 3;
case 3: {
if (tag == 24) {
parse_type_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &type_id_)));
set_has_type_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(32)) goto parse_iterations;
break;
}
// optional uint32 iterations = 4;
case 4: {
if (tag == 32) {
parse_iterations:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &iterations_)));
set_has_iterations();
} else {
goto handle_unusual;
}
if (input->ExpectTag(40)) goto parse_min_start_time;
break;
}
// optional uint32 min_start_time = 5;
case 5: {
if (tag == 40) {
parse_min_start_time:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &min_start_time_)));
set_has_min_start_time();
} else {
goto handle_unusual;
}
if (input->ExpectTag(48)) goto parse_max_start_time;
break;
}
// optional uint32 max_start_time = 6;
case 6: {
if (tag == 48) {
parse_max_start_time:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &max_start_time_)));
set_has_max_start_time();
} else {
goto handle_unusual;
}
if (input->ExpectTag(58)) goto parse_group_list;
break;
}
// repeated .CMsgDOTATournamentInfo.PhaseGroup group_list = 7;
case 7: {
if (tag == 58) {
parse_group_list:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_group_list()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(58)) goto parse_group_list;
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTATournamentInfo.Phase)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTATournamentInfo.Phase)
return false;
#undef DO_
}
void CMsgDOTATournamentInfo_Phase::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTATournamentInfo.Phase)
// optional uint32 phase_id = 1;
if (has_phase_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->phase_id(), output);
}
// optional string phase_name = 2;
if (has_phase_name()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->phase_name().data(), this->phase_name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"phase_name");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
2, this->phase_name(), output);
}
// optional uint32 type_id = 3;
if (has_type_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(3, this->type_id(), output);
}
// optional uint32 iterations = 4;
if (has_iterations()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(4, this->iterations(), output);
}
// optional uint32 min_start_time = 5;
if (has_min_start_time()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(5, this->min_start_time(), output);
}
// optional uint32 max_start_time = 6;
if (has_max_start_time()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(6, this->max_start_time(), output);
}
// repeated .CMsgDOTATournamentInfo.PhaseGroup group_list = 7;
for (int i = 0; i < this->group_list_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
7, this->group_list(i), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTATournamentInfo.Phase)
}
::google::protobuf::uint8* CMsgDOTATournamentInfo_Phase::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTATournamentInfo.Phase)
// optional uint32 phase_id = 1;
if (has_phase_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->phase_id(), target);
}
// optional string phase_name = 2;
if (has_phase_name()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->phase_name().data(), this->phase_name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"phase_name");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
2, this->phase_name(), target);
}
// optional uint32 type_id = 3;
if (has_type_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(3, this->type_id(), target);
}
// optional uint32 iterations = 4;
if (has_iterations()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(4, this->iterations(), target);
}
// optional uint32 min_start_time = 5;
if (has_min_start_time()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(5, this->min_start_time(), target);
}
// optional uint32 max_start_time = 6;
if (has_max_start_time()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(6, this->max_start_time(), target);
}
// repeated .CMsgDOTATournamentInfo.PhaseGroup group_list = 7;
for (int i = 0; i < this->group_list_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
7, this->group_list(i), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTATournamentInfo.Phase)
return target;
}
int CMsgDOTATournamentInfo_Phase::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional uint32 phase_id = 1;
if (has_phase_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->phase_id());
}
// optional string phase_name = 2;
if (has_phase_name()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->phase_name());
}
// optional uint32 type_id = 3;
if (has_type_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->type_id());
}
// optional uint32 iterations = 4;
if (has_iterations()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->iterations());
}
// optional uint32 min_start_time = 5;
if (has_min_start_time()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->min_start_time());
}
// optional uint32 max_start_time = 6;
if (has_max_start_time()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->max_start_time());
}
}
// repeated .CMsgDOTATournamentInfo.PhaseGroup group_list = 7;
total_size += 1 * this->group_list_size();
for (int i = 0; i < this->group_list_size(); i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->group_list(i));
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTATournamentInfo_Phase::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTATournamentInfo_Phase* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTATournamentInfo_Phase*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTATournamentInfo_Phase::MergeFrom(const CMsgDOTATournamentInfo_Phase& from) {
GOOGLE_CHECK_NE(&from, this);
group_list_.MergeFrom(from.group_list_);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_phase_id()) {
set_phase_id(from.phase_id());
}
if (from.has_phase_name()) {
set_phase_name(from.phase_name());
}
if (from.has_type_id()) {
set_type_id(from.type_id());
}
if (from.has_iterations()) {
set_iterations(from.iterations());
}
if (from.has_min_start_time()) {
set_min_start_time(from.min_start_time());
}
if (from.has_max_start_time()) {
set_max_start_time(from.max_start_time());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTATournamentInfo_Phase::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTATournamentInfo_Phase::CopyFrom(const CMsgDOTATournamentInfo_Phase& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTATournamentInfo_Phase::IsInitialized() const {
return true;
}
void CMsgDOTATournamentInfo_Phase::Swap(CMsgDOTATournamentInfo_Phase* other) {
if (other != this) {
std::swap(phase_id_, other->phase_id_);
std::swap(phase_name_, other->phase_name_);
std::swap(type_id_, other->type_id_);
std::swap(iterations_, other->iterations_);
std::swap(min_start_time_, other->min_start_time_);
std::swap(max_start_time_, other->max_start_time_);
group_list_.Swap(&other->group_list_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTATournamentInfo_Phase::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTATournamentInfo_Phase_descriptor_;
metadata.reflection = CMsgDOTATournamentInfo_Phase_reflection_;
return metadata;
}
// -------------------------------------------------------------------
#ifndef _MSC_VER
const int CMsgDOTATournamentInfo_Team::kTeamIdFieldNumber;
const int CMsgDOTATournamentInfo_Team::kNameFieldNumber;
const int CMsgDOTATournamentInfo_Team::kTagFieldNumber;
const int CMsgDOTATournamentInfo_Team::kTeamLogoFieldNumber;
const int CMsgDOTATournamentInfo_Team::kEliminatedFieldNumber;
#endif // !_MSC_VER
CMsgDOTATournamentInfo_Team::CMsgDOTATournamentInfo_Team()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTATournamentInfo.Team)
}
void CMsgDOTATournamentInfo_Team::InitAsDefaultInstance() {
}
CMsgDOTATournamentInfo_Team::CMsgDOTATournamentInfo_Team(const CMsgDOTATournamentInfo_Team& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTATournamentInfo.Team)
}
void CMsgDOTATournamentInfo_Team::SharedCtor() {
::google::protobuf::internal::GetEmptyString();
_cached_size_ = 0;
team_id_ = 0u;
name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
tag_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
team_logo_ = GOOGLE_ULONGLONG(0);
eliminated_ = false;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTATournamentInfo_Team::~CMsgDOTATournamentInfo_Team() {
// @@protoc_insertion_point(destructor:CMsgDOTATournamentInfo.Team)
SharedDtor();
}
void CMsgDOTATournamentInfo_Team::SharedDtor() {
if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete name_;
}
if (tag_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete tag_;
}
if (this != default_instance_) {
}
}
void CMsgDOTATournamentInfo_Team::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTATournamentInfo_Team::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTATournamentInfo_Team_descriptor_;
}
const CMsgDOTATournamentInfo_Team& CMsgDOTATournamentInfo_Team::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTATournamentInfo_Team* CMsgDOTATournamentInfo_Team::default_instance_ = NULL;
CMsgDOTATournamentInfo_Team* CMsgDOTATournamentInfo_Team::New() const {
return new CMsgDOTATournamentInfo_Team;
}
void CMsgDOTATournamentInfo_Team::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<CMsgDOTATournamentInfo_Team*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
if (_has_bits_[0 / 32] & 31) {
ZR_(team_id_, team_logo_);
if (has_name()) {
if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
name_->clear();
}
}
if (has_tag()) {
if (tag_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
tag_->clear();
}
}
}
#undef OFFSET_OF_FIELD_
#undef ZR_
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTATournamentInfo_Team::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTATournamentInfo.Team)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint32 team_id = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &team_id_)));
set_has_team_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_name;
break;
}
// optional string name = 2;
case 2: {
if (tag == 18) {
parse_name:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_name()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::PARSE,
"name");
} else {
goto handle_unusual;
}
if (input->ExpectTag(26)) goto parse_tag;
break;
}
// optional string tag = 3;
case 3: {
if (tag == 26) {
parse_tag:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_tag()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->tag().data(), this->tag().length(),
::google::protobuf::internal::WireFormat::PARSE,
"tag");
} else {
goto handle_unusual;
}
if (input->ExpectTag(32)) goto parse_team_logo;
break;
}
// optional uint64 team_logo = 4;
case 4: {
if (tag == 32) {
parse_team_logo:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &team_logo_)));
set_has_team_logo();
} else {
goto handle_unusual;
}
if (input->ExpectTag(40)) goto parse_eliminated;
break;
}
// optional bool eliminated = 5;
case 5: {
if (tag == 40) {
parse_eliminated:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &eliminated_)));
set_has_eliminated();
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTATournamentInfo.Team)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTATournamentInfo.Team)
return false;
#undef DO_
}
void CMsgDOTATournamentInfo_Team::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTATournamentInfo.Team)
// optional uint32 team_id = 1;
if (has_team_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->team_id(), output);
}
// optional string name = 2;
if (has_name()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"name");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
2, this->name(), output);
}
// optional string tag = 3;
if (has_tag()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->tag().data(), this->tag().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"tag");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
3, this->tag(), output);
}
// optional uint64 team_logo = 4;
if (has_team_logo()) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(4, this->team_logo(), output);
}
// optional bool eliminated = 5;
if (has_eliminated()) {
::google::protobuf::internal::WireFormatLite::WriteBool(5, this->eliminated(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTATournamentInfo.Team)
}
::google::protobuf::uint8* CMsgDOTATournamentInfo_Team::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTATournamentInfo.Team)
// optional uint32 team_id = 1;
if (has_team_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->team_id(), target);
}
// optional string name = 2;
if (has_name()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"name");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
2, this->name(), target);
}
// optional string tag = 3;
if (has_tag()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->tag().data(), this->tag().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"tag");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
3, this->tag(), target);
}
// optional uint64 team_logo = 4;
if (has_team_logo()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(4, this->team_logo(), target);
}
// optional bool eliminated = 5;
if (has_eliminated()) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(5, this->eliminated(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTATournamentInfo.Team)
return target;
}
int CMsgDOTATournamentInfo_Team::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional uint32 team_id = 1;
if (has_team_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->team_id());
}
// optional string name = 2;
if (has_name()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->name());
}
// optional string tag = 3;
if (has_tag()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->tag());
}
// optional uint64 team_logo = 4;
if (has_team_logo()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->team_logo());
}
// optional bool eliminated = 5;
if (has_eliminated()) {
total_size += 1 + 1;
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTATournamentInfo_Team::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTATournamentInfo_Team* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTATournamentInfo_Team*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTATournamentInfo_Team::MergeFrom(const CMsgDOTATournamentInfo_Team& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_team_id()) {
set_team_id(from.team_id());
}
if (from.has_name()) {
set_name(from.name());
}
if (from.has_tag()) {
set_tag(from.tag());
}
if (from.has_team_logo()) {
set_team_logo(from.team_logo());
}
if (from.has_eliminated()) {
set_eliminated(from.eliminated());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTATournamentInfo_Team::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTATournamentInfo_Team::CopyFrom(const CMsgDOTATournamentInfo_Team& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTATournamentInfo_Team::IsInitialized() const {
return true;
}
void CMsgDOTATournamentInfo_Team::Swap(CMsgDOTATournamentInfo_Team* other) {
if (other != this) {
std::swap(team_id_, other->team_id_);
std::swap(name_, other->name_);
std::swap(tag_, other->tag_);
std::swap(team_logo_, other->team_logo_);
std::swap(eliminated_, other->eliminated_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTATournamentInfo_Team::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTATournamentInfo_Team_descriptor_;
metadata.reflection = CMsgDOTATournamentInfo_Team_reflection_;
return metadata;
}
// -------------------------------------------------------------------
#ifndef _MSC_VER
const int CMsgDOTATournamentInfo_UpcomingMatch::kSeriesIdFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kTeam1IdFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kTeam2IdFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kBoFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kStageNameFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kStartTimeFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kWinnerStageFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kLoserStageFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kTeam1TagFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kTeam2TagFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kTeam1PrevOpponentTagFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kTeam2PrevOpponentTagFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kTeam1LogoFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kTeam2LogoFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kTeam1PrevOpponentLogoFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kTeam2PrevOpponentLogoFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kTeam1PrevOpponentIdFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kTeam2PrevOpponentIdFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kTeam1PrevMatchScoreFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kTeam1PrevMatchOpponentScoreFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kTeam2PrevMatchScoreFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kTeam2PrevMatchOpponentScoreFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kPhaseTypeFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kTeam1ScoreFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kTeam2ScoreFieldNumber;
const int CMsgDOTATournamentInfo_UpcomingMatch::kPhaseIdFieldNumber;
#endif // !_MSC_VER
CMsgDOTATournamentInfo_UpcomingMatch::CMsgDOTATournamentInfo_UpcomingMatch()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTATournamentInfo.UpcomingMatch)
}
void CMsgDOTATournamentInfo_UpcomingMatch::InitAsDefaultInstance() {
}
CMsgDOTATournamentInfo_UpcomingMatch::CMsgDOTATournamentInfo_UpcomingMatch(const CMsgDOTATournamentInfo_UpcomingMatch& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTATournamentInfo.UpcomingMatch)
}
void CMsgDOTATournamentInfo_UpcomingMatch::SharedCtor() {
::google::protobuf::internal::GetEmptyString();
_cached_size_ = 0;
series_id_ = 0u;
team1_id_ = 0u;
team2_id_ = 0u;
bo_ = 0u;
stage_name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
start_time_ = 0u;
winner_stage_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
loser_stage_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
team1_tag_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
team2_tag_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
team1_prev_opponent_tag_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
team2_prev_opponent_tag_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
team1_logo_ = GOOGLE_ULONGLONG(0);
team2_logo_ = GOOGLE_ULONGLONG(0);
team1_prev_opponent_logo_ = GOOGLE_ULONGLONG(0);
team2_prev_opponent_logo_ = GOOGLE_ULONGLONG(0);
team1_prev_opponent_id_ = 0u;
team2_prev_opponent_id_ = 0u;
team1_prev_match_score_ = 0u;
team1_prev_match_opponent_score_ = 0u;
team2_prev_match_score_ = 0u;
team2_prev_match_opponent_score_ = 0u;
phase_type_ = 0u;
team1_score_ = 0u;
team2_score_ = 0u;
phase_id_ = 0u;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTATournamentInfo_UpcomingMatch::~CMsgDOTATournamentInfo_UpcomingMatch() {
// @@protoc_insertion_point(destructor:CMsgDOTATournamentInfo.UpcomingMatch)
SharedDtor();
}
void CMsgDOTATournamentInfo_UpcomingMatch::SharedDtor() {
if (stage_name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete stage_name_;
}
if (winner_stage_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete winner_stage_;
}
if (loser_stage_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete loser_stage_;
}
if (team1_tag_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete team1_tag_;
}
if (team2_tag_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete team2_tag_;
}
if (team1_prev_opponent_tag_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete team1_prev_opponent_tag_;
}
if (team2_prev_opponent_tag_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete team2_prev_opponent_tag_;
}
if (this != default_instance_) {
}
}
void CMsgDOTATournamentInfo_UpcomingMatch::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTATournamentInfo_UpcomingMatch::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTATournamentInfo_UpcomingMatch_descriptor_;
}
const CMsgDOTATournamentInfo_UpcomingMatch& CMsgDOTATournamentInfo_UpcomingMatch::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTATournamentInfo_UpcomingMatch* CMsgDOTATournamentInfo_UpcomingMatch::default_instance_ = NULL;
CMsgDOTATournamentInfo_UpcomingMatch* CMsgDOTATournamentInfo_UpcomingMatch::New() const {
return new CMsgDOTATournamentInfo_UpcomingMatch;
}
void CMsgDOTATournamentInfo_UpcomingMatch::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<CMsgDOTATournamentInfo_UpcomingMatch*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
if (_has_bits_[0 / 32] & 255) {
ZR_(series_id_, bo_);
if (has_stage_name()) {
if (stage_name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
stage_name_->clear();
}
}
start_time_ = 0u;
if (has_winner_stage()) {
if (winner_stage_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
winner_stage_->clear();
}
}
if (has_loser_stage()) {
if (loser_stage_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
loser_stage_->clear();
}
}
}
if (_has_bits_[8 / 32] & 65280) {
ZR_(team1_logo_, team2_prev_opponent_logo_);
if (has_team1_tag()) {
if (team1_tag_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
team1_tag_->clear();
}
}
if (has_team2_tag()) {
if (team2_tag_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
team2_tag_->clear();
}
}
if (has_team1_prev_opponent_tag()) {
if (team1_prev_opponent_tag_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
team1_prev_opponent_tag_->clear();
}
}
if (has_team2_prev_opponent_tag()) {
if (team2_prev_opponent_tag_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
team2_prev_opponent_tag_->clear();
}
}
}
if (_has_bits_[16 / 32] & 16711680) {
ZR_(team2_prev_opponent_id_, team1_score_);
team1_prev_opponent_id_ = 0u;
}
ZR_(team2_score_, phase_id_);
#undef OFFSET_OF_FIELD_
#undef ZR_
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTATournamentInfo_UpcomingMatch::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTATournamentInfo.UpcomingMatch)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(16383);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint32 series_id = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &series_id_)));
set_has_series_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_team1_id;
break;
}
// optional uint32 team1_id = 2;
case 2: {
if (tag == 16) {
parse_team1_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &team1_id_)));
set_has_team1_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(24)) goto parse_team2_id;
break;
}
// optional uint32 team2_id = 3;
case 3: {
if (tag == 24) {
parse_team2_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &team2_id_)));
set_has_team2_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(32)) goto parse_bo;
break;
}
// optional uint32 bo = 4;
case 4: {
if (tag == 32) {
parse_bo:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &bo_)));
set_has_bo();
} else {
goto handle_unusual;
}
if (input->ExpectTag(42)) goto parse_stage_name;
break;
}
// optional string stage_name = 5;
case 5: {
if (tag == 42) {
parse_stage_name:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_stage_name()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->stage_name().data(), this->stage_name().length(),
::google::protobuf::internal::WireFormat::PARSE,
"stage_name");
} else {
goto handle_unusual;
}
if (input->ExpectTag(48)) goto parse_start_time;
break;
}
// optional uint32 start_time = 6;
case 6: {
if (tag == 48) {
parse_start_time:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &start_time_)));
set_has_start_time();
} else {
goto handle_unusual;
}
if (input->ExpectTag(58)) goto parse_winner_stage;
break;
}
// optional string winner_stage = 7;
case 7: {
if (tag == 58) {
parse_winner_stage:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_winner_stage()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->winner_stage().data(), this->winner_stage().length(),
::google::protobuf::internal::WireFormat::PARSE,
"winner_stage");
} else {
goto handle_unusual;
}
if (input->ExpectTag(66)) goto parse_loser_stage;
break;
}
// optional string loser_stage = 8;
case 8: {
if (tag == 66) {
parse_loser_stage:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_loser_stage()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->loser_stage().data(), this->loser_stage().length(),
::google::protobuf::internal::WireFormat::PARSE,
"loser_stage");
} else {
goto handle_unusual;
}
if (input->ExpectTag(74)) goto parse_team1_tag;
break;
}
// optional string team1_tag = 9;
case 9: {
if (tag == 74) {
parse_team1_tag:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_team1_tag()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->team1_tag().data(), this->team1_tag().length(),
::google::protobuf::internal::WireFormat::PARSE,
"team1_tag");
} else {
goto handle_unusual;
}
if (input->ExpectTag(82)) goto parse_team2_tag;
break;
}
// optional string team2_tag = 10;
case 10: {
if (tag == 82) {
parse_team2_tag:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_team2_tag()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->team2_tag().data(), this->team2_tag().length(),
::google::protobuf::internal::WireFormat::PARSE,
"team2_tag");
} else {
goto handle_unusual;
}
if (input->ExpectTag(90)) goto parse_team1_prev_opponent_tag;
break;
}
// optional string team1_prev_opponent_tag = 11;
case 11: {
if (tag == 90) {
parse_team1_prev_opponent_tag:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_team1_prev_opponent_tag()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->team1_prev_opponent_tag().data(), this->team1_prev_opponent_tag().length(),
::google::protobuf::internal::WireFormat::PARSE,
"team1_prev_opponent_tag");
} else {
goto handle_unusual;
}
if (input->ExpectTag(98)) goto parse_team2_prev_opponent_tag;
break;
}
// optional string team2_prev_opponent_tag = 12;
case 12: {
if (tag == 98) {
parse_team2_prev_opponent_tag:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_team2_prev_opponent_tag()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->team2_prev_opponent_tag().data(), this->team2_prev_opponent_tag().length(),
::google::protobuf::internal::WireFormat::PARSE,
"team2_prev_opponent_tag");
} else {
goto handle_unusual;
}
if (input->ExpectTag(104)) goto parse_team1_logo;
break;
}
// optional uint64 team1_logo = 13;
case 13: {
if (tag == 104) {
parse_team1_logo:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &team1_logo_)));
set_has_team1_logo();
} else {
goto handle_unusual;
}
if (input->ExpectTag(112)) goto parse_team2_logo;
break;
}
// optional uint64 team2_logo = 14;
case 14: {
if (tag == 112) {
parse_team2_logo:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &team2_logo_)));
set_has_team2_logo();
} else {
goto handle_unusual;
}
if (input->ExpectTag(120)) goto parse_team1_prev_opponent_logo;
break;
}
// optional uint64 team1_prev_opponent_logo = 15;
case 15: {
if (tag == 120) {
parse_team1_prev_opponent_logo:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &team1_prev_opponent_logo_)));
set_has_team1_prev_opponent_logo();
} else {
goto handle_unusual;
}
if (input->ExpectTag(128)) goto parse_team2_prev_opponent_logo;
break;
}
// optional uint64 team2_prev_opponent_logo = 16;
case 16: {
if (tag == 128) {
parse_team2_prev_opponent_logo:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &team2_prev_opponent_logo_)));
set_has_team2_prev_opponent_logo();
} else {
goto handle_unusual;
}
if (input->ExpectTag(136)) goto parse_team1_prev_opponent_id;
break;
}
// optional uint32 team1_prev_opponent_id = 17;
case 17: {
if (tag == 136) {
parse_team1_prev_opponent_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &team1_prev_opponent_id_)));
set_has_team1_prev_opponent_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(144)) goto parse_team2_prev_opponent_id;
break;
}
// optional uint32 team2_prev_opponent_id = 18;
case 18: {
if (tag == 144) {
parse_team2_prev_opponent_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &team2_prev_opponent_id_)));
set_has_team2_prev_opponent_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(152)) goto parse_team1_prev_match_score;
break;
}
// optional uint32 team1_prev_match_score = 19;
case 19: {
if (tag == 152) {
parse_team1_prev_match_score:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &team1_prev_match_score_)));
set_has_team1_prev_match_score();
} else {
goto handle_unusual;
}
if (input->ExpectTag(160)) goto parse_team1_prev_match_opponent_score;
break;
}
// optional uint32 team1_prev_match_opponent_score = 20;
case 20: {
if (tag == 160) {
parse_team1_prev_match_opponent_score:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &team1_prev_match_opponent_score_)));
set_has_team1_prev_match_opponent_score();
} else {
goto handle_unusual;
}
if (input->ExpectTag(168)) goto parse_team2_prev_match_score;
break;
}
// optional uint32 team2_prev_match_score = 21;
case 21: {
if (tag == 168) {
parse_team2_prev_match_score:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &team2_prev_match_score_)));
set_has_team2_prev_match_score();
} else {
goto handle_unusual;
}
if (input->ExpectTag(176)) goto parse_team2_prev_match_opponent_score;
break;
}
// optional uint32 team2_prev_match_opponent_score = 22;
case 22: {
if (tag == 176) {
parse_team2_prev_match_opponent_score:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &team2_prev_match_opponent_score_)));
set_has_team2_prev_match_opponent_score();
} else {
goto handle_unusual;
}
if (input->ExpectTag(184)) goto parse_phase_type;
break;
}
// optional uint32 phase_type = 23;
case 23: {
if (tag == 184) {
parse_phase_type:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &phase_type_)));
set_has_phase_type();
} else {
goto handle_unusual;
}
if (input->ExpectTag(192)) goto parse_team1_score;
break;
}
// optional uint32 team1_score = 24;
case 24: {
if (tag == 192) {
parse_team1_score:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &team1_score_)));
set_has_team1_score();
} else {
goto handle_unusual;
}
if (input->ExpectTag(200)) goto parse_team2_score;
break;
}
// optional uint32 team2_score = 25;
case 25: {
if (tag == 200) {
parse_team2_score:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &team2_score_)));
set_has_team2_score();
} else {
goto handle_unusual;
}
if (input->ExpectTag(208)) goto parse_phase_id;
break;
}
// optional uint32 phase_id = 26;
case 26: {
if (tag == 208) {
parse_phase_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &phase_id_)));
set_has_phase_id();
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTATournamentInfo.UpcomingMatch)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTATournamentInfo.UpcomingMatch)
return false;
#undef DO_
}
void CMsgDOTATournamentInfo_UpcomingMatch::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTATournamentInfo.UpcomingMatch)
// optional uint32 series_id = 1;
if (has_series_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->series_id(), output);
}
// optional uint32 team1_id = 2;
if (has_team1_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->team1_id(), output);
}
// optional uint32 team2_id = 3;
if (has_team2_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(3, this->team2_id(), output);
}
// optional uint32 bo = 4;
if (has_bo()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(4, this->bo(), output);
}
// optional string stage_name = 5;
if (has_stage_name()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->stage_name().data(), this->stage_name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"stage_name");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
5, this->stage_name(), output);
}
// optional uint32 start_time = 6;
if (has_start_time()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(6, this->start_time(), output);
}
// optional string winner_stage = 7;
if (has_winner_stage()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->winner_stage().data(), this->winner_stage().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"winner_stage");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
7, this->winner_stage(), output);
}
// optional string loser_stage = 8;
if (has_loser_stage()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->loser_stage().data(), this->loser_stage().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"loser_stage");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
8, this->loser_stage(), output);
}
// optional string team1_tag = 9;
if (has_team1_tag()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->team1_tag().data(), this->team1_tag().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"team1_tag");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
9, this->team1_tag(), output);
}
// optional string team2_tag = 10;
if (has_team2_tag()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->team2_tag().data(), this->team2_tag().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"team2_tag");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
10, this->team2_tag(), output);
}
// optional string team1_prev_opponent_tag = 11;
if (has_team1_prev_opponent_tag()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->team1_prev_opponent_tag().data(), this->team1_prev_opponent_tag().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"team1_prev_opponent_tag");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
11, this->team1_prev_opponent_tag(), output);
}
// optional string team2_prev_opponent_tag = 12;
if (has_team2_prev_opponent_tag()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->team2_prev_opponent_tag().data(), this->team2_prev_opponent_tag().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"team2_prev_opponent_tag");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
12, this->team2_prev_opponent_tag(), output);
}
// optional uint64 team1_logo = 13;
if (has_team1_logo()) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(13, this->team1_logo(), output);
}
// optional uint64 team2_logo = 14;
if (has_team2_logo()) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(14, this->team2_logo(), output);
}
// optional uint64 team1_prev_opponent_logo = 15;
if (has_team1_prev_opponent_logo()) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(15, this->team1_prev_opponent_logo(), output);
}
// optional uint64 team2_prev_opponent_logo = 16;
if (has_team2_prev_opponent_logo()) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(16, this->team2_prev_opponent_logo(), output);
}
// optional uint32 team1_prev_opponent_id = 17;
if (has_team1_prev_opponent_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(17, this->team1_prev_opponent_id(), output);
}
// optional uint32 team2_prev_opponent_id = 18;
if (has_team2_prev_opponent_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(18, this->team2_prev_opponent_id(), output);
}
// optional uint32 team1_prev_match_score = 19;
if (has_team1_prev_match_score()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(19, this->team1_prev_match_score(), output);
}
// optional uint32 team1_prev_match_opponent_score = 20;
if (has_team1_prev_match_opponent_score()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(20, this->team1_prev_match_opponent_score(), output);
}
// optional uint32 team2_prev_match_score = 21;
if (has_team2_prev_match_score()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(21, this->team2_prev_match_score(), output);
}
// optional uint32 team2_prev_match_opponent_score = 22;
if (has_team2_prev_match_opponent_score()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(22, this->team2_prev_match_opponent_score(), output);
}
// optional uint32 phase_type = 23;
if (has_phase_type()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(23, this->phase_type(), output);
}
// optional uint32 team1_score = 24;
if (has_team1_score()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(24, this->team1_score(), output);
}
// optional uint32 team2_score = 25;
if (has_team2_score()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(25, this->team2_score(), output);
}
// optional uint32 phase_id = 26;
if (has_phase_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(26, this->phase_id(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTATournamentInfo.UpcomingMatch)
}
::google::protobuf::uint8* CMsgDOTATournamentInfo_UpcomingMatch::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTATournamentInfo.UpcomingMatch)
// optional uint32 series_id = 1;
if (has_series_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->series_id(), target);
}
// optional uint32 team1_id = 2;
if (has_team1_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->team1_id(), target);
}
// optional uint32 team2_id = 3;
if (has_team2_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(3, this->team2_id(), target);
}
// optional uint32 bo = 4;
if (has_bo()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(4, this->bo(), target);
}
// optional string stage_name = 5;
if (has_stage_name()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->stage_name().data(), this->stage_name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"stage_name");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
5, this->stage_name(), target);
}
// optional uint32 start_time = 6;
if (has_start_time()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(6, this->start_time(), target);
}
// optional string winner_stage = 7;
if (has_winner_stage()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->winner_stage().data(), this->winner_stage().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"winner_stage");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
7, this->winner_stage(), target);
}
// optional string loser_stage = 8;
if (has_loser_stage()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->loser_stage().data(), this->loser_stage().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"loser_stage");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
8, this->loser_stage(), target);
}
// optional string team1_tag = 9;
if (has_team1_tag()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->team1_tag().data(), this->team1_tag().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"team1_tag");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
9, this->team1_tag(), target);
}
// optional string team2_tag = 10;
if (has_team2_tag()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->team2_tag().data(), this->team2_tag().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"team2_tag");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
10, this->team2_tag(), target);
}
// optional string team1_prev_opponent_tag = 11;
if (has_team1_prev_opponent_tag()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->team1_prev_opponent_tag().data(), this->team1_prev_opponent_tag().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"team1_prev_opponent_tag");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
11, this->team1_prev_opponent_tag(), target);
}
// optional string team2_prev_opponent_tag = 12;
if (has_team2_prev_opponent_tag()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->team2_prev_opponent_tag().data(), this->team2_prev_opponent_tag().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"team2_prev_opponent_tag");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
12, this->team2_prev_opponent_tag(), target);
}
// optional uint64 team1_logo = 13;
if (has_team1_logo()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(13, this->team1_logo(), target);
}
// optional uint64 team2_logo = 14;
if (has_team2_logo()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(14, this->team2_logo(), target);
}
// optional uint64 team1_prev_opponent_logo = 15;
if (has_team1_prev_opponent_logo()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(15, this->team1_prev_opponent_logo(), target);
}
// optional uint64 team2_prev_opponent_logo = 16;
if (has_team2_prev_opponent_logo()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(16, this->team2_prev_opponent_logo(), target);
}
// optional uint32 team1_prev_opponent_id = 17;
if (has_team1_prev_opponent_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(17, this->team1_prev_opponent_id(), target);
}
// optional uint32 team2_prev_opponent_id = 18;
if (has_team2_prev_opponent_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(18, this->team2_prev_opponent_id(), target);
}
// optional uint32 team1_prev_match_score = 19;
if (has_team1_prev_match_score()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(19, this->team1_prev_match_score(), target);
}
// optional uint32 team1_prev_match_opponent_score = 20;
if (has_team1_prev_match_opponent_score()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(20, this->team1_prev_match_opponent_score(), target);
}
// optional uint32 team2_prev_match_score = 21;
if (has_team2_prev_match_score()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(21, this->team2_prev_match_score(), target);
}
// optional uint32 team2_prev_match_opponent_score = 22;
if (has_team2_prev_match_opponent_score()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(22, this->team2_prev_match_opponent_score(), target);
}
// optional uint32 phase_type = 23;
if (has_phase_type()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(23, this->phase_type(), target);
}
// optional uint32 team1_score = 24;
if (has_team1_score()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(24, this->team1_score(), target);
}
// optional uint32 team2_score = 25;
if (has_team2_score()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(25, this->team2_score(), target);
}
// optional uint32 phase_id = 26;
if (has_phase_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(26, this->phase_id(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTATournamentInfo.UpcomingMatch)
return target;
}
int CMsgDOTATournamentInfo_UpcomingMatch::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional uint32 series_id = 1;
if (has_series_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->series_id());
}
// optional uint32 team1_id = 2;
if (has_team1_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->team1_id());
}
// optional uint32 team2_id = 3;
if (has_team2_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->team2_id());
}
// optional uint32 bo = 4;
if (has_bo()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->bo());
}
// optional string stage_name = 5;
if (has_stage_name()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->stage_name());
}
// optional uint32 start_time = 6;
if (has_start_time()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->start_time());
}
// optional string winner_stage = 7;
if (has_winner_stage()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->winner_stage());
}
// optional string loser_stage = 8;
if (has_loser_stage()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->loser_stage());
}
}
if (_has_bits_[8 / 32] & (0xffu << (8 % 32))) {
// optional string team1_tag = 9;
if (has_team1_tag()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->team1_tag());
}
// optional string team2_tag = 10;
if (has_team2_tag()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->team2_tag());
}
// optional string team1_prev_opponent_tag = 11;
if (has_team1_prev_opponent_tag()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->team1_prev_opponent_tag());
}
// optional string team2_prev_opponent_tag = 12;
if (has_team2_prev_opponent_tag()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->team2_prev_opponent_tag());
}
// optional uint64 team1_logo = 13;
if (has_team1_logo()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->team1_logo());
}
// optional uint64 team2_logo = 14;
if (has_team2_logo()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->team2_logo());
}
// optional uint64 team1_prev_opponent_logo = 15;
if (has_team1_prev_opponent_logo()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->team1_prev_opponent_logo());
}
// optional uint64 team2_prev_opponent_logo = 16;
if (has_team2_prev_opponent_logo()) {
total_size += 2 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->team2_prev_opponent_logo());
}
}
if (_has_bits_[16 / 32] & (0xffu << (16 % 32))) {
// optional uint32 team1_prev_opponent_id = 17;
if (has_team1_prev_opponent_id()) {
total_size += 2 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->team1_prev_opponent_id());
}
// optional uint32 team2_prev_opponent_id = 18;
if (has_team2_prev_opponent_id()) {
total_size += 2 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->team2_prev_opponent_id());
}
// optional uint32 team1_prev_match_score = 19;
if (has_team1_prev_match_score()) {
total_size += 2 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->team1_prev_match_score());
}
// optional uint32 team1_prev_match_opponent_score = 20;
if (has_team1_prev_match_opponent_score()) {
total_size += 2 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->team1_prev_match_opponent_score());
}
// optional uint32 team2_prev_match_score = 21;
if (has_team2_prev_match_score()) {
total_size += 2 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->team2_prev_match_score());
}
// optional uint32 team2_prev_match_opponent_score = 22;
if (has_team2_prev_match_opponent_score()) {
total_size += 2 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->team2_prev_match_opponent_score());
}
// optional uint32 phase_type = 23;
if (has_phase_type()) {
total_size += 2 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->phase_type());
}
// optional uint32 team1_score = 24;
if (has_team1_score()) {
total_size += 2 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->team1_score());
}
}
if (_has_bits_[24 / 32] & (0xffu << (24 % 32))) {
// optional uint32 team2_score = 25;
if (has_team2_score()) {
total_size += 2 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->team2_score());
}
// optional uint32 phase_id = 26;
if (has_phase_id()) {
total_size += 2 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->phase_id());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTATournamentInfo_UpcomingMatch::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTATournamentInfo_UpcomingMatch* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTATournamentInfo_UpcomingMatch*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTATournamentInfo_UpcomingMatch::MergeFrom(const CMsgDOTATournamentInfo_UpcomingMatch& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_series_id()) {
set_series_id(from.series_id());
}
if (from.has_team1_id()) {
set_team1_id(from.team1_id());
}
if (from.has_team2_id()) {
set_team2_id(from.team2_id());
}
if (from.has_bo()) {
set_bo(from.bo());
}
if (from.has_stage_name()) {
set_stage_name(from.stage_name());
}
if (from.has_start_time()) {
set_start_time(from.start_time());
}
if (from.has_winner_stage()) {
set_winner_stage(from.winner_stage());
}
if (from.has_loser_stage()) {
set_loser_stage(from.loser_stage());
}
}
if (from._has_bits_[8 / 32] & (0xffu << (8 % 32))) {
if (from.has_team1_tag()) {
set_team1_tag(from.team1_tag());
}
if (from.has_team2_tag()) {
set_team2_tag(from.team2_tag());
}
if (from.has_team1_prev_opponent_tag()) {
set_team1_prev_opponent_tag(from.team1_prev_opponent_tag());
}
if (from.has_team2_prev_opponent_tag()) {
set_team2_prev_opponent_tag(from.team2_prev_opponent_tag());
}
if (from.has_team1_logo()) {
set_team1_logo(from.team1_logo());
}
if (from.has_team2_logo()) {
set_team2_logo(from.team2_logo());
}
if (from.has_team1_prev_opponent_logo()) {
set_team1_prev_opponent_logo(from.team1_prev_opponent_logo());
}
if (from.has_team2_prev_opponent_logo()) {
set_team2_prev_opponent_logo(from.team2_prev_opponent_logo());
}
}
if (from._has_bits_[16 / 32] & (0xffu << (16 % 32))) {
if (from.has_team1_prev_opponent_id()) {
set_team1_prev_opponent_id(from.team1_prev_opponent_id());
}
if (from.has_team2_prev_opponent_id()) {
set_team2_prev_opponent_id(from.team2_prev_opponent_id());
}
if (from.has_team1_prev_match_score()) {
set_team1_prev_match_score(from.team1_prev_match_score());
}
if (from.has_team1_prev_match_opponent_score()) {
set_team1_prev_match_opponent_score(from.team1_prev_match_opponent_score());
}
if (from.has_team2_prev_match_score()) {
set_team2_prev_match_score(from.team2_prev_match_score());
}
if (from.has_team2_prev_match_opponent_score()) {
set_team2_prev_match_opponent_score(from.team2_prev_match_opponent_score());
}
if (from.has_phase_type()) {
set_phase_type(from.phase_type());
}
if (from.has_team1_score()) {
set_team1_score(from.team1_score());
}
}
if (from._has_bits_[24 / 32] & (0xffu << (24 % 32))) {
if (from.has_team2_score()) {
set_team2_score(from.team2_score());
}
if (from.has_phase_id()) {
set_phase_id(from.phase_id());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTATournamentInfo_UpcomingMatch::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTATournamentInfo_UpcomingMatch::CopyFrom(const CMsgDOTATournamentInfo_UpcomingMatch& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTATournamentInfo_UpcomingMatch::IsInitialized() const {
return true;
}
void CMsgDOTATournamentInfo_UpcomingMatch::Swap(CMsgDOTATournamentInfo_UpcomingMatch* other) {
if (other != this) {
std::swap(series_id_, other->series_id_);
std::swap(team1_id_, other->team1_id_);
std::swap(team2_id_, other->team2_id_);
std::swap(bo_, other->bo_);
std::swap(stage_name_, other->stage_name_);
std::swap(start_time_, other->start_time_);
std::swap(winner_stage_, other->winner_stage_);
std::swap(loser_stage_, other->loser_stage_);
std::swap(team1_tag_, other->team1_tag_);
std::swap(team2_tag_, other->team2_tag_);
std::swap(team1_prev_opponent_tag_, other->team1_prev_opponent_tag_);
std::swap(team2_prev_opponent_tag_, other->team2_prev_opponent_tag_);
std::swap(team1_logo_, other->team1_logo_);
std::swap(team2_logo_, other->team2_logo_);
std::swap(team1_prev_opponent_logo_, other->team1_prev_opponent_logo_);
std::swap(team2_prev_opponent_logo_, other->team2_prev_opponent_logo_);
std::swap(team1_prev_opponent_id_, other->team1_prev_opponent_id_);
std::swap(team2_prev_opponent_id_, other->team2_prev_opponent_id_);
std::swap(team1_prev_match_score_, other->team1_prev_match_score_);
std::swap(team1_prev_match_opponent_score_, other->team1_prev_match_opponent_score_);
std::swap(team2_prev_match_score_, other->team2_prev_match_score_);
std::swap(team2_prev_match_opponent_score_, other->team2_prev_match_opponent_score_);
std::swap(phase_type_, other->phase_type_);
std::swap(team1_score_, other->team1_score_);
std::swap(team2_score_, other->team2_score_);
std::swap(phase_id_, other->phase_id_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTATournamentInfo_UpcomingMatch::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTATournamentInfo_UpcomingMatch_descriptor_;
metadata.reflection = CMsgDOTATournamentInfo_UpcomingMatch_reflection_;
return metadata;
}
// -------------------------------------------------------------------
#ifndef _MSC_VER
const int CMsgDOTATournamentInfo_News::kLinkFieldNumber;
const int CMsgDOTATournamentInfo_News::kTitleFieldNumber;
const int CMsgDOTATournamentInfo_News::kImageFieldNumber;
const int CMsgDOTATournamentInfo_News::kTimestampFieldNumber;
#endif // !_MSC_VER
CMsgDOTATournamentInfo_News::CMsgDOTATournamentInfo_News()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTATournamentInfo.News)
}
void CMsgDOTATournamentInfo_News::InitAsDefaultInstance() {
}
CMsgDOTATournamentInfo_News::CMsgDOTATournamentInfo_News(const CMsgDOTATournamentInfo_News& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTATournamentInfo.News)
}
void CMsgDOTATournamentInfo_News::SharedCtor() {
::google::protobuf::internal::GetEmptyString();
_cached_size_ = 0;
link_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
title_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
image_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
timestamp_ = 0u;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTATournamentInfo_News::~CMsgDOTATournamentInfo_News() {
// @@protoc_insertion_point(destructor:CMsgDOTATournamentInfo.News)
SharedDtor();
}
void CMsgDOTATournamentInfo_News::SharedDtor() {
if (link_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete link_;
}
if (title_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete title_;
}
if (image_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete image_;
}
if (this != default_instance_) {
}
}
void CMsgDOTATournamentInfo_News::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTATournamentInfo_News::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTATournamentInfo_News_descriptor_;
}
const CMsgDOTATournamentInfo_News& CMsgDOTATournamentInfo_News::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTATournamentInfo_News* CMsgDOTATournamentInfo_News::default_instance_ = NULL;
CMsgDOTATournamentInfo_News* CMsgDOTATournamentInfo_News::New() const {
return new CMsgDOTATournamentInfo_News;
}
void CMsgDOTATournamentInfo_News::Clear() {
if (_has_bits_[0 / 32] & 15) {
if (has_link()) {
if (link_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
link_->clear();
}
}
if (has_title()) {
if (title_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
title_->clear();
}
}
if (has_image()) {
if (image_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
image_->clear();
}
}
timestamp_ = 0u;
}
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTATournamentInfo_News::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTATournamentInfo.News)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional string link = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_link()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->link().data(), this->link().length(),
::google::protobuf::internal::WireFormat::PARSE,
"link");
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_title;
break;
}
// optional string title = 2;
case 2: {
if (tag == 18) {
parse_title:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_title()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->title().data(), this->title().length(),
::google::protobuf::internal::WireFormat::PARSE,
"title");
} else {
goto handle_unusual;
}
if (input->ExpectTag(26)) goto parse_image;
break;
}
// optional string image = 3;
case 3: {
if (tag == 26) {
parse_image:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_image()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->image().data(), this->image().length(),
::google::protobuf::internal::WireFormat::PARSE,
"image");
} else {
goto handle_unusual;
}
if (input->ExpectTag(32)) goto parse_timestamp;
break;
}
// optional uint32 timestamp = 4;
case 4: {
if (tag == 32) {
parse_timestamp:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, ×tamp_)));
set_has_timestamp();
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTATournamentInfo.News)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTATournamentInfo.News)
return false;
#undef DO_
}
void CMsgDOTATournamentInfo_News::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTATournamentInfo.News)
// optional string link = 1;
if (has_link()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->link().data(), this->link().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"link");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
1, this->link(), output);
}
// optional string title = 2;
if (has_title()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->title().data(), this->title().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"title");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
2, this->title(), output);
}
// optional string image = 3;
if (has_image()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->image().data(), this->image().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"image");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
3, this->image(), output);
}
// optional uint32 timestamp = 4;
if (has_timestamp()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(4, this->timestamp(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTATournamentInfo.News)
}
::google::protobuf::uint8* CMsgDOTATournamentInfo_News::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTATournamentInfo.News)
// optional string link = 1;
if (has_link()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->link().data(), this->link().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"link");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
1, this->link(), target);
}
// optional string title = 2;
if (has_title()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->title().data(), this->title().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"title");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
2, this->title(), target);
}
// optional string image = 3;
if (has_image()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->image().data(), this->image().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"image");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
3, this->image(), target);
}
// optional uint32 timestamp = 4;
if (has_timestamp()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(4, this->timestamp(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTATournamentInfo.News)
return target;
}
int CMsgDOTATournamentInfo_News::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional string link = 1;
if (has_link()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->link());
}
// optional string title = 2;
if (has_title()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->title());
}
// optional string image = 3;
if (has_image()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->image());
}
// optional uint32 timestamp = 4;
if (has_timestamp()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->timestamp());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTATournamentInfo_News::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTATournamentInfo_News* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTATournamentInfo_News*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTATournamentInfo_News::MergeFrom(const CMsgDOTATournamentInfo_News& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_link()) {
set_link(from.link());
}
if (from.has_title()) {
set_title(from.title());
}
if (from.has_image()) {
set_image(from.image());
}
if (from.has_timestamp()) {
set_timestamp(from.timestamp());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTATournamentInfo_News::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTATournamentInfo_News::CopyFrom(const CMsgDOTATournamentInfo_News& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTATournamentInfo_News::IsInitialized() const {
return true;
}
void CMsgDOTATournamentInfo_News::Swap(CMsgDOTATournamentInfo_News* other) {
if (other != this) {
std::swap(link_, other->link_);
std::swap(title_, other->title_);
std::swap(image_, other->image_);
std::swap(timestamp_, other->timestamp_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTATournamentInfo_News::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTATournamentInfo_News_descriptor_;
metadata.reflection = CMsgDOTATournamentInfo_News_reflection_;
return metadata;
}
// -------------------------------------------------------------------
#ifndef _MSC_VER
const int CMsgDOTATournamentInfo::kLeagueIdFieldNumber;
const int CMsgDOTATournamentInfo::kPhaseListFieldNumber;
const int CMsgDOTATournamentInfo::kTeamsListFieldNumber;
const int CMsgDOTATournamentInfo::kUpcomingMatchesListFieldNumber;
const int CMsgDOTATournamentInfo::kNewsListFieldNumber;
#endif // !_MSC_VER
CMsgDOTATournamentInfo::CMsgDOTATournamentInfo()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTATournamentInfo)
}
void CMsgDOTATournamentInfo::InitAsDefaultInstance() {
}
CMsgDOTATournamentInfo::CMsgDOTATournamentInfo(const CMsgDOTATournamentInfo& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTATournamentInfo)
}
void CMsgDOTATournamentInfo::SharedCtor() {
_cached_size_ = 0;
league_id_ = 0u;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTATournamentInfo::~CMsgDOTATournamentInfo() {
// @@protoc_insertion_point(destructor:CMsgDOTATournamentInfo)
SharedDtor();
}
void CMsgDOTATournamentInfo::SharedDtor() {
if (this != default_instance_) {
}
}
void CMsgDOTATournamentInfo::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTATournamentInfo::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTATournamentInfo_descriptor_;
}
const CMsgDOTATournamentInfo& CMsgDOTATournamentInfo::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTATournamentInfo* CMsgDOTATournamentInfo::default_instance_ = NULL;
CMsgDOTATournamentInfo* CMsgDOTATournamentInfo::New() const {
return new CMsgDOTATournamentInfo;
}
void CMsgDOTATournamentInfo::Clear() {
league_id_ = 0u;
phase_list_.Clear();
teams_list_.Clear();
upcoming_matches_list_.Clear();
news_list_.Clear();
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTATournamentInfo::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTATournamentInfo)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint32 league_id = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &league_id_)));
set_has_league_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_phase_list;
break;
}
// repeated .CMsgDOTATournamentInfo.Phase phase_list = 2;
case 2: {
if (tag == 18) {
parse_phase_list:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_phase_list()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_phase_list;
if (input->ExpectTag(26)) goto parse_teams_list;
break;
}
// repeated .CMsgDOTATournamentInfo.Team teams_list = 3;
case 3: {
if (tag == 26) {
parse_teams_list:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_teams_list()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(26)) goto parse_teams_list;
if (input->ExpectTag(34)) goto parse_upcoming_matches_list;
break;
}
// repeated .CMsgDOTATournamentInfo.UpcomingMatch upcoming_matches_list = 4;
case 4: {
if (tag == 34) {
parse_upcoming_matches_list:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_upcoming_matches_list()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(34)) goto parse_upcoming_matches_list;
if (input->ExpectTag(42)) goto parse_news_list;
break;
}
// repeated .CMsgDOTATournamentInfo.News news_list = 5;
case 5: {
if (tag == 42) {
parse_news_list:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_news_list()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(42)) goto parse_news_list;
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTATournamentInfo)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTATournamentInfo)
return false;
#undef DO_
}
void CMsgDOTATournamentInfo::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTATournamentInfo)
// optional uint32 league_id = 1;
if (has_league_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->league_id(), output);
}
// repeated .CMsgDOTATournamentInfo.Phase phase_list = 2;
for (int i = 0; i < this->phase_list_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, this->phase_list(i), output);
}
// repeated .CMsgDOTATournamentInfo.Team teams_list = 3;
for (int i = 0; i < this->teams_list_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, this->teams_list(i), output);
}
// repeated .CMsgDOTATournamentInfo.UpcomingMatch upcoming_matches_list = 4;
for (int i = 0; i < this->upcoming_matches_list_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
4, this->upcoming_matches_list(i), output);
}
// repeated .CMsgDOTATournamentInfo.News news_list = 5;
for (int i = 0; i < this->news_list_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
5, this->news_list(i), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTATournamentInfo)
}
::google::protobuf::uint8* CMsgDOTATournamentInfo::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTATournamentInfo)
// optional uint32 league_id = 1;
if (has_league_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->league_id(), target);
}
// repeated .CMsgDOTATournamentInfo.Phase phase_list = 2;
for (int i = 0; i < this->phase_list_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
2, this->phase_list(i), target);
}
// repeated .CMsgDOTATournamentInfo.Team teams_list = 3;
for (int i = 0; i < this->teams_list_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
3, this->teams_list(i), target);
}
// repeated .CMsgDOTATournamentInfo.UpcomingMatch upcoming_matches_list = 4;
for (int i = 0; i < this->upcoming_matches_list_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
4, this->upcoming_matches_list(i), target);
}
// repeated .CMsgDOTATournamentInfo.News news_list = 5;
for (int i = 0; i < this->news_list_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
5, this->news_list(i), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTATournamentInfo)
return target;
}
int CMsgDOTATournamentInfo::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional uint32 league_id = 1;
if (has_league_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->league_id());
}
}
// repeated .CMsgDOTATournamentInfo.Phase phase_list = 2;
total_size += 1 * this->phase_list_size();
for (int i = 0; i < this->phase_list_size(); i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->phase_list(i));
}
// repeated .CMsgDOTATournamentInfo.Team teams_list = 3;
total_size += 1 * this->teams_list_size();
for (int i = 0; i < this->teams_list_size(); i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->teams_list(i));
}
// repeated .CMsgDOTATournamentInfo.UpcomingMatch upcoming_matches_list = 4;
total_size += 1 * this->upcoming_matches_list_size();
for (int i = 0; i < this->upcoming_matches_list_size(); i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->upcoming_matches_list(i));
}
// repeated .CMsgDOTATournamentInfo.News news_list = 5;
total_size += 1 * this->news_list_size();
for (int i = 0; i < this->news_list_size(); i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->news_list(i));
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTATournamentInfo::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTATournamentInfo* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTATournamentInfo*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTATournamentInfo::MergeFrom(const CMsgDOTATournamentInfo& from) {
GOOGLE_CHECK_NE(&from, this);
phase_list_.MergeFrom(from.phase_list_);
teams_list_.MergeFrom(from.teams_list_);
upcoming_matches_list_.MergeFrom(from.upcoming_matches_list_);
news_list_.MergeFrom(from.news_list_);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_league_id()) {
set_league_id(from.league_id());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTATournamentInfo::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTATournamentInfo::CopyFrom(const CMsgDOTATournamentInfo& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTATournamentInfo::IsInitialized() const {
return true;
}
void CMsgDOTATournamentInfo::Swap(CMsgDOTATournamentInfo* other) {
if (other != this) {
std::swap(league_id_, other->league_id_);
phase_list_.Swap(&other->phase_list_);
teams_list_.Swap(&other->teams_list_);
upcoming_matches_list_.Swap(&other->upcoming_matches_list_);
news_list_.Swap(&other->news_list_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTATournamentInfo::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTATournamentInfo_descriptor_;
metadata.reflection = CMsgDOTATournamentInfo_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
#endif // !_MSC_VER
CMsgRequestWeekendTourneySchedule::CMsgRequestWeekendTourneySchedule()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgRequestWeekendTourneySchedule)
}
void CMsgRequestWeekendTourneySchedule::InitAsDefaultInstance() {
}
CMsgRequestWeekendTourneySchedule::CMsgRequestWeekendTourneySchedule(const CMsgRequestWeekendTourneySchedule& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgRequestWeekendTourneySchedule)
}
void CMsgRequestWeekendTourneySchedule::SharedCtor() {
_cached_size_ = 0;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgRequestWeekendTourneySchedule::~CMsgRequestWeekendTourneySchedule() {
// @@protoc_insertion_point(destructor:CMsgRequestWeekendTourneySchedule)
SharedDtor();
}
void CMsgRequestWeekendTourneySchedule::SharedDtor() {
if (this != default_instance_) {
}
}
void CMsgRequestWeekendTourneySchedule::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgRequestWeekendTourneySchedule::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgRequestWeekendTourneySchedule_descriptor_;
}
const CMsgRequestWeekendTourneySchedule& CMsgRequestWeekendTourneySchedule::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgRequestWeekendTourneySchedule* CMsgRequestWeekendTourneySchedule::default_instance_ = NULL;
CMsgRequestWeekendTourneySchedule* CMsgRequestWeekendTourneySchedule::New() const {
return new CMsgRequestWeekendTourneySchedule;
}
void CMsgRequestWeekendTourneySchedule::Clear() {
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgRequestWeekendTourneySchedule::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgRequestWeekendTourneySchedule)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
}
success:
// @@protoc_insertion_point(parse_success:CMsgRequestWeekendTourneySchedule)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgRequestWeekendTourneySchedule)
return false;
#undef DO_
}
void CMsgRequestWeekendTourneySchedule::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgRequestWeekendTourneySchedule)
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgRequestWeekendTourneySchedule)
}
::google::protobuf::uint8* CMsgRequestWeekendTourneySchedule::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgRequestWeekendTourneySchedule)
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgRequestWeekendTourneySchedule)
return target;
}
int CMsgRequestWeekendTourneySchedule::ByteSize() const {
int total_size = 0;
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgRequestWeekendTourneySchedule::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgRequestWeekendTourneySchedule* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgRequestWeekendTourneySchedule*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgRequestWeekendTourneySchedule::MergeFrom(const CMsgRequestWeekendTourneySchedule& from) {
GOOGLE_CHECK_NE(&from, this);
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgRequestWeekendTourneySchedule::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgRequestWeekendTourneySchedule::CopyFrom(const CMsgRequestWeekendTourneySchedule& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgRequestWeekendTourneySchedule::IsInitialized() const {
return true;
}
void CMsgRequestWeekendTourneySchedule::Swap(CMsgRequestWeekendTourneySchedule* other) {
if (other != this) {
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgRequestWeekendTourneySchedule::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgRequestWeekendTourneySchedule_descriptor_;
metadata.reflection = CMsgRequestWeekendTourneySchedule_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int CMsgWeekendTourneySchedule_Division::kDivisionCodeFieldNumber;
const int CMsgWeekendTourneySchedule_Division::kTimeWindowOpenFieldNumber;
const int CMsgWeekendTourneySchedule_Division::kTimeWindowCloseFieldNumber;
const int CMsgWeekendTourneySchedule_Division::kTimeWindowOpenNextFieldNumber;
#endif // !_MSC_VER
CMsgWeekendTourneySchedule_Division::CMsgWeekendTourneySchedule_Division()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgWeekendTourneySchedule.Division)
}
void CMsgWeekendTourneySchedule_Division::InitAsDefaultInstance() {
}
CMsgWeekendTourneySchedule_Division::CMsgWeekendTourneySchedule_Division(const CMsgWeekendTourneySchedule_Division& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgWeekendTourneySchedule.Division)
}
void CMsgWeekendTourneySchedule_Division::SharedCtor() {
_cached_size_ = 0;
division_code_ = 0u;
time_window_open_ = 0u;
time_window_close_ = 0u;
time_window_open_next_ = 0u;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgWeekendTourneySchedule_Division::~CMsgWeekendTourneySchedule_Division() {
// @@protoc_insertion_point(destructor:CMsgWeekendTourneySchedule.Division)
SharedDtor();
}
void CMsgWeekendTourneySchedule_Division::SharedDtor() {
if (this != default_instance_) {
}
}
void CMsgWeekendTourneySchedule_Division::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgWeekendTourneySchedule_Division::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgWeekendTourneySchedule_Division_descriptor_;
}
const CMsgWeekendTourneySchedule_Division& CMsgWeekendTourneySchedule_Division::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgWeekendTourneySchedule_Division* CMsgWeekendTourneySchedule_Division::default_instance_ = NULL;
CMsgWeekendTourneySchedule_Division* CMsgWeekendTourneySchedule_Division::New() const {
return new CMsgWeekendTourneySchedule_Division;
}
void CMsgWeekendTourneySchedule_Division::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<CMsgWeekendTourneySchedule_Division*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
ZR_(division_code_, time_window_open_next_);
#undef OFFSET_OF_FIELD_
#undef ZR_
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgWeekendTourneySchedule_Division::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgWeekendTourneySchedule.Division)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint32 division_code = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &division_code_)));
set_has_division_code();
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_time_window_open;
break;
}
// optional uint32 time_window_open = 2;
case 2: {
if (tag == 16) {
parse_time_window_open:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &time_window_open_)));
set_has_time_window_open();
} else {
goto handle_unusual;
}
if (input->ExpectTag(24)) goto parse_time_window_close;
break;
}
// optional uint32 time_window_close = 3;
case 3: {
if (tag == 24) {
parse_time_window_close:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &time_window_close_)));
set_has_time_window_close();
} else {
goto handle_unusual;
}
if (input->ExpectTag(32)) goto parse_time_window_open_next;
break;
}
// optional uint32 time_window_open_next = 4;
case 4: {
if (tag == 32) {
parse_time_window_open_next:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &time_window_open_next_)));
set_has_time_window_open_next();
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgWeekendTourneySchedule.Division)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgWeekendTourneySchedule.Division)
return false;
#undef DO_
}
void CMsgWeekendTourneySchedule_Division::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgWeekendTourneySchedule.Division)
// optional uint32 division_code = 1;
if (has_division_code()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->division_code(), output);
}
// optional uint32 time_window_open = 2;
if (has_time_window_open()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->time_window_open(), output);
}
// optional uint32 time_window_close = 3;
if (has_time_window_close()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(3, this->time_window_close(), output);
}
// optional uint32 time_window_open_next = 4;
if (has_time_window_open_next()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(4, this->time_window_open_next(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgWeekendTourneySchedule.Division)
}
::google::protobuf::uint8* CMsgWeekendTourneySchedule_Division::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgWeekendTourneySchedule.Division)
// optional uint32 division_code = 1;
if (has_division_code()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->division_code(), target);
}
// optional uint32 time_window_open = 2;
if (has_time_window_open()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->time_window_open(), target);
}
// optional uint32 time_window_close = 3;
if (has_time_window_close()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(3, this->time_window_close(), target);
}
// optional uint32 time_window_open_next = 4;
if (has_time_window_open_next()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(4, this->time_window_open_next(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgWeekendTourneySchedule.Division)
return target;
}
int CMsgWeekendTourneySchedule_Division::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional uint32 division_code = 1;
if (has_division_code()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->division_code());
}
// optional uint32 time_window_open = 2;
if (has_time_window_open()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->time_window_open());
}
// optional uint32 time_window_close = 3;
if (has_time_window_close()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->time_window_close());
}
// optional uint32 time_window_open_next = 4;
if (has_time_window_open_next()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->time_window_open_next());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgWeekendTourneySchedule_Division::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgWeekendTourneySchedule_Division* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgWeekendTourneySchedule_Division*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgWeekendTourneySchedule_Division::MergeFrom(const CMsgWeekendTourneySchedule_Division& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_division_code()) {
set_division_code(from.division_code());
}
if (from.has_time_window_open()) {
set_time_window_open(from.time_window_open());
}
if (from.has_time_window_close()) {
set_time_window_close(from.time_window_close());
}
if (from.has_time_window_open_next()) {
set_time_window_open_next(from.time_window_open_next());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgWeekendTourneySchedule_Division::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgWeekendTourneySchedule_Division::CopyFrom(const CMsgWeekendTourneySchedule_Division& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgWeekendTourneySchedule_Division::IsInitialized() const {
return true;
}
void CMsgWeekendTourneySchedule_Division::Swap(CMsgWeekendTourneySchedule_Division* other) {
if (other != this) {
std::swap(division_code_, other->division_code_);
std::swap(time_window_open_, other->time_window_open_);
std::swap(time_window_close_, other->time_window_close_);
std::swap(time_window_open_next_, other->time_window_open_next_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgWeekendTourneySchedule_Division::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgWeekendTourneySchedule_Division_descriptor_;
metadata.reflection = CMsgWeekendTourneySchedule_Division_reflection_;
return metadata;
}
// -------------------------------------------------------------------
#ifndef _MSC_VER
const int CMsgWeekendTourneySchedule::kDivisionsFieldNumber;
#endif // !_MSC_VER
CMsgWeekendTourneySchedule::CMsgWeekendTourneySchedule()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgWeekendTourneySchedule)
}
void CMsgWeekendTourneySchedule::InitAsDefaultInstance() {
}
CMsgWeekendTourneySchedule::CMsgWeekendTourneySchedule(const CMsgWeekendTourneySchedule& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgWeekendTourneySchedule)
}
void CMsgWeekendTourneySchedule::SharedCtor() {
_cached_size_ = 0;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgWeekendTourneySchedule::~CMsgWeekendTourneySchedule() {
// @@protoc_insertion_point(destructor:CMsgWeekendTourneySchedule)
SharedDtor();
}
void CMsgWeekendTourneySchedule::SharedDtor() {
if (this != default_instance_) {
}
}
void CMsgWeekendTourneySchedule::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgWeekendTourneySchedule::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgWeekendTourneySchedule_descriptor_;
}
const CMsgWeekendTourneySchedule& CMsgWeekendTourneySchedule::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgWeekendTourneySchedule* CMsgWeekendTourneySchedule::default_instance_ = NULL;
CMsgWeekendTourneySchedule* CMsgWeekendTourneySchedule::New() const {
return new CMsgWeekendTourneySchedule;
}
void CMsgWeekendTourneySchedule::Clear() {
divisions_.Clear();
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgWeekendTourneySchedule::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgWeekendTourneySchedule)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// repeated .CMsgWeekendTourneySchedule.Division divisions = 1;
case 1: {
if (tag == 10) {
parse_divisions:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_divisions()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(10)) goto parse_divisions;
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgWeekendTourneySchedule)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgWeekendTourneySchedule)
return false;
#undef DO_
}
void CMsgWeekendTourneySchedule::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgWeekendTourneySchedule)
// repeated .CMsgWeekendTourneySchedule.Division divisions = 1;
for (int i = 0; i < this->divisions_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, this->divisions(i), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgWeekendTourneySchedule)
}
::google::protobuf::uint8* CMsgWeekendTourneySchedule::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgWeekendTourneySchedule)
// repeated .CMsgWeekendTourneySchedule.Division divisions = 1;
for (int i = 0; i < this->divisions_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
1, this->divisions(i), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgWeekendTourneySchedule)
return target;
}
int CMsgWeekendTourneySchedule::ByteSize() const {
int total_size = 0;
// repeated .CMsgWeekendTourneySchedule.Division divisions = 1;
total_size += 1 * this->divisions_size();
for (int i = 0; i < this->divisions_size(); i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->divisions(i));
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgWeekendTourneySchedule::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgWeekendTourneySchedule* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgWeekendTourneySchedule*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgWeekendTourneySchedule::MergeFrom(const CMsgWeekendTourneySchedule& from) {
GOOGLE_CHECK_NE(&from, this);
divisions_.MergeFrom(from.divisions_);
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgWeekendTourneySchedule::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgWeekendTourneySchedule::CopyFrom(const CMsgWeekendTourneySchedule& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgWeekendTourneySchedule::IsInitialized() const {
return true;
}
void CMsgWeekendTourneySchedule::Swap(CMsgWeekendTourneySchedule* other) {
if (other != this) {
divisions_.Swap(&other->divisions_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgWeekendTourneySchedule::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgWeekendTourneySchedule_descriptor_;
metadata.reflection = CMsgWeekendTourneySchedule_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int CMsgWeekendTourneyOpts::kParticipatingFieldNumber;
const int CMsgWeekendTourneyOpts::kDivisionIdFieldNumber;
const int CMsgWeekendTourneyOpts::kBuyinFieldNumber;
const int CMsgWeekendTourneyOpts::kSkillLevelFieldNumber;
const int CMsgWeekendTourneyOpts::kMatchGroupsFieldNumber;
const int CMsgWeekendTourneyOpts::kTeamIdFieldNumber;
const int CMsgWeekendTourneyOpts::kPickupTeamNameFieldNumber;
const int CMsgWeekendTourneyOpts::kPickupTeamLogoFieldNumber;
#endif // !_MSC_VER
CMsgWeekendTourneyOpts::CMsgWeekendTourneyOpts()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgWeekendTourneyOpts)
}
void CMsgWeekendTourneyOpts::InitAsDefaultInstance() {
}
CMsgWeekendTourneyOpts::CMsgWeekendTourneyOpts(const CMsgWeekendTourneyOpts& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgWeekendTourneyOpts)
}
void CMsgWeekendTourneyOpts::SharedCtor() {
::google::protobuf::internal::GetEmptyString();
_cached_size_ = 0;
participating_ = false;
division_id_ = 0u;
buyin_ = 0u;
skill_level_ = 0u;
match_groups_ = 0u;
team_id_ = 0u;
pickup_team_name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
pickup_team_logo_ = GOOGLE_ULONGLONG(0);
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgWeekendTourneyOpts::~CMsgWeekendTourneyOpts() {
// @@protoc_insertion_point(destructor:CMsgWeekendTourneyOpts)
SharedDtor();
}
void CMsgWeekendTourneyOpts::SharedDtor() {
if (pickup_team_name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete pickup_team_name_;
}
if (this != default_instance_) {
}
}
void CMsgWeekendTourneyOpts::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgWeekendTourneyOpts::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgWeekendTourneyOpts_descriptor_;
}
const CMsgWeekendTourneyOpts& CMsgWeekendTourneyOpts::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgWeekendTourneyOpts* CMsgWeekendTourneyOpts::default_instance_ = NULL;
CMsgWeekendTourneyOpts* CMsgWeekendTourneyOpts::New() const {
return new CMsgWeekendTourneyOpts;
}
void CMsgWeekendTourneyOpts::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<CMsgWeekendTourneyOpts*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
if (_has_bits_[0 / 32] & 255) {
ZR_(participating_, team_id_);
if (has_pickup_team_name()) {
if (pickup_team_name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
pickup_team_name_->clear();
}
}
pickup_team_logo_ = GOOGLE_ULONGLONG(0);
}
#undef OFFSET_OF_FIELD_
#undef ZR_
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgWeekendTourneyOpts::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgWeekendTourneyOpts)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional bool participating = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &participating_)));
set_has_participating();
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_division_id;
break;
}
// optional uint32 division_id = 2;
case 2: {
if (tag == 16) {
parse_division_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &division_id_)));
set_has_division_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(24)) goto parse_buyin;
break;
}
// optional uint32 buyin = 3;
case 3: {
if (tag == 24) {
parse_buyin:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &buyin_)));
set_has_buyin();
} else {
goto handle_unusual;
}
if (input->ExpectTag(32)) goto parse_skill_level;
break;
}
// optional uint32 skill_level = 4;
case 4: {
if (tag == 32) {
parse_skill_level:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &skill_level_)));
set_has_skill_level();
} else {
goto handle_unusual;
}
if (input->ExpectTag(40)) goto parse_match_groups;
break;
}
// optional uint32 match_groups = 5;
case 5: {
if (tag == 40) {
parse_match_groups:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &match_groups_)));
set_has_match_groups();
} else {
goto handle_unusual;
}
if (input->ExpectTag(48)) goto parse_team_id;
break;
}
// optional uint32 team_id = 6;
case 6: {
if (tag == 48) {
parse_team_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &team_id_)));
set_has_team_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(58)) goto parse_pickup_team_name;
break;
}
// optional string pickup_team_name = 7;
case 7: {
if (tag == 58) {
parse_pickup_team_name:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_pickup_team_name()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->pickup_team_name().data(), this->pickup_team_name().length(),
::google::protobuf::internal::WireFormat::PARSE,
"pickup_team_name");
} else {
goto handle_unusual;
}
if (input->ExpectTag(64)) goto parse_pickup_team_logo;
break;
}
// optional uint64 pickup_team_logo = 8;
case 8: {
if (tag == 64) {
parse_pickup_team_logo:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &pickup_team_logo_)));
set_has_pickup_team_logo();
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgWeekendTourneyOpts)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgWeekendTourneyOpts)
return false;
#undef DO_
}
void CMsgWeekendTourneyOpts::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgWeekendTourneyOpts)
// optional bool participating = 1;
if (has_participating()) {
::google::protobuf::internal::WireFormatLite::WriteBool(1, this->participating(), output);
}
// optional uint32 division_id = 2;
if (has_division_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->division_id(), output);
}
// optional uint32 buyin = 3;
if (has_buyin()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(3, this->buyin(), output);
}
// optional uint32 skill_level = 4;
if (has_skill_level()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(4, this->skill_level(), output);
}
// optional uint32 match_groups = 5;
if (has_match_groups()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(5, this->match_groups(), output);
}
// optional uint32 team_id = 6;
if (has_team_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(6, this->team_id(), output);
}
// optional string pickup_team_name = 7;
if (has_pickup_team_name()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->pickup_team_name().data(), this->pickup_team_name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"pickup_team_name");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
7, this->pickup_team_name(), output);
}
// optional uint64 pickup_team_logo = 8;
if (has_pickup_team_logo()) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(8, this->pickup_team_logo(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgWeekendTourneyOpts)
}
::google::protobuf::uint8* CMsgWeekendTourneyOpts::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgWeekendTourneyOpts)
// optional bool participating = 1;
if (has_participating()) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(1, this->participating(), target);
}
// optional uint32 division_id = 2;
if (has_division_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->division_id(), target);
}
// optional uint32 buyin = 3;
if (has_buyin()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(3, this->buyin(), target);
}
// optional uint32 skill_level = 4;
if (has_skill_level()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(4, this->skill_level(), target);
}
// optional uint32 match_groups = 5;
if (has_match_groups()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(5, this->match_groups(), target);
}
// optional uint32 team_id = 6;
if (has_team_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(6, this->team_id(), target);
}
// optional string pickup_team_name = 7;
if (has_pickup_team_name()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->pickup_team_name().data(), this->pickup_team_name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"pickup_team_name");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
7, this->pickup_team_name(), target);
}
// optional uint64 pickup_team_logo = 8;
if (has_pickup_team_logo()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(8, this->pickup_team_logo(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgWeekendTourneyOpts)
return target;
}
int CMsgWeekendTourneyOpts::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional bool participating = 1;
if (has_participating()) {
total_size += 1 + 1;
}
// optional uint32 division_id = 2;
if (has_division_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->division_id());
}
// optional uint32 buyin = 3;
if (has_buyin()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->buyin());
}
// optional uint32 skill_level = 4;
if (has_skill_level()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->skill_level());
}
// optional uint32 match_groups = 5;
if (has_match_groups()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->match_groups());
}
// optional uint32 team_id = 6;
if (has_team_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->team_id());
}
// optional string pickup_team_name = 7;
if (has_pickup_team_name()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->pickup_team_name());
}
// optional uint64 pickup_team_logo = 8;
if (has_pickup_team_logo()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->pickup_team_logo());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgWeekendTourneyOpts::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgWeekendTourneyOpts* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgWeekendTourneyOpts*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgWeekendTourneyOpts::MergeFrom(const CMsgWeekendTourneyOpts& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_participating()) {
set_participating(from.participating());
}
if (from.has_division_id()) {
set_division_id(from.division_id());
}
if (from.has_buyin()) {
set_buyin(from.buyin());
}
if (from.has_skill_level()) {
set_skill_level(from.skill_level());
}
if (from.has_match_groups()) {
set_match_groups(from.match_groups());
}
if (from.has_team_id()) {
set_team_id(from.team_id());
}
if (from.has_pickup_team_name()) {
set_pickup_team_name(from.pickup_team_name());
}
if (from.has_pickup_team_logo()) {
set_pickup_team_logo(from.pickup_team_logo());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgWeekendTourneyOpts::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgWeekendTourneyOpts::CopyFrom(const CMsgWeekendTourneyOpts& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgWeekendTourneyOpts::IsInitialized() const {
return true;
}
void CMsgWeekendTourneyOpts::Swap(CMsgWeekendTourneyOpts* other) {
if (other != this) {
std::swap(participating_, other->participating_);
std::swap(division_id_, other->division_id_);
std::swap(buyin_, other->buyin_);
std::swap(skill_level_, other->skill_level_);
std::swap(match_groups_, other->match_groups_);
std::swap(team_id_, other->team_id_);
std::swap(pickup_team_name_, other->pickup_team_name_);
std::swap(pickup_team_logo_, other->pickup_team_logo_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgWeekendTourneyOpts::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgWeekendTourneyOpts_descriptor_;
metadata.reflection = CMsgWeekendTourneyOpts_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
#endif // !_MSC_VER
CMsgWeekendTourneyLeave::CMsgWeekendTourneyLeave()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgWeekendTourneyLeave)
}
void CMsgWeekendTourneyLeave::InitAsDefaultInstance() {
}
CMsgWeekendTourneyLeave::CMsgWeekendTourneyLeave(const CMsgWeekendTourneyLeave& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgWeekendTourneyLeave)
}
void CMsgWeekendTourneyLeave::SharedCtor() {
_cached_size_ = 0;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgWeekendTourneyLeave::~CMsgWeekendTourneyLeave() {
// @@protoc_insertion_point(destructor:CMsgWeekendTourneyLeave)
SharedDtor();
}
void CMsgWeekendTourneyLeave::SharedDtor() {
if (this != default_instance_) {
}
}
void CMsgWeekendTourneyLeave::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgWeekendTourneyLeave::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgWeekendTourneyLeave_descriptor_;
}
const CMsgWeekendTourneyLeave& CMsgWeekendTourneyLeave::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgWeekendTourneyLeave* CMsgWeekendTourneyLeave::default_instance_ = NULL;
CMsgWeekendTourneyLeave* CMsgWeekendTourneyLeave::New() const {
return new CMsgWeekendTourneyLeave;
}
void CMsgWeekendTourneyLeave::Clear() {
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgWeekendTourneyLeave::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgWeekendTourneyLeave)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
}
success:
// @@protoc_insertion_point(parse_success:CMsgWeekendTourneyLeave)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgWeekendTourneyLeave)
return false;
#undef DO_
}
void CMsgWeekendTourneyLeave::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgWeekendTourneyLeave)
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgWeekendTourneyLeave)
}
::google::protobuf::uint8* CMsgWeekendTourneyLeave::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgWeekendTourneyLeave)
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgWeekendTourneyLeave)
return target;
}
int CMsgWeekendTourneyLeave::ByteSize() const {
int total_size = 0;
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgWeekendTourneyLeave::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgWeekendTourneyLeave* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgWeekendTourneyLeave*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgWeekendTourneyLeave::MergeFrom(const CMsgWeekendTourneyLeave& from) {
GOOGLE_CHECK_NE(&from, this);
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgWeekendTourneyLeave::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgWeekendTourneyLeave::CopyFrom(const CMsgWeekendTourneyLeave& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgWeekendTourneyLeave::IsInitialized() const {
return true;
}
void CMsgWeekendTourneyLeave::Swap(CMsgWeekendTourneyLeave* other) {
if (other != this) {
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgWeekendTourneyLeave::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgWeekendTourneyLeave_descriptor_;
metadata.reflection = CMsgWeekendTourneyLeave_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int CMsgDOTATournament_Team::kTeamGidFieldNumber;
const int CMsgDOTATournament_Team::kNodeOrStateFieldNumber;
const int CMsgDOTATournament_Team::kPlayersFieldNumber;
const int CMsgDOTATournament_Team::kPlayerBuyinFieldNumber;
const int CMsgDOTATournament_Team::kPlayerSkillLevelFieldNumber;
const int CMsgDOTATournament_Team::kMatchGroupMaskFieldNumber;
const int CMsgDOTATournament_Team::kTeamIdFieldNumber;
const int CMsgDOTATournament_Team::kTeamNameFieldNumber;
const int CMsgDOTATournament_Team::kTeamBaseLogoFieldNumber;
const int CMsgDOTATournament_Team::kTeamUiLogoFieldNumber;
const int CMsgDOTATournament_Team::kTeamDateFieldNumber;
#endif // !_MSC_VER
CMsgDOTATournament_Team::CMsgDOTATournament_Team()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTATournament.Team)
}
void CMsgDOTATournament_Team::InitAsDefaultInstance() {
}
CMsgDOTATournament_Team::CMsgDOTATournament_Team(const CMsgDOTATournament_Team& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTATournament.Team)
}
void CMsgDOTATournament_Team::SharedCtor() {
::google::protobuf::internal::GetEmptyString();
_cached_size_ = 0;
team_gid_ = GOOGLE_ULONGLONG(0);
node_or_state_ = 0u;
match_group_mask_ = 0u;
team_id_ = 0u;
team_name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
team_base_logo_ = GOOGLE_ULONGLONG(0);
team_ui_logo_ = GOOGLE_ULONGLONG(0);
team_date_ = 0u;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTATournament_Team::~CMsgDOTATournament_Team() {
// @@protoc_insertion_point(destructor:CMsgDOTATournament.Team)
SharedDtor();
}
void CMsgDOTATournament_Team::SharedDtor() {
if (team_name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete team_name_;
}
if (this != default_instance_) {
}
}
void CMsgDOTATournament_Team::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTATournament_Team::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTATournament_Team_descriptor_;
}
const CMsgDOTATournament_Team& CMsgDOTATournament_Team::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTATournament_Team* CMsgDOTATournament_Team::default_instance_ = NULL;
CMsgDOTATournament_Team* CMsgDOTATournament_Team::New() const {
return new CMsgDOTATournament_Team;
}
void CMsgDOTATournament_Team::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<CMsgDOTATournament_Team*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
if (_has_bits_[0 / 32] & 227) {
ZR_(node_or_state_, match_group_mask_);
team_gid_ = GOOGLE_ULONGLONG(0);
team_id_ = 0u;
if (has_team_name()) {
if (team_name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
team_name_->clear();
}
}
}
if (_has_bits_[8 / 32] & 1792) {
ZR_(team_date_, team_ui_logo_);
team_base_logo_ = GOOGLE_ULONGLONG(0);
}
#undef OFFSET_OF_FIELD_
#undef ZR_
players_.Clear();
player_buyin_.Clear();
player_skill_level_.Clear();
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTATournament_Team::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTATournament.Team)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional fixed64 team_gid = 1;
case 1: {
if (tag == 9) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_FIXED64>(
input, &team_gid_)));
set_has_team_gid();
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_node_or_state;
break;
}
// optional uint32 node_or_state = 2;
case 2: {
if (tag == 16) {
parse_node_or_state:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &node_or_state_)));
set_has_node_or_state();
} else {
goto handle_unusual;
}
if (input->ExpectTag(26)) goto parse_players;
break;
}
// repeated uint32 players = 3 [packed = true];
case 3: {
if (tag == 26) {
parse_players:
DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, this->mutable_players())));
} else if (tag == 24) {
DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
1, 26, input, this->mutable_players())));
} else {
goto handle_unusual;
}
if (input->ExpectTag(32)) goto parse_team_id;
break;
}
// optional uint32 team_id = 4;
case 4: {
if (tag == 32) {
parse_team_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &team_id_)));
set_has_team_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(42)) goto parse_team_name;
break;
}
// optional string team_name = 5;
case 5: {
if (tag == 42) {
parse_team_name:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_team_name()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->team_name().data(), this->team_name().length(),
::google::protobuf::internal::WireFormat::PARSE,
"team_name");
} else {
goto handle_unusual;
}
if (input->ExpectTag(56)) goto parse_team_base_logo;
break;
}
// optional uint64 team_base_logo = 7;
case 7: {
if (tag == 56) {
parse_team_base_logo:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &team_base_logo_)));
set_has_team_base_logo();
} else {
goto handle_unusual;
}
if (input->ExpectTag(64)) goto parse_team_ui_logo;
break;
}
// optional uint64 team_ui_logo = 8;
case 8: {
if (tag == 64) {
parse_team_ui_logo:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &team_ui_logo_)));
set_has_team_ui_logo();
} else {
goto handle_unusual;
}
if (input->ExpectTag(74)) goto parse_player_buyin;
break;
}
// repeated uint32 player_buyin = 9 [packed = true];
case 9: {
if (tag == 74) {
parse_player_buyin:
DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, this->mutable_player_buyin())));
} else if (tag == 72) {
DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
1, 74, input, this->mutable_player_buyin())));
} else {
goto handle_unusual;
}
if (input->ExpectTag(82)) goto parse_player_skill_level;
break;
}
// repeated uint32 player_skill_level = 10 [packed = true];
case 10: {
if (tag == 82) {
parse_player_skill_level:
DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, this->mutable_player_skill_level())));
} else if (tag == 80) {
DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
1, 82, input, this->mutable_player_skill_level())));
} else {
goto handle_unusual;
}
if (input->ExpectTag(88)) goto parse_team_date;
break;
}
// optional uint32 team_date = 11;
case 11: {
if (tag == 88) {
parse_team_date:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &team_date_)));
set_has_team_date();
} else {
goto handle_unusual;
}
if (input->ExpectTag(96)) goto parse_match_group_mask;
break;
}
// optional uint32 match_group_mask = 12;
case 12: {
if (tag == 96) {
parse_match_group_mask:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &match_group_mask_)));
set_has_match_group_mask();
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTATournament.Team)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTATournament.Team)
return false;
#undef DO_
}
void CMsgDOTATournament_Team::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTATournament.Team)
// optional fixed64 team_gid = 1;
if (has_team_gid()) {
::google::protobuf::internal::WireFormatLite::WriteFixed64(1, this->team_gid(), output);
}
// optional uint32 node_or_state = 2;
if (has_node_or_state()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->node_or_state(), output);
}
// repeated uint32 players = 3 [packed = true];
if (this->players_size() > 0) {
::google::protobuf::internal::WireFormatLite::WriteTag(3, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output);
output->WriteVarint32(_players_cached_byte_size_);
}
for (int i = 0; i < this->players_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteUInt32NoTag(
this->players(i), output);
}
// optional uint32 team_id = 4;
if (has_team_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(4, this->team_id(), output);
}
// optional string team_name = 5;
if (has_team_name()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->team_name().data(), this->team_name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"team_name");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
5, this->team_name(), output);
}
// optional uint64 team_base_logo = 7;
if (has_team_base_logo()) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(7, this->team_base_logo(), output);
}
// optional uint64 team_ui_logo = 8;
if (has_team_ui_logo()) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(8, this->team_ui_logo(), output);
}
// repeated uint32 player_buyin = 9 [packed = true];
if (this->player_buyin_size() > 0) {
::google::protobuf::internal::WireFormatLite::WriteTag(9, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output);
output->WriteVarint32(_player_buyin_cached_byte_size_);
}
for (int i = 0; i < this->player_buyin_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteUInt32NoTag(
this->player_buyin(i), output);
}
// repeated uint32 player_skill_level = 10 [packed = true];
if (this->player_skill_level_size() > 0) {
::google::protobuf::internal::WireFormatLite::WriteTag(10, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output);
output->WriteVarint32(_player_skill_level_cached_byte_size_);
}
for (int i = 0; i < this->player_skill_level_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteUInt32NoTag(
this->player_skill_level(i), output);
}
// optional uint32 team_date = 11;
if (has_team_date()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(11, this->team_date(), output);
}
// optional uint32 match_group_mask = 12;
if (has_match_group_mask()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(12, this->match_group_mask(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTATournament.Team)
}
::google::protobuf::uint8* CMsgDOTATournament_Team::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTATournament.Team)
// optional fixed64 team_gid = 1;
if (has_team_gid()) {
target = ::google::protobuf::internal::WireFormatLite::WriteFixed64ToArray(1, this->team_gid(), target);
}
// optional uint32 node_or_state = 2;
if (has_node_or_state()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->node_or_state(), target);
}
// repeated uint32 players = 3 [packed = true];
if (this->players_size() > 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray(
3,
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
target);
target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray(
_players_cached_byte_size_, target);
}
for (int i = 0; i < this->players_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteUInt32NoTagToArray(this->players(i), target);
}
// optional uint32 team_id = 4;
if (has_team_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(4, this->team_id(), target);
}
// optional string team_name = 5;
if (has_team_name()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->team_name().data(), this->team_name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"team_name");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
5, this->team_name(), target);
}
// optional uint64 team_base_logo = 7;
if (has_team_base_logo()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(7, this->team_base_logo(), target);
}
// optional uint64 team_ui_logo = 8;
if (has_team_ui_logo()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(8, this->team_ui_logo(), target);
}
// repeated uint32 player_buyin = 9 [packed = true];
if (this->player_buyin_size() > 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray(
9,
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
target);
target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray(
_player_buyin_cached_byte_size_, target);
}
for (int i = 0; i < this->player_buyin_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteUInt32NoTagToArray(this->player_buyin(i), target);
}
// repeated uint32 player_skill_level = 10 [packed = true];
if (this->player_skill_level_size() > 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray(
10,
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
target);
target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray(
_player_skill_level_cached_byte_size_, target);
}
for (int i = 0; i < this->player_skill_level_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteUInt32NoTagToArray(this->player_skill_level(i), target);
}
// optional uint32 team_date = 11;
if (has_team_date()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(11, this->team_date(), target);
}
// optional uint32 match_group_mask = 12;
if (has_match_group_mask()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(12, this->match_group_mask(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTATournament.Team)
return target;
}
int CMsgDOTATournament_Team::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional fixed64 team_gid = 1;
if (has_team_gid()) {
total_size += 1 + 8;
}
// optional uint32 node_or_state = 2;
if (has_node_or_state()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->node_or_state());
}
// optional uint32 match_group_mask = 12;
if (has_match_group_mask()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->match_group_mask());
}
// optional uint32 team_id = 4;
if (has_team_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->team_id());
}
// optional string team_name = 5;
if (has_team_name()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->team_name());
}
}
if (_has_bits_[8 / 32] & (0xffu << (8 % 32))) {
// optional uint64 team_base_logo = 7;
if (has_team_base_logo()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->team_base_logo());
}
// optional uint64 team_ui_logo = 8;
if (has_team_ui_logo()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->team_ui_logo());
}
// optional uint32 team_date = 11;
if (has_team_date()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->team_date());
}
}
// repeated uint32 players = 3 [packed = true];
{
int data_size = 0;
for (int i = 0; i < this->players_size(); i++) {
data_size += ::google::protobuf::internal::WireFormatLite::
UInt32Size(this->players(i));
}
if (data_size > 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::Int32Size(data_size);
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_players_cached_byte_size_ = data_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
total_size += data_size;
}
// repeated uint32 player_buyin = 9 [packed = true];
{
int data_size = 0;
for (int i = 0; i < this->player_buyin_size(); i++) {
data_size += ::google::protobuf::internal::WireFormatLite::
UInt32Size(this->player_buyin(i));
}
if (data_size > 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::Int32Size(data_size);
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_player_buyin_cached_byte_size_ = data_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
total_size += data_size;
}
// repeated uint32 player_skill_level = 10 [packed = true];
{
int data_size = 0;
for (int i = 0; i < this->player_skill_level_size(); i++) {
data_size += ::google::protobuf::internal::WireFormatLite::
UInt32Size(this->player_skill_level(i));
}
if (data_size > 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::Int32Size(data_size);
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_player_skill_level_cached_byte_size_ = data_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
total_size += data_size;
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTATournament_Team::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTATournament_Team* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTATournament_Team*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTATournament_Team::MergeFrom(const CMsgDOTATournament_Team& from) {
GOOGLE_CHECK_NE(&from, this);
players_.MergeFrom(from.players_);
player_buyin_.MergeFrom(from.player_buyin_);
player_skill_level_.MergeFrom(from.player_skill_level_);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_team_gid()) {
set_team_gid(from.team_gid());
}
if (from.has_node_or_state()) {
set_node_or_state(from.node_or_state());
}
if (from.has_match_group_mask()) {
set_match_group_mask(from.match_group_mask());
}
if (from.has_team_id()) {
set_team_id(from.team_id());
}
if (from.has_team_name()) {
set_team_name(from.team_name());
}
}
if (from._has_bits_[8 / 32] & (0xffu << (8 % 32))) {
if (from.has_team_base_logo()) {
set_team_base_logo(from.team_base_logo());
}
if (from.has_team_ui_logo()) {
set_team_ui_logo(from.team_ui_logo());
}
if (from.has_team_date()) {
set_team_date(from.team_date());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTATournament_Team::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTATournament_Team::CopyFrom(const CMsgDOTATournament_Team& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTATournament_Team::IsInitialized() const {
return true;
}
void CMsgDOTATournament_Team::Swap(CMsgDOTATournament_Team* other) {
if (other != this) {
std::swap(team_gid_, other->team_gid_);
std::swap(node_or_state_, other->node_or_state_);
players_.Swap(&other->players_);
player_buyin_.Swap(&other->player_buyin_);
player_skill_level_.Swap(&other->player_skill_level_);
std::swap(match_group_mask_, other->match_group_mask_);
std::swap(team_id_, other->team_id_);
std::swap(team_name_, other->team_name_);
std::swap(team_base_logo_, other->team_base_logo_);
std::swap(team_ui_logo_, other->team_ui_logo_);
std::swap(team_date_, other->team_date_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTATournament_Team::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTATournament_Team_descriptor_;
metadata.reflection = CMsgDOTATournament_Team_reflection_;
return metadata;
}
// -------------------------------------------------------------------
#ifndef _MSC_VER
const int CMsgDOTATournament_Game::kNodeIdxFieldNumber;
const int CMsgDOTATournament_Game::kLobbyIdFieldNumber;
const int CMsgDOTATournament_Game::kMatchIdFieldNumber;
const int CMsgDOTATournament_Game::kTeamAGoodFieldNumber;
const int CMsgDOTATournament_Game::kStateFieldNumber;
const int CMsgDOTATournament_Game::kStartTimeFieldNumber;
#endif // !_MSC_VER
CMsgDOTATournament_Game::CMsgDOTATournament_Game()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTATournament.Game)
}
void CMsgDOTATournament_Game::InitAsDefaultInstance() {
}
CMsgDOTATournament_Game::CMsgDOTATournament_Game(const CMsgDOTATournament_Game& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTATournament.Game)
}
void CMsgDOTATournament_Game::SharedCtor() {
_cached_size_ = 0;
node_idx_ = 0u;
lobby_id_ = GOOGLE_ULONGLONG(0);
match_id_ = GOOGLE_ULONGLONG(0);
team_a_good_ = false;
state_ = 0;
start_time_ = 0u;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTATournament_Game::~CMsgDOTATournament_Game() {
// @@protoc_insertion_point(destructor:CMsgDOTATournament.Game)
SharedDtor();
}
void CMsgDOTATournament_Game::SharedDtor() {
if (this != default_instance_) {
}
}
void CMsgDOTATournament_Game::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTATournament_Game::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTATournament_Game_descriptor_;
}
const CMsgDOTATournament_Game& CMsgDOTATournament_Game::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTATournament_Game* CMsgDOTATournament_Game::default_instance_ = NULL;
CMsgDOTATournament_Game* CMsgDOTATournament_Game::New() const {
return new CMsgDOTATournament_Game;
}
void CMsgDOTATournament_Game::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<CMsgDOTATournament_Game*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
if (_has_bits_[0 / 32] & 63) {
ZR_(lobby_id_, start_time_);
}
#undef OFFSET_OF_FIELD_
#undef ZR_
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTATournament_Game::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTATournament.Game)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint32 node_idx = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &node_idx_)));
set_has_node_idx();
} else {
goto handle_unusual;
}
if (input->ExpectTag(17)) goto parse_lobby_id;
break;
}
// optional fixed64 lobby_id = 2;
case 2: {
if (tag == 17) {
parse_lobby_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_FIXED64>(
input, &lobby_id_)));
set_has_lobby_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(24)) goto parse_match_id;
break;
}
// optional uint64 match_id = 3;
case 3: {
if (tag == 24) {
parse_match_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &match_id_)));
set_has_match_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(32)) goto parse_team_a_good;
break;
}
// optional bool team_a_good = 4;
case 4: {
if (tag == 32) {
parse_team_a_good:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &team_a_good_)));
set_has_team_a_good();
} else {
goto handle_unusual;
}
if (input->ExpectTag(40)) goto parse_state;
break;
}
// optional .ETournamentGameState state = 5 [default = k_ETournamentGameState_Unknown];
case 5: {
if (tag == 40) {
parse_state:
int value;
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
input, &value)));
if (::ETournamentGameState_IsValid(value)) {
set_state(static_cast< ::ETournamentGameState >(value));
} else {
mutable_unknown_fields()->AddVarint(5, value);
}
} else {
goto handle_unusual;
}
if (input->ExpectTag(48)) goto parse_start_time;
break;
}
// optional uint32 start_time = 6;
case 6: {
if (tag == 48) {
parse_start_time:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &start_time_)));
set_has_start_time();
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTATournament.Game)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTATournament.Game)
return false;
#undef DO_
}
void CMsgDOTATournament_Game::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTATournament.Game)
// optional uint32 node_idx = 1;
if (has_node_idx()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->node_idx(), output);
}
// optional fixed64 lobby_id = 2;
if (has_lobby_id()) {
::google::protobuf::internal::WireFormatLite::WriteFixed64(2, this->lobby_id(), output);
}
// optional uint64 match_id = 3;
if (has_match_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(3, this->match_id(), output);
}
// optional bool team_a_good = 4;
if (has_team_a_good()) {
::google::protobuf::internal::WireFormatLite::WriteBool(4, this->team_a_good(), output);
}
// optional .ETournamentGameState state = 5 [default = k_ETournamentGameState_Unknown];
if (has_state()) {
::google::protobuf::internal::WireFormatLite::WriteEnum(
5, this->state(), output);
}
// optional uint32 start_time = 6;
if (has_start_time()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(6, this->start_time(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTATournament.Game)
}
::google::protobuf::uint8* CMsgDOTATournament_Game::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTATournament.Game)
// optional uint32 node_idx = 1;
if (has_node_idx()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->node_idx(), target);
}
// optional fixed64 lobby_id = 2;
if (has_lobby_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteFixed64ToArray(2, this->lobby_id(), target);
}
// optional uint64 match_id = 3;
if (has_match_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(3, this->match_id(), target);
}
// optional bool team_a_good = 4;
if (has_team_a_good()) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(4, this->team_a_good(), target);
}
// optional .ETournamentGameState state = 5 [default = k_ETournamentGameState_Unknown];
if (has_state()) {
target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
5, this->state(), target);
}
// optional uint32 start_time = 6;
if (has_start_time()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(6, this->start_time(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTATournament.Game)
return target;
}
int CMsgDOTATournament_Game::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional uint32 node_idx = 1;
if (has_node_idx()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->node_idx());
}
// optional fixed64 lobby_id = 2;
if (has_lobby_id()) {
total_size += 1 + 8;
}
// optional uint64 match_id = 3;
if (has_match_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->match_id());
}
// optional bool team_a_good = 4;
if (has_team_a_good()) {
total_size += 1 + 1;
}
// optional .ETournamentGameState state = 5 [default = k_ETournamentGameState_Unknown];
if (has_state()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::EnumSize(this->state());
}
// optional uint32 start_time = 6;
if (has_start_time()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->start_time());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTATournament_Game::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTATournament_Game* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTATournament_Game*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTATournament_Game::MergeFrom(const CMsgDOTATournament_Game& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_node_idx()) {
set_node_idx(from.node_idx());
}
if (from.has_lobby_id()) {
set_lobby_id(from.lobby_id());
}
if (from.has_match_id()) {
set_match_id(from.match_id());
}
if (from.has_team_a_good()) {
set_team_a_good(from.team_a_good());
}
if (from.has_state()) {
set_state(from.state());
}
if (from.has_start_time()) {
set_start_time(from.start_time());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTATournament_Game::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTATournament_Game::CopyFrom(const CMsgDOTATournament_Game& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTATournament_Game::IsInitialized() const {
return true;
}
void CMsgDOTATournament_Game::Swap(CMsgDOTATournament_Game* other) {
if (other != this) {
std::swap(node_idx_, other->node_idx_);
std::swap(lobby_id_, other->lobby_id_);
std::swap(match_id_, other->match_id_);
std::swap(team_a_good_, other->team_a_good_);
std::swap(state_, other->state_);
std::swap(start_time_, other->start_time_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTATournament_Game::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTATournament_Game_descriptor_;
metadata.reflection = CMsgDOTATournament_Game_reflection_;
return metadata;
}
// -------------------------------------------------------------------
#ifndef _MSC_VER
const int CMsgDOTATournament_Node::kNodeIdFieldNumber;
const int CMsgDOTATournament_Node::kTeamIdxAFieldNumber;
const int CMsgDOTATournament_Node::kTeamIdxBFieldNumber;
const int CMsgDOTATournament_Node::kNodeStateFieldNumber;
#endif // !_MSC_VER
CMsgDOTATournament_Node::CMsgDOTATournament_Node()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTATournament.Node)
}
void CMsgDOTATournament_Node::InitAsDefaultInstance() {
}
CMsgDOTATournament_Node::CMsgDOTATournament_Node(const CMsgDOTATournament_Node& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTATournament.Node)
}
void CMsgDOTATournament_Node::SharedCtor() {
_cached_size_ = 0;
node_id_ = 0u;
team_idx_a_ = 0u;
team_idx_b_ = 0u;
node_state_ = 0;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTATournament_Node::~CMsgDOTATournament_Node() {
// @@protoc_insertion_point(destructor:CMsgDOTATournament.Node)
SharedDtor();
}
void CMsgDOTATournament_Node::SharedDtor() {
if (this != default_instance_) {
}
}
void CMsgDOTATournament_Node::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTATournament_Node::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTATournament_Node_descriptor_;
}
const CMsgDOTATournament_Node& CMsgDOTATournament_Node::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTATournament_Node* CMsgDOTATournament_Node::default_instance_ = NULL;
CMsgDOTATournament_Node* CMsgDOTATournament_Node::New() const {
return new CMsgDOTATournament_Node;
}
void CMsgDOTATournament_Node::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<CMsgDOTATournament_Node*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
ZR_(node_id_, node_state_);
#undef OFFSET_OF_FIELD_
#undef ZR_
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTATournament_Node::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTATournament.Node)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint32 node_id = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &node_id_)));
set_has_node_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_team_idx_a;
break;
}
// optional uint32 team_idx_a = 2;
case 2: {
if (tag == 16) {
parse_team_idx_a:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &team_idx_a_)));
set_has_team_idx_a();
} else {
goto handle_unusual;
}
if (input->ExpectTag(24)) goto parse_team_idx_b;
break;
}
// optional uint32 team_idx_b = 3;
case 3: {
if (tag == 24) {
parse_team_idx_b:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &team_idx_b_)));
set_has_team_idx_b();
} else {
goto handle_unusual;
}
if (input->ExpectTag(32)) goto parse_node_state;
break;
}
// optional .ETournamentNodeState node_state = 4 [default = k_ETournamentNodeState_Unknown];
case 4: {
if (tag == 32) {
parse_node_state:
int value;
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
input, &value)));
if (::ETournamentNodeState_IsValid(value)) {
set_node_state(static_cast< ::ETournamentNodeState >(value));
} else {
mutable_unknown_fields()->AddVarint(4, value);
}
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTATournament.Node)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTATournament.Node)
return false;
#undef DO_
}
void CMsgDOTATournament_Node::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTATournament.Node)
// optional uint32 node_id = 1;
if (has_node_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->node_id(), output);
}
// optional uint32 team_idx_a = 2;
if (has_team_idx_a()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->team_idx_a(), output);
}
// optional uint32 team_idx_b = 3;
if (has_team_idx_b()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(3, this->team_idx_b(), output);
}
// optional .ETournamentNodeState node_state = 4 [default = k_ETournamentNodeState_Unknown];
if (has_node_state()) {
::google::protobuf::internal::WireFormatLite::WriteEnum(
4, this->node_state(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTATournament.Node)
}
::google::protobuf::uint8* CMsgDOTATournament_Node::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTATournament.Node)
// optional uint32 node_id = 1;
if (has_node_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->node_id(), target);
}
// optional uint32 team_idx_a = 2;
if (has_team_idx_a()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->team_idx_a(), target);
}
// optional uint32 team_idx_b = 3;
if (has_team_idx_b()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(3, this->team_idx_b(), target);
}
// optional .ETournamentNodeState node_state = 4 [default = k_ETournamentNodeState_Unknown];
if (has_node_state()) {
target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
4, this->node_state(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTATournament.Node)
return target;
}
int CMsgDOTATournament_Node::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional uint32 node_id = 1;
if (has_node_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->node_id());
}
// optional uint32 team_idx_a = 2;
if (has_team_idx_a()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->team_idx_a());
}
// optional uint32 team_idx_b = 3;
if (has_team_idx_b()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->team_idx_b());
}
// optional .ETournamentNodeState node_state = 4 [default = k_ETournamentNodeState_Unknown];
if (has_node_state()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::EnumSize(this->node_state());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTATournament_Node::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTATournament_Node* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTATournament_Node*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTATournament_Node::MergeFrom(const CMsgDOTATournament_Node& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_node_id()) {
set_node_id(from.node_id());
}
if (from.has_team_idx_a()) {
set_team_idx_a(from.team_idx_a());
}
if (from.has_team_idx_b()) {
set_team_idx_b(from.team_idx_b());
}
if (from.has_node_state()) {
set_node_state(from.node_state());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTATournament_Node::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTATournament_Node::CopyFrom(const CMsgDOTATournament_Node& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTATournament_Node::IsInitialized() const {
return true;
}
void CMsgDOTATournament_Node::Swap(CMsgDOTATournament_Node* other) {
if (other != this) {
std::swap(node_id_, other->node_id_);
std::swap(team_idx_a_, other->team_idx_a_);
std::swap(team_idx_b_, other->team_idx_b_);
std::swap(node_state_, other->node_state_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTATournament_Node::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTATournament_Node_descriptor_;
metadata.reflection = CMsgDOTATournament_Node_reflection_;
return metadata;
}
// -------------------------------------------------------------------
#ifndef _MSC_VER
const int CMsgDOTATournament::kTournamentIdFieldNumber;
const int CMsgDOTATournament::kDivisionIdFieldNumber;
const int CMsgDOTATournament::kScheduleTimeFieldNumber;
const int CMsgDOTATournament::kSkillLevelFieldNumber;
const int CMsgDOTATournament::kTournamentTemplateFieldNumber;
const int CMsgDOTATournament::kStateFieldNumber;
const int CMsgDOTATournament::kStateSeqNumFieldNumber;
const int CMsgDOTATournament::kSeasonTrophyIdFieldNumber;
const int CMsgDOTATournament::kTeamsFieldNumber;
const int CMsgDOTATournament::kGamesFieldNumber;
const int CMsgDOTATournament::kNodesFieldNumber;
#endif // !_MSC_VER
CMsgDOTATournament::CMsgDOTATournament()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTATournament)
}
void CMsgDOTATournament::InitAsDefaultInstance() {
}
CMsgDOTATournament::CMsgDOTATournament(const CMsgDOTATournament& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTATournament)
}
void CMsgDOTATournament::SharedCtor() {
_cached_size_ = 0;
tournament_id_ = 0u;
division_id_ = 0u;
schedule_time_ = 0u;
skill_level_ = 0u;
tournament_template_ = 0;
state_ = 0;
state_seq_num_ = 0u;
season_trophy_id_ = 0u;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTATournament::~CMsgDOTATournament() {
// @@protoc_insertion_point(destructor:CMsgDOTATournament)
SharedDtor();
}
void CMsgDOTATournament::SharedDtor() {
if (this != default_instance_) {
}
}
void CMsgDOTATournament::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTATournament::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTATournament_descriptor_;
}
const CMsgDOTATournament& CMsgDOTATournament::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTATournament* CMsgDOTATournament::default_instance_ = NULL;
CMsgDOTATournament* CMsgDOTATournament::New() const {
return new CMsgDOTATournament;
}
void CMsgDOTATournament::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<CMsgDOTATournament*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
if (_has_bits_[0 / 32] & 255) {
ZR_(tournament_id_, season_trophy_id_);
}
#undef OFFSET_OF_FIELD_
#undef ZR_
teams_.Clear();
games_.Clear();
nodes_.Clear();
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTATournament::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTATournament)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint32 tournament_id = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &tournament_id_)));
set_has_tournament_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_division_id;
break;
}
// optional uint32 division_id = 2;
case 2: {
if (tag == 16) {
parse_division_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &division_id_)));
set_has_division_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(24)) goto parse_schedule_time;
break;
}
// optional uint32 schedule_time = 3;
case 3: {
if (tag == 24) {
parse_schedule_time:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &schedule_time_)));
set_has_schedule_time();
} else {
goto handle_unusual;
}
if (input->ExpectTag(32)) goto parse_skill_level;
break;
}
// optional uint32 skill_level = 4;
case 4: {
if (tag == 32) {
parse_skill_level:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &skill_level_)));
set_has_skill_level();
} else {
goto handle_unusual;
}
if (input->ExpectTag(40)) goto parse_tournament_template;
break;
}
// optional .ETournamentTemplate tournament_template = 5 [default = k_ETournamentTemplate_None];
case 5: {
if (tag == 40) {
parse_tournament_template:
int value;
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
input, &value)));
if (::ETournamentTemplate_IsValid(value)) {
set_tournament_template(static_cast< ::ETournamentTemplate >(value));
} else {
mutable_unknown_fields()->AddVarint(5, value);
}
} else {
goto handle_unusual;
}
if (input->ExpectTag(48)) goto parse_state;
break;
}
// optional .ETournamentState state = 6 [default = k_ETournamentState_Unknown];
case 6: {
if (tag == 48) {
parse_state:
int value;
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
input, &value)));
if (::ETournamentState_IsValid(value)) {
set_state(static_cast< ::ETournamentState >(value));
} else {
mutable_unknown_fields()->AddVarint(6, value);
}
} else {
goto handle_unusual;
}
if (input->ExpectTag(58)) goto parse_teams;
break;
}
// repeated .CMsgDOTATournament.Team teams = 7;
case 7: {
if (tag == 58) {
parse_teams:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_teams()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(58)) goto parse_teams;
if (input->ExpectTag(66)) goto parse_games;
break;
}
// repeated .CMsgDOTATournament.Game games = 8;
case 8: {
if (tag == 66) {
parse_games:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_games()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(66)) goto parse_games;
if (input->ExpectTag(74)) goto parse_nodes;
break;
}
// repeated .CMsgDOTATournament.Node nodes = 9;
case 9: {
if (tag == 74) {
parse_nodes:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_nodes()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(74)) goto parse_nodes;
if (input->ExpectTag(80)) goto parse_state_seq_num;
break;
}
// optional uint32 state_seq_num = 10;
case 10: {
if (tag == 80) {
parse_state_seq_num:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &state_seq_num_)));
set_has_state_seq_num();
} else {
goto handle_unusual;
}
if (input->ExpectTag(88)) goto parse_season_trophy_id;
break;
}
// optional uint32 season_trophy_id = 11;
case 11: {
if (tag == 88) {
parse_season_trophy_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &season_trophy_id_)));
set_has_season_trophy_id();
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTATournament)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTATournament)
return false;
#undef DO_
}
void CMsgDOTATournament::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTATournament)
// optional uint32 tournament_id = 1;
if (has_tournament_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->tournament_id(), output);
}
// optional uint32 division_id = 2;
if (has_division_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->division_id(), output);
}
// optional uint32 schedule_time = 3;
if (has_schedule_time()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(3, this->schedule_time(), output);
}
// optional uint32 skill_level = 4;
if (has_skill_level()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(4, this->skill_level(), output);
}
// optional .ETournamentTemplate tournament_template = 5 [default = k_ETournamentTemplate_None];
if (has_tournament_template()) {
::google::protobuf::internal::WireFormatLite::WriteEnum(
5, this->tournament_template(), output);
}
// optional .ETournamentState state = 6 [default = k_ETournamentState_Unknown];
if (has_state()) {
::google::protobuf::internal::WireFormatLite::WriteEnum(
6, this->state(), output);
}
// repeated .CMsgDOTATournament.Team teams = 7;
for (int i = 0; i < this->teams_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
7, this->teams(i), output);
}
// repeated .CMsgDOTATournament.Game games = 8;
for (int i = 0; i < this->games_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
8, this->games(i), output);
}
// repeated .CMsgDOTATournament.Node nodes = 9;
for (int i = 0; i < this->nodes_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
9, this->nodes(i), output);
}
// optional uint32 state_seq_num = 10;
if (has_state_seq_num()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(10, this->state_seq_num(), output);
}
// optional uint32 season_trophy_id = 11;
if (has_season_trophy_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(11, this->season_trophy_id(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTATournament)
}
::google::protobuf::uint8* CMsgDOTATournament::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTATournament)
// optional uint32 tournament_id = 1;
if (has_tournament_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->tournament_id(), target);
}
// optional uint32 division_id = 2;
if (has_division_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->division_id(), target);
}
// optional uint32 schedule_time = 3;
if (has_schedule_time()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(3, this->schedule_time(), target);
}
// optional uint32 skill_level = 4;
if (has_skill_level()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(4, this->skill_level(), target);
}
// optional .ETournamentTemplate tournament_template = 5 [default = k_ETournamentTemplate_None];
if (has_tournament_template()) {
target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
5, this->tournament_template(), target);
}
// optional .ETournamentState state = 6 [default = k_ETournamentState_Unknown];
if (has_state()) {
target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
6, this->state(), target);
}
// repeated .CMsgDOTATournament.Team teams = 7;
for (int i = 0; i < this->teams_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
7, this->teams(i), target);
}
// repeated .CMsgDOTATournament.Game games = 8;
for (int i = 0; i < this->games_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
8, this->games(i), target);
}
// repeated .CMsgDOTATournament.Node nodes = 9;
for (int i = 0; i < this->nodes_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
9, this->nodes(i), target);
}
// optional uint32 state_seq_num = 10;
if (has_state_seq_num()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(10, this->state_seq_num(), target);
}
// optional uint32 season_trophy_id = 11;
if (has_season_trophy_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(11, this->season_trophy_id(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTATournament)
return target;
}
int CMsgDOTATournament::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional uint32 tournament_id = 1;
if (has_tournament_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->tournament_id());
}
// optional uint32 division_id = 2;
if (has_division_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->division_id());
}
// optional uint32 schedule_time = 3;
if (has_schedule_time()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->schedule_time());
}
// optional uint32 skill_level = 4;
if (has_skill_level()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->skill_level());
}
// optional .ETournamentTemplate tournament_template = 5 [default = k_ETournamentTemplate_None];
if (has_tournament_template()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::EnumSize(this->tournament_template());
}
// optional .ETournamentState state = 6 [default = k_ETournamentState_Unknown];
if (has_state()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::EnumSize(this->state());
}
// optional uint32 state_seq_num = 10;
if (has_state_seq_num()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->state_seq_num());
}
// optional uint32 season_trophy_id = 11;
if (has_season_trophy_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->season_trophy_id());
}
}
// repeated .CMsgDOTATournament.Team teams = 7;
total_size += 1 * this->teams_size();
for (int i = 0; i < this->teams_size(); i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->teams(i));
}
// repeated .CMsgDOTATournament.Game games = 8;
total_size += 1 * this->games_size();
for (int i = 0; i < this->games_size(); i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->games(i));
}
// repeated .CMsgDOTATournament.Node nodes = 9;
total_size += 1 * this->nodes_size();
for (int i = 0; i < this->nodes_size(); i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->nodes(i));
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTATournament::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTATournament* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTATournament*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTATournament::MergeFrom(const CMsgDOTATournament& from) {
GOOGLE_CHECK_NE(&from, this);
teams_.MergeFrom(from.teams_);
games_.MergeFrom(from.games_);
nodes_.MergeFrom(from.nodes_);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_tournament_id()) {
set_tournament_id(from.tournament_id());
}
if (from.has_division_id()) {
set_division_id(from.division_id());
}
if (from.has_schedule_time()) {
set_schedule_time(from.schedule_time());
}
if (from.has_skill_level()) {
set_skill_level(from.skill_level());
}
if (from.has_tournament_template()) {
set_tournament_template(from.tournament_template());
}
if (from.has_state()) {
set_state(from.state());
}
if (from.has_state_seq_num()) {
set_state_seq_num(from.state_seq_num());
}
if (from.has_season_trophy_id()) {
set_season_trophy_id(from.season_trophy_id());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTATournament::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTATournament::CopyFrom(const CMsgDOTATournament& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTATournament::IsInitialized() const {
return true;
}
void CMsgDOTATournament::Swap(CMsgDOTATournament* other) {
if (other != this) {
std::swap(tournament_id_, other->tournament_id_);
std::swap(division_id_, other->division_id_);
std::swap(schedule_time_, other->schedule_time_);
std::swap(skill_level_, other->skill_level_);
std::swap(tournament_template_, other->tournament_template_);
std::swap(state_, other->state_);
std::swap(state_seq_num_, other->state_seq_num_);
std::swap(season_trophy_id_, other->season_trophy_id_);
teams_.Swap(&other->teams_);
games_.Swap(&other->games_);
nodes_.Swap(&other->nodes_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTATournament::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTATournament_descriptor_;
metadata.reflection = CMsgDOTATournament_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int CMsgDOTATournamentStateChange_GameChange::kMatchIdFieldNumber;
const int CMsgDOTATournamentStateChange_GameChange::kNewStateFieldNumber;
#endif // !_MSC_VER
CMsgDOTATournamentStateChange_GameChange::CMsgDOTATournamentStateChange_GameChange()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTATournamentStateChange.GameChange)
}
void CMsgDOTATournamentStateChange_GameChange::InitAsDefaultInstance() {
}
CMsgDOTATournamentStateChange_GameChange::CMsgDOTATournamentStateChange_GameChange(const CMsgDOTATournamentStateChange_GameChange& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTATournamentStateChange.GameChange)
}
void CMsgDOTATournamentStateChange_GameChange::SharedCtor() {
_cached_size_ = 0;
match_id_ = GOOGLE_ULONGLONG(0);
new_state_ = 0;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTATournamentStateChange_GameChange::~CMsgDOTATournamentStateChange_GameChange() {
// @@protoc_insertion_point(destructor:CMsgDOTATournamentStateChange.GameChange)
SharedDtor();
}
void CMsgDOTATournamentStateChange_GameChange::SharedDtor() {
if (this != default_instance_) {
}
}
void CMsgDOTATournamentStateChange_GameChange::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTATournamentStateChange_GameChange::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTATournamentStateChange_GameChange_descriptor_;
}
const CMsgDOTATournamentStateChange_GameChange& CMsgDOTATournamentStateChange_GameChange::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTATournamentStateChange_GameChange* CMsgDOTATournamentStateChange_GameChange::default_instance_ = NULL;
CMsgDOTATournamentStateChange_GameChange* CMsgDOTATournamentStateChange_GameChange::New() const {
return new CMsgDOTATournamentStateChange_GameChange;
}
void CMsgDOTATournamentStateChange_GameChange::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<CMsgDOTATournamentStateChange_GameChange*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
ZR_(match_id_, new_state_);
#undef OFFSET_OF_FIELD_
#undef ZR_
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTATournamentStateChange_GameChange::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTATournamentStateChange.GameChange)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint64 match_id = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &match_id_)));
set_has_match_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_new_state;
break;
}
// optional .ETournamentGameState new_state = 2 [default = k_ETournamentGameState_Unknown];
case 2: {
if (tag == 16) {
parse_new_state:
int value;
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
input, &value)));
if (::ETournamentGameState_IsValid(value)) {
set_new_state(static_cast< ::ETournamentGameState >(value));
} else {
mutable_unknown_fields()->AddVarint(2, value);
}
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTATournamentStateChange.GameChange)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTATournamentStateChange.GameChange)
return false;
#undef DO_
}
void CMsgDOTATournamentStateChange_GameChange::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTATournamentStateChange.GameChange)
// optional uint64 match_id = 1;
if (has_match_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(1, this->match_id(), output);
}
// optional .ETournamentGameState new_state = 2 [default = k_ETournamentGameState_Unknown];
if (has_new_state()) {
::google::protobuf::internal::WireFormatLite::WriteEnum(
2, this->new_state(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTATournamentStateChange.GameChange)
}
::google::protobuf::uint8* CMsgDOTATournamentStateChange_GameChange::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTATournamentStateChange.GameChange)
// optional uint64 match_id = 1;
if (has_match_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(1, this->match_id(), target);
}
// optional .ETournamentGameState new_state = 2 [default = k_ETournamentGameState_Unknown];
if (has_new_state()) {
target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
2, this->new_state(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTATournamentStateChange.GameChange)
return target;
}
int CMsgDOTATournamentStateChange_GameChange::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional uint64 match_id = 1;
if (has_match_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->match_id());
}
// optional .ETournamentGameState new_state = 2 [default = k_ETournamentGameState_Unknown];
if (has_new_state()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::EnumSize(this->new_state());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTATournamentStateChange_GameChange::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTATournamentStateChange_GameChange* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTATournamentStateChange_GameChange*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTATournamentStateChange_GameChange::MergeFrom(const CMsgDOTATournamentStateChange_GameChange& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_match_id()) {
set_match_id(from.match_id());
}
if (from.has_new_state()) {
set_new_state(from.new_state());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTATournamentStateChange_GameChange::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTATournamentStateChange_GameChange::CopyFrom(const CMsgDOTATournamentStateChange_GameChange& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTATournamentStateChange_GameChange::IsInitialized() const {
return true;
}
void CMsgDOTATournamentStateChange_GameChange::Swap(CMsgDOTATournamentStateChange_GameChange* other) {
if (other != this) {
std::swap(match_id_, other->match_id_);
std::swap(new_state_, other->new_state_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTATournamentStateChange_GameChange::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTATournamentStateChange_GameChange_descriptor_;
metadata.reflection = CMsgDOTATournamentStateChange_GameChange_reflection_;
return metadata;
}
// -------------------------------------------------------------------
#ifndef _MSC_VER
const int CMsgDOTATournamentStateChange_TeamChange::kTeamGidFieldNumber;
const int CMsgDOTATournamentStateChange_TeamChange::kNewNodeOrStateFieldNumber;
const int CMsgDOTATournamentStateChange_TeamChange::kOldNodeOrStateFieldNumber;
#endif // !_MSC_VER
CMsgDOTATournamentStateChange_TeamChange::CMsgDOTATournamentStateChange_TeamChange()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTATournamentStateChange.TeamChange)
}
void CMsgDOTATournamentStateChange_TeamChange::InitAsDefaultInstance() {
}
CMsgDOTATournamentStateChange_TeamChange::CMsgDOTATournamentStateChange_TeamChange(const CMsgDOTATournamentStateChange_TeamChange& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTATournamentStateChange.TeamChange)
}
void CMsgDOTATournamentStateChange_TeamChange::SharedCtor() {
_cached_size_ = 0;
team_gid_ = GOOGLE_ULONGLONG(0);
new_node_or_state_ = 0u;
old_node_or_state_ = 0u;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTATournamentStateChange_TeamChange::~CMsgDOTATournamentStateChange_TeamChange() {
// @@protoc_insertion_point(destructor:CMsgDOTATournamentStateChange.TeamChange)
SharedDtor();
}
void CMsgDOTATournamentStateChange_TeamChange::SharedDtor() {
if (this != default_instance_) {
}
}
void CMsgDOTATournamentStateChange_TeamChange::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTATournamentStateChange_TeamChange::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTATournamentStateChange_TeamChange_descriptor_;
}
const CMsgDOTATournamentStateChange_TeamChange& CMsgDOTATournamentStateChange_TeamChange::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTATournamentStateChange_TeamChange* CMsgDOTATournamentStateChange_TeamChange::default_instance_ = NULL;
CMsgDOTATournamentStateChange_TeamChange* CMsgDOTATournamentStateChange_TeamChange::New() const {
return new CMsgDOTATournamentStateChange_TeamChange;
}
void CMsgDOTATournamentStateChange_TeamChange::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<CMsgDOTATournamentStateChange_TeamChange*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
ZR_(team_gid_, old_node_or_state_);
#undef OFFSET_OF_FIELD_
#undef ZR_
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTATournamentStateChange_TeamChange::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTATournamentStateChange.TeamChange)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint64 team_gid = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &team_gid_)));
set_has_team_gid();
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_new_node_or_state;
break;
}
// optional uint32 new_node_or_state = 2;
case 2: {
if (tag == 16) {
parse_new_node_or_state:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &new_node_or_state_)));
set_has_new_node_or_state();
} else {
goto handle_unusual;
}
if (input->ExpectTag(24)) goto parse_old_node_or_state;
break;
}
// optional uint32 old_node_or_state = 3;
case 3: {
if (tag == 24) {
parse_old_node_or_state:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &old_node_or_state_)));
set_has_old_node_or_state();
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTATournamentStateChange.TeamChange)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTATournamentStateChange.TeamChange)
return false;
#undef DO_
}
void CMsgDOTATournamentStateChange_TeamChange::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTATournamentStateChange.TeamChange)
// optional uint64 team_gid = 1;
if (has_team_gid()) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(1, this->team_gid(), output);
}
// optional uint32 new_node_or_state = 2;
if (has_new_node_or_state()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->new_node_or_state(), output);
}
// optional uint32 old_node_or_state = 3;
if (has_old_node_or_state()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(3, this->old_node_or_state(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTATournamentStateChange.TeamChange)
}
::google::protobuf::uint8* CMsgDOTATournamentStateChange_TeamChange::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTATournamentStateChange.TeamChange)
// optional uint64 team_gid = 1;
if (has_team_gid()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(1, this->team_gid(), target);
}
// optional uint32 new_node_or_state = 2;
if (has_new_node_or_state()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->new_node_or_state(), target);
}
// optional uint32 old_node_or_state = 3;
if (has_old_node_or_state()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(3, this->old_node_or_state(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTATournamentStateChange.TeamChange)
return target;
}
int CMsgDOTATournamentStateChange_TeamChange::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional uint64 team_gid = 1;
if (has_team_gid()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->team_gid());
}
// optional uint32 new_node_or_state = 2;
if (has_new_node_or_state()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->new_node_or_state());
}
// optional uint32 old_node_or_state = 3;
if (has_old_node_or_state()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->old_node_or_state());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTATournamentStateChange_TeamChange::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTATournamentStateChange_TeamChange* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTATournamentStateChange_TeamChange*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTATournamentStateChange_TeamChange::MergeFrom(const CMsgDOTATournamentStateChange_TeamChange& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_team_gid()) {
set_team_gid(from.team_gid());
}
if (from.has_new_node_or_state()) {
set_new_node_or_state(from.new_node_or_state());
}
if (from.has_old_node_or_state()) {
set_old_node_or_state(from.old_node_or_state());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTATournamentStateChange_TeamChange::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTATournamentStateChange_TeamChange::CopyFrom(const CMsgDOTATournamentStateChange_TeamChange& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTATournamentStateChange_TeamChange::IsInitialized() const {
return true;
}
void CMsgDOTATournamentStateChange_TeamChange::Swap(CMsgDOTATournamentStateChange_TeamChange* other) {
if (other != this) {
std::swap(team_gid_, other->team_gid_);
std::swap(new_node_or_state_, other->new_node_or_state_);
std::swap(old_node_or_state_, other->old_node_or_state_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTATournamentStateChange_TeamChange::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTATournamentStateChange_TeamChange_descriptor_;
metadata.reflection = CMsgDOTATournamentStateChange_TeamChange_reflection_;
return metadata;
}
// -------------------------------------------------------------------
#ifndef _MSC_VER
const int CMsgDOTATournamentStateChange::kNewTournamentIdFieldNumber;
const int CMsgDOTATournamentStateChange::kEventFieldNumber;
const int CMsgDOTATournamentStateChange::kNewTournamentStateFieldNumber;
const int CMsgDOTATournamentStateChange::kGameChangesFieldNumber;
const int CMsgDOTATournamentStateChange::kTeamChangesFieldNumber;
const int CMsgDOTATournamentStateChange::kMergedTournamentIdsFieldNumber;
const int CMsgDOTATournamentStateChange::kStateSeqNumFieldNumber;
#endif // !_MSC_VER
CMsgDOTATournamentStateChange::CMsgDOTATournamentStateChange()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTATournamentStateChange)
}
void CMsgDOTATournamentStateChange::InitAsDefaultInstance() {
}
CMsgDOTATournamentStateChange::CMsgDOTATournamentStateChange(const CMsgDOTATournamentStateChange& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTATournamentStateChange)
}
void CMsgDOTATournamentStateChange::SharedCtor() {
_cached_size_ = 0;
new_tournament_id_ = 0u;
event_ = 0;
new_tournament_state_ = 0;
state_seq_num_ = 0u;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTATournamentStateChange::~CMsgDOTATournamentStateChange() {
// @@protoc_insertion_point(destructor:CMsgDOTATournamentStateChange)
SharedDtor();
}
void CMsgDOTATournamentStateChange::SharedDtor() {
if (this != default_instance_) {
}
}
void CMsgDOTATournamentStateChange::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTATournamentStateChange::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTATournamentStateChange_descriptor_;
}
const CMsgDOTATournamentStateChange& CMsgDOTATournamentStateChange::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTATournamentStateChange* CMsgDOTATournamentStateChange::default_instance_ = NULL;
CMsgDOTATournamentStateChange* CMsgDOTATournamentStateChange::New() const {
return new CMsgDOTATournamentStateChange;
}
void CMsgDOTATournamentStateChange::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<CMsgDOTATournamentStateChange*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
ZR_(new_tournament_id_, event_);
ZR_(new_tournament_state_, state_seq_num_);
#undef OFFSET_OF_FIELD_
#undef ZR_
game_changes_.Clear();
team_changes_.Clear();
merged_tournament_ids_.Clear();
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTATournamentStateChange::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTATournamentStateChange)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint32 new_tournament_id = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &new_tournament_id_)));
set_has_new_tournament_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_event;
break;
}
// optional .ETournamentEvent event = 2 [default = k_ETournamentEvent_None];
case 2: {
if (tag == 16) {
parse_event:
int value;
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
input, &value)));
if (::ETournamentEvent_IsValid(value)) {
set_event(static_cast< ::ETournamentEvent >(value));
} else {
mutable_unknown_fields()->AddVarint(2, value);
}
} else {
goto handle_unusual;
}
if (input->ExpectTag(24)) goto parse_new_tournament_state;
break;
}
// optional .ETournamentState new_tournament_state = 3 [default = k_ETournamentState_Unknown];
case 3: {
if (tag == 24) {
parse_new_tournament_state:
int value;
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
input, &value)));
if (::ETournamentState_IsValid(value)) {
set_new_tournament_state(static_cast< ::ETournamentState >(value));
} else {
mutable_unknown_fields()->AddVarint(3, value);
}
} else {
goto handle_unusual;
}
if (input->ExpectTag(34)) goto parse_game_changes;
break;
}
// repeated .CMsgDOTATournamentStateChange.GameChange game_changes = 4;
case 4: {
if (tag == 34) {
parse_game_changes:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_game_changes()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(34)) goto parse_game_changes;
if (input->ExpectTag(42)) goto parse_team_changes;
break;
}
// repeated .CMsgDOTATournamentStateChange.TeamChange team_changes = 5;
case 5: {
if (tag == 42) {
parse_team_changes:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_team_changes()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(42)) goto parse_team_changes;
if (input->ExpectTag(50)) goto parse_merged_tournament_ids;
break;
}
// repeated uint32 merged_tournament_ids = 6 [packed = true];
case 6: {
if (tag == 50) {
parse_merged_tournament_ids:
DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, this->mutable_merged_tournament_ids())));
} else if (tag == 48) {
DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
1, 50, input, this->mutable_merged_tournament_ids())));
} else {
goto handle_unusual;
}
if (input->ExpectTag(56)) goto parse_state_seq_num;
break;
}
// optional uint32 state_seq_num = 7;
case 7: {
if (tag == 56) {
parse_state_seq_num:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &state_seq_num_)));
set_has_state_seq_num();
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTATournamentStateChange)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTATournamentStateChange)
return false;
#undef DO_
}
void CMsgDOTATournamentStateChange::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTATournamentStateChange)
// optional uint32 new_tournament_id = 1;
if (has_new_tournament_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->new_tournament_id(), output);
}
// optional .ETournamentEvent event = 2 [default = k_ETournamentEvent_None];
if (has_event()) {
::google::protobuf::internal::WireFormatLite::WriteEnum(
2, this->event(), output);
}
// optional .ETournamentState new_tournament_state = 3 [default = k_ETournamentState_Unknown];
if (has_new_tournament_state()) {
::google::protobuf::internal::WireFormatLite::WriteEnum(
3, this->new_tournament_state(), output);
}
// repeated .CMsgDOTATournamentStateChange.GameChange game_changes = 4;
for (int i = 0; i < this->game_changes_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
4, this->game_changes(i), output);
}
// repeated .CMsgDOTATournamentStateChange.TeamChange team_changes = 5;
for (int i = 0; i < this->team_changes_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
5, this->team_changes(i), output);
}
// repeated uint32 merged_tournament_ids = 6 [packed = true];
if (this->merged_tournament_ids_size() > 0) {
::google::protobuf::internal::WireFormatLite::WriteTag(6, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output);
output->WriteVarint32(_merged_tournament_ids_cached_byte_size_);
}
for (int i = 0; i < this->merged_tournament_ids_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteUInt32NoTag(
this->merged_tournament_ids(i), output);
}
// optional uint32 state_seq_num = 7;
if (has_state_seq_num()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(7, this->state_seq_num(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTATournamentStateChange)
}
::google::protobuf::uint8* CMsgDOTATournamentStateChange::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTATournamentStateChange)
// optional uint32 new_tournament_id = 1;
if (has_new_tournament_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->new_tournament_id(), target);
}
// optional .ETournamentEvent event = 2 [default = k_ETournamentEvent_None];
if (has_event()) {
target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
2, this->event(), target);
}
// optional .ETournamentState new_tournament_state = 3 [default = k_ETournamentState_Unknown];
if (has_new_tournament_state()) {
target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
3, this->new_tournament_state(), target);
}
// repeated .CMsgDOTATournamentStateChange.GameChange game_changes = 4;
for (int i = 0; i < this->game_changes_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
4, this->game_changes(i), target);
}
// repeated .CMsgDOTATournamentStateChange.TeamChange team_changes = 5;
for (int i = 0; i < this->team_changes_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
5, this->team_changes(i), target);
}
// repeated uint32 merged_tournament_ids = 6 [packed = true];
if (this->merged_tournament_ids_size() > 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray(
6,
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
target);
target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray(
_merged_tournament_ids_cached_byte_size_, target);
}
for (int i = 0; i < this->merged_tournament_ids_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteUInt32NoTagToArray(this->merged_tournament_ids(i), target);
}
// optional uint32 state_seq_num = 7;
if (has_state_seq_num()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(7, this->state_seq_num(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTATournamentStateChange)
return target;
}
int CMsgDOTATournamentStateChange::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional uint32 new_tournament_id = 1;
if (has_new_tournament_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->new_tournament_id());
}
// optional .ETournamentEvent event = 2 [default = k_ETournamentEvent_None];
if (has_event()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::EnumSize(this->event());
}
// optional .ETournamentState new_tournament_state = 3 [default = k_ETournamentState_Unknown];
if (has_new_tournament_state()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::EnumSize(this->new_tournament_state());
}
// optional uint32 state_seq_num = 7;
if (has_state_seq_num()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->state_seq_num());
}
}
// repeated .CMsgDOTATournamentStateChange.GameChange game_changes = 4;
total_size += 1 * this->game_changes_size();
for (int i = 0; i < this->game_changes_size(); i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->game_changes(i));
}
// repeated .CMsgDOTATournamentStateChange.TeamChange team_changes = 5;
total_size += 1 * this->team_changes_size();
for (int i = 0; i < this->team_changes_size(); i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->team_changes(i));
}
// repeated uint32 merged_tournament_ids = 6 [packed = true];
{
int data_size = 0;
for (int i = 0; i < this->merged_tournament_ids_size(); i++) {
data_size += ::google::protobuf::internal::WireFormatLite::
UInt32Size(this->merged_tournament_ids(i));
}
if (data_size > 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::Int32Size(data_size);
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_merged_tournament_ids_cached_byte_size_ = data_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
total_size += data_size;
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTATournamentStateChange::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTATournamentStateChange* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTATournamentStateChange*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTATournamentStateChange::MergeFrom(const CMsgDOTATournamentStateChange& from) {
GOOGLE_CHECK_NE(&from, this);
game_changes_.MergeFrom(from.game_changes_);
team_changes_.MergeFrom(from.team_changes_);
merged_tournament_ids_.MergeFrom(from.merged_tournament_ids_);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_new_tournament_id()) {
set_new_tournament_id(from.new_tournament_id());
}
if (from.has_event()) {
set_event(from.event());
}
if (from.has_new_tournament_state()) {
set_new_tournament_state(from.new_tournament_state());
}
if (from.has_state_seq_num()) {
set_state_seq_num(from.state_seq_num());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTATournamentStateChange::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTATournamentStateChange::CopyFrom(const CMsgDOTATournamentStateChange& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTATournamentStateChange::IsInitialized() const {
return true;
}
void CMsgDOTATournamentStateChange::Swap(CMsgDOTATournamentStateChange* other) {
if (other != this) {
std::swap(new_tournament_id_, other->new_tournament_id_);
std::swap(event_, other->event_);
std::swap(new_tournament_state_, other->new_tournament_state_);
game_changes_.Swap(&other->game_changes_);
team_changes_.Swap(&other->team_changes_);
merged_tournament_ids_.Swap(&other->merged_tournament_ids_);
std::swap(state_seq_num_, other->state_seq_num_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTATournamentStateChange::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTATournamentStateChange_descriptor_;
metadata.reflection = CMsgDOTATournamentStateChange_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int CMsgDOTATournamentRequest::kTournamentIdFieldNumber;
const int CMsgDOTATournamentRequest::kClientTournamentGidFieldNumber;
#endif // !_MSC_VER
CMsgDOTATournamentRequest::CMsgDOTATournamentRequest()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTATournamentRequest)
}
void CMsgDOTATournamentRequest::InitAsDefaultInstance() {
}
CMsgDOTATournamentRequest::CMsgDOTATournamentRequest(const CMsgDOTATournamentRequest& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTATournamentRequest)
}
void CMsgDOTATournamentRequest::SharedCtor() {
_cached_size_ = 0;
tournament_id_ = 0u;
client_tournament_gid_ = GOOGLE_ULONGLONG(0);
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTATournamentRequest::~CMsgDOTATournamentRequest() {
// @@protoc_insertion_point(destructor:CMsgDOTATournamentRequest)
SharedDtor();
}
void CMsgDOTATournamentRequest::SharedDtor() {
if (this != default_instance_) {
}
}
void CMsgDOTATournamentRequest::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTATournamentRequest::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTATournamentRequest_descriptor_;
}
const CMsgDOTATournamentRequest& CMsgDOTATournamentRequest::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTATournamentRequest* CMsgDOTATournamentRequest::default_instance_ = NULL;
CMsgDOTATournamentRequest* CMsgDOTATournamentRequest::New() const {
return new CMsgDOTATournamentRequest;
}
void CMsgDOTATournamentRequest::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<CMsgDOTATournamentRequest*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
ZR_(client_tournament_gid_, tournament_id_);
#undef OFFSET_OF_FIELD_
#undef ZR_
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTATournamentRequest::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTATournamentRequest)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint32 tournament_id = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &tournament_id_)));
set_has_tournament_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_client_tournament_gid;
break;
}
// optional uint64 client_tournament_gid = 2;
case 2: {
if (tag == 16) {
parse_client_tournament_gid:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &client_tournament_gid_)));
set_has_client_tournament_gid();
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTATournamentRequest)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTATournamentRequest)
return false;
#undef DO_
}
void CMsgDOTATournamentRequest::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTATournamentRequest)
// optional uint32 tournament_id = 1;
if (has_tournament_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->tournament_id(), output);
}
// optional uint64 client_tournament_gid = 2;
if (has_client_tournament_gid()) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(2, this->client_tournament_gid(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTATournamentRequest)
}
::google::protobuf::uint8* CMsgDOTATournamentRequest::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTATournamentRequest)
// optional uint32 tournament_id = 1;
if (has_tournament_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->tournament_id(), target);
}
// optional uint64 client_tournament_gid = 2;
if (has_client_tournament_gid()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(2, this->client_tournament_gid(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTATournamentRequest)
return target;
}
int CMsgDOTATournamentRequest::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional uint32 tournament_id = 1;
if (has_tournament_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->tournament_id());
}
// optional uint64 client_tournament_gid = 2;
if (has_client_tournament_gid()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->client_tournament_gid());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTATournamentRequest::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTATournamentRequest* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTATournamentRequest*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTATournamentRequest::MergeFrom(const CMsgDOTATournamentRequest& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_tournament_id()) {
set_tournament_id(from.tournament_id());
}
if (from.has_client_tournament_gid()) {
set_client_tournament_gid(from.client_tournament_gid());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTATournamentRequest::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTATournamentRequest::CopyFrom(const CMsgDOTATournamentRequest& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTATournamentRequest::IsInitialized() const {
return true;
}
void CMsgDOTATournamentRequest::Swap(CMsgDOTATournamentRequest* other) {
if (other != this) {
std::swap(tournament_id_, other->tournament_id_);
std::swap(client_tournament_gid_, other->client_tournament_gid_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTATournamentRequest::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTATournamentRequest_descriptor_;
metadata.reflection = CMsgDOTATournamentRequest_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int CMsgDOTATournamentResponse::kResultFieldNumber;
const int CMsgDOTATournamentResponse::kTournamentFieldNumber;
#endif // !_MSC_VER
CMsgDOTATournamentResponse::CMsgDOTATournamentResponse()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTATournamentResponse)
}
void CMsgDOTATournamentResponse::InitAsDefaultInstance() {
tournament_ = const_cast< ::CMsgDOTATournament*>(&::CMsgDOTATournament::default_instance());
}
CMsgDOTATournamentResponse::CMsgDOTATournamentResponse(const CMsgDOTATournamentResponse& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTATournamentResponse)
}
void CMsgDOTATournamentResponse::SharedCtor() {
_cached_size_ = 0;
result_ = 2u;
tournament_ = NULL;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTATournamentResponse::~CMsgDOTATournamentResponse() {
// @@protoc_insertion_point(destructor:CMsgDOTATournamentResponse)
SharedDtor();
}
void CMsgDOTATournamentResponse::SharedDtor() {
if (this != default_instance_) {
delete tournament_;
}
}
void CMsgDOTATournamentResponse::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTATournamentResponse::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTATournamentResponse_descriptor_;
}
const CMsgDOTATournamentResponse& CMsgDOTATournamentResponse::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTATournamentResponse* CMsgDOTATournamentResponse::default_instance_ = NULL;
CMsgDOTATournamentResponse* CMsgDOTATournamentResponse::New() const {
return new CMsgDOTATournamentResponse;
}
void CMsgDOTATournamentResponse::Clear() {
if (_has_bits_[0 / 32] & 3) {
result_ = 2u;
if (has_tournament()) {
if (tournament_ != NULL) tournament_->::CMsgDOTATournament::Clear();
}
}
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTATournamentResponse::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTATournamentResponse)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint32 result = 1 [default = 2];
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &result_)));
set_has_result();
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_tournament;
break;
}
// optional .CMsgDOTATournament tournament = 2;
case 2: {
if (tag == 18) {
parse_tournament:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_tournament()));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTATournamentResponse)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTATournamentResponse)
return false;
#undef DO_
}
void CMsgDOTATournamentResponse::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTATournamentResponse)
// optional uint32 result = 1 [default = 2];
if (has_result()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->result(), output);
}
// optional .CMsgDOTATournament tournament = 2;
if (has_tournament()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, this->tournament(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTATournamentResponse)
}
::google::protobuf::uint8* CMsgDOTATournamentResponse::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTATournamentResponse)
// optional uint32 result = 1 [default = 2];
if (has_result()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->result(), target);
}
// optional .CMsgDOTATournament tournament = 2;
if (has_tournament()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
2, this->tournament(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTATournamentResponse)
return target;
}
int CMsgDOTATournamentResponse::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional uint32 result = 1 [default = 2];
if (has_result()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->result());
}
// optional .CMsgDOTATournament tournament = 2;
if (has_tournament()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->tournament());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTATournamentResponse::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTATournamentResponse* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTATournamentResponse*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTATournamentResponse::MergeFrom(const CMsgDOTATournamentResponse& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_result()) {
set_result(from.result());
}
if (from.has_tournament()) {
mutable_tournament()->::CMsgDOTATournament::MergeFrom(from.tournament());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTATournamentResponse::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTATournamentResponse::CopyFrom(const CMsgDOTATournamentResponse& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTATournamentResponse::IsInitialized() const {
return true;
}
void CMsgDOTATournamentResponse::Swap(CMsgDOTATournamentResponse* other) {
if (other != this) {
std::swap(result_, other->result_);
std::swap(tournament_, other->tournament_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTATournamentResponse::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTATournamentResponse_descriptor_;
metadata.reflection = CMsgDOTATournamentResponse_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int CMsgDOTAClearTournamentGame::kTournamentIdFieldNumber;
const int CMsgDOTAClearTournamentGame::kGameIdFieldNumber;
#endif // !_MSC_VER
CMsgDOTAClearTournamentGame::CMsgDOTAClearTournamentGame()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTAClearTournamentGame)
}
void CMsgDOTAClearTournamentGame::InitAsDefaultInstance() {
}
CMsgDOTAClearTournamentGame::CMsgDOTAClearTournamentGame(const CMsgDOTAClearTournamentGame& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTAClearTournamentGame)
}
void CMsgDOTAClearTournamentGame::SharedCtor() {
_cached_size_ = 0;
tournament_id_ = 0u;
game_id_ = 0u;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTAClearTournamentGame::~CMsgDOTAClearTournamentGame() {
// @@protoc_insertion_point(destructor:CMsgDOTAClearTournamentGame)
SharedDtor();
}
void CMsgDOTAClearTournamentGame::SharedDtor() {
if (this != default_instance_) {
}
}
void CMsgDOTAClearTournamentGame::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTAClearTournamentGame::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTAClearTournamentGame_descriptor_;
}
const CMsgDOTAClearTournamentGame& CMsgDOTAClearTournamentGame::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTAClearTournamentGame* CMsgDOTAClearTournamentGame::default_instance_ = NULL;
CMsgDOTAClearTournamentGame* CMsgDOTAClearTournamentGame::New() const {
return new CMsgDOTAClearTournamentGame;
}
void CMsgDOTAClearTournamentGame::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<CMsgDOTAClearTournamentGame*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
ZR_(tournament_id_, game_id_);
#undef OFFSET_OF_FIELD_
#undef ZR_
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTAClearTournamentGame::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTAClearTournamentGame)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint32 tournament_id = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &tournament_id_)));
set_has_tournament_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_game_id;
break;
}
// optional uint32 game_id = 2;
case 2: {
if (tag == 16) {
parse_game_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &game_id_)));
set_has_game_id();
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTAClearTournamentGame)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTAClearTournamentGame)
return false;
#undef DO_
}
void CMsgDOTAClearTournamentGame::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTAClearTournamentGame)
// optional uint32 tournament_id = 1;
if (has_tournament_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->tournament_id(), output);
}
// optional uint32 game_id = 2;
if (has_game_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->game_id(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTAClearTournamentGame)
}
::google::protobuf::uint8* CMsgDOTAClearTournamentGame::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTAClearTournamentGame)
// optional uint32 tournament_id = 1;
if (has_tournament_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->tournament_id(), target);
}
// optional uint32 game_id = 2;
if (has_game_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->game_id(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTAClearTournamentGame)
return target;
}
int CMsgDOTAClearTournamentGame::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional uint32 tournament_id = 1;
if (has_tournament_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->tournament_id());
}
// optional uint32 game_id = 2;
if (has_game_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->game_id());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTAClearTournamentGame::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTAClearTournamentGame* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTAClearTournamentGame*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTAClearTournamentGame::MergeFrom(const CMsgDOTAClearTournamentGame& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_tournament_id()) {
set_tournament_id(from.tournament_id());
}
if (from.has_game_id()) {
set_game_id(from.game_id());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTAClearTournamentGame::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTAClearTournamentGame::CopyFrom(const CMsgDOTAClearTournamentGame& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTAClearTournamentGame::IsInitialized() const {
return true;
}
void CMsgDOTAClearTournamentGame::Swap(CMsgDOTAClearTournamentGame* other) {
if (other != this) {
std::swap(tournament_id_, other->tournament_id_);
std::swap(game_id_, other->game_id_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTAClearTournamentGame::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTAClearTournamentGame_descriptor_;
metadata.reflection = CMsgDOTAClearTournamentGame_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int CMsgDOTAWeekendTourneyPlayerSkillLevelStats::kSkillLevelFieldNumber;
const int CMsgDOTAWeekendTourneyPlayerSkillLevelStats::kTimesWon0FieldNumber;
const int CMsgDOTAWeekendTourneyPlayerSkillLevelStats::kTimesWon1FieldNumber;
const int CMsgDOTAWeekendTourneyPlayerSkillLevelStats::kTimesWon2FieldNumber;
const int CMsgDOTAWeekendTourneyPlayerSkillLevelStats::kTimesWon3FieldNumber;
const int CMsgDOTAWeekendTourneyPlayerSkillLevelStats::kTimesByeAndLostFieldNumber;
const int CMsgDOTAWeekendTourneyPlayerSkillLevelStats::kTimesByeAndWonFieldNumber;
const int CMsgDOTAWeekendTourneyPlayerSkillLevelStats::kTotalGamesWonFieldNumber;
const int CMsgDOTAWeekendTourneyPlayerSkillLevelStats::kScoreFieldNumber;
#endif // !_MSC_VER
CMsgDOTAWeekendTourneyPlayerSkillLevelStats::CMsgDOTAWeekendTourneyPlayerSkillLevelStats()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTAWeekendTourneyPlayerSkillLevelStats)
}
void CMsgDOTAWeekendTourneyPlayerSkillLevelStats::InitAsDefaultInstance() {
}
CMsgDOTAWeekendTourneyPlayerSkillLevelStats::CMsgDOTAWeekendTourneyPlayerSkillLevelStats(const CMsgDOTAWeekendTourneyPlayerSkillLevelStats& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTAWeekendTourneyPlayerSkillLevelStats)
}
void CMsgDOTAWeekendTourneyPlayerSkillLevelStats::SharedCtor() {
_cached_size_ = 0;
skill_level_ = 0u;
times_won_0_ = 0u;
times_won_1_ = 0u;
times_won_2_ = 0u;
times_won_3_ = 0u;
times_bye_and_lost_ = 0u;
times_bye_and_won_ = 0u;
total_games_won_ = 0u;
score_ = 0u;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTAWeekendTourneyPlayerSkillLevelStats::~CMsgDOTAWeekendTourneyPlayerSkillLevelStats() {
// @@protoc_insertion_point(destructor:CMsgDOTAWeekendTourneyPlayerSkillLevelStats)
SharedDtor();
}
void CMsgDOTAWeekendTourneyPlayerSkillLevelStats::SharedDtor() {
if (this != default_instance_) {
}
}
void CMsgDOTAWeekendTourneyPlayerSkillLevelStats::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTAWeekendTourneyPlayerSkillLevelStats::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTAWeekendTourneyPlayerSkillLevelStats_descriptor_;
}
const CMsgDOTAWeekendTourneyPlayerSkillLevelStats& CMsgDOTAWeekendTourneyPlayerSkillLevelStats::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTAWeekendTourneyPlayerSkillLevelStats* CMsgDOTAWeekendTourneyPlayerSkillLevelStats::default_instance_ = NULL;
CMsgDOTAWeekendTourneyPlayerSkillLevelStats* CMsgDOTAWeekendTourneyPlayerSkillLevelStats::New() const {
return new CMsgDOTAWeekendTourneyPlayerSkillLevelStats;
}
void CMsgDOTAWeekendTourneyPlayerSkillLevelStats::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<CMsgDOTAWeekendTourneyPlayerSkillLevelStats*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
if (_has_bits_[0 / 32] & 255) {
ZR_(skill_level_, total_games_won_);
}
score_ = 0u;
#undef OFFSET_OF_FIELD_
#undef ZR_
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTAWeekendTourneyPlayerSkillLevelStats::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTAWeekendTourneyPlayerSkillLevelStats)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint32 skill_level = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &skill_level_)));
set_has_skill_level();
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_times_won_0;
break;
}
// optional uint32 times_won_0 = 2;
case 2: {
if (tag == 16) {
parse_times_won_0:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, ×_won_0_)));
set_has_times_won_0();
} else {
goto handle_unusual;
}
if (input->ExpectTag(24)) goto parse_times_won_1;
break;
}
// optional uint32 times_won_1 = 3;
case 3: {
if (tag == 24) {
parse_times_won_1:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, ×_won_1_)));
set_has_times_won_1();
} else {
goto handle_unusual;
}
if (input->ExpectTag(32)) goto parse_times_won_2;
break;
}
// optional uint32 times_won_2 = 4;
case 4: {
if (tag == 32) {
parse_times_won_2:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, ×_won_2_)));
set_has_times_won_2();
} else {
goto handle_unusual;
}
if (input->ExpectTag(40)) goto parse_times_won_3;
break;
}
// optional uint32 times_won_3 = 5;
case 5: {
if (tag == 40) {
parse_times_won_3:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, ×_won_3_)));
set_has_times_won_3();
} else {
goto handle_unusual;
}
if (input->ExpectTag(48)) goto parse_times_bye_and_lost;
break;
}
// optional uint32 times_bye_and_lost = 6;
case 6: {
if (tag == 48) {
parse_times_bye_and_lost:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, ×_bye_and_lost_)));
set_has_times_bye_and_lost();
} else {
goto handle_unusual;
}
if (input->ExpectTag(56)) goto parse_times_bye_and_won;
break;
}
// optional uint32 times_bye_and_won = 7;
case 7: {
if (tag == 56) {
parse_times_bye_and_won:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, ×_bye_and_won_)));
set_has_times_bye_and_won();
} else {
goto handle_unusual;
}
if (input->ExpectTag(64)) goto parse_total_games_won;
break;
}
// optional uint32 total_games_won = 8;
case 8: {
if (tag == 64) {
parse_total_games_won:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &total_games_won_)));
set_has_total_games_won();
} else {
goto handle_unusual;
}
if (input->ExpectTag(72)) goto parse_score;
break;
}
// optional uint32 score = 9;
case 9: {
if (tag == 72) {
parse_score:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &score_)));
set_has_score();
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTAWeekendTourneyPlayerSkillLevelStats)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTAWeekendTourneyPlayerSkillLevelStats)
return false;
#undef DO_
}
void CMsgDOTAWeekendTourneyPlayerSkillLevelStats::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTAWeekendTourneyPlayerSkillLevelStats)
// optional uint32 skill_level = 1;
if (has_skill_level()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->skill_level(), output);
}
// optional uint32 times_won_0 = 2;
if (has_times_won_0()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->times_won_0(), output);
}
// optional uint32 times_won_1 = 3;
if (has_times_won_1()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(3, this->times_won_1(), output);
}
// optional uint32 times_won_2 = 4;
if (has_times_won_2()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(4, this->times_won_2(), output);
}
// optional uint32 times_won_3 = 5;
if (has_times_won_3()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(5, this->times_won_3(), output);
}
// optional uint32 times_bye_and_lost = 6;
if (has_times_bye_and_lost()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(6, this->times_bye_and_lost(), output);
}
// optional uint32 times_bye_and_won = 7;
if (has_times_bye_and_won()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(7, this->times_bye_and_won(), output);
}
// optional uint32 total_games_won = 8;
if (has_total_games_won()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(8, this->total_games_won(), output);
}
// optional uint32 score = 9;
if (has_score()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(9, this->score(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTAWeekendTourneyPlayerSkillLevelStats)
}
::google::protobuf::uint8* CMsgDOTAWeekendTourneyPlayerSkillLevelStats::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTAWeekendTourneyPlayerSkillLevelStats)
// optional uint32 skill_level = 1;
if (has_skill_level()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->skill_level(), target);
}
// optional uint32 times_won_0 = 2;
if (has_times_won_0()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->times_won_0(), target);
}
// optional uint32 times_won_1 = 3;
if (has_times_won_1()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(3, this->times_won_1(), target);
}
// optional uint32 times_won_2 = 4;
if (has_times_won_2()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(4, this->times_won_2(), target);
}
// optional uint32 times_won_3 = 5;
if (has_times_won_3()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(5, this->times_won_3(), target);
}
// optional uint32 times_bye_and_lost = 6;
if (has_times_bye_and_lost()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(6, this->times_bye_and_lost(), target);
}
// optional uint32 times_bye_and_won = 7;
if (has_times_bye_and_won()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(7, this->times_bye_and_won(), target);
}
// optional uint32 total_games_won = 8;
if (has_total_games_won()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(8, this->total_games_won(), target);
}
// optional uint32 score = 9;
if (has_score()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(9, this->score(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTAWeekendTourneyPlayerSkillLevelStats)
return target;
}
int CMsgDOTAWeekendTourneyPlayerSkillLevelStats::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional uint32 skill_level = 1;
if (has_skill_level()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->skill_level());
}
// optional uint32 times_won_0 = 2;
if (has_times_won_0()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->times_won_0());
}
// optional uint32 times_won_1 = 3;
if (has_times_won_1()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->times_won_1());
}
// optional uint32 times_won_2 = 4;
if (has_times_won_2()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->times_won_2());
}
// optional uint32 times_won_3 = 5;
if (has_times_won_3()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->times_won_3());
}
// optional uint32 times_bye_and_lost = 6;
if (has_times_bye_and_lost()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->times_bye_and_lost());
}
// optional uint32 times_bye_and_won = 7;
if (has_times_bye_and_won()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->times_bye_and_won());
}
// optional uint32 total_games_won = 8;
if (has_total_games_won()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->total_games_won());
}
}
if (_has_bits_[8 / 32] & (0xffu << (8 % 32))) {
// optional uint32 score = 9;
if (has_score()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->score());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTAWeekendTourneyPlayerSkillLevelStats::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTAWeekendTourneyPlayerSkillLevelStats* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTAWeekendTourneyPlayerSkillLevelStats*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTAWeekendTourneyPlayerSkillLevelStats::MergeFrom(const CMsgDOTAWeekendTourneyPlayerSkillLevelStats& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_skill_level()) {
set_skill_level(from.skill_level());
}
if (from.has_times_won_0()) {
set_times_won_0(from.times_won_0());
}
if (from.has_times_won_1()) {
set_times_won_1(from.times_won_1());
}
if (from.has_times_won_2()) {
set_times_won_2(from.times_won_2());
}
if (from.has_times_won_3()) {
set_times_won_3(from.times_won_3());
}
if (from.has_times_bye_and_lost()) {
set_times_bye_and_lost(from.times_bye_and_lost());
}
if (from.has_times_bye_and_won()) {
set_times_bye_and_won(from.times_bye_and_won());
}
if (from.has_total_games_won()) {
set_total_games_won(from.total_games_won());
}
}
if (from._has_bits_[8 / 32] & (0xffu << (8 % 32))) {
if (from.has_score()) {
set_score(from.score());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTAWeekendTourneyPlayerSkillLevelStats::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTAWeekendTourneyPlayerSkillLevelStats::CopyFrom(const CMsgDOTAWeekendTourneyPlayerSkillLevelStats& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTAWeekendTourneyPlayerSkillLevelStats::IsInitialized() const {
return true;
}
void CMsgDOTAWeekendTourneyPlayerSkillLevelStats::Swap(CMsgDOTAWeekendTourneyPlayerSkillLevelStats* other) {
if (other != this) {
std::swap(skill_level_, other->skill_level_);
std::swap(times_won_0_, other->times_won_0_);
std::swap(times_won_1_, other->times_won_1_);
std::swap(times_won_2_, other->times_won_2_);
std::swap(times_won_3_, other->times_won_3_);
std::swap(times_bye_and_lost_, other->times_bye_and_lost_);
std::swap(times_bye_and_won_, other->times_bye_and_won_);
std::swap(total_games_won_, other->total_games_won_);
std::swap(score_, other->score_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTAWeekendTourneyPlayerSkillLevelStats::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTAWeekendTourneyPlayerSkillLevelStats_descriptor_;
metadata.reflection = CMsgDOTAWeekendTourneyPlayerSkillLevelStats_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int CMsgDOTAWeekendTourneyPlayerStats::kAccountIdFieldNumber;
const int CMsgDOTAWeekendTourneyPlayerStats::kSeasonTrophyIdFieldNumber;
const int CMsgDOTAWeekendTourneyPlayerStats::kSkillLevelsFieldNumber;
const int CMsgDOTAWeekendTourneyPlayerStats::kCurrentTierFieldNumber;
#endif // !_MSC_VER
CMsgDOTAWeekendTourneyPlayerStats::CMsgDOTAWeekendTourneyPlayerStats()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTAWeekendTourneyPlayerStats)
}
void CMsgDOTAWeekendTourneyPlayerStats::InitAsDefaultInstance() {
}
CMsgDOTAWeekendTourneyPlayerStats::CMsgDOTAWeekendTourneyPlayerStats(const CMsgDOTAWeekendTourneyPlayerStats& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTAWeekendTourneyPlayerStats)
}
void CMsgDOTAWeekendTourneyPlayerStats::SharedCtor() {
_cached_size_ = 0;
account_id_ = 0u;
season_trophy_id_ = 0u;
current_tier_ = 0u;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTAWeekendTourneyPlayerStats::~CMsgDOTAWeekendTourneyPlayerStats() {
// @@protoc_insertion_point(destructor:CMsgDOTAWeekendTourneyPlayerStats)
SharedDtor();
}
void CMsgDOTAWeekendTourneyPlayerStats::SharedDtor() {
if (this != default_instance_) {
}
}
void CMsgDOTAWeekendTourneyPlayerStats::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTAWeekendTourneyPlayerStats::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTAWeekendTourneyPlayerStats_descriptor_;
}
const CMsgDOTAWeekendTourneyPlayerStats& CMsgDOTAWeekendTourneyPlayerStats::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTAWeekendTourneyPlayerStats* CMsgDOTAWeekendTourneyPlayerStats::default_instance_ = NULL;
CMsgDOTAWeekendTourneyPlayerStats* CMsgDOTAWeekendTourneyPlayerStats::New() const {
return new CMsgDOTAWeekendTourneyPlayerStats;
}
void CMsgDOTAWeekendTourneyPlayerStats::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<CMsgDOTAWeekendTourneyPlayerStats*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
if (_has_bits_[0 / 32] & 11) {
ZR_(account_id_, season_trophy_id_);
current_tier_ = 0u;
}
#undef OFFSET_OF_FIELD_
#undef ZR_
skill_levels_.Clear();
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTAWeekendTourneyPlayerStats::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTAWeekendTourneyPlayerStats)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint32 account_id = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &account_id_)));
set_has_account_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_season_trophy_id;
break;
}
// optional uint32 season_trophy_id = 2;
case 2: {
if (tag == 16) {
parse_season_trophy_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &season_trophy_id_)));
set_has_season_trophy_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(26)) goto parse_skill_levels;
break;
}
// repeated .CMsgDOTAWeekendTourneyPlayerSkillLevelStats skill_levels = 3;
case 3: {
if (tag == 26) {
parse_skill_levels:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_skill_levels()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(26)) goto parse_skill_levels;
if (input->ExpectTag(32)) goto parse_current_tier;
break;
}
// optional uint32 current_tier = 4;
case 4: {
if (tag == 32) {
parse_current_tier:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, ¤t_tier_)));
set_has_current_tier();
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTAWeekendTourneyPlayerStats)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTAWeekendTourneyPlayerStats)
return false;
#undef DO_
}
void CMsgDOTAWeekendTourneyPlayerStats::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTAWeekendTourneyPlayerStats)
// optional uint32 account_id = 1;
if (has_account_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->account_id(), output);
}
// optional uint32 season_trophy_id = 2;
if (has_season_trophy_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->season_trophy_id(), output);
}
// repeated .CMsgDOTAWeekendTourneyPlayerSkillLevelStats skill_levels = 3;
for (int i = 0; i < this->skill_levels_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, this->skill_levels(i), output);
}
// optional uint32 current_tier = 4;
if (has_current_tier()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(4, this->current_tier(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTAWeekendTourneyPlayerStats)
}
::google::protobuf::uint8* CMsgDOTAWeekendTourneyPlayerStats::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTAWeekendTourneyPlayerStats)
// optional uint32 account_id = 1;
if (has_account_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->account_id(), target);
}
// optional uint32 season_trophy_id = 2;
if (has_season_trophy_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->season_trophy_id(), target);
}
// repeated .CMsgDOTAWeekendTourneyPlayerSkillLevelStats skill_levels = 3;
for (int i = 0; i < this->skill_levels_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
3, this->skill_levels(i), target);
}
// optional uint32 current_tier = 4;
if (has_current_tier()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(4, this->current_tier(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTAWeekendTourneyPlayerStats)
return target;
}
int CMsgDOTAWeekendTourneyPlayerStats::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional uint32 account_id = 1;
if (has_account_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->account_id());
}
// optional uint32 season_trophy_id = 2;
if (has_season_trophy_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->season_trophy_id());
}
// optional uint32 current_tier = 4;
if (has_current_tier()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->current_tier());
}
}
// repeated .CMsgDOTAWeekendTourneyPlayerSkillLevelStats skill_levels = 3;
total_size += 1 * this->skill_levels_size();
for (int i = 0; i < this->skill_levels_size(); i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->skill_levels(i));
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTAWeekendTourneyPlayerStats::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTAWeekendTourneyPlayerStats* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTAWeekendTourneyPlayerStats*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTAWeekendTourneyPlayerStats::MergeFrom(const CMsgDOTAWeekendTourneyPlayerStats& from) {
GOOGLE_CHECK_NE(&from, this);
skill_levels_.MergeFrom(from.skill_levels_);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_account_id()) {
set_account_id(from.account_id());
}
if (from.has_season_trophy_id()) {
set_season_trophy_id(from.season_trophy_id());
}
if (from.has_current_tier()) {
set_current_tier(from.current_tier());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTAWeekendTourneyPlayerStats::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTAWeekendTourneyPlayerStats::CopyFrom(const CMsgDOTAWeekendTourneyPlayerStats& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTAWeekendTourneyPlayerStats::IsInitialized() const {
return true;
}
void CMsgDOTAWeekendTourneyPlayerStats::Swap(CMsgDOTAWeekendTourneyPlayerStats* other) {
if (other != this) {
std::swap(account_id_, other->account_id_);
std::swap(season_trophy_id_, other->season_trophy_id_);
skill_levels_.Swap(&other->skill_levels_);
std::swap(current_tier_, other->current_tier_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTAWeekendTourneyPlayerStats::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTAWeekendTourneyPlayerStats_descriptor_;
metadata.reflection = CMsgDOTAWeekendTourneyPlayerStats_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int CMsgDOTAWeekendTourneyPlayerStatsRequest::kAccountIdFieldNumber;
const int CMsgDOTAWeekendTourneyPlayerStatsRequest::kSeasonTrophyIdFieldNumber;
#endif // !_MSC_VER
CMsgDOTAWeekendTourneyPlayerStatsRequest::CMsgDOTAWeekendTourneyPlayerStatsRequest()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTAWeekendTourneyPlayerStatsRequest)
}
void CMsgDOTAWeekendTourneyPlayerStatsRequest::InitAsDefaultInstance() {
}
CMsgDOTAWeekendTourneyPlayerStatsRequest::CMsgDOTAWeekendTourneyPlayerStatsRequest(const CMsgDOTAWeekendTourneyPlayerStatsRequest& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTAWeekendTourneyPlayerStatsRequest)
}
void CMsgDOTAWeekendTourneyPlayerStatsRequest::SharedCtor() {
_cached_size_ = 0;
account_id_ = 0u;
season_trophy_id_ = 0u;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTAWeekendTourneyPlayerStatsRequest::~CMsgDOTAWeekendTourneyPlayerStatsRequest() {
// @@protoc_insertion_point(destructor:CMsgDOTAWeekendTourneyPlayerStatsRequest)
SharedDtor();
}
void CMsgDOTAWeekendTourneyPlayerStatsRequest::SharedDtor() {
if (this != default_instance_) {
}
}
void CMsgDOTAWeekendTourneyPlayerStatsRequest::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTAWeekendTourneyPlayerStatsRequest::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTAWeekendTourneyPlayerStatsRequest_descriptor_;
}
const CMsgDOTAWeekendTourneyPlayerStatsRequest& CMsgDOTAWeekendTourneyPlayerStatsRequest::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTAWeekendTourneyPlayerStatsRequest* CMsgDOTAWeekendTourneyPlayerStatsRequest::default_instance_ = NULL;
CMsgDOTAWeekendTourneyPlayerStatsRequest* CMsgDOTAWeekendTourneyPlayerStatsRequest::New() const {
return new CMsgDOTAWeekendTourneyPlayerStatsRequest;
}
void CMsgDOTAWeekendTourneyPlayerStatsRequest::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<CMsgDOTAWeekendTourneyPlayerStatsRequest*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
ZR_(account_id_, season_trophy_id_);
#undef OFFSET_OF_FIELD_
#undef ZR_
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTAWeekendTourneyPlayerStatsRequest::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTAWeekendTourneyPlayerStatsRequest)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint32 account_id = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &account_id_)));
set_has_account_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_season_trophy_id;
break;
}
// optional uint32 season_trophy_id = 2;
case 2: {
if (tag == 16) {
parse_season_trophy_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &season_trophy_id_)));
set_has_season_trophy_id();
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTAWeekendTourneyPlayerStatsRequest)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTAWeekendTourneyPlayerStatsRequest)
return false;
#undef DO_
}
void CMsgDOTAWeekendTourneyPlayerStatsRequest::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTAWeekendTourneyPlayerStatsRequest)
// optional uint32 account_id = 1;
if (has_account_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->account_id(), output);
}
// optional uint32 season_trophy_id = 2;
if (has_season_trophy_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->season_trophy_id(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTAWeekendTourneyPlayerStatsRequest)
}
::google::protobuf::uint8* CMsgDOTAWeekendTourneyPlayerStatsRequest::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTAWeekendTourneyPlayerStatsRequest)
// optional uint32 account_id = 1;
if (has_account_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->account_id(), target);
}
// optional uint32 season_trophy_id = 2;
if (has_season_trophy_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->season_trophy_id(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTAWeekendTourneyPlayerStatsRequest)
return target;
}
int CMsgDOTAWeekendTourneyPlayerStatsRequest::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional uint32 account_id = 1;
if (has_account_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->account_id());
}
// optional uint32 season_trophy_id = 2;
if (has_season_trophy_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->season_trophy_id());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTAWeekendTourneyPlayerStatsRequest::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTAWeekendTourneyPlayerStatsRequest* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTAWeekendTourneyPlayerStatsRequest*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTAWeekendTourneyPlayerStatsRequest::MergeFrom(const CMsgDOTAWeekendTourneyPlayerStatsRequest& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_account_id()) {
set_account_id(from.account_id());
}
if (from.has_season_trophy_id()) {
set_season_trophy_id(from.season_trophy_id());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTAWeekendTourneyPlayerStatsRequest::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTAWeekendTourneyPlayerStatsRequest::CopyFrom(const CMsgDOTAWeekendTourneyPlayerStatsRequest& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTAWeekendTourneyPlayerStatsRequest::IsInitialized() const {
return true;
}
void CMsgDOTAWeekendTourneyPlayerStatsRequest::Swap(CMsgDOTAWeekendTourneyPlayerStatsRequest* other) {
if (other != this) {
std::swap(account_id_, other->account_id_);
std::swap(season_trophy_id_, other->season_trophy_id_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTAWeekendTourneyPlayerStatsRequest::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTAWeekendTourneyPlayerStatsRequest_descriptor_;
metadata.reflection = CMsgDOTAWeekendTourneyPlayerStatsRequest_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int CMsgDOTAWeekendTourneyPlayerHistoryRequest::kAccountIdFieldNumber;
const int CMsgDOTAWeekendTourneyPlayerHistoryRequest::kSeasonTrophyIdFieldNumber;
#endif // !_MSC_VER
CMsgDOTAWeekendTourneyPlayerHistoryRequest::CMsgDOTAWeekendTourneyPlayerHistoryRequest()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTAWeekendTourneyPlayerHistoryRequest)
}
void CMsgDOTAWeekendTourneyPlayerHistoryRequest::InitAsDefaultInstance() {
}
CMsgDOTAWeekendTourneyPlayerHistoryRequest::CMsgDOTAWeekendTourneyPlayerHistoryRequest(const CMsgDOTAWeekendTourneyPlayerHistoryRequest& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTAWeekendTourneyPlayerHistoryRequest)
}
void CMsgDOTAWeekendTourneyPlayerHistoryRequest::SharedCtor() {
_cached_size_ = 0;
account_id_ = 0u;
season_trophy_id_ = 0u;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTAWeekendTourneyPlayerHistoryRequest::~CMsgDOTAWeekendTourneyPlayerHistoryRequest() {
// @@protoc_insertion_point(destructor:CMsgDOTAWeekendTourneyPlayerHistoryRequest)
SharedDtor();
}
void CMsgDOTAWeekendTourneyPlayerHistoryRequest::SharedDtor() {
if (this != default_instance_) {
}
}
void CMsgDOTAWeekendTourneyPlayerHistoryRequest::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTAWeekendTourneyPlayerHistoryRequest::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTAWeekendTourneyPlayerHistoryRequest_descriptor_;
}
const CMsgDOTAWeekendTourneyPlayerHistoryRequest& CMsgDOTAWeekendTourneyPlayerHistoryRequest::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTAWeekendTourneyPlayerHistoryRequest* CMsgDOTAWeekendTourneyPlayerHistoryRequest::default_instance_ = NULL;
CMsgDOTAWeekendTourneyPlayerHistoryRequest* CMsgDOTAWeekendTourneyPlayerHistoryRequest::New() const {
return new CMsgDOTAWeekendTourneyPlayerHistoryRequest;
}
void CMsgDOTAWeekendTourneyPlayerHistoryRequest::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<CMsgDOTAWeekendTourneyPlayerHistoryRequest*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
ZR_(account_id_, season_trophy_id_);
#undef OFFSET_OF_FIELD_
#undef ZR_
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTAWeekendTourneyPlayerHistoryRequest::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTAWeekendTourneyPlayerHistoryRequest)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint32 account_id = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &account_id_)));
set_has_account_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_season_trophy_id;
break;
}
// optional uint32 season_trophy_id = 2;
case 2: {
if (tag == 16) {
parse_season_trophy_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &season_trophy_id_)));
set_has_season_trophy_id();
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTAWeekendTourneyPlayerHistoryRequest)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTAWeekendTourneyPlayerHistoryRequest)
return false;
#undef DO_
}
void CMsgDOTAWeekendTourneyPlayerHistoryRequest::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTAWeekendTourneyPlayerHistoryRequest)
// optional uint32 account_id = 1;
if (has_account_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->account_id(), output);
}
// optional uint32 season_trophy_id = 2;
if (has_season_trophy_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->season_trophy_id(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTAWeekendTourneyPlayerHistoryRequest)
}
::google::protobuf::uint8* CMsgDOTAWeekendTourneyPlayerHistoryRequest::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTAWeekendTourneyPlayerHistoryRequest)
// optional uint32 account_id = 1;
if (has_account_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->account_id(), target);
}
// optional uint32 season_trophy_id = 2;
if (has_season_trophy_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->season_trophy_id(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTAWeekendTourneyPlayerHistoryRequest)
return target;
}
int CMsgDOTAWeekendTourneyPlayerHistoryRequest::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional uint32 account_id = 1;
if (has_account_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->account_id());
}
// optional uint32 season_trophy_id = 2;
if (has_season_trophy_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->season_trophy_id());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTAWeekendTourneyPlayerHistoryRequest::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTAWeekendTourneyPlayerHistoryRequest* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTAWeekendTourneyPlayerHistoryRequest*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTAWeekendTourneyPlayerHistoryRequest::MergeFrom(const CMsgDOTAWeekendTourneyPlayerHistoryRequest& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_account_id()) {
set_account_id(from.account_id());
}
if (from.has_season_trophy_id()) {
set_season_trophy_id(from.season_trophy_id());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTAWeekendTourneyPlayerHistoryRequest::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTAWeekendTourneyPlayerHistoryRequest::CopyFrom(const CMsgDOTAWeekendTourneyPlayerHistoryRequest& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTAWeekendTourneyPlayerHistoryRequest::IsInitialized() const {
return true;
}
void CMsgDOTAWeekendTourneyPlayerHistoryRequest::Swap(CMsgDOTAWeekendTourneyPlayerHistoryRequest* other) {
if (other != this) {
std::swap(account_id_, other->account_id_);
std::swap(season_trophy_id_, other->season_trophy_id_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTAWeekendTourneyPlayerHistoryRequest::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTAWeekendTourneyPlayerHistoryRequest_descriptor_;
metadata.reflection = CMsgDOTAWeekendTourneyPlayerHistoryRequest_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int CMsgDOTAWeekendTourneyPlayerHistory_Tournament::kTournamentIdFieldNumber;
const int CMsgDOTAWeekendTourneyPlayerHistory_Tournament::kStartTimeFieldNumber;
const int CMsgDOTAWeekendTourneyPlayerHistory_Tournament::kTournamentTierFieldNumber;
const int CMsgDOTAWeekendTourneyPlayerHistory_Tournament::kTeamIdFieldNumber;
const int CMsgDOTAWeekendTourneyPlayerHistory_Tournament::kTeamDateFieldNumber;
const int CMsgDOTAWeekendTourneyPlayerHistory_Tournament::kTeamResultFieldNumber;
const int CMsgDOTAWeekendTourneyPlayerHistory_Tournament::kAccountIdFieldNumber;
const int CMsgDOTAWeekendTourneyPlayerHistory_Tournament::kTeamNameFieldNumber;
const int CMsgDOTAWeekendTourneyPlayerHistory_Tournament::kSeasonTrophyIdFieldNumber;
#endif // !_MSC_VER
CMsgDOTAWeekendTourneyPlayerHistory_Tournament::CMsgDOTAWeekendTourneyPlayerHistory_Tournament()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTAWeekendTourneyPlayerHistory.Tournament)
}
void CMsgDOTAWeekendTourneyPlayerHistory_Tournament::InitAsDefaultInstance() {
}
CMsgDOTAWeekendTourneyPlayerHistory_Tournament::CMsgDOTAWeekendTourneyPlayerHistory_Tournament(const CMsgDOTAWeekendTourneyPlayerHistory_Tournament& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTAWeekendTourneyPlayerHistory.Tournament)
}
void CMsgDOTAWeekendTourneyPlayerHistory_Tournament::SharedCtor() {
::google::protobuf::internal::GetEmptyString();
_cached_size_ = 0;
tournament_id_ = 0u;
start_time_ = 0u;
tournament_tier_ = 0u;
team_id_ = 0u;
team_date_ = 0u;
team_result_ = 0u;
team_name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
season_trophy_id_ = 0u;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTAWeekendTourneyPlayerHistory_Tournament::~CMsgDOTAWeekendTourneyPlayerHistory_Tournament() {
// @@protoc_insertion_point(destructor:CMsgDOTAWeekendTourneyPlayerHistory.Tournament)
SharedDtor();
}
void CMsgDOTAWeekendTourneyPlayerHistory_Tournament::SharedDtor() {
if (team_name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete team_name_;
}
if (this != default_instance_) {
}
}
void CMsgDOTAWeekendTourneyPlayerHistory_Tournament::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTAWeekendTourneyPlayerHistory_Tournament::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTAWeekendTourneyPlayerHistory_Tournament_descriptor_;
}
const CMsgDOTAWeekendTourneyPlayerHistory_Tournament& CMsgDOTAWeekendTourneyPlayerHistory_Tournament::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTAWeekendTourneyPlayerHistory_Tournament* CMsgDOTAWeekendTourneyPlayerHistory_Tournament::default_instance_ = NULL;
CMsgDOTAWeekendTourneyPlayerHistory_Tournament* CMsgDOTAWeekendTourneyPlayerHistory_Tournament::New() const {
return new CMsgDOTAWeekendTourneyPlayerHistory_Tournament;
}
void CMsgDOTAWeekendTourneyPlayerHistory_Tournament::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<CMsgDOTAWeekendTourneyPlayerHistory_Tournament*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
if (_has_bits_[0 / 32] & 191) {
ZR_(tournament_id_, team_result_);
if (has_team_name()) {
if (team_name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
team_name_->clear();
}
}
}
season_trophy_id_ = 0u;
#undef OFFSET_OF_FIELD_
#undef ZR_
account_id_.Clear();
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTAWeekendTourneyPlayerHistory_Tournament::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTAWeekendTourneyPlayerHistory.Tournament)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint32 tournament_id = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &tournament_id_)));
set_has_tournament_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_start_time;
break;
}
// optional uint32 start_time = 2;
case 2: {
if (tag == 16) {
parse_start_time:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &start_time_)));
set_has_start_time();
} else {
goto handle_unusual;
}
if (input->ExpectTag(24)) goto parse_tournament_tier;
break;
}
// optional uint32 tournament_tier = 3;
case 3: {
if (tag == 24) {
parse_tournament_tier:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &tournament_tier_)));
set_has_tournament_tier();
} else {
goto handle_unusual;
}
if (input->ExpectTag(32)) goto parse_team_id;
break;
}
// optional uint32 team_id = 4;
case 4: {
if (tag == 32) {
parse_team_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &team_id_)));
set_has_team_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(40)) goto parse_team_date;
break;
}
// optional uint32 team_date = 5;
case 5: {
if (tag == 40) {
parse_team_date:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &team_date_)));
set_has_team_date();
} else {
goto handle_unusual;
}
if (input->ExpectTag(48)) goto parse_team_result;
break;
}
// optional uint32 team_result = 6;
case 6: {
if (tag == 48) {
parse_team_result:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &team_result_)));
set_has_team_result();
} else {
goto handle_unusual;
}
if (input->ExpectTag(56)) goto parse_account_id;
break;
}
// repeated uint32 account_id = 7;
case 7: {
if (tag == 56) {
parse_account_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
1, 56, input, this->mutable_account_id())));
} else if (tag == 58) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitiveNoInline<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, this->mutable_account_id())));
} else {
goto handle_unusual;
}
if (input->ExpectTag(56)) goto parse_account_id;
if (input->ExpectTag(66)) goto parse_team_name;
break;
}
// optional string team_name = 8;
case 8: {
if (tag == 66) {
parse_team_name:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_team_name()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->team_name().data(), this->team_name().length(),
::google::protobuf::internal::WireFormat::PARSE,
"team_name");
} else {
goto handle_unusual;
}
if (input->ExpectTag(72)) goto parse_season_trophy_id;
break;
}
// optional uint32 season_trophy_id = 9;
case 9: {
if (tag == 72) {
parse_season_trophy_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &season_trophy_id_)));
set_has_season_trophy_id();
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTAWeekendTourneyPlayerHistory.Tournament)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTAWeekendTourneyPlayerHistory.Tournament)
return false;
#undef DO_
}
void CMsgDOTAWeekendTourneyPlayerHistory_Tournament::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTAWeekendTourneyPlayerHistory.Tournament)
// optional uint32 tournament_id = 1;
if (has_tournament_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->tournament_id(), output);
}
// optional uint32 start_time = 2;
if (has_start_time()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->start_time(), output);
}
// optional uint32 tournament_tier = 3;
if (has_tournament_tier()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(3, this->tournament_tier(), output);
}
// optional uint32 team_id = 4;
if (has_team_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(4, this->team_id(), output);
}
// optional uint32 team_date = 5;
if (has_team_date()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(5, this->team_date(), output);
}
// optional uint32 team_result = 6;
if (has_team_result()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(6, this->team_result(), output);
}
// repeated uint32 account_id = 7;
for (int i = 0; i < this->account_id_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(
7, this->account_id(i), output);
}
// optional string team_name = 8;
if (has_team_name()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->team_name().data(), this->team_name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"team_name");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
8, this->team_name(), output);
}
// optional uint32 season_trophy_id = 9;
if (has_season_trophy_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(9, this->season_trophy_id(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTAWeekendTourneyPlayerHistory.Tournament)
}
::google::protobuf::uint8* CMsgDOTAWeekendTourneyPlayerHistory_Tournament::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTAWeekendTourneyPlayerHistory.Tournament)
// optional uint32 tournament_id = 1;
if (has_tournament_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->tournament_id(), target);
}
// optional uint32 start_time = 2;
if (has_start_time()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->start_time(), target);
}
// optional uint32 tournament_tier = 3;
if (has_tournament_tier()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(3, this->tournament_tier(), target);
}
// optional uint32 team_id = 4;
if (has_team_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(4, this->team_id(), target);
}
// optional uint32 team_date = 5;
if (has_team_date()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(5, this->team_date(), target);
}
// optional uint32 team_result = 6;
if (has_team_result()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(6, this->team_result(), target);
}
// repeated uint32 account_id = 7;
for (int i = 0; i < this->account_id_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteUInt32ToArray(7, this->account_id(i), target);
}
// optional string team_name = 8;
if (has_team_name()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->team_name().data(), this->team_name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"team_name");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
8, this->team_name(), target);
}
// optional uint32 season_trophy_id = 9;
if (has_season_trophy_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(9, this->season_trophy_id(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTAWeekendTourneyPlayerHistory.Tournament)
return target;
}
int CMsgDOTAWeekendTourneyPlayerHistory_Tournament::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional uint32 tournament_id = 1;
if (has_tournament_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->tournament_id());
}
// optional uint32 start_time = 2;
if (has_start_time()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->start_time());
}
// optional uint32 tournament_tier = 3;
if (has_tournament_tier()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->tournament_tier());
}
// optional uint32 team_id = 4;
if (has_team_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->team_id());
}
// optional uint32 team_date = 5;
if (has_team_date()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->team_date());
}
// optional uint32 team_result = 6;
if (has_team_result()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->team_result());
}
// optional string team_name = 8;
if (has_team_name()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->team_name());
}
}
if (_has_bits_[8 / 32] & (0xffu << (8 % 32))) {
// optional uint32 season_trophy_id = 9;
if (has_season_trophy_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->season_trophy_id());
}
}
// repeated uint32 account_id = 7;
{
int data_size = 0;
for (int i = 0; i < this->account_id_size(); i++) {
data_size += ::google::protobuf::internal::WireFormatLite::
UInt32Size(this->account_id(i));
}
total_size += 1 * this->account_id_size() + data_size;
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTAWeekendTourneyPlayerHistory_Tournament::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTAWeekendTourneyPlayerHistory_Tournament* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTAWeekendTourneyPlayerHistory_Tournament*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTAWeekendTourneyPlayerHistory_Tournament::MergeFrom(const CMsgDOTAWeekendTourneyPlayerHistory_Tournament& from) {
GOOGLE_CHECK_NE(&from, this);
account_id_.MergeFrom(from.account_id_);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_tournament_id()) {
set_tournament_id(from.tournament_id());
}
if (from.has_start_time()) {
set_start_time(from.start_time());
}
if (from.has_tournament_tier()) {
set_tournament_tier(from.tournament_tier());
}
if (from.has_team_id()) {
set_team_id(from.team_id());
}
if (from.has_team_date()) {
set_team_date(from.team_date());
}
if (from.has_team_result()) {
set_team_result(from.team_result());
}
if (from.has_team_name()) {
set_team_name(from.team_name());
}
}
if (from._has_bits_[8 / 32] & (0xffu << (8 % 32))) {
if (from.has_season_trophy_id()) {
set_season_trophy_id(from.season_trophy_id());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTAWeekendTourneyPlayerHistory_Tournament::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTAWeekendTourneyPlayerHistory_Tournament::CopyFrom(const CMsgDOTAWeekendTourneyPlayerHistory_Tournament& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTAWeekendTourneyPlayerHistory_Tournament::IsInitialized() const {
return true;
}
void CMsgDOTAWeekendTourneyPlayerHistory_Tournament::Swap(CMsgDOTAWeekendTourneyPlayerHistory_Tournament* other) {
if (other != this) {
std::swap(tournament_id_, other->tournament_id_);
std::swap(start_time_, other->start_time_);
std::swap(tournament_tier_, other->tournament_tier_);
std::swap(team_id_, other->team_id_);
std::swap(team_date_, other->team_date_);
std::swap(team_result_, other->team_result_);
account_id_.Swap(&other->account_id_);
std::swap(team_name_, other->team_name_);
std::swap(season_trophy_id_, other->season_trophy_id_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTAWeekendTourneyPlayerHistory_Tournament::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTAWeekendTourneyPlayerHistory_Tournament_descriptor_;
metadata.reflection = CMsgDOTAWeekendTourneyPlayerHistory_Tournament_reflection_;
return metadata;
}
// -------------------------------------------------------------------
#ifndef _MSC_VER
const int CMsgDOTAWeekendTourneyPlayerHistory::kAccountIdFieldNumber;
const int CMsgDOTAWeekendTourneyPlayerHistory::kTournamentsFieldNumber;
#endif // !_MSC_VER
CMsgDOTAWeekendTourneyPlayerHistory::CMsgDOTAWeekendTourneyPlayerHistory()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTAWeekendTourneyPlayerHistory)
}
void CMsgDOTAWeekendTourneyPlayerHistory::InitAsDefaultInstance() {
}
CMsgDOTAWeekendTourneyPlayerHistory::CMsgDOTAWeekendTourneyPlayerHistory(const CMsgDOTAWeekendTourneyPlayerHistory& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTAWeekendTourneyPlayerHistory)
}
void CMsgDOTAWeekendTourneyPlayerHistory::SharedCtor() {
_cached_size_ = 0;
account_id_ = 0u;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTAWeekendTourneyPlayerHistory::~CMsgDOTAWeekendTourneyPlayerHistory() {
// @@protoc_insertion_point(destructor:CMsgDOTAWeekendTourneyPlayerHistory)
SharedDtor();
}
void CMsgDOTAWeekendTourneyPlayerHistory::SharedDtor() {
if (this != default_instance_) {
}
}
void CMsgDOTAWeekendTourneyPlayerHistory::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTAWeekendTourneyPlayerHistory::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTAWeekendTourneyPlayerHistory_descriptor_;
}
const CMsgDOTAWeekendTourneyPlayerHistory& CMsgDOTAWeekendTourneyPlayerHistory::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTAWeekendTourneyPlayerHistory* CMsgDOTAWeekendTourneyPlayerHistory::default_instance_ = NULL;
CMsgDOTAWeekendTourneyPlayerHistory* CMsgDOTAWeekendTourneyPlayerHistory::New() const {
return new CMsgDOTAWeekendTourneyPlayerHistory;
}
void CMsgDOTAWeekendTourneyPlayerHistory::Clear() {
account_id_ = 0u;
tournaments_.Clear();
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTAWeekendTourneyPlayerHistory::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTAWeekendTourneyPlayerHistory)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint32 account_id = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &account_id_)));
set_has_account_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(26)) goto parse_tournaments;
break;
}
// repeated .CMsgDOTAWeekendTourneyPlayerHistory.Tournament tournaments = 3;
case 3: {
if (tag == 26) {
parse_tournaments:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_tournaments()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(26)) goto parse_tournaments;
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTAWeekendTourneyPlayerHistory)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTAWeekendTourneyPlayerHistory)
return false;
#undef DO_
}
void CMsgDOTAWeekendTourneyPlayerHistory::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTAWeekendTourneyPlayerHistory)
// optional uint32 account_id = 1;
if (has_account_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->account_id(), output);
}
// repeated .CMsgDOTAWeekendTourneyPlayerHistory.Tournament tournaments = 3;
for (int i = 0; i < this->tournaments_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, this->tournaments(i), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTAWeekendTourneyPlayerHistory)
}
::google::protobuf::uint8* CMsgDOTAWeekendTourneyPlayerHistory::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTAWeekendTourneyPlayerHistory)
// optional uint32 account_id = 1;
if (has_account_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->account_id(), target);
}
// repeated .CMsgDOTAWeekendTourneyPlayerHistory.Tournament tournaments = 3;
for (int i = 0; i < this->tournaments_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
3, this->tournaments(i), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTAWeekendTourneyPlayerHistory)
return target;
}
int CMsgDOTAWeekendTourneyPlayerHistory::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional uint32 account_id = 1;
if (has_account_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->account_id());
}
}
// repeated .CMsgDOTAWeekendTourneyPlayerHistory.Tournament tournaments = 3;
total_size += 1 * this->tournaments_size();
for (int i = 0; i < this->tournaments_size(); i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->tournaments(i));
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTAWeekendTourneyPlayerHistory::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTAWeekendTourneyPlayerHistory* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTAWeekendTourneyPlayerHistory*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTAWeekendTourneyPlayerHistory::MergeFrom(const CMsgDOTAWeekendTourneyPlayerHistory& from) {
GOOGLE_CHECK_NE(&from, this);
tournaments_.MergeFrom(from.tournaments_);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_account_id()) {
set_account_id(from.account_id());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTAWeekendTourneyPlayerHistory::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTAWeekendTourneyPlayerHistory::CopyFrom(const CMsgDOTAWeekendTourneyPlayerHistory& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTAWeekendTourneyPlayerHistory::IsInitialized() const {
return true;
}
void CMsgDOTAWeekendTourneyPlayerHistory::Swap(CMsgDOTAWeekendTourneyPlayerHistory* other) {
if (other != this) {
std::swap(account_id_, other->account_id_);
tournaments_.Swap(&other->tournaments_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTAWeekendTourneyPlayerHistory::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTAWeekendTourneyPlayerHistory_descriptor_;
metadata.reflection = CMsgDOTAWeekendTourneyPlayerHistory_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int CMsgDOTAWeekendTourneyParticipationDetails_Tier::kTierFieldNumber;
const int CMsgDOTAWeekendTourneyParticipationDetails_Tier::kPlayersFieldNumber;
const int CMsgDOTAWeekendTourneyParticipationDetails_Tier::kTeamsFieldNumber;
const int CMsgDOTAWeekendTourneyParticipationDetails_Tier::kWinningTeamsFieldNumber;
const int CMsgDOTAWeekendTourneyParticipationDetails_Tier::kPlayersStreak2FieldNumber;
const int CMsgDOTAWeekendTourneyParticipationDetails_Tier::kPlayersStreak3FieldNumber;
const int CMsgDOTAWeekendTourneyParticipationDetails_Tier::kPlayersStreak4FieldNumber;
const int CMsgDOTAWeekendTourneyParticipationDetails_Tier::kPlayersStreak5FieldNumber;
#endif // !_MSC_VER
CMsgDOTAWeekendTourneyParticipationDetails_Tier::CMsgDOTAWeekendTourneyParticipationDetails_Tier()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTAWeekendTourneyParticipationDetails.Tier)
}
void CMsgDOTAWeekendTourneyParticipationDetails_Tier::InitAsDefaultInstance() {
}
CMsgDOTAWeekendTourneyParticipationDetails_Tier::CMsgDOTAWeekendTourneyParticipationDetails_Tier(const CMsgDOTAWeekendTourneyParticipationDetails_Tier& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTAWeekendTourneyParticipationDetails.Tier)
}
void CMsgDOTAWeekendTourneyParticipationDetails_Tier::SharedCtor() {
_cached_size_ = 0;
tier_ = 0u;
players_ = 0u;
teams_ = 0u;
winning_teams_ = 0u;
players_streak_2_ = 0u;
players_streak_3_ = 0u;
players_streak_4_ = 0u;
players_streak_5_ = 0u;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTAWeekendTourneyParticipationDetails_Tier::~CMsgDOTAWeekendTourneyParticipationDetails_Tier() {
// @@protoc_insertion_point(destructor:CMsgDOTAWeekendTourneyParticipationDetails.Tier)
SharedDtor();
}
void CMsgDOTAWeekendTourneyParticipationDetails_Tier::SharedDtor() {
if (this != default_instance_) {
}
}
void CMsgDOTAWeekendTourneyParticipationDetails_Tier::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTAWeekendTourneyParticipationDetails_Tier::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTAWeekendTourneyParticipationDetails_Tier_descriptor_;
}
const CMsgDOTAWeekendTourneyParticipationDetails_Tier& CMsgDOTAWeekendTourneyParticipationDetails_Tier::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTAWeekendTourneyParticipationDetails_Tier* CMsgDOTAWeekendTourneyParticipationDetails_Tier::default_instance_ = NULL;
CMsgDOTAWeekendTourneyParticipationDetails_Tier* CMsgDOTAWeekendTourneyParticipationDetails_Tier::New() const {
return new CMsgDOTAWeekendTourneyParticipationDetails_Tier;
}
void CMsgDOTAWeekendTourneyParticipationDetails_Tier::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<CMsgDOTAWeekendTourneyParticipationDetails_Tier*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
if (_has_bits_[0 / 32] & 255) {
ZR_(tier_, players_streak_5_);
}
#undef OFFSET_OF_FIELD_
#undef ZR_
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTAWeekendTourneyParticipationDetails_Tier::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTAWeekendTourneyParticipationDetails.Tier)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint32 tier = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &tier_)));
set_has_tier();
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_players;
break;
}
// optional uint32 players = 2;
case 2: {
if (tag == 16) {
parse_players:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &players_)));
set_has_players();
} else {
goto handle_unusual;
}
if (input->ExpectTag(24)) goto parse_teams;
break;
}
// optional uint32 teams = 3;
case 3: {
if (tag == 24) {
parse_teams:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &teams_)));
set_has_teams();
} else {
goto handle_unusual;
}
if (input->ExpectTag(32)) goto parse_winning_teams;
break;
}
// optional uint32 winning_teams = 4;
case 4: {
if (tag == 32) {
parse_winning_teams:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &winning_teams_)));
set_has_winning_teams();
} else {
goto handle_unusual;
}
if (input->ExpectTag(40)) goto parse_players_streak_2;
break;
}
// optional uint32 players_streak_2 = 5;
case 5: {
if (tag == 40) {
parse_players_streak_2:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &players_streak_2_)));
set_has_players_streak_2();
} else {
goto handle_unusual;
}
if (input->ExpectTag(48)) goto parse_players_streak_3;
break;
}
// optional uint32 players_streak_3 = 6;
case 6: {
if (tag == 48) {
parse_players_streak_3:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &players_streak_3_)));
set_has_players_streak_3();
} else {
goto handle_unusual;
}
if (input->ExpectTag(56)) goto parse_players_streak_4;
break;
}
// optional uint32 players_streak_4 = 7;
case 7: {
if (tag == 56) {
parse_players_streak_4:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &players_streak_4_)));
set_has_players_streak_4();
} else {
goto handle_unusual;
}
if (input->ExpectTag(64)) goto parse_players_streak_5;
break;
}
// optional uint32 players_streak_5 = 8;
case 8: {
if (tag == 64) {
parse_players_streak_5:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &players_streak_5_)));
set_has_players_streak_5();
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTAWeekendTourneyParticipationDetails.Tier)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTAWeekendTourneyParticipationDetails.Tier)
return false;
#undef DO_
}
void CMsgDOTAWeekendTourneyParticipationDetails_Tier::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTAWeekendTourneyParticipationDetails.Tier)
// optional uint32 tier = 1;
if (has_tier()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->tier(), output);
}
// optional uint32 players = 2;
if (has_players()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->players(), output);
}
// optional uint32 teams = 3;
if (has_teams()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(3, this->teams(), output);
}
// optional uint32 winning_teams = 4;
if (has_winning_teams()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(4, this->winning_teams(), output);
}
// optional uint32 players_streak_2 = 5;
if (has_players_streak_2()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(5, this->players_streak_2(), output);
}
// optional uint32 players_streak_3 = 6;
if (has_players_streak_3()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(6, this->players_streak_3(), output);
}
// optional uint32 players_streak_4 = 7;
if (has_players_streak_4()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(7, this->players_streak_4(), output);
}
// optional uint32 players_streak_5 = 8;
if (has_players_streak_5()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(8, this->players_streak_5(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTAWeekendTourneyParticipationDetails.Tier)
}
::google::protobuf::uint8* CMsgDOTAWeekendTourneyParticipationDetails_Tier::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTAWeekendTourneyParticipationDetails.Tier)
// optional uint32 tier = 1;
if (has_tier()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->tier(), target);
}
// optional uint32 players = 2;
if (has_players()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->players(), target);
}
// optional uint32 teams = 3;
if (has_teams()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(3, this->teams(), target);
}
// optional uint32 winning_teams = 4;
if (has_winning_teams()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(4, this->winning_teams(), target);
}
// optional uint32 players_streak_2 = 5;
if (has_players_streak_2()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(5, this->players_streak_2(), target);
}
// optional uint32 players_streak_3 = 6;
if (has_players_streak_3()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(6, this->players_streak_3(), target);
}
// optional uint32 players_streak_4 = 7;
if (has_players_streak_4()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(7, this->players_streak_4(), target);
}
// optional uint32 players_streak_5 = 8;
if (has_players_streak_5()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(8, this->players_streak_5(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTAWeekendTourneyParticipationDetails.Tier)
return target;
}
int CMsgDOTAWeekendTourneyParticipationDetails_Tier::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional uint32 tier = 1;
if (has_tier()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->tier());
}
// optional uint32 players = 2;
if (has_players()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->players());
}
// optional uint32 teams = 3;
if (has_teams()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->teams());
}
// optional uint32 winning_teams = 4;
if (has_winning_teams()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->winning_teams());
}
// optional uint32 players_streak_2 = 5;
if (has_players_streak_2()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->players_streak_2());
}
// optional uint32 players_streak_3 = 6;
if (has_players_streak_3()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->players_streak_3());
}
// optional uint32 players_streak_4 = 7;
if (has_players_streak_4()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->players_streak_4());
}
// optional uint32 players_streak_5 = 8;
if (has_players_streak_5()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->players_streak_5());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTAWeekendTourneyParticipationDetails_Tier::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTAWeekendTourneyParticipationDetails_Tier* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTAWeekendTourneyParticipationDetails_Tier*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTAWeekendTourneyParticipationDetails_Tier::MergeFrom(const CMsgDOTAWeekendTourneyParticipationDetails_Tier& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_tier()) {
set_tier(from.tier());
}
if (from.has_players()) {
set_players(from.players());
}
if (from.has_teams()) {
set_teams(from.teams());
}
if (from.has_winning_teams()) {
set_winning_teams(from.winning_teams());
}
if (from.has_players_streak_2()) {
set_players_streak_2(from.players_streak_2());
}
if (from.has_players_streak_3()) {
set_players_streak_3(from.players_streak_3());
}
if (from.has_players_streak_4()) {
set_players_streak_4(from.players_streak_4());
}
if (from.has_players_streak_5()) {
set_players_streak_5(from.players_streak_5());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTAWeekendTourneyParticipationDetails_Tier::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTAWeekendTourneyParticipationDetails_Tier::CopyFrom(const CMsgDOTAWeekendTourneyParticipationDetails_Tier& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTAWeekendTourneyParticipationDetails_Tier::IsInitialized() const {
return true;
}
void CMsgDOTAWeekendTourneyParticipationDetails_Tier::Swap(CMsgDOTAWeekendTourneyParticipationDetails_Tier* other) {
if (other != this) {
std::swap(tier_, other->tier_);
std::swap(players_, other->players_);
std::swap(teams_, other->teams_);
std::swap(winning_teams_, other->winning_teams_);
std::swap(players_streak_2_, other->players_streak_2_);
std::swap(players_streak_3_, other->players_streak_3_);
std::swap(players_streak_4_, other->players_streak_4_);
std::swap(players_streak_5_, other->players_streak_5_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTAWeekendTourneyParticipationDetails_Tier::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTAWeekendTourneyParticipationDetails_Tier_descriptor_;
metadata.reflection = CMsgDOTAWeekendTourneyParticipationDetails_Tier_reflection_;
return metadata;
}
// -------------------------------------------------------------------
#ifndef _MSC_VER
const int CMsgDOTAWeekendTourneyParticipationDetails_Division::kDivisionIdFieldNumber;
const int CMsgDOTAWeekendTourneyParticipationDetails_Division::kScheduleTimeFieldNumber;
const int CMsgDOTAWeekendTourneyParticipationDetails_Division::kTiersFieldNumber;
#endif // !_MSC_VER
CMsgDOTAWeekendTourneyParticipationDetails_Division::CMsgDOTAWeekendTourneyParticipationDetails_Division()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTAWeekendTourneyParticipationDetails.Division)
}
void CMsgDOTAWeekendTourneyParticipationDetails_Division::InitAsDefaultInstance() {
}
CMsgDOTAWeekendTourneyParticipationDetails_Division::CMsgDOTAWeekendTourneyParticipationDetails_Division(const CMsgDOTAWeekendTourneyParticipationDetails_Division& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTAWeekendTourneyParticipationDetails.Division)
}
void CMsgDOTAWeekendTourneyParticipationDetails_Division::SharedCtor() {
_cached_size_ = 0;
division_id_ = 0u;
schedule_time_ = 0u;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTAWeekendTourneyParticipationDetails_Division::~CMsgDOTAWeekendTourneyParticipationDetails_Division() {
// @@protoc_insertion_point(destructor:CMsgDOTAWeekendTourneyParticipationDetails.Division)
SharedDtor();
}
void CMsgDOTAWeekendTourneyParticipationDetails_Division::SharedDtor() {
if (this != default_instance_) {
}
}
void CMsgDOTAWeekendTourneyParticipationDetails_Division::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTAWeekendTourneyParticipationDetails_Division::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTAWeekendTourneyParticipationDetails_Division_descriptor_;
}
const CMsgDOTAWeekendTourneyParticipationDetails_Division& CMsgDOTAWeekendTourneyParticipationDetails_Division::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTAWeekendTourneyParticipationDetails_Division* CMsgDOTAWeekendTourneyParticipationDetails_Division::default_instance_ = NULL;
CMsgDOTAWeekendTourneyParticipationDetails_Division* CMsgDOTAWeekendTourneyParticipationDetails_Division::New() const {
return new CMsgDOTAWeekendTourneyParticipationDetails_Division;
}
void CMsgDOTAWeekendTourneyParticipationDetails_Division::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<CMsgDOTAWeekendTourneyParticipationDetails_Division*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
ZR_(division_id_, schedule_time_);
#undef OFFSET_OF_FIELD_
#undef ZR_
tiers_.Clear();
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTAWeekendTourneyParticipationDetails_Division::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTAWeekendTourneyParticipationDetails.Division)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional uint32 division_id = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &division_id_)));
set_has_division_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_schedule_time;
break;
}
// optional uint32 schedule_time = 2;
case 2: {
if (tag == 16) {
parse_schedule_time:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &schedule_time_)));
set_has_schedule_time();
} else {
goto handle_unusual;
}
if (input->ExpectTag(26)) goto parse_tiers;
break;
}
// repeated .CMsgDOTAWeekendTourneyParticipationDetails.Tier tiers = 3;
case 3: {
if (tag == 26) {
parse_tiers:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_tiers()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(26)) goto parse_tiers;
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTAWeekendTourneyParticipationDetails.Division)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTAWeekendTourneyParticipationDetails.Division)
return false;
#undef DO_
}
void CMsgDOTAWeekendTourneyParticipationDetails_Division::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTAWeekendTourneyParticipationDetails.Division)
// optional uint32 division_id = 1;
if (has_division_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->division_id(), output);
}
// optional uint32 schedule_time = 2;
if (has_schedule_time()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->schedule_time(), output);
}
// repeated .CMsgDOTAWeekendTourneyParticipationDetails.Tier tiers = 3;
for (int i = 0; i < this->tiers_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, this->tiers(i), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTAWeekendTourneyParticipationDetails.Division)
}
::google::protobuf::uint8* CMsgDOTAWeekendTourneyParticipationDetails_Division::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTAWeekendTourneyParticipationDetails.Division)
// optional uint32 division_id = 1;
if (has_division_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->division_id(), target);
}
// optional uint32 schedule_time = 2;
if (has_schedule_time()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->schedule_time(), target);
}
// repeated .CMsgDOTAWeekendTourneyParticipationDetails.Tier tiers = 3;
for (int i = 0; i < this->tiers_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
3, this->tiers(i), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTAWeekendTourneyParticipationDetails.Division)
return target;
}
int CMsgDOTAWeekendTourneyParticipationDetails_Division::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional uint32 division_id = 1;
if (has_division_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->division_id());
}
// optional uint32 schedule_time = 2;
if (has_schedule_time()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->schedule_time());
}
}
// repeated .CMsgDOTAWeekendTourneyParticipationDetails.Tier tiers = 3;
total_size += 1 * this->tiers_size();
for (int i = 0; i < this->tiers_size(); i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->tiers(i));
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTAWeekendTourneyParticipationDetails_Division::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTAWeekendTourneyParticipationDetails_Division* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTAWeekendTourneyParticipationDetails_Division*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTAWeekendTourneyParticipationDetails_Division::MergeFrom(const CMsgDOTAWeekendTourneyParticipationDetails_Division& from) {
GOOGLE_CHECK_NE(&from, this);
tiers_.MergeFrom(from.tiers_);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_division_id()) {
set_division_id(from.division_id());
}
if (from.has_schedule_time()) {
set_schedule_time(from.schedule_time());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTAWeekendTourneyParticipationDetails_Division::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTAWeekendTourneyParticipationDetails_Division::CopyFrom(const CMsgDOTAWeekendTourneyParticipationDetails_Division& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTAWeekendTourneyParticipationDetails_Division::IsInitialized() const {
return true;
}
void CMsgDOTAWeekendTourneyParticipationDetails_Division::Swap(CMsgDOTAWeekendTourneyParticipationDetails_Division* other) {
if (other != this) {
std::swap(division_id_, other->division_id_);
std::swap(schedule_time_, other->schedule_time_);
tiers_.Swap(&other->tiers_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTAWeekendTourneyParticipationDetails_Division::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTAWeekendTourneyParticipationDetails_Division_descriptor_;
metadata.reflection = CMsgDOTAWeekendTourneyParticipationDetails_Division_reflection_;
return metadata;
}
// -------------------------------------------------------------------
#ifndef _MSC_VER
const int CMsgDOTAWeekendTourneyParticipationDetails::kDivisionsFieldNumber;
#endif // !_MSC_VER
CMsgDOTAWeekendTourneyParticipationDetails::CMsgDOTAWeekendTourneyParticipationDetails()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:CMsgDOTAWeekendTourneyParticipationDetails)
}
void CMsgDOTAWeekendTourneyParticipationDetails::InitAsDefaultInstance() {
}
CMsgDOTAWeekendTourneyParticipationDetails::CMsgDOTAWeekendTourneyParticipationDetails(const CMsgDOTAWeekendTourneyParticipationDetails& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:CMsgDOTAWeekendTourneyParticipationDetails)
}
void CMsgDOTAWeekendTourneyParticipationDetails::SharedCtor() {
_cached_size_ = 0;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CMsgDOTAWeekendTourneyParticipationDetails::~CMsgDOTAWeekendTourneyParticipationDetails() {
// @@protoc_insertion_point(destructor:CMsgDOTAWeekendTourneyParticipationDetails)
SharedDtor();
}
void CMsgDOTAWeekendTourneyParticipationDetails::SharedDtor() {
if (this != default_instance_) {
}
}
void CMsgDOTAWeekendTourneyParticipationDetails::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CMsgDOTAWeekendTourneyParticipationDetails::descriptor() {
protobuf_AssignDescriptorsOnce();
return CMsgDOTAWeekendTourneyParticipationDetails_descriptor_;
}
const CMsgDOTAWeekendTourneyParticipationDetails& CMsgDOTAWeekendTourneyParticipationDetails::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_dota_5fgcmessages_5fclient_5ftournament_2eproto();
return *default_instance_;
}
CMsgDOTAWeekendTourneyParticipationDetails* CMsgDOTAWeekendTourneyParticipationDetails::default_instance_ = NULL;
CMsgDOTAWeekendTourneyParticipationDetails* CMsgDOTAWeekendTourneyParticipationDetails::New() const {
return new CMsgDOTAWeekendTourneyParticipationDetails;
}
void CMsgDOTAWeekendTourneyParticipationDetails::Clear() {
divisions_.Clear();
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CMsgDOTAWeekendTourneyParticipationDetails::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:CMsgDOTAWeekendTourneyParticipationDetails)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// repeated .CMsgDOTAWeekendTourneyParticipationDetails.Division divisions = 1;
case 1: {
if (tag == 10) {
parse_divisions:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_divisions()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(10)) goto parse_divisions;
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:CMsgDOTAWeekendTourneyParticipationDetails)
return true;
failure:
// @@protoc_insertion_point(parse_failure:CMsgDOTAWeekendTourneyParticipationDetails)
return false;
#undef DO_
}
void CMsgDOTAWeekendTourneyParticipationDetails::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:CMsgDOTAWeekendTourneyParticipationDetails)
// repeated .CMsgDOTAWeekendTourneyParticipationDetails.Division divisions = 1;
for (int i = 0; i < this->divisions_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, this->divisions(i), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:CMsgDOTAWeekendTourneyParticipationDetails)
}
::google::protobuf::uint8* CMsgDOTAWeekendTourneyParticipationDetails::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:CMsgDOTAWeekendTourneyParticipationDetails)
// repeated .CMsgDOTAWeekendTourneyParticipationDetails.Division divisions = 1;
for (int i = 0; i < this->divisions_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
1, this->divisions(i), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:CMsgDOTAWeekendTourneyParticipationDetails)
return target;
}
int CMsgDOTAWeekendTourneyParticipationDetails::ByteSize() const {
int total_size = 0;
// repeated .CMsgDOTAWeekendTourneyParticipationDetails.Division divisions = 1;
total_size += 1 * this->divisions_size();
for (int i = 0; i < this->divisions_size(); i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->divisions(i));
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CMsgDOTAWeekendTourneyParticipationDetails::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CMsgDOTAWeekendTourneyParticipationDetails* source =
::google::protobuf::internal::dynamic_cast_if_available<const CMsgDOTAWeekendTourneyParticipationDetails*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CMsgDOTAWeekendTourneyParticipationDetails::MergeFrom(const CMsgDOTAWeekendTourneyParticipationDetails& from) {
GOOGLE_CHECK_NE(&from, this);
divisions_.MergeFrom(from.divisions_);
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CMsgDOTAWeekendTourneyParticipationDetails::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CMsgDOTAWeekendTourneyParticipationDetails::CopyFrom(const CMsgDOTAWeekendTourneyParticipationDetails& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CMsgDOTAWeekendTourneyParticipationDetails::IsInitialized() const {
return true;
}
void CMsgDOTAWeekendTourneyParticipationDetails::Swap(CMsgDOTAWeekendTourneyParticipationDetails* other) {
if (other != this) {
divisions_.Swap(&other->divisions_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CMsgDOTAWeekendTourneyParticipationDetails::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CMsgDOTAWeekendTourneyParticipationDetails_descriptor_;
metadata.reflection = CMsgDOTAWeekendTourneyParticipationDetails_reflection_;
return metadata;
}
// @@protoc_insertion_point(namespace_scope)
// @@protoc_insertion_point(global_scope)
| 37.253776 | 169 | 0.704239 | devilesk |
7b23219fe75d1827b0eabdad7f5136eb52a067cb | 12,913 | cpp | C++ | sfizz/Synth.cpp | falkTX/sfizz | 7f26b53cb3878065e83f424001be8b2ded3c5306 | [
"BSD-2-Clause"
] | 1 | 2020-01-06T20:56:21.000Z | 2020-01-06T20:56:21.000Z | sfizz/Synth.cpp | falkTX/sfizz | 7f26b53cb3878065e83f424001be8b2ded3c5306 | [
"BSD-2-Clause"
] | null | null | null | sfizz/Synth.cpp | falkTX/sfizz | 7f26b53cb3878065e83f424001be8b2ded3c5306 | [
"BSD-2-Clause"
] | null | null | null | // Copyright (c) 2019, Paul Ferrand
// All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// 1. Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "Synth.h"
#include "Debug.h"
#include "ScopedFTZ.h"
#include "StringViewHelpers.h"
#include "absl/algorithm/container.h"
#include <algorithm>
#include <iostream>
#include <utility>
sfz::Synth::Synth()
{
for (int i = 0; i < config::numVoices; ++i)
voices.push_back(std::make_unique<Voice>(ccState));
}
void sfz::Synth::callback(std::string_view header, const std::vector<Opcode>& members)
{
switch (hash(header)) {
case hash("global"):
// We shouldn't have multiple global headers in file
ASSERT(!hasGlobal);
globalOpcodes = members;
handleGlobalOpcodes(members);
hasGlobal = true;
break;
case hash("control"):
// We shouldn't have multiple control headers in file
ASSERT(!hasControl)
hasControl = true;
handleControlOpcodes(members);
break;
case hash("master"):
masterOpcodes = members;
numMasters++;
break;
case hash("group"):
groupOpcodes = members;
numGroups++;
break;
case hash("region"):
buildRegion(members);
break;
case hash("curve"):
// TODO: implement curves
numCurves++;
break;
case hash("effect"):
// TODO: implement effects
break;
default:
std::cerr << "Unknown header: " << header << '\n';
}
}
void sfz::Synth::buildRegion(const std::vector<Opcode>& regionOpcodes)
{
auto lastRegion = std::make_unique<Region>();
auto parseOpcodes = [&](const auto& opcodes) {
for (auto& opcode : opcodes) {
const auto unknown = absl::c_find_if(unknownOpcodes, [&](std::string_view sv) { return sv.compare(opcode.opcode) == 0; });
if (unknown != unknownOpcodes.end()) {
continue;
}
if (!lastRegion->parseOpcode(opcode))
unknownOpcodes.insert(opcode.opcode);
}
};
parseOpcodes(globalOpcodes);
parseOpcodes(masterOpcodes);
parseOpcodes(groupOpcodes);
parseOpcodes(regionOpcodes);
regions.push_back(std::move(lastRegion));
}
void sfz::Synth::clear()
{
hasGlobal = false;
hasControl = false;
numGroups = 0;
numMasters = 0;
numCurves = 0;
fileTicket = -1;
defaultSwitch = std::nullopt;
for (auto& state : ccState)
state = 0;
ccNames.clear();
globalOpcodes.clear();
masterOpcodes.clear();
groupOpcodes.clear();
regions.clear();
}
void sfz::Synth::handleGlobalOpcodes(const std::vector<Opcode>& members)
{
for (auto& member : members) {
switch (hash(member.opcode)) {
case hash("sw_default"):
setValueFromOpcode(member, defaultSwitch, Default::keyRange);
break;
}
}
}
void sfz::Synth::handleControlOpcodes(const std::vector<Opcode>& members)
{
for (auto& member : members) {
switch (hash(member.opcode)) {
case hash("set_cc"):
if (member.parameter && Default::ccRange.containsWithEnd(*member.parameter))
setValueFromOpcode(member, ccState[*member.parameter], Default::ccRange);
break;
case hash("label_cc"):
if (member.parameter && Default::ccRange.containsWithEnd(*member.parameter))
ccNames.emplace_back(*member.parameter, member.value);
break;
case hash("default_path"):
if (auto newPath = std::filesystem::path(member.value); std::filesystem::exists(newPath))
rootDirectory = newPath;
break;
default:
// Unsupported control opcode
ASSERTFALSE;
}
}
}
void addEndpointsToVelocityCurve(sfz::Region& region)
{
if (region.velocityPoints.size() > 0) {
absl::c_sort(region.velocityPoints, [](auto& lhs, auto& rhs) { return lhs.first < rhs.first; });
if (region.ampVeltrack > 0) {
if (region.velocityPoints.back().first != sfz::Default::velocityRange.getEnd())
region.velocityPoints.push_back(std::make_pair<int, float>(127, 1.0f));
if (region.velocityPoints.front().first != sfz::Default::velocityRange.getStart())
region.velocityPoints.insert(region.velocityPoints.begin(), std::make_pair<int, float>(0, 0.0f));
} else {
if (region.velocityPoints.front().first != sfz::Default::velocityRange.getEnd())
region.velocityPoints.insert(region.velocityPoints.begin(), std::make_pair<int, float>(127, 0.0f));
if (region.velocityPoints.back().first != sfz::Default::velocityRange.getStart())
region.velocityPoints.push_back(std::make_pair<int, float>(0, 1.0f));
}
}
}
bool sfz::Synth::loadSfzFile(const std::filesystem::path& filename)
{
clear();
auto parserReturned = sfz::Parser::loadSfzFile(filename);
if (!parserReturned)
return false;
if (regions.empty())
return false;
filePool.setRootDirectory(this->rootDirectory);
auto lastRegion = regions.end() - 1;
auto currentRegion = regions.begin();
while (currentRegion <= lastRegion) {
auto region = currentRegion->get();
if (!region->isGenerator()) {
auto fileInformation = filePool.getFileInformation(region->sample);
if (!fileInformation) {
DBG("Removing the region with sample " << region->sample);
std::iter_swap(currentRegion, lastRegion);
lastRegion--;
continue;
}
region->sampleEnd = std::min(region->sampleEnd, fileInformation->end);
region->loopRange.shrinkIfSmaller(fileInformation->loopBegin, fileInformation->loopEnd);
region->preloadedData = fileInformation->preloadedData;
region->sampleRate = fileInformation->sampleRate;
}
for (auto note = region->keyRange.getStart(); note <= region->keyRange.getEnd(); note++)
noteActivationLists[note].push_back(region);
for (auto cc = region->keyRange.getStart(); cc <= region->keyRange.getEnd(); cc++)
ccActivationLists[cc].push_back(region);
// Defaults
for (int ccIndex = 1; ccIndex < 128; ccIndex++)
region->registerCC(region->channelRange.getStart(), ccIndex, ccState[ccIndex]);
if (defaultSwitch) {
region->registerNoteOn(region->channelRange.getStart(), *defaultSwitch, 127, 1.0);
region->registerNoteOff(region->channelRange.getStart(), *defaultSwitch, 0, 1.0);
}
addEndpointsToVelocityCurve(*region);
region->registerPitchWheel(region->channelRange.getStart(), 0);
region->registerAftertouch(region->channelRange.getStart(), 0);
region->registerTempo(2.0f);
currentRegion++;
}
DBG("Removed " << regions.size() - std::distance(regions.begin(), lastRegion) - 1 << " out of " << regions.size() << " regions.");
regions.resize(std::distance(regions.begin(), lastRegion) + 1);
return parserReturned;
}
sfz::Voice* sfz::Synth::findFreeVoice() noexcept
{
auto freeVoice = absl::c_find_if(voices, [](const auto& voice) { return voice->isFree(); });
if (freeVoice == voices.end()) {
DBG("Voices are overloaded, can't start a new note");
return {};
}
return freeVoice->get();
}
void sfz::Synth::getNumActiveVoices() const noexcept
{
auto activeVoices { 0 };
for (const auto& voice : voices) {
if (!voice->isFree())
activeVoices++;
}
}
void sfz::Synth::garbageCollect() noexcept
{
for (auto& voice : voices) {
voice->garbageCollect();
}
}
void sfz::Synth::setSamplesPerBlock(int samplesPerBlock) noexcept
{
this->samplesPerBlock = samplesPerBlock;
this->tempBuffer.resize(samplesPerBlock);
for (auto& voice : voices)
voice->setSamplesPerBlock(samplesPerBlock);
}
void sfz::Synth::setSampleRate(float sampleRate) noexcept
{
this->sampleRate = sampleRate;
for (auto& voice : voices)
voice->setSampleRate(sampleRate);
}
void sfz::Synth::renderBlock(AudioSpan<float> buffer) noexcept
{
ScopedFTZ ftz;
buffer.fill(0.0f);
auto tempSpan = AudioSpan<float>(tempBuffer).first(buffer.getNumFrames());
for (auto& voice : voices) {
voice->renderBlock(tempSpan);
buffer.add(tempSpan);
}
}
void sfz::Synth::noteOn(int delay, int channel, int noteNumber, uint8_t velocity) noexcept
{
auto randValue = randNoteDistribution(Random::randomGenerator);
for (auto& region : regions) {
if (region->registerNoteOn(channel, noteNumber, velocity, randValue)) {
for (auto& voice : voices) {
if (voice->checkOffGroup(delay, region->group))
noteOff(delay, voice->getTriggerChannel(), voice->getTriggerNumber(), 0);
}
auto voice = findFreeVoice();
if (voice == nullptr)
continue;
voice->startVoice(region.get(), delay, channel, noteNumber, velocity, Voice::TriggerType::NoteOn);
if (!region->isGenerator()) {
voice->expectFileData(fileTicket);
filePool.enqueueLoading(voice, region->sample, region->trueSampleEnd(), fileTicket++);
}
}
}
}
void sfz::Synth::noteOff(int delay, int channel, int noteNumber, uint8_t velocity) noexcept
{
auto randValue = randNoteDistribution(Random::randomGenerator);
for (auto& voice : voices)
voice->registerNoteOff(delay, channel, noteNumber, velocity);
for (auto& region : regions) {
if (region->registerNoteOff(channel, noteNumber, velocity, randValue)) {
auto voice = findFreeVoice();
if (voice == nullptr)
continue;
voice->startVoice(region.get(), delay, channel, noteNumber, velocity, Voice::TriggerType::NoteOff);
if (!region->isGenerator()) {
voice->expectFileData(fileTicket);
filePool.enqueueLoading(voice, region->sample, region->trueSampleEnd(), fileTicket++);
}
}
}
}
void sfz::Synth::cc(int delay, int channel, int ccNumber, uint8_t ccValue) noexcept
{
for (auto& voice : voices)
voice->registerCC(delay, channel, ccNumber, ccValue);
ccState[ccNumber] = ccValue;
for (auto& region : regions) {
if (region->registerCC(channel, ccNumber, ccValue)) {
auto voice = findFreeVoice();
if (voice == nullptr)
continue;
voice->startVoice(region.get(), delay, channel, ccNumber, ccValue, Voice::TriggerType::CC);
if (!region->isGenerator()) {
voice->expectFileData(fileTicket);
filePool.enqueueLoading(voice, region->sample, region->trueSampleEnd(), fileTicket++);
}
}
}
}
int sfz::Synth::getNumRegions() const noexcept
{
return static_cast<int>(regions.size());
}
int sfz::Synth::getNumGroups() const noexcept
{
return numGroups;
}
int sfz::Synth::getNumMasters() const noexcept
{
return numMasters;
}
int sfz::Synth::getNumCurves() const noexcept
{
return numCurves;
}
const sfz::Region* sfz::Synth::getRegionView(int idx) const noexcept
{
return (size_t)idx < regions.size() ? regions[idx].get() : nullptr;
}
std::set<std::string_view> sfz::Synth::getUnknownOpcodes() const noexcept
{
return unknownOpcodes;
}
size_t sfz::Synth::getNumPreloadedSamples() const noexcept
{
return filePool.getNumPreloadedSamples();
} | 34.251989 | 134 | 0.634167 | falkTX |
7b32a25bf67fb77fa18c115825f2556b98464d20 | 664 | hpp | C++ | lib/Croissant/Tags.hpp | Baduit/Croissant | 913ed121f6605314178dd231b5678f974993f99e | [
"MIT"
] | 4 | 2020-12-04T06:46:09.000Z | 2020-12-10T21:37:59.000Z | lib/Croissant/Tags.hpp | Baduit/Croissant | 913ed121f6605314178dd231b5678f974993f99e | [
"MIT"
] | null | null | null | lib/Croissant/Tags.hpp | Baduit/Croissant | 913ed121f6605314178dd231b5678f974993f99e | [
"MIT"
] | null | null | null | #pragma once
#include <concepts>
#include <type_traits>
#include <utility>
namespace Croissant
{
struct EqualityTag {};
struct LessTag {};
struct MoreTag {};
template <typename T>
concept ComparisonTag = std::same_as<T, EqualityTag> || std::same_as<T, LessTag> || std::same_as<T, MoreTag>;
struct ResultTag {};
template <typename T>
concept NotResult = (!std::is_base_of<ResultTag, T>::value);
struct ValueTag {};
template <typename T>
concept IsValue = (std::is_base_of<ValueTag, T>::value);
template <typename T>
concept NotValue = (!IsValue<T>);
template <typename T>
concept NotValueNorResult = NotValue<T> && NotResult<T>;
} // namespace Croissant | 19.529412 | 109 | 0.721386 | Baduit |
7b33a7a0b9e4cd7a2ac9d4a216d250c57e2895cb | 2,270 | hpp | C++ | rectilinear_grid.hpp | RaphaelPoncet/2016-macs2-projet-hpc | 1ae8936113ee24f0b49a303627d4fd5bc045f78d | [
"Apache-2.0"
] | 2 | 2017-07-19T09:14:20.000Z | 2017-09-17T11:39:52.000Z | rectilinear_grid.hpp | RaphaelPoncet/2016-macs2-projet-hpc | 1ae8936113ee24f0b49a303627d4fd5bc045f78d | [
"Apache-2.0"
] | null | null | null | rectilinear_grid.hpp | RaphaelPoncet/2016-macs2-projet-hpc | 1ae8936113ee24f0b49a303627d4fd5bc045f78d | [
"Apache-2.0"
] | null | null | null | // Copyright 2016 Raphael Poncet.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef RECTILINEAR_GRID_HPP
#define RECTILINEAR_GRID_HPP
#include <fstream>
#include <vector>
// Rectilinear 3D grid (also handles 2D as a particular case).
class RectilinearGrid3D {
public:
RectilinearGrid3D();
RectilinearGrid3D(RealT x_fast_min, RealT x_fast_max, int n_fast,
RealT x_medium_min, RealT x_medium_max, int n_medium,
RealT x_slow_min, RealT x_slow_max, int n_slow);
int n_fast() const { return m_n_fast; }
int n_medium() const { return m_n_medium; }
int n_slow() const { return m_n_slow; }
int x_fast_min() const {return m_x_fast_min; }
int x_fast_max() const {return m_x_fast_max; }
int x_medium_min() const {return m_x_medium_min; }
int x_medium_max() const {return m_x_medium_max; }
int x_slow_min() const {return m_x_slow_min; }
int x_slow_max() const {return m_x_slow_max; }
RealT dx_fast() const;
RealT dx_medium() const;
RealT dx_slow() const;
std::vector<RealT>fast_coordinates() const {return m_fast_coordinates;}
std::vector<RealT>medium_coordinates() const {return m_medium_coordinates;}
std::vector<RealT>slow_coordinates() const {return m_slow_coordinates;}
void WriteHeaderVTKXml(std::ofstream* os_ptr) const;
void WriteFooterVTKXml(std::ofstream* os_ptr) const;
void WriteVTKXmlAscii(std::ofstream* os_ptr) const;
private:
int m_n_fast;
int m_n_medium;
int m_n_slow;
RealT m_x_fast_min;
RealT m_x_fast_max;
RealT m_x_medium_min;
RealT m_x_medium_max;
RealT m_x_slow_min;
RealT m_x_slow_max;
std::vector<RealT> m_fast_coordinates;
std::vector<RealT> m_medium_coordinates;
std::vector<RealT> m_slow_coordinates;
};
#endif // RECTILINEAR_GRID_HPP
| 36.612903 | 77 | 0.748018 | RaphaelPoncet |
7b360adfe7ca4a74e1e03533a59b7d42467e4c75 | 1,813 | cpp | C++ | RenSharp/RenSharpHostControl.cpp | mpforums/RenSharp | 5b3fb8bff2a1772a82a4148bcf3e1265a11aa097 | [
"Apache-2.0"
] | 1 | 2021-10-04T02:34:33.000Z | 2021-10-04T02:34:33.000Z | RenSharp/RenSharpHostControl.cpp | TheUnstoppable/RenSharp | 2a123c6018c18f3fc73501737d600e291ac3afa7 | [
"Apache-2.0"
] | 9 | 2019-07-03T19:19:59.000Z | 2020-03-02T22:00:21.000Z | RenSharp/RenSharpHostControl.cpp | TheUnstoppable/RenSharp | 2a123c6018c18f3fc73501737d600e291ac3afa7 | [
"Apache-2.0"
] | 2 | 2019-08-14T08:37:36.000Z | 2020-09-29T06:44:26.000Z | /*
Copyright 2020 Neijwiert
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "General.h"
#include "RenSharpHostControl.h"
RenSharpHostControl::RenSharpHostControl()
: refCount(0), defaultDomainManager(nullptr)
{
}
RenSharpHostControl::~RenSharpHostControl()
{
if (defaultDomainManager != nullptr)
{
defaultDomainManager->Release();
defaultDomainManager = nullptr;
}
}
HRESULT RenSharpHostControl::GetHostManager(REFIID id, void **ppHostManager)
{
*ppHostManager = nullptr;
return E_NOINTERFACE;
}
HRESULT RenSharpHostControl::SetAppDomainManager(DWORD dwAppDomainID, IUnknown *pUnkAppDomainManager)
{
HRESULT hr = pUnkAppDomainManager->QueryInterface(__uuidof(RenSharpInterface), reinterpret_cast<PVOID *>(&defaultDomainManager));
return hr;
}
RenSharpInterface *RenSharpHostControl::GetRenSharpInterface()
{
if (defaultDomainManager != nullptr)
{
defaultDomainManager->AddRef();
}
return defaultDomainManager;
}
HRESULT RenSharpHostControl::QueryInterface(const IID &iid, void **ppv)
{
if (ppv == nullptr)
{
return E_POINTER;
}
*ppv = this;
AddRef();
return S_OK;
}
ULONG RenSharpHostControl::AddRef()
{
return InterlockedIncrement(&refCount);
}
ULONG RenSharpHostControl::Release()
{
if (InterlockedDecrement(&refCount) == 0)
{
delete this;
return 0;
}
return refCount;
} | 20.83908 | 130 | 0.766133 | mpforums |
7b3660a00916f4938b3cf90c5f2ddc6acd1da73e | 4,008 | cpp | C++ | Map.cpp | aleksha/electronic-signal | 158b09a4bd9cc9760f94110042c0405a11795e98 | [
"MIT"
] | null | null | null | Map.cpp | aleksha/electronic-signal | 158b09a4bd9cc9760f94110042c0405a11795e98 | [
"MIT"
] | null | null | null | Map.cpp | aleksha/electronic-signal | 158b09a4bd9cc9760f94110042c0405a11795e98 | [
"MIT"
] | null | null | null | // function to calculate induced charge at a ring (radius r) with
// step_size width induced by an electron placed at a distance h from anode.
double sigma(double h, double r){
double sigma = 0.;
double term = 1.;
int k=Nsum;
if(h<0.2) k = 10*Nsum;
for(int n=1;n<k;n++){
term = 1.;
term *= TMath::BesselK0(n*pi*r/grid_anode_distance)*n ;
term *= TMath::Sin (n*pi*h/grid_anode_distance);
sigma += term;
}
sigma *= 2.*pi*r*step_size / pow(grid_anode_distance,2);
return sigma;
}
int MapR(){
// Create maps of charge and currtent for thin rings (width=step_size)
// arount zero point/ This map will be later used to create a
// current mup with a givaen anode segmentetion
std::cout << "STATUS : Creating induced charge distribution\n";
int Nch = 0;
double current_time=0;
int Nr;
for(double h=10.; h>0 ; h-=drift_velocity*channel_width ){
std::cout << "\t Channel=" << Nch << " Time=" << current_time
<< " h=" << h << std::endl;
Nr=0;
for(double r=step_size*0.5; r<r_map; r+=step_size ){
charge[Nr][Nch] = sigma(h,r);
Nr++;
}
c_time[Nch] = current_time;
current_time += channel_width;
Nch++;
}
for(int bin=0;bin<Nch-1;bin++){
i_time[bin] = 0.5*(c_time[bin]+c_time[bin+1]);
for(int rbin=0;rbin<Nr;rbin++){
current[rbin][bin] = (charge[rbin][bin+1] - charge[rbin][bin]) / channel_width;
}
}
return Nch;
}
void WriteMapR(int Nch){
ofstream file_charge;
file_charge.open ("CHARGE_MapR.txt");
file_charge << Nch << "\n";
file_charge << r_map << "\n";
file_charge << step_size << "\n";
file_charge << channel_width << "\n";
file_charge << grid_anode_distance << "\n";
file_charge << drift_velocity << "\n";
for(int bin=0;bin<Nch;bin++){
file_charge << c_time[bin];
for(int rbin=0;rbin<N_R;rbin++){
file_charge << " " << charge[rbin][bin] ;
}
file_charge << "\n";
}
file_charge.close();
}
int ReadMapR(){
std::ifstream file_charge("CHARGE_MapR.txt" , std::ios::in);
int Nch ; file_charge >> Nch ;
double f_r_map ; file_charge >> f_r_map ;
double f_step_size ; file_charge >> f_step_size ;
double f_channel_width ; file_charge >> f_channel_width ;
double f_grid_anode_distance ; file_charge >> f_grid_anode_distance ;
double f_drift_velocity ; file_charge >> f_drift_velocity ;
bool AbortIt = false;
if (f_r_map != r_map) AbortIt = true ;
if (f_step_size != step_size) AbortIt = true ;
if (f_channel_width != channel_width) AbortIt = true ;
if (f_grid_anode_distance != grid_anode_distance) AbortIt = true ;
if (f_drift_velocity != drift_velocity) AbortIt = true ;
if( AbortIt ){
std::cout << "ABORTED: Parameters in CHARGE_MapR.txt DON'T FIT ones in Parameters.h\n";
gSystem->Exit(1);
}
for(int bin=0;bin<Nch;bin++){
file_charge >> c_time[bin];
for(int rbin=0;rbin<N_R;rbin++){
file_charge >> charge[rbin][bin] ;
}
}
file_charge.close();
for(int bin=0;bin<Nch-1;bin++){
i_time[bin] = 0.5*(c_time[bin]+c_time[bin+1]);
for(int rbin=0;rbin<N_R;rbin++){
current[rbin][bin] = (charge[rbin][bin+1] - charge[rbin][bin]) / channel_width;
}
}
return Nch;
}
void DrawMapR(int Nch, int to_draw=0){
TGraph* gr = new TGraph(Nch , c_time, charge [ to_draw ] );
TGraph* gc = new TGraph(Nch-1, i_time, current[ to_draw ] );
gr->SetMarkerStyle(20);
gc->SetMarkerStyle(24);
gr->SetMinimum(0);
gr->SetTitle(" ");
gc->SetTitle(" ");
gr->GetXaxis()->SetTitle("time, ns");
gc->GetXaxis()->SetTitle("time, ns");
gr->GetYaxis()->SetTitle("induced charge, a.u.");
gc->GetYaxis()->SetTitle("current, a.u.");
TCanvas* canv = new TCanvas("canv","canv",800,800);
gr->Draw("APL");
canv->Print("TEMP.png");
gc->Draw("APL");
canv->Print("TEMP2.png");
canv->Close();
}
| 28.834532 | 91 | 0.601796 | aleksha |
7b399e639c1bd498deb946063aadbe56aafbd97e | 1,570 | cpp | C++ | encoder/vaapiencoder_host.cpp | zhongcong/libyami | 0118c0c78cd5a0208da67024cb9c26b61af67851 | [
"Intel"
] | null | null | null | encoder/vaapiencoder_host.cpp | zhongcong/libyami | 0118c0c78cd5a0208da67024cb9c26b61af67851 | [
"Intel"
] | null | null | null | encoder/vaapiencoder_host.cpp | zhongcong/libyami | 0118c0c78cd5a0208da67024cb9c26b61af67851 | [
"Intel"
] | null | null | null | /*
* vaapiencoder_host.cpp - create specific type of video encoder
*
* Copyright (C) 2013-2014 Intel Corporation
* Author: Xu Guangxin <[email protected]>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1
* of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
#include "common/log.h"
#include "interface/VideoEncoderHost.h"
#include "vaapiencoder_factory.h"
using namespace YamiMediaCodec;
extern "C" {
IVideoEncoder* createVideoEncoder(const char* mimeType) {
yamiTraceInit();
if (!mimeType) {
ERROR("NULL mime type.");
return NULL;
}
VaapiEncoderFactory::Type enc = VaapiEncoderFactory::create(mimeType);
if (!enc)
ERROR("Failed to create encoder for mimeType: '%s'", mimeType);
else
INFO("Created encoder for mimeType: '%s'", mimeType);
return enc;
}
void releaseVideoEncoder(IVideoEncoder* p) {
delete p;
}
} // extern "C"
| 29.074074 | 74 | 0.703822 | zhongcong |
7b39b29f96a2e4e7d48ab934b8e4691fc66f23a4 | 1,865 | cpp | C++ | src/circle_midpoint.cpp | MangoMaster/raster_graphics | b40b2731b295ed2d743b59ff2872c81a9faf5130 | [
"MIT"
] | null | null | null | src/circle_midpoint.cpp | MangoMaster/raster_graphics | b40b2731b295ed2d743b59ff2872c81a9faf5130 | [
"MIT"
] | null | null | null | src/circle_midpoint.cpp | MangoMaster/raster_graphics | b40b2731b295ed2d743b59ff2872c81a9faf5130 | [
"MIT"
] | null | null | null | // encoding: utf-8
#include <opencv2/opencv.hpp>
#include "main.h"
// 利用圆的八对称性并平移,一次显示圆上8个点
// (x, y)为以原点为圆心、半径为radius的圆弧上一点的坐标
void circle8Translation(cv::Mat &image, int x, int y, cv::Point center, const cv::Scalar &color)
{
drawPixel(image, center.x + x, center.y + y, color);
drawPixel(image, center.x + y, center.y + x, color);
drawPixel(image, center.x - x, center.y + y, color);
drawPixel(image, center.x + y, center.y - x, color);
drawPixel(image, center.x + x, center.y - y, color);
drawPixel(image, center.x - y, center.y + x, color);
drawPixel(image, center.x - x, center.y - y, color);
drawPixel(image, center.x - y, center.y - x, color);
// drawPixel(image, x, y, color);
// drawPixel(image, y - center.y + center.x, x - center.x + center.y, color);
// drawPixel(image, 2 * center.x - x, y, color);
// drawPixel(image, y - center.y + center.x, center.x - x + center.y, color);
// drawPixel(image, x, 2 * center.y - y, color);
// drawPixel(image, center.y - y + center.x, x - center.x + center.y, color);
// drawPixel(image, 2 * center.x - x, 2 * center.y - y, color);
// drawPixel(image, center.y - y + center.x, center.x - x + center.y, color);
}
// 中点画圆算法
void circleMidPoint(cv::Mat &image, cv::Point center, int radius, const cv::Scalar &color)
{
assert(image.type() == CV_8UC3);
assert(radius >= 0);
// (x, y)在以原点为圆心、半径为radius的圆上
int x = 0;
int y = radius;
// e = 4 * d, d = (x+1)^2 + (y-0.5)^2 - radius^2
// 改用整数以加速
int e = 5 - 4 * radius;
while (x <= y)
{
// Draw pixel
circle8Translation(image, x, y, center, color);
// Update x, y and d
if (e < 0)
{
e += 8 * x + 12;
}
else
{
e += 8 * (x - y) + 20;
--y;
}
++x;
}
}
| 32.719298 | 96 | 0.549062 | MangoMaster |
7b3b0128a18e4243161b60398afdbb5c4f922abf | 2,998 | hpp | C++ | mc/rtm.hpp | Juelin-Liu/GraphSetIntersection | 359fc0a377d9b760a5198e2f7a14eab814e48961 | [
"MIT"
] | null | null | null | mc/rtm.hpp | Juelin-Liu/GraphSetIntersection | 359fc0a377d9b760a5198e2f7a14eab814e48961 | [
"MIT"
] | null | null | null | mc/rtm.hpp | Juelin-Liu/GraphSetIntersection | 359fc0a377d9b760a5198e2f7a14eab814e48961 | [
"MIT"
] | null | null | null | #ifndef _RTM_H_
#define _RTM_H_
#include "util.hpp"
#include "table.h"
namespace RTM_AVX2
{
typedef uint8_t Bitmap;
const Bitmap BITMASK = 0xff;
using namespace AVX2_DECODE_TABLE;
/**
* @param deg number of neighbors
* @return size of the bitmap vector (bytes)
* */
int get_vector_size(int deg);
/**
* @param bitmap triangle intersection vector to be expanded
* @param out output index place
* @param vector_size of length of the bitmap
* */
int expandToIndex(uint8_t *bitmap, int *out, int vector_size);
/**
* @param bitmap triangle intersection vector to be expanded
* @param out output vertex id place
* @param vector_size of length of the bitmap
* @param id_list start of the adjacancy list
* */
int expandToID(uint8_t *bitmap, int *out, int vector_size, int *id_list);
/**
*
* @note set intersection of two list, vec_a and vec_b
* @return number common vertex
* @return bitvec the position of common vertex in bitmap format relative to vec_a
* @param vec_a first list
* @param size_a size of first list
* @param vec_b second lsit
* @param size_b size of the second list
* */
int mark_intersect(int *vec_a, int size_a, int *vec_b, int size_b, uint8_t *bitvec);
/**
*
* @note bitwise and operation of two bitstream
* @return out the result of two intersection
* */
void intersect(uint8_t *bitmap_a, uint8_t *bitmap_b, uint8_t *out, int vector_size); // bitwise and operation
void mask_intersect(uint8_t *bitmap_a, uint8_t *bitmap_b, uint8_t mask, int pos, uint8_t *out); // bitwise and operation with mask applied
/**
* @param bitmap the coming bitstream
* @param out place that holds the indices in the bitmap
* @param start starting point of the bitmap (bits)
* @param end end place of the bitmap (bits)
* @return number of indices
* */
int expandToIndex(uint8_t *bitmap, int *out, int start, int end);
/**
* @param bitmap the coming bitstream
* @param out place that holds the vertex ids in the bitmap
* @param start starting point of the bitmap (bits)
* @param end end place of the bitmap (bits)
* @param id_list the id_list corresponds to the bitmap
* @return number of indices
* */
int expandToID(uint8_t *bitmap, int *out, int *id_list, int start, int end);
/**
* @param bitmap coming bitstream
* @param vector_size length of the bitstream
* @return number of 1s in the bitstream
* */
int count_bitmap(uint8_t *bitmap, int vector_size);
/**
* @param bitmap coming bitstream
* @param vector_size length of the bitstream
* @param start starting point of the bitmap (bits)
* @param end end place of the bitmap (bits)
* @return number of 1s in the bitstream
* */
int count_bitmap(uint8_t *bitmap, int start, int end);
/**
* @param bitmap coming bitstream
* @param vector_size number of bitmap to exam
* @return true if all the bits are zero, false otherwise
* */
bool all_zero(Bitmap *bitmap, int vector_size);
}
#endif | 31.893617 | 142 | 0.700467 | Juelin-Liu |
7b3f8627923ce5ae183f137280f13dd556e8e217 | 2,408 | cpp | C++ | engine/src/Scripting/Transformation.cpp | BigETI/NoLifeNoCry | 70ac2498b5e740b2b348771ef9617dea1eed7f9c | [
"MIT"
] | 5 | 2020-11-07T23:38:48.000Z | 2021-12-07T11:03:22.000Z | engine/src/Scripting/Transformation.cpp | BigETI/NoLifeNoCry | 70ac2498b5e740b2b348771ef9617dea1eed7f9c | [
"MIT"
] | null | null | null | engine/src/Scripting/Transformation.cpp | BigETI/NoLifeNoCry | 70ac2498b5e740b2b348771ef9617dea1eed7f9c | [
"MIT"
] | null | null | null | #include <glm/gtx/matrix_decompose.hpp>
#include <Scripting/Transformation.hpp>
DirtMachine::Scripting::Transformation::Transformation(DirtMachine::Scripting::Transformation* parent) :
DirtMachine::Scripting::Behaviour(false),
parent(parent),
transformation()
{
// ...
}
DirtMachine::Scripting::Transformation::~Transformation()
{
// ...
}
glm::mat4x4 DirtMachine::Scripting::Transformation::GetLocalTransformation() const
{
return transformation;
}
void DirtMachine::Scripting::Transformation::SetLocalTransformation(const glm::mat4x4& newLocalTransformation)
{
transformation = newLocalTransformation;
}
glm::mat4x4 DirtMachine::Scripting::Transformation::GetLocalSpaceToWorldSpaceTransformation() const
{
return (parent ? parent->GetLocalSpaceToWorldSpaceTransformation() : glm::mat4x4()) * transformation;
}
glm::mat4x4 DirtMachine::Scripting::Transformation::GetWorldSpaceToLocalSpaceTransformation() const
{
return transformation / (parent ? parent->GetWorldSpaceToLocalSpaceTransformation() : glm::mat4x4());
}
glm::vec3 DirtMachine::Scripting::Transformation::GetLocalPosition() const
{
glm::vec3 scale;
glm::quat orientation;
glm::vec3 translation;
glm::vec3 skew;
glm::vec4 perspective;
glm::decompose(transformation, scale, orientation, translation, skew, perspective);
return translation;
}
void DirtMachine::Scripting::Transformation::SetLocalPosition(const glm::vec3& newLocalPosition)
{
// TODO
}
glm::vec3 DirtMachine::Scripting::Transformation::GetGlobalPosition() const
{
// TODO
return glm::vec3();
}
void DirtMachine::Scripting::Transformation::SetGlobalPosition(const glm::vec3& newGlobalPosition)
{
// TODO
}
glm::quat DirtMachine::Scripting::Transformation::GetLocalRotation() const
{
glm::vec3 scale;
glm::quat orientation;
glm::vec3 translation;
glm::vec3 skew;
glm::vec4 perspective;
glm::decompose(transformation, scale, orientation, translation, skew, perspective);
return orientation;
}
void DirtMachine::Scripting::Transformation::SetLocalRotation(const glm::quat& newLocalRotation)
{
// TODO
}
glm::quat DirtMachine::Scripting::Transformation::GetGlobalRotation() const
{
// TODO
return glm::quat();
}
void DirtMachine::Scripting::Transformation::SetGlobalRotation(const glm::quat& newGlobalRotation)
{
// TODO
}
DirtMachine::Scripting::Transformation* DirtMachine::Scripting::Transformation::GetParent() const
{
return parent;
}
| 25.347368 | 110 | 0.775332 | BigETI |
7b444d9256199464c7999447ece2d312b6752943 | 264 | cpp | C++ | Source/IVoxel/Private/WorldGenerator/FlatWorldGenerator.cpp | kpqi5858/IVoxel | 421324dd840fcf27f9da668e1c4d4e7af9c2a983 | [
"MIT"
] | 1 | 2018-03-11T12:26:58.000Z | 2018-03-11T12:26:58.000Z | Source/IVoxel/Private/WorldGenerator/FlatWorldGenerator.cpp | kpqi5858/IVoxel | 421324dd840fcf27f9da668e1c4d4e7af9c2a983 | [
"MIT"
] | null | null | null | Source/IVoxel/Private/WorldGenerator/FlatWorldGenerator.cpp | kpqi5858/IVoxel | 421324dd840fcf27f9da668e1c4d4e7af9c2a983 | [
"MIT"
] | 1 | 2021-11-13T17:55:49.000Z | 2021-11-13T17:55:49.000Z | #include "FlatWorldGenerator.h"
UFlatWorldGenerator::UFlatWorldGenerator()
{
}
void UFlatWorldGenerator::GetValueAndColor(FIntVector Location, bool &Value, FColor &Color)
{
if (Location.Z < 10)
{
Value = true;
Color = FColor(1, 0, 0, 1);
}
else
{
}
} | 14.666667 | 91 | 0.689394 | kpqi5858 |
7b452e06138221a3af923eb35fd936814eddee65 | 2,026 | cpp | C++ | Developments/solidity-develop/test/boostTest.cpp | jansenbarabona/NFT-Game-Development | 49bf6593925123f0212dac13badd609be3866561 | [
"MIT"
] | null | null | null | Developments/solidity-develop/test/boostTest.cpp | jansenbarabona/NFT-Game-Development | 49bf6593925123f0212dac13badd609be3866561 | [
"MIT"
] | null | null | null | Developments/solidity-develop/test/boostTest.cpp | jansenbarabona/NFT-Game-Development | 49bf6593925123f0212dac13badd609be3866561 | [
"MIT"
] | null | null | null | /*
This file is part of solidity.
solidity is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
solidity is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file boostTest.cpp
* @author Marko Simovic <[email protected]>
* @date 2014
* Stub for generating main boost.test module.
* Original code taken from boost sources.
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable:4535) // calling _set_se_translator requires /EHa
#endif
#include <boost/test/included/unit_test.hpp>
#if defined(_MSC_VER)
#pragma warning(pop)
#endif
#pragma GCC diagnostic pop
#include <test/TestHelper.h>
using namespace boost::unit_test;
namespace
{
void removeTestSuite(std::string const& _name)
{
master_test_suite_t& master = framework::master_test_suite();
auto id = master.get(_name);
assert(id != INV_TEST_UNIT_ID);
master.remove(id);
}
}
test_suite* init_unit_test_suite( int /*argc*/, char* /*argv*/[] )
{
master_test_suite_t& master = framework::master_test_suite();
master.p_name.value = "SolidityTests";
if (dev::test::Options::get().disableIPC)
{
for (auto suite: {
"ABIEncoderTest",
"SolidityAuctionRegistrar",
"SolidityFixedFeeRegistrar",
"SolidityWallet",
"LLLERC20",
"LLLENS",
"LLLEndToEndTest",
"GasMeterTests",
"SolidityEndToEndTest",
"SolidityOptimizer"
})
removeTestSuite(suite);
}
if (dev::test::Options::get().disableSMT)
removeTestSuite("SMTChecker");
return 0;
}
| 25.974359 | 73 | 0.740375 | jansenbarabona |
0da55752e6a110c78d40f596f41d7fa00bfbb951 | 342 | cpp | C++ | lib/scopy.cpp | langou/latl | df838fb44a1ef5c77b57bf60bd46eaeff8db3492 | [
"BSD-3-Clause-Open-MPI"
] | 6 | 2015-12-13T09:10:11.000Z | 2022-02-09T23:18:22.000Z | lib/scopy.cpp | langou/latl | df838fb44a1ef5c77b57bf60bd46eaeff8db3492 | [
"BSD-3-Clause-Open-MPI"
] | null | null | null | lib/scopy.cpp | langou/latl | df838fb44a1ef5c77b57bf60bd46eaeff8db3492 | [
"BSD-3-Clause-Open-MPI"
] | 2 | 2019-02-01T06:46:36.000Z | 2022-02-09T23:18:24.000Z | //
// scopy.cpp
// Linear Algebra Template Library
//
// Created by Rodney James on 1/1/13.
// Copyright (c) 2013 University of Colorado Denver. All rights reserved.
//
#include "blas.h"
#include "copy.h"
using LATL::COPY;
int scopy_(int &n, float *x, int& incx, float *y, int& incy)
{
COPY<float>(n,x,incx,y,incy);
return 0;
}
| 17.1 | 74 | 0.649123 | langou |
0da794c492fd771ae15daadded850a6c0ddb4975 | 3,665 | hpp | C++ | tapl/common/ringBuffer.hpp | towardsautonomy/TAPL | 4d065b2250483bf2ea118bafa312ca893a25ca87 | [
"MIT"
] | 1 | 2021-01-05T12:53:17.000Z | 2021-01-05T12:53:17.000Z | tapl/common/ringBuffer.hpp | towardsautonomy/TAPL | 4d065b2250483bf2ea118bafa312ca893a25ca87 | [
"MIT"
] | null | null | null | tapl/common/ringBuffer.hpp | towardsautonomy/TAPL | 4d065b2250483bf2ea118bafa312ca893a25ca87 | [
"MIT"
] | null | null | null | /**
* @file ringBuffer.hpp
* @brief This file provides an implementation of a ring buffer
* @author Shubham Shrivastava
*/
#ifndef RING_BUFFER_H_
#define RING_BUFFER_H_
#include <iostream>
#include <algorithm>
#include "tapl/common/taplLog.hpp"
namespace tapl
{
/**
* @brief Ring Buffer
*/
template <typename T>
class RingBuffer {
private:
// size of the buffer
uint16_t size;
// maximum size of buffer
uint16_t max_size;
// real index of the ring buffer head
int16_t head;
// real index of the ring buffer tail
int16_t tail;
// buffer to store data
std::vector<T> buffer;
public:
// constructor
RingBuffer(uint16_t max_size)
{
// allocate memory
buffer.resize(max_size);
// set buffer size to zero
size = 0;
// set maximum size
this->max_size = max_size;
// set head and tail to zero
head = 0;
tail = 0;
}
// deconstructor
~RingBuffer() {}
// method for getting the size of the rung buffer
uint16_t getSize() {
return size;
}
// method for pushing the data at the front of the ring buffer
void push(T const data) {
buffer[head] = data;
// increment the header in circular manner
head++;
if(head >= max_size) head = 0;
// increment size
size = std::min((uint16_t)(size+1), max_size);
// setup the tail index
if(size == max_size)
{
tail = head - max_size;
if(tail < 0) tail += max_size;
}
}
// method for popping the data at the front of the ring buffer
T pop() {
// make sure atleast one data exists
if(size == 0)
{
TLOG_ERROR << "no data available to pop";
return T();
}
else
{
// decrement the head and return the data pointed by head
head--;
if(head < 0) head+= max_size;
size--;
return buffer[head];
}
}
// method for getting data at a certain index
T get(uint16_t index) {
// make sure that data requested at index exists
if(index >= size)
{
TLOG_ERROR << "index out of range";
return T();
}
else
{
// get the actual index and return data
int16_t idx = tail + index;
if(idx >= max_size)
{
idx = idx - max_size;
}
return buffer[idx];
}
}
// method for getting data pointer at a certain index
T * get_ptr(uint16_t index) {
// make sure that data requested at index exists
if(index >= size)
{
TLOG_INFO << "index = " << index << "; size = " << size;
TLOG_ERROR << "index out of range";
return (T *)NULL;
}
else
{
// get the actual index and return data pointer
int16_t idx = tail + index;
if(idx >= max_size)
{
idx = idx - max_size;
}
return &buffer[idx];
}
}
};
}
#endif /* RING_BUFFER_H_ */ | 26.366906 | 73 | 0.454843 | towardsautonomy |
0db1fb3968b40f77ea6baae37e0e7695221d3e8b | 1,747 | cpp | C++ | CsUserInterface/Source/CsUIEditor/Public/GraphEditor/EnumStruct/UserWidget/SCsGraphPin_ECsUserWidgetPooled.cpp | closedsum/core | c3cae44a177b9684585043a275130f9c7b67fef0 | [
"Unlicense"
] | 2 | 2019-03-17T10:43:53.000Z | 2021-04-20T21:24:19.000Z | CsUserInterface/Source/CsUIEditor/Public/GraphEditor/EnumStruct/UserWidget/SCsGraphPin_ECsUserWidgetPooled.cpp | closedsum/core | c3cae44a177b9684585043a275130f9c7b67fef0 | [
"Unlicense"
] | null | null | null | CsUserInterface/Source/CsUIEditor/Public/GraphEditor/EnumStruct/UserWidget/SCsGraphPin_ECsUserWidgetPooled.cpp | closedsum/core | c3cae44a177b9684585043a275130f9c7b67fef0 | [
"Unlicense"
] | null | null | null | // Copyright 2017-2021 Closed Sum Games, LLC. All Rights Reserved.
#include "GraphEditor/EnumStruct/UserWidget/SCsGraphPin_ECsUserWidgetPooled.h"
#include "CsUIEditor.h"
#include "Managers/UserWidget/CsTypes_UserWidget.h"
// Cached
#pragma region
namespace NCsGraphPinUserWidgetPooledCached
{
namespace Str
{
const FString CustomPopulateEnumMap = TEXT("SCsGraphPin_ECsUserWidgetPooled::CustomPopulateEnumMap");
}
}
#pragma endregion Cached
void SCsGraphPin_ECsUserWidgetPooled::Construct(const FArguments& InArgs, UEdGraphPin* InGraphPinObj)
{
SGraphPin::Construct(SGraphPin::FArguments(), InGraphPinObj);
Construct_Internal<EMCsUserWidgetPooled, FECsUserWidgetPooled>();
}
void SCsGraphPin_ECsUserWidgetPooled::CustomPopulateEnumMap()
{
using namespace NCsGraphPinUserWidgetPooledCached;
NCsUserWidgetPooled::PopulateEnumMapFromSettings(Str::CustomPopulateEnumMap, nullptr);
}
void SCsGraphPin_ECsUserWidgetPooled::GenerateComboBoxIndexes(TArray<TSharedPtr<int32>>& OutComboBoxIndexes)
{
GenenerateComboBoxIndexes_Internal<EMCsUserWidgetPooled>(OutComboBoxIndexes);
}
FString SCsGraphPin_ECsUserWidgetPooled::OnGetText() const
{
return OnGetText_Internal<EMCsUserWidgetPooled, FECsUserWidgetPooled>();
}
void SCsGraphPin_ECsUserWidgetPooled::ComboBoxSelectionChanged(TSharedPtr<int32> NewSelection, ESelectInfo::Type SelectInfo)
{
ComboBoxSelectionChanged_Internal<EMCsUserWidgetPooled, FECsUserWidgetPooled>(NewSelection, SelectInfo);
}
FText SCsGraphPin_ECsUserWidgetPooled::OnGetFriendlyName(int32 EnumIndex)
{
return OnGetFriendlyName_Internal<EMCsUserWidgetPooled>(EnumIndex);
}
FText SCsGraphPin_ECsUserWidgetPooled::OnGetTooltip(int32 EnumIndex)
{
return OnGetTooltip_Internal<EMCsUserWidgetPooled>(EnumIndex);
} | 30.649123 | 124 | 0.846594 | closedsum |
0db2edf1d6ff302406ae69048ccd85208a5f1378 | 590 | hpp | C++ | include/dna_library.hpp | dyigitpolat/relaxase | bb183197b48ca448afe71cb801c9cdafb8d418a1 | [
"MIT"
] | 1 | 2020-10-22T11:27:51.000Z | 2020-10-22T11:27:51.000Z | include/dna_library.hpp | dyigitpolat/relaxase | bb183197b48ca448afe71cb801c9cdafb8d418a1 | [
"MIT"
] | null | null | null | include/dna_library.hpp | dyigitpolat/relaxase | bb183197b48ca448afe71cb801c9cdafb8d418a1 | [
"MIT"
] | null | null | null | #pragma once
#include <vector>
#include <string>
#include "dna_pool.hpp"
#include "dna_strand.hpp"
struct FileAttributes
{
int pool_id;
LogicalAttributes logical_attributes;
};
class DNALibrary
{
public:
DNALibrary(); // default constructor
FileAttributes add_file(const std::vector<DNAStrand> &strands);
std::vector<DNAStrand> retrieve_file(const FileAttributes &fa) const;
int add_patch(const FileAttributes &fa, const std::vector<DNAStrand> &strands, int num_attrib_strands);
std::vector<DNAPool> pools;
private:
int next_available_pool;
}; | 21.071429 | 107 | 0.730508 | dyigitpolat |
0db610941a9dfa0de06b5ff4ce6426bc8133915d | 4,854 | hpp | C++ | Lexer/Parser.hpp | Pyxxil/LC3 | 7a2b201745846cd0f188648bfcc93f35d7ac711b | [
"MIT"
] | 2 | 2020-08-18T01:04:58.000Z | 2022-02-21T19:46:59.000Z | Lexer/Parser.hpp | Pyxxil/LC3 | 7a2b201745846cd0f188648bfcc93f35d7ac711b | [
"MIT"
] | null | null | null | Lexer/Parser.hpp | Pyxxil/LC3 | 7a2b201745846cd0f188648bfcc93f35d7ac711b | [
"MIT"
] | null | null | null | #ifndef PARSER_HPP
#define PARSER_HPP
#include <map>
#include "Lexer.hpp"
#include "Tokens.hpp"
namespace Parser {
class Parser {
public:
explicit Parser(std::vector<std::unique_ptr<Lexer::Token::Token>> tokens)
: m_tokens(std::move(tokens)) {}
void parse() {
uint16_t current_address{0};
bool origin_seen{false};
bool end_seen{false};
if (m_tokens.front()->token_type() != Lexer::TokenType::ORIG) {
error();
return;
}
for (auto &token : m_tokens) {
switch (token->token_type()) {
case Lexer::TokenType::LABEL: {
if (!origin_seen) {
error();
break;
} else if (end_seen) {
Notification::warning_notifications << Diagnostics::Diagnostic(
std::make_unique<Diagnostics::DiagnosticHighlighter>(
token->column(), token->get_token().length(), std::string{}),
"Label found after .END directive, ignoring.", token->file(),
token->line());
break;
}
for (auto &&[_, symbol] : m_symbols) {
if (symbol.address() == current_address) {
Notification::error_notifications << Diagnostics::Diagnostic(
std::make_unique<Diagnostics::DiagnosticHighlighter>(
token->column(), token->get_token().length(),
std::string{}),
"Multiple labels found for address", token->file(),
token->line());
Notification::error_notifications << Diagnostics::Diagnostic(
std::make_unique<Diagnostics::DiagnosticHighlighter>(
symbol.column(), symbol.name().length(), std::string{}),
"Previous label found here", symbol.file(), symbol.line());
}
}
auto &&[symbol, inserted] = m_symbols.try_emplace(
token->get_token(),
Lexer::Symbol(token->get_token(), current_address, token->file(),
token->column(), token->line()));
if (!inserted) {
// TODO: Fix the way these are handled. At the moment, any errors
// TODO: thrown here from labels that have been included (from the
// TODO: same file) won't actually be useful due to the fact that it
// TODO: doesn't tell the user where the .include was found.
auto &&sym = symbol->second;
Notification::error_notifications
<< Diagnostics::Diagnostic(
std::make_unique<Diagnostics::DiagnosticHighlighter>(
token->column(), token->get_token().length(),
std::string{}),
"Multiple definitions of label", token->file(),
token->line())
<< Diagnostics::Diagnostic(
std::make_unique<Diagnostics::DiagnosticHighlighter>(
sym.column(), sym.name().length(), std::string{}),
"Previous definition found here", sym.file(), sym.line());
} else {
longest_symbol_length =
std::max(longest_symbol_length,
static_cast<int>(token->get_token().length()));
}
break;
}
case Lexer::TokenType::ORIG:
if (origin_seen) {
error();
} else {
current_address =
static_cast<uint16_t>(static_cast<Lexer::Token::Immediate *>(
token->operands().front().get())
->value());
origin_seen = true;
}
break;
case Lexer::TokenType::END:
end_seen = true;
break;
default:
if (!origin_seen) {
error();
} else if (end_seen) {
Notification::warning_notifications << Diagnostics::Diagnostic(
std::make_unique<Diagnostics::DiagnosticHighlighter>(
token->column(), token->get_token().length(), std::string{}),
"Extra .END directive found.", token->file(), token->line());
} else {
if (const word memory_required = token->memory_required();
memory_required == -1) {
error();
} else if (memory_required > 0) {
current_address += static_cast<uint16_t>(memory_required);
}
}
break;
}
}
}
void error() { ++error_count; }
void warning() {}
const auto &tokens() const { return m_tokens; }
const auto &symbols() const { return m_symbols; }
auto is_okay() const { return error_count == 0; }
private:
std::vector<std::unique_ptr<Lexer::Token::Token>> m_tokens{};
std::map<std::string, Lexer::Symbol> m_symbols{};
size_t error_count{0};
int longest_symbol_length{20};
}; // namespace Parser
} // namespace Parser
#endif
| 35.691176 | 79 | 0.542851 | Pyxxil |
0dba848b3567e0dd938cb7c6cee647f7df7ccd04 | 304 | hh | C++ | src/client/human/human.hh | TheBenPerson/Game | 824b2240e95529b735b4d8055a541c77102bb5dc | [
"MIT"
] | null | null | null | src/client/human/human.hh | TheBenPerson/Game | 824b2240e95529b735b4d8055a541c77102bb5dc | [
"MIT"
] | null | null | null | src/client/human/human.hh | TheBenPerson/Game | 824b2240e95529b735b4d8055a541c77102bb5dc | [
"MIT"
] | null | null | null | #ifndef GAME_CLIENT_HUMAN
#define GAME_CLIENT_HUMAN
#include <stdint.h>
#include "entity.hh"
class Human: public Entity {
public:
Human(uint8_t *datat);
~Human();
void draw();
private:
typedef enum {LEFT, DOWN, RIGHT, UP} direction;
direction lastDir = UP;
char *name;
};
#endif
| 11.259259 | 49 | 0.677632 | TheBenPerson |
0dc2420ad4ac54d89a0fefe26df9221255024c8c | 6,227 | cpp | C++ | Base/PLPhysics/src/SceneNodes/RagdollBody.cpp | ktotheoz/pixellight | 43a661e762034054b47766d7e38d94baf22d2038 | [
"MIT"
] | 83 | 2015-01-08T15:06:14.000Z | 2021-07-20T17:07:00.000Z | Base/PLPhysics/src/SceneNodes/RagdollBody.cpp | PixelLightFoundation/pixellight | 43a661e762034054b47766d7e38d94baf22d2038 | [
"MIT"
] | 27 | 2019-06-18T06:46:07.000Z | 2020-02-02T11:11:28.000Z | Base/PLPhysics/src/SceneNodes/RagdollBody.cpp | naetherm/PixelLight | d7666f5b49020334cbb5debbee11030f34cced56 | [
"MIT"
] | 40 | 2015-02-25T18:24:34.000Z | 2021-03-06T09:01:48.000Z | /*********************************************************\
* File: RagdollBody.cpp *
*
* Copyright (C) 2002-2013 The PixelLight Team (http://www.pixellight.org/)
*
* This file is part of PixelLight.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
* and associated documentation files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\*********************************************************/
//[-------------------------------------------------------]
//[ Includes ]
//[-------------------------------------------------------]
#include <PLMath/Matrix3x4.h>
#include <PLMath/Matrix4x4.h>
#include <PLRenderer/Renderer/Renderer.h>
#include <PLRenderer/Renderer/DrawHelpers.h>
#include <PLScene/Visibility/VisNode.h>
#include "PLPhysics/Body.h"
#include "PLPhysics/World.h"
#include "PLPhysics/ElementHandler.h"
#include "PLPhysics/SceneNodes/SNRagdoll.h"
#include "PLPhysics/SceneNodes/SCPhysicsWorld.h"
#include "PLPhysics/SceneNodes/RagdollBody.h"
//[-------------------------------------------------------]
//[ Namespace ]
//[-------------------------------------------------------]
using namespace PLCore;
using namespace PLMath;
using namespace PLGraphics;
using namespace PLRenderer;
using namespace PLScene;
namespace PLPhysics {
//[-------------------------------------------------------]
//[ Public functions ]
//[-------------------------------------------------------]
/**
* @brief
* Constructor
*/
RagdollBody::RagdollBody(SNRagdoll *pParent) :
bEnabled(true),
fMass(0.1f),
m_pParentRagdoll(pParent),
m_pBodyHandler(new ElementHandler())
{
}
/**
* @brief
* Destructor
*/
RagdollBody::~RagdollBody()
{
DestroyPhysicsBody();
delete m_pBodyHandler;
}
/**
* @brief
* Returns the PL physics body
*/
Body *RagdollBody::GetBody() const
{
return static_cast<Body*>(m_pBodyHandler->GetElement());
}
/**
* @brief
* Sets the name of the body
*/
bool RagdollBody::SetName(const String &sName)
{
// Is this the current name?
if (this->sName != sName) {
// Is there a parent ragdoll and is this body name already used within the ragdoll?
if (!m_pParentRagdoll || m_pParentRagdoll->m_mapBodies.Get(sName))
return false; // Error!
// Set the new name
m_pParentRagdoll->m_mapBodies.Remove(this->sName);
this->sName = sName;
m_pParentRagdoll->m_mapBodies.Add(this->sName, this);
}
// Done
return true;
}
/**
* @brief
* Draws the physics body
*/
void RagdollBody::Draw(Renderer &cRenderer, const Color4 &cColor, const VisNode &cVisNode) const
{
// Calculate the world view projection matrix
Matrix3x4 mTrans;
GetTransformMatrix(mTrans);
const Matrix4x4 mWorldViewProjection = cVisNode.GetViewProjectionMatrix()*mTrans;
// Draw
const Vector3 &vNodeScale = m_pParentRagdoll->GetTransform().GetScale();
const Vector3 vRealSize = vSize*vNodeScale;
cRenderer.GetDrawHelpers().DrawBox(cColor,
Vector3(-vRealSize.x*0.5f, -vRealSize.y*0.5f, -vRealSize.z*0.5f),
Vector3( vRealSize.x*0.5f, vRealSize.y*0.5f, vRealSize.z*0.5f),
mWorldViewProjection, 0.0f);
}
/**
* @brief
* Creates the physics body
*/
void RagdollBody::CreatePhysicsBody()
{
// Is there a parent ragdoll?
if (m_pParentRagdoll) {
// Destroy the old physics body
DestroyPhysicsBody();
// Create the PL physics body
SCPhysicsWorld *pWorldContainer = m_pParentRagdoll->GetWorldContainer();
if (pWorldContainer && pWorldContainer->GetWorld()) {
const Vector3 &vNodePosition = m_pParentRagdoll->GetTransform().GetPosition();
const Quaternion &qNodeRotation = m_pParentRagdoll->GetTransform().GetRotation();
const Vector3 &vNodeScale = m_pParentRagdoll->GetTransform().GetScale();
const Vector3 vRealSize = vSize*vNodeScale;
Body *pBody = pWorldContainer->GetWorld()->CreateBodyBox(vRealSize);
if (pBody) {
m_pBodyHandler->SetElement(pBody);
// Setup body
pBody->SetMass(fMass);
pBody->SetPosition(qNodeRotation*(vPos*vNodeScale) + vNodePosition);
pBody->SetRotation(qNodeRotation*qRot);
}
}
}
}
/**
* @brief
* Destroys the physics body
*/
void RagdollBody::DestroyPhysicsBody()
{
if (m_pBodyHandler->GetElement())
delete m_pBodyHandler->GetElement();
}
/**
* @brief
* Returns the current rotation of the physics body
*/
void RagdollBody::GetRotation(Quaternion &qQ) const
{
const Body *pBody = static_cast<const Body*>(m_pBodyHandler->GetElement());
if (pBody)
pBody->GetRotation(qQ);
}
/**
* @brief
* Returns the current transform matrix of the physics body
*/
void RagdollBody::GetTransformMatrix(Matrix3x4 &mTrans) const
{
const Body *pBody = static_cast<const Body*>(m_pBodyHandler->GetElement());
if (pBody) {
Quaternion qQ;
pBody->GetRotation(qQ);
Vector3 vPos;
pBody->GetPosition(vPos);
mTrans.FromQuatTrans(qQ, vPos);
}
}
/**
* @brief
* Adds a force to the body
*/
void RagdollBody::AddForce(const Vector3 &vForce)
{
// Nothing do to in here
}
//[-------------------------------------------------------]
//[ Namespace ]
//[-------------------------------------------------------]
} // PLPhysics
| 29.372642 | 97 | 0.629517 | ktotheoz |
0dcd62c4eac3d1cec80ba7690df119bc9d4dfa46 | 3,595 | cpp | C++ | Practical_5_Pacman/components/cmp_ghost_movement.cpp | CarlosMiraGarcia/Pong_Practical-2 | ba26587fb2b538b9c3cceec98f1026112b2c6413 | [
"MIT"
] | null | null | null | Practical_5_Pacman/components/cmp_ghost_movement.cpp | CarlosMiraGarcia/Pong_Practical-2 | ba26587fb2b538b9c3cceec98f1026112b2c6413 | [
"MIT"
] | null | null | null | Practical_5_Pacman/components/cmp_ghost_movement.cpp | CarlosMiraGarcia/Pong_Practical-2 | ba26587fb2b538b9c3cceec98f1026112b2c6413 | [
"MIT"
] | null | null | null | #include "cmp_ghost_movement.h"
#include "cmp_player_movement.h"
#include "..\game.h"
#include <deque>
#include "../Pacman.h"
using namespace std;
using namespace sf;
static const Vector2i directions[] = { {1, 0}, {0, 1}, {0, -1}, {-1, 0} };
GhostMovementComponent::GhostMovementComponent(Entity* p)
: ActorMovementComponent(p) {
_speed = 100.f;
_state = ROAMING;
_direction = Vector2f(0.f, -1.f);
// srand is the seed to create a random number
srand(time(NULL));
}
void GhostMovementComponent::update(double dt) {
//amount to move
const auto movementValue = (float)(_speed * dt);
//Curent position
const Vector2f position = _parent->getPosition();
//Next position
const Vector2f newPosition = position + _direction * movementValue;
//Inverse of our current direction
const Vector2i badDirection = -1 * Vector2i(_direction);
//Random new direction
Vector2i newDirection = directions[(rand() % 4)];
const Vector2f inFront = _direction * _ghostSize;
switch (_state) {
case ROAMING:
// Wall in front or at waypoint
if (LevelSystem::getTileAt(position - inFront) == LevelSystem::INTERSECTION ||
LevelSystem::getTileAt(position + inFront) == LevelSystem::WALL) {
_state = ROTATING;
}
else {
move(_direction * movementValue);
}
break;
case ROTATING:
while (newDirection == badDirection ||
LevelSystem::getTileAt(position + (Vector2f(newDirection) * _ghostSize)) == LevelSystem::WALL) {
auto dir = findPlayer(position);
newDirection = dir;
}
_direction = Vector2f(newDirection);
_state = ROTATED;
break;
case ROTATED:
//have we left the waypoint?
if (LevelSystem::getTileAt(position - (_direction * _ghostSize)) != LevelSystem::INTERSECTION) {
_state = ROAMING; //yes
}
move(_direction * movementValue); //No
break;
}
}
Vector2i GhostMovementComponent::findPlayer(Vector2f ghostPosition) {
for (auto& e : _ents.list) {
auto comps = e->GetCompatibleComponent<PlayerMovementComponent>();
if (comps.size() > 0) {
auto actComp = comps[0];
const Vector2f playerPosition = e->getPosition();
const Vector2f wherePlayer = ghostPosition - playerPosition;
vector<Vector2f> newDirections;
if (wherePlayer.x > 0) {
newDirections.push_back(Vector2f(-1, 0));
}
if (wherePlayer.x < 0) {
newDirections.push_back(Vector2f(1, 0));
}
if (wherePlayer.y > 0) {
newDirections.push_back(Vector2f(0, -1));
}
if (wherePlayer.y < 0) {
newDirections.push_back(Vector2f(0, 1));
}
auto ran = rand() % 2;
auto returnDirection = Vector2i(newDirections[ran]);
if (LevelSystem::getTileAt(ghostPosition + (Vector2f(returnDirection) * _ghostSize)) == LevelSystem::WALL) {
if (ran == 0) {
if (!LevelSystem::getTileAt(ghostPosition + (Vector2f(newDirections[1]) * _ghostSize)) == LevelSystem::WALL) {
returnDirection = Vector2i(newDirections[1]);
}
if (!LevelSystem::getTileAt(ghostPosition + (Vector2f(newDirections[0]) * _ghostSize)) == LevelSystem::WALL) {
returnDirection = Vector2i(newDirections[0]);
}
else {
returnDirection = returnDirection * -1;
}
}
else {
if (!LevelSystem::getTileAt(ghostPosition + (Vector2f(newDirections[0]) * _ghostSize)) == LevelSystem::WALL) {
returnDirection = Vector2i(newDirections[0]);
}
if (!LevelSystem::getTileAt(ghostPosition + (Vector2f(newDirections[1]) * _ghostSize)) == LevelSystem::WALL) {
returnDirection = Vector2i(newDirections[1]);
}
else {
returnDirection = returnDirection * -1;
}
}
}
return returnDirection;
}
}
} | 30.466102 | 115 | 0.680111 | CarlosMiraGarcia |
0dd83497440071a37d3959b721008b3782f0b2dd | 631 | hpp | C++ | include/Keyboard.hpp | EmilyEclipse/Breakout | 9a5ef518464e02d6cb1f39e4c3011d52ec62fef2 | [
"MIT"
] | null | null | null | include/Keyboard.hpp | EmilyEclipse/Breakout | 9a5ef518464e02d6cb1f39e4c3011d52ec62fef2 | [
"MIT"
] | 2 | 2020-12-26T10:46:31.000Z | 2021-01-28T19:25:22.000Z | include/Keyboard.hpp | EmilyEclipse/Breakout | 9a5ef518464e02d6cb1f39e4c3011d52ec62fef2 | [
"MIT"
] | null | null | null | #ifndef KEYBOARD_HPP
#define KEYBOARD_HPP
#include <SDL2/SDL.h>
#include "Paddle.hpp"
class Keyboard
{
public:
static void handleInput();
static void setPaddle(Paddle* paddle);
class Key{
public:
Key(int inputScancode){
scancode = inputScancode;
state_p = &keyboardState[scancode];
}
Uint8 getState(){
return *state_p;
}
private:
Uint8 scancode;
const Uint8* state_p;
};
private:
static Paddle* paddle;
static const Uint8* keyboardState;
};
#endif //KEYBOARD_HPP | 19.71875 | 51 | 0.561014 | EmilyEclipse |
0ded6b82ae3a7dfb659211f8157be0a0defcf1c9 | 3,060 | cpp | C++ | 17_gpsanta.cpp | risteon/IEEE_SB_Passau_advent_2016 | 138bc4b90e55cc444e4c740d1641281bfe058e31 | [
"MIT"
] | null | null | null | 17_gpsanta.cpp | risteon/IEEE_SB_Passau_advent_2016 | 138bc4b90e55cc444e4c740d1641281bfe058e31 | [
"MIT"
] | null | null | null | 17_gpsanta.cpp | risteon/IEEE_SB_Passau_advent_2016 | 138bc4b90e55cc444e4c740d1641281bfe058e31 | [
"MIT"
] | null | null | null | // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
// -- BEGIN LICENSE BLOCK ----------------------------------------------
// -- END LICENSE BLOCK ------------------------------------------------
//----------------------------------------------------------------------
/*!\file
*
* \author Christoph Rist <[email protected]>
* \date 2016-12-28
*
*/
//----------------------------------------------------------------------
/***********************************
* IEEE SB Passau Adventskalender
* Problem 17
*/
#include <memory>
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <cmath>
#include <algorithm>
//#define TEST
#ifdef TEST
#include "io_redirect.h"
#endif
using namespace std;
class Graph
{
public:
using Node = pair<uint8_t, uint8_t>;
void addEdge(const Node& first_node, const Node& second_node)
{
addNode(first_node);
addNode(second_node);
nodes_[first_node].insert(second_node);
}
uint32_t nbSimplePaths(const Node& start, const Node& end)
{
set<Node> visited{};
uint32_t nb_paths = 0;
stack<pair<Node, set<Node>::const_iterator>> s;
s.emplace(start, nodes_[start].cbegin());
while(!s.empty())
{
auto& n = s.top();
if (n.first == end || n.second == nodes_[n.first].cend())
{
if (n.first == end)
++nb_paths;
visited.erase(n.first);
s.pop();
}
else
{
const Node& v = *n.second;
++n.second;
if (visited.find(v) == visited.cend())
{
s.emplace(v, nodes_.at(v).cbegin());
visited.insert(v);
}
}
}
return nb_paths;
}
private:
void addNode(const Node& n)
{
if (nodes_.find(n) == nodes_.cend())
{
nodes_.emplace(n, set<Node>{});
}
}
map<Node, set<Node>> nodes_;
};
Graph buildGraph(uint8_t size)
{
Graph g{};
for (uint8_t x = 1; x < size; ++x)
{
for (uint8_t y = 0; y < x; ++y)
{
g.addEdge({x - 1, y}, {x, y});
g.addEdge({x, y}, {x, y + 1});
}
}
return g;
}
int main(int argc, char* argv[])
{
#ifdef TEST
//////////////////////// INPUT/OUTPUT //////////////////////////
if (!redirect_io(argc, argv))
return 0;
#endif
uint32_t nb_testcases;
cin >> nb_testcases;
vector<uint8_t> sizes{};
// parse
string l;
getline(cin, l);
for (uint32_t i = 0; i < nb_testcases; ++i)
{
getline(cin, l);
const auto it = std::find(l.cbegin(), l.cend(), 'x');
if (it == l.cend())
throw runtime_error("Invalid input");
const int32_t first = stoi(string(l.cbegin(), it));
const int32_t second = stoi(string(it + 1, l.cend()));
if (first < 0 || first != second || first > 255)
throw runtime_error("Invalid input");
sizes.push_back(static_cast<uint8_t>(first));
}
for (uint8_t s : sizes)
{
auto g = buildGraph(s + 1);
cout <<g.nbSimplePaths({0, 0}, {s, s}) <<endl;
}
#ifdef TEST
cleanup_io();
#endif
return 0;
}
| 20.264901 | 75 | 0.508497 | risteon |
0df18d37a458cb900cf31f5bb56826ded09b2262 | 3,993 | cpp | C++ | tests/integral_tests.cpp | gridem/ReplobPrototype | 8c1f7ac46c9c46e7f02b402b8bbc5febaa152c90 | [
"Apache-2.0"
] | 3 | 2016-01-11T11:42:02.000Z | 2016-12-21T14:54:44.000Z | tests/integral_tests.cpp | gridem/ReplobPrototype | 8c1f7ac46c9c46e7f02b402b8bbc5febaa152c90 | [
"Apache-2.0"
] | null | null | null | tests/integral_tests.cpp | gridem/ReplobPrototype | 8c1f7ac46c9c46e7f02b402b8bbc5febaa152c90 | [
"Apache-2.0"
] | null | null | null | /*
* Copyright 2015 Grigory Demchenko (aka gridem)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <synca/synca.h>
#include <synca/log.h>
using namespace synca;
void f(){}
void addLocalNodePort(NodeId id, Port port)
{
JLOG("add node " << id << " with port " << port);
single<Nodes>().add(id, Endpoint{port, "127.0.0.1", Endpoint::Type::V4});
}
void broadcastTest()
{
if (thisNode() == 1)
{
go([] {
JLOG("broadcasting");
broadcast([] {
RJLOG("----- hello from node: " << thisNode());
});
});
}
}
void replobTest()
{
if (thisNode() != 1)
return;
go([] {
single<Replob>().apply([] {
RJLOG("--- commited for: " << thisNode());
if (thisNode() != 2)
return;
single<Replob>().apply([] {
RJLOG("--- commited from node 2 for: " << thisNode());
});
});
});
}
int counter = 0;
void applyCounterAsync()
{
go([] {
single<Replob>().apply([] {
++ counter;
if (thisNode() == 1)
{
applyCounterAsync();
}
});
});
}
void perfTest()
{
if (thisNode() == 1)
{
applyCounterAsync();
applyCounterAsync();
applyCounterAsync();
applyCounterAsync();
applyCounterAsync();
applyCounterAsync();
applyCounterAsync();
applyCounterAsync();
applyCounterAsync();
applyCounterAsync();
applyCounterAsync();
applyCounterAsync();
}
sleepFor(1000);
RLOG("Counter: " << counter);
}
void consistencyTest()
{
using L = std::vector<int>;
static int val = 0;
if (thisNode() <= 3)
{
for (int i = 0; i < 10; ++ i)
go([] {
NodeId src = thisNode();
int v = val++;
if (src == 3 && v == 5)
sleepFor(1000);
single<Replob>().apply([src, v] {
single<L>().push_back(int(v*10 + src));
});
});
}
sleepFor(1000);
int i = 0;
//VERIFY(single<L>().size() == 1000, "Invalid size");
for (int v: single<L>())
{
RJLOG("l[" << i++ << "] = " << v);
//VERIFY(v == i++, "Invalid value");
}
}
auto tests = {&broadcastTest, &replobTest, &perfTest, &consistencyTest};
int main(int argc, const char* argv[])
{
try
{
RLOG("address: " << (void*)&f);
VERIFY(argc == 4, "Invalid args");
NodeId id = std::stoi(argv[1]);
int nodes = std::stoi(argv[2]);
size_t nTest = std::stoi(argv[3]);
VERIFY(nTest < tests.size(), "Invalid test number");
RLOG("starting service with node " << id << " of " << nodes << ", test: " << nTest);
ThreadPool tp(1, "net");
scheduler<DefaultTag>().attach(tp);
service<NetworkTag>().attach(tp);
service<TimeoutTag>().attach(tp);
single<NodesConfig>().setThisNode(id);
MCleanup {
cleanupAll();
};
for (int i = 1; i <= nodes; ++ i)
addLocalNodePort(i, 8800 + i);
MsgListener msg;
msg.listen();
tests.begin()[nTest]();
sleepFor(2000);
//single<Nodes>().cleanup();
//msg.cancel();
//waitForAll();
}
catch (std::exception& e)
{
RLOG("Error: " << e.what());
return 1;
}
return 0;
}
| 23.91018 | 92 | 0.506136 | gridem |
0df5c58634006e4f202d4d1db66b584a36c8ee69 | 2,735 | hpp | C++ | TurbulentArena/Map.hpp | doodlemeat/Turbulent-Arena | 9030f291693e670f7751e23538e649cc24dc929f | [
"MIT"
] | 2 | 2017-02-03T04:30:29.000Z | 2017-03-27T19:33:38.000Z | TurbulentArena/Map.hpp | doodlemeat/Turbulent-Arena | 9030f291693e670f7751e23538e649cc24dc929f | [
"MIT"
] | null | null | null | TurbulentArena/Map.hpp | doodlemeat/Turbulent-Arena | 9030f291693e670f7751e23538e649cc24dc929f | [
"MIT"
] | null | null | null | #pragma once
#include "Physics.hpp"
namespace bjoernligan
{
class Map : public sf::Drawable
{
public:
enum Orientation
{
ORIENTATION_ORTHOGONAL,
ORIENTATION_ISOMETRIC,
ORIENTATION_STAGGERED
};
enum RenderOrder
{
RENDERORDER_RIGHT_DOWN,
RENDERORDER_RIGHT_UP,
RENDERORDER_LEFT_DOWN,
RENDERORDER_LEFT_UP
};
struct Tileset
{
sf::Texture m_texture;
};
class Properties
{
friend class Map;
public:
std::string getProperty(const std::string& key);
bool hasProperty(const std::string& key);
protected:
std::map<std::string, std::string> m_propertySet;
void parseProperties(tinyxml2::XMLElement* propertiesNode);
};
struct TileInfo
{
std::array<sf::Vector2f, 4> m_textureCoordinates;
Tileset* m_tileset;
Properties m_properties;
};
class Tile
{
friend class Map;
public:
sf::Vector2i getPosition() const;
TileInfo* getTileInfo() const;
private:
TileInfo* m_tileInfo;
sf::Vertex* m_vertices;
};
struct LayerSet
{
sf::VertexArray m_vertices;
std::vector<std::unique_ptr<Tile>> m_tiles;
};
struct TileLayer
{
std::string m_name;
sf::Vector2i m_size;
std::map<Tileset*, std::unique_ptr<LayerSet>> m_layerSets;
Tile* getTile(int x, int y);
};
struct Object : public Properties
{
virtual ~Object();
int m_ID;
sf::Vector2f m_position;
std::vector<sf::Vector2f> m_points;
};
struct Polygon : public Object
{
};
class ObjectGroup
{
friend class Map;
public:
std::vector<Object*> getObjects() const;
private:
std::vector<std::unique_ptr<Object>> m_objects;
std::string m_name;
};
Map(const std::string& path);
bool load(const std::string& file);
TileLayer* getLayer(const std::string& name) const;
Tile* getTopmostTileAt(int x, int y);
Tile* getTopmostTileAt(const sf::Vector2i& position);
ObjectGroup* getObjectGroup(const std::string& name) const;
sf::Vector2i getSize() const;
sf::Vector2i getTilePosition(const sf::Vector2f& position) const;
int getWidth() const;
int getHeight() const;
sf::Vector2f getTileSize() const;
void draw(sf::RenderTarget& target, sf::RenderStates states) const;
bool GetRandomTopmostWalkableTile(const sf::Vector2i &p_xSearchStart, sf::Vector2i &p_xTarget, sf::Vector2i p_xSearchAreaSize);
private:
sf::Vector2i m_size;
sf::Vector2f m_tileSize;
std::string m_path;
sf::Color m_backgroundColor;
Orientation m_orientation;
RenderOrder m_renderOrder;
std::vector<std::unique_ptr<TileLayer>> m_tileLayers;
std::vector<std::unique_ptr<ObjectGroup>> m_objectGroups;
std::vector<std::unique_ptr<TileInfo>> m_tileInfo;
std::vector<std::unique_ptr<Tileset>> m_tilesets;
};
} | 21.367188 | 129 | 0.702742 | doodlemeat |
0dfc6de979a1680ac026f288ea4ac1f5eaa6e42c | 1,942 | hpp | C++ | modules/boost/simd/base/include/boost/simd/arithmetic/functions/min.hpp | feelpp/nt2 | 4d121e2c7450f24b735d6cff03720f07b4b2146c | [
"BSL-1.0"
] | 34 | 2017-05-19T18:10:17.000Z | 2022-01-04T02:18:13.000Z | modules/boost/simd/base/include/boost/simd/arithmetic/functions/min.hpp | feelpp/nt2 | 4d121e2c7450f24b735d6cff03720f07b4b2146c | [
"BSL-1.0"
] | null | null | null | modules/boost/simd/base/include/boost/simd/arithmetic/functions/min.hpp | feelpp/nt2 | 4d121e2c7450f24b735d6cff03720f07b4b2146c | [
"BSL-1.0"
] | 7 | 2017-12-02T12:59:17.000Z | 2021-07-31T12:46:14.000Z | //==============================================================================
// Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II
// Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI
//
// Distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
//==============================================================================
#ifndef BOOST_SIMD_ARITHMETIC_FUNCTIONS_MIN_HPP_INCLUDED
#define BOOST_SIMD_ARITHMETIC_FUNCTIONS_MIN_HPP_INCLUDED
#include <boost/simd/include/functor.hpp>
#include <boost/dispatch/include/functor.hpp>
namespace boost { namespace simd { namespace tag
{
/*!
@brief min generic tag
Represents the min function in generic contexts.
@par Models:
Hierarchy
**/
struct min_ : ext::elementwise_<min_>
{
/// @brief Parent hierarchy
typedef ext::elementwise_<min_> parent;
template<class... Args>
static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args)
BOOST_AUTO_DECLTYPE_BODY( dispatching_min_( ext::adl_helper(), static_cast<Args&&>(args)... ) )
};
}
namespace ext
{
template<class Site>
BOOST_FORCEINLINE generic_dispatcher<tag::min_, Site> dispatching_min_(adl_helper, boost::dispatch::meta::unknown_<Site>, ...)
{
return generic_dispatcher<tag::min_, Site>();
}
template<class... Args>
struct impl_min_;
}
/*!
Computes the smallest of its parameter.
@par semantic:
For any given value @c x and @c y of type @c T:
@code
T r = min(x, y);
@endcode
is similar to:
@code
T r = if (x < y) ? x : y;
@endcode
@param a0
@param a1
@return an value of the same type as the input.
**/
BOOST_DISPATCH_FUNCTION_IMPLEMENTATION(tag::min_, min, 2)
} }
#endif
| 27.352113 | 129 | 0.593718 | feelpp |
0dfcc7e07a50dfe95fa699c7a27836233ef39a85 | 1,886 | cpp | C++ | Hacker Blocks/Smart Keypad - Advanced.cpp | Shubhrmcf07/Competitive-Coding-and-Interview-Problems | 7281ea3163c0cf6938a3af7b54a8a14f97c97c0e | [
"MIT"
] | 51 | 2020-02-24T11:14:00.000Z | 2022-03-24T09:32:18.000Z | Hacker Blocks/Smart Keypad - Advanced.cpp | Shubhrmcf07/Competitive-Coding-and-Interview-Problems | 7281ea3163c0cf6938a3af7b54a8a14f97c97c0e | [
"MIT"
] | 3 | 2020-10-02T08:16:09.000Z | 2021-04-17T16:32:38.000Z | Hacker Blocks/Smart Keypad - Advanced.cpp | Shubhrmcf07/Competitive-Coding-and-Interview-Problems | 7281ea3163c0cf6938a3af7b54a8a14f97c97c0e | [
"MIT"
] | 18 | 2020-04-24T15:33:36.000Z | 2022-03-24T09:32:20.000Z | /* Hacker Blocks */
/* Title - Smart Keypad - Advanced */
/* Created By - Akash Modak */
/* Date - 14/07/2020 */
// Given a long vector of strings, print the strings that contain the strings generated by numeric string str.
// string searchIn [] = {
// "prateek", "sneha", "deepak", "arnav", "shikha", "palak",
// "utkarsh", "divyam", "vidhi", "sparsh", "akku"
// };
// For example, if the input is 26 and the string is coding, then output should be coding since 26 can produce co which is contained in coding.
// Input Format
// A numeric string str
// Constraints
// len(str) < 10
// No of strings in the vector < 10
// Output Format
// Each matched string from the given vector.
// Sample Input
// 34
// Sample Output
// vidhi
// divyam
// sneha
// Explanation
// 34 will result into combinations :
// *dg *eg *fg
// *dh *eh *fh
// *di *ei *fi
// Corresponding strings are output.
// vidhi contains dh
// divyam contains di
// sneha contains eh
#include<iostream>
#include <string>
using namespace std;
string table[]={" ",".+@$","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};
string searchIn [] = {
"prateek", "sneha", "deepak", "arnav", "shikha", "palak",
"utkarsh", "divyam", "vidhi", "sparsh", "akku"
};
void generate(char *inp,char *out, int i, int j){
if(inp[i]=='\0'){
out[j]='\0';
for(int k=0;k<11;k++){
size_t found = searchIn[k].find(out);
if(found!=string::npos)
cout<<searchIn[k]<<endl;
}
return;
}
int key = inp[i]-'0';
if(key==0)
generate(inp,out,i+1,j);
for(int m=0;table[key][m]!='\0';m++){
out[j]=table[key][m];
generate(inp,out,i+1,j+1);
}
return;
}
int main() {
char a[100000],out[100000];
cin>>a;
generate(a,out,0,0);
return 0;
} | 24.815789 | 144 | 0.560976 | Shubhrmcf07 |
0dff851ffc028fc2eebcad183e10ebac4f183a78 | 676 | hpp | C++ | Source/Generator.hpp | Myles-Trevino/Resonance | 47ff7c51caa8fc15862818f56a232c3e71dd7e0a | [
"Apache-2.0"
] | 1 | 2020-09-07T13:03:34.000Z | 2020-09-07T13:03:34.000Z | Source/Generator.hpp | Myles-Trevino/Resonance | 47ff7c51caa8fc15862818f56a232c3e71dd7e0a | [
"Apache-2.0"
] | null | null | null | Source/Generator.hpp | Myles-Trevino/Resonance | 47ff7c51caa8fc15862818f56a232c3e71dd7e0a | [
"Apache-2.0"
] | null | null | null | /*
Copyright 2020 Myles Trevino
Licensed under the Apache License, Version 2.0
https://www.apache.org/licenses/LICENSE-2.0
*/
#pragma once
#include <string>
#include <vector>
#include <glm/glm.hpp>
namespace LV
{
struct Mesh
{
std::vector<glm::fvec3> vertices;
std::vector<unsigned> indices;
};
}
namespace LV::Generator
{
void configure(float dft_window_duration, float sample_interval,
float harmonic_smoothing, float temporal_smoothing,
float height_multiplier, const std::string& logarithmic);
void generate(const std::string& file_name);
// Getters.
glm::ivec2 get_size();
float get_height();
Mesh get_dft_mesh();
Mesh get_base_mesh();
}
| 16.095238 | 65 | 0.732249 | Myles-Trevino |
0dff8a9ca53b74b92f0c31b57917793ef5887015 | 6,838 | cc | C++ | fastcap/fc_accs/lstpack.cc | wrcad/xictools | f46ba6d42801426739cc8b2940a809b74f1641e2 | [
"Apache-2.0"
] | 73 | 2017-10-26T12:40:24.000Z | 2022-03-02T16:59:43.000Z | fastcap/fc_accs/lstpack.cc | chris-ayala/xictools | 4ea72c118679caed700dab3d49a8d36445acaec3 | [
"Apache-2.0"
] | 12 | 2017-11-01T10:18:22.000Z | 2022-03-20T19:35:36.000Z | fastcap/fc_accs/lstpack.cc | chris-ayala/xictools | 4ea72c118679caed700dab3d49a8d36445acaec3 | [
"Apache-2.0"
] | 34 | 2017-10-06T17:04:21.000Z | 2022-02-18T16:22:03.000Z |
/*========================================================================*
* *
* Distributed by Whiteley Research Inc., Sunnyvale, California, USA *
* http://wrcad.com *
* Copyright (C) 2017 Whiteley Research Inc., all rights reserved. *
* Author: Stephen R. Whiteley, except as indicated. *
* *
* As fully as possible recognizing licensing terms and conditions *
* imposed by earlier work from which this work was derived, if any, *
* this work is released under the Apache License, Version 2.0 (the *
* "License"). You may not use this file except in compliance with *
* the License, and compliance with inherited licenses which are *
* specified in a sub-header below this one if applicable. A copy *
* of the License is provided with this distribution, or you may *
* obtain a copy of the License at *
* *
* http://www.apache.org/licenses/LICENSE-2.0 *
* *
* See the License for the specific language governing permissions *
* and limitations under the License. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, *
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES *
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON- *
* INFRINGEMENT. IN NO EVENT SHALL WHITELEY RESEARCH INCORPORATED *
* OR STEPHEN R. WHITELEY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* *
*========================================================================*
* XicTools Integrated Circuit Design System *
* *
* lstpack -- Fast[er]Cap list file packer. *
* *
*========================================================================*
$Id:$
*========================================================================*/
#include "miscutil/lstring.h"
#include "miscutil/symtab.h"
#include "miscutil/pathlist.h"
// This program will assemble a unified list file from separate files.
// The unified format is supported by FasterCap from
// FastFieldSolvers.com, and by the Whiteley Research version of
// FastCap. It is not supported in the original MIT FastCap, or in
// FastCap2 from FastFieldSolvers.com.
//
// The argument is a path to a non-unified list file. The unified
// file is created in the current directory. If the original list
// file is named filename.lst, the new packed list file is named
// filename_p.lst. All referenced files are expected to be found in
// the same directory as the original list file.
namespace {
struct elt_t
{
const char *tab_name() { return (e_name); }
elt_t *tab_next() { return (e_next); }
void set_tab_next(elt_t *n) { e_next = n; }
elt_t *tgen_next(bool) { return (e_next); }
elt_t *e_next;
char *e_name;
};
table_t<elt_t> *hash_tab;
void hash(const char *str)
{
if (!hash_tab)
hash_tab = new table_t<elt_t>;
if (hash_tab->find(str))
return;
elt_t *e = new elt_t;
e->e_next = 0;
e->e_name = lstring::copy(str);
hash_tab->link(e);
hash_tab = hash_tab->check_rehash();
}
FILE *myopen(const char *dir, const char *fn)
{
if (!dir)
return (fopen(fn, "r"));
char *p = pathlist::mk_path(dir, fn);
FILE *fp = fopen(p, "r");
delete [] p;
return (fp);
}
}
int main(int argc, char **argv)
{
if (argc != 2) {
printf("Usage: %s filename\n", argv[0]);
printf(
"This creates a FasterCap unified list file from old-style separate\n"
"FastCap files, created in the current directory.\n\n");
return (1);
}
FILE *fpin = fopen(argv[1], "r");
if (!fpin) {
printf("Unable to open %s.\n\n", argv[1]);
return (2);
}
char buf[256];
strcpy(buf, lstring::strip_path(argv[1]));
char *e = strrchr(buf, '.');
if (e)
*e = 0;
strcat(buf, "_p.lst");
FILE *fpout =fopen(buf, "w");
if (!fpout) {
printf("Unable to open %s.\n\n", buf);
return (3);
}
// Path assumed for all input.
char *srcdir = 0;
if (lstring::strrdirsep(argv[1])) {
srcdir = lstring::copy(argv[1]);
*lstring::strrdirsep(srcdir) = 0;
}
// Hash the file names.
int lcnt = 0;
while (fgets(buf, 256, fpin) != 0) {
lcnt++;
if (buf[0] == 'C' || buf[0] == 'c') {
char *s = buf;
lstring::advtok(&s);
char *tok = lstring::getqtok(&s);
if (!tok) {
printf("Warning: C line without file name on line %d.\n",
lcnt);
continue;
}
hash(tok);
delete [] tok;
}
else if (buf[0] == 'D' || buf[0] == 'd') {
char *s = buf;
lstring::advtok(&s);
char *tok = lstring::getqtok(&s);
if (!tok) {
printf("Warning: D line without file name on line %d.\n",
lcnt);
continue;
}
hash(tok);
delete [] tok;
}
fputs(buf, fpout);
}
fclose(fpin);
fputs("End\n\n", fpout);
// Open and add the files we've hashed.
tgen_t<elt_t> gen(hash_tab);
elt_t *elt;
while ((elt = gen.next()) != 0) {
fpin = myopen(srcdir, elt->tab_name());
if (!fpin) {
printf("Warning: can't open %s, not packed.\n", elt->tab_name());
continue;
}
sprintf(buf, "File %s\n", elt->tab_name());
fputs(buf, fpout);
while (fgets(buf, 256, fpin) != 0)
fputs(buf, fpout);
fputs("End\n", fpout);
fclose(fpin);
}
return (0);
}
| 37.163043 | 78 | 0.463001 | wrcad |
df05ee58525d29d1927e3eeb1764f72b1fca9ad9 | 286 | cpp | C++ | test/quantity_test.cpp | horance-liu/cquantity | 27c0e60087cd9650e154eb527c20be4d7114228a | [
"Apache-2.0"
] | null | null | null | test/quantity_test.cpp | horance-liu/cquantity | 27c0e60087cd9650e154eb527c20be4d7114228a | [
"Apache-2.0"
] | null | null | null | test/quantity_test.cpp | horance-liu/cquantity | 27c0e60087cd9650e154eb527c20be4d7114228a | [
"Apache-2.0"
] | null | null | null | #include "quantity.h"
#include <gtest/gtest.h>
struct QuantityTest : testing::Test {
};
TEST_F(QuantityTest, 3_mile_not_equals_4_mile)
{
Length mile3 = {.amount = 3, .unit = MILE};
Length mile4 = {.amount = 4, .unit = MILE};
ASSERT_FALSE(length_equals(&mile3, &mile4));
} | 22 | 48 | 0.671329 | horance-liu |
df0def27e73116f8cbf74dd8a719697919a52ffa | 747 | hpp | C++ | inc/kos/boot/efi/filesystem.hpp | EmilGedda/kOS | 86d9e3ae377b6d7f003feb1c6ce584e427ed0563 | [
"MIT"
] | 5 | 2018-07-24T02:57:20.000Z | 2020-06-02T04:23:09.000Z | inc/kos/boot/efi/filesystem.hpp | EmilGedda/kOS | 86d9e3ae377b6d7f003feb1c6ce584e427ed0563 | [
"MIT"
] | null | null | null | inc/kos/boot/efi/filesystem.hpp | EmilGedda/kOS | 86d9e3ae377b6d7f003feb1c6ce584e427ed0563 | [
"MIT"
] | 1 | 2018-08-27T15:47:21.000Z | 2018-08-27T15:47:21.000Z | #pragma once
#include <kos/view.hpp>
#include <kos/types.hpp>
#include <Uefi/UefiBaseType.h>
#include <Uefi/UefiSpec.h>
#include <Guid/FileInfo.h>
#include <Protocol/SimpleFileSystem.h>
namespace kos::boot::efi {
struct file_metadata {
u64 size = 0;
};
struct file {
u8* data = 0;
u64 size = 0;
file_metadata info{};
~file();
};
struct filesystem {
inline static EFI_GUID guid = EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID;
EFI_FILE_PROTOCOL *root = 0;
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *protocol = 0;
static auto from_handle(EFI_HANDLE device_handle) -> filesystem;
auto stat(EFI_FILE_PROTOCOL* file) -> file_metadata;
auto open(view<wchar_t> path) -> file;
};
} // namespace kos::boot::efi
| 21.342857 | 71 | 0.686747 | EmilGedda |
df1d90e79a4ed477c6654e89de578a4a0639334b | 59 | cpp | C++ | lecture/src/cpp/MyRecipeNote/File.cpp | mac-novice-pg2/tool_dev | c988b72f803f24a130e08ef8515ec282119e377f | [
"BSD-3-Clause"
] | null | null | null | lecture/src/cpp/MyRecipeNote/File.cpp | mac-novice-pg2/tool_dev | c988b72f803f24a130e08ef8515ec282119e377f | [
"BSD-3-Clause"
] | 1 | 2018-09-28T13:33:18.000Z | 2018-09-28T13:33:18.000Z | lecture/src/cpp/MyRecipeNote/File.cpp | mac-novice-pg2/tool_dev | c988b72f803f24a130e08ef8515ec282119e377f | [
"BSD-3-Clause"
] | null | null | null | #include "File.h"
File::File()
{
}
File::~File()
{
}
| 4.538462 | 18 | 0.474576 | mac-novice-pg2 |
df1db50c0b217aa8de54ab7f295324b96710a4c2 | 2,618 | cpp | C++ | range-v3/test/view/unique.cpp | jiayuehua/parallelts-range-exploration | 53b574f650995d1f113d663d7217511a93145ba0 | [
"Apache-2.0"
] | 11 | 2018-01-12T18:29:59.000Z | 2022-01-22T21:50:56.000Z | test/view/unique.cpp | pacxx/range-v3 | bf7494563ce555494024a038042ee279eefeec7d | [
"MIT"
] | 15 | 2017-12-19T11:10:41.000Z | 2018-02-13T10:46:13.000Z | test/view/unique.cpp | pacxx/range-v3 | bf7494563ce555494024a038042ee279eefeec7d | [
"MIT"
] | 1 | 2021-01-08T13:17:16.000Z | 2021-01-08T13:17:16.000Z | // Range v3 library
//
// Copyright Eric Niebler 2014
//
// Use, modification and distribution is subject to the
// Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// Project home: https://github.com/ericniebler/range-v3
#include <iostream>
#include <cctype>
#include <cstring>
#include <string>
#include <vector>
#include <range/v3/core.hpp>
#include <range/v3/view/unique.hpp>
#include <range/v3/view/counted.hpp>
#include <range/v3/view/iota.hpp>
#include <range/v3/algorithm/copy.hpp>
#include <range/v3/utility/iterator.hpp>
#include "../simple_test.hpp"
#include "../test_utils.hpp"
#include <range/v3/view/transform.hpp>
using std::toupper;
// from http://stackoverflow.com/a/2886589/195873
struct ci_char_traits : public std::char_traits<char>
{
static bool eq(char c1, char c2) { return toupper(c1) == toupper(c2); }
static bool ne(char c1, char c2) { return toupper(c1) != toupper(c2); }
static bool lt(char c1, char c2) { return toupper(c1) < toupper(c2); }
static int compare(const char* s1, const char* s2, size_t n)
{
for(; n-- != 0; ++s1, ++s2)
{
if(toupper(*s1) < toupper(*s2))
return -1;
if(toupper(*s1) > toupper(*s2))
return 1;
}
return 0;
}
static const char* find(const char* s, int n, char a)
{
for(; n-- > 0; ++s)
if(toupper(*s) != toupper(a))
break;
return s;
}
};
typedef std::basic_string<char, ci_char_traits> ci_string;
int main()
{
using namespace ranges;
int rgi[] = {1, 1, 1, 2, 3, 4, 4};
std::vector<int> out;
auto && rng = rgi | view::unique;
has_type<int &>(*begin(rng));
models<concepts::BoundedView>(rng);
models_not<concepts::SizedView>(rng);
models<concepts::ForwardIterator>(begin(rng));
models_not<concepts::BidirectionalIterator>(begin(rng));
copy(rng, ranges::back_inserter(out));
::check_equal(out, {1, 2, 3, 4});
std::vector<ci_string> rgs{"hello", "HELLO", "bye", "Bye", "BYE"};
auto && rng3 = rgs | view::unique;
has_type<ci_string &>(*begin(rng3));
models<concepts::ForwardView>(rng3);
models<concepts::BoundedView>(rng3);
models_not<concepts::SizedView>(rng3);
models<concepts::ForwardIterator>(begin(rng3));
models_not<concepts::BidirectionalIterator>(begin(rng3));
auto fs = rng3 | view::transform([](ci_string s){return std::string(s.c_str());});
::check_equal(fs, {"hello","bye"});
return test_result();
}
| 29.41573 | 86 | 0.627196 | jiayuehua |
df20d52c0b6d4fbab5b4e45af39b69d01d95de12 | 491 | cpp | C++ | calibration-cli/src/main.cpp | mc18g13/teensy-drone | 21a396c44a32b85d6455de2743e52ba2c95bb07d | [
"MIT"
] | null | null | null | calibration-cli/src/main.cpp | mc18g13/teensy-drone | 21a396c44a32b85d6455de2743e52ba2c95bb07d | [
"MIT"
] | null | null | null | calibration-cli/src/main.cpp | mc18g13/teensy-drone | 21a396c44a32b85d6455de2743e52ba2c95bb07d | [
"MIT"
] | null | null | null | #include <Arduino.h>
#include "MARGCalibrationHandler.h"
#include "ReceiverCalibrationHandler.h"
#include <arm_math.h>
#include "MenuOptionHandler.h"
#include "MainMenuHandler.h"
MARGCalibrationHandler margCalibrationHandler;
ReceiverCalibrationHandler receiverHandler;
MainMenuHandler mainMenu;
void setup() {
mainMenu.addOptionHandler(&margCalibrationHandler);
mainMenu.addOptionHandler(&receiverHandler);
mainMenu.setup();
}
void loop() {
delay(1000);
mainMenu.start();
} | 19.64 | 53 | 0.790224 | mc18g13 |
afff9df32294269c04ac98691aede97da9a36648 | 1,351 | cpp | C++ | brackets_match/test/brackets_match_test.cpp | fanck0605/shit-algorithm | 75031bb25b59e0594a792f909a6f97bb0375120d | [
"MIT"
] | null | null | null | brackets_match/test/brackets_match_test.cpp | fanck0605/shit-algorithm | 75031bb25b59e0594a792f909a6f97bb0375120d | [
"MIT"
] | null | null | null | brackets_match/test/brackets_match_test.cpp | fanck0605/shit-algorithm | 75031bb25b59e0594a792f909a6f97bb0375120d | [
"MIT"
] | null | null | null | #include <iostream>
#include <vector>
#include <map>
int main()
{
std::string bracketList = "([{}])";
std::map<char, char> bracketPairs{{'{', '}'}, {'[', ']'}, {'(', ')'}};
std::vector<char> leftBracketStack;
for (const auto ch : bracketList)
{
char leftBracket;
char rightBracket;
switch (ch)
{
case '{':
case '[':
case '(':
leftBracketStack.push_back(ch);
break;
case '}':
case ']':
case ')':
if (leftBracketStack.empty())
{
std::cout << "lack left bracket!" << std::endl;
return 0;
}
leftBracket = leftBracketStack.back();
rightBracket = bracketPairs[leftBracket];
if (rightBracket != ch)
{
std::cout << "not match!" << std::endl;
std::cout << "except: " << rightBracket << std::endl;
std::cout << "result: " << ch << std::endl;
return 0;
}
leftBracketStack.pop_back();
break;
default:
break;
}
}
if (!leftBracketStack.empty())
{
std::cout << "lack right bracket!";
return 0;
}
std::cout << "match success!" << std::endl;
return 0;
}
| 23.701754 | 74 | 0.437454 | fanck0605 |
b303266b3336153638d043eae723858785b0e98b | 2,066 | cpp | C++ | tools/genrpc/genrpc_template.cpp | tkng/pficommon | 1301e1c9f958656e4bc882ae2db9452e8cffab7e | [
"BSD-3-Clause"
] | 48 | 2017-04-03T18:46:24.000Z | 2022-02-28T01:44:05.000Z | tools/genrpc/genrpc_template.cpp | tkng/pficommon | 1301e1c9f958656e4bc882ae2db9452e8cffab7e | [
"BSD-3-Clause"
] | 44 | 2017-02-21T13:13:52.000Z | 2021-02-06T13:08:31.000Z | tools/genrpc/genrpc_template.cpp | tkng/pficommon | 1301e1c9f958656e4bc882ae2db9452e8cffab7e | [
"BSD-3-Clause"
] | 13 | 2016-12-28T05:04:58.000Z | 2021-10-01T02:17:23.000Z | #include "/usr/local/share/pficommon/gen_php.h"
#include "/usr/local/share/pficommon/gen_hs.h"
#include "/usr/local/share/pficommon/gen_null.h"
#define RPC_PROC_BKUP RPC_PROC
#undef RPC_PROC
#define RPC_PROC REFLECT_RPC_PROC
#define RPC_GEN_BKUP RPC_GEN
#undef RPC_GEN
#define RPC_GEN REFLECT_RPC_GEN
#include "<<<SIGFILE>>>"
#undef RPC_GEN
#define RPC_GEN RPC_GEN_BKUP
#undef RPC_GEN_BKUP
#undef RPC_PROC
#define RPC_PROC RPC_PROC_BKUP
#undef RPC_PROC_BKUP
#include <fstream>
using namespace std;
struct info{
const char *id;
const char *suffix;
void (*f)(vector<reflect_base*> &, const string &);
}infos[]={
{"php", "php", &php_generator::generate},
{"haskell", "hs", &haskell_generator::generate},
{"ocaml", "ml", &null_generator::generate},
{"java", "java", &null_generator::generate},
{"ruby", "rb", &null_generator::generate},
{"python", "py", &null_generator::generate},
{"perl", "pl", &null_generator::generate},
};
int main()
{
string base("<<<BASENAME>>>");
string lang("<<<LANG>>>");
size_t lang_num=sizeof(infos)/sizeof(infos[0]);
for (size_t i=0;i<lang_num;i++){
if (infos[i].id==lang){
string outname(base);
string new_suf("."+string(infos[i].suffix));
static const char *header_sufs[]={
".hpp",
".hxx",
".h",
"",
};
for (size_t j=0;j<sizeof(header_sufs)/sizeof(header_sufs[0]);j++){
string org_suf(header_sufs[j]);
if (org_suf==""){
//outname+=new_suf;
break;
}
string::size_type p=outname.find(org_suf);
if (p!=string::npos){
outname.replace(p, org_suf.length(), ""/*new_suf*/);
break;
}
}
try{
vector<reflect_base*> refs;
<<<ADDREFLECTS>>>
infos[i].f(refs, outname);
}
catch(exception& e){
cerr<<"generate error: "<<e.what()<<endl;
unlink(outname.c_str());
}
return 0;
}
}
cerr<<"language "<<lang<<" is not supported"<<endl;
return 0;
}
| 22.703297 | 72 | 0.592933 | tkng |
b308af6133ea26fee0b6963122a63fc74bb85293 | 1,801 | cpp | C++ | aws-cpp-sdk-cognito-idp/source/model/CustomSMSLambdaVersionConfigType.cpp | perfectrecall/aws-sdk-cpp | fb8cbebf2fd62720b65aeff841ad2950e73d8ebd | [
"Apache-2.0"
] | 1 | 2022-02-10T08:06:54.000Z | 2022-02-10T08:06:54.000Z | aws-cpp-sdk-cognito-idp/source/model/CustomSMSLambdaVersionConfigType.cpp | perfectrecall/aws-sdk-cpp | fb8cbebf2fd62720b65aeff841ad2950e73d8ebd | [
"Apache-2.0"
] | 1 | 2021-10-14T16:57:00.000Z | 2021-10-18T10:47:24.000Z | aws-cpp-sdk-cognito-idp/source/model/CustomSMSLambdaVersionConfigType.cpp | ravindra-wagh/aws-sdk-cpp | 7d5ff01b3c3b872f31ca98fb4ce868cd01e97696 | [
"Apache-2.0"
] | 1 | 2021-11-09T12:02:58.000Z | 2021-11-09T12:02:58.000Z | /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/cognito-idp/model/CustomSMSLambdaVersionConfigType.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <utility>
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
namespace Aws
{
namespace CognitoIdentityProvider
{
namespace Model
{
CustomSMSLambdaVersionConfigType::CustomSMSLambdaVersionConfigType() :
m_lambdaVersion(CustomSMSSenderLambdaVersionType::NOT_SET),
m_lambdaVersionHasBeenSet(false),
m_lambdaArnHasBeenSet(false)
{
}
CustomSMSLambdaVersionConfigType::CustomSMSLambdaVersionConfigType(JsonView jsonValue) :
m_lambdaVersion(CustomSMSSenderLambdaVersionType::NOT_SET),
m_lambdaVersionHasBeenSet(false),
m_lambdaArnHasBeenSet(false)
{
*this = jsonValue;
}
CustomSMSLambdaVersionConfigType& CustomSMSLambdaVersionConfigType::operator =(JsonView jsonValue)
{
if(jsonValue.ValueExists("LambdaVersion"))
{
m_lambdaVersion = CustomSMSSenderLambdaVersionTypeMapper::GetCustomSMSSenderLambdaVersionTypeForName(jsonValue.GetString("LambdaVersion"));
m_lambdaVersionHasBeenSet = true;
}
if(jsonValue.ValueExists("LambdaArn"))
{
m_lambdaArn = jsonValue.GetString("LambdaArn");
m_lambdaArnHasBeenSet = true;
}
return *this;
}
JsonValue CustomSMSLambdaVersionConfigType::Jsonize() const
{
JsonValue payload;
if(m_lambdaVersionHasBeenSet)
{
payload.WithString("LambdaVersion", CustomSMSSenderLambdaVersionTypeMapper::GetNameForCustomSMSSenderLambdaVersionType(m_lambdaVersion));
}
if(m_lambdaArnHasBeenSet)
{
payload.WithString("LambdaArn", m_lambdaArn);
}
return payload;
}
} // namespace Model
} // namespace CognitoIdentityProvider
} // namespace Aws
| 23.697368 | 143 | 0.783454 | perfectrecall |
b316a9dbc71148e4e734dedd9990719f082bc5ad | 1,454 | cpp | C++ | matslise/matslise/periodic.cpp | twist-numerical/matslise | ccce2bd3359963cfdd4b9686cb7b263754e77e7e | [
"MIT"
] | 4 | 2020-08-27T10:10:08.000Z | 2020-09-03T14:06:16.000Z | matslise/matslise/periodic.cpp | twist-numerical/matslise | ccce2bd3359963cfdd4b9686cb7b263754e77e7e | [
"MIT"
] | 7 | 2019-12-16T09:37:59.000Z | 2020-12-01T15:03:00.000Z | matslise/matslise/periodic.cpp | twist-numerical/matslise | ccce2bd3359963cfdd4b9686cb7b263754e77e7e | [
"MIT"
] | 1 | 2020-08-27T14:02:25.000Z | 2020-08-27T14:02:25.000Z | #include "../matslise.h"
#include "../util/find_sector.h"
#include "../util/constants.h"
using namespace matslise;
using namespace Eigen;
using namespace std;
template<typename Scalar>
pair<Y<Scalar, 1, 2>, Array<Scalar, 2, 1>>
PeriodicMatslise<Scalar>::propagate(
const Scalar &E, const Y<Scalar, 1, 2> &y,
const Scalar &a, const Scalar &b, bool use_h) const {
return matslise.template propagate<2>(E, y, a, b, use_h);
}
template<typename Scalar>
tuple<Scalar, Scalar, Array<Scalar, 2, 1>>
PeriodicMatslise<Scalar>::matchingError(const Scalar &E, bool use_h) const {
Y<Scalar, 1, 2> l = Y<Scalar, 1, 2>::Periodic();
Y<Scalar, 1, 2> r = Y<Scalar, 1, 2>::Periodic();
Array<Scalar, 2, 1> thetaL, thetaR;
tie(l, thetaL) = propagate(E, l, matslise.domain.min(), matslise.sectors[matslise.matchIndex]->max, use_h);
tie(r, thetaR) = propagate(E, r, matslise.domain.max(), matslise.sectors[matslise.matchIndex]->max, use_h);
Matrix<Scalar, 2, 2> err = l.y() - r.y();
Matrix<Scalar, 2, 2> dErr = l.ydE() - r.ydE();
Scalar error = err(0, 0) * err(1, 1) - err(0, 1) * err(1, 0);
Scalar dError = dErr(0, 0) * err(1, 1) + err(0, 0) * dErr(1, 1) - dErr(0, 1) * err(1, 0) - err(0, 1) * dErr(1, 0);
Array<Scalar, 2, 1> theta = thetaL - thetaR;
theta /= constants<Scalar>::PI;
theta[1] += 1; // adjust for initial conditions
return make_tuple(error, dError, theta);
}
#include "instantiate.h"
| 39.297297 | 118 | 0.634801 | twist-numerical |
b317cf9c548ebd9e6e16c605107aea308bfd37cc | 895 | cpp | C++ | qwertyattack/KeyPresses.cpp | tblock007/qwertyattack | 9b02531fa896ca269dbaeb1611cc2cc0bbf41de9 | [
"MIT"
] | 1 | 2019-09-11T18:47:52.000Z | 2019-09-11T18:47:52.000Z | qwertyattack/KeyPresses.cpp | tblock007/qwertyattack | 9b02531fa896ca269dbaeb1611cc2cc0bbf41de9 | [
"MIT"
] | null | null | null | qwertyattack/KeyPresses.cpp | tblock007/qwertyattack | 9b02531fa896ca269dbaeb1611cc2cc0bbf41de9 | [
"MIT"
] | 1 | 2019-09-26T03:34:28.000Z | 2019-09-26T03:34:28.000Z | #include "KeyPresses.hpp"
#include <SFML/Config.hpp>
#include "constants.hpp"
namespace qa {
KeyPresses::KeyPresses() : pressMask_(0)
{
}
KeyPresses::KeyPresses(sf::Uint32 mask) : pressMask_(mask)
{
}
void KeyPresses::reset()
{
pressMask_ = 0;
}
bool KeyPresses::isPressed(sf::Int32 i) const
{
return ((pressMask_ & (1 << i)) != 0);
}
bool KeyPresses::isPressed(char c) const
{
return isPressed(static_cast<sf::Int32>(c) - static_cast<sf::Int32>('A'));
}
void KeyPresses::setPressed(sf::Int32 i)
{
pressMask_ = pressMask_ | (1 << i);
}
void KeyPresses::setPressed(char c)
{
setPressed(static_cast<sf::Int32>(c) - static_cast<sf::Int32>('A'));
}
void KeyPresses::resetPressed(sf::Int32 i)
{
pressMask_ = pressMask_ & ~(1 << i);
}
void KeyPresses::resetPressed(char c)
{
resetPressed(static_cast<sf::Int32>(c) - static_cast<sf::Int32>('A'));
}
} // namespace qa
| 16.886792 | 77 | 0.667039 | tblock007 |
b31bc20245b1c2da9a5e82afcd552231ed788729 | 1,285 | cpp | C++ | src/lib/util/tests/TestUtToken.cpp | MarkLeone/PostHaste | 56083e30a58489338e39387981029488d7af2390 | [
"MIT"
] | 4 | 2015-05-07T03:29:52.000Z | 2016-08-29T17:30:15.000Z | src/lib/util/tests/TestUtToken.cpp | MarkLeone/PostHaste | 56083e30a58489338e39387981029488d7af2390 | [
"MIT"
] | 1 | 2018-05-14T04:41:04.000Z | 2018-05-14T04:41:04.000Z | src/lib/util/tests/TestUtToken.cpp | MarkLeone/PostHaste | 56083e30a58489338e39387981029488d7af2390 | [
"MIT"
] | null | null | null | #include "util/UtToken.h"
#include "util/UtTokenFactory.h"
#include <gtest/gtest.h>
#include <list>
#include <stdio.h>
#include <vector>
class TestUtToken : public testing::Test { };
TEST_F(TestUtToken, TestTokens)
{
UtTokenFactory factory;
UtToken t1 = factory.Get("foo");
UtToken t2 = factory.Get("foo");
UtToken t3 = factory.Get("bar");
EXPECT_TRUE(t1 == t2);
EXPECT_EQ(t1, t2);
EXPECT_TRUE(t1 != t3);
EXPECT_NE(t1, t3);
char* s1 = strdup("foo");
char* s2 = strdup("bar");
UtToken t4 = factory.Get(s1);
UtToken t5 = factory.Get(s2);
EXPECT_NE(t4, t5);
EXPECT_EQ(t1, t4);
EXPECT_EQ(t2, t4);
EXPECT_EQ(t3, t5);
std::string str1 = s1;
std::string str2 = s2;
UtToken t6 = factory.Get(str1);
UtToken t7 = factory.Get(str2);
EXPECT_NE(t6, t7);
EXPECT_TRUE(t1 == t6);
EXPECT_EQ(t2, t6);
EXPECT_EQ(t3, t7);
// Test explicit/implict conversion.
std::cout << static_cast<const char*>(t1) << std::endl;
std::cout << std::string(t1) << std::endl;
std::cout << t1 << std::endl;
const char* name1 = t1;
std::cout << name1 << std::endl;
free(s1);
free(s2);
}
int main(int argc, char **argv)
{
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
| 23.363636 | 59 | 0.607004 | MarkLeone |
b31ca6d108369ab3e0a817dec4327a44c69d4763 | 36,105 | cpp | C++ | ExampleViewAllySkillPanel_publish/WarcraftIII_DLL_126-127/DotAAllstarsHelper/BlpReadWrite.cpp | UnrealKaraulov/DotaAllstarsHelper_DLL_FOR_DOTA | ed621a70540cdab03db8acc7cc6b80794363abcd | [
"Unlicense"
] | 1 | 2021-10-31T19:47:18.000Z | 2021-10-31T19:47:18.000Z | ExampleViewAllySkillPanel_publish/WarcraftIII_DLL_126-127/DotAAllstarsHelper/BlpReadWrite.cpp | UnrealKaraulov/DotaAllstarsHelper_DLL_FOR_DOTA | ed621a70540cdab03db8acc7cc6b80794363abcd | [
"Unlicense"
] | 1 | 2021-11-22T05:56:47.000Z | 2022-01-12T10:55:38.000Z | ExampleViewAllySkillPanel_publish/WarcraftIII_DLL_126-127/DotAAllstarsHelper/BlpReadWrite.cpp | UnrealKaraulov/DotaAllstarsHelper_DLL_FOR_DOTA | ed621a70540cdab03db8acc7cc6b80794363abcd | [
"Unlicense"
] | 1 | 2021-09-27T14:35:34.000Z | 2021-09-27T14:35:34.000Z | #include "BlpReadWrite.h"
BOOL IsPowerOfTwo( const long i )
{
long t = i;
while ( t % 2 == 0 )
t >>= 1;
return ( t == 1 );
}
BOOL GetFirstBytes( const char* filename, char* buffer, unsigned long length )
{
FILE* file;
fopen_s( &file, filename, "rb" );
if ( !file )
return FALSE;
if ( fread( buffer, 1, length, file ) < length )
{
fclose( file );
return FALSE;
}
fclose( file );
return TRUE;
}
BOOL MaskOk( unsigned char *mask, int expectedWidth, int expectedHeight, int expectedBpp, long &offset, const char *maskFile )
{
TGAHeader* header = ( TGAHeader* )mask;
if ( header->colorMapType != 0 || header->imageType != 2 || header->width == 0 || header->height == 0 )
return FALSE;
if ( header->width != expectedWidth || header->height != expectedHeight )
return FALSE;
if ( header->bpp / 8 != expectedBpp )
return FALSE;
offset = ( long )( sizeof( TGAHeader ) + header->imageIDLength );
return TRUE;
}
template<typename T>
inline void AssignWeightedPixel( double *target, T *source, double weight, int bytespp, BOOL add )
{
if ( !add )
{
target[ 0 ] = ( ( double )source[ 0 ] ) * weight;
target[ 1 ] = ( ( double )source[ 1 ] ) * weight;
target[ 2 ] = ( ( double )source[ 2 ] ) * weight;
if ( bytespp == 4 )
target[ 3 ] = ( ( double )source[ 3 ] ) * weight;
}
else
{
target[ 0 ] += ( ( double )source[ 0 ] ) * weight;
target[ 1 ] += ( ( double )source[ 1 ] ) * weight;
target[ 2 ] += ( ( double )source[ 2 ] ) * weight;
if ( bytespp == 4 )
target[ 3 ] += ( ( double )source[ 3 ] ) * weight;
}
}
inline unsigned char NormalizeComponent( double val )
{
if ( val < 0.0 )
return 0;
if ( val > ( double )0xFF )
return 0xFF;
return ( unsigned char )val;
}
static int* g_px1a = NULL;
static int g_px1a_w = 0;
static int* g_px1ab = NULL;
static int g_px1ab_w = 0;
void Resize_HQ_4ch( unsigned char* src, int w1, int h1,
int w2, int h2, StormBuffer& outdest )
{
unsigned char * dest = ( unsigned char * )Storm::MemAlloc( w2*h2 * 4 );
// Both buffers must be in ARGB format, and a scanline should be w*4 bytes.
// If pQuitFlag is non-NULL, then at the end of each scanline, it will check
// the value at *pQuitFlag; if it's set to 'true', this function will abort.
// (This is handy if you're background-loading an image, and decide to cancel.)
// NOTE: THIS WILL OVERFLOW for really major downsizing (2800x2800 to 1x1 or more)
// (2800 ~ sqrt(2^23)) - for a lazy fix, just call this in two passes.
/*assert( src );
assert( dest );
assert( w1 >= 1 );
assert( h1 >= 1 );
assert( w2 >= 1 );
assert( h2 >= 1 );
*/
// check for MMX (one time only)
if ( w2 * 2 == w1 && h2 * 2 == h1 )
{
// perfect 2x2:1 case - faster code
// (especially important because this is common for generating low (large) mip levels!)
DWORD *dsrc = ( DWORD* )src;
DWORD *ddest = ( DWORD* )dest;
DWORD remainder = 0;
int i = 0;
for ( int y2 = 0; y2 < h2; y2++ )
{
int y1 = y2 * 2;
DWORD* temp_src = &dsrc[ y1*w1 ];
for ( int x2 = 0; x2 < w2; x2++ )
{
DWORD xUL = temp_src[ 0 ];
DWORD xUR = temp_src[ 1 ];
DWORD xLL = temp_src[ w1 ];
DWORD xLR = temp_src[ w1 + 1 ];
// note: DWORD packing is 0xAARRGGBB
DWORD redblue = ( xUL & 0x00FF00FF ) + ( xUR & 0x00FF00FF ) + ( xLL & 0x00FF00FF ) + ( xLR & 0x00FF00FF ) + ( remainder & 0x00FF00FF );
DWORD green = ( xUL & 0x0000FF00 ) + ( xUR & 0x0000FF00 ) + ( xLL & 0x0000FF00 ) + ( xLR & 0x0000FF00 ) + ( remainder & 0x0000FF00 );
// redblue = 000000rr rrrrrrrr 000000bb bbbbbbbb
// green = xxxxxx00 000000gg gggggggg 00000000
remainder = ( redblue & 0x00030003 ) | ( green & 0x00000300 );
ddest[ i++ ] = ( ( redblue & 0x03FC03FC ) | ( green & 0x0003FC00 ) ) >> 2;
temp_src += 2;
}
}
}
else
{
// arbitrary resize.
unsigned int *dsrc = ( unsigned int * )src;
unsigned int *ddest = ( unsigned int * )dest;
bool bUpsampleX = ( w1 < w2 );
bool bUpsampleY = ( h1 < h2 );
// If too many input pixels map to one output pixel, our 32-bit accumulation values
// could overflow - so, if we have huge mappings like that, cut down the weights:
// 256 max color value
// *256 weight_x
// *256 weight_y
// *256 (16*16) maximum # of input pixels (x,y) - unless we cut the weights down...
int weight_shift = 0;
float source_texels_per_out_pixel = ( ( w1 / ( float )w2 + 1 )
* ( h1 / ( float )h2 + 1 )
);
float weight_per_pixel = source_texels_per_out_pixel * 256 * 256; //weight_x * weight_y
float accum_per_pixel = weight_per_pixel * 256; //color value is 0-255
float weight_div = accum_per_pixel / 4294967000.0f;
if ( weight_div > 1 )
weight_shift = ( int )ceilf( logf( ( float )weight_div ) / logf( 2.0f ) );
weight_shift = min( 15, weight_shift ); // this could go to 15 and still be ok.
float fh = 256 * h1 / ( float )h2;
float fw = 256 * w1 / ( float )w2;
if ( bUpsampleX && bUpsampleY )
{
// faster to just do 2x2 bilinear interp here
// cache x1a, x1b for all the columns:
// ...and your OS better have garbage collection on process exit :)
if ( g_px1a_w < w2 )
{
if ( g_px1a ) delete[ ] g_px1a;
g_px1a = new int[ w2 * 2 * 1 ];
g_px1a_w = w2 * 2;
}
for ( int x2 = 0; x2 < w2; x2++ )
{
// find the x-range of input pixels that will contribute:
int x1a = ( int )( x2*fw );
x1a = min( x1a, 256 * ( w1 - 1 ) - 1 );
g_px1a[ x2 ] = x1a;
}
// FOR EVERY OUTPUT PIXEL
for ( int y2 = 0; y2 < h2; y2++ )
{
// find the y-range of input pixels that will contribute:
int y1a = ( int )( y2*fh );
y1a = min( y1a, 256 * ( h1 - 1 ) - 1 );
int y1c = y1a >> 8;
unsigned int *ddest = &( ( unsigned int * )dest )[ y2*w2 + 0 ];
for ( int x2 = 0; x2 < w2; x2++ )
{
// find the x-range of input pixels that will contribute:
int x1a = g_px1a[ x2 ];//(int)(x2*fw);
int x1c = x1a >> 8;
unsigned int *dsrc2 = &dsrc[ y1c*w1 + x1c ];
// PERFORM BILINEAR INTERPOLATION on 2x2 pixels
unsigned int r = 0, g = 0, b = 0, a = 0;
unsigned int weight_x = 256 - ( x1a & 0xFF );
unsigned int weight_y = 256 - ( y1a & 0xFF );
for ( int y = 0; y < 2; y++ )
{
for ( int x = 0; x < 2; x++ )
{
unsigned int c = dsrc2[ x + y*w1 ];
unsigned int r_src = ( c ) & 0xFF;
unsigned int g_src = ( c >> 8 ) & 0xFF;
unsigned int b_src = ( c >> 16 ) & 0xFF;
unsigned int w = ( weight_x * weight_y ) >> weight_shift;
r += r_src * w;
g += g_src * w;
b += b_src * w;
weight_x = 256 - weight_x;
}
weight_y = 256 - weight_y;
}
unsigned int c = ( ( r >> 16 ) ) | ( ( g >> 8 ) & 0xFF00 ) | ( b & 0xFF0000 );
*ddest++ = c;//ddest[y2*w2 + x2] = c;
}
}
}
else
{
// cache x1a, x1b for all the columns:
// ...and your OS better have garbage collection on process exit :)
if ( g_px1ab_w < w2 )
{
if ( g_px1ab ) delete[ ] g_px1ab;
g_px1ab = new int[ w2 * 2 * 2 ];
g_px1ab_w = w2 * 2;
}
for ( int x2 = 0; x2 < w2; x2++ )
{
// find the x-range of input pixels that will contribute:
int x1a = ( int )( ( x2 )*fw );
int x1b = ( int )( ( x2 + 1 )*fw );
if ( bUpsampleX ) // map to same pixel -> we want to interpolate between two pixels!
x1b = x1a + 256;
x1b = min( x1b, 256 * w1 - 1 );
g_px1ab[ x2 * 2 + 0 ] = x1a;
g_px1ab[ x2 * 2 + 1 ] = x1b;
}
// FOR EVERY OUTPUT PIXEL
for ( int y2 = 0; y2 < h2; y2++ )
{
// find the y-range of input pixels that will contribute:
int y1a = ( int )( ( y2 )*fh );
int y1b = ( int )( ( y2 + 1 )*fh );
if ( bUpsampleY ) // map to same pixel -> we want to interpolate between two pixels!
y1b = y1a + 256;
y1b = min( y1b, 256 * h1 - 1 );
int y1c = y1a >> 8;
int y1d = y1b >> 8;
for ( int x2 = 0; x2 < w2; x2++ )
{
// find the x-range of input pixels that will contribute:
int x1a = g_px1ab[ x2 * 2 + 0 ]; // (computed earlier)
int x1b = g_px1ab[ x2 * 2 + 1 ]; // (computed earlier)
int x1c = x1a >> 8;
int x1d = x1b >> 8;
// ADD UP ALL INPUT PIXELS CONTRIBUTING TO THIS OUTPUT PIXEL:
unsigned int r = 0, g = 0, b = 0, a = 0;
for ( int y = y1c; y <= y1d; y++ )
{
unsigned int weight_y = 256;
if ( y1c != y1d )
{
if ( y == y1c )
weight_y = 256 - ( y1a & 0xFF );
else if ( y == y1d )
weight_y = ( y1b & 0xFF );
}
unsigned int *dsrc2 = &dsrc[ y*w1 + x1c ];
for ( int x = x1c; x <= x1d; x++ )
{
unsigned int weight_x = 256;
if ( x1c != x1d )
{
if ( x == x1c )
weight_x = 256 - ( x1a & 0xFF );
else if ( x == x1d )
weight_x = ( x1b & 0xFF );
}
unsigned int c = *dsrc2++;//dsrc[y*w1 + x];
unsigned int r_src = ( c ) & 0xFF;
unsigned int g_src = ( c >> 8 ) & 0xFF;
unsigned int b_src = ( c >> 16 ) & 0xFF;
unsigned int w = ( weight_x * weight_y ) >> weight_shift;
r += r_src * w;
g += g_src * w;
b += b_src * w;
a += w;
}
}
// write results
unsigned int c = ( ( r / a ) ) | ( ( g / a ) << 8 ) | ( ( b / a ) << 16 );
*ddest++ = c;//ddest[y2*w2 + x2] = c;
}
}
}
}
outdest.buf = ( char* )dest;
outdest.length = w2 * h2 * 4;
}
void ScaneImageSimple( unsigned char * data, int oldW, int oldH, int newW, int newH, int bytespp, StormBuffer & target )
{
unsigned char* newData = ( unsigned char * )Storm::MemAlloc( newW*newH*bytespp );
int maxpixel = oldW*oldH*bytespp - 4;
double scaleWidth = ( double )newW / ( double )oldW;
double scaleHeight = ( double )newH / ( double )oldH;
int pixel = 0;
for ( int cy = 0; cy < newH; cy++ ) {
for ( int cx = 0; cx < newW; cx++ ) {
int nearestMatch = ( ( int )( cy / scaleHeight )*( oldW * bytespp ) )
+ ( ( int )( cx / scaleWidth )*bytespp );
if ( nearestMatch > maxpixel )
{
nearestMatch = maxpixel;
}
newData[ pixel ] = data[ nearestMatch ];
newData[ pixel + 1 ] = data[ nearestMatch + 1 ];
newData[ pixel + 2 ] = data[ nearestMatch + 2 ];
if ( bytespp == 4 ) newData[ pixel + 3 ] = data[ nearestMatch + 3 ];
pixel += bytespp;
}
}
target.length = newW*newH*bytespp;
target.buf = ( char * )newData;
}
void ScaleImage( unsigned char* rawData, int oldW, int oldH, int newW, int newH, int bytespp, StormBuffer &target )
{
ScaneImageSimple( rawData, oldW, oldH, newW, newH, bytespp, target );
return;
/*if ( bytespp == 4 )
{
Resize_HQ_4ch( rawData, oldW, oldH, newW, newH, target );
return;
}
if ( oldW == newW && oldH == newH )
{
target.length = ( unsigned long )( newW * newH * bytespp );
target.buf = Storm::MemAlloc[ target.length ];
std::memcpy( target.buf, rawData, target.length );
return;
}
// scale horizontally
double* temp = new double[ ( unsigned int )( oldH * newW * bytespp ) ];
if ( oldW == newW )
{
for ( int i = 0; i < oldW * oldH * bytespp; i++ )
temp[ i ] = ( double )rawData[ i ];
}
else
{
double sum = 0;
double diffW = ( ( double )oldW / ( double )newW );
for ( int i = 0; i < newW; i++ )
{
double newSum = sum + diffW;
int pix = ( int )floor( sum );
double weight = min( diffW, 1.0 - fmod( sum, 1.0 ) );
for ( int j = 0; j < oldH; j++ )
AssignWeightedPixel( &temp[ ( j*newW + i )*bytespp ], &rawData[ ( j*oldW + pix )*bytespp ], ( weight / diffW ), bytespp, FALSE );
sum += weight;
while ( sum < newSum )
{
weight = min( newSum - sum, 1.0 );
pix++;
for ( int j = 0; j < oldH; j++ )
AssignWeightedPixel( &temp[ ( j*newW + i )*bytespp ], &rawData[ ( j*oldW + pix )*bytespp ], ( weight / diffW ), bytespp, TRUE );
sum += weight;
}
}
}
// scale vertically
target.length = ( unsigned long )( newW * newH * bytespp );
target.buf = Storm::MemAlloc[ target.length ];
double* final = new double[ target.length ];
if ( newH == oldH )
{
std::memcpy( final, temp, target.length * sizeof( double ) );
}
else
{
double sum = 0;
double diffH = ( ( double )oldH / ( double )newH );
for ( int j = 0; j < newH; j++ )
{
double newSum = sum + diffH;
int pix = ( int )floor( sum );
double weight = min( diffH, 1.0 - fmod( sum, 1.0 ) );
for ( int i = 0; i < newW; i++ )
AssignWeightedPixel( &final[ ( j*newW + i )*bytespp ], &temp[ ( pix*newW + i )*bytespp ], ( weight / diffH ), bytespp, FALSE );
sum += weight;
while ( sum < newSum )
{
weight = min( newSum - sum, 1.0 );
pix++;
for ( int i = 0; i < newW; i++ )
AssignWeightedPixel( &final[ ( j*newW + i )*bytespp ], &temp[ ( pix*newW + i )*bytespp ], ( weight / diffH ), bytespp, TRUE );
sum += weight;
}
}
}
for ( unsigned long i = 0; i < target.length; i++ )
target.buf[ i ] = ( char )NormalizeComponent( final[ i ] );
delete[ ] final;
delete[ ] temp;*/
}
void SubtractColor( unsigned char &pixel, unsigned char &mask )
{
if ( 0xFF - mask > pixel )
pixel = 0;
else
pixel -= ( 0xFF - mask );
}
void DivideColor( unsigned char &pixel, unsigned char &mask )
{
pixel = ( unsigned char )( ( double )pixel * ( ( double )mask / ( double )0xFF ) );
}
BOOL ApplyOverlay( unsigned char* rawData, unsigned char* mask, int width, int height, int bytespp, int maskBpp )
{
if ( !mask )
return FALSE;
for ( int i = 0; i < width * height; i++ )
{
DivideColor( rawData[ i*bytespp ], mask[ i*maskBpp ] );
DivideColor( rawData[ i*bytespp + 1 ], mask[ i*maskBpp + 1 ] );
DivideColor( rawData[ i*bytespp + 2 ], mask[ i*maskBpp + 2 ] );
if ( bytespp == 4 && maskBpp == 4 )
DivideColor( rawData[ i*bytespp + 3 ], mask[ i*maskBpp + 3 ] );
}
return TRUE;
}
BOOL ApplyBorder( unsigned char* rawData, unsigned char* mask, int width, int height, int bytespp, int borderBpp )
{
if ( !mask )
return FALSE;
if ( borderBpp == 4 )
{
for ( int i = 0; i < width * height; i++ )
{
if ( mask[ i*borderBpp + 3 ] == 0xFF )
{ // no transparence
rawData[ i*bytespp ] = mask[ i*borderBpp ];
rawData[ i*bytespp + 1 ] = mask[ i*borderBpp + 1 ];
rawData[ i*bytespp + 2 ] = mask[ i*borderBpp + 2 ];
if ( bytespp == 4 )
rawData[ i*bytespp + 3 ] = mask[ i*borderBpp + 3 ];
}
else if ( mask[ i*borderBpp + 3 ] == 0x00 )
{ // full transparence
rawData[ i*bytespp ] = rawData[ i*bytespp + 1 ] = rawData[ i*bytespp + 2 ] = 0x00;
if ( bytespp == 4 )
rawData[ i*bytespp + 3 ] = 0x00;
}
}
}
else
{
for ( int i = 0; i < width * height; i++ )
{
if ( mask[ i*borderBpp ] != 0xFF || mask[ i*borderBpp + 1 ] != 0xFF || mask[ i*borderBpp + 2 ] != 0xFF )
{ // not white
rawData[ i*bytespp ] = mask[ i*borderBpp ];
rawData[ i*bytespp + 1 ] = mask[ i*borderBpp + 1 ];
rawData[ i*bytespp + 2 ] = mask[ i*borderBpp + 2 ];
}
}
}
return TRUE;
}
int GetRequiredMipMaps( int width, int height )
{
int mips = 0;
while ( width > 0 && height > 0 )
{
mips++;
width = width / 2;
height = height / 2;
}
return mips;
}
void * ReadImage( int &width,
int &height,
int &nchannels,
const void *buffer,
int sizebytes )
{
JPEG_CORE_PROPERTIES jcprops = JPEG_CORE_PROPERTIES( );
if ( ijlInit( &jcprops ) != IJL_OK )
{
ijlFree( &jcprops );
MessageBoxA( 0, "IJL INIT ERROR", " Success ! ", 0 );
return NULL;
}
nchannels = 4;
unsigned char * pixbuff = ( unsigned char * )Storm::MemAlloc( width*height*nchannels );
if ( !pixbuff )
{
ijlFree( &jcprops );
MessageBoxA( 0, "pixbuff ERROR", " Success ! ", 0 );
return NULL;
}
jcprops.UseJPEGPROPERTIES = 0;
jcprops.DIBBytes = ( unsigned char * )pixbuff;
jcprops.DIBWidth = width;
jcprops.DIBHeight = height;
jcprops.DIBPadBytes = 0;
jcprops.DIBChannels = nchannels;
jcprops.DIBColor = IJL_OTHER;
jcprops.DIBSubsampling = IJL_NONE;
jcprops.JPGFile = NULL;
jcprops.JPGBytes = ( unsigned char * )buffer;
jcprops.JPGSizeBytes = sizebytes;
jcprops.JPGWidth = width;
jcprops.JPGHeight = height;
jcprops.JPGChannels = nchannels;
jcprops.JPGColor = IJL_OTHER;
jcprops.JPGSubsampling = IJL_NONE;
jcprops.JPGThumbWidth = 0;
jcprops.JPGThumbHeight = 0;
jcprops.cconversion_reqd = 1;
jcprops.upsampling_reqd = 1;
jcprops.jquality = 75;
if ( ijlRead( &jcprops, IJL_JBUFF_READWHOLEIMAGE ) != IJL_OK )
{
ijlFree( &jcprops );
MessageBoxA( 0, "IJL_JBUFF_READWHOLEIMAGE ERROR", " Success ! ", 0 );
return NULL;
}
if ( ijlFree( &jcprops ) != IJL_OK )
{
MessageBoxA( 0, "ijlFree ERROR", " Success ! ", 0 );
return 0;
}
return ( void * )pixbuff;
}
void * Compress( const void *source,
int width,
int height,
int bpp,
int &len,
int quality )
{
JPEG_CORE_PROPERTIES jcprops;
if ( ijlInit( &jcprops ) != IJL_OK )
{
ijlFree( &jcprops );
return 0;
}
jcprops.DIBWidth = width;
jcprops.DIBHeight = height;
jcprops.JPGWidth = width;
jcprops.JPGHeight = height;
jcprops.DIBBytes = ( unsigned char * )source;
jcprops.DIBPadBytes = 0;
jcprops.DIBChannels = bpp;
jcprops.JPGChannels = bpp;
if ( bpp == 3 )
{
jcprops.DIBColor = IJL_RGB;
jcprops.JPGColor = IJL_YCBCR;
jcprops.JPGSubsampling = IJL_411;
jcprops.DIBSubsampling = ( IJL_DIBSUBSAMPLING )0;
}
else
{
jcprops.DIBColor = IJL_G;
jcprops.JPGColor = IJL_G;
jcprops.JPGSubsampling = ( IJL_JPGSUBSAMPLING )0;
jcprops.DIBSubsampling = ( IJL_DIBSUBSAMPLING )0;
}
int size = width*height*bpp;
unsigned char * buffer = ( unsigned char * )Storm::MemAlloc( size );
jcprops.JPGSizeBytes = size;
jcprops.JPGBytes = buffer;
jcprops.jquality = quality;
if ( ijlWrite( &jcprops, IJL_JBUFF_WRITEWHOLEIMAGE ) != IJL_OK )
{
ijlFree( &jcprops );
Storm::MemFree( buffer );
return 0;
}
if ( ijlFree( &jcprops ) != IJL_OK )
{
Storm::MemFree( buffer );
return 0;
}
len = jcprops.JPGSizeBytes;
return buffer;
}
BOOL CreateJpgBLP( StormBuffer rawData, StormBuffer &output, int quality, char const *, int width, int height, int bytespp, int alphaflag, int &maxmipmaps )
{
StormBuffer target[ 16 ];
StormBuffer scaled[ 16 ];
StormBuffer source;
source.buf = rawData.buf;
source.length = ( unsigned long )( width * height * 4 );
if ( bytespp < 4 )
{
source.buf = ( char * )Storm::MemAlloc( ( unsigned int )( width * height * 4 ) );
for ( int j = 0; j < width * height; j++ )
{
std::memcpy( source.buf + j * 4, rawData.buf + j*bytespp, ( size_t )bytespp );
source.buf[ j * 4 + 3 ] = '\xFF';
}
}
int truemipmaps = GetRequiredMipMaps( width, height );
BLPHeader blpHeader;
std::memcpy( blpHeader.ident, "BLP1", 4 );
blpHeader.compress = 0; // jpg compression
blpHeader.IsAlpha = ( uint32_t )alphaflag;
blpHeader.sizey = ( unsigned long )height;
blpHeader.sizex = ( unsigned long )width;
blpHeader.alphaEncoding = ( uint32_t )( !alphaflag ? 5 : 4 ); // BGR or BGRA
blpHeader.flags2 = 1;
memset( &blpHeader.poffs, 0, 16 * sizeof( long ) );
memset( &blpHeader.psize, 0, 16 * sizeof( long ) );
int xdimension = width;
int ydimension = height;
output.length = sizeof( BLPHeader ) + 4; // header + one int for jpg header size
for ( int i = 0; i < 16; i++ )
{
if ( i < maxmipmaps && xdimension > 0 && ydimension > 0 )
{
if ( i == 0 )
scaled[ 0 ] = source;
else // generate mipmaps
ScaleImage( ( unsigned char* )scaled[ i - 1 ].buf, xdimension * 2, ydimension * 2, xdimension, ydimension, 4, scaled[ i ] );
//if ( !ConvertToJpg( scaled[ i ], target[ i ], xdimension, ydimension, 4, quality, TRUE ) )
JPEG_CORE_PROPERTIES v17;
ijlInit( &v17 );
void * compressedimage;
int imglen = 0;
if ( compressedimage = Compress( scaled[ i ].buf, xdimension, ydimension, bytespp, imglen, quality ) )
{
target[ i ].buf = ( char * )compressedimage;
target[ i ].length = imglen;
}
else
{
for ( int j = 0; j <= i; j++ )
{ // cleanup
if ( bytespp < 4 || j > 0 )
scaled->Clear( );
if ( target[ j ].buf )
target[ j ].Clear( );
}
return FALSE;
}
blpHeader.poffs[ i ] = output.length;
blpHeader.psize[ i ] = target[ i ].length;
output.length += target[ i ].length;
}
else
{
if ( i < truemipmaps )
{
if ( i > 0 )
{
blpHeader.poffs[ i ] = blpHeader.poffs[ i - 1 ];
blpHeader.psize[ i ] = blpHeader.psize[ i - 1 ];
}
}
else
{
blpHeader.poffs[ i ] = 0;
blpHeader.psize[ i ] = 0;
}
}
xdimension = xdimension / 2;
ydimension = ydimension / 2;
}
maxmipmaps = min( truemipmaps, maxmipmaps );
output.buf = ( char * )Storm::MemAlloc( output.length );
std::memcpy( output.buf, &blpHeader, sizeof( BLPHeader ) );
memset( output.buf + sizeof( BLPHeader ), 0, 4 );
char* blp = output.buf + sizeof( BLPHeader ) + 4;
for ( int i = 0; i < 16; i++ )
{
if ( i < maxmipmaps && width > 0 && height > 0 )
{
std::memcpy( blp, target[ i ].buf, target[ i ].length );
if ( bytespp < 4 || i > 0 ) // cleanup
scaled[ i ].Clear( );
if ( target[ i ].buf )
target[ i ].Clear( );
blp += target[ i ].length;
}
width = width / 2;
height = height / 2;
}
return TRUE;
}
BOOL CreatePalettedBLP( StormBuffer rawData, StormBuffer &output, int colors, char const *, int width, int height, int bytespp, int alphaflag, int &maxmipmaps )
{
CQuantizer* q = new CQuantizer( ( unsigned int )colors, 8 );
q->ProcessImage( ( unsigned char* )rawData.buf, ( unsigned long )( width * height ), ( unsigned char )bytespp, 0x00 );
int truemipmaps = GetRequiredMipMaps( width, height );
BLPHeader blpHeader;
std::memcpy( blpHeader.ident, "BLP1", 4 );
blpHeader.compress = 1; // paletted
blpHeader.IsAlpha = 8;
blpHeader.sizey = ( unsigned long )height;
blpHeader.sizex = ( unsigned long )width;
blpHeader.alphaEncoding = 4; // BGR or BGRA
blpHeader.flags2 = 1;
memset( &blpHeader.poffs, 0, 16 * sizeof( long ) );
memset( &blpHeader.psize, 0, 16 * sizeof( long ) );
if ( !maxmipmaps )
maxmipmaps = truemipmaps;
output.length = sizeof( BLPHeader ) + sizeof( BGRAPix ) * 256; // header + palette
StormBuffer bufs[ 16 ];
int xdimension = width;
int ydimension = height;
for ( int i = 0; i < 16; i++ )
{
if ( i < maxmipmaps && xdimension > 0 && ydimension > 0 )
{
if ( i == 0 )
bufs[ 0 ] = rawData;
else // generate mipmaps
ScaleImage( ( unsigned char* )bufs[ i - 1 ].buf, xdimension * 2, ydimension * 2, xdimension, ydimension, bytespp, bufs[ i ] );
blpHeader.poffs[ i ] = output.length;
blpHeader.psize[ i ] = ( unsigned long )( xdimension * ydimension * 2 ); //(q->NeedsAlphaChannel() ? 2 : 1);
output.length += blpHeader.psize[ i ];
}
else
{
if ( i < truemipmaps )
{ // war3 requires at least 8 mipmaps for the alpha channel to work
if ( i > 0 )
{
blpHeader.poffs[ i ] = blpHeader.poffs[ i - 1 ];
blpHeader.psize[ i ] = blpHeader.psize[ i - 1 ];
}
}
else
{
blpHeader.poffs[ i ] = 0;
blpHeader.psize[ i ] = 0;
}
}
xdimension = xdimension / 2;
ydimension = ydimension / 2;
}
output.buf = ( char * )Storm::MemAlloc( output.length );
unsigned char* blpData = ( unsigned char* )output.buf;
std::memcpy( blpData, &blpHeader, sizeof( BLPHeader ) );
memset( blpData + sizeof( BLPHeader ), 0, sizeof( BGRAPix ) * 256 );
unsigned char* blp = blpData + sizeof( BLPHeader ) + sizeof( BGRAPix ) * 256;
BGRAPix *palette = ( BGRAPix* )( blpData + sizeof( BLPHeader ) );
q->SetColorTable( palette );
for ( int i = 0; i <= 16; i++ )
{
if ( i < maxmipmaps && width > 0 && height > 0 )
{
BGRAPix* raw = ( BGRAPix* )bufs[ i ].buf;
memset( blp, 0xFF, ( size_t )( width * height * 2 ) ); //(q->NeedsAlphaChannel() ? 2 : 1);
q->FloydSteinbergDither( ( unsigned char* )bufs[ i ].buf, width, height, ( unsigned char )bytespp, blp, palette );
if ( q->NeedsAlphaChannel( ) )
{
for ( int y = 0; y < height; y++ )
{
for ( int x = 0; x < width; x++ )
{
unsigned char *z = blp + width * ( height - y - 1 ) + x + width * height;
BGRAPix *j = raw + width * y + x;
*( z ) = j->A;
}
}
}
if ( i > 0 )
bufs[ i ].Clear( ); // cleanup
blp += width * height * 2; //(q->NeedsAlphaChannel() ? 2 : 1);
}
width = width / 2;
height = height / 2;
}
delete q;
return TRUE;
}
BOOL TGA2Raw( StormBuffer input, StormBuffer &output, int &width, int &height, int &bpp, const char* filename )
{
TGAHeader* header = ( TGAHeader* )input.buf;
if ( header->colorMapType != 0 || header->imageType != 2 || header->width == 0 || header->height == 0 )
return FALSE;
if ( !IsPowerOfTwo( header->width ) || !IsPowerOfTwo( header->height ) )
return FALSE;
if ( header->bpp != 32 && header->bpp != 24 )
return FALSE;
bpp = 4;
if ( header->bpp < 4 )
bpp = 3;
width = header->width;
height = header->height;
output.length = ( unsigned long )( width*height*bpp );
output.buf = ( char * )Storm::MemAlloc( output.length );
std::memcpy( output.buf, input.buf + sizeof( TGAHeader ) + header->imageIDLength, output.length );
return TRUE;
}
BOOL RAW2Tga( StormBuffer input, StormBuffer &output, int width, int height, int bpp, const char* filename )
{
TGAHeader header;
memset( &header, 0, sizeof( TGAHeader ) );
header.imageType = 2;
header.width = width;
header.height = height;
header.bpp = bpp * 8;
header.imagedescriptor = bpp == 4 ? 8 : 0;
output.length = sizeof( TGAHeader ) + width * height * bpp;
output.buf = ( char * )Storm::MemAlloc( output.length );
std::memcpy( output.buf, &header, sizeof( TGAHeader ) );
std::memcpy( output.buf + sizeof( TGAHeader ), input.buf, output.length - sizeof( TGAHeader ) );
return TRUE;
}
BOOL BMP2Raw( StormBuffer input, StormBuffer &output, int &width, int &height, int &bpp, char const *filename )
{
BITMAPFILEHEADER *FileHeader = ( BITMAPFILEHEADER* )input.buf;
BITMAPINFOHEADER *InfoHeader = ( BITMAPINFOHEADER* )( FileHeader + 1 );
if ( FileHeader->bfType != 0x4D42 )
return FALSE;
if ( !IsPowerOfTwo( InfoHeader->biWidth ) || !IsPowerOfTwo( InfoHeader->biHeight ) )
return FALSE;
if ( InfoHeader->biBitCount != 32 && InfoHeader->biBitCount != 24 )
return FALSE;
bpp = 4;
if ( InfoHeader->biBitCount < 32 )
bpp = 3;
width = InfoHeader->biWidth;
height = InfoHeader->biHeight;
output.length = ( unsigned long )( width*height*bpp );
output.buf = ( char * )Storm::MemAlloc( output.length );
std::memcpy( output.buf, input.buf + FileHeader->bfOffBits, output.length );
if ( bpp == 4 ) // invert alpha
for ( int i = 0; i < width*height; i++ )
output.buf[ i*bpp + 3 ] = 0xFF - output.buf[ i*bpp + 3 ];
return TRUE;
}
#define _blp_swap_int16(x) (x)
#define _blp_swap_int32(x) (x)
void SwapBLPHeader( BLPHeader *header )
{
header->compress = ( unsigned long )_blp_swap_int32( header->compress );
header->IsAlpha = ( unsigned long )_blp_swap_int32( header->IsAlpha );
header->sizex = ( unsigned long )_blp_swap_int32( header->sizex );
header->sizey = ( unsigned long )_blp_swap_int32( header->sizey );
header->alphaEncoding = ( unsigned long )_blp_swap_int32( header->alphaEncoding );
header->flags2 = ( unsigned long )_blp_swap_int32( header->flags2 );
int i = 0;
for ( ; i < 16; i++ )
{
( header->poffs )[ i ] = ( unsigned long )_blp_swap_int32( ( header->poffs )[ i ] );
( header->psize )[ i ] = ( unsigned long )_blp_swap_int32( ( header->psize )[ i ] );
}
}
void textureInvertRBInPlace( RGBAPix *bufsrc, unsigned long srcsize )
{
for ( unsigned long i = 0; i < ( srcsize / 4 ); i++ )
{
unsigned char red = bufsrc[ i ].B;
bufsrc[ i ].B = bufsrc[ i ].R;
bufsrc[ i ].R = red;
}
}
void flip_vertically( unsigned char *pixels, const size_t width, const size_t height, const size_t bytes_per_pixel )
{
if ( !pixels )
return;
const size_t stride = width * bytes_per_pixel;
unsigned char *row = ( unsigned char * )malloc( stride );
if ( !row )
return;
unsigned char *low = pixels;
unsigned char *high = &pixels[ ( height - 1 ) * stride ];
for ( ; low < high; low += stride, high -= stride )
{
std::memcpy( row, low, stride );
std::memcpy( low, high, stride );
std::memcpy( high, row, stride );
}
free( row );
}
unsigned char * Scale_WithoutResize( unsigned char *pixels, const size_t width, const size_t height, const size_t newwidth, const size_t newheight, const size_t bytes_per_pixel )
{
if ( newwidth < width )
return pixels;
if ( newheight < height )
return pixels;
unsigned char * outimage = ( unsigned char * )Storm::MemAlloc( newwidth * newheight * bytes_per_pixel );
memset( outimage, 0, newwidth * newheight * bytes_per_pixel );
size_t y = 0;
for ( ; y < height; y++ )
{
unsigned char * offset1 = &pixels[ y * width * bytes_per_pixel ];
unsigned char * offset2 = &outimage[ y * newwidth * bytes_per_pixel ];
size_t copysize = width * bytes_per_pixel;
std::memcpy( offset2, offset1, copysize );
}
Storm::MemFree( pixels );
return outimage;
}
tBGRAPixel * blp1_convert_paletted_separated_alpha_BGRA( uint8_t* pSrc, tBGRAPixel* pInfos, unsigned int width, unsigned int height, BOOL invertAlpha )
{
tBGRAPixel* pBuffer = ( tBGRAPixel* )Storm::MemAlloc( width * height * sizeof( tBGRAPixel ) );
tBGRAPixel* pDst = pBuffer;
uint8_t* pIndices = pSrc;
uint8_t* pAlpha = pSrc + width * height;
for ( unsigned int y = 0; y < height; y++ )
{
for ( unsigned int x = 0; x < width; x++ )
{
*pDst = pInfos[ *pIndices ];
if ( invertAlpha )
pDst->a = ( uint8_t )( 0xFF - *pAlpha );
else
pDst->a = *pAlpha;
++pIndices;
++pAlpha;
++pDst;
}
}
flip_vertically( ( unsigned char* )pBuffer, width, height, 4 );
return pBuffer;
}
RGBAPix * blp1_convert_paletted_separated_alpha( uint8_t* pSrc, RGBAPix* pInfos, unsigned int width, unsigned int height, BOOL invertAlpha )
{
RGBAPix * outrgba = ( RGBAPix * )blp1_convert_paletted_separated_alpha_BGRA( pSrc, ( tBGRAPixel * )pInfos, width, height, invertAlpha );
return outrgba;
}
tBGRAPixel* blp1_convert_paletted_alpha_BGRA( uint8_t* pSrc, tBGRAPixel* pInfos, unsigned int width, unsigned int height )
{
tBGRAPixel* pBuffer = ( tBGRAPixel* )Storm::MemAlloc( width * height * sizeof( tBGRAPixel ) );
tBGRAPixel* pDst = pBuffer;
uint8_t* pIndices = pSrc;
for ( unsigned int y = 0; y < height; ++y )
{
for ( unsigned int x = 0; x < width; ++x )
{
*pDst = pInfos[ *pIndices ];
pDst->a = ( uint8_t )( 0xFF - pDst->a );
++pIndices;
++pDst;
}
}
return pBuffer;
}
RGBAPix* blp1_convert_paletted_alpha( uint8_t* pSrc, RGBAPix* pInfos, unsigned int width, unsigned int height )
{
RGBAPix * outrgba = ( RGBAPix * )blp1_convert_paletted_alpha_BGRA( pSrc, ( tBGRAPixel* )pInfos, width, height );
return outrgba;
}
tBGRAPixel* blp1_convert_paletted_no_alpha_BGRA( uint8_t* pSrc, tBGRAPixel* pInfos, unsigned int width, unsigned int height )
{
tBGRAPixel* pBuffer = ( tBGRAPixel * )Storm::MemAlloc( width * height * sizeof( tBGRAPixel ) );
tBGRAPixel* pDst = pBuffer;
uint8_t* pIndices = pSrc;
for ( unsigned int y = 0; y < height; ++y )
{
for ( unsigned int x = 0; x < width; ++x )
{
*pDst = pInfos[ *pIndices ];
pDst->a = 0xFF;
++pIndices;
++pDst;
}
}
flip_vertically( ( unsigned char* )pBuffer, width, height, 4 );
return pBuffer;
}
RGBAPix* blp1_convert_paletted_no_alpha( uint8_t* pSrc, RGBAPix* pInfos, unsigned int width, unsigned int height )
{
RGBAPix * outrgba = ( RGBAPix * )blp1_convert_paletted_no_alpha_BGRA( pSrc, ( tBGRAPixel* )pInfos, width, height );
return outrgba;
}
unsigned long Blp2Raw( StormBuffer input, StormBuffer &output, int &width, int &height, int &bpp, int &mipmaps, int & alphaflag, int & compresstype, int & pictype, char const *filename )
{
BLPHeader blph;
bpp = 4;
width = 0;
height = 0;
unsigned long curpos = 0;
unsigned long textureSize = 0;
if ( input.buf == NULL || input.length == NULL || input.length < sizeof( BLPHeader ) )
return 0;
std::memcpy( &blph, input.buf, sizeof( BLPHeader ) );
if ( memcmp( blph.ident, "BLP1", 4 ) != 0 )
return 0;
mipmaps = 0;
for ( int i = 0; i < 15; i++ )
{
if ( blph.poffs[ i ] > 0 )
{
mipmaps++;
}
}
alphaflag = ( int )blph.IsAlpha;
curpos += sizeof( BLPHeader );
textureSize = blph.sizex * blph.sizey * 4;
compresstype = ( int )blph.compress;
pictype = ( int )blph.alphaEncoding;
if ( blph.compress == 1 )
{
if ( input.length < curpos + 256 * 4 )
{
return 0;
}
RGBAPix Pal[ 256 ];
std::memcpy( Pal, input.buf + curpos, 256 * 4 );
curpos += 256 * 4;
int offset = ( int )blph.poffs[ 0 ];
int size = ( int )blph.psize[ 0 ];
if ( alphaflag > 0 && ( blph.alphaEncoding == 4 || blph.alphaEncoding == 3 ) )
{
if ( input.length < curpos + blph.sizex * blph.sizey * 2 )
return 0;
uint8_t* tdata = ( uint8_t * )Storm::MemAlloc( ( unsigned int )size );
std::memcpy( tdata, input.buf + offset, ( size_t )size );
RGBAPix *pic = blp1_convert_paletted_separated_alpha( ( uint8_t* )tdata, Pal, blph.sizex, blph.sizey, 0 );
Storm::MemFree( tdata );
output.length = textureSize;
output.buf = ( char * )Storm::MemAlloc( textureSize );
std::memcpy( output.buf, pic, textureSize );
Storm::MemFree( pic );
width = ( int )blph.sizex;
height = ( int )blph.sizey;
return textureSize;
}
else if ( alphaflag > 0 && blph.alphaEncoding == 5 )
{
if ( input.length < curpos + blph.sizex*blph.sizey )
return 0;
uint8_t* tdata = ( uint8_t * )Storm::MemAlloc( ( unsigned int )size );
std::memcpy( tdata, input.buf + offset, ( size_t )size );
RGBAPix *pic = blp1_convert_paletted_alpha( ( uint8_t* )tdata, Pal, blph.sizex, blph.sizey );
Storm::MemFree( tdata );
output.length = textureSize;
output.buf = ( char * )Storm::MemAlloc( textureSize );
std::memcpy( output.buf, pic, textureSize );
Storm::MemFree( pic );
width = ( int )blph.sizex;
height = ( int )blph.sizey;
return textureSize;
}
else
{
if ( input.length < curpos + blph.sizex * blph.sizey )
return 0;
uint8_t* tdata = ( uint8_t * )Storm::MemAlloc( ( unsigned int )size );
std::memcpy( tdata, input.buf + offset, ( size_t )size );
RGBAPix *pic = blp1_convert_paletted_no_alpha( ( uint8_t* )tdata, Pal, blph.sizex, blph.sizey );
Storm::MemFree( tdata );
output.length = textureSize;
output.buf = ( char * )Storm::MemAlloc( textureSize );
std::memcpy( output.buf, pic, textureSize );
Storm::MemFree( pic );
width = ( int )blph.sizex;
height = ( int )blph.sizey;
return textureSize;
}
}
// JPEG compressed
else if ( blph.compress == 0 )
{
unsigned long JPEGHeaderSize;
std::memcpy( &JPEGHeaderSize, input.buf + curpos, 4 );
JPEGHeaderSize = _blp_swap_int32( JPEGHeaderSize );
StormBuffer tempdata;
tempdata.length = blph.psize[ 0 ] + JPEGHeaderSize;
tempdata.buf = ( char * )Storm::MemAlloc( blph.psize[ 0 ] + JPEGHeaderSize );
std::memcpy( tempdata.buf, input.buf + curpos + 4, ( size_t )JPEGHeaderSize );
width = ( int )blph.sizex;
height = ( int )blph.sizey;
curpos = blph.poffs[ 0 ];
std::memcpy( ( tempdata.buf + JPEGHeaderSize ), input.buf + curpos, blph.psize[ 0 ] );
StormBuffer tmpout;
if ( !JPG2Raw( tempdata, tmpout, width, height, bpp, filename ) )
{
tmpout.Clear( );
tempdata.Clear( );
width = 0;
height = 0;
return 0;
}
tempdata.Clear( );
flip_vertically( ( unsigned char * )tmpout.buf, width, height, 4 );
// Output should be RGBA, BLPs use BGRA
//textureInvertRBInPlace( ( RGBAPix* )output.buf, output.length );
output = tmpout;
width = ( int )blph.sizex;
height = ( int )blph.sizey;
return textureSize;
}
return 0;
}
BOOL JPG2Raw( StormBuffer input, StormBuffer & output, int width, int height, int &bpp, char const *filename )
{
bpp = 4;
void * outdata;
if ( ( outdata = ReadImage( width, height, bpp, input.buf, input.length ) ) != NULL )
{
output.length = width * height * bpp;
output.buf = ( char * )outdata;
return TRUE;
}
//MessageBoxA( 0, "Convert error 1", " Success ! ", 0 );
return FALSE;
}
int ArrayXYtoId( int width, int x, int y )
{
return width * y + x;
} | 27.414579 | 186 | 0.605401 | UnrealKaraulov |
b31dfd9b9099f2aaf1c77dd643ac702de9b80669 | 2,599 | hpp | C++ | include/pcp/kdtree/linked_kdtree_node.hpp | Q-Minh/octree | 0c3fd5a791d660b37461daf968a68ffb1c80b965 | [
"BSL-1.0"
] | 2 | 2021-03-10T09:57:45.000Z | 2021-04-13T21:19:57.000Z | include/pcp/kdtree/linked_kdtree_node.hpp | Q-Minh/octree | 0c3fd5a791d660b37461daf968a68ffb1c80b965 | [
"BSL-1.0"
] | 22 | 2020-12-07T20:09:39.000Z | 2021-04-12T20:42:59.000Z | include/pcp/kdtree/linked_kdtree_node.hpp | Q-Minh/octree | 0c3fd5a791d660b37461daf968a68ffb1c80b965 | [
"BSL-1.0"
] | null | null | null | #ifndef PCP_KDTREE_KDTREE_NODE_HPP
#define PCP_KDTREE_KDTREE_NODE_HPP
/**
* @file
* @ingroup kd-tree
*/
#include <memory>
#include <vector>
namespace pcp {
/**
* @ingroup linked-kd-tree
* @brief
* A kdtree node at internal should only contain an element,
* while a leaf node may contain more than one element
* @tparam Element The element type
*/
template <class Element>
class basic_linked_kdtree_node_t
{
public:
using self_type = basic_linked_kdtree_node_t;
using self_type_ptr = std::unique_ptr<self_type>;
using element_type = Element;
using points_type = std::vector<element_type*>;
/**
* @brief Get the right child of the node
* @return Right child of the node
*/
self_type_ptr& left() { return left_; }
/**
* @brief Get the right child of the node
* @return Right child of the node
*/
self_type_ptr& right() { return right_; }
/**
* @brief Get the left child of the node (readonly)
* @return Left child of the node (readonly)
*/
self_type_ptr const& left() const { return left_; }
/**
* @brief Get the right child of the node (readonly)
* @return Right child of the node (readonly)
*/
self_type_ptr const& right() const { return right_; }
/**
* @brief Set the left child
* @param l the left child
*/
void set_left(self_type_ptr&& l) { left_ = std::move(l); }
/**
* @brief Set the right chikd
* @param r the right child
*/
void set_right(self_type_ptr&& r) { right_ = std::move(r); }
/**
* @brief Get the list of elements in the node
* internal node only contains 1 element
* Leaf node may contain more than 1 element
* @return List of elements in the node
*/
points_type& points() { return points_; }
/**
* @brief Get the list of elements in the node (readonly)
* internal node only contains 1 element
* Leaf node may contain more than 1 element
* @return List of elements in the node (readonly)
*/
points_type const& points() const { return points_; }
/**
* @brief Check if node is leaf
* @return True if node is leaf
*/
bool is_leaf() const { return left_ == nullptr && right_ == nullptr; }
/**
* @brief Check if leaf is internal
* @return True if leaf is internal
*/
bool is_internal() const { return !is_leaf(); }
private:
std::unique_ptr<self_type> left_;
std::unique_ptr<self_type> right_;
points_type points_;
};
} // namespace pcp
#endif // PCP_KDTREE_KDTREE_NODE_HPP | 25.480392 | 74 | 0.632551 | Q-Minh |
b32674bd704a49e2ec0ac72dbbe4b797e1662a41 | 229 | cpp | C++ | URI/Ad-Hoc/1397.cpp | danielcunhaa/Competitive-Programming | 6868a8dfb8000fd10650a692c548a86272f19735 | [
"MIT"
] | 1 | 2021-04-03T11:17:33.000Z | 2021-04-03T11:17:33.000Z | URI/Ad-Hoc/1397.cpp | danielcunhaa/Competitive-Programming | 6868a8dfb8000fd10650a692c548a86272f19735 | [
"MIT"
] | null | null | null | URI/Ad-Hoc/1397.cpp | danielcunhaa/Competitive-Programming | 6868a8dfb8000fd10650a692c548a86272f19735 | [
"MIT"
] | 1 | 2020-07-24T15:27:46.000Z | 2020-07-24T15:27:46.000Z | #include <cstdio>
int main() {
int N, A, B;
int X, Y;
while(scanf("%d", &N) && N!=0) {
X = Y = 0;
while(N--) {
scanf("%d %d", &A, &B);
if(A != B) (A > B) ? ++X : ++Y;
}
printf("%d %d\n", X, Y);
}
return 0;
} | 13.470588 | 34 | 0.388646 | danielcunhaa |
b32bf360638ec756575175c2bcb10065c96c610c | 8,118 | cpp | C++ | vtStorAtaProtocol/Platform/Linux/ProtocolAtaPassThrough.cpp | virtium/vtStor | 069d3e1ddb1c5589826dfe59714a1479c4af8f51 | [
"Apache-2.0"
] | 3 | 2015-04-27T07:53:57.000Z | 2017-12-26T08:55:24.000Z | vtStorAtaProtocol/Platform/Linux/ProtocolAtaPassThrough.cpp | virtium/vtStor | 069d3e1ddb1c5589826dfe59714a1479c4af8f51 | [
"Apache-2.0"
] | 18 | 2015-04-08T21:44:45.000Z | 2016-03-09T23:44:51.000Z | vtStorAtaProtocol/Platform/Linux/ProtocolAtaPassThrough.cpp | virtium/vtStor | 069d3e1ddb1c5589826dfe59714a1479c4af8f51 | [
"Apache-2.0"
] | 19 | 2015-05-15T07:48:05.000Z | 2019-09-16T09:12:05.000Z | /*
<License>
Copyright 2016 Virtium Technology
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.
</License>
*/
#include <assert.h>
#include <cstring>
#include <sys/ioctl.h>
#include "AtaProtocolEssense1.h"
#include "ProtocolAtaPassThrough.h"
#include "StorageUtility.h"
namespace vtStor
{
namespace Protocol
{
eErrorCode cAtaPassThrough::IssueCommand(const DeviceHandle& Handle, std::shared_ptr<const IBuffer> Essense, std::shared_ptr<IBuffer> DataBuffer)
{
eErrorCode errorCode = eErrorCode::None;
cBufferFormatter bufferFormatter = cBufferFormatter::Reader(Essense);
if (true == vtStor::CompareUUID(bufferFormatter.GetHeader().Format, cEssenseAta1::FormatType))
{
cEssenseAta1 essense = cEssenseAta1::Reader(Essense);
//! TODO: magic code 60
InitializePassThroughDirect(essense.GetCommandCharacteristics(), essense.GetTaskFileExt(), essense.GetTaskFile(), DataBuffer, 60);
errorCode = IssuePassThroughDirectCommand(Handle.Handle);
}
else
{
errorCode = eErrorCode::FormatNotSupported;
}
return(errorCode);
}
eErrorCode cAtaPassThrough::IssuePassThroughDirectCommand(const U32& FileDescriptor)
{
assert(INVALID_FILE_DESCRIPTOR != FileDescriptor);
U32 commandSuccessfulFlag = ioctl(FileDescriptor, SG_IO, &m_ATAPassThrough);
if (IOCTL_SG_IO_ERROR == commandSuccessfulFlag)
{
//! ERROR: IOCTL SG_IO was not successful
return(eErrorCode::Io);
}
return(eErrorCode::None);
}
void cAtaPassThrough::InitializePassThroughDirect(const StorageUtility::Ata::sCommandCharacteristic& CommandCharacteristics,
const StorageUtility::Ata::uTaskFileRegister& PreviousTaskFile,
const StorageUtility::Ata::uTaskFileRegister& CurrentTaskFile,
std::shared_ptr<IBuffer> DataBuffer,
U32 TimeoutValueInSeconds)
{
memset(&m_ATAPassThrough, 0, sizeof(m_ATAPassThrough));
//! TODO: Set up for Sense Data
m_ATAPassThrough.interface_id = static_cast<U32>(eSgAtaPassThough16::SgInterfaceId);
m_ATAPassThrough.mx_sb_len = static_cast<U8>(eSgAtaPassThough16::MaxSenseDataLength);
m_ATAPassThrough.cmd_len = static_cast<U8>(eSgAtaPassThough16::SgCdbLengh);
m_ATAPassThrough.dxfer_len = CommandCharacteristics.DataTransferLengthInBytes;
m_ATAPassThrough.timeout = TimeoutValueInSeconds;
if (nullptr != DataBuffer)
{
m_ATAPassThrough.dxferp = DataBuffer->ToDataBuffer();
}
InitializeFlags(CommandCharacteristics);
InitializeCommandDescBlock16Flags(CommandCharacteristics);
InitializeCommandDescBlock16Registers(PreviousTaskFile, CurrentTaskFile);
m_ATAPassThrough.cmdp = (U8*)&m_CommandDescBlock16;
}
void cAtaPassThrough::InitializeCommandDescBlock16Flags(const StorageUtility::Ata::sCommandCharacteristic& AtaCommandCharacteristic)
{
if (StorageUtility::Ata::eFieldFormatting::COMMAND_48_BIT == AtaCommandCharacteristic.FieldFormatting)
{
m_CommandDescBlock16.ExtendProtocol.Extend = SG_ATA_LBA48;
}
if (StorageUtility::Ata::eDataAccess::NONE != AtaCommandCharacteristic.DataAccess)
{
m_CommandDescBlock16.Param.TLength = static_cast<U8>(eTransferLenghValue::SpecInSectorCount);
m_CommandDescBlock16.Param.BytBlock = static_cast<U8>(eByteBlockBit::TransferSectorMode);
if (StorageUtility::Ata::eTransferMode::DMA_PROTOCOL == AtaCommandCharacteristic.TransferMode)
{
m_CommandDescBlock16.ExtendProtocol.Protocol = static_cast<U8>(eATAProtocolField::DMA);
}
else
{
if (StorageUtility::Ata::eDataAccess::WRITE_TO_DEVICE == AtaCommandCharacteristic.DataAccess)
{
m_CommandDescBlock16.ExtendProtocol.Protocol = static_cast<U8>(eATAProtocolField::PIO_Data_Out);
m_CommandDescBlock16.Param.TDir = static_cast<U8>(eTransferDirection::TransferToDevice);
}
else
{
//! Read to device
m_CommandDescBlock16.ExtendProtocol.Protocol = static_cast<U8>(eATAProtocolField::PIO_Data_In);
m_CommandDescBlock16.Param.TDir = static_cast<U8>(eTransferDirection::TransferFromDevice);
}
}
//! TODO: Support other protocols
}
else
{
m_CommandDescBlock16.ExtendProtocol.Protocol = static_cast<U8>(eATAProtocolField::NonData);
m_CommandDescBlock16.Param.CheckCondition = static_cast<U8>(eCheckCondition::CommonTerminate);
}
}
void cAtaPassThrough::InitializeFlags(const StorageUtility::Ata::sCommandCharacteristic& AtaCommandCharacteristic)
{
switch (AtaCommandCharacteristic.DataAccess)
{
case StorageUtility::Ata::eDataAccess::READ_FROM_DEVICE:
{
m_ATAPassThrough.dxfer_direction = SG_DXFER_FROM_DEV;
} break;
case StorageUtility::Ata::eDataAccess::WRITE_TO_DEVICE:
{
m_ATAPassThrough.dxfer_direction = SG_DXFER_TO_DEV;
} break;
case StorageUtility::Ata::eDataAccess::NONE:
{
m_ATAPassThrough.dxfer_direction = SG_DXFER_NONE;
m_ATAPassThrough.dxfer_len = 0;
} break;
default:
{
throw std::runtime_error("Attributes of the access was not supported\n");
} break;
}
}
void cAtaPassThrough::InitializeCommandDescBlock16Registers(const StorageUtility::Ata::uTaskFileRegister& PreviousTaskFile, const StorageUtility::Ata::uTaskFileRegister& CurrentTaskFile)
{
m_CommandDescBlock16.Opcode = static_cast<U8>(eSgAtaPassThough16::SgAtaPassThough);
m_CommandDescBlock16.LowDevice = CurrentTaskFile.InputRegister.Device;
m_CommandDescBlock16.LowCommand = CurrentTaskFile.InputRegister.Command;
m_CommandDescBlock16.LowFeature = CurrentTaskFile.InputRegister.Feature;
m_CommandDescBlock16.LowSectorCount = CurrentTaskFile.InputRegister.Count;
m_CommandDescBlock16.LowObLbaLow = CurrentTaskFile.InputRegister.LbaLow;
m_CommandDescBlock16.LowObLbaMid = CurrentTaskFile.InputRegister.LbaMid;
m_CommandDescBlock16.LowObLbaHigh = CurrentTaskFile.InputRegister.LbaHigh;
m_CommandDescBlock16.HighFeature = PreviousTaskFile.InputRegister.Feature;
m_CommandDescBlock16.HighSectorCount = PreviousTaskFile.InputRegister.Count;
m_CommandDescBlock16.HighObLbaLow = PreviousTaskFile.InputRegister.LbaLow;
m_CommandDescBlock16.HighObLbaMid = PreviousTaskFile.InputRegister.LbaMid;
m_CommandDescBlock16.HighObLbaHigh = PreviousTaskFile.InputRegister.LbaHigh;
}
}
}
| 43.881081 | 195 | 0.641907 | virtium |
b32dca93360bb7f208647226587b3c824edaaff4 | 2,056 | hh | C++ | include/mcnla/core/matrix/collection/base/matrix_collection_wrapper.hh | emfomy/mcnla | 9f9717f4d6449bbd467c186651856d6212035667 | [
"MIT"
] | null | null | null | include/mcnla/core/matrix/collection/base/matrix_collection_wrapper.hh | emfomy/mcnla | 9f9717f4d6449bbd467c186651856d6212035667 | [
"MIT"
] | null | null | null | include/mcnla/core/matrix/collection/base/matrix_collection_wrapper.hh | emfomy/mcnla | 9f9717f4d6449bbd467c186651856d6212035667 | [
"MIT"
] | null | null | null | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @file include/mcnla/core/matrix/collection/base/matrix_collection_wrapper.hh
/// @brief The definition of matrix collection wrapper.
///
/// @author Mu Yang <<[email protected]>>
///
#ifndef MCNLA_CORE_MATRIX_COLLECTION_BASE_MATRIX_COLLECTION_WRAPPER_HH_
#define MCNLA_CORE_MATRIX_COLLECTION_BASE_MATRIX_COLLECTION_WRAPPER_HH_
#include <mcnla/core/matrix/collection/def.hpp>
#include <tuple>
#include <mcnla/core/matrix/dense.hpp>
#include <mcnla/core/utility/crtp.hpp>
#include <mcnla/core/utility/traits.hpp>
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// The MCNLA namespace.
//
namespace mcnla {
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// The matrix namespace.
//
namespace matrix {
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// The matrix collection wrapper.
///
/// @tparam _Derived The derived type.
///
template <class _Derived>
class MatrixCollectionWrapper {
private:
using MatrixType = MatrixT<_Derived>;
protected:
// Constructors
inline MatrixCollectionWrapper() noexcept = default;
public:
// Gets information
inline bool isEmpty() const noexcept;
inline index_t nrow() const noexcept;
inline index_t ncol() const noexcept;
inline index_t nmat() const noexcept;
inline index_t nelem() const noexcept;
inline std::tuple<index_t, index_t, index_t> sizes() const noexcept;
// Gets matrix
inline MatrixType operator()( const index_t idx ) noexcept;
inline const MatrixType operator()( const index_t idx ) const noexcept;
protected:
MCNLA_CRTP_DERIVED(_Derived)
};
} // namespace matrix
} // namespace mcnla
#endif // MCNLA_CORE_MATRIX_COLLECTION_BASE_MATRIX_COLLECTION_WRAPPER_HH_
| 29.797101 | 128 | 0.562257 | emfomy |
b32dd58447a592738e9f75dbd3ecccbb7f8f4609 | 3,679 | hpp | C++ | include/immediate_buckling_energy.hpp | liuwei792966953/stitch | 108e3dbd3410331c741c7cb166f93bbffa11b369 | [
"Zlib"
] | 1 | 2021-01-23T05:20:09.000Z | 2021-01-23T05:20:09.000Z | include/immediate_buckling_energy.hpp | liuwei792966953/stitch | 108e3dbd3410331c741c7cb166f93bbffa11b369 | [
"Zlib"
] | null | null | null | include/immediate_buckling_energy.hpp | liuwei792966953/stitch | 108e3dbd3410331c741c7cb166f93bbffa11b369 | [
"Zlib"
] | null | null | null |
#pragma once
#include "energy.hpp"
class ImmediateBucklingEnergy : public BaseEnergy
{
public:
ImmediateBucklingEnergy(double kb) : kb_(kb) {}
void precompute(const TriMesh& mesh) override;
void getForceAndHessian(const TriMesh& mesh, const VecXd& x,
VecXd& F,
SparseMatrixd& dFdx,
SparseMatrixd& dFdv) const override;
void getHessianPattern(const TriMesh& mesh, std::vector<SparseTripletd> &triplets) const override;
void perVertexCount(const TriMesh& mesh, std::vector<int>& counts) const override;
void update(const TriMesh& mesh, const VecXd& x, double dt, VecXd& dx) override;
protected:
const double kb_ = 1.0;
std::vector<std::pair<int,int>> pairs_;
std::vector<double> restLength_;
std::vector<double> triAreas_;
std::vector<bool> isCreased_;
bool across_stitches_ = false;
};
template <typename MeshT>
struct ImmediateBucklingModel
{
using ElementT = typename MeshT::Diamond;
static constexpr int dim = 1;
static int n_constraints() { return 1; }
static typename MeshT::Real ks(const MeshT& mesh, typename ElementT::iterator it) {
return mesh.bend_ks(it);
}
static typename MeshT::Real kd(const MeshT& mesh, typename ElementT::iterator it) {
return mesh.bend_kd(it);
}
template <typename DerivedA, typename DerivedB, typename DerivedC, typename DerivedD>
static void project(const Eigen::MatrixBase<DerivedA>& u0,
const Eigen::MatrixBase<DerivedA>& u1,
const Eigen::MatrixBase<DerivedA>& u2,
const Eigen::MatrixBase<DerivedA>& u3,
const Eigen::MatrixBase<DerivedB>& x0,
const Eigen::MatrixBase<DerivedB>& x1,
const Eigen::MatrixBase<DerivedB>& x3,
const Eigen::MatrixBase<DerivedB>& x4,
Eigen::MatrixBase<DerivedC>& C,
Eigen::MatrixBase<DerivedD>& dC0,
Eigen::MatrixBase<DerivedD>& dC1,
Eigen::MatrixBase<DerivedD>& dC2,
Eigen::MatrixBase<DerivedD>& dC3)
{
auto n = x1 - x0;
const auto L = (u1 - u0).norm(); // Rest length
const auto l = n.norm(); // Current length
dC0 = -n;
dC1 = n;
// Only resists compression
C[0] = l < L ? l - L : 0.0;
if (l > 1.0e-8) {
dC0 /= l;
dC1 /= l;
}
}
};
/*
template <typename MeshT>
struct IBM
{
using ElementT = typename MeshT::Edge;
static constexpr int dim = 1;
static int n_constraints() { return 1; }
static typename MeshT::Real ks(const MeshT& mesh, typename ElementT::iterator it) {
return mesh.bend_ks(it);
}
static typename MeshT::Real kd(const MeshT& mesh, typename ElementT::iterator it) {
return mesh.bend_kd(it);
}
template <typename DerivedA, typename DerivedB, typename DerivedC, typename DerivedD>
static void project(const Eigen::MatrixBase<DerivedA>& u0,
const Eigen::MatrixBase<DerivedA>& u1,
const Eigen::MatrixBase<DerivedB>& x0,
const Eigen::MatrixBase<DerivedB>& x1,
Eigen::MatrixBase<DerivedC>& C,
Eigen::MatrixBase<DerivedD>& dC0,
Eigen::MatrixBase<DerivedD>& dC1)
{
auto n = x1 - x0;
const auto L = (u1 - u0).norm(); // Rest length
const auto l = n.norm(); // Current length
dC0 = -n;
dC1 = n;
C[0] = l - L;
if (l > 1.0e-8) {
dC0 /= l;
dC1 /= l;
}
}
};
*/
| 27.661654 | 102 | 0.581952 | liuwei792966953 |
b330b86f9a0166d2a0173a9b1db0c93bb3ff20ee | 100 | cpp | C++ | source/slang/slang-emit-context.cpp | KostasAndrianos/slang | 6cbc3929a54d37bd23cb5efa8e3320ba02f78b2f | [
"MIT"
] | null | null | null | source/slang/slang-emit-context.cpp | KostasAndrianos/slang | 6cbc3929a54d37bd23cb5efa8e3320ba02f78b2f | [
"MIT"
] | null | null | null | source/slang/slang-emit-context.cpp | KostasAndrianos/slang | 6cbc3929a54d37bd23cb5efa8e3320ba02f78b2f | [
"MIT"
] | null | null | null | // slang-emit-context.cpp
#include "slang-emit-context.h"
namespace Slang {
} // namespace Slang
| 12.5 | 31 | 0.71 | KostasAndrianos |
b332983e9973304dba040a625175348271461cc3 | 1,338 | cpp | C++ | osquery/config/parsers/kafka_topics.cpp | msekletar/osquery | beca5e68e97c5ff411b082fe871c69edcba1e641 | [
"BSD-3-Clause"
] | 7 | 2018-03-12T10:52:37.000Z | 2020-09-11T14:09:23.000Z | osquery/config/parsers/kafka_topics.cpp | msekletar/osquery | beca5e68e97c5ff411b082fe871c69edcba1e641 | [
"BSD-3-Clause"
] | 1 | 2021-03-20T05:24:15.000Z | 2021-03-20T05:24:15.000Z | osquery/config/parsers/kafka_topics.cpp | Acidburn0zzz/osquery | 1cedf8d57310b4ac3ae0a39fe33dce00699f4a3b | [
"BSD-3-Clause"
] | 4 | 2018-03-12T10:52:40.000Z | 2020-08-18T09:03:17.000Z | /*
* Copyright (c) 2014-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*/
#include <iostream>
#include <osquery/config.h>
#include "osquery/config/parsers/kafka_topics.h"
namespace osquery {
/// Root key to retrieve Kafka topic configurations.
const std::string kKafkaTopicParserRootKey("kafka_topics");
std::vector<std::string> KafkaTopicsConfigParserPlugin::keys() const {
return {kKafkaTopicParserRootKey};
}
Status KafkaTopicsConfigParserPlugin::setUp() {
data_.put_child(kKafkaTopicParserRootKey, boost::property_tree::ptree());
return Status(0, "OK");
}
Status KafkaTopicsConfigParserPlugin::update(const std::string& source,
const ParserConfig& config) {
if (config.count(kKafkaTopicParserRootKey) > 0) {
data_ = boost::property_tree::ptree();
data_.put_child(kKafkaTopicParserRootKey,
config.at(kKafkaTopicParserRootKey));
}
return Status(0, "OK");
}
REGISTER_INTERNAL(KafkaTopicsConfigParserPlugin,
"config_parser",
"kafka_topics");
} // namespace osquery
| 29.086957 | 79 | 0.697309 | msekletar |
b332b01fafcdbbfc42cf4d24c2dc090214a361e4 | 1,195 | cpp | C++ | src/luset_state_pkg/src/luset_state_package/node.cpp | nicholaspalomo/LUSETcontrol | 5576daf9551778804cd9dce8496a3f9ade6c4932 | [
"MIT"
] | null | null | null | src/luset_state_pkg/src/luset_state_package/node.cpp | nicholaspalomo/LUSETcontrol | 5576daf9551778804cd9dce8496a3f9ade6c4932 | [
"MIT"
] | null | null | null | src/luset_state_pkg/src/luset_state_package/node.cpp | nicholaspalomo/LUSETcontrol | 5576daf9551778804cd9dce8496a3f9ade6c4932 | [
"MIT"
] | null | null | null | /**
* @file node.cpp
* @author Nicholas José Palomo ([email protected])
* @brief This is the source code for the /LusetState node. This node subscribes to messages coming from the Indel inco_32.so library (or from a simulation model - not yet implemented). See https://google.github.io/styleguide/cppguide.html for Google Style Guide for C++.
* @version 0.1
* @date 2020-02-24
*
* @copyright Copyright (c) 2020
*
*/
#include "LusetState.hpp"
int main(int argc, char** argv){
ros::init(argc, argv, "LusetState"); ///< Must call ros::init() before using any other part of the ROS system
ros::NodeHandle handle; ///< Instantiate a ROS node handle
ros::Rate loop_rate(10); ///< Set the loop_rate for processing the callbacks
lusetstatepubsubnamespace::LusetStatePubSub luset_state_pub_sub_obj(handle); ///< Instantiate LusetStateSubPub object
while(ros::ok()){ ///< Infinite loop until the user shuts down the rosmaster with Ctrl + C
ros::spinOnce(); ///< ros::spinOnce() processes our callbacks for a single thread.
loop_rate.sleep(); ///< Sleep for the remainder of the loop once all callbacks have been processed.
}
return 0;
} | 39.833333 | 271 | 0.703766 | nicholaspalomo |
b337a09cf7460124080e9068428e0e9e05783842 | 53,736 | cpp | C++ | tests/integrationtests/db/SqliteDatabaseIntegrationTest.cpp | commshare/easyhttpcpp | 757ec75679c1cbc5f04c81a30133f4bcd3e780f4 | [
"MIT"
] | null | null | null | tests/integrationtests/db/SqliteDatabaseIntegrationTest.cpp | commshare/easyhttpcpp | 757ec75679c1cbc5f04c81a30133f4bcd3e780f4 | [
"MIT"
] | null | null | null | tests/integrationtests/db/SqliteDatabaseIntegrationTest.cpp | commshare/easyhttpcpp | 757ec75679c1cbc5f04c81a30133f4bcd3e780f4 | [
"MIT"
] | null | null | null | /*
* Copyright 2017 Sony Corporation
*/
#include "gtest/gtest.h"
#include <stdint.h>
#include "Poco/Path.h"
#include "Poco/Data/SQLite/Connector.h"
#include "easyhttpcpp/common/FileUtil.h"
#include "easyhttpcpp/common/StringUtil.h"
#include "easyhttpcpp/db/AutoSqliteTransaction.h"
#include "easyhttpcpp/db/SqlException.h"
#include "easyhttpcpp/db/SqliteQueryBuilder.h"
#include "EasyHttpCppAssertions.h"
#include "PartialMockSqliteOpenHelper.h"
#include "TestLogger.h"
#include "TestPreferences.h"
#include "SqliteDatabaseIntegrationTestConstants.h"
#include "SqliteDatabaseTestUtil.h"
using easyhttpcpp::common::FileUtil;
using easyhttpcpp::common::StringUtil;
using easyhttpcpp::testutil::PartialMockSqliteOpenHelper;
using easyhttpcpp::testutil::TestPreferences;
namespace easyhttpcpp {
namespace db {
namespace test {
namespace {
const std::string DatabaseDirString = SqliteDatabaseIntegrationTestConstants::DatabaseDir;
const std::string DatabaseFileName = SqliteDatabaseIntegrationTestConstants::DatabaseFileName;
const std::string DatabaseTableName = SqliteDatabaseIntegrationTestConstants::DatabaseTableName;
} /* namespace */
#define ELEMENT_NUM(st) (sizeof(st) / (sizeof st[0]))
class SqliteDatabaseIntegrationTest : public testing::Test {
protected:
static void SetUpTestCase()
{
// initialize test preferences with QA profile
TestPreferences::getInstance().initialize(TestPreferences::ProfileQA);
Poco::Path databaseDir(DatabaseDirString);
FileUtil::createDirsIfAbsent(Poco::File(databaseDir));
}
void TearDown()
{
EASYHTTPCPP_TESTLOG_TEARDOWN_START();
Poco::Path databaseFilePath(DatabaseDirString, DatabaseFileName);
m_pTestUtil = NULL;
FileUtil::removeFileIfPresent(databaseFilePath);
}
void createDefaultDatabaseTable()
{
// create table and insert data
// table is as below
// |Id | Name | Address | Age |
// | 1 | "Bart Simpson" | "Springfield" | 12 |
// | 2 | "Lisa Simpson" | "Springfield" | 10 |
//
std::string columnString = "Id INTEGER PRIMARY KEY AUTOINCREMENT, \
Name VARCHAR(30) UNIQUE, Address VARCHAR, Age INTEGER(3)";
Poco::AutoPtr<ContentValues> pContentValues = new ContentValues();
pContentValues->put("Name", "Bart Simpson");
pContentValues->put("Address", "Springfield");
pContentValues->put("Age", 12);
Poco::AutoPtr<ContentValues> pContentValues2 = new ContentValues();
pContentValues2->put("Name", "Lisa Simpson");
pContentValues2->put("Address", "Springfield");
pContentValues2->put("Age", 10);
//push back pContentValues and pContentValues2 to valuesVec
std::vector<ContentValues*> valuesVec;
valuesVec.push_back(pContentValues);
valuesVec.push_back(pContentValues2);
Poco::Path databaseFilePath(DatabaseDirString, DatabaseFileName);
m_pTestUtil = new SqliteDatabaseTestUtil();
m_pTestUtil->createAndOpenDatabase(databaseFilePath, 1);
m_pTestUtil->createTable(DatabaseTableName, columnString);
m_pTestUtil->insertData(DatabaseTableName, valuesVec);
}
void createDefaultDatabaseTableWithoutData()
{
// create table and insert data
// table is as below
std::string columnString = "Id INTEGER PRIMARY KEY AUTOINCREMENT, \
Name VARCHAR(30) UNIQUE, Address VARCHAR, Age INTEGER(3)";
Poco::Path databaseFilePath(DatabaseDirString, DatabaseFileName);
m_pTestUtil = new SqliteDatabaseTestUtil();
m_pTestUtil->createAndOpenDatabase(databaseFilePath, 1);
m_pTestUtil->createTable(DatabaseTableName, columnString);
}
SqliteCursor::Ptr queryDatabase(const std::string& tableName, const std::vector<std::string>* columns)
{
return m_pTestUtil->queryDatabase(tableName, columns, NULL, NULL);
}
struct RowElement {
int m_id;
char m_name[20];
char m_address[20];
int m_age;
};
bool databaseHasColumns(SqliteCursor::Ptr pCursor, size_t expectedColumnCount,
std::vector<std::string>& expectedColumnNames)
{
bool ret = false;
if (pCursor->getColumnCount() != expectedColumnCount) {
return ret;
}
std::vector<std::string> columnNames = pCursor->getColumnNames();
for (size_t i = 0; i < expectedColumnCount; i++) {
if (columnNames.at(i) != expectedColumnNames.at(i)) {
break;
}
ret = true;
}
return ret;
}
bool databaseHasRow(SqliteCursor::Ptr pCursor, RowElement& expectedRowElement)
{
bool ret = false;
size_t idIndex = SIZE_MAX;
size_t ageIndex = SIZE_MAX;
size_t nameIndex = SIZE_MAX;
size_t addressIndex = SIZE_MAX;
// column count
size_t columnCount = pCursor->getColumnCount();
// column names
std::vector<std::string> columnNames = pCursor->getColumnNames();
for (size_t i = 0; i < columnCount; i++) {
if (columnNames.at(i) == "Id") {
idIndex = i;
} else if (columnNames.at(i) == "Age") {
ageIndex = i;
} else if (columnNames.at(i) == "Name") {
nameIndex = i;
} else if (columnNames.at(i) == "Address") {
addressIndex = i;
}
}
if (idIndex == SIZE_MAX && ageIndex == SIZE_MAX && nameIndex == SIZE_MAX && addressIndex == SIZE_MAX) {
return ret;
}
if (!pCursor->moveToFirst()) {
return ret;
}
bool idExist = false;
bool ageExist = false;
bool nameExist = false;
bool addressExist = false;
do {
idExist = false;
ageExist = false;
nameExist = false;
addressExist = false;
if (idIndex == SIZE_MAX || pCursor->getInt(idIndex) == expectedRowElement.m_id) {
idExist = true;
}
if (ageIndex == SIZE_MAX || pCursor->getInt(ageIndex) == expectedRowElement.m_age) {
ageExist = true;
}
if (nameIndex == SIZE_MAX || pCursor->getString(nameIndex) == expectedRowElement.m_name) {
nameExist = true;
}
if (addressIndex == SIZE_MAX || pCursor->getString(addressIndex) == expectedRowElement.m_address) {
addressExist = true;
}
if (idExist & ageExist & nameExist & addressExist) {
ret = true;
break;
}
} while (pCursor->moveToNext());
return ret;
}
SqliteDatabaseTestUtil::Ptr m_pTestUtil;
};
TEST_F(SqliteDatabaseIntegrationTest, query_ReturnsQueryResult)
{
// Given: create database
createDefaultDatabaseTable();
// When: query Age, and Name
std::vector<std::string> columns;
columns.push_back("Id");
columns.push_back("Age");
columns.push_back("Name");
columns.push_back("Address");
SqliteDatabase::Ptr pDb = m_pTestUtil->getDatabase();
SqliteCursor::Ptr pCursor = pDb->query(DatabaseTableName, &columns, NULL, NULL, NULL, NULL, NULL, NULL, false);
// Then: verify query result
EXPECT_TRUE(databaseHasColumns(pCursor, 4, columns));
RowElement expectedExistRows[] = {
{1, "Bart Simpson", "Springfield", 12},
{2, "Lisa Simpson", "Springfield", 10}
};
for (size_t i = 0; i < ELEMENT_NUM(expectedExistRows); i++) {
EXPECT_TRUE(databaseHasRow(pCursor, expectedExistRows[i]));
}
}
TEST_F(SqliteDatabaseIntegrationTest, rawQuery_ReturnsQueryResult)
{
// Given: create database
createDefaultDatabaseTable();
// When: buidQueryString and call rawQuery
std::vector<std::string> columns;
columns.push_back("Age");
columns.push_back("Name");
columns.push_back("Address");
columns.push_back("Id");
std::string queryString = SqliteQueryBuilder::buildQueryString(DatabaseTableName, &columns, NULL, NULL, NULL, NULL,
NULL, false);
SqliteDatabase::Ptr pDb = m_pTestUtil->getDatabase();
SqliteCursor::Ptr pCursor = pDb->rawQuery(queryString, NULL);
// Then: verify query result
EXPECT_TRUE(databaseHasColumns(pCursor, 4, columns));
RowElement expectedExistRows[] = {
{1, "Bart Simpson", "Springfield", 12},
{2, "Lisa Simpson", "Springfield", 10}
};
for (size_t i = 0; i < ELEMENT_NUM(expectedExistRows); i++) {
EXPECT_TRUE(databaseHasRow(pCursor, expectedExistRows[i]));
}
}
TEST_F(SqliteDatabaseIntegrationTest, insert_Succeeds)
{
// Given: create database
createDefaultDatabaseTable();
// When: insert data
Poco::AutoPtr<ContentValues> pContentValues = new ContentValues();
pContentValues->put("Name", "Homer Simpson");
pContentValues->put("Address", "Springfield");
pContentValues->put("Age", 38);
SqliteDatabase::Ptr pDb = m_pTestUtil->getDatabase();
AutoSqliteTransaction autoTransaction(pDb);
pDb->insert(DatabaseTableName, *pContentValues);
pDb->setTransactionSuccessful();
// Then: verify query result
std::vector<std::string> columns;
columns.push_back("Age");
columns.push_back("Name");
columns.push_back("Address");
columns.push_back("Id");
SqliteCursor::Ptr pCursor = queryDatabase(DatabaseTableName, &columns);
EXPECT_TRUE(databaseHasColumns(pCursor, 4, columns));
RowElement expectedExistRows[] = {
{1, "Bart Simpson", "Springfield", 12},
{2, "Lisa Simpson", "Springfield", 10},
{3, "Homer Simpson", "Springfield", 38}
};
for (size_t i = 0; i < ELEMENT_NUM(expectedExistRows); i++) {
EXPECT_TRUE(databaseHasRow(pCursor, expectedExistRows[i]));
}
}
TEST_F(SqliteDatabaseIntegrationTest, replace_Succeeds_WhenPrimaryKeyConflicts)
{
// Given: create database
createDefaultDatabaseTable();
// When: insert data
Poco::AutoPtr<ContentValues> pContentValues = new ContentValues();
pContentValues->put("Name", "Lisa Simpson");
pContentValues->put("Address", "Springfield");
pContentValues->put("Age", 99);
SqliteDatabase::Ptr pDb = m_pTestUtil->getDatabase();
AutoSqliteTransaction autoTransaction(pDb);
pDb->replace(DatabaseTableName, *(pContentValues.get()));
pDb->setTransactionSuccessful();
// Then: verify query result
std::vector<std::string> columns;
columns.push_back("Age");
columns.push_back("Name");
columns.push_back("Address");
columns.push_back("Id");
SqliteCursor::Ptr pCursor = queryDatabase(DatabaseTableName, &columns);
EXPECT_TRUE(databaseHasColumns(pCursor, 4, columns));
RowElement expectedExistRows[] = {
{1, "Bart Simpson", "Springfield", 12},
{3, "Lisa Simpson", "Springfield", 99},
};
for (size_t i = 0; i < ELEMENT_NUM(expectedExistRows); i++) {
EXPECT_TRUE(databaseHasRow(pCursor, expectedExistRows[i]));
}
RowElement expectedNonExistRows[] = {
{2, "Lisa Simpson", "Springfield", 10}
};
for (size_t i = 0; i < ELEMENT_NUM(expectedNonExistRows); i++) {
EXPECT_FALSE(databaseHasRow(pCursor, expectedNonExistRows[i]));
}
}
TEST_F(SqliteDatabaseIntegrationTest, replace_Succeeds_WhenPrimaryKeyDoesNotConflict)
{
// Given: create database
createDefaultDatabaseTable();
// When: insert data
Poco::AutoPtr<ContentValues> pContentValues = new ContentValues();
pContentValues->put("Name", "Homer Simpson");
pContentValues->put("Address", "Springfield");
pContentValues->put("Age", 38);
SqliteDatabase::Ptr pDb = m_pTestUtil->getDatabase();
AutoSqliteTransaction autoTransaction(pDb);
pDb->replace(DatabaseTableName, *(pContentValues.get()));
pDb->setTransactionSuccessful();
// Then: verify query result
std::vector<std::string> columns;
columns.push_back("Age");
columns.push_back("Name");
columns.push_back("Address");
columns.push_back("Id");
SqliteCursor::Ptr pCursor = queryDatabase(DatabaseTableName, &columns);
EXPECT_TRUE(databaseHasColumns(pCursor, 4, columns));
RowElement expectedExistRows[] = {
{1, "Bart Simpson", "Springfield", 12},
{2, "Lisa Simpson", "Springfield", 10},
{3, "Homer Simpson", "Springfield", 38},
};
for (size_t i = 0; i < ELEMENT_NUM(expectedExistRows); i++) {
EXPECT_TRUE(databaseHasRow(pCursor, expectedExistRows[i]));
}
}
TEST_F(SqliteDatabaseIntegrationTest, delete_Succeeds_WhenWhereClauseMatches)
{
// Given: create database
createDefaultDatabaseTable();
// When: delete data
SqliteDatabase::Ptr pDb = m_pTestUtil->getDatabase();
AutoSqliteTransaction autoTransaction(pDb);
std::string whereClause = "Age = 10";
size_t id = pDb->deleteRows(DatabaseTableName, &whereClause, NULL);
pDb->setTransactionSuccessful();
EXPECT_EQ(1, id);
// Then: verify query result
std::vector<std::string> columns;
columns.push_back("Age");
columns.push_back("Name");
columns.push_back("Address");
columns.push_back("Id");
SqliteCursor::Ptr pCursor = queryDatabase(DatabaseTableName, &columns);
EXPECT_TRUE(databaseHasColumns(pCursor, 4, columns));
RowElement expectedExistRows[] = {
{1, "Bart Simpson", "Springfield", 12}
};
for (size_t i = 0; i < ELEMENT_NUM(expectedExistRows); i++) {
EXPECT_TRUE(databaseHasRow(pCursor, expectedExistRows[i]));
}
RowElement expectedNonExistRows[] = {
{2, "Lisa Simpson", "Springfield", 10}
};
for (size_t i = 0; i < ELEMENT_NUM(expectedNonExistRows); i++) {
EXPECT_FALSE(databaseHasRow(pCursor, expectedNonExistRows[i]));
}
}
TEST_F(SqliteDatabaseIntegrationTest, delete_DoNothing_WhenWhereClauseDoesNotMatch)
{
// Given: create database
createDefaultDatabaseTable();
// When: delete data
SqliteDatabase::Ptr pDb = m_pTestUtil->getDatabase();
AutoSqliteTransaction autoTransaction(pDb);
std::string whereClause = "Age = 33";
size_t id = pDb->deleteRows(DatabaseTableName, &whereClause, NULL);
pDb->setTransactionSuccessful();
EXPECT_EQ(0, id);
// Then: verify query result
std::vector<std::string> columns;
columns.push_back("Age");
columns.push_back("Name");
columns.push_back("Address");
columns.push_back("Id");
SqliteCursor::Ptr pCursor = queryDatabase(DatabaseTableName, &columns);
EXPECT_TRUE(databaseHasColumns(pCursor, 4, columns));
RowElement expectedExistRows[] = {
{1, "Bart Simpson", "Springfield", 12},
{2, "Lisa Simpson", "Springfield", 10}
};
for (size_t i = 0; i < ELEMENT_NUM(expectedExistRows); i++) {
EXPECT_TRUE(databaseHasRow(pCursor, expectedExistRows[i]));
}
}
TEST_F(SqliteDatabaseIntegrationTest, delete_Succeeds_WhenWhereClauseMatchesToMultiRaw)
{
// Given: create database and insert data
createDefaultDatabaseTable();
Poco::AutoPtr<ContentValues> pContentValues = new ContentValues();
pContentValues->put("Name", "Nobi Nobita");
pContentValues->put("Address", "Tokyo");
pContentValues->put("Age", 10);
SqliteDatabase::Ptr pDb = m_pTestUtil->getDatabase();
pDb->beginTransaction();
pDb->insert(DatabaseTableName, *(pContentValues.get()));
pDb->setTransactionSuccessful();
pDb->endTransaction();
// When: delete data
AutoSqliteTransaction autoTransaction(pDb);
std::string whereClause = "Age = 10";
size_t id = pDb->deleteRows(DatabaseTableName, &whereClause, NULL);
pDb->setTransactionSuccessful();
EXPECT_EQ(2, id);
// Then: verify query result
std::vector<std::string> columns;
columns.push_back("Age");
columns.push_back("Name");
columns.push_back("Address");
columns.push_back("Id");
SqliteCursor::Ptr pCursor = queryDatabase(DatabaseTableName, &columns);
EXPECT_TRUE(databaseHasColumns(pCursor, 4, columns));
RowElement expectedExistRows[] = {
{1, "Bart Simpson", "Springfield", 12}
};
for (size_t i = 0; i < ELEMENT_NUM(expectedExistRows); i++) {
EXPECT_TRUE(databaseHasRow(pCursor, expectedExistRows[i]));
}
RowElement expectedNonExistRows[] = {
{2, "Lisa Simpson", "Springfield", 10}
};
for (size_t i = 0; i < ELEMENT_NUM(expectedNonExistRows); i++) {
EXPECT_FALSE(databaseHasRow(pCursor, expectedNonExistRows[i]));
}
}
TEST_F(SqliteDatabaseIntegrationTest, update_Succeeds_WhenWhereClauseMatches)
{
// Given: create database
createDefaultDatabaseTable();
// When: update data
Poco::AutoPtr<ContentValues> pContentValues = new ContentValues();
pContentValues->put("Name", "Maggie Simpson");
pContentValues->put("Address", "Springfield");
pContentValues->put("Age", 1);
SqliteDatabase::Ptr pDb = m_pTestUtil->getDatabase();
AutoSqliteTransaction autoTransaction(pDb);
std::string whereClause = "Age = 10";
size_t id = pDb->update(DatabaseTableName, *(pContentValues.get()), &whereClause, NULL);
pDb->setTransactionSuccessful();
EXPECT_EQ(1, id);
// Then: query Age, and Name, and verify query result
std::vector<std::string> columns;
columns.push_back("Age");
columns.push_back("Name");
columns.push_back("Address");
columns.push_back("Id");
SqliteCursor::Ptr pCursor = queryDatabase(DatabaseTableName, &columns);
EXPECT_TRUE(databaseHasColumns(pCursor, 4, columns));
RowElement expectedExistRows[] = {
{1, "Bart Simpson", "Springfield", 12},
{2, "Maggie Simpson", "Springfield", 1}
};
for (size_t i = 0; i < ELEMENT_NUM(expectedExistRows); i++) {
EXPECT_TRUE(databaseHasRow(pCursor, expectedExistRows[i]));
}
RowElement expectedNonExistRows[] = {
{2, "Lisa Simpson", "Springfield", 10}
};
for (size_t i = 0; i < ELEMENT_NUM(expectedNonExistRows); i++) {
EXPECT_FALSE(databaseHasRow(pCursor, expectedNonExistRows[i]));
}
}
TEST_F(SqliteDatabaseIntegrationTest, update_Succeeds_WhenWhereClauseHasMultiConditions)
{
// Given: create database and insert data
createDefaultDatabaseTable();
Poco::AutoPtr<ContentValues> pContentValues = new ContentValues();
pContentValues->put("Name", "Nobi Nobita");
pContentValues->put("Address", "Tokyo");
pContentValues->put("Age", 10);
SqliteDatabase::Ptr pDb = m_pTestUtil->getDatabase();
pDb->beginTransaction();
pDb->insert(DatabaseTableName, *(pContentValues.get()));
pDb->setTransactionSuccessful();
pDb->endTransaction();
// When: update data
pContentValues->put("Name", "Maggie Simpson");
pContentValues->put("Address", "Springfield");
pContentValues->put("Age", 1);
AutoSqliteTransaction autoTransaction(pDb);
std::string whereClause = "Age = 10 AND Address = 'Tokyo'";
size_t id = pDb->update(DatabaseTableName, *(pContentValues.get()), &whereClause, NULL);
pDb->setTransactionSuccessful();
EXPECT_EQ(1, id);
// Then: verify query result
std::vector<std::string> columns;
columns.push_back("Age");
columns.push_back("Name");
columns.push_back("Address");
columns.push_back("Id");
SqliteCursor::Ptr pCursor = queryDatabase(DatabaseTableName, &columns);
EXPECT_TRUE(databaseHasColumns(pCursor, 4, columns));
RowElement expectedExistRows[] = {
{1, "Bart Simpson", "Springfield", 12},
{2, "Lisa Simpson", "Springfield", 10},
{3, "Maggie Simpson", "Springfield", 1}
};
for (size_t i = 0; i < ELEMENT_NUM(expectedExistRows); i++) {
EXPECT_TRUE(databaseHasRow(pCursor, expectedExistRows[i]));
}
RowElement expectedNonExistRows[] = {
{3, "Nobi Nobita", "Tokyo", 10}
};
for (size_t i = 0; i < ELEMENT_NUM(expectedNonExistRows); i++) {
EXPECT_FALSE(databaseHasRow(pCursor, expectedNonExistRows[i]));
}
}
TEST_F(SqliteDatabaseIntegrationTest, update_throwsSqlExecutionException_WhenWhereClauseMatchesToMultiRaw)
{
// Given: create database and insert data
createDefaultDatabaseTable();
Poco::AutoPtr<ContentValues> pContentValues = new ContentValues();
pContentValues->put("Name", "Nobi Nobita");
pContentValues->put("Address", "Tokyo");
pContentValues->put("Age", 10);
SqliteDatabase::Ptr pDb = m_pTestUtil->getDatabase();
pDb->beginTransaction();
pDb->insert(DatabaseTableName, *(pContentValues.get()));
pDb->setTransactionSuccessful();
pDb->endTransaction();
// When: update data
pContentValues->put("Name", "Maggie Simpson");
pContentValues->put("Address", "Springfield");
pContentValues->put("Age", 1);
AutoSqliteTransaction autoTransaction(pDb);
std::string whereClause = "Age = 10";
size_t id = 0;
EASYHTTPCPP_ASSERT_THROW_WITH_CAUSE(id = pDb->update(DatabaseTableName, *(pContentValues.get()), &whereClause, NULL),
SqlExecutionException, 100202);
pDb->setTransactionSuccessful();
EXPECT_EQ(0, id);
// Then: verify query result
std::vector<std::string> columns;
columns.push_back("Age");
columns.push_back("Name");
columns.push_back("Address");
columns.push_back("Id");
SqliteCursor::Ptr pCursor = queryDatabase(DatabaseTableName, &columns);
EXPECT_TRUE(databaseHasColumns(pCursor, 4, columns));
RowElement expectedExistRows[] = {
{1, "Bart Simpson", "Springfield", 12},
{2, "Lisa Simpson", "Springfield", 10},
{3, "Nobi Nobita", "Tokyo", 10}
};
for (size_t i = 0; i < ELEMENT_NUM(expectedExistRows); i++) {
EXPECT_TRUE(databaseHasRow(pCursor, expectedExistRows[i]));
}
RowElement expectedNonExistRows[] = {
{2, "Maggie Simpson", "Springfield", 1},
{3, "Maggie Simpson", "Springfield", 1}
};
for (size_t i = 0; i < ELEMENT_NUM(expectedNonExistRows); i++) {
EXPECT_FALSE(databaseHasRow(pCursor, expectedNonExistRows[i]));
}
}
TEST_F(SqliteDatabaseIntegrationTest, beginTransaction_throwsSqlIllegalStateException_AfterCloseDatabase)
{
// Given: create database
createDefaultDatabaseTable();
// When: close database
SqliteDatabase::Ptr pDb = m_pTestUtil->getDatabase();
pDb->close();
// Then: Access to SqliteDatabase throws Exception
EASYHTTPCPP_EXPECT_THROW(pDb->beginTransaction(), SqlIllegalStateException, 100201);
}
TEST_F(SqliteDatabaseIntegrationTest, query_Succeeds_WhenReopenDatabase)
{
// Given: create database
createDefaultDatabaseTable();
// When: close SqliteDatabase
SqliteDatabase::Ptr pDb = m_pTestUtil->getDatabase();
pDb->close();
EASYHTTPCPP_EXPECT_THROW(pDb->beginTransaction(), SqlIllegalStateException, 100201);
// When: reopen and insert data
pDb->reopen();
// Then: verify query result
std::vector<std::string> columns;
columns.push_back("Age");
columns.push_back("Name");
columns.push_back("Address");
columns.push_back("Id");
SqliteCursor::Ptr pCursor = queryDatabase(DatabaseTableName, &columns);
EXPECT_TRUE(databaseHasColumns(pCursor, 4, columns));
RowElement expectedExistRows[] = {
{1, "Bart Simpson", "Springfield", 12},
{2, "Lisa Simpson", "Springfield", 10}
};
for (size_t i = 0; i < ELEMENT_NUM(expectedExistRows); i++) {
EXPECT_TRUE(databaseHasRow(pCursor, expectedExistRows[i]));
}
}
TEST_F(SqliteDatabaseIntegrationTest, endTransaction_RollbacksData_WhenWithoutCallSetTransactionSuccessful)
{
// Given: create database
createDefaultDatabaseTable();
// When: insert data
Poco::AutoPtr<ContentValues> pContentValues = new ContentValues();
pContentValues->put("Name", "Homer Simpson");
pContentValues->put("Address", "Springfield");
pContentValues->put("Age", 38);
SqliteDatabase::Ptr pDb = m_pTestUtil->getDatabase();
pDb->beginTransaction();
pDb->insert(DatabaseTableName, *(pContentValues.get()));
// call SqliteDatabase::endTransaction() without call setTransactionSuccessful()
pDb->endTransaction();
// Then: verify query result
std::vector<std::string> columns;
columns.push_back("Age");
columns.push_back("Name");
columns.push_back("Address");
columns.push_back("Id");
SqliteCursor::Ptr pCursor = queryDatabase(DatabaseTableName, &columns);
EXPECT_TRUE(databaseHasColumns(pCursor, 4, columns));
RowElement expectedExistRows[] = {
{1, "Bart Simpson", "Springfield", 12},
{2, "Lisa Simpson", "Springfield", 10},
};
for (size_t i = 0; i < ELEMENT_NUM(expectedExistRows); i++) {
EXPECT_TRUE(databaseHasRow(pCursor, expectedExistRows[i]));
}
RowElement expectedNonExistRows[] = {
{3, "Homer Simpson", "Springfield", 38}
};
for (size_t i = 0; i < ELEMENT_NUM(expectedNonExistRows); i++) {
EXPECT_FALSE(databaseHasRow(pCursor, expectedNonExistRows[i]));
}
}
TEST_F(SqliteDatabaseIntegrationTest, query_ReturnsQueryResult_WhenSelectionArgsExists)
{
// Given: create database
createDefaultDatabaseTable();
// When: query Age, and Name, with SelectionArgs "Age = 10"
std::vector<std::string> columns;
columns.push_back("Age");
columns.push_back("Name");
columns.push_back("Address");
columns.push_back("Id");
std::string selection = "Age = ?";
std::vector<std::string> selectionArgs;
selectionArgs.push_back("10");
SqliteDatabase::Ptr pDb = m_pTestUtil->getDatabase();
SqliteCursor::Ptr pCursor = pDb->query(DatabaseTableName, &columns, &selection, &selectionArgs, NULL, NULL, NULL,
NULL, false);
// Then: verify query result
EXPECT_TRUE(databaseHasColumns(pCursor, 4, columns));
RowElement expectedExistRows[] = {
{2, "Lisa Simpson", "Springfield", 10}
};
for (size_t i = 0; i < ELEMENT_NUM(expectedExistRows); i++) {
EXPECT_TRUE(databaseHasRow(pCursor, expectedExistRows[i]));
}
RowElement expectedNonExistRows[] = {
{1, "Bart Simpson", "Springfield", 12}
};
for (size_t i = 0; i < ELEMENT_NUM(expectedNonExistRows); i++) {
EXPECT_FALSE(databaseHasRow(pCursor, expectedNonExistRows[i]));
}
}
TEST_F(SqliteDatabaseIntegrationTest, query_ReturnsQueryResult_WhenSelectionArgsExistsMulti)
{
// Given: create database and insert data
createDefaultDatabaseTable();
Poco::AutoPtr<ContentValues> pContentValues = new ContentValues();
pContentValues->put("Name", "Homer Simpson");
pContentValues->put("Address", "Springfield");
pContentValues->put("Age", 38);
SqliteDatabase::Ptr pDb = m_pTestUtil->getDatabase();
pDb->beginTransaction();
pDb->insert(DatabaseTableName, *pContentValues);
pDb->setTransactionSuccessful();
pDb->endTransaction();
// When: query Age, and Name, with SelectionArgs "Age = 10 OR Age = 38"
std::vector<std::string> columns;
columns.push_back("Age");
columns.push_back("Name");
columns.push_back("Address");
columns.push_back("Id");
std::string selection = "Age = ? OR Age = ?";
std::vector<std::string> selectionArgs;
selectionArgs.push_back("10");
selectionArgs.push_back("38");
SqliteCursor::Ptr pCursor = pDb->query(DatabaseTableName, &columns, &selection, &selectionArgs, NULL, NULL, NULL,
NULL, false);
// Then: verify query result
EXPECT_TRUE(databaseHasColumns(pCursor, 4, columns));
RowElement expectedExistRows[] = {
{2, "Lisa Simpson", "Springfield", 10},
{3, "Homer Simpson", "Springfield", 38}
};
for (size_t i = 0; i < ELEMENT_NUM(expectedExistRows); i++) {
EXPECT_TRUE(databaseHasRow(pCursor, expectedExistRows[i]));
}
RowElement expectedNonExistRows[] = {
{1, "Bart Simpson", "Springfield", 12}
};
for (size_t i = 0; i < ELEMENT_NUM(expectedNonExistRows); i++) {
EXPECT_FALSE(databaseHasRow(pCursor, expectedNonExistRows[i]));
}
}
TEST_F(SqliteDatabaseIntegrationTest, rawQuery_ReturnsQueryResult_WhenSelectionArgsExists)
{
// Given: create database
createDefaultDatabaseTable();
// When: buidQueryString and
// call rawQuery with selectionArgs "Age = 10"
std::string where = "Age = ?";
std::vector<std::string> columns;
columns.push_back("Age");
columns.push_back("Name");
columns.push_back("Address");
columns.push_back("Id");
std::string queryString = SqliteQueryBuilder::buildQueryString(DatabaseTableName, &columns, &where, NULL, NULL,
NULL, NULL, false);
std::vector<std::string> selectionArgs;
selectionArgs.push_back("10");
SqliteDatabase::Ptr pDb = m_pTestUtil->getDatabase();
SqliteCursor::Ptr pCursor = pDb->rawQuery(queryString, &selectionArgs);
// Then: verify query result
EXPECT_TRUE(databaseHasColumns(pCursor, 4, columns));
RowElement expectedExistRows[] = {
{2, "Lisa Simpson", "Springfield", 10}
};
for (size_t i = 0; i < ELEMENT_NUM(expectedExistRows); i++) {
EXPECT_TRUE(databaseHasRow(pCursor, expectedExistRows[i]));
}
RowElement expectedNonExistRows[] = {
{1, "Bart Simpson", "Springfield", 12}
};
for (size_t i = 0; i < ELEMENT_NUM(expectedNonExistRows); i++) {
EXPECT_FALSE(databaseHasRow(pCursor, expectedNonExistRows[i]));
}
}
TEST_F(SqliteDatabaseIntegrationTest, rawQuery_ReturnsQueryResult_WhenSelectionArgsExistsMulti)
{
// Given: create database and inset data
createDefaultDatabaseTable();
Poco::AutoPtr<ContentValues> pContentValues = new ContentValues();
pContentValues->put("Name", "Homer Simpson");
pContentValues->put("Address", "Springfield");
pContentValues->put("Age", 38);
SqliteDatabase::Ptr pDb = m_pTestUtil->getDatabase();
AutoSqliteTransaction autoTransaction(pDb);
pDb->insert(DatabaseTableName, *(pContentValues.get()));
pDb->setTransactionSuccessful();
// When: buidQueryString and
// call rawQuery with selectionArgs "Age = 10 OR Age = 38"
std::string where = "Age = ? OR Age = ?";
std::vector<std::string> columns;
columns.push_back("Age");
columns.push_back("Name");
columns.push_back("Address");
columns.push_back("Id");
std::string queryString = SqliteQueryBuilder::buildQueryString(DatabaseTableName, &columns, &where, NULL, NULL,
NULL, NULL, false);
std::vector<std::string> selectionArgs;
selectionArgs.push_back("10");
selectionArgs.push_back("38");
SqliteCursor::Ptr pCursor = pDb->rawQuery(queryString, &selectionArgs);
// Then: verify query result
EXPECT_TRUE(databaseHasColumns(pCursor, 4, columns));
RowElement expectedExistRows[] = {
{2, "Lisa Simpson", "Springfield", 10},
{3, "Homer Simpson", "Springfield", 38}
};
for (size_t i = 0; i < ELEMENT_NUM(expectedExistRows); i++) {
EXPECT_TRUE(databaseHasRow(pCursor, expectedExistRows[i]));
}
RowElement expectedNonExistRows[] = {
{1, "Bart Simpson", "Springfield", 12}
};
for (size_t i = 0; i < ELEMENT_NUM(expectedNonExistRows); i++) {
EXPECT_FALSE(databaseHasRow(pCursor, expectedNonExistRows[i]));
}
}
TEST_F(SqliteDatabaseIntegrationTest, query_ReturnsOnlyDistinctValues_WhenDistinctIsTrue)
{
// Given: create database and insert data
createDefaultDatabaseTable();
Poco::AutoPtr<ContentValues> pContentValues = new ContentValues();
pContentValues->put("Name", "Nobi Nobita");
pContentValues->put("Address", "Tokyo");
pContentValues->put("Age", 10);
SqliteDatabase::Ptr pDb = m_pTestUtil->getDatabase();
pDb->beginTransaction();
pDb->insert(DatabaseTableName, *(pContentValues.get()));
pDb->setTransactionSuccessful();
pDb->endTransaction();
// call query with distinct false, and verify query result row count is 3
std::vector<std::string> columns;
columns.push_back("Age");
SqliteCursor::Ptr pCursor1 = pDb->query(DatabaseTableName, &columns, NULL, NULL, NULL, NULL, NULL, NULL, false);
EXPECT_EQ(3, pCursor1->getCount());
RowElement expectedRows1[] = {
{1, "", "", 12},
{2, "", "", 10},
{3, "", "", 10}
};
for (size_t i = 0; i < ELEMENT_NUM(expectedRows1); i++) {
EXPECT_TRUE(databaseHasRow(pCursor1, expectedRows1[i]));
}
// When: call query with distinct true
SqliteCursor::Ptr pCursor2 = pDb->query(DatabaseTableName, &columns, NULL, NULL, NULL, NULL, NULL, NULL, true);
// Then: verify query result, duplicate value should be removed
EXPECT_EQ(2, pCursor2->getCount());
RowElement expectedRows2[] = {
{1, "", "", 12},
{2, "", "", 10}
};
for (size_t i = 0; i < ELEMENT_NUM(expectedRows2); i++) {
EXPECT_TRUE(databaseHasRow(pCursor2, expectedRows2[i]));
}
}
TEST_F(SqliteDatabaseIntegrationTest, query_ReturnsAllMatchingValues_WhenDistinctIsTrue)
{
// Given: create database and insert data
createDefaultDatabaseTable();
Poco::AutoPtr<ContentValues> pContentValues = new ContentValues();
pContentValues->put("Name", "Nobi Nobita");
pContentValues->put("Address", "Tokyo");
pContentValues->put("Age", 10);
SqliteDatabase::Ptr pDb = m_pTestUtil->getDatabase();
pDb->beginTransaction();
pDb->insert(DatabaseTableName, *(pContentValues.get()));
pDb->setTransactionSuccessful();
pDb->endTransaction();
// call query with distinct false, and verify query result row count is 3
std::vector<std::string> columns;
columns.push_back("Age");
columns.push_back("Name");
SqliteCursor::Ptr pCursor1 = pDb->query(DatabaseTableName, &columns, NULL, NULL, NULL, NULL, NULL, NULL, false);
RowElement expectedRows1[] = {
{1, "Bart Simpson", "", 12},
{2, "Lisa Simpson", "", 10},
{3, "Nobi Nobita", "", 10}
};
for (size_t i = 0; i < ELEMENT_NUM(expectedRows1); i++) {
EXPECT_TRUE(databaseHasRow(pCursor1, expectedRows1[i]));
}
EXPECT_EQ(3, pCursor1->getCount());
// When: call query with distinct true
SqliteCursor::Ptr pCursor2 = pDb->query(DatabaseTableName, &columns, NULL, NULL, NULL, NULL, NULL, NULL, true);
// Then: verify query result, duplicate value should be removed
RowElement expectedRows2[] = {
{1, "Bart Simpson", "", 12},
{2, "Lisa Simpson", "", 10},
{3, "Nobi Nobita", "", 10}
};
for (size_t i = 0; i < ELEMENT_NUM(expectedRows2); i++) {
EXPECT_TRUE(databaseHasRow(pCursor2, expectedRows2[i]));
}
EXPECT_EQ(3, pCursor2->getCount());
}
TEST_F(SqliteDatabaseIntegrationTest, query_Succeeds_ByAnotherInstance)
{
// Given: create database
createDefaultDatabaseTable();
// query and verify result
std::vector<std::string> columns;
columns.push_back("Age");
columns.push_back("Name");
columns.push_back("Address");
columns.push_back("Id");
SqliteCursor::Ptr pCursor = queryDatabase(DatabaseTableName, &columns);
EXPECT_TRUE(databaseHasColumns(pCursor, 4, columns));
RowElement expectedExistRows[] = {
{1, "Bart Simpson", "Springfield", 12},
{2, "Lisa Simpson", "Springfield", 10}
};
for (size_t i = 0; i < ELEMENT_NUM(expectedExistRows); i++) {
EXPECT_TRUE(databaseHasRow(pCursor, expectedExistRows[i]));
}
// When: OpenDatabase by using another helper, and query database
Poco::Path databasePath(DatabaseDirString, DatabaseFileName);
PartialMockSqliteOpenHelper::Ptr pHelper = new PartialMockSqliteOpenHelper(databasePath, 1);
EXPECT_CALL(*pHelper, onCreate(testing::_)).Times(testing::AnyNumber());
EXPECT_CALL(*pHelper, onConfigure(testing::_)).Times(testing::AnyNumber());
EXPECT_CALL(*pHelper, onOpen(testing::_)).Times(testing::AnyNumber());
EXPECT_CALL(*pHelper, onUpgrade(testing::_, testing::_, testing::_)).Times(testing::AnyNumber());
EXPECT_CALL(*pHelper, onDowngrade(testing::_, testing::_, testing::_)).Times(testing::AnyNumber());
//
SqliteDatabase::Ptr pDb = pHelper->getWritableDatabase();
SqliteCursor::Ptr pCursor1 = pDb->query(DatabaseTableName, &columns, NULL, NULL, NULL, NULL, NULL, NULL, false);
// Then: verify query result
for (size_t i = 0; i < ELEMENT_NUM(expectedExistRows); i++) {
EXPECT_TRUE(databaseHasRow(pCursor1, expectedExistRows[i]));
}
pHelper->close();
}
TEST_F(SqliteDatabaseIntegrationTest, query_ReturnsQueryResult_WhenDatabaseHasNoData)
{
// Given: create database
createDefaultDatabaseTableWithoutData();
// When: query database
std::vector<std::string> columns;
columns.push_back("Age");
columns.push_back("Name");
columns.push_back("Address");
columns.push_back("Id");
SqliteCursor::Ptr pCursor = queryDatabase(DatabaseTableName, &columns);
// Then: the cursor does not have raw
EXPECT_EQ(0, pCursor->getCount());
}
TEST_F(SqliteDatabaseIntegrationTest, query_ThrowsSqlIllegalStateException_AfterClose)
{
// Given: create database
createDefaultDatabaseTable();
// When: close SqliteDatabase
SqliteDatabase::Ptr pDb = m_pTestUtil->getDatabase();
pDb->close();
// Then: query throws exception
std::vector<std::string> columns;
columns.push_back("Age");
columns.push_back("Name");
columns.push_back("Address");
columns.push_back("Id");
EASYHTTPCPP_ASSERT_THROW(pDb->query(DatabaseTableName, &columns, NULL, NULL, NULL, NULL, NULL, NULL, false),
SqlIllegalStateException, 100201);
}
TEST_F(SqliteDatabaseIntegrationTest, execSql_Succeeds_WhenExecuteInsert)
{
// Given: create database
createDefaultDatabaseTable();
// When: insert data
Poco::AutoPtr<ContentValues> pContentValues = new ContentValues();
pContentValues->put("Name", "Homer Simpson");
pContentValues->put("Address", "Springfield");
pContentValues->put("Age", 38);
std::string insertString = SqliteQueryBuilder::buildInsertString(DatabaseTableName, *pContentValues,
SqliteConflictAlgorithmNone);
SqliteDatabase::Ptr pDb = m_pTestUtil->getDatabase();
AutoSqliteTransaction autoTransaction(pDb);
pDb->execSql(insertString);
pDb->setTransactionSuccessful();
// Then: query Age, and Name, and verify query result
std::vector<std::string> columns;
columns.push_back("Age");
columns.push_back("Name");
columns.push_back("Address");
columns.push_back("Id");
SqliteCursor::Ptr pCursor = queryDatabase(DatabaseTableName, &columns);
EXPECT_TRUE(databaseHasColumns(pCursor, 4, columns));
RowElement expectedExistRows[] = {
{1, "Bart Simpson", "Springfield", 12},
{2, "Lisa Simpson", "Springfield", 10},
{3, "Homer Simpson", "Springfield", 38}
};
for (size_t i = 0; i < ELEMENT_NUM(expectedExistRows); i++) {
EXPECT_TRUE(databaseHasRow(pCursor, expectedExistRows[i]));
}
}
TEST_F(SqliteDatabaseIntegrationTest, execSql_Succeeds_WhenExecuteUpdate)
{
// Given: create database
createDefaultDatabaseTable();
// When: insert data
Poco::AutoPtr<ContentValues> pContentValues = new ContentValues();
pContentValues->put("Name", "Lisa Simpson");
pContentValues->put("Address", "Springfield");
pContentValues->put("Age", 38);
std::string whereClause = "Age = 10";
std::string updateString = SqliteQueryBuilder::buildUpdateString(DatabaseTableName, *pContentValues,
&whereClause, SqliteConflictAlgorithmNone);
SqliteDatabase::Ptr pDb = m_pTestUtil->getDatabase();
AutoSqliteTransaction autoTransaction(pDb);
pDb->execSql(updateString);
pDb->setTransactionSuccessful();
// Then: query Age, and Name, and verify query result
std::vector<std::string> columns;
columns.push_back("Age");
columns.push_back("Name");
columns.push_back("Address");
columns.push_back("Id");
SqliteCursor::Ptr pCursor = queryDatabase(DatabaseTableName, &columns);
EXPECT_TRUE(databaseHasColumns(pCursor, 4, columns));
RowElement expectedExistRows[] = {
{1, "Bart Simpson", "Springfield", 12},
{2, "Lisa Simpson", "Springfield", 38},
};
for (size_t i = 0; i < ELEMENT_NUM(expectedExistRows); i++) {
EXPECT_TRUE(databaseHasRow(pCursor, expectedExistRows[i]));
}
RowElement expectedNonExistRows[] = {
{2, "Lisa Simpson", "Springfield", 10}
};
for (size_t i = 0; i < ELEMENT_NUM(expectedNonExistRows); i++) {
EXPECT_FALSE(databaseHasRow(pCursor, expectedNonExistRows[i]));
}
}
TEST_F(SqliteDatabaseIntegrationTest, execSql_Succeeds_WhenExecuteDelete)
{
// Given: create database
createDefaultDatabaseTable();
// When: insert data
std::string whereClause = "Age = 10";
std::string deleteString = SqliteQueryBuilder::buildDeleteString(DatabaseTableName, &whereClause);
SqliteDatabase::Ptr pDb = m_pTestUtil->getDatabase();
AutoSqliteTransaction autoTransaction(pDb);
pDb->execSql(deleteString);
pDb->setTransactionSuccessful();
// Then: query Age, and Name, and verify query result
std::vector<std::string> columns;
columns.push_back("Age");
columns.push_back("Name");
columns.push_back("Address");
columns.push_back("Id");
SqliteCursor::Ptr pCursor = queryDatabase(DatabaseTableName, &columns);
EXPECT_TRUE(databaseHasColumns(pCursor, 4, columns));
RowElement expectedExistRows[] = {
{1, "Bart Simpson", "Springfield", 12}
};
for (size_t i = 0; i < ELEMENT_NUM(expectedExistRows); i++) {
EXPECT_TRUE(databaseHasRow(pCursor, expectedExistRows[i]));
}
RowElement expectedNonExistRows[] = {
{2, "Lisa Simpson", "Springfield", 10}
};
for (size_t i = 0; i < ELEMENT_NUM(expectedExistRows); i++) {
EXPECT_FALSE(databaseHasRow(pCursor, expectedNonExistRows[i]));
}
}
TEST_F(SqliteDatabaseIntegrationTest,
insertWithConflictAlgorithmNone_ThrowsSqlExecutionException_WhenTryToInsertDataTheNameIsRedundant)
{
// Given: create database
createDefaultDatabaseTable();
// When: insert data
Poco::AutoPtr<ContentValues> pContentValues = new ContentValues();
pContentValues->put("Name", "Lisa Simpson");
pContentValues->put("Address", "Tokyo");
pContentValues->put("Age", 15);
std::string insertString = SqliteQueryBuilder::buildInsertString(DatabaseTableName, *pContentValues,
SqliteConflictAlgorithmNone);
SqliteDatabase::Ptr pDb = m_pTestUtil->getDatabase();
AutoSqliteTransaction autoTransaction(pDb);
EASYHTTPCPP_ASSERT_THROW_WITH_CAUSE(pDb->execSql(insertString), SqlExecutionException, 100202);
pDb->setTransactionSuccessful();
// Then: query Age, and Name, and verify query result
std::vector<std::string> columns;
columns.push_back("Age");
columns.push_back("Name");
columns.push_back("Address");
columns.push_back("Id");
SqliteCursor::Ptr pCursor = queryDatabase(DatabaseTableName, &columns);
EXPECT_EQ(2, pCursor->getCount());
EXPECT_TRUE(databaseHasColumns(pCursor, 4, columns));
RowElement expectedExistRows[] = {
{1, "Bart Simpson", "Springfield", 12},
{2, "Lisa Simpson", "Springfield", 10},
};
for (size_t i = 0; i < ELEMENT_NUM(expectedExistRows); i++) {
EXPECT_TRUE(databaseHasRow(pCursor, expectedExistRows[i]));
}
}
TEST_F(SqliteDatabaseIntegrationTest,
insertWithConflictAlgorithmRollback_ThrowsSqlExecutionException_WhenTryToInsertDataTheNameIsRedundant)
{
// Given: create database
createDefaultDatabaseTable();
// When: insert data
Poco::AutoPtr<ContentValues> pContentValues = new ContentValues();
pContentValues->put("Name", "Lisa Simpson");
pContentValues->put("Address", "Tokyo");
pContentValues->put("Age", 15);
std::string insertString = SqliteQueryBuilder::buildInsertString(DatabaseTableName, *pContentValues,
SqliteConflictAlgorithmRollback);
SqliteDatabase::Ptr pDb = m_pTestUtil->getDatabase();
pDb->beginTransaction();
EASYHTTPCPP_ASSERT_THROW_WITH_CAUSE(pDb->execSql(insertString), SqlExecutionException, 100202);
// Then: query Age, and Name, and verify query result
std::vector<std::string> columns;
columns.push_back("Age");
columns.push_back("Name");
columns.push_back("Address");
columns.push_back("Id");
SqliteCursor::Ptr pCursor = queryDatabase(DatabaseTableName, &columns);
EXPECT_EQ(2, pCursor->getCount());
EXPECT_TRUE(databaseHasColumns(pCursor, 4, columns));
RowElement expectedExistRows[] = {
{1, "Bart Simpson", "Springfield", 12},
{2, "Lisa Simpson", "Springfield", 10},
};
for (size_t i = 0; i < ELEMENT_NUM(expectedExistRows); i++) {
EXPECT_TRUE(databaseHasRow(pCursor, expectedExistRows[i]));
}
}
TEST_F(SqliteDatabaseIntegrationTest,
insertWithConflictAlgorithmAbort_ThrowsSqlExecutionException_WhenTryToInsertDataTheNameIsRedundant)
{
// Given: create database
createDefaultDatabaseTable();
// When: insert data
Poco::AutoPtr<ContentValues> pContentValues = new ContentValues();
pContentValues->put("Name", "Lisa Simpson");
pContentValues->put("Address", "Tokyo");
pContentValues->put("Age", 15);
std::string insertString = SqliteQueryBuilder::buildInsertString(DatabaseTableName, *pContentValues,
SqliteConflictAlgorithmAbort);
SqliteDatabase::Ptr pDb = m_pTestUtil->getDatabase();
AutoSqliteTransaction autoTransaction(pDb);
EASYHTTPCPP_ASSERT_THROW_WITH_CAUSE(pDb->execSql(insertString), SqlExecutionException, 100202);
pDb->setTransactionSuccessful();
// Then: query Age, and Name, and verify query result
std::vector<std::string> columns;
columns.push_back("Age");
columns.push_back("Name");
columns.push_back("Address");
columns.push_back("Id");
SqliteCursor::Ptr pCursor = queryDatabase(DatabaseTableName, &columns);
EXPECT_EQ(2, pCursor->getCount());
EXPECT_TRUE(databaseHasColumns(pCursor, 4, columns));
RowElement expectedExistRows[] = {
{1, "Bart Simpson", "Springfield", 12},
{2, "Lisa Simpson", "Springfield", 10},
};
for (size_t i = 0; i < ELEMENT_NUM(expectedExistRows); i++) {
EXPECT_TRUE(databaseHasRow(pCursor, expectedExistRows[i]));
}
}
TEST_F(SqliteDatabaseIntegrationTest,
insertWithConflictAlgorithmFail_ThrowsSqlExecutionException_WhenTryToInsertDataTheNameIsRedundant)
{
// Given: create database
createDefaultDatabaseTable();
// When: insert data
Poco::AutoPtr<ContentValues> pContentValues = new ContentValues();
pContentValues->put("Name", "Lisa Simpson");
pContentValues->put("Address", "Tokyo");
pContentValues->put("Age", 15);
std::string insertString = SqliteQueryBuilder::buildInsertString(DatabaseTableName, *pContentValues,
SqliteConflictAlgorithmFail);
SqliteDatabase::Ptr pDb = m_pTestUtil->getDatabase();
AutoSqliteTransaction autoTransaction(pDb);
EASYHTTPCPP_ASSERT_THROW_WITH_CAUSE(pDb->execSql(insertString), SqlExecutionException, 100202);
pDb->setTransactionSuccessful();
// Then: query Age, and Name, and verify query result
std::vector<std::string> columns;
columns.push_back("Age");
columns.push_back("Name");
columns.push_back("Address");
columns.push_back("Id");
SqliteCursor::Ptr pCursor = queryDatabase(DatabaseTableName, &columns);
EXPECT_EQ(2, pCursor->getCount());
EXPECT_TRUE(databaseHasColumns(pCursor, 4, columns));
RowElement expectedExistRows[] = {
{1, "Bart Simpson", "Springfield", 12},
{2, "Lisa Simpson", "Springfield", 10},
};
for (size_t i = 0; i < ELEMENT_NUM(expectedExistRows); i++) {
EXPECT_TRUE(databaseHasRow(pCursor, expectedExistRows[i]));
}
}
TEST_F(SqliteDatabaseIntegrationTest,
insertWithConflictAlgorithmIgnore_Succeeds_WhenTryToInsertDataTheNameIsRedundant)
{
// Given: create database
createDefaultDatabaseTable();
// When: insert data
Poco::AutoPtr<ContentValues> pContentValues = new ContentValues();
pContentValues->put("Name", "Lisa Simpson");
pContentValues->put("Address", "Tokyo");
pContentValues->put("Age", 15);
std::string insertString = SqliteQueryBuilder::buildInsertString(DatabaseTableName, *pContentValues,
SqliteConflictAlgorithmIgnore);
SqliteDatabase::Ptr pDb = m_pTestUtil->getDatabase();
AutoSqliteTransaction autoTransaction(pDb);
pDb->execSql(insertString);
pDb->setTransactionSuccessful();
// Then: query Age, and Name, and verify query result
std::vector<std::string> columns;
columns.push_back("Age");
columns.push_back("Name");
columns.push_back("Address");
columns.push_back("Id");
SqliteCursor::Ptr pCursor = queryDatabase(DatabaseTableName, &columns);
EXPECT_EQ(2, pCursor->getCount());
EXPECT_TRUE(databaseHasColumns(pCursor, 4, columns));
RowElement expectedExistRows[] = {
{1, "Bart Simpson", "Springfield", 12},
{2, "Lisa Simpson", "Springfield", 10}
};
for (size_t i = 0; i < ELEMENT_NUM(expectedExistRows); i++) {
EXPECT_TRUE(databaseHasRow(pCursor, expectedExistRows[i]));
}
RowElement expectedNonExistRows[] = {
{2, "Lisa Simpson", "Tokyo", 15},
{3, "Lisa Simpson", "Tokyo", 15}
};
for (size_t i = 0; i < ELEMENT_NUM(expectedNonExistRows); i++) {
EXPECT_FALSE(databaseHasRow(pCursor, expectedNonExistRows[i]));
}
}
TEST_F(SqliteDatabaseIntegrationTest, insertWithConflictAlgorithmReplace_Succeeds_WhenTryToInsertDataTheNameIsRedundant)
{
// Given: create database
createDefaultDatabaseTable();
// When: insert data
Poco::AutoPtr<ContentValues> pContentValues = new ContentValues();
pContentValues->put("Name", "Lisa Simpson");
pContentValues->put("Address", "Tokyo");
pContentValues->put("Age", 15);
std::string insertString = SqliteQueryBuilder::buildInsertString(DatabaseTableName, *pContentValues,
SqliteConflictAlgorithmReplace);
SqliteDatabase::Ptr pDb = m_pTestUtil->getDatabase();
AutoSqliteTransaction autoTransaction(pDb);
pDb->execSql(insertString);
pDb->setTransactionSuccessful();
// Then: query Age, and Name, and verify query result
std::vector<std::string> columns;
columns.push_back("Age");
columns.push_back("Name");
columns.push_back("Address");
columns.push_back("Id");
SqliteCursor::Ptr pCursor = queryDatabase(DatabaseTableName, &columns);
EXPECT_EQ(2, pCursor->getCount());
EXPECT_TRUE(databaseHasColumns(pCursor, 4, columns));
RowElement expectedExistRows[] = {
{1, "Bart Simpson", "Springfield", 12},
{3, "Lisa Simpson", "Tokyo", 15},
};
for (size_t i = 0; i < ELEMENT_NUM(expectedExistRows); i++) {
EXPECT_TRUE(databaseHasRow(pCursor, expectedExistRows[i]));
}
RowElement expectedNonExistRows[] = {
{2, "Lisa Simpson", "Springfield", 10}
};
for (size_t i = 0; i < ELEMENT_NUM(expectedNonExistRows); i++) {
EXPECT_FALSE(databaseHasRow(pCursor, expectedNonExistRows[i]));
}
}
TEST_F(SqliteDatabaseIntegrationTest, setVersion_Succeeds)
{
// Given: create database
Poco::Path databaseFilePath(DatabaseDirString, DatabaseFileName);
Poco::Data::SQLite::Connector::registerConnector();
SqliteDatabase::Ptr pDb = SqliteDatabase::openOrCreateDatabase(databaseFilePath.toString());
// When: set version
EXPECT_EQ(0, pDb->getVersion());
pDb->setVersion(1);
// Then: version has been updated
EXPECT_EQ(1, pDb->getVersion());
}
TEST_F(SqliteDatabaseIntegrationTest, setVersion_ThrowsSqlIllegalStateException_AfterClose)
{
// Given: create database
Poco::Path databaseFilePath(DatabaseDirString, DatabaseFileName);
Poco::Data::SQLite::Connector::registerConnector();
SqliteDatabase::Ptr pDb = SqliteDatabase::openOrCreateDatabase(databaseFilePath.toString());
// When: Close the database
pDb->close();
// Then: throws SqlIllegalStateException
EASYHTTPCPP_ASSERT_THROW(pDb->setVersion(1), SqlIllegalStateException, 100201);
}
TEST_F(SqliteDatabaseIntegrationTest, setAutoVacuum_Succeeds)
{
// Given: create database
Poco::Path databaseFilePath(DatabaseDirString, DatabaseFileName);
Poco::Data::SQLite::Connector::registerConnector();
SqliteDatabase::Ptr pDb = SqliteDatabase::openOrCreateDatabase(databaseFilePath.toString());
// When: set AutoVacuumIncremental
EXPECT_EQ(SqliteDatabase::AutoVacuumNone, pDb->getAutoVacuum());
pDb->setAutoVacuum(SqliteDatabase::AutoVacuumIncremental);
// Then: AutoVacuum has been updated
EXPECT_EQ(SqliteDatabase::AutoVacuumIncremental, pDb->getAutoVacuum());
}
TEST_F(SqliteDatabaseIntegrationTest, setAutoVacuum_ThrowsSqlIllegalStateException_AfterClose)
{
// Given: create database
Poco::Path databaseFilePath(DatabaseDirString, DatabaseFileName);
Poco::Data::SQLite::Connector::registerConnector();
SqliteDatabase::Ptr pDb = SqliteDatabase::openOrCreateDatabase(databaseFilePath.toString());
// When: Close the database
pDb->close();
// Then: throws SqlIllegalStateException
EASYHTTPCPP_ASSERT_THROW(pDb->setAutoVacuum(SqliteDatabase::AutoVacuumIncremental), SqlIllegalStateException, 100201);
}
} /* namespace test */
} /* namespace db */
} /* namespace easyhttpcpp */
| 34.556913 | 122 | 0.678279 | commshare |
b3392d29bb58dbf1bb0761a9f19bbdd1067bbd55 | 12,390 | cpp | C++ | src/main/cpp/Encoders.cpp | AlphaDragon601/SwerveDrive2_2022 | 7e575906ea71803ece25ee293cd74e0e9ea322b5 | [
"BSD-3-Clause"
] | null | null | null | src/main/cpp/Encoders.cpp | AlphaDragon601/SwerveDrive2_2022 | 7e575906ea71803ece25ee293cd74e0e9ea322b5 | [
"BSD-3-Clause"
] | null | null | null | src/main/cpp/Encoders.cpp | AlphaDragon601/SwerveDrive2_2022 | 7e575906ea71803ece25ee293cd74e0e9ea322b5 | [
"BSD-3-Clause"
] | null | null | null | /*
Encoders.cpp
Created on: Jan 3, 2020
Author: 5561
*/
#include "rev/CANSparkMax.h"
#include <frc/AnalogInput.h>
#include "Enums.hpp"
#include <frc/smartdashboard/SmartDashboard.h>
#include "Encoders.hpp"
#include "Const.hpp"
double V_WheelAngleRaw[E_RobotCornerSz];
double V_WheelAngle[E_RobotCornerSz];
double V_WheelAngleFwd[E_RobotCornerSz]; // This is the wheel angle as if the wheel were going to be driven in a forward direction, in degrees
double V_Rad_WheelAngleFwd[E_RobotCornerSz]; // This is the wheel angle as if the wheel were going to be driven in a forward direction, in radians
double V_WheelAngleRev[E_RobotCornerSz]; // This is the wheel angle as if the wheel were going to be driven in a reverse direction
double V_WheelAngleArb[E_RobotCornerSz]; // This is the arbitrated wheel angle that is used in the PID controller
double V_WheelAnglePrev[E_RobotCornerSz];
double V_WheelAngleLoop[E_RobotCornerSz];
double V_WheelRelativeAngleRawOffset[E_RobotCornerSz];
double V_WheelVelocity[E_RobotCornerSz]; // Velocity of drive wheels, in in/sec
double V_M_WheelDeltaDistance[E_RobotCornerSz]; // Distance wheel moved, loop to loop, in inches
double V_Cnt_WheelDeltaDistanceCurr[E_RobotCornerSz]; // Prev distance wheel moved, loop to loop, in Counts
double V_Cnt_WheelDeltaDistancePrev[E_RobotCornerSz]; // Prev distance wheel moved, loop to loop, in Counts
double V_ShooterSpeedCurr[E_RoboShooter];
double V_Cnt_WheelDeltaDistanceInit[E_RobotCornerSz];
double V_Delta_Angle[E_RobotCornerSz]; // The delta of the angle needed to align the wheels when the robot inits
/******************************************************************************
* Function: Init_Delta_Angle
*
* Description: Stores the delta value for wheel angles.
******************************************************************************/
void Init_Delta_Angle(double *L_Delta_Angle,
double a_encoderFrontLeftSteerVoltage,
double a_encoderFrontRightSteerVoltage,
double a_encoderRearLeftSteerVoltage,
double a_encoderRearRightSteerVoltage,
rev::SparkMaxRelativeEncoder m_encoderFrontLeftSteer,
rev::SparkMaxRelativeEncoder m_encoderFrontRightSteer,
rev::SparkMaxRelativeEncoder m_encoderRearLeftSteer,
rev::SparkMaxRelativeEncoder m_encoderRearRightSteer)
{
L_Delta_Angle[E_FrontLeft] = a_encoderFrontLeftSteerVoltage * C_VoltageToAngle - K_WheelOffsetAngle[E_FrontLeft];
L_Delta_Angle[E_FrontRight] = a_encoderFrontRightSteerVoltage * C_VoltageToAngle - K_WheelOffsetAngle[E_FrontRight];
L_Delta_Angle[E_RearLeft] = a_encoderRearLeftSteerVoltage * C_VoltageToAngle - K_WheelOffsetAngle[E_RearLeft];
L_Delta_Angle[E_RearRight] = a_encoderRearRightSteerVoltage * C_VoltageToAngle - K_WheelOffsetAngle[E_RearRight];
m_encoderFrontLeftSteer.SetPosition(0);
m_encoderFrontRightSteer.SetPosition(0);
m_encoderRearLeftSteer.SetPosition(0);
m_encoderRearRightSteer.SetPosition(0);
frc::SmartDashboard::PutNumber("Right rear aelta dngle", L_Delta_Angle[E_RearRight]);
frc::SmartDashboard::PutNumber("Left rear aelta dngle", L_Delta_Angle[E_RearLeft]);
}
/******************************************************************************
* Function: Read_Encoders
*
* Description: Run all of the encoder decoding logic.
******************************************************************************/
void Read_Encoders(bool L_RobotInit,
double a_encoderFrontLeftSteerVoltage,
double a_encoderFrontRightSteerVoltage,
double a_encoderRearLeftSteerVoltage,
double a_encoderRearRightSteerVoltage,
rev::SparkMaxRelativeEncoder m_encoderFrontLeftSteer,
rev::SparkMaxRelativeEncoder m_encoderFrontRightSteer,
rev::SparkMaxRelativeEncoder m_encoderRearLeftSteer,
rev::SparkMaxRelativeEncoder m_encoderRearRightSteer,
rev::SparkMaxRelativeEncoder m_encoderFrontLeftDrive,
rev::SparkMaxRelativeEncoder m_encoderFrontRightDrive,
rev::SparkMaxRelativeEncoder m_encoderRearLeftDrive,
rev::SparkMaxRelativeEncoder m_encoderRearRightDrive,
rev::SparkMaxRelativeEncoder m_encoderrightShooter,
rev::SparkMaxRelativeEncoder m_encoderleftShooter)
{
T_RobotCorner index;
//L_RobotInit = true; // For calibration only!
if (L_RobotInit == true)
{
V_WheelAngleRaw[E_FrontLeft] = a_encoderFrontLeftSteerVoltage * C_VoltageToAngle - K_WheelOffsetAngle[E_FrontLeft];
V_WheelAngleRaw[E_FrontRight] = a_encoderFrontRightSteerVoltage * C_VoltageToAngle - K_WheelOffsetAngle[E_FrontRight];
V_WheelAngleRaw[E_RearLeft] = a_encoderRearLeftSteerVoltage * C_VoltageToAngle - K_WheelOffsetAngle[E_RearLeft];
V_WheelAngleRaw[E_RearRight] = a_encoderRearRightSteerVoltage * C_VoltageToAngle - K_WheelOffsetAngle[E_RearRight];
V_WheelRelativeAngleRawOffset[E_FrontLeft] = m_encoderFrontLeftSteer.GetPosition();
V_WheelRelativeAngleRawOffset[E_FrontRight] = m_encoderFrontRightSteer.GetPosition();
V_WheelRelativeAngleRawOffset[E_RearLeft] = m_encoderRearLeftSteer.GetPosition();
V_WheelRelativeAngleRawOffset[E_RearRight] = m_encoderRearRightSteer.GetPosition();
for (index = E_FrontLeft;
index < E_RobotCornerSz;
index = T_RobotCorner(int(index) + 1))
{
if(abs(V_WheelAnglePrev[index]) >= 330 || abs(V_WheelAnglePrev[index] <= 30 ))
{
if(V_WheelAnglePrev[index] >= 330 && V_WheelAngleRaw[index] <= 30)
{
V_WheelAngleLoop[index] += 1;
}
else if (V_WheelAnglePrev[index] <= 30 && V_WheelAngleRaw[index] >= 330)
{
V_WheelAngleLoop[index] -= 1;
}
}
V_WheelAngleFwd[index] = (V_WheelAngleLoop[index] * 360) + V_WheelAngleRaw[index];
V_WheelAnglePrev[index] = V_WheelAngleRaw[index];
}
V_Cnt_WheelDeltaDistanceInit[E_FrontLeft] = m_encoderFrontLeftDrive.GetPosition();
V_Cnt_WheelDeltaDistanceInit[E_FrontRight] = m_encoderFrontRightDrive.GetPosition();
V_Cnt_WheelDeltaDistanceInit[E_RearRight] = m_encoderRearRightDrive.GetPosition();
V_Cnt_WheelDeltaDistanceInit[E_RearLeft] = m_encoderRearLeftDrive.GetPosition();
}
else
{
V_WheelAngleFwd[E_FrontLeft] = fmod(((m_encoderFrontLeftSteer.GetPosition() - V_WheelRelativeAngleRawOffset[E_FrontLeft]) * -20), 360);
V_WheelAngleFwd[E_FrontRight] = fmod(((m_encoderFrontRightSteer.GetPosition() - V_WheelRelativeAngleRawOffset[E_FrontRight]) * -20), 360);
V_WheelAngleFwd[E_RearLeft] = fmod(((m_encoderRearLeftSteer.GetPosition() - V_WheelRelativeAngleRawOffset[E_RearLeft]) * -20), 360);
V_WheelAngleFwd[E_RearRight] = fmod(((m_encoderRearRightSteer.GetPosition() - V_WheelRelativeAngleRawOffset[E_RearRight]) * -20), 360);
for (index = E_FrontLeft;
index < E_RobotCornerSz;
index = T_RobotCorner(int(index) + 1))
{
if (V_WheelAngleFwd[index] > 180)
{
V_WheelAngleFwd[index] -= 360;
}
else if (V_WheelAngleFwd[index] < -180)
{
V_WheelAngleFwd[index] += 360;
}
/* Now we need to find the equivalent angle as if the wheel were going to be driven in the opposite direction, i.e. in reverse */
if (V_WheelAngleFwd[index] >= 0)
{
V_WheelAngleRev[index] = V_WheelAngleFwd[index] - 180;
}
else
{
V_WheelAngleRev[index] = V_WheelAngleFwd[index] + 180;
}
}
}
frc::SmartDashboard::PutNumber("V_WheelAngleRaw Front Left", V_WheelAngleRaw[E_FrontLeft]);
frc::SmartDashboard::PutNumber("V_WheelAngleRaw Front Right", V_WheelAngleRaw[E_FrontRight]);
frc::SmartDashboard::PutNumber("V_WheelAngleRaw Rear Left", V_WheelAngleRaw[E_RearLeft]);
frc::SmartDashboard::PutNumber("V_WheelAngleRaw Rear Right", V_WheelAngleRaw[E_RearRight]);
frc::SmartDashboard::PutNumber("encoder_rear_right_steer", m_encoderRearRightSteer.GetPosition());
if (L_RobotInit == false)
{
V_Cnt_WheelDeltaDistanceCurr[E_FrontLeft] = m_encoderFrontLeftDrive.GetPosition() - V_Cnt_WheelDeltaDistanceInit[E_FrontLeft];
V_Cnt_WheelDeltaDistanceCurr[E_FrontRight] = m_encoderFrontRightDrive.GetPosition() - V_Cnt_WheelDeltaDistanceInit[E_FrontRight];
V_Cnt_WheelDeltaDistanceCurr[E_RearRight] = m_encoderRearRightDrive.GetPosition() - V_Cnt_WheelDeltaDistanceInit[E_RearRight];
V_Cnt_WheelDeltaDistanceCurr[E_RearLeft] = m_encoderRearLeftDrive.GetPosition() - V_Cnt_WheelDeltaDistanceInit[E_RearLeft];
V_M_WheelDeltaDistance[E_FrontLeft] = ((((V_Cnt_WheelDeltaDistanceCurr[E_FrontLeft] - V_Cnt_WheelDeltaDistancePrev[E_FrontLeft])/ K_ReductionRatio)) * K_WheelCircufrence );
V_M_WheelDeltaDistance[E_FrontRight] = ((((V_Cnt_WheelDeltaDistanceCurr[E_FrontRight] - V_Cnt_WheelDeltaDistancePrev[E_FrontRight])/ K_ReductionRatio)) * K_WheelCircufrence );
V_M_WheelDeltaDistance[E_RearRight] = ((((V_Cnt_WheelDeltaDistanceCurr[E_RearRight] - V_Cnt_WheelDeltaDistancePrev[E_RearRight])/ K_ReductionRatio)) * K_WheelCircufrence );
V_M_WheelDeltaDistance[E_RearLeft] = ((((V_Cnt_WheelDeltaDistanceCurr[E_RearLeft] - V_Cnt_WheelDeltaDistancePrev[E_RearLeft])/ K_ReductionRatio)) * K_WheelCircufrence );
V_Cnt_WheelDeltaDistancePrev[E_FrontLeft] = V_Cnt_WheelDeltaDistanceCurr[E_FrontLeft];
V_Cnt_WheelDeltaDistancePrev[E_FrontRight] = V_Cnt_WheelDeltaDistanceCurr[E_FrontRight];
V_Cnt_WheelDeltaDistancePrev[E_RearRight] = V_Cnt_WheelDeltaDistanceCurr[E_RearRight];
V_Cnt_WheelDeltaDistancePrev[E_RearLeft] = V_Cnt_WheelDeltaDistanceCurr[E_RearLeft];
}
for (index = E_FrontLeft;
index < E_RobotCornerSz;
index = T_RobotCorner(int(index) + 1))
{
/* Create a copy of the Angle Fwd, but in radians */
V_Rad_WheelAngleFwd[index] = V_WheelAngleFwd[index] * (C_PI/180);
}
frc::SmartDashboard::PutNumber("Wheel Front Left", ((V_Cnt_WheelDeltaDistanceCurr[E_FrontLeft] / K_ReductionRatio) / 60) * K_WheelCircufrence);
V_WheelVelocity[E_FrontLeft] = ((m_encoderFrontLeftDrive.GetVelocity() / K_ReductionRatio) / 60) * K_WheelCircufrence;
V_WheelVelocity[E_FrontRight] = ((m_encoderFrontRightDrive.GetVelocity() / K_ReductionRatio) / 60) * K_WheelCircufrence;
V_WheelVelocity[E_RearRight] = ((m_encoderRearRightDrive.GetVelocity() / K_ReductionRatio) / 60) * K_WheelCircufrence;
V_WheelVelocity[E_RearLeft] = ((m_encoderRearLeftDrive.GetVelocity() / K_ReductionRatio) / 60) * K_WheelCircufrence;
V_ShooterSpeedCurr[E_rightShooter] = (m_encoderrightShooter.GetVelocity() * K_ShooterWheelRotation[E_rightShooter]);
V_ShooterSpeedCurr[E_leftShooter] = (m_encoderleftShooter.GetVelocity() * K_ShooterWheelRotation[E_leftShooter]);
frc::SmartDashboard::PutNumber("Top speed current", m_encoderrightShooter.GetVelocity());
frc::SmartDashboard::PutNumber("Bottom speed current", m_encoderleftShooter.GetVelocity());
frc::SmartDashboard::PutBoolean("init?", L_RobotInit);
}
/******************************************************************************
* Function: DtrmnEncoderRelativeToCmnd
*
* Description: tbd
******************************************************************************/
double DtrmnEncoderRelativeToCmnd(double L_JoystickCmnd,
double L_EncoderReading)
{
double L_Opt1;
double L_Opt2;
double L_Opt3;
double L_Output;
L_Opt1 = fabs(L_JoystickCmnd - L_EncoderReading);
L_Opt2 = fabs(L_JoystickCmnd - (L_EncoderReading + 360));
L_Opt3 = fabs(L_JoystickCmnd - (L_EncoderReading - 360));
if ((L_Opt1 < L_Opt2) && (L_Opt1 < L_Opt3))
{
L_Output = L_EncoderReading;
}
else if ((L_Opt2 < L_Opt1) && (L_Opt2 < L_Opt3))
{
L_Output = L_EncoderReading + 360;
}
else
{
L_Output = L_EncoderReading - 360;
}
return (L_Output);
}
| 52.723404 | 182 | 0.695238 | AlphaDragon601 |
b33cc8d3b447236f074bd9fd1d238079ae9b3eac | 4,431 | cpp | C++ | src/patternScan/TriangleScanner.cpp | sroehling/ChartPatternRecognitionLib | d9bd25c0fc5a8942bb98c74c42ab52db80f680c1 | [
"MIT"
] | 9 | 2019-07-15T19:10:07.000Z | 2021-12-14T12:16:18.000Z | src/patternScan/TriangleScanner.cpp | sroehling/ChartPatternRecognitionLib | d9bd25c0fc5a8942bb98c74c42ab52db80f680c1 | [
"MIT"
] | null | null | null | src/patternScan/TriangleScanner.cpp | sroehling/ChartPatternRecognitionLib | d9bd25c0fc5a8942bb98c74c42ab52db80f680c1 | [
"MIT"
] | 2 | 2020-05-23T03:25:25.000Z | 2021-11-19T16:41:44.000Z | /*
* WedgeScanner.cpp
*
* Created on: Aug 1, 2014
* Author: sroehling
*/
#include <TriangleScanner.h>
#include "ChartSegment.h"
#include "DebugLog.h"
TriangleScanner::TriangleScanner(const DoubleRange &upperTrendLineSlopeRange,
const DoubleRange &lowerTrendLineSlopeRange)
: upperTrendLineSlopeRange_(upperTrendLineSlopeRange),
lowerTrendLineSlopeRange_(lowerTrendLineSlopeRange)
{
minPercDistanceToUpperLowerTrendlineIntercept_ = 0.6;
minPercValsBetweenTrendlines_ = 0.85;
}
bool TriangleScanner::pivotsSpacedOut(const ChartSegmentPtr &upperTrendLine,
const ChartSegmentPtr &lowerTrendLine) const
{
double numPerToIntercept = numPeriodsToIntercept(upperTrendLine,lowerTrendLine);
assert(numPerToIntercept > 0.0);
// If the distance between the pivot points doesn't cover a reasonable amount
// of the pattern, the pattern will look "bunched up" in one area.
double MIN_SPACING_PERC = 0.30;
double pivotLowSpacing = lowerTrendLine->lastPeriodVal().pseudoXVal()-lowerTrendLine->firstPeriodVal().pseudoXVal();
assert(pivotLowSpacing <= numPerToIntercept);
if((pivotLowSpacing/numPerToIntercept) < MIN_SPACING_PERC)
{
return false;
}
double pivotHighSpacing = upperTrendLine->lastPeriodVal().pseudoXVal()-upperTrendLine->firstPeriodVal().pseudoXVal();
if(pivotHighSpacing >= numPerToIntercept)
{
DEBUG_MSG("ERROR: WedgeScanner: "
<< " pivot high space: " << pivotHighSpacing
<< " intercept periods: " << numPerToIntercept);
}
assert(pivotHighSpacing <= numPerToIntercept);
if(pivotHighSpacing > numPerToIntercept)
{
DEBUG_MSG("WedgeScanner: "
<< " pivot high space: " << pivotHighSpacing
<< " intercept periods: " << numPerToIntercept);
}
if((pivotHighSpacing/numPerToIntercept) < MIN_SPACING_PERC)
{
return false;
}
return true;
}
bool TriangleScanner::validTrendLines(const ChartSegmentPtr &upperTrendLine, const ChartSegmentPtr &lowerTrendLine) const
{
if(!WedgeScannerEngine::validTrendLines(upperTrendLine,lowerTrendLine))
{
return false;
}
// For starters, the trend-line slope for the upper and lower trendlines must be within
// the acceptable ranges.
if(!(WedgeScannerEngine::validTrendlinePercChangePerYear(upperTrendLineSlopeRange_,upperTrendLine) &&
WedgeScannerEngine::validTrendlinePercChangePerYear(lowerTrendLineSlopeRange_,lowerTrendLine)))
{
return false;
}
if(!(upperTrendLineSlopeRange_.valueWithinRange(upperTrendLine->slope()) &&
lowerTrendLineSlopeRange_.valueWithinRange(lowerTrendLine->slope())))
{
return false;
}
// The first and last value of the upper and lower trend lines are the pivot highs and lows used to
// define the trend lines. With this in mind, we don't want to consider a pattern valid if
// there is not a pivot low before the second pivot high; in other words, the pattern is not
// considered valid (i.e., well-balanced) if both the pivot lows occur after both the pivot highs.
if(interceptAfter2ndLowerAndUpperPivot(upperTrendLine,lowerTrendLine))
{
if(!pivotsInterleaved(upperTrendLine,lowerTrendLine))
{
return false;
}
if(!pivotsSpacedOut(upperTrendLine,lowerTrendLine))
{
return false;
}
return true;
}
else
{
return false;
}
}
unsigned int TriangleScanner::minPatternPeriods(const ChartSegmentPtr &upperTrendLine,
const ChartSegmentPtr &lowerTrendLine) const
{
assert(validTrendLines(upperTrendLine,lowerTrendLine));
double numPeriodsToIntercept = this->numPeriodsToIntercept(upperTrendLine,lowerTrendLine);
double minPeriods = floor(minPercDistanceToUpperLowerTrendlineIntercept_ * numPeriodsToIntercept);
return minPeriods;
}
unsigned int TriangleScanner::maxPatternPeriods(const ChartSegmentPtr &upperTrendLine, const ChartSegmentPtr &lowerTrendLine) const
{
assert(validTrendLines(upperTrendLine,lowerTrendLine));
unsigned int maxPeriods = floor(this->numPeriodsToIntercept(upperTrendLine,lowerTrendLine));
DEBUG_MSG("WedgeScannerEngine: num periods to intercept: "
<< maxPeriods);
return maxPeriods;
}
TriangleScanner::~TriangleScanner() {
}
| 30.986014 | 131 | 0.713157 | sroehling |
b33fa5944016c9cda050601679f276ca6cbd4fe8 | 820 | tpp | C++ | src/delaunay_static_cpu_interpolator.tpp | bszhu/interpolators | 3a3274e5ce89a6532168b3305c013e2ab590a02c | [
"MIT"
] | null | null | null | src/delaunay_static_cpu_interpolator.tpp | bszhu/interpolators | 3a3274e5ce89a6532168b3305c013e2ab590a02c | [
"MIT"
] | 3 | 2021-04-03T23:09:23.000Z | 2021-06-25T09:07:36.000Z | src/delaunay_static_cpu_interpolator.tpp | bszhu/interpolators | 3a3274e5ce89a6532168b3305c013e2ab590a02c | [
"MIT"
] | null | null | null | #include "delaunay_static_cpu_interpolator.h"
template<typename index_t, int N_DIMS, int N_OPS>
DelaunayStaticCPUInterpolator<index_t, N_DIMS, N_OPS>::DelaunayStaticCPUInterpolator(
operator_set_evaluator_iface *supporting_point_evaluator,
const std::array<int, N_DIMS> &axes_points,
const std::array<double, N_DIMS> &axes_min,
const std::array<double, N_DIMS> &axes_max)
: DelaunayCPUInterpolatorBase<index_t, N_DIMS, N_OPS>(
supporting_point_evaluator, axes_points, axes_min, axes_max),
StaticCPUInterpolatorBase<index_t, N_DIMS, N_OPS>(
supporting_point_evaluator, axes_points, axes_min, axes_max),
InterpolatorBase<index_t, N_DIMS, N_OPS>(supporting_point_evaluator,
axes_points, axes_min, axes_max) {} | 54.666667 | 85 | 0.719512 | bszhu |
b342f0fe086bfb4beacf8b35ebe6fa79cd9f07a3 | 1,241 | cc | C++ | src/image/utils_test.cc | kofuk/pixel-terrain | f39e2a0120aab5a11311f57cfd1ab46efa65fddd | [
"MIT"
] | 2 | 2020-10-16T08:46:45.000Z | 2020-11-04T02:19:19.000Z | src/image/utils_test.cc | kofuk/minecraft-image-generator | ef2f7deb2daac7f7c2cfb468ef39e0cdc8b33db7 | [
"MIT"
] | null | null | null | src/image/utils_test.cc | kofuk/minecraft-image-generator | ef2f7deb2daac7f7c2cfb468ef39e0cdc8b33db7 | [
"MIT"
] | null | null | null | // SPDX-License-Identifier: MIT
#include <filesystem>
#include <boost/test/tools/interface.hpp>
#include <boost/test/unit_test.hpp>
#include <boost/test/unit_test_suite.hpp>
#include "image/utils.hh"
#include "utils/path_hack.hh"
using namespace pixel_terrain;
BOOST_AUTO_TEST_CASE(make_output_name_test) {
std::filesystem::path path(PATH_STR_LITERAL("/foo/bar/foo.mca"));
std::filesystem::path out_dir(PATH_STR_LITERAL("/foobar"));
{
auto [name, ok] = image::make_output_name_by_input(path, out_dir);
BOOST_TEST(ok);
BOOST_TEST(name == PATH_STR_LITERAL("/foobar/foo.png"));
}
{
path = PATH_STR_LITERAL("/foo/bar.baz");
auto [name, ok] = image::make_output_name_by_input(path, out_dir);
BOOST_TEST(not ok);
}
}
BOOST_AUTO_TEST_CASE(format_output_name_test) {
BOOST_TEST(image::format_output_name("%X %Z", 1, 2) == "1 2");
BOOST_TEST(image::format_output_name("%X %Z", 10, 200) == "10 200");
BOOST_TEST(image::format_output_name("%", 10, 200) == "%");
BOOST_TEST(image::format_output_name("%%%X", 10, 200) == "%10");
BOOST_TEST(image::format_output_name("", 10, 200) == "");
BOOST_TEST(image::format_output_name("%a", 10, 200) == "%a");
}
| 32.657895 | 74 | 0.664786 | kofuk |
b3456298caec8573eb7cdddb733a121e383eba23 | 14,197 | cpp | C++ | src/LuaInterpolate.cpp | perweij/tundra | 3384818fcf389a897de2463119a7e00de9da70e0 | [
"MIT"
] | 262 | 2015-01-15T09:52:46.000Z | 2022-03-26T19:10:54.000Z | src/LuaInterpolate.cpp | perweij/tundra | 3384818fcf389a897de2463119a7e00de9da70e0 | [
"MIT"
] | 78 | 2015-01-23T09:10:45.000Z | 2021-04-25T03:02:53.000Z | src/LuaInterpolate.cpp | perweij/tundra | 3384818fcf389a897de2463119a7e00de9da70e0 | [
"MIT"
] | 44 | 2015-03-13T22:15:24.000Z | 2022-03-27T15:06:27.000Z |
#include "MemAllocHeap.hpp"
#include "Buffer.hpp"
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
extern "C" {
#include "lua.h"
#include "lauxlib.h"
}
namespace t2
{
struct LuaEnvLookup
{
lua_State *m_LuaState;
int m_EnvIndex;
int m_VarIndex;
};
class LuaEnvLookupScope
{
private:
lua_State* m_LuaState;
bool m_Valid;
size_t m_Count;
public:
explicit LuaEnvLookupScope(LuaEnvLookup& lookup, const char* key, size_t len)
{
m_LuaState = lookup.m_LuaState;
m_Valid = false;
lua_State* L = lookup.m_LuaState;
// If we have a table of per-call variables, look there first.
if (int var_table_idx = lookup.m_VarIndex)
{
lua_getfield(L, var_table_idx, key);
if (!lua_isnil(L, -1))
{
if (LUA_TTABLE != lua_type(L, -1))
{
lua_newtable(L);
lua_pushvalue(L, -2);
lua_rawseti(L, -2, 1);
lua_replace(L, -2);
}
m_Count = lua_objlen(L, -1);
m_Valid = true;
return;
}
else
{
lua_pop(L, 1);
}
}
// Next, walk through the environment tables.
lua_pushvalue(L, lookup.m_EnvIndex);
while (!lua_isnil(L, -1))
{
lua_getfield(L, -1, "parent");
lua_getfield(L, -2, "vars");
// remove env table index from stack, replace it with its parent table
lua_remove(L, -3);
lua_getfield(L, -1, key);
if (!lua_isnil(L, -1))
{
luaL_checktype(L, -1, LUA_TTABLE);
lua_remove(L, -3);
lua_remove(L, -2);
m_Count = lua_objlen(L, -1);
m_Valid = true;
return;
}
// Pop nil value, and vars table. Leaving us with next table to try.
lua_pop(L, 2);
}
// Pop nil table.
lua_pop(L, 1);
luaL_error(L, "No key '%s' present in environment", key);
}
size_t GetCount()
{
return m_Count;
}
const char* GetValue(size_t index, size_t* len_out)
{
lua_State* L = m_LuaState;
CHECK(lua_type(L, -1) == LUA_TTABLE);
lua_rawgeti(L, -1, int(index + 1));
if (lua_type(L, -1) != LUA_TSTRING)
{
fprintf(stderr, "env lookup failed: elem %d is not a string: %s\n", (int) index + 1, lua_typename(L, lua_type(L, -1)));
return nullptr;
}
// This is technically not allowed but we do it anyway for performance.
// We check that the value is already a string, and we know it's being
// kept alive by the table which is on our stack.
const char* str = lua_tolstring(L, -1, len_out);
lua_pop(L, 1);
return str;
}
~LuaEnvLookupScope()
{
if (m_Valid)
{
lua_pop(m_LuaState, 1);
}
}
bool Valid()
{
return m_Valid;
}
private:
LuaEnvLookupScope(const LuaEnvLookupScope&);
LuaEnvLookupScope& operator=(const LuaEnvLookupScope&);
};
class StringBuffer
{
private:
enum
{
kInternalBufferSize = 64
};
MemAllocHeap *m_Heap;
size_t m_InternalBufferUsed;
char m_InternalBuffer[kInternalBufferSize];
Buffer<char> m_Buffer;
public:
explicit StringBuffer(MemAllocHeap* heap)
{
m_Heap = heap;
m_InternalBufferUsed = 0;
BufferInit(&m_Buffer);
}
~StringBuffer()
{
BufferDestroy(&m_Buffer, m_Heap);
}
void Add(const char* data, size_t len)
{
char* dest = Grow(len);
memcpy(dest, data, len);
}
char* Grow(size_t len)
{
if (m_Buffer.m_Size)
{
return BufferAlloc(&m_Buffer, m_Heap, len);
}
else if (len + m_InternalBufferUsed <= kInternalBufferSize)
{
size_t offset = m_InternalBufferUsed;
m_InternalBufferUsed += len;
return m_InternalBuffer + offset;
}
else
{
BufferAppend(&m_Buffer, m_Heap, m_InternalBuffer, m_InternalBufferUsed);
return BufferAlloc(&m_Buffer, m_Heap, len);
}
}
void Shrink(size_t size)
{
CHECK(size <= GetSize());
if (m_Buffer.m_Size)
{
m_Buffer.m_Size = size;
}
else
{
CHECK(size <= kInternalBufferSize);
m_InternalBufferUsed = size;
}
}
void NullTerminate()
{
Add("", 1);
}
MemAllocHeap* GetHeap()
{
return m_Heap;
}
size_t GetSize()
{
if (size_t sz = m_Buffer.m_Size)
return sz;
else
return m_InternalBufferUsed;
}
char* GetBuffer()
{
if (m_Buffer.m_Size)
return m_Buffer.m_Storage;
else
return m_InternalBuffer;
}
// Transformation functions invoked by interpolation options
void Prepend(const char* data, size_t len)
{
Grow(len);
char *buffer = GetBuffer();
size_t buflen = GetSize();
memmove(buffer + len, buffer, buflen - len);
memcpy(buffer, data, len);
}
void Append(const char* data, size_t len)
{
Add(data, len);
}
void PrependUnless(const char* data, size_t len)
{
if (len > GetSize() || 0 != memcmp(GetBuffer(), data, len))
{
Prepend(data, len);
}
}
void AppendUnless(const char* data, size_t data_len)
{
size_t len = GetSize();
char* buf = GetBuffer();
if (len < data_len || 0 != memcmp(buf + len - data_len, data, data_len))
{
Append(data, data_len);
}
}
void ToForwardSlashes()
{
size_t len = GetSize();
char* buf = GetBuffer();
for (size_t i = 0; i < len; ++i)
{
if (buf[i] == '\\')
buf[i] = '/';
}
}
void ToBackSlashes()
{
size_t len = GetSize();
char* buf = GetBuffer();
for (size_t i = 0; i < len; ++i)
{
if (buf[i] == '/')
buf[i] = '\\';
}
}
void ToUppercase()
{
size_t len = GetSize();
char* buf = GetBuffer();
for (size_t i = 0; i < len; ++i)
{
buf[i] = (char) toupper(buf[i]);
}
}
void ToLowercase()
{
size_t len = GetSize();
char* buf = GetBuffer();
for (size_t i = 0; i < len; ++i)
{
buf[i] = (char) tolower(buf[i]);
}
}
void DropSuffix()
{
size_t len = GetSize();
char* buf = GetBuffer();
for (int i = (int) len - 1; i >= 0; --i)
{
if ('.' == buf[i])
{
Shrink(i);
break;
}
}
}
void GetFilename()
{
size_t len = GetSize();
char* buf = GetBuffer();
for (int i = (int) len - 1; i >= 0; --i)
{
if ('/' == buf[i] || '\\' == buf[i])
{
int target_len = int(len - i - 1);
memmove(buf, buf + i + 1, target_len);
Shrink(target_len);
break;
}
}
}
void GetFilenameDir()
{
size_t len = GetSize();
char* buf = GetBuffer();
for (int i = (int) len - 1; i >= 0; --i)
{
if ('/' == buf[i] || '\\' == buf[i])
{
Shrink(i);
break;
}
}
}
void PrepQuoteCommon()
{
// Drop trailing backslash - can't be escaped on windows
{
size_t len = GetSize();
char* buf = GetBuffer();
if (len > 0 && buf[len - 1] == '\\')
Shrink(len - 1);
}
size_t bs_count = 0;
{
size_t len = GetSize();
char* buf = GetBuffer();
for (size_t i = 0; i < len; ++i)
{
if (buf[i] == '\\')
++bs_count;
}
}
if (bs_count > 0)
{
size_t orig_len = GetSize();
Grow(bs_count);
char* data = GetBuffer();
memmove(data + bs_count, data, orig_len);
size_t r = bs_count;
size_t w = 0;
while (r < orig_len + bs_count)
{
char ch = data[r++];
data[w++] = ch;
if (ch == '\\')
{
data[w++] = '\\';
}
}
}
}
void Quote()
{
// Avoid double quoting.
{
char* data = GetBuffer();
const size_t orig_len = GetSize();
if (orig_len > 0 && data[0] == '"' && data[orig_len-1] == '"')
{
// Already quoted. Make sure it doesn't end in a backslash.
if (orig_len > 1 && data[orig_len-2] == '\\')
{
Shrink(orig_len - 1);
size_t len = orig_len - 1;
data = GetBuffer();
data[len-1] = '"';
}
return;
}
}
PrepQuoteCommon();
Prepend("\"", 1);
Append("\"", 1);
}
void EscapeForCmdlineDefine()
{
PrepQuoteCommon();
Prepend("\\\"", 2);
Append("\\\"", 2);
}
private:
StringBuffer(const StringBuffer&);
StringBuffer& operator=(const StringBuffer&);
};
static bool DoInterpolate(StringBuffer& output, const char* str, size_t len, LuaEnvLookup& lookup);
static void UnescapeOption(char* p)
{
int r = 0;
int w = 0;
while (char ch = p[r++])
{
if ('\\' == ch)
{
if (p[r] == ':')
{
++r;
p[w++] = ':';
continue;
}
}
p[w++] = ch;
}
p[w++] = '\0';
}
static bool InterpolateVar(StringBuffer& output, const char* str, size_t len, LuaEnvLookup& lookup)
{
StringBuffer var_name(output.GetHeap());
if (!DoInterpolate(var_name, str, len, lookup))
return false;
var_name.NullTerminate();
enum
{
kMaxOptions = 10
};
size_t data_size = var_name.GetSize() - 1;
char *data = var_name.GetBuffer();
size_t option_count = 0;
char *option_ptrs[kMaxOptions];
if (char *options = strchr(data, ':'))
{
data_size = options - data;
while (nullptr != (options = strchr(options, ':')))
{
if (options[-1] == '\\')
{
++options;
continue;
}
if (option_count == kMaxOptions)
return false;
*options = '\0';
option_ptrs[option_count++] = options + 1;
++options;
}
for (size_t i = 0; i < option_count; ++i)
{
UnescapeOption(option_ptrs[i]);
}
}
LuaEnvLookupScope scope(lookup, data, data_size);
if (!scope.Valid())
return false;
const char *join_string = " ";
size_t first_index = 0;
size_t max_index = scope.GetCount();
for (size_t oi = 0; oi < option_count; ++oi)
{
const char* option = option_ptrs[oi];
switch (option[0])
{
case 'j':
join_string = &option[1];
break;
case '[':
first_index = atoi(&option[1]) - 1;
max_index = first_index + 1;
if (first_index >= scope.GetCount())
return false;
break;
}
}
const size_t join_len = strlen(join_string);
for (size_t i = first_index; i < max_index; ++i)
{
size_t item_len;
const char* item_text = scope.GetValue(i, &item_len);
if (!item_text)
return false;
StringBuffer item(output.GetHeap());
if (!DoInterpolate(item, item_text, item_len, lookup))
return false;
for (size_t oi = 0; oi < option_count; ++oi)
{
const char* option = option_ptrs[oi];
switch (option[0])
{
case 'p': item.Prepend(&option[1], strlen(&option[1])); break;
case 'a': item.Append(&option[1], strlen(&option[1])); break;
case 'P': item.PrependUnless(&option[1], strlen(&option[1])); break;
case 'A': item.AppendUnless(&option[1], strlen(&option[1])); break;
case 'f': item.ToForwardSlashes(); break;
case 'b': item.ToBackSlashes(); break;
case 'n':
#if defined(TUNDRA_WIN32)
item.ToBackSlashes();
#else
item.ToForwardSlashes();
#endif
break;
case 'u': item.ToUppercase(); break;
case 'l': item.ToLowercase(); break;
case 'B': item.DropSuffix(); break;
case 'F': item.GetFilename(); break;
case 'D': item.GetFilenameDir(); break;
case 'q': item.Quote(); break;
case '#': item.EscapeForCmdlineDefine(); break;
// Ignore these here
case '[': case 'j':
break;
default:
fprintf(stderr, "bad interpolation option: \"%s\"\n", option);
return false;
}
}
if (i > first_index)
output.Add(join_string, join_len);
output.Add(item.GetBuffer(), item.GetSize());
}
return true;
}
static const char* FindEndParen(const char* str, size_t len)
{
int nesting = 1;
for (size_t i = 0; i < len; ++i)
{
switch (str[i])
{
case '(':
++nesting;
break;
case ')':
if (--nesting == 0)
return str + i;
break;
}
}
return 0;
}
static bool DoInterpolate(StringBuffer& output, const char* str, size_t len, LuaEnvLookup& lookup)
{
const char* end = str + len;
while (str < end)
{
char ch = *str++;
if ('$' == ch)
{
if (end != str && '(' == str[0])
{
// Don't interpolate $(<) or $(@) without a lookaside table.
// We leave them in the string.
if (lookup.m_VarIndex || (str[1] != '<' && str[1] != '@'))
{
++str;
const char* end_paren = FindEndParen(str, end - str);
if (!end_paren)
{
fprintf(stderr, "unbalanced parens\n");
return false;
}
if (!InterpolateVar(output, str, end_paren - str, lookup))
return false;
str = end_paren + 1;
continue;
}
}
}
output.Add(&ch, 1);
}
return true;
}
// Interpolate a string with respect to a set of lookup tables.
//
// Calling interface:
// Arg 1 - String to interpolate
// Arg 2 - Top environment (we will follow "parent" links if needed)
// Arg 3 - Optional table of variables for this interpolation only
static int LuaInterpolate(lua_State* L)
{
size_t input_len;
const char* input = luaL_checklstring(L, 1, &input_len);
luaL_checktype(L, 2, LUA_TTABLE);
const bool has_vars = lua_type(L, 3) == LUA_TTABLE;
MemAllocHeap* heap;
lua_getallocf(L, (void**) &heap);
LuaEnvLookup lookup = { L, 2, has_vars ? 3 : 0 };
StringBuffer output(heap);
if (DoInterpolate(output, input, input_len, lookup))
{
lua_pushlstring(L, output.GetBuffer(), output.GetSize());
return 1;
}
return luaL_error(L, "interpolation failed: %s", input);
}
void LuaEnvNativeOpen(lua_State* L)
{
static luaL_Reg functions[] =
{
{ "interpolate", LuaInterpolate },
{ nullptr, nullptr },
};
luaL_register(L, "tundra.environment.native", functions);
lua_pop(L, 1);
}
}
| 21.032593 | 125 | 0.541241 | perweij |
b3458a8bc057840100266afbe0e26931be313b45 | 1,893 | cpp | C++ | POSN Camp1/toi_worldcup.cpp | ParamaaS/ParamaaS-Cpp-code- | a6c78151defe38d1460cde2b005a67be5a1d092d | [
"MIT"
] | null | null | null | POSN Camp1/toi_worldcup.cpp | ParamaaS/ParamaaS-Cpp-code- | a6c78151defe38d1460cde2b005a67be5a1d092d | [
"MIT"
] | null | null | null | POSN Camp1/toi_worldcup.cpp | ParamaaS/ParamaaS-Cpp-code- | a6c78151defe38d1460cde2b005a67be5a1d092d | [
"MIT"
] | null | null | null | #include<stdio.h>
char name[10][25];
int s[10][10],p[10],so[10],rem[10];
int c,c2,g[10],d[10],idx[10],dif[10];
main()
{
for(c=1;c<=4;c++)
{
scanf("%s",name[c]);
}
for(c=1;c<=4;c++)
{
for(c2=1;c2<=4;c2++)
{
scanf("%d",&s[c][c2]);
if(c==1) g[1]+=s[1][c2];
else if(c==2) g[2]+=s[2][c2];
else if(c==3) g[3]+=s[3][c2];
else if(c==4) g[4]+=s[4][c2];
if(c2==1) d[1]+=s[c][1];
else if(c2==2) d[2]+=s[c][2];
else if(c2==3) d[3]+=s[c][3];
else if(c2==4) d[4]+=s[c][4];
}
}
for(c=1;c<=4;c++)
{
dif[c]=g[c]-d[c];
}
for(c=1;c<=4;c++)
{
for(c2=1;c2<=4;c2++)
{
if(c==c2)
{
continue;
}
if(s[c][c2]>s[c2][c])
{
idx[c]+=3;
}
if(s[c][c2]==s[c2][c])
{
idx[c]++;
}
}
}
/*/
for(c=1;c<=4;c++)
{
printf("%s %d\n",name[c],idx[c]);
}
/*/
for(c=1;c<=4;c++)
{
so[c]=0;
for(c2=1;c2<=4;c2++)
{
if(so[c]<=idx[c2])
{
if(so[c]==idx[c2])
{
if(idx[rem[c]]==idx[c2]&&idx[c2]!=0)
{
if(dif[rem[c]]>dif[c2])
{
//rem[c]=rem[c];
so[c]=idx[rem[c]];
continue;
}
else if(dif[c2]>dif[rem[c]])
{
rem[c]=c2;
so[c]=idx[c2];
continue;
}
else if(dif[c2]==dif[rem[c]])
{
if(g[c2]>g[rem[c]])
{
rem[c]=c2;
so[c]=idx[c2];
continue;
}
else
{
rem[c]=rem[c];
so[c]=idx[rem[c]];
continue;
}
}
}
else if(idx[c2]==0&&idx[c2]==idx[rem[c]])
{
rem[c]=c2;
so[c]=idx[c2];
}
}
else
{
rem[c]=c2;
so[c]=idx[c2];
}
}
}
idx[rem[c]]=-1;
}
/*/
for(c=1;c<=4;c++)
{
printf("%d ",rem[c]);
}/*/
for(c=1;c<=4;c++)
{
printf("%s %d\n",name[rem[c]],so[c]);
}
}
| 15.907563 | 47 | 0.348653 | ParamaaS |
b3465a1ea06f2959df68fc58697a3aa36c2d89aa | 1,001 | cpp | C++ | src/UserData.cpp | maxmcguire/rocket | d7df8a698da25ed0aae125579fd2a58e3f07c48b | [
"MIT"
] | 6 | 2015-10-07T22:43:18.000Z | 2021-12-20T05:48:54.000Z | src/UserData.cpp | maxmcguire/rocket | d7df8a698da25ed0aae125579fd2a58e3f07c48b | [
"MIT"
] | null | null | null | src/UserData.cpp | maxmcguire/rocket | d7df8a698da25ed0aae125579fd2a58e3f07c48b | [
"MIT"
] | 3 | 2015-06-19T04:58:50.000Z | 2020-01-19T16:19:22.000Z | /*
* RocketVM
* Copyright (c) 2011 Max McGuire
*
* See copyright notice in COPYRIGHT
*/
extern "C"
{
#include "lua.h"
}
#include "Global.h"
#include "UserData.h"
#include "State.h"
#include "Table.h"
#include <stdlib.h>
UserData* UserData_Create(lua_State* L, size_t size, Table* env)
{
ASSERT(env != NULL);
UserData* userData = static_cast<UserData*>(Gc_AllocateObject(L, LUA_TUSERDATA, sizeof(UserData) + size));
userData->size = size;
userData->metatable = NULL;
userData->env = env;
Gc* gc = &L->gc;
Gc_IncrementReference(gc, userData, userData->env);
return userData;
}
void UserData_Destroy(lua_State* L, UserData* userData, bool releaseRefs)
{
if (releaseRefs)
{
Gc* gc = &L->gc;
if (userData->metatable != NULL)
{
Gc_DecrementReference(L, gc, userData->metatable);
}
Gc_DecrementReference(L, gc, userData->env);
}
Free(L, userData, sizeof(UserData) + userData->size);
} | 21.297872 | 110 | 0.629371 | maxmcguire |
b348374945b91d5b2125b34ffb65e00c20f0a5ab | 1,754 | cpp | C++ | KROSS/src/Kross/Util/Util.cpp | WillianKoessler/KROSS-ENGINE | 0e680b455ffd071565fe8b99343805ad16ca1e91 | [
"Apache-2.0"
] | null | null | null | KROSS/src/Kross/Util/Util.cpp | WillianKoessler/KROSS-ENGINE | 0e680b455ffd071565fe8b99343805ad16ca1e91 | [
"Apache-2.0"
] | null | null | null | KROSS/src/Kross/Util/Util.cpp | WillianKoessler/KROSS-ENGINE | 0e680b455ffd071565fe8b99343805ad16ca1e91 | [
"Apache-2.0"
] | null | null | null | #include "Kross_pch.h"
#include "Util.h"
namespace Kross {
void append(char *dest, size_t size, const char *str)
{
if (!dest || !str) return;
strcat_s(dest, size, str);
//std::string buffer(dest);
//std::string copy = buffer;
//buffer += str;
//size_t size = buffer.size();
//char *result = new char[size];
//memcpy(result, buffer.c_str(), size);
//size_t d = dest!=nullptr ? strlen(dest) : 0;
//size_t s = str!=nullptr ? strlen(str) : 0;
//char *cbuffer = new char[d+s+1];
//memset(cbuffer, 0, d + s + 1);
//memcpy(cbuffer, dest, d);
//memcpy(cbuffer + d, str, s);
//cbuffer[d+s] = '\0';
//char *temp = dest;
//dest = cbuffer;
//delete temp;
}
const char *ReadFile(const char *filepath)
{
std::ifstream inFile(filepath);
if (!inFile.is_open()) KROSS_ERROR("Unable to Open file: {0}", filepath);
std::stringstream stream;
stream << inFile.rdbuf();
inFile.close();
std::string str = stream.str();
size_t size = str.size();
char *ptr = new char[size+1];
memcpy(ptr, str.c_str(), size);
ptr[size] = '\0';
return ptr;
}
const char *FileName(const char *cpath)
{
if (cpath == nullptr) return nullptr;
std::string path(cpath);
size_t slash = path.find_last_of("/\\");
slash = (slash != std::string::npos) ? slash + 1 : 0;
size_t dot = path.find_last_of(".");
std::string name = path.substr(slash, dot);
size_t count = name.size();
char *ptr = new char[count + 1];
memcpy(ptr, name.c_str(), count);
ptr[count] = '\0';
return ptr;
}
int FlipBits(int &flags, int mask)
{
flags ^= mask;
return flags;
}
int ClearBits(int &flags, int mask)
{
flags &= ~mask;
return flags;
}
int SetBits(int &flags, int mask)
{
flags |= mask;
return flags;
}
}
| 21.654321 | 75 | 0.607754 | WillianKoessler |
b34f5322e95c6dfb58a48c59ca9a5609c89dfed7 | 821 | cpp | C++ | test/unit-XmlElementEmpty.cpp | Luchev/uni-xml-parser | 2a30d317617a19dd0c34b1788e478bd777f218ac | [
"MIT"
] | null | null | null | test/unit-XmlElementEmpty.cpp | Luchev/uni-xml-parser | 2a30d317617a19dd0c34b1788e478bd777f218ac | [
"MIT"
] | null | null | null | test/unit-XmlElementEmpty.cpp | Luchev/uni-xml-parser | 2a30d317617a19dd0c34b1788e478bd777f218ac | [
"MIT"
] | null | null | null | #include <lib/catch.hpp>
#include <test/test-utilities.hpp>
#include <test/test-XmlElementEmpty.hpp>
TEST_CASE("XmlElement set/getName() correctness", "[xmlElement]") {
REQUIRE(testXmlElementEmptyName());
}
TEST_CASE("XmlElement set/getParent() correctness", "[xmlElement]") {
REQUIRE(testXmlElementEmptyParent());
}
TEST_CASE("XmlElement addAttribute() correctness", "[xmlElementEmpty]") {
REQUIRE(testXmlElementEmptyAddAttributeCountZero());
REQUIRE(testXmlElementEmptyAddAttributeCountOne());
REQUIRE(testXmlElementEmptyAddAttributeValueIsCorrect());
}
TEST_CASE("XmlElement toString() correctness", "[xmlElementEmpty]") {
REQUIRE(testXmlElementEmptyToStringNoAttributes());
REQUIRE(testXmlElementEmptyToStringOneAttribute());
REQUIRE(testXmlElementEmptyToStringTwoAttributes());
}
| 34.208333 | 73 | 0.774665 | Luchev |
b35502acb01046f23e2883a3f0e49e59f3efb63b | 62 | cpp | C++ | test/compile_include_rope_2.cpp | eightysquirrels/text | d935545648777786dc196a75346cde8906da846a | [
"BSL-1.0"
] | null | null | null | test/compile_include_rope_2.cpp | eightysquirrels/text | d935545648777786dc196a75346cde8906da846a | [
"BSL-1.0"
] | 1 | 2021-03-05T12:56:59.000Z | 2021-03-05T13:11:53.000Z | test/compile_include_rope_2.cpp | eightysquirrels/text | d935545648777786dc196a75346cde8906da846a | [
"BSL-1.0"
] | 3 | 2019-10-30T18:38:15.000Z | 2021-03-05T12:10:13.000Z | #include <boost/text/rope.hpp>
#include <boost/text/rope.hpp>
| 20.666667 | 30 | 0.741935 | eightysquirrels |
b3575e393c46637c841f1391fa2098df614b9f65 | 120,472 | cpp | C++ | src/campaign/camptool/campdriv.cpp | Terebinth/freefalcon-central | c28d807183ab447ef6a801068aa3769527d55deb | [
"BSD-2-Clause"
] | 117 | 2015-01-13T14:48:49.000Z | 2022-03-16T01:38:19.000Z | src/campaign/camptool/campdriv.cpp | darongE/freefalcon-central | c28d807183ab447ef6a801068aa3769527d55deb | [
"BSD-2-Clause"
] | 4 | 2015-05-01T13:09:53.000Z | 2017-07-22T09:11:06.000Z | src/campaign/camptool/campdriv.cpp | darongE/freefalcon-central | c28d807183ab447ef6a801068aa3769527d55deb | [
"BSD-2-Clause"
] | 78 | 2015-01-13T09:27:47.000Z | 2022-03-18T14:39:09.000Z | // 2001-10-25 MOVED BY S.G. To the top of the file, outside of the #ifdef CAMPTOOL since it is used by other files as well
#ifdef _DEBUG
int gDumping = 0;
#endif
#ifdef CAMPTOOL
#include <windows.h>
#include <ctype.h>
#include "FalcLib.h"
#include "fsound.h"
#include "F4Vu.h"
#include "FalcSess.h"
#include "stdhdr.h"
#include "debuggr.h"
#include "camplib.h"
#include "camp2sim.h"
#include "threadmgr.h"
#include "cmpglobl.h"
#include "math.h"
#include "time.h"
#include "errorLog.h"
#include "campdisp.h"
#include "wingraph.h"
#include "Weather.h"
#include "dialog.h"
#include "uiwin.h"
#include "resource.h"
#include "unitdlg.h"
#include "falcmesg.h"
#include "campdriv.h"
#include "cmpevent.h"
#include "team.h"
#include "PlayerOp.h"
#include "ThreadMgr.h"
#include "classtbl.h"
// Campaign Specific Includes
#include "campaign.h"
#include "path.h"
#include "listADT.h"
#include "find.h"
#include "strategy.h"
#include "update.h"
#include "atm.h"
#include "gtm.h"
#include "CampList.h"
#include "CmpClass.h"
#include "CampBase.h"
#include "Convert.h"
#include "CampStr.h"
#include "CampMap.h"
#include "Options.h"
#include "CmpRadar.h"
#include "Graphics/Include/TMap.h"
// ========================================
// Global Variables
// ========================================
// Map sizing Info
#define MAX_XPIX 1536
#define MAX_YPIX 768
// Mapping data
MapData MainMapData;
int MaxXSize;
int MaxYSize;
unsigned char ReBlt = FALSE;
// Windows global handles
HWND hMainWnd = NULL, hToolWnd = NULL;
HDC hMainDC, hToolDC, hMapDC = NULL;
HMENU hMainMenu;
HBITMAP hMapBM;
HCURSOR hCurWait, hCurPoint, hCur = NULL;
// Threads
static F4THREADHANDLE hCampaignThread;
static DWORD CampaignThreadID;
// CampTool Specific
unsigned char Drawing = FALSE;
unsigned char RoadsOn = TRUE;
unsigned char RailsOn = TRUE;
unsigned char PBubble = FALSE;
unsigned char PBubbleDrawn = FALSE;
unsigned char SuspendDraw = TRUE;
unsigned char ShowCodes = FALSE;
unsigned char RefreshAll = FALSE;
unsigned char ShowSearch = FALSE;
unsigned char FreshDraw = FALSE;
unsigned char Saved;
unsigned char StateEdit;
unsigned char Moving = FALSE;
unsigned char Linking = FALSE;
unsigned char LinkTool = FALSE;
unsigned char FindPath = FALSE;
unsigned char WPDrag = FALSE;
unsigned char ShowFlanks = FALSE;
unsigned char ShowPaths = FALSE;
Team ThisTeam = 0;
char Mode = 1, EditMode = 8;
char TempPriority, DrawRoad = 0, DrawRail = 0, ObjMode = 0;
short CellSize;
ReliefType DrawRelief = Flat;
CoverType DrawCover = Water;
int DrawWeather = 0;
int ShowReal = 1;
GridIndex CurX, CurY, CenX, CenY, Movx, Movy, PBx, PBy, Sel1X, Sel1Y, Sel2X, Sel2Y;
costtype cost;
CampaignState StateToEdit = NULL;
ObjectiveType TempType;
Objective OneObjective, FromObjective, ToObjective, Neighbor, GlobObj, DragObjective = NULL;
Unit OneUnit, MoveUnit, PathUnit, GlobUnit, WPUnit, DragUnit = NULL;
WORD CampHour, CampMinute, CampDay;
WayPoint GlobWP = NULL;
F4PFList GlobList;
short ptSelected = 0;
extern int asAgg;
// Returns upper left hand corner of Cell, in window pixel coordinates
#define POSX(X) (short)((X)*md->CellSize-md->PFX)
#define POSY(Y) (short)(md->PLY-(Y+1)*md->CellSize)
// For testing
unsigned char SHOWSTATS;
int NoInput = 1;
int gMoveFlags = PATH_ENEMYOK bitor PATH_ROADOK;
int gMoveType = Tracked;
int gMoveWho = 6;
extern BOOL WINAPI SelectSquadron(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
// Renaming tool stuff
VU_ID_NUMBER RenameTable[65536] = { 0 };
int gRenameIds = 0;
extern int displayCampaign;
extern int maxSearch;
extern void ShowMissionLists(void);
// 2001-10-25 MOVED BY S.G. To the top of the file, outside of the #ifdef CAMPTOOL since it is used by other files as well
//#ifdef _DEBUG
//int gDumping = 0;
//#endif
// ========================================
// Necessary Prototypes
// ========================================
LRESULT CALLBACK CampaignWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
void CampMain(HINSTANCE hInstance, int nCmdShow);
void ProcessCommand(int Key);
void SetRefresh(MapData md);
void GetCellScreenRect(MapData md, GridIndex X, GridIndex Y, RECT *r);
// ====================================================================
// Campaign Support Functions (These are called by the campaign itself)
// ====================================================================
void ReBltWnd(MapData md, HDC DC)
{
RECT r;
if ( not md)
md = MainMapData;
if ( not MainMapData)
return; // Map's not open
GetClientRect(md->hMapWnd, &r);
BitBlt(md->hMapDC, r.left, r.top, r.right, r.bottom, DC, r.left, r.top, SRCCOPY);
// MonoPrint("blt to storage: %d,%d:%d,%d\n",r.left,r.top,r.right-r.left,r.bottom-r.top);
}
// This is a temporary routine for testing...
// Shows the pattern taken with my search routine.
void ShowWhere(MapData md, GridIndex x, GridIndex y, int color)
{
RECT r;
PAINTSTRUCT ps;
HDC DC;
if ( not md)
md = MainMapData;
if ( not MainMapData)
return; // Map's not open
GetCellScreenRect(md, x, y, &r);
InvalidateRect(md->hMapWnd, &r, FALSE);
DC = BeginPaint(md->hMapWnd, &ps);
_setcolor(DC, color);
_rectangle(DC, _GFILLINTERIOR, POSX(x), POSY(y), POSX(x + 1), POSY(y + 1));
EndPaint(md->hMapWnd, &ps);
}
// Show the time
void ShowTime(CampaignTime t)
{
RECT r;
WORD nm, nh;
if ( not hToolWnd)
return;
while (t > CampaignDay)
t -= CampaignDay;
nh = (WORD)(t / CampaignHours);
nm = (WORD)((t - nh * CampaignHours) / CampaignMinutes);
if (nm not_eq CampMinute)
{
_setcolor(hToolDC, White);
CampHour = nh;
CampMinute = nm;
CampDay = (WORD)TheCampaign.GetCurrentDay();
GetClientRect(hToolWnd, &r);
InvalidateRect(hToolWnd, &r, FALSE);
PostMessage(hToolWnd, WM_PAINT, 0, 0);
}
}
void ShowLink(MapData md, Objective o, Objective n, int color)
{
RECT r;
PAINTSTRUCT ps;
HDC DC;
GridIndex x, y;
if ( not md)
md = MainMapData;
if ( not MainMapData)
return; // Map's not open
GetClientRect(md->hMapWnd, &r);
InvalidateRect(md->hMapWnd, &r, FALSE);
DC = BeginPaint(md->hMapWnd, &ps);
_setcolor(DC, color);
o->GetLocation(&x, &y);
_moveto(DC, POSX(x) + (md->CellSize >> 1), POSY(y) + (md->CellSize >> 1));
n->GetLocation(&x, &y);
_lineto(DC, POSX(x) + (md->CellSize >> 1), POSY(y) + (md->CellSize >> 1));
EndPaint(md->hMapWnd, &ps);
}
// Draw a waypoint box
void ShowWP(MapData md, GridIndex X, GridIndex Y, int color)
{
RECT r;
PAINTSTRUCT ps;
HDC DC;
if ( not md)
md = MainMapData;
if ( not MainMapData)
return; // Map's not open
GetCellScreenRect(md, X, Y, &r);
InvalidateRect(md->hMapWnd, &r, FALSE);
DC = BeginPaint(md->hMapWnd, &ps);
_setcolor(DC, color);
_rectangle(DC, _GBORDER, POSX(X), POSY(Y), POSX(X) + md->CellSize * 4, POSY(Y) + md->CellSize * 4);
EndPaint(md->hMapWnd, &ps);
}
void ShowWPLeg(MapData md, GridIndex x, GridIndex y, GridIndex X, GridIndex Y, int color)
{
RECT r;
PAINTSTRUCT ps;
HDC DC;
if ( not md)
md = MainMapData;
if ( not MainMapData)
return; // Map's not open
GetClientRect(md->hMapWnd, &r);
InvalidateRect(md->hMapWnd, &r, FALSE);
DC = BeginPaint(md->hMapWnd, &ps);
_setcolor(DC, color);
_moveto(DC, POSX(x) + (md->CellSize >> 1), POSY(y) + (md->CellSize >> 1));
_lineto(DC, POSX(X) + (md->CellSize >> 1), POSY(Y) + (md->CellSize >> 1));
EndPaint(md->hMapWnd, &ps);
ShowWP(md, x, y, color);
ShowWP(md, X, Y, color);
}
void ShowPath(MapData md, GridIndex X, GridIndex Y, Path p, int color)
{
RECT r;
PAINTSTRUCT ps;
HDC DC;
int i, d, step;
GridIndex x, y;
if ( not md)
md = MainMapData;
if ( not MainMapData)
return; // Map's not open
GetClientRect(md->hMapWnd, &r);
InvalidateRect(md->hMapWnd, &r, FALSE);
DC = BeginPaint(md->hMapWnd, &ps);
_setcolor(DC, color);
_moveto(DC, POSX(X) + (md->CellSize >> 1), POSY(Y) + (md->CellSize >> 1));
if (QuickSearch)
step = QuickSearch;
else
step = 1;
for (i = 0; i < p->GetLength(); i++)
{
d = p->GetDirection(i);
if (d >= 0)
{
x = X + dx[d] * step;
y = Y + dy[d] * step;
_lineto(DC, POSX(x) + (md->CellSize >> 1), POSY(y) + (md->CellSize >> 1));
X = x;
Y = y;
}
}
EndPaint(md->hMapWnd, &ps);
}
void ShowObjectivePath(MapData md, Objective o, Path p, int color)
{
RECT r;
PAINTSTRUCT ps;
HDC DC;
int i, d;
GridIndex x, y;
if ( not md)
md = MainMapData;
if ( not MainMapData)
return; // Map's not open
GetClientRect(md->hMapWnd, &r);
InvalidateRect(md->hMapWnd, &r, FALSE);
DC = BeginPaint(md->hMapWnd, &ps);
_setcolor(DC, color);
o->GetLocation(&x, &y);
_moveto(DC, POSX(x) + (md->CellSize >> 1), POSY(y) + (md->CellSize >> 1));
for (i = 0; i < p->GetLength(); i++)
{
d = p->GetDirection(i);
if (d >= 0)
{
o = o->GetNeighbor(d);
o->GetLocation(&x, &y);
_lineto(DC, POSX(x) + (md->CellSize >> 1), POSY(y) + (md->CellSize >> 1));
}
}
EndPaint(md->hMapWnd, &ps);
}
void ShowPathHistory(MapData md, GridIndex X, GridIndex Y, Path p, int color)
{
RECT r;
PAINTSTRUCT ps;
HDC DC;
int i, d, step;
GridIndex x, y;
if ( not md)
md = MainMapData;
if ( not MainMapData)
return; // Map's not open
GetClientRect(md->hMapWnd, &r);
InvalidateRect(md->hMapWnd, &r, FALSE);
DC = BeginPaint(md->hMapWnd, &ps);
_setcolor(DC, color);
_moveto(DC, POSX(X) + (md->CellSize >> 1), POSY(Y) + (md->CellSize >> 1));
i = 1;
if (QuickSearch)
step = QuickSearch;
else
step = 1;
d = p->GetPreviousDirection(i);
while (d not_eq Here)
{
x = X - dx[d] * step;
y = Y - dy[d] * step;
_lineto(DC, POSX(x) + (md->CellSize >> 1), POSY(y) + (md->CellSize >> 1));
X = x;
Y = y;
i++;
}
EndPaint(md->hMapWnd, &ps);
}
void ShowRange(MapData md, GridIndex X, GridIndex Y, int range, int color)
{
RECT r;
PAINTSTRUCT ps;
HDC DC;
GridIndex x, y;
if ( not md)
md = MainMapData;
if ( not MainMapData)
return; // Map's not open
GetClientRect(md->hMapWnd, &r);
InvalidateRect(md->hMapWnd, &r, FALSE);
DC = BeginPaint(md->hMapWnd, &ps);
_setcolor(DC, color);
range *= md->CellSize;
x = (short)(POSX(X) + (md->CellSize >> 1));
y = (short)(POSY(Y) + (md->CellSize >> 1));
_ellipse(DC, _GBORDER, x - range, y - range, x + range, y + range);
EndPaint(md->hMapWnd, &ps);
}
void ShowLinkCosts(Objective f, Objective t)
{
int i, j;
MonoPrint("Link Costs: ");
for (i = 0; i < f->NumLinks(); i++)
{
if (f->GetNeighbor(i) == t)
{
for (j = 0; j < MOVEMENT_TYPES; j++)
MonoPrint("%d ", f->link_data[i].costs[j]);
}
}
MonoPrint("\n");
}
void ShowDivisions(HDC DC, MapData md)
{
int t;
Division d;
Unit u;
for (t = 0; t < NUM_TEAMS; t++)
{
d = GetFirstDivision(t);
while (d)
{
u = d->GetFirstUnitElement();
while (u)
{
if (u->GetSType() == d->type)
{
DisplayUnit(DC, u, (short)(POSX(d->x - 2) + (md->CellSize >> 3) * 5), (short)(POSY(d->y + 2) + (md->CellSize >> 2) * 5), (short)(md->CellSize >> 1) * 5);
u = NULL;
}
else
u = d->GetNextUnitElement();
}
d = d->next;
}
}
}
void RedrawUnit(Unit u)
{
GridIndex x, y;
PAINTSTRUCT ps;
RECT r;
HDC DC;
MapData md = MainMapData;
if ( not MainMapData)
return;
u->GetLocation(&x, &y);
GetCellScreenRect(md, x, y, &r);
InvalidateRect(md->hMapWnd, &r, FALSE);
DC = BeginPaint(md->hMapWnd, &ps);
DisplayUnit(DC, u, (short)(POSX(x) + (md->CellSize >> 3)), (short)(POSY(y) + (md->CellSize >> 2)), (short)(md->CellSize >> 1));
EndPaint(md->hMapWnd, &ps);
}
// return 0 or 1 depending on if this unit is a type we want to display
int DisplayOk(Unit u)
{
if (ShowReal == 1 and u->Real() and not u->Inactive())
return 1;
else if ( not ShowReal and u->Parent() and not u->Inactive())
return 1;
else if (ShowReal == 2 and u->Inactive())
return 1;
return 0;
}
// ===============================================
// Mutual support functions
// ===============================================
void GetCellScreenRect(MapData md, GridIndex X, GridIndex Y, RECT *r)
{
if ( not md)
return;
r->left = POSX(X);
r->top = POSY(Y);
r->right = r->left + md->CellSize;
r->bottom = r->top + md->CellSize;
}
void RedrawCell(MapData md, GridIndex X, GridIndex Y)
{
RECT r;
PAINTSTRUCT ps;
Objective o;
Unit u = NULL;
HDC DC;
short scale = 1;
if ( not md)
md = MainMapData;
if ( not MainMapData)
return; // Map's not open
if (X < md->FX or X > md->LX or Y < md->FY or Y > md->LY)
return;
GetCellScreenRect(md, X, Y, &r);
InvalidateRect(md->hMapWnd, &r, FALSE);
DC = BeginPaint(md->hMapWnd, &ps);
DisplayCellData(DC, X, Y, POSX(X), POSY(Y), md->CellSize, Mode, RoadsOn, RailsOn);
o = GetObjectiveByXY(X, Y);
if (o)
{
DisplayObjective(DC, o, POSX(X), POSY(Y), md->CellSize);
}
if (ShowReal == 1)
u = FindUnitByXY(AllRealList, X, Y, 0);
else if ( not ShowReal)
{
u = FindUnitByXY(AllParentList, X, Y, 0);
scale = 3;
X--;
Y++;
}
else if (ShowReal == 2)
u = FindUnitByXY(InactiveList, X, Y, 0);
else
{
Division d;
d = FindDivisionByXY(X, Y);
if (d)
u = d->GetUnitElement(0);
X -= 2;
Y += 2;
scale = 5;
}
if (u)
DisplayUnit(DC, u, (short)(POSX(X) + (md->CellSize >> 3)*scale), (short)(POSY(Y) + (md->CellSize >> 2)*scale), (short)((md->CellSize >> 1)*scale));
EndPaint(md->hMapWnd, &ps);
}
// =======================================
// Tool support functions
// =======================================
void ShowEmitters(MapData md, HDC DC)
{
CampEntity e;
GridIndex x, y;
int range;
VuListIterator myit(EmitterList);
e = GetFirstEntity(&myit);
while (e)
{
range = e->GetDetectionRange(Air);
if (range > 0)
{
e->GetLocation(&x, &y);
DisplaySideRange(DC, e->GetOwner(), (short)(POSX(x) + (md->CellSize >> 1)), (short)(POSY(y) + (md->CellSize >> 1)), range * md->CellSize);
}
e = GetNextEntity(&myit);
}
}
void ShowSAMs(MapData md, HDC DC)
{
CampEntity e;
GridIndex x, y;
int range;
VuListIterator myit(AirDefenseList);
e = GetFirstEntity(&myit);
while (e)
{
if (md->SAMs == 1)
range = e->GetWeaponRange(Air);
else
range = e->GetWeaponRange(LowAir);
if (range > 0 and (e->IsObjective() or (e->GetDomain() not_eq DOMAIN_AIR and e->IsUnit() and not ((Unit)e)->Moving())))
{
e->GetLocation(&x, &y);
DisplaySideRange(DC, e->GetOwner(), (short)(POSX(x) + (md->CellSize >> 1)), (short)(POSY(y) + (md->CellSize >> 1)), range * md->CellSize);
}
e = GetNextEntity(&myit);
}
}
void ShowPlayerBubble(MapData md, HDC DC, int show_ok)
{
//GridIndex x=0,y=0;
//int bubble_size = 20; // This is actually a per-entity value
//if (FalconLocalSession->Camera(0)){
// // sfr: xy order
// ::vector pos = { FalconLocalSession->Camera(0)->XPos(), FalconLocalSession->Camera(0)->YPos() };
// ConvertSimToGrid(&pos, &x, &y );
// y = SimToGrid(FalconLocalSession->Camera(0)->XPos());
// x = SimToGrid(FalconLocalSession->Camera(0)->YPos());
//}
//else {
// show_ok = FALSE;
//}
//if (PBubbleDrawn){
// SetROP2(DC, R2_NOT);
// DisplaySideRange(
// DC,0,(short)(POSX(PBx)+(md->CellSize>>1)),(short)(POSY(PBy)+(md->CellSize>>1)),bubble_size*md->CellSize
// );
// DisplaySideRange(
// DC,0,(short)(POSX(PBx)+(md->CellSize>>1)),(short)(POSY(PBy)+(md->CellSize>>1)),1*md->CellSize
// );
// SetROP2(DC, R2_COPYPEN);
// PBubbleDrawn = FALSE;
//}
//if (show_ok){
// SetROP2(DC, R2_NOT);
// DisplaySideRange(
// DC,0,(short)(POSX(x)+(md->CellSize>>1)),(short)(POSY(y)+(md->CellSize>>1)),bubble_size*md->CellSize
// );
// DisplaySideRange(
// DC,0,(short)(POSX(x)+(md->CellSize>>1)),(short)(POSY(y)+(md->CellSize>>1)),1*md->CellSize
// );
// SetROP2(DC, R2_COPYPEN);
// PBubbleDrawn = TRUE;
// PBx = x;
// PBy = y;
//}
}
void RedrawPlayerBubble()
{
RECT r;
PAINTSTRUCT ps;
HDC DC;
MapData md = MainMapData;
GetClientRect(md->hMapWnd, &r);
InvalidateRect(md->hMapWnd, &r, FALSE);
DC = BeginPaint(md->hMapWnd, &ps);
ShowPlayerBubble(md, DC, 1);
EndPaint(md->hMapWnd, &ps);
}
void ChangeCell(GridIndex X, GridIndex Y)
{
int i;//,x,y;
PAINTSTRUCT ps;
HDC DC;
RECT r;
MapData md = MainMapData;
Trim(&X, &Y);
switch (EditMode)
{
case 0:
case 1:
SetGroundCover(GetCell(X, Y), DrawCover);
break;
case 2:
SetReliefType(GetCell(X, Y), DrawRelief);
break;
case 3:
SetRoadCell(GetCell(X, Y), DrawRoad);
for (i = 0; i < 8; i++)
{
FreshDraw = TRUE;
RedrawCell(MainMapData, (short)(X + dx[i]), (short)(Y + dy[i]));
}
break;
case 4:
SetRailCell(GetCell(X, Y), DrawRail);
for (i = 0; i < 8; i++)
{
FreshDraw = TRUE;
RedrawCell(MainMapData, (short)(X + dx[i]), (short)(Y + dy[i]));
}
break;
case 5:
((WeatherClass*)realWeather)->SetCloudCover(X, Y, DrawWeather);
GetClientRect(md->hMapWnd, &r);
InvalidateRect(md->hMapWnd, &r, FALSE);
DC = BeginPaint(md->hMapWnd, &ps);
if (PBubble)
ShowPlayerBubble(md, DC, 0);
//JAM - FIXME
// for (x=X-FloatToInt32(CLOUD_CELL_SIZE); x<X+FloatToInt32(CLOUD_CELL_SIZE); x++)
// for (y=Y-FloatToInt32(CLOUD_CELL_SIZE); y<Y+FloatToInt32(CLOUD_CELL_SIZE); y++)
// DisplayCellData(DC,x,y,POSX(x),POSY(y),md->CellSize,Mode,0,0);
ReBltWnd(md, DC);
if (PBubble)
ShowPlayerBubble(md, DC, 1);
EndPaint(md->hMapWnd, &ps);
break;
case 6:
((WeatherClass*)realWeather)->SetCloudLevel(X, Y, DrawWeather);
GetClientRect(md->hMapWnd, &r);
InvalidateRect(md->hMapWnd, &r, FALSE);
DC = BeginPaint(md->hMapWnd, &ps);
if (PBubble)
ShowPlayerBubble(md, DC, 0);
//JAM - FIXME
// for (x=X-FloatToInt32(CLOUD_CELL_SIZE); x<X+FloatToInt32(CLOUD_CELL_SIZE); x++)
// for (y=Y-FloatToInt32(CLOUD_CELL_SIZE); y<Y+FloatToInt32(CLOUD_CELL_SIZE); y++)
// DisplayCellData(DC,x,y,POSX(x),POSY(y),md->CellSize,Mode,0,0);
ReBltWnd(md, DC);
if (PBubble)
ShowPlayerBubble(md, DC, 1);
EndPaint(md->hMapWnd, &ps);
break;
default:
break;
}
FreshDraw = TRUE;
RedrawCell(MainMapData, X, Y);
}
void ResizeCursor(void)
{
if (hCur)
DestroyCursor(hCur);
switch (CellSize)
{
case 2:
hCur = LoadCursor(hInst, MAKEINTRESOURCE(IDC_CURSOR1));
break;
case 4:
hCur = LoadCursor(hInst, MAKEINTRESOURCE(IDC_CURSOR2));
break;
case 8:
hCur = LoadCursor(hInst, MAKEINTRESOURCE(IDC_CURSOR3));
break;
case 16:
hCur = LoadCursor(hInst, MAKEINTRESOURCE(IDC_CURSOR4));
break;
default:
hCur = LoadCursor(hInst, MAKEINTRESOURCE(IDC_CURSOR0));
break;
}
SetCursor(hCur);
}
void FindBorders(MapData md)
{
RECT windim;
short xsize, ysize;
GridIndex tx, ty;
GetClientRect(md->hMapWnd, &windim);
xsize = (short)(windim.right); // - windim->left);
ysize = (short)(windim.bottom); // - windim->top);
tx = md->CenX - (xsize / md->CellSize) / 2;
ty = md->CenY + (ysize / md->CellSize) / 2;
if (tx - md->FX > 1 or md->FX - tx > 1)
md->FX = tx;
if (ty - md->LY > 1 or md->LY - ty > 1)
md->LY = ty;
md->LX = md->FX + (xsize / md->CellSize) + 1;
md->FY = md->LY - (ysize / md->CellSize) - 1;
if (md->LX > Map_Max_X)
{
md->LX = Map_Max_X;
md->FX = Map_Max_X - xsize / md->CellSize;
if (xsize / md->CellSize)
md->FX--;
}
if (md->LY > Map_Max_Y)
{
md->LY = Map_Max_Y;
md->FY = Map_Max_Y - ysize / md->CellSize;
}
if (md->FX < 0)
{
md->FX = 0;
md->LX = xsize / md->CellSize + 1;
}
if (md->FY < 0)
{
md->FY = 0;
md->LY = ysize / md->CellSize + 1;
}
if (md->LX > Map_Max_X)
md->LX = Map_Max_X;
if (md->LY > Map_Max_Y)
md->LY = Map_Max_Y;
md->PFX = md->FX * md->CellSize;
md->PLY = md->LY * md->CellSize;
md->PLX = md->PFX + xsize;
md->PFY = md->PLY - ysize;
md->CenX = CenX = (md->LX - md->FX) / 2 + md->FX;
md->CenY = CenY = (md->LY - md->FY) / 2 + md->FY;
GetWindowRect(md->hMapWnd, &windim);
md->WULX = (short)windim.left;
md->WULY = (short)windim.top;
md->CULX = GetSystemMetrics(SM_CXSIZEFRAME);
md->CULY = (SHORT)(windim.bottom - windim.top - ysize);
md->CULY -= GetSystemMetrics(SM_CYHSCROLL);
md->CULY -= GetSystemMetrics(SM_CYSIZEFRAME);
}
int CenPer(MapData md, GridIndex cen, int side)
{
RECT windim;
int size, range, per;
GetClientRect(md->hMapWnd, &windim);
if (side == XSIDE)
{
size = (short)(windim.right); // - windim->left);
range = 1 + Map_Max_X - (size / md->CellSize);
per = (cen - ((size / md->CellSize) / 2)) * 100 / range;
}
else
{
size = (short)(windim.bottom); // - windim->top);
range = 1 + Map_Max_Y - (size / md->CellSize);
per = ((Map_Max_Y - cen) - ((size / md->CellSize) / 2)) * 100 / range;
}
return per;
}
F4PFList GetSquadsFlightList(VU_ID id)
{
F4PFList list = new FalconPrivateList(&AllAirFilter);
Unit u;
VuListIterator myit(AllRealList);
list->Register();
u = GetFirstUnit(&myit);
while (u)
{
if (u->GetUnitParentID() == id and u->GetDomain() == DOMAIN_AIR and u->GetType() == TYPE_FLIGHT)
{
list->ForcedInsert(u);
}
u = GetNextUnit(&myit);
}
return list;
}
#define MAX_OBJ_TYPES 33 // WARNING: This should go someplace real...
typedef struct
{
short ClassId;
short stype;
} OBJ_DATA;
void MakeCampaignNew(void)
{
// Remove all flights, reset times, and generally do what is necessary
// to make a campaign be "unrun"
Unit u;
int i, id;
ATMAirbaseClass *cur;
// Clearup unit data
{
VuListIterator uit(AllUnitList);
u = (Unit)uit.GetFirst();
while (u)
{
if (u->IsFlight() or u->IsPackage())
{
u->KillUnit();
u->Remove();
}
else if (u->IsBattalion())
{
((Battalion)u)->SetUnitSupply(100);
((Battalion)u)->last_move = 0;
((Battalion)u)->last_combat = 0;
((Battalion)u)->SetSpottedTime(0);
((Battalion)u)->SetUnitFatigue(0);
((Battalion)u)->SetUnitMorale(100);
((Battalion)u)->SetFullStrength(0);
((Battalion)u)->last_obj = FalconNullId;
((Battalion)u)->deag_data = NULL;
((Battalion)u)->DisposeWayPoints();
((Battalion)u)->ClearUnitPath();
((Battalion)u)->SetOrders(0);
((Battalion)u)->SetPObj(FalconNullId);
((Battalion)u)->SetSObj(FalconNullId);
((Battalion)u)->SetAObj(FalconNullId);
}
else if (u->IsBrigade()/*u->IsBattalion()*/)
{
((Brigade)u)->SetFullStrength(0);
((Brigade)u)->SetOrders(0);
((Brigade)u)->SetPObj(FalconNullId);
((Brigade)u)->SetSObj(FalconNullId);
((Brigade)u)->SetAObj(FalconNullId);
}
else if (u->IsSquadron())
{
((Squadron)u)->SetUnitAirbase(FalconNullId);
for (i = 0; i < VEHICLE_GROUPS_PER_UNIT; i++)
((Squadron)u)->ClearSchedule(i);
((Squadron)u)->SetHotSpot(FalconNullId);
((Squadron)u)->SetAssigned(0);
for (i = 0; i < ARO_OTHER; i++)
((Squadron)u)->SetRating(i, 0);
((Squadron)u)->SetAAKills(0);
((Squadron)u)->SetAGKills(0);
((Squadron)u)->SetASKills(0);
((Squadron)u)->SetANKills(0);
((Squadron)u)->SetMissionsFlown(0);
((Squadron)u)->SetMissionScore(0);
((Squadron)u)->SetTotalLosses(0);
((Squadron)u)->SetPilotLosses(0);
for (i = 0; i < PILOTS_PER_SQUADRON; i++)
{
id = ((Squadron)u)->GetPilotData(i)->pilot_id;
// 2000-11-17 MODIFIED BY S.G. NEED TO PASS THE 'airExperience' OF THE TEAM SO I CAN USE IT AS A BASE
// ((Squadron)u)->GetPilotData(i)->ResetStats();
((Squadron)u)->GetPilotData(i)->ResetStats(TeamInfo[((Squadron)u)->GetOwner()]->airExperience);
((Squadron)u)->GetPilotData(i)->pilot_id = id;
}
}
u = (Unit)uit.GetNext();
}
}
// Clear team and planner data
for (i = 0; i < NUM_TEAMS; i++)
{
TeamInfo[i]->atm->squadrons = 0;
TeamInfo[i]->atm->requestList->Purge();
TeamInfo[i]->atm->delayedList->Purge();
TeamInfo[i]->atm->supplyBase = 0;
cur = TeamInfo[i]->atm->airbaseList;
while (cur)
{
cur->id = FalconNullId;
memset(cur->schedule, 0, sizeof(uchar)*ATM_MAX_CYCLES);
cur->usage = 0;
cur = cur->next;
}
}
// Clear campaign data
TheCampaign.lastGroundTask = 0;
TheCampaign.lastAirTask = 0;
TheCampaign.lastNavalTask = 0;
TheCampaign.lastGroundPlan = 0;
TheCampaign.lastAirPlan = 0;
TheCampaign.lastNavalPlan = 0;
TheCampaign.lastResupply = 0;
TheCampaign.lastRepair = 0;
TheCampaign.lastReinforcement = 0;
TheCampaign.lastStatistic = 0;
TheCampaign.lastMajorEvent = 0;
TheCampaign.last_victory_time = 0;
TheCampaign.TimeStamp = 0;
TheCampaign.CurrentDay = 0;
TheCampaign.FreeCampMaps();
}
void MatchObjectiveTypes(void)
{
char *file, buffer[80];
GridIndex x, y;
FILE *fp;
int i, j, k, TexIndex, id, set;
short *counts, type, index, matches;
ObjClassDataType* oc;
GridIndex *locs; //DSP
OBJ_DATA stypes[20];
memset(stypes, 0, sizeof(OBJ_DATA) * 20);
CampEnterCriticalSection();
fp = OpenCampFile("TypeErro", "too", "wb");
//FromObjective = GetFirstObjective(&oit);
counts = new short[(MaxTextureType + 1)*NumEntities];
memset(counts, 0, sizeof(short) * (MaxTextureType + 1)*NumEntities);
locs = new GridIndex[(MaxTextureType + 1)*NumEntities * 2]; //DSP
memset(locs, 0, sizeof(GridIndex) * (MaxTextureType + 1)*NumEntities * 2);
while (FromObjective not_eq NULL)
{
if (FromObjective->ManualSet())
{
// We want to leave this as we set it.
/*FromObjective = GetNextObjective(&oit);*/
continue;
}
FromObjective->GetLocation(&x, &y);
file = GetFilename(x, y);
file = strchr(file, '.') - 3;
TexIndex = GetTextureIndex(x, y);
j = i = 1;
set = 0;
matches = 0;
index = FromObjective->Type() - VU_LAST_ENTITY_TYPE;
type = FromObjective->GetType();
while (j)
{
j = GetClassID(DOMAIN_LAND, CLASS_OBJECTIVE, (uchar)type, i, 0, 0, 0, 0);
if (j)
{
oc = (ObjClassDataType*) Falcon4ClassTable[j].dataPtr;
if (oc and strncmp(oc->Name, file, 3) == 0)
{
//record values for matches, so we can choose later
stypes[matches].ClassId = j;
stypes[matches].stype = i;
matches++;
}
}
i++;
}
//if ( not set) // no matching texture
if ( not matches)
{
FromObjective->SetObjectiveSType(1);
index = GetClassID(DOMAIN_LAND, CLASS_OBJECTIVE, (uchar)type, 1, 0, 0, 0, 0);
counts[TexIndex * NumEntities + index]--;
locs[(TexIndex * NumEntities + index) * 2] = x; //DSP
locs[(TexIndex * NumEntities + index) * 2 + 1] = y;
}
else
{
//use number of matches found to randomly choose which values to use
id = rand() % matches;
FromObjective->SetObjectiveSType((uchar)stypes[id].stype);
index = stypes[id].ClassId;
memset(stypes, 0, sizeof(OBJ_DATA) * 20);
counts[TexIndex * NumEntities + index]++;
locs[(TexIndex * NumEntities + index) * 2] = x; //DSP
locs[(TexIndex * NumEntities + index) * 2 + 1] = y;
}
//FromObjective = GetNextObjective(&oit);
}
// Now output totals:
for (i = 1; i < MAX_OBJ_TYPES; i++)
{
j = index = 1;
while (index)
{
index = GetClassID(DOMAIN_LAND, CLASS_OBJECTIVE, (uchar)i, (uchar)j, 0, 0, 0, 0);
oc = (ObjClassDataType*) Falcon4ClassTable[index].dataPtr;
for (k = 0; k < MaxTextureType + 1 and index; k++)
{
if ( not counts[k * NumEntities + index])
continue;
file = GetTextureId(k);
if (counts[k * NumEntities + index] > 0)
sprintf(buffer, "%s - %s on texture %s: %d - x: %d y: %d\n", ObjectiveStr[i], oc->Name, file, counts[k * NumEntities + index], locs[(k * NumEntities + index) * 2], locs[(k * NumEntities + index) * 2 + 1]);
else if (counts[k * NumEntities + index] < 0 and index)
sprintf(buffer, "%s - %s on texture %s: %d - NEEDED x: %d y: %d\n", ObjectiveStr[i], oc->Name, file, -counts[k * NumEntities + index], locs[(k * NumEntities + index) * 2], locs[(k * NumEntities + index) * 2 + 1]); //DSP
fwrite(buffer, strlen(buffer), 1, fp);
}
j++;
}
}
delete [] locs ;
CloseCampFile(fp);
CampLeaveCriticalSection();
}
void RecalculateBrigadePositions(void)
{
Unit unit;
Unit battalion;
GridIndex x, y, SumX, SumY;
int count;
VuListIterator myit(AllParentList);
unit = (Unit) myit.GetFirst();
while (unit not_eq NULL)
{
SumX = SumY = count = 0;
if (unit->GetType() == TYPE_BRIGADE)
{
battalion = unit->GetFirstUnitElement();
while (battalion)
{
battalion->GetLocation(&x, &y);
SumX += x;
SumY += y;
count++;
battalion = unit->GetNextUnitElement();
}
if (count)
{
x = SumX / count;
y = SumY / count;
unit->SetLocation(x, y);
}
}
unit = (Unit) myit.GetNext();
}
}
void MoveUnits(void)
{
Unit unit;
int x, y, deltaX, deltaY;
int initX, endX, initY, endY;
deltaX = CurX - Sel1X;
deltaY = CurY - Sel1Y;
if (Sel1X < Sel2X)
{
initX = Sel1X;
endX = Sel2X;
}
else
{
initX = Sel2X;
endX = Sel1X;
}
if (Sel1Y < Sel2Y)
{
initY = Sel1Y;
endY = Sel2Y;
}
else
{
initY = Sel2Y;
endY = Sel1Y;
}
for (x = initX; x <= endX; x++)
{
for (y = initY; y <= endY; y++)
{
if (ShowReal == 2)
{
do
{
unit = FindUnitByXY(InactiveList, x, y, 0);
if (unit)
{
unit->SetLocation(x + deltaX, y + deltaY);
}
}
while (unit);
}
else
{
do
{
unit = FindUnitByXY(AllParentList, x, y, 0);
if (unit)
{
unit->SetLocation(x + deltaX, y + deltaY);
}
}
while (unit);
do
{
unit = FindUnitByXY(AllRealList, x, y, 0);
if (unit)
{
unit->SetLocation(x + deltaX, y + deltaY);
}
}
while (unit);
}
}
}
SetRefresh(MainMapData);
ptSelected = 0;
}
void RegroupBrigades(void)
{
Unit unit;
Unit battalion;
int x, y;
int initX, endX, initY, endY;
if (Sel1X < Sel2X)
{
initX = Sel1X;
endX = Sel2X;
}
else
{
initX = Sel2X;
endX = Sel1X;
}
if (Sel1Y < Sel2Y)
{
initY = Sel1Y;
endY = Sel2Y;
}
else
{
initY = Sel2Y;
endY = Sel1Y;
}
for (x = initX; x <= endX; x++)
{
for (y = initY; y <= endY; y++)
{
unit = FindUnitByXY(AllParentList, x, y, 0);
if (unit)
{
if (unit->GetType() == TYPE_BRIGADE)
{
battalion = unit->GetFirstUnitElement();
while (battalion)
{
battalion->SetLocation(x , y);
battalion = unit->GetNextUnitElement();
}
}
}
}
}
SetRefresh(MainMapData);
ptSelected = 0;
}
void AssignBattToBrigDiv(void)
{
Unit unit;
Unit battalion;
VuListIterator myit(AllParentList);
unit = (Unit) myit.GetFirst();
while (unit not_eq NULL)
{
if (unit->GetType() == TYPE_BRIGADE)
{
battalion = unit->GetFirstUnitElement();
while (battalion)
{
battalion->SetUnitDivision(((GroundUnitClass *)unit)->GetUnitDivision());
battalion = unit->GetNextUnitElement();
}
}
unit = (Unit) myit.GetNext();
}
}
void DeleteUnit(Unit unit)
{
if ( not unit)
return;
Unit E;
CampEnterCriticalSection();
E = unit->GetFirstUnitElement();
while (E)
{
unit->RemoveChild(E->Id());
vuDatabase->Remove(E);
E = unit->GetFirstUnitElement();
}
// Kill the unit
unit->KillUnit();
vuDatabase->Remove(unit);
// Remove parent, if we're the last element
E = unit->GetUnitParent();
if (E and not E->GetFirstUnitElement())
vuDatabase->Remove(E);
GlobUnit = NULL;
asAgg = 1;
CampLeaveCriticalSection();
}
void StartUnitEdit(void)
{
GridIndex X, Y;
X = (GridIndex) CurX;
Y = (GridIndex) CurY;
TheCampaign.Suspend();
if (ShowReal == 1)
OneUnit = FindUnitByXY(AllRealList, X, Y, 0);
else if (ShowReal == 0)
OneUnit = FindUnitByXY(AllParentList, X, Y, 0);
else if (ShowReal == 2)
OneUnit = FindUnitByXY(InactiveList, X, Y, 0);
else
OneUnit = NULL; // Can't edit divisions
if (OneUnit)
GlobUnit = OneUnit;
else
GlobUnit = NULL;
if (GlobUnit)
DialogBox(hInst, MAKEINTRESOURCE(IDD_UNITDIALOG1), hMainWnd, (DLGPROC)EditUnit);
if (MainMapData->ShowWPs)
SetRefresh(MainMapData);
else
{
InvalidateRect(MainMapData->hMapWnd, NULL, FALSE);
PostMessage(MainMapData->hMapWnd, WM_PAINT, (WPARAM)hMainDC, 0);
}
TheCampaign.Resume();
}
void StartObjectiveEdit(void)
{
GridIndex X, Y;
X = (GridIndex) CurX;
Y = (GridIndex) CurY;
CampEnterCriticalSection();
OneObjective = GetObjectiveByXY(X, Y);
if ( not OneObjective)
{
OneObjective = AddObjectiveToCampaign(X, Y);
}
GlobObj = OneObjective;
CampLeaveCriticalSection();
DialogBox(hInst, MAKEINTRESOURCE(IDD_OBJECTIVEDIALOG), hMainWnd, (DLGPROC)EditObjective);
MainMapData->ShowObjectives = TRUE;
InvalidateRect(MainMapData->hMapWnd, NULL, FALSE);
PostMessage(MainMapData->hMapWnd, WM_PAINT, (WPARAM)hMainDC, 0);
}
void DamageBattalions(void)
{
Unit unit;
int x, y;
int initX, endX, initY, endY;
if (Sel1X < Sel2X)
{
initX = Sel1X;
endX = Sel2X;
}
else
{
initX = Sel2X;
endX = Sel1X;
}
if (Sel1Y < Sel2Y)
{
initY = Sel1Y;
endY = Sel2Y;
}
else
{
initY = Sel2Y;
endY = Sel1Y;
}
for (x = initX; x <= endX; x++)
{
for (y = initY; y <= endY; y++)
{
unit = FindUnitByXY(AllRealList, x, y, 0);
if (unit)
{
if (unit->GetType() == TYPE_BATTALION)
{
}
}
}
}
SetRefresh(MainMapData);
ptSelected = 0;
}
void SetObjOwnersArea(int team)
{
Objective obj;
int x, y;
int initX, endX, initY, endY;
if (Sel1X < Sel2X)
{
initX = Sel1X;
endX = Sel2X;
}
else
{
initX = Sel2X;
endX = Sel1X;
}
if (Sel1Y < Sel2Y)
{
initY = Sel1Y;
endY = Sel2Y;
}
else
{
initY = Sel2Y;
endY = Sel1Y;
}
for (x = initX; x <= endX; x++)
{
for (y = initY; y <= endY; y++)
{
obj = GetObjectiveByXY(x, y);
if (obj)
{
obj->SetOwner(team);
}
}
}
SetRefresh(MainMapData);
ptSelected = 0;
}
// ===================================
// Timing functions
// ===================================
/*
ulong Camp_VU_clock(void)
{
return (ulong)clock*1000/CLK_TCK;
}
ulong Camp_VU_game_time(void)
{
return (ulong)(Camp_GetCurrentTime()*1000);
}
*/
// ====================================
// Map display functions
// ====================================
void SetRefresh(MapData md)
{
RECT r;
if ( not md or not md->hMapWnd)
return;
RefreshAll = TRUE;
ReBlt = TRUE;
GetClientRect(md->hMapWnd, &r);
InvalidateRect(md->hMapWnd, &r, FALSE);
PostMessage(md->hMapWnd, WM_PAINT, 0, 0);
SuspendDraw = TRUE;
}
void RefreshCampMap(void)
{
SetRefresh(MainMapData);
}
void RefreshMap(MapData md, HDC DC, RECT *rect)
{
GridIndex x, y, NFX = 0, NFY = 0, NLX = 0, NLY = 0;
int clipx, clipy, ysize;
RECT r;
GridIndex xx, yy;
int side = 0;
WayPoint w;
// if (SuspendDraw)
CampEnterCriticalSection();
if (RefreshAll)
{
SetCursor(hCurWait);
NFX = md->FX;
NFY = md->FY;
NLX = md->LX;
NLY = md->LY;
RefreshAll = FALSE;
}
else if (FreshDraw)
{
NFX = (GridIndex)(rect->left / CellSize) + md->FX;
NFY = (GridIndex)(rect->top / CellSize) + md->FY;
NLX = (GridIndex)(rect->right / CellSize) + md->FX + 1;
NLY = (GridIndex)(rect->bottom / CellSize) + md->FY + 1;
FreshDraw = FALSE;
}
else
{
SetCursor(hCurWait);
if (PBubble)
ShowPlayerBubble(md, DC, 0); // Undraw the player bubble
// Update what we can with our bmap
NFX = md->FX;
NFY = md->FY;
NLX = md->FX;
NLY = md->FY;
GetClientRect(md->hMapWnd, &r);
ysize = r.bottom;
if (md->PFX < md->PMFX)
{
NFX = md->FX;
NLX = (md->PMFX / md->CellSize) + 1;
NLY = md->LY;
r.left = md->PMFX - md->PFX;
side or_eq 1;
}
if (md->PFY < md->PMFY)
{
NFY = md->FY;
NLY = (md->PMFY / md->CellSize) + 1;
NLX = md->LX;
r.bottom = ysize - (md->PMFY - md->PFY);
side or_eq 2;
}
if (md->PLX > md->PMLX)
{
NLX = md->LX;
NFX = md->PMLX / md->CellSize;
NLY = md->LY;
r.right = md->PMLX - md->PFX;
side or_eq 4;
}
if (md->PLY > md->PMLY)
{
NLY = md->LY;
NFY = md->PMLY / md->CellSize;
NLX = md->LX;
r.top = ysize - (md->PMLY - md->PFY);
side or_eq 8;
}
if ((side bitand 0x5) == 0x5)
{
NFX = md->FX;
NLX = md->LX;
}
if ((side bitand 0xa) == 0xa)
{
NFY = md->FY;
NLY = md->LY;
}
if ((side bitand 0xC) == 0xC or (side bitand 0x3) == 0x3)
{
NFX = md->FX;
NFY = md->FY;
NLX = md->LX;
NLY = md->LY;
}
clipx = md->PFX - md->PMFX;
clipy = md->PMLY - md->PLY;
if (clipx < 0)
clipx = 0;
if (clipy < 0)
clipy = 0;
// Blit from storage to the screen
BitBlt(DC, r.left, r.top, r.right - r.left, r.bottom - r.top, md->hMapDC,
clipx, clipy, SRCCOPY);
if (NFX < md->FX)
NFX = md->FX;
if (NFY < md->FY)
NFY = md->FY;
if (NLX > md->LX)
NLX = md->LX;
if (NLY > md->LY)
NLY = md->LY;
}
// Now draw the rest.
for (y = NLY - 1; y >= NFY; y--)
for (x = NFX; x < NLX; x++)
DisplayCellData(DC, x, y, POSX(x), POSY(y), md->CellSize, Mode, RoadsOn, RailsOn);
PBubbleDrawn = FALSE;
// Reblt before drawing Objectives or Units - do that each time.
if (ReBlt)
ReBltWnd(md, DC);
md->PMFX = md->PFX;
md->PMLX = md->PLX;
md->PMFY = md->PFY;
md->PMLY = md->PLY;
if (md->ShowObjectives)
{
#ifdef VU_GRID_TREE_Y_MAJOR
VuGridIterator oit(ObjProxList, (BIG_SCALAR)GridToSim(md->CenX), (BIG_SCALAR)GridToSim(md->CenY), (BIG_SCALAR)GridToSim((short)(Distance(md->LX, md->LY, md->CenX, md->CenY))));
#else
VuGridIterator oit(ObjProxList, (BIG_SCALAR)GridToSim(md->CenY), (BIG_SCALAR)GridToSim(md->CenX), (BIG_SCALAR)GridToSim((short)(Distance(md->LX, md->LY, md->CenX, md->CenY))));
#endif
int i;
OneObjective = GetFirstObjective(&oit);
while (OneObjective not_eq NULL)
{
OneObjective->GetLocation(&x, &y);
if (x > md->LX or x < md->FX or y < md->FY or y > md->LY)
; // Out of window bounds
else
{
if (md->ShowLinks)
{
_setcolor(DC, White);
for (i = 0; i < OneObjective->NumLinks(); i++)
{
Neighbor = OneObjective->GetNeighbor(i);
if (Neighbor)
{
Neighbor->GetLocation(&xx, &yy);
_moveto(DC, POSX(x) + (md->CellSize >> 1), POSY(y) + (md->CellSize >> 1));
_lineto(DC, POSX(xx) + (md->CellSize >> 1), POSY(yy) + (md->CellSize >> 1));
}
}
}
DisplayObjective(DC, OneObjective, POSX(x), POSY(y), md->CellSize);
}
OneObjective = GetNextObjective(&oit);
}
}
if (md->ShowUnits)
{
VuListIterator *uit = NULL;
short scale = 1, xd = 0, yd = 0;
if (ShowReal == 1)
uit = new VuListIterator(AllRealList);
else if ( not ShowReal)
{
uit = new VuListIterator(AllParentList);
scale = 3;
xd = -1;
yd = 1;
}
else if (ShowReal == 2)
uit = new VuListIterator(InactiveList);
else
ShowDivisions(DC, md);
if (uit)
{
OneUnit = GetFirstUnit(uit);
while (OneUnit not_eq NULL)
{
OneUnit->GetLocation(&x, &y);
DisplayUnit(DC, OneUnit, (short)(POSX(x + xd) + (md->CellSize >> 3)*scale), (short)(POSY(y + yd) + (md->CellSize >> 2)*scale), (short)((md->CellSize >> 1)*scale));
if (ShowPaths and OneUnit->IsBattalion())
{
if (OneUnit->GetType() == TYPE_BATTALION)
{
// sfr: this is pointer now... took out &
//ShowPath(md, x, y, &((Battalion)OneUnit)->path, White);
//ShowPathHistory(md, x, y, &((Battalion)OneUnit)->path, Red);
ShowPath(md, x, y, ((Battalion)OneUnit)->path, White);
ShowPathHistory(md, x, y, ((Battalion)OneUnit)->path, Red);
}
}
#ifdef USE_FLANKS
if (ShowFlanks and OneUnit->GetDomain() == DOMAIN_LAND)
{
GridIndex fx, fy;
OneUnit->GetLeftFlank(&fx, &fy);
_setcolor(DC, SideColor[OneUnit->GetOwner()]);
_moveto(DC, POSX(fx) + (md->CellSize >> 1), POSY(fy) + (md->CellSize >> 1));
_lineto(DC, POSX(x) + (md->CellSize >> 1), POSY(y) + (md->CellSize >> 1));
OneUnit->GetRightFlank(&fx, &fy);
_lineto(DC, POSX(fx) + (md->CellSize >> 1), POSY(fy) + (md->CellSize >> 1));
}
#endif
OneUnit = GetNextUnit(uit);
}
delete uit;
}
}
if (md->ShowWPs)
{
if ( not WPUnit or WPUnit->IsDead())
WPUnit = NULL;
else
{
WPUnit->GetLocation(&x, &y);
w = WPUnit->GetCurrentUnitWP();
while (w)
{
w->GetWPLocation(&xx, &yy);
ShowWPLeg(MainMapData, x, y, xx, yy, White);
w = w->GetNextWP();
x = xx;
y = yy;
}
}
}
if (md->Emitters)
{
ShowEmitters(md, DC);
}
if (md->SAMs)
{
ShowSAMs(md, DC);
}
if (PBubble)
ShowPlayerBubble(md, DC, 1);
SetCursor(hCur);
CampLeaveCriticalSection();
}
void zoomOut(MapData md)
{
md->CellSize /= 2;
if (md->CellSize < 1)
md->CellSize = 1;
CellSize = md->CellSize;
FindBorders(md);
MaxXSize = MAX_XPIX / md->CellSize;
MaxYSize = MAX_YPIX / md->CellSize;
SetRefresh(md);
ResizeCursor();
// nPos = (Map_Max_Y-md->CenY)*100/Map_Max_Y;
SetScrollPos(md->hMapWnd, SB_VERT, CenPer(MainMapData, CenY, YSIDE), TRUE);
// nPos = md->CenX*100/Map_Max_X;
SetScrollPos(md->hMapWnd, SB_HORZ, CenPer(MainMapData, CenX, XSIDE), TRUE);
}
void zoomIn(MapData md)
{
md->CellSize *= 2;
if (md->CellSize > 16)
md->CellSize = 16;
CellSize = md->CellSize;
FindBorders(md);
MaxXSize = MAX_XPIX / md->CellSize;
MaxYSize = MAX_YPIX / md->CellSize;
SetRefresh(md);
ResizeCursor();
// nPos = (Map_Max_Y-md->CenY)*100/Map_Max_Y;
SetScrollPos(md->hMapWnd, SB_VERT, CenPer(MainMapData, CenY, YSIDE), TRUE);
// nPos = md->CenX*100/Map_Max_X;
SetScrollPos(md->hMapWnd, SB_HORZ, CenPer(MainMapData, CenX, XSIDE), TRUE);
}
// ============================================
// Tool window procedure
// ============================================
LRESULT CALLBACK ToolWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
LRESULT retval = 0;
switch (message)
{
case WM_PAINT:
{
char time[80], buffer[60];
RECT r;
PAINTSTRUCT ps;
HDC DC;
if (GetUpdateRect(hToolWnd, &r, FALSE))
{
DC = BeginPaint(hToolWnd, &ps);
/* sprintf(time,"Day %2.2d, %2.2d:%2.2d x%d ",CampDay, CampHour, CampMinute, gameCompressionRatio);*/
_moveto(DC, 1, 0);
_outgtext(DC, time);
// Theater Name
_moveto(DC, 190, 0);
_outgtext(DC, TheCampaign.TheaterName);
// Position
sprintf(time, "%d,%d ", CurX, CurY);
_moveto(DC, 1, 18);
_outgtext(DC, time);
// Texture file
if (ShowCodes)
{
char *file;
file = GetFilename(CurX, CurY);
sprintf(buffer, "%s ", file);
_moveto(DC, 190, 18);
_outgtext(DC, buffer);
}
if (OneObjective)
sprintf(time, "%s ", OneObjective->GetName(buffer, 60, FALSE));
else
sprintf(time, " ");
_moveto(DC, 1, 36);
_outgtext(DC, time);
if (OneUnit)
if (OneUnit->GetType() == TYPE_BATTALION and OneUnit->GetDomain() == DOMAIN_LAND)
{
if (((GroundUnitClass *)OneUnit)->GetDivision())
{
Unit unit;
unit = OneUnit->GetUnitParent();
if (unit)
sprintf(time, "%d-%d-%s ", ((GroundUnitClass *)OneUnit)->GetDivision(), unit->GetNameId(), OneUnit->GetName(buffer, 60, FALSE));
else
sprintf(time, "%d-%s ", ((GroundUnitClass *)OneUnit)->GetDivision(), OneUnit->GetName(buffer, 60, FALSE));
}
else
{
sprintf(time, "%s ", OneUnit->GetName(buffer, 60, FALSE));
}
}
else if (OneUnit->GetType() == TYPE_BRIGADE and OneUnit->GetDomain() == DOMAIN_LAND)
{
if (((GroundUnitClass *)OneUnit)->GetDivision())
{
sprintf(time, "%d-%s ", ((GroundUnitClass *)OneUnit)->GetDivision(), OneUnit->GetName(buffer, 60, FALSE));
}
else
{
sprintf(time, "%s ", OneUnit->GetName(buffer, 60, FALSE));
}
}
else
{
sprintf(time, "%s ", OneUnit->GetName(buffer, 60, FALSE));
}
else
sprintf(time, " ");
_moveto(DC, 1, 54);
_outgtext(DC, time);
if (Linking)
sprintf(time, "Linking..");
else if (LinkTool and FromObjective)
sprintf(time, "Linking #%d ", FromObjective->GetCampID());
else
sprintf(time, " ");
_moveto(DC, 1, 72);
_outgtext(DC, time);
EndPaint(hToolWnd, &ps);
}
retval = 0;
break;
}
case WM_DESTROY:
hToolWnd = NULL;
retval = DefWindowProc(hwnd, message, wParam, lParam);
break;
default:
retval = DefWindowProc(hwnd, message, wParam, lParam);
break;
}
return retval;
}
// ================================================
// Main Campaign Window procedure
// ================================================
BOOL MainWndCommandProc(HWND hWndFrame, WPARAM wParam, LONG lParam)
{
lParam = lParam;
switch (wParam)
{
case ID_FILE_NEWTHEATER:
InitTheaterTerrain();
((WeatherClass*)realWeather)->Init();
// WARNING: Things could get fucked if we changed the theater size
// DisposeProxLists();
// InitProximityLists();
// WARNING: entities will not be reinserted into prox lists
SetRefresh(MainMapData);
break;
case ID_FILE_OPENTHEATER:
OpenTheaterFile(hMainWnd);
((WeatherClass*)realWeather)->Init();
// WARNING: Things could get fucked if we changed the theater size
// DisposeProxLists();
// InitProximityLists();
// WARNING: entities will not be reinserted into prox lists
SetRefresh(MainMapData);
break;
case ID_FILE_SAVETHEATER:
// SaveTheaterFile(hMainWnd);
break;
case ID_FILE_SAVEASTHEATER:
SaveAsTheaterFile(hMainWnd);
break;
case ID_FILE_EXIT:
PostQuitMessage(0);
break;
case ID_EDIT_COVER:
EditMode = 0;
break;
case ID_EDIT_RELIEF:
EditMode = 2;
break;
case ID_EDIT_ROADS:
EditMode = 3;
DrawRoad = 1;
break;
case ID_EDIT_RAILS:
EditMode = 4;
DrawRail = 1;
break;
case ID_EDIT_WEATHER:
EditMode = 5;
DrawWeather = 1;
break;
case ID_EDIT_OBJECTIVES:
EditMode = 7;
MainMapData->ShowObjectives = 1;
break;
case ID_EDIT_UNITS:
EditMode = 8;
MainMapData->ShowUnits = 1;
case ID_EDIT_WATER:
DrawCover = Water;
break;
case ID_EDIT_BOG:
DrawCover = Bog;
break;
case ID_EDIT_BARREN:
DrawCover = Barren;
break;
case ID_EDIT_PLAINS:
DrawCover = Plain;
break;
case ID_EDIT_BRUSH:
DrawCover = Brush;
break;
case ID_EDIT_LFOREST:
DrawCover = LightForest;
break;
case ID_EDIT_HFOREST:
DrawCover = HeavyForest;
break;
case ID_EDIT_SURBAN:
DrawCover = Urban;
break;
case ID_EDIT_URBAN:
DrawCover = Urban;
break;
case ID_EDIT_FLAT:
DrawRelief = Flat;
break;
case ID_EDIT_ROUGH:
DrawRelief = Rough;
break;
case ID_EDIT_HILLY:
DrawRelief = Hills;
break;
case ID_EDIT_MOUNTAIN:
DrawRelief = Mountains;
break;
case ID_EDIT_CLEARCOV:
DrawWeather = 0;
break;
case ID_EDIT_LOWFOG:
DrawWeather = 1;
break;
case ID_EDIT_SCATTERED:
DrawWeather = 2;
break;
case ID_EDIT_BROKEN:
DrawWeather = 3;
break;
case ID_EDIT_OVERCAST:
DrawWeather = 4;
break;
case ID_EDIT_RAIN:
DrawWeather = 5;
break;
case ID_CAMPAIGN_NEW:
TheCampaign.Reset();
SetRefresh(MainMapData);
break;
case ID_CAMPAIGN_MAKENEW:
MakeCampaignNew();
break;
case ID_VIEW_ZOOMIN:
zoomIn(MainMapData);
break;
case ID_VIEW_ZOOMOUT:
zoomOut(MainMapData);
break;
case ID_VIEW_BOTH:
Mode = EditMode = 0;
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_BOTH, MF_BYCOMMAND bitor MF_CHECKED);
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_COVER, MF_BYCOMMAND bitor MF_UNCHECKED);
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_RELIEF, MF_BYCOMMAND bitor MF_UNCHECKED);
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_CLOUDS, MF_BYCOMMAND bitor MF_UNCHECKED);
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_LEVELS, MF_BYCOMMAND bitor MF_UNCHECKED);
SetRefresh(MainMapData);
break;
case ID_VIEW_COVER:
Mode = EditMode = 1;
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_BOTH, MF_BYCOMMAND bitor MF_UNCHECKED);
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_COVER, MF_BYCOMMAND bitor MF_CHECKED);
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_RELIEF, MF_BYCOMMAND bitor MF_UNCHECKED);
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_CLOUDS, MF_BYCOMMAND bitor MF_UNCHECKED);
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_LEVELS, MF_BYCOMMAND bitor MF_UNCHECKED);
SetRefresh(MainMapData);
break;
case ID_VIEW_RELIEF:
Mode = EditMode = 2;
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_BOTH, MF_BYCOMMAND bitor MF_UNCHECKED);
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_COVER, MF_BYCOMMAND bitor MF_UNCHECKED);
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_RELIEF, MF_BYCOMMAND bitor MF_CHECKED);
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_CLOUDS, MF_BYCOMMAND bitor MF_UNCHECKED);
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_LEVELS, MF_BYCOMMAND bitor MF_UNCHECKED);
SetRefresh(MainMapData);
break;
case ID_VIEW_CLOUDS:
Mode = EditMode = 5;
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_BOTH, MF_BYCOMMAND bitor MF_UNCHECKED);
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_COVER, MF_BYCOMMAND bitor MF_UNCHECKED);
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_RELIEF, MF_BYCOMMAND bitor MF_UNCHECKED);
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_CLOUDS, MF_BYCOMMAND bitor MF_CHECKED);
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_LEVELS, MF_BYCOMMAND bitor MF_UNCHECKED);
SetRefresh(MainMapData);
break;
case ID_VIEW_LEVELS:
Mode = EditMode = 6;
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_BOTH, MF_BYCOMMAND bitor MF_UNCHECKED);
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_COVER, MF_BYCOMMAND bitor MF_UNCHECKED);
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_RELIEF, MF_BYCOMMAND bitor MF_UNCHECKED);
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_CLOUDS, MF_BYCOMMAND bitor MF_UNCHECKED);
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_LEVELS, MF_BYCOMMAND bitor MF_CHECKED);
SetRefresh(MainMapData);
case ID_VIEW_ROADS:
RoadsOn = not RoadsOn;
if (RoadsOn)
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_ROADS, MF_BYCOMMAND bitor MF_CHECKED);
else
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_ROADS, MF_BYCOMMAND bitor MF_UNCHECKED);
SetRefresh(MainMapData);
break;
case ID_VIEW_RAILS:
RailsOn = not RailsOn;
if (RailsOn)
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_RAILS, MF_BYCOMMAND bitor MF_CHECKED);
else
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_RAILS, MF_BYCOMMAND bitor MF_UNCHECKED);
SetRefresh(MainMapData);
break;
case ID_VIEW_EMITTERS:
// MainMapData->Emitters = not MainMapData->Emitters;
Mode = 11;
if (MainMapData->Emitters)
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_EMITTERS, MF_BYCOMMAND bitor MF_CHECKED);
else
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_EMITTERS, MF_BYCOMMAND bitor MF_UNCHECKED);
SetRefresh(MainMapData);
break;
case ID_VIEW_SAMS:
// MainMapData->SAMs = not MainMapData->SAMs;
Mode = 10;
if (MainMapData->SAMs)
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_SAMS, MF_BYCOMMAND bitor MF_CHECKED);
else
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_SAMS, MF_BYCOMMAND bitor MF_UNCHECKED);
SetRefresh(MainMapData);
break;
case ID_VIEW_PLAYERBUBBLE:
PBubble = not PBubble;
if (PBubble)
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_PLAYERBUBBLE, MF_BYCOMMAND bitor MF_CHECKED);
else
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_PLAYERBUBBLE, MF_BYCOMMAND bitor MF_UNCHECKED);
SetRefresh(MainMapData);
break;
case ID_VIEW_OBJPRIORITY:
ObjMode = 1;
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_OBJOWNER, MF_BYCOMMAND bitor MF_UNCHECKED);
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_OBJPRIORITY, MF_BYCOMMAND bitor MF_CHECKED);
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_OBJTYPE, MF_BYCOMMAND bitor MF_UNCHECKED);
SetRefresh(MainMapData);
break;
case ID_VIEW_OBJOWNER:
ObjMode = 0;
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_OBJOWNER, MF_BYCOMMAND bitor MF_CHECKED);
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_OBJPRIORITY, MF_BYCOMMAND bitor MF_UNCHECKED);
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_OBJTYPE, MF_BYCOMMAND bitor MF_UNCHECKED);
SetRefresh(MainMapData);
break;
case ID_VIEW_OBJTYPE:
ObjMode = 2;
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_OBJOWNER, MF_BYCOMMAND bitor MF_UNCHECKED);
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_OBJPRIORITY, MF_BYCOMMAND bitor MF_UNCHECKED);
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_OBJTYPE, MF_BYCOMMAND bitor MF_CHECKED);
SetRefresh(MainMapData);
break;
case ID_VIEW_REALUNITS:
ShowReal = 1;
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_REALUNITS, MF_BYCOMMAND bitor MF_CHECKED);
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_PARENTUNITS, MF_BYCOMMAND bitor MF_UNCHECKED);
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_REINFORCEMENTS, MF_BYCOMMAND bitor MF_UNCHECKED);
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_DIVISIONS, MF_BYCOMMAND bitor MF_UNCHECKED);
SetRefresh(MainMapData);
break;
case ID_VIEW_PARENTUNITS:
ShowReal = 0;
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_REALUNITS, MF_BYCOMMAND bitor MF_UNCHECKED);
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_PARENTUNITS, MF_BYCOMMAND bitor MF_CHECKED);
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_REINFORCEMENTS, MF_BYCOMMAND bitor MF_UNCHECKED);
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_DIVISIONS, MF_BYCOMMAND bitor MF_UNCHECKED);
SetRefresh(MainMapData);
break;
case ID_VIEW_DIVISIONS:
ShowReal = 3;
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_REALUNITS, MF_BYCOMMAND bitor MF_UNCHECKED);
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_PARENTUNITS, MF_BYCOMMAND bitor MF_UNCHECKED);
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_REINFORCEMENTS, MF_BYCOMMAND bitor MF_UNCHECKED);
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_DIVISIONS, MF_BYCOMMAND bitor MF_CHECKED);
SetRefresh(MainMapData);
break;
case ID_VIEW_REINFORCEMENTS:
ShowReal = 2;
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_REALUNITS, MF_BYCOMMAND bitor MF_UNCHECKED);
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_PARENTUNITS, MF_BYCOMMAND bitor MF_UNCHECKED);
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_REINFORCEMENTS, MF_BYCOMMAND bitor MF_CHECKED);
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_DIVISIONS, MF_BYCOMMAND bitor MF_UNCHECKED);
SetRefresh(MainMapData);
break;
case ID_VIEW_TEXTURECODES:
if (ShowCodes)
{
ShowCodes = 0;
CleanupConverter();
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_TEXTURECODES, MF_BYCOMMAND bitor MF_UNCHECKED);
}
else
{
ShowCodes = 1;
InitConverter(TheCampaign.TheaterName);
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_TEXTURECODES, MF_BYCOMMAND bitor MF_CHECKED);
}
break;
case ID_VIEW_REFRESH:
SetRefresh(MainMapData);
break;
case ID_TOOLS_RECALULATELINKS:
{
int i, done;
PathClass path;
MSG msg;
GridIndex ox, oy;
// KCK: First, I need to place roads to ports
{
VuListIterator oit(AllObjList);
FromObjective = GetFirstObjective(&oit);
while (FromObjective not_eq NULL)
{
if (FromObjective->GetType() == TYPE_PORT)
{
FromObjective->GetLocation(&ox, &oy);
SetRoadCell(GetCell(ox, oy), 1);
// Attempt to find an adjacent land space
for (i = 0, done = 0; i < 8 and not done; i += 2)
{
if (GetCover(ox + dx[i], oy + dy[i]) not_eq Water)
{
SetRoadCell(GetCell(ox + dx[i], oy + dy[i]), 1);
done = 1;
}
}
// Attempt to find a diagonal if no luck
for (i = 1; i < 8 and not done; i += 2)
{
if (GetCover(ox + dx[i], oy + dy[i]) not_eq Water)
{
SetRoadCell(GetCell(ox + dx[i], oy + dy[i]), 1);
SetRoadCell(GetCell(ox + dx[i - 1], oy + dy[i - 1]), 1);
done = 1;
}
}
}
FromObjective = GetNextObjective(&oit);
}
}
// Next, do the linking
LinkTool = TRUE;
// CampEnterCriticalSection();
memset(CampSearch, 0, sizeof(uchar)*MAX_CAMP_ENTITIES);
/* FromObjective = GetFirstObjective(&oit);*/
while (FromObjective not_eq NULL)
{
CampSearch[FromObjective->GetCampID()] = 1;
for (i = 0; i < FromObjective->NumLinks(); i++)
{
ToObjective = FromObjective->GetNeighbor(i);
if (ToObjective and not CampSearch[ToObjective->GetCampID()])
LinkCampaignObjectives(&path, FromObjective, ToObjective);
}
/* FromObjective = GetNextObjective(&oit);*/
// Still handle window messages while we loop
if (GetMessage(&msg, NULL, 0, 0))
DispatchMessage(&msg); // Dispatch message to window.
}
// CampLeaveCriticalSection();
LinkTool = FALSE;
}
break;
case ID_TOOLS_SETOBJTYPES:
if ( not ShowCodes)
{
// Load the texture codes
ShowCodes = 1;
InitConverter(TheCampaign.TheaterName);
CheckMenuItem(GetMenu(hMainWnd), ID_VIEW_TEXTURECODES, MF_BYCOMMAND bitor MF_CHECKED);
}
MatchObjectiveTypes();
break;
case ID_TOOLS_OUTPUTREINFORCEMENTS:
{
GridIndex x, y;
FILE *fp;
Unit unit;
Unit brigade;
Objective obj;
char buffer[60], domain[8], type[12], div[5], brig[5], vehicle[20], objective[40];
CampEnterCriticalSection();
fp = OpenCampFile("Reinloc", "txt", "w");
if (fp)
{
VuListIterator myit(InactiveList);
unit = (Unit) myit.GetFirst();
while (unit not_eq NULL)
{
unit->GetLocation(&x, &y);
obj = GetObjectiveByXY(x, y);
if (obj)
{
sprintf(objective, "%s", obj->GetName(buffer, 60, FALSE));
}
else
{
strcpy(objective, "none");
}
if (unit->GetDomain() == DOMAIN_AIR)
{
strcpy(domain, "AIR");
if (unit->GetType() == TYPE_SQUADRON)
{
strcpy(div, "n/a");
strcpy(brig, "n/a");
strcpy(type, "SQUADRON");
strcpy(vehicle, GetVehicleName(unit->GetVehicleID(0)));
}
}
else if (unit->GetDomain() == DOMAIN_SEA)
{
strcpy(domain, "SEA");
if (unit->GetType() == TYPE_TASKFORCE)
{
strcpy(div, "n/a");
strcpy(brig, "n/a");
strcpy(type, "TASKFORCE");
strcpy(vehicle, GetVehicleName(unit->GetVehicleID(0)));
}
}
else if (unit->GetDomain() == DOMAIN_LAND)
{
strcpy(domain, "LAND");
if (unit->GetType() == TYPE_BRIGADE)
{
sprintf(div, "%d", ((GroundUnitClass *)unit)->GetDivision());
strcpy(brig, "n/a");
strcpy(type, "BRIGADE");
strcpy(vehicle, "n/a");
}
else if (unit->GetType() == TYPE_BATTALION)
{
brigade = unit->GetUnitParent();
if (brigade)
sprintf(brig, "%d", brigade->GetNameId());
else
strcpy(brig, "--");
sprintf(div, "%d", ((GroundUnitClass *)unit)->GetDivision());
strcpy(type, "BATTALION");
strcpy(vehicle, GetVehicleName(unit->GetVehicleID(0)));
}
}
fprintf(fp, "%d : %-4s : %-8s : %-5s : %-4s : %-4s : %-15s : %-20s : x : %d : y : %d : %s \n",
unit->GetReinforcement(), Side[unit->GetOwner()], domain, type, div, brig, unit->GetName(buffer, 60, FALSE), vehicle, (int)x, (int)y, objective);
unit = (Unit) myit.GetNext();
}
CloseCampFile(fp);
}
CampLeaveCriticalSection();
}
break;
case ID_TOOLS_OUTPUTUNITLOCATIONS:
{
GridIndex x, y;
FILE *fp;
Unit unit;
Unit brigade;
Objective obj;
char buffer[60], domain[8], type[12], div[5], brig[5], vehicle[20], objective[40];
CampEnterCriticalSection();
fp = OpenCampFile("Unitloc", "txt", "w");
if (fp)
{
VuListIterator myit(AllUnitList);
unit = (Unit) myit.GetFirst();
while (unit not_eq NULL)
{
unit->GetLocation(&x, &y);
obj = GetObjectiveByXY(x, y);
if (obj)
sprintf(objective, "%s", obj->GetName(buffer, 60, FALSE));
else
strcpy(objective, "none");
if (unit->GetDomain() == DOMAIN_AIR)
{
strcpy(domain, "AIR");
if (unit->GetType() == TYPE_SQUADRON)
{
strcpy(div, "n/a");
strcpy(brig, "n/a");
strcpy(type, "SQUADRON");
strcpy(vehicle, GetVehicleName(unit->GetVehicleID(0)));
//cur = DistanceToFront(x,y);
//min = u->GetUnitRange() / 50;
//max = u->GetUnitRange() / 4;
}
}
else if (unit->GetDomain() == DOMAIN_SEA)
{
strcpy(domain, "SEA");
if (unit->GetType() == TYPE_TASKFORCE)
{
strcpy(div, "n/a");
strcpy(brig, "n/a");
strcpy(type, "TASKFORCE");
strcpy(vehicle, GetVehicleName(unit->GetVehicleID(0)));
}
}
else if (unit->GetDomain() == DOMAIN_LAND)
{
strcpy(domain, "LAND");
if (unit->GetType() == TYPE_BRIGADE)
{
sprintf(div, "%d", ((GroundUnitClass *)unit)->GetDivision());
strcpy(brig, "n/a");
strcpy(type, "BRIGADE");
strcpy(vehicle, "n/a");
}
else if (unit->GetType() == TYPE_BATTALION)
{
brigade = unit->GetUnitParent();
if (brigade)
sprintf(brig, "%d", brigade->GetNameId());
else
strcpy(brig, "--");
sprintf(div, "%d", ((GroundUnitClass *)unit)->GetDivision());
strcpy(type, "BATTALION");
strcpy(vehicle, GetVehicleName(unit->GetVehicleID(0)));
}
}
fprintf(fp, "%-4s : %-8s : %-5s : %-4s : %-4s : %-15s : %-20s : x : %d : y : %d : %s : %d\n",
Side[unit->GetOwner()], domain, type, div, brig, unit->GetName(buffer, 60, FALSE), vehicle, (int)x, (int)y, objective, unit->Type());
unit = (Unit) myit.GetNext();
}
CloseCampFile(fp);
}
CampLeaveCriticalSection();
}
break;
case ID_TOOLS_OUTPUTOBJLOCATIONS:
{
uchar *objmap, type;
GridIndex x, y;
FILE *fp;
ObjClassDataType* oc;
char *file;
char buffer[60];
InitConverter(TheCampaign.TheaterName);
// This outputs two files - a text file and a raw file with
// objective placement info.
CampEnterCriticalSection();
fp = OpenCampFile("Objloc", "txt", "w");
if ( not fp)
{
CampLeaveCriticalSection();
break;
}
objmap = new unsigned char[Map_Max_X * Map_Max_Y];
memset(objmap, 255, sizeof(uchar)*Map_Max_X * Map_Max_Y);
type = 1;
// Collect data and print text file
while (type <= NumObjectiveTypes)
{
VuListIterator oit(AllObjList);
FromObjective = GetFirstObjective(&oit);
while (FromObjective not_eq NULL)
{
if (FromObjective->GetType() == type)
{
FromObjective->GetLocation(&x, &y);
file = GetFilename(x, y);
objmap[((Map_Max_Y - y - 1)*Map_Max_X) + x] = type;
oc = (ObjClassDataType*) Falcon4ClassTable[FromObjective->Type() - VU_LAST_ENTITY_TYPE].dataPtr;
if (oc)
fprintf(fp, "%-4s : %-15s : %-15s : %-20s : on : %-14s : at x: %4d : y: %4d : %d : %d\n",
Side[FromObjective->GetOwner()], ObjectiveStr[type], oc->Name, FromObjective->GetName(buffer, 60, FALSE), file, y, x, FromObjective->GetObjectivePriority(), FromObjective->GetCampId());
}
FromObjective = GetNextObjective(&oit);
}
type++;
}
CloseCampFile(fp);
// Now dump the RAW file
fp = OpenCampFile("Objloc", "raw", "wb");
fwrite(objmap, sizeof(uchar), Map_Max_X * Map_Max_Y, fp);
CloseCampFile(fp);
delete [] objmap;
CampLeaveCriticalSection();
}
break;
case ID_TOOLS_APPLYFORCERATIOS:
DialogBox(hInst, MAKEINTRESOURCE(IDD_FORCERARIODIALOG), hMainWnd, (DLGPROC)AdjustForceRatioProc);
AdjustForceRatios();
break;
case ID_TOOLS_CLIPCAMPAIGN:
DialogBox(hInst, MAKEINTRESOURCE(IDD_CAMP_CLIPPER), hMainWnd, (DLGPROC)CampClipperProc);
break;
case ID_TOOLS_AUTOSETSAMARTSITES:
{
GridIndex x, y;
float rel;
CampEnterCriticalSection();
{
VuListIterator oit(AllObjList);
FromObjective = GetFirstObjective(&oit);
while (FromObjective)
{
// SAM Site logic
if (FromObjective->GetType() == TYPE_AIRBASE or
FromObjective->GetType() == TYPE_ARMYBASE or
FromObjective->GetType() == TYPE_PORT or
FromObjective->GetType() == TYPE_FACTORY or
FromObjective->GetType() == TYPE_NUCLEAR or
FromObjective->GetType() == TYPE_POWERPLANT or
FromObjective->GetType() == TYPE_REFINERY or
FromObjective->GetType() == TYPE_CHEMICAL or
FromObjective->GetType() == TYPE_COM_CONTROL or
FromObjective->GetType() == TYPE_DEPOT or
FromObjective->GetType() == TYPE_RADAR or
FromObjective->GetType() == TYPE_SAM_SITE)
FromObjective->SetSamSite(1);
else
FromObjective->SetSamSite(0);
// HART Site logic
if (FromObjective->GetType() == TYPE_HARTS or
FromObjective->GetType() == TYPE_HILL_TOP)
FromObjective->SetArtillerySite(1);
else
FromObjective->SetArtillerySite(0);
// Commando logic
if (FromObjective->GetType() == TYPE_AIRBASE)
FromObjective->SetCommandoSite(1);
else
FromObjective->SetCommandoSite(0);
// Radar logic
if (FromObjective->GetType() == TYPE_AIRBASE or
FromObjective->GetType() == TYPE_RADAR)
FromObjective->SetRadarSite(1);
else
FromObjective->SetRadarSite(0);
// Mountain/Flat site logic
FromObjective->GetLocation(&x, &y);
rel = ((float)(GetRelief(x, y) + GetRelief(x + 1, y) + GetRelief(x - 1, y) + GetRelief(x, y + 1) + GetRelief(x, y - 1))) / 5.0F;
if (rel > 2.0F)
{
FromObjective->SetMountainSite(1);
FromObjective->SetFlatSite(0);
}
else if (rel < 0.5F)
{
FromObjective->SetMountainSite(0);
FromObjective->SetFlatSite(1);
}
FromObjective = GetNextObjective(&oit);
}
}
CampLeaveCriticalSection();
}
break;
case ID_TOOLS_PREORDERSAMARTILLERY:
{
Unit u;
GridIndex x, y;
Objective o;
int role;
VuListIterator uit(AllUnitList);
u = (Unit) uit.GetFirst();
while (u)
{
if (u->IsBattalion())
{
role = u->GetUnitNormalRole();
if (role == GRO_FIRESUPPORT or role == GRO_AIRDEFENSE)
{
u->GetLocation(&x, &y);
o = FindNearestObjective(x, y, NULL);
if (o)
u->SetUnitOrders(GetGroundOrders(role), o->Id());
}
}
u = (Unit) uit.GetNext();
}
}
break;
case ID_TOOLS_CALCULATERADARARCS:
{
Objective o;
float ox, oy, oz, x, y, r;
float angle, ratio, max_ratio;
mlTrig sincos;
int arc;
CampEnterCriticalSection();
{
VuListIterator oit(AllObjList);
o = GetFirstObjective(&oit);
while (o)
{
if (o->SamSite() or o->RadarSite() or o->GetElectronicDetectionRange(LowAir) > 0)
{
// This place needs arc data
ox = o->XPos();
oy = o->YPos();
oz = TheMap.GetMEA(ox, oy);
if (o->static_data.radar_data)
delete o->static_data.radar_data;
o->static_data.radar_data = new RadarRangeClass;
for (arc = 0; arc < NUM_RADAR_ARCS; arc++)
{
// Find this arc's ratio
max_ratio = MINIMUM_RADAR_RATIO;
angle = arc * (360 / NUM_RADAR_ARCS) * DTR;
while (angle < (arc + 1) * (360 / NUM_RADAR_ARCS) * DTR)
{
// Trace a ray every 10 degrees
r = KM_TO_FT;
mlSinCos(&sincos, angle);
while (r * max_ratio < LOW_ALTITUDE_CUTOFF)
{
// Step one km at a time
x = ox + r * sincos.cos;
y = oy + r * sincos.sin;
ratio = (TheMap.GetMEA(x, y) - oz) / r;
if (ratio > max_ratio)
max_ratio = ratio;
r += KM_TO_FT;
}
angle += 10 * DTR;
}
o->static_data.radar_data->SetArcRatio(arc, max_ratio);
}
}
o = GetNextObjective(&oit);
}
}
CampLeaveCriticalSection();
}
break;
case ID_TOOLS_GENERATEPAKMAP:
{
uchar *data = NULL;
ulong size;
FILE *fp;
size = sizeof(uchar) * (Map_Max_X / 4) * (Map_Max_Y / 4);
RebuildObjectiveLists();
data = MakeCampMap(MAP_PAK_BUILD, data, 0);
fp = fopen("pakmap.raw", "wb");
if (fp)
{
fwrite(data, size, 1, fp);
fclose(fp);
}
delete data;
break;
}
case ID_HELP_ABOUTCAMPTOOL:
{
FARPROC lpProcAbout;
lpProcAbout = MakeProcInstance((FARPROC)About, hInst);
DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTDIALOG), hMainWnd, (DLGPROC)lpProcAbout);
FreeProcInstance(lpProcAbout);
break;
}
case ID_PB_CENTERONPLAYERBUBBLE:
if (PBubble and FalconLocalSession->GetPlayerEntity())
{
TheCampaign.GetPlayerLocation(&MainMapData->CenX, &MainMapData->CenY);
SetRefresh(MainMapData);
}
break;
case ID_CAMP_REFRESHPB:
RedrawPlayerBubble();
break;
default:
return(FALSE);
}
return(TRUE);
}
LRESULT CALLBACK CampaignWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
LRESULT retval = 0;
static int shifted;
HBITMAP OldMap;
switch (message)
{
case WM_CREATE:
MainMapData = new MapWindowType;
MainMapData->CellSize = CellSize;
MainMapData->hMapWnd = hwnd;
MainMapData->CenX = CenX;
MainMapData->CenY = CenY;
MainMapData->ShowUnits = TRUE;
MainMapData->ShowObjectives = TRUE;
MainMapData->ShowLinks = FALSE;
MainMapData->Emitters = FALSE;
MainMapData->ShowWPs = FALSE;
MainMapData->SAMs = FALSE;
hMainDC = GetDC(hMainWnd);
hMapBM = CreateCompatibleBitmap(hMainDC, MAX_XPIX, MAX_YPIX);
hMapDC = CreateCompatibleDC(hMainDC);
MainMapData->hMapDC = hMapDC;
OldMap = (HBITMAP)SelectObject(hMapDC, hMapBM);
DeleteObject(OldMap);
ResizeCursor();
// set up it's menu bar
EnableMenuItem(GetMenu(hMainWnd), ID_FILE_MYSAVE, MF_BYCOMMAND bitor MF_DISABLED);
if (hMainMenu = GetSubMenu(GetMenu(hMainWnd), 0))
DrawMenuBar(hMainWnd);
// Init my graphics pointers
_initgraphics(hMainDC);
ReBlt = TRUE;
SetRefresh(MainMapData);
retval = 0;
break;
case WM_HSCROLL:
{
WORD nPos, nScrollCode;
RECT r;
nScrollCode = (int) LOWORD(wParam); // scroll bar value
nPos = (short int) HIWORD(wParam); // scroll box position
if (nScrollCode == 4)
{
ReBlt = TRUE;
CenX = nPos * Map_Max_X / 100;
}
if (nScrollCode == SB_PAGELEFT)
{
ReBlt = TRUE;
CenX = MainMapData->FX - ((MainMapData->LX - MainMapData->FX) / 4);
if (CenX < 0)
CenX = 0;
}
if (nScrollCode == SB_PAGERIGHT)
{
ReBlt = TRUE;
CenX = MainMapData->LX + ((MainMapData->LX - MainMapData->FX) / 4);
if (CenX > Map_Max_X)
CenX = Map_Max_X;
}
if (nScrollCode == SB_LINELEFT)
{
ReBlt = TRUE;
CenX -= Map_Max_X / 100;
if (CenX < 0)
CenX = 0;
}
if (nScrollCode == SB_LINERIGHT)
{
ReBlt = TRUE;
CenX += Map_Max_X / 100 + 1;
if (CenX > Map_Max_X)
CenX = Map_Max_X;
}
if (ReBlt and nScrollCode not_eq 8)
{
MainMapData->CenX = CenX;
MainMapData->CenY = CenY;
GetClientRect(hMainWnd, &r);
InvalidateRect(hMainWnd, &r, FALSE);
// SetScrollPos(hMainWnd, SB_HORZ, nPos, TRUE);
}
break;
}
case WM_VSCROLL:
{
WORD nPos, nScrollCode;
RECT r;
nScrollCode = (int) LOWORD(wParam); // scroll bar value
nPos = (short int) HIWORD(wParam); // scroll box position
if (nScrollCode == 4)
{
ReBlt = TRUE;
CenY = Map_Max_Y - (nPos * Map_Max_Y / 100);
}
if (nScrollCode == SB_PAGELEFT)
{
ReBlt = TRUE;
CenY = MainMapData->LY + ((MainMapData->LY - MainMapData->FY) / 4);
if (CenY > Map_Max_Y)
CenY = Map_Max_Y;
}
if (nScrollCode == SB_PAGERIGHT)
{
ReBlt = TRUE;
CenY = MainMapData->FY - ((MainMapData->LY - MainMapData->FY) / 4);
if (CenY < 0)
CenY = 0;
}
if (nScrollCode == SB_LINELEFT)
{
ReBlt = TRUE;
CenY += Map_Max_Y / 100 + 1;
if (CenY > Map_Max_Y)
CenY = Map_Max_Y;
}
if (nScrollCode == SB_LINERIGHT)
{
ReBlt = TRUE;
CenY -= Map_Max_Y / 100;
if (CenY < 0)
CenY = 0;
}
if (ReBlt and nScrollCode not_eq 8)
{
MainMapData->CenX = CenX;
MainMapData->CenY = CenY;
GetClientRect(hMainWnd, &r);
InvalidateRect(hMainWnd, &r, FALSE);
}
break;
}
case WM_MOUSEMOVE:
{
WORD fwKeys, xPos, yPos, xn, yn;
static int coffx = 0, coffy = 0;
POINT pt;
RECT r;
fwKeys = wParam; // key flags
/*
if (fwKeys == MK_LBUTTON and Drawing)
{
xPos = LOWORD(lParam);
yPos = HIWORD(lParam);
ChangeCell((GridIndex)((xPos+PFX)/CellSize),(GridIndex)((PLY-yPos)/CellSize));
}
*/
GetCursorPos(&pt); // Get the real mouse position
pt.x += coffx; // Add old offset
pt.y += coffy;
xPos = (WORD)(pt.x - MainMapData->WULX - MainMapData->CULX); // Get position relative to client area
yPos = (WORD)(pt.y - MainMapData->WULY - MainMapData->CULY);
CurX = (WORD)(xPos + MainMapData->PFX) / MainMapData->CellSize; // Get grid location in Campaign terms
CurY = (MainMapData->PLY - 1 - yPos) / MainMapData->CellSize;
if (fwKeys == MK_LBUTTON and Drawing)
ChangeCell(CurX, CurY);
coffx = xPos % CellSize; // Find our offset, if any
coffy = yPos % CellSize;
xn = (WORD) pt.x - coffx; // Find new grid location to snap to.
yn = (WORD) pt.y - coffy;
SetCursor(hCur);
SetCursorPos(xn, yn); // Snap to the grid
retval = 0;
OneObjective = GetObjectiveByXY(CurX, CurY);
if (ShowReal == 1)
OneUnit = FindUnitByXY(AllRealList, CurX, CurY, 0);
else if (ShowReal == 0)
OneUnit = FindUnitByXY(AllParentList, CurX, CurY, 0);
else if (ShowReal == 2)
{
OneUnit = FindUnitByXY(InactiveList, CurX, CurY, 0);
/* if (OneUnit and not OneUnit->Real())
{
int foundone=0;
GridIndex x,y;
Unit e;
VuListIterator myit(InactiveList);
// Next unit in stack.
e = (Unit) myit.GetFirst();
while (e and e not_eq OneUnit)
e = GetNextUnit(&myit); // Get to current location in list
// e should be OneUnit or be null here
if (e)
{
e = GetNextUnit(&myit);
while (e and not foundone)
{
e->GetLocation(&x,&y);
if (x==CurX and y==CurY and e not_eq OneUnit)
foundone = 1;
else
e = GetNextUnit(&myit);
}
}
OneUnit = e;
}
*/
}
else
OneUnit = NULL; // Can't edit divisions
// Post a message to Toolbar window to redraw (And show new x,y pos)
if (hToolWnd)
{
GetClientRect(hToolWnd, &r);
InvalidateRect(hToolWnd, &r, FALSE);
PostMessage(hToolWnd, WM_PAINT, 0, 0);
}
break;
}
case WM_KEYUP:
if ((int)wParam == 16)
shifted = FALSE;
retval = 0;
break;
case WM_KEYDOWN:
{
int C = (int)wParam;
if (C == 16)
shifted = TRUE;
//if(isalpha(C) and shifted)
//C += 0x20;
if (isalpha(C) and not (GetKeyState(VK_SHIFT) bitand 0x80))
C += 0x20;
ProcessCommand(C);
retval = 0;
break;
}
case WM_DESTROY :
ReleaseDC(hMainWnd, hMainDC);
DeleteDC(hMapDC);
DeleteObject(hMapBM);
_shutdowngraphics();
delete MainMapData;
if (ShowCodes)
{
CleanupConverter();
ShowCodes = FALSE;
}
displayCampaign = FALSE;
hMainWnd = NULL;
retval = 0;
break;
case WM_SIZE:
{
WORD nWidth, nHeight;
int trunc, resize = 0;
RECT r;
nWidth = LOWORD(lParam); // width of client area
nHeight = HIWORD(lParam); // height of client area
ReBlt = TRUE;
GetClientRect(hMainWnd, &r);
if (nWidth % 16 not_eq 0)
{
trunc = 1 + nWidth / 16;
r.right = 16 * trunc;
resize = 1;
if (r.right < 304)
r.right = 304;
}
if (nHeight % 16 not_eq 0)
{
if (r.right < 304)
r.right = 304;
trunc = 1 + nHeight / 16;
r.bottom = 16 * trunc;
resize = 1;
}
if (resize)
{
// Note: This should work, but currently doesnt. MSVC++ bug?
// AdjustWindowRect(&r, WS_OVERLAPPEDWINDOW bitor WS_HSCROLL bitor WS_VSCROLL, TRUE);
AdjustWindowRect(&r, WS_OVERLAPPEDWINDOW, TRUE);
r.right += GetSystemMetrics(SM_CXVSCROLL);
r.bottom += GetSystemMetrics(SM_CYHSCROLL);
SetWindowPos(hMainWnd, HWND_TOP, 0, 0, r.right - r.left, r.bottom - r.top, SWP_NOMOVE bitor SWP_NOZORDER);
PostMessage(hMainWnd, WM_PAINT, 0, 0);
}
else
PostMessage(hMainWnd, WM_PAINT, 0, 0);
retval = 0;
break;
}
case WM_MOVE:
FindBorders(MainMapData);
break;
case WM_ACTIVATE:
retval = 0;
if (LOWORD(wParam) == WA_INACTIVE)
ShowCursor(0);
else
ShowCursor(1);
break;
case WM_USER:
retval = 0;
break;
case WM_LBUTTONDOWN:
{
WORD fwKeys = wParam;
// if (fwKeys=MK_SHIFT)
// ;
if (MainMapData->ShowWPs and WPUnit)
{
WayPoint w;
GridIndex x, y;
w = WPUnit->GetFirstUnitWP();
while (w)
{
w->GetWPLocation(&x, &y);
if (x == CurX and y == CurY)
{
GlobWP = w;
WPDrag = TRUE;
}
w = w->GetNextWP();
}
}
else if (EditMode == 7)
{
DragObjective = OneObjective;
}
else if (EditMode == 8)
{
DragUnit = OneUnit;
}
else
{
ChangeCell(CurX, CurY);
Drawing = TRUE;
}
}
break;
case WM_LBUTTONUP:
Drawing = FALSE;
if (WPDrag)
{
WayPoint w;
GlobWP->SetWPLocation(CurX, CurY);
w = WPUnit->GetFirstUnitWP();
SetWPTimes(w, w->GetWPArrivalTime(), WPUnit->GetCruiseSpeed(), 0);
WPDrag = FALSE;
SetRefresh(MainMapData);
}
if (DragObjective)
{
DragObjective->SetLocation(CurX, CurY);
RecalculateLinks(DragObjective);
DragObjective = NULL;
SetRefresh(MainMapData);
}
if (DragUnit)
{
DragUnit->SetLocation(CurX, CurY);
DragUnit = NULL;
SetRefresh(MainMapData);
}
break;
case WM_RBUTTONDOWN:
{
switch (EditMode)
{
case 0:
case 1:
DrawCover = GetGroundCover(GetCell(CurX, CurY));
break;
case 2:
DrawRelief = GetReliefType(GetCell(CurX, CurY));
break;
case 3:
DrawRoad = GetRoadCell(GetCell(CurX, CurY));
break;
case 4:
DrawRail = GetRailCell(GetCell(CurX, CurY));
break;
case 5:
DrawWeather = ((WeatherClass*)realWeather)->GetCloudCover(CurX, CurY);
break;
case 6:
DrawWeather = ((WeatherClass*)realWeather)->GetCloudLevel(CurX, CurY);
break;
case 7:
StartObjectiveEdit();
break;
case 8:
StartUnitEdit();
break;
default:
break;
}
break;
}
case WM_PAINT:
{
RECT r;
PAINTSTRUCT ps;
HDC DC;
if (GetUpdateRect(hMainWnd, &r, FALSE))
{
DC = BeginPaint(hMainWnd, &ps);
FindBorders(MainMapData);
SetScrollPos(hMainWnd, SB_HORZ, CenPer(MainMapData, CenX, XSIDE), TRUE);
SetScrollPos(hMainWnd, SB_VERT, CenPer(MainMapData, CenY, YSIDE), TRUE);
if (r.right > Map_Max_X * CellSize)
{
_setcolor(DC, Blue);
_rectangle(DC, _GFILLINTERIOR, Map_Max_X * CellSize, 0, r.right, r.bottom);
}
if (r.bottom > Map_Max_Y * CellSize)
{
_setcolor(DC, Blue);
_rectangle(DC, _GFILLINTERIOR, 0, Map_Max_Y * CellSize, r.right, r.bottom);
}
RefreshMap(MainMapData, DC, &r);
ReBlt = FALSE;
EndPaint(hMainWnd, &ps);
}
retval = 0;
break;
}
case WM_COMMAND:
MainWndCommandProc(hMainWnd, wParam, lParam);
break;
default:
retval = DefWindowProc(hwnd, message, wParam, lParam);
break;
}
return retval;
}
// ====================================
// Keyboard Command dispatch function
// ====================================
void ProcessCommand(int Key)
{
GridIndex X, Y, x, y;
int i;
X = (GridIndex) CurX;
Y = (GridIndex) CurY;
switch (Key)
{
case 'a':
CampEnterCriticalSection();
GlobUnit = AddUnit(X, Y, COUN_NORTH_KOREA);
CampLeaveCriticalSection();
DialogBox(hInst, MAKEINTRESOURCE(IDD_UNITDIALOG), hMainWnd, (DLGPROC)EditUnit);
if (GlobUnit)
GlobUnit = NULL;
MainMapData->ShowUnits = TRUE;
if (MainMapData->ShowWPs)
SetRefresh(MainMapData);
else
{
InvalidateRect(MainMapData->hMapWnd, NULL, FALSE);
PostMessage(MainMapData->hMapWnd, WM_PAINT, (WPARAM)hMainDC, 0);
}
Saved = FALSE;
break;
case 'A':
AssignBattToBrigDiv();
break;
case 'b':
SHOWSTATS = not SHOWSTATS;
break;
case 'B':
TheCampaign.MakeCampMap(MAP_SAMCOVERAGE);
TheCampaign.MakeCampMap(MAP_RADARCOVERAGE);
TheCampaign.MakeCampMap(MAP_OWNERSHIP);
// RecalculateBrigadePositions();
// SetRefresh(MainMapData);
break;
case 'c':
DialogBox(hInst, MAKEINTRESOURCE(IDD_WEATHERDIALOG), hMainWnd, (DLGPROC)WeatherEditProc);
break;
case 'C':
if (ptSelected == 2)
{
RegroupBrigades();
}
else
{
Sel1X = Sel2X = CurX;
Sel1Y = Sel2Y = CurY;
RegroupBrigades();
}
break;
case 'd':
gDumping = compl gDumping;
break;
case 'D':
DeleteUnit(OneUnit);
SetRefresh(MainMapData);
break;
case 'e':
DialogBox(hInst, MAKEINTRESOURCE(IDD_TEAMEDIT_DIALOG), hMainWnd, (DLGPROC)EditTeams);
break;
case 'E':
StateEdit = not StateEdit;
if (ThisTeam == 0 or not StateToEdit)
StateEdit = FALSE;
SetRefresh(MainMapData);
break;
case 'f':
break;
case 'F':
if (ShowFlanks)
ShowFlanks = 0;
else
ShowFlanks = 1;
SetRefresh(MainMapData);
break;
case 'G':
ptSelected = 0;
Sel1X = Sel2X = 0;
Sel1Y = Sel2Y = 0;
break;
case 'g':
if (ptSelected)
{
Sel2X = CurX;
Sel2Y = CurY;
ptSelected = 2;
}
else
{
Sel1X = CurX;
Sel1Y = CurY;
ptSelected = 1;
}
break;
case 'H':
// if (MainMapData->SAMs == 1)
// MainMapData->SAMs = 2;
// else if (MainMapData->SAMs == 2)
// MainMapData->SAMs = 1;
if (Mode == 10)
Mode = 11;
else if (Mode == 11)
Mode = 10;
SetRefresh(MainMapData);
break;
case 'l':
if (OneObjective)
{
if ( not Linking)
{
FromObjective = OneObjective;
Linking = TRUE;
}
else
{
ToObjective = OneObjective;
ShowLinkCosts(FromObjective, ToObjective);
// CampEnterCriticalSection();
if ( not UnLinkCampaignObjectives(FromObjective, ToObjective))
{
PathClass path;
i = LinkCampaignObjectives(&path, FromObjective, ToObjective);
if (i < 1)
MessageBox(NULL, "No valid path found", "Error", MB_OK bitor MB_ICONSTOP bitor MB_SETFOREGROUND);
if (MainMapData->ShowLinks and i > 0)
{
RECT r;
PAINTSTRUCT ps;
HDC DC;
MapData md = MainMapData;
GetClientRect(hMainWnd, &r);
InvalidateRect(hMainWnd, &r, FALSE);
DC = BeginPaint(hMainWnd, &ps);
_setcolor(DC, White);
ToObjective->GetLocation(&x, &y);
_moveto(DC, POSX(x) + (CellSize >> 1), POSY(y) + (CellSize >> 1));
FromObjective->GetLocation(&x, &y);
_lineto(DC, POSX(x) + (CellSize >> 1), POSY(y) + (CellSize >> 1));
EndPaint(hMainWnd, &ps);
}
else
{
MainMapData->ShowLinks = TRUE;
SetRefresh(MainMapData);
}
}
else if (MainMapData->ShowLinks)
SetRefresh(MainMapData);
ToObjective->RecalculateParent();
FromObjective->RecalculateParent();
ShowLinkCosts(FromObjective, ToObjective);
// CampLeaveCriticalSection();
Linking = FALSE;
Saved = FALSE;
}
}
break;
case 'L':
MainMapData->ShowLinks = not MainMapData->ShowLinks;
SetRefresh(MainMapData);
break;
case 'm':
DialogBox(hInst, MAKEINTRESOURCE(IDD_MISSTRIGDIALOG), hMainWnd, (DLGPROC)MissionTriggerProc);
break;
case 'M':
DialogBox(hInst, MAKEINTRESOURCE(IDD_MAPDIALOG), hMainWnd, (DLGPROC)MapDialogProc);
PostMessage(hMainWnd, WM_KEYUP, 16, 0);
break;
case 'n':
if (StateEdit)
{
OneObjective = FindNearestObjective(X, Y, NULL);
OneObjective->GetLocation(&x, &y);
if (x == X and y == Y)
{
RedrawCell(MainMapData, X, Y);
}
}
break;
case 'N':
Mode++;
if (Mode > 2)
Mode = 0;
SetRefresh(MainMapData);
break;
case 'o':
StartObjectiveEdit();
break;
case 'O':
MainMapData->ShowObjectives = not MainMapData->ShowObjectives;
RebuildParentsList();
SetRefresh(MainMapData);
break;
case 'p':
if ( not FindPath)
{
Movx = X;
Movy = Y;
FindPath = TRUE;
}
else
{
PathClass path;
CampEnterCriticalSection();
maxSearch = GROUND_PATH_MAX;
GetGridPath(&path, Movx, Movy, X, Y, gMoveType, gMoveWho, gMoveFlags);
maxSearch = MAX_SEARCH;
CampLeaveCriticalSection();
ShowPath(MainMapData, Movx, Movy, &path, White);
FindPath = FALSE;
}
break;
case 'P':
if ( not FindPath)
{
if (OneObjective)
{
FromObjective = OneObjective;
FindPath = TRUE;
}
}
else
{
PathClass path;
if (OneObjective)
{
CampEnterCriticalSection();
GetObjectivePath(&path, FromObjective, OneObjective, gMoveType, gMoveWho, gMoveFlags);
CampLeaveCriticalSection();
ShowObjectivePath(MainMapData, FromObjective, &path, Red);
FindPath = FALSE;
}
}
/* if (ShowPaths)
ShowPaths = 0;
else
ShowPaths = 1;
SetRefresh(MainMapData);
*/
break;
case 'Q':
ShowMissionLists();
break;
case 'r':
DialogBox(hInst, MAKEINTRESOURCE(IDD_TEAMDIALOG), hMainWnd, (DLGPROC)EditRelations);
break;
case 'R':
RoadsOn = not RoadsOn;
RailsOn = not RailsOn;
SetRefresh(MainMapData);
break;
case 's':
DialogBox(hInst, MAKEINTRESOURCE(IDD_SQUADRONDIALOG), hMainWnd, (DLGPROC)SelectSquadron);
break;
case 'S':
ShowSearch = not ShowSearch;
break;
case 't':
//SetTimeCompression (gameCompressionRatio / 2);
break;
case 'T':
//if (gameCompressionRatio < 1)
// SetTimeCompression (1);
//else
// SetTimeCompression *2; /*(gameCompressionRatio * 2);*/
break;
case 'u':
if (ptSelected == 2)
{
MoveUnits();
}
else
{
StartUnitEdit();
/*
if (ShowReal == 1)
OneUnit = FindUnitByXY(AllRealList,X,Y,0);
else if (ShowReal == 0)
OneUnit = FindUnitByXY(AllParentList,X,Y,0);
else if (ShowReal == 2)
OneUnit = FindUnitByXY(InactiveList,X,Y,0);
else
OneUnit = NULL; // Can't edit divisions
if (OneUnit)
GlobUnit = OneUnit;
else
GlobUnit = NULL;
if (GlobUnit)
DialogBox(hInst,MAKEINTRESOURCE(IDD_UNITDIALOG1),hMainWnd,(DLGPROC)EditUnit);
if (MainMapData->ShowWPs)
SetRefresh(MainMapData);
else
{
InvalidateRect(MainMapData->hMapWnd,NULL,FALSE);
PostMessage(MainMapData->hMapWnd,WM_PAINT,(WPARAM)hMainDC,0);
}*/
}
break;
case 'U':
MainMapData->ShowUnits = not MainMapData->ShowUnits;
SetRefresh(MainMapData);
break;
case 'v':
{
extern int GetTopPriorityObjectives(int team, _TCHAR * buffers[5]);
extern int GetTeamSituation(Team t);
_TCHAR* junk[5];
for (i = 0; i < 5; i++)
junk[i] = new _TCHAR[100];
GetTopPriorityObjectives(2, junk);
i = GetTeamSituation(2);
}
break;
case 'w':
if (WPUnit)
{
WayPoint w;
int gotone = 0;
w = WPUnit->GetFirstUnitWP();
while (w and not gotone)
{
w->GetWPLocation(&x, &y);
if (x == X and y == Y)
{
GlobWP = w;
DialogBox(hInst, MAKEINTRESOURCE(IDD_WPDIALOG), hMainWnd, (DLGPROC)EditWayPoint);
gotone = 1;
}
w = w->GetNextWP();
}
if ( not gotone)
{
w = WPUnit->GetFirstUnitWP();
if ( not w)
{
// WPUnit->AddCurrentWP (X,Y,0,0,0.0F,0,WP_NOTHING);
w = WPUnit->GetFirstUnitWP();
SetWPTimes(w, w->GetWPArrivalTime(), WPUnit->GetCruiseSpeed(), 0);
}
else
{
while (w->GetNextWP())
w = w->GetNextWP();
// GlobWP = WPUnit->AddWPAfter(w,X,Y,0,0,0.0F,0,WP_NOTHING);
w = WPUnit->GetFirstUnitWP();
SetWPTimes(w, w->GetWPArrivalTime(), WPUnit->GetCruiseSpeed());
DialogBox(hInst, MAKEINTRESOURCE(IDD_WPDIALOG), hMainWnd, (DLGPROC)EditWayPoint);
}
SetRefresh(MainMapData);
}
}
break;
case 'W':
if (WPUnit and not MainMapData->ShowWPs)
MainMapData->ShowWPs = TRUE;
else
MainMapData->ShowWPs = FALSE;
SetRefresh(MainMapData);
break;
case 'x':
case 'X':
MainMapData->CenX = CenX = X;
MainMapData->CenY = CenY = Y;
zoomOut(MainMapData);
break;
case 'z':
case 'Z':
MainMapData->CenX = CenX = X;
MainMapData->CenY = CenY = Y;
zoomIn(MainMapData);
break;
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
if (ptSelected == 2)
{
SetObjOwnersArea(Key - '1' + 1);
SetRefresh(MainMapData);
}
else
{
OneObjective = GetObjectiveByXY(X, Y);
if (OneObjective)
{
OneObjective->SetOwner(Key - '1' + 1);
}
SetRefresh(MainMapData);
}
break;
case 64:
NoInput = 0;
break;
case 139:
switch (Mode)
{
case 0:
case 1:
i = GetReliefType(GetCell(X, Y));
i++;
SetReliefType(GetCell(X, Y), (ReliefType)i);
break;
case 5:
case 6:
i = ((WeatherClass*)realWeather)->GetCloudLevel(X, Y);
i++;
((WeatherClass*)realWeather)->SetCloudLevel(X, Y, i);
break;
default:
break;
}
Saved = FALSE;
RedrawCell(MainMapData, X, Y);
break;
case 141:
switch (Mode)
{
case 0:
case 1:
i = GetReliefType(GetCell(X, Y));
i--;
SetReliefType(GetCell(X, Y), (ReliefType)i);
break;
case 5:
case 6:
i = ((WeatherClass*)realWeather)->GetCloudLevel(X, Y);
i--;
((WeatherClass*)realWeather)->SetCloudLevel(X, Y, i);
break;
default:
break;
}
Saved = FALSE;
RedrawCell(MainMapData, X, Y);
break;
default:
break;
}
}
/*************************************************************************\
*
* FUNCTION: CampMain(HANDLE, HANDLE, LPSTR, int)
*
* PURPOSE: calls initialization function, processes message loop
*
* COMMENTS:
*
\*************************************************************************/
void CampMain(HINSTANCE hInstance, int nCmdShow)
{
RECT rect;
WNDCLASS mainwc;
CenX = CenY = Map_Max_X / 2;
CellSize = 4;
MaxXSize = MAX_XPIX / CellSize;
MaxYSize = MAX_YPIX / CellSize;
srand((unsigned) time(NULL));
InitDebug(DEBUGGER_TEXT_MODE);
if (campCritical == NULL)
{
campCritical = F4CreateCriticalSection("campCritical");
}
hCurWait = LoadCursor(NULL, IDC_WAIT);
hCurPoint = LoadCursor(NULL, IDC_ARROW);
// Set up the main window
mainwc.style = CS_HREDRAW bitor CS_VREDRAW;
mainwc.lpfnWndProc = (WNDPROC)CampaignWndProc; // The client window procedure.
mainwc.cbClsExtra = 0; // No room reserved for extra data.
mainwc.cbWndExtra = sizeof(DWORD);
mainwc.hInstance = hInstance;
mainwc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
mainwc.hCursor = NULL;
mainwc.hbrBackground = Brushes[Blue];
mainwc.lpszMenuName = MAKEINTRESOURCE(IDR_CAMPAIGN_MENU);
mainwc.lpszClassName = "CampTool";
RegisterClass(&mainwc);
rect.top = rect.left = 0;
rect.right = 320;
rect.bottom = 256;
// Note: This should work, but currently doesnt. MSVC++ bug?
// AdjustWindowRect(&rect, WS_OVERLAPPEDWINDOW bitor WS_HSCROLL bitor WS_VSCROLL, TRUE);
AdjustWindowRect(&rect, WS_OVERLAPPEDWINDOW, TRUE);
rect.right += GetSystemMetrics(SM_CXVSCROLL);
rect.bottom += GetSystemMetrics(SM_CYHSCROLL);
hMainWnd = CreateWindow("CampTool",
"Campaign Tool",
WS_OVERLAPPEDWINDOW bitor WS_HSCROLL bitor WS_VSCROLL, // bitor WS_MAXIMIZE,
CW_USEDEFAULT, // WS_CLIPCHILDREN |
CW_USEDEFAULT,
rect.right - rect.left, /* init. x size */
rect.bottom - rect.top, /* init. y size */
NULL,
NULL,
hInstance,
NULL);
// set up data associated with this window
SetWindowPos(hMainWnd, HWND_TOP, 600, 400, 650, 600, SWP_NOSIZE bitor SWP_NOZORDER);
ShowWindow(hMainWnd, SW_SHOW);
UpdateWindow(hMainWnd);
RefreshCampMap();
}
void CampaignWindow(HINSTANCE hInstance, int nCmdShow)
{
WNDCLASS toolwc;
// Set up the time/location window
toolwc.style = CS_HREDRAW bitor CS_VREDRAW;
toolwc.lpfnWndProc = (WNDPROC)ToolWndProc; // The client window procedure.
toolwc.cbClsExtra = 0; // No room reserved for extra data.
toolwc.cbWndExtra = sizeof(DWORD);
toolwc.hInstance = hInstance;
toolwc.hIcon = NULL; // LoadIcon (NULL, IDI_APPLICATION);
toolwc.hCursor = NULL;
toolwc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
toolwc.lpszMenuName = "";
toolwc.lpszClassName = "Toolbar";
RegisterClass(&toolwc);
hToolWnd = CreateWindow("Toolbar",
"Toolbar",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
300,
100,
NULL,
NULL,
hInstance,
NULL);
// set up data associated with this window
SetWindowPos(hToolWnd, HWND_TOP, 10, 10, 10, 10, SWP_NOSIZE bitor SWP_NOZORDER);
ShowWindow(hToolWnd, SW_SHOW);
UpdateWindow(hToolWnd);
}
void ShowCampaign(void)
{
if (hMainWnd)
{
ShowWindow(hMainWnd, SW_SHOW);
UpdateWindow(hMainWnd);
}
if (hToolWnd)
{
ShowWindow(hToolWnd, SW_SHOW);
UpdateWindow(hToolWnd);
}
}
#endif CAMPTOOL
| 28.904031 | 240 | 0.475513 | Terebinth |
b3598f74f568ce007d0dd421eb430c08521b6541 | 1,965 | cpp | C++ | src/primitives.cpp | kalakuer/TinyRayTracer | 99758f3e2e5279574e3850647d2541df2e111387 | [
"Apache-2.0"
] | null | null | null | src/primitives.cpp | kalakuer/TinyRayTracer | 99758f3e2e5279574e3850647d2541df2e111387 | [
"Apache-2.0"
] | null | null | null | src/primitives.cpp | kalakuer/TinyRayTracer | 99758f3e2e5279574e3850647d2541df2e111387 | [
"Apache-2.0"
] | null | null | null | #include "primitives.h"
#include <glm/gtc/matrix_transform.hpp>
namespace TinyRT {
IntersectTestResult Primitives::intersectTest(const Ray &ray, float refractiveIndex) {
glm::vec3 normal = glm::normalize(glm::cross(V1-V0, V2-V1));
float A = normal.x;
float B = normal.y;
float C = normal.z;
float D = -A*V0.x - B * V0.y - C * V0.z;
//Plane equation: Ax + By + Cz + D = 0
glm::vec3 rayOrigin = ray.origin();
glm::vec3 rayDirection = glm::normalize(ray.direction());
float t = -(D + A * rayOrigin.x + B * rayOrigin.y + C * rayOrigin.z) /
(A * rayDirection.x + B * rayDirection.y + C * rayDirection.z);
//check if ray intersect with plant
if(t <= 0 || glm::dot(rayDirection , normal) >= 0) {
IntersectTestResult result;
result.Intersected = false;
return result;
}
glm::vec3 intersectedPoint = rayOrigin + rayDirection * t;
//check if intersect point is in triangle
glm::vec3 PV0 = V0 - intersectedPoint;
glm::vec3 PV1 = V1 - intersectedPoint;
glm::vec3 PV2 = V2 - intersectedPoint;
float S0 = glm::length(glm::cross(V1-V0, V2-V0));
float S1 = glm::length(glm::cross(PV0, PV1)) +
glm::length(glm::cross(PV0, PV2)) +
glm::length(glm::cross(PV1, PV2));
IntersectTestResult result;
result.distance = t;
if(abs(S0-S1)<0.0001) {
result.Intersected = true;
result.IntersectedPoint = intersectedPoint;
result.PrimitivesNormal = normal;
result.ReflectionDirection = -glm::normalize(glm::reflect(normal, ray.direction()));
//TODO:RefractionDirection
return result;
} else {
result.Intersected = false;
return result;
}
}
}
| 33.87931 | 97 | 0.545547 | kalakuer |
b35aff00167f1f45d0c563466d09d90065a798ed | 4,664 | cpp | C++ | cpp/TCPDataTracker.cpp | jinyyu/filedump | 72b55e4ed260585a754078dc9623ff2fbbe5d9fc | [
"MIT"
] | null | null | null | cpp/TCPDataTracker.cpp | jinyyu/filedump | 72b55e4ed260585a754078dc9623ff2fbbe5d9fc | [
"MIT"
] | null | null | null | cpp/TCPDataTracker.cpp | jinyyu/filedump | 72b55e4ed260585a754078dc9623ff2fbbe5d9fc | [
"MIT"
] | null | null | null | #include "TCPDataTracker.h"
#include "debug_log.h"
#include <stdio.h>
#include <vector>
#include <map>
// As defined by RFC 1982 - 2 ^ (SERIAL_BITS - 1)
static const uint32_t k_seq_number_diff = 2147483648U;
static int seq_compare(uint32_t seq1, uint32_t seq2)
{
if (seq1 == seq2) {
return 0;
}
if (seq1 < seq2) {
return (seq2 - seq1 < k_seq_number_diff) ? -1 : 1;
}
else {
return (seq1 - seq2 > k_seq_number_diff) ? -1 : 1;
}
}
typedef std::vector<uint8_t> Payload;
typedef std::map<uint32_t, Payload> BufferPayload;
class TCPDataTracker
{
public:
explicit TCPDataTracker(uint32_t seq)
: next_seq_(seq),
ctx_(nullptr),
cb_(nullptr)
{
//LOG_DEBUG("new");
}
~TCPDataTracker()
{
//LOG_DEBUG("release");
}
void handle_data(uint32_t seq, const char* data, uint32_t len)
{
const uint32_t chunk_end = seq + len;
// If the end of the chunk ends before current sequence number, ignore it.
if (seq_compare(chunk_end, next_seq_) < 0) {
return;
}
// If it starts before our sequence number, slice it
if (seq_compare(seq, next_seq_) < 0) {
const uint32_t diff = next_seq_ - seq;
data += diff;
len -= diff;
seq = next_seq_;
}
if (seq == next_seq_) {
cb_(ctx_, data, len);
next_seq_ += len;
} else {
// Store this payload
store_payload(seq, data, len);
}
// Keep looping while the fragments seq is lower or equal to our seq
auto it = buffer_payload_.find(next_seq_);
while (it != buffer_payload_.end() && seq_compare(it->first, next_seq_) <= 0) {
// Does this fragment start before our sequence number?
if (seq_compare(it->first, next_seq_) < 0) {
uint32_t fragment_end = it->first + static_cast<uint32_t>(it->second.size());
int comparison = seq_compare(fragment_end, next_seq_);
// Does it end after our sequence number?
if (comparison > 0) {
// Then slice it
std::vector<uint8_t>& payload = it->second;
// First update this counter
uint32_t diff = next_seq_ - it->first;
const uint8_t* data = payload.data() + diff;
uint32_t len = payload.size() - diff;
store_payload(next_seq_, (const char*) data, len);
it = erase_iterator(it);
}
else {
// Otherwise, we've seen this part of the payload. Erase it.
it = erase_iterator(it);
}
}
else {
cb_(ctx_, (const char*) it->second.data(), static_cast<uint32_t>(it->second.size()));
next_seq_ += it->second.size();
it = erase_iterator(it);
}
}
}
void store_payload(uint32_t seq, const char* data, uint32_t len)
{
auto it = buffer_payload_.find(seq);
if (it == buffer_payload_.end()) {
Payload payload(data, data + len);
buffer_payload_[seq] = std::move(payload);
}
else if (it->second.size() < len) {
Payload payload(data, data + len);
it->second = std::move(payload);
}
}
BufferPayload::iterator erase_iterator(BufferPayload::iterator iter)
{
auto output = iter;
++output;
buffer_payload_.erase(iter);
if (output == buffer_payload_.end()) {
output = buffer_payload_.begin();
}
return output;
}
void set_callback(void* ctx, on_data_callback cb)
{
ctx_ = ctx;
cb_ = cb;
}
void update_seq(uint32_t seq)
{
next_seq_ = seq;
}
private:
uint32_t next_seq_;
void* ctx_;
on_data_callback cb_;
BufferPayload buffer_payload_;
};
void* new_tcp_data_tracker(uint32_t seq)
{
return new TCPDataTracker(seq);
}
void free_tcp_data_tracker(void* tracker)
{
delete ((TCPDataTracker*) tracker);
}
void tcp_data_tracker_set_callback(void* tracker, void* ctx, on_data_callback cb)
{
((TCPDataTracker*) tracker)->set_callback(ctx, cb);
}
void tcp_data_tracker_update_seq(void* tracker, uint32_t seq)
{
((TCPDataTracker*) tracker)->update_seq(seq);
}
void tcp_data_tracker_process_data(void* tracker, uint32_t seq, const char* data, uint32_t len)
{
((TCPDataTracker*) tracker)->handle_data(seq, data, len);
}
| 27.435294 | 101 | 0.560249 | jinyyu |
b37071ac5ce2fb057bc33580817a79c11b09df5d | 3,360 | cpp | C++ | test/unit/io/sequence_file/sequence_file_record_test.cpp | joergi-w/seqan3 | b757646eee3cddf1f2487db8f1c9f3576ee37391 | [
"CC-BY-4.0",
"CC0-1.0"
] | 283 | 2017-03-14T23:43:33.000Z | 2022-03-28T02:30:02.000Z | test/unit/io/sequence_file/sequence_file_record_test.cpp | joergi-w/seqan3 | b757646eee3cddf1f2487db8f1c9f3576ee37391 | [
"CC-BY-4.0",
"CC0-1.0"
] | 2,754 | 2017-03-21T18:39:02.000Z | 2022-03-31T13:26:15.000Z | test/unit/io/sequence_file/sequence_file_record_test.cpp | joergi-w/seqan3 | b757646eee3cddf1f2487db8f1c9f3576ee37391 | [
"CC-BY-4.0",
"CC0-1.0"
] | 88 | 2017-03-20T12:43:42.000Z | 2022-03-17T08:56:13.000Z | // -----------------------------------------------------------------------------------------------------
// Copyright (c) 2006-2021, Knut Reinert & Freie Universität Berlin
// Copyright (c) 2016-2021, Knut Reinert & MPI für molekulare Genetik
// This file may be used, modified and/or redistributed under the terms of the 3-clause BSD-License
// shipped with this file and also available at: https://github.com/seqan/seqan3/blob/master/LICENSE.md
// -----------------------------------------------------------------------------------------------------
#include <gtest/gtest.h>
#include <seqan3/alphabet/detail/debug_stream_alphabet.hpp>
#include <seqan3/alphabet/nucleotide/dna4.hpp>
#include <seqan3/alphabet/quality/phred42.hpp>
#include <seqan3/io/detail/record_like.hpp>
#include <seqan3/io/sequence_file/record.hpp>
#include <seqan3/test/expect_range_eq.hpp>
#include <seqan3/test/expect_same_type.hpp>
#include <seqan3/utility/tuple/concept.hpp>
#include <seqan3/utility/type_list/type_list.hpp>
using seqan3::operator""_dna4;
// ----------------------------------------------------------------------------
// record
// ----------------------------------------------------------------------------
struct sequence_record : public ::testing::Test
{
using types = seqan3::type_list<std::string, seqan3::dna4_vector>;
using types_as_ids = seqan3::fields<seqan3::field::id, seqan3::field::seq>;
using record_type = seqan3::sequence_record<types, types_as_ids>;
};
TEST_F(sequence_record, concept)
{
EXPECT_TRUE((seqan3::detail::record_like<record_type>));
}
TEST_F(sequence_record, definition_tuple_traits)
{
EXPECT_SAME_TYPE((std::tuple<std::string, seqan3::dna4_vector>), typename record_type::base_type);
EXPECT_SAME_TYPE(std::string, (std::tuple_element_t<0, record_type>));
EXPECT_SAME_TYPE(seqan3::dna4_vector, (std::tuple_element_t<1, record_type>));
EXPECT_EQ(std::tuple_size_v<record_type>, 2ul);
EXPECT_TRUE(seqan3::tuple_like<record_type>);
}
TEST_F(sequence_record, construction)
{
[[maybe_unused]] record_type r{"MY ID", "ACGT"_dna4};
}
TEST_F(sequence_record, get_by_index)
{
record_type r{"MY ID", "ACGT"_dna4};
EXPECT_EQ(std::get<0>(r), "MY ID");
EXPECT_RANGE_EQ(std::get<1>(r), "ACGT"_dna4);
}
TEST_F(sequence_record, get_by_type)
{
record_type r{"MY ID", "ACGT"_dna4};
EXPECT_EQ(std::get<std::string>(r), "MY ID");
EXPECT_RANGE_EQ(std::get<seqan3::dna4_vector>(r), "ACGT"_dna4);
}
TEST_F(sequence_record, get_by_member)
{
record_type r{"MY ID", "ACGT"_dna4};
EXPECT_EQ(r.id(), "MY ID");
EXPECT_RANGE_EQ(r.sequence(), "ACGT"_dna4);
}
TEST_F(sequence_record, member_types)
{
record_type r{"MY ID", "ACGT"_dna4};
EXPECT_SAME_TYPE(std::string &, decltype(r.id()));
EXPECT_SAME_TYPE(seqan3::dna4_vector &, decltype(r.sequence()));
EXPECT_SAME_TYPE(std::string const &, decltype(std::as_const(r).id()));
EXPECT_SAME_TYPE(seqan3::dna4_vector const &, decltype(std::as_const(r).sequence()));
EXPECT_SAME_TYPE(std::string &&, decltype(std::move(r).id()));
EXPECT_SAME_TYPE(seqan3::dna4_vector &&, decltype(std::move(r).sequence()));
EXPECT_SAME_TYPE(std::string const &&, decltype(std::move(std::as_const(r)).id()));
EXPECT_SAME_TYPE(seqan3::dna4_vector const &&, decltype(std::move(std::as_const(r)).sequence()));
}
| 35.744681 | 104 | 0.643155 | joergi-w |
b375c7a959fa66dc6180a694281a47efb0880cb0 | 220 | hh | C++ | tests/Titon/Test/Stub/Annotation/BarAnnotationStub.hh | ciklon-z/framework | cbf44729173d3a83b91a2b0a217c6b3827512e44 | [
"BSD-2-Clause"
] | 206 | 2015-01-02T20:01:12.000Z | 2021-04-15T09:49:56.000Z | tests/Titon/Test/Stub/Annotation/BarAnnotationStub.hh | ciklon-z/framework | cbf44729173d3a83b91a2b0a217c6b3827512e44 | [
"BSD-2-Clause"
] | 44 | 2015-01-02T06:03:43.000Z | 2017-11-20T18:29:06.000Z | tests/Titon/Test/Stub/Annotation/BarAnnotationStub.hh | titon/framework | cbf44729173d3a83b91a2b0a217c6b3827512e44 | [
"BSD-2-Clause"
] | 27 | 2015-01-03T05:51:29.000Z | 2022-02-21T13:50:40.000Z | <?hh // strict
namespace Titon\Test\Stub\Annotation;
use Titon\Annotation\Annotation;
class BarAnnotationStub extends Annotation {
public function __construct(public string $string, public int $int = 0): void {}
}
| 24.444444 | 84 | 0.759091 | ciklon-z |
b382b4a80e7c3c5a3e9a6e795322701b252c352c | 682 | hpp | C++ | include/api/InfoObject.hpp | bander9289/StratifyAPI | 9b45091aa71a4e5718047438ea4044c1fdc814a3 | [
"MIT"
] | 2 | 2016-05-21T03:09:19.000Z | 2016-08-27T03:40:51.000Z | include/api/InfoObject.hpp | bander9289/StratifyAPI | 9b45091aa71a4e5718047438ea4044c1fdc814a3 | [
"MIT"
] | 75 | 2017-10-08T22:21:19.000Z | 2020-03-30T21:13:20.000Z | include/api/InfoObject.hpp | StratifyLabs/StratifyLib | 975a5c25a84296fd0dec64fe4dc579cf7027abe6 | [
"MIT"
] | 5 | 2018-03-27T16:44:09.000Z | 2020-07-08T16:45:55.000Z | /*! \file */ // Copyright 2011-2020 Tyler Gilbert and Stratify Labs, Inc; see LICENSE.md for rights.
#ifndef API_INFO_OBJECT_HPP
#define API_INFO_OBJECT_HPP
#include "ApiObject.hpp"
namespace api {
/*! \brief Information Object
* \details Classes that inherit from
* information objects are used for static
* data storage and access. They don't do any
* work that could cause errors.
*
*
* \sa api::WorkObject
*
*
*/
class InfoObject : public virtual ApiObject {
public:
virtual void * info_to_void(){ return 0; }
virtual const void * info_to_void() const { return 0; }
virtual u32 info_size() const { return 0; }
protected:
};
}
#endif // API_INFO_OBJECT_HPP
| 19.485714 | 100 | 0.714076 | bander9289 |
b384be169d0145722b946a25561ad6989f50479b | 6,544 | cpp | C++ | CorsixTH/Src/th_map_overlays.cpp | terrorcide/CorsixTH | 2d91936656529c26d21e2de41f4ea6a831bb4e47 | [
"MIT"
] | null | null | null | CorsixTH/Src/th_map_overlays.cpp | terrorcide/CorsixTH | 2d91936656529c26d21e2de41f4ea6a831bb4e47 | [
"MIT"
] | null | null | null | CorsixTH/Src/th_map_overlays.cpp | terrorcide/CorsixTH | 2d91936656529c26d21e2de41f4ea6a831bb4e47 | [
"MIT"
] | null | null | null | /*
Copyright (c) 2010 Peter "Corsix" Cawley
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 "th_map_overlays.h"
#include "th_gfx.h"
#include "th_map.h"
#include <sstream>
map_overlay_pair::map_overlay_pair()
{
first = nullptr;
second = nullptr;
owns_first = false;
owns_second = false;
}
map_overlay_pair::~map_overlay_pair()
{
set_first(nullptr, false);
set_second(nullptr, false);
}
void map_overlay_pair::set_first(map_overlay* pOverlay, bool bTakeOwnership)
{
if(first && owns_first)
delete first;
first = pOverlay;
owns_first = bTakeOwnership;
}
void map_overlay_pair::set_second(map_overlay* pOverlay, bool bTakeOwnership)
{
if(second && owns_second)
delete second;
second = pOverlay;
owns_second = bTakeOwnership;
}
void map_overlay_pair::draw_cell(render_target* pCanvas, int iCanvasX,
int iCanvasY, const level_map* pMap, int iNodeX,
int iNodeY)
{
if(first)
first->draw_cell(pCanvas, iCanvasX, iCanvasY, pMap, iNodeX, iNodeY);
if(second)
second->draw_cell(pCanvas, iCanvasX, iCanvasY, pMap, iNodeX, iNodeY);
}
map_text_overlay::map_text_overlay()
{
background_sprite = 0;
}
void map_text_overlay::set_background_sprite(size_t iSprite)
{
background_sprite = iSprite;
}
void map_text_overlay::draw_cell(render_target* pCanvas, int iCanvasX,
int iCanvasY, const level_map* pMap, int iNodeX,
int iNodeY)
{
if(sprites && background_sprite)
{
sprites->draw_sprite(pCanvas, background_sprite, iCanvasX,
iCanvasY, 0);
}
if(font)
{
draw_text(pCanvas, iCanvasX, iCanvasY, get_text(pMap, iNodeX, iNodeY));
}
}
const std::string map_positions_overlay::get_text(const level_map* pMap, int iNodeX, int iNodeY)
{
std::ostringstream str;
str << iNodeX + 1 << ',' << iNodeY + 1;
return str.str();
}
map_typical_overlay::map_typical_overlay()
{
sprites = nullptr;
font = nullptr;
owns_sprites = false;
owns_font = false;
}
map_typical_overlay::~map_typical_overlay()
{
set_sprites(nullptr, false);
set_font(nullptr, false);
}
void map_flags_overlay::draw_cell(render_target* pCanvas, int iCanvasX,
int iCanvasY, const level_map* pMap, int iNodeX,
int iNodeY)
{
const map_tile *pNode = pMap->get_tile(iNodeX, iNodeY);
if(!pNode)
return;
if(sprites)
{
if(pNode->flags.passable)
sprites->draw_sprite(pCanvas, 3, iCanvasX, iCanvasY, 0);
if(pNode->flags.hospital)
sprites->draw_sprite(pCanvas, 8, iCanvasX, iCanvasY, 0);
if(pNode->flags.buildable)
sprites->draw_sprite(pCanvas, 9, iCanvasX, iCanvasY, 0);
if(pNode->flags.can_travel_n && pMap->get_tile(iNodeX, iNodeY - 1)->flags.passable)
{
sprites->draw_sprite(pCanvas, 4, iCanvasX, iCanvasY, 0);
}
if(pNode->flags.can_travel_e && pMap->get_tile(iNodeX + 1, iNodeY)->flags.passable)
{
sprites->draw_sprite(pCanvas, 5, iCanvasX, iCanvasY, 0);
}
if(pNode->flags.can_travel_s && pMap->get_tile(iNodeX, iNodeY + 1)->flags.passable)
{
sprites->draw_sprite(pCanvas, 6, iCanvasX, iCanvasY, 0);
}
if(pNode->flags.can_travel_w && pMap->get_tile(iNodeX - 1, iNodeY)->flags.passable)
{
sprites->draw_sprite(pCanvas, 7, iCanvasX, iCanvasY, 0);
}
}
if(font)
{
if(!pNode->objects.empty())
{
std::ostringstream str;
str << 'T' << static_cast<int>(pNode->objects.front());
draw_text(pCanvas, iCanvasX, iCanvasY - 8, str.str());
}
if(pNode->iRoomId)
{
std::ostringstream str;
str << 'R' << static_cast<int>(pNode->iRoomId);
draw_text(pCanvas, iCanvasX, iCanvasY + 8, str.str());
}
}
}
void map_parcels_overlay::draw_cell(render_target* pCanvas, int iCanvasX,
int iCanvasY, const level_map* pMap, int iNodeX,
int iNodeY)
{
const map_tile *pNode = pMap->get_tile(iNodeX, iNodeY);
if(!pNode)
return;
if(font)
draw_text(pCanvas, iCanvasX, iCanvasY, std::to_string((int)pNode->iParcelId));
if(sprites)
{
uint16_t iParcel = pNode->iParcelId;
#define DIR(dx, dy, sprite) \
pNode = pMap->get_tile(iNodeX + dx, iNodeY + dy); \
if(!pNode || pNode->iParcelId != iParcel) \
sprites->draw_sprite(pCanvas, sprite, iCanvasX, iCanvasY, 0)
DIR( 0, -1, 18);
DIR( 1, 0, 19);
DIR( 0, 1, 20);
DIR(-1, 0, 21);
#undef DIR
}
}
void map_typical_overlay::draw_text(render_target* pCanvas, int iX, int iY,
std::string str)
{
text_layout oArea = font->get_text_dimensions(str.c_str(), str.length());
font->draw_text(pCanvas, str.c_str(), str.length(), iX + (64 - oArea.end_x) / 2,
iY + (32 - oArea.end_y) / 2);
}
void map_typical_overlay::set_sprites(sprite_sheet* pSheet, bool bTakeOwnership)
{
if(sprites && owns_sprites)
delete sprites;
sprites = pSheet;
owns_sprites = bTakeOwnership;
}
void map_typical_overlay::set_font(::font* font, bool take_ownership)
{
if(this->font && owns_font)
delete this->font;
this->font = font;
owns_font = take_ownership;
}
| 31.014218 | 96 | 0.636767 | terrorcide |
b387b1e4fc48981995d85dc01f36e5d93b923c28 | 8,733 | hpp | C++ | nodec/include/nodec/entities/sparse_table.hpp | ContentsViewer/nodec | 40b414a2f48d2e4718b69e0fa630e3f85e90e083 | [
"Apache-2.0"
] | 2 | 2022-01-03T12:01:03.000Z | 2022-01-04T18:11:25.000Z | nodec/include/nodec/entities/sparse_table.hpp | ContentsViewer/nodec | 40b414a2f48d2e4718b69e0fa630e3f85e90e083 | [
"Apache-2.0"
] | null | null | null | nodec/include/nodec/entities/sparse_table.hpp | ContentsViewer/nodec | 40b414a2f48d2e4718b69e0fa630e3f85e90e083 | [
"Apache-2.0"
] | null | null | null | #ifndef NODEC__ENTITIES__SPARSE_TABLE_HPP_
#define NODEC__ENTITIES__SPARSE_TABLE_HPP_
#include <nodec/logging.hpp>
#include <vector>
namespace nodec {
namespace entities {
// This code based on
// * <https://github.com/sparsehash/sparsehash/blob/master/src/sparsehash/sparsetable>
// Thank you! :)
/**
* The smaller this is, the faster lookup is (because the group bitmap is
* smaller) and the faster insert it, because there's less to move.
* On the other hand, there are more groups.
*/
constexpr uint16_t DEFAULT_SPARSE_GROUP_SIZE = 48;
template<typename Table>
class TableIterator {
using GroupIterator = typename Table::Group::iterator;
public:
using value_type = typename Table::Group::Value;
using pointer = value_type*;
using reference = value_type&;
public:
TableIterator(Table* table, size_t group_num, GroupIterator group_iter)
: table_(table), group_num_(group_num), group_iter_(group_iter) {
}
TableIterator(const TableIterator& from)
: table_(from.table_), group_num_(from.group_num_), group_iter_(from.group_iter_) {
}
reference operator*() const {
return *group_iter_;
}
pointer operator->() const {
return group_iter_.operator->();
}
TableIterator& operator++() {
++group_iter_;
if (group_iter_ == table_->end(group_num_)
&& group_num_ + 1 < table_->group_count()) {
++group_num_;
group_iter_ = table_->begin(group_num_);
}
return *this;
}
TableIterator& operator--() {
if (group_iter_ == table_->begin(group_num_)
&& group_num_ > 0) {
--group_num_;
group_iter_ = table_->end(group_num_);
}
--group_iter_;
return *this;
}
bool operator==(const TableIterator& it) {
return table_ == it.table_
&& group_num_ == it.group_num_
&& group_iter_ == it.group_iter_;
}
bool operator!=(const TableIterator& it) {
return !(*this == it);
}
private:
Table* table_;
size_t group_num_;
GroupIterator group_iter_;
};
template<typename ValueT, uint16_t GROUP_SIZE>
class BasicSparseGroup {
public:
using Value = ValueT;
public:
using size_type = uint16_t;
using iterator = typename std::vector<Value>::iterator;
private:
/**
* @brief i bits to bytes (rounded down)
*/
static size_type bytebit(size_type i) { return i >> 3; }
/**
* @brief Gets the leftover bits with division by byte.
*/
static size_type modbit(size_type i) { return 1 << (i & 0x07); }
/**
* @brief Tests bucket i is occuoued or not.
*/
int bmtest(size_type i) const { return bitmap[bytebit(i)] & modbit(i); }
void bmset(size_type i) { bitmap[bytebit(i)] |= modbit(i); }
void bmclear(size_type i) { bitmap[bytebit(i)] &= ~modbit(i); }
static size_type bits_in_byte(uint8_t byte) {
static const uint8_t bits_in[256]{
0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4,
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8,
};
return bits_in[byte];
}
public:
/*
* @brief We need a small function that tells us how many set bits there are
* in position 0..i-1 of the bitmap.
*/
static size_type pos_to_offset(const uint8_t* bm, size_type pos) {
size_type retval = 0;
// @note Condition pos > 8 is an optimization; convince yourself we
// give exactly the same result as if we had pos >= 8 here instead.
for (; pos > 8; pos -= 8) {
retval += bits_in_byte(*bm++);
}
return retval + bits_in_byte(*bm & ((1 << pos) - 1));
}
public:
iterator begin() { return group.begin(); }
iterator end() { return group.end(); }
size_type num_buckets() { return num_buckets_; }
bool contains(const size_type i) const {
return bmtest(i) != 0x00;
}
template<typename... Args>
std::pair<Value&, bool> emplace(const size_type i, Args&&... args) {
if (bmtest(i)) {
return { group[pos_to_offset(bitmap, i)], false };
}
auto offset = pos_to_offset(bitmap, i);
group.emplace(group.begin() + offset, std::forward<Args>(args)...);
++num_buckets_;
bmset(i);
return { group[offset], true };
}
const Value* try_get(const size_type i) const {
if (!bmtest(i)) {
return nullptr;
}
return &group[pos_to_offset(bitmap, i)];
}
Value* try_get(const size_type i) {
if (!bmtest(i)) {
return nullptr;
}
return &group[pos_to_offset(bitmap, i)];
}
bool erase(const size_type i) {
if (!bmtest(i)) {
return false;
}
auto offset = pos_to_offset(bitmap, i);
group.erase(group.begin() + offset);
--num_buckets_;
bmclear(i);
return true;
}
private:
std::vector<Value> group;
uint8_t bitmap[(GROUP_SIZE - 1) / 8 + 1]; // fancy math is so we round up
size_type num_buckets_; // limits GROUP_SIZE to 64KB
};
template<typename T, uint16_t GROUP_SIZE>
class BasicSparseTable {
public:
using Group = BasicSparseGroup<T, GROUP_SIZE>;
public:
using size_type = size_t;
using iterator = TableIterator<BasicSparseTable<T, GROUP_SIZE>>;
using local_iterator = typename Group::iterator;
public:
uint16_t pos_in_group(const size_type i) const {
return static_cast<uint16_t>(i % GROUP_SIZE);
}
size_type group_num(const size_type i) const {
return i / GROUP_SIZE;
}
Group* group_assured(size_type i) {
auto num = group_num(i);
if (!(num < groups.size())) {
groups.resize(num + 1);
}
//nodec:logging::DebugStream(__FILE__, __LINE__) << sizeof(Group) << " * " << groups.size();
return &groups[num];
}
const Group* group_if_exists(size_type i) const {
auto num = group_num(i);
if (!(num < groups.size())) {
return nullptr;
}
return &groups[num];
}
Group* group_if_exists(size_type i) {
auto num = group_num(i);
if (!(num < groups.size())) {
return nullptr;
}
return &groups[num];
}
bool has_group(size_type i) const {
return group_num(i) < groups.size();
}
iterator begin() {
return { this, 0, begin(0) };
}
iterator end() {
auto group_num = groups.size() - 1;
return { this, group_num, end(group_num) };
}
T& operator[](const size_type i) {
return group_assured(i)->emplace(pos_in_group(i)).first;
}
const T* try_get(const size_type i) const {
auto* group = group_if_exists(i);
if (!group) {
return nullptr;
}
return group->try_get(pos_in_group(i));
}
T* try_get(const size_type i) {
auto* group = group_if_exists(i);
if (!group) {
return nullptr;
}
return group->try_get(pos_in_group(i));
}
bool erase(const size_type i) {
auto* group = group_if_exists(i);
if (!group) {
return false;
}
return group->erase(pos_in_group(i));
}
bool contains(const size_type i) const {
auto* group = group_if_exists(i);
if (!group) {
return false;
}
return group->contains(pos_in_group(i));
}
size_type group_count() const noexcept { return groups.size(); }
local_iterator begin(size_type n) {
return groups[n].begin();
}
local_iterator end(size_type n) {
return groups[n].end();
}
private:
std::vector<Group> groups;
};
template<typename T>
using SparseTable = BasicSparseTable<T, DEFAULT_SPARSE_GROUP_SIZE>;
}
}
#endif | 25.837278 | 100 | 0.557082 | ContentsViewer |
b389c12acbab075b6c2c19ac5d3e02b0a506f4c2 | 15,011 | cpp | C++ | master/core/third/libtorrent/src/tracker_manager.cpp | importlib/klib | a59837857689d0e60d3df6d2ebd12c3160efa794 | [
"MIT"
] | 4 | 2017-12-04T08:22:48.000Z | 2019-10-26T21:44:59.000Z | master/core/third/libtorrent/src/tracker_manager.cpp | isuhao/klib | a59837857689d0e60d3df6d2ebd12c3160efa794 | [
"MIT"
] | null | null | null | master/core/third/libtorrent/src/tracker_manager.cpp | isuhao/klib | a59837857689d0e60d3df6d2ebd12c3160efa794 | [
"MIT"
] | 4 | 2017-12-19T11:13:56.000Z | 2018-02-23T08:44:03.000Z | /*
Copyright (c) 2003, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the distribution.
* Neither the name of the author 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 "libtorrent/pch.hpp"
#include <vector>
#include <iostream>
#include <cctype>
#include <iomanip>
#include <sstream>
#include "zlib.h"
#include <boost/bind.hpp>
#include "libtorrent/tracker_manager.hpp"
#include "libtorrent/http_tracker_connection.hpp"
#include "libtorrent/udp_tracker_connection.hpp"
#include "libtorrent/entry.hpp"
#include "libtorrent/bencode.hpp"
#include "libtorrent/torrent.hpp"
#include "libtorrent/peer_connection.hpp"
using namespace libtorrent;
using boost::tuples::make_tuple;
using boost::tuples::tuple;
using boost::bind;
namespace
{
enum
{
minimum_tracker_response_length = 3,
http_buffer_size = 2048
};
enum
{
FTEXT = 0x01,
FHCRC = 0x02,
FEXTRA = 0x04,
FNAME = 0x08,
FCOMMENT = 0x10,
FRESERVED = 0xe0,
GZIP_MAGIC0 = 0x1f,
GZIP_MAGIC1 = 0x8b
};
}
namespace libtorrent
{
// returns -1 if gzip header is invalid or the header size in bytes
int gzip_header(const char* buf, int size)
{
TORRENT_ASSERT(buf != 0);
TORRENT_ASSERT(size > 0);
const unsigned char* buffer = reinterpret_cast<const unsigned char*>(buf);
const int total_size = size;
// The zip header cannot be shorter than 10 bytes
if (size < 10) return -1;
// check the magic header of gzip
if ((buffer[0] != GZIP_MAGIC0) || (buffer[1] != GZIP_MAGIC1)) return -1;
int method = buffer[2];
int flags = buffer[3];
// check for reserved flag and make sure it's compressed with the correct metod
if (method != Z_DEFLATED || (flags & FRESERVED) != 0) return -1;
// skip time, xflags, OS code
size -= 10;
buffer += 10;
if (flags & FEXTRA)
{
int extra_len;
if (size < 2) return -1;
extra_len = (buffer[1] << 8) | buffer[0];
if (size < (extra_len+2)) return -1;
size -= (extra_len + 2);
buffer += (extra_len + 2);
}
if (flags & FNAME)
{
while (size && *buffer)
{
--size;
++buffer;
}
if (!size || *buffer) return -1;
--size;
++buffer;
}
if (flags & FCOMMENT)
{
while (size && *buffer)
{
--size;
++buffer;
}
if (!size || *buffer) return -1;
--size;
++buffer;
}
if (flags & FHCRC)
{
if (size < 2) return -1;
size -= 2;
buffer += 2;
}
return total_size - size;
}
bool inflate_gzip(
std::vector<char>& buffer
, tracker_request const& req
, request_callback* requester
, int maximum_tracker_response_length)
{
TORRENT_ASSERT(maximum_tracker_response_length > 0);
int header_len = gzip_header(&buffer[0], (int)buffer.size());
if (header_len < 0)
{
requester->tracker_request_error(req, 200, "invalid gzip header in tracker response");
return true;
}
// start off wth one kilobyte and grow
// if needed
std::vector<char> inflate_buffer(1024);
// initialize the zlib-stream
z_stream str;
// subtract 8 from the end of the buffer since that's CRC32 and input size
// and those belong to the gzip file
str.avail_in = (int)buffer.size() - header_len - 8;
str.next_in = reinterpret_cast<Bytef*>(&buffer[header_len]);
str.next_out = reinterpret_cast<Bytef*>(&inflate_buffer[0]);
str.avail_out = (int)inflate_buffer.size();
str.zalloc = Z_NULL;
str.zfree = Z_NULL;
str.opaque = 0;
// -15 is really important. It will make inflate() not look for a zlib header
// and just deflate the buffer
if (inflateInit2(&str, -15) != Z_OK)
{
requester->tracker_request_error(req, 200, "gzip out of memory");
return true;
}
// inflate and grow inflate_buffer as needed
int ret = inflate(&str, Z_SYNC_FLUSH);
while (ret == Z_OK)
{
if (str.avail_out == 0)
{
if (inflate_buffer.size() >= (unsigned)maximum_tracker_response_length)
{
inflateEnd(&str);
requester->tracker_request_error(req, 200
, "tracker response too large");
return true;
}
int new_size = (int)inflate_buffer.size() * 2;
if (new_size > maximum_tracker_response_length) new_size = maximum_tracker_response_length;
int old_size = (int)inflate_buffer.size();
inflate_buffer.resize(new_size);
str.next_out = reinterpret_cast<Bytef*>(&inflate_buffer[old_size]);
str.avail_out = new_size - old_size;
}
ret = inflate(&str, Z_SYNC_FLUSH);
}
inflate_buffer.resize(inflate_buffer.size() - str.avail_out);
inflateEnd(&str);
if (ret != Z_STREAM_END)
{
requester->tracker_request_error(req, 200, "gzip error");
return true;
}
// commit the resulting buffer
std::swap(buffer, inflate_buffer);
return false;
}
std::string base64encode(const std::string& s)
{
static const char base64_table[] =
{
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
'w', 'x', 'y', 'z', '0', '1', '2', '3',
'4', '5', '6', '7', '8', '9', '+', '/'
};
unsigned char inbuf[3];
unsigned char outbuf[4];
std::string ret;
for (std::string::const_iterator i = s.begin(); i != s.end();)
{
// available input is 1,2 or 3 bytes
// since we read 3 bytes at a time at most
int available_input = (std::min)(3, (int)std::distance(i, s.end()));
// clear input buffer
std::fill(inbuf, inbuf+3, 0);
// read a chunk of input into inbuf
for (int j = 0; j < available_input; ++j)
{
inbuf[j] = *i;
++i;
}
// encode inbuf to outbuf
outbuf[0] = (inbuf[0] & 0xfc) >> 2;
outbuf[1] = ((inbuf[0] & 0x03) << 4) | ((inbuf [1] & 0xf0) >> 4);
outbuf[2] = ((inbuf[1] & 0x0f) << 2) | ((inbuf [2] & 0xc0) >> 6);
outbuf[3] = inbuf[2] & 0x3f;
// write output
for (int j = 0; j < available_input+1; ++j)
{
ret += base64_table[outbuf[j]];
}
// write pad
for (int j = 0; j < 3 - available_input; ++j)
{
ret += '=';
}
}
return ret;
}
timeout_handler::timeout_handler(asio::strand& str)
: m_strand(str)
, m_start_time(time_now())
, m_read_time(time_now())
, m_timeout(str.io_service())
, m_completion_timeout(0)
, m_read_timeout(0)
, m_abort(false)
{}
void timeout_handler::set_timeout(int completion_timeout, int read_timeout)
{
m_completion_timeout = completion_timeout;
m_read_timeout = read_timeout;
m_start_time = m_read_time = time_now();
if (m_abort) return;
int timeout = (std::min)(
m_read_timeout, (std::min)(m_completion_timeout, m_read_timeout));
m_timeout.expires_at(m_read_time + seconds(timeout));
m_timeout.async_wait(m_strand.wrap(bind(
&timeout_handler::timeout_callback, self(), _1)));
}
void timeout_handler::restart_read_timeout()
{
m_read_time = time_now();
}
void timeout_handler::cancel()
{
m_abort = true;
m_completion_timeout = 0;
m_timeout.cancel();
}
void timeout_handler::timeout_callback(asio::error_code const& error) try
{
if (error) return;
if (m_completion_timeout == 0) return;
ptime now(time_now());
time_duration receive_timeout = now - m_read_time;
time_duration completion_timeout = now - m_start_time;
if (m_read_timeout
< total_seconds(receive_timeout)
|| m_completion_timeout
< total_seconds(completion_timeout))
{
on_timeout();
return;
}
if (m_abort) return;
int timeout = (std::min)(
m_read_timeout, (std::min)(m_completion_timeout, m_read_timeout));
m_timeout.expires_at(m_read_time + seconds(timeout));
m_timeout.async_wait(m_strand.wrap(
bind(&timeout_handler::timeout_callback, self(), _1)));
}
catch (std::exception&)
{
TORRENT_ASSERT(false);
}
tracker_connection::tracker_connection(
tracker_manager& man
, tracker_request const& req
, asio::strand& str
, address bind_interface_
, boost::weak_ptr<request_callback> r)
: timeout_handler(str)
, m_requester(r)
, m_bind_interface(bind_interface_)
, m_man(man)
, m_req(req)
{}
boost::shared_ptr<request_callback> tracker_connection::requester()
{
return m_requester.lock();
}
void tracker_connection::fail(int code, char const* msg)
{
boost::shared_ptr<request_callback> cb = requester();
if (cb) cb->tracker_request_error(m_req, code, msg);
close();
}
void tracker_connection::fail_timeout()
{
boost::shared_ptr<request_callback> cb = requester();
if (cb) cb->tracker_request_timed_out(m_req);
close();
}
void tracker_connection::close()
{
cancel();
m_man.remove_request(this);
}
void tracker_manager::remove_request(tracker_connection const* c)
{
mutex_t::scoped_lock l(m_mutex);
tracker_connections_t::iterator i = std::find(m_connections.begin()
, m_connections.end(), boost::intrusive_ptr<const tracker_connection>(c));
if (i == m_connections.end()) return;
m_connections.erase(i);
}
// returns protocol, auth, hostname, port, path
tuple<std::string, std::string, std::string, int, std::string>
parse_url_components(std::string url)
{
std::string hostname; // hostname only
std::string auth; // user:pass
std::string protocol; // should be http
int port = 80;
// PARSE URL
std::string::iterator start = url.begin();
// remove white spaces in front of the url
while (start != url.end() && (*start == ' ' || *start == '\t'))
++start;
std::string::iterator end
= std::find(url.begin(), url.end(), ':');
protocol.assign(start, end);
if (end == url.end()) throw std::runtime_error("invalid url '" + url + "'");
++end;
if (end == url.end()) throw std::runtime_error("invalid url '" + url + "'");
if (*end != '/') throw std::runtime_error("invalid url '" + url + "'");
++end;
if (end == url.end()) throw std::runtime_error("invalid url '" + url + "'");
if (*end != '/') throw std::runtime_error("invalid url '" + url + "'");
++end;
start = end;
std::string::iterator at = std::find(start, url.end(), '@');
std::string::iterator colon = std::find(start, url.end(), ':');
end = std::find(start, url.end(), '/');
if (at != url.end()
&& colon != url.end()
&& colon < at
&& at < end)
{
auth.assign(start, at);
start = at;
++start;
}
std::string::iterator port_pos;
// this is for IPv6 addresses
if (start != url.end() && *start == '[')
{
port_pos = std::find(start, url.end(), ']');
if (port_pos == url.end()) throw std::runtime_error("invalid hostname syntax '" + url + "'");
port_pos = std::find(port_pos, url.end(), ':');
}
else
{
port_pos = std::find(start, url.end(), ':');
}
if (port_pos < end)
{
hostname.assign(start, port_pos);
++port_pos;
try
{
port = boost::lexical_cast<int>(std::string(port_pos, end));
}
catch(boost::bad_lexical_cast&)
{
throw std::runtime_error("invalid url: \"" + url
+ "\", port number expected");
}
}
else
{
hostname.assign(start, end);
}
start = end;
return make_tuple(protocol, auth, hostname, port
, std::string(start, url.end()));
}
void tracker_manager::queue_request(
asio::strand& str
, connection_queue& cc
, tracker_request req
, std::string const& auth
, address bind_infc
, boost::weak_ptr<request_callback> c)
{
mutex_t::scoped_lock l(m_mutex);
TORRENT_ASSERT(req.num_want >= 0);
if (req.event == tracker_request::stopped)
req.num_want = 0;
TORRENT_ASSERT(!m_abort || req.event == tracker_request::stopped);
if (m_abort && req.event != tracker_request::stopped)
return;
try
{
std::string protocol;
std::string hostname;
int port;
std::string request_string;
using boost::tuples::ignore;
// TODO: should auth be used here?
boost::tie(protocol, ignore, hostname, port, request_string)
= parse_url_components(req.url);
boost::intrusive_ptr<tracker_connection> con;
if (protocol == "http")
{
con = new http_tracker_connection(
str
, cc
, *this
, req
, hostname
, port
, request_string
, bind_infc
, c
, m_settings
, m_proxy
, auth);
}
else if (protocol == "udp")
{
con = new udp_tracker_connection(
str
, *this
, req
, hostname
, port
, bind_infc
, c
, m_settings);
}
else
{
throw std::runtime_error("unkown protocol in tracker url");
}
m_connections.push_back(con);
boost::shared_ptr<request_callback> cb = con->requester();
if (cb) cb->m_manager = this;
}
catch (std::exception& e)
{
if (boost::shared_ptr<request_callback> r = c.lock())
r->tracker_request_error(req, -1, e.what());
}
}
void tracker_manager::abort_all_requests()
{
// removes all connections from m_connections
// except those with a requester == 0 (since those are
// 'event=stopped'-requests)
mutex_t::scoped_lock l(m_mutex);
m_abort = true;
tracker_connections_t keep_connections;
while (!m_connections.empty())
{
boost::intrusive_ptr<tracker_connection>& c = m_connections.back();
if (!c)
{
m_connections.pop_back();
continue;
}
tracker_request const& req = c->tracker_req();
if (req.event == tracker_request::stopped)
{
keep_connections.push_back(c);
m_connections.pop_back();
continue;
}
// close will remove the entry from m_connections
// so no need to pop
c->close();
}
std::swap(m_connections, keep_connections);
}
bool tracker_manager::empty() const
{
mutex_t::scoped_lock l(m_mutex);
return m_connections.empty();
}
int tracker_manager::num_requests() const
{
mutex_t::scoped_lock l(m_mutex);
return m_connections.size();
}
}
| 24.608197 | 96 | 0.651456 | importlib |
b38c0e0d9c3330e7bea5bd829fe6bbf9063acaf3 | 7,847 | cpp | C++ | vipster/step.py.cpp | hein09/vipster | b92302bf2bb8b8941e239ce8cbc7209e1e615b0b | [
"BSD-2-Clause"
] | 6 | 2015-12-02T15:33:27.000Z | 2017-07-28T17:46:51.000Z | vipster/step.py.cpp | hein09/vipster | b92302bf2bb8b8941e239ce8cbc7209e1e615b0b | [
"BSD-2-Clause"
] | 3 | 2018-02-04T16:11:19.000Z | 2018-03-16T16:23:29.000Z | vipster/step.py.cpp | hein09/vipster | b92302bf2bb8b8941e239ce8cbc7209e1e615b0b | [
"BSD-2-Clause"
] | 1 | 2017-07-05T11:44:55.000Z | 2017-07-05T11:44:55.000Z | #include "step.py.h"
#include "step.h"
#include <utility>
using namespace Vipster;
/* FIXME: Optimize assignment
*
* problems so far:
* - assignment from formatter not working as intended, library problem?
* - assignment to sub-steps not working, types mapped multiple times
* -> pybind/python can't deduce correct overload at RT
* - bindings are not templated -> confined to one atom_source hierarchy
*
* Possible solutions:
* - Introduce a standalone atom to allow for conversion between hierarchies
* (probably slow, but only when working within python)
* could also solve the problem of comparability
* - bind formatter/selection within bind_step so assignments can refer to concrete instances
* of the whole hierarchy (better)
* OR
* remove duplicate bindings via constexpr if and detail::is_selection/is_formatter (worse)
*/
template <typename S, typename A>
void __setitem__(S& s, int i, const A& at){
if (i<0){
i = i+static_cast<int>(s.getNat());
}
if ((i<0) || i>=static_cast<int>(s.getNat())){
throw py::index_error();
}
s[static_cast<size_t>(i)] = at;
}
template <typename S>
py::class_<S> bind_step(py::handle &m, std::string name){
py::class_<StepConst<typename S::atom_source>>(m, ("__"+name+"Base").c_str());
auto s = py::class_<S, StepConst<typename S::atom_source>>(m, name.c_str())
.def("getPTE", &S::getPTE)
.def_property("comment", &S::getComment, &S::setComment)
// Atoms
.def("__getitem__", [](S& s, int i){
if (i<0){
i = i+static_cast<int>(s.getNat());
}
if ((i<0) || i>=static_cast<int>(s.getNat())){
throw py::index_error();
}
return s[static_cast<size_t>(i)];
}, py::keep_alive<0, 1>())
.def("__setitem__", __setitem__<S, typename S::atom>)
.def("__setitem__", __setitem__<S, typename S::formatter::atom>)
.def("__setitem__", __setitem__<S, typename S::selection::atom>)
.def("__setitem__", __setitem__<S, typename S::formatter::selection::atom>)
.def("__len__", &S::getNat)
.def_property_readonly("nat", &S::getNat)
.def("__iter__", [](S& s){return py::make_iterator(s.begin(), s.end());})
// TYPES
.def("getTypes", [](const S& s){
auto oldT = s.getTypes();
return std::vector<std::string>(oldT.begin(), oldT.end());
})
.def_property_readonly("ntyp", &S::getNtyp)
// FMT
.def_property_readonly("fmt", &S::getFmt)
.def("asFmt", py::overload_cast<AtomFmt>(&S::asFmt), "fmt"_a)
// CELL
.def_property_readonly("hasCell", &S::hasCell)
.def("getCellDim", &S::getCellDim)
.def("getCellVec", &S::getCellVec)
.def("getCom", py::overload_cast<>(&S::getCom, py::const_))
.def("getCom", py::overload_cast<AtomFmt>(&S::getCom, py::const_), "fmt"_a)
.def("getCenter", &S::getCenter, "fmt"_a, "com"_a)
// BONDS
.def("getBonds", [](const S& s, bool update){
if(update){
s.generateBonds();
}
return s.getBonds();
}, "update"_a=true)
.def("generateBonds", &S::generateBonds, "overlap_only"_a=false)
.def("getOverlaps", &S::getOverlaps)
.def("getTopology", &S::getTopology, "angles"_a=true, "dihedrals"_a=true, "impropers"_a=true)
// SELECTION
.def("select", [](S &s, const std::string &sel){return s.select(sel);}, "selection"_a)
// Modification functions
.def("modShift", &S::modShift, "shift"_a, "factor"_a=1.0f)
.def("modRotate", &S::modRotate, "angle"_a, "axis"_a, "shift"_a=Vec{})
.def("modMirror", &S::modMirror, "axis1"_a, "axis1"_a, "shift"_a=Vec{})
;
using Atom = typename S::atom;
using _Vec = decltype(std::declval<typename S::atom>().coord);
auto a = py::class_<Atom>(s, "Atom")
.def_property("name", [](const Atom &a)->const std::string&{return a.name;},
[](Atom &a, const std::string &s){a.name = s;})
.def_property("coord", [](const Atom &a)->const _Vec&{return a.coord;},
[](Atom &a, Vec c){a.coord = c;})
.def_property("properties", [](const Atom &a)->const AtomProperties&{return a.properties;},
[](Atom &a, const AtomProperties &bs){a.properties = bs;})
// .def("__eq__", [](const Atom &lhs, const Atom &rhs){return lhs == rhs;},py::is_operator())
// .def(py::self == py::self)
// .def(py::self != py::self)
;
py::class_<_Vec>(a, "_Vec")
.def("__getitem__", [](const _Vec& v, int i) -> Vec::value_type{
if (i<0) {
i += 3;
}
if ((i<0) || (i>=3)) {
throw py::index_error();
}
return v[i];
})
.def("__setitem__", [](_Vec& v, int i, Vec::value_type val){
if (i<0) {
i += 3;
}
if ((i<0) || (i>=3)) {
throw py::index_error();
}
v[i] = val;
}, py::keep_alive<0, 1>())
.def("__repr__", [name](const _Vec& v){
return name + "::Atom::Vec["
+ std::to_string(v[0]) + ", "
+ std::to_string(v[1]) + ", "
+ std::to_string(v[2]) + "]";
})
.def(py::self == py::self)
.def(py::self == Vec())
;
return s;
}
void Vipster::Py::Step(py::module& m){
auto s = bind_step<Vipster::Step>(m, "Step")
.def(py::init<AtomFmt, std::string>(), "fmt"_a=AtomFmt::Angstrom, "comment"_a="")
// Format
.def("setFmt", &Step::setFmt, "fmt"_a, "scale"_a=true)
// Atoms
.def("newAtom", [](Vipster::Step& s, std::string name, Vec coord, AtomProperties prop){
s.newAtom(name, coord, prop);},
"name"_a="", "coord"_a=Vec{}, "properties"_a=AtomProperties{})
.def("newAtom", [](Vipster::Step& s, const Step::atom& at){s.newAtom(at);}, "at"_a)
.def("newAtom", [](Vipster::Step& s, const Step::formatter::atom& at){s.newAtom(at);}, "at"_a)
.def("newAtom", [](Vipster::Step& s, const Step::selection::atom& at){s.newAtom(at);}, "at"_a)
.def("newAtom", [](Vipster::Step& s, const Step::selection::formatter::atom& at){s.newAtom(at);}, "at"_a)
.def("newAtoms", [](Vipster::Step& s, size_t i){s.newAtoms(i);}, "i"_a)
.def("newAtoms", [](Vipster::Step& s, const Vipster::Step& rhs){s.newAtoms(rhs);}, "step"_a)
.def("newAtoms", [](Vipster::Step& s, const Vipster::Step::formatter& rhs){s.newAtoms(rhs);}, "step"_a)
.def("newAtoms", [](Vipster::Step& s, const Vipster::Step::selection& rhs){s.newAtoms(rhs);}, "step"_a)
.def("newAtoms", [](Vipster::Step& s, const Vipster::Step::selection::formatter& rhs){s.newAtoms(rhs);}, "step"_a)
.def("delAtom", [](Vipster::Step& s, size_t i){s.delAtom(i);}, "i"_a)
// CELL
.def("enableCell", &Vipster::Step::enableCell, "val"_a)
.def("setCellDim", &Vipster::Step::setCellDim, "cdm"_a, "fmt"_a, "scale"_a=false)
.def("setCellVec", &Vipster::Step::setCellVec, "vec"_a, "scale"_a=false)
// Modification functions
.def("modWrap", &Step::modWrap)
.def("modCrop", &Step::modCrop)
.def("modMultiply", &Step::modMultiply, "x"_a, "y"_a, "z"_a)
.def("modAlign", &Step::modAlign, "step_dir"_a, "target_dir"_a)
.def("modReshape", &Step::modReshape, "newMat"_a, "newCdm"_a, "cdmFmt"_a)
;
auto sf = bind_step<Vipster::Step::formatter>(s, "__Formatter");
bind_step<Vipster::Step::selection>(s, "__Selection");
bind_step<Vipster::Step::formatter::selection>(sf, "__Selection");
}
| 44.84 | 122 | 0.555626 | hein09 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.