Switchboard Extension SDK
Loading...
Searching...
No Matches
NodeFactory.hpp
1//
2// NodeFactory.hpp
3// SwitchboardSDK
4//
5// Created by Balazs Kiss on 2023. 07. 05..
6//
7
8#pragma once
9
10#include <any>
11#include <map>
12#include <memory>
13#include <string>
14#include <switchboard/export.h>
15#include <switchboard_core/Node.hpp>
16#include <switchboard_core/NodeTypeInfo.hpp>
17#include <vector>
18
19namespace switchboard {
20
25class SWITCHBOARDSDK_EXPORT NodeFactory {
26public:
31
35 virtual ~NodeFactory();
36
43 virtual std::string getNodeTypePrefix() = 0;
44
51 virtual std::vector<NodeTypeInfo> getNodeTypes();
52
62 virtual Node* createNode(const std::string& type, const SBAnyMap& config);
63
64 using NodeCreator = std::function<Node*(const SBAnyMap&)>;
65
73 void registerNode(const NodeTypeInfo& type, NodeCreator creator);
74
75private:
76 class Impl;
77 std::unique_ptr<Impl> pImpl;
78};
79
80}
virtual std::vector< NodeTypeInfo > getNodeTypes()
Returns the list of node types that can be created by this factory.
virtual ~NodeFactory()
NodeFactory destructor.
virtual Node * createNode(const std::string &type, const SBAnyMap &config)
Creates an Node instance based on type information.
NodeFactory()
NodeFactory constructor.
virtual std::string getNodeTypePrefix()=0
Returns the prefix of the node type.
void registerNode(const NodeTypeInfo &type, NodeCreator creator)
Registers a node type with the factory.
Definition Node.hpp:14
Definition NodeTypeInfo.hpp:29