Noise Modeler Library  0.1
Library for procedurally generating noise-based terrains and other content
 All Classes Files Functions Variables Enumerations Enumerator Groups Pages
moduleinput.hpp
1 #ifndef NM_MODULEINPUT_HPP
2 #define NM_MODULEINPUT_HPP
3 
4 #include <nmlib/model/signaltype.hpp>
5 #include <nmlib/model/signalvalue.hpp>
6 #include <nmlib/util/userdataprovider.hpp>
7 
8 #include <nmlib/util/signals.hpp>
9 
10 #include <string>
11 
12 namespace nm {
13 
14 class SignalType;
15 class ModuleType;
16 
22 {
23 public:
24  //TODO this constructor might not be needed
25  explicit ModuleInput(std::string name, SignalType signalType, const ModuleType &moduleType):
26  ModuleInput(name, SignalValue(signalType), moduleType) //zero as default value
27  {}
28  explicit ModuleInput(std::string name, SignalValue defaultValue, const ModuleType &moduleType):
29  c_name(name),
30  c_signalType(defaultValue.getSignalType()), //TODO redundants?
31  c_defaultValue(defaultValue),
32  c_moduleType(moduleType)
33  {}
34  ~ModuleInput(){destroying(*this);}
35 
36  std::string getName() const {return c_name;}
37  SignalType getSignalType() const {return c_signalType;}
38  SignalValue getDefaultValue() const {return c_defaultValue;}
39 
40  signal<void(ModuleInput&)> destroying;
41 private:
42  const std::string c_name;
43  const SignalType c_signalType;//TODO this may be inferred from signalvalue?
44  const SignalValue c_defaultValue;//TODO consider relaxing the constant requirement on this member
45  const ModuleType &c_moduleType;
46 };
47 
48 } // namespace nm
49 
50 #endif // NM_MODULEINPUT_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
Describes a recipe for a module and its inputs and outputs.
Definition: moduletype.hpp:37
Describes a the dimensionality of a signal Can be extended to include other type information such as ...
Definition: signaltype.hpp:13
A vector of floats that can be set as the unlinked value of InputLinks.
Definition: signalvalue.hpp:15