Developer Application Interface (ARC API) v4.5.8
ARC, Inc. GenIV Application Interface
arc::gen4::CArcPacket Class Referenceabstract

#include <CArcPacket.h>

Inheritance diagram for arc::gen4::CArcPacket:
arc::gen4::CArcBase arc::gen4::CArcCommandPacket arc::gen4::CArcImagePacket arc::gen4::CArcStatusPacket arc::gen4::CArcDLoadPacket arc::gen4::CArcAlertPacket

Public Member Functions

virtual ~CArcPacket (void)=default
 
virtual bool headerValid (void) const noexcept=0
 
constexpr std::uint32_t headerLength (void) const noexcept
 
constexpr std::uint32_t headerByteLength (void) const noexcept
 
std::uint8_t packetId (void) const
 
bool checkPacketId (std::uint32_t uiHeader, std::uint8_t uiPacketId) const noexcept
 
std::uint8_t payloadId (void) const
 
std::uint8_t payloadLength (void) const
 
std::uint32_t payloadByteLength (void) const
 
std::uint32_t * payload (void) const noexcept
 
void add (const std::uint32_t uiValue)
 
std::uint32_t length (void) const noexcept
 
std::uint32_t byteLength (void) const noexcept
 
std::uint32_t maxByteLength (void) const noexcept
 
std::uint32_t maxLength (void) const noexcept
 
std::uint32_t at (const std::uint32_t uiIndex) const
 
std::uint32_t & operator[] (const std::uint32_t uiIndex)
 
std::uint8_t * data (void) const noexcept
 
virtual const std::string getName (void) const =0
 
virtual const std::string toString (void) const
 
virtual const std::string toLogString (void) const
 
- Public Member Functions inherited from arc::gen4::CArcBase
virtual ~CArcBase (void)
 

Protected Member Functions

 CArcPacket (const std::uint32_t uiSize=MAX_PACKET_SIZE)
 
void incrementLength (const std::uint8_t uiIncr=1) noexcept
 
- Protected Member Functions inherited from arc::gen4::CArcBase
 CArcBase (void)=default
 
 CArcBase (const CArcBase &)=delete
 
 CArcBase (CArcBase &&)=delete
 
CArcBaseoperator= (const CArcBase &)=delete
 
CArcBaseoperator= (CArcBase &&)=delete
 

Protected Attributes

packetHeader_tm_pHeader
 
std::uint32_t * m_pPayload
 
std::unique_ptr< std::uint8_t[]> m_pData
 
std::uint32_t m_uiSize
 

Static Protected Attributes

static constexpr auto MAX_PACKET_SIZE = static_cast< std::uint32_t >( 1024 )
 
- Static Protected Attributes inherited from arc::gen4::CArcBase
static const std::string m_sVersion
 

Additional Inherited Members

- Static Public Member Functions inherited from arc::gen4::CArcBase
static const std::string version (void)
 
static void zeroMemory (void *pDest, std::size_t uiSize)
 
static void copyMemory (void *pDest, void *pSrc, std::size_t uiSize)
 
template<typename T >
static std::tuple< T *, T * > copyAndIncrement (void *pDest, void *pSrc, const std::size_t uiSize)
 
template<typename ErrCode >
requires std::is_integral_v<ErrCode>
static const std::string getSystemErrorMessage (ErrCode iErrCode)
 
static const std::string getSystemErrorMessage (void)
 
static std::uint32_t getSystemError (void) noexcept
 
static pStringList_t splitString (const std::string &sString, const char &zDelim=' ')
 
static std::string formatString (const char *pszFmt,...)
 
static const std::filesystem::path incrementFileName (const std::filesystem::path &tFilePath="", const std::int32_t iStartValue=-1)
 
static std::string convertWideToAnsi (const wchar_t wzString[]) noexcept
 
static std::string convertWideToAnsi (const std::wstring &wsString)
 
static std::wstring convertAnsiToWide (const char *pszString)
 
static std::string cmdToString (const std::uint32_t uiCmd)
 
