CDPSignalChannel Class
(ServerIO::CDPSignalChannel)The CDPSignalChannel template-class is an ACDPBaseChannel<> implementation based on CDPSignal. More...
Header: | #include <IO/ServerIO/CDPSignalChannel.h> |
Inherits: | ACDPBaseChannel<T> and |
Public Functions
CDPSignalChannel() | |
~CDPSignalChannel() override |
Reimplemented Public Functions
virtual void | AddProperty(std::string name, std::string value) override |
virtual void | Configure(XMLElementEx *pSignalXML) override |
virtual void | Create(const char *name, CDPComponent *pParent) override |
virtual void | Destroy() override |
virtual std::string | GetProperty(const std::string &propertyName) override |
virtual bool | IsInput() override |
virtual const char * | Name() const override |
virtual void | SetChannelParameters(bool input, int moduleNo, int channelGroup, int channelNo) override |
virtual void | SetProperty(std::string name, std::string value) override |
virtual void | SyncIn() override |
virtual void | SyncOut() override |
- 10 public functions inherited from ServerIO::ACDPBaseChannel
- 12 public functions inherited from ServerIO::ICDPChannel
- 8 public functions inherited from ServerIO::IChannel
- 26 public functions inherited from CDP::StudioAPI::CDPNode
- 22 public functions inherited from CDP::StudioAPI::ICDPNode
Protected Functions
void | ValueChanged(CDP::StudioAPI::ICDPNode *node, const CDP::StudioAPI::CDPVariantValue &oldValue, const CDP::StudioAPI::CDPVariantValue &newValue) override |
Reimplemented Protected Functions
virtual bool | AddChild(const std::string &name, const std::string &typeName, const std::string &configuration) override |
virtual void | FillNodeChildren(CDP::StudioAPI::NodeStream &stream) const override |
virtual T | GetExternal() const override |
virtual T | GetInternal(double &timeStamp) const override |
virtual CDP::StudioAPI::CDPNodeType | GetNodeType() const override |
virtual std::string | GetNodeTypeName() const override |
virtual CDP::StudioAPI::CDPValueType | GetNodeValueType() const override |
virtual CDP::StudioAPI::CDPVariantValue | GetVariantValue() const override |
virtual void | IssueBadDataSizeError(const char *methodName, unsigned int size) override |
virtual bool | RemoveChild(const std::string &name) override |
virtual void | SetExternal(T newValue) override |
virtual void | SetInternal(T newValue, double timeStamp) override |
virtual void | SetVariantValue(const CDP::StudioAPI::CDPVariantValue &value) override |
- 16 protected functions inherited from ServerIO::ACDPBaseChannel
- 2 protected functions inherited from ServerIO::IChannel
- 1 protected function inherited from CDP::StudioAPI::CDPNode
Additional Inherited Members
- 3 protected variables inherited from ServerIO::ACDPBaseChannel
Detailed Description
The CDPSignalChannel template-class is an ACDPBaseChannel<> implementation based on CDPSignal.
This class is final and IChannel interface members are threadsafe for user threads that run SynchronizeValuesIn() and SynchronizeValuesOut() through ChannelManager.
CDPSignalChannel<string> Specialization
CDPSignalChannel<string> has an additional member BinaryEncodedLength that can be specified to limit the size of the string. When BinaryEncodedLength is set to 0, the channel will behave as a dynamically sized channel, and automatically resize to match the content size.
When BinaryEncodedLength is set to a non-zero value, then the channel will be always encoded to that size, so that longer string values will be truncated and shorter values will be padded by zero characters. This can be useful in some I/O Servers, such as ModbusIO, to send and receive string data that always occupies a fixed amount of space.
Note: Some I/O Servers, such as ModbusIO can not fully handle dynamically sized channels (i.e. BinaryEncodedLength set to 0) as it will cause issues due to the string length and positioning of the data in the channels following this string channel.
Note: Custom buffer can be passed to the channel using SetDataPointer(). Passing in 'nullptr' as a data pointer will make the CDPSignalChannel<string> use the internal buffer.
See also ServerIO::CDPSignalChannelFactory, IOServer, ServerIO, ServerIO::ACDPBaseChannel, ServerIO::ICDPChannel, ServerIO::IChannel, ServerIO::CDPPropertyChannel, and ServerIO::ComponentStateChannel.
Member Function Documentation
CDPSignalChannel::CDPSignalChannel()
Default constructs an instance of CDPSignalChannel.
CDPSignalChannel::~CDPSignalChannel()
Releases memory.
[override virtual protected]
bool CDPSignalChannel::AddChild(const std::string &name, const std::string &typeName, const std::string &configuration)
[override virtual]
void CDPSignalChannel::AddProperty(std::string name, std::string value)
Reimplemented from ICDPChannel::AddProperty().
[override virtual]
void CDPSignalChannel::Configure(XMLElementEx *pSignalXML)
Reimplemented from ICDPChannel::Configure().
[override virtual]
void CDPSignalChannel::Create(const char *name, CDPComponent *pParent)
Reimplemented from ICDPChannel::Create().
[override virtual]
void CDPSignalChannel::Destroy()
Reimplemented from ICDPChannel::Destroy().
Destroys m_signal.
[override virtual protected]
void CDPSignalChannel::FillNodeChildren(CDP::StudioAPI::NodeStream &stream) const
Reimplemented from CDPNode::FillNodeChildren().
Serializes m_name, m_networkConvert, m_channelNo and m_signal.
[override virtual protected]
T CDPSignalChannel::GetExternal() const
Reimplemented from ACDPBaseChannel::GetExternal().
Returns the value of m_signal
as type T.
[override virtual protected]
T CDPSignalChannel::GetInternal(double &timeStamp) const
Reimplemented from ACDPBaseChannel::GetInternal().
timestamp
is updated and value from m_signal
is returned, called from ACDPBaseChannel::SyncIn().
[override virtual protected]
CDP::StudioAPI::CDPNodeType CDPSignalChannel::GetNodeType() const
Reimplemented from ICDPNode::GetNodeType().
Returns eCDP_OBJECT_NODE, see CDP::StudioAPI::CDPNodeType.
[override virtual protected]
std::string CDPSignalChannel::GetNodeTypeName() const
Reimplemented from ICDPNode::GetNodeTypeName().
Returns "CDPSignalChannel<T>" where T is the type, e.g. "double", "bool".
[override virtual protected]
CDP::StudioAPI::CDPValueType CDPSignalChannel::GetNodeValueType() const
Reimplemented from ICDPNode::GetNodeValueType().
Returns the ValueType of m_signal
, see CDP::StudioAPI::CDPValueType.
[override virtual]
std::string CDPSignalChannel::GetProperty(const std::string &propertyName)
Reimplemented from ICDPChannel::GetProperty().
[override virtual protected]
CDP::StudioAPI::CDPVariantValue CDPSignalChannel::GetVariantValue() const
Reimplemented from ICDPNode::GetVariantValue().
Returns the value of m_signal
as a CDPVariantValue.
[override virtual]
bool CDPSignalChannel::IsInput()
Reimplemented from IChannel::IsInput().
[override virtual protected]
void CDPSignalChannel::IssueBadDataSizeError(const char *methodName, unsigned int size)
Reimplemented from ACDPBaseChannel::IssueBadDataSizeError().
Prints an error CDPMessage because of mismatch between specified size and size of type T.
[override virtual]
const char *CDPSignalChannel::Name() const
Reimplemented from IChannel::Name().
[override virtual protected]
bool CDPSignalChannel::RemoveChild(const std::string &name)
[override virtual]
void CDPSignalChannel::SetChannelParameters(bool input, int moduleNo, int channelGroup, int channelNo)
Reimplemented from ICDPChannel::SetChannelParameters().
[override virtual protected]
void CDPSignalChannel::SetExternal(T newValue)
Reimplemented from ACDPBaseChannel::SetExternal().
Sets the value of m_signal
from newValue
of type T.
[override virtual protected]
void CDPSignalChannel::SetInternal(T newValue, double timeStamp)
Reimplemented from ACDPBaseChannel::SetInternal().
m_signal
is updated with newValue
and timestamp
, called from ACDPBaseChannel::SyncOut().
[override virtual]
void CDPSignalChannel::SetProperty(std::string name, std::string value)
Reimplemented from ICDPChannel::SetProperty().
[override virtual protected]
void CDPSignalChannel::SetVariantValue(const CDP::StudioAPI::CDPVariantValue &value)
[override virtual]
void CDPSignalChannel::SyncIn()
[override virtual]
void CDPSignalChannel::SyncOut()
[protected]
void CDPSignalChannel::ValueChanged(CDP::StudioAPI::ICDPNode *node, const CDP::StudioAPI::CDPVariantValue &oldValue, const CDP::StudioAPI::CDPVariantValue &newValue)
Get started with CDP Studio today
Let us help you take your great ideas and turn them into the products your customer will love.