From 1ae59dbf28dcff8e15f88de743522c6021f0e26f Mon Sep 17 00:00:00 2001 From: Henry Winkel Date: Wed, 21 Dec 2022 13:06:34 +0000 Subject: [PATCH] revert 8ce77182014fabc41d4eef5913ab18f78f18c635 revert FIX: fixed message class to that only one any message can be stored; deleted track class --- .../WHISPER/Messages/Protos/raw_track.pb.cc | 643 ++++++++++++++++ .../WHISPER/Messages/Protos/raw_track.pb.h | 709 ++++++++++++++++++ .../WHISPER/Messages/Protos/raw_track.proto | 23 + include/WHISPER/Messages/Track.hpp | 25 + src/WHISPER/Messages/Join.cpp | 54 ++ src/WHISPER/Messages/Leave.cpp | 55 ++ src/WHISPER/Messages/Message.cpp | 74 ++ src/WHISPER/Messages/Track.cpp | 56 ++ 8 files changed, 1639 insertions(+) create mode 100644 include/WHISPER/Messages/Protos/raw_track.pb.cc create mode 100644 include/WHISPER/Messages/Protos/raw_track.pb.h create mode 100644 include/WHISPER/Messages/Protos/raw_track.proto create mode 100644 include/WHISPER/Messages/Track.hpp create mode 100644 src/WHISPER/Messages/Join.cpp create mode 100644 src/WHISPER/Messages/Leave.cpp create mode 100644 src/WHISPER/Messages/Message.cpp create mode 100644 src/WHISPER/Messages/Track.cpp diff --git a/include/WHISPER/Messages/Protos/raw_track.pb.cc b/include/WHISPER/Messages/Protos/raw_track.pb.cc new file mode 100644 index 0000000..b8a7351 --- /dev/null +++ b/include/WHISPER/Messages/Protos/raw_track.pb.cc @@ -0,0 +1,643 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: raw_track.proto + +#include "raw_track.pb.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +// @@protoc_insertion_point(includes) +#include + +PROTOBUF_PRAGMA_INIT_SEG + +namespace _pb = ::PROTOBUF_NAMESPACE_ID; +namespace _pbi = _pb::internal; + +namespace messages { +namespace raw_track { +PROTOBUF_CONSTEXPR RawTrack_DISEntityID::RawTrack_DISEntityID( + ::_pbi::ConstantInitialized): _impl_{ + /*decltype(_impl_.site_)*/0u + , /*decltype(_impl_.application_)*/0u + , /*decltype(_impl_.entity_)*/0u + , /*decltype(_impl_._cached_size_)*/{}} {} +struct RawTrack_DISEntityIDDefaultTypeInternal { + PROTOBUF_CONSTEXPR RawTrack_DISEntityIDDefaultTypeInternal() + : _instance(::_pbi::ConstantInitialized{}) {} + ~RawTrack_DISEntityIDDefaultTypeInternal() {} + union { + RawTrack_DISEntityID _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 RawTrack_DISEntityIDDefaultTypeInternal _RawTrack_DISEntityID_default_instance_; +PROTOBUF_CONSTEXPR RawTrack::RawTrack( + ::_pbi::ConstantInitialized): _impl_{ + /*decltype(_impl_.entityid_)*/nullptr + , /*decltype(_impl_.timestamp_)*/nullptr + , /*decltype(_impl_.trackno_)*/0u + , /*decltype(_impl_._cached_size_)*/{}} {} +struct RawTrackDefaultTypeInternal { + PROTOBUF_CONSTEXPR RawTrackDefaultTypeInternal() + : _instance(::_pbi::ConstantInitialized{}) {} + ~RawTrackDefaultTypeInternal() {} + union { + RawTrack _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 RawTrackDefaultTypeInternal _RawTrack_default_instance_; +} // namespace raw_track +} // namespace messages +static ::_pb::Metadata file_level_metadata_raw_5ftrack_2eproto[2]; +static constexpr ::_pb::EnumDescriptor const** file_level_enum_descriptors_raw_5ftrack_2eproto = nullptr; +static constexpr ::_pb::ServiceDescriptor const** file_level_service_descriptors_raw_5ftrack_2eproto = nullptr; + +const uint32_t TableStruct_raw_5ftrack_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::messages::raw_track::RawTrack_DISEntityID, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::messages::raw_track::RawTrack_DISEntityID, _impl_.site_), + PROTOBUF_FIELD_OFFSET(::messages::raw_track::RawTrack_DISEntityID, _impl_.application_), + PROTOBUF_FIELD_OFFSET(::messages::raw_track::RawTrack_DISEntityID, _impl_.entity_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::messages::raw_track::RawTrack, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::messages::raw_track::RawTrack, _impl_.trackno_), + PROTOBUF_FIELD_OFFSET(::messages::raw_track::RawTrack, _impl_.entityid_), + PROTOBUF_FIELD_OFFSET(::messages::raw_track::RawTrack, _impl_.timestamp_), +}; +static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { + { 0, -1, -1, sizeof(::messages::raw_track::RawTrack_DISEntityID)}, + { 9, -1, -1, sizeof(::messages::raw_track::RawTrack)}, +}; + +static const ::_pb::Message* const file_default_instances[] = { + &::messages::raw_track::_RawTrack_DISEntityID_default_instance_._instance, + &::messages::raw_track::_RawTrack_default_instance_._instance, +}; + +const char descriptor_table_protodef_raw_5ftrack_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = + "\n\017raw_track.proto\022\022messages.raw_track\032\037g" + "oogle/protobuf/timestamp.proto\"\310\001\n\010RawTr" + "ack\022\017\n\007trackNo\030\001 \001(\r\022:\n\010EntityID\030\002 \001(\0132(" + ".messages.raw_track.RawTrack.DISEntityID" + "\022-\n\ttimestamp\030\003 \001(\0132\032.google.protobuf.Ti" + "mestamp\032@\n\013DISEntityID\022\014\n\004site\030\001 \001(\r\022\023\n\013" + "application\030\002 \001(\r\022\016\n\006entity\030\003 \001(\rb\006proto" + "3" + ; +static const ::_pbi::DescriptorTable* const descriptor_table_raw_5ftrack_2eproto_deps[1] = { + &::descriptor_table_google_2fprotobuf_2ftimestamp_2eproto, +}; +static ::_pbi::once_flag descriptor_table_raw_5ftrack_2eproto_once; +const ::_pbi::DescriptorTable descriptor_table_raw_5ftrack_2eproto = { + false, false, 281, descriptor_table_protodef_raw_5ftrack_2eproto, + "raw_track.proto", + &descriptor_table_raw_5ftrack_2eproto_once, descriptor_table_raw_5ftrack_2eproto_deps, 1, 2, + schemas, file_default_instances, TableStruct_raw_5ftrack_2eproto::offsets, + file_level_metadata_raw_5ftrack_2eproto, file_level_enum_descriptors_raw_5ftrack_2eproto, + file_level_service_descriptors_raw_5ftrack_2eproto, +}; +PROTOBUF_ATTRIBUTE_WEAK const ::_pbi::DescriptorTable* descriptor_table_raw_5ftrack_2eproto_getter() { + return &descriptor_table_raw_5ftrack_2eproto; +} + +// Force running AddDescriptors() at dynamic initialization time. +PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 static ::_pbi::AddDescriptorsRunner dynamic_init_dummy_raw_5ftrack_2eproto(&descriptor_table_raw_5ftrack_2eproto); +namespace messages { +namespace raw_track { + +// =================================================================== + +class RawTrack_DISEntityID::_Internal { + public: +}; + +RawTrack_DISEntityID::RawTrack_DISEntityID(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(arena, is_message_owned); + // @@protoc_insertion_point(arena_constructor:messages.raw_track.RawTrack.DISEntityID) +} +RawTrack_DISEntityID::RawTrack_DISEntityID(const RawTrack_DISEntityID& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + RawTrack_DISEntityID* const _this = this; (void)_this; + new (&_impl_) Impl_{ + decltype(_impl_.site_){} + , decltype(_impl_.application_){} + , decltype(_impl_.entity_){} + , /*decltype(_impl_._cached_size_)*/{}}; + + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + ::memcpy(&_impl_.site_, &from._impl_.site_, + static_cast(reinterpret_cast(&_impl_.entity_) - + reinterpret_cast(&_impl_.site_)) + sizeof(_impl_.entity_)); + // @@protoc_insertion_point(copy_constructor:messages.raw_track.RawTrack.DISEntityID) +} + +inline void RawTrack_DISEntityID::SharedCtor( + ::_pb::Arena* arena, bool is_message_owned) { + (void)arena; + (void)is_message_owned; + new (&_impl_) Impl_{ + decltype(_impl_.site_){0u} + , decltype(_impl_.application_){0u} + , decltype(_impl_.entity_){0u} + , /*decltype(_impl_._cached_size_)*/{} + }; +} + +RawTrack_DISEntityID::~RawTrack_DISEntityID() { + // @@protoc_insertion_point(destructor:messages.raw_track.RawTrack.DISEntityID) + if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) { + (void)arena; + return; + } + SharedDtor(); +} + +inline void RawTrack_DISEntityID::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void RawTrack_DISEntityID::SetCachedSize(int size) const { + _impl_._cached_size_.Set(size); +} + +void RawTrack_DISEntityID::Clear() { +// @@protoc_insertion_point(message_clear_start:messages.raw_track.RawTrack.DISEntityID) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + ::memset(&_impl_.site_, 0, static_cast( + reinterpret_cast(&_impl_.entity_) - + reinterpret_cast(&_impl_.site_)) + sizeof(_impl_.entity_)); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* RawTrack_DISEntityID::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::_pbi::ReadTag(ptr, &tag); + switch (tag >> 3) { + // uint32 site = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + _impl_.site_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // uint32 application = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + _impl_.application_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // uint32 entity = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 24)) { + _impl_.entity_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* RawTrack_DISEntityID::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:messages.raw_track.RawTrack.DISEntityID) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + // uint32 site = 1; + if (this->_internal_site() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteUInt32ToArray(1, this->_internal_site(), target); + } + + // uint32 application = 2; + if (this->_internal_application() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteUInt32ToArray(2, this->_internal_application(), target); + } + + // uint32 entity = 3; + if (this->_internal_entity() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteUInt32ToArray(3, this->_internal_entity(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:messages.raw_track.RawTrack.DISEntityID) + return target; +} + +size_t RawTrack_DISEntityID::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:messages.raw_track.RawTrack.DISEntityID) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // uint32 site = 1; + if (this->_internal_site() != 0) { + total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_site()); + } + + // uint32 application = 2; + if (this->_internal_application() != 0) { + total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_application()); + } + + // uint32 entity = 3; + if (this->_internal_entity() != 0) { + total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_entity()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData RawTrack_DISEntityID::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck, + RawTrack_DISEntityID::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*RawTrack_DISEntityID::GetClassData() const { return &_class_data_; } + + +void RawTrack_DISEntityID::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) { + auto* const _this = static_cast(&to_msg); + auto& from = static_cast(from_msg); + // @@protoc_insertion_point(class_specific_merge_from_start:messages.raw_track.RawTrack.DISEntityID) + GOOGLE_DCHECK_NE(&from, _this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (from._internal_site() != 0) { + _this->_internal_set_site(from._internal_site()); + } + if (from._internal_application() != 0) { + _this->_internal_set_application(from._internal_application()); + } + if (from._internal_entity() != 0) { + _this->_internal_set_entity(from._internal_entity()); + } + _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void RawTrack_DISEntityID::CopyFrom(const RawTrack_DISEntityID& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:messages.raw_track.RawTrack.DISEntityID) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool RawTrack_DISEntityID::IsInitialized() const { + return true; +} + +void RawTrack_DISEntityID::InternalSwap(RawTrack_DISEntityID* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(RawTrack_DISEntityID, _impl_.entity_) + + sizeof(RawTrack_DISEntityID::_impl_.entity_) + - PROTOBUF_FIELD_OFFSET(RawTrack_DISEntityID, _impl_.site_)>( + reinterpret_cast(&_impl_.site_), + reinterpret_cast(&other->_impl_.site_)); +} + +::PROTOBUF_NAMESPACE_ID::Metadata RawTrack_DISEntityID::GetMetadata() const { + return ::_pbi::AssignDescriptors( + &descriptor_table_raw_5ftrack_2eproto_getter, &descriptor_table_raw_5ftrack_2eproto_once, + file_level_metadata_raw_5ftrack_2eproto[0]); +} + +// =================================================================== + +class RawTrack::_Internal { + public: + static const ::messages::raw_track::RawTrack_DISEntityID& entityid(const RawTrack* msg); + static const ::PROTOBUF_NAMESPACE_ID::Timestamp& timestamp(const RawTrack* msg); +}; + +const ::messages::raw_track::RawTrack_DISEntityID& +RawTrack::_Internal::entityid(const RawTrack* msg) { + return *msg->_impl_.entityid_; +} +const ::PROTOBUF_NAMESPACE_ID::Timestamp& +RawTrack::_Internal::timestamp(const RawTrack* msg) { + return *msg->_impl_.timestamp_; +} +void RawTrack::clear_timestamp() { + if (GetArenaForAllocation() == nullptr && _impl_.timestamp_ != nullptr) { + delete _impl_.timestamp_; + } + _impl_.timestamp_ = nullptr; +} +RawTrack::RawTrack(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(arena, is_message_owned); + // @@protoc_insertion_point(arena_constructor:messages.raw_track.RawTrack) +} +RawTrack::RawTrack(const RawTrack& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + RawTrack* const _this = this; (void)_this; + new (&_impl_) Impl_{ + decltype(_impl_.entityid_){nullptr} + , decltype(_impl_.timestamp_){nullptr} + , decltype(_impl_.trackno_){} + , /*decltype(_impl_._cached_size_)*/{}}; + + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + if (from._internal_has_entityid()) { + _this->_impl_.entityid_ = new ::messages::raw_track::RawTrack_DISEntityID(*from._impl_.entityid_); + } + if (from._internal_has_timestamp()) { + _this->_impl_.timestamp_ = new ::PROTOBUF_NAMESPACE_ID::Timestamp(*from._impl_.timestamp_); + } + _this->_impl_.trackno_ = from._impl_.trackno_; + // @@protoc_insertion_point(copy_constructor:messages.raw_track.RawTrack) +} + +inline void RawTrack::SharedCtor( + ::_pb::Arena* arena, bool is_message_owned) { + (void)arena; + (void)is_message_owned; + new (&_impl_) Impl_{ + decltype(_impl_.entityid_){nullptr} + , decltype(_impl_.timestamp_){nullptr} + , decltype(_impl_.trackno_){0u} + , /*decltype(_impl_._cached_size_)*/{} + }; +} + +RawTrack::~RawTrack() { + // @@protoc_insertion_point(destructor:messages.raw_track.RawTrack) + if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) { + (void)arena; + return; + } + SharedDtor(); +} + +inline void RawTrack::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + if (this != internal_default_instance()) delete _impl_.entityid_; + if (this != internal_default_instance()) delete _impl_.timestamp_; +} + +void RawTrack::SetCachedSize(int size) const { + _impl_._cached_size_.Set(size); +} + +void RawTrack::Clear() { +// @@protoc_insertion_point(message_clear_start:messages.raw_track.RawTrack) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + if (GetArenaForAllocation() == nullptr && _impl_.entityid_ != nullptr) { + delete _impl_.entityid_; + } + _impl_.entityid_ = nullptr; + if (GetArenaForAllocation() == nullptr && _impl_.timestamp_ != nullptr) { + delete _impl_.timestamp_; + } + _impl_.timestamp_ = nullptr; + _impl_.trackno_ = 0u; + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* RawTrack::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::_pbi::ReadTag(ptr, &tag); + switch (tag >> 3) { + // uint32 trackNo = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + _impl_.trackno_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // .messages.raw_track.RawTrack.DISEntityID EntityID = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 18)) { + ptr = ctx->ParseMessage(_internal_mutable_entityid(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // .google.protobuf.Timestamp timestamp = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 26)) { + ptr = ctx->ParseMessage(_internal_mutable_timestamp(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* RawTrack::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:messages.raw_track.RawTrack) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + // uint32 trackNo = 1; + if (this->_internal_trackno() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteUInt32ToArray(1, this->_internal_trackno(), target); + } + + // .messages.raw_track.RawTrack.DISEntityID EntityID = 2; + if (this->_internal_has_entityid()) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage(2, _Internal::entityid(this), + _Internal::entityid(this).GetCachedSize(), target, stream); + } + + // .google.protobuf.Timestamp timestamp = 3; + if (this->_internal_has_timestamp()) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage(3, _Internal::timestamp(this), + _Internal::timestamp(this).GetCachedSize(), target, stream); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:messages.raw_track.RawTrack) + return target; +} + +size_t RawTrack::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:messages.raw_track.RawTrack) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // .messages.raw_track.RawTrack.DISEntityID EntityID = 2; + if (this->_internal_has_entityid()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *_impl_.entityid_); + } + + // .google.protobuf.Timestamp timestamp = 3; + if (this->_internal_has_timestamp()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *_impl_.timestamp_); + } + + // uint32 trackNo = 1; + if (this->_internal_trackno() != 0) { + total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_trackno()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData RawTrack::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck, + RawTrack::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*RawTrack::GetClassData() const { return &_class_data_; } + + +void RawTrack::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) { + auto* const _this = static_cast(&to_msg); + auto& from = static_cast(from_msg); + // @@protoc_insertion_point(class_specific_merge_from_start:messages.raw_track.RawTrack) + GOOGLE_DCHECK_NE(&from, _this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (from._internal_has_entityid()) { + _this->_internal_mutable_entityid()->::messages::raw_track::RawTrack_DISEntityID::MergeFrom( + from._internal_entityid()); + } + if (from._internal_has_timestamp()) { + _this->_internal_mutable_timestamp()->::PROTOBUF_NAMESPACE_ID::Timestamp::MergeFrom( + from._internal_timestamp()); + } + if (from._internal_trackno() != 0) { + _this->_internal_set_trackno(from._internal_trackno()); + } + _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void RawTrack::CopyFrom(const RawTrack& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:messages.raw_track.RawTrack) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool RawTrack::IsInitialized() const { + return true; +} + +void RawTrack::InternalSwap(RawTrack* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(RawTrack, _impl_.trackno_) + + sizeof(RawTrack::_impl_.trackno_) + - PROTOBUF_FIELD_OFFSET(RawTrack, _impl_.entityid_)>( + reinterpret_cast(&_impl_.entityid_), + reinterpret_cast(&other->_impl_.entityid_)); +} + +::PROTOBUF_NAMESPACE_ID::Metadata RawTrack::GetMetadata() const { + return ::_pbi::AssignDescriptors( + &descriptor_table_raw_5ftrack_2eproto_getter, &descriptor_table_raw_5ftrack_2eproto_once, + file_level_metadata_raw_5ftrack_2eproto[1]); +} + +// @@protoc_insertion_point(namespace_scope) +} // namespace raw_track +} // namespace messages +PROTOBUF_NAMESPACE_OPEN +template<> PROTOBUF_NOINLINE ::messages::raw_track::RawTrack_DISEntityID* +Arena::CreateMaybeMessage< ::messages::raw_track::RawTrack_DISEntityID >(Arena* arena) { + return Arena::CreateMessageInternal< ::messages::raw_track::RawTrack_DISEntityID >(arena); +} +template<> PROTOBUF_NOINLINE ::messages::raw_track::RawTrack* +Arena::CreateMaybeMessage< ::messages::raw_track::RawTrack >(Arena* arena) { + return Arena::CreateMessageInternal< ::messages::raw_track::RawTrack >(arena); +} +PROTOBUF_NAMESPACE_CLOSE + +// @@protoc_insertion_point(global_scope) +#include diff --git a/include/WHISPER/Messages/Protos/raw_track.pb.h b/include/WHISPER/Messages/Protos/raw_track.pb.h new file mode 100644 index 0000000..5f6f878 --- /dev/null +++ b/include/WHISPER/Messages/Protos/raw_track.pb.h @@ -0,0 +1,709 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: raw_track.proto + +#ifndef GOOGLE_PROTOBUF_INCLUDED_raw_5ftrack_2eproto +#define GOOGLE_PROTOBUF_INCLUDED_raw_5ftrack_2eproto + +#include +#include + +#include +#if PROTOBUF_VERSION < 3021000 +#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 3021012 < 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 // IWYU pragma: export +#include // IWYU pragma: export +#include +#include +// @@protoc_insertion_point(includes) +#include +#define PROTOBUF_INTERNAL_EXPORT_raw_5ftrack_2eproto +PROTOBUF_NAMESPACE_OPEN +namespace internal { +class AnyMetadata; +} // namespace internal +PROTOBUF_NAMESPACE_CLOSE + +// Internal implementation detail -- do not use these members. +struct TableStruct_raw_5ftrack_2eproto { + static const uint32_t offsets[]; +}; +extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_raw_5ftrack_2eproto; +namespace messages { +namespace raw_track { +class RawTrack; +struct RawTrackDefaultTypeInternal; +extern RawTrackDefaultTypeInternal _RawTrack_default_instance_; +class RawTrack_DISEntityID; +struct RawTrack_DISEntityIDDefaultTypeInternal; +extern RawTrack_DISEntityIDDefaultTypeInternal _RawTrack_DISEntityID_default_instance_; +} // namespace raw_track +} // namespace messages +PROTOBUF_NAMESPACE_OPEN +template<> ::messages::raw_track::RawTrack* Arena::CreateMaybeMessage<::messages::raw_track::RawTrack>(Arena*); +template<> ::messages::raw_track::RawTrack_DISEntityID* Arena::CreateMaybeMessage<::messages::raw_track::RawTrack_DISEntityID>(Arena*); +PROTOBUF_NAMESPACE_CLOSE +namespace messages { +namespace raw_track { + +// =================================================================== + +class RawTrack_DISEntityID final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:messages.raw_track.RawTrack.DISEntityID) */ { + public: + inline RawTrack_DISEntityID() : RawTrack_DISEntityID(nullptr) {} + ~RawTrack_DISEntityID() override; + explicit PROTOBUF_CONSTEXPR RawTrack_DISEntityID(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + RawTrack_DISEntityID(const RawTrack_DISEntityID& from); + RawTrack_DISEntityID(RawTrack_DISEntityID&& from) noexcept + : RawTrack_DISEntityID() { + *this = ::std::move(from); + } + + inline RawTrack_DISEntityID& operator=(const RawTrack_DISEntityID& from) { + CopyFrom(from); + return *this; + } + inline RawTrack_DISEntityID& operator=(RawTrack_DISEntityID&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const RawTrack_DISEntityID& default_instance() { + return *internal_default_instance(); + } + static inline const RawTrack_DISEntityID* internal_default_instance() { + return reinterpret_cast( + &_RawTrack_DISEntityID_default_instance_); + } + static constexpr int kIndexInFileMessages = + 0; + + friend void swap(RawTrack_DISEntityID& a, RawTrack_DISEntityID& b) { + a.Swap(&b); + } + inline void Swap(RawTrack_DISEntityID* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(RawTrack_DISEntityID* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + RawTrack_DISEntityID* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const RawTrack_DISEntityID& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom( const RawTrack_DISEntityID& from) { + RawTrack_DISEntityID::MergeImpl(*this, from); + } + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(RawTrack_DISEntityID* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "messages.raw_track.RawTrack.DISEntityID"; + } + protected: + explicit RawTrack_DISEntityID(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kSiteFieldNumber = 1, + kApplicationFieldNumber = 2, + kEntityFieldNumber = 3, + }; + // uint32 site = 1; + void clear_site(); + uint32_t site() const; + void set_site(uint32_t value); + private: + uint32_t _internal_site() const; + void _internal_set_site(uint32_t value); + public: + + // uint32 application = 2; + void clear_application(); + uint32_t application() const; + void set_application(uint32_t value); + private: + uint32_t _internal_application() const; + void _internal_set_application(uint32_t value); + public: + + // uint32 entity = 3; + void clear_entity(); + uint32_t entity() const; + void set_entity(uint32_t value); + private: + uint32_t _internal_entity() const; + void _internal_set_entity(uint32_t value); + public: + + // @@protoc_insertion_point(class_scope:messages.raw_track.RawTrack.DISEntityID) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + uint32_t site_; + uint32_t application_; + uint32_t entity_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_raw_5ftrack_2eproto; +}; +// ------------------------------------------------------------------- + +class RawTrack final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:messages.raw_track.RawTrack) */ { + public: + inline RawTrack() : RawTrack(nullptr) {} + ~RawTrack() override; + explicit PROTOBUF_CONSTEXPR RawTrack(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + RawTrack(const RawTrack& from); + RawTrack(RawTrack&& from) noexcept + : RawTrack() { + *this = ::std::move(from); + } + + inline RawTrack& operator=(const RawTrack& from) { + CopyFrom(from); + return *this; + } + inline RawTrack& operator=(RawTrack&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const RawTrack& default_instance() { + return *internal_default_instance(); + } + static inline const RawTrack* internal_default_instance() { + return reinterpret_cast( + &_RawTrack_default_instance_); + } + static constexpr int kIndexInFileMessages = + 1; + + friend void swap(RawTrack& a, RawTrack& b) { + a.Swap(&b); + } + inline void Swap(RawTrack* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(RawTrack* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + RawTrack* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const RawTrack& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom( const RawTrack& from) { + RawTrack::MergeImpl(*this, from); + } + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(RawTrack* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "messages.raw_track.RawTrack"; + } + protected: + explicit RawTrack(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + typedef RawTrack_DISEntityID DISEntityID; + + // accessors ------------------------------------------------------- + + enum : int { + kEntityIDFieldNumber = 2, + kTimestampFieldNumber = 3, + kTrackNoFieldNumber = 1, + }; + // .messages.raw_track.RawTrack.DISEntityID EntityID = 2; + bool has_entityid() const; + private: + bool _internal_has_entityid() const; + public: + void clear_entityid(); + const ::messages::raw_track::RawTrack_DISEntityID& entityid() const; + PROTOBUF_NODISCARD ::messages::raw_track::RawTrack_DISEntityID* release_entityid(); + ::messages::raw_track::RawTrack_DISEntityID* mutable_entityid(); + void set_allocated_entityid(::messages::raw_track::RawTrack_DISEntityID* entityid); + private: + const ::messages::raw_track::RawTrack_DISEntityID& _internal_entityid() const; + ::messages::raw_track::RawTrack_DISEntityID* _internal_mutable_entityid(); + public: + void unsafe_arena_set_allocated_entityid( + ::messages::raw_track::RawTrack_DISEntityID* entityid); + ::messages::raw_track::RawTrack_DISEntityID* unsafe_arena_release_entityid(); + + // .google.protobuf.Timestamp timestamp = 3; + bool has_timestamp() const; + private: + bool _internal_has_timestamp() const; + public: + void clear_timestamp(); + const ::PROTOBUF_NAMESPACE_ID::Timestamp& timestamp() const; + PROTOBUF_NODISCARD ::PROTOBUF_NAMESPACE_ID::Timestamp* release_timestamp(); + ::PROTOBUF_NAMESPACE_ID::Timestamp* mutable_timestamp(); + void set_allocated_timestamp(::PROTOBUF_NAMESPACE_ID::Timestamp* timestamp); + private: + const ::PROTOBUF_NAMESPACE_ID::Timestamp& _internal_timestamp() const; + ::PROTOBUF_NAMESPACE_ID::Timestamp* _internal_mutable_timestamp(); + public: + void unsafe_arena_set_allocated_timestamp( + ::PROTOBUF_NAMESPACE_ID::Timestamp* timestamp); + ::PROTOBUF_NAMESPACE_ID::Timestamp* unsafe_arena_release_timestamp(); + + // uint32 trackNo = 1; + void clear_trackno(); + uint32_t trackno() const; + void set_trackno(uint32_t value); + private: + uint32_t _internal_trackno() const; + void _internal_set_trackno(uint32_t value); + public: + + // @@protoc_insertion_point(class_scope:messages.raw_track.RawTrack) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::messages::raw_track::RawTrack_DISEntityID* entityid_; + ::PROTOBUF_NAMESPACE_ID::Timestamp* timestamp_; + uint32_t trackno_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_raw_5ftrack_2eproto; +}; +// =================================================================== + + +// =================================================================== + +#ifdef __GNUC__ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif // __GNUC__ +// RawTrack_DISEntityID + +// uint32 site = 1; +inline void RawTrack_DISEntityID::clear_site() { + _impl_.site_ = 0u; +} +inline uint32_t RawTrack_DISEntityID::_internal_site() const { + return _impl_.site_; +} +inline uint32_t RawTrack_DISEntityID::site() const { + // @@protoc_insertion_point(field_get:messages.raw_track.RawTrack.DISEntityID.site) + return _internal_site(); +} +inline void RawTrack_DISEntityID::_internal_set_site(uint32_t value) { + + _impl_.site_ = value; +} +inline void RawTrack_DISEntityID::set_site(uint32_t value) { + _internal_set_site(value); + // @@protoc_insertion_point(field_set:messages.raw_track.RawTrack.DISEntityID.site) +} + +// uint32 application = 2; +inline void RawTrack_DISEntityID::clear_application() { + _impl_.application_ = 0u; +} +inline uint32_t RawTrack_DISEntityID::_internal_application() const { + return _impl_.application_; +} +inline uint32_t RawTrack_DISEntityID::application() const { + // @@protoc_insertion_point(field_get:messages.raw_track.RawTrack.DISEntityID.application) + return _internal_application(); +} +inline void RawTrack_DISEntityID::_internal_set_application(uint32_t value) { + + _impl_.application_ = value; +} +inline void RawTrack_DISEntityID::set_application(uint32_t value) { + _internal_set_application(value); + // @@protoc_insertion_point(field_set:messages.raw_track.RawTrack.DISEntityID.application) +} + +// uint32 entity = 3; +inline void RawTrack_DISEntityID::clear_entity() { + _impl_.entity_ = 0u; +} +inline uint32_t RawTrack_DISEntityID::_internal_entity() const { + return _impl_.entity_; +} +inline uint32_t RawTrack_DISEntityID::entity() const { + // @@protoc_insertion_point(field_get:messages.raw_track.RawTrack.DISEntityID.entity) + return _internal_entity(); +} +inline void RawTrack_DISEntityID::_internal_set_entity(uint32_t value) { + + _impl_.entity_ = value; +} +inline void RawTrack_DISEntityID::set_entity(uint32_t value) { + _internal_set_entity(value); + // @@protoc_insertion_point(field_set:messages.raw_track.RawTrack.DISEntityID.entity) +} + +// ------------------------------------------------------------------- + +// RawTrack + +// uint32 trackNo = 1; +inline void RawTrack::clear_trackno() { + _impl_.trackno_ = 0u; +} +inline uint32_t RawTrack::_internal_trackno() const { + return _impl_.trackno_; +} +inline uint32_t RawTrack::trackno() const { + // @@protoc_insertion_point(field_get:messages.raw_track.RawTrack.trackNo) + return _internal_trackno(); +} +inline void RawTrack::_internal_set_trackno(uint32_t value) { + + _impl_.trackno_ = value; +} +inline void RawTrack::set_trackno(uint32_t value) { + _internal_set_trackno(value); + // @@protoc_insertion_point(field_set:messages.raw_track.RawTrack.trackNo) +} + +// .messages.raw_track.RawTrack.DISEntityID EntityID = 2; +inline bool RawTrack::_internal_has_entityid() const { + return this != internal_default_instance() && _impl_.entityid_ != nullptr; +} +inline bool RawTrack::has_entityid() const { + return _internal_has_entityid(); +} +inline void RawTrack::clear_entityid() { + if (GetArenaForAllocation() == nullptr && _impl_.entityid_ != nullptr) { + delete _impl_.entityid_; + } + _impl_.entityid_ = nullptr; +} +inline const ::messages::raw_track::RawTrack_DISEntityID& RawTrack::_internal_entityid() const { + const ::messages::raw_track::RawTrack_DISEntityID* p = _impl_.entityid_; + return p != nullptr ? *p : reinterpret_cast( + ::messages::raw_track::_RawTrack_DISEntityID_default_instance_); +} +inline const ::messages::raw_track::RawTrack_DISEntityID& RawTrack::entityid() const { + // @@protoc_insertion_point(field_get:messages.raw_track.RawTrack.EntityID) + return _internal_entityid(); +} +inline void RawTrack::unsafe_arena_set_allocated_entityid( + ::messages::raw_track::RawTrack_DISEntityID* entityid) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.entityid_); + } + _impl_.entityid_ = entityid; + if (entityid) { + + } else { + + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:messages.raw_track.RawTrack.EntityID) +} +inline ::messages::raw_track::RawTrack_DISEntityID* RawTrack::release_entityid() { + + ::messages::raw_track::RawTrack_DISEntityID* temp = _impl_.entityid_; + _impl_.entityid_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::messages::raw_track::RawTrack_DISEntityID* RawTrack::unsafe_arena_release_entityid() { + // @@protoc_insertion_point(field_release:messages.raw_track.RawTrack.EntityID) + + ::messages::raw_track::RawTrack_DISEntityID* temp = _impl_.entityid_; + _impl_.entityid_ = nullptr; + return temp; +} +inline ::messages::raw_track::RawTrack_DISEntityID* RawTrack::_internal_mutable_entityid() { + + if (_impl_.entityid_ == nullptr) { + auto* p = CreateMaybeMessage<::messages::raw_track::RawTrack_DISEntityID>(GetArenaForAllocation()); + _impl_.entityid_ = p; + } + return _impl_.entityid_; +} +inline ::messages::raw_track::RawTrack_DISEntityID* RawTrack::mutable_entityid() { + ::messages::raw_track::RawTrack_DISEntityID* _msg = _internal_mutable_entityid(); + // @@protoc_insertion_point(field_mutable:messages.raw_track.RawTrack.EntityID) + return _msg; +} +inline void RawTrack::set_allocated_entityid(::messages::raw_track::RawTrack_DISEntityID* entityid) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete _impl_.entityid_; + } + if (entityid) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(entityid); + if (message_arena != submessage_arena) { + entityid = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, entityid, submessage_arena); + } + + } else { + + } + _impl_.entityid_ = entityid; + // @@protoc_insertion_point(field_set_allocated:messages.raw_track.RawTrack.EntityID) +} + +// .google.protobuf.Timestamp timestamp = 3; +inline bool RawTrack::_internal_has_timestamp() const { + return this != internal_default_instance() && _impl_.timestamp_ != nullptr; +} +inline bool RawTrack::has_timestamp() const { + return _internal_has_timestamp(); +} +inline const ::PROTOBUF_NAMESPACE_ID::Timestamp& RawTrack::_internal_timestamp() const { + const ::PROTOBUF_NAMESPACE_ID::Timestamp* p = _impl_.timestamp_; + return p != nullptr ? *p : reinterpret_cast( + ::PROTOBUF_NAMESPACE_ID::_Timestamp_default_instance_); +} +inline const ::PROTOBUF_NAMESPACE_ID::Timestamp& RawTrack::timestamp() const { + // @@protoc_insertion_point(field_get:messages.raw_track.RawTrack.timestamp) + return _internal_timestamp(); +} +inline void RawTrack::unsafe_arena_set_allocated_timestamp( + ::PROTOBUF_NAMESPACE_ID::Timestamp* timestamp) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.timestamp_); + } + _impl_.timestamp_ = timestamp; + if (timestamp) { + + } else { + + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:messages.raw_track.RawTrack.timestamp) +} +inline ::PROTOBUF_NAMESPACE_ID::Timestamp* RawTrack::release_timestamp() { + + ::PROTOBUF_NAMESPACE_ID::Timestamp* temp = _impl_.timestamp_; + _impl_.timestamp_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::PROTOBUF_NAMESPACE_ID::Timestamp* RawTrack::unsafe_arena_release_timestamp() { + // @@protoc_insertion_point(field_release:messages.raw_track.RawTrack.timestamp) + + ::PROTOBUF_NAMESPACE_ID::Timestamp* temp = _impl_.timestamp_; + _impl_.timestamp_ = nullptr; + return temp; +} +inline ::PROTOBUF_NAMESPACE_ID::Timestamp* RawTrack::_internal_mutable_timestamp() { + + if (_impl_.timestamp_ == nullptr) { + auto* p = CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::Timestamp>(GetArenaForAllocation()); + _impl_.timestamp_ = p; + } + return _impl_.timestamp_; +} +inline ::PROTOBUF_NAMESPACE_ID::Timestamp* RawTrack::mutable_timestamp() { + ::PROTOBUF_NAMESPACE_ID::Timestamp* _msg = _internal_mutable_timestamp(); + // @@protoc_insertion_point(field_mutable:messages.raw_track.RawTrack.timestamp) + return _msg; +} +inline void RawTrack::set_allocated_timestamp(::PROTOBUF_NAMESPACE_ID::Timestamp* timestamp) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.timestamp_); + } + if (timestamp) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena( + reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(timestamp)); + if (message_arena != submessage_arena) { + timestamp = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, timestamp, submessage_arena); + } + + } else { + + } + _impl_.timestamp_ = timestamp; + // @@protoc_insertion_point(field_set_allocated:messages.raw_track.RawTrack.timestamp) +} + +#ifdef __GNUC__ + #pragma GCC diagnostic pop +#endif // __GNUC__ +// ------------------------------------------------------------------- + + +// @@protoc_insertion_point(namespace_scope) + +} // namespace raw_track +} // namespace messages + +// @@protoc_insertion_point(global_scope) + +#include +#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_raw_5ftrack_2eproto diff --git a/include/WHISPER/Messages/Protos/raw_track.proto b/include/WHISPER/Messages/Protos/raw_track.proto new file mode 100644 index 0000000..136a77f --- /dev/null +++ b/include/WHISPER/Messages/Protos/raw_track.proto @@ -0,0 +1,23 @@ + +// [START declaration] +syntax = "proto3"; +package messages.raw_track; + +import "google/protobuf/timestamp.proto"; +// [END declaration] + + +// [START messages] +message RawTrack { + uint32 trackNo = 1; + + message DISEntityID { + uint32 site = 1; + uint32 application = 2; + uint32 entity = 3; + } + + DISEntityID EntityID = 2; + + google.protobuf.Timestamp timestamp = 3; +} diff --git a/include/WHISPER/Messages/Track.hpp b/include/WHISPER/Messages/Track.hpp new file mode 100644 index 0000000..eed3227 --- /dev/null +++ b/include/WHISPER/Messages/Track.hpp @@ -0,0 +1,25 @@ +#pragma once + + +#include "google/protobuf/message.h" +#include +#include +#include +#include + +namespace WHISPER { + + class RawTrack : public Message + { + private: + + messages::raw_track::RawTrack trackMessage; + public: + std::uint32_t trackNo; + + RawTrack(std::string receivedMessage); + + RawTrack(std::uint32_t deviceID,WHISPER::MsgTopics topic, SourceType src,std::uint32_t trackNo); + + }; +} \ No newline at end of file diff --git a/src/WHISPER/Messages/Join.cpp b/src/WHISPER/Messages/Join.cpp new file mode 100644 index 0000000..95d21c6 --- /dev/null +++ b/src/WHISPER/Messages/Join.cpp @@ -0,0 +1,54 @@ +#include "WHISPER/Messages/Message.hpp" +#include +#include + + + + +namespace WHISPER { + + Join::Join(std::string receivedMessage){ + msg = messages::header::Message(); + try { + msg.ParseFromString(receivedMessage); + topic_ = msg.topic(); + sourceType_ = msg.sourcetype(); + msgType_ = msg.msgtype(); + joinMessage = messages::join::Join(); + deviceId_ = msg.sourceid(); + + if ( msg.payload_size()) { + if (msg.payload().begin()->Is()) { + msg.payload().begin()->UnpackTo(&joinMessage); + } + } + port = joinMessage.port(); + sourceAddr = joinMessage.srcaddress(); + + + + } catch (const std::exception& e) { + LOG_S(ERROR)<(); + payloadMessage->PackFrom(joinMessage); + addPayLoad(payloadMessage); + + + } + + + + +} \ No newline at end of file diff --git a/src/WHISPER/Messages/Leave.cpp b/src/WHISPER/Messages/Leave.cpp new file mode 100644 index 0000000..dad99ed --- /dev/null +++ b/src/WHISPER/Messages/Leave.cpp @@ -0,0 +1,55 @@ +#include "WHISPER/Messages/Message.hpp" +#include +#include + + + + +namespace WHISPER { + + Leave::Leave(std::string receivedMessage){ + msg = messages::header::Message(); + try { + msg.ParseFromString(receivedMessage); + topic_ = msg.topic(); + sourceType_ = msg.sourcetype(); + msgType_ = msg.msgtype(); + + leaveMessage = messages::leave::Leave(); + + if ( msg.payload_size()) { + if (msg.payload().begin()->Is()) { + msg.payload().begin()->UnpackTo(&leaveMessage); + } + } + port = leaveMessage.port(); + sourceAddr = leaveMessage.srcaddress(); + + + + } catch (const std::exception& e) { + LOG_S(ERROR)<(); + payloadMessage->PackFrom(leaveMessage); + addPayLoad(payloadMessage); + + + } + + + + +} \ No newline at end of file diff --git a/src/WHISPER/Messages/Message.cpp b/src/WHISPER/Messages/Message.cpp new file mode 100644 index 0000000..68cb670 --- /dev/null +++ b/src/WHISPER/Messages/Message.cpp @@ -0,0 +1,74 @@ + + +#include +#include + + + + +namespace WHISPER { + Message::Message(std::string stringMessage) + { + msg = messages::header::Message(); + try { + msg.ParseFromString(stringMessage); + + deviceId_ = msg.sourceid(); + topic_ = msg.topic(); + sourceType_ = msg.sourcetype(); + msgType_ = msg.msgtype(); + + + } catch (const std::exception& e) { + LOG_S(ERROR)< payload){ + payload_ = payload; + + msg.clear_payload(); + msg.add_payload()->CopyFrom(*payload_); + + } + + + + std::string Message::serialize(){ + + std::string serializedMessage; + if (msg.IsInitialized()) { + serializedMessage = msg.SerializeAsString(); + } + return serializedMessage; + } + + +} \ No newline at end of file diff --git a/src/WHISPER/Messages/Track.cpp b/src/WHISPER/Messages/Track.cpp new file mode 100644 index 0000000..20afe37 --- /dev/null +++ b/src/WHISPER/Messages/Track.cpp @@ -0,0 +1,56 @@ +#include "WHISPER/Messages/Message.hpp" +#include "WHISPER/Messages/Protos/raw_track.pb.h" +#include +#include + + + + +namespace WHISPER { + + RawTrack::RawTrack(std::string receivedMessage){ + msg = messages::header::Message(); + try { + msg.ParseFromString(receivedMessage); + topic_ = msg.topic(); + sourceType_ = msg.sourcetype(); + msgType_ = msg.msgtype(); + + trackMessage = messages::raw_track::RawTrack(); + + if ( msg.payload_size()) { + if (msg.payload().begin()->Is()) { + msg.payload().begin()->UnpackTo(&trackMessage); + } + } + + + trackNo = trackMessage.trackno(); + + + + } catch (const std::exception& e) { + LOG_S(ERROR)<(); + payloadMessage->PackFrom(trackMessage); + addPayLoad(payloadMessage); + + + } + + + + +} \ No newline at end of file