Public Member Functions | Private Member Functions | Private Attributes | List of all members
eip::Path Class Reference

#include <path.h>

Public Member Functions

void addLogicalAttribute (EIP_USINT attribute_id)
 
void addLogicalClass (EIP_USINT class_id)
 
void addLogicalConnectionPoint (EIP_USINT connection_id)
 
void addLogicalInstance (EIP_USINT instance_id)
 
virtual Readerdeserialize (Reader &reader)
 
virtual Readerdeserialize (Reader &reader, size_t length)
 
virtual size_t getLength () const
 
 Path (bool pad_after_length=false)
 
 Path (EIP_USINT class_id, EIP_USINT instance_id)
 
 Path (EIP_USINT class_id, EIP_USINT instance_id, EIP_USINT attribute_id, bool pad_after_length=false)
 
void reset ()
 
virtual Writerserialize (Writer &writer) const
 
virtual Writerserialize (Writer &writer, bool pad_after_length) const
 
void setPadAfterLength (bool pad)
 

Private Member Functions

void addSegment (EIP_USINT type, EIP_USINT data)
 

Private Attributes

bool pad_after_length_
 
vector< EIP_USINTpath_buf_
 

Detailed Description

Class to handle serialization of the Path data type in EthernetIP. Note that this is not a complete implementation of all path segment types, just the elements needed for the OS32c.

Definition at line 50 of file path.h.

Constructor & Destructor Documentation

◆ Path() [1/3]

eip::Path::Path ( bool  pad_after_length = false)

Construct an empty path.

Parameters
pad_after_lengthset to true to enable pad byte after length when serializing the path.

Definition at line 32 of file path.cpp.

◆ Path() [2/3]

eip::Path::Path ( EIP_USINT  class_id,
EIP_USINT  instance_id,
EIP_USINT  attribute_id,
bool  pad_after_length = false 
)

Shortcut to construct a path to the given logical class instance and attribute IDs.

Parameters
class_idLogical Class ID for the first segment of the path
instance_idLogical instance ID for the second segment of the path
attribute_idLogical instance ID for the third segment of the path
pad_after_lengthset to true to enable pad byte after length when serializing the path.

Definition at line 37 of file path.cpp.

◆ Path() [3/3]

eip::Path::Path ( EIP_USINT  class_id,
EIP_USINT  instance_id 
)

Shortcut to construct a path to the given logical class instance

Parameters
class_idLogical Class ID for the first segment of the path
instance_idLogical instance ID for the second segment of the path
pad_after_lengthset to true to enable pad byte after length when serializing the path.

Definition at line 46 of file path.cpp.

Member Function Documentation

◆ addLogicalAttribute()

void eip::Path::addLogicalAttribute ( EIP_USINT  attribute_id)

Add a logical attribute segment

Parameters
attribute_idID Number of attribute to add to path

Definition at line 69 of file path.cpp.

◆ addLogicalClass()

void eip::Path::addLogicalClass ( EIP_USINT  class_id)

Add a logical class segment

Parameters
class_idID Number of class to add to path

Definition at line 59 of file path.cpp.

◆ addLogicalConnectionPoint()

void eip::Path::addLogicalConnectionPoint ( EIP_USINT  connection_id)

Add a logical connection point segment

Parameters
IDnumber of the connection point (usually assembly ID)

Definition at line 74 of file path.cpp.

◆ addLogicalInstance()

void eip::Path::addLogicalInstance ( EIP_USINT  instance_id)

Add a logical instance segment

Parameters
instance_idID Number of instance to add to path

Definition at line 64 of file path.cpp.

◆ addSegment()

void eip::Path::addSegment ( EIP_USINT  type,
EIP_USINT  data 
)
private

Helper to put a segment into the current path buffer

Parameters
typeType of segment to add
dataData to add to path

Definition at line 53 of file path.cpp.

◆ deserialize() [1/2]

virtual Reader& eip::Path::deserialize ( Reader reader)
inlinevirtual

Not actually implemented

Definition at line 164 of file path.h.

◆ deserialize() [2/2]

virtual Reader& eip::Path::deserialize ( Reader reader,
size_t  length 
)
inlinevirtual

Not actually implemented

Definition at line 156 of file path.h.

◆ getLength()

size_t eip::Path::getLength ( ) const
virtual

Get the length of serialized data that would be produced if serialized

Returns
Total length in bytes to be serialized

Definition at line 79 of file path.cpp.

◆ reset()

void eip::Path::reset ( )
inline

Clear out anything currently in the path

Definition at line 120 of file path.h.

◆ serialize() [1/2]

virtual Writer& eip::Path::serialize ( Writer writer) const
inlinevirtual

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 137 of file path.h.

◆ serialize() [2/2]

Writer & eip::Path::serialize ( Writer writer,
bool  pad_after_length 
) const
virtual

Serialize data into the given buffer with a flag for adding a pad after the length field.

Parameters
writerWriter to use for serialization
pad_after_lengthset to true to add a byte after the length field
Returns
the writer again
Exceptions
std::length_errorif the buffer is too small for the header data

Definition at line 84 of file path.cpp.

◆ setPadAfterLength()

void eip::Path::setPadAfterLength ( bool  pad)
inline

In some special cases, need to add a pad byte after the length when serializing the path. Set this flag to true to enable that behaviour.

Parameters
padif set to true, will add a pad byte after the path length when serializing the path.

Definition at line 88 of file path.h.

Member Data Documentation

◆ pad_after_length_

bool eip::Path::pad_after_length_
private

Definition at line 170 of file path.h.

◆ path_buf_

vector<EIP_USINT> eip::Path::path_buf_
private

Definition at line 171 of file path.h.


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


odva_ethernetip
Author(s): Kareem Shehata
autogenerated on Wed Mar 2 2022 00:38:56