ChimeraTK-ApplicationCore  04.01.00
ChimeraTK::EntityOwner Class Referenceabstract

Base class for owners of other EntityOwners (e.g. More...

#include <EntityOwner.h>

+ Inheritance diagram for ChimeraTK::EntityOwner:
+ Collaboration diagram for ChimeraTK::EntityOwner:

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
 
EntityOwneroperator= (EntityOwner &&other) noexcept
 Move assignment operator. More...
 
EntityOwneroperator= (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< VariableNetworkNodegetAccessorList () 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< VariableNetworkNodegetAccessorListRecursive () 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...
 

Detailed Description

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.

Member Enumeration Documentation

◆ ModuleType

Enumerator
ApplicationModule 
ModuleGroup 
VariableGroup 
ControlSystem 
Device 
Invalid 

Definition at line 117 of file EntityOwner.h.

Constructor & Destructor Documentation

◆ EntityOwner() [1/4]

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.

◆ EntityOwner() [2/4]

ChimeraTK::EntityOwner::EntityOwner ( )

Default constructor just for late initialisation.

Definition at line 23 of file EntityOwner.cc.

◆ ~EntityOwner()

virtual ChimeraTK::EntityOwner::~EntityOwner ( )
virtualdefault

Virtual destructor to make the type polymorphic.

◆ EntityOwner() [3/4]

ChimeraTK::EntityOwner::EntityOwner ( EntityOwner &&  other)
inlinenoexcept

Move constructor.

Definition at line 51 of file EntityOwner.h.

+ Here is the call graph for this function:

◆ EntityOwner() [4/4]

ChimeraTK::EntityOwner::EntityOwner ( const EntityOwner other)
delete

Member Function Documentation

◆ addTag()

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.

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

◆ constant()

template<typename T >
std::string ChimeraTK::EntityOwner::constant ( 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.

+ Here is the call graph for this function:

◆ decrementDataFaultCounter()

virtual void ChimeraTK::EntityOwner::decrementDataFaultCounter ( )
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.

+ Here is the caller graph for this function:

◆ dump()

void ChimeraTK::EntityOwner::dump ( const std::string &  prefix = "",
std::ostream &  stream = std::cout 
) const

Print the full hierarchy to given stream.

Examples
demoStatusMonitor.cc.

Definition at line 108 of file EntityOwner.cc.

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

◆ getAccessorList()

std::list<VariableNetworkNode> ChimeraTK::EntityOwner::getAccessorList ( ) const
inline

Obtain the list of accessors/variables directly associated with this instance.

Definition at line 77 of file EntityOwner.h.

+ Here is the caller graph for this function:

◆ getAccessorListRecursive()

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.

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

◆ getCircularNetworkHash()

virtual size_t ChimeraTK::EntityOwner::getCircularNetworkHash ( ) const
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.

+ Here is the caller graph for this function:

◆ getCurrentVersionNumber()

virtual VersionNumber ChimeraTK::EntityOwner::getCurrentVersionNumber ( ) const
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.

+ Here is the caller graph for this function:

◆ getDataValidity()

virtual DataValidity ChimeraTK::EntityOwner::getDataValidity ( ) const
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.

+ Here is the caller graph for this function:

◆ getDescription()

const std::string& ChimeraTK::EntityOwner::getDescription ( ) const
inline

Get the description of the module instance.

Definition at line 69 of file EntityOwner.h.

+ Here is the caller graph for this function:

◆ getFullDescription()

virtual std::string ChimeraTK::EntityOwner::getFullDescription ( ) const
pure virtual

Obtain the full description including the full description of the owner.

Implemented in ChimeraTK::Application, ChimeraTK::Module, and ChimeraTK::InternalModule.

+ Here is the caller graph for this function:

◆ getInputModulesRecursively()

virtual std::list<EntityOwner*> ChimeraTK::EntityOwner::getInputModulesRecursively ( std::list< EntityOwner * >  startList)
pure virtual

Use pointer to the module as unique identifier.

Implemented in ChimeraTK::DeviceManager, ChimeraTK::Module, and ChimeraTK::ApplicationModule.

+ Here is the caller graph for this function:

◆ getModuleType()

virtual ModuleType ChimeraTK::EntityOwner::getModuleType ( ) const
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.

+ Here is the caller graph for this function:

◆ getName()

const std::string& ChimeraTK::EntityOwner::getName ( ) const
inline

Get the name of the module instance.

Definition at line 59 of file EntityOwner.h.

+ Here is the caller graph for this function:

◆ getQualifiedName()

virtual std::string ChimeraTK::EntityOwner::getQualifiedName ( ) const
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.

+ Here is the caller graph for this function:

◆ getQualifiedNameWithType()

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.

+ Here is the call graph for this function:

◆ getSubmoduleList()

std::list<Module*> ChimeraTK::EntityOwner::getSubmoduleList ( ) const
inline

Obtain the list of submodules associated with this instance.

Definition at line 80 of file EntityOwner.h.

+ Here is the caller graph for this function:

◆ getSubmoduleListRecursive()

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.

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

◆ hasReachedTestableMode()

bool ChimeraTK::EntityOwner::hasReachedTestableMode ( )

Check whether this module has declared that it reached the testable mode.

Definition at line 141 of file EntityOwner.cc.

+ Here is the caller graph for this function:

◆ incrementDataFaultCounter()

virtual void ChimeraTK::EntityOwner::incrementDataFaultCounter ( )
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.

+ Here is the caller graph for this function:

◆ operator=() [1/2]

EntityOwner& ChimeraTK::EntityOwner::operator= ( const EntityOwner other)
delete

◆ operator=() [2/2]

EntityOwner & ChimeraTK::EntityOwner::operator= ( EntityOwner &&  other)
noexcept

Move assignment operator.

Definition at line 28 of file EntityOwner.cc.

+ Here is the caller graph for this function:

◆ registerAccessor()

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.

+ Here is the call graph for this function:

◆ registerModule()

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.

+ Here is the caller graph for this function:

◆ setCurrentVersionNumber()

virtual void ChimeraTK::EntityOwner::setCurrentVersionNumber ( VersionNumber  versionNumber)
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.

+ Here is the caller graph for this function:

◆ unregisterAccessor()

void ChimeraTK::EntityOwner::unregisterAccessor ( const VariableNetworkNode accessor)
inline

Called inside the destructor of Accessor: removes the accessor from the list.

Definition at line 96 of file EntityOwner.h.

◆ unregisterModule()

void ChimeraTK::EntityOwner::unregisterModule ( Module module)
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.

+ Here is the caller graph for this function:

Member Data Documentation

◆ _accessorList

std::list<VariableNetworkNode> ChimeraTK::EntityOwner::_accessorList
protected

List of accessors owned by this instance.

Definition at line 177 of file EntityOwner.h.

◆ _description

std::string ChimeraTK::EntityOwner::_description
protected

The description of this instance.

Definition at line 174 of file EntityOwner.h.

◆ _moduleList

std::list<Module*> ChimeraTK::EntityOwner::_moduleList
protected

List of modules owned by this instance.

Definition at line 180 of file EntityOwner.h.

◆ _name

std::string ChimeraTK::EntityOwner::_name
protected

The name of this instance.

Definition at line 171 of file EntityOwner.h.

◆ _tags

std::unordered_set<std::string> ChimeraTK::EntityOwner::_tags
protected

List of tags to be added to all accessors and modules inside this module.

Definition at line 184 of file EntityOwner.h.

◆ _testableModeReached

std::atomic<bool> ChimeraTK::EntityOwner::_testableModeReached {false}
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.

Todo:
This should be moved to a more proper place in the hierarchy (e.g. ModuleImpl) after InternalModule class has been properly unified with the normal Module class.

Definition at line 190 of file EntityOwner.h.

◆ namePrefixConstant

constexpr std::string_view ChimeraTK::EntityOwner::namePrefixConstant {"/@CONST@"}
staticconstexpr

Prefix for constants created by constant().

Definition at line 167 of file EntityOwner.h.


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