IChannel Class
(ServerIO::IChannel)IChannel exposes methods from a channel that can be used by IOServer implementation to convert to from IOServer raw packets to some CDP based implementation of the channel. More...
Header: | #include <IO/ServerIO/IChannel.h> |
Inherited By: |
Public Functions
virtual | ~IChannel() |
virtual bool | GetData(void *data, unsigned int size = 0, double *timestamp = nullptr) = 0 |
virtual unsigned int | GetDataSize() const = 0 |
virtual bool | IsInput() = 0 |
virtual const char * | Name() const = 0 |
virtual bool | PutData(const void *data, unsigned int size = 0, double timestamp = 0.0) = 0 |
virtual void | SetDataPointer(void *data, double *timestamp = 0, std::optional<unsigned int> size = {}) = 0 |
virtual void | SetDataResizeHandler(const std::function<void( unsigned int ) > &resizeHandler = {}) = 0 |
virtual void | SetDataSize(unsigned int size) = 0 |
Protected Functions
Detailed Description
IChannel exposes methods from a channel that can be used by IOServer implementation to convert to from IOServer raw packets to some CDP based implementation of the channel.
See also IOServer, ServerIO, ServerIO::ICDPChannel, ServerIO::ChannelManager, and ServerIO::CDPSignalChannel.
Member Function Documentation
[virtual]
IChannel::~IChannel()
Destroys the instance of IChannel. The destructor is virtual.
[pure virtual]
bool IChannel::GetData(void *data, unsigned int size = 0, double *timestamp = nullptr)
Gets raw channel value, copied into given void* data.
Used by IOServers that don't directly map outgoing data buffer to channel by using SetDataPointer(). When SetDataPointer() has been used on a IChannel to use external memory region for storage. bool implementations of the IChannel must take into account that in external storage there is single bit used in the pointed byte for the storage and masking must be used to set and get the value.
data is pointer where current channel raw data will be stored. There should be correct amount of bytes available expected by specific instance of the channel to store the value.
size, if provided, is matched against internal size and operation is stopped if channels internal type size does not match.
timestamp is pointer to timestamp double, if provided, where timestamp may be stored for given data sample returned.
Returns true on success.
[pure virtual]
unsigned int IChannel::GetDataSize() const
Used for getting the byte size of internal datatype.
Returns number of bytes in the data type used to hold the data.
[pure virtual]
bool IChannel::IsInput()
Can be used to determine channel direction. The direction is considered input if it accepts data in from CDP sources and output if it provides values to CDP classes.
Returns true if the channel is input channel.
[pure virtual]
const char *IChannel::Name() const
Gets the short name of the channel
Returns const char pointer to the short name of instance.
[pure virtual]
bool IChannel::PutData(const void *data, unsigned int size = 0, double timestamp = 0.0)
Puts the value given in void* data to channels raw value.
Used by IOServers that don't directly map incoming data buffer to channel by using SetDataPointer(). When SetDataPointer() has been used on a IChannel to use external memory region for storage bool implementations of the IChannel must take into account that in external storage there is single bit used in the pointed byte for the storage and masking must be used to set and get the value.
data is pointer to passed in raw data. There should be correct amount of bytes available, expected by specific instance of the channel.
size, if provided, is matched against internal size and operation is stopped if channels internal type size does not match.
timestamp optional value of timestamp to store with data.
Returns true on success.
[pure virtual]
void IChannel::SetDataPointer(void *data, double *timestamp = 0, std::optional<unsigned int> size = {})
[pure virtual]
void IChannel::SetDataResizeHandler(const std::function<void( unsigned int ) > &resizeHandler = {})
[pure virtual]
void IChannel::SetDataSize(unsigned int size)
[pure virtual protected]
void IChannel::SyncIn()
Is a synchronisation call that is called by IChannelManager on SynchronizeValuesIn() to synchronize values in from CDPProcess where the cdp value holder resides.
This makes it possible for a user level thread who calls SynchronizeValuesIn() to safely use the LoadData and StoreData calls in the user thread.
[pure virtual protected]
void IChannel::SyncOut()
Is a synchronisation call that is called by IChannelManager on SynchronizeValuesOut() to synchronize values out to CDPProcess where the cdp class resides.
This makes it possible for a user level thread who calls SynchronizeValuesOut() to safely use the StoreData() call in the user thread and the value will be propagated.
Get started with CDP Studio today
Let us help you take your great ideas and turn them into the products your customer will love.