Uniot Core
0.8.1
Loading...
Searching...
No Matches
uniot::DataChannels< T_channel, T_data > Class Template Reference

#include <DataChannels.h>

Public Member Functions

virtual ~DataChannels ()=default
 
bool open (T_channel channel, size_t limit)
 Creates a new data channel with the specified capacity.
 
bool close (T_channel channel)
 Removes an existing channel and frees associated resources.
 
bool send (T_channel channel, T_data data)
 Sends data to the specified channel.
 
T_data receive (T_channel channel)
 Retrieves and removes the oldest data from the specified channel.
 
bool isEmpty (T_channel channel)
 Checks if a channel has no data available.
 

Constructor & Destructor Documentation

◆ ~DataChannels()

template<class T_channel, class T_data>
virtual uniot::DataChannels< T_channel, T_data >::~DataChannels ( )
virtualdefault

Member Function Documentation

◆ close()

template<class T_channel, class T_data>
bool uniot::DataChannels< T_channel, T_data >::close ( T_channel channel)

Removes an existing channel and frees associated resources.

Parameters
channelThe identifier of the channel to close
Return values
trueIf the channel was successfully closed
falseIf the channel doesn't exist

◆ isEmpty()

template<class T_channel, class T_data>
bool uniot::DataChannels< T_channel, T_data >::isEmpty ( T_channel channel)

Checks if a channel has no data available.

Parameters
channelThe identifier of the channel to check
Return values
trueIf the channel is empty or doesn't exist
falseIf the channel exists and contains data

◆ open()

template<class T_channel, class T_data>
bool uniot::DataChannels< T_channel, T_data >::open ( T_channel channel,
size_t limit )

Creates a new data channel with the specified capacity.

Parameters
channelThe unique identifier for the channel
limitThe maximum number of data items the channel can hold
Return values
trueIf the channel was successfully created
falseIf a channel with the same identifier already exists

◆ receive()

template<class T_channel, class T_data>
T_data uniot::DataChannels< T_channel, T_data >::receive ( T_channel channel)

Retrieves and removes the oldest data from the specified channel.

Parameters
channelThe identifier of the source channel
Return values
T_dataThe retrieved data, or an empty/default data object if the channel doesn't exist or is empty

◆ send()

template<class T_channel, class T_data>
bool uniot::DataChannels< T_channel, T_data >::send ( T_channel channel,
T_data data )

Sends data to the specified channel.

If the channel is full, the oldest data will be overwritten.

Parameters
channelThe identifier of the destination channel
dataThe data to send
Return values
trueIf the data was successfully sent
falseIf the channel doesn't exist

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