ADD: added new version of Orders and a first use in the entity base class

This commit is contained in:
Henry Winkel
2023-07-06 09:29:11 +02:00
parent 3333fadf20
commit 89665f3ce7
12 changed files with 263 additions and 474 deletions

View File

@@ -79,6 +79,7 @@ SimCore
eigen eigen
loguru loguru
nlohmann_json nlohmann_json
OrderLibrary
) )
# add_dependencies(SimCore protoc) # add_dependencies(SimCore protoc)

View File

@@ -1,7 +1,9 @@
#pragma once #pragma once
#include "SimCore/data.hpp"
#include <Orders/Order.hpp> #include <Orders/Order.hpp>
#include <SimCore/Position.hpp> #include <SimCore/Position.hpp>
#include <iterator>
#include <memory> #include <memory>
namespace Orders namespace Orders
@@ -9,33 +11,33 @@ namespace Orders
class MoveOrder: public Order class MoveOrder: public Order
{ {
public: public:
MoveOrder(const SimCore::Identifier id,const SimCore::Identifier orderingEntity,const SimCore::Identifier orderedEntity,WHISPER::SourceType srcType); MoveOrder(const SimCore::Identifier OwnID, WHISPER::SourceType srcType);
MoveOrder(const SimCore::Identifier id,const SimCore::Identifier orderingEntity,const SimCore::Identifier orderedEntity,WHISPER::SourceType srcType,SimCore::Position pos,double speed = 0, int startTime = 0); MoveOrder(const SimCore::Identifier OwnID,WHISPER::SourceType srcType,SimCore::Position pos,double speed = 0,double course = 0, int startTime = 0);
~MoveOrder(); ~MoveOrder();
void addData(SimCore::Position pos,double speed = 0, int startTime = 0);
void setPosition(SimCore::Position pos); void setPosition(SimCore::Position pos);
void setSpeed(double speed);
void setStartTime(uint64_t startTime);
SimCore::Position getPosition(); SimCore::Position getPosition();
double getSpeed();
uint64_t getStartTime();
virtual WHISPER::Message buildMessage(SimCore::Identifier parentID) override; virtual WHISPER::Message buildMessage() override;
static std::shared_ptr<MoveOrder> unpack(WHISPER::Message msg); static std::unique_ptr<MoveOrder> unpack(WHISPER::Message msg);
static std::unique_ptr<MoveOrder> unpack(std::string msg);
SimCore::Data<double> Course;
SimCore::Data<double> Speed;
SimCore::Data<uint64_t> StartTime;
private: private:
SimCore::Position pos_; SimCore::Position pos_;
double speed_ = 0;
uint64_t startTime_ = 0;
}; };

View File

