CatapultServer  v0.5.0.1 (Elephant)
EntityBody.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include "EntityType.h"
23 #include "NetworkInfo.h"
24 #include "catapult/utils/Casting.h"
25 #include "catapult/types.h"
26 
27 namespace catapult { namespace model {
28 
29 #pragma pack(push, 1)
30 
32  template<typename THeader>
33  struct EntityBody : public THeader {
34  public:
37 
39  uint16_t Version;
40 
43 
46  return static_cast<NetworkIdentifier>(Version >> 8);
47  }
48 
50  uint8_t EntityVersion() const {
51  return static_cast<uint8_t>(Version & 0xFF);
52  }
53  };
54 
55 #pragma pack(pop)
56 
58  constexpr uint16_t MakeVersion(NetworkIdentifier networkIdentifier, uint8_t version) noexcept {
59  return static_cast<uint16_t>(utils::to_underlying_type(networkIdentifier) << 8 | version);
60  }
61 }}
catapult::model::EntityType
EntityType
Enumeration of entity types.
Definition: EntityType.h:43
catapult::model::EntityBody::Version
uint16_t Version
Entity version.
Definition: EntityBody.h:39
catapult::utils::to_underlying_type
constexpr std::underlying_type_t< TEnum > to_underlying_type(TEnum value)
Converts a strongly typed enumeration value to its underlying integral value.
Definition: Casting.h:37
EntityType.h
NetworkInfo.h
catapult::model::EntityBody::Signer
Key Signer
Entity signer's public key.
Definition: EntityBody.h:36
catapult::model::NetworkIdentifier
NetworkIdentifier
Possible network identifiers.
Definition: NetworkInfo.h:45
catapult::model::EntityBody::EntityVersion
uint8_t EntityVersion() const
Returns version of an entity.
Definition: EntityBody.h:50
catapult::model::EntityBody
Binary layout for an entity body.
Definition: EntityBody.h:33
types.h
Casting.h
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::utils::ByteArray< Key_Size, Key_tag >
catapult::model::MakeVersion
constexpr uint16_t MakeVersion(NetworkIdentifier networkIdentifier, uint8_t version) noexcept
Creates a version field out of given entity version and networkIdentifier.
Definition: EntityBody.h:58
catapult::model::EntityBody::Network
NetworkIdentifier Network() const
Returns network of an entity, as defined in NetworkInfoTraits.
Definition: EntityBody.h:45
catapult::model::EntityBody::Type
EntityType Type
Entity type.
Definition: EntityBody.h:42