template<typename T >
static std::string iterToString (T *begin, T *end, const char zSeperator=' ')
 
static std::string setDots (const std::string &sText, const std::size_t uiMaxLength, const char szDot='.')
 
static std::string trim (const std::string &sText) noexcept
 
static const std::chrono::time_point< std::chrono::high_resolution_clock > startCodeTime (void) noexcept
 
template<typename T >
static constexpr auto endCodeTime (const std::chrono::time_point< std::chrono::high_resolution_clock > tStartTimePoint) noexcept
 

Detailed Description

ARC GenIV packet class. All ARC GenIV images are sent to the host computer using this packets type.

ARC GenIV base packet class. All ARC GenIV packets derive from this class.

Definition at line 49 of file CArcPacket.h.

Constructor & Destructor Documentation

◆ ~CArcPacket()

virtual arc::gen4::CArcPacket::~CArcPacket ( void  )
virtualdefault

Destructor

◆ CArcPacket()

arc::gen4::CArcPacket::CArcPacket ( const std::uint32_t  uiSize = MAX_PACKET_SIZE)
protected

Constructor

Member Function Documentation

◆ headerValid()

virtual bool arc::gen4::CArcPacket::headerValid ( void  ) const
pure virtualnoexcept

Returns whether or not the header contains valid values.

Returns
Returns true if the header contains valid values.

Implemented in arc::gen4::CArcAlertPacket, arc::gen4::CArcCommandPacket, arc::gen4::CArcDLoadPacket, arc::gen4::CArcImagePacket, and arc::gen4::CArcStatusPacket.

◆ headerLength()

constexpr std::uint32_t arc::gen4::CArcPacket::headerLength ( void  ) const
inlineconstexprnoexcept

Returns the packet header maxLength in dwords ( 32-bits ).

Returns
The packet header maxLength in dwords ( 32-bits ).

Definition at line 65 of file CArcPacket.h.

◆ headerByteLength()

constexpr std::uint32_t arc::gen4::CArcPacket::headerByteLength ( void  ) const
inlineconstexprnoexcept

Returns the packet header maxLength in bytes.

Returns
The packet header maxLength in bytes.

Definition at line 73 of file CArcPacket.h.

◆ packetId()

std::uint8_t arc::gen4::CArcPacket::packetId ( void  ) const

Returns the packet id.

Returns
The packet id.
Exceptions
std::runtime_error

◆ checkPacketId()

bool arc::gen4::CArcPacket::checkPacketId ( std::uint32_t  uiHeader,
std::uint8_t  uiPacketId 
) const
noexcept

Checks if the specified packet ID exists in the specified partial header.

Parameters
uiHeader- The partial (first) packet header.
uiPacketId- The packet ID to check for.
Returns
true if the packet ID is found in the header; false otherwise.

◆ payloadId()

std::uint8_t arc::gen4::CArcPacket::payloadId ( void  ) const

Returns the payload id.

Returns
The payload id.
Exceptions
std::runtime_error

◆ payloadLength()

std::uint8_t arc::gen4::CArcPacket::payloadLength ( void  ) const

Returns the payload dword count.

Returns
The payload dword count.
Exceptions
std::runtime_error

◆ payloadByteLength()

std::uint32_t arc::gen4::CArcPacket::payloadByteLength ( void  ) const

Returns the payload byte count.

Returns
The payload byte count.
Exceptions
std::runtime_error

◆ payload()

std::uint32_t * arc::gen4::CArcPacket::payload ( void  ) const
noexcept

Returns a pointer to the start of the payload.

Returns
A pointer to the start of the packet payload

◆ add()

void arc::gen4::CArcPacket::add ( const std::uint32_t  uiValue)

Add a value to the end of the payload.

Parameters
uiValue- The value to append to the end of the payload.
Exceptions
std::out_of_rangeexception if index is beyond max length of packet.

◆ length()

std::uint32_t arc::gen4::CArcPacket::length ( void  ) const
noexcept

Returns the number of dwords ( 32-bit values ) that define the current packet ( header plus payload length ).

Returns
The number of 32-bit dwords in the packet.