@@ -16,26 +16,25 @@ namespace Orders
class Order class Order
{ {
public: public:
Order(const SimCore::Identifier id,const SimCore::Identifier orderingEntity,const SimCore::Identifier orderedEntity,const WHISPER::SourceType srcType, const Orders::OrderType OrderType_); Order(const SimCore::Identifier OwnID,const WHISPER::SourceType srcType, const Orders::OrderType OrderType_);
const SimCore::Identifier getOrderID(); const SimCore::Identifier getOrderID();
const SimCore::Identifier getOrderingEntity(); const SimCore::Identifier getOwnID();
const SimCore::Identifier getOrderedEntity();
const WHISPER::SourceType srcType; const WHISPER::SourceType srcType;
const Orders::OrderType getOrderType(); const Orders::OrderType getOrderType();
protected: protected:
virtual WHISPER::Message buildMessage(SimCore::Identifier parentID) = 0; virtual WHISPER::Message buildMessage() = 0;
private: private:
const SimCore::Identifier orderID_; const SimCore::Identifier orderID_;
const SimCore::Identifier orderingEntity_; const SimCore::Identifier OwnID_;
const SimCore::Identifier orderedEntity_;
const Orders::OrderType OrderType_; const Orders::OrderType OrderType_;

View File

@@ -29,7 +29,8 @@ PROTOBUF_CONSTEXPR MoveOrder::MoveOrder(
, /*decltype(_impl_._cached_size_)*/{} , /*decltype(_impl_._cached_size_)*/{}
, /*decltype(_impl_.geocentricposition_)*/nullptr , /*decltype(_impl_.geocentricposition_)*/nullptr
, /*decltype(_impl_.startingtime_)*/nullptr , /*decltype(_impl_.startingtime_)*/nullptr
, /*decltype(_impl_.speed_)*/0} {} , /*decltype(_impl_.speed_)*/0
, /*decltype(_impl_.course_)*/0} {}
struct MoveOrderDefaultTypeInternal { struct MoveOrderDefaultTypeInternal {
PROTOBUF_CONSTEXPR MoveOrderDefaultTypeInternal() PROTOBUF_CONSTEXPR MoveOrderDefaultTypeInternal()
: _instance(::_pbi::ConstantInitialized{}) {} : _instance(::_pbi::ConstantInitialized{}) {}
@@ -55,13 +56,15 @@ const uint32_t TableStruct_MoveOrder_2eproto::offsets[] PROTOBUF_SECTION_VARIABL
~0u, // no _inlined_string_donated_ ~0u, // no _inlined_string_donated_
PROTOBUF_FIELD_OFFSET(::messages::entity::order::MoveOrder, _impl_.geocentricposition_), PROTOBUF_FIELD_OFFSET(::messages::entity::order::MoveOrder, _impl_.geocentricposition_),
PROTOBUF_FIELD_OFFSET(::messages::entity::order::MoveOrder, _impl_.speed_), PROTOBUF_FIELD_OFFSET(::messages::entity::order::MoveOrder, _impl_.speed_),
PROTOBUF_FIELD_OFFSET(::messages::entity::order::MoveOrder, _impl_.course_),
PROTOBUF_FIELD_OFFSET(::messages::entity::order::MoveOrder, _impl_.startingtime_), PROTOBUF_FIELD_OFFSET(::messages::entity::order::MoveOrder, _impl_.startingtime_),
~0u,
1,
0, 0,
2,
3,
1,
}; };
static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
{ 0, 9, -1, sizeof(::messages::entity::order::MoveOrder)}, { 0, 10, -1, sizeof(::messages::entity::order::MoveOrder)},
}; };
static const ::_pb::Message* const file_default_instances[] = { static const ::_pb::Message* const file_default_instances[] = {
@@ -71,12 +74,13 @@ static const ::_pb::Message* const file_default_instances[] = {
const char descriptor_table_protodef_MoveOrder_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = const char descriptor_table_protodef_MoveOrder_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) =
"\n\017MoveOrder.proto\022\025messages.entity.order" "\n\017MoveOrder.proto\022\025messages.entity.order"
"\032\030GeocentricPosition.proto\032\037google/proto" "\032\030GeocentricPosition.proto\032\037google/proto"
"buf/timestamp.proto\"\267\001\n\tMoveOrder\022D\n\022Geo" "buf/timestamp.proto\"\363\001\n\tMoveOrder\022I\n\022Geo"
"centricPosition\030\001 \001(\0132(.messages.track.E" "centricPosition\030\001 \001(\0132(.messages.track.E"
"ntityGeocentricPosition\022\022\n\005speed\030\002 \001(\001H\000" "ntityGeocentricPositionH\000\210\001\001\022\022\n\005speed\030\002 "
"\210\001\001\0225\n\014startingTime\030\003 \001(\0132\032.google.proto" "\001(\001H\001\210\001\001\022\023\n\006course\030\003 \001(\001H\002\210\001\001\0225\n\014startin"
"buf.TimestampH\001\210\001\001B\010\n\006_speedB\017\n\r_startin" "gTime\030\004 \001(\0132\032.google.protobuf.TimestampH"
"gTimeb\006proto3" "\003\210\001\001B\025\n\023_GeocentricPositionB\010\n\006_speedB\t\n"
"\007_courseB\017\n\r_startingTimeb\006proto3"
; ;
static const ::_pbi::DescriptorTable* const descriptor_table_MoveOrder_2eproto_deps[2] = { static const ::_pbi::DescriptorTable* const descriptor_table_MoveOrder_2eproto_deps[2] = {
&::descriptor_table_GeocentricPosition_2eproto, &::descriptor_table_GeocentricPosition_2eproto,
@@ -84,7 +88,7 @@ static const ::_pbi::DescriptorTable* const descriptor_table_MoveOrder_2eproto_d
}; };
static ::_pbi::once_flag descriptor_table_MoveOrder_2eproto_once; static ::_pbi::once_flag descriptor_table_MoveOrder_2eproto_once;
const ::_pbi::DescriptorTable descriptor_table_MoveOrder_2eproto = { const ::_pbi::DescriptorTable descriptor_table_MoveOrder_2eproto = {
false, false, 293, descriptor_table_protodef_MoveOrder_2eproto, false, false, 353, descriptor_table_protodef_MoveOrder_2eproto,
"MoveOrder.proto", "MoveOrder.proto",
&descriptor_table_MoveOrder_2eproto_once, descriptor_table_MoveOrder_2eproto_deps, 2, 1, &descriptor_table_MoveOrder_2eproto_once, descriptor_table_MoveOrder_2eproto_deps, 2, 1,
schemas, file_default_instances, TableStruct_MoveOrder_2eproto::offsets, schemas, file_default_instances, TableStruct_MoveOrder_2eproto::offsets,
@@ -107,12 +111,18 @@ class MoveOrder::_Internal {
public: public:
using HasBits = decltype(std::declval<MoveOrder>()._impl_._has_bits_); using HasBits = decltype(std::declval<MoveOrder>()._impl_._has_bits_);
static const ::messages::track::EntityGeocentricPosition& geocentricposition(const MoveOrder* msg); static const ::messages::track::EntityGeocentricPosition& geocentricposition(const MoveOrder* msg);
static void set_has_geocentricposition(HasBits* has_bits) {
(*has_bits)[0] |= 1u;
}
static void set_has_speed(HasBits* has_bits) { static void set_has_speed(HasBits* has_bits) {
(*has_bits)[0] |= 2u; (*has_bits)[0] |= 4u;
}
static void set_has_course(HasBits* has_bits) {
(*has_bits)[0] |= 8u;
} }
static const ::PROTOBUF_NAMESPACE_ID::Timestamp& startingtime(const MoveOrder* msg); static const ::PROTOBUF_NAMESPACE_ID::Timestamp& startingtime(const MoveOrder* msg);
static void set_has_startingtime(HasBits* has_bits) { static void set_has_startingtime(HasBits* has_bits) {
(*has_bits)[0] |= 1u; (*has_bits)[0] |= 2u;
} }
}; };
@@ -125,14 +135,12 @@ MoveOrder::_Internal::startingtime(const MoveOrder* msg) {
return *msg->_impl_.startingtime_; return *msg->_impl_.startingtime_;
} }
void MoveOrder::clear_geocentricposition() { void MoveOrder::clear_geocentricposition() {
if (GetArenaForAllocation() == nullptr && _impl_.geocentricposition_ != nullptr) { if (_impl_.geocentricposition_ != nullptr) _impl_.geocentricposition_->Clear();
delete _impl_.geocentricposition_; _impl_._has_bits_[0] &= ~0x00000001u;
}
_impl_.geocentricposition_ = nullptr;
} }
void MoveOrder::clear_startingtime() { void MoveOrder::clear_startingtime() {
if (_impl_.startingtime_ != nullptr) _impl_.startingtime_->Clear(); if (_impl_.startingtime_ != nullptr) _impl_.startingtime_->Clear();
_impl_._has_bits_[0] &= ~0x00000001u; _impl_._has_bits_[0] &= ~0x00000002u;
} }
MoveOrder::MoveOrder(::PROTOBUF_NAMESPACE_ID::Arena* arena, MoveOrder::MoveOrder(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned) bool is_message_owned)
@@ -148,7 +156,8 @@ MoveOrder::MoveOrder(const MoveOrder& from)
, /*decltype(_impl_._cached_size_)*/{} , /*decltype(_impl_._cached_size_)*/{}
, decltype(_impl_.geocentricposition_){nullptr} , decltype(_impl_.geocentricposition_){nullptr}
, decltype(_impl_.startingtime_){nullptr} , decltype(_impl_.startingtime_){nullptr}
, decltype(_impl_.speed_){}}; , decltype(_impl_.speed_){}
, decltype(_impl_.course_){}};
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
if (from._internal_has_geocentricposition()) { if (from._internal_has_geocentricposition()) {
@@ -157,7 +166,9 @@ MoveOrder::MoveOrder(const MoveOrder& from)
if (from._internal_has_startingtime()) { if (from._internal_has_startingtime()) {
_this->_impl_.startingtime_ = new ::PROTOBUF_NAMESPACE_ID::Timestamp(*from._impl_.startingtime_); _this->_impl_.startingtime_ = new ::PROTOBUF_NAMESPACE_ID::Timestamp(*from._impl_.startingtime_);
} }
_this->_impl_.speed_ = from._impl_.speed_; ::memcpy(&_impl_.speed_, &from._impl_.speed_,
static_cast<size_t>(reinterpret_cast<char*>(&_impl_.course_) -
reinterpret_cast<char*>(&_impl_.speed_)) + sizeof(_impl_.course_));
// @@protoc_insertion_point(copy_constructor:messages.entity.order.MoveOrder) // @@protoc_insertion_point(copy_constructor:messages.entity.order.MoveOrder)
} }
@@ -171,6 +182,7 @@ inline void MoveOrder::SharedCtor(
, decltype(_impl_.geocentricposition_){nullptr} , decltype(_impl_.geocentricposition_){nullptr}
, decltype(_impl_.startingtime_){nullptr} , decltype(_impl_.startingtime_){nullptr}
, decltype(_impl_.speed_){0} , decltype(_impl_.speed_){0}
, decltype(_impl_.course_){0}
}; };
} }
@@ -199,16 +211,22 @@ void MoveOrder::Clear() {
// Prevent compiler warnings about cached_has_bits being unused // Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits; (void) cached_has_bits;
if (GetArenaForAllocation() == nullptr && _impl_.geocentricposition_ != nullptr) {
delete _impl_.geocentricposition_;
}
_impl_.geocentricposition_ = nullptr;
cached_has_bits = _impl_._has_bits_[0]; cached_has_bits = _impl_._has_bits_[0];
if (cached_has_bits & 0x00000003u) {
if (cached_has_bits & 0x00000001u) { if (cached_has_bits & 0x00000001u) {
GOOGLE_DCHECK(_impl_.geocentricposition_ != nullptr);
_impl_.geocentricposition_->Clear();
}
if (cached_has_bits & 0x00000002u) {
GOOGLE_DCHECK(_impl_.startingtime_ != nullptr); GOOGLE_DCHECK(_impl_.startingtime_ != nullptr);
_impl_.startingtime_->Clear(); _impl_.startingtime_->Clear();
} }
_impl_.speed_ = 0; }
if (cached_has_bits & 0x0000000cu) {
::memset(&_impl_.speed_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&_impl_.course_) -
reinterpret_cast<char*>(&_impl_.speed_)) + sizeof(_impl_.course_));
}
_impl_._has_bits_.Clear(); _impl_._has_bits_.Clear();
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
} }
@@ -220,7 +238,7 @@ const char* MoveOrder::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx
uint32_t tag; uint32_t tag;
ptr = ::_pbi::ReadTag(ptr, &tag); ptr = ::_pbi::ReadTag(ptr, &tag);
switch (tag >> 3) { switch (tag >> 3) {
// .messages.track.EntityGeocentricPosition GeocentricPosition = 1; // optional .messages.track.EntityGeocentricPosition GeocentricPosition = 1;
case 1: case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) { if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
ptr = ctx->ParseMessage(_internal_mutable_geocentricposition(), ptr); ptr = ctx->ParseMessage(_internal_mutable_geocentricposition(), ptr);
@@ -237,9 +255,18 @@ const char* MoveOrder::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx
} else } else
goto handle_unusual; goto handle_unusual;
continue; continue;
// optional .google.protobuf.Timestamp startingTime = 3; // optional double course = 3;
case 3: case 3:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) { if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 25)) {
_Internal::set_has_course(&has_bits);
_impl_.course_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<double>(ptr);
ptr += sizeof(double);
} else
goto handle_unusual;
continue;
// optional .google.protobuf.Timestamp startingTime = 4;
case 4:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) {
ptr = ctx->ParseMessage(_internal_mutable_startingtime(), ptr); ptr = ctx->ParseMessage(_internal_mutable_startingtime(), ptr);
CHK_(ptr); CHK_(ptr);
} else } else
@@ -275,8 +302,8 @@ uint8_t* MoveOrder::_InternalSerialize(
uint32_t cached_has_bits = 0; uint32_t cached_has_bits = 0;
(void) cached_has_bits; (void) cached_has_bits;
// .messages.track.EntityGeocentricPosition GeocentricPosition = 1; // optional .messages.track.EntityGeocentricPosition GeocentricPosition = 1;
if (this->_internal_has_geocentricposition()) { if (_internal_has_geocentricposition()) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessage(1, _Internal::geocentricposition(this), InternalWriteMessage(1, _Internal::geocentricposition(this),
_Internal::geocentricposition(this).GetCachedSize(), target, stream); _Internal::geocentricposition(this).GetCachedSize(), target, stream);
@@ -288,10 +315,16 @@ uint8_t* MoveOrder::_InternalSerialize(
target = ::_pbi::WireFormatLite::WriteDoubleToArray(2, this->_internal_speed(), target); target = ::_pbi::WireFormatLite::WriteDoubleToArray(2, this->_internal_speed(), target);
} }
// optional .google.protobuf.Timestamp startingTime = 3; // optional double course = 3;
if (_internal_has_course()) {
target = stream->EnsureSpace(target);
target = ::_pbi::WireFormatLite::WriteDoubleToArray(3, this->_internal_course(), target);
}
// optional .google.protobuf.Timestamp startingTime = 4;
if (_internal_has_startingtime()) { if (_internal_has_startingtime()) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessage(3, _Internal::startingtime(this), InternalWriteMessage(4, _Internal::startingtime(this),
_Internal::startingtime(this).GetCachedSize(), target, stream); _Internal::startingtime(this).GetCachedSize(), target, stream);
} }
@@ -311,24 +344,29 @@ size_t MoveOrder::ByteSizeLong() const {
// Prevent compiler warnings about cached_has_bits being unused // Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits; (void) cached_has_bits;
// .messages.track.EntityGeocentricPosition GeocentricPosition = 1; cached_has_bits = _impl_._has_bits_[0];
if (this->_internal_has_geocentricposition()) { if (cached_has_bits & 0x0000000fu) {
// optional .messages.track.EntityGeocentricPosition GeocentricPosition = 1;
if (cached_has_bits & 0x00000001u) {
total_size += 1 + total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
*_impl_.geocentricposition_); *_impl_.geocentricposition_);
} }
cached_has_bits = _impl_._has_bits_[0]; // optional .google.protobuf.Timestamp startingTime = 4;
if (cached_has_bits & 0x00000003u) { if (cached_has_bits & 0x00000002u) {
// optional .google.protobuf.Timestamp startingTime = 3;
if (cached_has_bits & 0x00000001u) {
total_size += 1 + total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
*_impl_.startingtime_); *_impl_.startingtime_);
} }
// optional double speed = 2; // optional double speed = 2;
if (cached_has_bits & 0x00000002u) { if (cached_has_bits & 0x00000004u) {
total_size += 1 + 8;
}
// optional double course = 3;
if (cached_has_bits & 0x00000008u) {
total_size += 1 + 8; total_size += 1 + 8;
} }
@@ -351,19 +389,22 @@ void MoveOrder::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROT
uint32_t cached_has_bits = 0; uint32_t cached_has_bits = 0;
(void) cached_has_bits; (void) cached_has_bits;
if (from._internal_has_geocentricposition()) { cached_has_bits = from._impl_._has_bits_[0];
if (cached_has_bits & 0x0000000fu) {
if (cached_has_bits & 0x00000001u) {
_this->_internal_mutable_geocentricposition()->::messages::track::EntityGeocentricPosition::MergeFrom( _this->_internal_mutable_geocentricposition()->::messages::track::EntityGeocentricPosition::MergeFrom(
from._internal_geocentricposition()); from._internal_geocentricposition());
} }
cached_has_bits = from._impl_._has_bits_[0]; if (cached_has_bits & 0x00000002u) {
if (cached_has_bits & 0x00000003u) {
if (cached_has_bits & 0x00000001u) {
_this->_internal_mutable_startingtime()->::PROTOBUF_NAMESPACE_ID::Timestamp::MergeFrom( _this->_internal_mutable_startingtime()->::PROTOBUF_NAMESPACE_ID::Timestamp::MergeFrom(
from._internal_startingtime()); from._internal_startingtime());
} }
if (cached_has_bits & 0x00000002u) { if (cached_has_bits & 0x00000004u) {
_this->_impl_.speed_ = from._impl_.speed_; _this->_impl_.speed_ = from._impl_.speed_;
} }
if (cached_has_bits & 0x00000008u) {
_this->_impl_.course_ = from._impl_.course_;
}
_this->_impl_._has_bits_[0] |= cached_has_bits; _this->_impl_._has_bits_[0] |= cached_has_bits;
} }
_this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
@@ -385,8 +426,8 @@ void MoveOrder::InternalSwap(MoveOrder* other) {
_internal_metadata_.InternalSwap(&other->_internal_metadata_); _internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]);
::PROTOBUF_NAMESPACE_ID::internal::memswap< ::PROTOBUF_NAMESPACE_ID::internal::memswap<
PROTOBUF_FIELD_OFFSET(MoveOrder, _impl_.speed_) PROTOBUF_FIELD_OFFSET(MoveOrder, _impl_.course_)
+ sizeof(MoveOrder::_impl_.speed_) + sizeof(MoveOrder::_impl_.course_)
- PROTOBUF_FIELD_OFFSET(MoveOrder, _impl_.geocentricposition_)>( - PROTOBUF_FIELD_OFFSET(MoveOrder, _impl_.geocentricposition_)>(
reinterpret_cast<char*>(&_impl_.geocentricposition_), reinterpret_cast<char*>(&_impl_.geocentricposition_),
reinterpret_cast<char*>(&other->_impl_.geocentricposition_)); reinterpret_cast<char*>(&other->_impl_.geocentricposition_));

