CatapultServer  v0.5.0.1 (Elephant)
PacketPayload.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include "Packet.h"
23 #include "catapult/types.h"
24 #include <vector>
25 
26 namespace catapult { namespace ionet {
27 
29  class PacketPayload {
30  public:
32  PacketPayload();
33 
35  explicit PacketPayload(PacketType type);
36 
38  explicit PacketPayload(const std::shared_ptr<const Packet>& pPacket);
39 
40  public:
42  bool unset() const;
43 
45  const PacketHeader& header() const;
46 
48  const std::vector<RawBuffer>& buffers() const;
49 
50  public:
52  static PacketPayload Merge(const std::shared_ptr<const Packet>& pPacket, const PacketPayload& payload);
53 
54  private:
56  std::vector<RawBuffer> m_buffers;
57 
58  // the backing data
59  std::vector<std::shared_ptr<const void>> m_entities;
60 
61  private:
62  friend class PacketPayloadBuilder;
63  };
64 }}
catapult::ionet::PacketPayload::PacketPayload
PacketPayload()
Creates a default (empty) packet payload.
Definition: PacketPayload.cpp:25
catapult::ionet::PacketPayload::m_buffers
std::vector< RawBuffer > m_buffers
Definition: PacketPayload.h:56
catapult::ionet::PacketHeader::Size
uint32_t Size
Size of the packet.
Definition: PacketHeader.h:32
catapult::ionet::PacketPayload::m_entities
std::vector< std::shared_ptr< const void > > m_entities
Definition: PacketPayload.h:59
catapult::ionet::PacketHeader
A packet header that all transferable information is expected to have.
Definition: PacketHeader.h:30
catapult::ionet::PacketPayload::buffers
const std::vector< RawBuffer > & buffers() const
Packet data.
Definition: PacketPayload.cpp:55
catapult::ionet::PacketHeader::Type
PacketType Type
Type of the packet.
Definition: PacketHeader.h:35
Packet.h
catapult::ionet::PacketPayload::header
const PacketHeader & header() const
Packet header.
Definition: PacketPayload.cpp:51
catapult::ionet::PacketType
PacketType
An enumeration of known packet types.
Definition: PacketType.h:171
catapult::ionet::PacketPayloadBuilder
A packet payload builder for creating payloads composed of heterogeneous data.
Definition: PacketPayloadBuilder.h:29
catapult::ionet::PacketPayload::unset
bool unset() const
Returns true if this packet payload is unset.
Definition: PacketPayload.cpp:47
catapult::ionet::PacketPayload::m_header
PacketHeader m_header
Definition: PacketPayload.h:55
PacketPayload.h
catapult::ionet::PacketPayload::Merge
static PacketPayload Merge(const std::shared_ptr< const Packet > &pPacket, const PacketPayload &payload)
Merges a packet (pPacket) and a packet payload into a new packet payload.
Definition: PacketPayload.cpp:59
types.h
CATAPULT_THROW_INVALID_ARGUMENT
#define CATAPULT_THROW_INVALID_ARGUMENT(MESSAGE)
Macro used to throw a catapult invalid argument.
Definition: exceptions.h:179
catapult::ionet::PacketPayload
A packet payload that can be written.
Definition: PacketPayload.h:29
catapult
Definition: AddressExtractionExtension.cpp:28