Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-02 08:51:48

0001 #ifndef PROCESS_MODULE_H
0002 #define PROCESS_MODULE_H
0003 
0004 /**
0005  * @file ProcessModule.h
0006  * @author Bryan BERTHOU (SPhN / CEA Saclay)
0007  * @date November 19, 2014
0008  * @version 1.0
0009  */
0010 
0011 #include <ElementaryUtils/logger/CustomException.h>
0012 #include <ElementaryUtils/parameters/Parameters.h>
0013 #include <map>
0014 #include <string>
0015 
0016 #include "../../beans/automation/BaseObjectData.h"
0017 #include "../../beans/channel/ChannelType.h"
0018 #include "../../beans/gpd/GPDType.h"
0019 #include "../../beans/List.h"
0020 #include "../../ModuleObject.h"
0021 
0022 namespace NumA {
0023 class Vector3D;
0024 } /* namespace NumA */
0025 
0026 namespace PARTONS {
0027 
0028 /**
0029  * @class ProcessModule
0030  *
0031  * @brief Abstract class that provides a skeleton to implement a Process module.
0032  */
0033 template<typename KinematicType, typename ResultType>
0034 class ProcessModule: public ModuleObject {
0035 
0036 public:
0037 
0038     /**
0039      * Destructor.
0040      */
0041     virtual ~ProcessModule() {
0042     }
0043 
0044     virtual ProcessModule* clone() const = 0;
0045 
0046     virtual std::string toString() const {
0047         return ModuleObject::toString();
0048     }
0049 
0050     virtual void resolveObjectDependencies() {
0051         ModuleObject::resolveObjectDependencies();
0052     }
0053 
0054     virtual void run() {
0055         throw ElemUtils::CustomException("Thread", __func__,
0056                 "This must be implemented in daughter class");
0057     }
0058 
0059     virtual void configure(const ElemUtils::Parameters &parameters) {
0060         ModuleObject::configure(parameters);
0061     }
0062 
0063     virtual void prepareSubModules(
0064             const std::map<std::string, BaseObjectData>& subModulesData) {
0065         ModuleObject::prepareSubModules(subModulesData);
0066     }
0067 
0068     /**
0069      * Must be implemented in child class.
0070      * @return List of GPD/CCF types the child class can compute.
0071      */
0072     virtual List<GPDType> getListOfAvailableGPDTypeForComputation() const = 0;
0073 
0074     // ##### GETTERS & SETTERS #####
0075 
0076     /**
0077      * Check if this process module depends on a CCF module.
0078      */
0079     bool isCCFModuleDependent() const {
0080         return m_isCCFModuleDependent;
0081     }
0082 
0083     /**
0084      * Set if this process module depends on a CCF module.
0085      */
0086     void setIsCCFModuleDependent(bool isCCFModuleDependent) {
0087         m_isCCFModuleDependent = isCCFModuleDependent;
0088     }
0089 
0090 protected:
0091 
0092     /**
0093      * Constructor.
0094      * See BaseObject::BaseObject and ModuleObject::ModuleObject for more details.
0095      *
0096      * @param className name of child class.
0097      * @param channelType Channel type.
0098      */
0099     ProcessModule(const std::string &className, ChannelType::Type channelType) :
0100             ModuleObject(className, channelType), m_isCCFModuleDependent(true) {
0101     }
0102 
0103     /**
0104      * Copy constructor
0105      * @param other Object to be copied.
0106      */
0107     ProcessModule(const ProcessModule &other) :
0108             ModuleObject(other), m_isCCFModuleDependent(
0109                     other.m_isCCFModuleDependent) {
0110 
0111     }
0112 
0113     /**
0114      * Set internal kinematics.
0115      * @param kinematic Kinematics to be set
0116      */
0117     virtual void setKinematics(const KinematicType& kinematic) = 0;
0118 
0119     virtual void initModule() {
0120     }
0121 
0122     virtual void isModuleWellConfigured() {
0123     }
0124 
0125     /**
0126      * Boolean (true if this Process module depends on a CCF module).
0127      */
0128     bool m_isCCFModuleDependent;
0129 };
0130 
0131 } /* namespace PARTONS */
0132 
0133 #endif /* PROCESS_MODULE_H */