ValueNode Class
A template class that provides value node functionality to any base node type. More...
| Header: | #include <ValueNode> |
| Inherits: | CDP::StudioAPI::AbstractValueListener and |
| Inherited By: |
Public Functions
| ValueNode() | |
| ValueNode(Args &&... args) | |
| ~ValueNode() override | |
| std::optional<CDP::StudioAPI::Metadata> | GetMetadata() const override |
| CDP::StudioAPI::CDPNodeModeFlags | GetNodeModeFlags() const override |
| CDP::StudioAPI::CDPValueType | GetNodeValueType() const override |
| CDP::StudioAPI::CDPVariantValue | GetVariantValue() const override |
| void | MetadataChanged(CDP::StudioAPI::ICDPNode *node, const CDP::StudioAPI::Metadata &newMetadata) override |
| void | SetValueChild(CDP::StudioAPI::CDPNode *child) |
| void | SetVariantValue(const CDP::StudioAPI::CDPVariantValue &value) override |
| void | UpdateMetadata(const CDP::StudioAPI::MetadataUpdate &metadata) const override |
| void | ValueChanged(CDP::StudioAPI::ICDPNode *node, const CDP::StudioAPI::CDPVariantValue &oldValue, const CDP::StudioAPI::CDPVariantValue &newValue) override |
- 8 public functions inherited from CDP::StudioAPI::AbstractValueListener
Detailed Description
A template class that provides value node functionality to any base node type.
ValueNode Class
ValueNode is a template class that provides a value node functionality to any CDP base node type. A value node is a node that has a value child that holds the actual value of the node. The value node acts as a proxy to its value child. All value-related calls to the value node are forwarded to the value child. And vice versa, all value-related events from the value child are forwarded to the value node.
In addition to CDPVariantValue-related proxying, ValueNode also supports value child metadata and external value proxying.
ValueNode class implementers need not call CDP::StudioAPI::CDPNode::NotifyValueChange nor CDP::StudioAPI::CDPNode::NotifyMetadataChange methods on value child changes manually, as these are called automatically by the ValueNode class, which registers itself as an CDP::StudioAPI::AbstractValueListener to the value child node. And because of that, the ValueNode class implementers can not to register themselves as an CDP::StudioAPI::AbstractValueListener anymore. But implementers can override the relevant CDP::StudioAPI::AbstractValueListener methods in their implementation to get them notified about value or metadata changes as well, if needed.
Note: ValueNode does not take ownership of the value child node. It is the responsibility of the user to ensure that the value child node is valid for the lifetime of the value node or until a new value child is set via ValueNode::SetValueChild() method.
Example usage for creating a CDPNode-based value node:
class MyValueNode : public ValueNode<CDP::StudioAPI::CDPNode> { public: MyValueNode() { SetValueChild(&m_value); } private: CDPProperty<double> m_value; }
Example usage for creating a CDPBaseObject-based value node:
class MyValueObject : public ValueNode<CDPBaseObject> { public: MyValueObject() { SetValueChild(&m_value); } private: CDPProperty<double> m_value; }
Member Function Documentation
ValueNode::ValueNode()
Default constructs an instance of ValueNode.
ValueNode::ValueNode(Args &&... args)
Default constructs an instance of ValueNode.
ValueNode::~ValueNode()
Destroys the instance of ValueNode.
std::optional<CDP::StudioAPI::Metadata> ValueNode::GetMetadata() const
CDP::StudioAPI::CDPNodeModeFlags ValueNode::GetNodeModeFlags() const
CDP::StudioAPI::CDPValueType ValueNode::GetNodeValueType() const
CDP::StudioAPI::CDPVariantValue ValueNode::GetVariantValue() const
void ValueNode::MetadataChanged(CDP::StudioAPI::ICDPNode *node, const CDP::StudioAPI::Metadata &newMetadata)
void ValueNode::SetValueChild(CDP::StudioAPI::CDPNode *child)
Sets the value child node given by child. Should be called to set the value child node of the value node to enable the value proxying functionality.
void ValueNode::SetVariantValue(const CDP::StudioAPI::CDPVariantValue &value)
void ValueNode::UpdateMetadata(const CDP::StudioAPI::MetadataUpdate &metadata) const
void ValueNode::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.