PeriDyno 1.2.1
Loading...
Searching...
No Matches
dyno::Module Class Reference

#include <Module.h>

Inheritance diagram for dyno::Module:
Collaboration diagram for dyno::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 ()
 
SceneGraphgetSceneGraph ()
 
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 ()
 
bool connect (ModulePort *nPort)
 
bool disconnect (ModulePort *nPort)
 
virtual bool allowImported ()
 
virtual bool allowExported ()
 
std::vector< ModulePort * > & getImportModules ()
 
std::vector< ModulePort * > & getExportModules ()
 
 DEF_VAR (bool, ForceUpdate, false, "")
 
void setUpdateAlways (bool b)
 Set the update strategy for the module.
 
virtual bool initializeImpl ()
 
virtual void updateImpl ()
 
MultipleModulePort< Module > * importModules ()
 Used to ensure modules can be executed in the correct order.
 
- 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 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 ()
 
bool appendExportModule (ModulePort *nodePort)
 
bool removeExportModule (ModulePort *nodePort)
 

Private Member Functions

bool addModulePort (ModulePort *port)
 

Private Attributes

Nodem_node
 
std::string m_module_name
 
bool m_initialized
 
std::vector< ModulePort * > mImportModules
 
std::vector< ModulePort * > mExportModules
 
MultipleModulePort< ModulemAncestors
 

Friends

class ModulePort
 

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 36 of file Module.h.

Constructor & Destructor Documentation

◆ Module()

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

Definition at line 9 of file Module.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~Module()

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

Definition at line 17 of file Module.cpp.

Member Function Documentation

◆ addModulePort()

bool dyno::Module::addModulePort ( ModulePort * port)
private

Definition at line 195 of file Module.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ allowExported()

virtual bool dyno::Module::allowExported ( )
inlinevirtual

Reimplemented in dyno::Outputs, and dyno::States.

Definition at line 89 of file Module.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ allowImported()

virtual bool dyno::Module::allowImported ( )
inlinevirtual

Reimplemented in dyno::Outputs, and dyno::States.

Definition at line 88 of file Module.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ appendExportModule()

bool dyno::Module::appendExportModule ( ModulePort * nodePort)
protected

Definition at line 162 of file Module.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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 283 of file Module.cpp.

Here is the call graph for this function:

◆ connect()

bool dyno::Module::connect ( ModulePort * nPort)

Definition at line 139 of file Module.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DEF_VAR()

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

◆ disconnect()

bool dyno::Module::disconnect ( ModulePort * nPort)

Definition at line 149 of file Module.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getExportModules()

std::vector< ModulePort * > & dyno::Module::getExportModules ( )
inline

Definition at line 92 of file Module.h.

◆ getImportModules()

std::vector< ModulePort * > & dyno::Module::getImportModules ( )
inline

Definition at line 91 of file Module.h.

◆ getModuleType()

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

◆ getName()

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

Reimplemented from dyno::OBase.

Definition at line 241 of file Module.cpp.

Here is the caller graph for this function:

◆ 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 246 of file Module.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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 255 of file Module.cpp.

Here is the call graph for this function:

◆ importModules()

MultipleModulePort< Module > * dyno::Module::importModules ( )
inline

Used to ensure modules can be executed in the correct order.

Definition at line 146 of file Module.h.

◆ initialize()

bool dyno::Module::initialize ( )

Definition at line 23 of file Module.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initializeImpl()

◆ isInitialized()

bool dyno::Module::isInitialized ( )

Definition at line 269 of file Module.cpp.

Here is the caller graph for this function:

◆ 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 94 of file Module.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isOutputCompete()

bool dyno::Module::isOutputCompete ( )

Definition at line 117 of file Module.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ postprocess()

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

Reimplemented in dyno::GLVisualModule.

Definition at line 113 of file Module.h.

Here is the caller graph for this function:

◆ preprocess()

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

Reimplemented in dyno::GLVisualModule, dyno::GroupModule, dyno::LinearElasticitySolver< TDataType >, dyno::Pipeline, and Pipeline.

Definition at line 111 of file Module.h.

Here is the caller graph for this function:

◆ removeExportModule()

bool dyno::Module::removeExportModule ( ModulePort * nodePort)
protected

Definition at line 176 of file Module.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ requireUpdate()

bool dyno::Module::requireUpdate ( )
protectedvirtual

Reimplemented in dyno::KeyboardInputModule, dyno::MouseInputModule, dyno::Pipeline, and Pipeline.

Definition at line 207 of file Module.cpp.

Here is the caller graph for this function:

◆ setName()

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

Definition at line 230 of file Module.cpp.

Here is the caller graph for this function:

◆ setParentNode()

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

Set the parent node.

Reimplemented in dyno::GroupModule.

Definition at line 236 of file Module.cpp.

Here is the caller graph for this function:

◆ 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 264 of file Module.cpp.

◆ update()

void dyno::Module::update ( )

Definition at line 34 of file Module.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateEnded()

void dyno::Module::updateEnded ( )
protectedvirtual

Definition at line 158 of file Module.cpp.

Here is the caller graph for this function:

◆ updateImpl()

◆ updateStarted()

void dyno::Module::updateStarted ( )
protectedvirtual

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

Definition at line 154 of file Module.cpp.

Here is the caller graph for this function:

◆ validateInputs()

bool dyno::Module::validateInputs ( )
protectedvirtual

Reimplemented in dyno::ContactsToPointSet< TDataType >, dyno::ContactsUnion< TDataType >, and dyno::GLVisualModule.

Definition at line 89 of file Module.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ validateOutputs()

bool dyno::Module::validateOutputs ( )
protectedvirtual

Definition at line 202 of file Module.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ ModulePort

friend class ModulePort
friend

Definition at line 153 of file Module.h.

Member Data Documentation

◆ m_initialized

bool dyno::Module::m_initialized
private

Definition at line 136 of file Module.h.

◆ m_module_name

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

Definition at line 135 of file Module.h.

◆ m_node

Node* dyno::Module::m_node
private

Definition at line 134 of file Module.h.

◆ mAncestors

MultipleModulePort<Module> dyno::Module::mAncestors
private
Initial value:
= MultipleModulePort<Module>(
std::string("Ancestor") + std::string("(s)"),
"Ancestors",
this)

Definition at line 148 of file Module.h.

◆ mExportModules

std::vector<ModulePort*> dyno::Module::mExportModules
private

Definition at line 140 of file Module.h.

◆ mImportModules

std::vector<ModulePort*> dyno::Module::mImportModules
private

Definition at line 138 of file Module.h.


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