Noise Modeler Library  0.1
Library for procedurally generating noise-based terrains and other content
 All Classes Files Functions Variables Enumerations Enumerator Groups Pages
nm::Module Class Reference

An instantiated ModuleType. A node in a function graph. More...

#include <module.hpp>

Inheritance diagram for nm::Module:
nm::UserDataProvider

Public Member Functions

 Module (const ModuleType &type, std::string name, std::string description="")
 Constructor. More...
 
const ModuleTypegetType () const
 
const ModuleTypegetType ()
 
const std::string getName () const
 
void setName (std::string name)
 
const std::string getDescription () const
 
void setDescription (std::string description)
 
InputLinkgetInput (std::string name)
 
const InputLinkgetInput (std::string name) const
 
InputLinkgetInput (unsigned int i)
 
const InputLinkgetInput (unsigned int i) const
 
unsigned int getInputSize () const
 
std::vector< InputLink * > getInputs ()
 
OutputLinkgetOutput (std::string name)
 
const OutputLinkgetOutput (std::string name) const
 
OutputLinkgetOutput (unsigned int i)
 
const OutputLinkgetOutput (unsigned int i) const
 
unsigned int getOutputSize () const
 
std::vector< OutputLink * > getOutputs ()
 
void disconnect ()
 disconnects module by unlinking all InputLinks and OutputLinks of this module.
 
void traverseChildren (std::function< void(const Module &)> callback) const
 
void traverseParents (std::function< void(const Module &)> callback) const
 
void traverseDescendants (std::function< void(const Module &)> callback) const
 
void traverseDescendants (std::function< void(Module &)> callback)
 
void traverseAncestors (std::function< void(const Module &)> callback) const
 
int getDepth () const
 
int getHeight () const
 
- Public Member Functions inherited from nm::UserDataProvider
void * getUserData () const
 
void setUserData (void *userData)
 

Static Public Member Functions

static std::vector< Module * > getDependenciesSorted (const std::vector< OutputLink * > &outputs, const std::set< InputLink * > &ignoreInputs={})
 
static std::vector< const
Module * > 
getDependenciesSorted (const std::vector< const OutputLink * > &outputs, const std::set< const InputLink * > &ignoreInputs={})
 
static void topologicallyTraverseDependencies (const std::vector< OutputLink * > &outputs, std::function< void(Module &)> visitor, const std::set< InputLink * > &ignoreInputs={})
 
static void topologicallyTraverseDependencies (const std::vector< const OutputLink * > &outputs, std::function< void(const Module &)> visitor, const std::set< const InputLink * > &ignoreInputs={})
 

Public Attributes

signal< void(Module &, const
std::string &)> 
nameChanged
 This signal is emitted when the name of the Module is changed.
 
signal< void(Module &, const
std::string &)> 
descriptionChanged
 This signal is emitted when the description of the Module is changed.
 
signal< void(Module &)> destroying
 This signal is emitted before the Module is destroyed.
 
signal< void(Module
&, InputLink &)> 
addedInputLink
 This signal is emitted after an input has been added.
 
signal< void(Module &, const
ModuleInput &)> 
removedInputLink
 This signal is emitted after an input has been removed.
 
signal< void(Module
&, OutputLink &)> 
addedOutputLink
 This signal is emitted after an output has been added.
 
signal< void(Module &, const
ModuleOutput &)> 
removedOutputLink
 This signal is emitted after an output has been removed.
 
signal< void(Module &)> dependenciesChanged
 This signal is emitted if changes have been made to the graph that may influence this Module's output signals.
 

Detailed Description

An instantiated ModuleType. A node in a function graph.

A module is a part of a node in a Graph. It has a corresponding ModuleType, which describes some sort of mathematical function or algorithm. A module may be thought of a configuration for a function call.

A Module has a number of InputLinks and OutputLinks that may be connected to other Modules InputLinks and OutputLinks.

Connections can be changed by using the getters for these InputLinks and OutputLinks. One InputLink exists for each ModuleInput in the ModuleType of the Module. The same applies for outputs.

Usually create by Graph::createModule

Constructor & Destructor Documentation

nm::Module::Module ( const ModuleType type,
std::string  name,
std::string  description = "" 
)
explicit

Constructor.

Consider using Graph::createModule() instead if your goal is to add the module to a graph.

Member Function Documentation

int nm::Module::getDepth ( ) const
Returns
the number of modules above this one
int nm::Module::getHeight ( ) const
Returns
the number of modules below this one

The documentation for this class was generated from the following files: