RMW desert 1.0
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | List of all members
cbor::RxStream Class Reference

Public Member Functions

 RxStream (uint8_t stream_type, std::string stream_name, uint8_t stream_identifier)
 Create a reception stream.
 
bool data_available (int64_t sequence_id=0)
 Check if there are data.
 
void clear_buffer ()
 Clear the currently buffered packet.
 
RxStreamoperator>> (uint64_t &n)
 Decode uint64.
 
RxStreamoperator>> (uint32_t &n)
 Decode uint32.
 
RxStreamoperator>> (uint16_t &n)
 Decode uint16.
 
RxStreamoperator>> (uint8_t &n)
 Decode uint8.
 
RxStreamoperator>> (int64_t &n)
 Decode int64.
 
RxStreamoperator>> (int32_t &n)
 Decode int32.
 
RxStreamoperator>> (int16_t &n)
 Decode int16.
 
RxStreamoperator>> (int8_t &n)
 Decode int8.
 
template<typename T >
RxStreamdeserialize_integer (T &n)
 Decode a generic integer.
 
RxStreamoperator>> (char &n)
 Decode char.
 
RxStreamoperator>> (float &f)
 Decode float.
 
RxStreamoperator>> (double &d)
 Decode double.
 
RxStreamoperator>> (std::string &s)
 Decode string.
 
RxStreamoperator>> (std::u16string &s)
 Decode u16string.
 
RxStreamoperator>> (bool &b)
 Decode bool.
 
template<typename T >
RxStreamoperator>> (std::vector< T > &v)
 Decode vector.
 
RxStreamoperator>> (std::vector< bool > &v)
 Decode bool vector.
 
template<typename T >
RxStreamdeserialize_sequence (T *items, size_t size)
 Deserialize a sequence of uniform elements.
 

Static Public Member Functions

static void interpret_packets ()
 Interpret raw packets and splits them into different communication types.
 

Constructor & Destructor Documentation

◆ RxStream()

cbor::RxStream::RxStream ( uint8_t  stream_type,
std::string  stream_name,
uint8_t  stream_identifier 
)

Create a reception stream.

Parameters
stream_typeType of the object using the current instance
stream_nameName of the topic or the service to which the communication belongs
stream_identifierIdentifier of the topic or the service read from configuration

Member Function Documentation

◆ clear_buffer()

void cbor::RxStream::clear_buffer ( )

Clear the currently buffered packet.

When the packet is read by the entity, this function must be called to clear the buffer and allow RxStream to add the next one in the queue.

◆ data_available()

bool cbor::RxStream::data_available ( int64_t  sequence_id = 0)

Check if there are data.

A map contains the information received for all topics and services, so using the name saved in the current instance as key it is possible to know if a message is arrived for a specific entity.

Parameters
sequence_idThe id of the client service communication

◆ deserialize_integer()

template<typename T >
RxStream & cbor::RxStream::deserialize_integer ( T &  n)

Decode a generic integer.

Parameters
nField to decode

◆ deserialize_sequence()

template<typename T >
RxStream & cbor::RxStream::deserialize_sequence ( T *  items,
size_t  size 
)
inline

Deserialize a sequence of uniform elements.

Parameters
itemsPointer to the first element
sizeSize of the items array

◆ interpret_packets()

void cbor::RxStream::interpret_packets ( )
static

Interpret raw packets and splits them into different communication types.

Raw packets from TcpDaemon are read and interpreted in order to put them in a map where the key allows to distinguish the topic name or the service name, and eventually the sequence identifier.

◆ operator>>() [1/16]

RxStream & cbor::RxStream::operator>> ( bool &  b)

Decode bool.

Parameters
bField to decode

◆ operator>>() [2/16]

RxStream & cbor::RxStream::operator>> ( char &  n)

Decode char.

Parameters
nField to decode

◆ operator>>() [3/16]

RxStream & cbor::RxStream::operator>> ( double &  d)

Decode double.

Parameters
dField to decode

◆ operator>>() [4/16]

RxStream & cbor::RxStream::operator>> ( float &  f)

Decode float.

Parameters
fField to decode

◆ operator>>() [5/16]

RxStream & cbor::RxStream::operator>> ( int16_t &  n)

Decode int16.

Parameters
nField to decode

◆ operator>>() [6/16]

RxStream & cbor::RxStream::operator>> ( int32_t &  n)

Decode int32.

Parameters
nField to decode

◆ operator>>() [7/16]

RxStream & cbor::RxStream::operator>> ( int64_t &  n)

Decode int64.

Parameters
nField to decode

◆ operator>>() [8/16]

RxStream & cbor::RxStream::operator>> ( int8_t &  n)

Decode int8.

Parameters
nField to decode

◆ operator>>() [9/16]

RxStream & cbor::RxStream::operator>> ( std::string &  s)

Decode string.

Parameters
sField to decode

◆ operator>>() [10/16]

RxStream & cbor::RxStream::operator>> ( std::u16string &  s)

Decode u16string.

Parameters
sField to decode

◆ operator>>() [11/16]

RxStream & cbor::RxStream::operator>> ( std::vector< bool > &  v)

Decode bool vector.

Parameters
vField to decode

◆ operator>>() [12/16]

template<typename T >
RxStream & cbor::RxStream::operator>> ( std::vector< T > &  v)
inline

Decode vector.

Parameters
vField to decode

◆ operator>>() [13/16]

RxStream & cbor::RxStream::operator>> ( uint16_t &  n)

Decode uint16.

Parameters
nField to decode

◆ operator>>() [14/16]

RxStream & cbor::RxStream::operator>> ( uint32_t &  n)

Decode uint32.

Parameters
nField to decode

◆ operator>>() [15/16]

RxStream & cbor::RxStream::operator>> ( uint64_t &  n)

Decode uint64.

Parameters
nField to decode

◆ operator>>() [16/16]

RxStream & cbor::RxStream::operator>> ( uint8_t &  n)

Decode uint8.

Parameters
nField to decode

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