Public Member Functions | Private Member Functions | Private Attributes
eip::CPFItem Class Reference

#include <cpf_item.h>

Inheritance diagram for eip::CPFItem:
Inheritance graph
[legend]

List of all members.

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_

Detailed Description

Representation of a Common Packet Format Item. Uses a Serializable reference for the actual data.

Definition at line 48 of file cpf_item.h.


Constructor & Destructor Documentation

eip::CPFItem::CPFItem ( ) [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.

eip::CPFItem::CPFItem ( EIP_UINT  item_type,
shared_ptr< Serializable >  item_data 
) [inline]

Construct a common packet item to represent the given item type and data

Parameters:
item_typeItem type code for this item (see EIP_ITEM_T)
item_dataData for this item

Definition at line 63 of file cpf_item.h.


Member Function Documentation

Reader & eip::CPFItem::deserialize ( Reader &  reader,
size_t  length 
) [virtual]

Deserialize data from the given reader with the length given

Parameters:
readerReader to use for deserialization
lengthLength expected for data
Returns:
the reader again
Exceptions:
std::length_errorif the buffer is overrun while deserializing

Definition at line 47 of file cpf_item.cpp.

Reader & eip::CPFItem::deserialize ( Reader &  reader) [virtual]

Deserialize data from the given reader without length information

Parameters:
readerReader to use for deserialization
Returns:
the reader again
Exceptions:
std::length_errorif the buffer is overrun while deserializing

Definition at line 64 of file cpf_item.cpp.

void eip::CPFItem::deserializeData ( Reader &  reader,
EIP_UINT  item_length 
) [private]

Helper to deserialize the item data

Parameters:
readerthe reader to use to deserialize data
item_lengththe length in bytes of the data to read

Definition at line 73 of file cpf_item.cpp.

shared_ptr<Serializable> eip::CPFItem::getData ( ) [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

Parameters:
resultSerializable class to get data into

Definition at line 86 of file cpf_item.cpp.

virtual EIP_UINT eip::CPFItem::getDataLength ( ) const [inline, virtual]

Get the length of the data in this item.

Returns:
length in bytes of the data for this item

Definition at line 111 of file cpf_item.h.

Get the type code for this item

Returns:
Item type code (see EIP_ITEM_T)

Definition at line 70 of file cpf_item.h.

virtual size_t eip::CPFItem::getLength ( ) const [inline, virtual]

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.

Returns:
Total length in bytes to be serialized

Definition at line 121 of file cpf_item.h.

Writer & eip::CPFItem::serialize ( Writer &  writer) const [virtual]

Serialize data into the given buffer

Parameters:
writerWriter to use for serialization
Returns:
the writer again
Exceptions:
std::length_errorif the buffer is too small for the header data

Definition at line 37 of file cpf_item.cpp.

void eip::CPFItem::setData ( shared_ptr< Serializable >  data) [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.

void eip::CPFItem::setItemType ( EIP_UINT  item_type) [inline]

Set the type code for this item

Parameters:
item_typeItem type code (see EIP_ITEM_T)

Definition at line 79 of file cpf_item.h.


Member Data Documentation

shared_ptr<Serializable> eip::CPFItem::item_data_ [private]

Definition at line 152 of file cpf_item.h.

Definition at line 151 of file cpf_item.h.


The documentation for this class was generated from the following files:


odva_ethernetip
Author(s): Kareem Shehata
autogenerated on Sat Jun 8 2019 20:21:23