PeriDyno 1.0.0
Loading...
Searching...
No Matches
Module Class Reference

#include <Module.h>

Inheritance diagram for Module:
Collaboration diagram for Module:

Public Member Functions

 Module (std::string name="default")
 
 ~Module (void) override
 
bool initialize ()
 
void update ()
 
void setName (std::string name)
 
std::string getName () override
 
virtual void setParentNode (Node *node)
 Set the parent node.
 
NodegetParentNode ()
 
SceneGraph * getSceneGraph ()
 
bool isInitialized ()
 
virtual std::string getModuleType ()
 
bool attachField (FBase *field, std::string name, std::string desc, bool autoDestroy=true) override
 Attach a field to Base.
 
bool isInputComplete ()
 Check the completeness of input fields.
 
bool isOutputCompete ()
 
 DEF_VAR (bool, ForceUpdate, false, "")
 
void setUpdateAlways (bool b)
 Set the update strategy for the module.
 
- Public Member Functions inherited from dyno::OBase
 OBase ()
 
 ~OBase () override
 
virtual std::string caption ()
 Return the caption.
 
virtual bool captionVisible ()
 Whether to hide the caption in the GUI.
 
virtual std::string description ()
 Return a description for the node or module, override this function to support user-defined description.
 
bool addField (FBase *data)
 Add a field to Base FieldID will be set to the name of Field by default.
 
bool addField (FieldID name, FBase *data)
 Add a field to Base.
 
bool addFieldAlias (FieldID name, FBase *data)
 
bool addFieldAlias (FieldID name, FBase *data, FieldMap &fieldAlias)
 
bool findField (FBase *data)
 Find a field by its pointer.
 
bool findFieldAlias (const FieldID name)
 Find a field by its name.
 
bool findFieldAlias (const FieldID name, FieldMap &fieldAlias)
 Find a field in fieldAlias by its name This function is typically called by other functions.
 
bool removeField (FBase *data)
 Remove a field by its pointer.
 
bool removeFieldAlias (const FieldID name)
 Remove a field by its name.
 
bool removeFieldAlias (const FieldID name, FieldMap &fieldAlias)
 
FBasegetField (const FieldID name)
 Return a field by its name.
 
std::vector< FBase * > & getAllFields ()
 
template<typename T>
TgetField (FieldID name)
 
bool isAllFieldsReady ()
 Check the completeness of all required fields.
 
std::vector< FieldIDgetFieldAlias (FBase *data)
 
int getFieldAliasCount (FBase *data)
 
void setBlockCoord (float x, float y)
 
float bx ()
 
float by ()
 
bool findInputField (FBase *field)
 
bool addInputField (FBase *field)
 
bool removeInputField (FBase *field)
 
std::vector< FBase * > & getInputFields ()
 
bool findOutputField (FBase *field)
 
bool addOutputField (FBase *field)
 
bool addToOutput (FBase *field)
 
bool removeOutputField (FBase *field)
 
bool removeFromOutput (FBase *field)
 
std::vector< FBase * > & getOutputFields ()
 
bool findParameter (FBase *field)
 
bool addParameter (FBase *field)
 
bool removeParameter (FBase *field)
 
std::vector< FBase * > & getParameters ()
 
- Public Member Functions inherited from dyno::Object
 Object ()
 
virtual ~Object ()
 
ObjectId objectId ()
 

Protected Member Functions

virtual bool initializeImpl ()
 
virtual void updateImpl ()
 
virtual void preprocess ()
 
virtual void postprocess ()
 
virtual bool validateInputs ()
 
virtual bool validateOutputs ()
 
virtual bool requireUpdate ()
 
virtual void updateStarted ()
 Two functions called at the beginning and end of update() used for debug.
 
virtual void updateEnded ()
 

Private Attributes

Nodem_node
 
std::string m_module_name
 
bool m_initialized
 

Additional Inherited Members

- Public Types inherited from dyno::OBase
typedef std::vector< FBase * > FieldVector
 
typedef std::map< FieldID, FBase * > FieldMap
 
- Static Public Member Functions inherited from dyno::Object
static bool registerClass (ClassInfo *ci)
 
static ObjectcreateObject (std::string name)
 
static std::map< std::string, ClassInfo * > * getClassMap ()
 
static ObjectId baseId ()
 Base Id.
 
- Protected Attributes inherited from dyno::OBase
std::vector< FBase * > fields_input
 
std::vector< FBase * > fields_output
 
std::vector< FBase * > fields_param
 

Detailed Description

Definition at line 35 of file Module.h.

