ChimeraTK-ApplicationCore
04.01.00
|
Base class for owners of other EntityOwners (e.g. More...
#include <EntityOwner.h>
Public Types | |
enum | ModuleType { ModuleType::ApplicationModule, ModuleType::ModuleGroup, ModuleType::VariableGroup, ModuleType::ControlSystem, ModuleType::Device, ModuleType::Invalid } |
Public Member Functions | |
EntityOwner (std::string name, std::string description, std::unordered_set< std::string > tags={}) | |
Constructor: Create EntityOwner by the given name with the given description. More... | |
EntityOwner () | |
Default constructor just for late initialisation. More... | |
virtual | ~EntityOwner ()=default |
Virtual destructor to make the type polymorphic. More... | |
EntityOwner (EntityOwner &&other) noexcept | |
Move constructor. More... | |
EntityOwner (const EntityOwner &other)=delete | |
EntityOwner & | operator= (EntityOwner &&other) noexcept |
Move assignment operator. More... | |
EntityOwner & | operator= (const EntityOwner &other)=delete |
const std::string & | getName () const |
Get the name of the module instance. More... | |
virtual std::string | getQualifiedName () const =0 |
Get the fully qualified name of the module instance, i.e. More... | |
std::string | getQualifiedNameWithType () const |
Get the fully qualified name of the module instance, followed by the C++ data type (in pointy brackets) More... | |
const std::string & | getDescription () const |
Get the description of the module instance. More... | |
virtual std::string | getFullDescription () const =0 |
Obtain the full description including the full description of the owner. More... | |
std::list< VariableNetworkNode > | getAccessorList () const |
Obtain the list of accessors/variables directly associated with this instance. More... | |
std::list< Module * > | getSubmoduleList () const |
Obtain the list of submodules associated with this instance. More... | |
std::list< VariableNetworkNode > | getAccessorListRecursive () const |
Obtain the list of accessors/variables associated with this instance and any submodules. More... | |
std::list< Module * > | getSubmoduleListRecursive () const |
Obtain the list of submodules associated with this instance and any submodules. More... | |
void | registerAccessor (VariableNetworkNode accessor) |
Called inside the constructor of Accessor: adds the accessor to the list. More... | |
void | unregisterAccessor (const VariableNetworkNode &accessor) |
Called inside the destructor of Accessor: removes the accessor from the list. More... | |
void | registerModule (Module *module, bool addTags=true) |
Register another module as a sub-module. More... | |
virtual void | unregisterModule (Module *module) |
Unregister another module as a sub-module. More... | |
void | addTag (const std::string &tag) |
Add a tag to all Application-type nodes inside this group. More... | |
void | dump (const std::string &prefix="", std::ostream &stream=std::cout) const |
Print the full hierarchy to given stream. More... | |
virtual ModuleType | getModuleType () const =0 |
Return the module type of this module, or in case of a VirtualModule the module type this VirtualModule was derived from. More... | |
virtual VersionNumber | getCurrentVersionNumber () const =0 |
Return the current version number which has been received with the last push-type read operation. More... | |
virtual void | setCurrentVersionNumber (VersionNumber versionNumber)=0 |
Set the current version number. More... | |
virtual DataValidity | getDataValidity () const =0 |
Return the data validity flag. More... | |
virtual void | incrementDataFaultCounter ()=0 |
Set the data validity flag to fault and increment the fault counter. More... | |
virtual void | decrementDataFaultCounter ()=0 |
Decrement the fault counter and set the data validity flag to ok if the counter has reached 0. More... | |
virtual std::list< EntityOwner * > | getInputModulesRecursively (std::list< EntityOwner * > startList)=0 |
Use pointer to the module as unique identifier. More... | |
virtual size_t | getCircularNetworkHash () const =0 |
Get the ID of the circular dependency network (0 if none). More... | |
bool | hasReachedTestableMode () |
Check whether this module has declared that it reached the testable mode. More... | |
template<typename T > | |
std::string | constant (T value) |
Create a variable name which will be automatically connected with a constant value. More... | |
Static Public Attributes | |
static constexpr std::string_view | namePrefixConstant {"/@CONST@"} |
Prefix for constants created by constant(). More... | |
Protected Attributes | |
std::string | _name |
The name of this instance. More... | |
std::string | _description |
The description of this instance. More... | |
std::list< VariableNetworkNode > | _accessorList |
List of accessors owned by this instance. More... | |
std::list< Module * > | _moduleList |
List of modules owned by this instance. More... | |
std::unordered_set< std::string > | _tags |
List of tags to be added to all accessors and modules inside this module. More... | |
std::atomic< bool > | _testableModeReached {false} |
Flag used by the testable mode to identify whether a thread within the EntityOwner has reached the point where the testable mode lock is acquired. More... | |
Base class for owners of other EntityOwners (e.g.
Modules) and Accessors. FIXME: Unify with Module class (not straight forward!).
Definition at line 38 of file EntityOwner.h.
|
strong |
Enumerator | |
---|---|
ApplicationModule | |
ModuleGroup | |
VariableGroup | |
ControlSystem | |
Device | |
Invalid |
Definition at line 117 of file EntityOwner.h.
ChimeraTK::EntityOwner::EntityOwner | ( | std::string | name, |
std::string | description, | ||
std::unordered_set< std::string > | tags = {} |
||
) |
Constructor: Create EntityOwner by the given name with the given description.
The specified list of tags will be added to all elements directly or indirectly owned by this instance.
Definition at line 18 of file EntityOwner.cc.
ChimeraTK::EntityOwner::EntityOwner | ( | ) |
Default constructor just for late initialisation.
Definition at line 23 of file EntityOwner.cc.
|
virtualdefault |
Virtual destructor to make the type polymorphic.
|
inlinenoexcept |
Move constructor.
Definition at line 51 of file EntityOwner.h.
|
delete |
void ChimeraTK::EntityOwner::addTag | ( | const std::string & | tag | ) |
Add a tag to all Application-type nodes inside this group.
It will recurse into any subgroups. See VariableNetworkNode::addTag() for additional information about tags.
Definition at line 126 of file EntityOwner.cc.
std::string ChimeraTK::EntityOwner::constant | ( | T | value | ) |
Create a variable name which will be automatically connected with a constant value.
This can be used when a constant value.
Definition at line 196 of file EntityOwner.h.
|
pure virtual |
Decrement the fault counter and set the data validity flag to ok if the counter has reached 0.
This function will be called by all input accessors when receiving the an ok update if the previous update was faulty. The caller of this function must ensure that calles to this function are paired to a previous call to incrementDataFaultCounter().
Implemented in ChimeraTK::Application, ChimeraTK::Module, Tests::testDataValidityPropagation::TestModule1, ChimeraTK::ApplicationModule, ChimeraTK::DeviceManager, and ChimeraTK::InternalModule.
void ChimeraTK::EntityOwner::dump | ( | const std::string & | prefix = "" , |
std::ostream & | stream = std::cout |
||
) | const |
Print the full hierarchy to given stream.
Definition at line 108 of file EntityOwner.cc.
|
inline |
Obtain the list of accessors/variables directly associated with this instance.
Definition at line 77 of file EntityOwner.h.
std::list< VariableNetworkNode > ChimeraTK::EntityOwner::getAccessorListRecursive | ( | ) | const |
Obtain the list of accessors/variables associated with this instance and any submodules.
Definition at line 69 of file EntityOwner.cc.
|
pure virtual |
Get the ID of the circular dependency network (0 if none).
This information is only available after the Application has finalised all connections.
Implemented in ChimeraTK::Application, ChimeraTK::DeviceManager, ChimeraTK::Module, ChimeraTK::ApplicationModule, and ChimeraTK::InternalModule.
|
pure virtual |
Return the current version number which has been received with the last push-type read operation.
Implemented in ChimeraTK::Application, ChimeraTK::Module, ChimeraTK::ApplicationModule, and ChimeraTK::InternalModule.
|
pure virtual |
Return the data validity flag.
If any This function will be called by all output accessors in their write functions.
Implemented in ChimeraTK::Application, ChimeraTK::Module, ChimeraTK::StatusAggregator, ChimeraTK::ApplicationModule, ChimeraTK::DeviceManager, and ChimeraTK::InternalModule.
|
inline |
Get the description of the module instance.
Definition at line 69 of file EntityOwner.h.
|
pure virtual |
Obtain the full description including the full description of the owner.
Implemented in ChimeraTK::Application, ChimeraTK::Module, and ChimeraTK::InternalModule.
|
pure virtual |
Use pointer to the module as unique identifier.
Implemented in ChimeraTK::DeviceManager, ChimeraTK::Module, and ChimeraTK::ApplicationModule.
|
pure virtual |
Return the module type of this module, or in case of a VirtualModule the module type this VirtualModule was derived from.
Implemented in ChimeraTK::Application, ChimeraTK::ApplicationModule, ChimeraTK::VariableGroup, ChimeraTK::InternalModule, and ChimeraTK::ModuleGroup.
|
inline |
Get the name of the module instance.
Definition at line 59 of file EntityOwner.h.
|
pure virtual |
Get the fully qualified name of the module instance, i.e.
the name containing all module names further up in the hierarchy.
Implemented in ChimeraTK::Application, ChimeraTK::Module, and ChimeraTK::InternalModule.
std::string ChimeraTK::EntityOwner::getQualifiedNameWithType | ( | ) | const |
Get the fully qualified name of the module instance, followed by the C++ data type (in pointy brackets)
Definition at line 156 of file EntityOwner.cc.
|
inline |
Obtain the list of submodules associated with this instance.
Definition at line 80 of file EntityOwner.h.
std::list< Module * > ChimeraTK::EntityOwner::getSubmoduleListRecursive | ( | ) | const |
Obtain the list of submodules associated with this instance and any submodules.
Definition at line 83 of file EntityOwner.cc.
bool ChimeraTK::EntityOwner::hasReachedTestableMode | ( | ) |
Check whether this module has declared that it reached the testable mode.
Definition at line 141 of file EntityOwner.cc.
|
pure virtual |
Set the data validity flag to fault and increment the fault counter.
This function will be called by all input accessors when receiving the a faulty update if the previous update was ok. The caller of this function must ensure that calls to this function are paired to a subsequent call to decrementDataFaultCounter().
Implemented in ChimeraTK::Application, ChimeraTK::Module, Tests::testDataValidityPropagation::TestModule1, ChimeraTK::ApplicationModule, ChimeraTK::DeviceManager, and ChimeraTK::InternalModule.
|
delete |
|
noexcept |
Move assignment operator.
Definition at line 28 of file EntityOwner.cc.
void ChimeraTK::EntityOwner::registerAccessor | ( | VariableNetworkNode | accessor | ) |
Called inside the constructor of Accessor: adds the accessor to the list.
Definition at line 97 of file EntityOwner.cc.
void ChimeraTK::EntityOwner::registerModule | ( | Module * | module, |
bool | addTags = true |
||
) |
Register another module as a sub-module.
Will be called automatically by all modules in their constructors. If addTags is set to false, the tags of this EntityOwner will not be set to the module being registered. This is e.g. used in the move-constructor of Module to prevent from altering the tags in the move operation.
Definition at line 52 of file EntityOwner.cc.
|
pure virtual |
Set the current version number.
This function is called by the push-type input accessors in their read functions.
Implemented in ChimeraTK::Application, ChimeraTK::InternalModule, ChimeraTK::ApplicationModule, and ChimeraTK::Module.
|
inline |
Called inside the destructor of Accessor: removes the accessor from the list.
Definition at line 96 of file EntityOwner.h.
|
virtual |
Unregister another module as a sub-module.
Will be called automatically by all modules in their destructors.
Reimplemented in ChimeraTK::ApplicationModule, ChimeraTK::VariableGroup, and ChimeraTK::ModuleGroup.
Definition at line 63 of file EntityOwner.cc.
|
protected |
List of accessors owned by this instance.
Definition at line 177 of file EntityOwner.h.
|
protected |
The description of this instance.
Definition at line 174 of file EntityOwner.h.
|
protected |
List of modules owned by this instance.
Definition at line 180 of file EntityOwner.h.
|
protected |
The name of this instance.
Definition at line 171 of file EntityOwner.h.
|
protected |
List of tags to be added to all accessors and modules inside this module.
Definition at line 184 of file EntityOwner.h.
|
protected |
Flag used by the testable mode to identify whether a thread within the EntityOwner has reached the point where the testable mode lock is acquired.
Definition at line 190 of file EntityOwner.h.
|
staticconstexpr |
Prefix for constants created by constant().
Definition at line 167 of file EntityOwner.h.