From 67c377cfecafce88389db691db74a1762475f72f Mon Sep 17 00:00:00 2001 From: selcuk Date: Sun, 26 Nov 2023 13:55:29 +0000 Subject: [PATCH] Project restructured --- CMakeLists.txt | 58 +- benchmarking/CMakeLists.txt | 40 + {test => benchmarking}/benchmark | 0 benchmarking/include/Complex.hpp | 98 ++ benchmarking/include/Complex.pb.h | 1677 +++++++++++++++++++ benchmarking/include/Person.pb.h | 706 ++++++++ benchmarking/include/Simple.hpp | 79 + benchmarking/include/protobuf/Complex.proto | 34 + benchmarking/include/protobuf/Person.proto | 16 + benchmarking/src/Complex.cpp | 263 +++ benchmarking/src/Complex.pb.cc | 1645 ++++++++++++++++++ benchmarking/src/Person.pb.cc | 636 +++++++ benchmarking/src/Simple.cpp | 136 ++ cmake/bunnyConfig.cmake.in | 4 + test/CMakeLists.txt | 21 +- test/include/ArrayTest.hpp | 36 +- test/include/ArrayTest1.hpp | 142 -- test/include/ComplexClassTest.hpp | 110 +- test/include/ComplexClassTest1.hpp | 57 - test/include/ComplexClassTestTemp.hpp | 40 - test/include/ObjectTest.hpp | 32 +- test/include/ObjectTest1.hpp | 61 - test/include/SharedPtrTest.hpp | 51 +- test/include/SharedPtrTest1.hpp | 77 - test/include/UnorderedMapTest.hpp | 20 +- test/include/UnorderedMapTest1.hpp | 93 - test/include/VectorTest.hpp | 28 +- test/include/VectorTest1.hpp | 60 - test/src/ArrayTest.cpp | 199 ++- test/src/ArrayTest1.cpp | 98 -- test/src/BoostTest.cpp | 242 --- test/src/ComplexTest.cpp | 116 +- test/src/ComplexTest1.cpp | 68 - test/src/ObjectTest.cpp | 42 +- test/src/ObjectTest1.cpp | 25 - test/src/SharedPtrTest.cpp | 110 +- test/src/SharedPtrTest1.cpp | 74 - test/src/Test.cpp | 101 -- test/src/UnorderedMapTest.cpp | 81 +- test/src/UnorderedMapTest1.cpp | 50 - test/src/VectorTest.cpp | 76 +- test/src/VectorTest1.cpp | 52 - 42 files changed, 5840 insertions(+), 1714 deletions(-) create mode 100644 benchmarking/CMakeLists.txt rename {test => benchmarking}/benchmark (100%) create mode 100644 benchmarking/include/Complex.hpp create mode 100644 benchmarking/include/Complex.pb.h create mode 100644 benchmarking/include/Person.pb.h create mode 100644 benchmarking/include/Simple.hpp create mode 100644 benchmarking/include/protobuf/Complex.proto create mode 100644 benchmarking/include/protobuf/Person.proto create mode 100644 benchmarking/src/Complex.cpp create mode 100644 benchmarking/src/Complex.pb.cc create mode 100644 benchmarking/src/Person.pb.cc create mode 100644 benchmarking/src/Simple.cpp create mode 100644 cmake/bunnyConfig.cmake.in delete mode 100644 test/include/ArrayTest1.hpp delete mode 100644 test/include/ComplexClassTest1.hpp delete mode 100644 test/include/ComplexClassTestTemp.hpp delete mode 100644 test/include/ObjectTest1.hpp delete mode 100644 test/include/SharedPtrTest1.hpp delete mode 100644 test/include/UnorderedMapTest1.hpp delete mode 100644 test/include/VectorTest1.hpp delete mode 100644 test/src/ArrayTest1.cpp delete mode 100644 test/src/BoostTest.cpp delete mode 100644 test/src/ComplexTest1.cpp delete mode 100644 test/src/ObjectTest1.cpp delete mode 100644 test/src/SharedPtrTest1.cpp delete mode 100644 test/src/Test.cpp delete mode 100644 test/src/UnorderedMapTest1.cpp delete mode 100644 test/src/VectorTest1.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 9a0984d..4ef7dc7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,24 +1,70 @@ cmake_minimum_required(VERSION 3.2) -project(bunny VERSION 3.7.1 LANGUAGES CXX) +project(bunny VERSION 1.0.0 + DESCRIPTION "A header-only backward compatible C++ serialization library." + LANGUAGES CXX) SET(WARNING_FLAGS "-Wno-unused-variable -Wno-unused-parameter") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNING_FLAGS} -std=c++17") - set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +set(CMAKE_INSTALL_PREFIX "/usr/local/lib/") + +# This is a local setting and needs to be removed. +list(APPEND CMAKE_PREFIX_PATH "/usr/local/lib/boost/lib/cmake/" "/usr/local/lib/protobuf/lib/cmake/") -find_package(GTest REQUIRED) +option(ENABLE_BUNNY_TEST "Enables the bunny test cases." OFF) +option(ENABLE_BUNNY_BENCHMARKING "Enables the benchmarking test cases." OFF) add_compile_options(-Wall -Wextra -Wpedantic) file(GLOB SRC_FILES - "src/*.cpp" "include/*.hpp" ) +include(GNUInstallDirs) + include_directories(include) -add_subdirectory(test) +if(${ENABLE_BUNNY_TEST}) + add_subdirectory(test) +endif() + +if(${ENABLE_BUNNY_BENCHMARKING}) + add_subdirectory(benchmarking) +endif() + +add_library(${PROJECT_NAME} INTERFACE ${SRC_FILES}) + +target_include_directories(${PROJECT_NAME} + INTERFACE $ + $) + + +install(TARGETS ${PROJECT_NAME} + EXPORT ${PROJECT_NAME}_Targets + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + +include(CMakePackageConfigHelpers) +write_basic_package_version_file("bunnyConfigVersion.cmake" + VERSION ${PROJECT_VERSION} + COMPATIBILITY SameMajorVersion) + +configure_package_config_file( + "${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME}Config.cmake.in" + "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" + INSTALL_DESTINATION + ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/cmake) + +install(EXPORT ${PROJECT_NAME}_Targets + FILE ${PROJECT_NAME}Targets.cmake + NAMESPACE ${PROJECT_NAME}:: + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/cmake) + +install(FILES "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" + "${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake" + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/cmake) -add_executable(${PROJECT_NAME} ${SRC_FILES}) +install(DIRECTORY ${PROJECT_SOURCE_DIR}/include DESTINATION bunny) diff --git a/benchmarking/CMakeLists.txt b/benchmarking/CMakeLists.txt new file mode 100644 index 0000000..efc119b --- /dev/null +++ b/benchmarking/CMakeLists.txt @@ -0,0 +1,40 @@ +cmake_minimum_required(VERSION 3.2) + +project(bunny-benchmark VERSION 3.7.1 LANGUAGES CXX) + +set(benchmark_DIR "${CMAKE_CURRENT_SOURCE_DIR}/benchmark") +set(BENCHMARK_ENABLE_GTEST_TESTS OFF) + +find_package(Boost REQUIRED COMPONENTS serialization) +find_package(absl REQUIRED) +find_package(utf8_range REQUIRED) +find_package(protobuf REQUIRED) + +add_compile_options(-Wall -Wextra -Wpedantic) + +file(GLOB SRC_FILES + "src/*.cpp" + "src/*.cc" +) + +add_subdirectory(benchmark) + +link_directories(/usr/local/lib/abseil/lib ${Protobuf_LIBRARIES}) + +add_executable(${PROJECT_NAME} ${SRC_FILES}) + +target_include_directories(${PROJECT_NAME} PRIVATE + include + ${CMAKE_CURRENT_SOURCE_DIR}/include + ${Boost_INCLUDE_DIRS} + benchmark/include + ${Protobuf_INCLUDE_DIR}) + +target_link_libraries(${PROJECT_NAME} ${GTEST_LIBRARIES} + pthread + gtest_main + Boost::serialization + benchmark::benchmark + protobuf::libprotobuf + protobuf::libprotoc +) \ No newline at end of file diff --git a/test/benchmark b/benchmarking/benchmark similarity index 100% rename from test/benchmark rename to benchmarking/benchmark diff --git a/benchmarking/include/Complex.hpp b/benchmarking/include/Complex.hpp new file mode 100644 index 0000000..2d14232 --- /dev/null +++ b/benchmarking/include/Complex.hpp @@ -0,0 +1,98 @@ +#pragma once + +#include "ComposerPaper.hpp" +#include "DecomposerPaper.hpp" +#include +#include +#include +#include + +namespace boosttest +{ + struct PlainClass + { + std::string m_name; + std::unordered_map m_map; + + template + void serialize(Archive &arc, unsigned int) + { + arc & m_name; + arc & m_map; + } + }; + + struct ComplexTestClass + { + unsigned int m_id{}; + int m_count{}; + std::string m_name; + std::unordered_map> m_int_map; + std::unordered_map> m_plain_map[3]; + + template + void serialize(Archive &arc, unsigned int) + { + arc & m_id; + arc & m_name; + arc & m_count; + arc & m_int_map; + arc & m_plain_map; + } + }; +} + +namespace bunnytest +{ + using bunny::FieldTag; + + struct PlainClass + { + std::string m_name; + std::unordered_map m_map; + + template + void serialize(Paper &paper) + { + paper(m_name, FieldTag{1}); + paper(m_map, FieldTag{2}); + } + + template + void deserialize(Paper &paper) + { + paper(m_name, FieldTag{1}); + paper(m_map, FieldTag{2}); + } + }; + + struct ComplexTestClass + { + unsigned int m_id{}; + int m_count{}; + std::string m_name; + std::unordered_map> m_int_map; + std::unordered_map> m_plain_map[3]; + + template + void serialize(Paper &paper) + { + paper(m_id, FieldTag{1}); + paper(m_name, FieldTag{2}); + paper(m_count, FieldTag{3}); + paper(m_int_map, FieldTag{4}); + paper(m_plain_map, FieldTag{5}); + } + + template + void deserialize(Paper &paper) + { + paper(m_id, FieldTag{1}); + paper(m_name, FieldTag{2}); + paper(m_count, FieldTag{3}); + paper(m_int_map, FieldTag{4}); + paper(m_plain_map, FieldTag{5}); + } + }; + +} \ No newline at end of file diff --git a/benchmarking/include/Complex.pb.h b/benchmarking/include/Complex.pb.h new file mode 100644 index 0000000..dadc466 --- /dev/null +++ b/benchmarking/include/Complex.pb.h @@ -0,0 +1,1677 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: Complex.proto +// Protobuf C++ Version: 4.26.0-dev + +#ifndef GOOGLE_PROTOBUF_INCLUDED_Complex_2eproto_2epb_2eh +#define GOOGLE_PROTOBUF_INCLUDED_Complex_2eproto_2epb_2eh + +#include +#include +#include +#include + +#include "google/protobuf/port_def.inc" +#if PROTOBUF_VERSION != 4026000 +#error "Protobuf C++ gencode is built with an incompatible version of" +#error "Protobuf C++ headers/runtime. See" +#error "https://protobuf.dev/support/cross-version-runtime-guarantee/#cpp" +#endif +#include "google/protobuf/port_undef.inc" +#include "google/protobuf/io/coded_stream.h" +#include "google/protobuf/arena.h" +#include "google/protobuf/arenastring.h" +#include "google/protobuf/generated_message_tctable_decl.h" +#include "google/protobuf/generated_message_util.h" +#include "google/protobuf/metadata_lite.h" +#include "google/protobuf/generated_message_reflection.h" +#include "google/protobuf/message.h" +#include "google/protobuf/repeated_field.h" // IWYU pragma: export +#include "google/protobuf/extension_set.h" // IWYU pragma: export +#include "google/protobuf/map.h" // IWYU pragma: export +#include "google/protobuf/map_entry.h" +#include "google/protobuf/map_field_inl.h" +#include "google/protobuf/unknown_field_set.h" +// @@protoc_insertion_point(includes) + +// Must be included last. +#include "google/protobuf/port_def.inc" + +#define PROTOBUF_INTERNAL_EXPORT_Complex_2eproto + +namespace google { +namespace protobuf { +namespace internal { +class AnyMetadata; +} // namespace internal +} // namespace protobuf +} // namespace google + +// Internal implementation detail -- do not use these members. +struct TableStruct_Complex_2eproto { + static const ::uint32_t offsets[]; +}; +extern const ::google::protobuf::internal::DescriptorTable + descriptor_table_Complex_2eproto; +namespace complexbenchmarking { +class ComplexClass; +struct ComplexClassDefaultTypeInternal; +extern ComplexClassDefaultTypeInternal _ComplexClass_default_instance_; +class ComplexClass_InnerIntMap; +struct ComplexClass_InnerIntMapDefaultTypeInternal; +extern ComplexClass_InnerIntMapDefaultTypeInternal _ComplexClass_InnerIntMap_default_instance_; +class ComplexClass_InnerIntMap_MMapEntry_DoNotUse; +struct ComplexClass_InnerIntMap_MMapEntry_DoNotUseDefaultTypeInternal; +extern ComplexClass_InnerIntMap_MMapEntry_DoNotUseDefaultTypeInternal _ComplexClass_InnerIntMap_MMapEntry_DoNotUse_default_instance_; +class ComplexClass_InnerPlainClassMap; +struct ComplexClass_InnerPlainClassMapDefaultTypeInternal; +extern ComplexClass_InnerPlainClassMapDefaultTypeInternal _ComplexClass_InnerPlainClassMap_default_instance_; +class ComplexClass_InnerPlainClassMapArray; +struct ComplexClass_InnerPlainClassMapArrayDefaultTypeInternal; +extern ComplexClass_InnerPlainClassMapArrayDefaultTypeInternal _ComplexClass_InnerPlainClassMapArray_default_instance_; +class ComplexClass_InnerPlainClassMap_MyMapEntry_DoNotUse; +struct ComplexClass_InnerPlainClassMap_MyMapEntry_DoNotUseDefaultTypeInternal; +extern ComplexClass_InnerPlainClassMap_MyMapEntry_DoNotUseDefaultTypeInternal _ComplexClass_InnerPlainClassMap_MyMapEntry_DoNotUse_default_instance_; +class ComplexClass_IntMapEntry_DoNotUse; +struct ComplexClass_IntMapEntry_DoNotUseDefaultTypeInternal; +extern ComplexClass_IntMapEntry_DoNotUseDefaultTypeInternal _ComplexClass_IntMapEntry_DoNotUse_default_instance_; +class ComplexClass_PlainClass; +struct ComplexClass_PlainClassDefaultTypeInternal; +extern ComplexClass_PlainClassDefaultTypeInternal _ComplexClass_PlainClass_default_instance_; +class ComplexClass_PlainClass_MyMapEntry_DoNotUse; +struct ComplexClass_PlainClass_MyMapEntry_DoNotUseDefaultTypeInternal; +extern ComplexClass_PlainClass_MyMapEntry_DoNotUseDefaultTypeInternal _ComplexClass_PlainClass_MyMapEntry_DoNotUse_default_instance_; +} // namespace complexbenchmarking +namespace google { +namespace protobuf { +} // namespace protobuf +} // namespace google + +namespace complexbenchmarking { + +// =================================================================== + + +// ------------------------------------------------------------------- + +class ComplexClass_PlainClass_MyMapEntry_DoNotUse final + : public ::google::protobuf::internal::MapEntry< + ComplexClass_PlainClass_MyMapEntry_DoNotUse, ::int32_t, std::string, + ::google::protobuf::internal::WireFormatLite::TYPE_INT32, + ::google::protobuf::internal::WireFormatLite::TYPE_STRING> { + public: + using SuperType = ::google::protobuf::internal::MapEntry< + ComplexClass_PlainClass_MyMapEntry_DoNotUse, ::int32_t, std::string, + ::google::protobuf::internal::WireFormatLite::TYPE_INT32, + ::google::protobuf::internal::WireFormatLite::TYPE_STRING>; + ComplexClass_PlainClass_MyMapEntry_DoNotUse(); + template + explicit PROTOBUF_CONSTEXPR ComplexClass_PlainClass_MyMapEntry_DoNotUse( + ::google::protobuf::internal::ConstantInitialized); + explicit ComplexClass_PlainClass_MyMapEntry_DoNotUse(::google::protobuf::Arena* arena); + static const ComplexClass_PlainClass_MyMapEntry_DoNotUse* internal_default_instance() { + return reinterpret_cast( + &_ComplexClass_PlainClass_MyMapEntry_DoNotUse_default_instance_); + } + static bool ValidateKey(void*) { return true; } + static bool ValidateValue(std::string* s) { +#ifndef NDEBUG + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + s->data(), static_cast(s->size()), ::google::protobuf::internal::WireFormatLite::PARSE, "complexbenchmarking.ComplexClass.PlainClass.MyMapEntry.value"); +#else + (void) s; +#endif + return true; + } + ::google::protobuf::Metadata GetMetadata() const final; + friend struct ::TableStruct_Complex_2eproto; +}; +// ------------------------------------------------------------------- + +class ComplexClass_InnerIntMap_MMapEntry_DoNotUse final + : public ::google::protobuf::internal::MapEntry< + ComplexClass_InnerIntMap_MMapEntry_DoNotUse, ::int32_t, ::int32_t, + ::google::protobuf::internal::WireFormatLite::TYPE_INT32, + ::google::protobuf::internal::WireFormatLite::TYPE_INT32> { + public: + using SuperType = ::google::protobuf::internal::MapEntry< + ComplexClass_InnerIntMap_MMapEntry_DoNotUse, ::int32_t, ::int32_t, + ::google::protobuf::internal::WireFormatLite::TYPE_INT32, + ::google::protobuf::internal::WireFormatLite::TYPE_INT32>; + ComplexClass_InnerIntMap_MMapEntry_DoNotUse(); + template + explicit PROTOBUF_CONSTEXPR ComplexClass_InnerIntMap_MMapEntry_DoNotUse( + ::google::protobuf::internal::ConstantInitialized); + explicit ComplexClass_InnerIntMap_MMapEntry_DoNotUse(::google::protobuf::Arena* arena); + static const ComplexClass_InnerIntMap_MMapEntry_DoNotUse* internal_default_instance() { + return reinterpret_cast( + &_ComplexClass_InnerIntMap_MMapEntry_DoNotUse_default_instance_); + } + static bool ValidateKey(void*) { return true; } + static bool ValidateValue(void*) { return true; } + ::google::protobuf::Metadata GetMetadata() const final; + friend struct ::TableStruct_Complex_2eproto; +}; +// ------------------------------------------------------------------- + +class ComplexClass_PlainClass final : public ::google::protobuf::Message +/* @@protoc_insertion_point(class_definition:complexbenchmarking.ComplexClass.PlainClass) */ { + public: + inline ComplexClass_PlainClass() : ComplexClass_PlainClass(nullptr) {} + ~ComplexClass_PlainClass() override; + template + explicit PROTOBUF_CONSTEXPR ComplexClass_PlainClass( + ::google::protobuf::internal::ConstantInitialized); + + inline ComplexClass_PlainClass(const ComplexClass_PlainClass& from) : ComplexClass_PlainClass(nullptr, from) {} + inline ComplexClass_PlainClass(ComplexClass_PlainClass&& from) noexcept + : ComplexClass_PlainClass(nullptr, std::move(from)) {} + inline ComplexClass_PlainClass& operator=(const ComplexClass_PlainClass& from) { + CopyFrom(from); + return *this; + } + inline ComplexClass_PlainClass& operator=(ComplexClass_PlainClass&& from) noexcept { + if (this == &from) return *this; + if (GetArena() == from.GetArena() +#ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetArena() != nullptr +#endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); + } + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + ABSL_ATTRIBUTE_LIFETIME_BOUND { + return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); + } + + static const ::google::protobuf::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::google::protobuf::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::google::protobuf::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const ComplexClass_PlainClass& default_instance() { + return *internal_default_instance(); + } + static inline const ComplexClass_PlainClass* internal_default_instance() { + return reinterpret_cast( + &_ComplexClass_PlainClass_default_instance_); + } + static constexpr int kIndexInFileMessages = 1; + friend void swap(ComplexClass_PlainClass& a, ComplexClass_PlainClass& b) { a.Swap(&b); } + inline void Swap(ComplexClass_PlainClass* other) { + if (other == this) return; +#ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetArena() != nullptr && GetArena() == other->GetArena()) { +#else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetArena() == other->GetArena()) { +#endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::google::protobuf::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(ComplexClass_PlainClass* other) { + if (other == this) return; + ABSL_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + ComplexClass_PlainClass* New(::google::protobuf::Arena* arena = nullptr) const final { + return ::google::protobuf::Message::DefaultConstruct(arena); + } + using ::google::protobuf::Message::CopyFrom; + void CopyFrom(const ComplexClass_PlainClass& from); + using ::google::protobuf::Message::MergeFrom; + void MergeFrom(const ComplexClass_PlainClass& from) { ComplexClass_PlainClass::MergeImpl(*this, from); } + + private: + static void MergeImpl( + ::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); + + public: + ABSL_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + ::size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::google::protobuf::internal::ParseContext* ctx) final; + ::uint8_t* _InternalSerialize( + ::uint8_t* target, + ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::google::protobuf::Arena* arena); + void SharedDtor(); + void InternalSwap(ComplexClass_PlainClass* other); + private: + friend class ::google::protobuf::internal::AnyMetadata; + static ::absl::string_view FullMessageName() { return "complexbenchmarking.ComplexClass.PlainClass"; } + + protected: + explicit ComplexClass_PlainClass(::google::protobuf::Arena* arena); + ComplexClass_PlainClass(::google::protobuf::Arena* arena, const ComplexClass_PlainClass& from); + ComplexClass_PlainClass(::google::protobuf::Arena* arena, ComplexClass_PlainClass&& from) noexcept + : ComplexClass_PlainClass(arena) { + *this = ::std::move(from); + } + const ::google::protobuf::MessageLite::ClassData* GetClassData() + const final; + + public: + ::google::protobuf::Metadata GetMetadata() const final; + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + enum : int { + kMyMapFieldNumber = 2, + kNameFieldNumber = 1, + }; + // map my_map = 2; + int my_map_size() const; + private: + int _internal_my_map_size() const; + + public: + void clear_my_map() ; + const ::google::protobuf::Map<::int32_t, std::string>& my_map() const; + ::google::protobuf::Map<::int32_t, std::string>* mutable_my_map(); + + private: + const ::google::protobuf::Map<::int32_t, std::string>& _internal_my_map() const; + ::google::protobuf::Map<::int32_t, std::string>* _internal_mutable_my_map(); + + public: + // optional string name = 1; + bool has_name() const; + void clear_name() ; + const std::string& name() const; + template + void set_name(Arg_&& arg, Args_... args); + std::string* mutable_name(); + PROTOBUF_NODISCARD std::string* release_name(); + void set_allocated_name(std::string* value); + + private: + const std::string& _internal_name() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_name( + const std::string& value); + std::string* _internal_mutable_name(); + + public: + // @@protoc_insertion_point(class_scope:complexbenchmarking.ComplexClass.PlainClass) + private: + class _Internal; + friend class ::google::protobuf::internal::TcParser; + static const ::google::protobuf::internal::TcParseTable< + 0, 2, 1, + 62, 2> + _table_; + friend class ::google::protobuf::MessageLite; + friend class ::google::protobuf::Arena; + template + friend class ::google::protobuf::Arena::InternalHelper; + using InternalArenaConstructable_ = void; + using DestructorSkippable_ = void; + struct Impl_ { + inline explicit constexpr Impl_( + ::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena); + inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena, const Impl_& from); + ::google::protobuf::internal::HasBits<1> _has_bits_; + mutable ::google::protobuf::internal::CachedSize _cached_size_; + ::google::protobuf::internal::MapField + my_map_; + ::google::protobuf::internal::ArenaStringPtr name_; + PROTOBUF_TSAN_DECLARE_MEMBER + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_Complex_2eproto; +}; +// ------------------------------------------------------------------- + +class ComplexClass_InnerIntMap final : public ::google::protobuf::Message +/* @@protoc_insertion_point(class_definition:complexbenchmarking.ComplexClass.InnerIntMap) */ { + public: + inline ComplexClass_InnerIntMap() : ComplexClass_InnerIntMap(nullptr) {} + ~ComplexClass_InnerIntMap() override; + template + explicit PROTOBUF_CONSTEXPR ComplexClass_InnerIntMap( + ::google::protobuf::internal::ConstantInitialized); + + inline ComplexClass_InnerIntMap(const ComplexClass_InnerIntMap& from) : ComplexClass_InnerIntMap(nullptr, from) {} + inline ComplexClass_InnerIntMap(ComplexClass_InnerIntMap&& from) noexcept + : ComplexClass_InnerIntMap(nullptr, std::move(from)) {} + inline ComplexClass_InnerIntMap& operator=(const ComplexClass_InnerIntMap& from) { + CopyFrom(from); + return *this; + } + inline ComplexClass_InnerIntMap& operator=(ComplexClass_InnerIntMap&& from) noexcept { + if (this == &from) return *this; + if (GetArena() == from.GetArena() +#ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetArena() != nullptr +#endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); + } + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + ABSL_ATTRIBUTE_LIFETIME_BOUND { + return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); + } + + static const ::google::protobuf::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::google::protobuf::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::google::protobuf::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const ComplexClass_InnerIntMap& default_instance() { + return *internal_default_instance(); + } + static inline const ComplexClass_InnerIntMap* internal_default_instance() { + return reinterpret_cast( + &_ComplexClass_InnerIntMap_default_instance_); + } + static constexpr int kIndexInFileMessages = 3; + friend void swap(ComplexClass_InnerIntMap& a, ComplexClass_InnerIntMap& b) { a.Swap(&b); } + inline void Swap(ComplexClass_InnerIntMap* other) { + if (other == this) return; +#ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetArena() != nullptr && GetArena() == other->GetArena()) { +#else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetArena() == other->GetArena()) { +#endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::google::protobuf::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(ComplexClass_InnerIntMap* other) { + if (other == this) return; + ABSL_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + ComplexClass_InnerIntMap* New(::google::protobuf::Arena* arena = nullptr) const final { + return ::google::protobuf::Message::DefaultConstruct(arena); + } + using ::google::protobuf::Message::CopyFrom; + void CopyFrom(const ComplexClass_InnerIntMap& from); + using ::google::protobuf::Message::MergeFrom; + void MergeFrom(const ComplexClass_InnerIntMap& from) { ComplexClass_InnerIntMap::MergeImpl(*this, from); } + + private: + static void MergeImpl( + ::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); + + public: + ABSL_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + ::size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::google::protobuf::internal::ParseContext* ctx) final; + ::uint8_t* _InternalSerialize( + ::uint8_t* target, + ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::google::protobuf::Arena* arena); + void SharedDtor(); + void InternalSwap(ComplexClass_InnerIntMap* other); + private: + friend class ::google::protobuf::internal::AnyMetadata; + static ::absl::string_view FullMessageName() { return "complexbenchmarking.ComplexClass.InnerIntMap"; } + + protected: + explicit ComplexClass_InnerIntMap(::google::protobuf::Arena* arena); + ComplexClass_InnerIntMap(::google::protobuf::Arena* arena, const ComplexClass_InnerIntMap& from); + ComplexClass_InnerIntMap(::google::protobuf::Arena* arena, ComplexClass_InnerIntMap&& from) noexcept + : ComplexClass_InnerIntMap(arena) { + *this = ::std::move(from); + } + const ::google::protobuf::MessageLite::ClassData* GetClassData() + const final; + + public: + ::google::protobuf::Metadata GetMetadata() const final; + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + enum : int { + kMMapFieldNumber = 1, + }; + // map m_map = 1; + int m_map_size() const; + private: + int _internal_m_map_size() const; + + public: + void clear_m_map() ; + const ::google::protobuf::Map<::int32_t, ::int32_t>& m_map() const; + ::google::protobuf::Map<::int32_t, ::int32_t>* mutable_m_map(); + + private: + const ::google::protobuf::Map<::int32_t, ::int32_t>& _internal_m_map() const; + ::google::protobuf::Map<::int32_t, ::int32_t>* _internal_mutable_m_map(); + + public: + // @@protoc_insertion_point(class_scope:complexbenchmarking.ComplexClass.InnerIntMap) + private: + class _Internal; + friend class ::google::protobuf::internal::TcParser; + static const ::google::protobuf::internal::TcParseTable< + 0, 1, 1, + 0, 2> + _table_; + friend class ::google::protobuf::MessageLite; + friend class ::google::protobuf::Arena; + template + friend class ::google::protobuf::Arena::InternalHelper; + using InternalArenaConstructable_ = void; + using DestructorSkippable_ = void; + struct Impl_ { + inline explicit constexpr Impl_( + ::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena); + inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena, const Impl_& from); + ::google::protobuf::internal::MapField + m_map_; + mutable ::google::protobuf::internal::CachedSize _cached_size_; + PROTOBUF_TSAN_DECLARE_MEMBER + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_Complex_2eproto; +}; +// ------------------------------------------------------------------- + +class ComplexClass_IntMapEntry_DoNotUse final + : public ::google::protobuf::internal::MapEntry< + ComplexClass_IntMapEntry_DoNotUse, ::int32_t, ::complexbenchmarking::ComplexClass_InnerIntMap, + ::google::protobuf::internal::WireFormatLite::TYPE_INT32, + ::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE> { + public: + using SuperType = ::google::protobuf::internal::MapEntry< + ComplexClass_IntMapEntry_DoNotUse, ::int32_t, ::complexbenchmarking::ComplexClass_InnerIntMap, + ::google::protobuf::internal::WireFormatLite::TYPE_INT32, + ::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE>; + ComplexClass_IntMapEntry_DoNotUse(); + template + explicit PROTOBUF_CONSTEXPR ComplexClass_IntMapEntry_DoNotUse( + ::google::protobuf::internal::ConstantInitialized); + explicit ComplexClass_IntMapEntry_DoNotUse(::google::protobuf::Arena* arena); + static const ComplexClass_IntMapEntry_DoNotUse* internal_default_instance() { + return reinterpret_cast( + &_ComplexClass_IntMapEntry_DoNotUse_default_instance_); + } + static bool ValidateKey(void*) { return true; } + static bool ValidateValue(void*) { return true; } + ::google::protobuf::Metadata GetMetadata() const final; + friend struct ::TableStruct_Complex_2eproto; +}; +// ------------------------------------------------------------------- + +class ComplexClass_InnerPlainClassMap_MyMapEntry_DoNotUse final + : public ::google::protobuf::internal::MapEntry< + ComplexClass_InnerPlainClassMap_MyMapEntry_DoNotUse, ::int32_t, ::complexbenchmarking::ComplexClass_PlainClass, + ::google::protobuf::internal::WireFormatLite::TYPE_INT32, + ::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE> { + public: + using SuperType = ::google::protobuf::internal::MapEntry< + ComplexClass_InnerPlainClassMap_MyMapEntry_DoNotUse, ::int32_t, ::complexbenchmarking::ComplexClass_PlainClass, + ::google::protobuf::internal::WireFormatLite::TYPE_INT32, + ::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE>; + ComplexClass_InnerPlainClassMap_MyMapEntry_DoNotUse(); + template + explicit PROTOBUF_CONSTEXPR ComplexClass_InnerPlainClassMap_MyMapEntry_DoNotUse( + ::google::protobuf::internal::ConstantInitialized); + explicit ComplexClass_InnerPlainClassMap_MyMapEntry_DoNotUse(::google::protobuf::Arena* arena); + static const ComplexClass_InnerPlainClassMap_MyMapEntry_DoNotUse* internal_default_instance() { + return reinterpret_cast( + &_ComplexClass_InnerPlainClassMap_MyMapEntry_DoNotUse_default_instance_); + } + static bool ValidateKey(void*) { return true; } + static bool ValidateValue(void*) { return true; } + ::google::protobuf::Metadata GetMetadata() const final; + friend struct ::TableStruct_Complex_2eproto; +}; +// ------------------------------------------------------------------- + +class ComplexClass_InnerPlainClassMap final : public ::google::protobuf::Message +/* @@protoc_insertion_point(class_definition:complexbenchmarking.ComplexClass.InnerPlainClassMap) */ { + public: + inline ComplexClass_InnerPlainClassMap() : ComplexClass_InnerPlainClassMap(nullptr) {} + ~ComplexClass_InnerPlainClassMap() override; + template + explicit PROTOBUF_CONSTEXPR ComplexClass_InnerPlainClassMap( + ::google::protobuf::internal::ConstantInitialized); + + inline ComplexClass_InnerPlainClassMap(const ComplexClass_InnerPlainClassMap& from) : ComplexClass_InnerPlainClassMap(nullptr, from) {} + inline ComplexClass_InnerPlainClassMap(ComplexClass_InnerPlainClassMap&& from) noexcept + : ComplexClass_InnerPlainClassMap(nullptr, std::move(from)) {} + inline ComplexClass_InnerPlainClassMap& operator=(const ComplexClass_InnerPlainClassMap& from) { + CopyFrom(from); + return *this; + } + inline ComplexClass_InnerPlainClassMap& operator=(ComplexClass_InnerPlainClassMap&& from) noexcept { + if (this == &from) return *this; + if (GetArena() == from.GetArena() +#ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetArena() != nullptr +#endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); + } + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + ABSL_ATTRIBUTE_LIFETIME_BOUND { + return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); + } + + static const ::google::protobuf::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::google::protobuf::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::google::protobuf::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const ComplexClass_InnerPlainClassMap& default_instance() { + return *internal_default_instance(); + } + static inline const ComplexClass_InnerPlainClassMap* internal_default_instance() { + return reinterpret_cast( + &_ComplexClass_InnerPlainClassMap_default_instance_); + } + static constexpr int kIndexInFileMessages = 5; + friend void swap(ComplexClass_InnerPlainClassMap& a, ComplexClass_InnerPlainClassMap& b) { a.Swap(&b); } + inline void Swap(ComplexClass_InnerPlainClassMap* other) { + if (other == this) return; +#ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetArena() != nullptr && GetArena() == other->GetArena()) { +#else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetArena() == other->GetArena()) { +#endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::google::protobuf::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(ComplexClass_InnerPlainClassMap* other) { + if (other == this) return; + ABSL_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + ComplexClass_InnerPlainClassMap* New(::google::protobuf::Arena* arena = nullptr) const final { + return ::google::protobuf::Message::DefaultConstruct(arena); + } + using ::google::protobuf::Message::CopyFrom; + void CopyFrom(const ComplexClass_InnerPlainClassMap& from); + using ::google::protobuf::Message::MergeFrom; + void MergeFrom(const ComplexClass_InnerPlainClassMap& from) { ComplexClass_InnerPlainClassMap::MergeImpl(*this, from); } + + private: + static void MergeImpl( + ::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); + + public: + ABSL_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + ::size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::google::protobuf::internal::ParseContext* ctx) final; + ::uint8_t* _InternalSerialize( + ::uint8_t* target, + ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::google::protobuf::Arena* arena); + void SharedDtor(); + void InternalSwap(ComplexClass_InnerPlainClassMap* other); + private: + friend class ::google::protobuf::internal::AnyMetadata; + static ::absl::string_view FullMessageName() { return "complexbenchmarking.ComplexClass.InnerPlainClassMap"; } + + protected: + explicit ComplexClass_InnerPlainClassMap(::google::protobuf::Arena* arena); + ComplexClass_InnerPlainClassMap(::google::protobuf::Arena* arena, const ComplexClass_InnerPlainClassMap& from); + ComplexClass_InnerPlainClassMap(::google::protobuf::Arena* arena, ComplexClass_InnerPlainClassMap&& from) noexcept + : ComplexClass_InnerPlainClassMap(arena) { + *this = ::std::move(from); + } + const ::google::protobuf::MessageLite::ClassData* GetClassData() + const final; + + public: + ::google::protobuf::Metadata GetMetadata() const final; + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + enum : int { + kMyMapFieldNumber = 1, + }; + // map my_map = 1; + int my_map_size() const; + private: + int _internal_my_map_size() const; + + public: + void clear_my_map() ; + const ::google::protobuf::Map<::int32_t, ::complexbenchmarking::ComplexClass_PlainClass>& my_map() const; + ::google::protobuf::Map<::int32_t, ::complexbenchmarking::ComplexClass_PlainClass>* mutable_my_map(); + + private: + const ::google::protobuf::Map<::int32_t, ::complexbenchmarking::ComplexClass_PlainClass>& _internal_my_map() const; + ::google::protobuf::Map<::int32_t, ::complexbenchmarking::ComplexClass_PlainClass>* _internal_mutable_my_map(); + + public: + // @@protoc_insertion_point(class_scope:complexbenchmarking.ComplexClass.InnerPlainClassMap) + private: + class _Internal; + friend class ::google::protobuf::internal::TcParser; + static const ::google::protobuf::internal::TcParseTable< + 0, 1, 2, + 0, 2> + _table_; + friend class ::google::protobuf::MessageLite; + friend class ::google::protobuf::Arena; + template + friend class ::google::protobuf::Arena::InternalHelper; + using InternalArenaConstructable_ = void; + using DestructorSkippable_ = void; + struct Impl_ { + inline explicit constexpr Impl_( + ::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena); + inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena, const Impl_& from); + ::google::protobuf::internal::MapField + my_map_; + mutable ::google::protobuf::internal::CachedSize _cached_size_; + PROTOBUF_TSAN_DECLARE_MEMBER + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_Complex_2eproto; +}; +// ------------------------------------------------------------------- + +class ComplexClass_InnerPlainClassMapArray final : public ::google::protobuf::Message +/* @@protoc_insertion_point(class_definition:complexbenchmarking.ComplexClass.InnerPlainClassMapArray) */ { + public: + inline ComplexClass_InnerPlainClassMapArray() : ComplexClass_InnerPlainClassMapArray(nullptr) {} + ~ComplexClass_InnerPlainClassMapArray() override; + template + explicit PROTOBUF_CONSTEXPR ComplexClass_InnerPlainClassMapArray( + ::google::protobuf::internal::ConstantInitialized); + + inline ComplexClass_InnerPlainClassMapArray(const ComplexClass_InnerPlainClassMapArray& from) : ComplexClass_InnerPlainClassMapArray(nullptr, from) {} + inline ComplexClass_InnerPlainClassMapArray(ComplexClass_InnerPlainClassMapArray&& from) noexcept + : ComplexClass_InnerPlainClassMapArray(nullptr, std::move(from)) {} + inline ComplexClass_InnerPlainClassMapArray& operator=(const ComplexClass_InnerPlainClassMapArray& from) { + CopyFrom(from); + return *this; + } + inline ComplexClass_InnerPlainClassMapArray& operator=(ComplexClass_InnerPlainClassMapArray&& from) noexcept { + if (this == &from) return *this; + if (GetArena() == from.GetArena() +#ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetArena() != nullptr +#endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); + } + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + ABSL_ATTRIBUTE_LIFETIME_BOUND { + return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); + } + + static const ::google::protobuf::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::google::protobuf::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::google::protobuf::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const ComplexClass_InnerPlainClassMapArray& default_instance() { + return *internal_default_instance(); + } + static inline const ComplexClass_InnerPlainClassMapArray* internal_default_instance() { + return reinterpret_cast( + &_ComplexClass_InnerPlainClassMapArray_default_instance_); + } + static constexpr int kIndexInFileMessages = 6; + friend void swap(ComplexClass_InnerPlainClassMapArray& a, ComplexClass_InnerPlainClassMapArray& b) { a.Swap(&b); } + inline void Swap(ComplexClass_InnerPlainClassMapArray* other) { + if (other == this) return; +#ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetArena() != nullptr && GetArena() == other->GetArena()) { +#else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetArena() == other->GetArena()) { +#endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::google::protobuf::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(ComplexClass_InnerPlainClassMapArray* other) { + if (other == this) return; + ABSL_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + ComplexClass_InnerPlainClassMapArray* New(::google::protobuf::Arena* arena = nullptr) const final { + return ::google::protobuf::Message::DefaultConstruct(arena); + } + using ::google::protobuf::Message::CopyFrom; + void CopyFrom(const ComplexClass_InnerPlainClassMapArray& from); + using ::google::protobuf::Message::MergeFrom; + void MergeFrom(const ComplexClass_InnerPlainClassMapArray& from) { ComplexClass_InnerPlainClassMapArray::MergeImpl(*this, from); } + + private: + static void MergeImpl( + ::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); + + public: + ABSL_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + ::size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::google::protobuf::internal::ParseContext* ctx) final; + ::uint8_t* _InternalSerialize( + ::uint8_t* target, + ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::google::protobuf::Arena* arena); + void SharedDtor(); + void InternalSwap(ComplexClass_InnerPlainClassMapArray* other); + private: + friend class ::google::protobuf::internal::AnyMetadata; + static ::absl::string_view FullMessageName() { return "complexbenchmarking.ComplexClass.InnerPlainClassMapArray"; } + + protected: + explicit ComplexClass_InnerPlainClassMapArray(::google::protobuf::Arena* arena); + ComplexClass_InnerPlainClassMapArray(::google::protobuf::Arena* arena, const ComplexClass_InnerPlainClassMapArray& from); + ComplexClass_InnerPlainClassMapArray(::google::protobuf::Arena* arena, ComplexClass_InnerPlainClassMapArray&& from) noexcept + : ComplexClass_InnerPlainClassMapArray(arena) { + *this = ::std::move(from); + } + const ::google::protobuf::MessageLite::ClassData* GetClassData() + const final; + + public: + ::google::protobuf::Metadata GetMetadata() const final; + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + enum : int { + kMyMapsFieldNumber = 1, + }; + // optional .complexbenchmarking.ComplexClass.InnerPlainClassMap my_maps = 1; + bool has_my_maps() const; + void clear_my_maps() ; + const ::complexbenchmarking::ComplexClass_InnerPlainClassMap& my_maps() const; + PROTOBUF_NODISCARD ::complexbenchmarking::ComplexClass_InnerPlainClassMap* release_my_maps(); + ::complexbenchmarking::ComplexClass_InnerPlainClassMap* mutable_my_maps(); + void set_allocated_my_maps(::complexbenchmarking::ComplexClass_InnerPlainClassMap* value); + void unsafe_arena_set_allocated_my_maps(::complexbenchmarking::ComplexClass_InnerPlainClassMap* value); + ::complexbenchmarking::ComplexClass_InnerPlainClassMap* unsafe_arena_release_my_maps(); + + private: + const ::complexbenchmarking::ComplexClass_InnerPlainClassMap& _internal_my_maps() const; + ::complexbenchmarking::ComplexClass_InnerPlainClassMap* _internal_mutable_my_maps(); + + public: + // @@protoc_insertion_point(class_scope:complexbenchmarking.ComplexClass.InnerPlainClassMapArray) + private: + class _Internal; + friend class ::google::protobuf::internal::TcParser; + static const ::google::protobuf::internal::TcParseTable< + 0, 1, 1, + 0, 2> + _table_; + friend class ::google::protobuf::MessageLite; + friend class ::google::protobuf::Arena; + template + friend class ::google::protobuf::Arena::InternalHelper; + using InternalArenaConstructable_ = void; + using DestructorSkippable_ = void; + struct Impl_ { + inline explicit constexpr Impl_( + ::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena); + inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena, const Impl_& from); + ::google::protobuf::internal::HasBits<1> _has_bits_; + mutable ::google::protobuf::internal::CachedSize _cached_size_; + ::complexbenchmarking::ComplexClass_InnerPlainClassMap* my_maps_; + PROTOBUF_TSAN_DECLARE_MEMBER + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_Complex_2eproto; +}; +// ------------------------------------------------------------------- + +class ComplexClass final : public ::google::protobuf::Message +/* @@protoc_insertion_point(class_definition:complexbenchmarking.ComplexClass) */ { + public: + inline ComplexClass() : ComplexClass(nullptr) {} + ~ComplexClass() override; + template + explicit PROTOBUF_CONSTEXPR ComplexClass( + ::google::protobuf::internal::ConstantInitialized); + + inline ComplexClass(const ComplexClass& from) : ComplexClass(nullptr, from) {} + inline ComplexClass(ComplexClass&& from) noexcept + : ComplexClass(nullptr, std::move(from)) {} + inline ComplexClass& operator=(const ComplexClass& from) { + CopyFrom(from); + return *this; + } + inline ComplexClass& operator=(ComplexClass&& from) noexcept { + if (this == &from) return *this; + if (GetArena() == from.GetArena() +#ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetArena() != nullptr +#endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); + } + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + ABSL_ATTRIBUTE_LIFETIME_BOUND { + return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); + } + + static const ::google::protobuf::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::google::protobuf::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::google::protobuf::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const ComplexClass& default_instance() { + return *internal_default_instance(); + } + static inline const ComplexClass* internal_default_instance() { + return reinterpret_cast( + &_ComplexClass_default_instance_); + } + static constexpr int kIndexInFileMessages = 8; + friend void swap(ComplexClass& a, ComplexClass& b) { a.Swap(&b); } + inline void Swap(ComplexClass* other) { + if (other == this) return; +#ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetArena() != nullptr && GetArena() == other->GetArena()) { +#else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetArena() == other->GetArena()) { +#endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::google::protobuf::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(ComplexClass* other) { + if (other == this) return; + ABSL_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + ComplexClass* New(::google::protobuf::Arena* arena = nullptr) const final { + return ::google::protobuf::Message::DefaultConstruct(arena); + } + using ::google::protobuf::Message::CopyFrom; + void CopyFrom(const ComplexClass& from); + using ::google::protobuf::Message::MergeFrom; + void MergeFrom(const ComplexClass& from) { ComplexClass::MergeImpl(*this, from); } + + private: + static void MergeImpl( + ::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); + + public: + ABSL_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + ::size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::google::protobuf::internal::ParseContext* ctx) final; + ::uint8_t* _InternalSerialize( + ::uint8_t* target, + ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::google::protobuf::Arena* arena); + void SharedDtor(); + void InternalSwap(ComplexClass* other); + private: + friend class ::google::protobuf::internal::AnyMetadata; + static ::absl::string_view FullMessageName() { return "complexbenchmarking.ComplexClass"; } + + protected: + explicit ComplexClass(::google::protobuf::Arena* arena); + ComplexClass(::google::protobuf::Arena* arena, const ComplexClass& from); + ComplexClass(::google::protobuf::Arena* arena, ComplexClass&& from) noexcept + : ComplexClass(arena) { + *this = ::std::move(from); + } + const ::google::protobuf::MessageLite::ClassData* GetClassData() + const final; + + public: + ::google::protobuf::Metadata GetMetadata() const final; + // nested types ---------------------------------------------------- + using PlainClass = ComplexClass_PlainClass; + using InnerIntMap = ComplexClass_InnerIntMap; + using InnerPlainClassMap = ComplexClass_InnerPlainClassMap; + using InnerPlainClassMapArray = ComplexClass_InnerPlainClassMapArray; + + // accessors ------------------------------------------------------- + enum : int { + kIntMapFieldNumber = 4, + kPlainClassMapFieldNumber = 5, + kNameFieldNumber = 3, + kIdFieldNumber = 1, + kCountFieldNumber = 2, + }; + // map int_map = 4; + int int_map_size() const; + private: + int _internal_int_map_size() const; + + public: + void clear_int_map() ; + const ::google::protobuf::Map<::int32_t, ::complexbenchmarking::ComplexClass_InnerIntMap>& int_map() const; + ::google::protobuf::Map<::int32_t, ::complexbenchmarking::ComplexClass_InnerIntMap>* mutable_int_map(); + + private: + const ::google::protobuf::Map<::int32_t, ::complexbenchmarking::ComplexClass_InnerIntMap>& _internal_int_map() const; + ::google::protobuf::Map<::int32_t, ::complexbenchmarking::ComplexClass_InnerIntMap>* _internal_mutable_int_map(); + + public: + // repeated .complexbenchmarking.ComplexClass.InnerPlainClassMapArray plain_class_map = 5; + int plain_class_map_size() const; + private: + int _internal_plain_class_map_size() const; + + public: + void clear_plain_class_map() ; + ::complexbenchmarking::ComplexClass_InnerPlainClassMapArray* mutable_plain_class_map(int index); + ::google::protobuf::RepeatedPtrField< ::complexbenchmarking::ComplexClass_InnerPlainClassMapArray >* + mutable_plain_class_map(); + private: + const ::google::protobuf::RepeatedPtrField<::complexbenchmarking::ComplexClass_InnerPlainClassMapArray>& _internal_plain_class_map() const; + ::google::protobuf::RepeatedPtrField<::complexbenchmarking::ComplexClass_InnerPlainClassMapArray>* _internal_mutable_plain_class_map(); + public: + const ::complexbenchmarking::ComplexClass_InnerPlainClassMapArray& plain_class_map(int index) const; + ::complexbenchmarking::ComplexClass_InnerPlainClassMapArray* add_plain_class_map(); + const ::google::protobuf::RepeatedPtrField< ::complexbenchmarking::ComplexClass_InnerPlainClassMapArray >& + plain_class_map() const; + // optional string name = 3; + bool has_name() const; + void clear_name() ; + const std::string& name() const; + template + void set_name(Arg_&& arg, Args_... args); + std::string* mutable_name(); + PROTOBUF_NODISCARD std::string* release_name(); + void set_allocated_name(std::string* value); + + private: + const std::string& _internal_name() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_name( + const std::string& value); + std::string* _internal_mutable_name(); + + public: + // optional int32 id = 1; + bool has_id() const; + void clear_id() ; + ::int32_t id() const; + void set_id(::int32_t value); + + private: + ::int32_t _internal_id() const; + void _internal_set_id(::int32_t value); + + public: + // optional int32 count = 2; + bool has_count() const; + void clear_count() ; + ::int32_t count() const; + void set_count(::int32_t value); + + private: + ::int32_t _internal_count() const; + void _internal_set_count(::int32_t value); + + public: + // @@protoc_insertion_point(class_scope:complexbenchmarking.ComplexClass) + private: + class _Internal; + friend class ::google::protobuf::internal::TcParser; + static const ::google::protobuf::internal::TcParseTable< + 3, 5, 3, + 45, 2> + _table_; + friend class ::google::protobuf::MessageLite; + friend class ::google::protobuf::Arena; + template + friend class ::google::protobuf::Arena::InternalHelper; + using InternalArenaConstructable_ = void; + using DestructorSkippable_ = void; + struct Impl_ { + inline explicit constexpr Impl_( + ::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena); + inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena, const Impl_& from); + ::google::protobuf::internal::HasBits<1> _has_bits_; + mutable ::google::protobuf::internal::CachedSize _cached_size_; + ::google::protobuf::internal::MapField + int_map_; + ::google::protobuf::RepeatedPtrField< ::complexbenchmarking::ComplexClass_InnerPlainClassMapArray > plain_class_map_; + ::google::protobuf::internal::ArenaStringPtr name_; + ::int32_t id_; + ::int32_t count_; + PROTOBUF_TSAN_DECLARE_MEMBER + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_Complex_2eproto; +}; + +// =================================================================== + + + + +// =================================================================== + + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif // __GNUC__ +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ComplexClass_PlainClass + +// optional string name = 1; +inline bool ComplexClass_PlainClass::has_name() const { + bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline void ComplexClass_PlainClass::clear_name() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + _impl_.name_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000001u; +} +inline const std::string& ComplexClass_PlainClass::name() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_get:complexbenchmarking.ComplexClass.PlainClass.name) + return _internal_name(); +} +template +inline PROTOBUF_ALWAYS_INLINE void ComplexClass_PlainClass::set_name(Arg_&& arg, + Args_... args) { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + _impl_._has_bits_[0] |= 0x00000001u; + _impl_.name_.Set(static_cast(arg), args..., GetArena()); + // @@protoc_insertion_point(field_set:complexbenchmarking.ComplexClass.PlainClass.name) +} +inline std::string* ComplexClass_PlainClass::mutable_name() ABSL_ATTRIBUTE_LIFETIME_BOUND { + std::string* _s = _internal_mutable_name(); + // @@protoc_insertion_point(field_mutable:complexbenchmarking.ComplexClass.PlainClass.name) + return _s; +} +inline const std::string& ComplexClass_PlainClass::_internal_name() const { + PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race); + return _impl_.name_.Get(); +} +inline void ComplexClass_PlainClass::_internal_set_name(const std::string& value) { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + _impl_._has_bits_[0] |= 0x00000001u; + _impl_.name_.Set(value, GetArena()); +} +inline std::string* ComplexClass_PlainClass::_internal_mutable_name() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + _impl_._has_bits_[0] |= 0x00000001u; + return _impl_.name_.Mutable( GetArena()); +} +inline std::string* ComplexClass_PlainClass::release_name() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + // @@protoc_insertion_point(field_release:complexbenchmarking.ComplexClass.PlainClass.name) + if ((_impl_._has_bits_[0] & 0x00000001u) == 0) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000001u; + auto* released = _impl_.name_.Release(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.name_.Set("", GetArena()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return released; +} +inline void ComplexClass_PlainClass::set_allocated_name(std::string* value) { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } + _impl_.name_.SetAllocated(value, GetArena()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.name_.IsDefault()) { + _impl_.name_.Set("", GetArena()); + } + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:complexbenchmarking.ComplexClass.PlainClass.name) +} + +// map my_map = 2; +inline int ComplexClass_PlainClass::_internal_my_map_size() const { + return _internal_my_map().size(); +} +inline int ComplexClass_PlainClass::my_map_size() const { + return _internal_my_map_size(); +} +inline void ComplexClass_PlainClass::clear_my_map() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + _impl_.my_map_.Clear(); +} +inline const ::google::protobuf::Map<::int32_t, std::string>& ComplexClass_PlainClass::_internal_my_map() const { + PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race); + return _impl_.my_map_.GetMap(); +} +inline const ::google::protobuf::Map<::int32_t, std::string>& ComplexClass_PlainClass::my_map() const ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_map:complexbenchmarking.ComplexClass.PlainClass.my_map) + return _internal_my_map(); +} +inline ::google::protobuf::Map<::int32_t, std::string>* ComplexClass_PlainClass::_internal_mutable_my_map() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + return _impl_.my_map_.MutableMap(); +} +inline ::google::protobuf::Map<::int32_t, std::string>* ComplexClass_PlainClass::mutable_my_map() ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_mutable_map:complexbenchmarking.ComplexClass.PlainClass.my_map) + return _internal_mutable_my_map(); +} + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ComplexClass_InnerIntMap + +// map m_map = 1; +inline int ComplexClass_InnerIntMap::_internal_m_map_size() const { + return _internal_m_map().size(); +} +inline int ComplexClass_InnerIntMap::m_map_size() const { + return _internal_m_map_size(); +} +inline void ComplexClass_InnerIntMap::clear_m_map() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + _impl_.m_map_.Clear(); +} +inline const ::google::protobuf::Map<::int32_t, ::int32_t>& ComplexClass_InnerIntMap::_internal_m_map() const { + PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race); + return _impl_.m_map_.GetMap(); +} +inline const ::google::protobuf::Map<::int32_t, ::int32_t>& ComplexClass_InnerIntMap::m_map() const ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_map:complexbenchmarking.ComplexClass.InnerIntMap.m_map) + return _internal_m_map(); +} +inline ::google::protobuf::Map<::int32_t, ::int32_t>* ComplexClass_InnerIntMap::_internal_mutable_m_map() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + return _impl_.m_map_.MutableMap(); +} +inline ::google::protobuf::Map<::int32_t, ::int32_t>* ComplexClass_InnerIntMap::mutable_m_map() ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_mutable_map:complexbenchmarking.ComplexClass.InnerIntMap.m_map) + return _internal_mutable_m_map(); +} + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ComplexClass_InnerPlainClassMap + +// map my_map = 1; +inline int ComplexClass_InnerPlainClassMap::_internal_my_map_size() const { + return _internal_my_map().size(); +} +inline int ComplexClass_InnerPlainClassMap::my_map_size() const { + return _internal_my_map_size(); +} +inline void ComplexClass_InnerPlainClassMap::clear_my_map() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + _impl_.my_map_.Clear(); +} +inline const ::google::protobuf::Map<::int32_t, ::complexbenchmarking::ComplexClass_PlainClass>& ComplexClass_InnerPlainClassMap::_internal_my_map() const { + PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race); + return _impl_.my_map_.GetMap(); +} +inline const ::google::protobuf::Map<::int32_t, ::complexbenchmarking::ComplexClass_PlainClass>& ComplexClass_InnerPlainClassMap::my_map() const ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_map:complexbenchmarking.ComplexClass.InnerPlainClassMap.my_map) + return _internal_my_map(); +} +inline ::google::protobuf::Map<::int32_t, ::complexbenchmarking::ComplexClass_PlainClass>* ComplexClass_InnerPlainClassMap::_internal_mutable_my_map() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + return _impl_.my_map_.MutableMap(); +} +inline ::google::protobuf::Map<::int32_t, ::complexbenchmarking::ComplexClass_PlainClass>* ComplexClass_InnerPlainClassMap::mutable_my_map() ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_mutable_map:complexbenchmarking.ComplexClass.InnerPlainClassMap.my_map) + return _internal_mutable_my_map(); +} + +// ------------------------------------------------------------------- + +// ComplexClass_InnerPlainClassMapArray + +// optional .complexbenchmarking.ComplexClass.InnerPlainClassMap my_maps = 1; +inline bool ComplexClass_InnerPlainClassMapArray::has_my_maps() const { + bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; + PROTOBUF_ASSUME(!value || _impl_.my_maps_ != nullptr); + return value; +} +inline void ComplexClass_InnerPlainClassMapArray::clear_my_maps() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + if (_impl_.my_maps_ != nullptr) _impl_.my_maps_->Clear(); + _impl_._has_bits_[0] &= ~0x00000001u; +} +inline const ::complexbenchmarking::ComplexClass_InnerPlainClassMap& ComplexClass_InnerPlainClassMapArray::_internal_my_maps() const { + PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race); + const ::complexbenchmarking::ComplexClass_InnerPlainClassMap* p = _impl_.my_maps_; + return p != nullptr ? *p : reinterpret_cast(::complexbenchmarking::_ComplexClass_InnerPlainClassMap_default_instance_); +} +inline const ::complexbenchmarking::ComplexClass_InnerPlainClassMap& ComplexClass_InnerPlainClassMapArray::my_maps() const ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_get:complexbenchmarking.ComplexClass.InnerPlainClassMapArray.my_maps) + return _internal_my_maps(); +} +inline void ComplexClass_InnerPlainClassMapArray::unsafe_arena_set_allocated_my_maps(::complexbenchmarking::ComplexClass_InnerPlainClassMap* value) { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + if (GetArena() == nullptr) { + delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.my_maps_); + } + _impl_.my_maps_ = reinterpret_cast<::complexbenchmarking::ComplexClass_InnerPlainClassMap*>(value); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:complexbenchmarking.ComplexClass.InnerPlainClassMapArray.my_maps) +} +inline ::complexbenchmarking::ComplexClass_InnerPlainClassMap* ComplexClass_InnerPlainClassMapArray::release_my_maps() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + + _impl_._has_bits_[0] &= ~0x00000001u; + ::complexbenchmarking::ComplexClass_InnerPlainClassMap* released = _impl_.my_maps_; + _impl_.my_maps_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::google::protobuf::MessageLite*>(released); + released = ::google::protobuf::internal::DuplicateIfNonNull(released); + if (GetArena() == nullptr) { + delete old; + } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArena() != nullptr) { + released = ::google::protobuf::internal::DuplicateIfNonNull(released); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return released; +} +inline ::complexbenchmarking::ComplexClass_InnerPlainClassMap* ComplexClass_InnerPlainClassMapArray::unsafe_arena_release_my_maps() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + // @@protoc_insertion_point(field_release:complexbenchmarking.ComplexClass.InnerPlainClassMapArray.my_maps) + + _impl_._has_bits_[0] &= ~0x00000001u; + ::complexbenchmarking::ComplexClass_InnerPlainClassMap* temp = _impl_.my_maps_; + _impl_.my_maps_ = nullptr; + return temp; +} +inline ::complexbenchmarking::ComplexClass_InnerPlainClassMap* ComplexClass_InnerPlainClassMapArray::_internal_mutable_my_maps() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + if (_impl_.my_maps_ == nullptr) { + auto* p = ::google::protobuf::Message::DefaultConstruct<::complexbenchmarking::ComplexClass_InnerPlainClassMap>(GetArena()); + _impl_.my_maps_ = reinterpret_cast<::complexbenchmarking::ComplexClass_InnerPlainClassMap*>(p); + } + return _impl_.my_maps_; +} +inline ::complexbenchmarking::ComplexClass_InnerPlainClassMap* ComplexClass_InnerPlainClassMapArray::mutable_my_maps() ABSL_ATTRIBUTE_LIFETIME_BOUND { + _impl_._has_bits_[0] |= 0x00000001u; + ::complexbenchmarking::ComplexClass_InnerPlainClassMap* _msg = _internal_mutable_my_maps(); + // @@protoc_insertion_point(field_mutable:complexbenchmarking.ComplexClass.InnerPlainClassMapArray.my_maps) + return _msg; +} +inline void ComplexClass_InnerPlainClassMapArray::set_allocated_my_maps(::complexbenchmarking::ComplexClass_InnerPlainClassMap* value) { + ::google::protobuf::Arena* message_arena = GetArena(); + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + if (message_arena == nullptr) { + delete (_impl_.my_maps_); + } + + if (value != nullptr) { + ::google::protobuf::Arena* submessage_arena = (value)->GetArena(); + if (message_arena != submessage_arena) { + value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); + } + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } + + _impl_.my_maps_ = reinterpret_cast<::complexbenchmarking::ComplexClass_InnerPlainClassMap*>(value); + // @@protoc_insertion_point(field_set_allocated:complexbenchmarking.ComplexClass.InnerPlainClassMapArray.my_maps) +} + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ComplexClass + +// optional int32 id = 1; +inline bool ComplexClass::has_id() const { + bool value = (_impl_._has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline void ComplexClass::clear_id() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + _impl_.id_ = 0; + _impl_._has_bits_[0] &= ~0x00000002u; +} +inline ::int32_t ComplexClass::id() const { + // @@protoc_insertion_point(field_get:complexbenchmarking.ComplexClass.id) + return _internal_id(); +} +inline void ComplexClass::set_id(::int32_t value) { + _internal_set_id(value); + _impl_._has_bits_[0] |= 0x00000002u; + // @@protoc_insertion_point(field_set:complexbenchmarking.ComplexClass.id) +} +inline ::int32_t ComplexClass::_internal_id() const { + PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race); + return _impl_.id_; +} +inline void ComplexClass::_internal_set_id(::int32_t value) { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + _impl_.id_ = value; +} + +// optional int32 count = 2; +inline bool ComplexClass::has_count() const { + bool value = (_impl_._has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline void ComplexClass::clear_count() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + _impl_.count_ = 0; + _impl_._has_bits_[0] &= ~0x00000004u; +} +inline ::int32_t ComplexClass::count() const { + // @@protoc_insertion_point(field_get:complexbenchmarking.ComplexClass.count) + return _internal_count(); +} +inline void ComplexClass::set_count(::int32_t value) { + _internal_set_count(value); + _impl_._has_bits_[0] |= 0x00000004u; + // @@protoc_insertion_point(field_set:complexbenchmarking.ComplexClass.count) +} +inline ::int32_t ComplexClass::_internal_count() const { + PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race); + return _impl_.count_; +} +inline void ComplexClass::_internal_set_count(::int32_t value) { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + _impl_.count_ = value; +} + +// optional string name = 3; +inline bool ComplexClass::has_name() const { + bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline void ComplexClass::clear_name() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + _impl_.name_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000001u; +} +inline const std::string& ComplexClass::name() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_get:complexbenchmarking.ComplexClass.name) + return _internal_name(); +} +template +inline PROTOBUF_ALWAYS_INLINE void ComplexClass::set_name(Arg_&& arg, + Args_... args) { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + _impl_._has_bits_[0] |= 0x00000001u; + _impl_.name_.Set(static_cast(arg), args..., GetArena()); + // @@protoc_insertion_point(field_set:complexbenchmarking.ComplexClass.name) +} +inline std::string* ComplexClass::mutable_name() ABSL_ATTRIBUTE_LIFETIME_BOUND { + std::string* _s = _internal_mutable_name(); + // @@protoc_insertion_point(field_mutable:complexbenchmarking.ComplexClass.name) + return _s; +} +inline const std::string& ComplexClass::_internal_name() const { + PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race); + return _impl_.name_.Get(); +} +inline void ComplexClass::_internal_set_name(const std::string& value) { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + _impl_._has_bits_[0] |= 0x00000001u; + _impl_.name_.Set(value, GetArena()); +} +inline std::string* ComplexClass::_internal_mutable_name() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + _impl_._has_bits_[0] |= 0x00000001u; + return _impl_.name_.Mutable( GetArena()); +} +inline std::string* ComplexClass::release_name() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + // @@protoc_insertion_point(field_release:complexbenchmarking.ComplexClass.name) + if ((_impl_._has_bits_[0] & 0x00000001u) == 0) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000001u; + auto* released = _impl_.name_.Release(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.name_.Set("", GetArena()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return released; +} +inline void ComplexClass::set_allocated_name(std::string* value) { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } + _impl_.name_.SetAllocated(value, GetArena()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.name_.IsDefault()) { + _impl_.name_.Set("", GetArena()); + } + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:complexbenchmarking.ComplexClass.name) +} + +// map int_map = 4; +inline int ComplexClass::_internal_int_map_size() const { + return _internal_int_map().size(); +} +inline int ComplexClass::int_map_size() const { + return _internal_int_map_size(); +} +inline void ComplexClass::clear_int_map() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + _impl_.int_map_.Clear(); +} +inline const ::google::protobuf::Map<::int32_t, ::complexbenchmarking::ComplexClass_InnerIntMap>& ComplexClass::_internal_int_map() const { + PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race); + return _impl_.int_map_.GetMap(); +} +inline const ::google::protobuf::Map<::int32_t, ::complexbenchmarking::ComplexClass_InnerIntMap>& ComplexClass::int_map() const ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_map:complexbenchmarking.ComplexClass.int_map) + return _internal_int_map(); +} +inline ::google::protobuf::Map<::int32_t, ::complexbenchmarking::ComplexClass_InnerIntMap>* ComplexClass::_internal_mutable_int_map() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + return _impl_.int_map_.MutableMap(); +} +inline ::google::protobuf::Map<::int32_t, ::complexbenchmarking::ComplexClass_InnerIntMap>* ComplexClass::mutable_int_map() ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_mutable_map:complexbenchmarking.ComplexClass.int_map) + return _internal_mutable_int_map(); +} + +// repeated .complexbenchmarking.ComplexClass.InnerPlainClassMapArray plain_class_map = 5; +inline int ComplexClass::_internal_plain_class_map_size() const { + return _internal_plain_class_map().size(); +} +inline int ComplexClass::plain_class_map_size() const { + return _internal_plain_class_map_size(); +} +inline void ComplexClass::clear_plain_class_map() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + _impl_.plain_class_map_.Clear(); +} +inline ::complexbenchmarking::ComplexClass_InnerPlainClassMapArray* ComplexClass::mutable_plain_class_map(int index) + ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_mutable:complexbenchmarking.ComplexClass.plain_class_map) + return _internal_mutable_plain_class_map()->Mutable(index); +} +inline ::google::protobuf::RepeatedPtrField<::complexbenchmarking::ComplexClass_InnerPlainClassMapArray>* ComplexClass::mutable_plain_class_map() + ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_mutable_list:complexbenchmarking.ComplexClass.plain_class_map) + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + return _internal_mutable_plain_class_map(); +} +inline const ::complexbenchmarking::ComplexClass_InnerPlainClassMapArray& ComplexClass::plain_class_map(int index) const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_get:complexbenchmarking.ComplexClass.plain_class_map) + return _internal_plain_class_map().Get(index); +} +inline ::complexbenchmarking::ComplexClass_InnerPlainClassMapArray* ComplexClass::add_plain_class_map() ABSL_ATTRIBUTE_LIFETIME_BOUND { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + ::complexbenchmarking::ComplexClass_InnerPlainClassMapArray* _add = _internal_mutable_plain_class_map()->Add(); + // @@protoc_insertion_point(field_add:complexbenchmarking.ComplexClass.plain_class_map) + return _add; +} +inline const ::google::protobuf::RepeatedPtrField<::complexbenchmarking::ComplexClass_InnerPlainClassMapArray>& ComplexClass::plain_class_map() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_list:complexbenchmarking.ComplexClass.plain_class_map) + return _internal_plain_class_map(); +} +inline const ::google::protobuf::RepeatedPtrField<::complexbenchmarking::ComplexClass_InnerPlainClassMapArray>& +ComplexClass::_internal_plain_class_map() const { + PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race); + return _impl_.plain_class_map_; +} +inline ::google::protobuf::RepeatedPtrField<::complexbenchmarking::ComplexClass_InnerPlainClassMapArray>* +ComplexClass::_internal_mutable_plain_class_map() { + PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race); + return &_impl_.plain_class_map_; +} + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif // __GNUC__ + +// @@protoc_insertion_point(namespace_scope) +} // namespace complexbenchmarking + + +// @@protoc_insertion_point(global_scope) + +#include "google/protobuf/port_undef.inc" + +#endif // GOOGLE_PROTOBUF_INCLUDED_Complex_2eproto_2epb_2eh diff --git a/benchmarking/include/Person.pb.h b/benchmarking/include/Person.pb.h new file mode 100644 index 0000000..c0bafde --- /dev/null +++ b/benchmarking/include/Person.pb.h @@ -0,0 +1,706 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: Person.proto +// Protobuf C++ Version: 4.26.0-dev + +#ifndef GOOGLE_PROTOBUF_INCLUDED_Person_2eproto_2epb_2eh +#define GOOGLE_PROTOBUF_INCLUDED_Person_2eproto_2epb_2eh + +#include +#include +#include +#include + +#include "google/protobuf/port_def.inc" +#if PROTOBUF_VERSION != 4026000 +#error "Protobuf C++ gencode is built with an incompatible version of" +#error "Protobuf C++ headers/runtime. See" +#error "https://protobuf.dev/support/cross-version-runtime-guarantee/#cpp" +#endif +#include "google/protobuf/port_undef.inc" +#include "google/protobuf/io/coded_stream.h" +#include "google/protobuf/arena.h" +#include "google/protobuf/arenastring.h" +#include "google/protobuf/generated_message_tctable_decl.h" +#include "google/protobuf/generated_message_util.h" +#include "google/protobuf/metadata_lite.h" +#include "google/protobuf/generated_message_reflection.h" +#include "google/protobuf/message.h" +#include "google/protobuf/repeated_field.h" // IWYU pragma: export +#include "google/protobuf/extension_set.h" // IWYU pragma: export +#include "google/protobuf/unknown_field_set.h" +// @@protoc_insertion_point(includes) + +// Must be included last. +#include "google/protobuf/port_def.inc" + +#define PROTOBUF_INTERNAL_EXPORT_Person_2eproto + +namespace google { +namespace protobuf { +namespace internal { +class AnyMetadata; +} // namespace internal +} // namespace protobuf +} // namespace google + +// Internal implementation detail -- do not use these members. +struct TableStruct_Person_2eproto { + static const ::uint32_t offsets[]; +}; +extern const ::google::protobuf::internal::DescriptorTable + descriptor_table_Person_2eproto; +namespace benchmarktesting { +class Person; +struct PersonDefaultTypeInternal; +extern PersonDefaultTypeInternal _Person_default_instance_; +class Person_Role; +struct Person_RoleDefaultTypeInternal; +extern Person_RoleDefaultTypeInternal _Person_Role_default_instance_; +} // namespace benchmarktesting +namespace google { +namespace protobuf { +} // namespace protobuf +} // namespace google + +namespace benchmarktesting { + +// =================================================================== + + +// ------------------------------------------------------------------- + +class Person_Role final : public ::google::protobuf::Message +/* @@protoc_insertion_point(class_definition:benchmarktesting.Person.Role) */ { + public: + inline Person_Role() : Person_Role(nullptr) {} + ~Person_Role() override; + template + explicit PROTOBUF_CONSTEXPR Person_Role( + ::google::protobuf::internal::ConstantInitialized); + + inline Person_Role(const Person_Role& from) : Person_Role(nullptr, from) {} + inline Person_Role(Person_Role&& from) noexcept + : Person_Role(nullptr, std::move(from)) {} + inline Person_Role& operator=(const Person_Role& from) { + CopyFrom(from); + return *this; + } + inline Person_Role& operator=(Person_Role&& from) noexcept { + if (this == &from) return *this; + if (GetArena() == from.GetArena() +#ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetArena() != nullptr +#endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); + } + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + ABSL_ATTRIBUTE_LIFETIME_BOUND { + return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); + } + + static const ::google::protobuf::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::google::protobuf::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::google::protobuf::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const Person_Role& default_instance() { + return *internal_default_instance(); + } + static inline const Person_Role* internal_default_instance() { + return reinterpret_cast( + &_Person_Role_default_instance_); + } + static constexpr int kIndexInFileMessages = 0; + friend void swap(Person_Role& a, Person_Role& b) { a.Swap(&b); } + inline void Swap(Person_Role* other) { + if (other == this) return; +#ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetArena() != nullptr && GetArena() == other->GetArena()) { +#else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetArena() == other->GetArena()) { +#endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::google::protobuf::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(Person_Role* other) { + if (other == this) return; + ABSL_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + Person_Role* New(::google::protobuf::Arena* arena = nullptr) const final { + return ::google::protobuf::Message::DefaultConstruct(arena); + } + using ::google::protobuf::Message::CopyFrom; + void CopyFrom(const Person_Role& from); + using ::google::protobuf::Message::MergeFrom; + void MergeFrom(const Person_Role& from) { Person_Role::MergeImpl(*this, from); } + + private: + static void MergeImpl( + ::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); + + public: + ABSL_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + ::size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::google::protobuf::internal::ParseContext* ctx) final; + ::uint8_t* _InternalSerialize( + ::uint8_t* target, + ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::google::protobuf::Arena* arena); + void SharedDtor(); + void InternalSwap(Person_Role* other); + private: + friend class ::google::protobuf::internal::AnyMetadata; + static ::absl::string_view FullMessageName() { return "benchmarktesting.Person.Role"; } + + protected: + explicit Person_Role(::google::protobuf::Arena* arena); + Person_Role(::google::protobuf::Arena* arena, const Person_Role& from); + Person_Role(::google::protobuf::Arena* arena, Person_Role&& from) noexcept + : Person_Role(arena) { + *this = ::std::move(from); + } + const ::google::protobuf::MessageLite::ClassData* GetClassData() + const final; + + public: + ::google::protobuf::Metadata GetMetadata() const final; + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + enum : int { + kRoleNameFieldNumber = 1, + }; + // optional string roleName = 1; + bool has_rolename() const; + void clear_rolename() ; + const std::string& rolename() const; + template + void set_rolename(Arg_&& arg, Args_... args); + std::string* mutable_rolename(); + PROTOBUF_NODISCARD std::string* release_rolename(); + void set_allocated_rolename(std::string* value); + + private: + const std::string& _internal_rolename() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_rolename( + const std::string& value); + std::string* _internal_mutable_rolename(); + + public: + // @@protoc_insertion_point(class_scope:benchmarktesting.Person.Role) + private: + class _Internal; + friend class ::google::protobuf::internal::TcParser; + static const ::google::protobuf::internal::TcParseTable< + 0, 1, 0, + 45, 2> + _table_; + friend class ::google::protobuf::MessageLite; + friend class ::google::protobuf::Arena; + template + friend class ::google::protobuf::Arena::InternalHelper; + using InternalArenaConstructable_ = void; + using DestructorSkippable_ = void; + struct Impl_ { + inline explicit constexpr Impl_( + ::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena); + inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena, const Impl_& from); + ::google::protobuf::internal::HasBits<1> _has_bits_; + mutable ::google::protobuf::internal::CachedSize _cached_size_; + ::google::protobuf::internal::ArenaStringPtr rolename_; + PROTOBUF_TSAN_DECLARE_MEMBER + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_Person_2eproto; +}; +// ------------------------------------------------------------------- + +class Person final : public ::google::protobuf::Message +/* @@protoc_insertion_point(class_definition:benchmarktesting.Person) */ { + public: + inline Person() : Person(nullptr) {} + ~Person() override; + template + explicit PROTOBUF_CONSTEXPR Person( + ::google::protobuf::internal::ConstantInitialized); + + inline Person(const Person& from) : Person(nullptr, from) {} + inline Person(Person&& from) noexcept + : Person(nullptr, std::move(from)) {} + inline Person& operator=(const Person& from) { + CopyFrom(from); + return *this; + } + inline Person& operator=(Person&& from) noexcept { + if (this == &from) return *this; + if (GetArena() == from.GetArena() +#ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetArena() != nullptr +#endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); + } + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + ABSL_ATTRIBUTE_LIFETIME_BOUND { + return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); + } + + static const ::google::protobuf::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::google::protobuf::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::google::protobuf::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const Person& default_instance() { + return *internal_default_instance(); + } + static inline const Person* internal_default_instance() { + return reinterpret_cast( + &_Person_default_instance_); + } + static constexpr int kIndexInFileMessages = 1; + friend void swap(Person& a, Person& b) { a.Swap(&b); } + inline void Swap(Person* other) { + if (other == this) return; +#ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetArena() != nullptr && GetArena() == other->GetArena()) { +#else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetArena() == other->GetArena()) { +#endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::google::protobuf::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(Person* other) { + if (other == this) return; + ABSL_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + Person* New(::google::protobuf::Arena* arena = nullptr) const final { + return ::google::protobuf::Message::DefaultConstruct(arena); + } + using ::google::protobuf::Message::CopyFrom; + void CopyFrom(const Person& from); + using ::google::protobuf::Message::MergeFrom; + void MergeFrom(const Person& from) { Person::MergeImpl(*this, from); } + + private: + static void MergeImpl( + ::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); + + public: + ABSL_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + ::size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::google::protobuf::internal::ParseContext* ctx) final; + ::uint8_t* _InternalSerialize( + ::uint8_t* target, + ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::google::protobuf::Arena* arena); + void SharedDtor(); + void InternalSwap(Person* other); + private: + friend class ::google::protobuf::internal::AnyMetadata; + static ::absl::string_view FullMessageName() { return "benchmarktesting.Person"; } + + protected: + explicit Person(::google::protobuf::Arena* arena); + Person(::google::protobuf::Arena* arena, const Person& from); + Person(::google::protobuf::Arena* arena, Person&& from) noexcept + : Person(arena) { + *this = ::std::move(from); + } + const ::google::protobuf::MessageLite::ClassData* GetClassData() + const final; + + public: + ::google::protobuf::Metadata GetMetadata() const final; + // nested types ---------------------------------------------------- + using Role = Person_Role; + + // accessors ------------------------------------------------------- + enum : int { + kRolesFieldNumber = 3, + kNameFieldNumber = 1, + kIdFieldNumber = 2, + }; + // repeated .benchmarktesting.Person.Role roles = 3; + int roles_size() const; + private: + int _internal_roles_size() const; + + public: + void clear_roles() ; + ::benchmarktesting::Person_Role* mutable_roles(int index); + ::google::protobuf::RepeatedPtrField< ::benchmarktesting::Person_Role >* + mutable_roles(); + private: + const ::google::protobuf::RepeatedPtrField<::benchmarktesting::Person_Role>& _internal_roles() const; + ::google::protobuf::RepeatedPtrField<::benchmarktesting::Person_Role>* _internal_mutable_roles(); + public: + const ::benchmarktesting::Person_Role& roles(int index) const; + ::benchmarktesting::Person_Role* add_roles(); + const ::google::protobuf::RepeatedPtrField< ::benchmarktesting::Person_Role >& + roles() const; + // optional string name = 1; + bool has_name() const; + void clear_name() ; + const std::string& name() const; + template + void set_name(Arg_&& arg, Args_... args); + std::string* mutable_name(); + PROTOBUF_NODISCARD std::string* release_name(); + void set_allocated_name(std::string* value); + + private: + const std::string& _internal_name() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_name( + const std::string& value); + std::string* _internal_mutable_name(); + + public: + // optional int32 id = 2; + bool has_id() const; + void clear_id() ; + ::int32_t id() const; + void set_id(::int32_t value); + + private: + ::int32_t _internal_id() const; + void _internal_set_id(::int32_t value); + + public: + // @@protoc_insertion_point(class_scope:benchmarktesting.Person) + private: + class _Internal; + friend class ::google::protobuf::internal::TcParser; + static const ::google::protobuf::internal::TcParseTable< + 2, 3, 1, + 36, 2> + _table_; + friend class ::google::protobuf::MessageLite; + friend class ::google::protobuf::Arena; + template + friend class ::google::protobuf::Arena::InternalHelper; + using InternalArenaConstructable_ = void; + using DestructorSkippable_ = void; + struct Impl_ { + inline explicit constexpr Impl_( + ::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena); + inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena, const Impl_& from); + ::google::protobuf::internal::HasBits<1> _has_bits_; + mutable ::google::protobuf::internal::CachedSize _cached_size_; + ::google::protobuf::RepeatedPtrField< ::benchmarktesting::Person_Role > roles_; + ::google::protobuf::internal::ArenaStringPtr name_; + ::int32_t id_; + PROTOBUF_TSAN_DECLARE_MEMBER + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_Person_2eproto; +}; + +// =================================================================== + + + + +// =================================================================== + + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif // __GNUC__ +// ------------------------------------------------------------------- + +// Person_Role + +// optional string roleName = 1; +inline bool Person_Role::has_rolename() const { + bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline void Person_Role::clear_rolename() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + _impl_.rolename_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000001u; +} +inline const std::string& Person_Role::rolename() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_get:benchmarktesting.Person.Role.roleName) + return _internal_rolename(); +} +template +inline PROTOBUF_ALWAYS_INLINE void Person_Role::set_rolename(Arg_&& arg, + Args_... args) { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + _impl_._has_bits_[0] |= 0x00000001u; + _impl_.rolename_.Set(static_cast(arg), args..., GetArena()); + // @@protoc_insertion_point(field_set:benchmarktesting.Person.Role.roleName) +} +inline std::string* Person_Role::mutable_rolename() ABSL_ATTRIBUTE_LIFETIME_BOUND { + std::string* _s = _internal_mutable_rolename(); + // @@protoc_insertion_point(field_mutable:benchmarktesting.Person.Role.roleName) + return _s; +} +inline const std::string& Person_Role::_internal_rolename() const { + PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race); + return _impl_.rolename_.Get(); +} +inline void Person_Role::_internal_set_rolename(const std::string& value) { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + _impl_._has_bits_[0] |= 0x00000001u; + _impl_.rolename_.Set(value, GetArena()); +} +inline std::string* Person_Role::_internal_mutable_rolename() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + _impl_._has_bits_[0] |= 0x00000001u; + return _impl_.rolename_.Mutable( GetArena()); +} +inline std::string* Person_Role::release_rolename() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + // @@protoc_insertion_point(field_release:benchmarktesting.Person.Role.roleName) + if ((_impl_._has_bits_[0] & 0x00000001u) == 0) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000001u; + auto* released = _impl_.rolename_.Release(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.rolename_.Set("", GetArena()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return released; +} +inline void Person_Role::set_allocated_rolename(std::string* value) { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } + _impl_.rolename_.SetAllocated(value, GetArena()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.rolename_.IsDefault()) { + _impl_.rolename_.Set("", GetArena()); + } + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:benchmarktesting.Person.Role.roleName) +} + +// ------------------------------------------------------------------- + +// Person + +// optional string name = 1; +inline bool Person::has_name() const { + bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline void Person::clear_name() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + _impl_.name_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000001u; +} +inline const std::string& Person::name() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_get:benchmarktesting.Person.name) + return _internal_name(); +} +template +inline PROTOBUF_ALWAYS_INLINE void Person::set_name(Arg_&& arg, + Args_... args) { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + _impl_._has_bits_[0] |= 0x00000001u; + _impl_.name_.Set(static_cast(arg), args..., GetArena()); + // @@protoc_insertion_point(field_set:benchmarktesting.Person.name) +} +inline std::string* Person::mutable_name() ABSL_ATTRIBUTE_LIFETIME_BOUND { + std::string* _s = _internal_mutable_name(); + // @@protoc_insertion_point(field_mutable:benchmarktesting.Person.name) + return _s; +} +inline const std::string& Person::_internal_name() const { + PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race); + return _impl_.name_.Get(); +} +inline void Person::_internal_set_name(const std::string& value) { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + _impl_._has_bits_[0] |= 0x00000001u; + _impl_.name_.Set(value, GetArena()); +} +inline std::string* Person::_internal_mutable_name() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + _impl_._has_bits_[0] |= 0x00000001u; + return _impl_.name_.Mutable( GetArena()); +} +inline std::string* Person::release_name() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + // @@protoc_insertion_point(field_release:benchmarktesting.Person.name) + if ((_impl_._has_bits_[0] & 0x00000001u) == 0) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000001u; + auto* released = _impl_.name_.Release(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.name_.Set("", GetArena()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return released; +} +inline void Person::set_allocated_name(std::string* value) { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } + _impl_.name_.SetAllocated(value, GetArena()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.name_.IsDefault()) { + _impl_.name_.Set("", GetArena()); + } + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:benchmarktesting.Person.name) +} + +// optional int32 id = 2; +inline bool Person::has_id() const { + bool value = (_impl_._has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline void Person::clear_id() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + _impl_.id_ = 0; + _impl_._has_bits_[0] &= ~0x00000002u; +} +inline ::int32_t Person::id() const { + // @@protoc_insertion_point(field_get:benchmarktesting.Person.id) + return _internal_id(); +} +inline void Person::set_id(::int32_t value) { + _internal_set_id(value); + _impl_._has_bits_[0] |= 0x00000002u; + // @@protoc_insertion_point(field_set:benchmarktesting.Person.id) +} +inline ::int32_t Person::_internal_id() const { + PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race); + return _impl_.id_; +} +inline void Person::_internal_set_id(::int32_t value) { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + _impl_.id_ = value; +} + +// repeated .benchmarktesting.Person.Role roles = 3; +inline int Person::_internal_roles_size() const { + return _internal_roles().size(); +} +inline int Person::roles_size() const { + return _internal_roles_size(); +} +inline void Person::clear_roles() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + _impl_.roles_.Clear(); +} +inline ::benchmarktesting::Person_Role* Person::mutable_roles(int index) + ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_mutable:benchmarktesting.Person.roles) + return _internal_mutable_roles()->Mutable(index); +} +inline ::google::protobuf::RepeatedPtrField<::benchmarktesting::Person_Role>* Person::mutable_roles() + ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_mutable_list:benchmarktesting.Person.roles) + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + return _internal_mutable_roles(); +} +inline const ::benchmarktesting::Person_Role& Person::roles(int index) const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_get:benchmarktesting.Person.roles) + return _internal_roles().Get(index); +} +inline ::benchmarktesting::Person_Role* Person::add_roles() ABSL_ATTRIBUTE_LIFETIME_BOUND { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + ::benchmarktesting::Person_Role* _add = _internal_mutable_roles()->Add(); + // @@protoc_insertion_point(field_add:benchmarktesting.Person.roles) + return _add; +} +inline const ::google::protobuf::RepeatedPtrField<::benchmarktesting::Person_Role>& Person::roles() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_list:benchmarktesting.Person.roles) + return _internal_roles(); +} +inline const ::google::protobuf::RepeatedPtrField<::benchmarktesting::Person_Role>& +Person::_internal_roles() const { + PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race); + return _impl_.roles_; +} +inline ::google::protobuf::RepeatedPtrField<::benchmarktesting::Person_Role>* +Person::_internal_mutable_roles() { + PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race); + return &_impl_.roles_; +} + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif // __GNUC__ + +// @@protoc_insertion_point(namespace_scope) +} // namespace benchmarktesting + + +// @@protoc_insertion_point(global_scope) + +#include "google/protobuf/port_undef.inc" + +#endif // GOOGLE_PROTOBUF_INCLUDED_Person_2eproto_2epb_2eh diff --git a/benchmarking/include/Simple.hpp b/benchmarking/include/Simple.hpp new file mode 100644 index 0000000..b96d71f --- /dev/null +++ b/benchmarking/include/Simple.hpp @@ -0,0 +1,79 @@ +#pragma once + +#include +#include +#include "Vector.hpp" + +namespace boosttest +{ + struct Role + { + std::string m_roleName{}; + + template + void serialize(Archive& arc, const unsigned int) + { + arc & m_roleName; + } + }; + + struct Person + { + std::string m_name{}; + int m_id{}; + std::vector m_roles{}; + + template + void serialize(Archive& arc, const unsigned int) + { + arc & m_name; + arc & m_id; + arc & m_roles; + } + }; +} + +namespace bunnytest +{ + using bunny::FieldTag; + + struct Role + { + std::string m_roleName{}; + + template + void serialize(Paper& paper) + { + paper(m_roleName, FieldTag{1}); + } + + template + void deserialize(Paper& paper) + { + paper(m_roleName, FieldTag{1}); + } + }; + + struct Person + { + std::string m_name{}; + int m_id{}; + std::vector m_roles{}; + + template + void serialize(Paper& paper) + { + paper(m_name, FieldTag{1}); + paper(m_id, FieldTag{2}); + paper(m_roles, FieldTag{3}); + } + + template + void deserialize(Paper& paper) + { + paper(m_name, FieldTag{1}); + paper(m_id, FieldTag{2}); + paper(m_roles, FieldTag{3}); + } + }; +} \ No newline at end of file diff --git a/benchmarking/include/protobuf/Complex.proto b/benchmarking/include/protobuf/Complex.proto new file mode 100644 index 0000000..41fffe5 --- /dev/null +++ b/benchmarking/include/protobuf/Complex.proto @@ -0,0 +1,34 @@ +syntax = "proto2"; + +package complexbenchmarking; + +message ComplexClass +{ + optional int32 id = 1; + optional int32 count = 2; + optional string name = 3; + + message PlainClass + { + optional string name = 1; + map my_map = 2; + } + + message InnerIntMap + { + map m_map = 1; + } + + message InnerPlainClassMap + { + map my_map = 1; + } + + message InnerPlainClassMapArray + { + optional InnerPlainClassMap my_maps = 1; + } + + map int_map = 4; + repeated InnerPlainClassMapArray plain_class_map = 5; +} \ No newline at end of file diff --git a/benchmarking/include/protobuf/Person.proto b/benchmarking/include/protobuf/Person.proto new file mode 100644 index 0000000..b2e8c5c --- /dev/null +++ b/benchmarking/include/protobuf/Person.proto @@ -0,0 +1,16 @@ +syntax = "proto2"; + +package benchmarktesting; + +message Person +{ + optional string name = 1; + optional int32 id = 2; + + message Role + { + optional string roleName = 1; + } + + repeated Role roles = 3; +} \ No newline at end of file diff --git a/benchmarking/src/Complex.cpp b/benchmarking/src/Complex.cpp new file mode 100644 index 0000000..20351fb --- /dev/null +++ b/benchmarking/src/Complex.cpp @@ -0,0 +1,263 @@ +#include "Complex.hpp" +#include "ComposerPaper.hpp" +#include "DecomposerPaper.hpp" +#include "Complex.pb.h" +#include +#include +#include +#include + +void PerformanceTestBoostComplex(std::size_t); +void PerformanceTestBunnyComplex(std::size_t); +void PerformanceTestProtoComplex(std::size_t); + +static void BM_BoostComplex(benchmark::State &state) +{ + std::size_t count{}; + for (auto _ : state) + { + PerformanceTestBoostComplex(count++); + } +} + +static void BM_BunnyComplex(benchmark::State &state) +{ + std::size_t count{}; + for (auto _ : state) + { + PerformanceTestBunnyComplex(count++); + } +} + +static void BM_ProtoComplex(benchmark::State &state) +{ + std::size_t count{}; + for (auto _ : state) + { + PerformanceTestProtoComplex(count++); + } +} + +BENCHMARK(BM_BoostComplex); +BENCHMARK(BM_BunnyComplex); +BENCHMARK(BM_ProtoComplex); + +// BENCHMARK_MAIN(); + +constexpr std::uint64_t kCountThreshold = 100000; + +void PerformanceTestBoostComplex(std::size_t count) +{ + using boosttest::ComplexTestClass; + using boosttest::PlainClass; + + std::stringstream ss; + boost::archive::text_oarchive oa{ss}; + + ComplexTestClass out_obj; + + PlainClass plain1; + plain1.m_name = "plain1"; + plain1.m_map.insert({1, "left"}); + plain1.m_map.insert({2, "right"}); + plain1.m_map.insert({3, "forward"}); + plain1.m_map.insert({4, "backward"}); + + PlainClass plain2; + plain2.m_name = "plain2"; + plain2.m_map.insert({10, "left10"}); + plain2.m_map.insert({20, "right20"}); + plain2.m_map.insert({30, "forward30"}); + plain2.m_map.insert({40, "backward40"}); + + std::unordered_map map1; + map1.insert({100, plain1}); + map1.insert({200, plain2}); + + PlainClass plain3; + plain3.m_name = "plain3"; + plain3.m_map.insert({11, "left"}); + plain3.m_map.insert({21, "right"}); + plain3.m_map.insert({31, "forward"}); + plain3.m_map.insert({41, "backward"}); + + PlainClass plain4; + plain4.m_name = "plain4"; + plain4.m_map.insert({105, "left10"}); + plain4.m_map.insert({205, "right20"}); + plain4.m_map.insert({305, "forward30"}); + plain4.m_map.insert({405, "backward40"}); + + std::unordered_map map2; + map2.insert({100, plain3}); + map2.insert({200, plain4}); + + out_obj.m_plain_map[0].insert({888, map1}); + out_obj.m_plain_map[2].insert({999, map2}); + + out_obj.m_count = 7070; + out_obj.m_id = 2323; + + std::unordered_map map_int1; + map_int1.insert({1, 10}); + + std::unordered_map map_int2; + map_int2.insert({2, 20}); + + out_obj.m_int_map.insert({7979, map_int1}); + out_obj.m_int_map.insert({9090, map_int2}); + + oa << out_obj; + + if (count % kCountThreshold == 0) + { + boost::archive::text_iarchive ia{ss}; + ComplexTestClass in_obj; + ia >> in_obj; + } +} + +void PerformanceTestBunnyComplex(std::size_t count) +{ + using bunnytest::ComplexTestClass; + using bunnytest::PlainClass; + + std::stringstream ss; + bunny::ComposerPaper composer{ss}; + + ComplexTestClass out_obj; + + PlainClass plain1; + plain1.m_name = "plain1"; + plain1.m_map.insert({1, "left"}); + plain1.m_map.insert({2, "right"}); + plain1.m_map.insert({3, "forward"}); + plain1.m_map.insert({4, "backward"}); + + PlainClass plain2; + plain2.m_name = "plain2"; + plain2.m_map.insert({10, "left10"}); + plain2.m_map.insert({20, "right20"}); + plain2.m_map.insert({30, "forward30"}); + plain2.m_map.insert({40, "backward40"}); + + std::unordered_map map1; + map1.insert({100, plain1}); + map1.insert({200, plain2}); + + PlainClass plain3; + plain3.m_name = "plain3"; + plain3.m_map.insert({11, "left"}); + plain3.m_map.insert({21, "right"}); + plain3.m_map.insert({31, "forward"}); + plain3.m_map.insert({41, "backward"}); + + PlainClass plain4; + plain4.m_name = "plain4"; + plain4.m_map.insert({105, "left10"}); + plain4.m_map.insert({205, "right20"}); + plain4.m_map.insert({305, "forward30"}); + plain4.m_map.insert({405, "backward40"}); + + std::unordered_map map2; + map2.insert({100, plain3}); + map2.insert({200, plain4}); + + out_obj.m_plain_map[0].insert({888, map1}); + out_obj.m_plain_map[2].insert({999, map2}); + + out_obj.m_count = 7070; + out_obj.m_id = 2323; + + std::unordered_map map_int1; + map_int1.insert({1, 10}); + + std::unordered_map map_int2; + map_int2.insert({2, 20}); + + out_obj.m_int_map.insert({7979, map_int1}); + out_obj.m_int_map.insert({9090, map_int2}); + + composer << out_obj; + + if (count % kCountThreshold == 0) + { + bunny::DecomposerPaper decomposer{ss}; + ComplexTestClass in_obj; + decomposer >> in_obj; + } +} + +void PerformanceTestProtoComplex(std::size_t count) +{ + GOOGLE_PROTOBUF_VERIFY_VERSION; + + std::stringstream ss{}; + + { + complexbenchmarking::ComplexClass out_obj; + out_obj.set_name("sia"); + out_obj.set_count(99999); + out_obj.set_id(909090); + + complexbenchmarking::ComplexClass_PlainClass plain_class1; + auto plain1_map = plain_class1.mutable_my_map(); + plain_class1.set_name("plain1"); + plain1_map->insert({1, "left"}); + plain1_map->insert({2, "right"}); + plain1_map->insert({3, "forward"}); + plain1_map->insert({4, "backward"}); + + complexbenchmarking::ComplexClass_PlainClass plain_class2; + auto plain2_map = plain_class2.mutable_my_map(); + plain_class2.set_name("plain2"); + plain2_map->insert({1, "left10"}); + plain2_map->insert({2, "right20"}); + plain2_map->insert({3, "forward30"}); + plain2_map->insert({4, "backward40"}); + + complexbenchmarking::ComplexClass_PlainClass plain_class3; + auto plain3_map = plain_class3.mutable_my_map(); + plain_class3.set_name("plain3"); + plain3_map->insert({1, "left"}); + plain3_map->insert({2, "right"}); + plain3_map->insert({3, "forward"}); + plain3_map->insert({4, "backward"}); + + complexbenchmarking::ComplexClass_PlainClass plain_class4; + auto plain4_map = plain_class4.mutable_my_map(); + plain_class4.set_name("plain4"); + plain4_map->insert({1, "left10"}); + plain4_map->insert({2, "right20"}); + plain4_map->insert({3, "forward30"}); + plain4_map->insert({4, "backward40"}); + + complexbenchmarking::ComplexClass_InnerPlainClassMapArray map_array1; + map_array1.mutable_my_maps()->mutable_my_map()->insert({100, plain_class1}); + map_array1.mutable_my_maps()->mutable_my_map()->insert({200, plain_class2}); + + complexbenchmarking::ComplexClass_InnerPlainClassMapArray map_array2; + map_array2.mutable_my_maps()->mutable_my_map()->insert({100, plain_class3}); + map_array2.mutable_my_maps()->mutable_my_map()->insert({200, plain_class4}); + + out_obj.mutable_plain_class_map()->Add(std::move(map_array1)); + out_obj.mutable_plain_class_map()->Add(std::move(map_array2)); + + complexbenchmarking::ComplexClass_InnerIntMap int_map1; + int_map1.mutable_m_map()->insert({1, 10}); + + complexbenchmarking::ComplexClass_InnerIntMap int_map2; + int_map2.mutable_m_map()->insert({2, 20}); + + out_obj.mutable_int_map()->insert({7979, int_map1}); + out_obj.mutable_int_map()->insert({9090, int_map2}); + + out_obj.SerializeToOstream(&ss); + } + + if (count % kCountThreshold == 0) + { + complexbenchmarking::ComplexClass in_obj; + in_obj.ParseFromIstream(&ss); + } +} \ No newline at end of file diff --git a/benchmarking/src/Complex.pb.cc b/benchmarking/src/Complex.pb.cc new file mode 100644 index 0000000..fb61fb2 --- /dev/null +++ b/benchmarking/src/Complex.pb.cc @@ -0,0 +1,1645 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: Complex.proto +// Protobuf C++ Version: 4.26.0-dev + +#include "Complex.pb.h" + +#include +#include "google/protobuf/io/coded_stream.h" +#include "google/protobuf/extension_set.h" +#include "google/protobuf/wire_format_lite.h" +#include "google/protobuf/descriptor.h" +#include "google/protobuf/generated_message_reflection.h" +#include "google/protobuf/reflection_ops.h" +#include "google/protobuf/wire_format.h" +#include "google/protobuf/generated_message_tctable_impl.h" +// @@protoc_insertion_point(includes) + +// Must be included last. +#include "google/protobuf/port_def.inc" +PROTOBUF_PRAGMA_INIT_SEG +namespace _pb = ::google::protobuf; +namespace _pbi = ::google::protobuf::internal; +namespace _fl = ::google::protobuf::internal::field_layout; +namespace complexbenchmarking { + template +PROTOBUF_CONSTEXPR ComplexClass_PlainClass_MyMapEntry_DoNotUse::ComplexClass_PlainClass_MyMapEntry_DoNotUse(::_pbi::ConstantInitialized) {} +struct ComplexClass_PlainClass_MyMapEntry_DoNotUseDefaultTypeInternal { + PROTOBUF_CONSTEXPR ComplexClass_PlainClass_MyMapEntry_DoNotUseDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} + ~ComplexClass_PlainClass_MyMapEntry_DoNotUseDefaultTypeInternal() {} + union { + ComplexClass_PlainClass_MyMapEntry_DoNotUse _instance; + }; +}; + +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ComplexClass_PlainClass_MyMapEntry_DoNotUseDefaultTypeInternal _ComplexClass_PlainClass_MyMapEntry_DoNotUse_default_instance_; + template +PROTOBUF_CONSTEXPR ComplexClass_InnerIntMap_MMapEntry_DoNotUse::ComplexClass_InnerIntMap_MMapEntry_DoNotUse(::_pbi::ConstantInitialized) {} +struct ComplexClass_InnerIntMap_MMapEntry_DoNotUseDefaultTypeInternal { + PROTOBUF_CONSTEXPR ComplexClass_InnerIntMap_MMapEntry_DoNotUseDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} + ~ComplexClass_InnerIntMap_MMapEntry_DoNotUseDefaultTypeInternal() {} + union { + ComplexClass_InnerIntMap_MMapEntry_DoNotUse _instance; + }; +}; + +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ComplexClass_InnerIntMap_MMapEntry_DoNotUseDefaultTypeInternal _ComplexClass_InnerIntMap_MMapEntry_DoNotUse_default_instance_; + +inline constexpr ComplexClass_PlainClass::Impl_::Impl_( + ::_pbi::ConstantInitialized) noexcept + : _cached_size_{0}, + my_map_{}, + name_( + &::google::protobuf::internal::fixed_address_empty_string, + ::_pbi::ConstantInitialized()) {} + +template +PROTOBUF_CONSTEXPR ComplexClass_PlainClass::ComplexClass_PlainClass(::_pbi::ConstantInitialized) + : _impl_(::_pbi::ConstantInitialized()) {} +struct ComplexClass_PlainClassDefaultTypeInternal { + PROTOBUF_CONSTEXPR ComplexClass_PlainClassDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} + ~ComplexClass_PlainClassDefaultTypeInternal() {} + union { + ComplexClass_PlainClass _instance; + }; +}; + +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ComplexClass_PlainClassDefaultTypeInternal _ComplexClass_PlainClass_default_instance_; + +inline constexpr ComplexClass_InnerIntMap::Impl_::Impl_( + ::_pbi::ConstantInitialized) noexcept + : m_map_{}, + _cached_size_{0} {} + +template +PROTOBUF_CONSTEXPR ComplexClass_InnerIntMap::ComplexClass_InnerIntMap(::_pbi::ConstantInitialized) + : _impl_(::_pbi::ConstantInitialized()) {} +struct ComplexClass_InnerIntMapDefaultTypeInternal { + PROTOBUF_CONSTEXPR ComplexClass_InnerIntMapDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} + ~ComplexClass_InnerIntMapDefaultTypeInternal() {} + union { + ComplexClass_InnerIntMap _instance; + }; +}; + +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ComplexClass_InnerIntMapDefaultTypeInternal _ComplexClass_InnerIntMap_default_instance_; + template +PROTOBUF_CONSTEXPR ComplexClass_IntMapEntry_DoNotUse::ComplexClass_IntMapEntry_DoNotUse(::_pbi::ConstantInitialized) {} +struct ComplexClass_IntMapEntry_DoNotUseDefaultTypeInternal { + PROTOBUF_CONSTEXPR ComplexClass_IntMapEntry_DoNotUseDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} + ~ComplexClass_IntMapEntry_DoNotUseDefaultTypeInternal() {} + union { + ComplexClass_IntMapEntry_DoNotUse _instance; + }; +}; + +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ComplexClass_IntMapEntry_DoNotUseDefaultTypeInternal _ComplexClass_IntMapEntry_DoNotUse_default_instance_; + template +PROTOBUF_CONSTEXPR ComplexClass_InnerPlainClassMap_MyMapEntry_DoNotUse::ComplexClass_InnerPlainClassMap_MyMapEntry_DoNotUse(::_pbi::ConstantInitialized) {} +struct ComplexClass_InnerPlainClassMap_MyMapEntry_DoNotUseDefaultTypeInternal { + PROTOBUF_CONSTEXPR ComplexClass_InnerPlainClassMap_MyMapEntry_DoNotUseDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} + ~ComplexClass_InnerPlainClassMap_MyMapEntry_DoNotUseDefaultTypeInternal() {} + union { + ComplexClass_InnerPlainClassMap_MyMapEntry_DoNotUse _instance; + }; +}; + +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ComplexClass_InnerPlainClassMap_MyMapEntry_DoNotUseDefaultTypeInternal _ComplexClass_InnerPlainClassMap_MyMapEntry_DoNotUse_default_instance_; + +inline constexpr ComplexClass_InnerPlainClassMap::Impl_::Impl_( + ::_pbi::ConstantInitialized) noexcept + : my_map_{}, + _cached_size_{0} {} + +template +PROTOBUF_CONSTEXPR ComplexClass_InnerPlainClassMap::ComplexClass_InnerPlainClassMap(::_pbi::ConstantInitialized) + : _impl_(::_pbi::ConstantInitialized()) {} +struct ComplexClass_InnerPlainClassMapDefaultTypeInternal { + PROTOBUF_CONSTEXPR ComplexClass_InnerPlainClassMapDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} + ~ComplexClass_InnerPlainClassMapDefaultTypeInternal() {} + union { + ComplexClass_InnerPlainClassMap _instance; + }; +}; + +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ComplexClass_InnerPlainClassMapDefaultTypeInternal _ComplexClass_InnerPlainClassMap_default_instance_; + +inline constexpr ComplexClass_InnerPlainClassMapArray::Impl_::Impl_( + ::_pbi::ConstantInitialized) noexcept + : _cached_size_{0}, + my_maps_{nullptr} {} + +template +PROTOBUF_CONSTEXPR ComplexClass_InnerPlainClassMapArray::ComplexClass_InnerPlainClassMapArray(::_pbi::ConstantInitialized) + : _impl_(::_pbi::ConstantInitialized()) {} +struct ComplexClass_InnerPlainClassMapArrayDefaultTypeInternal { + PROTOBUF_CONSTEXPR ComplexClass_InnerPlainClassMapArrayDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} + ~ComplexClass_InnerPlainClassMapArrayDefaultTypeInternal() {} + union { + ComplexClass_InnerPlainClassMapArray _instance; + }; +}; + +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ComplexClass_InnerPlainClassMapArrayDefaultTypeInternal _ComplexClass_InnerPlainClassMapArray_default_instance_; + +inline constexpr ComplexClass::Impl_::Impl_( + ::_pbi::ConstantInitialized) noexcept + : _cached_size_{0}, + int_map_{}, + plain_class_map_{}, + name_( + &::google::protobuf::internal::fixed_address_empty_string, + ::_pbi::ConstantInitialized()), + id_{0}, + count_{0} {} + +template +PROTOBUF_CONSTEXPR ComplexClass::ComplexClass(::_pbi::ConstantInitialized) + : _impl_(::_pbi::ConstantInitialized()) {} +struct ComplexClassDefaultTypeInternal { + PROTOBUF_CONSTEXPR ComplexClassDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} + ~ComplexClassDefaultTypeInternal() {} + union { + ComplexClass _instance; + }; +}; + +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ComplexClassDefaultTypeInternal _ComplexClass_default_instance_; +} // namespace complexbenchmarking +static ::_pb::Metadata file_level_metadata_Complex_2eproto[9]; +static constexpr const ::_pb::EnumDescriptor** + file_level_enum_descriptors_Complex_2eproto = nullptr; +static constexpr const ::_pb::ServiceDescriptor** + file_level_service_descriptors_Complex_2eproto = nullptr; +const ::uint32_t + TableStruct_Complex_2eproto::offsets[] ABSL_ATTRIBUTE_SECTION_VARIABLE( + protodesc_cold) = { + PROTOBUF_FIELD_OFFSET(::complexbenchmarking::ComplexClass_PlainClass_MyMapEntry_DoNotUse, _has_bits_), + PROTOBUF_FIELD_OFFSET(::complexbenchmarking::ComplexClass_PlainClass_MyMapEntry_DoNotUse, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) + PROTOBUF_FIELD_OFFSET(::complexbenchmarking::ComplexClass_PlainClass_MyMapEntry_DoNotUse, key_), + PROTOBUF_FIELD_OFFSET(::complexbenchmarking::ComplexClass_PlainClass_MyMapEntry_DoNotUse, value_), + 0, + 1, + PROTOBUF_FIELD_OFFSET(::complexbenchmarking::ComplexClass_PlainClass, _impl_._has_bits_), + PROTOBUF_FIELD_OFFSET(::complexbenchmarking::ComplexClass_PlainClass, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) + PROTOBUF_FIELD_OFFSET(::complexbenchmarking::ComplexClass_PlainClass, _impl_.name_), + PROTOBUF_FIELD_OFFSET(::complexbenchmarking::ComplexClass_PlainClass, _impl_.my_map_), + 0, + ~0u, + PROTOBUF_FIELD_OFFSET(::complexbenchmarking::ComplexClass_InnerIntMap_MMapEntry_DoNotUse, _has_bits_), + PROTOBUF_FIELD_OFFSET(::complexbenchmarking::ComplexClass_InnerIntMap_MMapEntry_DoNotUse, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) + PROTOBUF_FIELD_OFFSET(::complexbenchmarking::ComplexClass_InnerIntMap_MMapEntry_DoNotUse, key_), + PROTOBUF_FIELD_OFFSET(::complexbenchmarking::ComplexClass_InnerIntMap_MMapEntry_DoNotUse, value_), + 0, + 1, + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::complexbenchmarking::ComplexClass_InnerIntMap, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) + PROTOBUF_FIELD_OFFSET(::complexbenchmarking::ComplexClass_InnerIntMap, _impl_.m_map_), + PROTOBUF_FIELD_OFFSET(::complexbenchmarking::ComplexClass_InnerPlainClassMap_MyMapEntry_DoNotUse, _has_bits_), + PROTOBUF_FIELD_OFFSET(::complexbenchmarking::ComplexClass_InnerPlainClassMap_MyMapEntry_DoNotUse, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) + PROTOBUF_FIELD_OFFSET(::complexbenchmarking::ComplexClass_InnerPlainClassMap_MyMapEntry_DoNotUse, key_), + PROTOBUF_FIELD_OFFSET(::complexbenchmarking::ComplexClass_InnerPlainClassMap_MyMapEntry_DoNotUse, value_), + 0, + 1, + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::complexbenchmarking::ComplexClass_InnerPlainClassMap, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) + PROTOBUF_FIELD_OFFSET(::complexbenchmarking::ComplexClass_InnerPlainClassMap, _impl_.my_map_), + PROTOBUF_FIELD_OFFSET(::complexbenchmarking::ComplexClass_InnerPlainClassMapArray, _impl_._has_bits_), + PROTOBUF_FIELD_OFFSET(::complexbenchmarking::ComplexClass_InnerPlainClassMapArray, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) + PROTOBUF_FIELD_OFFSET(::complexbenchmarking::ComplexClass_InnerPlainClassMapArray, _impl_.my_maps_), + 0, + PROTOBUF_FIELD_OFFSET(::complexbenchmarking::ComplexClass_IntMapEntry_DoNotUse, _has_bits_), + PROTOBUF_FIELD_OFFSET(::complexbenchmarking::ComplexClass_IntMapEntry_DoNotUse, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) + PROTOBUF_FIELD_OFFSET(::complexbenchmarking::ComplexClass_IntMapEntry_DoNotUse, key_), + PROTOBUF_FIELD_OFFSET(::complexbenchmarking::ComplexClass_IntMapEntry_DoNotUse, value_), + 0, + 1, + PROTOBUF_FIELD_OFFSET(::complexbenchmarking::ComplexClass, _impl_._has_bits_), + PROTOBUF_FIELD_OFFSET(::complexbenchmarking::ComplexClass, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) + PROTOBUF_FIELD_OFFSET(::complexbenchmarking::ComplexClass, _impl_.id_), + PROTOBUF_FIELD_OFFSET(::complexbenchmarking::ComplexClass, _impl_.count_), + PROTOBUF_FIELD_OFFSET(::complexbenchmarking::ComplexClass, _impl_.name_), + PROTOBUF_FIELD_OFFSET(::complexbenchmarking::ComplexClass, _impl_.int_map_), + PROTOBUF_FIELD_OFFSET(::complexbenchmarking::ComplexClass, _impl_.plain_class_map_), + 1, + 2, + 0, + ~0u, + ~0u, +}; + +static const ::_pbi::MigrationSchema + schemas[] ABSL_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { + {0, 10, -1, sizeof(::complexbenchmarking::ComplexClass_PlainClass_MyMapEntry_DoNotUse)}, + {12, 22, -1, sizeof(::complexbenchmarking::ComplexClass_PlainClass)}, + {24, 34, -1, sizeof(::complexbenchmarking::ComplexClass_InnerIntMap_MMapEntry_DoNotUse)}, + {36, -1, -1, sizeof(::complexbenchmarking::ComplexClass_InnerIntMap)}, + {45, 55, -1, sizeof(::complexbenchmarking::ComplexClass_InnerPlainClassMap_MyMapEntry_DoNotUse)}, + {57, -1, -1, sizeof(::complexbenchmarking::ComplexClass_InnerPlainClassMap)}, + {66, 75, -1, sizeof(::complexbenchmarking::ComplexClass_InnerPlainClassMapArray)}, + {76, 86, -1, sizeof(::complexbenchmarking::ComplexClass_IntMapEntry_DoNotUse)}, + {88, 101, -1, sizeof(::complexbenchmarking::ComplexClass)}, +}; + +static const ::_pb::Message* const file_default_instances[] = { + &::complexbenchmarking::_ComplexClass_PlainClass_MyMapEntry_DoNotUse_default_instance_._instance, + &::complexbenchmarking::_ComplexClass_PlainClass_default_instance_._instance, + &::complexbenchmarking::_ComplexClass_InnerIntMap_MMapEntry_DoNotUse_default_instance_._instance, + &::complexbenchmarking::_ComplexClass_InnerIntMap_default_instance_._instance, + &::complexbenchmarking::_ComplexClass_InnerPlainClassMap_MyMapEntry_DoNotUse_default_instance_._instance, + &::complexbenchmarking::_ComplexClass_InnerPlainClassMap_default_instance_._instance, + &::complexbenchmarking::_ComplexClass_InnerPlainClassMapArray_default_instance_._instance, + &::complexbenchmarking::_ComplexClass_IntMapEntry_DoNotUse_default_instance_._instance, + &::complexbenchmarking::_ComplexClass_default_instance_._instance, +}; +const char descriptor_table_protodef_Complex_2eproto[] ABSL_ATTRIBUTE_SECTION_VARIABLE( + protodesc_cold) = { + "\n\rComplex.proto\022\023complexbenchmarking\"\350\006\n" + "\014ComplexClass\022\n\n\002id\030\001 \001(\005\022\r\n\005count\030\002 \001(\005" + "\022\014\n\004name\030\003 \001(\t\022>\n\007int_map\030\004 \003(\0132-.comple" + "xbenchmarking.ComplexClass.IntMapEntry\022R" + "\n\017plain_class_map\030\005 \003(\01329.complexbenchma" + "rking.ComplexClass.InnerPlainClassMapArr" + "ay\032\221\001\n\nPlainClass\022\014\n\004name\030\001 \001(\t\022G\n\006my_ma" + "p\030\002 \003(\01327.complexbenchmarking.ComplexCla" + "ss.PlainClass.MyMapEntry\032,\n\nMyMapEntry\022\013" + "\n\003key\030\001 \001(\005\022\r\n\005value\030\002 \001(\t:\0028\001\032\202\001\n\013Inner" + "IntMap\022F\n\005m_map\030\001 \003(\01327.complexbenchmark" + "ing.ComplexClass.InnerIntMap.MMapEntry\032+" + "\n\tMMapEntry\022\013\n\003key\030\001 \001(\005\022\r\n\005value\030\002 \001(\005:" + "\0028\001\032\301\001\n\022InnerPlainClassMap\022O\n\006my_map\030\001 \003" + "(\0132\?.complexbenchmarking.ComplexClass.In" + "nerPlainClassMap.MyMapEntry\032Z\n\nMyMapEntr" + "y\022\013\n\003key\030\001 \001(\005\022;\n\005value\030\002 \001(\0132,.complexb" + "enchmarking.ComplexClass.PlainClass:\0028\001\032" + "`\n\027InnerPlainClassMapArray\022E\n\007my_maps\030\001 " + "\001(\01324.complexbenchmarking.ComplexClass.I" + "nnerPlainClassMap\032\\\n\013IntMapEntry\022\013\n\003key\030" + "\001 \001(\005\022<\n\005value\030\002 \001(\0132-.complexbenchmarki" + "ng.ComplexClass.InnerIntMap:\0028\001" +}; +static ::absl::once_flag descriptor_table_Complex_2eproto_once; +const ::_pbi::DescriptorTable descriptor_table_Complex_2eproto = { + false, + false, + 911, + descriptor_table_protodef_Complex_2eproto, + "Complex.proto", + &descriptor_table_Complex_2eproto_once, + nullptr, + 0, + 9, + schemas, + file_default_instances, + TableStruct_Complex_2eproto::offsets, + file_level_metadata_Complex_2eproto, + file_level_enum_descriptors_Complex_2eproto, + file_level_service_descriptors_Complex_2eproto, +}; + +// This function exists to be marked as weak. +// It can significantly speed up compilation by breaking up LLVM's SCC +// in the .pb.cc translation units. Large translation units see a +// reduction of more than 35% of walltime for optimized builds. Without +// the weak attribute all the messages in the file, including all the +// vtables and everything they use become part of the same SCC through +// a cycle like: +// GetMetadata -> descriptor table -> default instances -> +// vtables -> GetMetadata +// By adding a weak function here we break the connection from the +// individual vtables back into the descriptor table. +PROTOBUF_ATTRIBUTE_WEAK const ::_pbi::DescriptorTable* descriptor_table_Complex_2eproto_getter() { + return &descriptor_table_Complex_2eproto; +} +// Force running AddDescriptors() at dynamic initialization time. +PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 +static ::_pbi::AddDescriptorsRunner dynamic_init_dummy_Complex_2eproto(&descriptor_table_Complex_2eproto); +namespace complexbenchmarking { +// =================================================================== + +ComplexClass_PlainClass_MyMapEntry_DoNotUse::ComplexClass_PlainClass_MyMapEntry_DoNotUse() {} +ComplexClass_PlainClass_MyMapEntry_DoNotUse::ComplexClass_PlainClass_MyMapEntry_DoNotUse(::google::protobuf::Arena* arena) + : SuperType(arena) {} +::google::protobuf::Metadata ComplexClass_PlainClass_MyMapEntry_DoNotUse::GetMetadata() const { + return ::_pbi::AssignDescriptors( + &descriptor_table_Complex_2eproto_getter, &descriptor_table_Complex_2eproto_once, + file_level_metadata_Complex_2eproto[0]); +} +// =================================================================== + +class ComplexClass_PlainClass::_Internal { + public: + using HasBits = decltype(std::declval()._impl_._has_bits_); + static constexpr ::int32_t kHasBitsOffset = + 8 * PROTOBUF_FIELD_OFFSET(ComplexClass_PlainClass, _impl_._has_bits_); +}; + +ComplexClass_PlainClass::ComplexClass_PlainClass(::google::protobuf::Arena* arena) + : ::google::protobuf::Message(arena) { + SharedCtor(arena); + // @@protoc_insertion_point(arena_constructor:complexbenchmarking.ComplexClass.PlainClass) +} +inline PROTOBUF_NDEBUG_INLINE ComplexClass_PlainClass::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, + const Impl_& from) + : _has_bits_{from._has_bits_}, + _cached_size_{0}, + my_map_{visibility, arena, from.my_map_}, + name_(arena, from.name_) {} + +ComplexClass_PlainClass::ComplexClass_PlainClass( + ::google::protobuf::Arena* arena, + const ComplexClass_PlainClass& from) + : ::google::protobuf::Message(arena) { + ComplexClass_PlainClass* const _this = this; + (void)_this; + _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( + from._internal_metadata_); + new (&_impl_) Impl_(internal_visibility(), arena, from._impl_); + + // @@protoc_insertion_point(copy_constructor:complexbenchmarking.ComplexClass.PlainClass) +} +inline PROTOBUF_NDEBUG_INLINE ComplexClass_PlainClass::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena) + : _cached_size_{0}, + my_map_{visibility, arena}, + name_(arena) {} + +inline void ComplexClass_PlainClass::SharedCtor(::_pb::Arena* arena) { + new (&_impl_) Impl_(internal_visibility(), arena); +} +ComplexClass_PlainClass::~ComplexClass_PlainClass() { + // @@protoc_insertion_point(destructor:complexbenchmarking.ComplexClass.PlainClass) + _internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); + SharedDtor(); +} +inline void ComplexClass_PlainClass::SharedDtor() { + ABSL_DCHECK(GetArena() == nullptr); + _impl_.name_.Destroy(); + _impl_.~Impl_(); +} + +const ::google::protobuf::MessageLite::ClassData* +ComplexClass_PlainClass::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + _data_ = { + ComplexClass_PlainClass::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + PROTOBUF_FIELD_OFFSET(ComplexClass_PlainClass, _impl_._cached_size_), + }; + return &_data_; +} +PROTOBUF_NOINLINE void ComplexClass_PlainClass::Clear() { +// @@protoc_insertion_point(message_clear_start:complexbenchmarking.ComplexClass.PlainClass) + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _impl_.my_map_.Clear(); + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + _impl_.name_.ClearNonDefaultToEmpty(); + } + _impl_._has_bits_.Clear(); + _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); +} + +const char* ComplexClass_PlainClass::_InternalParse( + const char* ptr, ::_pbi::ParseContext* ctx) { + ptr = ::_pbi::TcParser::ParseLoop(this, ptr, ctx, &_table_.header); + return ptr; +} + + +PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 +const ::_pbi::TcParseTable<0, 2, 1, 62, 2> ComplexClass_PlainClass::_table_ = { + { + PROTOBUF_FIELD_OFFSET(ComplexClass_PlainClass, _impl_._has_bits_), + 0, // no _extensions_ + 2, 0, // max_field_number, fast_idx_mask + offsetof(decltype(_table_), field_lookup_table), + 4294967292, // skipmap + offsetof(decltype(_table_), field_entries), + 2, // num_field_entries + 1, // num_aux_entries + offsetof(decltype(_table_), aux_entries), + &_ComplexClass_PlainClass_default_instance_._instance, + ::_pbi::TcParser::GenericFallback, // fallback + #ifdef PROTOBUF_PREFETCH_PARSE_TABLE + ::_pbi::TcParser::GetTable<::complexbenchmarking::ComplexClass_PlainClass>(), // to_prefetch + #endif // PROTOBUF_PREFETCH_PARSE_TABLE + }, {{ + // optional string name = 1; + {::_pbi::TcParser::FastSS1, + {10, 0, 0, PROTOBUF_FIELD_OFFSET(ComplexClass_PlainClass, _impl_.name_)}}, + }}, {{ + 65535, 65535 + }}, {{ + // optional string name = 1; + {PROTOBUF_FIELD_OFFSET(ComplexClass_PlainClass, _impl_.name_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kRawString | ::_fl::kRepAString)}, + // map my_map = 2; + {PROTOBUF_FIELD_OFFSET(ComplexClass_PlainClass, _impl_.my_map_), -1, 0, + (0 | ::_fl::kFcRepeated | ::_fl::kMap)}, + }}, {{ + {::_pbi::TcParser::GetMapAuxInfo< + decltype(ComplexClass_PlainClass()._impl_.my_map_)>( + 0, 1, 0, 5, + 9)}, + }}, {{ + "\53\4\6\0\0\0\0\0" + "complexbenchmarking.ComplexClass.PlainClass" + "name" + "my_map" + }}, +}; + +::uint8_t* ComplexClass_PlainClass::_InternalSerialize( + ::uint8_t* target, + ::google::protobuf::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:complexbenchmarking.ComplexClass.PlainClass) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; + + cached_has_bits = _impl_._has_bits_[0]; + // optional string name = 1; + if (cached_has_bits & 0x00000001u) { + const std::string& _s = this->_internal_name(); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "complexbenchmarking.ComplexClass.PlainClass.name"); + target = stream->WriteStringMaybeAliased(1, _s, target); + } + + // map my_map = 2; + if (!_internal_my_map().empty()) { + using MapType = ::google::protobuf::Map<::int32_t, std::string>; + using WireHelper = _pbi::MapEntryFuncs<::int32_t, std::string, + _pbi::WireFormatLite::TYPE_INT32, + _pbi::WireFormatLite::TYPE_STRING>; + const auto& field = _internal_my_map(); + + if (stream->IsSerializationDeterministic() && field.size() > 1) { + for (const auto& entry : ::google::protobuf::internal::MapSorterFlat(field)) { + target = WireHelper::InternalSerialize( + 2, entry.first, entry.second, target, stream); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(entry.second.data(), static_cast(entry.second.length()), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "complexbenchmarking.ComplexClass.PlainClass.my_map"); + } + } else { + for (const auto& entry : field) { + target = WireHelper::InternalSerialize( + 2, entry.first, entry.second, target, stream); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(entry.second.data(), static_cast(entry.second.length()), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "complexbenchmarking.ComplexClass.PlainClass.my_map"); + } + } + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:complexbenchmarking.ComplexClass.PlainClass) + return target; +} + +::size_t ComplexClass_PlainClass::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:complexbenchmarking.ComplexClass.PlainClass) + ::size_t total_size = 0; + + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // map my_map = 2; + total_size += 1 * ::google::protobuf::internal::FromIntSize(_internal_my_map_size()); + for (const auto& entry : _internal_my_map()) { + total_size += _pbi::MapEntryFuncs<::int32_t, std::string, + _pbi::WireFormatLite::TYPE_INT32, + _pbi::WireFormatLite::TYPE_STRING>::ByteSizeLong(entry.first, entry.second); + } + // optional string name = 1; + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this->_internal_name()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); +} + + +void ComplexClass_PlainClass::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { + auto* const _this = static_cast(&to_msg); + auto& from = static_cast(from_msg); + // @@protoc_insertion_point(class_specific_merge_from_start:complexbenchmarking.ComplexClass.PlainClass) + ABSL_DCHECK_NE(&from, _this); + ::uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + _this->_impl_.my_map_.MergeFrom(from._impl_.my_map_); + cached_has_bits = from._impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + _this->_internal_set_name(from._internal_name()); + } + _this->_impl_._has_bits_[0] |= cached_has_bits; + _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); +} + +void ComplexClass_PlainClass::CopyFrom(const ComplexClass_PlainClass& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:complexbenchmarking.ComplexClass.PlainClass) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +PROTOBUF_NOINLINE bool ComplexClass_PlainClass::IsInitialized() const { + return true; +} + +void ComplexClass_PlainClass::InternalSwap(ComplexClass_PlainClass* PROTOBUF_RESTRICT other) { + using std::swap; + auto* arena = GetArena(); + ABSL_DCHECK_EQ(arena, other->GetArena()); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); + _impl_.my_map_.InternalSwap(&other->_impl_.my_map_); + ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.name_, &other->_impl_.name_, arena); +} + +::google::protobuf::Metadata ComplexClass_PlainClass::GetMetadata() const { + return ::_pbi::AssignDescriptors( + &descriptor_table_Complex_2eproto_getter, &descriptor_table_Complex_2eproto_once, + file_level_metadata_Complex_2eproto[1]); +} +// =================================================================== + +ComplexClass_InnerIntMap_MMapEntry_DoNotUse::ComplexClass_InnerIntMap_MMapEntry_DoNotUse() {} +ComplexClass_InnerIntMap_MMapEntry_DoNotUse::ComplexClass_InnerIntMap_MMapEntry_DoNotUse(::google::protobuf::Arena* arena) + : SuperType(arena) {} +::google::protobuf::Metadata ComplexClass_InnerIntMap_MMapEntry_DoNotUse::GetMetadata() const { + return ::_pbi::AssignDescriptors( + &descriptor_table_Complex_2eproto_getter, &descriptor_table_Complex_2eproto_once, + file_level_metadata_Complex_2eproto[2]); +} +// =================================================================== + +class ComplexClass_InnerIntMap::_Internal { + public: +}; + +ComplexClass_InnerIntMap::ComplexClass_InnerIntMap(::google::protobuf::Arena* arena) + : ::google::protobuf::Message(arena) { + SharedCtor(arena); + // @@protoc_insertion_point(arena_constructor:complexbenchmarking.ComplexClass.InnerIntMap) +} +inline PROTOBUF_NDEBUG_INLINE ComplexClass_InnerIntMap::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, + const Impl_& from) + : m_map_{visibility, arena, from.m_map_}, + _cached_size_{0} {} + +ComplexClass_InnerIntMap::ComplexClass_InnerIntMap( + ::google::protobuf::Arena* arena, + const ComplexClass_InnerIntMap& from) + : ::google::protobuf::Message(arena) { + ComplexClass_InnerIntMap* const _this = this; + (void)_this; + _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( + from._internal_metadata_); + new (&_impl_) Impl_(internal_visibility(), arena, from._impl_); + + // @@protoc_insertion_point(copy_constructor:complexbenchmarking.ComplexClass.InnerIntMap) +} +inline PROTOBUF_NDEBUG_INLINE ComplexClass_InnerIntMap::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena) + : m_map_{visibility, arena}, + _cached_size_{0} {} + +inline void ComplexClass_InnerIntMap::SharedCtor(::_pb::Arena* arena) { + new (&_impl_) Impl_(internal_visibility(), arena); +} +ComplexClass_InnerIntMap::~ComplexClass_InnerIntMap() { + // @@protoc_insertion_point(destructor:complexbenchmarking.ComplexClass.InnerIntMap) + _internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); + SharedDtor(); +} +inline void ComplexClass_InnerIntMap::SharedDtor() { + ABSL_DCHECK(GetArena() == nullptr); + _impl_.~Impl_(); +} + +const ::google::protobuf::MessageLite::ClassData* +ComplexClass_InnerIntMap::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + _data_ = { + ComplexClass_InnerIntMap::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + PROTOBUF_FIELD_OFFSET(ComplexClass_InnerIntMap, _impl_._cached_size_), + }; + return &_data_; +} +PROTOBUF_NOINLINE void ComplexClass_InnerIntMap::Clear() { +// @@protoc_insertion_point(message_clear_start:complexbenchmarking.ComplexClass.InnerIntMap) + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _impl_.m_map_.Clear(); + _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); +} + +const char* ComplexClass_InnerIntMap::_InternalParse( + const char* ptr, ::_pbi::ParseContext* ctx) { + ptr = ::_pbi::TcParser::ParseLoop(this, ptr, ctx, &_table_.header); + return ptr; +} + + +PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 +const ::_pbi::TcParseTable<0, 1, 1, 0, 2> ComplexClass_InnerIntMap::_table_ = { + { + 0, // no _has_bits_ + 0, // no _extensions_ + 1, 0, // max_field_number, fast_idx_mask + offsetof(decltype(_table_), field_lookup_table), + 4294967294, // skipmap + offsetof(decltype(_table_), field_entries), + 1, // num_field_entries + 1, // num_aux_entries + offsetof(decltype(_table_), aux_entries), + &_ComplexClass_InnerIntMap_default_instance_._instance, + ::_pbi::TcParser::GenericFallback, // fallback + #ifdef PROTOBUF_PREFETCH_PARSE_TABLE + ::_pbi::TcParser::GetTable<::complexbenchmarking::ComplexClass_InnerIntMap>(), // to_prefetch + #endif // PROTOBUF_PREFETCH_PARSE_TABLE + }, {{ + {::_pbi::TcParser::MiniParse, {}}, + }}, {{ + 65535, 65535 + }}, {{ + // map m_map = 1; + {PROTOBUF_FIELD_OFFSET(ComplexClass_InnerIntMap, _impl_.m_map_), 0, 0, + (0 | ::_fl::kFcRepeated | ::_fl::kMap)}, + }}, {{ + {::_pbi::TcParser::GetMapAuxInfo< + decltype(ComplexClass_InnerIntMap()._impl_.m_map_)>( + 0, 1, 0, 5, + 5)}, + }}, {{ + }}, +}; + +::uint8_t* ComplexClass_InnerIntMap::_InternalSerialize( + ::uint8_t* target, + ::google::protobuf::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:complexbenchmarking.ComplexClass.InnerIntMap) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; + + // map m_map = 1; + if (!_internal_m_map().empty()) { + using MapType = ::google::protobuf::Map<::int32_t, ::int32_t>; + using WireHelper = _pbi::MapEntryFuncs<::int32_t, ::int32_t, + _pbi::WireFormatLite::TYPE_INT32, + _pbi::WireFormatLite::TYPE_INT32>; + const auto& field = _internal_m_map(); + + if (stream->IsSerializationDeterministic() && field.size() > 1) { + for (const auto& entry : ::google::protobuf::internal::MapSorterFlat(field)) { + target = WireHelper::InternalSerialize( + 1, entry.first, entry.second, target, stream); + } + } else { + for (const auto& entry : field) { + target = WireHelper::InternalSerialize( + 1, entry.first, entry.second, target, stream); + } + } + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:complexbenchmarking.ComplexClass.InnerIntMap) + return target; +} + +::size_t ComplexClass_InnerIntMap::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:complexbenchmarking.ComplexClass.InnerIntMap) + ::size_t total_size = 0; + + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // map m_map = 1; + total_size += 1 * ::google::protobuf::internal::FromIntSize(_internal_m_map_size()); + for (const auto& entry : _internal_m_map()) { + total_size += _pbi::MapEntryFuncs<::int32_t, ::int32_t, + _pbi::WireFormatLite::TYPE_INT32, + _pbi::WireFormatLite::TYPE_INT32>::ByteSizeLong(entry.first, entry.second); + } + return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); +} + + +void ComplexClass_InnerIntMap::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { + auto* const _this = static_cast(&to_msg); + auto& from = static_cast(from_msg); + // @@protoc_insertion_point(class_specific_merge_from_start:complexbenchmarking.ComplexClass.InnerIntMap) + ABSL_DCHECK_NE(&from, _this); + ::uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + _this->_impl_.m_map_.MergeFrom(from._impl_.m_map_); + _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); +} + +void ComplexClass_InnerIntMap::CopyFrom(const ComplexClass_InnerIntMap& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:complexbenchmarking.ComplexClass.InnerIntMap) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +PROTOBUF_NOINLINE bool ComplexClass_InnerIntMap::IsInitialized() const { + return true; +} + +void ComplexClass_InnerIntMap::InternalSwap(ComplexClass_InnerIntMap* PROTOBUF_RESTRICT other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + _impl_.m_map_.InternalSwap(&other->_impl_.m_map_); +} + +::google::protobuf::Metadata ComplexClass_InnerIntMap::GetMetadata() const { + return ::_pbi::AssignDescriptors( + &descriptor_table_Complex_2eproto_getter, &descriptor_table_Complex_2eproto_once, + file_level_metadata_Complex_2eproto[3]); +} +// =================================================================== + +ComplexClass_InnerPlainClassMap_MyMapEntry_DoNotUse::ComplexClass_InnerPlainClassMap_MyMapEntry_DoNotUse() {} +ComplexClass_InnerPlainClassMap_MyMapEntry_DoNotUse::ComplexClass_InnerPlainClassMap_MyMapEntry_DoNotUse(::google::protobuf::Arena* arena) + : SuperType(arena) {} +::google::protobuf::Metadata ComplexClass_InnerPlainClassMap_MyMapEntry_DoNotUse::GetMetadata() const { + return ::_pbi::AssignDescriptors( + &descriptor_table_Complex_2eproto_getter, &descriptor_table_Complex_2eproto_once, + file_level_metadata_Complex_2eproto[4]); +} +// =================================================================== + +class ComplexClass_InnerPlainClassMap::_Internal { + public: +}; + +ComplexClass_InnerPlainClassMap::ComplexClass_InnerPlainClassMap(::google::protobuf::Arena* arena) + : ::google::protobuf::Message(arena) { + SharedCtor(arena); + // @@protoc_insertion_point(arena_constructor:complexbenchmarking.ComplexClass.InnerPlainClassMap) +} +inline PROTOBUF_NDEBUG_INLINE ComplexClass_InnerPlainClassMap::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, + const Impl_& from) + : my_map_{visibility, arena, from.my_map_}, + _cached_size_{0} {} + +ComplexClass_InnerPlainClassMap::ComplexClass_InnerPlainClassMap( + ::google::protobuf::Arena* arena, + const ComplexClass_InnerPlainClassMap& from) + : ::google::protobuf::Message(arena) { + ComplexClass_InnerPlainClassMap* const _this = this; + (void)_this; + _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( + from._internal_metadata_); + new (&_impl_) Impl_(internal_visibility(), arena, from._impl_); + + // @@protoc_insertion_point(copy_constructor:complexbenchmarking.ComplexClass.InnerPlainClassMap) +} +inline PROTOBUF_NDEBUG_INLINE ComplexClass_InnerPlainClassMap::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena) + : my_map_{visibility, arena}, + _cached_size_{0} {} + +inline void ComplexClass_InnerPlainClassMap::SharedCtor(::_pb::Arena* arena) { + new (&_impl_) Impl_(internal_visibility(), arena); +} +ComplexClass_InnerPlainClassMap::~ComplexClass_InnerPlainClassMap() { + // @@protoc_insertion_point(destructor:complexbenchmarking.ComplexClass.InnerPlainClassMap) + _internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); + SharedDtor(); +} +inline void ComplexClass_InnerPlainClassMap::SharedDtor() { + ABSL_DCHECK(GetArena() == nullptr); + _impl_.~Impl_(); +} + +const ::google::protobuf::MessageLite::ClassData* +ComplexClass_InnerPlainClassMap::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + _data_ = { + ComplexClass_InnerPlainClassMap::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + PROTOBUF_FIELD_OFFSET(ComplexClass_InnerPlainClassMap, _impl_._cached_size_), + }; + return &_data_; +} +PROTOBUF_NOINLINE void ComplexClass_InnerPlainClassMap::Clear() { +// @@protoc_insertion_point(message_clear_start:complexbenchmarking.ComplexClass.InnerPlainClassMap) + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _impl_.my_map_.Clear(); + _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); +} + +const char* ComplexClass_InnerPlainClassMap::_InternalParse( + const char* ptr, ::_pbi::ParseContext* ctx) { + ptr = ::_pbi::TcParser::ParseLoop(this, ptr, ctx, &_table_.header); + return ptr; +} + + +PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 +const ::_pbi::TcParseTable<0, 1, 2, 0, 2> ComplexClass_InnerPlainClassMap::_table_ = { + { + 0, // no _has_bits_ + 0, // no _extensions_ + 1, 0, // max_field_number, fast_idx_mask + offsetof(decltype(_table_), field_lookup_table), + 4294967294, // skipmap + offsetof(decltype(_table_), field_entries), + 1, // num_field_entries + 2, // num_aux_entries + offsetof(decltype(_table_), aux_entries), + &_ComplexClass_InnerPlainClassMap_default_instance_._instance, + ::_pbi::TcParser::GenericFallback, // fallback + #ifdef PROTOBUF_PREFETCH_PARSE_TABLE + ::_pbi::TcParser::GetTable<::complexbenchmarking::ComplexClass_InnerPlainClassMap>(), // to_prefetch + #endif // PROTOBUF_PREFETCH_PARSE_TABLE + }, {{ + {::_pbi::TcParser::MiniParse, {}}, + }}, {{ + 65535, 65535 + }}, {{ + // map my_map = 1; + {PROTOBUF_FIELD_OFFSET(ComplexClass_InnerPlainClassMap, _impl_.my_map_), 0, 0, + (0 | ::_fl::kFcRepeated | ::_fl::kMap)}, + }}, {{ + {::_pbi::TcParser::GetMapAuxInfo< + decltype(ComplexClass_InnerPlainClassMap()._impl_.my_map_)>( + 0, 1, 0, 5, + 11)}, + {::_pbi::TcParser::CreateInArenaStorageCb<::complexbenchmarking::ComplexClass_PlainClass>}, + }}, {{ + }}, +}; + +::uint8_t* ComplexClass_InnerPlainClassMap::_InternalSerialize( + ::uint8_t* target, + ::google::protobuf::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:complexbenchmarking.ComplexClass.InnerPlainClassMap) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; + + // map my_map = 1; + if (!_internal_my_map().empty()) { + using MapType = ::google::protobuf::Map<::int32_t, ::complexbenchmarking::ComplexClass_PlainClass>; + using WireHelper = _pbi::MapEntryFuncs<::int32_t, ::complexbenchmarking::ComplexClass_PlainClass, + _pbi::WireFormatLite::TYPE_INT32, + _pbi::WireFormatLite::TYPE_MESSAGE>; + const auto& field = _internal_my_map(); + + if (stream->IsSerializationDeterministic() && field.size() > 1) { + for (const auto& entry : ::google::protobuf::internal::MapSorterFlat(field)) { + target = WireHelper::InternalSerialize( + 1, entry.first, entry.second, target, stream); + } + } else { + for (const auto& entry : field) { + target = WireHelper::InternalSerialize( + 1, entry.first, entry.second, target, stream); + } + } + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:complexbenchmarking.ComplexClass.InnerPlainClassMap) + return target; +} + +::size_t ComplexClass_InnerPlainClassMap::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:complexbenchmarking.ComplexClass.InnerPlainClassMap) + ::size_t total_size = 0; + + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // map my_map = 1; + total_size += 1 * ::google::protobuf::internal::FromIntSize(_internal_my_map_size()); + for (const auto& entry : _internal_my_map()) { + total_size += _pbi::MapEntryFuncs<::int32_t, ::complexbenchmarking::ComplexClass_PlainClass, + _pbi::WireFormatLite::TYPE_INT32, + _pbi::WireFormatLite::TYPE_MESSAGE>::ByteSizeLong(entry.first, entry.second); + } + return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); +} + + +void ComplexClass_InnerPlainClassMap::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { + auto* const _this = static_cast(&to_msg); + auto& from = static_cast(from_msg); + // @@protoc_insertion_point(class_specific_merge_from_start:complexbenchmarking.ComplexClass.InnerPlainClassMap) + ABSL_DCHECK_NE(&from, _this); + ::uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + _this->_impl_.my_map_.MergeFrom(from._impl_.my_map_); + _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); +} + +void ComplexClass_InnerPlainClassMap::CopyFrom(const ComplexClass_InnerPlainClassMap& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:complexbenchmarking.ComplexClass.InnerPlainClassMap) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +PROTOBUF_NOINLINE bool ComplexClass_InnerPlainClassMap::IsInitialized() const { + return true; +} + +void ComplexClass_InnerPlainClassMap::InternalSwap(ComplexClass_InnerPlainClassMap* PROTOBUF_RESTRICT other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + _impl_.my_map_.InternalSwap(&other->_impl_.my_map_); +} + +::google::protobuf::Metadata ComplexClass_InnerPlainClassMap::GetMetadata() const { + return ::_pbi::AssignDescriptors( + &descriptor_table_Complex_2eproto_getter, &descriptor_table_Complex_2eproto_once, + file_level_metadata_Complex_2eproto[5]); +} +// =================================================================== + +class ComplexClass_InnerPlainClassMapArray::_Internal { + public: + using HasBits = decltype(std::declval()._impl_._has_bits_); + static constexpr ::int32_t kHasBitsOffset = + 8 * PROTOBUF_FIELD_OFFSET(ComplexClass_InnerPlainClassMapArray, _impl_._has_bits_); +}; + +ComplexClass_InnerPlainClassMapArray::ComplexClass_InnerPlainClassMapArray(::google::protobuf::Arena* arena) + : ::google::protobuf::Message(arena) { + SharedCtor(arena); + // @@protoc_insertion_point(arena_constructor:complexbenchmarking.ComplexClass.InnerPlainClassMapArray) +} +inline PROTOBUF_NDEBUG_INLINE ComplexClass_InnerPlainClassMapArray::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, + const Impl_& from) + : _has_bits_{from._has_bits_}, + _cached_size_{0} {} + +ComplexClass_InnerPlainClassMapArray::ComplexClass_InnerPlainClassMapArray( + ::google::protobuf::Arena* arena, + const ComplexClass_InnerPlainClassMapArray& from) + : ::google::protobuf::Message(arena) { + ComplexClass_InnerPlainClassMapArray* const _this = this; + (void)_this; + _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( + from._internal_metadata_); + new (&_impl_) Impl_(internal_visibility(), arena, from._impl_); + ::uint32_t cached_has_bits = _impl_._has_bits_[0]; + _impl_.my_maps_ = (cached_has_bits & 0x00000001u) ? ::google::protobuf::Message::CopyConstruct<::complexbenchmarking::ComplexClass_InnerPlainClassMap>( + arena, *from._impl_.my_maps_) + : nullptr; + + // @@protoc_insertion_point(copy_constructor:complexbenchmarking.ComplexClass.InnerPlainClassMapArray) +} +inline PROTOBUF_NDEBUG_INLINE ComplexClass_InnerPlainClassMapArray::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena) + : _cached_size_{0} {} + +inline void ComplexClass_InnerPlainClassMapArray::SharedCtor(::_pb::Arena* arena) { + new (&_impl_) Impl_(internal_visibility(), arena); + _impl_.my_maps_ = {}; +} +ComplexClass_InnerPlainClassMapArray::~ComplexClass_InnerPlainClassMapArray() { + // @@protoc_insertion_point(destructor:complexbenchmarking.ComplexClass.InnerPlainClassMapArray) + _internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); + SharedDtor(); +} +inline void ComplexClass_InnerPlainClassMapArray::SharedDtor() { + ABSL_DCHECK(GetArena() == nullptr); + delete _impl_.my_maps_; + _impl_.~Impl_(); +} + +const ::google::protobuf::MessageLite::ClassData* +ComplexClass_InnerPlainClassMapArray::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + _data_ = { + ComplexClass_InnerPlainClassMapArray::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + PROTOBUF_FIELD_OFFSET(ComplexClass_InnerPlainClassMapArray, _impl_._cached_size_), + }; + return &_data_; +} +PROTOBUF_NOINLINE void ComplexClass_InnerPlainClassMapArray::Clear() { +// @@protoc_insertion_point(message_clear_start:complexbenchmarking.ComplexClass.InnerPlainClassMapArray) + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + ABSL_DCHECK(_impl_.my_maps_ != nullptr); + _impl_.my_maps_->Clear(); + } + _impl_._has_bits_.Clear(); + _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); +} + +const char* ComplexClass_InnerPlainClassMapArray::_InternalParse( + const char* ptr, ::_pbi::ParseContext* ctx) { + ptr = ::_pbi::TcParser::ParseLoop(this, ptr, ctx, &_table_.header); + return ptr; +} + + +PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 +const ::_pbi::TcParseTable<0, 1, 1, 0, 2> ComplexClass_InnerPlainClassMapArray::_table_ = { + { + PROTOBUF_FIELD_OFFSET(ComplexClass_InnerPlainClassMapArray, _impl_._has_bits_), + 0, // no _extensions_ + 1, 0, // max_field_number, fast_idx_mask + offsetof(decltype(_table_), field_lookup_table), + 4294967294, // skipmap + offsetof(decltype(_table_), field_entries), + 1, // num_field_entries + 1, // num_aux_entries + offsetof(decltype(_table_), aux_entries), + &_ComplexClass_InnerPlainClassMapArray_default_instance_._instance, + ::_pbi::TcParser::GenericFallback, // fallback + #ifdef PROTOBUF_PREFETCH_PARSE_TABLE + ::_pbi::TcParser::GetTable<::complexbenchmarking::ComplexClass_InnerPlainClassMapArray>(), // to_prefetch + #endif // PROTOBUF_PREFETCH_PARSE_TABLE + }, {{ + // optional .complexbenchmarking.ComplexClass.InnerPlainClassMap my_maps = 1; + {::_pbi::TcParser::FastMtS1, + {10, 0, 0, PROTOBUF_FIELD_OFFSET(ComplexClass_InnerPlainClassMapArray, _impl_.my_maps_)}}, + }}, {{ + 65535, 65535 + }}, {{ + // optional .complexbenchmarking.ComplexClass.InnerPlainClassMap my_maps = 1; + {PROTOBUF_FIELD_OFFSET(ComplexClass_InnerPlainClassMapArray, _impl_.my_maps_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kMessage | ::_fl::kTvTable)}, + }}, {{ + {::_pbi::TcParser::GetTable<::complexbenchmarking::ComplexClass_InnerPlainClassMap>()}, + }}, {{ + }}, +}; + +::uint8_t* ComplexClass_InnerPlainClassMapArray::_InternalSerialize( + ::uint8_t* target, + ::google::protobuf::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:complexbenchmarking.ComplexClass.InnerPlainClassMapArray) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; + + cached_has_bits = _impl_._has_bits_[0]; + // optional .complexbenchmarking.ComplexClass.InnerPlainClassMap my_maps = 1; + if (cached_has_bits & 0x00000001u) { + target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 1, *_impl_.my_maps_, _impl_.my_maps_->GetCachedSize(), target, stream); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:complexbenchmarking.ComplexClass.InnerPlainClassMapArray) + return target; +} + +::size_t ComplexClass_InnerPlainClassMapArray::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:complexbenchmarking.ComplexClass.InnerPlainClassMapArray) + ::size_t total_size = 0; + + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // optional .complexbenchmarking.ComplexClass.InnerPlainClassMap my_maps = 1; + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + total_size += + 1 + ::google::protobuf::internal::WireFormatLite::MessageSize(*_impl_.my_maps_); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); +} + + +void ComplexClass_InnerPlainClassMapArray::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { + auto* const _this = static_cast(&to_msg); + auto& from = static_cast(from_msg); + ::google::protobuf::Arena* arena = _this->GetArena(); + // @@protoc_insertion_point(class_specific_merge_from_start:complexbenchmarking.ComplexClass.InnerPlainClassMapArray) + ABSL_DCHECK_NE(&from, _this); + ::uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + ABSL_DCHECK(from._impl_.my_maps_ != nullptr); + if (_this->_impl_.my_maps_ == nullptr) { + _this->_impl_.my_maps_ = + ::google::protobuf::Message::CopyConstruct<::complexbenchmarking::ComplexClass_InnerPlainClassMap>(arena, *from._impl_.my_maps_); + } else { + _this->_impl_.my_maps_->MergeFrom(*from._impl_.my_maps_); + } + } + _this->_impl_._has_bits_[0] |= cached_has_bits; + _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); +} + +void ComplexClass_InnerPlainClassMapArray::CopyFrom(const ComplexClass_InnerPlainClassMapArray& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:complexbenchmarking.ComplexClass.InnerPlainClassMapArray) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +PROTOBUF_NOINLINE bool ComplexClass_InnerPlainClassMapArray::IsInitialized() const { + return true; +} + +void ComplexClass_InnerPlainClassMapArray::InternalSwap(ComplexClass_InnerPlainClassMapArray* PROTOBUF_RESTRICT other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); + swap(_impl_.my_maps_, other->_impl_.my_maps_); +} + +::google::protobuf::Metadata ComplexClass_InnerPlainClassMapArray::GetMetadata() const { + return ::_pbi::AssignDescriptors( + &descriptor_table_Complex_2eproto_getter, &descriptor_table_Complex_2eproto_once, + file_level_metadata_Complex_2eproto[6]); +} +// =================================================================== + +ComplexClass_IntMapEntry_DoNotUse::ComplexClass_IntMapEntry_DoNotUse() {} +ComplexClass_IntMapEntry_DoNotUse::ComplexClass_IntMapEntry_DoNotUse(::google::protobuf::Arena* arena) + : SuperType(arena) {} +::google::protobuf::Metadata ComplexClass_IntMapEntry_DoNotUse::GetMetadata() const { + return ::_pbi::AssignDescriptors( + &descriptor_table_Complex_2eproto_getter, &descriptor_table_Complex_2eproto_once, + file_level_metadata_Complex_2eproto[7]); +} +// =================================================================== + +class ComplexClass::_Internal { + public: + using HasBits = decltype(std::declval()._impl_._has_bits_); + static constexpr ::int32_t kHasBitsOffset = + 8 * PROTOBUF_FIELD_OFFSET(ComplexClass, _impl_._has_bits_); +}; + +ComplexClass::ComplexClass(::google::protobuf::Arena* arena) + : ::google::protobuf::Message(arena) { + SharedCtor(arena); + // @@protoc_insertion_point(arena_constructor:complexbenchmarking.ComplexClass) +} +inline PROTOBUF_NDEBUG_INLINE ComplexClass::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, + const Impl_& from) + : _has_bits_{from._has_bits_}, + _cached_size_{0}, + int_map_{visibility, arena, from.int_map_}, + plain_class_map_{visibility, arena, from.plain_class_map_}, + name_(arena, from.name_) {} + +ComplexClass::ComplexClass( + ::google::protobuf::Arena* arena, + const ComplexClass& from) + : ::google::protobuf::Message(arena) { + ComplexClass* const _this = this; + (void)_this; + _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( + from._internal_metadata_); + new (&_impl_) Impl_(internal_visibility(), arena, from._impl_); + ::memcpy(reinterpret_cast(&_impl_) + + offsetof(Impl_, id_), + reinterpret_cast(&from._impl_) + + offsetof(Impl_, id_), + offsetof(Impl_, count_) - + offsetof(Impl_, id_) + + sizeof(Impl_::count_)); + + // @@protoc_insertion_point(copy_constructor:complexbenchmarking.ComplexClass) +} +inline PROTOBUF_NDEBUG_INLINE ComplexClass::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena) + : _cached_size_{0}, + int_map_{visibility, arena}, + plain_class_map_{visibility, arena}, + name_(arena) {} + +inline void ComplexClass::SharedCtor(::_pb::Arena* arena) { + new (&_impl_) Impl_(internal_visibility(), arena); + ::memset(reinterpret_cast(&_impl_) + + offsetof(Impl_, id_), + 0, + offsetof(Impl_, count_) - + offsetof(Impl_, id_) + + sizeof(Impl_::count_)); +} +ComplexClass::~ComplexClass() { + // @@protoc_insertion_point(destructor:complexbenchmarking.ComplexClass) + _internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); + SharedDtor(); +} +inline void ComplexClass::SharedDtor() { + ABSL_DCHECK(GetArena() == nullptr); + _impl_.name_.Destroy(); + _impl_.~Impl_(); +} + +const ::google::protobuf::MessageLite::ClassData* +ComplexClass::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + _data_ = { + ComplexClass::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + PROTOBUF_FIELD_OFFSET(ComplexClass, _impl_._cached_size_), + }; + return &_data_; +} +PROTOBUF_NOINLINE void ComplexClass::Clear() { +// @@protoc_insertion_point(message_clear_start:complexbenchmarking.ComplexClass) + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _impl_.int_map_.Clear(); + _impl_.plain_class_map_.Clear(); + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + _impl_.name_.ClearNonDefaultToEmpty(); + } + if (cached_has_bits & 0x00000006u) { + ::memset(&_impl_.id_, 0, static_cast<::size_t>( + reinterpret_cast(&_impl_.count_) - + reinterpret_cast(&_impl_.id_)) + sizeof(_impl_.count_)); + } + _impl_._has_bits_.Clear(); + _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); +} + +const char* ComplexClass::_InternalParse( + const char* ptr, ::_pbi::ParseContext* ctx) { + ptr = ::_pbi::TcParser::ParseLoop(this, ptr, ctx, &_table_.header); + return ptr; +} + + +PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 +const ::_pbi::TcParseTable<3, 5, 3, 45, 2> ComplexClass::_table_ = { + { + PROTOBUF_FIELD_OFFSET(ComplexClass, _impl_._has_bits_), + 0, // no _extensions_ + 5, 56, // max_field_number, fast_idx_mask + offsetof(decltype(_table_), field_lookup_table), + 4294967264, // skipmap + offsetof(decltype(_table_), field_entries), + 5, // num_field_entries + 3, // num_aux_entries + offsetof(decltype(_table_), aux_entries), + &_ComplexClass_default_instance_._instance, + ::_pbi::TcParser::GenericFallback, // fallback + #ifdef PROTOBUF_PREFETCH_PARSE_TABLE + ::_pbi::TcParser::GetTable<::complexbenchmarking::ComplexClass>(), // to_prefetch + #endif // PROTOBUF_PREFETCH_PARSE_TABLE + }, {{ + {::_pbi::TcParser::MiniParse, {}}, + // optional int32 id = 1; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(ComplexClass, _impl_.id_), 1>(), + {8, 1, 0, PROTOBUF_FIELD_OFFSET(ComplexClass, _impl_.id_)}}, + // optional int32 count = 2; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(ComplexClass, _impl_.count_), 2>(), + {16, 2, 0, PROTOBUF_FIELD_OFFSET(ComplexClass, _impl_.count_)}}, + // optional string name = 3; + {::_pbi::TcParser::FastSS1, + {26, 0, 0, PROTOBUF_FIELD_OFFSET(ComplexClass, _impl_.name_)}}, + {::_pbi::TcParser::MiniParse, {}}, + // repeated .complexbenchmarking.ComplexClass.InnerPlainClassMapArray plain_class_map = 5; + {::_pbi::TcParser::FastMtR1, + {42, 63, 2, PROTOBUF_FIELD_OFFSET(ComplexClass, _impl_.plain_class_map_)}}, + {::_pbi::TcParser::MiniParse, {}}, + {::_pbi::TcParser::MiniParse, {}}, + }}, {{ + 65535, 65535 + }}, {{ + // optional int32 id = 1; + {PROTOBUF_FIELD_OFFSET(ComplexClass, _impl_.id_), _Internal::kHasBitsOffset + 1, 0, + (0 | ::_fl::kFcOptional | ::_fl::kInt32)}, + // optional int32 count = 2; + {PROTOBUF_FIELD_OFFSET(ComplexClass, _impl_.count_), _Internal::kHasBitsOffset + 2, 0, + (0 | ::_fl::kFcOptional | ::_fl::kInt32)}, + // optional string name = 3; + {PROTOBUF_FIELD_OFFSET(ComplexClass, _impl_.name_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kRawString | ::_fl::kRepAString)}, + // map int_map = 4; + {PROTOBUF_FIELD_OFFSET(ComplexClass, _impl_.int_map_), -1, 0, + (0 | ::_fl::kFcRepeated | ::_fl::kMap)}, + // repeated .complexbenchmarking.ComplexClass.InnerPlainClassMapArray plain_class_map = 5; + {PROTOBUF_FIELD_OFFSET(ComplexClass, _impl_.plain_class_map_), -1, 2, + (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, + }}, {{ + {::_pbi::TcParser::GetMapAuxInfo< + decltype(ComplexClass()._impl_.int_map_)>( + 0, 1, 0, 5, + 11)}, + {::_pbi::TcParser::CreateInArenaStorageCb<::complexbenchmarking::ComplexClass_InnerIntMap>}, + {::_pbi::TcParser::GetTable<::complexbenchmarking::ComplexClass_InnerPlainClassMapArray>()}, + }}, {{ + "\40\0\0\4\0\0\0\0" + "complexbenchmarking.ComplexClass" + "name" + }}, +}; + +::uint8_t* ComplexClass::_InternalSerialize( + ::uint8_t* target, + ::google::protobuf::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:complexbenchmarking.ComplexClass) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; + + cached_has_bits = _impl_._has_bits_[0]; + // optional int32 id = 1; + if (cached_has_bits & 0x00000002u) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<1>( + stream, this->_internal_id(), target); + } + + // optional int32 count = 2; + if (cached_has_bits & 0x00000004u) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<2>( + stream, this->_internal_count(), target); + } + + // optional string name = 3; + if (cached_has_bits & 0x00000001u) { + const std::string& _s = this->_internal_name(); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "complexbenchmarking.ComplexClass.name"); + target = stream->WriteStringMaybeAliased(3, _s, target); + } + + // map int_map = 4; + if (!_internal_int_map().empty()) { + using MapType = ::google::protobuf::Map<::int32_t, ::complexbenchmarking::ComplexClass_InnerIntMap>; + using WireHelper = _pbi::MapEntryFuncs<::int32_t, ::complexbenchmarking::ComplexClass_InnerIntMap, + _pbi::WireFormatLite::TYPE_INT32, + _pbi::WireFormatLite::TYPE_MESSAGE>; + const auto& field = _internal_int_map(); + + if (stream->IsSerializationDeterministic() && field.size() > 1) { + for (const auto& entry : ::google::protobuf::internal::MapSorterFlat(field)) { + target = WireHelper::InternalSerialize( + 4, entry.first, entry.second, target, stream); + } + } else { + for (const auto& entry : field) { + target = WireHelper::InternalSerialize( + 4, entry.first, entry.second, target, stream); + } + } + } + + // repeated .complexbenchmarking.ComplexClass.InnerPlainClassMapArray plain_class_map = 5; + for (unsigned i = 0, + n = static_cast(this->_internal_plain_class_map_size()); i < n; i++) { + const auto& repfield = this->_internal_plain_class_map().Get(i); + target = ::google::protobuf::internal::WireFormatLite:: + InternalWriteMessage(5, repfield, repfield.GetCachedSize(), target, stream); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:complexbenchmarking.ComplexClass) + return target; +} + +::size_t ComplexClass::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:complexbenchmarking.ComplexClass) + ::size_t total_size = 0; + + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // map int_map = 4; + total_size += 1 * ::google::protobuf::internal::FromIntSize(_internal_int_map_size()); + for (const auto& entry : _internal_int_map()) { + total_size += _pbi::MapEntryFuncs<::int32_t, ::complexbenchmarking::ComplexClass_InnerIntMap, + _pbi::WireFormatLite::TYPE_INT32, + _pbi::WireFormatLite::TYPE_MESSAGE>::ByteSizeLong(entry.first, entry.second); + } + // repeated .complexbenchmarking.ComplexClass.InnerPlainClassMapArray plain_class_map = 5; + total_size += 1UL * this->_internal_plain_class_map_size(); + for (const auto& msg : this->_internal_plain_class_map()) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000007u) { + // optional string name = 3; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this->_internal_name()); + } + + // optional int32 id = 1; + if (cached_has_bits & 0x00000002u) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this->_internal_id()); + } + + // optional int32 count = 2; + if (cached_has_bits & 0x00000004u) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this->_internal_count()); + } + + } + return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); +} + + +void ComplexClass::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { + auto* const _this = static_cast(&to_msg); + auto& from = static_cast(from_msg); + // @@protoc_insertion_point(class_specific_merge_from_start:complexbenchmarking.ComplexClass) + ABSL_DCHECK_NE(&from, _this); + ::uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + _this->_impl_.int_map_.MergeFrom(from._impl_.int_map_); + _this->_internal_mutable_plain_class_map()->MergeFrom( + from._internal_plain_class_map()); + cached_has_bits = from._impl_._has_bits_[0]; + if (cached_has_bits & 0x00000007u) { + if (cached_has_bits & 0x00000001u) { + _this->_internal_set_name(from._internal_name()); + } + if (cached_has_bits & 0x00000002u) { + _this->_impl_.id_ = from._impl_.id_; + } + if (cached_has_bits & 0x00000004u) { + _this->_impl_.count_ = from._impl_.count_; + } + } + _this->_impl_._has_bits_[0] |= cached_has_bits; + _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); +} + +void ComplexClass::CopyFrom(const ComplexClass& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:complexbenchmarking.ComplexClass) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +PROTOBUF_NOINLINE bool ComplexClass::IsInitialized() const { + return true; +} + +void ComplexClass::InternalSwap(ComplexClass* PROTOBUF_RESTRICT other) { + using std::swap; + auto* arena = GetArena(); + ABSL_DCHECK_EQ(arena, other->GetArena()); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); + _impl_.int_map_.InternalSwap(&other->_impl_.int_map_); + _impl_.plain_class_map_.InternalSwap(&other->_impl_.plain_class_map_); + ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.name_, &other->_impl_.name_, arena); + ::google::protobuf::internal::memswap< + PROTOBUF_FIELD_OFFSET(ComplexClass, _impl_.count_) + + sizeof(ComplexClass::_impl_.count_) + - PROTOBUF_FIELD_OFFSET(ComplexClass, _impl_.id_)>( + reinterpret_cast(&_impl_.id_), + reinterpret_cast(&other->_impl_.id_)); +} + +::google::protobuf::Metadata ComplexClass::GetMetadata() const { + return ::_pbi::AssignDescriptors( + &descriptor_table_Complex_2eproto_getter, &descriptor_table_Complex_2eproto_once, + file_level_metadata_Complex_2eproto[8]); +} +// @@protoc_insertion_point(namespace_scope) +} // namespace complexbenchmarking +namespace google { +namespace protobuf { +} // namespace protobuf +} // namespace google +// @@protoc_insertion_point(global_scope) +#include "google/protobuf/port_undef.inc" diff --git a/benchmarking/src/Person.pb.cc b/benchmarking/src/Person.pb.cc new file mode 100644 index 0000000..f884879 --- /dev/null +++ b/benchmarking/src/Person.pb.cc @@ -0,0 +1,636 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: Person.proto +// Protobuf C++ Version: 4.26.0-dev + +#include "Person.pb.h" + +#include +#include "google/protobuf/io/coded_stream.h" +#include "google/protobuf/extension_set.h" +#include "google/protobuf/wire_format_lite.h" +#include "google/protobuf/descriptor.h" +#include "google/protobuf/generated_message_reflection.h" +#include "google/protobuf/reflection_ops.h" +#include "google/protobuf/wire_format.h" +#include "google/protobuf/generated_message_tctable_impl.h" +// @@protoc_insertion_point(includes) + +// Must be included last. +#include "google/protobuf/port_def.inc" +PROTOBUF_PRAGMA_INIT_SEG +namespace _pb = ::google::protobuf; +namespace _pbi = ::google::protobuf::internal; +namespace _fl = ::google::protobuf::internal::field_layout; +namespace benchmarktesting { + +inline constexpr Person_Role::Impl_::Impl_( + ::_pbi::ConstantInitialized) noexcept + : _cached_size_{0}, + rolename_( + &::google::protobuf::internal::fixed_address_empty_string, + ::_pbi::ConstantInitialized()) {} + +template +PROTOBUF_CONSTEXPR Person_Role::Person_Role(::_pbi::ConstantInitialized) + : _impl_(::_pbi::ConstantInitialized()) {} +struct Person_RoleDefaultTypeInternal { + PROTOBUF_CONSTEXPR Person_RoleDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} + ~Person_RoleDefaultTypeInternal() {} + union { + Person_Role _instance; + }; +}; + +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 Person_RoleDefaultTypeInternal _Person_Role_default_instance_; + +inline constexpr Person::Impl_::Impl_( + ::_pbi::ConstantInitialized) noexcept + : _cached_size_{0}, + roles_{}, + name_( + &::google::protobuf::internal::fixed_address_empty_string, + ::_pbi::ConstantInitialized()), + id_{0} {} + +template +PROTOBUF_CONSTEXPR Person::Person(::_pbi::ConstantInitialized) + : _impl_(::_pbi::ConstantInitialized()) {} +struct PersonDefaultTypeInternal { + PROTOBUF_CONSTEXPR PersonDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} + ~PersonDefaultTypeInternal() {} + union { + Person _instance; + }; +}; + +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 PersonDefaultTypeInternal _Person_default_instance_; +} // namespace benchmarktesting +static ::_pb::Metadata file_level_metadata_Person_2eproto[2]; +static constexpr const ::_pb::EnumDescriptor** + file_level_enum_descriptors_Person_2eproto = nullptr; +static constexpr const ::_pb::ServiceDescriptor** + file_level_service_descriptors_Person_2eproto = nullptr; +const ::uint32_t + TableStruct_Person_2eproto::offsets[] ABSL_ATTRIBUTE_SECTION_VARIABLE( + protodesc_cold) = { + PROTOBUF_FIELD_OFFSET(::benchmarktesting::Person_Role, _impl_._has_bits_), + PROTOBUF_FIELD_OFFSET(::benchmarktesting::Person_Role, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) + PROTOBUF_FIELD_OFFSET(::benchmarktesting::Person_Role, _impl_.rolename_), + 0, + PROTOBUF_FIELD_OFFSET(::benchmarktesting::Person, _impl_._has_bits_), + PROTOBUF_FIELD_OFFSET(::benchmarktesting::Person, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) + PROTOBUF_FIELD_OFFSET(::benchmarktesting::Person, _impl_.name_), + PROTOBUF_FIELD_OFFSET(::benchmarktesting::Person, _impl_.id_), + PROTOBUF_FIELD_OFFSET(::benchmarktesting::Person, _impl_.roles_), + 0, + 1, + ~0u, +}; + +static const ::_pbi::MigrationSchema + schemas[] ABSL_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { + {0, 9, -1, sizeof(::benchmarktesting::Person_Role)}, + {10, 21, -1, sizeof(::benchmarktesting::Person)}, +}; + +static const ::_pb::Message* const file_default_instances[] = { + &::benchmarktesting::_Person_Role_default_instance_._instance, + &::benchmarktesting::_Person_default_instance_._instance, +}; +const char descriptor_table_protodef_Person_2eproto[] ABSL_ATTRIBUTE_SECTION_VARIABLE( + protodesc_cold) = { + "\n\014Person.proto\022\020benchmarktesting\"j\n\006Pers" + "on\022\014\n\004name\030\001 \001(\t\022\n\n\002id\030\002 \001(\005\022,\n\005roles\030\003 " + "\003(\0132\035.benchmarktesting.Person.Role\032\030\n\004Ro" + "le\022\020\n\010roleName\030\001 \001(\t" +}; +static ::absl::once_flag descriptor_table_Person_2eproto_once; +const ::_pbi::DescriptorTable descriptor_table_Person_2eproto = { + false, + false, + 140, + descriptor_table_protodef_Person_2eproto, + "Person.proto", + &descriptor_table_Person_2eproto_once, + nullptr, + 0, + 2, + schemas, + file_default_instances, + TableStruct_Person_2eproto::offsets, + file_level_metadata_Person_2eproto, + file_level_enum_descriptors_Person_2eproto, + file_level_service_descriptors_Person_2eproto, +}; + +// This function exists to be marked as weak. +// It can significantly speed up compilation by breaking up LLVM's SCC +// in the .pb.cc translation units. Large translation units see a +// reduction of more than 35% of walltime for optimized builds. Without +// the weak attribute all the messages in the file, including all the +// vtables and everything they use become part of the same SCC through +// a cycle like: +// GetMetadata -> descriptor table -> default instances -> +// vtables -> GetMetadata +// By adding a weak function here we break the connection from the +// individual vtables back into the descriptor table. +PROTOBUF_ATTRIBUTE_WEAK const ::_pbi::DescriptorTable* descriptor_table_Person_2eproto_getter() { + return &descriptor_table_Person_2eproto; +} +// Force running AddDescriptors() at dynamic initialization time. +PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 +static ::_pbi::AddDescriptorsRunner dynamic_init_dummy_Person_2eproto(&descriptor_table_Person_2eproto); +namespace benchmarktesting { +// =================================================================== + +class Person_Role::_Internal { + public: + using HasBits = decltype(std::declval()._impl_._has_bits_); + static constexpr ::int32_t kHasBitsOffset = + 8 * PROTOBUF_FIELD_OFFSET(Person_Role, _impl_._has_bits_); +}; + +Person_Role::Person_Role(::google::protobuf::Arena* arena) + : ::google::protobuf::Message(arena) { + SharedCtor(arena); + // @@protoc_insertion_point(arena_constructor:benchmarktesting.Person.Role) +} +inline PROTOBUF_NDEBUG_INLINE Person_Role::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, + const Impl_& from) + : _has_bits_{from._has_bits_}, + _cached_size_{0}, + rolename_(arena, from.rolename_) {} + +Person_Role::Person_Role( + ::google::protobuf::Arena* arena, + const Person_Role& from) + : ::google::protobuf::Message(arena) { + Person_Role* const _this = this; + (void)_this; + _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( + from._internal_metadata_); + new (&_impl_) Impl_(internal_visibility(), arena, from._impl_); + + // @@protoc_insertion_point(copy_constructor:benchmarktesting.Person.Role) +} +inline PROTOBUF_NDEBUG_INLINE Person_Role::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena) + : _cached_size_{0}, + rolename_(arena) {} + +inline void Person_Role::SharedCtor(::_pb::Arena* arena) { + new (&_impl_) Impl_(internal_visibility(), arena); +} +Person_Role::~Person_Role() { + // @@protoc_insertion_point(destructor:benchmarktesting.Person.Role) + _internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); + SharedDtor(); +} +inline void Person_Role::SharedDtor() { + ABSL_DCHECK(GetArena() == nullptr); + _impl_.rolename_.Destroy(); + _impl_.~Impl_(); +} + +const ::google::protobuf::MessageLite::ClassData* +Person_Role::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + _data_ = { + Person_Role::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + PROTOBUF_FIELD_OFFSET(Person_Role, _impl_._cached_size_), + }; + return &_data_; +} +PROTOBUF_NOINLINE void Person_Role::Clear() { +// @@protoc_insertion_point(message_clear_start:benchmarktesting.Person.Role) + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + _impl_.rolename_.ClearNonDefaultToEmpty(); + } + _impl_._has_bits_.Clear(); + _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); +} + +const char* Person_Role::_InternalParse( + const char* ptr, ::_pbi::ParseContext* ctx) { + ptr = ::_pbi::TcParser::ParseLoop(this, ptr, ctx, &_table_.header); + return ptr; +} + + +PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 +const ::_pbi::TcParseTable<0, 1, 0, 45, 2> Person_Role::_table_ = { + { + PROTOBUF_FIELD_OFFSET(Person_Role, _impl_._has_bits_), + 0, // no _extensions_ + 1, 0, // max_field_number, fast_idx_mask + offsetof(decltype(_table_), field_lookup_table), + 4294967294, // skipmap + offsetof(decltype(_table_), field_entries), + 1, // num_field_entries + 0, // num_aux_entries + offsetof(decltype(_table_), field_names), // no aux_entries + &_Person_Role_default_instance_._instance, + ::_pbi::TcParser::GenericFallback, // fallback + #ifdef PROTOBUF_PREFETCH_PARSE_TABLE + ::_pbi::TcParser::GetTable<::benchmarktesting::Person_Role>(), // to_prefetch + #endif // PROTOBUF_PREFETCH_PARSE_TABLE + }, {{ + // optional string roleName = 1; + {::_pbi::TcParser::FastSS1, + {10, 0, 0, PROTOBUF_FIELD_OFFSET(Person_Role, _impl_.rolename_)}}, + }}, {{ + 65535, 65535 + }}, {{ + // optional string roleName = 1; + {PROTOBUF_FIELD_OFFSET(Person_Role, _impl_.rolename_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kRawString | ::_fl::kRepAString)}, + }}, + // no aux_entries + {{ + "\34\10\0\0\0\0\0\0" + "benchmarktesting.Person.Role" + "roleName" + }}, +}; + +::uint8_t* Person_Role::_InternalSerialize( + ::uint8_t* target, + ::google::protobuf::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:benchmarktesting.Person.Role) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; + + cached_has_bits = _impl_._has_bits_[0]; + // optional string roleName = 1; + if (cached_has_bits & 0x00000001u) { + const std::string& _s = this->_internal_rolename(); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "benchmarktesting.Person.Role.roleName"); + target = stream->WriteStringMaybeAliased(1, _s, target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:benchmarktesting.Person.Role) + return target; +} + +::size_t Person_Role::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:benchmarktesting.Person.Role) + ::size_t total_size = 0; + + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // optional string roleName = 1; + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this->_internal_rolename()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); +} + + +void Person_Role::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { + auto* const _this = static_cast(&to_msg); + auto& from = static_cast(from_msg); + // @@protoc_insertion_point(class_specific_merge_from_start:benchmarktesting.Person.Role) + ABSL_DCHECK_NE(&from, _this); + ::uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + _this->_internal_set_rolename(from._internal_rolename()); + } + _this->_impl_._has_bits_[0] |= cached_has_bits; + _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); +} + +void Person_Role::CopyFrom(const Person_Role& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:benchmarktesting.Person.Role) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +PROTOBUF_NOINLINE bool Person_Role::IsInitialized() const { + return true; +} + +void Person_Role::InternalSwap(Person_Role* PROTOBUF_RESTRICT other) { + using std::swap; + auto* arena = GetArena(); + ABSL_DCHECK_EQ(arena, other->GetArena()); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); + ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.rolename_, &other->_impl_.rolename_, arena); +} + +::google::protobuf::Metadata Person_Role::GetMetadata() const { + return ::_pbi::AssignDescriptors( + &descriptor_table_Person_2eproto_getter, &descriptor_table_Person_2eproto_once, + file_level_metadata_Person_2eproto[0]); +} +// =================================================================== + +class Person::_Internal { + public: + using HasBits = decltype(std::declval()._impl_._has_bits_); + static constexpr ::int32_t kHasBitsOffset = + 8 * PROTOBUF_FIELD_OFFSET(Person, _impl_._has_bits_); +}; + +Person::Person(::google::protobuf::Arena* arena) + : ::google::protobuf::Message(arena) { + SharedCtor(arena); + // @@protoc_insertion_point(arena_constructor:benchmarktesting.Person) +} +inline PROTOBUF_NDEBUG_INLINE Person::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, + const Impl_& from) + : _has_bits_{from._has_bits_}, + _cached_size_{0}, + roles_{visibility, arena, from.roles_}, + name_(arena, from.name_) {} + +Person::Person( + ::google::protobuf::Arena* arena, + const Person& from) + : ::google::protobuf::Message(arena) { + Person* const _this = this; + (void)_this; + _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( + from._internal_metadata_); + new (&_impl_) Impl_(internal_visibility(), arena, from._impl_); + _impl_.id_ = from._impl_.id_; + + // @@protoc_insertion_point(copy_constructor:benchmarktesting.Person) +} +inline PROTOBUF_NDEBUG_INLINE Person::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena) + : _cached_size_{0}, + roles_{visibility, arena}, + name_(arena) {} + +inline void Person::SharedCtor(::_pb::Arena* arena) { + new (&_impl_) Impl_(internal_visibility(), arena); + _impl_.id_ = {}; +} +Person::~Person() { + // @@protoc_insertion_point(destructor:benchmarktesting.Person) + _internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); + SharedDtor(); +} +inline void Person::SharedDtor() { + ABSL_DCHECK(GetArena() == nullptr); + _impl_.name_.Destroy(); + _impl_.~Impl_(); +} + +const ::google::protobuf::MessageLite::ClassData* +Person::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData + _data_ = { + Person::MergeImpl, + nullptr, // OnDemandRegisterArenaDtor + &::google::protobuf::Message::kDescriptorMethods, + PROTOBUF_FIELD_OFFSET(Person, _impl_._cached_size_), + }; + return &_data_; +} +PROTOBUF_NOINLINE void Person::Clear() { +// @@protoc_insertion_point(message_clear_start:benchmarktesting.Person) + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _impl_.roles_.Clear(); + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + _impl_.name_.ClearNonDefaultToEmpty(); + } + _impl_.id_ = 0; + _impl_._has_bits_.Clear(); + _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); +} + +const char* Person::_InternalParse( + const char* ptr, ::_pbi::ParseContext* ctx) { + ptr = ::_pbi::TcParser::ParseLoop(this, ptr, ctx, &_table_.header); + return ptr; +} + + +PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 +const ::_pbi::TcParseTable<2, 3, 1, 36, 2> Person::_table_ = { + { + PROTOBUF_FIELD_OFFSET(Person, _impl_._has_bits_), + 0, // no _extensions_ + 3, 24, // max_field_number, fast_idx_mask + offsetof(decltype(_table_), field_lookup_table), + 4294967288, // skipmap + offsetof(decltype(_table_), field_entries), + 3, // num_field_entries + 1, // num_aux_entries + offsetof(decltype(_table_), aux_entries), + &_Person_default_instance_._instance, + ::_pbi::TcParser::GenericFallback, // fallback + #ifdef PROTOBUF_PREFETCH_PARSE_TABLE + ::_pbi::TcParser::GetTable<::benchmarktesting::Person>(), // to_prefetch + #endif // PROTOBUF_PREFETCH_PARSE_TABLE + }, {{ + {::_pbi::TcParser::MiniParse, {}}, + // optional string name = 1; + {::_pbi::TcParser::FastSS1, + {10, 0, 0, PROTOBUF_FIELD_OFFSET(Person, _impl_.name_)}}, + // optional int32 id = 2; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Person, _impl_.id_), 1>(), + {16, 1, 0, PROTOBUF_FIELD_OFFSET(Person, _impl_.id_)}}, + // repeated .benchmarktesting.Person.Role roles = 3; + {::_pbi::TcParser::FastMtR1, + {26, 63, 0, PROTOBUF_FIELD_OFFSET(Person, _impl_.roles_)}}, + }}, {{ + 65535, 65535 + }}, {{ + // optional string name = 1; + {PROTOBUF_FIELD_OFFSET(Person, _impl_.name_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kRawString | ::_fl::kRepAString)}, + // optional int32 id = 2; + {PROTOBUF_FIELD_OFFSET(Person, _impl_.id_), _Internal::kHasBitsOffset + 1, 0, + (0 | ::_fl::kFcOptional | ::_fl::kInt32)}, + // repeated .benchmarktesting.Person.Role roles = 3; + {PROTOBUF_FIELD_OFFSET(Person, _impl_.roles_), -1, 0, + (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, + }}, {{ + {::_pbi::TcParser::GetTable<::benchmarktesting::Person_Role>()}, + }}, {{ + "\27\4\0\0\0\0\0\0" + "benchmarktesting.Person" + "name" + }}, +}; + +::uint8_t* Person::_InternalSerialize( + ::uint8_t* target, + ::google::protobuf::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:benchmarktesting.Person) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; + + cached_has_bits = _impl_._has_bits_[0]; + // optional string name = 1; + if (cached_has_bits & 0x00000001u) { + const std::string& _s = this->_internal_name(); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "benchmarktesting.Person.name"); + target = stream->WriteStringMaybeAliased(1, _s, target); + } + + // optional int32 id = 2; + if (cached_has_bits & 0x00000002u) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<2>( + stream, this->_internal_id(), target); + } + + // repeated .benchmarktesting.Person.Role roles = 3; + for (unsigned i = 0, + n = static_cast(this->_internal_roles_size()); i < n; i++) { + const auto& repfield = this->_internal_roles().Get(i); + target = ::google::protobuf::internal::WireFormatLite:: + InternalWriteMessage(3, repfield, repfield.GetCachedSize(), target, stream); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:benchmarktesting.Person) + return target; +} + +::size_t Person::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:benchmarktesting.Person) + ::size_t total_size = 0; + + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // repeated .benchmarktesting.Person.Role roles = 3; + total_size += 1UL * this->_internal_roles_size(); + for (const auto& msg : this->_internal_roles()) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + // optional string name = 1; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this->_internal_name()); + } + + // optional int32 id = 2; + if (cached_has_bits & 0x00000002u) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this->_internal_id()); + } + + } + return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); +} + + +void Person::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { + auto* const _this = static_cast(&to_msg); + auto& from = static_cast(from_msg); + // @@protoc_insertion_point(class_specific_merge_from_start:benchmarktesting.Person) + ABSL_DCHECK_NE(&from, _this); + ::uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + _this->_internal_mutable_roles()->MergeFrom( + from._internal_roles()); + cached_has_bits = from._impl_._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000001u) { + _this->_internal_set_name(from._internal_name()); + } + if (cached_has_bits & 0x00000002u) { + _this->_impl_.id_ = from._impl_.id_; + } + } + _this->_impl_._has_bits_[0] |= cached_has_bits; + _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); +} + +void Person::CopyFrom(const Person& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:benchmarktesting.Person) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +PROTOBUF_NOINLINE bool Person::IsInitialized() const { + return true; +} + +void Person::InternalSwap(Person* PROTOBUF_RESTRICT other) { + using std::swap; + auto* arena = GetArena(); + ABSL_DCHECK_EQ(arena, other->GetArena()); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); + _impl_.roles_.InternalSwap(&other->_impl_.roles_); + ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.name_, &other->_impl_.name_, arena); + swap(_impl_.id_, other->_impl_.id_); +} + +::google::protobuf::Metadata Person::GetMetadata() const { + return ::_pbi::AssignDescriptors( + &descriptor_table_Person_2eproto_getter, &descriptor_table_Person_2eproto_once, + file_level_metadata_Person_2eproto[1]); +} +// @@protoc_insertion_point(namespace_scope) +} // namespace benchmarktesting +namespace google { +namespace protobuf { +} // namespace protobuf +} // namespace google +// @@protoc_insertion_point(global_scope) +#include "google/protobuf/port_undef.inc" diff --git a/benchmarking/src/Simple.cpp b/benchmarking/src/Simple.cpp new file mode 100644 index 0000000..c2990db --- /dev/null +++ b/benchmarking/src/Simple.cpp @@ -0,0 +1,136 @@ +#include "Simple.hpp" +#include "ComposerPaper.hpp" +#include "DecomposerPaper.hpp" +#include "Person.pb.h" +#include +#include +#include +#include + +void PerformanceTestBoostSimple(std::size_t); +void PerformanceTestBunnySimple(std::size_t); +void PerformanceTestProtoSimple(std::size_t); + +static void BM_BoostSimple(benchmark::State &state) +{ + std::size_t count{}; + for (auto _ : state) + { + PerformanceTestBoostSimple(count++); + } +} + +static void BM_BunnySimple(benchmark::State &state) +{ + std::size_t count{}; + for (auto _ : state) + { + PerformanceTestBunnySimple(count++); + } +} + +static void BM_ProtoSimple(benchmark::State &state) +{ + std::size_t count{}; + for (auto _ : state) + { + PerformanceTestProtoSimple(count++); + } +} + +BENCHMARK(BM_BoostSimple); +BENCHMARK(BM_BunnySimple); +BENCHMARK(BM_ProtoSimple); + +BENCHMARK_MAIN(); + +constexpr std::uint64_t kCountThreshold = 100; + +void PerformanceTestBoostSimple(std::size_t count) +{ + using boosttest::Person; + using boosttest::Role; + + Role role1; + role1.m_roleName = "director"; + + Role role2; + role2.m_roleName = "manager"; + + Person out_obj; + out_obj.m_id = 100; + out_obj.m_name = "sia"; + out_obj.m_roles.push_back(role1); + out_obj.m_roles.push_back(role2); + + std::stringstream ss; + boost::archive::text_oarchive oa{ss}; + + oa << out_obj; + + if (count % kCountThreshold == 0) + { + boost::archive::text_iarchive ia{ss}; + Person in_obj; + ia >> in_obj; + } +} + +void PerformanceTestBunnySimple(std::size_t count) +{ + using bunnytest::Person; + using bunnytest::Role; + + Role role1; + role1.m_roleName = "director"; + + Role role2; + role2.m_roleName = "manager"; + + Person out_obj; + out_obj.m_id = 100; + out_obj.m_name = "sia"; + out_obj.m_roles.push_back(role1); + out_obj.m_roles.push_back(role2); + + std::stringstream ss; + bunny::ComposerPaper composer{ss}; + + composer << out_obj; + + if (count % kCountThreshold == 0) + { + bunny::DecomposerPaper decomposer{ss}; + Person in_obj; + decomposer >> in_obj; + } +} + +void PerformanceTestProtoSimple(std::size_t count) +{ + GOOGLE_PROTOBUF_VERIFY_VERSION; + + benchmarktesting::Person person1{}; + person1.set_id(100); + person1.set_name("sia"); + + auto role1 = person1.add_roles(); + role1->set_rolename("director"); + + auto role2 = person1.add_roles(); + role2->set_rolename("manager"); + + std::stringstream ss{}; + person1.SerializeToOstream(&ss); + + if ((count % kCountThreshold == 0)) + { + benchmarktesting::Person person2{}; + person2.ParseFromIstream(&ss); + + for (std::size_t i = 0; i < person2.roles_size(); ++i) + { + auto role = person2.roles(i); + } + } +} \ No newline at end of file diff --git a/cmake/bunnyConfig.cmake.in b/cmake/bunnyConfig.cmake.in new file mode 100644 index 0000000..ff0fa67 --- /dev/null +++ b/cmake/bunnyConfig.cmake.in @@ -0,0 +1,4 @@ +@PACKAGE_INIT@ + +include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") +check_required_components("@PROJECT_NAME@") \ No newline at end of file diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 5b443ae..8276b62 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -2,26 +2,17 @@ cmake_minimum_required(VERSION 3.2) project(bunny-test VERSION 3.7.1 LANGUAGES CXX) -set(Boost_NO_BOOST_CMAKE TRUE) -set(BOOST_ROOT "/usr/local/lib/boost") -set(Boost_INCLUDE_DIR "/usr/local/lib/boost/include") -set(benchmark_DIR "${CMAKE_CURRENT_SOURCE_DIR}/benchmark") -set(BENCHMARK_ENABLE_GTEST_TESTS OFF) - find_package(GTest REQUIRED) -find_package(Boost REQUIRED COMPONENTS serialization) add_compile_options(-Wall -Wextra -Wpedantic) file(GLOB SRC_FILES - "src/*.cpp" - "include/*.hpp" + "src/*.cpp" ) -add_subdirectory(benchmark) - -# include_directories(include) - add_executable(${PROJECT_NAME} ${SRC_FILES}) -target_include_directories(${PROJECT_NAME} PRIVATE include ${CMAKE_CURRENT_SOURCE_DIR}/include ${Boost_INCLUDE_DIRS} benchmark/include) -target_link_libraries(${PROJECT_NAME} ${GTEST_LIBRARIES} pthread gtest_main Boost::serialization benchmark::benchmark) \ No newline at end of file +target_include_directories(${PROJECT_NAME} PRIVATE include ${CMAKE_CURRENT_SOURCE_DIR}/include) +target_link_libraries(${PROJECT_NAME} ${GTEST_LIBRARIES} + pthread + gtest_main +) \ No newline at end of file diff --git a/test/include/ArrayTest.hpp b/test/include/ArrayTest.hpp index 5d33e85..ad1b249 100644 --- a/test/include/ArrayTest.hpp +++ b/test/include/ArrayTest.hpp @@ -1,21 +1,25 @@ #pragma once +#include "ComposerPaper.hpp" +#include "DecomposerPaper.hpp" #include +using bunny::FieldTag; + struct SimpleTestClass { int m_arr[5]{1, 2, 3, 4, 5}; template - void serialize(Paper &paper, std::string key = "") + void serialize(Paper &paper) { - paper.save(m_arr, key, 9090); + paper(m_arr, FieldTag{9090}); } template - void deserialize(Paper &paper, std::string key = "", std::size_t index = 0) + void deserialize(Paper &paper) { - paper.load(m_arr, key, 9090, index); + paper(m_arr, FieldTag{9090}); } bool operator==(const SimpleTestClass &other) const & @@ -46,15 +50,15 @@ struct KeyIgnoreTestClass int m_arr[5]{1, 2, 3, 4, 5}; template - void serialize(Paper &paper, std::string key = "") + void serialize(Paper &paper) { - paper.save(m_arr, key, 9090); + paper(m_arr, FieldTag{9090}); } template - void deserialize(Paper &paper, std::string key = "", std::size_t index = 0) + void deserialize(Paper &paper) { - paper.load(m_arr, key, 1231, index); + paper(m_arr, FieldTag{1231}); } bool operator==(const KeyIgnoreTestClass &other) const & @@ -78,15 +82,15 @@ struct CascadeArrayTestClass SimpleTestClass m_class_list[10]; template - void serialize(Paper &paper, std::string key = "") + void serialize(Paper &paper) { - paper.save(m_class_list, key, 9090); + paper(m_class_list, FieldTag{9090}); } template - void deserialize(Paper &paper, std::string key = "", std::size_t index = 0) + void deserialize(Paper &paper) { - paper.load(m_class_list, key, 9090, index); + paper(m_class_list, FieldTag{9090}); } bool operator==(const CascadeArrayTestClass &other) const & @@ -110,15 +114,15 @@ struct SimpleStringTestClass std::string m_arr[5]; template - void serialize(Paper &paper, std::string key = "") + void serialize(Paper &paper) { - paper.save(m_arr, key, 9090); + paper(m_arr, FieldTag{9090}); } template - void deserialize(Paper &paper, std::string key = "", std::size_t index = 0) + void deserialize(Paper &paper) { - paper.load(m_arr, key, 9090, index); + paper(m_arr, FieldTag{9090}); } bool operator==(const SimpleStringTestClass &other) const & diff --git a/test/include/ArrayTest1.hpp b/test/include/ArrayTest1.hpp deleted file mode 100644 index ad1b249..0000000 --- a/test/include/ArrayTest1.hpp +++ /dev/null @@ -1,142 +0,0 @@ -#pragma once - -#include "ComposerPaper.hpp" -#include "DecomposerPaper.hpp" -#include - -using bunny::FieldTag; - -struct SimpleTestClass -{ - int m_arr[5]{1, 2, 3, 4, 5}; - - template - void serialize(Paper &paper) - { - paper(m_arr, FieldTag{9090}); - } - - template - void deserialize(Paper &paper) - { - paper(m_arr, FieldTag{9090}); - } - - bool operator==(const SimpleTestClass &other) const & - { - bool ans = true; - for (std::size_t i = 0; i < std::size(m_arr); ++i) - { - if (m_arr[i] != other.m_arr[i]) - { - ans = false; - break; - } - } - - return ans; - } - - friend bool operator!=(const SimpleTestClass &first, const SimpleTestClass &second); -}; - -bool operator!=(const SimpleTestClass &first, const SimpleTestClass &second) -{ - return !(first == second); -} - -struct KeyIgnoreTestClass -{ - int m_arr[5]{1, 2, 3, 4, 5}; - - template - void serialize(Paper &paper) - { - paper(m_arr, FieldTag{9090}); - } - - template - void deserialize(Paper &paper) - { - paper(m_arr, FieldTag{1231}); - } - - bool operator==(const KeyIgnoreTestClass &other) const & - { - bool ans = true; - for (std::size_t i = 0; i < std::size(m_arr); ++i) - { - if (m_arr[i] != other.m_arr[i]) - { - ans = false; - break; - } - } - - return ans; - } -}; - -struct CascadeArrayTestClass -{ - SimpleTestClass m_class_list[10]; - - template - void serialize(Paper &paper) - { - paper(m_class_list, FieldTag{9090}); - } - - template - void deserialize(Paper &paper) - { - paper(m_class_list, FieldTag{9090}); - } - - bool operator==(const CascadeArrayTestClass &other) const & - { - bool ans = true; - for (std::size_t i = 0; i < std::size(m_class_list); ++i) - { - if (m_class_list[i] != other.m_class_list[i]) - { - ans = false; - break; - } - } - - return ans; - } -}; - -struct SimpleStringTestClass -{ - std::string m_arr[5]; - - template - void serialize(Paper &paper) - { - paper(m_arr, FieldTag{9090}); - } - - template - void deserialize(Paper &paper) - { - paper(m_arr, FieldTag{9090}); - } - - bool operator==(const SimpleStringTestClass &other) const & - { - bool ans = true; - for (std::size_t i = 0; i < std::size(m_arr); ++i) - { - if (m_arr[i] != other.m_arr[i]) - { - ans = false; - break; - } - } - - return ans; - } -}; \ No newline at end of file diff --git a/test/include/ComplexClassTest.hpp b/test/include/ComplexClassTest.hpp index 7b70067..f40adc8 100644 --- a/test/include/ComplexClassTest.hpp +++ b/test/include/ComplexClassTest.hpp @@ -1,53 +1,57 @@ -// #pragma once - -// #include -// #include - -// struct PlainClass -// { -// std::string m_name; -// std::unordered_map m_map; - -// template -// void serialize(Paper &paper, std::string key = "") -// { -// paper.save(m_name, key, 1); -// paper.save(m_map, key, 2); -// } - -// template -// void deserialize(Paper &paper, std::string key = "", std::size_t index = 0) -// { -// paper.load(m_name, key, 1, index); -// paper.load(m_map, key, 2, index); -// } -// }; - -// struct ComplexTestClass -// { -// unsigned int m_id{}; -// int m_count{}; -// std::string m_name; -// std::unordered_map> m_int_map; -// std::unordered_map> m_plain_map[3]; - -// template -// void serialize(Paper &paper, std::string key = "") -// { -// paper.save(m_id, key, 1); -// paper.save(m_name, key, 2); -// paper.save(m_count, key, 3); -// paper.save(m_int_map, key, 4); -// paper.save(m_plain_map, key, 5); -// } - -// template -// void deserialize(Paper &paper, std::string key = "", std::size_t index = 0) -// { -// paper.load(m_id, key, 1, index); -// paper.load(m_name, key, 2, index); -// paper.load(m_count, key, 3, index); -// paper.load(m_int_map, key, 4, index); -// paper.load(m_plain_map, key, 5, index); -// } -// }; \ No newline at end of file +#pragma once + +#include "ComposerPaper.hpp" +#include "DecomposerPaper.hpp" +#include +#include + +using bunny::FieldTag; + +struct PlainClass +{ + std::string m_name; + std::unordered_map m_map; + + template + void serialize(Paper &paper) + { + paper(m_name, FieldTag{1}); + paper(m_map, FieldTag{2}); + } + + template + void deserialize(Paper &paper) + { + paper(m_name, FieldTag{1}); + paper(m_map, FieldTag{2}); + } +}; + +struct ComplexTestClass +{ + unsigned int m_id{}; + int m_count{}; + std::string m_name; + std::unordered_map> m_int_map; + std::unordered_map> m_plain_map[3]; + + template + void serialize(Paper &paper) + { + paper(m_id, FieldTag{1}); + paper(m_name, FieldTag{2}); + paper(m_count, FieldTag{3}); + paper(m_int_map, FieldTag{4}); + paper(m_plain_map, FieldTag{5}); + } + + template + void deserialize(Paper &paper) + { + paper(m_id, FieldTag{1}); + paper(m_name, FieldTag{2}); + paper(m_count, FieldTag{3}); + paper(m_int_map, FieldTag{4}); + paper(m_plain_map, FieldTag{5}); + } +}; \ No newline at end of file diff --git a/test/include/ComplexClassTest1.hpp b/test/include/ComplexClassTest1.hpp deleted file mode 100644 index f40adc8..0000000 --- a/test/include/ComplexClassTest1.hpp +++ /dev/null @@ -1,57 +0,0 @@ -#pragma once - -#include "ComposerPaper.hpp" -#include "DecomposerPaper.hpp" -#include -#include - -using bunny::FieldTag; - -struct PlainClass -{ - std::string m_name; - std::unordered_map m_map; - - template - void serialize(Paper &paper) - { - paper(m_name, FieldTag{1}); - paper(m_map, FieldTag{2}); - } - - template - void deserialize(Paper &paper) - { - paper(m_name, FieldTag{1}); - paper(m_map, FieldTag{2}); - } -}; - -struct ComplexTestClass -{ - unsigned int m_id{}; - int m_count{}; - std::string m_name; - std::unordered_map> m_int_map; - std::unordered_map> m_plain_map[3]; - - template - void serialize(Paper &paper) - { - paper(m_id, FieldTag{1}); - paper(m_name, FieldTag{2}); - paper(m_count, FieldTag{3}); - paper(m_int_map, FieldTag{4}); - paper(m_plain_map, FieldTag{5}); - } - - template - void deserialize(Paper &paper) - { - paper(m_id, FieldTag{1}); - paper(m_name, FieldTag{2}); - paper(m_count, FieldTag{3}); - paper(m_int_map, FieldTag{4}); - paper(m_plain_map, FieldTag{5}); - } -}; \ No newline at end of file diff --git a/test/include/ComplexClassTestTemp.hpp b/test/include/ComplexClassTestTemp.hpp deleted file mode 100644 index cd3c3de..0000000 --- a/test/include/ComplexClassTestTemp.hpp +++ /dev/null @@ -1,40 +0,0 @@ -#pragma once - -#include -#include -#include - -namespace boosttest -{ - struct PlainClass - { - std::string m_name; - std::unordered_map m_map; - - template - void serialize(Archive &arc, unsigned int) - { - arc & m_name; - arc & m_map; - } - }; - - struct ComplexTestClass - { - unsigned int m_id{}; - int m_count{}; - std::string m_name; - std::unordered_map> m_int_map; - std::unordered_map> m_plain_map[3]; - - template - void serialize(Archive &arc, unsigned int) - { - arc & m_id; - arc & m_name; - arc & m_count; - arc & m_int_map; - arc & m_plain_map; - } - }; -} \ No newline at end of file diff --git a/test/include/ObjectTest.hpp b/test/include/ObjectTest.hpp index 08ee455..fc8b481 100644 --- a/test/include/ObjectTest.hpp +++ b/test/include/ObjectTest.hpp @@ -1,25 +1,29 @@ #pragma once +#include "ComposerPaper.hpp" +#include "DecomposerPaper.hpp" #include #include +using bunny::FieldTag; + struct Manager { int m_id; std::string m_department; template - void serialize(Paper &paper, std::string key = "") + void serialize(Paper &paper) { - paper.save(m_id, key, 1); - paper.save(m_department, key, 2); + paper(m_id, FieldTag{1}); + paper(m_department, FieldTag{2}); } template - void deserialize(Paper &paper, std::string key = "", std::size_t index = 0) + void deserialize(Paper &paper) { - paper.load(m_id, key, 1, index); - paper.load(m_department, key, 2, index); + paper(m_id, FieldTag{1}); + paper(m_department, FieldTag{2}); } bool operator==(const Manager& other) const& @@ -35,19 +39,19 @@ struct Person Manager m_manager; template - void serialize(Paper &paper, std::string key = "") + void serialize(Paper &paper) { - paper.save(m_id, key, 1); - paper.save(m_name, key, 2); - paper.save(m_manager, key, 3); + paper(m_id, FieldTag{1}); + paper(m_name, FieldTag{2}); + paper(m_manager, FieldTag{3}); } template - void deserialize(Paper &paper, std::string key = "", std::size_t index = 0) + void deserialize(Paper &paper) { - paper.load(m_id, key, 1, index); - paper.load(m_name, key, 2, index); - paper.load(m_manager, key, 3, index); + paper(m_id, FieldTag{1}); + paper(m_name, FieldTag{2}); + paper(m_manager, FieldTag{3}); } bool operator==(const Person& other) const& diff --git a/test/include/ObjectTest1.hpp b/test/include/ObjectTest1.hpp deleted file mode 100644 index fc8b481..0000000 --- a/test/include/ObjectTest1.hpp +++ /dev/null @@ -1,61 +0,0 @@ -#pragma once - -#include "ComposerPaper.hpp" -#include "DecomposerPaper.hpp" -#include -#include - -using bunny::FieldTag; - -struct Manager -{ - int m_id; - std::string m_department; - - template - void serialize(Paper &paper) - { - paper(m_id, FieldTag{1}); - paper(m_department, FieldTag{2}); - } - - template - void deserialize(Paper &paper) - { - paper(m_id, FieldTag{1}); - paper(m_department, FieldTag{2}); - } - - bool operator==(const Manager& other) const& - { - return (other.m_id == m_id) && (m_department == other.m_department); - } -}; - -struct Person -{ - int m_id; - std::string m_name; - Manager m_manager; - - template - void serialize(Paper &paper) - { - paper(m_id, FieldTag{1}); - paper(m_name, FieldTag{2}); - paper(m_manager, FieldTag{3}); - } - - template - void deserialize(Paper &paper) - { - paper(m_id, FieldTag{1}); - paper(m_name, FieldTag{2}); - paper(m_manager, FieldTag{3}); - } - - bool operator==(const Person& other) const& - { - return (m_id == other.m_id) && (m_name == other.m_name) && (m_manager == other.m_manager); - } -}; \ No newline at end of file diff --git a/test/include/SharedPtrTest.hpp b/test/include/SharedPtrTest.hpp index c117386..2832a0c 100644 --- a/test/include/SharedPtrTest.hpp +++ b/test/include/SharedPtrTest.hpp @@ -1,22 +1,26 @@ #pragma once +#include "ComposerPaper.hpp" +#include "DecomposerPaper.hpp" #include #include +using bunny::FieldTag; + struct SharedPtrPersonTestClass { int m_number; template - void serialize(Paper &paper, std::string key = "") + void serialize(Paper &paper) { - paper.save(m_number, key, 1); + paper(m_number, FieldTag{1}); } template - void deserialize(Paper &paper, std::string key = "", std::size_t index = 0) + void deserialize(Paper &paper) { - paper.load(m_number, key, 1, index); + paper(m_number, FieldTag{1}); } }; @@ -27,19 +31,19 @@ struct SharedPtrSimpleTestClass std::shared_ptr m_person{nullptr}; template - void serialize(Paper &paper, std::string key = "") + void serialize(Paper &paper) { - paper.save(m_name, key, 1); - paper.save(m_id, key, 2); - paper.save(m_person, key, 3); + paper(m_name, FieldTag{1}); + paper(m_id, FieldTag{2}); + paper(m_person, FieldTag{3}); } template - void deserialize(Paper &paper, std::string key = "", std::size_t index = 0) + void deserialize(Paper &paper) { - paper.load(m_name, key, 1, index); - paper.load(m_id, key, 2, index); - paper.load(m_person, key, 3, index); + paper(m_name, FieldTag{1}); + paper(m_id, FieldTag{2}); + paper(m_person, FieldTag{3}); } }; @@ -49,22 +53,25 @@ struct SharedPtrComplexTestClass int m_id; std::shared_ptr m_person1{nullptr}; std::shared_ptr> m_person2{nullptr}; + std::shared_ptr m_int_ptr{nullptr}; template - void serialize(Paper &paper, std::string key = "") + void serialize(Paper &paper) { - paper.save(m_name, key, 1); - paper.save(m_id, key, 2); - paper.save(m_person1, key, 3); - paper.save(m_person2, key, 4); + paper(m_name, FieldTag{1}); + paper(m_id, FieldTag{2}); + paper(m_person1, FieldTag{3}); + paper(m_person2, FieldTag{4}); + paper(m_int_ptr, FieldTag{5}); } template - void deserialize(Paper &paper, std::string key = "", std::size_t index = 0) + void deserialize(Paper &paper) { - paper.load(m_name, key, 1, index); - paper.load(m_id, key, 2, index); - paper.load(m_person1, key, 30, index); - paper.load(m_person2, key, 4, index); + paper(m_name, FieldTag{1}); + paper(m_id, FieldTag{2}); + paper(m_person1, FieldTag{30}); + paper(m_person2, FieldTag{4}); + paper(m_int_ptr, FieldTag{5}); } }; \ No newline at end of file diff --git a/test/include/SharedPtrTest1.hpp b/test/include/SharedPtrTest1.hpp deleted file mode 100644 index 2832a0c..0000000 --- a/test/include/SharedPtrTest1.hpp +++ /dev/null @@ -1,77 +0,0 @@ -#pragma once - -#include "ComposerPaper.hpp" -#include "DecomposerPaper.hpp" -#include -#include - -using bunny::FieldTag; - -struct SharedPtrPersonTestClass -{ - int m_number; - - template - void serialize(Paper &paper) - { - paper(m_number, FieldTag{1}); - } - - template - void deserialize(Paper &paper) - { - paper(m_number, FieldTag{1}); - } -}; - -struct SharedPtrSimpleTestClass -{ - std::string m_name; - int m_id; - std::shared_ptr m_person{nullptr}; - - template - void serialize(Paper &paper) - { - paper(m_name, FieldTag{1}); - paper(m_id, FieldTag{2}); - paper(m_person, FieldTag{3}); - } - - template - void deserialize(Paper &paper) - { - paper(m_name, FieldTag{1}); - paper(m_id, FieldTag{2}); - paper(m_person, FieldTag{3}); - } -}; - -struct SharedPtrComplexTestClass -{ - std::string m_name; - int m_id; - std::shared_ptr m_person1{nullptr}; - std::shared_ptr> m_person2{nullptr}; - std::shared_ptr m_int_ptr{nullptr}; - - template - void serialize(Paper &paper) - { - paper(m_name, FieldTag{1}); - paper(m_id, FieldTag{2}); - paper(m_person1, FieldTag{3}); - paper(m_person2, FieldTag{4}); - paper(m_int_ptr, FieldTag{5}); - } - - template - void deserialize(Paper &paper) - { - paper(m_name, FieldTag{1}); - paper(m_id, FieldTag{2}); - paper(m_person1, FieldTag{30}); - paper(m_person2, FieldTag{4}); - paper(m_int_ptr, FieldTag{5}); - } -}; \ No newline at end of file diff --git a/test/include/UnorderedMapTest.hpp b/test/include/UnorderedMapTest.hpp index 0a6f0e4..c2951fd 100644 --- a/test/include/UnorderedMapTest.hpp +++ b/test/include/UnorderedMapTest.hpp @@ -1,22 +1,26 @@ #pragma once +#include "ComposerPaper.hpp" +#include "DecomposerPaper.hpp" #include #include +using bunny::FieldTag; + struct SimpleUnorderedTestClass { std::unordered_map m_map; template - void serialize(Paper &paper, std::string key = "") + void serialize(Paper &paper) { - paper.save(m_map, key, 1); + paper(m_map, FieldTag{1}); } template - void deserialize(Paper &paper, std::string key = "", std::size_t index = 0) + void deserialize(Paper &paper) { - paper.load(m_map, key, 1, index); + paper(m_map, FieldTag{1}); } bool operator==(const SimpleUnorderedTestClass& other) const& @@ -54,15 +58,15 @@ struct CascadedUnorderedTestClass std::unordered_map m_map; template - void serialize(Paper &paper, std::string key = "") + void serialize(Paper &paper) { - paper.save(m_map, key, 1); + paper(m_map, FieldTag{1}); } template - void deserialize(Paper &paper, std::string key = "", std::size_t index = 0) + void deserialize(Paper &paper) { - paper.load(m_map, key, 1, index); + paper(m_map, FieldTag{1}); } bool operator==(const CascadedUnorderedTestClass& other) const& diff --git a/test/include/UnorderedMapTest1.hpp b/test/include/UnorderedMapTest1.hpp deleted file mode 100644 index c2951fd..0000000 --- a/test/include/UnorderedMapTest1.hpp +++ /dev/null @@ -1,93 +0,0 @@ -#pragma once - -#include "ComposerPaper.hpp" -#include "DecomposerPaper.hpp" -#include -#include - -using bunny::FieldTag; - -struct SimpleUnorderedTestClass -{ - std::unordered_map m_map; - - template - void serialize(Paper &paper) - { - paper(m_map, FieldTag{1}); - } - - template - void deserialize(Paper &paper) - { - paper(m_map, FieldTag{1}); - } - - bool operator==(const SimpleUnorderedTestClass& other) const& - { - bool ans = true; - for(auto itr = m_map.begin(); itr != m_map.end(); ++itr) - { - auto itr_other = other.m_map.find(itr->first); - if(itr_other == other.m_map.end()) - { - ans = false; - break; - } - - if(itr->second != itr_other->second) - { - ans = false; - break; - } - } - - return ans; - } - - friend bool operator!=(const SimpleUnorderedTestClass& first, const SimpleUnorderedTestClass& second); -}; - -bool operator!=(const SimpleUnorderedTestClass& first, const SimpleUnorderedTestClass& second) -{ - return !(first == second); -} - -struct CascadedUnorderedTestClass -{ - std::unordered_map m_map; - - template - void serialize(Paper &paper) - { - paper(m_map, FieldTag{1}); - } - - template - void deserialize(Paper &paper) - { - paper(m_map, FieldTag{1}); - } - - bool operator==(const CascadedUnorderedTestClass& other) const& - { - bool ans = true; - for(auto itr = m_map.begin(); itr != m_map.end(); ++itr) - { - auto itr_other = other.m_map.find(itr->first); - if(itr_other == other.m_map.end()) - { - ans = false; - break; - } - - if(itr->second != itr_other->second) - { - ans = false; - break; - } - } - - return ans; - } -}; \ No newline at end of file diff --git a/test/include/VectorTest.hpp b/test/include/VectorTest.hpp index ca00c60..1bc4b27 100644 --- a/test/include/VectorTest.hpp +++ b/test/include/VectorTest.hpp @@ -1,23 +1,27 @@ #pragma once +#include "ComposerPaper.hpp" +#include "DecomposerPaper.hpp" #include #include #include +using bunny::FieldTag; + struct VectorPersonClass { int m_id{}; template - void serialize(Paper &paper, std::string key = "") + void serialize(Paper &paper) { - paper.save(m_id, key, 1); + paper(m_id, FieldTag{1}); } template - void deserialize(Paper &paper, std::string key = "", std::size_t index = 0) + void deserialize(Paper &paper) { - paper.load(m_id, key, 1, index); + paper(m_id, FieldTag{1}); } }; @@ -26,15 +30,15 @@ struct VectorTestSimpleClass std::vector> m_person_list; template - void serialize(Paper &paper, std::string key = "") + void serialize(Paper &paper) { - paper.save(m_person_list, key, 1); + paper(m_person_list, FieldTag{1}); } template - void deserialize(Paper &paper, std::string key = "", std::size_t index = 0) + void deserialize(Paper &paper) { - paper.load(m_person_list, key, 1, index); + paper(m_person_list, FieldTag{1}); } }; @@ -43,14 +47,14 @@ struct VectorTestCascadeClass std::vector> m_vector; template - void serialize(Paper &paper, std::string key = "") + void serialize(Paper &paper) { - paper.save(m_vector, key, 1); + paper(m_vector, FieldTag{1}); } template - void deserialize(Paper &paper, std::string key = "", std::size_t index = 0) + void deserialize(Paper &paper) { - paper.load(m_vector, key, 1, index); + paper(m_vector, FieldTag{1}); } }; \ No newline at end of file diff --git a/test/include/VectorTest1.hpp b/test/include/VectorTest1.hpp deleted file mode 100644 index 1bc4b27..0000000 --- a/test/include/VectorTest1.hpp +++ /dev/null @@ -1,60 +0,0 @@ -#pragma once - -#include "ComposerPaper.hpp" -#include "DecomposerPaper.hpp" -#include -#include -#include - -using bunny::FieldTag; - -struct VectorPersonClass -{ - int m_id{}; - - template - void serialize(Paper &paper) - { - paper(m_id, FieldTag{1}); - } - - template - void deserialize(Paper &paper) - { - paper(m_id, FieldTag{1}); - } -}; - -struct VectorTestSimpleClass -{ - std::vector> m_person_list; - - template - void serialize(Paper &paper) - { - paper(m_person_list, FieldTag{1}); - } - - template - void deserialize(Paper &paper) - { - paper(m_person_list, FieldTag{1}); - } -}; - -struct VectorTestCascadeClass -{ - std::vector> m_vector; - - template - void serialize(Paper &paper) - { - paper(m_vector, FieldTag{1}); - } - - template - void deserialize(Paper &paper) - { - paper(m_vector, FieldTag{1}); - } -}; \ No newline at end of file diff --git a/test/src/ArrayTest.cpp b/test/src/ArrayTest.cpp index 0ac2a42..8d60177 100644 --- a/test/src/ArrayTest.cpp +++ b/test/src/ArrayTest.cpp @@ -1,101 +1,98 @@ -// #include "ArrayTest.hpp" - -// #include -// #include "detail/out_paper.hpp" -// #include "detail/InPaper.hpp" - - -// TEST(ArrayTest, Simple) -// { -// SimpleTestClass out_obj; -// std::stringstream ss; -// bunny::detail::OutPaper opaper{ss}; - -// out_obj.m_arr[0] = 100; -// out_obj.m_arr[1] = 101; -// out_obj.m_arr[2] = 102; -// out_obj.m_arr[3] = 103; -// out_obj.m_arr[4] = 104; - -// out_obj.serialize(opaper); - -// bunny::detail::InPaper ipaper{ss}; -// SimpleTestClass in_obj; -// in_obj.deserialize(ipaper); - -// EXPECT_TRUE(in_obj == out_obj); -// } - -// TEST(ArrayTest, IgnoredKey) -// { -// KeyIgnoreTestClass out_obj; -// std::stringstream ss; -// bunny::detail::OutPaper opaper{ss}; - -// out_obj.m_arr[0] = 100; -// out_obj.m_arr[1] = 101; -// out_obj.m_arr[2] = 102; -// out_obj.m_arr[3] = 103; -// out_obj.m_arr[4] = 104; - -// out_obj.serialize(opaper); - -// bunny::detail::InPaper ipaper{ss}; -// KeyIgnoreTestClass in_obj; -// in_obj.deserialize(ipaper); - -// EXPECT_FALSE(in_obj == out_obj); -// } - -// TEST(ArrayTest, CascadeArrayTest) -// { -// CascadeArrayTestClass out_obj; -// std::stringstream ss; -// bunny::detail::OutPaper opaper{ss}; - -// SimpleTestClass test1; -// test1.m_arr[0] = 100; -// test1.m_arr[1] = 101; -// test1.m_arr[2] = 102; -// test1.m_arr[3] = 103; -// test1.m_arr[4] = 104; - -// SimpleTestClass test2; -// test2.m_arr[0] = 900; -// test2.m_arr[1] = 901; -// test2.m_arr[2] = 902; -// test2.m_arr[3] = 903; -// test2.m_arr[4] = 904; - -// out_obj.m_class_list[0] = test1; -// out_obj.m_class_list[9] = test2; - -// out_obj.serialize(opaper); - -// bunny::detail::InPaper ipaper{ss}; -// CascadeArrayTestClass in_obj; -// in_obj.deserialize(ipaper); - -// EXPECT_TRUE(in_obj == out_obj); -// } - -// TEST(ArrayTest, SimpleStringTest) -// { -// SimpleStringTestClass out_obj; -// std::stringstream ss; -// bunny::detail::OutPaper opaper{ss}; - -// out_obj.m_arr[0] = "a"; -// out_obj.m_arr[0] = "b"; -// out_obj.m_arr[0] = "c"; -// out_obj.m_arr[0] = "d"; -// out_obj.m_arr[0] = "e"; - -// out_obj.serialize(opaper); - -// bunny::detail::InPaper ipaper{ss}; -// SimpleStringTestClass in_obj; -// in_obj.deserialize(ipaper); - -// EXPECT_TRUE(in_obj == out_obj); -// } \ No newline at end of file +#include "ArrayTest.hpp" +#include + + +TEST(ArrayTest1, Simple) +{ + SimpleTestClass out_obj; + std::stringstream ss; + bunny::ComposerPaper composer{ss}; + + out_obj.m_arr[0] = 100; + out_obj.m_arr[1] = 101; + out_obj.m_arr[2] = 102; + out_obj.m_arr[3] = 103; + out_obj.m_arr[4] = 104; + + composer << out_obj; + + bunny::DecomposerPaper decomposer{ss}; + SimpleTestClass in_obj; + decomposer >> in_obj; + + EXPECT_TRUE(in_obj == out_obj); +} + +TEST(ArrayTest1, IgnoredKey) +{ + KeyIgnoreTestClass out_obj; + std::stringstream ss; + bunny::ComposerPaper composer{ss}; + + out_obj.m_arr[0] = 100; + out_obj.m_arr[1] = 101; + out_obj.m_arr[2] = 102; + out_obj.m_arr[3] = 103; + out_obj.m_arr[4] = 104; + + composer << out_obj; + + bunny::DecomposerPaper decomposer{ss}; + KeyIgnoreTestClass in_obj; + decomposer >> in_obj; + + EXPECT_FALSE(in_obj == out_obj); +} + +TEST(ArrayTest1, CascadeArrayTest) +{ + CascadeArrayTestClass out_obj; + std::stringstream ss; + bunny::ComposerPaper composer{ss}; + + SimpleTestClass test1; + test1.m_arr[0] = 100; + test1.m_arr[1] = 101; + test1.m_arr[2] = 102; + test1.m_arr[3] = 103; + test1.m_arr[4] = 104; + + SimpleTestClass test2; + test2.m_arr[0] = 900; + test2.m_arr[1] = 901; + test2.m_arr[2] = 902; + test2.m_arr[3] = 903; + test2.m_arr[4] = 904; + + out_obj.m_class_list[0] = test1; + out_obj.m_class_list[9] = test2; + + composer << out_obj; + + bunny::DecomposerPaper decomposer{ss}; + CascadeArrayTestClass in_obj; + decomposer >> in_obj; + + EXPECT_TRUE(in_obj == out_obj); +} + +TEST(ArrayTest1, SimpleStringTest) +{ + SimpleStringTestClass out_obj; + std::stringstream ss; + bunny::ComposerPaper composer{ss}; + + out_obj.m_arr[0] = "a"; + out_obj.m_arr[0] = "b"; + out_obj.m_arr[0] = "c"; + out_obj.m_arr[0] = "d"; + out_obj.m_arr[0] = "e"; + + composer << out_obj; + + bunny::DecomposerPaper decomposer{ss}; + SimpleStringTestClass in_obj; + decomposer >> in_obj; + + EXPECT_TRUE(in_obj == out_obj); +} \ No newline at end of file diff --git a/test/src/ArrayTest1.cpp b/test/src/ArrayTest1.cpp deleted file mode 100644 index b558cb8..0000000 --- a/test/src/ArrayTest1.cpp +++ /dev/null @@ -1,98 +0,0 @@ -#include "ArrayTest1.hpp" -#include - - -TEST(ArrayTest1, Simple) -{ - SimpleTestClass out_obj; - std::stringstream ss; - bunny::ComposerPaper composer{ss}; - - out_obj.m_arr[0] = 100; - out_obj.m_arr[1] = 101; - out_obj.m_arr[2] = 102; - out_obj.m_arr[3] = 103; - out_obj.m_arr[4] = 104; - - composer << out_obj; - - bunny::DecomposerPaper decomposer{ss}; - SimpleTestClass in_obj; - decomposer >> in_obj; - - EXPECT_TRUE(in_obj == out_obj); -} - -TEST(ArrayTest1, IgnoredKey) -{ - KeyIgnoreTestClass out_obj; - std::stringstream ss; - bunny::ComposerPaper composer{ss}; - - out_obj.m_arr[0] = 100; - out_obj.m_arr[1] = 101; - out_obj.m_arr[2] = 102; - out_obj.m_arr[3] = 103; - out_obj.m_arr[4] = 104; - - composer << out_obj; - - bunny::DecomposerPaper decomposer{ss}; - KeyIgnoreTestClass in_obj; - decomposer >> in_obj; - - EXPECT_FALSE(in_obj == out_obj); -} - -TEST(ArrayTest1, CascadeArrayTest) -{ - CascadeArrayTestClass out_obj; - std::stringstream ss; - bunny::ComposerPaper composer{ss}; - - SimpleTestClass test1; - test1.m_arr[0] = 100; - test1.m_arr[1] = 101; - test1.m_arr[2] = 102; - test1.m_arr[3] = 103; - test1.m_arr[4] = 104; - - SimpleTestClass test2; - test2.m_arr[0] = 900; - test2.m_arr[1] = 901; - test2.m_arr[2] = 902; - test2.m_arr[3] = 903; - test2.m_arr[4] = 904; - - out_obj.m_class_list[0] = test1; - out_obj.m_class_list[9] = test2; - - composer << out_obj; - - bunny::DecomposerPaper decomposer{ss}; - CascadeArrayTestClass in_obj; - decomposer >> in_obj; - - EXPECT_TRUE(in_obj == out_obj); -} - -TEST(ArrayTest1, SimpleStringTest) -{ - SimpleStringTestClass out_obj; - std::stringstream ss; - bunny::ComposerPaper composer{ss}; - - out_obj.m_arr[0] = "a"; - out_obj.m_arr[0] = "b"; - out_obj.m_arr[0] = "c"; - out_obj.m_arr[0] = "d"; - out_obj.m_arr[0] = "e"; - - composer << out_obj; - - bunny::DecomposerPaper decomposer{ss}; - SimpleStringTestClass in_obj; - decomposer >> in_obj; - - EXPECT_TRUE(in_obj == out_obj); -} \ No newline at end of file diff --git a/test/src/BoostTest.cpp b/test/src/BoostTest.cpp deleted file mode 100644 index bad5035..0000000 --- a/test/src/BoostTest.cpp +++ /dev/null @@ -1,242 +0,0 @@ -// #include -// #include -// #include -// #include -// #include "ComposerPaper.hpp" -// #include "DecomposerPaper.hpp" -// #include "UnorderedMap.hpp" -// #include "ComplexClassTestTemp.hpp" -// #include "ComplexClassTest1.hpp" -// #include - -// void PerformanceTestBoost(std::size_t); -// void PerformanceTestBunny(std::size_t); - -// static void BM_Boost(benchmark::State &state) -// { -// std::size_t count{}; -// for (auto _ : state) -// { -// PerformanceTestBoost(count++); -// } -// } - -// static void BM_Bunny(benchmark::State &state) -// { -// std::size_t count{}; -// for (auto _ : state) -// { -// PerformanceTestBunny(count++); -// } -// } - -// BENCHMARK(BM_Bunny); -// BENCHMARK(BM_Boost); - -// BENCHMARK_MAIN(); - -// void PerformanceTestBoost(std::size_t count) -// { -// using boosttest::ComplexTestClass; -// using boosttest::PlainClass; - -// std::stringstream ss; -// boost::archive::text_oarchive oa{ss}; - -// ComplexTestClass out_obj; - -// PlainClass plain1; -// plain1.m_name = "plain1"; -// plain1.m_map.insert({1, "left"}); -// plain1.m_map.insert({2, "right"}); -// plain1.m_map.insert({3, "forward"}); -// plain1.m_map.insert({4, "backward"}); - -// PlainClass plain2; -// plain2.m_name = "plain2"; -// plain2.m_map.insert({10, "left10"}); -// plain2.m_map.insert({20, "right20"}); -// plain2.m_map.insert({30, "forward30"}); -// plain2.m_map.insert({40, "backward40"}); - -// std::unordered_map map1; -// map1.insert({100, plain1}); -// map1.insert({200, plain2}); - -// PlainClass plain3; -// plain3.m_name = "plain3"; -// plain3.m_map.insert({11, "left"}); -// plain3.m_map.insert({21, "right"}); -// plain3.m_map.insert({31, "forward"}); -// plain3.m_map.insert({41, "backward"}); - -// PlainClass plain4; -// plain4.m_name = "plain4"; -// plain4.m_map.insert({105, "left10"}); -// plain4.m_map.insert({205, "right20"}); -// plain4.m_map.insert({305, "forward30"}); -// plain4.m_map.insert({405, "backward40"}); - -// std::unordered_map map2; -// map2.insert({100, plain3}); -// map2.insert({200, plain4}); - -// out_obj.m_plain_map[0].insert({888, map1}); -// out_obj.m_plain_map[2].insert({999, map2}); - -// out_obj.m_count = 7070; -// out_obj.m_id = 2323; - -// std::unordered_map map_int1; -// map_int1.insert({1, 10}); - -// std::unordered_map map_int2; -// map_int2.insert({2, 20}); - -// out_obj.m_int_map.insert({7979, map_int1}); -// out_obj.m_int_map.insert({9090, map_int2}); - -// oa << out_obj; - -// if (count % 100 == 0) -// { -// boost::archive::text_iarchive ia{ss}; -// ComplexTestClass in_obj; -// ia >> in_obj; -// } -// } - -// void PerformanceTestBunny(std::size_t count) -// { -// std::stringstream ss; -// bunny::ComposerPaper composer{ss}; - -// ComplexTestClass out_obj; - -// PlainClass plain1; -// plain1.m_name = "plain1"; -// plain1.m_map.insert({1, "left"}); -// plain1.m_map.insert({2, "right"}); -// plain1.m_map.insert({3, "forward"}); -// plain1.m_map.insert({4, "backward"}); - -// PlainClass plain2; -// plain2.m_name = "plain2"; -// plain2.m_map.insert({10, "left10"}); -// plain2.m_map.insert({20, "right20"}); -// plain2.m_map.insert({30, "forward30"}); -// plain2.m_map.insert({40, "backward40"}); - -// std::unordered_map map1; -// map1.insert({100, plain1}); -// map1.insert({200, plain2}); - -// PlainClass plain3; -// plain3.m_name = "plain3"; -// plain3.m_map.insert({11, "left"}); -// plain3.m_map.insert({21, "right"}); -// plain3.m_map.insert({31, "forward"}); -// plain3.m_map.insert({41, "backward"}); - -// PlainClass plain4; -// plain4.m_name = "plain4"; -// plain4.m_map.insert({105, "left10"}); -// plain4.m_map.insert({205, "right20"}); -// plain4.m_map.insert({305, "forward30"}); -// plain4.m_map.insert({405, "backward40"}); - -// std::unordered_map map2; -// map2.insert({100, plain3}); -// map2.insert({200, plain4}); - -// out_obj.m_plain_map[0].insert({888, map1}); -// out_obj.m_plain_map[2].insert({999, map2}); - -// out_obj.m_count = 7070; -// out_obj.m_id = 2323; - -// std::unordered_map map_int1; -// map_int1.insert({1, 10}); - -// std::unordered_map map_int2; -// map_int2.insert({2, 20}); - -// out_obj.m_int_map.insert({7979, map_int1}); -// out_obj.m_int_map.insert({9090, map_int2}); - -// composer << out_obj; - -// if (count % 50 == 0) -// { -// bunny::DecomposerPaper decomposer{ss}; -// ComplexTestClass in_obj; -// decomposer >> in_obj; -// } -// } - -// TEST(PerformanceTest, BoostTest) -// { -// // std::stringstream ss; -// // boost::archive::text_oarchive oa{ss}; - -// // ComplexTestClass out_obj; - -// // PlainClass plain1; -// // plain1.m_name = "plain1"; -// // plain1.m_map.insert({1, "left"}); -// // plain1.m_map.insert({2, "right"}); -// // plain1.m_map.insert({3, "forward"}); -// // plain1.m_map.insert({4, "backward"}); - -// // PlainClass plain2; -// // plain2.m_name = "plain2"; -// // plain2.m_map.insert({10, "left10"}); -// // plain2.m_map.insert({20, "right20"}); -// // plain2.m_map.insert({30, "forward30"}); -// // plain2.m_map.insert({40, "backward40"}); - -// // std::unordered_map map1; -// // map1.insert({100, plain1}); -// // map1.insert({200, plain2}); - -// // PlainClass plain3; -// // plain3.m_name = "plain3"; -// // plain3.m_map.insert({11, "left"}); -// // plain3.m_map.insert({21, "right"}); -// // plain3.m_map.insert({31, "forward"}); -// // plain3.m_map.insert({41, "backward"}); - -// // PlainClass plain4; -// // plain4.m_name = "plain4"; -// // plain4.m_map.insert({105, "left10"}); -// // plain4.m_map.insert({205, "right20"}); -// // plain4.m_map.insert({305, "forward30"}); -// // plain4.m_map.insert({405, "backward40"}); - -// // std::unordered_map map2; -// // map2.insert({100, plain3}); -// // map2.insert({200, plain4}); - -// // out_obj.m_plain_map[0].insert({888, map1}); -// // out_obj.m_plain_map[2].insert({999, map2}); - -// // out_obj.m_count = 7070; -// // out_obj.m_id = 2323; - -// // std::unordered_map map_int1; -// // map_int1.insert({1, 10}); - -// // std::unordered_map map_int2; -// // map_int2.insert({2, 20}); - -// // out_obj.m_int_map.insert({7979, map_int1}); -// // out_obj.m_int_map.insert({9090, map_int2}); - -// // oa << out_obj; - -// // boost::archive::text_iarchive ia{ss}; -// // ComplexTestClass in_obj; -// // ia >> in_obj; - -// // // std::cout << ss.str() << '\n'; -// } \ No newline at end of file diff --git a/test/src/ComplexTest.cpp b/test/src/ComplexTest.cpp index c8ea8aa..e05f764 100644 --- a/test/src/ComplexTest.cpp +++ b/test/src/ComplexTest.cpp @@ -1,78 +1,68 @@ -// #include "ComplexClassTest.hpp" -// #include "detail/InPaper.hpp" -// #include "detail/out_paper.hpp" -// #include +#include "ComplexClassTest.hpp" +#include "UnorderedMap.hpp" +#include -// TEST(ComplexTest, Complex1) -// { -// std::stringstream ss; -// bunny::detail::OutPaper opaper{ss}; +TEST(ComplexTest1, Complex1) +{ + std::stringstream ss; + bunny::ComposerPaper composer{ss}; -// ComplexTestClass out_obj; + ComplexTestClass out_obj; -// PlainClass plain1; -// plain1.m_name = "plain1"; -// plain1.m_map.insert({1, "left"}); -// plain1.m_map.insert({2, "right"}); -// plain1.m_map.insert({3, "forward"}); -// plain1.m_map.insert({4, "backward"}); + PlainClass plain1; + plain1.m_name = "plain1"; + plain1.m_map.insert({1, "left"}); + plain1.m_map.insert({2, "right"}); + plain1.m_map.insert({3, "forward"}); + plain1.m_map.insert({4, "backward"}); -// PlainClass plain2; -// plain2.m_name = "plain2"; -// plain2.m_map.insert({10, "left10"}); -// plain2.m_map.insert({20, "right20"}); -// plain2.m_map.insert({30, "forward30"}); -// plain2.m_map.insert({40, "backward40"}); + PlainClass plain2; + plain2.m_name = "plain2"; + plain2.m_map.insert({10, "left10"}); + plain2.m_map.insert({20, "right20"}); + plain2.m_map.insert({30, "forward30"}); + plain2.m_map.insert({40, "backward40"}); -// std::unordered_map map1; -// map1.insert({100, plain1}); -// map1.insert({200, plain2}); + std::unordered_map map1; + map1.insert({100, plain1}); + map1.insert({200, plain2}); -// PlainClass plain3; -// plain3.m_name = "plain3"; -// plain3.m_map.insert({11, "left"}); -// plain3.m_map.insert({21, "right"}); -// plain3.m_map.insert({31, "forward"}); -// plain3.m_map.insert({41, "backward"}); + PlainClass plain3; + plain3.m_name = "plain3"; + plain3.m_map.insert({11, "left"}); + plain3.m_map.insert({21, "right"}); + plain3.m_map.insert({31, "forward"}); + plain3.m_map.insert({41, "backward"}); -// PlainClass plain4; -// plain4.m_name = "plain4"; -// plain4.m_map.insert({105, "left10"}); -// plain4.m_map.insert({205, "right20"}); -// plain4.m_map.insert({305, "forward30"}); -// plain4.m_map.insert({405, "backward40"}); + PlainClass plain4; + plain4.m_name = "plain4"; + plain4.m_map.insert({105, "left10"}); + plain4.m_map.insert({205, "right20"}); + plain4.m_map.insert({305, "forward30"}); + plain4.m_map.insert({405, "backward40"}); -// std::unordered_map map2; -// map2.insert({100, plain3}); -// map2.insert({200, plain4}); + std::unordered_map map2; + map2.insert({100, plain3}); + map2.insert({200, plain4}); -// // This scheme causes a problem. We need to add a testcase -// // for arrays with zero full one empty second full. -// // POTANTIAL FIX: Arrays and continuous containers -// // will have in sequence keys per item. -// // -// out_obj.m_plain_map[0].insert({888, map1}); -// out_obj.m_plain_map[2].insert({999, map2}); + out_obj.m_plain_map[0].insert({888, map1}); + out_obj.m_plain_map[2].insert({999, map2}); -// out_obj.m_count = 7070; -// out_obj.m_id = 2323; + out_obj.m_count = 7070; + out_obj.m_id = 2323; -// std::unordered_map map_int1; -// map_int1.insert({1, 10}); + std::unordered_map map_int1; + map_int1.insert({1, 10}); -// std::unordered_map map_int2; -// map_int2.insert({2, 20}); + std::unordered_map map_int2; + map_int2.insert({2, 20}); -// out_obj.m_int_map.insert({7979, map_int1}); -// out_obj.m_int_map.insert({9090, map_int2}); + out_obj.m_int_map.insert({7979, map_int1}); + out_obj.m_int_map.insert({9090, map_int2}); -// out_obj.serialize(opaper); -// std::cout << ss.str() << '\n'; + composer << out_obj; -// bunny::detail::InPaper ipaper{ss}; -// ComplexTestClass in_obj; -// in_obj.deserialize(ipaper); - -// std::cout << "Finished\n"; - -// } \ No newline at end of file + bunny::DecomposerPaper decomposer{ss}; + ComplexTestClass in_obj; + decomposer >> in_obj; +} \ No newline at end of file diff --git a/test/src/ComplexTest1.cpp b/test/src/ComplexTest1.cpp deleted file mode 100644 index ac1f2e2..0000000 --- a/test/src/ComplexTest1.cpp +++ /dev/null @@ -1,68 +0,0 @@ -#include "ComplexClassTest1.hpp" -#include "UnorderedMap.hpp" -#include - -TEST(ComplexTest1, Complex1) -{ - std::stringstream ss; - bunny::ComposerPaper composer{ss}; - - ComplexTestClass out_obj; - - PlainClass plain1; - plain1.m_name = "plain1"; - plain1.m_map.insert({1, "left"}); - plain1.m_map.insert({2, "right"}); - plain1.m_map.insert({3, "forward"}); - plain1.m_map.insert({4, "backward"}); - - PlainClass plain2; - plain2.m_name = "plain2"; - plain2.m_map.insert({10, "left10"}); - plain2.m_map.insert({20, "right20"}); - plain2.m_map.insert({30, "forward30"}); - plain2.m_map.insert({40, "backward40"}); - - std::unordered_map map1; - map1.insert({100, plain1}); - map1.insert({200, plain2}); - - PlainClass plain3; - plain3.m_name = "plain3"; - plain3.m_map.insert({11, "left"}); - plain3.m_map.insert({21, "right"}); - plain3.m_map.insert({31, "forward"}); - plain3.m_map.insert({41, "backward"}); - - PlainClass plain4; - plain4.m_name = "plain4"; - plain4.m_map.insert({105, "left10"}); - plain4.m_map.insert({205, "right20"}); - plain4.m_map.insert({305, "forward30"}); - plain4.m_map.insert({405, "backward40"}); - - std::unordered_map map2; - map2.insert({100, plain3}); - map2.insert({200, plain4}); - - out_obj.m_plain_map[0].insert({888, map1}); - out_obj.m_plain_map[2].insert({999, map2}); - - out_obj.m_count = 7070; - out_obj.m_id = 2323; - - std::unordered_map map_int1; - map_int1.insert({1, 10}); - - std::unordered_map map_int2; - map_int2.insert({2, 20}); - - out_obj.m_int_map.insert({7979, map_int1}); - out_obj.m_int_map.insert({9090, map_int2}); - - composer << out_obj; - - bunny::DecomposerPaper decomposer{ss}; - ComplexTestClass in_obj; - decomposer >> in_obj; -} \ No newline at end of file diff --git a/test/src/ObjectTest.cpp b/test/src/ObjectTest.cpp index 5f92a56..f1b1c8c 100644 --- a/test/src/ObjectTest.cpp +++ b/test/src/ObjectTest.cpp @@ -1,29 +1,25 @@ -// #include "ObjectTest.hpp" -// #include -// #include "detail/out_paper.hpp" -// #include "detail/InPaper.hpp" +#include "ObjectTest.hpp" +#include -// TEST(ObjectTest, Simple) -// { -// Person out_obj; -// Manager manager1; -// manager1.m_id = 100; -// manager1.m_department = "science"; -// out_obj.m_manager = manager1; +TEST(ObjectTest, Simple) +{ + Person out_obj; + Manager manager1; + manager1.m_id = 100; + manager1.m_department = "science"; + out_obj.m_manager = manager1; -// out_obj.m_id = 800; -// out_obj.m_name = "sia"; + out_obj.m_id = 800; + out_obj.m_name = "sia"; -// std::stringstream ss; -// bunny::detail::OutPaper opaper{ss}; + std::stringstream ss; + bunny::ComposerPaper composer{ss}; -// out_obj.serialize(opaper); + composer << out_obj; -// bunny::detail::InPaper ipaper{ss}; -// Person in_obj; -// in_obj.deserialize(ipaper); + bunny::DecomposerPaper decomposer{ss}; + Person in_obj; + decomposer >> in_obj; -// std::cout << ss.str() << '\n'; - -// EXPECT_EQ(out_obj, in_obj); -// } \ No newline at end of file + EXPECT_EQ(out_obj, in_obj); +} \ No newline at end of file diff --git a/test/src/ObjectTest1.cpp b/test/src/ObjectTest1.cpp deleted file mode 100644 index 96c0846..0000000 --- a/test/src/ObjectTest1.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include "ObjectTest1.hpp" -#include - -TEST(ObjectTest, Simple) -{ - Person out_obj; - Manager manager1; - manager1.m_id = 100; - manager1.m_department = "science"; - out_obj.m_manager = manager1; - - out_obj.m_id = 800; - out_obj.m_name = "sia"; - - std::stringstream ss; - bunny::ComposerPaper composer{ss}; - - composer << out_obj; - - bunny::DecomposerPaper decomposer{ss}; - Person in_obj; - decomposer >> in_obj; - - EXPECT_EQ(out_obj, in_obj); -} \ No newline at end of file diff --git a/test/src/SharedPtrTest.cpp b/test/src/SharedPtrTest.cpp index 603ec1d..6433bd1 100644 --- a/test/src/SharedPtrTest.cpp +++ b/test/src/SharedPtrTest.cpp @@ -1,78 +1,72 @@ -// #include "SharedPtrTest.hpp" -// #include "detail/InPaper.hpp" -// #include "detail/out_paper.hpp" +#include "SharedPtrTest.hpp" +#include "SharedPointer.hpp" -// #include -// #include +#include +#include -// TEST(SharedptrTest, Simple) -// { -// std::stringstream ss; -// bunny::detail::OutPaper opaper{ss}; +TEST(SharedptrTest1, Simple) +{ + std::stringstream ss; + bunny::ComposerPaper composer{ss}; -// SharedPtrSimpleTestClass out_obj; -// out_obj.m_id = 100; -// out_obj.m_name = "sia"; + SharedPtrSimpleTestClass out_obj; + out_obj.m_id = 100; + out_obj.m_name = "sia"; -// auto ptr = std::make_shared(); -// ptr->m_number = 200; + auto ptr = std::make_shared(); + ptr->m_number = 200; -// out_obj.m_person = ptr; + out_obj.m_person = ptr; -// out_obj.serialize(opaper); + composer << out_obj; -// std::cout << ss.str() << '\n'; + bunny::DecomposerPaper decomposer{ss}; + SharedPtrSimpleTestClass in_obj; + decomposer >> in_obj; -// bunny::detail::InPaper ipaper{ss}; -// SharedPtrSimpleTestClass in_obj; -// in_obj.deserialize(ipaper); + EXPECT_TRUE(out_obj.m_person->m_number == in_obj.m_person->m_number); +} -// EXPECT_TRUE(out_obj.m_person->m_number == in_obj.m_person->m_number); -// } +TEST(SharedptrTest1, Nullptr) +{ + std::stringstream ss; + bunny::ComposerPaper composer{ss}; -// TEST(SharedptrTest, Nullptr) -// { -// std::stringstream ss; -// bunny::detail::OutPaper opaper{ss}; + SharedPtrSimpleTestClass out_obj; + out_obj.m_id = 100; + out_obj.m_name = "sia"; -// SharedPtrSimpleTestClass out_obj; -// out_obj.m_id = 100; -// out_obj.m_name = "sia"; + composer << out_obj; -// out_obj.serialize(opaper); + bunny::DecomposerPaper decomposer{ss}; + SharedPtrSimpleTestClass in_obj; + decomposer >> in_obj; -// std::cout << ss.str() << '\n'; + EXPECT_TRUE(in_obj.m_person.get() == nullptr); +} -// bunny::detail::InPaper ipaper{ss}; -// SharedPtrSimpleTestClass in_obj; -// in_obj.deserialize(ipaper); +TEST(SharedptrTest1, Complex1) +{ + std::stringstream ss; + bunny::ComposerPaper composer{ss}; -// EXPECT_TRUE(in_obj.m_person.get() == nullptr); -// } + SharedPtrComplexTestClass out_obj; + out_obj.m_id = 100; + out_obj.m_name = "sia"; -// TEST(SharedptrTest, Complex1) -// { -// std::stringstream ss; -// bunny::detail::OutPaper opaper{ss}; + auto person2 = std::make_shared(); + person2->m_number = 200; -// SharedPtrComplexTestClass out_obj; -// out_obj.m_id = 100; -// out_obj.m_name = "sia"; + out_obj.m_person1 = nullptr; + out_obj.m_person2 = std::make_shared>(person2); + out_obj.m_int_ptr = std::make_shared(new int(123)); -// auto person2 = std::make_shared(); -// person2->m_number = 200; + composer << out_obj; -// out_obj.m_person1 = nullptr; -// out_obj.m_person2 = std::make_shared>(person2); + bunny::DecomposerPaper decomposer{ss}; + SharedPtrComplexTestClass in_obj; + decomposer >> in_obj; -// out_obj.serialize(opaper); - -// std::cout << ss.str() << '\n'; - -// bunny::detail::InPaper ipaper{ss}; -// SharedPtrComplexTestClass in_obj; -// in_obj.deserialize(ipaper); - -// EXPECT_TRUE(in_obj.m_person1.get() == nullptr); -// EXPECT_TRUE(in_obj.m_person2.get()->get()->m_number == out_obj.m_person2.get()->get()->m_number); -// } \ No newline at end of file + EXPECT_TRUE(in_obj.m_person1.get() == nullptr); + EXPECT_TRUE(in_obj.m_person2.get()->get()->m_number == out_obj.m_person2.get()->get()->m_number); +} \ No newline at end of file diff --git a/test/src/SharedPtrTest1.cpp b/test/src/SharedPtrTest1.cpp deleted file mode 100644 index 1fe3c27..0000000 --- a/test/src/SharedPtrTest1.cpp +++ /dev/null @@ -1,74 +0,0 @@ -#include "SharedPtrTest1.hpp" -#include "SharedPointer.hpp" - -#include -#include - -TEST(SharedptrTest1, Simple) -{ - std::stringstream ss; - bunny::ComposerPaper composer{ss}; - - SharedPtrSimpleTestClass out_obj; - out_obj.m_id = 100; - out_obj.m_name = "sia"; - - auto ptr = std::make_shared(); - ptr->m_number = 200; - - out_obj.m_person = ptr; - - composer << out_obj; - - bunny::DecomposerPaper decomposer{ss}; - SharedPtrSimpleTestClass in_obj; - decomposer >> in_obj; - - EXPECT_TRUE(out_obj.m_person->m_number == in_obj.m_person->m_number); -} - -TEST(SharedptrTest1, Nullptr) -{ - std::stringstream ss; - bunny::ComposerPaper composer{ss}; - - SharedPtrSimpleTestClass out_obj; - out_obj.m_id = 100; - out_obj.m_name = "sia"; - - composer << out_obj; - - bunny::DecomposerPaper decomposer{ss}; - SharedPtrSimpleTestClass in_obj; - decomposer >> in_obj; - - EXPECT_TRUE(in_obj.m_person.get() == nullptr); -} - -TEST(SharedptrTest1, Complex1) -{ - std::stringstream ss; - bunny::ComposerPaper composer{ss}; - - SharedPtrComplexTestClass out_obj; - out_obj.m_id = 100; - out_obj.m_name = "sia"; - - auto person2 = std::make_shared(); - person2->m_number = 200; - - out_obj.m_person1 = nullptr; - out_obj.m_person2 = std::make_shared>(person2); - out_obj.m_int_ptr = std::make_shared(new int(123)); - - composer << out_obj; - - bunny::DecomposerPaper decomposer{ss}; - SharedPtrComplexTestClass in_obj; - decomposer >> in_obj; - - std::cout << ss.str() << '\n'; - - EXPECT_TRUE(in_obj.m_person1.get() == nullptr); - EXPECT_TRUE(in_obj.m_person2.get()->get()->m_number == out_obj.m_person2.get()->get()->m_number); -} \ No newline at end of file diff --git a/test/src/Test.cpp b/test/src/Test.cpp deleted file mode 100644 index e90ac2f..0000000 --- a/test/src/Test.cpp +++ /dev/null @@ -1,101 +0,0 @@ -// #include "ComposerPaper.hpp" -// #include "UnorderedMap.hpp" -// #include "SharedPointer.hpp" -// #include "Vector.hpp" -// #include "DecomposerPaper.hpp" -// #include -// #include - -// using bunny::FieldTag; - -// struct MockTestPerson -// { -// int m_id{}; -// int m_arr[3]; - -// template -// void serialize(Paper &paper, std::string key = "") -// { -// paper(m_id, key, FieldTag{10}); -// paper(m_arr, key, FieldTag{20}); -// } - -// template -// void deserialize(Paper &paper, std::string key = "") -// { -// paper(m_id, key, FieldTag{10}); -// paper(m_arr, key, FieldTag{20}); -// } -// }; - -// struct MockTestManager -// { -// int m_score{99}; -// MockTestPerson m_person; -// std::unordered_map m_map; -// std::unordered_map m_map1; -// std::unordered_map m_map2; -// std::shared_ptr m_person_ptr{}; -// std::string m_name{"selcuk"}; -// std::vector m_vector; -// MockTestPerson* m_person_raw_ptr{nullptr}; - - -// template -// void serialize(Paper &paper, std::string key = "") -// { -// paper(m_person, key, FieldTag{1}); -// paper(m_score, key, FieldTag{2}); -// paper(m_map, key, FieldTag{3}); -// paper(m_map1, key, FieldTag{4}); -// paper(m_map2, key, FieldTag{5}); -// paper(m_person_ptr, key, FieldTag{6}); -// paper(m_name, key, FieldTag{7}); -// paper(m_vector, key, FieldTag{8}); -// paper(m_person_raw_ptr, key, FieldTag{9}); -// } - -// template -// void deserialize(Paper &paper, std::string key = "") -// { -// paper(m_person, key, FieldTag{1}); -// paper(m_score, key, FieldTag{2}); -// paper(m_map, key, FieldTag{3}); -// paper(m_map1, key, FieldTag{4}); -// paper(m_map2, key, FieldTag{5}); -// paper(m_person_ptr, key, FieldTag{6}); -// paper(m_name, key, FieldTag{7}); -// paper(m_vector, key, FieldTag{8}); -// paper(m_person_raw_ptr, key, FieldTag{9}); -// } -// }; - -// TEST(MockTest, Simple) -// { -// std::stringstream ss; -// bunny::ComposerPaper composer_paper{ss}; -// MockTestPerson person1{}; - -// person1.m_arr[0] = 200; -// person1.m_arr[1] = 201; -// person1.m_arr[2] = 202; - -// MockTestManager manager1{}; -// manager1.m_person = person1; -// manager1.m_map.insert({1, 100}); -// manager1.m_map.insert({2, 200}); -// manager1.m_map1.insert({900, person1}); -// manager1.m_map2.insert({"sia", person1}); -// manager1.m_person_ptr = std::make_shared(person1); -// manager1.m_vector.push_back(9090); -// manager1.m_person_raw_ptr = new MockTestPerson{person1}; - -// composer_paper << manager1; -// std::cout << ss.str() << '\n'; - -// MockTestManager in_obj{}; -// bunny::DecomposerPaper decomposer_paper{ss}; -// decomposer_paper >> in_obj; - -// std::cout << "done\n"; -// } \ No newline at end of file diff --git a/test/src/UnorderedMapTest.cpp b/test/src/UnorderedMapTest.cpp index 1d00c07..10206e4 100644 --- a/test/src/UnorderedMapTest.cpp +++ b/test/src/UnorderedMapTest.cpp @@ -1,55 +1,50 @@ -// #include "UnorderedMapTest.hpp" -// #include "detail/out_paper.hpp" -// #include "detail/InPaper.hpp" -// #include +#include "UnorderedMapTest.hpp" +#include "UnorderedMap.hpp" +#include -// TEST(UnorderedMapTest, Simple) -// { -// SimpleUnorderedTestClass out_obj; -// std::stringstream ss; -// bunny::detail::OutPaper opaper{ss}; +TEST(UnorderedMapTest, Simple) +{ + SimpleUnorderedTestClass out_obj; + std::stringstream ss; + bunny::ComposerPaper composer{ss}; -// out_obj.m_map.insert({1, "sia"}); -// out_obj.m_map.insert({2, "john"}); -// out_obj.m_map.insert({3, "alis"}); + out_obj.m_map.insert({1, "sia"}); + out_obj.m_map.insert({2, "john"}); + out_obj.m_map.insert({3, "alis"}); -// out_obj.serialize(opaper); -// std::cout << ss.str() << '\n'; + composer << out_obj; -// bunny::detail::InPaper ipaper{ss}; -// SimpleUnorderedTestClass in_obj; -// in_obj.deserialize(ipaper); + bunny::DecomposerPaper decomposer{ss}; + SimpleUnorderedTestClass in_obj; + decomposer >> in_obj; + EXPECT_EQ(out_obj, in_obj); +} -// EXPECT_EQ(out_obj, in_obj); -// } +TEST(UnorderedMapTest, Cascaded) +{ + std::stringstream ss; + bunny::ComposerPaper composer{ss}; -// TEST(UnorderedMapTest, Cascaded) -// { -// std::stringstream ss; -// bunny::detail::OutPaper opaper{ss}; + SimpleUnorderedTestClass obj1; + obj1.m_map.insert({1, "sia"}); + obj1.m_map.insert({2, "john"}); + obj1.m_map.insert({3, "alis"}); -// SimpleUnorderedTestClass obj1; -// obj1.m_map.insert({1, "sia"}); -// obj1.m_map.insert({2, "john"}); -// obj1.m_map.insert({3, "alis"}); + SimpleUnorderedTestClass obj2; + obj2.m_map.insert({4, "he"}); + obj2.m_map.insert({5, "she"}); + obj2.m_map.insert({6, "we"}); -// SimpleUnorderedTestClass obj2; -// obj2.m_map.insert({4, "he"}); -// obj2.m_map.insert({5, "she"}); -// obj2.m_map.insert({6, "we"}); + CascadedUnorderedTestClass out_obj; + out_obj.m_map.insert({650, obj1}); + out_obj.m_map.insert({700, obj2}); -// CascadedUnorderedTestClass out_obj; -// out_obj.m_map.insert({650, obj1}); -// out_obj.m_map.insert({700, obj2}); + composer << out_obj; -// out_obj.serialize(opaper); -// std::cout << ss.str() << '\n'; + bunny::DecomposerPaper decomposer{ss}; + CascadedUnorderedTestClass in_obj; + decomposer >> in_obj; -// bunny::detail::InPaper ipaper{ss}; -// CascadedUnorderedTestClass in_obj; -// in_obj.deserialize(ipaper); - - -// EXPECT_EQ(out_obj, in_obj); -// } \ No newline at end of file + EXPECT_EQ(out_obj, in_obj); +} \ No newline at end of file diff --git a/test/src/UnorderedMapTest1.cpp b/test/src/UnorderedMapTest1.cpp deleted file mode 100644 index 779b357..0000000 --- a/test/src/UnorderedMapTest1.cpp +++ /dev/null @@ -1,50 +0,0 @@ -#include "UnorderedMapTest1.hpp" -#include "UnorderedMap.hpp" -#include - -TEST(UnorderedMapTest, Simple) -{ - SimpleUnorderedTestClass out_obj; - std::stringstream ss; - bunny::ComposerPaper composer{ss}; - - out_obj.m_map.insert({1, "sia"}); - out_obj.m_map.insert({2, "john"}); - out_obj.m_map.insert({3, "alis"}); - - composer << out_obj; - - bunny::DecomposerPaper decomposer{ss}; - SimpleUnorderedTestClass in_obj; - decomposer >> in_obj; - - EXPECT_EQ(out_obj, in_obj); -} - -TEST(UnorderedMapTest, Cascaded) -{ - std::stringstream ss; - bunny::ComposerPaper composer{ss}; - - SimpleUnorderedTestClass obj1; - obj1.m_map.insert({1, "sia"}); - obj1.m_map.insert({2, "john"}); - obj1.m_map.insert({3, "alis"}); - - SimpleUnorderedTestClass obj2; - obj2.m_map.insert({4, "he"}); - obj2.m_map.insert({5, "she"}); - obj2.m_map.insert({6, "we"}); - - CascadedUnorderedTestClass out_obj; - out_obj.m_map.insert({650, obj1}); - out_obj.m_map.insert({700, obj2}); - - composer << out_obj; - - bunny::DecomposerPaper decomposer{ss}; - CascadedUnorderedTestClass in_obj; - decomposer >> in_obj; - - EXPECT_EQ(out_obj, in_obj); -} \ No newline at end of file diff --git a/test/src/VectorTest.cpp b/test/src/VectorTest.cpp index 43496f4..7d3bfbe 100644 --- a/test/src/VectorTest.cpp +++ b/test/src/VectorTest.cpp @@ -1,56 +1,52 @@ -// #include "VectorTest.hpp" -// #include "detail/out_paper.hpp" -// #include "detail/InPaper.hpp" -// #include +#include "VectorTest.hpp" +#include "Vector.hpp" +#include "SharedPointer.hpp" +#include -// TEST(VectorTest, Simple) -// { -// auto person1 = std::make_shared(); -// auto person2 = std::make_shared(); +TEST(VectorTest, Simple) +{ + auto person1 = std::make_shared(); + auto person2 = std::make_shared(); -// person1->m_id = 100; -// person2->m_id = 101; + person1->m_id = 100; + person2->m_id = 101; -// VectorTestSimpleClass out_obj; -// out_obj.m_person_list.push_back(person1); -// out_obj.m_person_list.push_back(person2); + VectorTestSimpleClass out_obj; + out_obj.m_person_list.push_back(person1); + out_obj.m_person_list.push_back(person2); -// std::stringstream ss; -// bunny::detail::OutPaper opaper{ss}; + std::stringstream ss; + bunny::ComposerPaper composer{ss}; -// out_obj.serialize(opaper); + composer << out_obj; -// std::cout << ss.str() << '\n'; + VectorTestSimpleClass in_obj; + bunny::DecomposerPaper decomposer{ss}; -// VectorTestSimpleClass in_obj; -// bunny::detail::InPaper ipaper{ss}; + decomposer >> in_obj; -// in_obj.deserialize(ipaper); + EXPECT_TRUE(out_obj.m_person_list.size() == in_obj.m_person_list.size()); +} -// EXPECT_TRUE(out_obj.m_person_list.size() == in_obj.m_person_list.size()); -// } +TEST(VectorTest, Cascade) +{ + VectorTestCascadeClass out_obj; -// TEST(VectorTest, Cascade) -// { -// VectorTestCascadeClass out_obj; + std::vector v1{1,2,3,4,5,6}; + std::vector v2{10,11,12,13,14}; -// std::vector v1{1,2,3,4,5,6}; -// std::vector v2{10,11,12,13,14}; + out_obj.m_vector.push_back(v1); + out_obj.m_vector.push_back(v2); -// out_obj.m_vector.push_back(v1); -// out_obj.m_vector.push_back(v2); + std::stringstream ss; + bunny::ComposerPaper composer{ss}; -// std::stringstream ss; -// bunny::detail::OutPaper opaper{ss}; + composer << out_obj; -// out_obj.serialize(opaper); + VectorTestCascadeClass in_obj; + bunny::DecomposerPaper decomposer{ss}; -// std::cout << ss.str() << '\n'; + decomposer >> in_obj; -// VectorTestCascadeClass in_obj; -// bunny::detail::InPaper ipaper{ss}; - -// in_obj.deserialize(ipaper); - -// EXPECT_TRUE(out_obj.m_vector.size() == in_obj.m_vector.size()); -// } \ No newline at end of file + EXPECT_TRUE(out_obj.m_vector.size() == in_obj.m_vector.size()); +} \ No newline at end of file diff --git a/test/src/VectorTest1.cpp b/test/src/VectorTest1.cpp deleted file mode 100644 index 6bff7b3..0000000 --- a/test/src/VectorTest1.cpp +++ /dev/null @@ -1,52 +0,0 @@ -#include "VectorTest1.hpp" -#include "Vector.hpp" -#include "SharedPointer.hpp" -#include - -TEST(VectorTest, Simple) -{ - auto person1 = std::make_shared(); - auto person2 = std::make_shared(); - - person1->m_id = 100; - person2->m_id = 101; - - VectorTestSimpleClass out_obj; - out_obj.m_person_list.push_back(person1); - out_obj.m_person_list.push_back(person2); - - std::stringstream ss; - bunny::ComposerPaper composer{ss}; - - composer << out_obj; - - VectorTestSimpleClass in_obj; - bunny::DecomposerPaper decomposer{ss}; - - decomposer >> in_obj; - - EXPECT_TRUE(out_obj.m_person_list.size() == in_obj.m_person_list.size()); -} - -TEST(VectorTest, Cascade) -{ - VectorTestCascadeClass out_obj; - - std::vector v1{1,2,3,4,5,6}; - std::vector v2{10,11,12,13,14}; - - out_obj.m_vector.push_back(v1); - out_obj.m_vector.push_back(v2); - - std::stringstream ss; - bunny::ComposerPaper composer{ss}; - - composer << out_obj; - - VectorTestCascadeClass in_obj; - bunny::DecomposerPaper decomposer{ss}; - - decomposer >> in_obj; - - EXPECT_TRUE(out_obj.m_vector.size() == in_obj.m_vector.size()); -} \ No newline at end of file