Constructor & Destructor Documentation

◆ Module()

dyno::Module::Module ( std::string name = "default")

Definition at line 7 of file Module.cpp.

◆ ~Module()

dyno::Module::~Module ( void )
override

Definition at line 15 of file Module.cpp.

Member Function Documentation

◆ attachField()

bool dyno::Module::attachField ( FBase * field,
std::string name,
std::string desc,
bool autoDestroy = true )
overridevirtual

Attach a field to Base.

Parameters
fieldField pointer
nameField name
descField description
autoDestroyThe field will be destroyed by Base if true, otherwise, the field should be explicitly destroyed by its creator.
Returns
Return false if the name conflicts with exists fields' names

Reimplemented from dyno::OBase.

Definition at line 240 of file Module.cpp.

◆ DEF_VAR()

dyno::Module::DEF_VAR ( bool ,
ForceUpdate ,
false ,
""  )

◆ getModuleType()

virtual std::string dyno::Module::getModuleType ( )
inlinevirtual

Definition at line 71 of file Module.h.

◆ getName()

std::string dyno::Module::getName ( )
overridevirtual

Reimplemented from dyno::OBase.

Definition at line 198 of file Module.cpp.

◆ getParentNode()

Node * dyno::Module::getParentNode ( )

@breif Return the Node that contains this Module

Returns
return nullptr if the Module is not contained in any Node

Definition at line 203 of file Module.cpp.

◆ getSceneGraph()

dyno::SceneGraph * dyno::Module::getSceneGraph ( )

@breif Return the SceneGraph that contains this Module

Returns
return nullptr if the module is not contained in any node

Definition at line 212 of file Module.cpp.

◆ initialize()

bool dyno::Module::initialize ( )

Definition at line 36 of file Module.cpp.

◆ initializeImpl()

bool dyno::Module::initializeImpl ( )
protectedvirtual

Definition at line 231 of file Module.cpp.

◆ isInitialized()

bool dyno::Module::isInitialized ( )

Definition at line 226 of file Module.cpp.

◆ isInputComplete()

bool dyno::Module::isInputComplete ( )

Check the completeness of input fields.

Returns
true, if all input fields are appropriately set.
false, if any of the input field is empty.

Definition at line 104 of file Module.cpp.

◆ isOutputCompete()

bool dyno::Module::isOutputCompete ( )

Definition at line 127 of file Module.cpp.

◆ postprocess()

virtual void dyno::Module::postprocess ( )
inlineprotectedvirtual

Definition at line 104 of file Module.h.

◆ preprocess()

virtual void dyno::Module::preprocess ( )
inlineprotectedvirtual

Definition at line 102 of file Module.h.

◆ requireUpdate()

bool dyno::Module::requireUpdate ( )
protectedvirtual

Definition at line 164 of file Module.cpp.

◆ setName()

void dyno::Module::setName ( std::string name)

Definition at line 187 of file Module.cpp.

◆ setParentNode()

void dyno::Module::setParentNode ( Node * node)
virtual

Set the parent node.

Definition at line 193 of file Module.cpp.

◆ setUpdateAlways()

void dyno::Module::setUpdateAlways ( bool b)

Set the update strategy for the module.

Parameters
btrue, the module will be updated no matter the control and input variables are changed; false, the module will updated only when one of the variables are changed.

Definition at line 221 of file Module.cpp.

◆ update()

void dyno::Module::update ( )

Definition at line 47 of file Module.cpp.

◆ updateEnded()

void dyno::Module::updateEnded ( )
protectedvirtual

Definition at line 154 of file Module.cpp.

◆ updateImpl()

void dyno::Module::updateImpl ( )
protectedvirtual

Definition at line 236 of file Module.cpp.

◆ updateStarted()

void dyno::Module::updateStarted ( )
protectedvirtual

Two functions called at the beginning and end of update() used for debug.

Definition at line 149 of file Module.cpp.

◆ validateInputs()

bool dyno::Module::validateInputs ( )
protectedvirtual

Definition at line 99 of file Module.cpp.

◆ validateOutputs()

bool dyno::Module::validateOutputs ( )
protectedvirtual

Definition at line 159 of file Module.cpp.

Member Data Documentation

◆ m_initialized

bool dyno::Module::m_initialized
private

Definition at line 121 of file Module.h.

◆ m_module_name

std::string dyno::Module::m_module_name
private

Definition at line 120 of file Module.h.

◆ m_node

Node* dyno::Module::m_node
private

Definition at line 119 of file Module.h.


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