ChimeraTK-ApplicationCore  04.01.00
ChimeraTK::InternalModule Class Reference

Base class for internal modules which are created by the variable connection code (e.g. More...

#include <InternalModule.h>

+ Inheritance diagram for ChimeraTK::InternalModule:
+ Collaboration diagram for ChimeraTK::InternalModule:

Public Member Functions

 ~InternalModule () override=default
 
virtual void activate ()
 Activate synchronisation thread if needed. More...
 
virtual void deactivate ()
 Deactivate synchronisation thread if running. More...
 
std::string getQualifiedName () const override
 Below all pure virtual functions of EntityOwner are "implemented" just to make the program compile for now. More...
 
std::string getFullDescription () const override
 Obtain the full description including the full description of the owner. More...
 
ModuleType getModuleType () const override
 Return the module type of this module, or in case of a VirtualModule the module type this VirtualModule was derived from. More...
 
VersionNumber getCurrentVersionNumber () const override
 Return the current version number which has been received with the last push-type read operation. More...
 
void setCurrentVersionNumber (VersionNumber) override
 Set the current version number. More...
 
DataValidity getDataValidity () const override
 Return the data validity flag. More...
 
void incrementDataFaultCounter () override
 Set the data validity flag to fault and increment the fault counter. More...
 
void decrementDataFaultCounter () override
 Decrement the fault counter and set the data validity flag to ok if the counter has reached 0. More...
 
std::list< EntityOwner * > getInputModulesRecursively ([[maybe_unused]] std::list< EntityOwner * > startList) override
 
size_t getCircularNetworkHash () const override
 Get the ID of the circular dependency network (0 if none). More...
 
- Public Member Functions inherited from 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. 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...
 
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...
 
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 std::list< EntityOwner * > getInputModulesRecursively (std::list< EntityOwner * > startList)=0
 Use pointer to the module as unique identifier. 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...
 

Additional Inherited Members

- Public Types inherited from ChimeraTK::EntityOwner
enum  ModuleType {
  ModuleType::ApplicationModule, ModuleType::ModuleGroup, ModuleType::VariableGroup, ModuleType::ControlSystem,
  ModuleType::Device, ModuleType::Invalid
}
 
- Static Public Attributes inherited from ChimeraTK::EntityOwner
static constexpr std::string_view namePrefixConstant {"/@CONST@"}
 Prefix for constants created by constant(). More...
 
- Protected Attributes inherited from ChimeraTK::EntityOwner
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 internal modules which are created by the variable connection code (e.g.

Application::makeConnections()). These modules have to be handled differently since the instance is created dynamically and thus we cannot store the plain pointer in Application::overallModuleList.

Todo:
Currently this class is based on EntityOwner somewhat artificially. Instead the InternalModule class needs to be properly unified with the normal Module classes.

Definition at line 21 of file InternalModule.h.

Constructor & Destructor Documentation

◆ ~InternalModule()

ChimeraTK::InternalModule::~InternalModule ( )
overridedefault

Member Function Documentation

◆ activate()

virtual void ChimeraTK::InternalModule::activate ( )
inlinevirtual

Activate synchronisation thread if needed.

Todo:
: Unify with Module::run()

Reimplemented in ChimeraTK::TriggerFanOut, and ChimeraTK::ThreadedFanOut< UserType >.

Definition at line 27 of file InternalModule.h.

◆ deactivate()

virtual void ChimeraTK::InternalModule::deactivate ( )
inlinevirtual

Deactivate synchronisation thread if running.

Todo:
: Unify with Module::terminate()

Reimplemented in ChimeraTK::ThreadedFanOut< UserType >, and ChimeraTK::TriggerFanOut.

Definition at line 31 of file InternalModule.h.

◆ decrementDataFaultCounter()

void ChimeraTK::InternalModule::decrementDataFaultCounter ( )
inlineoverridevirtual

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().

Implements ChimeraTK::EntityOwner.

Definition at line 42 of file InternalModule.h.

+ Here is the caller graph for this function:

◆ getCircularNetworkHash()

size_t ChimeraTK::InternalModule::getCircularNetworkHash ( ) const
inlineoverridevirtual

Get the ID of the circular dependency network (0 if none).

This information is only available after the Application has finalised all connections.

Implements ChimeraTK::EntityOwner.

Definition at line 59 of file InternalModule.h.

◆ getCurrentVersionNumber()

VersionNumber ChimeraTK::InternalModule::getCurrentVersionNumber ( ) const
inlineoverridevirtual

Return the current version number which has been received with the last push-type read operation.

Implements ChimeraTK::EntityOwner.

Definition at line 38 of file InternalModule.h.

◆ getDataValidity()

DataValidity ChimeraTK::InternalModule::getDataValidity ( ) const
inlineoverridevirtual

Return the data validity flag.

If any This function will be called by all output accessors in their write functions.

Implements ChimeraTK::EntityOwner.

Definition at line 40 of file InternalModule.h.

+ Here is the caller graph for this function:

◆ getFullDescription()

std::string ChimeraTK::InternalModule::getFullDescription ( ) const
inlineoverridevirtual

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

Implements ChimeraTK::EntityOwner.

Definition at line 36 of file InternalModule.h.

◆ getInputModulesRecursively()

std::list< EntityOwner * > ChimeraTK::InternalModule::getInputModulesRecursively ( [[maybe_unused] ] std::list< EntityOwner * >  startList)
inlineoverride

Definition at line 50 of file InternalModule.h.

◆ getModuleType()

ModuleType ChimeraTK::InternalModule::getModuleType ( ) const
inlineoverridevirtual

Return the module type of this module, or in case of a VirtualModule the module type this VirtualModule was derived from.

Implements ChimeraTK::EntityOwner.

Definition at line 37 of file InternalModule.h.

◆ getQualifiedName()

std::string ChimeraTK::InternalModule::getQualifiedName ( ) const
inlineoverridevirtual

Below all pure virtual functions of EntityOwner are "implemented" just to make the program compile for now.

They are currently not used.

Implements ChimeraTK::EntityOwner.

Definition at line 35 of file InternalModule.h.

◆ incrementDataFaultCounter()

void ChimeraTK::InternalModule::incrementDataFaultCounter ( )
inlineoverridevirtual

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().

Implements ChimeraTK::EntityOwner.

Definition at line 41 of file InternalModule.h.

+ Here is the caller graph for this function:

◆ setCurrentVersionNumber()

void ChimeraTK::InternalModule::setCurrentVersionNumber ( VersionNumber  versionNumber)
inlineoverridevirtual

Set the current version number.

This function is called by the push-type input accessors in their read functions.

Implements ChimeraTK::EntityOwner.

Definition at line 39 of file InternalModule.h.

+ Here is the caller graph for this function:

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