Lluvia
ContainerNode.h
Go to the documentation of this file.
1 
8 #ifndef LLUVIA_CORE_NODE_CONTAINER_NODE_H_
9 #define LLUVIA_CORE_NODE_CONTAINER_NODE_H_
10 
12 #include "lluvia/core/node/Node.h"
13 
14 #include <map>
15 #include <memory>
16 #include <string>
17 #include <vector>
18 
19 namespace ll {
20 
21 class CommandBuffer;
22 class Interpreter;
23 
24 class ContainerNode : public Node, public std::enable_shared_from_this<ll::ContainerNode> {
25 
26 public:
27  ContainerNode(const std::weak_ptr<ll::Interpreter>& interpreter);
28  ContainerNode(const std::weak_ptr<ll::Interpreter>& interpreter,
29  const ll::ContainerNodeDescriptor& descriptor);
30 
31  ContainerNode(const ll::ContainerNode&) = delete;
33 
34  virtual ~ContainerNode() = default;
35 
38 
39  ll::NodeType getType() const noexcept override;
40 
41  const ll::ContainerNodeDescriptor& getDescriptor() const noexcept;
42 
43  bool hasPort(const std::string& name) const noexcept override;
44 
45  std::shared_ptr<ll::Object> getPort(const std::string& name) const override;
46 
47  void bind(const std::string& name, const std::shared_ptr<ll::Object>& obj) override;
48 
49  void bindNode(const std::string& name, const std::shared_ptr<ll::Node>& node);
50 
51  std::shared_ptr<ll::Node> getNode(const std::string& name) const;
52 
53  void record(ll::CommandBuffer& commandBuffer) const override;
54 
55  void setParameter(const std::string& name, const ll::Parameter& value) override;
56 
57  const ll::Parameter& getParameter(const std::string& name) const override;
58 
59 protected:
60  void onInit() override;
61 
63 
64  std::map<std::string, std::shared_ptr<ll::Object>> m_objects;
65  std::map<std::string, std::shared_ptr<ll::Node>> m_nodes;
66 
67  std::weak_ptr<ll::Interpreter> m_interpreter;
68 };
69 
70 } // namespace ll
71 
72 #endif // LLUVIA_CORE_NODE_CONTAINER_NODE_H_
ContainerNodeDescriptor class.
Node class and related enums.
Class for command buffer.
Definition: CommandBuffer.h:63
Class for describing a container node.
Definition: ContainerNodeDescriptor.h:25
Definition: ContainerNode.h:24
ContainerNode(const std::weak_ptr< ll::Interpreter > &interpreter, const ll::ContainerNodeDescriptor &descriptor)
ll::ContainerNodeDescriptor m_descriptor
Definition: ContainerNode.h:62
ContainerNode(const std::weak_ptr< ll::Interpreter > &interpreter)
void bindNode(const std::string &name, const std::shared_ptr< ll::Node > &node)
bool hasPort(const std::string &name) const noexcept override
Returns whether or not a port exists with a given name.
ll::NodeType getType() const noexcept override
Gets the node type.
void record(ll::CommandBuffer &commandBuffer) const override
Records the operations required to run this node in a ll::CommandBuffer.
std::map< std::string, std::shared_ptr< ll::Object > > m_objects
Definition: ContainerNode.h:64
const ll::Parameter & getParameter(const std::string &name) const override
Gets a parameter.
const ll::ContainerNodeDescriptor & getDescriptor() const noexcept
std::map< std::string, std::shared_ptr< ll::Node > > m_nodes
Definition: ContainerNode.h:65
virtual ~ContainerNode()=default
void onInit() override
ll::ContainerNode & operator=(const ll::ContainerNode &)=delete
std::shared_ptr< ll::Node > getNode(const std::string &name) const
void bind(const std::string &name, const std::shared_ptr< ll::Object > &obj) override
Binds a ll::Object as port index for this node.
void setParameter(const std::string &name, const ll::Parameter &value) override
Sets a parameter.
ContainerNode(const ll::ContainerNode &)=delete
std::weak_ptr< ll::Interpreter > m_interpreter
Definition: ContainerNode.h:67
ContainerNode(ll::ContainerNode &&)=delete
ll::ContainerNode & operator=(ll::ContainerNode &&)=delete
std::shared_ptr< ll::Object > getPort(const std::string &name) const override
Gets a port descriptor given its name.
Definition: Interpreter.h:34
Definition: Node.h:30
Base class for all types that can be used in computer shaders.
Definition: Object.h:94
Definition: Parameter.h:23
Definition: Buffer.h:28
NodeType
Class for node type.
Definition: NodeType.h:19