#include <cpf_item.h>
Public Member Functions | |
CPFItem () | |
CPFItem (EIP_UINT item_type, shared_ptr< Serializable > item_data) | |
virtual Reader & | deserialize (Reader &reader, size_t length) |
virtual Reader & | deserialize (Reader &reader) |
shared_ptr< Serializable > | getData () |
void | getDataAs (Serializable &result) |
virtual EIP_UINT | getDataLength () const |
EIP_UINT | getItemType () |
virtual size_t | getLength () const |
virtual Writer & | serialize (Writer &writer) const |
void | setData (shared_ptr< Serializable > data) |
void | setItemType (EIP_UINT item_type) |
Private Member Functions | |
void | deserializeData (Reader &reader, EIP_UINT item_length) |
Private Attributes | |
shared_ptr< Serializable > | item_data_ |
EIP_UINT | item_type_ |
Representation of a Common Packet Format Item. Uses a Serializable reference for the actual data.
Definition at line 48 of file cpf_item.h.
|
inline |
Construct null item by default. Anything else requires both the type and a serializable for the data.
Definition at line 56 of file cpf_item.h.
|
inline |
Construct a common packet item to represent the given item type and data
item_type | Item type code for this item (see EIP_ITEM_T) |
item_data | Data for this item |
Definition at line 63 of file cpf_item.h.
|
virtual |
Deserialize data from the given reader with the length given
reader | Reader to use for deserialization |
length | Length expected for data |
std::length_error | if the buffer is overrun while deserializing |
Definition at line 47 of file cpf_item.cpp.
|
virtual |
Deserialize data from the given reader without length information
reader | Reader to use for deserialization |
std::length_error | if the buffer is overrun while deserializing |
Definition at line 64 of file cpf_item.cpp.
|
private |
Helper to deserialize the item data
reader | the reader to use to deserialize data |
item_length | the length in bytes of the data to read |
Definition at line 73 of file cpf_item.cpp.
|
inline |
Get the data portion of this item
Definition at line 87 of file cpf_item.h.
void eip::CPFItem::getDataAs | ( | Serializable & | result | ) |
Get the item data as a particular serializable instance
result | Serializable class to get data into |
Definition at line 86 of file cpf_item.cpp.
|
inlinevirtual |
Get the length of the data in this item.
Definition at line 111 of file cpf_item.h.
|
inline |
Get the type code for this item
Definition at line 70 of file cpf_item.h.
|
inlinevirtual |
Get the total length needed to serialize this item. Really just 4 bytes (2 for the type, 2 for length) plus the size of the data itself.
Definition at line 121 of file cpf_item.h.
|
virtual |
Serialize data into the given buffer
writer | Writer to use for serialization |
std::length_error | if the buffer is too small for the header data |
Definition at line 37 of file cpf_item.cpp.
|
inline |
Set the data portion of this item. If a null reference is given, the item is assumed to be a NullItem
Definition at line 96 of file cpf_item.h.
|
inline |
Set the type code for this item
item_type | Item type code (see EIP_ITEM_T) |
Definition at line 79 of file cpf_item.h.
|
private |
Definition at line 152 of file cpf_item.h.
|
private |
Definition at line 151 of file cpf_item.h.