opendnp3  3.1.0
Reference implementation of DNP3 (IEEE-1815)
opendnp3::OctetData Class Reference

A base-class for bitstrings containing up to 255 bytes. More...

#include <opendnp3/app/OctetData.h>

Public Member Functions

 OctetData ()
 Construct with a default value of [0x00] (length == 1) More...
 
 OctetData (const Buffer &input)
 Construct from read-only buffer slice. More...
 
 OctetData (const char *input)
 Construct from a c-style string. More...
 
bool Set (const Buffer &input)
 Set the octet data to the input buffer. More...
 
bool Set (const char *input)
 Set the buffer equal to the supplied c-string. More...
 
uint8_t Size () const
 
const Buffer ToBuffer () const
 

Static Public Attributes

const static uint8_t MAX_SIZE = 255
 

Static Private Member Functions

static const Buffer ToSlice (const char *input)
 

Private Attributes

std::array< uint8_t, MAX_SIZEbuffer = {0x00}
 
uint8_t size
 

Detailed Description

A base-class for bitstrings containing up to 255 bytes.

Definition at line 34 of file OctetData.h.

Constructor & Destructor Documentation

◆ OctetData() [1/3]

opendnp3::OctetData::OctetData ( )

Construct with a default value of [0x00] (length == 1)

◆ OctetData() [2/3]

opendnp3::OctetData::OctetData ( const char *  input)

Construct from a c-style string.

strlen() is used internally to determine the length

If the length is 0, the default value of [0x00] is assigned If the length is > 255, only the first 255 bytes are copied.

The null terminator is NOT copied as part of buffer

◆ OctetData() [3/3]

opendnp3::OctetData::OctetData ( const Buffer input)

Construct from read-only buffer slice.

If the length is 0, the default value of [0x00] is assigned If the length is > 255, only the first 255 bytes are copied.

The null terminator is NOT copied as part of buffer

Member Function Documentation

◆ Set() [1/2]

bool opendnp3::OctetData::Set ( const Buffer input)

Set the octet data to the input buffer.

If the length is 0, the default value of [0x00] is assigned If the length is > 255, only the first 255 bytes are copied

Parameters
inputthe input data to copy into this object
Returns
true if the input meets the length requirements, false otherwise

◆ Set() [2/2]

bool opendnp3::OctetData::Set ( const char *  input)

Set the buffer equal to the supplied c-string.

If the length is 0, the default value of [0x00] is assigned If the length is > 255, only the first 255 bytes are copied

Parameters
inputc-style string to copy into this object
Returns
true if the input meets the length requirements, false otherwise

◆ Size()

uint8_t opendnp3::OctetData::Size ( ) const
inline

Definition at line 67 of file OctetData.h.

References size.

◆ ToBuffer()

const Buffer opendnp3::OctetData::ToBuffer ( ) const
Returns
a view of the current data

◆ ToSlice()

static const Buffer opendnp3::OctetData::ToSlice ( const char *  input)
staticprivate

Member Data Documentation

◆ buffer

std::array<uint8_t, MAX_SIZE> opendnp3::OctetData::buffer = {0x00}
private

Definition at line 104 of file OctetData.h.

◆ MAX_SIZE

const static uint8_t opendnp3::OctetData::MAX_SIZE = 255
static

Definition at line 37 of file OctetData.h.

◆ size

uint8_t opendnp3::OctetData::size
private

Definition at line 105 of file OctetData.h.

Referenced by Size().


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