View File

@@ -186,10 +186,11 @@ class MoveOrder final :
enum : int { enum : int {
kGeocentricPositionFieldNumber = 1, kGeocentricPositionFieldNumber = 1,
kStartingTimeFieldNumber = 3, kStartingTimeFieldNumber = 4,
kSpeedFieldNumber = 2, kSpeedFieldNumber = 2,
kCourseFieldNumber = 3,
}; };
// .messages.track.EntityGeocentricPosition GeocentricPosition = 1; // optional .messages.track.EntityGeocentricPosition GeocentricPosition = 1;
bool has_geocentricposition() const; bool has_geocentricposition() const;
private: private:
bool _internal_has_geocentricposition() const; bool _internal_has_geocentricposition() const;
@@ -207,7 +208,7 @@ class MoveOrder final :
::messages::track::EntityGeocentricPosition* geocentricposition); ::messages::track::EntityGeocentricPosition* geocentricposition);
::messages::track::EntityGeocentricPosition* unsafe_arena_release_geocentricposition(); ::messages::track::EntityGeocentricPosition* unsafe_arena_release_geocentricposition();
// optional .google.protobuf.Timestamp startingTime = 3; // optional .google.protobuf.Timestamp startingTime = 4;
bool has_startingtime() const; bool has_startingtime() const;
private: private:
bool _internal_has_startingtime() const; bool _internal_has_startingtime() const;
@@ -238,6 +239,19 @@ class MoveOrder final :
void _internal_set_speed(double value); void _internal_set_speed(double value);
public: public:
// optional double course = 3;
bool has_course() const;
private:
bool _internal_has_course() const;
public:
void clear_course();
double course() const;
void set_course(double value);
private:
double _internal_course() const;
void _internal_set_course(double value);
public:
// @@protoc_insertion_point(class_scope:messages.entity.order.MoveOrder) // @@protoc_insertion_point(class_scope:messages.entity.order.MoveOrder)
private: private:
class _Internal; class _Internal;
@@ -251,6 +265,7 @@ class MoveOrder final :
::messages::track::EntityGeocentricPosition* geocentricposition_; ::messages::track::EntityGeocentricPosition* geocentricposition_;
::PROTOBUF_NAMESPACE_ID::Timestamp* startingtime_; ::PROTOBUF_NAMESPACE_ID::Timestamp* startingtime_;
double speed_; double speed_;
double course_;
}; };
union { Impl_ _impl_; }; union { Impl_ _impl_; };
friend struct ::TableStruct_MoveOrder_2eproto; friend struct ::TableStruct_MoveOrder_2eproto;
@@ -266,9 +281,11 @@ class MoveOrder final :
#endif // __GNUC__ #endif // __GNUC__
// MoveOrder // MoveOrder
// .messages.track.EntityGeocentricPosition GeocentricPosition = 1; // optional .messages.track.EntityGeocentricPosition GeocentricPosition = 1;
inline bool MoveOrder::_internal_has_geocentricposition() const { inline bool MoveOrder::_internal_has_geocentricposition() const {
return this != internal_default_instance() && _impl_.geocentricposition_ != nullptr; bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0;
PROTOBUF_ASSUME(!value || _impl_.geocentricposition_ != nullptr);
return value;
} }
inline bool MoveOrder::has_geocentricposition() const { inline bool MoveOrder::has_geocentricposition() const {
return _internal_has_geocentricposition(); return _internal_has_geocentricposition();
@@ -289,14 +306,14 @@ inline void MoveOrder::unsafe_arena_set_allocated_geocentricposition(
} }
_impl_.geocentricposition_ = geocentricposition; _impl_.geocentricposition_ = geocentricposition;
if (geocentricposition) { if (geocentricposition) {
_impl_._has_bits_[0] |= 0x00000001u;
} else { } else {
_impl_._has_bits_[0] &= ~0x00000001u;
} }
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:messages.entity.order.MoveOrder.GeocentricPosition) // @@protoc_insertion_point(field_unsafe_arena_set_allocated:messages.entity.order.MoveOrder.GeocentricPosition)
} }
inline ::messages::track::EntityGeocentricPosition* MoveOrder::release_geocentricposition() { inline ::messages::track::EntityGeocentricPosition* MoveOrder::release_geocentricposition() {
_impl_._has_bits_[0] &= ~0x00000001u;
::messages::track::EntityGeocentricPosition* temp = _impl_.geocentricposition_; ::messages::track::EntityGeocentricPosition* temp = _impl_.geocentricposition_;
_impl_.geocentricposition_ = nullptr; _impl_.geocentricposition_ = nullptr;
#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE #ifdef PROTOBUF_FORCE_COPY_IN_RELEASE
@@ -312,13 +329,13 @@ inline ::messages::track::EntityGeocentricPosition* MoveOrder::release_geocentri
} }
inline ::messages::track::EntityGeocentricPosition* MoveOrder::unsafe_arena_release_geocentricposition() { inline ::messages::track::EntityGeocentricPosition* MoveOrder::unsafe_arena_release_geocentricposition() {
// @@protoc_insertion_point(field_release:messages.entity.order.MoveOrder.GeocentricPosition) // @@protoc_insertion_point(field_release:messages.entity.order.MoveOrder.GeocentricPosition)
_impl_._has_bits_[0] &= ~0x00000001u;
::messages::track::EntityGeocentricPosition* temp = _impl_.geocentricposition_; ::messages::track::EntityGeocentricPosition* temp = _impl_.geocentricposition_;
_impl_.geocentricposition_ = nullptr; _impl_.geocentricposition_ = nullptr;
return temp; return temp;
} }
inline ::messages::track::EntityGeocentricPosition* MoveOrder::_internal_mutable_geocentricposition() { inline ::messages::track::EntityGeocentricPosition* MoveOrder::_internal_mutable_geocentricposition() {
_impl_._has_bits_[0] |= 0x00000001u;
if (_impl_.geocentricposition_ == nullptr) { if (_impl_.geocentricposition_ == nullptr) {
auto* p = CreateMaybeMessage<::messages::track::EntityGeocentricPosition>(GetArenaForAllocation()); auto* p = CreateMaybeMessage<::messages::track::EntityGeocentricPosition>(GetArenaForAllocation());
_impl_.geocentricposition_ = p; _impl_.geocentricposition_ = p;
@@ -343,9 +360,9 @@ inline void MoveOrder::set_allocated_geocentricposition(::messages::track::Entit
geocentricposition = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( geocentricposition = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, geocentricposition, submessage_arena); message_arena, geocentricposition, submessage_arena);
} }
_impl_._has_bits_[0] |= 0x00000001u;
} else { } else {
_impl_._has_bits_[0] &= ~0x00000001u;
} }
_impl_.geocentricposition_ = geocentricposition; _impl_.geocentricposition_ = geocentricposition;
// @@protoc_insertion_point(field_set_allocated:messages.entity.order.MoveOrder.GeocentricPosition) // @@protoc_insertion_point(field_set_allocated:messages.entity.order.MoveOrder.GeocentricPosition)
@@ -353,7 +370,7 @@ inline void MoveOrder::set_allocated_geocentricposition(::messages::track::Entit
// optional double speed = 2; // optional double speed = 2;
inline bool MoveOrder::_internal_has_speed() const { inline bool MoveOrder::_internal_has_speed() const {
bool value = (_impl_._has_bits_[0] & 0x00000002u) != 0; bool value = (_impl_._has_bits_[0] & 0x00000004u) != 0;
return value; return value;
} }
inline bool MoveOrder::has_speed() const { inline bool MoveOrder::has_speed() const {
@@ -361,7 +378,7 @@ inline bool MoveOrder::has_speed() const {
} }
inline void MoveOrder::clear_speed() { inline void MoveOrder::clear_speed() {
_impl_.speed_ = 0; _impl_.speed_ = 0;
_impl_._has_bits_[0] &= ~0x00000002u; _impl_._has_bits_[0] &= ~0x00000004u;
} }
inline double MoveOrder::_internal_speed() const { inline double MoveOrder::_internal_speed() const {
return _impl_.speed_; return _impl_.speed_;
@@ -371,7 +388,7 @@ inline double MoveOrder::speed() const {
return _internal_speed(); return _internal_speed();
} }
inline void MoveOrder::_internal_set_speed(double value) { inline void MoveOrder::_internal_set_speed(double value) {
_impl_._has_bits_[0] |= 0x00000002u; _impl_._has_bits_[0] |= 0x00000004u;
_impl_.speed_ = value; _impl_.speed_ = value;
} }
inline void MoveOrder::set_speed(double value) { inline void MoveOrder::set_speed(double value) {
@@ -379,9 +396,37 @@ inline void MoveOrder::set_speed(double value) {
// @@protoc_insertion_point(field_set:messages.entity.order.MoveOrder.speed) // @@protoc_insertion_point(field_set:messages.entity.order.MoveOrder.speed)
} }
// optional .google.protobuf.Timestamp startingTime = 3; // optional double course = 3;
inline bool MoveOrder::_internal_has_course() const {
bool value = (_impl_._has_bits_[0] & 0x00000008u) != 0;
return value;
}
inline bool MoveOrder::has_course() const {
return _internal_has_course();
}
inline void MoveOrder::clear_course() {
_impl_.course_ = 0;
_impl_._has_bits_[0] &= ~0x00000008u;
}
inline double MoveOrder::_internal_course() const {
return _impl_.course_;
}
inline double MoveOrder::course() const {
// @@protoc_insertion_point(field_get:messages.entity.order.MoveOrder.course)
return _internal_course();
}
inline void MoveOrder::_internal_set_course(double value) {
_impl_._has_bits_[0] |= 0x00000008u;
_impl_.course_ = value;
}
inline void MoveOrder::set_course(double value) {
_internal_set_course(value);
// @@protoc_insertion_point(field_set:messages.entity.order.MoveOrder.course)
}
// optional .google.protobuf.Timestamp startingTime = 4;
inline bool MoveOrder::_internal_has_startingtime() const { inline bool MoveOrder::_internal_has_startingtime() const {
bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; bool value = (_impl_._has_bits_[0] & 0x00000002u) != 0;
PROTOBUF_ASSUME(!value || _impl_.startingtime_ != nullptr); PROTOBUF_ASSUME(!value || _impl_.startingtime_ != nullptr);
return value; return value;
} }
@@ -404,14 +449,14 @@ inline void MoveOrder::unsafe_arena_set_allocated_startingtime(
} }
_impl_.startingtime_ = startingtime; _impl_.startingtime_ = startingtime;
if (startingtime) { if (startingtime) {
_impl_._has_bits_[0] |= 0x00000001u; _impl_._has_bits_[0] |= 0x00000002u;
} else { } else {
_impl_._has_bits_[0] &= ~0x00000001u; _impl_._has_bits_[0] &= ~0x00000002u;
} }
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:messages.entity.order.MoveOrder.startingTime) // @@protoc_insertion_point(field_unsafe_arena_set_allocated:messages.entity.order.MoveOrder.startingTime)
} }
inline ::PROTOBUF_NAMESPACE_ID::Timestamp* MoveOrder::release_startingtime() { inline ::PROTOBUF_NAMESPACE_ID::Timestamp* MoveOrder::release_startingtime() {
_impl_._has_bits_[0] &= ~0x00000001u; _impl_._has_bits_[0] &= ~0x00000002u;
::PROTOBUF_NAMESPACE_ID::Timestamp* temp = _impl_.startingtime_; ::PROTOBUF_NAMESPACE_ID::Timestamp* temp = _impl_.startingtime_;
_impl_.startingtime_ = nullptr; _impl_.startingtime_ = nullptr;
#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE #ifdef PROTOBUF_FORCE_COPY_IN_RELEASE
@@ -427,13 +472,13 @@ inline ::PROTOBUF_NAMESPACE_ID::Timestamp* MoveOrder::release_startingtime() {
} }
inline ::PROTOBUF_NAMESPACE_ID::Timestamp* MoveOrder::unsafe_arena_release_startingtime() { inline ::PROTOBUF_NAMESPACE_ID::Timestamp* MoveOrder::unsafe_arena_release_startingtime() {
// @@protoc_insertion_point(field_release:messages.entity.order.MoveOrder.startingTime) // @@protoc_insertion_point(field_release:messages.entity.order.MoveOrder.startingTime)
_impl_._has_bits_[0] &= ~0x00000001u; _impl_._has_bits_[0] &= ~0x00000002u;
::PROTOBUF_NAMESPACE_ID::Timestamp* temp = _impl_.startingtime_; ::PROTOBUF_NAMESPACE_ID::Timestamp* temp = _impl_.startingtime_;
_impl_.startingtime_ = nullptr; _impl_.startingtime_ = nullptr;
return temp; return temp;
} }
inline ::PROTOBUF_NAMESPACE_ID::Timestamp* MoveOrder::_internal_mutable_startingtime() { inline ::PROTOBUF_NAMESPACE_ID::Timestamp* MoveOrder::_internal_mutable_startingtime() {
_impl_._has_bits_[0] |= 0x00000001u; _impl_._has_bits_[0] |= 0x00000002u;
if (_impl_.startingtime_ == nullptr) { if (_impl_.startingtime_ == nullptr) {
auto* p = CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::Timestamp>(GetArenaForAllocation()); auto* p = CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::Timestamp>(GetArenaForAllocation());
_impl_.startingtime_ = p; _impl_.startingtime_ = p;
@@ -458,9 +503,9 @@ inline void MoveOrder::set_allocated_startingtime(::PROTOBUF_NAMESPACE_ID::Times
startingtime = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( startingtime = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, startingtime, submessage_arena); message_arena, startingtime, submessage_arena);
} }
_impl_._has_bits_[0] |= 0x00000001u; _impl_._has_bits_[0] |= 0x00000002u;
} else { } else {
_impl_._has_bits_[0] &= ~0x00000001u; _impl_._has_bits_[0] &= ~0x00000002u;
} }
_impl_.startingtime_ = startingtime; _impl_.startingtime_ = startingtime;
// @@protoc_insertion_point(field_set_allocated:messages.entity.order.MoveOrder.startingTime) // @@protoc_insertion_point(field_set_allocated:messages.entity.order.MoveOrder.startingTime)

View File

@@ -9,8 +9,9 @@ import "google/protobuf/timestamp.proto";
message MoveOrder message MoveOrder
{ {
messages.track.EntityGeocentricPosition GeocentricPosition = 1; optional messages.track.EntityGeocentricPosition GeocentricPosition = 1;
optional double speed = 2; optional double speed = 2;
optional google.protobuf.Timestamp startingTime = 3; optional double course = 3;
optional google.protobuf.Timestamp startingTime = 4;
} }

View File

@@ -26,8 +26,6 @@ namespace order {
PROTOBUF_CONSTEXPR Order::Order( PROTOBUF_CONSTEXPR Order::Order(
::_pbi::ConstantInitialized): _impl_{ ::_pbi::ConstantInitialized): _impl_{
/*decltype(_impl_.orderid_)*/nullptr /*decltype(_impl_.orderid_)*/nullptr
, /*decltype(_impl_.orderingentity_)*/nullptr
, /*decltype(_impl_.orderedentity_)*/nullptr
, /*decltype(_impl_.orderpayload_)*/nullptr , /*decltype(_impl_.orderpayload_)*/nullptr
, /*decltype(_impl_.ordertype_)*/0u , /*decltype(_impl_.ordertype_)*/0u
, /*decltype(_impl_._cached_size_)*/{}} {} , /*decltype(_impl_._cached_size_)*/{}} {}
@@ -55,8 +53,6 @@ const uint32_t TableStruct_Order_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(pr
~0u, // no _weak_field_map_ ~0u, // no _weak_field_map_
~0u, // no _inlined_string_donated_ ~0u, // no _inlined_string_donated_
PROTOBUF_FIELD_OFFSET(::messages::entity::order::Order, _impl_.orderid_), PROTOBUF_FIELD_OFFSET(::messages::entity::order::Order, _impl_.orderid_),
PROTOBUF_FIELD_OFFSET(::messages::entity::order::Order, _impl_.orderingentity_),
PROTOBUF_FIELD_OFFSET(::messages::entity::order::Order, _impl_.orderedentity_),
PROTOBUF_FIELD_OFFSET(::messages::entity::order::Order, _impl_.ordertype_), PROTOBUF_FIELD_OFFSET(::messages::entity::order::Order, _impl_.ordertype_),
PROTOBUF_FIELD_OFFSET(::messages::entity::order::Order, _impl_.orderpayload_), PROTOBUF_FIELD_OFFSET(::messages::entity::order::Order, _impl_.orderpayload_),
}; };
@@ -71,12 +67,10 @@ static const ::_pb::Message* const file_default_instances[] = {
const char descriptor_table_protodef_Order_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = const char descriptor_table_protodef_Order_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) =
"\n\013Order.proto\022\025messages.entity.order\032\020Id" "\n\013Order.proto\022\025messages.entity.order\032\020Id"
"entifier.proto\032\031google/protobuf/any.prot" "entifier.proto\032\031google/protobuf/any.prot"
"o\"\332\001\n\005Order\022+\n\007OrderID\030\001 \001(\0132\032.messages." "o\"s\n\005Order\022+\n\007OrderID\030\001 \001(\0132\032.messages.t"
"track.Identifier\0222\n\016orderingEntity\030\002 \001(\013" "rack.Identifier\022\021\n\tOrderType\030\004 \001(\r\022*\n\014Or"
"2\032.messages.track.Identifier\0221\n\rorderedE" "derPayload\030\005 \001(\0132\024.google.protobuf.Anyb\006"
"ntity\030\003 \001(\0132\032.messages.track.Identifier\022" "proto3"
"\021\n\tOrderType\030\004 \001(\r\022*\n\014OrderPayload\030\005 \001(\013"
"2\024.google.protobuf.Anyb\006proto3"
; ;
static const ::_pbi::DescriptorTable* const descriptor_table_Order_2eproto_deps[2] = { static const ::_pbi::DescriptorTable* const descriptor_table_Order_2eproto_deps[2] = {
&::descriptor_table_Identifier_2eproto, &::descriptor_table_Identifier_2eproto,
@@ -84,7 +78,7 @@ static const ::_pbi::DescriptorTable* const descriptor_table_Order_2eproto_deps[
}; };
static ::_pbi::once_flag descriptor_table_Order_2eproto_once; static ::_pbi::once_flag descriptor_table_Order_2eproto_once;
const ::_pbi::DescriptorTable descriptor_table_Order_2eproto = { const ::_pbi::DescriptorTable descriptor_table_Order_2eproto = {
false, false, 310, descriptor_table_protodef_Order_2eproto, false, false, 206, descriptor_table_protodef_Order_2eproto,
"Order.proto", "Order.proto",
&descriptor_table_Order_2eproto_once, descriptor_table_Order_2eproto_deps, 2, 1, &descriptor_table_Order_2eproto_once, descriptor_table_Order_2eproto_deps, 2, 1,
schemas, file_default_instances, TableStruct_Order_2eproto::offsets, schemas, file_default_instances, TableStruct_Order_2eproto::offsets,
@@ -106,8 +100,6 @@ namespace order {
class Order::_Internal { class Order::_Internal {
public: public:
static const ::messages::track::Identifier& orderid(const Order* msg); static const ::messages::track::Identifier& orderid(const Order* msg);
static const ::messages::track::Identifier& orderingentity(const Order* msg);
static const ::messages::track::Identifier& orderedentity(const Order* msg);
static const ::PROTOBUF_NAMESPACE_ID::Any& orderpayload(const Order* msg); static const ::PROTOBUF_NAMESPACE_ID::Any& orderpayload(const Order* msg);
}; };
@@ -115,14 +107,6 @@ const ::messages::track::Identifier&
Order::_Internal::orderid(const Order* msg) { Order::_Internal::orderid(const Order* msg) {
return *msg->_impl_.orderid_; return *msg->_impl_.orderid_;
} }
const ::messages::track::Identifier&
Order::_Internal::orderingentity(const Order* msg) {
return *msg->_impl_.orderingentity_;
}
const ::messages::track::Identifier&
Order::_Internal::orderedentity(const Order* msg) {
return *msg->_impl_.orderedentity_;
}
const ::PROTOBUF_NAMESPACE_ID::Any& const ::PROTOBUF_NAMESPACE_ID::Any&
Order::_Internal::orderpayload(const Order* msg) { Order::_Internal::orderpayload(const Order* msg) {
return *msg->_impl_.orderpayload_; return *msg->_impl_.orderpayload_;
@@ -133,18 +117,6 @@ void Order::clear_orderid() {
} }
_impl_.orderid_ = nullptr; _impl_.orderid_ = nullptr;
} }
void Order::clear_orderingentity() {
if (GetArenaForAllocation() == nullptr && _impl_.orderingentity_ != nullptr) {
delete _impl_.orderingentity_;
}
_impl_.orderingentity_ = nullptr;
}
void Order::clear_orderedentity() {
if (GetArenaForAllocation() == nullptr && _impl_.orderedentity_ != nullptr) {
delete _impl_.orderedentity_;
}
_impl_.orderedentity_ = nullptr;
}
void Order::clear_orderpayload() { void Order::clear_orderpayload() {
if (GetArenaForAllocation() == nullptr && _impl_.orderpayload_ != nullptr) { if (GetArenaForAllocation() == nullptr && _impl_.orderpayload_ != nullptr) {
delete _impl_.orderpayload_; delete _impl_.orderpayload_;
@@ -162,8 +134,6 @@ Order::Order(const Order& from)
Order* const _this = this; (void)_this; Order* const _this = this; (void)_this;
new (&_impl_) Impl_{ new (&_impl_) Impl_{
decltype(_impl_.orderid_){nullptr} decltype(_impl_.orderid_){nullptr}
, decltype(_impl_.orderingentity_){nullptr}
, decltype(_impl_.orderedentity_){nullptr}
, decltype(_impl_.orderpayload_){nullptr} , decltype(_impl_.orderpayload_){nullptr}
, decltype(_impl_.ordertype_){} , decltype(_impl_.ordertype_){}
, /*decltype(_impl_._cached_size_)*/{}}; , /*decltype(_impl_._cached_size_)*/{}};
@@ -172,12 +142,6 @@ Order::Order(const Order& from)
if (from._internal_has_orderid()) { if (from._internal_has_orderid()) {
_this->_impl_.orderid_ = new ::messages::track::Identifier(*from._impl_.orderid_); _this->_impl_.orderid_ = new ::messages::track::Identifier(*from._impl_.orderid_);
} }
if (from._internal_has_orderingentity()) {
_this->_impl_.orderingentity_ = new ::messages::track::Identifier(*from._impl_.orderingentity_);
}
if (from._internal_has_orderedentity()) {
_this->_impl_.orderedentity_ = new ::messages::track::Identifier(*from._impl_.orderedentity_);
}
if (from._internal_has_orderpayload()) { if (from._internal_has_orderpayload()) {
_this->_impl_.orderpayload_ = new ::PROTOBUF_NAMESPACE_ID::Any(*from._impl_.orderpayload_); _this->_impl_.orderpayload_ = new ::PROTOBUF_NAMESPACE_ID::Any(*from._impl_.orderpayload_);
} }
@@ -191,8 +155,6 @@ inline void Order::SharedCtor(
(void)is_message_owned; (void)is_message_owned;
new (&_impl_) Impl_{ new (&_impl_) Impl_{
decltype(_impl_.orderid_){nullptr} decltype(_impl_.orderid_){nullptr}
, decltype(_impl_.orderingentity_){nullptr}
, decltype(_impl_.orderedentity_){nullptr}
, decltype(_impl_.orderpayload_){nullptr} , decltype(_impl_.orderpayload_){nullptr}
, decltype(_impl_.ordertype_){0u} , decltype(_impl_.ordertype_){0u}
, /*decltype(_impl_._cached_size_)*/{} , /*decltype(_impl_._cached_size_)*/{}
@@ -211,8 +173,6 @@ Order::~Order() {
inline void Order::SharedDtor() { inline void Order::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
if (this != internal_default_instance()) delete _impl_.orderid_; if (this != internal_default_instance()) delete _impl_.orderid_;
if (this != internal_default_instance()) delete _impl_.orderingentity_;
if (this != internal_default_instance()) delete _impl_.orderedentity_;
if (this != internal_default_instance()) delete _impl_.orderpayload_; if (this != internal_default_instance()) delete _impl_.orderpayload_;
} }
@@ -230,14 +190,6 @@ void Order::Clear() {
delete _impl_.orderid_; delete _impl_.orderid_;
} }
_impl_.orderid_ = nullptr; _impl_.orderid_ = nullptr;
if (GetArenaForAllocation() == nullptr && _impl_.orderingentity_ != nullptr) {
delete _impl_.orderingentity_;
}
_impl_.orderingentity_ = nullptr;
if (GetArenaForAllocation() == nullptr && _impl_.orderedentity_ != nullptr) {
delete _impl_.orderedentity_;
}
_impl_.orderedentity_ = nullptr;
if (GetArenaForAllocation() == nullptr && _impl_.orderpayload_ != nullptr) { if (GetArenaForAllocation() == nullptr && _impl_.orderpayload_ != nullptr) {
delete _impl_.orderpayload_; delete _impl_.orderpayload_;
} }
@@ -260,22 +212,6 @@ const char* Order::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
} else } else
goto handle_unusual; goto handle_unusual;
continue; continue;
// .messages.track.Identifier orderingEntity = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
ptr = ctx->ParseMessage(_internal_mutable_orderingentity(), ptr);
CHK_(ptr);
} else
goto handle_unusual;
continue;
// .messages.track.Identifier orderedEntity = 3;
case 3:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) {
ptr = ctx->ParseMessage(_internal_mutable_orderedentity(), ptr);
CHK_(ptr);
} else
goto handle_unusual;
continue;
// uint32 OrderType = 4; // uint32 OrderType = 4;
case 4: case 4:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 32)) { if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 32)) {
@@ -328,20 +264,6 @@ uint8_t* Order::_InternalSerialize(
_Internal::orderid(this).GetCachedSize(), target, stream); _Internal::orderid(this).GetCachedSize(), target, stream);
} }
// .messages.track.Identifier orderingEntity = 2;
if (this->_internal_has_orderingentity()) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessage(2, _Internal::orderingentity(this),
_Internal::orderingentity(this).GetCachedSize(), target, stream);
}
// .messages.track.Identifier orderedEntity = 3;
if (this->_internal_has_orderedentity()) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessage(3, _Internal::orderedentity(this),
_Internal::orderedentity(this).GetCachedSize(), target, stream);
}
// uint32 OrderType = 4; // uint32 OrderType = 4;
if (this->_internal_ordertype() != 0) { if (this->_internal_ordertype() != 0) {
target = stream->EnsureSpace(target); target = stream->EnsureSpace(target);
@@ -378,20 +300,6 @@ size_t Order::ByteSizeLong() const {
*_impl_.orderid_); *_impl_.orderid_);
} }
// .messages.track.Identifier orderingEntity = 2;
if (this->_internal_has_orderingentity()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
*_impl_.orderingentity_);
}
// .messages.track.Identifier orderedEntity = 3;
if (this->_internal_has_orderedentity()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
*_impl_.orderedentity_);
}
// .google.protobuf.Any OrderPayload = 5; // .google.protobuf.Any OrderPayload = 5;
if (this->_internal_has_orderpayload()) { if (this->_internal_has_orderpayload()) {
total_size += 1 + total_size += 1 +
@@ -426,14 +334,6 @@ void Order::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF
_this->_internal_mutable_orderid()->::messages::track::Identifier::MergeFrom( _this->_internal_mutable_orderid()->::messages::track::Identifier::MergeFrom(
from._internal_orderid()); from._internal_orderid());
} }
if (from._internal_has_orderingentity()) {
_this->_internal_mutable_orderingentity()->::messages::track::Identifier::MergeFrom(
from._internal_orderingentity());
}
if (from._internal_has_orderedentity()) {
_this->_internal_mutable_orderedentity()->::messages::track::Identifier::MergeFrom(
from._internal_orderedentity());
}
if (from._internal_has_orderpayload()) { if (from._internal_has_orderpayload()) {
_this->_internal_mutable_orderpayload()->::PROTOBUF_NAMESPACE_ID::Any::MergeFrom( _this->_internal_mutable_orderpayload()->::PROTOBUF_NAMESPACE_ID::Any::MergeFrom(
from._internal_orderpayload()); from._internal_orderpayload());

View File

@@ -186,8 +186,6 @@ class Order final :
enum : int { enum : int {
kOrderIDFieldNumber = 1, kOrderIDFieldNumber = 1,
kOrderingEntityFieldNumber = 2,
kOrderedEntityFieldNumber = 3,
kOrderPayloadFieldNumber = 5, kOrderPayloadFieldNumber = 5,
kOrderTypeFieldNumber = 4, kOrderTypeFieldNumber = 4,
}; };
@@ -209,42 +207,6 @@ class Order final :
::messages::track::Identifier* orderid); ::messages::track::Identifier* orderid);
::messages::track::Identifier* unsafe_arena_release_orderid(); ::messages::track::Identifier* unsafe_arena_release_orderid();
// .messages.track.Identifier orderingEntity = 2;
bool has_orderingentity() const;
private:
bool _internal_has_orderingentity() const;
public:
void clear_orderingentity();
const ::messages::track::Identifier& orderingentity() const;
PROTOBUF_NODISCARD ::messages::track::Identifier* release_orderingentity();
::messages::track::Identifier* mutable_orderingentity();
void set_allocated_orderingentity(::messages::track::Identifier* orderingentity);
private:
const ::messages::track::Identifier& _internal_orderingentity() const;
::messages::track::Identifier* _internal_mutable_orderingentity();
public:
void unsafe_arena_set_allocated_orderingentity(
::messages::track::Identifier* orderingentity);
::messages::track::Identifier* unsafe_arena_release_orderingentity();
// .messages.track.Identifier orderedEntity = 3;
bool has_orderedentity() const;
private:
bool _internal_has_orderedentity() const;
public:
void clear_orderedentity();
const ::messages::track::Identifier& orderedentity() const;
PROTOBUF_NODISCARD ::messages::track::Identifier* release_orderedentity();
::messages::track::Identifier* mutable_orderedentity();
void set_allocated_orderedentity(::messages::track::Identifier* orderedentity);
private:
const ::messages::track::Identifier& _internal_orderedentity() const;
::messages::track::Identifier* _internal_mutable_orderedentity();
public:
void unsafe_arena_set_allocated_orderedentity(
::messages::track::Identifier* orderedentity);
::messages::track::Identifier* unsafe_arena_release_orderedentity();
// .google.protobuf.Any OrderPayload = 5; // .google.protobuf.Any OrderPayload = 5;
bool has_orderpayload() const; bool has_orderpayload() const;
private: private:
@@ -281,8 +243,6 @@ class Order final :
typedef void DestructorSkippable_; typedef void DestructorSkippable_;
struct Impl_ { struct Impl_ {
::messages::track::Identifier* orderid_; ::messages::track::Identifier* orderid_;
::messages::track::Identifier* orderingentity_;
::messages::track::Identifier* orderedentity_;
::PROTOBUF_NAMESPACE_ID::Any* orderpayload_; ::PROTOBUF_NAMESPACE_ID::Any* orderpayload_;
uint32_t ordertype_; uint32_t ordertype_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
@@ -386,176 +346,6 @@ inline void Order::set_allocated_orderid(::messages::track::Identifier* orderid)
// @@protoc_insertion_point(field_set_allocated:messages.entity.order.Order.OrderID) // @@protoc_insertion_point(field_set_allocated:messages.entity.order.Order.OrderID)
} }
// .messages.track.Identifier orderingEntity = 2;
inline bool Order::_internal_has_orderingentity() const {
return this != internal_default_instance() && _impl_.orderingentity_ != nullptr;
}
inline bool Order::has_orderingentity() const {
return _internal_has_orderingentity();
}
inline const ::messages::track::Identifier& Order::_internal_orderingentity() const {
const ::messages::track::Identifier* p = _impl_.orderingentity_;
return p != nullptr ? *p : reinterpret_cast<const ::messages::track::Identifier&>(
::messages::track::_Identifier_default_instance_);
}
inline const ::messages::track::Identifier& Order::orderingentity() const {
// @@protoc_insertion_point(field_get:messages.entity.order.Order.orderingEntity)
return _internal_orderingentity();
}
inline void Order::unsafe_arena_set_allocated_orderingentity(
::messages::track::Identifier* orderingentity) {
if (GetArenaForAllocation() == nullptr) {
delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.orderingentity_);
}
_impl_.orderingentity_ = orderingentity;
if (orderingentity) {
} else {
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:messages.entity.order.Order.orderingEntity)
}
inline ::messages::track::Identifier* Order::release_orderingentity() {
::messages::track::Identifier* temp = _impl_.orderingentity_;
_impl_.orderingentity_ = 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::track::Identifier* Order::unsafe_arena_release_orderingentity() {
// @@protoc_insertion_point(field_release:messages.entity.order.Order.orderingEntity)
::messages::track::Identifier* temp = _impl_.orderingentity_;
_impl_.orderingentity_ = nullptr;
return temp;
}
inline ::messages::track::Identifier* Order::_internal_mutable_orderingentity() {
if (_impl_.orderingentity_ == nullptr) {
auto* p = CreateMaybeMessage<::messages::track::Identifier>(GetArenaForAllocation());
_impl_.orderingentity_ = p;
}
return _impl_.orderingentity_;
}
inline ::messages::track::Identifier* Order::mutable_orderingentity() {
::messages::track::Identifier* _msg = _internal_mutable_orderingentity();
// @@protoc_insertion_point(field_mutable:messages.entity.order.Order.orderingEntity)
return _msg;
}
inline void Order::set_allocated_orderingentity(::messages::track::Identifier* orderingentity) {
::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
if (message_arena == nullptr) {
delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.orderingentity_);
}
if (orderingentity) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(
reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(orderingentity));
if (message_arena != submessage_arena) {
orderingentity = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, orderingentity, submessage_arena);
}
} else {
}
_impl_.orderingentity_ = orderingentity;
// @@protoc_insertion_point(field_set_allocated:messages.entity.order.Order.orderingEntity)
}
// .messages.track.Identifier orderedEntity = 3;
inline bool Order::_internal_has_orderedentity() const {
return this != internal_default_instance() && _impl_.orderedentity_ != nullptr;
}
inline bool Order::has_orderedentity() const {
return _internal_has_orderedentity();
}
inline const ::messages::track::Identifier& Order::_internal_orderedentity() const {
const ::messages::track::Identifier* p = _impl_.orderedentity_;
return p != nullptr ? *p : reinterpret_cast<const ::messages::track::Identifier&>(
::messages::track::_Identifier_default_instance_);
}
inline const ::messages::track::Identifier& Order::orderedentity() const {
// @@protoc_insertion_point(field_get:messages.entity.order.Order.orderedEntity)
return _internal_orderedentity();
}
inline void Order::unsafe_arena_set_allocated_orderedentity(
::messages::track::Identifier* orderedentity) {
if (GetArenaForAllocation() == nullptr) {
delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.orderedentity_);
}
_impl_.orderedentity_ = orderedentity;
if (orderedentity) {
} else {
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:messages.entity.order.Order.orderedEntity)
}
inline ::messages::track::Identifier* Order::release_orderedentity() {
::messages::track::Identifier* temp = _impl_.orderedentity_;
_impl_.orderedentity_ = 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::track::Identifier* Order::unsafe_arena_release_orderedentity() {
// @@protoc_insertion_point(field_release:messages.entity.order.Order.orderedEntity)
::messages::track::Identifier* temp = _impl_.orderedentity_;
_impl_.orderedentity_ = nullptr;
return temp;
}
inline ::messages::track::Identifier* Order::_internal_mutable_orderedentity() {
if (_impl_.orderedentity_ == nullptr) {
auto* p = CreateMaybeMessage<::messages::track::Identifier>(GetArenaForAllocation());
_impl_.orderedentity_ = p;
}
return _impl_.orderedentity_;
}
inline ::messages::track::Identifier* Order::mutable_orderedentity() {
::messages::track::Identifier* _msg = _internal_mutable_orderedentity();
// @@protoc_insertion_point(field_mutable:messages.entity.order.Order.orderedEntity)
return _msg;
}
inline void Order::set_allocated_orderedentity(::messages::track::Identifier* orderedentity) {
::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
if (message_arena == nullptr) {
delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.orderedentity_);
}
if (orderedentity) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(
reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(orderedentity));
if (message_arena != submessage_arena) {
orderedentity = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, orderedentity, submessage_arena);
}
} else {
}
_impl_.orderedentity_ = orderedentity;
// @@protoc_insertion_point(field_set_allocated:messages.entity.order.Order.orderedEntity)
}
// uint32 OrderType = 4; // uint32 OrderType = 4;
inline void Order::clear_ordertype() { inline void Order::clear_ordertype() {
_impl_.ordertype_ = 0u; _impl_.ordertype_ = 0u;

View File

@@ -7,8 +7,6 @@ import "google/protobuf/any.proto";
message Order message Order
{ {
messages.track.Identifier OrderID = 1; messages.track.Identifier OrderID = 1;
messages.track.Identifier orderingEntity = 2;
messages.track.Identifier orderedEntity = 3;
uint32 OrderType = 4; uint32 OrderType = 4;

View File

@@ -1,5 +1,6 @@
#include "DirectCommunicationServer.hpp" #include "DirectCommunicationServer.hpp"
#include "Entities/Movement.hpp" #include "Entities/Movement.hpp"
#include "Orders/MoveOrder.hpp"
#include "SimCore/Messages/SimTrack.hpp" #include "SimCore/Messages/SimTrack.hpp"
#include "WHISPER/InternalUDPListener.hpp" #include "WHISPER/InternalUDPListener.hpp"
#include "WHISPER/InternalUDPSender.hpp" #include "WHISPER/InternalUDPSender.hpp"
@@ -53,30 +54,28 @@ namespace Entities
void Entity::setPosition(SimCore::Position pos) void Entity::setPosition(SimCore::Position pos)
{ {
OwnShipTrack->setPosition(pos); OwnShipTrack->setPosition(pos);
SimCore::SimTrack newSimTrack(OwnShipTrack->getIdentifier(),WHISPER::SourceType::ENTITY,EntityKind_); Orders::MoveOrder moveorder(OwnShipTrack->getIdentifier(),WHISPER::SourceType::ENTITY);
newSimTrack.setPosition(pos); moveorder.setPosition(pos);
} }
void Entity::setSpeed(double val) void Entity::setSpeed(double val)
{ {
OwnShipTrack->Speed.setValue(val); OwnShipTrack->Speed.setValue(val);
SimCore::SimTrack newSimTrack(OwnShipTrack->getIdentifier(),WHISPER::SourceType::ENTITY,EntityKind_); Orders::MoveOrder moveorder(OwnShipTrack->getIdentifier(),WHISPER::SourceType::ENTITY);
newSimTrack.Speed.setValue(val);
MovemtServer_->sendMessage(newSimTrack.buildMessage().serialize());
} }
void Entity::setCourse(double val) void Entity::setCourse(double val)
{ {
OwnShipTrack->Course.setValue(val); OwnShipTrack->Course.setValue(val);
SimCore::SimTrack newSimTrack(OwnShipTrack->getIdentifier(),WHISPER::SourceType::ENTITY,EntityKind_); Orders::MoveOrder moveorder(OwnShipTrack->getIdentifier(),WHISPER::SourceType::ENTITY);
newSimTrack.Course.setValue(val); moveorder.Course.setValue(val);
LOG_S(INFO)<< "NEW Course: "<< val; MovemtServer_->sendMessage(moveorder.buildMessage().serialize());
MovemtServer_->sendMessage(newSimTrack.buildMessage().serialize());
} }
void Entity::setPitch( double val) void Entity::setPitch( double val)
{ {
OwnShipTrack->Pitch.setValue(val); OwnShipTrack->Pitch.setValue(val);
SimCore::SimTrack newSimTrack(OwnShipTrack->getIdentifier(),WHISPER::SourceType::ENTITY,EntityKind_);
newSimTrack.Pitch.setValue(val);
} }

View File

@@ -1,22 +1,32 @@
#include "SimCore/Position.hpp" #include "SimCore/Position.hpp"
#include "SimCore/data.hpp"
#include <Orders/Order.hpp> #include <Orders/Order.hpp>
#include <WHISPER/Messages/Message.hpp> #include <WHISPER/Messages/Message.hpp>
#include <Orders/MoveOrder.hpp> #include <Orders/MoveOrder.hpp>
#include <Orders/protos/MoveOrder.pb.h> #include <Orders/protos/MoveOrder.pb.h>
#include <Orders/protos/Order.pb.h> #include <Orders/protos/Order.pb.h>
#include <memory>
namespace Orders namespace Orders
{ {
MoveOrder::MoveOrder(const SimCore::Identifier id,const SimCore::Identifier orderingEntity,const SimCore::Identifier orderedEntity,WHISPER::SourceType srcType): MoveOrder::MoveOrder(const SimCore::Identifier OwnID, WHISPER::SourceType srcType):
Order(id, orderingEntity, orderedEntity,srcType,Orders::MOVE_ORDER) Order(OwnID,srcType,Orders::MOVE_ORDER)
{ {
Speed = SimCore::Data<double>();
Course = SimCore::Data<double>();
StartTime = SimCore::Data<uint64_t>();
pos_ = SimCore::Position();
} }
MoveOrder::MoveOrder(const SimCore::Identifier id,const SimCore::Identifier orderingEntity,const SimCore::Identifier orderedEntity,WHISPER::SourceType srcType,SimCore::Position pos,double speed, int startTime ): MoveOrder::MoveOrder(const SimCore::Identifier OwnID,WHISPER::SourceType srcType,SimCore::Position pos,double speed,double course , int startTime ):
Order(id, orderingEntity, orderedEntity,srcType,Orders::MOVE_ORDER),speed_(speed),startTime_(startTime) Order(OwnID, srcType,Orders::MOVE_ORDER)
{ {
Speed = SimCore::Data<double>();
Course = SimCore::Data<double>();
StartTime = SimCore::Data<uint64_t>();
pos_ = SimCore::Position();
} }
@@ -25,51 +35,41 @@ namespace Orders
} }
void MoveOrder::addData(SimCore::Position pos,double speed, int startTime )
{
pos_ = pos;
speed_ = speed;
startTime_ = startTime;
}
void MoveOrder::setPosition(SimCore::Position pos) void MoveOrder::setPosition(SimCore::Position pos)
{ {
pos_ = pos; pos_ = pos;
} }
void MoveOrder::setSpeed(double speed)
{
speed_ = speed;
}
void MoveOrder::setStartTime(uint64_t startTime)
{
startTime_ = startTime;
}
SimCore::Position MoveOrder::getPosition(){return pos_;} SimCore::Position MoveOrder::getPosition(){return pos_;}
double MoveOrder::getSpeed(){return speed_;}
uint64_t MoveOrder::getStartTime(){return startTime_;}
WHISPER::Message MoveOrder::buildMessage(SimCore::Identifier parentID)
WHISPER::Message MoveOrder::buildMessage()
{ {
WHISPER::Message msg = WHISPER::Message(getOrderingEntity().getParentNumber(), getOrderingEntity().getNumber(), WHISPER::MsgTopics::COMMANDS , WHISPER::MsgType::COMMAND , srcType); WHISPER::Message msg = WHISPER::Message(getOwnID().getUUID(), WHISPER::MsgTopics::COMMANDS , WHISPER::MsgType::COMMAND , srcType);
messages::entity::order::MoveOrder MoveOrder = messages::entity::order::MoveOrder(); messages::entity::order::MoveOrder MoveOrder = messages::entity::order::MoveOrder();
if (pos_.isValid())
{
MoveOrder.mutable_geocentricposition()->set_x(pos_.getGeocentricPos().x()); MoveOrder.mutable_geocentricposition()->set_x(pos_.getGeocentricPos().x());
MoveOrder.mutable_geocentricposition()->set_y(pos_.getGeocentricPos().y()); MoveOrder.mutable_geocentricposition()->set_y(pos_.getGeocentricPos().y());
MoveOrder.mutable_geocentricposition()->set_z(pos_.getGeocentricPos().z()); MoveOrder.mutable_geocentricposition()->set_z(pos_.getGeocentricPos().z());
if (speed_ != 0) {
MoveOrder.set_speed(speed_);
} }
if (startTime_ != 0) { if (Speed.getValidity() == true) {
MoveOrder.mutable_startingtime()->set_seconds(startTime_); MoveOrder.set_speed(Speed.getValue());
}
if (Course.getValidity() == true) {
MoveOrder.set_course(Course.getValue());
}
if (StartTime.getValidity() == true) {
MoveOrder.mutable_startingtime()->set_seconds(StartTime.getValue());
} }
@@ -77,7 +77,7 @@ namespace Orders
} }
std::shared_ptr<MoveOrder> MoveOrder::unpack(WHISPER::Message msg) std::unique_ptr<MoveOrder> MoveOrder::unpack(WHISPER::Message msg)
{ {
if(msg.msgType_ == WHISPER::MsgType::COMMAND) if(msg.msgType_ == WHISPER::MsgType::COMMAND)
@@ -87,23 +87,26 @@ namespace Orders
{ {
auto order = messages::entity::order::Order(); auto order = messages::entity::order::Order();
protoMsg.payload().UnpackTo(&order); protoMsg.payload().UnpackTo(&order);
if (order.has_orderpayload() && order.orderpayload().Is<messages::entity::order::MoveOrder>()) if (order.has_orderpayload() && order.orderpayload().Is<messages::entity::order::MoveOrder>())
{ {
auto moveOrder = messages::entity::order::MoveOrder(); auto moveOrder = messages::entity::order::MoveOrder();
order.orderpayload().UnpackTo(&moveOrder); order.orderpayload().UnpackTo(&moveOrder);
SimCore::Identifier OrderID(order.orderid().parent(),order.orderid().number(),order.orderid().external());
SimCore::Identifier OrderingID(order.orderingentity().parent(),order.orderingentity().number(),order.orderingentity().external());
SimCore::Identifier OrderedID(order.orderedentity().parent(),order.orderedentity().number(),order.orderedentity().external());
auto pos = SimCore::Position(moveOrder.geocentricposition().x(),moveOrder.geocentricposition().y(),moveOrder.geocentricposition().z()); SimCore::Identifier OrderID(order.orderid());
auto MoveOrderObj = std::make_shared<MoveOrder>(OrderID,OrderingID,OrderedID,(WHISPER::SourceType)msg.sourceType_,pos); auto MoveOrderObj = std::make_unique<MoveOrder>(OrderID,(WHISPER::SourceType)msg.sourceType_);
MoveOrderObj->setSpeed(moveOrder.speed());
MoveOrderObj->setStartTime(moveOrder.mutable_startingtime()->seconds());
return MoveOrderObj; if (moveOrder.has_geocentricposition()) MoveOrderObj->setPosition(SimCore::Position(moveOrder.geocentricposition().x(),moveOrder.geocentricposition().y(),moveOrder.geocentricposition().z()));
if (moveOrder.has_speed()) MoveOrderObj->Speed.setValue(moveOrder.speed());
if (moveOrder.has_course()) MoveOrderObj->Course.setValue(moveOrder.course());
if (moveOrder.has_startingtime()) MoveOrderObj->Course.setValue(moveOrder.mutable_startingtime()->seconds());
return std::move(MoveOrderObj);
} }
} }
@@ -112,5 +115,16 @@ namespace Orders
return nullptr; return nullptr;
} }
std::unique_ptr<MoveOrder> MoveOrder::unpack(std::string msg)
{
if (std::empty(msg) == false && msg != "NULL")
{
WHISPER::Message whisperMessage(msg);
return std::move(unpack(whisperMessage));
}
return nullptr;
}
} }

View File

@@ -1,13 +1,13 @@
#include "SimCore/Identifier.hpp"
#include <Orders/Order.hpp> #include <Orders/Order.hpp>
namespace Orders namespace Orders
{ {
Order::Order(const SimCore::Identifier id,const SimCore::Identifier orderingEntity,const SimCore::Identifier orderedEntity,const WHISPER::SourceType srcType, const Orders::OrderType OrderType_): Order::Order(const SimCore::Identifier OwnID,const WHISPER::SourceType srcType, const Orders::OrderType OrderType_):
orderID_(id), orderID_(SimCore::Identifier()),
orderingEntity_(orderingEntity), OwnID_(OwnID),
orderedEntity_(orderedEntity),
srcType(srcType), srcType(srcType),
OrderType_(OrderType_) OrderType_(OrderType_)
{ {
@@ -18,8 +18,7 @@ namespace Orders
const SimCore::Identifier Order::getOrderID(){ return orderID_;} const SimCore::Identifier Order::getOrderID(){ return orderID_;}
const SimCore::Identifier Order::getOrderingEntity(){ return orderingEntity_;}
const SimCore::Identifier Order::getOrderedEntity(){ return orderedEntity_;}
const Orders::OrderType Order::getOrderType(){return OrderType_;} const Orders::OrderType Order::getOrderType(){return OrderType_;}
const SimCore::Identifier Order::getOwnID(){return OwnID_;}
} }