JAPAn
Just Another Parity Analyzer
Loading...
Searching...
No Matches
MQwPublishable_child< U, T > Class Template Referenceabstract

Mix-in for objects that can publish/request variables via a parent container. More...

#include <MQwPublishable.h>

+ Inheritance diagram for MQwPublishable_child< U, T >:

Public Member Functions

 MQwPublishable_child ()
 Default constructor Initializes the child object and sets up self-reference for publishing.
 
 MQwPublishable_child (const MQwPublishable_child &source)
 Copy constructor.
 
virtual ~MQwPublishable_child ()
 Virtual destructor.
 
void SetParent (U *parent)
 Set the parent container for this child object.
 
U * GetParent () const
 Get the parent container for this child object.
 
virtual Bool_t PublishInternalValues () const =0
 The functions below should be specified in the fully derived classes.
 
virtual Bool_t PublishByRequest (TString device_name)=0
 Try to publish an internal variable matching the submitted name Called when another subsystem requests a variable that hasn't been published yet. Allows for lazy/on-demand publishing of variables.
 

Protected Member Functions

Bool_t RequestExternalValue (const TString &name, VQwHardwareChannel *value) const
 Retrieve the variable name from other subsystem arrays Get the value corresponding to some variable name from a different data array.
 
const VQwHardwareChannelRequestExternalPointer (const TString &name) const
 Retrieve a pointer to an external variable by name Requests a direct pointer to a variable from sibling subsystems via the parent container.
 
Bool_t PublishInternalValue (const TString name, const TString desc, const VQwHardwareChannel *element) const
 Publish a variable from this child into the parent container.
 

Private Attributes

U * fParent
 
T * fSelf
 

Detailed Description

template<class U, class T>
class MQwPublishable_child< U, T >

Mix-in for objects that can publish/request variables via a parent container.

Enables subsystems or data handlers to request external variables from sibling objects via a parent container, and to publish their own internal variables for external access. Part of the variable publishing framework.

Definition at line 22 of file MQwPublishable.h.

Constructor & Destructor Documentation

◆ MQwPublishable_child() [1/2]

template<class U, class T>
MQwPublishable_child< U, T >::MQwPublishable_child ( )
inline

Default constructor Initializes the child object and sets up self-reference for publishing.

Definition at line 30 of file MQwPublishable.h.

30{fSelf = dynamic_cast<T*>(this); };
Mix-in for objects that can publish/request variables via a parent container.

References fSelf.

Referenced by MQwPublishable_child().

+ Here is the caller graph for this function:

◆ MQwPublishable_child() [2/2]

template<class U, class T>
MQwPublishable_child< U, T >::MQwPublishable_child ( const MQwPublishable_child< U, T > & source)
inline

Copy constructor.

Parameters
sourceSource object to copy from

Definition at line 36 of file MQwPublishable.h.

36{fSelf = dynamic_cast<T*>(this);};

References fSelf, and MQwPublishable_child().

+ Here is the call graph for this function:

◆ ~MQwPublishable_child()

template<class U, class T>
virtual MQwPublishable_child< U, T >::~MQwPublishable_child ( )
inlinevirtual

Virtual destructor.

Definition at line 39 of file MQwPublishable.h.

39{ };

Member Function Documentation

◆ GetParent()

template<class U, class T>
U * MQwPublishable_child< U, T >::GetParent ( ) const
inline

Get the parent container for this child object.

Returns
Pointer to the parent container, or nullptr if no parent is set

Definition at line 51 of file MQwPublishable.h.

51{return fParent;};

References fParent.

◆ PublishByRequest()

template<class U, class T>
virtual Bool_t MQwPublishable_child< U, T >::PublishByRequest ( TString device_name)
pure virtual

Try to publish an internal variable matching the submitted name Called when another subsystem requests a variable that hasn't been published yet. Allows for lazy/on-demand publishing of variables.