◆ byteLength()

std::uint32_t arc::gen4::CArcPacket::byteLength ( void  ) const
noexcept

Returns the number of bytes that define the current packet ( header plus payload length ).

Returns
The number of valid bytes in the packet.

◆ maxByteLength()

std::uint32_t arc::gen4::CArcPacket::maxByteLength ( void  ) const
noexcept

Returns the maximum number of bytes that the packet may contain.

Returns
The maximum number of bytes in the packet.

◆ maxLength()

std::uint32_t arc::gen4::CArcPacket::maxLength ( void  ) const
noexcept

Returns the maximum number of dwords ( 32-bit values ) that the packet may contain.

Returns
The maximum number of 32-bit words in the packet.

◆ at()

std::uint32_t arc::gen4::CArcPacket::at ( const std::uint32_t  uiIndex) const

Returns the 32-bit packet data value at the specified index.

Parameters
uiIndex- The index of the value to readRunnable.
Exceptions
std::out_of_rangeexception if index exceeds packet size.
std::runtime_error

◆ operator[]()

std::uint32_t & arc::gen4::CArcPacket::operator[] ( const std::uint32_t  uiIndex)

Access the specified 32-bit value in the packet.

Parameters
uiIndex- The index of the value to access. Starts at beginning of packet (i.e. header ).
Returns
A reference to the value at the specified index.
Exceptions
std::out_of_rangeexception if index exceeds packet size.
std::runtime_error

◆ data()

std::uint8_t * arc::gen4::CArcPacket::data ( void  ) const
noexcept

Returns a pointer to the underlying packet data storage.

Returns
A pointer to the underlying packet data storage.

◆ getName()

virtual const std::string arc::gen4::CArcPacket::getName ( void  ) const
pure virtual

Returns the packet name.

Returns
The packet name.
Exceptions
Anyexception thrown by std::string

Implemented in arc::gen4::CArcAlertPacket, arc::gen4::CArcCommandPacket, arc::gen4::CArcDLoadPacket, arc::gen4::CArcImagePacket, and arc::gen4::CArcStatusPacket.

◆ toString()

virtual const std::string arc::gen4::CArcPacket::toString ( void  ) const
virtual

Returns the packet as a formatted string. The format, which may change at any time, is not documented here.

Returns
The packet as a formatted string.
Exceptions
std::ios_base::failure

◆ toLogString()

virtual const std::string arc::gen4::CArcPacket::toLogString ( void  ) const
virtual

Returns the packet as a formatted string for the log class. The format, which may change at any time, is not documented here.

Returns
The packet as a formatted string.
Exceptions
std::ios_base::failure

◆ incrementLength()

void arc::gen4::CArcPacket::incrementLength ( const std::uint8_t  uiIncr = 1)
protectednoexcept

Increment the header payload maxLength by the specified amount.

Parameters
uiIncr- The number of dwords ( 32-bits ) by which to increment the header payload maxLength field.

Member Data Documentation

◆ MAX_PACKET_SIZE

constexpr auto arc::gen4::CArcPacket::MAX_PACKET_SIZE = static_cast< std::uint32_t >( 1024 )
staticconstexprprotected

Default maximum packet size ( in bytes ) IMPORTANT NOTE: The header cannot support more than 255 dwords

Definition at line 194 of file CArcPacket.h.

◆ m_pHeader

packetHeader_t* arc::gen4::CArcPacket::m_pHeader
protected

Packet header pointer

Definition at line 197 of file CArcPacket.h.

◆ m_pPayload

std::uint32_t* arc::gen4::CArcPacket::m_pPayload
protected

Packet payload pointer

Definition at line 200 of file CArcPacket.h.

◆ m_pData

std::unique_ptr<std::uint8_t[]> arc::gen4::CArcPacket::m_pData
protected

Packet data

Definition at line 203 of file CArcPacket.h.

◆ m_uiSize

std::uint32_t arc::gen4::CArcPacket::m_uiSize
protected

Packet data byte size

Definition at line 206 of file CArcPacket.h.