|
Switchboard Extension SDK
|
Creates node instances. More...
#include <NodeFactory.hpp>
Public Types | |
| using | NodeCreator = std::function<Node*(const std::map<std::string, std::any>&)> |
Public Member Functions | |
| NodeFactory () | |
| NodeFactory constructor. | |
| virtual | ~NodeFactory () |
| NodeFactory destructor. | |
| virtual std::string | getNodeTypePrefix ()=0 |
| Returns the prefix of the node type. | |
| virtual std::vector< NodeTypeInfo > | getNodeTypes () |
| Returns the list of node types that can be created by this factory. | |
| virtual Node * | createNode (const std::string &type, const std::map< std::string, std::any > &config) |
| Creates an Node instance based on type information. | |
| void | registerNode (const NodeTypeInfo &type, NodeCreator creator) |
| Registers a node type with the factory. | |
Creates node instances.
NodeFactory class.
|
virtual |
Creates an Node instance based on type information.
The returned node instances need to be freed by the user of the NodeFactory.
| type | The type of the node. |
| config | Configuration values for the node. |
|
pure virtual |
Returns the prefix of the node type.
The prefix is used to identify the node type and it follows the format: <extension name>.<node type>.
|
virtual |
Returns the list of node types that can be created by this factory.
The node types are returned as a vector of strings, where each string is the type name of the node.
| void switchboard::NodeFactory::registerNode | ( | const NodeTypeInfo & | type, |
| NodeCreator | creator ) |
Registers a node type with the factory.
This function allows the factory to create instances of the specified node type.
| type | The type information of the node. |
| creator | A function that creates instances of the node. |