ADD: added tracklist update and systemstate update messages with tests and some improvements of simtrack
This commit is contained in:
@@ -49,6 +49,21 @@ add_library(SimCore STATIC
|
||||
include/SimCore/Messages/Protos/GeocentricPosition.pb.cc
|
||||
include/SimCore/Messages/Protos/Identifier.pb.cc
|
||||
|
||||
|
||||
include/SimCore/Messages/SystemStateUpdate.hpp
|
||||
src/SimCore/Messages/SystemStateUpdate.cpp
|
||||
include/SimCore/Messages/Protos/SystemStateUpdate.pb.cc
|
||||
|
||||
include/SimCore/Messages/TracklistUpdate.hpp
|
||||
src/SimCore/Messages/TracklistUpdate.cpp
|
||||
include/SimCore/Messages/Protos/TracklistUpdate.pb.cc
|
||||
|
||||
include/SimCore/SensorData.hpp
|
||||
src/SimCore/SensorData.cpp
|
||||
|
||||
include/SimCore/EffectorData.hpp
|
||||
src/SimCore/EffectorData.cpp
|
||||
|
||||
include/SimCore/data.hpp
|
||||
|
||||
|
||||
@@ -146,4 +161,14 @@ IF (${TEST_SIMCORE_LIBRARY})
|
||||
target_link_libraries(test_TrackClass Catch2::Catch2 SimCore loguru)
|
||||
catch_discover_tests(test_TrackClass)
|
||||
|
||||
|
||||
add_executable(test_SystemStateUpdate tests/test_SystemStateUpdate.cpp)
|
||||
target_link_libraries(test_SystemStateUpdate Catch2::Catch2 SimCore loguru)
|
||||
catch_discover_tests(test_SystemStateUpdate)
|
||||
|
||||
add_executable(test_TracklistUpdate tests/test_TracklistUpdate.cpp)
|
||||
target_link_libraries(test_TracklistUpdate Catch2::Catch2 SimCore loguru)
|
||||
catch_discover_tests(test_TracklistUpdate)
|
||||
|
||||
|
||||
ENDIF()
|
||||
|
||||
20
include/SimCore/EffectorData.hpp
Normal file
20
include/SimCore/EffectorData.hpp
Normal file
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
#include "SimCore/Identifier.hpp"
|
||||
#include "SimCore/data.hpp"
|
||||
namespace SimCore
|
||||
{
|
||||
|
||||
class EffectorData
|
||||
{
|
||||
public:
|
||||
EffectorData(const SimCore::Identifier effctorID, const std::string name);
|
||||
|
||||
|
||||
const SimCore::Identifier EffectorID;
|
||||
Data<std::string> Name;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
1225
include/SimCore/Messages/Protos/SystemStateUpdate.pb.cc
Normal file
1225
include/SimCore/Messages/Protos/SystemStateUpdate.pb.cc
Normal file
File diff suppressed because it is too large
Load Diff
1454
include/SimCore/Messages/Protos/SystemStateUpdate.pb.h
Normal file
1454
include/SimCore/Messages/Protos/SystemStateUpdate.pb.h
Normal file
File diff suppressed because it is too large
Load Diff
33
include/SimCore/Messages/Protos/SystemStateUpdate.proto
Normal file
33
include/SimCore/Messages/Protos/SystemStateUpdate.proto
Normal file
@@ -0,0 +1,33 @@
|
||||
syntax = "proto3";
|
||||
package messages.data;
|
||||
|
||||
import "Identifier.proto";
|
||||
|
||||
|
||||
message SystemStateUpdate
|
||||
{
|
||||
messages.track.Identifier OwnID = 1;
|
||||
repeated Sensor sensors = 2;
|
||||
repeated Effector effectors = 3;
|
||||
|
||||
}
|
||||
|
||||
message Sensor
|
||||
{
|
||||
messages.track.Identifier ID = 1;
|
||||
string name = 2;
|
||||
double range = 3;
|
||||
uint32 kind = 4;
|
||||
uint32 Status = 5;
|
||||
|
||||
}
|
||||
message Effector
|
||||
{
|
||||
messages.track.Identifier ID = 1;
|
||||
string name = 2;
|
||||
double range = 3;
|
||||
int32 ammunition = 4;
|
||||
int32 maxammunition =6;
|
||||
uint32 Status = 7;
|
||||
|
||||
}
|
||||
475
include/SimCore/Messages/Protos/TracklistUpdate.pb.cc
Normal file
475
include/SimCore/Messages/Protos/TracklistUpdate.pb.cc
Normal file
@@ -0,0 +1,475 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: TracklistUpdate.proto
|
||||
|
||||
#include "TracklistUpdate.pb.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include "google/protobuf/io/coded_stream.h"
|
||||
#include "google/protobuf/extension_set.h"
|
||||
#include "google/protobuf/wire_format_lite.h"
|
||||
#include "google/protobuf/descriptor.h"
|
||||
#include "google/protobuf/generated_message_reflection.h"
|
||||
#include "google/protobuf/reflection_ops.h"
|
||||
#include "google/protobuf/wire_format.h"
|
||||
#include "google/protobuf/generated_message_tctable_impl.h"
|
||||
// @@protoc_insertion_point(includes)
|
||||
|
||||
// Must be included last.
|
||||
#include "google/protobuf/port_def.inc"
|
||||
PROTOBUF_PRAGMA_INIT_SEG
|
||||
namespace _pb = ::google::protobuf;
|
||||
namespace _pbi = ::google::protobuf::internal;
|
||||
namespace _fl = ::google::protobuf::internal::field_layout;
|
||||
namespace messages {
|
||||
namespace data {
|
||||
|
||||
inline constexpr TracklistUpdate::Impl_::Impl_(
|
||||
::_pbi::ConstantInitialized) noexcept
|
||||
: _cached_size_{0},
|
||||
tracks_{},
|
||||
ownid_{nullptr},
|
||||
timestamp_{nullptr},
|
||||
trackscount_{0u} {}
|
||||
|
||||
template <typename>
|
||||
PROTOBUF_CONSTEXPR TracklistUpdate::TracklistUpdate(::_pbi::ConstantInitialized)
|
||||
: _impl_(::_pbi::ConstantInitialized()) {}
|
||||
struct TracklistUpdateDefaultTypeInternal {
|
||||
PROTOBUF_CONSTEXPR TracklistUpdateDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {}
|
||||
~TracklistUpdateDefaultTypeInternal() {}
|
||||
union {
|
||||
TracklistUpdate _instance;
|
||||
};
|
||||
};
|
||||
|
||||
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT
|
||||
PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 TracklistUpdateDefaultTypeInternal _TracklistUpdate_default_instance_;
|
||||
} // namespace data
|
||||
} // namespace messages
|
||||
static ::_pb::Metadata file_level_metadata_TracklistUpdate_2eproto[1];
|
||||
static constexpr const ::_pb::EnumDescriptor**
|
||||
file_level_enum_descriptors_TracklistUpdate_2eproto = nullptr;
|
||||
static constexpr const ::_pb::ServiceDescriptor**
|
||||
file_level_service_descriptors_TracklistUpdate_2eproto = nullptr;
|
||||
const ::uint32_t
|
||||
TableStruct_TracklistUpdate_2eproto::offsets[] ABSL_ATTRIBUTE_SECTION_VARIABLE(
|
||||
protodesc_cold) = {
|
||||
PROTOBUF_FIELD_OFFSET(::messages::data::TracklistUpdate, _impl_._has_bits_),
|
||||
PROTOBUF_FIELD_OFFSET(::messages::data::TracklistUpdate, _internal_metadata_),
|
||||
~0u, // no _extensions_
|
||||
~0u, // no _oneof_case_
|
||||
~0u, // no _weak_field_map_
|
||||
~0u, // no _inlined_string_donated_
|
||||
~0u, // no _split_
|
||||
~0u, // no sizeof(Split)
|
||||
PROTOBUF_FIELD_OFFSET(::messages::data::TracklistUpdate, _impl_.ownid_),
|
||||
PROTOBUF_FIELD_OFFSET(::messages::data::TracklistUpdate, _impl_.timestamp_),
|
||||
PROTOBUF_FIELD_OFFSET(::messages::data::TracklistUpdate, _impl_.trackscount_),
|
||||
PROTOBUF_FIELD_OFFSET(::messages::data::TracklistUpdate, _impl_.tracks_),
|
||||
0,
|
||||
1,
|
||||
~0u,
|
||||
~0u,
|
||||
};
|
||||
|
||||
static const ::_pbi::MigrationSchema
|
||||
schemas[] ABSL_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
|
||||
{0, 12, -1, sizeof(::messages::data::TracklistUpdate)},
|
||||
};
|
||||
|
||||
static const ::_pb::Message* const file_default_instances[] = {
|
||||
&::messages::data::_TracklistUpdate_default_instance_._instance,
|
||||
};
|
||||
const char descriptor_table_protodef_TracklistUpdate_2eproto[] ABSL_ATTRIBUTE_SECTION_VARIABLE(
|
||||
protodesc_cold) = {
|
||||
"\n\025TracklistUpdate.proto\022\rmessages.data\032\020"
|
||||
"Identifier.proto\032\037google/protobuf/timest"
|
||||
"amp.proto\032\016SimTrack.proto\"\255\001\n\017TracklistU"
|
||||
"pdate\022)\n\005OwnID\030\001 \001(\0132\032.messages.track.Id"
|
||||
"entifier\022-\n\ttimestamp\030\002 \001(\0132\032.google.pro"
|
||||
"tobuf.Timestamp\022\023\n\013TracksCount\030\003 \001(\r\022+\n\006"
|
||||
"tracks\030\004 \003(\0132\033.messages.SimTrack.SimTrac"
|
||||
"kb\006proto3"
|
||||
};
|
||||
static const ::_pbi::DescriptorTable* const descriptor_table_TracklistUpdate_2eproto_deps[3] =
|
||||
{
|
||||
&::descriptor_table_Identifier_2eproto,
|
||||
&::descriptor_table_SimTrack_2eproto,
|
||||
&::descriptor_table_google_2fprotobuf_2ftimestamp_2eproto,
|
||||
};
|
||||
static ::absl::once_flag descriptor_table_TracklistUpdate_2eproto_once;
|
||||
const ::_pbi::DescriptorTable descriptor_table_TracklistUpdate_2eproto = {
|
||||
false,
|
||||
false,
|
||||
289,
|
||||
descriptor_table_protodef_TracklistUpdate_2eproto,
|
||||
"TracklistUpdate.proto",
|
||||
&descriptor_table_TracklistUpdate_2eproto_once,
|
||||
descriptor_table_TracklistUpdate_2eproto_deps,
|
||||
3,
|
||||
1,
|
||||
schemas,
|
||||
file_default_instances,
|
||||
TableStruct_TracklistUpdate_2eproto::offsets,
|
||||
file_level_metadata_TracklistUpdate_2eproto,
|
||||
file_level_enum_descriptors_TracklistUpdate_2eproto,
|
||||
file_level_service_descriptors_TracklistUpdate_2eproto,
|
||||
};
|
||||
|
||||
// This function exists to be marked as weak.
|
||||
// It can significantly speed up compilation by breaking up LLVM's SCC
|
||||
// in the .pb.cc translation units. Large translation units see a
|
||||
// reduction of more than 35% of walltime for optimized builds. Without
|
||||
// the weak attribute all the messages in the file, including all the
|
||||
// vtables and everything they use become part of the same SCC through
|
||||
// a cycle like:
|
||||
// GetMetadata -> descriptor table -> default instances ->
|
||||
// vtables -> GetMetadata
|
||||
// By adding a weak function here we break the connection from the
|
||||
// individual vtables back into the descriptor table.
|
||||
PROTOBUF_ATTRIBUTE_WEAK const ::_pbi::DescriptorTable* descriptor_table_TracklistUpdate_2eproto_getter() {
|
||||
return &descriptor_table_TracklistUpdate_2eproto;
|
||||
}
|
||||
// Force running AddDescriptors() at dynamic initialization time.
|
||||
PROTOBUF_ATTRIBUTE_INIT_PRIORITY2
|
||||
static ::_pbi::AddDescriptorsRunner dynamic_init_dummy_TracklistUpdate_2eproto(&descriptor_table_TracklistUpdate_2eproto);
|
||||
namespace messages {
|
||||
namespace data {
|
||||
// ===================================================================
|
||||
|
||||
class TracklistUpdate::_Internal {
|
||||
public:
|
||||
using HasBits = decltype(std::declval<TracklistUpdate>()._impl_._has_bits_);
|
||||
static constexpr ::int32_t kHasBitsOffset =
|
||||
8 * PROTOBUF_FIELD_OFFSET(TracklistUpdate, _impl_._has_bits_);
|
||||
static const ::messages::track::Identifier& ownid(const TracklistUpdate* msg);
|
||||
static void set_has_ownid(HasBits* has_bits) {
|
||||
(*has_bits)[0] |= 1u;
|
||||
}
|
||||
static const ::google::protobuf::Timestamp& timestamp(const TracklistUpdate* msg);
|
||||
static void set_has_timestamp(HasBits* has_bits) {
|
||||
(*has_bits)[0] |= 2u;
|
||||
}
|
||||
};
|
||||
|
||||
const ::messages::track::Identifier& TracklistUpdate::_Internal::ownid(const TracklistUpdate* msg) {
|
||||
return *msg->_impl_.ownid_;
|
||||
}
|
||||
const ::google::protobuf::Timestamp& TracklistUpdate::_Internal::timestamp(const TracklistUpdate* msg) {
|
||||
return *msg->_impl_.timestamp_;
|
||||
}
|
||||
void TracklistUpdate::clear_ownid() {
|
||||
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
|
||||
if (_impl_.ownid_ != nullptr) _impl_.ownid_->Clear();
|
||||
_impl_._has_bits_[0] &= ~0x00000001u;
|
||||
}
|
||||
void TracklistUpdate::clear_timestamp() {
|
||||
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
|
||||
if (_impl_.timestamp_ != nullptr) _impl_.timestamp_->Clear();
|
||||
_impl_._has_bits_[0] &= ~0x00000002u;
|
||||
}
|
||||
void TracklistUpdate::clear_tracks() {
|
||||
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
|
||||
_impl_.tracks_.Clear();
|
||||
}
|
||||
TracklistUpdate::TracklistUpdate(::google::protobuf::Arena* arena)
|
||||
: ::google::protobuf::Message(arena) {
|
||||
SharedCtor(arena);
|
||||
// @@protoc_insertion_point(arena_constructor:messages.data.TracklistUpdate)
|
||||
}
|
||||
inline PROTOBUF_NDEBUG_INLINE TracklistUpdate::Impl_::Impl_(
|
||||
::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena,
|
||||
const Impl_& from)
|
||||
: _has_bits_{from._has_bits_},
|
||||
_cached_size_{0},
|
||||
tracks_{visibility, arena, from.tracks_} {}
|
||||
|
||||
TracklistUpdate::TracklistUpdate(
|
||||
::google::protobuf::Arena* arena,
|
||||
const TracklistUpdate& from)
|
||||
: ::google::protobuf::Message(arena) {
|
||||
TracklistUpdate* const _this = this;
|
||||
(void)_this;
|
||||
_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(
|
||||
from._internal_metadata_);
|
||||
new (&_impl_) Impl_(internal_visibility(), arena, from._impl_);
|
||||
::uint32_t cached_has_bits = _impl_._has_bits_[0];
|
||||
_impl_.ownid_ = (cached_has_bits & 0x00000001u)
|
||||
? CreateMaybeMessage<::messages::track::Identifier>(arena, *from._impl_.ownid_)
|
||||
: nullptr;
|
||||
_impl_.timestamp_ = (cached_has_bits & 0x00000002u)
|
||||
? CreateMaybeMessage<::google::protobuf::Timestamp>(arena, *from._impl_.timestamp_)
|
||||
: nullptr;
|
||||
_impl_.trackscount_ = from._impl_.trackscount_;
|
||||
|
||||
// @@protoc_insertion_point(copy_constructor:messages.data.TracklistUpdate)
|
||||
}
|
||||
inline PROTOBUF_NDEBUG_INLINE TracklistUpdate::Impl_::Impl_(
|
||||
::google::protobuf::internal::InternalVisibility visibility,
|
||||
::google::protobuf::Arena* arena)
|
||||
: _cached_size_{0},
|
||||
tracks_{visibility, arena} {}
|
||||
|
||||
inline void TracklistUpdate::SharedCtor(::_pb::Arena* arena) {
|
||||
new (&_impl_) Impl_(internal_visibility(), arena);
|
||||
::memset(reinterpret_cast<char *>(&_impl_) +
|
||||
offsetof(Impl_, ownid_),
|
||||
0,
|
||||
offsetof(Impl_, trackscount_) -
|
||||
offsetof(Impl_, ownid_) +
|
||||
sizeof(Impl_::trackscount_));
|
||||
}
|
||||
TracklistUpdate::~TracklistUpdate() {
|
||||
// @@protoc_insertion_point(destructor:messages.data.TracklistUpdate)
|
||||
_internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>();
|
||||
SharedDtor();
|
||||
}
|
||||
inline void TracklistUpdate::SharedDtor() {
|
||||
ABSL_DCHECK(GetArena() == nullptr);
|
||||
delete _impl_.ownid_;
|
||||
delete _impl_.timestamp_;
|
||||
_impl_.~Impl_();
|
||||
}
|
||||
|
||||
const ::google::protobuf::MessageLite::ClassData*
|
||||
TracklistUpdate::GetClassData() const {
|
||||
PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite::ClassData
|
||||
_data_ = {
|
||||
TracklistUpdate::MergeImpl,
|
||||
nullptr, // OnDemandRegisterArenaDtor
|
||||
&::google::protobuf::Message::kDescriptorMethods,
|
||||
PROTOBUF_FIELD_OFFSET(TracklistUpdate, _impl_._cached_size_),
|
||||
};
|
||||
return &_data_;
|
||||
}
|
||||
PROTOBUF_NOINLINE void TracklistUpdate::Clear() {
|
||||
// @@protoc_insertion_point(message_clear_start:messages.data.TracklistUpdate)
|
||||
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
|
||||
::uint32_t cached_has_bits = 0;
|
||||
// Prevent compiler warnings about cached_has_bits being unused
|
||||
(void) cached_has_bits;
|
||||
|
||||
_impl_.tracks_.Clear();
|
||||
cached_has_bits = _impl_._has_bits_[0];
|
||||
if (cached_has_bits & 0x00000003u) {
|
||||
if (cached_has_bits & 0x00000001u) {
|
||||
ABSL_DCHECK(_impl_.ownid_ != nullptr);
|
||||
_impl_.ownid_->Clear();
|
||||
}
|
||||
if (cached_has_bits & 0x00000002u) {
|
||||
ABSL_DCHECK(_impl_.timestamp_ != nullptr);
|
||||
_impl_.timestamp_->Clear();
|
||||
}
|
||||
}
|
||||
_impl_.trackscount_ = 0u;
|
||||
_impl_._has_bits_.Clear();
|
||||
_internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>();
|
||||
}
|
||||
|
||||
const char* TracklistUpdate::_InternalParse(
|
||||
const char* ptr, ::_pbi::ParseContext* ctx) {
|
||||
ptr = ::_pbi::TcParser::ParseLoop(this, ptr, ctx, &_table_.header);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
||||
PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1
|
||||
const ::_pbi::TcParseTable<2, 4, 3, 0, 2> TracklistUpdate::_table_ = {
|
||||
{
|
||||
PROTOBUF_FIELD_OFFSET(TracklistUpdate, _impl_._has_bits_),
|
||||
0, // no _extensions_
|
||||
4, 24, // max_field_number, fast_idx_mask
|
||||
offsetof(decltype(_table_), field_lookup_table),
|
||||
4294967280, // skipmap
|
||||
offsetof(decltype(_table_), field_entries),
|
||||
4, // num_field_entries
|
||||
3, // num_aux_entries
|
||||
offsetof(decltype(_table_), aux_entries),
|
||||
&_TracklistUpdate_default_instance_._instance,
|
||||
::_pbi::TcParser::GenericFallback, // fallback
|
||||
}, {{
|
||||
// repeated .messages.SimTrack.SimTrack tracks = 4;
|
||||
{::_pbi::TcParser::FastMtR1,
|
||||
{34, 63, 2, PROTOBUF_FIELD_OFFSET(TracklistUpdate, _impl_.tracks_)}},
|
||||
// .messages.track.Identifier OwnID = 1;
|
||||
{::_pbi::TcParser::FastMtS1,
|
||||
{10, 0, 0, PROTOBUF_FIELD_OFFSET(TracklistUpdate, _impl_.ownid_)}},
|
||||
// .google.protobuf.Timestamp timestamp = 2;
|
||||
{::_pbi::TcParser::FastMtS1,
|
||||
{18, 1, 1, PROTOBUF_FIELD_OFFSET(TracklistUpdate, _impl_.timestamp_)}},
|
||||
// uint32 TracksCount = 3;
|
||||
{::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(TracklistUpdate, _impl_.trackscount_), 63>(),
|
||||
{24, 63, 0, PROTOBUF_FIELD_OFFSET(TracklistUpdate, _impl_.trackscount_)}},
|
||||
}}, {{
|
||||
65535, 65535
|
||||
}}, {{
|
||||
// .messages.track.Identifier OwnID = 1;
|
||||
{PROTOBUF_FIELD_OFFSET(TracklistUpdate, _impl_.ownid_), _Internal::kHasBitsOffset + 0, 0,
|
||||
(0 | ::_fl::kFcOptional | ::_fl::kMessage | ::_fl::kTvTable)},
|
||||
// .google.protobuf.Timestamp timestamp = 2;
|
||||
{PROTOBUF_FIELD_OFFSET(TracklistUpdate, _impl_.timestamp_), _Internal::kHasBitsOffset + 1, 1,
|
||||
(0 | ::_fl::kFcOptional | ::_fl::kMessage | ::_fl::kTvTable)},
|
||||
// uint32 TracksCount = 3;
|
||||
{PROTOBUF_FIELD_OFFSET(TracklistUpdate, _impl_.trackscount_), -1, 0,
|
||||
(0 | ::_fl::kFcSingular | ::_fl::kUInt32)},
|
||||
// repeated .messages.SimTrack.SimTrack tracks = 4;
|
||||
{PROTOBUF_FIELD_OFFSET(TracklistUpdate, _impl_.tracks_), -1, 2,
|
||||
(0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)},
|
||||
}}, {{
|
||||
{::_pbi::TcParser::GetTable<::messages::track::Identifier>()},
|
||||
{::_pbi::TcParser::GetTable<::google::protobuf::Timestamp>()},
|
||||
{::_pbi::TcParser::GetTable<::messages::SimTrack::SimTrack>()},
|
||||
}}, {{
|
||||
}},
|
||||
};
|
||||
|
||||
::uint8_t* TracklistUpdate::_InternalSerialize(
|
||||
::uint8_t* target,
|
||||
::google::protobuf::io::EpsCopyOutputStream* stream) const {
|
||||
// @@protoc_insertion_point(serialize_to_array_start:messages.data.TracklistUpdate)
|
||||
::uint32_t cached_has_bits = 0;
|
||||
(void)cached_has_bits;
|
||||
|
||||
cached_has_bits = _impl_._has_bits_[0];
|
||||
// .messages.track.Identifier OwnID = 1;
|
||||
if (cached_has_bits & 0x00000001u) {
|
||||
target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage(
|
||||
1, _Internal::ownid(this),
|
||||
_Internal::ownid(this).GetCachedSize(), target, stream);
|
||||
}
|
||||
|
||||
// .google.protobuf.Timestamp timestamp = 2;
|
||||
if (cached_has_bits & 0x00000002u) {
|
||||
target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage(
|
||||
2, _Internal::timestamp(this),
|
||||
_Internal::timestamp(this).GetCachedSize(), target, stream);
|
||||
}
|
||||
|
||||
// uint32 TracksCount = 3;
|
||||
if (this->_internal_trackscount() != 0) {
|
||||
target = stream->EnsureSpace(target);
|
||||
target = ::_pbi::WireFormatLite::WriteUInt32ToArray(
|
||||
3, this->_internal_trackscount(), target);
|
||||
}
|
||||
|
||||
// repeated .messages.SimTrack.SimTrack tracks = 4;
|
||||
for (unsigned i = 0,
|
||||
n = static_cast<unsigned>(this->_internal_tracks_size()); i < n; i++) {
|
||||
const auto& repfield = this->_internal_tracks().Get(i);
|
||||
target = ::google::protobuf::internal::WireFormatLite::
|
||||
InternalWriteMessage(4, repfield, repfield.GetCachedSize(), target, stream);
|
||||
}
|
||||
|
||||
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
|
||||
target =
|
||||
::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
|
||||
_internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream);
|
||||
}
|
||||
// @@protoc_insertion_point(serialize_to_array_end:messages.data.TracklistUpdate)
|
||||
return target;
|
||||
}
|
||||
|
||||
::size_t TracklistUpdate::ByteSizeLong() const {
|
||||
// @@protoc_insertion_point(message_byte_size_start:messages.data.TracklistUpdate)
|
||||
::size_t total_size = 0;
|
||||
|
||||
::uint32_t cached_has_bits = 0;
|
||||
// Prevent compiler warnings about cached_has_bits being unused
|
||||
(void) cached_has_bits;
|
||||
|
||||
// repeated .messages.SimTrack.SimTrack tracks = 4;
|
||||
total_size += 1UL * this->_internal_tracks_size();
|
||||
for (const auto& msg : this->_internal_tracks()) {
|
||||
total_size +=
|
||||
::google::protobuf::internal::WireFormatLite::MessageSize(msg);
|
||||
}
|
||||
cached_has_bits = _impl_._has_bits_[0];
|
||||
if (cached_has_bits & 0x00000003u) {
|
||||
// .messages.track.Identifier OwnID = 1;
|
||||
if (cached_has_bits & 0x00000001u) {
|
||||
total_size +=
|
||||
1 + ::google::protobuf::internal::WireFormatLite::MessageSize(*_impl_.ownid_);
|
||||
}
|
||||
|
||||
// .google.protobuf.Timestamp timestamp = 2;
|
||||
if (cached_has_bits & 0x00000002u) {
|
||||
total_size +=
|
||||
1 + ::google::protobuf::internal::WireFormatLite::MessageSize(*_impl_.timestamp_);
|
||||
}
|
||||
|
||||
}
|
||||
// uint32 TracksCount = 3;
|
||||
if (this->_internal_trackscount() != 0) {
|
||||
total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(
|
||||
this->_internal_trackscount());
|
||||
}
|
||||
|
||||
return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
|
||||
}
|
||||
|
||||
|
||||
void TracklistUpdate::MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg) {
|
||||
auto* const _this = static_cast<TracklistUpdate*>(&to_msg);
|
||||
auto& from = static_cast<const TracklistUpdate&>(from_msg);
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:messages.data.TracklistUpdate)
|
||||
ABSL_DCHECK_NE(&from, _this);
|
||||
::uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
_this->_internal_mutable_tracks()->MergeFrom(
|
||||
from._internal_tracks());
|
||||
cached_has_bits = from._impl_._has_bits_[0];
|
||||
if (cached_has_bits & 0x00000003u) {
|
||||
if (cached_has_bits & 0x00000001u) {
|
||||
_this->_internal_mutable_ownid()->::messages::track::Identifier::MergeFrom(
|
||||
from._internal_ownid());
|
||||
}
|
||||
if (cached_has_bits & 0x00000002u) {
|
||||
_this->_internal_mutable_timestamp()->::google::protobuf::Timestamp::MergeFrom(
|
||||
from._internal_timestamp());
|
||||
}
|
||||
}
|
||||
if (from._internal_trackscount() != 0) {
|
||||
_this->_internal_set_trackscount(from._internal_trackscount());
|
||||
}
|
||||
_this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_);
|
||||
}
|
||||
|
||||
void TracklistUpdate::CopyFrom(const TracklistUpdate& from) {
|
||||
// @@protoc_insertion_point(class_specific_copy_from_start:messages.data.TracklistUpdate)
|
||||
if (&from == this) return;
|
||||
Clear();
|
||||
MergeFrom(from);
|
||||
}
|
||||
|
||||
PROTOBUF_NOINLINE bool TracklistUpdate::IsInitialized() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
void TracklistUpdate::InternalSwap(TracklistUpdate* PROTOBUF_RESTRICT other) {
|
||||
using std::swap;
|
||||
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
|
||||
swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]);
|
||||
_impl_.tracks_.InternalSwap(&other->_impl_.tracks_);
|
||||
::google::protobuf::internal::memswap<
|
||||
PROTOBUF_FIELD_OFFSET(TracklistUpdate, _impl_.trackscount_)
|
||||
+ sizeof(TracklistUpdate::_impl_.trackscount_)
|
||||
- PROTOBUF_FIELD_OFFSET(TracklistUpdate, _impl_.ownid_)>(
|
||||
reinterpret_cast<char*>(&_impl_.ownid_),
|
||||
reinterpret_cast<char*>(&other->_impl_.ownid_));
|
||||
}
|
||||
|
||||
::google::protobuf::Metadata TracklistUpdate::GetMetadata() const {
|
||||
return ::_pbi::AssignDescriptors(
|
||||
&descriptor_table_TracklistUpdate_2eproto_getter, &descriptor_table_TracklistUpdate_2eproto_once,
|
||||
file_level_metadata_TracklistUpdate_2eproto[0]);
|
||||
}
|
||||
// @@protoc_insertion_point(namespace_scope)
|
||||
} // namespace data
|
||||
} // namespace messages
|
||||
namespace google {
|
||||
namespace protobuf {
|
||||
} // namespace protobuf
|
||||
} // namespace google
|
||||
// @@protoc_insertion_point(global_scope)
|
||||
#include "google/protobuf/port_undef.inc"
|
||||
587
include/SimCore/Messages/Protos/TracklistUpdate.pb.h
Normal file
587
include/SimCore/Messages/Protos/TracklistUpdate.pb.h
Normal file
@@ -0,0 +1,587 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: TracklistUpdate.proto
|
||||
// Protobuf C++ Version: 4.24.0-main
|
||||
|
||||
#ifndef GOOGLE_PROTOBUF_INCLUDED_TracklistUpdate_2eproto_2epb_2eh
|
||||
#define GOOGLE_PROTOBUF_INCLUDED_TracklistUpdate_2eproto_2epb_2eh
|
||||
|
||||
#include <limits>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
#include "google/protobuf/port_def.inc"
|
||||
#if PROTOBUF_VERSION < 4025000
|
||||
#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 // PROTOBUF_VERSION
|
||||
|
||||
#if 4025000 < 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 // PROTOBUF_MIN_PROTOC_VERSION
|
||||
#include "google/protobuf/port_undef.inc"
|
||||
#include "google/protobuf/io/coded_stream.h"
|
||||
#include "google/protobuf/arena.h"
|
||||
#include "google/protobuf/arenastring.h"
|
||||
#include "google/protobuf/generated_message_tctable_decl.h"
|
||||
#include "google/protobuf/generated_message_util.h"
|
||||
#include "google/protobuf/metadata_lite.h"
|
||||
#include "google/protobuf/generated_message_reflection.h"
|
||||
#include "google/protobuf/message.h"
|
||||
#include "google/protobuf/repeated_field.h" // IWYU pragma: export
|
||||
#include "google/protobuf/extension_set.h" // IWYU pragma: export
|
||||
#include "google/protobuf/unknown_field_set.h"
|
||||
#include "Identifier.pb.h"
|
||||
#include "google/protobuf/timestamp.pb.h"
|
||||
#include "SimTrack.pb.h"
|
||||
// @@protoc_insertion_point(includes)
|
||||
|
||||
// Must be included last.
|
||||
#include "google/protobuf/port_def.inc"
|
||||
|
||||
#define PROTOBUF_INTERNAL_EXPORT_TracklistUpdate_2eproto
|
||||
|
||||
namespace google {
|
||||
namespace protobuf {
|
||||
namespace internal {
|
||||
class AnyMetadata;
|
||||
} // namespace internal
|
||||
} // namespace protobuf
|
||||
} // namespace google
|
||||
|
||||
// Internal implementation detail -- do not use these members.
|
||||
struct TableStruct_TracklistUpdate_2eproto {
|
||||
static const ::uint32_t offsets[];
|
||||
};
|
||||
extern const ::google::protobuf::internal::DescriptorTable
|
||||
descriptor_table_TracklistUpdate_2eproto;
|
||||
namespace messages {
|
||||
namespace data {
|
||||
class TracklistUpdate;
|
||||
struct TracklistUpdateDefaultTypeInternal;
|
||||
extern TracklistUpdateDefaultTypeInternal _TracklistUpdate_default_instance_;
|
||||
} // namespace data
|
||||
} // namespace messages
|
||||
namespace google {
|
||||
namespace protobuf {
|
||||
} // namespace protobuf
|
||||
} // namespace google
|
||||
|
||||
namespace messages {
|
||||
namespace data {
|
||||
|
||||
// ===================================================================
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
class TracklistUpdate final :
|
||||
public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:messages.data.TracklistUpdate) */ {
|
||||
public:
|
||||
inline TracklistUpdate() : TracklistUpdate(nullptr) {}
|
||||
~TracklistUpdate() override;
|
||||
template<typename = void>
|
||||
explicit PROTOBUF_CONSTEXPR TracklistUpdate(::google::protobuf::internal::ConstantInitialized);
|
||||
|
||||
inline TracklistUpdate(const TracklistUpdate& from)
|
||||
: TracklistUpdate(nullptr, from) {}
|
||||
TracklistUpdate(TracklistUpdate&& from) noexcept
|
||||
: TracklistUpdate() {
|
||||
*this = ::std::move(from);
|
||||
}
|
||||
|
||||
inline TracklistUpdate& operator=(const TracklistUpdate& from) {
|
||||
CopyFrom(from);
|
||||
return *this;
|
||||
}
|
||||
inline TracklistUpdate& operator=(TracklistUpdate&& from) noexcept {
|
||||
if (this == &from) return *this;
|
||||
if (GetArena() == from.GetArena()
|
||||
#ifdef PROTOBUF_FORCE_COPY_IN_MOVE
|
||||
&& GetArena() != nullptr
|
||||
#endif // !PROTOBUF_FORCE_COPY_IN_MOVE
|
||||
) {
|
||||
InternalSwap(&from);
|
||||
} else {
|
||||
CopyFrom(from);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const
|
||||
ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
||||
return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance);
|
||||
}
|
||||
inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields()
|
||||
ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
||||
return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>();
|
||||
}
|
||||
|
||||
static const ::google::protobuf::Descriptor* descriptor() {
|
||||
return GetDescriptor();
|
||||
}
|
||||
static const ::google::protobuf::Descriptor* GetDescriptor() {
|
||||
return default_instance().GetMetadata().descriptor;
|
||||
}
|
||||
static const ::google::protobuf::Reflection* GetReflection() {
|
||||
return default_instance().GetMetadata().reflection;
|
||||
}
|
||||
static const TracklistUpdate& default_instance() {
|
||||
return *internal_default_instance();
|
||||
}
|
||||
static inline const TracklistUpdate* internal_default_instance() {
|
||||
return reinterpret_cast<const TracklistUpdate*>(
|
||||
&_TracklistUpdate_default_instance_);
|
||||
}
|
||||
static constexpr int kIndexInFileMessages =
|
||||
0;
|
||||
|
||||
friend void swap(TracklistUpdate& a, TracklistUpdate& b) {
|
||||
a.Swap(&b);
|
||||
}
|
||||
inline void Swap(TracklistUpdate* other) {
|
||||
if (other == this) return;
|
||||
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
if (GetArena() != nullptr &&
|
||||
GetArena() == other->GetArena()) {
|
||||
#else // PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
if (GetArena() == other->GetArena()) {
|
||||
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
InternalSwap(other);
|
||||
} else {
|
||||
::google::protobuf::internal::GenericSwap(this, other);
|
||||
}
|
||||
}
|
||||
void UnsafeArenaSwap(TracklistUpdate* other) {
|
||||
if (other == this) return;
|
||||
ABSL_DCHECK(GetArena() == other->GetArena());
|
||||
InternalSwap(other);
|
||||
}
|
||||
|
||||
// implements Message ----------------------------------------------
|
||||
|
||||
TracklistUpdate* New(::google::protobuf::Arena* arena = nullptr) const final {
|
||||
return CreateMaybeMessage<TracklistUpdate>(arena);
|
||||
}
|
||||
using ::google::protobuf::Message::CopyFrom;
|
||||
void CopyFrom(const TracklistUpdate& from);
|
||||
using ::google::protobuf::Message::MergeFrom;
|
||||
void MergeFrom( const TracklistUpdate& from) {
|
||||
TracklistUpdate::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::google::protobuf::Message& to_msg, const ::google::protobuf::Message& from_msg);
|
||||
public:
|
||||
ABSL_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
|
||||
::size_t ByteSizeLong() const final;
|
||||
const char* _InternalParse(const char* ptr, ::google::protobuf::internal::ParseContext* ctx) final;
|
||||
::uint8_t* _InternalSerialize(
|
||||
::uint8_t* target, ::google::protobuf::io::EpsCopyOutputStream* stream) const final;
|
||||
int GetCachedSize() const { return _impl_._cached_size_.Get(); }
|
||||
|
||||
private:
|
||||
void SharedCtor(::google::protobuf::Arena* arena);
|
||||
void SharedDtor();
|
||||
void InternalSwap(TracklistUpdate* other);
|
||||
|
||||
private:
|
||||
friend class ::google::protobuf::internal::AnyMetadata;
|
||||
static ::absl::string_view FullMessageName() {
|
||||
return "messages.data.TracklistUpdate";
|
||||
}
|
||||
protected:
|
||||
explicit TracklistUpdate(::google::protobuf::Arena* arena);
|
||||
TracklistUpdate(::google::protobuf::Arena* arena, const TracklistUpdate& from);
|
||||
const ::google::protobuf::MessageLite::ClassData* GetClassData() const final;
|
||||
public:
|
||||
|
||||
::google::protobuf::Metadata GetMetadata() const final;
|
||||
|
||||
// nested types ----------------------------------------------------
|
||||
|
||||
// accessors -------------------------------------------------------
|
||||
|
||||
enum : int {
|
||||
kTracksFieldNumber = 4,
|
||||
kOwnIDFieldNumber = 1,
|
||||
kTimestampFieldNumber = 2,
|
||||
kTracksCountFieldNumber = 3,
|
||||
};
|
||||
// repeated .messages.SimTrack.SimTrack tracks = 4;
|
||||
int tracks_size() const;
|
||||
private:
|
||||
int _internal_tracks_size() const;
|
||||
|
||||
public:
|
||||
void clear_tracks() ;
|
||||
::messages::SimTrack::SimTrack* mutable_tracks(int index);
|
||||
::google::protobuf::RepeatedPtrField< ::messages::SimTrack::SimTrack >*
|
||||
mutable_tracks();
|
||||
private:
|
||||
const ::google::protobuf::RepeatedPtrField<::messages::SimTrack::SimTrack>& _internal_tracks() const;
|
||||
::google::protobuf::RepeatedPtrField<::messages::SimTrack::SimTrack>* _internal_mutable_tracks();
|
||||
public:
|
||||
const ::messages::SimTrack::SimTrack& tracks(int index) const;
|
||||
::messages::SimTrack::SimTrack* add_tracks();
|
||||
const ::google::protobuf::RepeatedPtrField< ::messages::SimTrack::SimTrack >&
|
||||
tracks() const;
|
||||
// .messages.track.Identifier OwnID = 1;
|
||||
bool has_ownid() const;
|
||||
void clear_ownid() ;
|
||||
const ::messages::track::Identifier& ownid() const;
|
||||
PROTOBUF_NODISCARD ::messages::track::Identifier* release_ownid();
|
||||
::messages::track::Identifier* mutable_ownid();
|
||||
void set_allocated_ownid(::messages::track::Identifier* value);
|
||||
void unsafe_arena_set_allocated_ownid(::messages::track::Identifier* value);
|
||||
::messages::track::Identifier* unsafe_arena_release_ownid();
|
||||
|
||||
private:
|
||||
const ::messages::track::Identifier& _internal_ownid() const;
|
||||
::messages::track::Identifier* _internal_mutable_ownid();
|
||||
|
||||
public:
|
||||
// .google.protobuf.Timestamp timestamp = 2;
|
||||
bool has_timestamp() const;
|
||||
void clear_timestamp() ;
|
||||
const ::google::protobuf::Timestamp& timestamp() const;
|
||||
PROTOBUF_NODISCARD ::google::protobuf::Timestamp* release_timestamp();
|
||||
::google::protobuf::Timestamp* mutable_timestamp();
|
||||
void set_allocated_timestamp(::google::protobuf::Timestamp* value);
|
||||
void unsafe_arena_set_allocated_timestamp(::google::protobuf::Timestamp* value);
|
||||
::google::protobuf::Timestamp* unsafe_arena_release_timestamp();
|
||||
|
||||
private:
|
||||
const ::google::protobuf::Timestamp& _internal_timestamp() const;
|
||||
::google::protobuf::Timestamp* _internal_mutable_timestamp();
|
||||
|
||||
public:
|
||||
// uint32 TracksCount = 3;
|
||||
void clear_trackscount() ;
|
||||
::uint32_t trackscount() const;
|
||||
void set_trackscount(::uint32_t value);
|
||||
|
||||
private:
|
||||
::uint32_t _internal_trackscount() const;
|
||||
void _internal_set_trackscount(::uint32_t value);
|
||||
|
||||
public:
|
||||
// @@protoc_insertion_point(class_scope:messages.data.TracklistUpdate)
|
||||
private:
|
||||
class _Internal;
|
||||
|
||||
friend class ::google::protobuf::internal::TcParser;
|
||||
static const ::google::protobuf::internal::TcParseTable<
|
||||
2, 4, 3,
|
||||
0, 2>
|
||||
_table_;
|
||||
friend class ::google::protobuf::MessageLite;
|
||||
friend class ::google::protobuf::Arena;
|
||||
template <typename T>
|
||||
friend class ::google::protobuf::Arena::InternalHelper;
|
||||
using InternalArenaConstructable_ = void;
|
||||
using DestructorSkippable_ = void;
|
||||
struct Impl_ {
|
||||
|
||||
inline explicit constexpr Impl_(
|
||||
::google::protobuf::internal::ConstantInitialized) noexcept;
|
||||
inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility,
|
||||
::google::protobuf::Arena* arena);
|
||||
inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility,
|
||||
::google::protobuf::Arena* arena, const Impl_& from);
|
||||
::google::protobuf::internal::HasBits<1> _has_bits_;
|
||||
mutable ::google::protobuf::internal::CachedSize _cached_size_;
|
||||
::google::protobuf::RepeatedPtrField< ::messages::SimTrack::SimTrack > tracks_;
|
||||
::messages::track::Identifier* ownid_;
|
||||
::google::protobuf::Timestamp* timestamp_;
|
||||
::uint32_t trackscount_;
|
||||
PROTOBUF_TSAN_DECLARE_MEMBER
|
||||
};
|
||||
union { Impl_ _impl_; };
|
||||
friend struct ::TableStruct_TracklistUpdate_2eproto;
|
||||
};
|
||||
|
||||
// ===================================================================
|
||||
|
||||
|
||||
|
||||
|
||||
// ===================================================================
|
||||
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
||||
#endif // __GNUC__
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
// TracklistUpdate
|
||||
|
||||
// .messages.track.Identifier OwnID = 1;
|
||||
inline bool TracklistUpdate::has_ownid() const {
|
||||
bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0;
|
||||
PROTOBUF_ASSUME(!value || _impl_.ownid_ != nullptr);
|
||||
return value;
|
||||
}
|
||||
inline const ::messages::track::Identifier& TracklistUpdate::_internal_ownid() const {
|
||||
PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race);
|
||||
const ::messages::track::Identifier* p = _impl_.ownid_;
|
||||
return p != nullptr ? *p : reinterpret_cast<const ::messages::track::Identifier&>(::messages::track::_Identifier_default_instance_);
|
||||
}
|
||||
inline const ::messages::track::Identifier& TracklistUpdate::ownid() const ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
||||
// @@protoc_insertion_point(field_get:messages.data.TracklistUpdate.OwnID)
|
||||
return _internal_ownid();
|
||||
}
|
||||
inline void TracklistUpdate::unsafe_arena_set_allocated_ownid(::messages::track::Identifier* value) {
|
||||
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
|
||||
if (GetArena() == nullptr) {
|
||||
delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.ownid_);
|
||||
}
|
||||
_impl_.ownid_ = reinterpret_cast<::messages::track::Identifier*>(value);
|
||||
if (value != nullptr) {
|
||||
_impl_._has_bits_[0] |= 0x00000001u;
|
||||
} else {
|
||||
_impl_._has_bits_[0] &= ~0x00000001u;
|
||||
}
|
||||
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:messages.data.TracklistUpdate.OwnID)
|
||||
}
|
||||
inline ::messages::track::Identifier* TracklistUpdate::release_ownid() {
|
||||
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
|
||||
|
||||
_impl_._has_bits_[0] &= ~0x00000001u;
|
||||
::messages::track::Identifier* released = _impl_.ownid_;
|
||||
_impl_.ownid_ = nullptr;
|
||||
#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE
|
||||
auto* old = reinterpret_cast<::google::protobuf::MessageLite*>(released);
|
||||
released = ::google::protobuf::internal::DuplicateIfNonNull(released);
|
||||
if (GetArena() == nullptr) {
|
||||
delete old;
|
||||
}
|
||||
#else // PROTOBUF_FORCE_COPY_IN_RELEASE
|
||||
if (GetArena() != nullptr) {
|
||||
released = ::google::protobuf::internal::DuplicateIfNonNull(released);
|
||||
}
|
||||
#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE
|
||||
return released;
|
||||
}
|
||||
inline ::messages::track::Identifier* TracklistUpdate::unsafe_arena_release_ownid() {
|
||||
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
|
||||
// @@protoc_insertion_point(field_release:messages.data.TracklistUpdate.OwnID)
|
||||
|
||||
_impl_._has_bits_[0] &= ~0x00000001u;
|
||||
::messages::track::Identifier* temp = _impl_.ownid_;
|
||||
_impl_.ownid_ = nullptr;
|
||||
return temp;
|
||||
}
|
||||
inline ::messages::track::Identifier* TracklistUpdate::_internal_mutable_ownid() {
|
||||
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
|
||||
_impl_._has_bits_[0] |= 0x00000001u;
|
||||
if (_impl_.ownid_ == nullptr) {
|
||||
auto* p = CreateMaybeMessage<::messages::track::Identifier>(GetArena());
|
||||
_impl_.ownid_ = reinterpret_cast<::messages::track::Identifier*>(p);
|
||||
}
|
||||
return _impl_.ownid_;
|
||||
}
|
||||
inline ::messages::track::Identifier* TracklistUpdate::mutable_ownid() ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
||||
::messages::track::Identifier* _msg = _internal_mutable_ownid();
|
||||
// @@protoc_insertion_point(field_mutable:messages.data.TracklistUpdate.OwnID)
|
||||
return _msg;
|
||||
}
|
||||
inline void TracklistUpdate::set_allocated_ownid(::messages::track::Identifier* value) {
|
||||
::google::protobuf::Arena* message_arena = GetArena();
|
||||
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
|
||||
if (message_arena == nullptr) {
|
||||
delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.ownid_);
|
||||
}
|
||||
|
||||
if (value != nullptr) {
|
||||
::google::protobuf::Arena* submessage_arena = reinterpret_cast<::google::protobuf::MessageLite*>(value)->GetArena();
|
||||
if (message_arena != submessage_arena) {
|
||||
value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena);
|
||||
}
|
||||
_impl_._has_bits_[0] |= 0x00000001u;
|
||||
} else {
|
||||
_impl_._has_bits_[0] &= ~0x00000001u;
|
||||
}
|
||||
|
||||
_impl_.ownid_ = reinterpret_cast<::messages::track::Identifier*>(value);
|
||||
// @@protoc_insertion_point(field_set_allocated:messages.data.TracklistUpdate.OwnID)
|
||||
}
|
||||
|
||||
// .google.protobuf.Timestamp timestamp = 2;
|
||||
inline bool TracklistUpdate::has_timestamp() const {
|
||||
bool value = (_impl_._has_bits_[0] & 0x00000002u) != 0;
|
||||
PROTOBUF_ASSUME(!value || _impl_.timestamp_ != nullptr);
|
||||
return value;
|
||||
}
|
||||
inline const ::google::protobuf::Timestamp& TracklistUpdate::_internal_timestamp() const {
|
||||
PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race);
|
||||
const ::google::protobuf::Timestamp* p = _impl_.timestamp_;
|
||||
return p != nullptr ? *p : reinterpret_cast<const ::google::protobuf::Timestamp&>(::google::protobuf::_Timestamp_default_instance_);
|
||||
}
|
||||
inline const ::google::protobuf::Timestamp& TracklistUpdate::timestamp() const ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
||||
// @@protoc_insertion_point(field_get:messages.data.TracklistUpdate.timestamp)
|
||||
return _internal_timestamp();
|
||||
}
|
||||
inline void TracklistUpdate::unsafe_arena_set_allocated_timestamp(::google::protobuf::Timestamp* value) {
|
||||
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
|
||||
if (GetArena() == nullptr) {
|
||||
delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.timestamp_);
|
||||
}
|
||||
_impl_.timestamp_ = reinterpret_cast<::google::protobuf::Timestamp*>(value);
|
||||
if (value != nullptr) {
|
||||
_impl_._has_bits_[0] |= 0x00000002u;
|
||||
} else {
|
||||
_impl_._has_bits_[0] &= ~0x00000002u;
|
||||
}
|
||||
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:messages.data.TracklistUpdate.timestamp)
|
||||
}
|
||||
inline ::google::protobuf::Timestamp* TracklistUpdate::release_timestamp() {
|
||||
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
|
||||
|
||||
_impl_._has_bits_[0] &= ~0x00000002u;
|
||||
::google::protobuf::Timestamp* released = _impl_.timestamp_;
|
||||
_impl_.timestamp_ = nullptr;
|
||||
#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE
|
||||
auto* old = reinterpret_cast<::google::protobuf::MessageLite*>(released);
|
||||
released = ::google::protobuf::internal::DuplicateIfNonNull(released);
|
||||
if (GetArena() == nullptr) {
|
||||
delete old;
|
||||
}
|
||||
#else // PROTOBUF_FORCE_COPY_IN_RELEASE
|
||||
if (GetArena() != nullptr) {
|
||||
released = ::google::protobuf::internal::DuplicateIfNonNull(released);
|
||||
}
|
||||
#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE
|
||||
return released;
|
||||
}
|
||||
inline ::google::protobuf::Timestamp* TracklistUpdate::unsafe_arena_release_timestamp() {
|
||||
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
|
||||
// @@protoc_insertion_point(field_release:messages.data.TracklistUpdate.timestamp)
|
||||
|
||||
_impl_._has_bits_[0] &= ~0x00000002u;
|
||||
::google::protobuf::Timestamp* temp = _impl_.timestamp_;
|
||||
_impl_.timestamp_ = nullptr;
|
||||
return temp;
|
||||
}
|
||||
inline ::google::protobuf::Timestamp* TracklistUpdate::_internal_mutable_timestamp() {
|
||||
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
|
||||
_impl_._has_bits_[0] |= 0x00000002u;
|
||||
if (_impl_.timestamp_ == nullptr) {
|
||||
auto* p = CreateMaybeMessage<::google::protobuf::Timestamp>(GetArena());
|
||||
_impl_.timestamp_ = reinterpret_cast<::google::protobuf::Timestamp*>(p);
|
||||
}
|
||||
return _impl_.timestamp_;
|
||||
}
|
||||
inline ::google::protobuf::Timestamp* TracklistUpdate::mutable_timestamp() ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
||||
::google::protobuf::Timestamp* _msg = _internal_mutable_timestamp();
|
||||
// @@protoc_insertion_point(field_mutable:messages.data.TracklistUpdate.timestamp)
|
||||
return _msg;
|
||||
}
|
||||
inline void TracklistUpdate::set_allocated_timestamp(::google::protobuf::Timestamp* value) {
|
||||
::google::protobuf::Arena* message_arena = GetArena();
|
||||
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
|
||||
if (message_arena == nullptr) {
|
||||
delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.timestamp_);
|
||||
}
|
||||
|
||||
if (value != nullptr) {
|
||||
::google::protobuf::Arena* submessage_arena = reinterpret_cast<::google::protobuf::MessageLite*>(value)->GetArena();
|
||||
if (message_arena != submessage_arena) {
|
||||
value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena);
|
||||
}
|
||||
_impl_._has_bits_[0] |= 0x00000002u;
|
||||
} else {
|
||||
_impl_._has_bits_[0] &= ~0x00000002u;
|
||||
}
|
||||
|
||||
_impl_.timestamp_ = reinterpret_cast<::google::protobuf::Timestamp*>(value);
|
||||
// @@protoc_insertion_point(field_set_allocated:messages.data.TracklistUpdate.timestamp)
|
||||
}
|
||||
|
||||
// uint32 TracksCount = 3;
|
||||
inline void TracklistUpdate::clear_trackscount() {
|
||||
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
|
||||
_impl_.trackscount_ = 0u;
|
||||
}
|
||||
inline ::uint32_t TracklistUpdate::trackscount() const {
|
||||
// @@protoc_insertion_point(field_get:messages.data.TracklistUpdate.TracksCount)
|
||||
return _internal_trackscount();
|
||||
}
|
||||
inline void TracklistUpdate::set_trackscount(::uint32_t value) {
|
||||
_internal_set_trackscount(value);
|
||||
// @@protoc_insertion_point(field_set:messages.data.TracklistUpdate.TracksCount)
|
||||
}
|
||||
inline ::uint32_t TracklistUpdate::_internal_trackscount() const {
|
||||
PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race);
|
||||
return _impl_.trackscount_;
|
||||
}
|
||||
inline void TracklistUpdate::_internal_set_trackscount(::uint32_t value) {
|
||||
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
|
||||
;
|
||||
_impl_.trackscount_ = value;
|
||||
}
|
||||
|
||||
// repeated .messages.SimTrack.SimTrack tracks = 4;
|
||||
inline int TracklistUpdate::_internal_tracks_size() const {
|
||||
return _internal_tracks().size();
|
||||
}
|
||||
inline int TracklistUpdate::tracks_size() const {
|
||||
return _internal_tracks_size();
|
||||
}
|
||||
inline ::messages::SimTrack::SimTrack* TracklistUpdate::mutable_tracks(int index)
|
||||
ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
||||
// @@protoc_insertion_point(field_mutable:messages.data.TracklistUpdate.tracks)
|
||||
return _internal_mutable_tracks()->Mutable(index);
|
||||
}
|
||||
inline ::google::protobuf::RepeatedPtrField<::messages::SimTrack::SimTrack>* TracklistUpdate::mutable_tracks()
|
||||
ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
||||
// @@protoc_insertion_point(field_mutable_list:messages.data.TracklistUpdate.tracks)
|
||||
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
|
||||
return _internal_mutable_tracks();
|
||||
}
|
||||
inline const ::messages::SimTrack::SimTrack& TracklistUpdate::tracks(int index) const
|
||||
ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
||||
// @@protoc_insertion_point(field_get:messages.data.TracklistUpdate.tracks)
|
||||
return _internal_tracks().Get(index);
|
||||
}
|
||||
inline ::messages::SimTrack::SimTrack* TracklistUpdate::add_tracks() ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
||||
PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race);
|
||||
::messages::SimTrack::SimTrack* _add = _internal_mutable_tracks()->Add();
|
||||
// @@protoc_insertion_point(field_add:messages.data.TracklistUpdate.tracks)
|
||||
return _add;
|
||||
}
|
||||
inline const ::google::protobuf::RepeatedPtrField<::messages::SimTrack::SimTrack>& TracklistUpdate::tracks() const
|
||||
ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
||||
// @@protoc_insertion_point(field_list:messages.data.TracklistUpdate.tracks)
|
||||
return _internal_tracks();
|
||||
}
|
||||
inline const ::google::protobuf::RepeatedPtrField<::messages::SimTrack::SimTrack>&
|
||||
TracklistUpdate::_internal_tracks() const {
|
||||
PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race);
|
||||
return _impl_.tracks_;
|
||||
}
|
||||
inline ::google::protobuf::RepeatedPtrField<::messages::SimTrack::SimTrack>*
|
||||
TracklistUpdate::_internal_mutable_tracks() {
|
||||
PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race);
|
||||
return &_impl_.tracks_;
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif // __GNUC__
|
||||
|
||||
// @@protoc_insertion_point(namespace_scope)
|
||||
} // namespace data
|
||||
} // namespace messages
|
||||
|
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
||||
|
||||
#include "google/protobuf/port_undef.inc"
|
||||
|
||||
#endif // GOOGLE_PROTOBUF_INCLUDED_TracklistUpdate_2eproto_2epb_2eh
|
||||
26
include/SimCore/Messages/Protos/TracklistUpdate.proto
Normal file
26
include/SimCore/Messages/Protos/TracklistUpdate.proto
Normal file
@@ -0,0 +1,26 @@
|
||||
syntax = "proto3";
|
||||
package messages.data;
|
||||
|
||||
import "Identifier.proto";
|
||||
// import "GeocentricPosition.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "SimTrack.proto";
|
||||
|
||||
message TracklistUpdate
|
||||
{
|
||||
messages.track.Identifier OwnID = 1;
|
||||
google.protobuf.Timestamp timestamp = 2;
|
||||
uint32 TracksCount = 3;
|
||||
repeated messages.SimTrack.SimTrack tracks = 4;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// message TrackUpdate
|
||||
// {
|
||||
// messages.track.Identifier TrackID = 1;
|
||||
// string Name = 2;
|
||||
// messages.track.EntityGeocentricPosition position = 3;
|
||||
// double distance = 4;
|
||||
// double bearing = 5;
|
||||
// }
|
||||
@@ -29,7 +29,9 @@ namespace SimCore
|
||||
|
||||
SimTrack(SimCore::Identifier id, WHISPER::SourceType sourcetype, SimCore::Kind::EntityKind entityKind,SimCore::Side::EntitySide Side);
|
||||
|
||||
~SimTrack();
|
||||
SimTrack(messages::SimTrack::SimTrack message);
|
||||
|
||||
// ~SimTrack();
|
||||
|
||||
/// @brief
|
||||
/// @param pos
|
||||
@@ -57,8 +59,10 @@ namespace SimCore
|
||||
/// @return returns the amout of emission
|
||||
size_t coutEmissions();
|
||||
|
||||
/// @brief return the proto message for a simtrack
|
||||
messages::SimTrack::SimTrack getSimTrackMessage();
|
||||
|
||||
/// @brief return a WHISPER Message out of a simtrack object
|
||||
/// @param parentID
|
||||
/// @return WHISPER::Message
|
||||
WHISPER::Message buildMessage();
|
||||
|
||||
@@ -72,6 +76,11 @@ namespace SimCore
|
||||
/// @return SimTrack Oject
|
||||
static std::unique_ptr<SimCore::SimTrack> unpack(std::string msgString);
|
||||
|
||||
/// @brief creates a SimTrack out of a string message
|
||||
/// @param msg
|
||||
/// @return SimTrack Oject
|
||||
static std::unique_ptr<SimCore::SimTrack> unpack(messages::SimTrack::SimTrack message);
|
||||
|
||||
public:
|
||||
Data<std::string> Name;
|
||||
Data<double> Speed;
|
||||
|
||||
45
include/SimCore/Messages/SystemStateUpdate.hpp
Normal file
45
include/SimCore/Messages/SystemStateUpdate.hpp
Normal file
@@ -0,0 +1,45 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
#include "SimCore/EffectorData.hpp"
|
||||
#include "SimCore/Identifier.hpp"
|
||||
#include "SimCore/SensorData.hpp"
|
||||
#include "WHISPER/Messages/Message.hpp"
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
namespace SimCore
|
||||
{
|
||||
|
||||
|
||||
class SystemStateUpdate
|
||||
{
|
||||
public:
|
||||
SystemStateUpdate(const SimCore::Identifier OwnID);
|
||||
SimCore::Identifier getOwnID();
|
||||
|
||||
void addSensorData(SimCore::SensorData data);
|
||||
|
||||
void addEffectorData(SimCore::EffectorData data);
|
||||
|
||||
/// @brief return a WHISPER Message out of a simtrack object
|
||||
/// @return WHISPER::Message
|
||||
WHISPER::Message buildMessage();
|
||||
|
||||
/// @brief creates a SimTrack out of a whisper message
|
||||
/// @param msg
|
||||
/// @return SimTrack Oject
|
||||
static std::unique_ptr<SystemStateUpdate> unpack(WHISPER::Message msg);
|
||||
|
||||
std::vector<SensorData> getSensorData();
|
||||
std::vector<EffectorData> getEffectorData();
|
||||
|
||||
|
||||
private:
|
||||
const SimCore::Identifier OwnID;
|
||||
|
||||
std::vector<SensorData> SensorData_;
|
||||
std::vector<EffectorData> EffectorData_;
|
||||
};
|
||||
|
||||
}
|
||||
32
include/SimCore/Messages/TracklistUpdate.hpp
Normal file
32
include/SimCore/Messages/TracklistUpdate.hpp
Normal file
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
#include "SimCore/Identifier.hpp"
|
||||
#include "SimCore/Messages/SimTrack.hpp"
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
namespace SimCore
|
||||
{
|
||||
class TracklistUpdate
|
||||
{
|
||||
public:
|
||||
TracklistUpdate(const SimCore::Identifier OwnID);
|
||||
SimCore::Identifier getOwnID();
|
||||
void addTrack(SimCore::SimTrack track);
|
||||
std::vector<SimTrack> getTracks();
|
||||
|
||||
WHISPER::Message buildMessage();
|
||||
|
||||
/// @brief creates a SimTrack out of a whisper message
|
||||
/// @param msg
|
||||
/// @return SimTrack Oject
|
||||
static std::unique_ptr<TracklistUpdate> unpack(WHISPER::Message msg);
|
||||
|
||||
private:
|
||||
const SimCore::Identifier OwnID_;
|
||||
std::vector<SimTrack> tracks_;
|
||||
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
@@ -47,7 +47,10 @@ namespace SimCore {
|
||||
std::tuple<double, double> distanceBearingToPosition(Position &p2);
|
||||
|
||||
|
||||
|
||||
|
||||
bool operator== ( Position &lhs);
|
||||
friend bool operator==(const Position& lhs, const Position& rhs);
|
||||
Position& operator=(const Position other);
|
||||
|
||||
|
||||
@@ -67,4 +70,6 @@ namespace SimCore {
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
}
|
||||
27
include/SimCore/SensorData.hpp
Normal file
27
include/SimCore/SensorData.hpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
|
||||
#include "SimCore/Identifier.hpp"
|
||||
#include "SimCore/SimCore.hpp"
|
||||
#include "SimCore/data.hpp"
|
||||
#include <string>
|
||||
namespace SimCore
|
||||
{
|
||||
class SensorData
|
||||
{
|
||||
public:
|
||||
SensorData(const SimCore::Identifier sensorID, const std::string Name);
|
||||
|
||||
|
||||
|
||||
|
||||
public:
|
||||
const SimCore::Identifier SensorID;
|
||||
Data<std::string> Name;
|
||||
Data<double> Range;
|
||||
Data<std::uint32_t> SensorKind;
|
||||
Data<std::uint32_t> Status;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -84,6 +84,25 @@ namespace Kind {
|
||||
};
|
||||
}
|
||||
|
||||
enum Status : std::uint32_t{
|
||||
ACTIVE,
|
||||
OFF,
|
||||
INTAKT,
|
||||
DEFEKT,
|
||||
DEGRADED
|
||||
|
||||
};
|
||||
|
||||
|
||||
static std::map<std::uint32_t, std::string> StatusMap =
|
||||
{
|
||||
{ACTIVE, "Active"},
|
||||
{OFF, "Off"},
|
||||
{INTAKT, "Intakt" },
|
||||
{DEFEKT, "Defekt"},
|
||||
{DEGRADED, "Degraded"},
|
||||
};
|
||||
|
||||
enum SensorKinds : std::uint32_t {
|
||||
RADAR = 1,
|
||||
ELOKA,
|
||||
|
||||
Submodule libs/whisper-com updated: 113b37b3e6...f46706aec7
15
src/SimCore/EffectorData.cpp
Normal file
15
src/SimCore/EffectorData.cpp
Normal file
@@ -0,0 +1,15 @@
|
||||
#include <SimCore/EffectorData.hpp>
|
||||
|
||||
namespace SimCore
|
||||
{
|
||||
|
||||
|
||||
EffectorData::EffectorData(const SimCore::Identifier effctorID, const std::string name)
|
||||
:EffectorID(effctorID),Name(name)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
#include "SimCore/Identifier.hpp"
|
||||
#include "SimCore/Position.hpp"
|
||||
#include "SimCore/SimCore.hpp"
|
||||
#include "WHISPER/Messages/Message.hpp"
|
||||
@@ -65,11 +66,118 @@ namespace SimCore
|
||||
RCS.setValue(0);
|
||||
}
|
||||
|
||||
|
||||
SimTrack::~SimTrack()
|
||||
SimTrack::SimTrack(messages::SimTrack::SimTrack trackMsg)
|
||||
:ID_(SimCore::Identifier(trackMsg.entityidentifier()))
|
||||
{
|
||||
|
||||
WHISPER::SourceType sourcetype = (WHISPER::SourceType)trackMsg.contactsourcetype();
|
||||
|
||||
SimCore::Kind::EntityKind entityKind = SimCore::Kind::UNKNOWN;
|
||||
if (trackMsg.has_contactkind())
|
||||
{
|
||||
entityKind = (SimCore::Kind::EntityKind)trackMsg.contactkind();
|
||||
}
|
||||
|
||||
SimCore::Side::EntitySide entitySide = SimCore::Side::UNKNOWN;
|
||||
if (trackMsg.has_contactside())
|
||||
{
|
||||
entitySide = (SimCore::Side::EntitySide)trackMsg.contactside();
|
||||
}
|
||||
|
||||
|
||||
// SimCore::SimTrack track(id,trackMsg.conatactname(),entityKind,entitySide);
|
||||
|
||||
if (trackMsg.has_contactsourcetype())
|
||||
{
|
||||
this->SourceType.setValue((WHISPER::SourceType)trackMsg.contactsourcetype());
|
||||
}
|
||||
|
||||
if (trackMsg.has_geocentricposition())
|
||||
{
|
||||
this->setPosition(trackMsg.mutable_geocentricposition()->x(), trackMsg.mutable_geocentricposition()->y(), trackMsg.mutable_geocentricposition()->z());
|
||||
}else
|
||||
{
|
||||
Position tmpPos;
|
||||
tmpPos.setGeodesicPos(0, 0, 0);
|
||||
this->setPosition(tmpPos);
|
||||
}
|
||||
|
||||
if (trackMsg.has_contactcourse())
|
||||
{
|
||||
this->Course.setValue(trackMsg.contactcourse());
|
||||
}else
|
||||
{
|
||||
this->Course.setValue(0);
|
||||
}
|
||||
|
||||
if (trackMsg.has_contactspeed())
|
||||
{
|
||||
this->Speed.setValue(trackMsg.contactspeed());
|
||||
}else
|
||||
{
|
||||
this->Speed.setValue(0);
|
||||
}
|
||||
|
||||
if (trackMsg.has_conactpitch())
|
||||
{
|
||||
this->Pitch.setValue(trackMsg.conactpitch());
|
||||
}else {
|
||||
this->Pitch.setValue(0);
|
||||
}
|
||||
|
||||
if (trackMsg.has_contactrcs())
|
||||
{
|
||||
this->RCS.setValue(trackMsg.contactrcs());
|
||||
}else
|
||||
{
|
||||
switch (entityKind)
|
||||
{
|
||||
case SimCore::Kind::EntityKind::AIR:
|
||||
{
|
||||
this->RCS.setValue(RCS_AIR);
|
||||
|
||||
break;
|
||||
}
|
||||
case SimCore::Kind::EntityKind::LAND:
|
||||
{
|
||||
this->RCS.setValue(RCS_LAND);
|
||||
break;
|
||||
}
|
||||
case SimCore::Kind::EntityKind::SURFACE:
|
||||
{
|
||||
this->RCS.setValue(RCS_SURFACE);
|
||||
break;
|
||||
}
|
||||
case SimCore::Kind::EntityKind::SPACE:
|
||||
{
|
||||
this->RCS.setValue(RCS_SPACE);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
this->RCS.setValue(RCS_DEFAULT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < trackMsg.contactemissions_size(); i++)
|
||||
{
|
||||
const messages::SimTrack::Emission* emission = trackMsg.mutable_contactemissions(i);
|
||||
auto obj = SimCore::Emission::unpackEmission(*emission);
|
||||
this->addEmission(obj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// SimTrack::~SimTrack()
|
||||
// {
|
||||
// }
|
||||
|
||||
const SimCore::Identifier SimTrack::getIdentifier()
|
||||
{
|
||||
return ID_;
|
||||
@@ -92,18 +200,13 @@ namespace SimCore
|
||||
return position_;
|
||||
}
|
||||
|
||||
|
||||
WHISPER::Message SimTrack::buildMessage()
|
||||
messages::SimTrack::SimTrack SimTrack::getSimTrackMessage()
|
||||
{
|
||||
WHISPER::Message msg(ID_.getUUID(),WHISPER::MsgTopics::TRACK , WHISPER::MsgType::SIM_TRACK);
|
||||
|
||||
|
||||
messages::SimTrack::SimTrack SimTrack;
|
||||
|
||||
if (Name.isValid()) SimTrack.set_conatactname(Name.getValue());
|
||||
else SimTrack.set_conatactname(" ");
|
||||
|
||||
|
||||
if (position_.isValid())
|
||||
{
|
||||
SimTrack.mutable_geocentricposition()->set_x(position_.getGeocentricPos()(SimCore::X));
|
||||
@@ -125,13 +228,26 @@ namespace SimCore
|
||||
std::vector<std::shared_ptr<Emission>>::iterator it;
|
||||
for( it = EmissionList.begin(); it != EmissionList.end(); it++)
|
||||
{
|
||||
|
||||
auto emissionMsg = it->get()->packEmission();
|
||||
SimTrack.add_contactemissions()->CopyFrom(emissionMsg);
|
||||
|
||||
}
|
||||
// SimTrack.mutable_timestamp()->set_seconds(time(NULL));
|
||||
|
||||
|
||||
return SimTrack;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
WHISPER::Message SimTrack::buildMessage()
|
||||
{
|
||||
WHISPER::Message msg(ID_.getUUID(),WHISPER::MsgTopics::TRACK , WHISPER::MsgType::SIM_TRACK);
|
||||
|
||||
|
||||
messages::SimTrack::SimTrack SimTrack = this->getSimTrackMessage();
|
||||
|
||||
|
||||
auto any = std::make_shared<google::protobuf::Any>();
|
||||
|
||||
any->PackFrom(SimTrack);
|
||||
@@ -154,111 +270,7 @@ namespace SimCore
|
||||
m.payload().UnpackTo(&trackMsg);
|
||||
}
|
||||
|
||||
SimCore::Identifier id(*trackMsg.mutable_entityidentifier());
|
||||
|
||||
|
||||
WHISPER::SourceType sourcetype = (WHISPER::SourceType)trackMsg.contactsourcetype();
|
||||
|
||||
SimCore::Kind::EntityKind entityKind = SimCore::Kind::UNKNOWN;
|
||||
if (trackMsg.has_contactkind())
|
||||
{
|
||||
entityKind = (SimCore::Kind::EntityKind)trackMsg.contactkind();
|
||||
}
|
||||
|
||||
SimCore::Side::EntitySide entitySide = SimCore::Side::UNKNOWN;
|
||||
if (trackMsg.has_contactside())
|
||||
{
|
||||
entitySide = (SimCore::Side::EntitySide)trackMsg.contactside();
|
||||
}
|
||||
|
||||
|
||||
SimCore::SimTrack track(id,trackMsg.conatactname(),entityKind,entitySide);
|
||||
|
||||
if (trackMsg.has_contactsourcetype())
|
||||
{
|
||||
track.SourceType.setValue((WHISPER::SourceType)trackMsg.contactsourcetype());
|
||||
}
|
||||
|
||||
if (trackMsg.has_geocentricposition())
|
||||
{
|
||||
track.setPosition(trackMsg.mutable_geocentricposition()->x(), trackMsg.mutable_geocentricposition()->y(), trackMsg.mutable_geocentricposition()->z());
|
||||
}else
|
||||
{
|
||||
Position tmpPos;
|
||||
tmpPos.setGeodesicPos(0, 0, 0);
|
||||
track.setPosition(tmpPos);
|
||||
}
|
||||
|
||||
if (trackMsg.has_contactcourse())
|
||||
{
|
||||
track.Course.setValue(trackMsg.contactcourse());
|
||||
}else
|
||||
{
|
||||
track.Course.setValue(0);
|
||||
}
|
||||
|
||||
if (trackMsg.has_contactspeed())
|
||||
{
|
||||
track.Speed.setValue(trackMsg.contactspeed());
|
||||
}else
|
||||
{
|
||||
track.Speed.setValue(0);
|
||||
}
|
||||
|
||||
if (trackMsg.has_conactpitch())
|
||||
{
|
||||
track.Pitch.setValue(trackMsg.conactpitch());
|
||||
}else {
|
||||
track.Pitch.setValue(0);
|
||||
}
|
||||
|
||||
if (trackMsg.has_contactrcs())
|
||||
{
|
||||
track.RCS.setValue(trackMsg.contactrcs());
|
||||
}else
|
||||
{
|
||||
switch (entityKind)
|
||||
{
|
||||
case SimCore::Kind::EntityKind::AIR:
|
||||
{
|
||||
track.RCS.setValue(RCS_AIR);
|
||||
|
||||
break;
|
||||
}
|
||||
case SimCore::Kind::EntityKind::LAND:
|
||||
{
|
||||
track.RCS.setValue(RCS_LAND);
|
||||
break;
|
||||
}
|
||||
case SimCore::Kind::EntityKind::SURFACE:
|
||||
{
|
||||
track.RCS.setValue(RCS_SURFACE);
|
||||
break;
|
||||
}
|
||||
case SimCore::Kind::EntityKind::SPACE:
|
||||
{
|
||||
track.RCS.setValue(RCS_SPACE);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
track.RCS.setValue(RCS_DEFAULT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (int i = 0; i < trackMsg.contactemissions_size(); i++)
|
||||
{
|
||||
const messages::SimTrack::Emission* emission = trackMsg.mutable_contactemissions(i);
|
||||
auto obj = SimCore::Emission::unpackEmission(*emission);
|
||||
track.addEmission(obj);
|
||||
}
|
||||
|
||||
|
||||
return track;
|
||||
return SimTrack(trackMsg);
|
||||
}
|
||||
|
||||
|
||||
@@ -275,6 +287,15 @@ namespace SimCore
|
||||
}
|
||||
|
||||
|
||||
std::unique_ptr<SimCore::SimTrack> SimTrack::unpack(messages::SimTrack::SimTrack trackMsg)
|
||||
{
|
||||
|
||||
|
||||
return std::make_unique<SimTrack>(trackMsg);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void SimTrack::addEmission(Emission emission)
|
||||
|
||||
112
src/SimCore/Messages/SystemStateUpdate.cpp
Normal file
112
src/SimCore/Messages/SystemStateUpdate.cpp
Normal file
@@ -0,0 +1,112 @@
|
||||
#include "SimCore/EffectorData.hpp"
|
||||
#include "SimCore/Identifier.hpp"
|
||||
#include "SimCore/Messages/Protos/SystemStateUpdate.pb.h"
|
||||
#include "SimCore/SensorData.hpp"
|
||||
#include <SimCore/Messages/SystemStateUpdate.hpp>
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
|
||||
|
||||
namespace SimCore {
|
||||
|
||||
|
||||
SystemStateUpdate::SystemStateUpdate(const SimCore::Identifier ownID):OwnID(ownID)
|
||||
{
|
||||
|
||||
}
|
||||
SimCore::Identifier SystemStateUpdate::getOwnID()
|
||||
{
|
||||
return OwnID;
|
||||
}
|
||||
|
||||
void SystemStateUpdate::addSensorData(SimCore::SensorData data)
|
||||
{
|
||||
SensorData_.push_back(data);
|
||||
}
|
||||
|
||||
void SystemStateUpdate::addEffectorData(SimCore::EffectorData data)
|
||||
{
|
||||
EffectorData_.push_back(data);
|
||||
}
|
||||
|
||||
|
||||
WHISPER::Message SystemStateUpdate::buildMessage()
|
||||
{
|
||||
WHISPER::Message msg(OwnID.getUUID(),WHISPER::MsgTopics::DATA , WHISPER::MsgType::SYSTEMSTATE_UPDATE);
|
||||
|
||||
messages::data::SystemStateUpdate message;
|
||||
message.mutable_ownid()->set_uuid(OwnID.getUUID());
|
||||
message.mutable_ownid()->set_external(OwnID.isExternal());
|
||||
|
||||
for(auto &sensor : SensorData_)
|
||||
{
|
||||
messages::data::Sensor *s = message.add_sensors();
|
||||
s->set_name(sensor.Name.getValue());
|
||||
s->mutable_id()->set_uuid(sensor.SensorID.getUUID());
|
||||
s->mutable_id()->set_external(sensor.SensorID.isExternal());
|
||||
s->set_kind(sensor.SensorKind.getValue());
|
||||
s->set_range(sensor.Range.getValue());
|
||||
s->set_status(sensor.Status.getValue());
|
||||
|
||||
}
|
||||
for(auto &effector : EffectorData_)
|
||||
{
|
||||
messages::data::Effector *e = message.add_effectors();
|
||||
e->mutable_id()->set_uuid(effector.EffectorID.getUUID());
|
||||
e->set_name(effector.Name.getValue());
|
||||
|
||||
}
|
||||
|
||||
auto any = std::make_shared<google::protobuf::Any>();
|
||||
|
||||
any->PackFrom(message);
|
||||
msg.addPayLoad(any);
|
||||
|
||||
return msg;
|
||||
|
||||
}
|
||||
|
||||
|
||||
std::unique_ptr<SystemStateUpdate> SystemStateUpdate::unpack(WHISPER::Message msg)
|
||||
{
|
||||
auto m = msg.getProtoMessage();
|
||||
|
||||
auto UpdateMessage = messages::data::SystemStateUpdate();
|
||||
if(!m.payload().Is<messages::data::SystemStateUpdate>())
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
m.payload().UnpackTo(&UpdateMessage);
|
||||
|
||||
std::unique_ptr<SystemStateUpdate> obj = std::make_unique<SystemStateUpdate>(SimCore::Identifier( UpdateMessage.ownid()));
|
||||
|
||||
for(auto sensor: UpdateMessage.sensors())
|
||||
{
|
||||
SensorData data(SimCore::Identifier(sensor.id()),sensor.name());
|
||||
data.SensorKind.setValue(sensor.kind());
|
||||
data.Range.setValue(sensor.range());
|
||||
data.Status.setValue(sensor.status());
|
||||
obj->addSensorData(data);
|
||||
}
|
||||
|
||||
for(auto effector: UpdateMessage.effectors())
|
||||
{
|
||||
EffectorData data(SimCore::Identifier(effector.id()),effector.name());
|
||||
|
||||
obj->addEffectorData(data);
|
||||
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
std::vector<SensorData> SystemStateUpdate::getSensorData()
|
||||
{
|
||||
return this->SensorData_;
|
||||
}
|
||||
std::vector<EffectorData> SystemStateUpdate::getEffectorData()
|
||||
{
|
||||
return this->EffectorData_;
|
||||
}
|
||||
|
||||
}
|
||||
76
src/SimCore/Messages/TracklistUpdate.cpp
Normal file
76
src/SimCore/Messages/TracklistUpdate.cpp
Normal file
@@ -0,0 +1,76 @@
|
||||
#include "SimCore/Messages/SimTrack.hpp"
|
||||
#include <SimCore/Messages/TracklistUpdate.hpp>
|
||||
#include <SimCore/Messages/Protos/TracklistUpdate.pb.h>
|
||||
|
||||
namespace SimCore
|
||||
{
|
||||
TracklistUpdate::TracklistUpdate(const SimCore::Identifier OwnID)
|
||||
:OwnID_(OwnID)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
SimCore::Identifier TracklistUpdate::getOwnID()
|
||||
{
|
||||
return OwnID_;
|
||||
}
|
||||
|
||||
void TracklistUpdate::addTrack(SimCore::SimTrack track)
|
||||
{
|
||||
tracks_.push_back(track);
|
||||
}
|
||||
|
||||
std::vector<SimTrack> TracklistUpdate::getTracks()
|
||||
{
|
||||
return tracks_;
|
||||
}
|
||||
|
||||
WHISPER::Message TracklistUpdate::buildMessage()
|
||||
{
|
||||
WHISPER::Message msg(OwnID_.getUUID(),WHISPER::MsgTopics::DATA , WHISPER::MsgType::TRACKLIST_UPDATE);
|
||||
messages::data::TracklistUpdate message;
|
||||
message.mutable_ownid()->set_uuid(OwnID_.getUUID());
|
||||
message.mutable_ownid()->set_external(OwnID_.isExternal());
|
||||
|
||||
for(auto &track : tracks_)
|
||||
{
|
||||
message.mutable_tracks()->Add(track.getSimTrackMessage());
|
||||
}
|
||||
|
||||
|
||||
auto any = std::make_shared<google::protobuf::Any>();
|
||||
|
||||
any->PackFrom(message);
|
||||
msg.addPayLoad(any);
|
||||
|
||||
return msg;
|
||||
|
||||
}
|
||||
|
||||
|
||||
std::unique_ptr<TracklistUpdate> TracklistUpdate::unpack(WHISPER::Message msg)
|
||||
{
|
||||
auto m = msg.getProtoMessage();
|
||||
|
||||
auto UpdateMessage = messages::data::TracklistUpdate();
|
||||
if(!m.payload().Is<messages::data::TracklistUpdate>())
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
m.payload().UnpackTo(&UpdateMessage);
|
||||
|
||||
std::unique_ptr<TracklistUpdate> obj = std::make_unique<TracklistUpdate>(SimCore::Identifier( UpdateMessage.ownid()));
|
||||
|
||||
for(auto track: UpdateMessage.tracks())
|
||||
{
|
||||
obj->addTrack(SimTrack(track));
|
||||
}
|
||||
|
||||
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -131,6 +131,18 @@ namespace SimCore {
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool operator==(const Position& lhs, const Position& rhs)
|
||||
{
|
||||
|
||||
if (lhs.GeocentricPos_ == rhs.GeocentricPos_) {
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Position& Position::operator=(const Position other)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(other.mx);
|
||||
|
||||
11
src/SimCore/SensorData.cpp
Normal file
11
src/SimCore/SensorData.cpp
Normal file
@@ -0,0 +1,11 @@
|
||||
#include <SimCore/SensorData.hpp>
|
||||
|
||||
|
||||
|
||||
namespace SimCore
|
||||
{
|
||||
SensorData::SensorData(const SimCore::Identifier sensorID, const std::string Name):
|
||||
SensorID(sensorID),Name(Name)
|
||||
{}
|
||||
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
|
||||
#include <thread>
|
||||
#define CATCH_CONFIG_MAIN
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
@@ -24,7 +25,8 @@ SCENARIO("Testing the SimCore Sensor")
|
||||
THEN("check if Track attributes are correct")
|
||||
{
|
||||
REQUIRE(Name.getValue() == "hello world");
|
||||
REQUIRE(Name.getValidity() == true);
|
||||
REQUIRE(Name.isValid() == true);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
REQUIRE(Name.getWriteTime() < std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count());
|
||||
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ SCENARIO("Testing the SimCorePositionClass")
|
||||
REQUIRE(std::abs(pos1b.getGeocentricPos()(SimCore::Z) - GeocentPos1(SimCore::Z)) <= 0.001);
|
||||
|
||||
|
||||
REQUIRE(pos2.getGeocentricPos() == pos1.getGeocentricPos());
|
||||
REQUIRE(pos2 == pos1);
|
||||
REQUIRE(pos2.getGeodesicPos() == pos1.getGeodesicPos());
|
||||
|
||||
|
||||
|
||||
72
tests/test_SystemStateUpdate.cpp
Normal file
72
tests/test_SystemStateUpdate.cpp
Normal file
@@ -0,0 +1,72 @@
|
||||
|
||||
#include "SimCore/EffectorData.hpp"
|
||||
#include "SimCore/Identifier.hpp"
|
||||
#include "SimCore/SimCore.hpp"
|
||||
#include "WHISPER/Messages/Message.hpp"
|
||||
#define CATCH_CONFIG_MAIN
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <SimCore/Messages/SystemStateUpdate.hpp>
|
||||
|
||||
|
||||
SCENARIO("Testing the SimCore Sensor")
|
||||
{
|
||||
GIVEN("different Attributes for a Track in different forms")
|
||||
{
|
||||
|
||||
SimCore::Identifier OwnID;
|
||||
|
||||
SimCore::SystemStateUpdate update(OwnID);
|
||||
|
||||
SimCore::Identifier Idsensor1;
|
||||
std::string NameSensor1 = "TRS3D";
|
||||
SimCore::SensorData sensor1(Idsensor1,NameSensor1);
|
||||
sensor1.SensorKind.setValue(SimCore::SensorKinds::RADAR);
|
||||
sensor1.Range.setValue(120000);
|
||||
sensor1.Status.setValue(SimCore::Status::ACTIVE);
|
||||
update.addSensorData(sensor1);
|
||||
|
||||
|
||||
SimCore::Identifier Idsensor2;
|
||||
std::string NameSensor2 = "Smart-S";
|
||||
SimCore::SensorData sensor2(Idsensor2,NameSensor2);
|
||||
sensor1.SensorKind.setValue(SimCore::SensorKinds::RADAR);
|
||||
sensor1.Range.setValue(90000);
|
||||
sensor1.Status.setValue(SimCore::Status::OFF);
|
||||
update.addSensorData(sensor1);
|
||||
|
||||
SimCore::Identifier Ideffector1;
|
||||
std::string NameEffector1 = "MLG";
|
||||
|
||||
SimCore::EffectorData effector1(Ideffector1,NameEffector1);
|
||||
update.addEffectorData(effector1);
|
||||
|
||||
|
||||
|
||||
|
||||
auto msg = update.buildMessage().serialize();
|
||||
|
||||
auto resMess = WHISPER::Message(msg);
|
||||
auto resUpdate = SimCore::SystemStateUpdate::unpack(resMess);
|
||||
WHEN("constructing Track Object with data")
|
||||
{
|
||||
|
||||
THEN("check if Track attributes are correct")
|
||||
{
|
||||
REQUIRE(resMess.msgType_ == WHISPER::MsgType::SYSTEMSTATE_UPDATE);
|
||||
REQUIRE(resUpdate->getOwnID() == OwnID);
|
||||
REQUIRE(resUpdate->getSensorData().size() == 2);
|
||||
REQUIRE(resUpdate->getEffectorData().size() == 1);
|
||||
REQUIRE(resUpdate->getEffectorData()[0].EffectorID == effector1.EffectorID);
|
||||
REQUIRE(resUpdate->getEffectorData()[0].Name.getValue() == NameEffector1);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} //THEN
|
||||
} // WHEN
|
||||
} // GIVEN
|
||||
} //SCENARIO
|
||||
59
tests/test_TracklistUpdate.cpp
Normal file
59
tests/test_TracklistUpdate.cpp
Normal file
@@ -0,0 +1,59 @@
|
||||
|
||||
#include "SimCore/Identifier.hpp"
|
||||
#include "SimCore/Messages/SimTrack.hpp"
|
||||
#include "SimCore/Position.hpp"
|
||||
#define CATCH_CONFIG_MAIN
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <SimCore/Messages/TracklistUpdate.hpp>
|
||||
|
||||
|
||||
SCENARIO("Testing the SimCore Sensor")
|
||||
{
|
||||
GIVEN("different Attributes for a Track in different forms")
|
||||
{
|
||||
SimCore::Identifier OwnID;
|
||||
SimCore::TracklistUpdate update(OwnID);
|
||||
SimCore::SimTrack track1;
|
||||
track1.Course.setValue(273);
|
||||
track1.Speed.setValue(11);
|
||||
track1.Pitch.setValue(45);
|
||||
|
||||
SimCore::Position pos1;
|
||||
pos1.setGeodesicPos(55, 10, 0);
|
||||
track1.setPosition(pos1);
|
||||
|
||||
update.addTrack(track1);
|
||||
|
||||
|
||||
WHEN("constructing Track Object with data")
|
||||
{
|
||||
|
||||
auto msg = update.buildMessage().serialize();
|
||||
|
||||
auto resMess = WHISPER::Message(msg);
|
||||
auto resUpdate = SimCore::TracklistUpdate::unpack(resMess);
|
||||
|
||||
THEN("check if Track attributes are correct")
|
||||
{
|
||||
REQUIRE(update.getOwnID() == OwnID);
|
||||
REQUIRE(update.getTracks().size() == 1);
|
||||
REQUIRE(resMess.msgType_ == WHISPER::MsgType::TRACKLIST_UPDATE);
|
||||
REQUIRE(resUpdate->getOwnID() == OwnID);
|
||||
REQUIRE(resUpdate->getTracks().size() == 1);
|
||||
REQUIRE(resUpdate->getTracks()[0].getIdentifier() == track1.getIdentifier());
|
||||
REQUIRE(resUpdate->getTracks()[0].Course.getValue() == 273);
|
||||
REQUIRE(resUpdate->getTracks()[0].Speed.getValue() == 11);
|
||||
REQUIRE(resUpdate->getTracks()[0].Pitch.getValue() == 45);
|
||||
REQUIRE(resUpdate->getTracks()[0].getPosition() == pos1);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} //THEN
|
||||
} // WHEN
|
||||
} // GIVEN
|
||||
} //SCENARIO
|
||||
Reference in New Issue
Block a user