Noise Modeler Library  0.1
Library for procedurally generating noise-based terrains and other content
 All Classes Files Functions Variables Enumerations Enumerator Groups Pages
outputlink.hpp
1 #ifndef NM_OUTPUTLINK_HPP
2 #define NM_OUTPUTLINK_HPP
3 
4 #include <nmlib/util/userdataprovider.hpp>
5 #include <nmlib/util/signals.hpp>
6 
7 #include <set>
8 
9 namespace nm {
10 
11 class Module;
12 class ModuleOutput;
13 class InputLink;
14 
22 {
23 public:
29  explicit OutputLink(Module &owner, const ModuleOutput &type):
30  m_owner(owner),
31  c_moduleOutput(type),
32  m_inputLinks()
33  {}
34  virtual ~OutputLink();
35 
41  bool addLink(InputLink &input);
42 
48  bool unlink(InputLink *input);
49 
55  void unlinkAll();
56 
57  unsigned int numLinks(){
58  return m_inputLinks.size();
59  }
60  InputLink* getLink(unsigned int index);
61 
62  const Module &getOwner() const {return m_owner;}
63  Module &getOwner() {return m_owner;}
64  const ModuleOutput &getModuleOutput() const {return c_moduleOutput;}
65 
66  //signals
67  signal<void (OutputLink&)> linksChanged;
68  signal<void (OutputLink&)> destroying;
69 
70 private:
71  Module &m_owner;
72  const ModuleOutput &c_moduleOutput;
73  std::vector<InputLink *> m_inputLinks;
74 };
75 
76 } // namespace nm
77 
78 #endif // NM_OUTPUTLINK_HPP
Base class for stuff that needs to provide user data in form of a void* pointer.
Definition: userdataprovider.hpp:10
An instantiated ModuleType. A node in a function graph.
Definition: module.hpp:40
Describes one of a ModuleType's outputs (name, SignalType)
Definition: moduleoutput.hpp:19