CDPSignal Class
The CDPSignal is a template class used for holding a group of properties. More...
Header: | #include <Signal/CDPSignal.h> |
Inherits: | CDPObject and |
Public Functions
CDPSignal() | |
CDPSignal(T initialValue) | |
CDPSignal(CDPSignal<T> &&) = delete | |
virtual | ~CDPSignal() override |
virtual void | ConnectTo(const char *fullName) override |
virtual void | Disconnect() override |
virtual double | GetDouble() override |
virtual double | GetDoubleWithTimeStamp(double &timeStamp) const override |
const CDPPropertyBase & | GetPropertyFromOperator(const std::string &propertyName) |
T | GetRawValue() const |
CDPPropertyBase::RoutingStatus_e | GetRoutingStatus(std::string strProperty = "") |
double | GetTimeStamp() const |
virtual T | GetWithTimeStamp(double &timeStamp) const |
bool | HasOperators() const |
virtual bool | IsUpdated(double timeout = -1.0) const |
virtual const char * | Name() const override |
virtual const std::string | Routing() const override |
virtual bool | RoutingOK() override |
virtual void | SetDouble(double newValue) override |
virtual void | SetDoubleWithTimeStamp(double newValue, double timeStamp) |
void | SetInput(bool isInputSignal) |
void | SetSignalSyncGroupId(int iSignalSyncGroupId) |
void | SetTimeStamp(double timeStamp) |
virtual void | SetWithTimeStamp(T newValue, double timeStamp) |
operator T() const | |
CDPSignal<T> & | operator=(CDPSignal<T> &&) = delete |
CDPSignal<T> & | operator=(const CDPSignal<T> &rhs) |
CDPSignal<T> & | operator=(const CDPProperty<T> &rhs) |
CDPSignal<T> & | operator=(const std::string &rhs) |
CDPSignal<T> & | operator=(const char *rhs) |
CDPSignal<T> & | operator=(const double rhs) |
CDPSignal<T> & | operator=(const float rhs) |
CDPSignal<T> & | operator=(const uint64_t rhs) |
CDPSignal<T> & | operator=(const int64_t rhs) |
CDPSignal<T> & | operator=(const unsigned int rhs) |
CDPSignal<T> & | operator=(const int rhs) |
CDPSignal<T> & | operator=(const unsigned short rhs) |
CDPSignal<T> & | operator=(const short rhs) |
CDPSignal<T> & | operator=(const unsigned char rhs) |
CDPSignal<T> & | operator=(const char rhs) |
CDPSignal<T> & | operator=(const bool rhs) |
Reimplemented Public Functions
virtual void | Activate() override |
virtual bool | AddChild(const std::string &name, const std::string &typeName, const std::string &configuration) override |
virtual void | ClockIn() override |
virtual void | ClockOut() override |
virtual void | Configure(const char *pzXML) override |
virtual void | Configure(XMLElementEx *pSignalXML) override |
virtual void | Create(const char *name, CDPComponent *pParent) override |
virtual void | CreateModel() override |
virtual void | Destroy() override |
virtual void | DontSaveXML() override |
virtual std::string | GetProperty(std::string propertyName) override |
virtual const char * | GetType() override |
virtual CDP::StudioAPI::CDPVariantValue | GetVariantValue() const override |
virtual XMLElementEx * | GetXMLElement() override |
virtual bool | RemoveChild(const std::string &name) override |
virtual void | SetProperty(std::string propertyName, std::string propertyValue) override |
virtual void | SetVariantValue(const CDP::StudioAPI::CDPVariantValue &value) override |
virtual const char * | ShortName() const override |
virtual void | Suspend() override |
- 37 public functions inherited from CDPObject
- 46 public functions inherited from CDPBaseObject
- 26 public functions inherited from CDP::StudioAPI::CDPNode
- 22 public functions inherited from CDP::StudioAPI::ICDPNode
Additional Inherited Members
- 6 static public members inherited from CDPObject
- 1 static public member inherited from CDPBaseObject
- 13 protected functions inherited from CDPObject
- 1 protected function inherited from CDP::StudioAPI::CDPNode
- 7 protected variables inherited from CDPObject
- 9 protected variables inherited from CDPBaseObject
- 1 static protected member inherited from CDPObject
Detailed Description
The CDPSignal is a template class used for holding a group of properties.
A CDPSignal holds a value that changes over time. The input or output value can be manipulated by adding CDPOperators. Each Signal can contain a chain of CDPOperators to perform multiple operations on input or output values. Signals can be routed to retrieve values from other signals.
Note: The length of CDPSignal<string> is not limited but only values of 925 characters or less are guaranteed to pass through the routing system to remote applications.
Usage
- Add signal to your code using CDP Studio. Give the signal a unique name, for instance 'pA'.
- Use the created signal as a normal variable :
pA = 0.6;
ordouble pressure = pA;
- Signal can get its value(s) from another signal or property by changing the 'Routing' property.
- There is a property called 'RoutedProperties' that lists which Properties the signal should try to retrieve when it Routes from another signal.
- Input signals by default route the remote Value of a signal and apply operators, if they exist, before updating its own Value property that can be accessed in user code in Component.
- Output signals by default route the remote Value of a signal to its internal raw value (if the signal is assigned in Component code it will override the internal raw value from routing). Signal then applies its operators to produce Value that can in turn be routed by other signals.
Member Function Documentation
CDPSignal::CDPSignal()
Default constructor. Resets all member variables to safe initial values. Overload to set custom members.
CDPSignal::CDPSignal(T initialValue)
CDPSignal Constructor. Parameter initialValue is set to internal value, which can be accessed with CDPSignal<T>::operator T()
.
[delete]
CDPSignal::CDPSignal(CDPSignal<T> &&)
Move-copy constructor.
[override virtual]
CDPSignal::~CDPSignal()
CDPSignal destructor, destroys the instance.
[override virtual]
void CDPSignal::Activate()
Reimplemented from CDPBaseObject::Activate().
Activates CDPSignal instance and all its CDPOperators, prints a warning if the CDPSignal does not have an XML configuration.
See also Suspend().
[override virtual]
bool CDPSignal::AddChild(const std::string &name, const std::string &typeName, const std::string &configuration)
[override virtual]
void CDPSignal::ClockIn()
Reimplemented from CDPBaseObject::ClockIn().
Clock the signal value in from the external side. This function will retrieve the external value and pass it on to all operators, updating the Output, Status and TimeStamp afterwards.
[override virtual]
void CDPSignal::ClockOut()
Reimplemented from CDPBaseObject::ClockOut().
Clock the signal value out to the external side. This function runs all operators and sets the value to the outside of the signal, updating status and timestamp afterwards.
[override virtual]
void CDPSignal::Configure(const char *pzXML)
Reimplemented from CDPObject::Configure().
Configures the signal from an XML string.
See also CDPSignal::Configure(XMLElementEx* pSignalXML).
[override virtual]
void CDPSignal::Configure(XMLElementEx *pSignalXML)
Reimplemented from CDPObject::Configure().
Configure the signal from an pSignalXML XMLElementEx. Based on the Input attribute it will:
- Dynamically create input/output properties
- Add to the parent SyncInList or the SyncOutList
- Set the output value based on 'Value'
See also CDPSignal::Configure(const char *pzXML).
[override virtual]
void CDPSignal::ConnectTo(const char *fullName)
Connects to another named signal. All properties configured in RoutedProperties
property will be attempted to be routed.
See also RoutingOK(), Disconnect(), SetInput(), and GetRoutingStatus().
[override virtual]
void CDPSignal::Create(const char *name, CDPComponent *pParent)
Reimplemented from CDPObject::Create().
Creates the Signal and sets the name-binding to use in Configure().
See also Configure() and CreateModel().
[override virtual]
void CDPSignal::CreateModel()
Reimplemented from CDPBaseObject::CreateModel().
Creates the model for this object, and registers Message handlers etc.
See also CDPObject::CreateModel().
[override virtual]
void CDPSignal::Destroy()
Reimplemented from CDPBaseObject::Destroy().
Destroy the signal when it is no longer is in use.
CDP handles destruction of all objects itself, but if Objects are to be reconstructed during runtime, the programmer must call Destroy before calling Create() on the object again.
See also Create().
[override virtual]
void CDPSignal::Disconnect()
Disconnect from the current signal if connected. All the properties configured in RoutedPropertied
will be disconnected.
See also CDPSignal::ConnectTo() and CDPSignal::GetRoutingStatus().
[override virtual]
void CDPSignal::DontSaveXML()
Reimplemented from CDPObject::DontSaveXML().
Permanently prevent this object from being saved to XML. XMLElement is unlinked from parser, and parser will take care to delete the element on destroy.
[override virtual]
double CDPSignal::GetDouble()
Returns the value as a double.
See also SetDouble().
[override virtual]
double CDPSignal::GetDoubleWithTimeStamp(double &timeStamp) const
Return the current value as a double, along with its timestamp.
See also GetWithTimeStamp() and GetTimeStamp().
[override virtual]
std::string CDPSignal::GetProperty(std::string propertyName)
const CDPPropertyBase &CDPSignal::GetPropertyFromOperator(const std::string &propertyName)
T CDPSignal::GetRawValue() const
Returns the unscaled and unmasked value.
CDPPropertyBase::RoutingStatus_e CDPSignal::GetRoutingStatus(std::string strProperty = "")
Gets the (worst) CDPPropertyBase::RoutingStatus_e of the 'RoutedProperties' of this signal. The routingstatus order is CDPPropertyBase::e_RoutingInvalid, CDPPropertyBase::e_Routed, CDPPropertyBase::e_NotRouted.
See also CDPPropertyBase::RoutingStatus_e.
double CDPSignal::GetTimeStamp() const
Get the timestamp for the current value.
[override virtual]
const char *CDPSignal::GetType()
Reimplemented from CDPObject::GetType().
Returns the type of the signal as a string.
[override virtual]
CDP::StudioAPI::CDPVariantValue CDPSignal::GetVariantValue() const
Reimplemented from ICDPNode::GetVariantValue().
Returns the value of this signal as a CDPVariantValue.
See also SetVariantValue().
[virtual]
T CDPSignal::GetWithTimeStamp(double &timeStamp) const
Return the current value along with its timestamp.
See also SetWithTimeStamp() and GetTimeStamp().
[override virtual]
XMLElementEx *CDPSignal::GetXMLElement()
Reimplemented from CDPObject::GetXMLElement().
Gets the XML Element for this CDPSignal
bool CDPSignal::HasOperators() const
[virtual]
bool CDPSignal::IsUpdated(double timeout = -1.0) const
Returns true if the signal has been updated in the interval CDPTime::GetGlobalTime() - m_dTimeStamp < timeout
.
If called from a thread (not from a Process-function), CDPTime::GetGlobalTime() may not be updated, so instead check this value: CDPTime::GetGlobalTimeFromHardware() - GetTimeStamp() < timeout
.
See also CDPTime::GetGlobalTime() and CDPTime::GetGlobalTimeFromHardware().
[override virtual]
const char *CDPSignal::Name() const
Returns the full name of the signal.
See also CDPObject::Name().
[override virtual]
bool CDPSignal::RemoveChild(const std::string &name)
[override virtual]
const std::string CDPSignal::Routing() const
Returns the current routing as string
[override virtual]
bool CDPSignal::RoutingOK()
Checks routing statuses on all properties in the object and returns if routing is OK or not.
[override virtual]
void CDPSignal::SetDouble(double newValue)
Sets the new value from a double.
See also GetDouble().
[virtual]
void CDPSignal::SetDoubleWithTimeStamp(double newValue, double timeStamp)
Set the current value from a double, along with a timestamp.
See also GetWithTimeStamp() and SetWithTimeStamp().
void CDPSignal::SetInput(bool isInputSignal)
Sets the signal to be an input signal (true) or an output signal (false).
[override virtual]
void CDPSignal::SetProperty(std::string propertyName, std::string propertyValue)
Reimplemented from CDPBaseObject::SetProperty().
Sets the named property to the specified string value.
See also GetProperty(), CDPObject::GetPropertyObject(), and GetPropertyFromOperator().
void CDPSignal::SetSignalSyncGroupId(int iSignalSyncGroupId)
Sets the sync group id for this signal.
void CDPSignal::SetTimeStamp(double timeStamp)
Set the timestamp for the current value.
[override virtual]
void CDPSignal::SetVariantValue(const CDP::StudioAPI::CDPVariantValue &value)
Reimplemented from CDPNode::SetVariantValue().
Sets the value of this signal from a CDPVariantValue.
See also GetVariantValue().
[virtual]
void CDPSignal::SetWithTimeStamp(T newValue, double timeStamp)
Set the current value along with a timestamp.
See also GetWithTimeStamp() and SetDoubleWithTimeStamp().
[override virtual]
const char *CDPSignal::ShortName() const
Reimplemented from CDPBaseObject::ShortName().
Returns the short (non-dotted) name of the signal.
See also CDPObject::ShortName().
[override virtual]
void CDPSignal::Suspend()
Reimplemented from CDPBaseObject::Suspend().
Suspends all CDPOperators owned by this signal.
CDPSignal::operator T() const
Returns the internal signal value.
[delete]
CDPSignal<T> &CDPSignal::operator=(CDPSignal<T> &&)
Move-assignment operator.
CDPSignal<T> &CDPSignal::operator=(const CDPSignal<T> &rhs)
Assigns the value of another signal to this signal.
Note: This does not copy any other state besides the value of the signal.
CDPSignal<T> &CDPSignal::operator=(const CDPProperty<T> &rhs)
CDPSignal<T> &CDPSignal::operator=(const std::string &rhs)
CDPSignal<T> &CDPSignal::operator=(const char *rhs)
CDPSignal<T> &CDPSignal::operator=(const double rhs)
Assigns the value of a double to this signal.
CDPSignal<T> &CDPSignal::operator=(const float rhs)
Assigns the value of a float to this signal.
CDPSignal<T> &CDPSignal::operator=(const uint64_t rhs)
Assigns the value of an uint64_t to this signal.
CDPSignal<T> &CDPSignal::operator=(const int64_t rhs)
Assigns the value of an int64_t to this signal.
CDPSignal<T> &CDPSignal::operator=(const unsigned int rhs)
Assigns the value of an unsigned int to this signal.
CDPSignal<T> &CDPSignal::operator=(const int rhs)
Assigns the value of an int to this signal.
CDPSignal<T> &CDPSignal::operator=(const unsigned short rhs)
Assigns the value of an unsigned short to this signal.
CDPSignal<T> &CDPSignal::operator=(const short rhs)
Assigns the value of a short to this signal.
CDPSignal<T> &CDPSignal::operator=(const unsigned char rhs)
Assigns the value of an unsigned char to this signal.
CDPSignal<T> &CDPSignal::operator=(const char rhs)
Assigns the value of a char to this signal.
CDPSignal<T> &CDPSignal::operator=(const bool rhs)
Assigns the value of a bool to this signal.
Get started with CDP Studio today
Let us help you take your great ideas and turn them into the products your customer will love.