MUXOperator Class
(Automation::MUXOperator)The MUXOperator is a multiplexer that selects one source by Index from a selection of many sources. More...
Header: | #include <MUXOperator.h> |
Inherits: | CDPOperator<T> |
Public Functions
MUXOperator(const CDPPropertyBase &in) |
Reimplemented Public Functions
- 18 public functions inherited from CDPOperator
- 17 public functions inherited from CDPOperatorBase
- 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
- 1 public variable inherited from CDPOperatorBase
- 1 static public member inherited from CDPBaseObject
- 1 protected function inherited from CDP::StudioAPI::CDPNode
- 8 protected variables inherited from CDPOperator
- 5 protected variables inherited from CDPOperatorBase
- 11 protected variables inherited from CDPBaseObject
Detailed Description
The MUXOperator is a multiplexer that selects one source by Index from a selection of many sources.
The default input will always be source 0. Additional sources can be added as Arguments into the MUXOperator. The source selection is done by setting the MUXOperator Index to the desired 0-based source number to use. Index can be routed from another value.
Example
To select between a signal value and the values 10,20 and 30; add a Signal<double>, go into it and add two additional Arguments. Go into the first Argument and set Value to 10, then go into the second Argument and set Value to 20, and finally go into the third argument and set Value to 30.
How to Run the Example
To run the example from CDP Studio, open Welcome mode and find it under Examples. Next, in Configure mode right-click on the system project and select Run & Connect. See the Running the Example Project tutorial for more information.
Click into the signal containing the MUXOperator, and change Index between 0 and 3, and validate that the signal value changes according to selected source index.
Note: If index is larger than the allowed range (number of arguments), then the Index will be limited (to number of arguments).
Arguments
Name | Description |
---|---|
Out | The default output value. |
Index | 0-based index to select which of the arguments to use. Index 0 is the default input value; any other Index value chooses between the arguments in the operator. If index is larger than the allowed range (number of arguments), then the Index will be limited (to number of arguments). |
In0 | Default input argument corresponding to Index 0 |
In1 | Input argument corresponding to Index 1 |
When operator is used inside a signal its default input is automatically tied to signal's InternalValue or previous operator's output. Its default output is automatically tied to next operator's input or to signal's Value. See also CDP Operator Usage In CDP Signals.
Actual Processing Code of the MUXOperator
unsigned int MUXOperator<T>::Process() { if (!m_index) return STATUS_ERROR; unsigned int index = static_cast<unsigned int>(*m_index); if (index > this->m_arguments.size()-1) index = this->m_arguments.size()-1; if (this->m_arguments.size()-1 > 0 && index > 0) m_output = static_cast<T>(*this->m_arguments[index]); else m_output = m_input; return STATUS_OK; }
See also Argument.
Member Function Documentation
MUXOperator::MUXOperator(const CDPPropertyBase &in)
Default constructs an instance of MUXOperator.
[override virtual]
void MUXOperator::Configure(XMLPrimitive *operatorXML)
Reimplemented from CDPBaseObject::Configure().
[override virtual]
unsigned int MUXOperator::Process()
Get started with CDP Studio today
Let us help you take your great ideas and turn them into the products your customer will love.