Noise Modeler Library  0.1
Library for procedurally generating noise-based terrains and other content
 All Classes Files Functions Variables Enumerations Enumerator Groups Pages
inputlink.hpp
1 #ifndef NM_INPUTLINK_HPP
2 #define NM_INPUTLINK_HPP
3 
4 #include <nmlib/model/signalvalue.hpp>
5 
6 #include <nmlib/util/userdataprovider.hpp>
7 #include <nmlib/util/signals.hpp>
8 
9 namespace nm {
10 
11 class Module;
12 class ModuleInput;
13 class OutputLink;
14 
20 {
21 public:
22  explicit InputLink(Module &owner, const ModuleInput &type);
23  virtual ~InputLink();
24  bool link(OutputLink &output);
25  void unlink();
26  const Module& getOwner() const {return m_owner;}
27  Module& getOwner() {return m_owner;}
28  const ModuleInput& getModuleInput() const {return c_moduleInput;}
29  const OutputLink* getOutputLink() const {return p_outputLink;}
30  OutputLink* getOutputLink() {return p_outputLink;}
31  SignalValue getUnlinkedValue() const;
32  bool setUnlinkedValue(SignalValue newValue); //returns false if there was a type mismatch
33 
34  //signals
35  signal<void (InputLink&)> linkChanged;
36  signal<void (InputLink&)> unlinkedValueChanged;
37  signal<void (InputLink&)> destroying;
38 
39 private:
40  Module& m_owner;
41  const ModuleInput& c_moduleInput;
42  OutputLink* p_outputLink;
43  SignalValue m_unlinkedValue;
44 };
45 
46 } // namespace nm
47 
48 #endif // NM_INPUTLINK_HPP
Describes one of a ModuleType's inputs (name, SignalType, default value).
Definition: moduleinput.hpp:21
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
A vector of floats that can be set as the unlinked value of InputLinks.
Definition: signalvalue.hpp:15