Chain is the class used to manage the chain execution of multiple executable blocks (manipulation object).
More...
#include <Chain.hpp>
Chain is the class used to manage the chain execution of multiple executable blocks (manipulation object).
Chain is a wrapper, executable container capable to manage the workflow execution of multiple manipulation objects, connected each other through port PINs. Each object added to the chain is inserted in the chain. According to the mutual connections with other object, the class will automatically assign to it a priority of execution. An ID is assigned to a new chain and to every object in the chain, in order to give to the user a persistent information to recover or the position or the ID of the object in the chain. The execution is performed following the correct order of the object chain in order to avoid conflicts in parent/child dependencies. Closed connections loops in the chain are not allowed.
- Examples
- genericinput_example_00001.cpp, genericinput_example_00002.cpp, genericinput_example_00003.cpp, genericinput_example_00004.cpp, genericinput_example_00005.cpp, geohandlers_example_00000.cpp, geohandlers_example_00001.cpp, geohandlers_example_00002.cpp, geohandlers_example_00003.cpp, geohandlers_example_00004.cpp, iocgns_example_00001.cpp, iocgns_example_00002.cpp, ioofoam_example_00001.cpp, ioofoam_example_00002.cpp, manipulators_example_00001.cpp, manipulators_example_00002.cpp, manipulators_example_00003.cpp, manipulators_example_00004.cpp, manipulators_example_00005.cpp, manipulators_example_00006.cpp, manipulators_example_00007.cpp, manipulators_example_00008.cpp, utils_example_00003.cpp, and utils_example_00004.cpp.
Definition at line 48 of file Chain.hpp.
◆ Chain()
Default constructor of Chain. It sets to zero/null each member/pointer.
Definition at line 34 of file Chain.cpp.
◆ ~Chain()
◆ addObject()
It adds a manipulator object in the chain. The position of the objects after the insertion can be modified in order to respect the parent/child dependencies during the execution of the chain.
- Parameters
-
[in] | obj | Pointer to object to be inserted. |
[in] | id_ | Id of the object to be inserted (optional, if not passed or negative it is computed). |
- Returns
- Index of insertion of the object in the chain. Return -1 if the object cannot be inserted (wrong parent/child dependencies).
- Examples
- genericinput_example_00001.cpp, genericinput_example_00002.cpp, genericinput_example_00003.cpp, genericinput_example_00004.cpp, genericinput_example_00005.cpp, geohandlers_example_00000.cpp, geohandlers_example_00001.cpp, geohandlers_example_00002.cpp, geohandlers_example_00003.cpp, geohandlers_example_00004.cpp, iocgns_example_00001.cpp, iocgns_example_00002.cpp, ioofoam_example_00001.cpp, ioofoam_example_00002.cpp, manipulators_example_00001.cpp, manipulators_example_00002.cpp, manipulators_example_00003.cpp, manipulators_example_00004.cpp, manipulators_example_00005.cpp, manipulators_example_00006.cpp, manipulators_example_00007.cpp, manipulators_example_00008.cpp, utils_example_00003.cpp, and utils_example_00004.cpp.
Definition at line 170 of file Chain.cpp.
◆ checkLoops()
void mimmo::Chain::checkLoops |
( |
| ) |
|
|
protected |
It checks if a loop exists in the chain. In the case that a loop exists the process ends with an error.
Definition at line 337 of file Chain.cpp.
◆ clear()
void mimmo::Chain::clear |
( |
| ) |
|
It clears the object.
Definition at line 90 of file Chain.cpp.
◆ clone()
std::unique_ptr< Chain > mimmo::Chain::clone |
( |
| ) |
const |
Clone(Hard Copy) the current chain in a new indipendent one.
- Returns
- unique pointer to the new cloned object
Definition at line 71 of file Chain.cpp.
◆ deleteObject()
bool mimmo::Chain::deleteObject |
( |
int |
idobj | ) |
|
It deletes a manipulator object in the chain.
- Returns
- True if some linking in the chain after the deletion are interrupted.
Definition at line 148 of file Chain.cpp.
◆ exec() [1/2]
void mimmo::Chain::exec |
( |
bool |
debug = false | ) |
|
It executes the chain, i.e. it executes all the manipulator objects contained in the chain following the correct order. In the case that a loop exists in the chain the execution doesn't start and the process ends with an error.
- Parameters
-
[in] | debug | boolean to activate verbose execution mode. |
- Examples
- genericinput_example_00001.cpp, genericinput_example_00002.cpp, genericinput_example_00003.cpp, genericinput_example_00004.cpp, genericinput_example_00005.cpp, geohandlers_example_00000.cpp, geohandlers_example_00001.cpp, geohandlers_example_00002.cpp, geohandlers_example_00003.cpp, geohandlers_example_00004.cpp, iocgns_example_00001.cpp, iocgns_example_00002.cpp, ioofoam_example_00001.cpp, ioofoam_example_00002.cpp, manipulators_example_00001.cpp, manipulators_example_00002.cpp, manipulators_example_00003.cpp, manipulators_example_00004.cpp, manipulators_example_00005.cpp, manipulators_example_00006.cpp, manipulators_example_00007.cpp, manipulators_example_00008.cpp, utils_example_00003.cpp, and utils_example_00004.cpp.
Definition at line 284 of file Chain.cpp.
◆ exec() [2/2]
void mimmo::Chain::exec |
( |
int |
idobj | ) |
|
It executes one manipulator object contained in the chain singularly.
- Parameters
-
[in] | idobj | ID of the target manipulator object. |
Definition at line 327 of file Chain.cpp.
◆ getID() [1/2]
uint8_t mimmo::Chain::getID |
( |
| ) |
|
It gets the ID of the chain.
- Returns
- ID of the chain.
Definition at line 110 of file Chain.cpp.
◆ getID() [2/2]
int mimmo::Chain::getID |
( |
int |
i | ) |
|
It gets the ID of an object in the chain.
- Parameters
-
[in] | i | Index of the target object in the chain. |
- Returns
- ID of the i-th object.
Definition at line 129 of file Chain.cpp.
◆ getName()
std::string mimmo::Chain::getName |
( |
int |
i | ) |
|
It gets the name of an object in the chain.
- Parameters
-
[in] | i | Index of the target object in the chain. |
- Returns
- name of the i-th object.
Definition at line 139 of file Chain.cpp.
◆ getNChains()
uint8_t mimmo::Chain::getNChains |
( |
| ) |
|
It gets the number of chains actually defined in the process.
- Returns
- Number of chains in the process.
Definition at line 119 of file Chain.cpp.
◆ getNObjects()
uint32_t mimmo::Chain::getNObjects |
( |
| ) |
|
It gets the number of manipulator objects in the chain.
- Returns
- Number of objects in the chain.
Definition at line 101 of file Chain.cpp.
◆ getOutputDebugResults()
std::string mimmo::Chain::getOutputDebugResults |
( |
| ) |
|
- Returns
- specified path for storing intermediate/optional results of each block in the chain, if their plotting is enabled.
Definition at line 271 of file Chain.cpp.
◆ isPlottingDebugResults()
bool mimmo::Chain::isPlottingDebugResults |
( |
| ) |
|
- Returns
- true if plotting of intermediate/optional results of each block in the chain is active.
Definition at line 263 of file Chain.cpp.
◆ setOutputDebugResults()
void mimmo::Chain::setOutputDebugResults |
( |
std::string |
path | ) |
|
◆ setPlotDebugResults()
void mimmo::Chain::setPlotDebugResults |
( |
bool |
active | ) |
|
◆ swap()
void mimmo::Chain::swap |
( |
Chain & |
x | ) |
|
|
protectednoexcept |
Chain swap operator.
- Parameters
-
[in] | x | sibling clas to be swapped |
Definition at line 58 of file Chain.cpp.
◆ m_id
uint8_t mimmo::Chain::m_id |
|
protected |
ID of the chain.
Definition at line 52 of file Chain.hpp.
◆ m_idObjects
std::vector<int> mimmo::Chain::m_idObjects |
|
protected |
ID (order of insertion) of the mimmo objects in the chain.
Definition at line 54 of file Chain.hpp.
◆ m_log
bitpit::Logger* mimmo::Chain::m_log |
|
protected |
Pointer to logger.
Definition at line 57 of file Chain.hpp.
◆ m_objcounter
uint32_t mimmo::Chain::m_objcounter |
|
protected |
Counter of objects inserted the chain.
Definition at line 55 of file Chain.hpp.
◆ m_objects
Pointers to manipulation objects placed in the current execution chain.
Definition at line 53 of file Chain.hpp.
◆ m_outputDebRes
std::string mimmo::Chain::m_outputDebRes |
|
protected |
directory path to store the debug intermediate results, if plot is enabled
Definition at line 60 of file Chain.hpp.
◆ m_plotDebRes
bool mimmo::Chain::m_plotDebRes |
|
protected |
boolean to activate plotting of debug intermediate results
Definition at line 59 of file Chain.hpp.
◆ sm_chaincounter
uint8_t mimmo::Chain::sm_chaincounter |
|
staticprotected |
Current global number of chain in the instance.
Definition at line 62 of file Chain.hpp.
The documentation for this class was generated from the following files: