diff --git a/.gitignore b/.gitignore index ccb24eb..0ae0dc7 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,6 @@ compile_commands.json build/ .vscode/ .clangd/ +.RData +.Rhistory +*.Rout diff --git a/CMakeLists.txt b/CMakeLists.txt index bf10ad8..d7d4302 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,11 +67,11 @@ set(boost_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/boost) ExternalProject_Add( boost PREFIX ${boost_PREFIX} - URL "http://netcologne.dl.sourceforge.net/project/boost/boost/1.69.0/boost_1_69_0.tar.gz" - URL_MD5 "b50944c0c13f81ce2c006802a1186f5a" - CONFIGURE_COMMAND ${boost_PREFIX}/src/boost/bootstrap.sh --with-libraries=serialization,filesystem,system,program_options,iostreams --prefix=${boost_PREFIX} - BUILD_COMMAND ./bjam link=static cxxflags='-fPIC' - INSTALL_COMMAND ./bjam link=static install + URL "https://dl.bintray.com/boostorg/release/1.72.0/source/boost_1_72_0.tar.gz" + URL_MD5 "e2b0b1eac302880461bcbef097171758" + CONFIGURE_COMMAND ${boost_PREFIX}/src/boost/bootstrap.sh --with-libraries=serialization,filesystem,system,program_options,iostreams,regex --prefix=${boost_PREFIX} + BUILD_COMMAND ./b2 link=static cxxflags='-fPIC' + INSTALL_COMMAND ./b2 link=static install BUILD_IN_SOURCE 1 LOG_UPDATE ON LOG_CONFIGURE ON @@ -87,8 +87,8 @@ ExternalProject_Add( thrift PREFIX ${thrift_PREFIX} DEPENDS boost - URL "http://www-eu.apache.org/dist/thrift/0.12.0/thrift-0.12.0.tar.gz" - URL_MD5 "3deebbb4d1ca77dd9c9e009a1ea02183" + URL "https://www-eu.apache.org/dist/thrift/0.13.0/thrift-0.13.0.tar.gz" + URL_MD5 "38a27d391a2b03214b444cb13d5664f1" CONFIGURE_COMMAND CXX=${CMAKE_CXX_COMPILER} CC=${CMAKE_C_COMPILER} ${thrift_PREFIX}/src/thrift/configure --prefix=${thrift_PREFIX} --libdir=${thrift_PREFIX}/lib --with-boost=${Boost_INCLUDE_DIRS} --enable-shared=no --with-libevent=no --with-c_glib=no --with-java=no --with-erlang=no --with-python=no --with-perl=no --with-php=no --with-php_extension=no --with-ruby=no --with-haskell=no --with-go=no --with-d=no --with-lua=no --with-qt4=no --with-qt5=no --with-nodejs=no --with-cl=no --with-dotnetcore=no --with-nodets=no --with-rs=no --disable-tests --enable-plugin=no BUILD_COMMAND $(MAKE) INSTALL_COMMAND $(MAKE) install @@ -118,8 +118,8 @@ set(protobuf_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/protobuf) ExternalProject_Add( protobuf PREFIX ${protobuf_PREFIX} - URL "https://github.com/protocolbuffers/protobuf/releases/download/v3.7.0/protobuf-cpp-3.7.0.tar.gz" - URL_MD5 "f1631a8e551e569273d78538f6ecf41c" + URL "https://github.com/protocolbuffers/protobuf/releases/download/v3.11.2/protobuf-cpp-3.11.2.tar.gz" + URL_MD5 "351a0f5c4edd3f45035417f09133ce73" CONFIGURE_COMMAND CXX=${CMAKE_CXX_COMPILER} CC=${CMAKE_C_COMPILER} ${protobuf_PREFIX}/src/protobuf/configure --prefix=${protobuf_PREFIX} --libdir=${protobuf_PREFIX}/lib --enable-shared=no BUILD_COMMAND $(MAKE) INSTALL_COMMAND $(MAKE) install @@ -153,8 +153,8 @@ set(cereal_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/cereal) ExternalProject_Add( cereal PREFIX ${cereal_PREFIX} - URL "https://github.com/USCiLab/cereal/archive/v1.2.2.tar.gz" - URL_MD5 "4c56c7b9499dba79404250ef9a040481" + URL "https://github.com/USCiLab/cereal/archive/v1.3.0.tar.gz" + URL_MD5 "4342e811f245403646c4175258f413f1" CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND mkdir -p ${cereal_PREFIX}/include/ && cp -r ${cereal_PREFIX}/src/cereal/include/cereal ${cereal_PREFIX}/include/ @@ -165,8 +165,8 @@ ExternalProject_Add( avro DEPENDS boost PREFIX ${avro_PREFIX} - URL "https://github.com/apache/avro/archive/release-1.8.2.tar.gz" - URL_MD5 "dcaa6eaa0c0854c535b9daf1c024cb35" + URL "https://github.com/apache/avro/archive/release-1.9.1.tar.gz" + URL_MD5 "2929b6ee91070fe0f2f6e683c7892104" CONFIGURE_COMMAND cmake -DBOOST_INCLUDEDIR=${boost_PREFIX}/include -DBOOST_LIBRARYDIR=${boost_PREFIX}/lib -DBoost_NO_SYSTEM_PATHS=ON -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=${avro_PREFIX} -DBUILD_SHARED_LIBS=OFF ${avro_PREFIX}/src/avro/lang/c++/ # Due to some issues with using statically built boost libraries AND zlib in avro tests # build only necessary parts and install them in a very hackish way. @@ -183,8 +183,8 @@ set(flatbuffers_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/flatbuffers) ExternalProject_Add( flatbuffers PREFIX ${flatbuffers_PREFIX} - URL "https://github.com/google/flatbuffers/archive/v1.10.0.tar.gz" - URL_MD5 "f7d19a3f021d93422b0bc287d7148cd2" + URL "https://github.com/google/flatbuffers/archive/v1.11.0.tar.gz" + URL_MD5 "02c64880acb89dbd57eebacfd67200d8" CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${flatbuffers_PREFIX} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} LOG_UPDATE ON LOG_CONFIGURE ON @@ -197,8 +197,8 @@ set(yas_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/yas) ExternalProject_Add( yas PREFIX ${yas_PREFIX} - URL "https://github.com/niXman/yas/archive/7.0.2.tar.gz" - URL_MD5 "d55353960467afabc6774583880a30f0" + URL "https://github.com/niXman/yas/archive/7.0.5.tar.gz" + URL_MD5 "8c666d29575c8cafe9cea1fc2946253e" CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND mkdir -p ${yas_PREFIX}/include/ && cp -r ${yas_PREFIX}/src/yas/include/yas ${yas_PREFIX}/include/ diff --git a/avro/record.hpp b/avro/record.hpp index cb36931..6504300 100644 --- a/avro/record.hpp +++ b/avro/record.hpp @@ -7,7 +7,7 @@ * "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 + * https://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, @@ -17,8 +17,8 @@ */ -#ifndef _HOME_PKOK_CPP_SERIALIZERS_AVRO_RECORD_HPP_2710640864__H_ -#define _HOME_PKOK_CPP_SERIALIZERS_AVRO_RECORD_HPP_2710640864__H_ +#ifndef _HOME_PKOK_DROPBOX_UNIVERSITY_THESIS_CPP_SERIALIZERS_AVRO_RECORD_HPP_2093218524__H_ +#define _HOME_PKOK_DROPBOX_UNIVERSITY_THESIS_CPP_SERIALIZERS_AVRO_RECORD_HPP_2093218524__H_ #include diff --git a/flatbuffers/test_generated.h b/flatbuffers/test_generated.h index 9e009b0..93d3670 100644 --- a/flatbuffers/test_generated.h +++ b/flatbuffers/test_generated.h @@ -11,7 +11,7 @@ namespace flatbuffers_test { struct Record; struct Record FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - enum { + enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { VT_IDS = 4, VT_STRINGS = 6 }; @@ -67,10 +67,12 @@ inline flatbuffers::Offset CreateRecordDirect( flatbuffers::FlatBufferBuilder &_fbb, const std::vector *ids = nullptr, const std::vector> *strings = nullptr) { + auto ids__ = ids ? _fbb.CreateVector(*ids) : 0; + auto strings__ = strings ? _fbb.CreateVector>(*strings) : 0; return flatbuffers_test::CreateRecord( _fbb, - ids ? _fbb.CreateVector(*ids) : 0, - strings ? _fbb.CreateVector>(*strings) : 0); + ids__, + strings__); } inline const flatbuffers_test::Record *GetRecord(const void *buf) { diff --git a/images/generate_graph_data.sh b/images/generate_graph_data.sh new file mode 100755 index 0000000..04dc687 --- /dev/null +++ b/images/generate_graph_data.sh @@ -0,0 +1,49 @@ +#!/bin/bash +ITERATIONS=1000000 +RESTARTS=50 +BENCHMARK="../build/benchmark" + +if [ ! -f ${BENCHMARK} ]; then + echo "Error: executable build/benchmark not found" + exit 1 +fi + +echo "-- Generating data for images/graphs.R..." +echo "-- Substitute lines 9 through 19 with this:" +c=" " +for t in thrift-binary thrift-compact protobuf boost msgpack cereal avro capnproto flatbuffers yas yas-compact; +do + ${BENCHMARK} -i 1 -s $t | grep Size | awk "{printf \"%s%d # %s\n\", \"$c\", \$3, \"$t\"}" + c="," +done + +echo "" +echo "-- Substitute lines 23 through 31 with this:" +c=" " +for t in thrift-binary thrift-compact protobuf boost msgpack cereal avro yas yas-compact; +do + rm -f /tmp/$t.time + for i in `seq 1 ${RESTARTS}` + do + ${BENCHMARK} -i ${ITERATIONS} -s $t | grep Time | awk '{print $3}' >>/tmp/$t.time + done; + awk "{ sum += \$1 } END {printf \"%s%f # %s\n\", \"$c\", sum/50, \"$t\"}" /tmp/$t.time + c="," +done + +echo "" +echo "-- Substitute lines 35 and 36 with this:" +c=" " +for t in capnproto flatbuffers; +do + rm -f /tmp/$t.time; + for i in `seq 1 ${RESTARTS}`; + do + ${BENCHMARK} -i ${ITERATIONS} -s $t | grep Time | awk '{print $3}' >>/tmp/$t.time + done; + awk "{ sum += \$1 } END {printf \"%s%f # %s\n\", \"$c\", sum/50, \"$t\"}" /tmp/$t.time + c="," +done + +echo "-- Run the following command to generate the new images:" +echo " R CMD BATCH images/graphs.R" diff --git a/images/graphs.R b/images/graphs.R index 9a362b4..96be615 100644 --- a/images/graphs.R +++ b/images/graphs.R @@ -4,7 +4,7 @@ names.size <- c("thrift-binary", "thrift-compact", "protobuf", "boost", "msgpack names.time <- c("thrift-binary", "thrift-compact", "protobuf", "boost", "msgpack", "cereal", "avro", "yas", "yas-compact") names.time2 <- c("capnproto", "flatbuffers") # data from the 1000000 simulations -# for t in thrift-binary thrift-compact protobuf boost msgpack cereal avro yas yas-compact; do echo -n "$t: "; ./benchmark 1 $t | grep size | awk '{print $4}'; done +# c=" "; for t in thrift-binary thrift-compact protobuf boost msgpack cereal avro capnproto flatbuffers yas yas-compact; do ${BENCHMARK} -i 1 -s $t | grep Size | awk "{printf \"%s%d # %s\n\", \"$c\", \$3, \"$t\"}"; c=","; done size <- c( 17017 # thrift-binary ,13378 # thrift-compact @@ -18,21 +18,22 @@ size <- c( ,17416 # yas ,13321 # yas-compact ) -# for t in thrift-binary thrift-compact protobuf boost msgpack cereal avro yas yas-compact; do rm -f /tmp/$t.time; echo -n "$t: "; for i in `seq 1 50`; do ./benchmark 1000000 $t | grep time | awk '{print $4}' >>/tmp/$t.time; done; awk '{ sum += $1 } END { print sum/50}' /tmp/$t.time; done +# c=" "; for t in thrift-binary thrift-compact protobuf boost msgpack cereal avro yas yas-compact; do rm -f /tmp/$t.time; for i in `seq 1 ${RESTARTS}`; do ${BENCHMARK} -i ${ITERATIONS} -s $t | grep Time | awk '{print $3}' >>/tmp/$t.time; done; awk "{ sum += \$1 } END {printf \"%s%f # %s\n\", \"$c\", sum/50, \"$t\"}" /tmp/$t.time; c=","; done time <- c( - 1190.22 # thrift-binary - ,3474.32 # thrift-compact - ,2312.78 # protobuf - ,1195.04 # boost - ,2560.6 # msgpack - ,1052.46 # cereal - ,4488.18 # avro - ,302.7 # yas - ,2063.34 # yas-compact + 13795.100000 # thrift-binary + ,41831.280000 # thrift-compact + ,30041.420000 # protobuf + ,14231.320000 # boost + ,31668.700000 # msgpack + ,14203.780000 # cereal + ,55352.740000 # avro + ,3307.360000 # yas + ,28981.900000 # yas-compact ) +# c=" "; for t in capnproto flatbuffers; do rm -f /tmp/$t.time; for i in `seq 1 ${RESTARTS}`; do ${BENCHMARK} -i ${ITERATIONS} -s $t | grep Time | awk '{print $3}' >>/tmp/$t.time; done; awk "{ sum += \$1 } END {printf \"%s%f # %s\n\", \"$c\", sum/50, \"$t\"}" /tmp/$t.time; c=","; done time2 <- c( - 400.98 # capnproto - ,491.5 # flatbuffers + 4512.320000 # capnproto + ,5821.920000 # flatbuffers ) data.size <- as.data.frame(list(serializer = names.size, size = size)) diff --git a/images/size.png b/images/size.png index da9c7b0..1389dc7 100644 Binary files a/images/size.png and b/images/size.png differ diff --git a/images/time.png b/images/time.png index 1abdc74..f90d930 100644 Binary files a/images/time.png and b/images/time.png differ diff --git a/images/time2.png b/images/time2.png index d99cf84..06449da 100644 Binary files a/images/time2.png and b/images/time2.png differ diff --git a/protobuf/test.pb.cc b/protobuf/test.pb.cc index f10a89a..0d909cb 100644 --- a/protobuf/test.pb.cc +++ b/protobuf/test.pb.cc @@ -5,46 +5,40 @@ #include -#include #include #include -#include +#include #include #include #include #include // @@protoc_insertion_point(includes) #include - namespace protobuf_test { class RecordDefaultTypeInternal { public: - ::google::protobuf::internal::ExplicitlyConstructed _instance; + ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; } _Record_default_instance_; } // namespace protobuf_test -static void InitDefaultsRecord_test_2eproto() { +static void InitDefaultsscc_info_Record_test_2eproto() { GOOGLE_PROTOBUF_VERIFY_VERSION; { void* ptr = &::protobuf_test::_Record_default_instance_; new (ptr) ::protobuf_test::Record(); - ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); } ::protobuf_test::Record::InitAsDefaultInstance(); } -::google::protobuf::internal::SCCInfo<0> scc_info_Record_test_2eproto = - {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsRecord_test_2eproto}, {}}; - -void InitDefaults_test_2eproto() { - ::google::protobuf::internal::InitSCC(&scc_info_Record_test_2eproto.base); -} +::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_Record_test_2eproto = + {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_Record_test_2eproto}, {}}; -::google::protobuf::Metadata file_level_metadata_test_2eproto[1]; -constexpr ::google::protobuf::EnumDescriptor const** file_level_enum_descriptors_test_2eproto = nullptr; -constexpr ::google::protobuf::ServiceDescriptor const** file_level_service_descriptors_test_2eproto = nullptr; +static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_test_2eproto[1]; +static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_test_2eproto = nullptr; +static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_test_2eproto = nullptr; -const ::google::protobuf::uint32 TableStruct_test_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { +const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_test_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::protobuf_test::Record, _internal_metadata_), ~0u, // no _extensions_ @@ -53,61 +47,51 @@ const ::google::protobuf::uint32 TableStruct_test_2eproto::offsets[] PROTOBUF_SE PROTOBUF_FIELD_OFFSET(::protobuf_test::Record, ids_), PROTOBUF_FIELD_OFFSET(::protobuf_test::Record, strings_), }; -static const ::google::protobuf::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { +static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { { 0, -1, sizeof(::protobuf_test::Record)}, }; -static ::google::protobuf::Message const * const file_default_instances[] = { - reinterpret_cast(&::protobuf_test::_Record_default_instance_), +static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = { + reinterpret_cast(&::protobuf_test::_Record_default_instance_), }; -::google::protobuf::internal::AssignDescriptorsTable assign_descriptors_table_test_2eproto = { - {}, AddDescriptors_test_2eproto, "test.proto", schemas, - file_default_instances, TableStruct_test_2eproto::offsets, - file_level_metadata_test_2eproto, 1, file_level_enum_descriptors_test_2eproto, file_level_service_descriptors_test_2eproto, -}; - -const char descriptor_table_protodef_test_2eproto[] = +const char descriptor_table_protodef_test_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = "\n\ntest.proto\022\rprotobuf_test\"&\n\006Record\022\013\n" "\003ids\030\001 \003(\003\022\017\n\007strings\030\002 \003(\tb\006proto3" ; -::google::protobuf::internal::DescriptorTable descriptor_table_test_2eproto = { - false, InitDefaults_test_2eproto, - descriptor_table_protodef_test_2eproto, - "test.proto", &assign_descriptors_table_test_2eproto, 75, +static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_test_2eproto_deps[1] = { +}; +static ::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase*const descriptor_table_test_2eproto_sccs[1] = { + &scc_info_Record_test_2eproto.base, +}; +static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_test_2eproto_once; +static bool descriptor_table_test_2eproto_initialized = false; +const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_test_2eproto = { + &descriptor_table_test_2eproto_initialized, descriptor_table_protodef_test_2eproto, "test.proto", 75, + &descriptor_table_test_2eproto_once, descriptor_table_test_2eproto_sccs, descriptor_table_test_2eproto_deps, 1, 0, + schemas, file_default_instances, TableStruct_test_2eproto::offsets, + file_level_metadata_test_2eproto, 1, file_level_enum_descriptors_test_2eproto, file_level_service_descriptors_test_2eproto, }; - -void AddDescriptors_test_2eproto() { - static constexpr ::google::protobuf::internal::InitFunc deps[1] = - { - }; - ::google::protobuf::internal::AddDescriptors(&descriptor_table_test_2eproto, deps, 0); -} // Force running AddDescriptors() at dynamic initialization time. -static bool dynamic_init_dummy_test_2eproto = []() { AddDescriptors_test_2eproto(); return true; }(); +static bool dynamic_init_dummy_test_2eproto = ( ::PROTOBUF_NAMESPACE_ID::internal::AddDescriptors(&descriptor_table_test_2eproto), true); namespace protobuf_test { // =================================================================== void Record::InitAsDefaultInstance() { } -class Record::HasBitSetters { +class Record::_Internal { public: }; -#if !defined(_MSC_VER) || _MSC_VER >= 1900 -const int Record::kIdsFieldNumber; -const int Record::kStringsFieldNumber; -#endif // !defined(_MSC_VER) || _MSC_VER >= 1900 - Record::Record() - : ::google::protobuf::Message(), _internal_metadata_(nullptr) { + : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) { SharedCtor(); // @@protoc_insertion_point(constructor:protobuf_test.Record) } Record::Record(const Record& from) - : ::google::protobuf::Message(), + : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr), ids_(from.ids_), strings_(from.strings_) { @@ -116,8 +100,7 @@ Record::Record(const Record& from) } void Record::SharedCtor() { - ::google::protobuf::internal::InitSCC( - &scc_info_Record_test_2eproto.base); + ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_Record_test_2eproto.base); } Record::~Record() { @@ -132,14 +115,14 @@ void Record::SetCachedSize(int size) const { _cached_size_.Set(size); } const Record& Record::default_instance() { - ::google::protobuf::internal::InitSCC(&::scc_info_Record_test_2eproto.base); + ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_Record_test_2eproto.base); return *internal_default_instance(); } void Record::Clear() { // @@protoc_insertion_point(message_clear_start:protobuf_test.Record) - ::google::protobuf::uint32 cached_has_bits = 0; + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -148,211 +131,85 @@ void Record::Clear() { _internal_metadata_.Clear(); } -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -const char* Record::_InternalParse(const char* begin, const char* end, void* object, - ::google::protobuf::internal::ParseContext* ctx) { - auto msg = static_cast(object); - ::google::protobuf::int32 size; (void)size; - int depth; (void)depth; - ::google::protobuf::uint32 tag; - ::google::protobuf::internal::ParseFunc parser_till_end; (void)parser_till_end; - auto ptr = begin; - while (ptr < end) { - ptr = ::google::protobuf::io::Parse32(ptr, &tag); - GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); +const char* Record::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + ::PROTOBUF_NAMESPACE_ID::uint32 tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + CHK_(ptr); switch (tag >> 3) { // repeated int64 ids = 1; - case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == 10) { - ptr = ::google::protobuf::io::ReadSize(ptr, &size); - GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); - parser_till_end = ::google::protobuf::internal::PackedInt64Parser; - object = msg->mutable_ids(); - if (size > end - ptr) goto len_delim_till_end; - auto newend = ptr + size; - if (size) ptr = parser_till_end(ptr, newend, object, ctx); - GOOGLE_PROTOBUF_PARSER_ASSERT(ptr == newend); - break; - } else if (static_cast<::google::protobuf::uint8>(tag) != 8) goto handle_unusual; - do { - msg->add_ids(::google::protobuf::internal::ReadVarint(&ptr)); - GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); - if (ptr >= end) break; - } while ((::google::protobuf::io::UnalignedLoad<::google::protobuf::uint64>(ptr) & 255) == 8 && (ptr += 1)); - break; - } + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedInt64Parser(_internal_mutable_ids(), ptr, ctx); + CHK_(ptr); + } else if (static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8) { + _internal_add_ids(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr)); + CHK_(ptr); + } else goto handle_unusual; + continue; // repeated string strings = 2; - case 2: { - if (static_cast<::google::protobuf::uint8>(tag) != 18) goto handle_unusual; - do { - ptr = ::google::protobuf::io::ReadSize(ptr, &size); - GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); - ctx->extra_parse_data().SetFieldName("protobuf_test.Record.strings"); - object = msg->add_strings(); - if (size > end - ptr + ::google::protobuf::internal::ParseContext::kSlopBytes) { - parser_till_end = ::google::protobuf::internal::GreedyStringParserUTF8; - goto string_till_end; - } - GOOGLE_PROTOBUF_PARSER_ASSERT(::google::protobuf::internal::StringCheckUTF8(ptr, size, ctx)); - ::google::protobuf::internal::InlineGreedyStringParser(object, ptr, size, ctx); - ptr += size; - if (ptr >= end) break; - } while ((::google::protobuf::io::UnalignedLoad<::google::protobuf::uint64>(ptr) & 255) == 18 && (ptr += 1)); - break; - } + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { + ptr -= 1; + do { + ptr += 1; + auto str = _internal_add_strings(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "protobuf_test.Record.strings")); + CHK_(ptr); + if (!ctx->DataAvailable(ptr)) break; + } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<18>(ptr)); + } else goto handle_unusual; + continue; default: { handle_unusual: if ((tag & 7) == 4 || tag == 0) { - ctx->EndGroup(tag); - return ptr; + ctx->SetLastTag(tag); + goto success; } - auto res = UnknownFieldParse(tag, {_InternalParse, msg}, - ptr, end, msg->_internal_metadata_.mutable_unknown_fields(), ctx); - ptr = res.first; - GOOGLE_PROTOBUF_PARSER_ASSERT(ptr != nullptr); - if (res.second) return ptr; + ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx); + CHK_(ptr != nullptr); + continue; } } // switch } // while - return ptr; -string_till_end: - static_cast<::std::string*>(object)->clear(); - static_cast<::std::string*>(object)->reserve(size); - goto len_delim_till_end; -len_delim_till_end: - return ctx->StoreAndTailCall(ptr, end, {_InternalParse, msg}, - {parser_till_end, object}, size); -} -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool Record::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::google::protobuf::uint32 tag; - // @@protoc_insertion_point(parse_start:protobuf_test.Record) - for (;;) { - ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // repeated int64 ids = 1; - case 1: { - if (static_cast< ::google::protobuf::uint8>(tag) == (10 & 0xFF)) { - DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive< - ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>( - input, this->mutable_ids()))); - } else if (static_cast< ::google::protobuf::uint8>(tag) == (8 & 0xFF)) { - DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline< - ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>( - 1, 10u, input, this->mutable_ids()))); - } else { - goto handle_unusual; - } - break; - } - - // repeated string strings = 2; - case 2: { - if (static_cast< ::google::protobuf::uint8>(tag) == (18 & 0xFF)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadString( - input, this->add_strings())); - DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->strings(this->strings_size() - 1).data(), - static_cast(this->strings(this->strings_size() - 1).length()), - ::google::protobuf::internal::WireFormatLite::PARSE, - "protobuf_test.Record.strings")); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::google::protobuf::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } success: - // @@protoc_insertion_point(parse_success:protobuf_test.Record) - return true; + return ptr; failure: - // @@protoc_insertion_point(parse_failure:protobuf_test.Record) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER - -void Record::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const { - // @@protoc_insertion_point(serialize_start:protobuf_test.Record) - ::google::protobuf::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - // repeated int64 ids = 1; - if (this->ids_size() > 0) { - ::google::protobuf::internal::WireFormatLite::WriteTag(1, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output); - output->WriteVarint32(_ids_cached_byte_size_.load( - std::memory_order_relaxed)); - } - for (int i = 0, n = this->ids_size(); i < n; i++) { - ::google::protobuf::internal::WireFormatLite::WriteInt64NoTag( - this->ids(i), output); - } - - // repeated string strings = 2; - for (int i = 0, n = this->strings_size(); i < n; i++) { - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->strings(i).data(), static_cast(this->strings(i).length()), - ::google::protobuf::internal::WireFormatLite::SERIALIZE, - "protobuf_test.Record.strings"); - ::google::protobuf::internal::WireFormatLite::WriteString( - 2, this->strings(i), output); - } - - if (_internal_metadata_.have_unknown_fields()) { - ::google::protobuf::internal::WireFormat::SerializeUnknownFields( - _internal_metadata_.unknown_fields(), output); - } - // @@protoc_insertion_point(serialize_end:protobuf_test.Record) + ptr = nullptr; + goto success; +#undef CHK_ } -::google::protobuf::uint8* Record::InternalSerializeWithCachedSizesToArray( - ::google::protobuf::uint8* target) const { +::PROTOBUF_NAMESPACE_ID::uint8* Record::_InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:protobuf_test.Record) - ::google::protobuf::uint32 cached_has_bits = 0; + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; // repeated int64 ids = 1; - if (this->ids_size() > 0) { - target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray( - 1, - ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, - target); - target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( - _ids_cached_byte_size_.load(std::memory_order_relaxed), - target); - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt64NoTagToArray(this->ids_, target); + { + int byte_size = _ids_cached_byte_size_.load(std::memory_order_relaxed); + if (byte_size > 0) { + target = stream->WriteInt64Packed( + 1, _internal_ids(), byte_size, target); + } } // repeated string strings = 2; - for (int i = 0, n = this->strings_size(); i < n; i++) { - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->strings(i).data(), static_cast(this->strings(i).length()), - ::google::protobuf::internal::WireFormatLite::SERIALIZE, + for (int i = 0, n = this->_internal_strings_size(); i < n; i++) { + const auto& s = this->_internal_strings(i); + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + s.data(), static_cast(s.length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, "protobuf_test.Record.strings"); - target = ::google::protobuf::internal::WireFormatLite:: - WriteStringToArray(2, this->strings(i), target); + target = stream->WriteString(2, s, target); } - if (_internal_metadata_.have_unknown_fields()) { - target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( - _internal_metadata_.unknown_fields(), target); + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields(), target, stream); } // @@protoc_insertion_point(serialize_to_array_end:protobuf_test.Record) return target; @@ -362,25 +219,20 @@ size_t Record::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:protobuf_test.Record) size_t total_size = 0; - if (_internal_metadata_.have_unknown_fields()) { - total_size += - ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( - _internal_metadata_.unknown_fields()); - } - ::google::protobuf::uint32 cached_has_bits = 0; + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; // repeated int64 ids = 1; { - size_t data_size = ::google::protobuf::internal::WireFormatLite:: + size_t data_size = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: Int64Size(this->ids_); if (data_size > 0) { total_size += 1 + - ::google::protobuf::internal::WireFormatLite::Int32Size( - static_cast<::google::protobuf::int32>(data_size)); + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( + static_cast<::PROTOBUF_NAMESPACE_ID::int32>(data_size)); } - int cached_size = ::google::protobuf::internal::ToCachedSize(data_size); + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(data_size); _ids_cached_byte_size_.store(cached_size, std::memory_order_relaxed); total_size += data_size; @@ -388,26 +240,30 @@ size_t Record::ByteSizeLong() const { // repeated string strings = 2; total_size += 1 * - ::google::protobuf::internal::FromIntSize(this->strings_size()); - for (int i = 0, n = this->strings_size(); i < n; i++) { - total_size += ::google::protobuf::internal::WireFormatLite::StringSize( - this->strings(i)); + ::PROTOBUF_NAMESPACE_ID::internal::FromIntSize(strings_.size()); + for (int i = 0, n = strings_.size(); i < n; i++) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + strings_.Get(i)); } - int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( + _internal_metadata_, total_size, &_cached_size_); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); SetCachedSize(cached_size); return total_size; } -void Record::MergeFrom(const ::google::protobuf::Message& from) { +void Record::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { // @@protoc_insertion_point(generalized_merge_from_start:protobuf_test.Record) GOOGLE_DCHECK_NE(&from, this); const Record* source = - ::google::protobuf::DynamicCastToGenerated( + ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated( &from); if (source == nullptr) { // @@protoc_insertion_point(generalized_merge_from_cast_fail:protobuf_test.Record) - ::google::protobuf::internal::ReflectionOps::Merge(from, this); + ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); } else { // @@protoc_insertion_point(generalized_merge_from_cast_success:protobuf_test.Record) MergeFrom(*source); @@ -418,14 +274,14 @@ void Record::MergeFrom(const Record& from) { // @@protoc_insertion_point(class_specific_merge_from_start:protobuf_test.Record) GOOGLE_DCHECK_NE(&from, this); _internal_metadata_.MergeFrom(from._internal_metadata_); - ::google::protobuf::uint32 cached_has_bits = 0; + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; ids_.MergeFrom(from.ids_); strings_.MergeFrom(from.strings_); } -void Record::CopyFrom(const ::google::protobuf::Message& from) { +void Record::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { // @@protoc_insertion_point(generalized_copy_from_start:protobuf_test.Record) if (&from == this) return; Clear(); @@ -443,32 +299,25 @@ bool Record::IsInitialized() const { return true; } -void Record::Swap(Record* other) { - if (other == this) return; - InternalSwap(other); -} void Record::InternalSwap(Record* other) { using std::swap; _internal_metadata_.Swap(&other->_internal_metadata_); ids_.InternalSwap(&other->ids_); - strings_.InternalSwap(CastToBase(&other->strings_)); + strings_.InternalSwap(&other->strings_); } -::google::protobuf::Metadata Record::GetMetadata() const { - ::google::protobuf::internal::AssignDescriptors(&::assign_descriptors_table_test_2eproto); - return ::file_level_metadata_test_2eproto[kIndexInFileMessages]; +::PROTOBUF_NAMESPACE_ID::Metadata Record::GetMetadata() const { + return GetMetadataStatic(); } // @@protoc_insertion_point(namespace_scope) } // namespace protobuf_test -namespace google { -namespace protobuf { +PROTOBUF_NAMESPACE_OPEN template<> PROTOBUF_NOINLINE ::protobuf_test::Record* Arena::CreateMaybeMessage< ::protobuf_test::Record >(Arena* arena) { return Arena::CreateInternal< ::protobuf_test::Record >(arena); } -} // namespace protobuf -} // namespace google +PROTOBUF_NAMESPACE_CLOSE // @@protoc_insertion_point(global_scope) #include diff --git a/protobuf/test.pb.h b/protobuf/test.pb.h index b20f25f..a2e6367 100644 --- a/protobuf/test.pb.h +++ b/protobuf/test.pb.h @@ -1,19 +1,19 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: test.proto -#ifndef PROTOBUF_INCLUDED_test_2eproto -#define PROTOBUF_INCLUDED_test_2eproto +#ifndef GOOGLE_PROTOBUF_INCLUDED_test_2eproto +#define GOOGLE_PROTOBUF_INCLUDED_test_2eproto #include #include #include -#if PROTOBUF_VERSION < 3007000 +#if PROTOBUF_VERSION < 3011000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3007000 < PROTOBUF_MIN_PROTOC_VERSION +#if 3011002 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. @@ -27,6 +27,7 @@ #include #include #include +#include #include #include // IWYU pragma: export #include // IWYU pragma: export @@ -34,52 +35,53 @@ // @@protoc_insertion_point(includes) #include #define PROTOBUF_INTERNAL_EXPORT_test_2eproto +PROTOBUF_NAMESPACE_OPEN +namespace internal { +class AnyMetadata; +} // namespace internal +PROTOBUF_NAMESPACE_CLOSE // Internal implementation detail -- do not use these members. struct TableStruct_test_2eproto { - static const ::google::protobuf::internal::ParseTableField entries[] + static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTableField entries[] PROTOBUF_SECTION_VARIABLE(protodesc_cold); - static const ::google::protobuf::internal::AuxillaryParseTableField aux[] + static const ::PROTOBUF_NAMESPACE_ID::internal::AuxillaryParseTableField aux[] PROTOBUF_SECTION_VARIABLE(protodesc_cold); - static const ::google::protobuf::internal::ParseTable schema[1] + static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTable schema[1] PROTOBUF_SECTION_VARIABLE(protodesc_cold); - static const ::google::protobuf::internal::FieldMetadata field_metadata[]; - static const ::google::protobuf::internal::SerializationTable serialization_table[]; - static const ::google::protobuf::uint32 offsets[]; + static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[]; + static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[]; + static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[]; }; -void AddDescriptors_test_2eproto(); +extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_test_2eproto; namespace protobuf_test { class Record; class RecordDefaultTypeInternal; extern RecordDefaultTypeInternal _Record_default_instance_; } // namespace protobuf_test -namespace google { -namespace protobuf { +PROTOBUF_NAMESPACE_OPEN template<> ::protobuf_test::Record* Arena::CreateMaybeMessage<::protobuf_test::Record>(Arena*); -} // namespace protobuf -} // namespace google +PROTOBUF_NAMESPACE_CLOSE namespace protobuf_test { // =================================================================== -class Record final : - public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:protobuf_test.Record) */ { +class Record : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:protobuf_test.Record) */ { public: Record(); virtual ~Record(); Record(const Record& from); - - inline Record& operator=(const Record& from) { - CopyFrom(from); - return *this; - } - #if LANG_CXX11 Record(Record&& from) noexcept : Record() { *this = ::std::move(from); } + inline Record& operator=(const Record& from) { + CopyFrom(from); + return *this; + } inline Record& operator=(Record&& from) noexcept { if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { if (this != &from) InternalSwap(&from); @@ -88,9 +90,15 @@ class Record final : } return *this; } - #endif - static const ::google::protobuf::Descriptor* descriptor() { - return default_instance().GetDescriptor(); + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; } static const Record& default_instance(); @@ -102,10 +110,13 @@ class Record final : static constexpr int kIndexInFileMessages = 0; - void Swap(Record* other); friend void swap(Record& a, Record& b) { a.Swap(&b); } + inline void Swap(Record* other) { + if (other == this) return; + InternalSwap(other); + } // implements Message ---------------------------------------------- @@ -113,37 +124,33 @@ class Record final : return CreateMaybeMessage(nullptr); } - Record* New(::google::protobuf::Arena* arena) const final { + Record* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { return CreateMaybeMessage(arena); } - void CopyFrom(const ::google::protobuf::Message& from) final; - void MergeFrom(const ::google::protobuf::Message& from) final; + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; void CopyFrom(const Record& from); void MergeFrom(const Record& from); PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER - static const char* _InternalParse(const char* begin, const char* end, void* object, ::google::protobuf::internal::ParseContext* ctx); - ::google::protobuf::internal::ParseFunc _ParseFunc() const final { return _InternalParse; } - #else - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const final; - ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( - ::google::protobuf::uint8* target) const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: - void SharedCtor(); - void SharedDtor(); + inline void SharedCtor(); + inline void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(Record* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "protobuf_test.Record"; + } private: - inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const { return nullptr; } inline void* MaybeArenaPtr() const { @@ -151,55 +158,78 @@ class Record final : } public: - ::google::protobuf::Metadata GetMetadata() const final; + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_test_2eproto); + return ::descriptor_table_test_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- + enum : int { + kIdsFieldNumber = 1, + kStringsFieldNumber = 2, + }; // repeated int64 ids = 1; int ids_size() const; + private: + int _internal_ids_size() const; + public: void clear_ids(); - static const int kIdsFieldNumber = 1; - ::google::protobuf::int64 ids(int index) const; - void set_ids(int index, ::google::protobuf::int64 value); - void add_ids(::google::protobuf::int64 value); - const ::google::protobuf::RepeatedField< ::google::protobuf::int64 >& + private: + ::PROTOBUF_NAMESPACE_ID::int64 _internal_ids(int index) const; + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int64 >& + _internal_ids() const; + void _internal_add_ids(::PROTOBUF_NAMESPACE_ID::int64 value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int64 >* + _internal_mutable_ids(); + public: + ::PROTOBUF_NAMESPACE_ID::int64 ids(int index) const; + void set_ids(int index, ::PROTOBUF_NAMESPACE_ID::int64 value); + void add_ids(::PROTOBUF_NAMESPACE_ID::int64 value); + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int64 >& ids() const; - ::google::protobuf::RepeatedField< ::google::protobuf::int64 >* + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int64 >* mutable_ids(); // repeated string strings = 2; int strings_size() const; + private: + int _internal_strings_size() const; + public: void clear_strings(); - static const int kStringsFieldNumber = 2; - const ::std::string& strings(int index) const; - ::std::string* mutable_strings(int index); - void set_strings(int index, const ::std::string& value); - #if LANG_CXX11 - void set_strings(int index, ::std::string&& value); - #endif + const std::string& strings(int index) const; + std::string* mutable_strings(int index); + void set_strings(int index, const std::string& value); + void set_strings(int index, std::string&& value); void set_strings(int index, const char* value); void set_strings(int index, const char* value, size_t size); - ::std::string* add_strings(); - void add_strings(const ::std::string& value); - #if LANG_CXX11 - void add_strings(::std::string&& value); - #endif + std::string* add_strings(); + void add_strings(const std::string& value); + void add_strings(std::string&& value); void add_strings(const char* value); void add_strings(const char* value, size_t size); - const ::google::protobuf::RepeatedPtrField<::std::string>& strings() const; - ::google::protobuf::RepeatedPtrField<::std::string>* mutable_strings(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField& strings() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField* mutable_strings(); + private: + const std::string& _internal_strings(int index) const; + std::string* _internal_add_strings(); + public: // @@protoc_insertion_point(class_scope:protobuf_test.Record) private: - class HasBitSetters; + class _Internal; - ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; - ::google::protobuf::RepeatedField< ::google::protobuf::int64 > ids_; + ::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int64 > ids_; mutable std::atomic _ids_cached_byte_size_; - ::google::protobuf::RepeatedPtrField<::std::string> strings_; - mutable ::google::protobuf::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField strings_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; friend struct ::TableStruct_test_2eproto; }; // =================================================================== @@ -214,60 +244,85 @@ class Record final : // Record // repeated int64 ids = 1; -inline int Record::ids_size() const { +inline int Record::_internal_ids_size() const { return ids_.size(); } +inline int Record::ids_size() const { + return _internal_ids_size(); +} inline void Record::clear_ids() { ids_.Clear(); } -inline ::google::protobuf::int64 Record::ids(int index) const { - // @@protoc_insertion_point(field_get:protobuf_test.Record.ids) +inline ::PROTOBUF_NAMESPACE_ID::int64 Record::_internal_ids(int index) const { return ids_.Get(index); } -inline void Record::set_ids(int index, ::google::protobuf::int64 value) { +inline ::PROTOBUF_NAMESPACE_ID::int64 Record::ids(int index) const { + // @@protoc_insertion_point(field_get:protobuf_test.Record.ids) + return _internal_ids(index); +} +inline void Record::set_ids(int index, ::PROTOBUF_NAMESPACE_ID::int64 value) { ids_.Set(index, value); // @@protoc_insertion_point(field_set:protobuf_test.Record.ids) } -inline void Record::add_ids(::google::protobuf::int64 value) { +inline void Record::_internal_add_ids(::PROTOBUF_NAMESPACE_ID::int64 value) { ids_.Add(value); +} +inline void Record::add_ids(::PROTOBUF_NAMESPACE_ID::int64 value) { + _internal_add_ids(value); // @@protoc_insertion_point(field_add:protobuf_test.Record.ids) } -inline const ::google::protobuf::RepeatedField< ::google::protobuf::int64 >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int64 >& +Record::_internal_ids() const { + return ids_; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int64 >& Record::ids() const { // @@protoc_insertion_point(field_list:protobuf_test.Record.ids) - return ids_; + return _internal_ids(); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int64 >* +Record::_internal_mutable_ids() { + return &ids_; } -inline ::google::protobuf::RepeatedField< ::google::protobuf::int64 >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int64 >* Record::mutable_ids() { // @@protoc_insertion_point(field_mutable_list:protobuf_test.Record.ids) - return &ids_; + return _internal_mutable_ids(); } // repeated string strings = 2; -inline int Record::strings_size() const { +inline int Record::_internal_strings_size() const { return strings_.size(); } +inline int Record::strings_size() const { + return _internal_strings_size(); +} inline void Record::clear_strings() { strings_.Clear(); } -inline const ::std::string& Record::strings(int index) const { - // @@protoc_insertion_point(field_get:protobuf_test.Record.strings) +inline std::string* Record::add_strings() { + // @@protoc_insertion_point(field_add_mutable:protobuf_test.Record.strings) + return _internal_add_strings(); +} +inline const std::string& Record::_internal_strings(int index) const { return strings_.Get(index); } -inline ::std::string* Record::mutable_strings(int index) { +inline const std::string& Record::strings(int index) const { + // @@protoc_insertion_point(field_get:protobuf_test.Record.strings) + return _internal_strings(index); +} +inline std::string* Record::mutable_strings(int index) { // @@protoc_insertion_point(field_mutable:protobuf_test.Record.strings) return strings_.Mutable(index); } -inline void Record::set_strings(int index, const ::std::string& value) { +inline void Record::set_strings(int index, const std::string& value) { // @@protoc_insertion_point(field_set:protobuf_test.Record.strings) strings_.Mutable(index)->assign(value); } -#if LANG_CXX11 -inline void Record::set_strings(int index, ::std::string&& value) { +inline void Record::set_strings(int index, std::string&& value) { // @@protoc_insertion_point(field_set:protobuf_test.Record.strings) strings_.Mutable(index)->assign(std::move(value)); } -#endif inline void Record::set_strings(int index, const char* value) { GOOGLE_DCHECK(value != nullptr); strings_.Mutable(index)->assign(value); @@ -278,20 +333,17 @@ inline void Record::set_strings(int index, const char* value, size_t size) { reinterpret_cast(value), size); // @@protoc_insertion_point(field_set_pointer:protobuf_test.Record.strings) } -inline ::std::string* Record::add_strings() { - // @@protoc_insertion_point(field_add_mutable:protobuf_test.Record.strings) +inline std::string* Record::_internal_add_strings() { return strings_.Add(); } -inline void Record::add_strings(const ::std::string& value) { +inline void Record::add_strings(const std::string& value) { strings_.Add()->assign(value); // @@protoc_insertion_point(field_add:protobuf_test.Record.strings) } -#if LANG_CXX11 -inline void Record::add_strings(::std::string&& value) { +inline void Record::add_strings(std::string&& value) { strings_.Add(std::move(value)); // @@protoc_insertion_point(field_add:protobuf_test.Record.strings) } -#endif inline void Record::add_strings(const char* value) { GOOGLE_DCHECK(value != nullptr); strings_.Add()->assign(value); @@ -301,12 +353,12 @@ inline void Record::add_strings(const char* value, size_t size) { strings_.Add()->assign(reinterpret_cast(value), size); // @@protoc_insertion_point(field_add_pointer:protobuf_test.Record.strings) } -inline const ::google::protobuf::RepeatedPtrField<::std::string>& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField& Record::strings() const { // @@protoc_insertion_point(field_list:protobuf_test.Record.strings) return strings_; } -inline ::google::protobuf::RepeatedPtrField<::std::string>* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField* Record::mutable_strings() { // @@protoc_insertion_point(field_mutable_list:protobuf_test.Record.strings) return &strings_; @@ -323,4 +375,4 @@ Record::mutable_strings() { // @@protoc_insertion_point(global_scope) #include -#endif // PROTOBUF_INCLUDED_test_2eproto +#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_test_2eproto diff --git a/thrift/gen-cpp/test_constants.cpp b/thrift/gen-cpp/test_constants.cpp index 359f438..6f99a3a 100644 --- a/thrift/gen-cpp/test_constants.cpp +++ b/thrift/gen-cpp/test_constants.cpp @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.12.0) + * Autogenerated by Thrift Compiler (0.13.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated diff --git a/thrift/gen-cpp/test_constants.h b/thrift/gen-cpp/test_constants.h index 9744976..72c8e72 100644 --- a/thrift/gen-cpp/test_constants.h +++ b/thrift/gen-cpp/test_constants.h @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.12.0) + * Autogenerated by Thrift Compiler (0.13.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated diff --git a/thrift/gen-cpp/test_types.cpp b/thrift/gen-cpp/test_types.cpp index ab9194a..08597f7 100644 --- a/thrift/gen-cpp/test_types.cpp +++ b/thrift/gen-cpp/test_types.cpp @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.12.0) + * Autogenerated by Thrift Compiler (0.13.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @@ -14,7 +14,7 @@ namespace thrift_test { -Record::~Record() throw() { +Record::~Record() noexcept { } diff --git a/thrift/gen-cpp/test_types.h b/thrift/gen-cpp/test_types.h index 181bea4..d0793c1 100644 --- a/thrift/gen-cpp/test_types.h +++ b/thrift/gen-cpp/test_types.h @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.12.0) + * Autogenerated by Thrift Compiler (0.13.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @@ -15,7 +15,8 @@ #include #include -#include +#include +#include namespace thrift_test { @@ -31,7 +32,7 @@ class Record : public virtual ::apache::thrift::TBase { Record() { } - virtual ~Record() throw(); + virtual ~Record() noexcept; std::vector ids; std::vector strings;