| /** |
| * Generated by the Emboss compiler. DO NOT EDIT! |
| */ |
| #ifndef TESTDATA_NESTED_STRUCTURE_EMB_H_ |
| #define TESTDATA_NESTED_STRUCTURE_EMB_H_ |
| #include <stdint.h> |
| #include <string.h> |
| |
| #include <algorithm> |
| #include <type_traits> |
| #include <utility> |
| |
| #include "runtime/cpp/emboss_cpp_util.h" |
| |
| #include "runtime/cpp/emboss_prelude.h" |
| |
| #include "runtime/cpp/emboss_enum_view.h" |
| |
| #include "runtime/cpp/emboss_text_util.h" |
| |
| |
| |
| /* NOLINTBEGIN */ |
| namespace emboss { |
| namespace test { |
| namespace Container { |
| |
| } // namespace Container |
| |
| |
| template <class Storage> |
| class GenericContainerView; |
| |
| namespace Box { |
| |
| } // namespace Box |
| |
| |
| template <class Storage> |
| class GenericBoxView; |
| |
| namespace Truck { |
| |
| } // namespace Truck |
| |
| |
| template <class Storage> |
| class GenericTruckView; |
| |
| |
| |
| |
| |
| |
| |
| namespace Container { |
| |
| } // namespace Container |
| |
| |
| template <class View> |
| struct EmbossReservedInternalIsGenericContainerView; |
| |
| template <class Storage> |
| class GenericContainerView final { |
| public: |
| GenericContainerView() : backing_() {} |
| explicit GenericContainerView( |
| Storage emboss_reserved_local_bytes) |
| : backing_(emboss_reserved_local_bytes) |
| {} |
| |
| template <typename OtherStorage> |
| GenericContainerView( |
| const GenericContainerView<OtherStorage> &emboss_reserved_local_other) |
| : backing_{emboss_reserved_local_other.BackingStorage()} |
| {} |
| |
| template <typename Arg, |
| typename = typename ::std::enable_if< |
| !EmbossReservedInternalIsGenericContainerView< |
| typename ::std::remove_cv<typename ::std::remove_reference< |
| Arg>::type>::type>::value>::type> |
| explicit GenericContainerView( |
| Arg &&emboss_reserved_local_arg) |
| : backing_(::std::forward<Arg>( |
| emboss_reserved_local_arg)) |
| {} |
| template <typename Arg0, typename Arg1, typename... Args> |
| explicit GenericContainerView( |
| Arg0 &&emboss_reserved_local_arg0, |
| Arg1 &&emboss_reserved_local_arg1, Args &&... emboss_reserved_local_args) |
| : backing_(::std::forward<Arg0>(emboss_reserved_local_arg0), |
| ::std::forward<Arg1>(emboss_reserved_local_arg1), |
| ::std::forward<Args>( |
| emboss_reserved_local_args)...) |
| {} |
| |
| template <typename OtherStorage> |
| GenericContainerView<Storage> &operator=( |
| const GenericContainerView<OtherStorage> &emboss_reserved_local_other) { |
| backing_ = emboss_reserved_local_other.BackingStorage(); |
| return *this; |
| } |
| |
| |
| |
| bool Ok() const { |
| if (!IsComplete()) return false; |
| |
| if (!has_weight().Known()) return false; |
| if (has_weight().ValueOrDefault() && !weight().Ok()) return false; |
| |
| |
| if (!has_important_box().Known()) return false; |
| if (has_important_box().ValueOrDefault() && !important_box().Ok()) return false; |
| |
| |
| if (!has_other_box().Known()) return false; |
| if (has_other_box().ValueOrDefault() && !other_box().Ok()) return false; |
| |
| |
| if (!has_IntrinsicSizeInBytes().Known()) return false; |
| if (has_IntrinsicSizeInBytes().ValueOrDefault() && !IntrinsicSizeInBytes().Ok()) return false; |
| |
| |
| if (!has_MaxSizeInBytes().Known()) return false; |
| if (has_MaxSizeInBytes().ValueOrDefault() && !MaxSizeInBytes().Ok()) return false; |
| |
| |
| if (!has_MinSizeInBytes().Known()) return false; |
| if (has_MinSizeInBytes().ValueOrDefault() && !MinSizeInBytes().Ok()) return false; |
| |
| |
| |
| return true; |
| } |
| Storage BackingStorage() const { return backing_; } |
| bool IsComplete() const { |
| return backing_.Ok() && IntrinsicSizeInBytes().Ok() && |
| backing_.SizeInBytes() >= |
| static_cast</**/ ::std::size_t>( |
| IntrinsicSizeInBytes().UncheckedRead()); |
| } |
| static constexpr ::std::size_t SizeInBytes() { |
| return static_cast</**/ ::std::size_t>(IntrinsicSizeInBytes().Read()); |
| } |
| static constexpr bool SizeIsKnown() { |
| return IntrinsicSizeInBytes().Ok(); |
| } |
| |
| |
| template <typename OtherStorage> |
| bool Equals( |
| GenericContainerView<OtherStorage> emboss_reserved_local_other) const { |
| |
| if (!has_weight().Known()) return false; |
| if (!emboss_reserved_local_other.has_weight().Known()) return false; |
| |
| if (emboss_reserved_local_other.has_weight().ValueOrDefault() && |
| !has_weight().ValueOrDefault()) |
| return false; |
| if (has_weight().ValueOrDefault() && |
| !emboss_reserved_local_other.has_weight().ValueOrDefault()) |
| return false; |
| |
| if (emboss_reserved_local_other.has_weight().ValueOrDefault() && |
| has_weight().ValueOrDefault() && |
| !weight().Equals(emboss_reserved_local_other.weight())) |
| return false; |
| |
| |
| |
| if (!has_important_box().Known()) return false; |
| if (!emboss_reserved_local_other.has_important_box().Known()) return false; |
| |
| if (emboss_reserved_local_other.has_important_box().ValueOrDefault() && |
| !has_important_box().ValueOrDefault()) |
| return false; |
| if (has_important_box().ValueOrDefault() && |
| !emboss_reserved_local_other.has_important_box().ValueOrDefault()) |
| return false; |
| |
| if (emboss_reserved_local_other.has_important_box().ValueOrDefault() && |
| has_important_box().ValueOrDefault() && |
| !important_box().Equals(emboss_reserved_local_other.important_box())) |
| return false; |
| |
| |
| |
| if (!has_other_box().Known()) return false; |
| if (!emboss_reserved_local_other.has_other_box().Known()) return false; |
| |
| if (emboss_reserved_local_other.has_other_box().ValueOrDefault() && |
| !has_other_box().ValueOrDefault()) |
| return false; |
| if (has_other_box().ValueOrDefault() && |
| !emboss_reserved_local_other.has_other_box().ValueOrDefault()) |
| return false; |
| |
| if (emboss_reserved_local_other.has_other_box().ValueOrDefault() && |
| has_other_box().ValueOrDefault() && |
| !other_box().Equals(emboss_reserved_local_other.other_box())) |
| return false; |
| |
| return true; |
| } |
| template <typename OtherStorage> |
| bool UncheckedEquals( |
| GenericContainerView<OtherStorage> emboss_reserved_local_other) const { |
| |
| if (emboss_reserved_local_other.has_weight().ValueOr(false) && |
| !has_weight().ValueOr(false)) |
| return false; |
| if (has_weight().ValueOr(false) && |
| !emboss_reserved_local_other.has_weight().ValueOr(false)) |
| return false; |
| |
| if (emboss_reserved_local_other.has_weight().ValueOr(false) && |
| has_weight().ValueOr(false) && |
| !weight().UncheckedEquals(emboss_reserved_local_other.weight())) |
| return false; |
| |
| |
| |
| if (emboss_reserved_local_other.has_important_box().ValueOr(false) && |
| !has_important_box().ValueOr(false)) |
| return false; |
| if (has_important_box().ValueOr(false) && |
| !emboss_reserved_local_other.has_important_box().ValueOr(false)) |
| return false; |
| |
| if (emboss_reserved_local_other.has_important_box().ValueOr(false) && |
| has_important_box().ValueOr(false) && |
| !important_box().UncheckedEquals(emboss_reserved_local_other.important_box())) |
| return false; |
| |
| |
| |
| if (emboss_reserved_local_other.has_other_box().ValueOr(false) && |
| !has_other_box().ValueOr(false)) |
| return false; |
| if (has_other_box().ValueOr(false) && |
| !emboss_reserved_local_other.has_other_box().ValueOr(false)) |
| return false; |
| |
| if (emboss_reserved_local_other.has_other_box().ValueOr(false) && |
| has_other_box().ValueOr(false) && |
| !other_box().UncheckedEquals(emboss_reserved_local_other.other_box())) |
| return false; |
| |
| return true; |
| } |
| template <typename OtherStorage> |
| void UncheckedCopyFrom( |
| GenericContainerView<OtherStorage> emboss_reserved_local_other) const { |
| backing_.UncheckedCopyFrom( |
| emboss_reserved_local_other.BackingStorage(), |
| emboss_reserved_local_other.IntrinsicSizeInBytes().UncheckedRead()); |
| } |
| |
| template <typename OtherStorage> |
| void CopyFrom( |
| GenericContainerView<OtherStorage> emboss_reserved_local_other) const { |
| backing_.CopyFrom( |
| emboss_reserved_local_other.BackingStorage(), |
| emboss_reserved_local_other.IntrinsicSizeInBytes().Read()); |
| } |
| template <typename OtherStorage> |
| bool TryToCopyFrom( |
| GenericContainerView<OtherStorage> emboss_reserved_local_other) const { |
| return emboss_reserved_local_other.Ok() && backing_.TryToCopyFrom( |
| emboss_reserved_local_other.BackingStorage(), |
| emboss_reserved_local_other.IntrinsicSizeInBytes().Read()); |
| } |
| |
| template <class Stream> |
| bool UpdateFromTextStream(Stream *emboss_reserved_local_stream) const { |
| ::std::string emboss_reserved_local_brace; |
| if (!::emboss::support::ReadToken(emboss_reserved_local_stream, |
| &emboss_reserved_local_brace)) |
| return false; |
| if (emboss_reserved_local_brace != "{") return false; |
| for (;;) { |
| ::std::string emboss_reserved_local_name; |
| if (!::emboss::support::ReadToken(emboss_reserved_local_stream, |
| &emboss_reserved_local_name)) |
| return false; |
| if (emboss_reserved_local_name == ",") |
| if (!::emboss::support::ReadToken(emboss_reserved_local_stream, |
| &emboss_reserved_local_name)) |
| return false; |
| if (emboss_reserved_local_name == "}") return true; |
| ::std::string emboss_reserved_local_colon; |
| if (!::emboss::support::ReadToken(emboss_reserved_local_stream, |
| &emboss_reserved_local_colon)) |
| return false; |
| if (emboss_reserved_local_colon != ":") return false; |
| if (emboss_reserved_local_name == "weight") { |
| if (!weight().UpdateFromTextStream( |
| emboss_reserved_local_stream)) { |
| return false; |
| } |
| continue; |
| } |
| |
| if (emboss_reserved_local_name == "important_box") { |
| if (!important_box().UpdateFromTextStream( |
| emboss_reserved_local_stream)) { |
| return false; |
| } |
| continue; |
| } |
| |
| if (emboss_reserved_local_name == "other_box") { |
| if (!other_box().UpdateFromTextStream( |
| emboss_reserved_local_stream)) { |
| return false; |
| } |
| continue; |
| } |
| |
| return false; |
| } |
| } |
| |
| template <class Stream> |
| void WriteToTextStream( |
| Stream *emboss_reserved_local_stream, |
| ::emboss::TextOutputOptions emboss_reserved_local_options) const { |
| ::emboss::TextOutputOptions emboss_reserved_local_field_options = |
| emboss_reserved_local_options.PlusOneIndent(); |
| if (emboss_reserved_local_options.multiline()) { |
| emboss_reserved_local_stream->Write("{\n"); |
| } else { |
| emboss_reserved_local_stream->Write("{"); |
| } |
| bool emboss_reserved_local_wrote_field = false; |
| if (has_weight().ValueOr(false)) { |
| if (!emboss_reserved_local_field_options.allow_partial_output() || |
| weight().IsAggregate() || weight().Ok()) { |
| if (emboss_reserved_local_field_options.multiline()) { |
| emboss_reserved_local_stream->Write( |
| emboss_reserved_local_field_options.current_indent()); |
| } else { |
| if (emboss_reserved_local_wrote_field) { |
| emboss_reserved_local_stream->Write(","); |
| } |
| emboss_reserved_local_stream->Write(" "); |
| } |
| emboss_reserved_local_stream->Write("weight: "); |
| weight().WriteToTextStream(emboss_reserved_local_stream, |
| emboss_reserved_local_field_options); |
| emboss_reserved_local_wrote_field = true; |
| if (emboss_reserved_local_field_options.multiline()) { |
| emboss_reserved_local_stream->Write("\n"); |
| } |
| } else if (emboss_reserved_local_field_options.allow_partial_output() && |
| emboss_reserved_local_field_options.comments() && |
| !weight().IsAggregate() && !weight().Ok()) { |
| if (emboss_reserved_local_field_options.multiline()) { |
| emboss_reserved_local_stream->Write( |
| emboss_reserved_local_field_options.current_indent()); |
| } |
| emboss_reserved_local_stream->Write("# weight: UNREADABLE\n"); |
| } |
| } |
| |
| if (has_important_box().ValueOr(false)) { |
| if (!emboss_reserved_local_field_options.allow_partial_output() || |
| important_box().IsAggregate() || important_box().Ok()) { |
| if (emboss_reserved_local_field_options.multiline()) { |
| emboss_reserved_local_stream->Write( |
| emboss_reserved_local_field_options.current_indent()); |
| } else { |
| if (emboss_reserved_local_wrote_field) { |
| emboss_reserved_local_stream->Write(","); |
| } |
| emboss_reserved_local_stream->Write(" "); |
| } |
| emboss_reserved_local_stream->Write("important_box: "); |
| important_box().WriteToTextStream(emboss_reserved_local_stream, |
| emboss_reserved_local_field_options); |
| emboss_reserved_local_wrote_field = true; |
| if (emboss_reserved_local_field_options.multiline()) { |
| emboss_reserved_local_stream->Write("\n"); |
| } |
| } else if (emboss_reserved_local_field_options.allow_partial_output() && |
| emboss_reserved_local_field_options.comments() && |
| !important_box().IsAggregate() && !important_box().Ok()) { |
| if (emboss_reserved_local_field_options.multiline()) { |
| emboss_reserved_local_stream->Write( |
| emboss_reserved_local_field_options.current_indent()); |
| } |
| emboss_reserved_local_stream->Write("# important_box: UNREADABLE\n"); |
| } |
| } |
| |
| if (has_other_box().ValueOr(false)) { |
| if (!emboss_reserved_local_field_options.allow_partial_output() || |
| other_box().IsAggregate() || other_box().Ok()) { |
| if (emboss_reserved_local_field_options.multiline()) { |
| emboss_reserved_local_stream->Write( |
| emboss_reserved_local_field_options.current_indent()); |
| } else { |
| if (emboss_reserved_local_wrote_field) { |
| emboss_reserved_local_stream->Write(","); |
| } |
| emboss_reserved_local_stream->Write(" "); |
| } |
| emboss_reserved_local_stream->Write("other_box: "); |
| other_box().WriteToTextStream(emboss_reserved_local_stream, |
| emboss_reserved_local_field_options); |
| emboss_reserved_local_wrote_field = true; |
| if (emboss_reserved_local_field_options.multiline()) { |
| emboss_reserved_local_stream->Write("\n"); |
| } |
| } else if (emboss_reserved_local_field_options.allow_partial_output() && |
| emboss_reserved_local_field_options.comments() && |
| !other_box().IsAggregate() && !other_box().Ok()) { |
| if (emboss_reserved_local_field_options.multiline()) { |
| emboss_reserved_local_stream->Write( |
| emboss_reserved_local_field_options.current_indent()); |
| } |
| emboss_reserved_local_stream->Write("# other_box: UNREADABLE\n"); |
| } |
| } |
| |
| (void)emboss_reserved_local_wrote_field; |
| if (emboss_reserved_local_options.multiline()) { |
| emboss_reserved_local_stream->Write( |
| emboss_reserved_local_options.current_indent()); |
| emboss_reserved_local_stream->Write("}"); |
| } else { |
| emboss_reserved_local_stream->Write(" }"); |
| } |
| } |
| |
| |
| |
| static constexpr bool IsAggregate() { return true; } |
| |
| public: |
| typename ::emboss::prelude::UIntView< |
| /**/ ::emboss::support::FixedSizeViewParameters<32, ::emboss::support::AllValuesAreOk>, |
| typename ::emboss::support::BitBlock</**/::emboss::support::LittleEndianByteOrderer<typename Storage::template OffsetStorageType</**/0, 0>>, 32>> |
| |
| weight() const; |
| ::emboss::support::Maybe<bool> has_weight() const; |
| |
| public: |
| typename ::emboss::test::GenericBoxView<typename Storage::template OffsetStorageType</**/0, 4>> |
| |
| important_box() const; |
| ::emboss::support::Maybe<bool> has_important_box() const; |
| |
| public: |
| typename ::emboss::test::GenericBoxView<typename Storage::template OffsetStorageType</**/0, 12>> |
| |
| other_box() const; |
| ::emboss::support::Maybe<bool> has_other_box() const; |
| |
| public: |
| class EmbossReservedDollarVirtualIntrinsicSizeInBytesView final { |
| public: |
| using ValueType = ::std::int32_t; |
| |
| constexpr EmbossReservedDollarVirtualIntrinsicSizeInBytesView() {} |
| EmbossReservedDollarVirtualIntrinsicSizeInBytesView(const EmbossReservedDollarVirtualIntrinsicSizeInBytesView &) = default; |
| EmbossReservedDollarVirtualIntrinsicSizeInBytesView(EmbossReservedDollarVirtualIntrinsicSizeInBytesView &&) = default; |
| EmbossReservedDollarVirtualIntrinsicSizeInBytesView &operator=(const EmbossReservedDollarVirtualIntrinsicSizeInBytesView &) = |
| default; |
| EmbossReservedDollarVirtualIntrinsicSizeInBytesView &operator=(EmbossReservedDollarVirtualIntrinsicSizeInBytesView &&) = |
| default; |
| ~EmbossReservedDollarVirtualIntrinsicSizeInBytesView() = default; |
| |
| static constexpr ::std::int32_t Read(); |
| static constexpr ::std::int32_t UncheckedRead(); |
| static constexpr bool Ok() { return true; } |
| template <class Stream> |
| void WriteToTextStream(Stream *emboss_reserved_local_stream, |
| const ::emboss::TextOutputOptions |
| &emboss_reserved_local_options) const { |
| ::emboss::support::WriteIntegerViewToTextStream( |
| this, emboss_reserved_local_stream, emboss_reserved_local_options); |
| } |
| |
| static constexpr bool IsAggregate() { return false; } |
| }; |
| |
| static constexpr EmbossReservedDollarVirtualIntrinsicSizeInBytesView IntrinsicSizeInBytes() { |
| return EmbossReservedDollarVirtualIntrinsicSizeInBytesView(); |
| } |
| static constexpr ::emboss::support::Maybe<bool> has_IntrinsicSizeInBytes() { |
| return ::emboss::support::Maybe<bool>(true); |
| } |
| |
| public: |
| class EmbossReservedDollarVirtualMaxSizeInBytesView final { |
| public: |
| using ValueType = ::std::int32_t; |
| |
| constexpr EmbossReservedDollarVirtualMaxSizeInBytesView() {} |
| EmbossReservedDollarVirtualMaxSizeInBytesView(const EmbossReservedDollarVirtualMaxSizeInBytesView &) = default; |
| EmbossReservedDollarVirtualMaxSizeInBytesView(EmbossReservedDollarVirtualMaxSizeInBytesView &&) = default; |
| EmbossReservedDollarVirtualMaxSizeInBytesView &operator=(const EmbossReservedDollarVirtualMaxSizeInBytesView &) = |
| default; |
| EmbossReservedDollarVirtualMaxSizeInBytesView &operator=(EmbossReservedDollarVirtualMaxSizeInBytesView &&) = |
| default; |
| ~EmbossReservedDollarVirtualMaxSizeInBytesView() = default; |
| |
| static constexpr ::std::int32_t Read(); |
| static constexpr ::std::int32_t UncheckedRead(); |
| static constexpr bool Ok() { return true; } |
| template <class Stream> |
| void WriteToTextStream(Stream *emboss_reserved_local_stream, |
| const ::emboss::TextOutputOptions |
| &emboss_reserved_local_options) const { |
| ::emboss::support::WriteIntegerViewToTextStream( |
| this, emboss_reserved_local_stream, emboss_reserved_local_options); |
| } |
| |
| static constexpr bool IsAggregate() { return false; } |
| }; |
| |
| static constexpr EmbossReservedDollarVirtualMaxSizeInBytesView MaxSizeInBytes() { |
| return EmbossReservedDollarVirtualMaxSizeInBytesView(); |
| } |
| static constexpr ::emboss::support::Maybe<bool> has_MaxSizeInBytes() { |
| return ::emboss::support::Maybe<bool>(true); |
| } |
| |
| public: |
| class EmbossReservedDollarVirtualMinSizeInBytesView final { |
| public: |
| using ValueType = ::std::int32_t; |
| |
| constexpr EmbossReservedDollarVirtualMinSizeInBytesView() {} |
| EmbossReservedDollarVirtualMinSizeInBytesView(const EmbossReservedDollarVirtualMinSizeInBytesView &) = default; |
| EmbossReservedDollarVirtualMinSizeInBytesView(EmbossReservedDollarVirtualMinSizeInBytesView &&) = default; |
| EmbossReservedDollarVirtualMinSizeInBytesView &operator=(const EmbossReservedDollarVirtualMinSizeInBytesView &) = |
| default; |
| EmbossReservedDollarVirtualMinSizeInBytesView &operator=(EmbossReservedDollarVirtualMinSizeInBytesView &&) = |
| default; |
| ~EmbossReservedDollarVirtualMinSizeInBytesView() = default; |
| |
| static constexpr ::std::int32_t Read(); |
| static constexpr ::std::int32_t UncheckedRead(); |
| static constexpr bool Ok() { return true; } |
| template <class Stream> |
| void WriteToTextStream(Stream *emboss_reserved_local_stream, |
| const ::emboss::TextOutputOptions |
| &emboss_reserved_local_options) const { |
| ::emboss::support::WriteIntegerViewToTextStream( |
| this, emboss_reserved_local_stream, emboss_reserved_local_options); |
| } |
| |
| static constexpr bool IsAggregate() { return false; } |
| }; |
| |
| static constexpr EmbossReservedDollarVirtualMinSizeInBytesView MinSizeInBytes() { |
| return EmbossReservedDollarVirtualMinSizeInBytesView(); |
| } |
| static constexpr ::emboss::support::Maybe<bool> has_MinSizeInBytes() { |
| return ::emboss::support::Maybe<bool>(true); |
| } |
| |
| |
| |
| private: |
| Storage backing_; |
| |
| |
| |
| template <class OtherStorage> |
| friend class GenericContainerView; |
| }; |
| using ContainerView = |
| GenericContainerView</**/ ::emboss::support::ReadOnlyContiguousBuffer>; |
| using ContainerWriter = |
| GenericContainerView</**/ ::emboss::support::ReadWriteContiguousBuffer>; |
| |
| template <class View> |
| struct EmbossReservedInternalIsGenericContainerView { |
| static constexpr const bool value = false; |
| }; |
| |
| template <class Storage> |
| struct EmbossReservedInternalIsGenericContainerView< |
| GenericContainerView<Storage>> { |
| static constexpr const bool value = true; |
| }; |
| |
| template <typename T> |
| inline GenericContainerView< |
| /**/ ::emboss::support::ContiguousBuffer< |
| typename ::std::remove_reference< |
| decltype(*::std::declval<T>()->data())>::type, |
| 1, 0>> |
| MakeContainerView( T &&emboss_reserved_local_arg) { |
| return GenericContainerView< |
| /**/ ::emboss::support::ContiguousBuffer< |
| typename ::std::remove_reference<decltype( |
| *::std::declval<T>()->data())>::type, |
| 1, 0>>( |
| ::std::forward<T>(emboss_reserved_local_arg)); |
| } |
| |
| template <typename T> |
| inline GenericContainerView</**/ ::emboss::support::ContiguousBuffer<T, 1, 0>> |
| MakeContainerView( T *emboss_reserved_local_data, |
| ::std::size_t emboss_reserved_local_size) { |
| return GenericContainerView</**/ ::emboss::support::ContiguousBuffer<T, 1, 0>>( |
| emboss_reserved_local_data, |
| emboss_reserved_local_size); |
| } |
| |
| template <typename T, ::std::size_t kAlignment> |
| inline GenericContainerView< |
| /**/ ::emboss::support::ContiguousBuffer<T, kAlignment, 0>> |
| MakeAlignedContainerView( |
| T *emboss_reserved_local_data, |
| ::std::size_t emboss_reserved_local_size) { |
| return GenericContainerView< |
| /**/ ::emboss::support::ContiguousBuffer<T, kAlignment, 0>>( |
| emboss_reserved_local_data, |
| emboss_reserved_local_size); |
| } |
| |
| |
| |
| |
| namespace Box { |
| |
| } // namespace Box |
| |
| |
| template <class View> |
| struct EmbossReservedInternalIsGenericBoxView; |
| |
| template <class Storage> |
| class GenericBoxView final { |
| public: |
| GenericBoxView() : backing_() {} |
| explicit GenericBoxView( |
| Storage emboss_reserved_local_bytes) |
| : backing_(emboss_reserved_local_bytes) |
| {} |
| |
| template <typename OtherStorage> |
| GenericBoxView( |
| const GenericBoxView<OtherStorage> &emboss_reserved_local_other) |
| : backing_{emboss_reserved_local_other.BackingStorage()} |
| {} |
| |
| template <typename Arg, |
| typename = typename ::std::enable_if< |
| !EmbossReservedInternalIsGenericBoxView< |
| typename ::std::remove_cv<typename ::std::remove_reference< |
| Arg>::type>::type>::value>::type> |
| explicit GenericBoxView( |
| Arg &&emboss_reserved_local_arg) |
| : backing_(::std::forward<Arg>( |
| emboss_reserved_local_arg)) |
| {} |
| template <typename Arg0, typename Arg1, typename... Args> |
| explicit GenericBoxView( |
| Arg0 &&emboss_reserved_local_arg0, |
| Arg1 &&emboss_reserved_local_arg1, Args &&... emboss_reserved_local_args) |
| : backing_(::std::forward<Arg0>(emboss_reserved_local_arg0), |
| ::std::forward<Arg1>(emboss_reserved_local_arg1), |
| ::std::forward<Args>( |
| emboss_reserved_local_args)...) |
| {} |
| |
| template <typename OtherStorage> |
| GenericBoxView<Storage> &operator=( |
| const GenericBoxView<OtherStorage> &emboss_reserved_local_other) { |
| backing_ = emboss_reserved_local_other.BackingStorage(); |
| return *this; |
| } |
| |
| |
| |
| bool Ok() const { |
| if (!IsComplete()) return false; |
| |
| if (!has_id().Known()) return false; |
| if (has_id().ValueOrDefault() && !id().Ok()) return false; |
| |
| |
| if (!has_count().Known()) return false; |
| if (has_count().ValueOrDefault() && !count().Ok()) return false; |
| |
| |
| if (!has_IntrinsicSizeInBytes().Known()) return false; |
| if (has_IntrinsicSizeInBytes().ValueOrDefault() && !IntrinsicSizeInBytes().Ok()) return false; |
| |
| |
| if (!has_MaxSizeInBytes().Known()) return false; |
| if (has_MaxSizeInBytes().ValueOrDefault() && !MaxSizeInBytes().Ok()) return false; |
| |
| |
| if (!has_MinSizeInBytes().Known()) return false; |
| if (has_MinSizeInBytes().ValueOrDefault() && !MinSizeInBytes().Ok()) return false; |
| |
| |
| |
| return true; |
| } |
| Storage BackingStorage() const { return backing_; } |
| bool IsComplete() const { |
| return backing_.Ok() && IntrinsicSizeInBytes().Ok() && |
| backing_.SizeInBytes() >= |
| static_cast</**/ ::std::size_t>( |
| IntrinsicSizeInBytes().UncheckedRead()); |
| } |
| static constexpr ::std::size_t SizeInBytes() { |
| return static_cast</**/ ::std::size_t>(IntrinsicSizeInBytes().Read()); |
| } |
| static constexpr bool SizeIsKnown() { |
| return IntrinsicSizeInBytes().Ok(); |
| } |
| |
| |
| template <typename OtherStorage> |
| bool Equals( |
| GenericBoxView<OtherStorage> emboss_reserved_local_other) const { |
| |
| if (!has_id().Known()) return false; |
| if (!emboss_reserved_local_other.has_id().Known()) return false; |
| |
| if (emboss_reserved_local_other.has_id().ValueOrDefault() && |
| !has_id().ValueOrDefault()) |
| return false; |
| if (has_id().ValueOrDefault() && |
| !emboss_reserved_local_other.has_id().ValueOrDefault()) |
| return false; |
| |
| if (emboss_reserved_local_other.has_id().ValueOrDefault() && |
| has_id().ValueOrDefault() && |
| !id().Equals(emboss_reserved_local_other.id())) |
| return false; |
| |
| |
| |
| if (!has_count().Known()) return false; |
| if (!emboss_reserved_local_other.has_count().Known()) return false; |
| |
| if (emboss_reserved_local_other.has_count().ValueOrDefault() && |
| !has_count().ValueOrDefault()) |
| return false; |
| if (has_count().ValueOrDefault() && |
| !emboss_reserved_local_other.has_count().ValueOrDefault()) |
| return false; |
| |
| if (emboss_reserved_local_other.has_count().ValueOrDefault() && |
| has_count().ValueOrDefault() && |
| !count().Equals(emboss_reserved_local_other.count())) |
| return false; |
| |
| return true; |
| } |
| template <typename OtherStorage> |
| bool UncheckedEquals( |
| GenericBoxView<OtherStorage> emboss_reserved_local_other) const { |
| |
| if (emboss_reserved_local_other.has_id().ValueOr(false) && |
| !has_id().ValueOr(false)) |
| return false; |
| if (has_id().ValueOr(false) && |
| !emboss_reserved_local_other.has_id().ValueOr(false)) |
| return false; |
| |
| if (emboss_reserved_local_other.has_id().ValueOr(false) && |
| has_id().ValueOr(false) && |
| !id().UncheckedEquals(emboss_reserved_local_other.id())) |
| return false; |
| |
| |
| |
| if (emboss_reserved_local_other.has_count().ValueOr(false) && |
| !has_count().ValueOr(false)) |
| return false; |
| if (has_count().ValueOr(false) && |
| !emboss_reserved_local_other.has_count().ValueOr(false)) |
| return false; |
| |
| if (emboss_reserved_local_other.has_count().ValueOr(false) && |
| has_count().ValueOr(false) && |
| !count().UncheckedEquals(emboss_reserved_local_other.count())) |
| return false; |
| |
| return true; |
| } |
| template <typename OtherStorage> |
| void UncheckedCopyFrom( |
| GenericBoxView<OtherStorage> emboss_reserved_local_other) const { |
| backing_.UncheckedCopyFrom( |
| emboss_reserved_local_other.BackingStorage(), |
| emboss_reserved_local_other.IntrinsicSizeInBytes().UncheckedRead()); |
| } |
| |
| template <typename OtherStorage> |
| void CopyFrom( |
| GenericBoxView<OtherStorage> emboss_reserved_local_other) const { |
| backing_.CopyFrom( |
| emboss_reserved_local_other.BackingStorage(), |
| emboss_reserved_local_other.IntrinsicSizeInBytes().Read()); |
| } |
| template <typename OtherStorage> |
| bool TryToCopyFrom( |
| GenericBoxView<OtherStorage> emboss_reserved_local_other) const { |
| return emboss_reserved_local_other.Ok() && backing_.TryToCopyFrom( |
| emboss_reserved_local_other.BackingStorage(), |
| emboss_reserved_local_other.IntrinsicSizeInBytes().Read()); |
| } |
| |
| template <class Stream> |
| bool UpdateFromTextStream(Stream *emboss_reserved_local_stream) const { |
| ::std::string emboss_reserved_local_brace; |
| if (!::emboss::support::ReadToken(emboss_reserved_local_stream, |
| &emboss_reserved_local_brace)) |
| return false; |
| if (emboss_reserved_local_brace != "{") return false; |
| for (;;) { |
| ::std::string emboss_reserved_local_name; |
| if (!::emboss::support::ReadToken(emboss_reserved_local_stream, |
| &emboss_reserved_local_name)) |
| return false; |
| if (emboss_reserved_local_name == ",") |
| if (!::emboss::support::ReadToken(emboss_reserved_local_stream, |
| &emboss_reserved_local_name)) |
| return false; |
| if (emboss_reserved_local_name == "}") return true; |
| ::std::string emboss_reserved_local_colon; |
| if (!::emboss::support::ReadToken(emboss_reserved_local_stream, |
| &emboss_reserved_local_colon)) |
| return false; |
| if (emboss_reserved_local_colon != ":") return false; |
| if (emboss_reserved_local_name == "id") { |
| if (!id().UpdateFromTextStream( |
| emboss_reserved_local_stream)) { |
| return false; |
| } |
| continue; |
| } |
| |
| if (emboss_reserved_local_name == "count") { |
| if (!count().UpdateFromTextStream( |
| emboss_reserved_local_stream)) { |
| return false; |
| } |
| continue; |
| } |
| |
| return false; |
| } |
| } |
| |
| template <class Stream> |
| void WriteToTextStream( |
| Stream *emboss_reserved_local_stream, |
| ::emboss::TextOutputOptions emboss_reserved_local_options) const { |
| ::emboss::TextOutputOptions emboss_reserved_local_field_options = |
| emboss_reserved_local_options.PlusOneIndent(); |
| if (emboss_reserved_local_options.multiline()) { |
| emboss_reserved_local_stream->Write("{\n"); |
| } else { |
| emboss_reserved_local_stream->Write("{"); |
| } |
| bool emboss_reserved_local_wrote_field = false; |
| if (has_id().ValueOr(false)) { |
| if (!emboss_reserved_local_field_options.allow_partial_output() || |
| id().IsAggregate() || id().Ok()) { |
| if (emboss_reserved_local_field_options.multiline()) { |
| emboss_reserved_local_stream->Write( |
| emboss_reserved_local_field_options.current_indent()); |
| } else { |
| if (emboss_reserved_local_wrote_field) { |
| emboss_reserved_local_stream->Write(","); |
| } |
| emboss_reserved_local_stream->Write(" "); |
| } |
| emboss_reserved_local_stream->Write("id: "); |
| id().WriteToTextStream(emboss_reserved_local_stream, |
| emboss_reserved_local_field_options); |
| emboss_reserved_local_wrote_field = true; |
| if (emboss_reserved_local_field_options.multiline()) { |
| emboss_reserved_local_stream->Write("\n"); |
| } |
| } else if (emboss_reserved_local_field_options.allow_partial_output() && |
| emboss_reserved_local_field_options.comments() && |
| !id().IsAggregate() && !id().Ok()) { |
| if (emboss_reserved_local_field_options.multiline()) { |
| emboss_reserved_local_stream->Write( |
| emboss_reserved_local_field_options.current_indent()); |
| } |
| emboss_reserved_local_stream->Write("# id: UNREADABLE\n"); |
| } |
| } |
| |
| if (has_count().ValueOr(false)) { |
| if (!emboss_reserved_local_field_options.allow_partial_output() || |
| count().IsAggregate() || count().Ok()) { |
| if (emboss_reserved_local_field_options.multiline()) { |
| emboss_reserved_local_stream->Write( |
| emboss_reserved_local_field_options.current_indent()); |
| } else { |
| if (emboss_reserved_local_wrote_field) { |
| emboss_reserved_local_stream->Write(","); |
| } |
| emboss_reserved_local_stream->Write(" "); |
| } |
| emboss_reserved_local_stream->Write("count: "); |
| count().WriteToTextStream(emboss_reserved_local_stream, |
| emboss_reserved_local_field_options); |
| emboss_reserved_local_wrote_field = true; |
| if (emboss_reserved_local_field_options.multiline()) { |
| emboss_reserved_local_stream->Write("\n"); |
| } |
| } else if (emboss_reserved_local_field_options.allow_partial_output() && |
| emboss_reserved_local_field_options.comments() && |
| !count().IsAggregate() && !count().Ok()) { |
| if (emboss_reserved_local_field_options.multiline()) { |
| emboss_reserved_local_stream->Write( |
| emboss_reserved_local_field_options.current_indent()); |
| } |
| emboss_reserved_local_stream->Write("# count: UNREADABLE\n"); |
| } |
| } |
| |
| (void)emboss_reserved_local_wrote_field; |
| if (emboss_reserved_local_options.multiline()) { |
| emboss_reserved_local_stream->Write( |
| emboss_reserved_local_options.current_indent()); |
| emboss_reserved_local_stream->Write("}"); |
| } else { |
| emboss_reserved_local_stream->Write(" }"); |
| } |
| } |
| |
| |
| |
| static constexpr bool IsAggregate() { return true; } |
| |
| public: |
| typename ::emboss::prelude::UIntView< |
| /**/ ::emboss::support::FixedSizeViewParameters<32, ::emboss::support::AllValuesAreOk>, |
| typename ::emboss::support::BitBlock</**/::emboss::support::LittleEndianByteOrderer<typename Storage::template OffsetStorageType</**/0, 0>>, 32>> |
| |
| id() const; |
| ::emboss::support::Maybe<bool> has_id() const; |
| |
| public: |
| typename ::emboss::prelude::UIntView< |
| /**/ ::emboss::support::FixedSizeViewParameters<32, ::emboss::support::AllValuesAreOk>, |
| typename ::emboss::support::BitBlock</**/::emboss::support::LittleEndianByteOrderer<typename Storage::template OffsetStorageType</**/0, 4>>, 32>> |
| |
| count() const; |
| ::emboss::support::Maybe<bool> has_count() const; |
| |
| public: |
| class EmbossReservedDollarVirtualIntrinsicSizeInBytesView final { |
| public: |
| using ValueType = ::std::int32_t; |
| |
| constexpr EmbossReservedDollarVirtualIntrinsicSizeInBytesView() {} |
| EmbossReservedDollarVirtualIntrinsicSizeInBytesView(const EmbossReservedDollarVirtualIntrinsicSizeInBytesView &) = default; |
| EmbossReservedDollarVirtualIntrinsicSizeInBytesView(EmbossReservedDollarVirtualIntrinsicSizeInBytesView &&) = default; |
| EmbossReservedDollarVirtualIntrinsicSizeInBytesView &operator=(const EmbossReservedDollarVirtualIntrinsicSizeInBytesView &) = |
| default; |
| EmbossReservedDollarVirtualIntrinsicSizeInBytesView &operator=(EmbossReservedDollarVirtualIntrinsicSizeInBytesView &&) = |
| default; |
| ~EmbossReservedDollarVirtualIntrinsicSizeInBytesView() = default; |
| |
| static constexpr ::std::int32_t Read(); |
| static constexpr ::std::int32_t UncheckedRead(); |
| static constexpr bool Ok() { return true; } |
| template <class Stream> |
| void WriteToTextStream(Stream *emboss_reserved_local_stream, |
| const ::emboss::TextOutputOptions |
| &emboss_reserved_local_options) const { |
| ::emboss::support::WriteIntegerViewToTextStream( |
| this, emboss_reserved_local_stream, emboss_reserved_local_options); |
| } |
| |
| static constexpr bool IsAggregate() { return false; } |
| }; |
| |
| static constexpr EmbossReservedDollarVirtualIntrinsicSizeInBytesView IntrinsicSizeInBytes() { |
| return EmbossReservedDollarVirtualIntrinsicSizeInBytesView(); |
| } |
| static constexpr ::emboss::support::Maybe<bool> has_IntrinsicSizeInBytes() { |
| return ::emboss::support::Maybe<bool>(true); |
| } |
| |
| public: |
| class EmbossReservedDollarVirtualMaxSizeInBytesView final { |
| public: |
| using ValueType = ::std::int32_t; |
| |
| constexpr EmbossReservedDollarVirtualMaxSizeInBytesView() {} |
| EmbossReservedDollarVirtualMaxSizeInBytesView(const EmbossReservedDollarVirtualMaxSizeInBytesView &) = default; |
| EmbossReservedDollarVirtualMaxSizeInBytesView(EmbossReservedDollarVirtualMaxSizeInBytesView &&) = default; |
| EmbossReservedDollarVirtualMaxSizeInBytesView &operator=(const EmbossReservedDollarVirtualMaxSizeInBytesView &) = |
| default; |
| EmbossReservedDollarVirtualMaxSizeInBytesView &operator=(EmbossReservedDollarVirtualMaxSizeInBytesView &&) = |
| default; |
| ~EmbossReservedDollarVirtualMaxSizeInBytesView() = default; |
| |
| static constexpr ::std::int32_t Read(); |
| static constexpr ::std::int32_t UncheckedRead(); |
| static constexpr bool Ok() { return true; } |
| template <class Stream> |
| void WriteToTextStream(Stream *emboss_reserved_local_stream, |
| const ::emboss::TextOutputOptions |
| &emboss_reserved_local_options) const { |
| ::emboss::support::WriteIntegerViewToTextStream( |
| this, emboss_reserved_local_stream, emboss_reserved_local_options); |
| } |
| |
| static constexpr bool IsAggregate() { return false; } |
| }; |
| |
| static constexpr EmbossReservedDollarVirtualMaxSizeInBytesView MaxSizeInBytes() { |
| return EmbossReservedDollarVirtualMaxSizeInBytesView(); |
| } |
| static constexpr ::emboss::support::Maybe<bool> has_MaxSizeInBytes() { |
| return ::emboss::support::Maybe<bool>(true); |
| } |
| |
| public: |
| class EmbossReservedDollarVirtualMinSizeInBytesView final { |
| public: |
| using ValueType = ::std::int32_t; |
| |
| constexpr EmbossReservedDollarVirtualMinSizeInBytesView() {} |
| EmbossReservedDollarVirtualMinSizeInBytesView(const EmbossReservedDollarVirtualMinSizeInBytesView &) = default; |
| EmbossReservedDollarVirtualMinSizeInBytesView(EmbossReservedDollarVirtualMinSizeInBytesView &&) = default; |
| EmbossReservedDollarVirtualMinSizeInBytesView &operator=(const EmbossReservedDollarVirtualMinSizeInBytesView &) = |
| default; |
| EmbossReservedDollarVirtualMinSizeInBytesView &operator=(EmbossReservedDollarVirtualMinSizeInBytesView &&) = |
| default; |
| ~EmbossReservedDollarVirtualMinSizeInBytesView() = default; |
| |
| static constexpr ::std::int32_t Read(); |
| static constexpr ::std::int32_t UncheckedRead(); |
| static constexpr bool Ok() { return true; } |
| template <class Stream> |
| void WriteToTextStream(Stream *emboss_reserved_local_stream, |
| const ::emboss::TextOutputOptions |
| &emboss_reserved_local_options) const { |
| ::emboss::support::WriteIntegerViewToTextStream( |
| this, emboss_reserved_local_stream, emboss_reserved_local_options); |
| } |
| |
| static constexpr bool IsAggregate() { return false; } |
| }; |
| |
| static constexpr EmbossReservedDollarVirtualMinSizeInBytesView MinSizeInBytes() { |
| return EmbossReservedDollarVirtualMinSizeInBytesView(); |
| } |
| static constexpr ::emboss::support::Maybe<bool> has_MinSizeInBytes() { |
| return ::emboss::support::Maybe<bool>(true); |
| } |
| |
| |
| |
| private: |
| Storage backing_; |
| |
| |
| |
| template <class OtherStorage> |
| friend class GenericBoxView; |
| }; |
| using BoxView = |
| GenericBoxView</**/ ::emboss::support::ReadOnlyContiguousBuffer>; |
| using BoxWriter = |
| GenericBoxView</**/ ::emboss::support::ReadWriteContiguousBuffer>; |
| |
| template <class View> |
| struct EmbossReservedInternalIsGenericBoxView { |
| static constexpr const bool value = false; |
| }; |
| |
| template <class Storage> |
| struct EmbossReservedInternalIsGenericBoxView< |
| GenericBoxView<Storage>> { |
| static constexpr const bool value = true; |
| }; |
| |
| template <typename T> |
| inline GenericBoxView< |
| /**/ ::emboss::support::ContiguousBuffer< |
| typename ::std::remove_reference< |
| decltype(*::std::declval<T>()->data())>::type, |
| 1, 0>> |
| MakeBoxView( T &&emboss_reserved_local_arg) { |
| return GenericBoxView< |
| /**/ ::emboss::support::ContiguousBuffer< |
| typename ::std::remove_reference<decltype( |
| *::std::declval<T>()->data())>::type, |
| 1, 0>>( |
| ::std::forward<T>(emboss_reserved_local_arg)); |
| } |
| |
| template <typename T> |
| inline GenericBoxView</**/ ::emboss::support::ContiguousBuffer<T, 1, 0>> |
| MakeBoxView( T *emboss_reserved_local_data, |
| ::std::size_t emboss_reserved_local_size) { |
| return GenericBoxView</**/ ::emboss::support::ContiguousBuffer<T, 1, 0>>( |
| emboss_reserved_local_data, |
| emboss_reserved_local_size); |
| } |
| |
| template <typename T, ::std::size_t kAlignment> |
| inline GenericBoxView< |
| /**/ ::emboss::support::ContiguousBuffer<T, kAlignment, 0>> |
| MakeAlignedBoxView( |
| T *emboss_reserved_local_data, |
| ::std::size_t emboss_reserved_local_size) { |
| return GenericBoxView< |
| /**/ ::emboss::support::ContiguousBuffer<T, kAlignment, 0>>( |
| emboss_reserved_local_data, |
| emboss_reserved_local_size); |
| } |
| |
| |
| |
| |
| namespace Truck { |
| |
| } // namespace Truck |
| |
| |
| template <class View> |
| struct EmbossReservedInternalIsGenericTruckView; |
| |
| template <class Storage> |
| class GenericTruckView final { |
| public: |
| GenericTruckView() : backing_() {} |
| explicit GenericTruckView( |
| Storage emboss_reserved_local_bytes) |
| : backing_(emboss_reserved_local_bytes) |
| {} |
| |
| template <typename OtherStorage> |
| GenericTruckView( |
| const GenericTruckView<OtherStorage> &emboss_reserved_local_other) |
| : backing_{emboss_reserved_local_other.BackingStorage()} |
| {} |
| |
| template <typename Arg, |
| typename = typename ::std::enable_if< |
| !EmbossReservedInternalIsGenericTruckView< |
| typename ::std::remove_cv<typename ::std::remove_reference< |
| Arg>::type>::type>::value>::type> |
| explicit GenericTruckView( |
| Arg &&emboss_reserved_local_arg) |
| : backing_(::std::forward<Arg>( |
| emboss_reserved_local_arg)) |
| {} |
| template <typename Arg0, typename Arg1, typename... Args> |
| explicit GenericTruckView( |
| Arg0 &&emboss_reserved_local_arg0, |
| Arg1 &&emboss_reserved_local_arg1, Args &&... emboss_reserved_local_args) |
| : backing_(::std::forward<Arg0>(emboss_reserved_local_arg0), |
| ::std::forward<Arg1>(emboss_reserved_local_arg1), |
| ::std::forward<Args>( |
| emboss_reserved_local_args)...) |
| {} |
| |
| template <typename OtherStorage> |
| GenericTruckView<Storage> &operator=( |
| const GenericTruckView<OtherStorage> &emboss_reserved_local_other) { |
| backing_ = emboss_reserved_local_other.BackingStorage(); |
| return *this; |
| } |
| |
| |
| |
| bool Ok() const { |
| if (!IsComplete()) return false; |
| |
| if (!has_id().Known()) return false; |
| if (has_id().ValueOrDefault() && !id().Ok()) return false; |
| |
| |
| if (!has_cargo().Known()) return false; |
| if (has_cargo().ValueOrDefault() && !cargo().Ok()) return false; |
| |
| |
| if (!has_IntrinsicSizeInBytes().Known()) return false; |
| if (has_IntrinsicSizeInBytes().ValueOrDefault() && !IntrinsicSizeInBytes().Ok()) return false; |
| |
| |
| if (!has_MaxSizeInBytes().Known()) return false; |
| if (has_MaxSizeInBytes().ValueOrDefault() && !MaxSizeInBytes().Ok()) return false; |
| |
| |
| if (!has_MinSizeInBytes().Known()) return false; |
| if (has_MinSizeInBytes().ValueOrDefault() && !MinSizeInBytes().Ok()) return false; |
| |
| |
| |
| return true; |
| } |
| Storage BackingStorage() const { return backing_; } |
| bool IsComplete() const { |
| return backing_.Ok() && IntrinsicSizeInBytes().Ok() && |
| backing_.SizeInBytes() >= |
| static_cast</**/ ::std::size_t>( |
| IntrinsicSizeInBytes().UncheckedRead()); |
| } |
| static constexpr ::std::size_t SizeInBytes() { |
| return static_cast</**/ ::std::size_t>(IntrinsicSizeInBytes().Read()); |
| } |
| static constexpr bool SizeIsKnown() { |
| return IntrinsicSizeInBytes().Ok(); |
| } |
| |
| |
| template <typename OtherStorage> |
| bool Equals( |
| GenericTruckView<OtherStorage> emboss_reserved_local_other) const { |
| |
| if (!has_id().Known()) return false; |
| if (!emboss_reserved_local_other.has_id().Known()) return false; |
| |
| if (emboss_reserved_local_other.has_id().ValueOrDefault() && |
| !has_id().ValueOrDefault()) |
| return false; |
| if (has_id().ValueOrDefault() && |
| !emboss_reserved_local_other.has_id().ValueOrDefault()) |
| return false; |
| |
| if (emboss_reserved_local_other.has_id().ValueOrDefault() && |
| has_id().ValueOrDefault() && |
| !id().Equals(emboss_reserved_local_other.id())) |
| return false; |
| |
| |
| |
| if (!has_cargo().Known()) return false; |
| if (!emboss_reserved_local_other.has_cargo().Known()) return false; |
| |
| if (emboss_reserved_local_other.has_cargo().ValueOrDefault() && |
| !has_cargo().ValueOrDefault()) |
| return false; |
| if (has_cargo().ValueOrDefault() && |
| !emboss_reserved_local_other.has_cargo().ValueOrDefault()) |
| return false; |
| |
| if (emboss_reserved_local_other.has_cargo().ValueOrDefault() && |
| has_cargo().ValueOrDefault() && |
| !cargo().Equals(emboss_reserved_local_other.cargo())) |
| return false; |
| |
| return true; |
| } |
| template <typename OtherStorage> |
| bool UncheckedEquals( |
| GenericTruckView<OtherStorage> emboss_reserved_local_other) const { |
| |
| if (emboss_reserved_local_other.has_id().ValueOr(false) && |
| !has_id().ValueOr(false)) |
| return false; |
| if (has_id().ValueOr(false) && |
| !emboss_reserved_local_other.has_id().ValueOr(false)) |
| return false; |
| |
| if (emboss_reserved_local_other.has_id().ValueOr(false) && |
| has_id().ValueOr(false) && |
| !id().UncheckedEquals(emboss_reserved_local_other.id())) |
| return false; |
| |
| |
| |
| if (emboss_reserved_local_other.has_cargo().ValueOr(false) && |
| !has_cargo().ValueOr(false)) |
| return false; |
| if (has_cargo().ValueOr(false) && |
| !emboss_reserved_local_other.has_cargo().ValueOr(false)) |
| return false; |
| |
| if (emboss_reserved_local_other.has_cargo().ValueOr(false) && |
| has_cargo().ValueOr(false) && |
| !cargo().UncheckedEquals(emboss_reserved_local_other.cargo())) |
| return false; |
| |
| return true; |
| } |
| template <typename OtherStorage> |
| void UncheckedCopyFrom( |
| GenericTruckView<OtherStorage> emboss_reserved_local_other) const { |
| backing_.UncheckedCopyFrom( |
| emboss_reserved_local_other.BackingStorage(), |
| emboss_reserved_local_other.IntrinsicSizeInBytes().UncheckedRead()); |
| } |
| |
| template <typename OtherStorage> |
| void CopyFrom( |
| GenericTruckView<OtherStorage> emboss_reserved_local_other) const { |
| backing_.CopyFrom( |
| emboss_reserved_local_other.BackingStorage(), |
| emboss_reserved_local_other.IntrinsicSizeInBytes().Read()); |
| } |
| template <typename OtherStorage> |
| bool TryToCopyFrom( |
| GenericTruckView<OtherStorage> emboss_reserved_local_other) const { |
| return emboss_reserved_local_other.Ok() && backing_.TryToCopyFrom( |
| emboss_reserved_local_other.BackingStorage(), |
| emboss_reserved_local_other.IntrinsicSizeInBytes().Read()); |
| } |
| |
| template <class Stream> |
| bool UpdateFromTextStream(Stream *emboss_reserved_local_stream) const { |
| ::std::string emboss_reserved_local_brace; |
| if (!::emboss::support::ReadToken(emboss_reserved_local_stream, |
| &emboss_reserved_local_brace)) |
| return false; |
| if (emboss_reserved_local_brace != "{") return false; |
| for (;;) { |
| ::std::string emboss_reserved_local_name; |
| if (!::emboss::support::ReadToken(emboss_reserved_local_stream, |
| &emboss_reserved_local_name)) |
| return false; |
| if (emboss_reserved_local_name == ",") |
| if (!::emboss::support::ReadToken(emboss_reserved_local_stream, |
| &emboss_reserved_local_name)) |
| return false; |
| if (emboss_reserved_local_name == "}") return true; |
| ::std::string emboss_reserved_local_colon; |
| if (!::emboss::support::ReadToken(emboss_reserved_local_stream, |
| &emboss_reserved_local_colon)) |
| return false; |
| if (emboss_reserved_local_colon != ":") return false; |
| if (emboss_reserved_local_name == "id") { |
| if (!id().UpdateFromTextStream( |
| emboss_reserved_local_stream)) { |
| return false; |
| } |
| continue; |
| } |
| |
| if (emboss_reserved_local_name == "cargo") { |
| if (!cargo().UpdateFromTextStream( |
| emboss_reserved_local_stream)) { |
| return false; |
| } |
| continue; |
| } |
| |
| return false; |
| } |
| } |
| |
| template <class Stream> |
| void WriteToTextStream( |
| Stream *emboss_reserved_local_stream, |
| ::emboss::TextOutputOptions emboss_reserved_local_options) const { |
| ::emboss::TextOutputOptions emboss_reserved_local_field_options = |
| emboss_reserved_local_options.PlusOneIndent(); |
| if (emboss_reserved_local_options.multiline()) { |
| emboss_reserved_local_stream->Write("{\n"); |
| } else { |
| emboss_reserved_local_stream->Write("{"); |
| } |
| bool emboss_reserved_local_wrote_field = false; |
| if (has_id().ValueOr(false)) { |
| if (!emboss_reserved_local_field_options.allow_partial_output() || |
| id().IsAggregate() || id().Ok()) { |
| if (emboss_reserved_local_field_options.multiline()) { |
| emboss_reserved_local_stream->Write( |
| emboss_reserved_local_field_options.current_indent()); |
| } else { |
| if (emboss_reserved_local_wrote_field) { |
| emboss_reserved_local_stream->Write(","); |
| } |
| emboss_reserved_local_stream->Write(" "); |
| } |
| emboss_reserved_local_stream->Write("id: "); |
| id().WriteToTextStream(emboss_reserved_local_stream, |
| emboss_reserved_local_field_options); |
| emboss_reserved_local_wrote_field = true; |
| if (emboss_reserved_local_field_options.multiline()) { |
| emboss_reserved_local_stream->Write("\n"); |
| } |
| } else if (emboss_reserved_local_field_options.allow_partial_output() && |
| emboss_reserved_local_field_options.comments() && |
| !id().IsAggregate() && !id().Ok()) { |
| if (emboss_reserved_local_field_options.multiline()) { |
| emboss_reserved_local_stream->Write( |
| emboss_reserved_local_field_options.current_indent()); |
| } |
| emboss_reserved_local_stream->Write("# id: UNREADABLE\n"); |
| } |
| } |
| |
| if (has_cargo().ValueOr(false)) { |
| if (!emboss_reserved_local_field_options.allow_partial_output() || |
| cargo().IsAggregate() || cargo().Ok()) { |
| if (emboss_reserved_local_field_options.multiline()) { |
| emboss_reserved_local_stream->Write( |
| emboss_reserved_local_field_options.current_indent()); |
| } else { |
| if (emboss_reserved_local_wrote_field) { |
| emboss_reserved_local_stream->Write(","); |
| } |
| emboss_reserved_local_stream->Write(" "); |
| } |
| emboss_reserved_local_stream->Write("cargo: "); |
| cargo().WriteToTextStream(emboss_reserved_local_stream, |
| emboss_reserved_local_field_options); |
| emboss_reserved_local_wrote_field = true; |
| if (emboss_reserved_local_field_options.multiline()) { |
| emboss_reserved_local_stream->Write("\n"); |
| } |
| } else if (emboss_reserved_local_field_options.allow_partial_output() && |
| emboss_reserved_local_field_options.comments() && |
| !cargo().IsAggregate() && !cargo().Ok()) { |
| if (emboss_reserved_local_field_options.multiline()) { |
| emboss_reserved_local_stream->Write( |
| emboss_reserved_local_field_options.current_indent()); |
| } |
| emboss_reserved_local_stream->Write("# cargo: UNREADABLE\n"); |
| } |
| } |
| |
| (void)emboss_reserved_local_wrote_field; |
| if (emboss_reserved_local_options.multiline()) { |
| emboss_reserved_local_stream->Write( |
| emboss_reserved_local_options.current_indent()); |
| emboss_reserved_local_stream->Write("}"); |
| } else { |
| emboss_reserved_local_stream->Write(" }"); |
| } |
| } |
| |
| |
| |
| static constexpr bool IsAggregate() { return true; } |
| |
| public: |
| typename ::emboss::prelude::UIntView< |
| /**/ ::emboss::support::FixedSizeViewParameters<32, ::emboss::support::AllValuesAreOk>, |
| typename ::emboss::support::BitBlock</**/::emboss::support::LittleEndianByteOrderer<typename Storage::template OffsetStorageType</**/0, 0>>, 32>> |
| |
| id() const; |
| ::emboss::support::Maybe<bool> has_id() const; |
| |
| public: |
| typename ::emboss::support::GenericArrayView< |
| typename ::emboss::test::GenericContainerView<typename Storage::template OffsetStorageType</**/0, 4>::template OffsetStorageType</**/20, 0>> |
| |
| , typename Storage::template OffsetStorageType</**/0, 4>, 20, |
| 8 > |
| |
| cargo() const; |
| ::emboss::support::Maybe<bool> has_cargo() const; |
| |
| public: |
| class EmbossReservedDollarVirtualIntrinsicSizeInBytesView final { |
| public: |
| using ValueType = ::std::int32_t; |
| |
| constexpr EmbossReservedDollarVirtualIntrinsicSizeInBytesView() {} |
| EmbossReservedDollarVirtualIntrinsicSizeInBytesView(const EmbossReservedDollarVirtualIntrinsicSizeInBytesView &) = default; |
| EmbossReservedDollarVirtualIntrinsicSizeInBytesView(EmbossReservedDollarVirtualIntrinsicSizeInBytesView &&) = default; |
| EmbossReservedDollarVirtualIntrinsicSizeInBytesView &operator=(const EmbossReservedDollarVirtualIntrinsicSizeInBytesView &) = |
| default; |
| EmbossReservedDollarVirtualIntrinsicSizeInBytesView &operator=(EmbossReservedDollarVirtualIntrinsicSizeInBytesView &&) = |
| default; |
| ~EmbossReservedDollarVirtualIntrinsicSizeInBytesView() = default; |
| |
| static constexpr ::std::int32_t Read(); |
| static constexpr ::std::int32_t UncheckedRead(); |
| static constexpr bool Ok() { return true; } |
| template <class Stream> |
| void WriteToTextStream(Stream *emboss_reserved_local_stream, |
| const ::emboss::TextOutputOptions |
| &emboss_reserved_local_options) const { |
| ::emboss::support::WriteIntegerViewToTextStream( |
| this, emboss_reserved_local_stream, emboss_reserved_local_options); |
| } |
| |
| static constexpr bool IsAggregate() { return false; } |
| }; |
| |
| static constexpr EmbossReservedDollarVirtualIntrinsicSizeInBytesView IntrinsicSizeInBytes() { |
| return EmbossReservedDollarVirtualIntrinsicSizeInBytesView(); |
| } |
| static constexpr ::emboss::support::Maybe<bool> has_IntrinsicSizeInBytes() { |
| return ::emboss::support::Maybe<bool>(true); |
| } |
| |
| public: |
| class EmbossReservedDollarVirtualMaxSizeInBytesView final { |
| public: |
| using ValueType = ::std::int32_t; |
| |
| constexpr EmbossReservedDollarVirtualMaxSizeInBytesView() {} |
| EmbossReservedDollarVirtualMaxSizeInBytesView(const EmbossReservedDollarVirtualMaxSizeInBytesView &) = default; |
| EmbossReservedDollarVirtualMaxSizeInBytesView(EmbossReservedDollarVirtualMaxSizeInBytesView &&) = default; |
| EmbossReservedDollarVirtualMaxSizeInBytesView &operator=(const EmbossReservedDollarVirtualMaxSizeInBytesView &) = |
| default; |
| EmbossReservedDollarVirtualMaxSizeInBytesView &operator=(EmbossReservedDollarVirtualMaxSizeInBytesView &&) = |
| default; |
| ~EmbossReservedDollarVirtualMaxSizeInBytesView() = default; |
| |
| static constexpr ::std::int32_t Read(); |
| static constexpr ::std::int32_t UncheckedRead(); |
| static constexpr bool Ok() { return true; } |
| template <class Stream> |
| void WriteToTextStream(Stream *emboss_reserved_local_stream, |
| const ::emboss::TextOutputOptions |
| &emboss_reserved_local_options) const { |
| ::emboss::support::WriteIntegerViewToTextStream( |
| this, emboss_reserved_local_stream, emboss_reserved_local_options); |
| } |
| |
| static constexpr bool IsAggregate() { return false; } |
| }; |
| |
| static constexpr EmbossReservedDollarVirtualMaxSizeInBytesView MaxSizeInBytes() { |
| return EmbossReservedDollarVirtualMaxSizeInBytesView(); |
| } |
| static constexpr ::emboss::support::Maybe<bool> has_MaxSizeInBytes() { |
| return ::emboss::support::Maybe<bool>(true); |
| } |
| |
| public: |
| class EmbossReservedDollarVirtualMinSizeInBytesView final { |
| public: |
| using ValueType = ::std::int32_t; |
| |
| constexpr EmbossReservedDollarVirtualMinSizeInBytesView() {} |
| EmbossReservedDollarVirtualMinSizeInBytesView(const EmbossReservedDollarVirtualMinSizeInBytesView &) = default; |
| EmbossReservedDollarVirtualMinSizeInBytesView(EmbossReservedDollarVirtualMinSizeInBytesView &&) = default; |
| EmbossReservedDollarVirtualMinSizeInBytesView &operator=(const EmbossReservedDollarVirtualMinSizeInBytesView &) = |
| default; |
| EmbossReservedDollarVirtualMinSizeInBytesView &operator=(EmbossReservedDollarVirtualMinSizeInBytesView &&) = |
| default; |
| ~EmbossReservedDollarVirtualMinSizeInBytesView() = default; |
| |
| static constexpr ::std::int32_t Read(); |
| static constexpr ::std::int32_t UncheckedRead(); |
| static constexpr bool Ok() { return true; } |
| template <class Stream> |
| void WriteToTextStream(Stream *emboss_reserved_local_stream, |
| const ::emboss::TextOutputOptions |
| &emboss_reserved_local_options) const { |
| ::emboss::support::WriteIntegerViewToTextStream( |
| this, emboss_reserved_local_stream, emboss_reserved_local_options); |
| } |
| |
| static constexpr bool IsAggregate() { return false; } |
| }; |
| |
| static constexpr EmbossReservedDollarVirtualMinSizeInBytesView MinSizeInBytes() { |
| return EmbossReservedDollarVirtualMinSizeInBytesView(); |
| } |
| static constexpr ::emboss::support::Maybe<bool> has_MinSizeInBytes() { |
| return ::emboss::support::Maybe<bool>(true); |
| } |
| |
| |
| |
| private: |
| Storage backing_; |
| |
| |
| |
| template <class OtherStorage> |
| friend class GenericTruckView; |
| }; |
| using TruckView = |
| GenericTruckView</**/ ::emboss::support::ReadOnlyContiguousBuffer>; |
| using TruckWriter = |
| GenericTruckView</**/ ::emboss::support::ReadWriteContiguousBuffer>; |
| |
| template <class View> |
| struct EmbossReservedInternalIsGenericTruckView { |
| static constexpr const bool value = false; |
| }; |
| |
| template <class Storage> |
| struct EmbossReservedInternalIsGenericTruckView< |
| GenericTruckView<Storage>> { |
| static constexpr const bool value = true; |
| }; |
| |
| template <typename T> |
| inline GenericTruckView< |
| /**/ ::emboss::support::ContiguousBuffer< |
| typename ::std::remove_reference< |
| decltype(*::std::declval<T>()->data())>::type, |
| 1, 0>> |
| MakeTruckView( T &&emboss_reserved_local_arg) { |
| return GenericTruckView< |
| /**/ ::emboss::support::ContiguousBuffer< |
| typename ::std::remove_reference<decltype( |
| *::std::declval<T>()->data())>::type, |
| 1, 0>>( |
| ::std::forward<T>(emboss_reserved_local_arg)); |
| } |
| |
| template <typename T> |
| inline GenericTruckView</**/ ::emboss::support::ContiguousBuffer<T, 1, 0>> |
| MakeTruckView( T *emboss_reserved_local_data, |
| ::std::size_t emboss_reserved_local_size) { |
| return GenericTruckView</**/ ::emboss::support::ContiguousBuffer<T, 1, 0>>( |
| emboss_reserved_local_data, |
| emboss_reserved_local_size); |
| } |
| |
| template <typename T, ::std::size_t kAlignment> |
| inline GenericTruckView< |
| /**/ ::emboss::support::ContiguousBuffer<T, kAlignment, 0>> |
| MakeAlignedTruckView( |
| T *emboss_reserved_local_data, |
| ::std::size_t emboss_reserved_local_size) { |
| return GenericTruckView< |
| /**/ ::emboss::support::ContiguousBuffer<T, kAlignment, 0>>( |
| emboss_reserved_local_data, |
| emboss_reserved_local_size); |
| } |
| |
| namespace Container { |
| |
| } // namespace Container |
| |
| |
| template <class Storage> |
| inline typename ::emboss::prelude::UIntView< |
| /**/ ::emboss::support::FixedSizeViewParameters<32, ::emboss::support::AllValuesAreOk>, |
| typename ::emboss::support::BitBlock</**/::emboss::support::LittleEndianByteOrderer<typename Storage::template OffsetStorageType</**/0, 0>>, 32>> |
| |
| GenericContainerView<Storage>::weight() |
| const { |
| |
| if ( has_weight().ValueOr(false)) { |
| |
| auto emboss_reserved_local_size = ::emboss::support::Maybe</**/::std::int32_t>(static_cast</**/::std::int32_t>(4LL)); |
| auto emboss_reserved_local_offset = ::emboss::support::Maybe</**/::std::int32_t>(static_cast</**/::std::int32_t>(0LL)); |
| if (emboss_reserved_local_size.Known() && |
| emboss_reserved_local_size.ValueOr(0) >= 0 && |
| emboss_reserved_local_offset.Known() && |
| emboss_reserved_local_offset.ValueOr(0) >= 0) { |
| return ::emboss::prelude::UIntView< |
| /**/ ::emboss::support::FixedSizeViewParameters<32, ::emboss::support::AllValuesAreOk>, |
| typename ::emboss::support::BitBlock</**/::emboss::support::LittleEndianByteOrderer<typename Storage::template OffsetStorageType</**/0, 0>>, 32>> |
| |
| ( |
| backing_ |
| .template GetOffsetStorage<0, |
| 0>( |
| emboss_reserved_local_offset.ValueOrDefault(), |
| emboss_reserved_local_size.ValueOrDefault())); |
| } |
| } |
| return ::emboss::prelude::UIntView< |
| /**/ ::emboss::support::FixedSizeViewParameters<32, ::emboss::support::AllValuesAreOk>, |
| typename ::emboss::support::BitBlock</**/::emboss::support::LittleEndianByteOrderer<typename Storage::template OffsetStorageType</**/0, 0>>, 32>> |
| |
| (); |
| } |
| |
| template <class Storage> |
| inline ::emboss::support::Maybe<bool> |
| GenericContainerView<Storage>::has_weight() const { |
| return ::emboss::support::Maybe</**/bool>(true); |
| } |
| |
| |
| template <class Storage> |
| inline typename ::emboss::test::GenericBoxView<typename Storage::template OffsetStorageType</**/0, 4>> |
| |
| GenericContainerView<Storage>::important_box() |
| const { |
| |
| if ( has_important_box().ValueOr(false)) { |
| |
| auto emboss_reserved_local_size = ::emboss::support::Maybe</**/::std::int32_t>(static_cast</**/::std::int32_t>(8LL)); |
| auto emboss_reserved_local_offset = ::emboss::support::Maybe</**/::std::int32_t>(static_cast</**/::std::int32_t>(4LL)); |
| if (emboss_reserved_local_size.Known() && |
| emboss_reserved_local_size.ValueOr(0) >= 0 && |
| emboss_reserved_local_offset.Known() && |
| emboss_reserved_local_offset.ValueOr(0) >= 0) { |
| return ::emboss::test::GenericBoxView<typename Storage::template OffsetStorageType</**/0, 4>> |
| |
| ( |
| backing_ |
| .template GetOffsetStorage<0, |
| 4>( |
| emboss_reserved_local_offset.ValueOrDefault(), |
| emboss_reserved_local_size.ValueOrDefault())); |
| } |
| } |
| return ::emboss::test::GenericBoxView<typename Storage::template OffsetStorageType</**/0, 4>> |
| |
| (); |
| } |
| |
| template <class Storage> |
| inline ::emboss::support::Maybe<bool> |
| GenericContainerView<Storage>::has_important_box() const { |
| return ::emboss::support::Maybe</**/bool>(true); |
| } |
| |
| |
| template <class Storage> |
| inline typename ::emboss::test::GenericBoxView<typename Storage::template OffsetStorageType</**/0, 12>> |
| |
| GenericContainerView<Storage>::other_box() |
| const { |
| |
| if ( has_other_box().ValueOr(false)) { |
| |
| auto emboss_reserved_local_size = ::emboss::support::Maybe</**/::std::int32_t>(static_cast</**/::std::int32_t>(8LL)); |
| auto emboss_reserved_local_offset = ::emboss::support::Maybe</**/::std::int32_t>(static_cast</**/::std::int32_t>(12LL)); |
| if (emboss_reserved_local_size.Known() && |
| emboss_reserved_local_size.ValueOr(0) >= 0 && |
| emboss_reserved_local_offset.Known() && |
| emboss_reserved_local_offset.ValueOr(0) >= 0) { |
| return ::emboss::test::GenericBoxView<typename Storage::template OffsetStorageType</**/0, 12>> |
| |
| ( |
| backing_ |
| .template GetOffsetStorage<0, |
| 12>( |
| emboss_reserved_local_offset.ValueOrDefault(), |
| emboss_reserved_local_size.ValueOrDefault())); |
| } |
| } |
| return ::emboss::test::GenericBoxView<typename Storage::template OffsetStorageType</**/0, 12>> |
| |
| (); |
| } |
| |
| template <class Storage> |
| inline ::emboss::support::Maybe<bool> |
| GenericContainerView<Storage>::has_other_box() const { |
| return ::emboss::support::Maybe</**/bool>(true); |
| } |
| |
| |
| namespace Container { |
| inline constexpr ::std::int32_t IntrinsicSizeInBytes() { |
| return ::emboss::support::Maybe</**/::std::int32_t>(static_cast</**/::std::int32_t>(20LL)).ValueOrDefault(); |
| } |
| } // namespace Container |
| |
| template <class Storage> |
| inline constexpr ::std::int32_t |
| GenericContainerView<Storage>::EmbossReservedDollarVirtualIntrinsicSizeInBytesView::Read() { |
| return Container::IntrinsicSizeInBytes(); |
| } |
| |
| template <class Storage> |
| inline constexpr ::std::int32_t |
| GenericContainerView< |
| Storage>::EmbossReservedDollarVirtualIntrinsicSizeInBytesView::UncheckedRead() { |
| return Container::IntrinsicSizeInBytes(); |
| } |
| |
| namespace Container { |
| inline constexpr ::std::int32_t MaxSizeInBytes() { |
| return ::emboss::support::Maybe</**/::std::int32_t>(static_cast</**/::std::int32_t>(20LL)).ValueOrDefault(); |
| } |
| } // namespace Container |
| |
| template <class Storage> |
| inline constexpr ::std::int32_t |
| GenericContainerView<Storage>::EmbossReservedDollarVirtualMaxSizeInBytesView::Read() { |
| return Container::MaxSizeInBytes(); |
| } |
| |
| template <class Storage> |
| inline constexpr ::std::int32_t |
| GenericContainerView< |
| Storage>::EmbossReservedDollarVirtualMaxSizeInBytesView::UncheckedRead() { |
| return Container::MaxSizeInBytes(); |
| } |
| |
| namespace Container { |
| inline constexpr ::std::int32_t MinSizeInBytes() { |
| return ::emboss::support::Maybe</**/::std::int32_t>(static_cast</**/::std::int32_t>(20LL)).ValueOrDefault(); |
| } |
| } // namespace Container |
| |
| template <class Storage> |
| inline constexpr ::std::int32_t |
| GenericContainerView<Storage>::EmbossReservedDollarVirtualMinSizeInBytesView::Read() { |
| return Container::MinSizeInBytes(); |
| } |
| |
| template <class Storage> |
| inline constexpr ::std::int32_t |
| GenericContainerView< |
| Storage>::EmbossReservedDollarVirtualMinSizeInBytesView::UncheckedRead() { |
| return Container::MinSizeInBytes(); |
| } |
| namespace Box { |
| |
| } // namespace Box |
| |
| |
| template <class Storage> |
| inline typename ::emboss::prelude::UIntView< |
| /**/ ::emboss::support::FixedSizeViewParameters<32, ::emboss::support::AllValuesAreOk>, |
| typename ::emboss::support::BitBlock</**/::emboss::support::LittleEndianByteOrderer<typename Storage::template OffsetStorageType</**/0, 0>>, 32>> |
| |
| GenericBoxView<Storage>::id() |
| const { |
| |
| if ( has_id().ValueOr(false)) { |
| |
| auto emboss_reserved_local_size = ::emboss::support::Maybe</**/::std::int32_t>(static_cast</**/::std::int32_t>(4LL)); |
| auto emboss_reserved_local_offset = ::emboss::support::Maybe</**/::std::int32_t>(static_cast</**/::std::int32_t>(0LL)); |
| if (emboss_reserved_local_size.Known() && |
| emboss_reserved_local_size.ValueOr(0) >= 0 && |
| emboss_reserved_local_offset.Known() && |
| emboss_reserved_local_offset.ValueOr(0) >= 0) { |
| return ::emboss::prelude::UIntView< |
| /**/ ::emboss::support::FixedSizeViewParameters<32, ::emboss::support::AllValuesAreOk>, |
| typename ::emboss::support::BitBlock</**/::emboss::support::LittleEndianByteOrderer<typename Storage::template OffsetStorageType</**/0, 0>>, 32>> |
| |
| ( |
| backing_ |
| .template GetOffsetStorage<0, |
| 0>( |
| emboss_reserved_local_offset.ValueOrDefault(), |
| emboss_reserved_local_size.ValueOrDefault())); |
| } |
| } |
| return ::emboss::prelude::UIntView< |
| /**/ ::emboss::support::FixedSizeViewParameters<32, ::emboss::support::AllValuesAreOk>, |
| typename ::emboss::support::BitBlock</**/::emboss::support::LittleEndianByteOrderer<typename Storage::template OffsetStorageType</**/0, 0>>, 32>> |
| |
| (); |
| } |
| |
| template <class Storage> |
| inline ::emboss::support::Maybe<bool> |
| GenericBoxView<Storage>::has_id() const { |
| return ::emboss::support::Maybe</**/bool>(true); |
| } |
| |
| |
| template <class Storage> |
| inline typename ::emboss::prelude::UIntView< |
| /**/ ::emboss::support::FixedSizeViewParameters<32, ::emboss::support::AllValuesAreOk>, |
| typename ::emboss::support::BitBlock</**/::emboss::support::LittleEndianByteOrderer<typename Storage::template OffsetStorageType</**/0, 4>>, 32>> |
| |
| GenericBoxView<Storage>::count() |
| const { |
| |
| if ( has_count().ValueOr(false)) { |
| |
| auto emboss_reserved_local_size = ::emboss::support::Maybe</**/::std::int32_t>(static_cast</**/::std::int32_t>(4LL)); |
| auto emboss_reserved_local_offset = ::emboss::support::Maybe</**/::std::int32_t>(static_cast</**/::std::int32_t>(4LL)); |
| if (emboss_reserved_local_size.Known() && |
| emboss_reserved_local_size.ValueOr(0) >= 0 && |
| emboss_reserved_local_offset.Known() && |
| emboss_reserved_local_offset.ValueOr(0) >= 0) { |
| return ::emboss::prelude::UIntView< |
| /**/ ::emboss::support::FixedSizeViewParameters<32, ::emboss::support::AllValuesAreOk>, |
| typename ::emboss::support::BitBlock</**/::emboss::support::LittleEndianByteOrderer<typename Storage::template OffsetStorageType</**/0, 4>>, 32>> |
| |
| ( |
| backing_ |
| .template GetOffsetStorage<0, |
| 4>( |
| emboss_reserved_local_offset.ValueOrDefault(), |
| emboss_reserved_local_size.ValueOrDefault())); |
| } |
| } |
| return ::emboss::prelude::UIntView< |
| /**/ ::emboss::support::FixedSizeViewParameters<32, ::emboss::support::AllValuesAreOk>, |
| typename ::emboss::support::BitBlock</**/::emboss::support::LittleEndianByteOrderer<typename Storage::template OffsetStorageType</**/0, 4>>, 32>> |
| |
| (); |
| } |
| |
| template <class Storage> |
| inline ::emboss::support::Maybe<bool> |
| GenericBoxView<Storage>::has_count() const { |
| return ::emboss::support::Maybe</**/bool>(true); |
| } |
| |
| |
| namespace Box { |
| inline constexpr ::std::int32_t IntrinsicSizeInBytes() { |
| return ::emboss::support::Maybe</**/::std::int32_t>(static_cast</**/::std::int32_t>(8LL)).ValueOrDefault(); |
| } |
| } // namespace Box |
| |
| template <class Storage> |
| inline constexpr ::std::int32_t |
| GenericBoxView<Storage>::EmbossReservedDollarVirtualIntrinsicSizeInBytesView::Read() { |
| return Box::IntrinsicSizeInBytes(); |
| } |
| |
| template <class Storage> |
| inline constexpr ::std::int32_t |
| GenericBoxView< |
| Storage>::EmbossReservedDollarVirtualIntrinsicSizeInBytesView::UncheckedRead() { |
| return Box::IntrinsicSizeInBytes(); |
| } |
| |
| namespace Box { |
| inline constexpr ::std::int32_t MaxSizeInBytes() { |
| return ::emboss::support::Maybe</**/::std::int32_t>(static_cast</**/::std::int32_t>(8LL)).ValueOrDefault(); |
| } |
| } // namespace Box |
| |
| template <class Storage> |
| inline constexpr ::std::int32_t |
| GenericBoxView<Storage>::EmbossReservedDollarVirtualMaxSizeInBytesView::Read() { |
| return Box::MaxSizeInBytes(); |
| } |
| |
| template <class Storage> |
| inline constexpr ::std::int32_t |
| GenericBoxView< |
| Storage>::EmbossReservedDollarVirtualMaxSizeInBytesView::UncheckedRead() { |
| return Box::MaxSizeInBytes(); |
| } |
| |
| namespace Box { |
| inline constexpr ::std::int32_t MinSizeInBytes() { |
| return ::emboss::support::Maybe</**/::std::int32_t>(static_cast</**/::std::int32_t>(8LL)).ValueOrDefault(); |
| } |
| } // namespace Box |
| |
| template <class Storage> |
| inline constexpr ::std::int32_t |
| GenericBoxView<Storage>::EmbossReservedDollarVirtualMinSizeInBytesView::Read() { |
| return Box::MinSizeInBytes(); |
| } |
| |
| template <class Storage> |
| inline constexpr ::std::int32_t |
| GenericBoxView< |
| Storage>::EmbossReservedDollarVirtualMinSizeInBytesView::UncheckedRead() { |
| return Box::MinSizeInBytes(); |
| } |
| namespace Truck { |
| |
| } // namespace Truck |
| |
| |
| template <class Storage> |
| inline typename ::emboss::prelude::UIntView< |
| /**/ ::emboss::support::FixedSizeViewParameters<32, ::emboss::support::AllValuesAreOk>, |
| typename ::emboss::support::BitBlock</**/::emboss::support::LittleEndianByteOrderer<typename Storage::template OffsetStorageType</**/0, 0>>, 32>> |
| |
| GenericTruckView<Storage>::id() |
| const { |
| |
| if ( has_id().ValueOr(false)) { |
| |
| auto emboss_reserved_local_size = ::emboss::support::Maybe</**/::std::int32_t>(static_cast</**/::std::int32_t>(4LL)); |
| auto emboss_reserved_local_offset = ::emboss::support::Maybe</**/::std::int32_t>(static_cast</**/::std::int32_t>(0LL)); |
| if (emboss_reserved_local_size.Known() && |
| emboss_reserved_local_size.ValueOr(0) >= 0 && |
| emboss_reserved_local_offset.Known() && |
| emboss_reserved_local_offset.ValueOr(0) >= 0) { |
| return ::emboss::prelude::UIntView< |
| /**/ ::emboss::support::FixedSizeViewParameters<32, ::emboss::support::AllValuesAreOk>, |
| typename ::emboss::support::BitBlock</**/::emboss::support::LittleEndianByteOrderer<typename Storage::template OffsetStorageType</**/0, 0>>, 32>> |
| |
| ( |
| backing_ |
| .template GetOffsetStorage<0, |
| 0>( |
| emboss_reserved_local_offset.ValueOrDefault(), |
| emboss_reserved_local_size.ValueOrDefault())); |
| } |
| } |
| return ::emboss::prelude::UIntView< |
| /**/ ::emboss::support::FixedSizeViewParameters<32, ::emboss::support::AllValuesAreOk>, |
| typename ::emboss::support::BitBlock</**/::emboss::support::LittleEndianByteOrderer<typename Storage::template OffsetStorageType</**/0, 0>>, 32>> |
| |
| (); |
| } |
| |
| template <class Storage> |
| inline ::emboss::support::Maybe<bool> |
| GenericTruckView<Storage>::has_id() const { |
| return ::emboss::support::Maybe</**/bool>(true); |
| } |
| |
| |
| template <class Storage> |
| inline typename ::emboss::support::GenericArrayView< |
| typename ::emboss::test::GenericContainerView<typename Storage::template OffsetStorageType</**/0, 4>::template OffsetStorageType</**/20, 0>> |
| |
| , typename Storage::template OffsetStorageType</**/0, 4>, 20, |
| 8 > |
| |
| GenericTruckView<Storage>::cargo() |
| const { |
| |
| if ( has_cargo().ValueOr(false)) { |
| |
| auto emboss_reserved_local_size = ::emboss::support::Maybe</**/::std::int32_t>(static_cast</**/::std::int32_t>(40LL)); |
| auto emboss_reserved_local_offset = ::emboss::support::Maybe</**/::std::int32_t>(static_cast</**/::std::int32_t>(4LL)); |
| if (emboss_reserved_local_size.Known() && |
| emboss_reserved_local_size.ValueOr(0) >= 0 && |
| emboss_reserved_local_offset.Known() && |
| emboss_reserved_local_offset.ValueOr(0) >= 0) { |
| return ::emboss::support::GenericArrayView< |
| typename ::emboss::test::GenericContainerView<typename Storage::template OffsetStorageType</**/0, 4>::template OffsetStorageType</**/20, 0>> |
| |
| , typename Storage::template OffsetStorageType</**/0, 4>, 20, |
| 8 > |
| |
| ( |
| backing_ |
| .template GetOffsetStorage<0, |
| 4>( |
| emboss_reserved_local_offset.ValueOrDefault(), |
| emboss_reserved_local_size.ValueOrDefault())); |
| } |
| } |
| return ::emboss::support::GenericArrayView< |
| typename ::emboss::test::GenericContainerView<typename Storage::template OffsetStorageType</**/0, 4>::template OffsetStorageType</**/20, 0>> |
| |
| , typename Storage::template OffsetStorageType</**/0, 4>, 20, |
| 8 > |
| |
| (); |
| } |
| |
| template <class Storage> |
| inline ::emboss::support::Maybe<bool> |
| GenericTruckView<Storage>::has_cargo() const { |
| return ::emboss::support::Maybe</**/bool>(true); |
| } |
| |
| |
| namespace Truck { |
| inline constexpr ::std::int32_t IntrinsicSizeInBytes() { |
| return ::emboss::support::Maybe</**/::std::int32_t>(static_cast</**/::std::int32_t>(44LL)).ValueOrDefault(); |
| } |
| } // namespace Truck |
| |
| template <class Storage> |
| inline constexpr ::std::int32_t |
| GenericTruckView<Storage>::EmbossReservedDollarVirtualIntrinsicSizeInBytesView::Read() { |
| return Truck::IntrinsicSizeInBytes(); |
| } |
| |
| template <class Storage> |
| inline constexpr ::std::int32_t |
| GenericTruckView< |
| Storage>::EmbossReservedDollarVirtualIntrinsicSizeInBytesView::UncheckedRead() { |
| return Truck::IntrinsicSizeInBytes(); |
| } |
| |
| namespace Truck { |
| inline constexpr ::std::int32_t MaxSizeInBytes() { |
| return ::emboss::support::Maybe</**/::std::int32_t>(static_cast</**/::std::int32_t>(44LL)).ValueOrDefault(); |
| } |
| } // namespace Truck |
| |
| template <class Storage> |
| inline constexpr ::std::int32_t |
| GenericTruckView<Storage>::EmbossReservedDollarVirtualMaxSizeInBytesView::Read() { |
| return Truck::MaxSizeInBytes(); |
| } |
| |
| template <class Storage> |
| inline constexpr ::std::int32_t |
| GenericTruckView< |
| Storage>::EmbossReservedDollarVirtualMaxSizeInBytesView::UncheckedRead() { |
| return Truck::MaxSizeInBytes(); |
| } |
| |
| namespace Truck { |
| inline constexpr ::std::int32_t MinSizeInBytes() { |
| return ::emboss::support::Maybe</**/::std::int32_t>(static_cast</**/::std::int32_t>(44LL)).ValueOrDefault(); |
| } |
| } // namespace Truck |
| |
| template <class Storage> |
| inline constexpr ::std::int32_t |
| GenericTruckView<Storage>::EmbossReservedDollarVirtualMinSizeInBytesView::Read() { |
| return Truck::MinSizeInBytes(); |
| } |
| |
| template <class Storage> |
| inline constexpr ::std::int32_t |
| GenericTruckView< |
| Storage>::EmbossReservedDollarVirtualMinSizeInBytesView::UncheckedRead() { |
| return Truck::MinSizeInBytes(); |
| } |
| |
| |
| |
| } // namespace test |
| |
| |
| |
| } // namespace emboss |
| |
| |
| |
| /* NOLINTEND */ |
| |
| #endif // TESTDATA_NESTED_STRUCTURE_EMB_H_ |
| |