Parameters
device_nameName of the variable being requested
Returns
kTRUE if the variable was found and published, kFALSE otherwise

Implemented in QwBeamLine, VQwDataHandler, VQwDetectorArray, and VQwSubsystem.

◆ PublishInternalValue()

template<class U, class T>
Bool_t MQwPublishable_child< U, T >::PublishInternalValue ( const TString name,
const TString desc,
const VQwHardwareChannel * element ) const
protected

Publish a variable from this child into the parent container.

Parameters
nameVariable key to publish under.
descHuman-readable description of the variable.
elementPointer to the data element representing this variable.
Returns
kTRUE if the variable was published; kFALSE on duplicate key or no parent.

Definition at line 172 of file MQwPublishable.cc.

175 {
176 // Get the parent and check for existence
177 if (fParent != 0) {
178 // Publish the variable with name in the parent
179 if (fParent->PublishInternalValue(name, desc, fSelf, element) == kFALSE) {
180 QwError << "Could not publish variable " << name
181 << " in from object " << fSelf->GetName() << "!" << QwLog::endl;
182 return kFALSE; // Error: variable could not be puslished
183 }
184 } else {
185 QwError << "Unable to publish; I am an orphan :-(" << QwLog::endl;
186 return kFALSE; // Error: no parent defined
187 }
188 return kTRUE; // Success
189}

References fParent.

◆ PublishInternalValues()

template<class U, class T>
virtual Bool_t MQwPublishable_child< U, T >::PublishInternalValues ( ) const
pure virtual

The functions below should be specified in the fully derived classes.

Publish all variables of the subsystem Called to register all internal variables that this subsystem wants to make available to other subsystems via the publishing framework.

Returns
kTRUE if all variables were successfully published, kFALSE otherwise

Implemented in QwBeamLine, VQwDataHandler, VQwDetectorArray, and VQwSubsystem.

◆ RequestExternalPointer()

template<class U, class T>
const VQwHardwareChannel * MQwPublishable_child< U, T >::RequestExternalPointer ( const TString & name) const
protected

Retrieve a pointer to an external variable by name Requests a direct pointer to a variable from sibling subsystems via the parent container.

Retrieve the variable name from other subsystem arrays.

Parameters
nameName of the desired variable
Returns
Pointer to the variable's data element, or nullptr if not found

Definition at line 163 of file MQwPublishable.cc.

163 {
164 if (fParent != 0) {
165 return fParent->RequestExternalPointer(name);
166 }
167 return NULL;
168}

References fParent.

◆ RequestExternalValue()

template<class U, class T>
Bool_t MQwPublishable_child< U, T >::RequestExternalValue ( const TString & name,
VQwHardwareChannel * value ) const
protected

Retrieve the variable name from other subsystem arrays Get the value corresponding to some variable name from a different data array.

Parameters
nameName of the desired variable
valuePointer to the value to be filled by the call
Returns
True if the variable was found, false if not found

Definition at line 155 of file MQwPublishable.cc.

155 {
156 if (fParent != 0) {
157 return fParent->RequestExternalValue(name,value);
158 }
159 return kFALSE;
160}

References fParent.

◆ SetParent()

template<class U, class T>
void MQwPublishable_child< U, T >::SetParent ( U * parent)
inline

Set the parent container for this child object.

Parameters
parentPointer to the parent container that manages variable publishing

Definition at line 45 of file MQwPublishable.h.

45{fParent = parent;};

References fParent.

Referenced by QwDataHandlerArray::LoadDataHandlersFromParameterFile().

+ Here is the caller graph for this function:

Field Documentation

◆ fParent

template<class U, class T>
U* MQwPublishable_child< U, T >::fParent
private

◆ fSelf

template<class U, class T>
T* MQwPublishable_child< U, T >::fSelf
private

Definition at line 102 of file MQwPublishable.h.

Referenced by MQwPublishable_child(), and MQwPublishable_child().


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