diff --git a/.gitignore b/.gitignore index ccb24eb..9f692ee 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,11 @@ compile_commands.json build/ .vscode/ .clangd/ + +# Auto-generated directories +avro/ +capnproto/ +flatbuffers/ +msgpack/ +protobuf/ +thrift/ diff --git a/CMakeLists.txt b/CMakeLists.txt index bf10ad8..44c611e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -216,8 +216,14 @@ set(LINKLIBS ${ZLIB_LIBRARIES} ) + +add_custom_target(thrift_make_directory ALL + COMMAND ${CMAKE_COMMAND} -E make_directory thrift + WORKING_DIRECTORY ${cpp_serializers_SOURCE_DIR} + COMMENT "Create thrift/ directory" +) add_custom_command( - DEPENDS ${cpp_serializers_SOURCE_DIR}/test.thrift + DEPENDS ${cpp_serializers_SOURCE_DIR}/test.thrift thrift_make_directory COMMAND ${THRIFT_GENERATOR} ARGS -r -gen cpp -o ${cpp_serializers_SOURCE_DIR}/thrift/ ${cpp_serializers_SOURCE_DIR}/test.thrift OUTPUT "${cpp_serializers_SOURCE_DIR}/thrift/gen-cpp/test_constants.cpp" @@ -235,8 +241,13 @@ set(THRIFT_SERIALIZATION_SOURCES ${cpp_serializers_SOURCE_DIR}/thrift/gen-cpp ${cpp_serializers_SOURCE_DIR}/thrift/gen-cpp/test_types.cpp ) +add_custom_target(protobuf_make_directory ALL + COMMAND ${CMAKE_COMMAND} -E make_directory protobuf + WORKING_DIRECTORY ${cpp_serializers_SOURCE_DIR} + COMMENT "Create protobuf/ directory" +) add_custom_command( - DEPENDS ${cpp_serializers_SOURCE_DIR}/test.proto + DEPENDS ${cpp_serializers_SOURCE_DIR}/test.proto protobuf_make_directory COMMAND ${PROTOBUF_GENERATOR} ARGS -I${cpp_serializers_SOURCE_DIR} --cpp_out=${cpp_serializers_SOURCE_DIR}/protobuf ${cpp_serializers_SOURCE_DIR}/test.proto OUTPUT "${cpp_serializers_SOURCE_DIR}/protobuf/test.pb.cc" @@ -249,8 +260,13 @@ set_source_files_properties( ) set(PROTOBUF_SERIALIZATION_SOURCES ${cpp_serializers_SOURCE_DIR}/protobuf/test.pb.cc) +add_custom_target(capnproto_make_directory ALL + COMMAND ${CMAKE_COMMAND} -E make_directory capnproto + WORKING_DIRECTORY ${cpp_serializers_SOURCE_DIR} + COMMENT "Create thrift/ directory" +) add_custom_command( - DEPENDS ${cpp_serializers_SOURCE_DIR}/test.capnp + DEPENDS ${cpp_serializers_SOURCE_DIR}/test.capnp capnproto_make_directory COMMAND ${CAPNPROTO_GENERATOR} ARGS compile -I${cpp_serializers_SOURCE_DIR} --src-prefix=${cpp_serializers_SOURCE_DIR} -o${CAPNPROTO_CPP_GENERATOR}:${cpp_serializers_SOURCE_DIR}/capnproto ${cpp_serializers_SOURCE_DIR}/test.capnp OUTPUT "${cpp_serializers_SOURCE_DIR}/capnproto/test.capnp.c++" @@ -263,8 +279,13 @@ set_source_files_properties( ) set(CAPNPROTO_SERIALIZATION_SOURCES ${cpp_serializers_SOURCE_DIR}/capnproto/test.capnp.c++) +add_custom_target(avro_make_directory ALL + COMMAND ${CMAKE_COMMAND} -E make_directory avro + WORKING_DIRECTORY ${cpp_serializers_SOURCE_DIR} + COMMENT "Create thrift/ directory" +) add_custom_command( - DEPENDS ${cpp_serializers_SOURCE_DIR}/test.json + DEPENDS ${cpp_serializers_SOURCE_DIR}/test.json avro_make_directory COMMAND ${AVRO_GENERATOR} ARGS --input ${cpp_serializers_SOURCE_DIR}/test.json --output ${cpp_serializers_SOURCE_DIR}/avro/record.hpp --namespace avro_test OUTPUT "${cpp_serializers_SOURCE_DIR}/avro/record.hpp" @@ -276,8 +297,13 @@ set_source_files_properties( ) set(AVRO_SERIALIZATION_SOURCES ${cpp_serializers_SOURCE_DIR}/avro/record.hpp) +add_custom_target(flatbuffers_make_directory ALL + COMMAND ${CMAKE_COMMAND} -E make_directory flatbuffers + WORKING_DIRECTORY ${cpp_serializers_SOURCE_DIR} + COMMENT "Create thrift/ directory" +) add_custom_command( - DEPENDS ${cpp_serializers_SOURCE_DIR}/test.fbs + DEPENDS ${cpp_serializers_SOURCE_DIR}/test.fbs flatbuffers_make_directory COMMAND ${FLATBUFFERS_GENERATOR} ARGS --cpp -o ${cpp_serializers_SOURCE_DIR}/flatbuffers ${cpp_serializers_SOURCE_DIR}/test.fbs OUTPUT "${cpp_serializers_SOURCE_DIR}/flatbuffers/test_generated.h" diff --git a/avro/record.hpp b/avro/record.hpp deleted file mode 100644 index cb36931..0000000 --- a/avro/record.hpp +++ /dev/null @@ -1,72 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#ifndef _HOME_PKOK_CPP_SERIALIZERS_AVRO_RECORD_HPP_2710640864__H_ -#define _HOME_PKOK_CPP_SERIALIZERS_AVRO_RECORD_HPP_2710640864__H_ - - -#include -#include "boost/any.hpp" -#include "avro/Specific.hh" -#include "avro/Encoder.hh" -#include "avro/Decoder.hh" - -namespace avro_test { -struct Record { - std::vector ids; - std::vector strings; - Record() : - ids(std::vector()), - strings(std::vector()) - { } -}; - -} -namespace avro { -template<> struct codec_traits { - static void encode(Encoder& e, const avro_test::Record& v) { - avro::encode(e, v.ids); - avro::encode(e, v.strings); - } - static void decode(Decoder& d, avro_test::Record& v) { - if (avro::ResolvingDecoder *rd = - dynamic_cast(&d)) { - const std::vector fo = rd->fieldOrder(); - for (std::vector::const_iterator it = fo.begin(); - it != fo.end(); ++it) { - switch (*it) { - case 0: - avro::decode(d, v.ids); - break; - case 1: - avro::decode(d, v.strings); - break; - default: - break; - } - } - } else { - avro::decode(d, v.ids); - avro::decode(d, v.strings); - } - } -}; - -} -#endif diff --git a/capnproto/test.capnp.c++ b/capnproto/test.capnp.c++ deleted file mode 100644 index ec6f5a6..0000000 --- a/capnproto/test.capnp.c++ +++ /dev/null @@ -1,91 +0,0 @@ -// Generated by Cap'n Proto compiler, DO NOT EDIT -// source: test.capnp - -#include "test.capnp.h" - -namespace capnp { -namespace schemas { -static const ::capnp::_::AlignedData<55> b_b11f3695c22ca61e = { - { 0, 0, 0, 0, 5, 0, 6, 0, - 30, 166, 44, 194, 149, 54, 31, 177, - 11, 0, 0, 0, 1, 0, 0, 0, - 86, 151, 87, 178, 195, 228, 213, 234, - 2, 0, 7, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 21, 0, 0, 0, 146, 0, 0, 0, - 29, 0, 0, 0, 7, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 25, 0, 0, 0, 119, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 116, 101, 115, 116, 46, 99, 97, 112, - 110, 112, 58, 82, 101, 99, 111, 114, - 100, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, 1, 0, - 8, 0, 0, 0, 3, 0, 4, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 41, 0, 0, 0, 34, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 36, 0, 0, 0, 3, 0, 1, 0, - 64, 0, 0, 0, 2, 0, 1, 0, - 1, 0, 0, 0, 1, 0, 0, 0, - 0, 0, 1, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 61, 0, 0, 0, 66, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 56, 0, 0, 0, 3, 0, 1, 0, - 84, 0, 0, 0, 2, 0, 1, 0, - 105, 100, 115, 0, 0, 0, 0, 0, - 14, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 0, 1, 0, - 5, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 14, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 115, 116, 114, 105, 110, 103, 115, 0, - 14, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 0, 1, 0, - 12, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 14, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, } -}; -::capnp::word const* const bp_b11f3695c22ca61e = b_b11f3695c22ca61e.words; -#if !CAPNP_LITE -static const uint16_t m_b11f3695c22ca61e[] = {0, 1}; -static const uint16_t i_b11f3695c22ca61e[] = {0, 1}; -const ::capnp::_::RawSchema s_b11f3695c22ca61e = { - 0xb11f3695c22ca61e, b_b11f3695c22ca61e.words, 55, nullptr, m_b11f3695c22ca61e, - 0, 2, i_b11f3695c22ca61e, nullptr, nullptr, { &s_b11f3695c22ca61e, nullptr, nullptr, 0, 0, nullptr } -}; -#endif // !CAPNP_LITE -} // namespace schemas -} // namespace capnp - -// ======================================================================================= - -namespace capnp_test { - -// Record -constexpr uint16_t Record::_capnpPrivate::dataWordSize; -constexpr uint16_t Record::_capnpPrivate::pointerCount; -#if !CAPNP_LITE -constexpr ::capnp::Kind Record::_capnpPrivate::kind; -constexpr ::capnp::_::RawSchema const* Record::_capnpPrivate::schema; -#endif // !CAPNP_LITE - - -} // namespace - diff --git a/capnproto/test.capnp.h b/capnproto/test.capnp.h deleted file mode 100644 index 7d74135..0000000 --- a/capnproto/test.capnp.h +++ /dev/null @@ -1,213 +0,0 @@ -// Generated by Cap'n Proto compiler, DO NOT EDIT -// source: test.capnp - -#pragma once - -#include -#include - -#if CAPNP_VERSION != 7000 -#error "Version mismatch between generated code and library headers. You must use the same version of the Cap'n Proto compiler and library." -#endif - - -namespace capnp { -namespace schemas { - -CAPNP_DECLARE_SCHEMA(b11f3695c22ca61e); - -} // namespace schemas -} // namespace capnp - -namespace capnp_test { - -struct Record { - Record() = delete; - - class Reader; - class Builder; - class Pipeline; - - struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(b11f3695c22ca61e, 0, 2) - #if !CAPNP_LITE - static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; } - #endif // !CAPNP_LITE - }; -}; - -// ======================================================================================= - -class Record::Reader { -public: - typedef Record Reads; - - Reader() = default; - inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} - - inline ::capnp::MessageSize totalSize() const { - return _reader.totalSize().asPublic(); - } - -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { - return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); - } -#endif // !CAPNP_LITE - - inline bool hasIds() const; - inline ::capnp::List< ::int64_t, ::capnp::Kind::PRIMITIVE>::Reader getIds() const; - - inline bool hasStrings() const; - inline ::capnp::List< ::capnp::Text, ::capnp::Kind::BLOB>::Reader getStrings() const; - -private: - ::capnp::_::StructReader _reader; - template - friend struct ::capnp::ToDynamic_; - template - friend struct ::capnp::_::PointerHelpers; - template - friend struct ::capnp::List; - friend class ::capnp::MessageBuilder; - friend class ::capnp::Orphanage; -}; - -class Record::Builder { -public: - typedef Record Builds; - - Builder() = delete; // Deleted to discourage incorrect usage. - // You can explicitly initialize to nullptr instead. - inline Builder(decltype(nullptr)) {} - inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} - inline operator Reader() const { return Reader(_builder.asReader()); } - inline Reader asReader() const { return *this; } - - inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); } -#if !CAPNP_LITE - inline ::kj::StringTree toString() const { return asReader().toString(); } -#endif // !CAPNP_LITE - - inline bool hasIds(); - inline ::capnp::List< ::int64_t, ::capnp::Kind::PRIMITIVE>::Builder getIds(); - inline void setIds( ::capnp::List< ::int64_t, ::capnp::Kind::PRIMITIVE>::Reader value); - inline void setIds(::kj::ArrayPtr value); - inline ::capnp::List< ::int64_t, ::capnp::Kind::PRIMITIVE>::Builder initIds(unsigned int size); - inline void adoptIds(::capnp::Orphan< ::capnp::List< ::int64_t, ::capnp::Kind::PRIMITIVE>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::int64_t, ::capnp::Kind::PRIMITIVE>> disownIds(); - - inline bool hasStrings(); - inline ::capnp::List< ::capnp::Text, ::capnp::Kind::BLOB>::Builder getStrings(); - inline void setStrings( ::capnp::List< ::capnp::Text, ::capnp::Kind::BLOB>::Reader value); - inline void setStrings(::kj::ArrayPtr value); - inline ::capnp::List< ::capnp::Text, ::capnp::Kind::BLOB>::Builder initStrings(unsigned int size); - inline void adoptStrings(::capnp::Orphan< ::capnp::List< ::capnp::Text, ::capnp::Kind::BLOB>>&& value); - inline ::capnp::Orphan< ::capnp::List< ::capnp::Text, ::capnp::Kind::BLOB>> disownStrings(); - -private: - ::capnp::_::StructBuilder _builder; - template - friend struct ::capnp::ToDynamic_; - friend class ::capnp::Orphanage; - template - friend struct ::capnp::_::PointerHelpers; -}; - -#if !CAPNP_LITE -class Record::Pipeline { -public: - typedef Record Pipelines; - - inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} - inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) - : _typeless(kj::mv(typeless)) {} - -private: - ::capnp::AnyPointer::Pipeline _typeless; - friend class ::capnp::PipelineHook; - template - friend struct ::capnp::ToDynamic_; -}; -#endif // !CAPNP_LITE - -// ======================================================================================= - -inline bool Record::Reader::hasIds() const { - return !_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline bool Record::Builder::hasIds() { - return !_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::int64_t, ::capnp::Kind::PRIMITIVE>::Reader Record::Reader::getIds() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::int64_t, ::capnp::Kind::PRIMITIVE>>::get(_reader.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::int64_t, ::capnp::Kind::PRIMITIVE>::Builder Record::Builder::getIds() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::int64_t, ::capnp::Kind::PRIMITIVE>>::get(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} -inline void Record::Builder::setIds( ::capnp::List< ::int64_t, ::capnp::Kind::PRIMITIVE>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::int64_t, ::capnp::Kind::PRIMITIVE>>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline void Record::Builder::setIds(::kj::ArrayPtr value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::int64_t, ::capnp::Kind::PRIMITIVE>>::set(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::int64_t, ::capnp::Kind::PRIMITIVE>::Builder Record::Builder::initIds(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::int64_t, ::capnp::Kind::PRIMITIVE>>::init(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), size); -} -inline void Record::Builder::adoptIds( - ::capnp::Orphan< ::capnp::List< ::int64_t, ::capnp::Kind::PRIMITIVE>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::int64_t, ::capnp::Kind::PRIMITIVE>>::adopt(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::int64_t, ::capnp::Kind::PRIMITIVE>> Record::Builder::disownIds() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::int64_t, ::capnp::Kind::PRIMITIVE>>::disown(_builder.getPointerField( - ::capnp::bounded<0>() * ::capnp::POINTERS)); -} - -inline bool Record::Reader::hasStrings() const { - return !_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline bool Record::Builder::hasStrings() { - return !_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS).isNull(); -} -inline ::capnp::List< ::capnp::Text, ::capnp::Kind::BLOB>::Reader Record::Reader::getStrings() const { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::Text, ::capnp::Kind::BLOB>>::get(_reader.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline ::capnp::List< ::capnp::Text, ::capnp::Kind::BLOB>::Builder Record::Builder::getStrings() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::Text, ::capnp::Kind::BLOB>>::get(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} -inline void Record::Builder::setStrings( ::capnp::List< ::capnp::Text, ::capnp::Kind::BLOB>::Reader value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::Text, ::capnp::Kind::BLOB>>::set(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), value); -} -inline void Record::Builder::setStrings(::kj::ArrayPtr value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::Text, ::capnp::Kind::BLOB>>::set(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), value); -} -inline ::capnp::List< ::capnp::Text, ::capnp::Kind::BLOB>::Builder Record::Builder::initStrings(unsigned int size) { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::Text, ::capnp::Kind::BLOB>>::init(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), size); -} -inline void Record::Builder::adoptStrings( - ::capnp::Orphan< ::capnp::List< ::capnp::Text, ::capnp::Kind::BLOB>>&& value) { - ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::Text, ::capnp::Kind::BLOB>>::adopt(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS), kj::mv(value)); -} -inline ::capnp::Orphan< ::capnp::List< ::capnp::Text, ::capnp::Kind::BLOB>> Record::Builder::disownStrings() { - return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::Text, ::capnp::Kind::BLOB>>::disown(_builder.getPointerField( - ::capnp::bounded<1>() * ::capnp::POINTERS)); -} - -} // namespace - diff --git a/flatbuffers/test_generated.h b/flatbuffers/test_generated.h deleted file mode 100644 index 9e009b0..0000000 --- a/flatbuffers/test_generated.h +++ /dev/null @@ -1,108 +0,0 @@ -// automatically generated by the FlatBuffers compiler, do not modify - - -#ifndef FLATBUFFERS_GENERATED_TEST_FLATBUFFERS_TEST_H_ -#define FLATBUFFERS_GENERATED_TEST_FLATBUFFERS_TEST_H_ - -#include "flatbuffers/flatbuffers.h" - -namespace flatbuffers_test { - -struct Record; - -struct Record FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - enum { - VT_IDS = 4, - VT_STRINGS = 6 - }; - const flatbuffers::Vector *ids() const { - return GetPointer *>(VT_IDS); - } - const flatbuffers::Vector> *strings() const { - return GetPointer> *>(VT_STRINGS); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_IDS) && - verifier.VerifyVector(ids()) && - VerifyOffset(verifier, VT_STRINGS) && - verifier.VerifyVector(strings()) && - verifier.VerifyVectorOfStrings(strings()) && - verifier.EndTable(); - } -}; - -struct RecordBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_ids(flatbuffers::Offset> ids) { - fbb_.AddOffset(Record::VT_IDS, ids); - } - void add_strings(flatbuffers::Offset>> strings) { - fbb_.AddOffset(Record::VT_STRINGS, strings); - } - explicit RecordBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - RecordBuilder &operator=(const RecordBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateRecord( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset> ids = 0, - flatbuffers::Offset>> strings = 0) { - RecordBuilder builder_(_fbb); - builder_.add_strings(strings); - builder_.add_ids(ids); - return builder_.Finish(); -} - -inline flatbuffers::Offset CreateRecordDirect( - flatbuffers::FlatBufferBuilder &_fbb, - const std::vector *ids = nullptr, - const std::vector> *strings = nullptr) { - return flatbuffers_test::CreateRecord( - _fbb, - ids ? _fbb.CreateVector(*ids) : 0, - strings ? _fbb.CreateVector>(*strings) : 0); -} - -inline const flatbuffers_test::Record *GetRecord(const void *buf) { - return flatbuffers::GetRoot(buf); -} - -inline const flatbuffers_test::Record *GetSizePrefixedRecord(const void *buf) { - return flatbuffers::GetSizePrefixedRoot(buf); -} - -inline bool VerifyRecordBuffer( - flatbuffers::Verifier &verifier) { - return verifier.VerifyBuffer(nullptr); -} - -inline bool VerifySizePrefixedRecordBuffer( - flatbuffers::Verifier &verifier) { - return verifier.VerifySizePrefixedBuffer(nullptr); -} - -inline void FinishRecordBuffer( - flatbuffers::FlatBufferBuilder &fbb, - flatbuffers::Offset root) { - fbb.Finish(root); -} - -inline void FinishSizePrefixedRecordBuffer( - flatbuffers::FlatBufferBuilder &fbb, - flatbuffers::Offset root) { - fbb.FinishSizePrefixed(root); -} - -} // namespace flatbuffers_test - -#endif // FLATBUFFERS_GENERATED_TEST_FLATBUFFERS_TEST_H_ diff --git a/protobuf/test.pb.cc b/protobuf/test.pb.cc deleted file mode 100644 index f10a89a..0000000 --- a/protobuf/test.pb.cc +++ /dev/null @@ -1,474 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: test.proto - -#include "test.pb.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -// @@protoc_insertion_point(includes) -#include - -namespace protobuf_test { -class RecordDefaultTypeInternal { - public: - ::google::protobuf::internal::ExplicitlyConstructed _instance; -} _Record_default_instance_; -} // namespace protobuf_test -static void InitDefaultsRecord_test_2eproto() { - GOOGLE_PROTOBUF_VERIFY_VERSION; - - { - void* ptr = &::protobuf_test::_Record_default_instance_; - new (ptr) ::protobuf_test::Record(); - ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); - } - ::protobuf_test::Record::InitAsDefaultInstance(); -} - -::google::protobuf::internal::SCCInfo<0> scc_info_Record_test_2eproto = - {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsRecord_test_2eproto}, {}}; - -void InitDefaults_test_2eproto() { - ::google::protobuf::internal::InitSCC(&scc_info_Record_test_2eproto.base); -} - -::google::protobuf::Metadata file_level_metadata_test_2eproto[1]; -constexpr ::google::protobuf::EnumDescriptor const** file_level_enum_descriptors_test_2eproto = nullptr; -constexpr ::google::protobuf::ServiceDescriptor const** file_level_service_descriptors_test_2eproto = nullptr; - -const ::google::protobuf::uint32 TableStruct_test_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(::protobuf_test::Record, _internal_metadata_), - ~0u, // no _extensions_ - ~0u, // no _oneof_case_ - ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(::protobuf_test::Record, ids_), - PROTOBUF_FIELD_OFFSET(::protobuf_test::Record, strings_), -}; -static const ::google::protobuf::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - { 0, -1, sizeof(::protobuf_test::Record)}, -}; - -static ::google::protobuf::Message const * const file_default_instances[] = { - reinterpret_cast(&::protobuf_test::_Record_default_instance_), -}; - -::google::protobuf::internal::AssignDescriptorsTable assign_descriptors_table_test_2eproto = { - {}, AddDescriptors_test_2eproto, "test.proto", schemas, - file_default_instances, TableStruct_test_2eproto::offsets, - file_level_metadata_test_2eproto, 1, file_level_enum_descriptors_test_2eproto, file_level_service_descriptors_test_2eproto, -}; - -const char descriptor_table_protodef_test_2eproto[] = - "\n\ntest.proto\022\rprotobuf_test\"&\n\006Record\022\013\n" - "\003ids\030\001 \003(\003\022\017\n\007strings\030\002 \003(\tb\006proto3" - ; -::google::protobuf::internal::DescriptorTable descriptor_table_test_2eproto = { - false, InitDefaults_test_2eproto, - descriptor_table_protodef_test_2eproto, - "test.proto", &assign_descriptors_table_test_2eproto, 75, -}; - -void AddDescriptors_test_2eproto() { - static constexpr ::google::protobuf::internal::InitFunc deps[1] = - { - }; - ::google::protobuf::internal::AddDescriptors(&descriptor_table_test_2eproto, deps, 0); -} - -// Force running AddDescriptors() at dynamic initialization time. -static bool dynamic_init_dummy_test_2eproto = []() { AddDescriptors_test_2eproto(); return true; }(); -namespace protobuf_test { - -// =================================================================== - -void Record::InitAsDefaultInstance() { -} -class Record::HasBitSetters { - public: -}; - -#if !defined(_MSC_VER) || _MSC_VER >= 1900 -const int Record::kIdsFieldNumber; -const int Record::kStringsFieldNumber; -#endif // !defined(_MSC_VER) || _MSC_VER >= 1900 - -Record::Record() - : ::google::protobuf::Message(), _internal_metadata_(nullptr) { - SharedCtor(); - // @@protoc_insertion_point(constructor:protobuf_test.Record) -} -Record::Record(const Record& from) - : ::google::protobuf::Message(), - _internal_metadata_(nullptr), - ids_(from.ids_), - strings_(from.strings_) { - _internal_metadata_.MergeFrom(from._internal_metadata_); - // @@protoc_insertion_point(copy_constructor:protobuf_test.Record) -} - -void Record::SharedCtor() { - ::google::protobuf::internal::InitSCC( - &scc_info_Record_test_2eproto.base); -} - -Record::~Record() { - // @@protoc_insertion_point(destructor:protobuf_test.Record) - SharedDtor(); -} - -void Record::SharedDtor() { -} - -void Record::SetCachedSize(int size) const { - _cached_size_.Set(size); -} -const Record& Record::default_instance() { - ::google::protobuf::internal::InitSCC(&::scc_info_Record_test_2eproto.base); - return *internal_default_instance(); -} - - -void Record::Clear() { -// @@protoc_insertion_point(message_clear_start:protobuf_test.Record) - ::google::protobuf::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - ids_.Clear(); - strings_.Clear(); - _internal_metadata_.Clear(); -} - -#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -const char* Record::_InternalParse(const char* begin, const char* end, void* object, - ::google::protobuf::internal::ParseContext* ctx) { - auto msg = static_cast(object); - ::google::protobuf::int32 size; (void)size; - int depth; (void)depth; - ::google::protobuf::uint32 tag; - ::google::protobuf::internal::ParseFunc parser_till_end; (void)parser_till_end; - auto ptr = begin; - while (ptr < end) { - ptr = ::google::protobuf::io::Parse32(ptr, &tag); - GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); - switch (tag >> 3) { - // repeated int64 ids = 1; - case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == 10) { - ptr = ::google::protobuf::io::ReadSize(ptr, &size); - GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); - parser_till_end = ::google::protobuf::internal::PackedInt64Parser; - object = msg->mutable_ids(); - if (size > end - ptr) goto len_delim_till_end; - auto newend = ptr + size; - if (size) ptr = parser_till_end(ptr, newend, object, ctx); - GOOGLE_PROTOBUF_PARSER_ASSERT(ptr == newend); - break; - } else if (static_cast<::google::protobuf::uint8>(tag) != 8) goto handle_unusual; - do { - msg->add_ids(::google::protobuf::internal::ReadVarint(&ptr)); - GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); - if (ptr >= end) break; - } while ((::google::protobuf::io::UnalignedLoad<::google::protobuf::uint64>(ptr) & 255) == 8 && (ptr += 1)); - break; - } - // repeated string strings = 2; - case 2: { - if (static_cast<::google::protobuf::uint8>(tag) != 18) goto handle_unusual; - do { - ptr = ::google::protobuf::io::ReadSize(ptr, &size); - GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); - ctx->extra_parse_data().SetFieldName("protobuf_test.Record.strings"); - object = msg->add_strings(); - if (size > end - ptr + ::google::protobuf::internal::ParseContext::kSlopBytes) { - parser_till_end = ::google::protobuf::internal::GreedyStringParserUTF8; - goto string_till_end; - } - GOOGLE_PROTOBUF_PARSER_ASSERT(::google::protobuf::internal::StringCheckUTF8(ptr, size, ctx)); - ::google::protobuf::internal::InlineGreedyStringParser(object, ptr, size, ctx); - ptr += size; - if (ptr >= end) break; - } while ((::google::protobuf::io::UnalignedLoad<::google::protobuf::uint64>(ptr) & 255) == 18 && (ptr += 1)); - break; - } - default: { - handle_unusual: - if ((tag & 7) == 4 || tag == 0) { - ctx->EndGroup(tag); - return ptr; - } - auto res = UnknownFieldParse(tag, {_InternalParse, msg}, - ptr, end, msg->_internal_metadata_.mutable_unknown_fields(), ctx); - ptr = res.first; - GOOGLE_PROTOBUF_PARSER_ASSERT(ptr != nullptr); - if (res.second) return ptr; - } - } // switch - } // while - return ptr; -string_till_end: - static_cast<::std::string*>(object)->clear(); - static_cast<::std::string*>(object)->reserve(size); - goto len_delim_till_end; -len_delim_till_end: - return ctx->StoreAndTailCall(ptr, end, {_InternalParse, msg}, - {parser_till_end, object}, size); -} -#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -bool Record::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure - ::google::protobuf::uint32 tag; - // @@protoc_insertion_point(parse_start:protobuf_test.Record) - for (;;) { - ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // repeated int64 ids = 1; - case 1: { - if (static_cast< ::google::protobuf::uint8>(tag) == (10 & 0xFF)) { - DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive< - ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>( - input, this->mutable_ids()))); - } else if (static_cast< ::google::protobuf::uint8>(tag) == (8 & 0xFF)) { - DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline< - ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>( - 1, 10u, input, this->mutable_ids()))); - } else { - goto handle_unusual; - } - break; - } - - // repeated string strings = 2; - case 2: { - if (static_cast< ::google::protobuf::uint8>(tag) == (18 & 0xFF)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadString( - input, this->add_strings())); - DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->strings(this->strings_size() - 1).data(), - static_cast(this->strings(this->strings_size() - 1).length()), - ::google::protobuf::internal::WireFormatLite::PARSE, - "protobuf_test.Record.strings")); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::google::protobuf::internal::WireFormat::SkipField( - input, tag, _internal_metadata_.mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:protobuf_test.Record) - return true; -failure: - // @@protoc_insertion_point(parse_failure:protobuf_test.Record) - return false; -#undef DO_ -} -#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER - -void Record::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const { - // @@protoc_insertion_point(serialize_start:protobuf_test.Record) - ::google::protobuf::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - // repeated int64 ids = 1; - if (this->ids_size() > 0) { - ::google::protobuf::internal::WireFormatLite::WriteTag(1, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output); - output->WriteVarint32(_ids_cached_byte_size_.load( - std::memory_order_relaxed)); - } - for (int i = 0, n = this->ids_size(); i < n; i++) { - ::google::protobuf::internal::WireFormatLite::WriteInt64NoTag( - this->ids(i), output); - } - - // repeated string strings = 2; - for (int i = 0, n = this->strings_size(); i < n; i++) { - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->strings(i).data(), static_cast(this->strings(i).length()), - ::google::protobuf::internal::WireFormatLite::SERIALIZE, - "protobuf_test.Record.strings"); - ::google::protobuf::internal::WireFormatLite::WriteString( - 2, this->strings(i), output); - } - - if (_internal_metadata_.have_unknown_fields()) { - ::google::protobuf::internal::WireFormat::SerializeUnknownFields( - _internal_metadata_.unknown_fields(), output); - } - // @@protoc_insertion_point(serialize_end:protobuf_test.Record) -} - -::google::protobuf::uint8* Record::InternalSerializeWithCachedSizesToArray( - ::google::protobuf::uint8* target) const { - // @@protoc_insertion_point(serialize_to_array_start:protobuf_test.Record) - ::google::protobuf::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - // repeated int64 ids = 1; - if (this->ids_size() > 0) { - target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray( - 1, - ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, - target); - target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( - _ids_cached_byte_size_.load(std::memory_order_relaxed), - target); - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt64NoTagToArray(this->ids_, target); - } - - // repeated string strings = 2; - for (int i = 0, n = this->strings_size(); i < n; i++) { - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->strings(i).data(), static_cast(this->strings(i).length()), - ::google::protobuf::internal::WireFormatLite::SERIALIZE, - "protobuf_test.Record.strings"); - target = ::google::protobuf::internal::WireFormatLite:: - WriteStringToArray(2, this->strings(i), target); - } - - if (_internal_metadata_.have_unknown_fields()) { - target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( - _internal_metadata_.unknown_fields(), target); - } - // @@protoc_insertion_point(serialize_to_array_end:protobuf_test.Record) - return target; -} - -size_t Record::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:protobuf_test.Record) - size_t total_size = 0; - - if (_internal_metadata_.have_unknown_fields()) { - total_size += - ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( - _internal_metadata_.unknown_fields()); - } - ::google::protobuf::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - // repeated int64 ids = 1; - { - size_t data_size = ::google::protobuf::internal::WireFormatLite:: - Int64Size(this->ids_); - if (data_size > 0) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::Int32Size( - static_cast<::google::protobuf::int32>(data_size)); - } - int cached_size = ::google::protobuf::internal::ToCachedSize(data_size); - _ids_cached_byte_size_.store(cached_size, - std::memory_order_relaxed); - total_size += data_size; - } - - // repeated string strings = 2; - total_size += 1 * - ::google::protobuf::internal::FromIntSize(this->strings_size()); - for (int i = 0, n = this->strings_size(); i < n; i++) { - total_size += ::google::protobuf::internal::WireFormatLite::StringSize( - this->strings(i)); - } - - int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; -} - -void Record::MergeFrom(const ::google::protobuf::Message& from) { -// @@protoc_insertion_point(generalized_merge_from_start:protobuf_test.Record) - GOOGLE_DCHECK_NE(&from, this); - const Record* source = - ::google::protobuf::DynamicCastToGenerated( - &from); - if (source == nullptr) { - // @@protoc_insertion_point(generalized_merge_from_cast_fail:protobuf_test.Record) - ::google::protobuf::internal::ReflectionOps::Merge(from, this); - } else { - // @@protoc_insertion_point(generalized_merge_from_cast_success:protobuf_test.Record) - MergeFrom(*source); - } -} - -void Record::MergeFrom(const Record& from) { -// @@protoc_insertion_point(class_specific_merge_from_start:protobuf_test.Record) - GOOGLE_DCHECK_NE(&from, this); - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::google::protobuf::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - ids_.MergeFrom(from.ids_); - strings_.MergeFrom(from.strings_); -} - -void Record::CopyFrom(const ::google::protobuf::Message& from) { -// @@protoc_insertion_point(generalized_copy_from_start:protobuf_test.Record) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -void Record::CopyFrom(const Record& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:protobuf_test.Record) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool Record::IsInitialized() const { - return true; -} - -void Record::Swap(Record* other) { - if (other == this) return; - InternalSwap(other); -} -void Record::InternalSwap(Record* other) { - using std::swap; - _internal_metadata_.Swap(&other->_internal_metadata_); - ids_.InternalSwap(&other->ids_); - strings_.InternalSwap(CastToBase(&other->strings_)); -} - -::google::protobuf::Metadata Record::GetMetadata() const { - ::google::protobuf::internal::AssignDescriptors(&::assign_descriptors_table_test_2eproto); - return ::file_level_metadata_test_2eproto[kIndexInFileMessages]; -} - - -// @@protoc_insertion_point(namespace_scope) -} // namespace protobuf_test -namespace google { -namespace protobuf { -template<> PROTOBUF_NOINLINE ::protobuf_test::Record* Arena::CreateMaybeMessage< ::protobuf_test::Record >(Arena* arena) { - return Arena::CreateInternal< ::protobuf_test::Record >(arena); -} -} // namespace protobuf -} // namespace google - -// @@protoc_insertion_point(global_scope) -#include diff --git a/protobuf/test.pb.h b/protobuf/test.pb.h deleted file mode 100644 index b20f25f..0000000 --- a/protobuf/test.pb.h +++ /dev/null @@ -1,326 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: test.proto - -#ifndef PROTOBUF_INCLUDED_test_2eproto -#define PROTOBUF_INCLUDED_test_2eproto - -#include -#include - -#include -#if PROTOBUF_VERSION < 3007000 -#error This file was generated by a newer version of protoc which is -#error incompatible with your Protocol Buffer headers. Please update -#error your headers. -#endif -#if 3007000 < PROTOBUF_MIN_PROTOC_VERSION -#error This file was generated by an older version of protoc which is -#error incompatible with your Protocol Buffer headers. Please -#error regenerate this file with a newer version of protoc. -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include // IWYU pragma: export -#include // IWYU pragma: export -#include -// @@protoc_insertion_point(includes) -#include -#define PROTOBUF_INTERNAL_EXPORT_test_2eproto - -// Internal implementation detail -- do not use these members. -struct TableStruct_test_2eproto { - static const ::google::protobuf::internal::ParseTableField entries[] - PROTOBUF_SECTION_VARIABLE(protodesc_cold); - static const ::google::protobuf::internal::AuxillaryParseTableField aux[] - PROTOBUF_SECTION_VARIABLE(protodesc_cold); - static const ::google::protobuf::internal::ParseTable schema[1] - PROTOBUF_SECTION_VARIABLE(protodesc_cold); - static const ::google::protobuf::internal::FieldMetadata field_metadata[]; - static const ::google::protobuf::internal::SerializationTable serialization_table[]; - static const ::google::protobuf::uint32 offsets[]; -}; -void AddDescriptors_test_2eproto(); -namespace protobuf_test { -class Record; -class RecordDefaultTypeInternal; -extern RecordDefaultTypeInternal _Record_default_instance_; -} // namespace protobuf_test -namespace google { -namespace protobuf { -template<> ::protobuf_test::Record* Arena::CreateMaybeMessage<::protobuf_test::Record>(Arena*); -} // namespace protobuf -} // namespace google -namespace protobuf_test { - -// =================================================================== - -class Record final : - public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:protobuf_test.Record) */ { - public: - Record(); - virtual ~Record(); - - Record(const Record& from); - - inline Record& operator=(const Record& from) { - CopyFrom(from); - return *this; - } - #if LANG_CXX11 - Record(Record&& from) noexcept - : Record() { - *this = ::std::move(from); - } - - inline Record& operator=(Record&& from) noexcept { - if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { - if (this != &from) InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - #endif - static const ::google::protobuf::Descriptor* descriptor() { - return default_instance().GetDescriptor(); - } - static const Record& default_instance(); - - static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY - static inline const Record* internal_default_instance() { - return reinterpret_cast( - &_Record_default_instance_); - } - static constexpr int kIndexInFileMessages = - 0; - - void Swap(Record* other); - friend void swap(Record& a, Record& b) { - a.Swap(&b); - } - - // implements Message ---------------------------------------------- - - inline Record* New() const final { - return CreateMaybeMessage(nullptr); - } - - Record* New(::google::protobuf::Arena* arena) const final { - return CreateMaybeMessage(arena); - } - void CopyFrom(const ::google::protobuf::Message& from) final; - void MergeFrom(const ::google::protobuf::Message& from) final; - void CopyFrom(const Record& from); - void MergeFrom(const Record& from); - PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; - bool IsInitialized() const final; - - size_t ByteSizeLong() const final; - #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER - static const char* _InternalParse(const char* begin, const char* end, void* object, ::google::protobuf::internal::ParseContext* ctx); - ::google::protobuf::internal::ParseFunc _ParseFunc() const final { return _InternalParse; } - #else - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input) final; - #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const final; - ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( - ::google::protobuf::uint8* target) const final; - int GetCachedSize() const final { return _cached_size_.Get(); } - - private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const final; - void InternalSwap(Record* other); - private: - inline ::google::protobuf::Arena* GetArenaNoVirtual() const { - return nullptr; - } - inline void* MaybeArenaPtr() const { - return nullptr; - } - public: - - ::google::protobuf::Metadata GetMetadata() const final; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - // repeated int64 ids = 1; - int ids_size() const; - void clear_ids(); - static const int kIdsFieldNumber = 1; - ::google::protobuf::int64 ids(int index) const; - void set_ids(int index, ::google::protobuf::int64 value); - void add_ids(::google::protobuf::int64 value); - const ::google::protobuf::RepeatedField< ::google::protobuf::int64 >& - ids() const; - ::google::protobuf::RepeatedField< ::google::protobuf::int64 >* - mutable_ids(); - - // repeated string strings = 2; - int strings_size() const; - void clear_strings(); - static const int kStringsFieldNumber = 2; - const ::std::string& strings(int index) const; - ::std::string* mutable_strings(int index); - void set_strings(int index, const ::std::string& value); - #if LANG_CXX11 - void set_strings(int index, ::std::string&& value); - #endif - void set_strings(int index, const char* value); - void set_strings(int index, const char* value, size_t size); - ::std::string* add_strings(); - void add_strings(const ::std::string& value); - #if LANG_CXX11 - void add_strings(::std::string&& value); - #endif - void add_strings(const char* value); - void add_strings(const char* value, size_t size); - const ::google::protobuf::RepeatedPtrField<::std::string>& strings() const; - ::google::protobuf::RepeatedPtrField<::std::string>* mutable_strings(); - - // @@protoc_insertion_point(class_scope:protobuf_test.Record) - private: - class HasBitSetters; - - ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; - ::google::protobuf::RepeatedField< ::google::protobuf::int64 > ids_; - mutable std::atomic _ids_cached_byte_size_; - ::google::protobuf::RepeatedPtrField<::std::string> strings_; - mutable ::google::protobuf::internal::CachedSize _cached_size_; - friend struct ::TableStruct_test_2eproto; -}; -// =================================================================== - - -// =================================================================== - -#ifdef __GNUC__ - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wstrict-aliasing" -#endif // __GNUC__ -// Record - -// repeated int64 ids = 1; -inline int Record::ids_size() const { - return ids_.size(); -} -inline void Record::clear_ids() { - ids_.Clear(); -} -inline ::google::protobuf::int64 Record::ids(int index) const { - // @@protoc_insertion_point(field_get:protobuf_test.Record.ids) - return ids_.Get(index); -} -inline void Record::set_ids(int index, ::google::protobuf::int64 value) { - ids_.Set(index, value); - // @@protoc_insertion_point(field_set:protobuf_test.Record.ids) -} -inline void Record::add_ids(::google::protobuf::int64 value) { - ids_.Add(value); - // @@protoc_insertion_point(field_add:protobuf_test.Record.ids) -} -inline const ::google::protobuf::RepeatedField< ::google::protobuf::int64 >& -Record::ids() const { - // @@protoc_insertion_point(field_list:protobuf_test.Record.ids) - return ids_; -} -inline ::google::protobuf::RepeatedField< ::google::protobuf::int64 >* -Record::mutable_ids() { - // @@protoc_insertion_point(field_mutable_list:protobuf_test.Record.ids) - return &ids_; -} - -// repeated string strings = 2; -inline int Record::strings_size() const { - return strings_.size(); -} -inline void Record::clear_strings() { - strings_.Clear(); -} -inline const ::std::string& Record::strings(int index) const { - // @@protoc_insertion_point(field_get:protobuf_test.Record.strings) - return strings_.Get(index); -} -inline ::std::string* Record::mutable_strings(int index) { - // @@protoc_insertion_point(field_mutable:protobuf_test.Record.strings) - return strings_.Mutable(index); -} -inline void Record::set_strings(int index, const ::std::string& value) { - // @@protoc_insertion_point(field_set:protobuf_test.Record.strings) - strings_.Mutable(index)->assign(value); -} -#if LANG_CXX11 -inline void Record::set_strings(int index, ::std::string&& value) { - // @@protoc_insertion_point(field_set:protobuf_test.Record.strings) - strings_.Mutable(index)->assign(std::move(value)); -} -#endif -inline void Record::set_strings(int index, const char* value) { - GOOGLE_DCHECK(value != nullptr); - strings_.Mutable(index)->assign(value); - // @@protoc_insertion_point(field_set_char:protobuf_test.Record.strings) -} -inline void Record::set_strings(int index, const char* value, size_t size) { - strings_.Mutable(index)->assign( - reinterpret_cast(value), size); - // @@protoc_insertion_point(field_set_pointer:protobuf_test.Record.strings) -} -inline ::std::string* Record::add_strings() { - // @@protoc_insertion_point(field_add_mutable:protobuf_test.Record.strings) - return strings_.Add(); -} -inline void Record::add_strings(const ::std::string& value) { - strings_.Add()->assign(value); - // @@protoc_insertion_point(field_add:protobuf_test.Record.strings) -} -#if LANG_CXX11 -inline void Record::add_strings(::std::string&& value) { - strings_.Add(std::move(value)); - // @@protoc_insertion_point(field_add:protobuf_test.Record.strings) -} -#endif -inline void Record::add_strings(const char* value) { - GOOGLE_DCHECK(value != nullptr); - strings_.Add()->assign(value); - // @@protoc_insertion_point(field_add_char:protobuf_test.Record.strings) -} -inline void Record::add_strings(const char* value, size_t size) { - strings_.Add()->assign(reinterpret_cast(value), size); - // @@protoc_insertion_point(field_add_pointer:protobuf_test.Record.strings) -} -inline const ::google::protobuf::RepeatedPtrField<::std::string>& -Record::strings() const { - // @@protoc_insertion_point(field_list:protobuf_test.Record.strings) - return strings_; -} -inline ::google::protobuf::RepeatedPtrField<::std::string>* -Record::mutable_strings() { - // @@protoc_insertion_point(field_mutable_list:protobuf_test.Record.strings) - return &strings_; -} - -#ifdef __GNUC__ - #pragma GCC diagnostic pop -#endif // __GNUC__ - -// @@protoc_insertion_point(namespace_scope) - -} // namespace protobuf_test - -// @@protoc_insertion_point(global_scope) - -#include -#endif // PROTOBUF_INCLUDED_test_2eproto diff --git a/thrift/gen-cpp/test_constants.cpp b/thrift/gen-cpp/test_constants.cpp deleted file mode 100644 index 359f438..0000000 --- a/thrift/gen-cpp/test_constants.cpp +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.12.0) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -#include "test_constants.h" - -namespace thrift_test { - -const testConstants g_test_constants; - -testConstants::testConstants() { -} - -} // namespace - diff --git a/thrift/gen-cpp/test_constants.h b/thrift/gen-cpp/test_constants.h deleted file mode 100644 index 9744976..0000000 --- a/thrift/gen-cpp/test_constants.h +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.12.0) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -#ifndef test_CONSTANTS_H -#define test_CONSTANTS_H - -#include "test_types.h" - -namespace thrift_test { - -class testConstants { - public: - testConstants(); - -}; - -extern const testConstants g_test_constants; - -} // namespace - -#endif diff --git a/thrift/gen-cpp/test_types.cpp b/thrift/gen-cpp/test_types.cpp deleted file mode 100644 index ab9194a..0000000 --- a/thrift/gen-cpp/test_types.cpp +++ /dev/null @@ -1,171 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.12.0) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -#include "test_types.h" - -#include -#include - -#include - -namespace thrift_test { - - -Record::~Record() throw() { -} - - -void Record::__set_ids(const std::vector & val) { - this->ids = val; -} - -void Record::__set_strings(const std::vector & val) { - this->strings = val; -} -std::ostream& operator<<(std::ostream& out, const Record& obj) -{ - obj.printTo(out); - return out; -} - - -uint32_t Record::read(::apache::thrift::protocol::TProtocol* iprot) { - - ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - bool isset_ids = false; - bool isset_strings = false; - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 1: - if (ftype == ::apache::thrift::protocol::T_LIST) { - { - this->ids.clear(); - uint32_t _size0; - ::apache::thrift::protocol::TType _etype3; - xfer += iprot->readListBegin(_etype3, _size0); - this->ids.resize(_size0); - uint32_t _i4; - for (_i4 = 0; _i4 < _size0; ++_i4) - { - xfer += iprot->readI64(this->ids[_i4]); - } - xfer += iprot->readListEnd(); - } - isset_ids = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 2: - if (ftype == ::apache::thrift::protocol::T_LIST) { - { - this->strings.clear(); - uint32_t _size5; - ::apache::thrift::protocol::TType _etype8; - xfer += iprot->readListBegin(_etype8, _size5); - this->strings.resize(_size5); - uint32_t _i9; - for (_i9 = 0; _i9 < _size5; ++_i9) - { - xfer += iprot->readString(this->strings[_i9]); - } - xfer += iprot->readListEnd(); - } - isset_strings = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - if (!isset_ids) - throw TProtocolException(TProtocolException::INVALID_DATA); - if (!isset_strings) - throw TProtocolException(TProtocolException::INVALID_DATA); - return xfer; -} - -uint32_t Record::write(::apache::thrift::protocol::TProtocol* oprot) const { - uint32_t xfer = 0; - ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); - xfer += oprot->writeStructBegin("Record"); - - xfer += oprot->writeFieldBegin("ids", ::apache::thrift::protocol::T_LIST, 1); - { - xfer += oprot->writeListBegin(::apache::thrift::protocol::T_I64, static_cast(this->ids.size())); - std::vector ::const_iterator _iter10; - for (_iter10 = this->ids.begin(); _iter10 != this->ids.end(); ++_iter10) - { - xfer += oprot->writeI64((*_iter10)); - } - xfer += oprot->writeListEnd(); - } - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldBegin("strings", ::apache::thrift::protocol::T_LIST, 2); - { - xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast(this->strings.size())); - std::vector ::const_iterator _iter11; - for (_iter11 = this->strings.begin(); _iter11 != this->strings.end(); ++_iter11) - { - xfer += oprot->writeString((*_iter11)); - } - xfer += oprot->writeListEnd(); - } - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - -void swap(Record &a, Record &b) { - using ::std::swap; - swap(a.ids, b.ids); - swap(a.strings, b.strings); -} - -Record::Record(const Record& other12) { - ids = other12.ids; - strings = other12.strings; -} -Record& Record::operator=(const Record& other13) { - ids = other13.ids; - strings = other13.strings; - return *this; -} -void Record::printTo(std::ostream& out) const { - using ::apache::thrift::to_string; - out << "Record("; - out << "ids=" << to_string(ids); - out << ", " << "strings=" << to_string(strings); - out << ")"; -} - -} // namespace diff --git a/thrift/gen-cpp/test_types.h b/thrift/gen-cpp/test_types.h deleted file mode 100644 index 181bea4..0000000 --- a/thrift/gen-cpp/test_types.h +++ /dev/null @@ -1,68 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.12.0) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -#ifndef test_TYPES_H -#define test_TYPES_H - -#include - -#include -#include -#include -#include -#include - -#include - - -namespace thrift_test { - -class Record; - - -class Record : public virtual ::apache::thrift::TBase { - public: - - Record(const Record&); - Record& operator=(const Record&); - Record() { - } - - virtual ~Record() throw(); - std::vector ids; - std::vector strings; - - void __set_ids(const std::vector & val); - - void __set_strings(const std::vector & val); - - bool operator == (const Record & rhs) const - { - if (!(ids == rhs.ids)) - return false; - if (!(strings == rhs.strings)) - return false; - return true; - } - bool operator != (const Record &rhs) const { - return !(*this == rhs); - } - - bool operator < (const Record & ) const; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - - virtual void printTo(std::ostream& out) const; -}; - -void swap(Record &a, Record &b); - -std::ostream& operator<<(std::ostream& out, const Record& obj); - -} // namespace - -#endif