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

@@ -29,7 +29,8 @@ PROTOBUF_CONSTEXPR MoveOrder::MoveOrder(
, /*decltype(_impl_._cached_size_)*/{}
, /*decltype(_impl_.geocentricposition_)*/nullptr
, /*decltype(_impl_.startingtime_)*/nullptr
, /*decltype(_impl_.speed_)*/0} {}
, /*decltype(_impl_.speed_)*/0
, /*decltype(_impl_.course_)*/0} {}
struct MoveOrderDefaultTypeInternal {
PROTOBUF_CONSTEXPR MoveOrderDefaultTypeInternal()
: _instance(::_pbi::ConstantInitialized{}) {}
@@ -55,13 +56,15 @@ const uint32_t TableStruct_MoveOrder_2eproto::offsets[] PROTOBUF_SECTION_VARIABL
~0u, // no _inlined_string_donated_
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_.course_),
PROTOBUF_FIELD_OFFSET(::messages::entity::order::MoveOrder, _impl_.startingtime_),
~0u,
1,
0,
2,
3,
1,
};
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[] = {
@@ -71,12 +74,13 @@ static const ::_pb::Message* const file_default_instances[] = {
const char descriptor_table_protodef_MoveOrder_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) =
"\n\017MoveOrder.proto\022\025messages.entity.order"
"\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"
"ntityGeocentricPosition\022\022\n\005speed\030\002 \001(\001H\000"
"\210\001\001\0225\n\014startingTime\030\003 \001(\0132\032.google.proto"
"buf.TimestampH\001\210\001\001B\010\n\006_speedB\017\n\r_startin"
"gTimeb\006proto3"
"ntityGeocentricPositionH\000\210\001\001\022\022\n\005speed\030\002 "
"\001(\001H\001\210\001\001\022\023\n\006course\030\003 \001(\001H\002\210\001\001\0225\n\014startin"
"gTime\030\004 \001(\0132\032.google.protobuf.TimestampH"
"\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] = {
&::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;
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",
&descriptor_table_MoveOrder_2eproto_once, descriptor_table_MoveOrder_2eproto_deps, 2, 1,
schemas, file_default_instances, TableStruct_MoveOrder_2eproto::offsets,
@@ -107,12 +111,18 @@ class MoveOrder::_Internal {
public:
using HasBits = decltype(std::declval<MoveOrder>()._impl_._has_bits_);
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) {
(*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 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_;
}
void MoveOrder::clear_geocentricposition() {
if (GetArenaForAllocation() == nullptr && _impl_.geocentricposition_ != nullptr) {
delete _impl_.geocentricposition_;
}
_impl_.geocentricposition_ = nullptr;
if (_impl_.geocentricposition_ != nullptr) _impl_.geocentricposition_->Clear();
_impl_._has_bits_[0] &= ~0x00000001u;
}
void MoveOrder::clear_startingtime() {
if (_impl_.startingtime_ != nullptr) _impl_.startingtime_->Clear();
_impl_._has_bits_[0] &= ~0x00000001u;
_impl_._has_bits_[0] &= ~0x00000002u;
}
MoveOrder::MoveOrder(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned)
@@ -148,7 +156,8 @@ MoveOrder::MoveOrder(const MoveOrder& from)
, /*decltype(_impl_._cached_size_)*/{}
, decltype(_impl_.geocentricposition_){nullptr}
, decltype(_impl_.startingtime_){nullptr}
, decltype(_impl_.speed_){}};
, decltype(_impl_.speed_){}
, decltype(_impl_.course_){}};
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
if (from._internal_has_geocentricposition()) {
@@ -157,7 +166,9 @@ MoveOrder::MoveOrder(const MoveOrder& from)
if (from._internal_has_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)
}
@@ -171,6 +182,7 @@ inline void MoveOrder::SharedCtor(
, decltype(_impl_.geocentricposition_){nullptr}
, decltype(_impl_.startingtime_){nullptr}
, decltype(_impl_.speed_){0}
, decltype(_impl_.course_){0}
};
}
@@ -199,16 +211,22 @@ void MoveOrder::Clear() {
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
if (GetArenaForAllocation() == nullptr && _impl_.geocentricposition_ != nullptr) {
delete _impl_.geocentricposition_;
}
_impl_.geocentricposition_ = nullptr;
cached_has_bits = _impl_._has_bits_[0];
if (cached_has_bits & 0x00000001u) {
GOOGLE_DCHECK(_impl_.startingtime_ != nullptr);
_impl_.startingtime_->Clear();
if (cached_has_bits & 0x00000003u) {
if (cached_has_bits & 0x00000001u) {
GOOGLE_DCHECK(_impl_.geocentricposition_ != nullptr);
_impl_.geocentricposition_->Clear();
}
if (cached_has_bits & 0x00000002u) {
GOOGLE_DCHECK(_impl_.startingtime_ != nullptr);
_impl_.startingtime_->Clear();
}
}
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_.speed_ = 0;
_impl_._has_bits_.Clear();
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
@@ -220,7 +238,7 @@ const char* MoveOrder::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx
uint32_t tag;
ptr = ::_pbi::ReadTag(ptr, &tag);
switch (tag >> 3) {
// .messages.track.EntityGeocentricPosition GeocentricPosition = 1;
// optional .messages.track.EntityGeocentricPosition GeocentricPosition = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
ptr = ctx->ParseMessage(_internal_mutable_geocentricposition(), ptr);
@@ -237,9 +255,18 @@ const char* MoveOrder::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx
} else
goto handle_unusual;
continue;
// optional .google.protobuf.Timestamp startingTime = 3;
// optional double course = 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);
CHK_(ptr);
} else
@@ -275,8 +302,8 @@ uint8_t* MoveOrder::_InternalSerialize(
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
// .messages.track.EntityGeocentricPosition GeocentricPosition = 1;
if (this->_internal_has_geocentricposition()) {
// optional .messages.track.EntityGeocentricPosition GeocentricPosition = 1;
if (_internal_has_geocentricposition()) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessage(1, _Internal::geocentricposition(this),
_Internal::geocentricposition(this).GetCachedSize(), target, stream);
@@ -288,10 +315,16 @@ uint8_t* MoveOrder::_InternalSerialize(
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()) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessage(3, _Internal::startingtime(this),
InternalWriteMessage(4, _Internal::startingtime(this),
_Internal::startingtime(this).GetCachedSize(), target, stream);
}
@@ -311,24 +344,29 @@ size_t MoveOrder::ByteSizeLong() const {
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
// .messages.track.EntityGeocentricPosition GeocentricPosition = 1;
if (this->_internal_has_geocentricposition()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
*_impl_.geocentricposition_);
}
cached_has_bits = _impl_._has_bits_[0];
if (cached_has_bits & 0x00000003u) {
// optional .google.protobuf.Timestamp startingTime = 3;
if (cached_has_bits & 0x0000000fu) {
// optional .messages.track.EntityGeocentricPosition GeocentricPosition = 1;
if (cached_has_bits & 0x00000001u) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
*_impl_.geocentricposition_);
}
// optional .google.protobuf.Timestamp startingTime = 4;
if (cached_has_bits & 0x00000002u) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
*_impl_.startingtime_);
}
// 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;
}
@@ -351,19 +389,22 @@ void MoveOrder::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROT
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
if (from._internal_has_geocentricposition()) {
_this->_internal_mutable_geocentricposition()->::messages::track::EntityGeocentricPosition::MergeFrom(
from._internal_geocentricposition());
}
cached_has_bits = from._impl_._has_bits_[0];
if (cached_has_bits & 0x00000003u) {
if (cached_has_bits & 0x0000000fu) {
if (cached_has_bits & 0x00000001u) {
_this->_internal_mutable_geocentricposition()->::messages::track::EntityGeocentricPosition::MergeFrom(
from._internal_geocentricposition());
}
if (cached_has_bits & 0x00000002u) {
_this->_internal_mutable_startingtime()->::PROTOBUF_NAMESPACE_ID::Timestamp::MergeFrom(
from._internal_startingtime());
}
if (cached_has_bits & 0x00000002u) {
if (cached_has_bits & 0x00000004u) {
_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->_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_);
swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]);
::PROTOBUF_NAMESPACE_ID::internal::memswap<
PROTOBUF_FIELD_OFFSET(MoveOrder, _impl_.speed_)
+ sizeof(MoveOrder::_impl_.speed_)
PROTOBUF_FIELD_OFFSET(MoveOrder, _impl_.course_)
+ sizeof(MoveOrder::_impl_.course_)
- PROTOBUF_FIELD_OFFSET(MoveOrder, _impl_.geocentricposition_)>(
reinterpret_cast<char*>(&_impl_.geocentricposition_),
reinterpret_cast<char*>(&other->_impl_.geocentricposition_));