|
|
|||
File indexing completed on 2026-06-02 08:51:49
0001 #ifndef MODULE_OBJECT_H 0002 #define MODULE_OBJECT_H 0003 0004 /** 0005 * @file ModuleObject.h 0006 * @author Bryan BERTHOU (SPhN / CEA Saclay) 0007 * @date Aout 06, 2014 0008 * @version 1.0 0009 */ 0010 0011 #include <ElementaryUtils/parameters/Parameters.h> 0012 #include <ElementaryUtils/thread/Thread.h> 0013 #include <map> 0014 #include <string> 0015 0016 #include "beans/automation/BaseObjectData.h" 0017 #include "beans/channel/ChannelType.h" 0018 0019 namespace ElemUtils { 0020 class Parameters; 0021 } /* namespace ElemUtils */ 0022 0023 namespace PARTONS { 0024 0025 class ModuleObjectFactory; 0026 0027 /** 0028 * @class ModuleObject 0029 * 0030 * @brief Super class of all module types - A module is a class that performs a specific compute task. 0031 * A ModuleObject can be threaded. See services for more details. 0032 * 0033 * ex : GK11Model is a module that computes only GPDq(x, xi, t, MuF, MuR) defined by Kroll-Goloskokov in 2011. \n 0034 * ex : DVCSCFFModel is a module that evaluates the convolution of the GPD H with the hard scattering kernel at twist 2 necessary to the evaluation of DVCS scattering amplitudes. 0035 */ 0036 class ModuleObject: public BaseObject, public ElemUtils::Thread { 0037 0038 public: 0039 0040 /** 0041 * Constructor. 0042 * See BaseObject class for more info about input parameter. 0043 * 0044 * Needn't be used directly. Use the ModuleObjectFactory to clone a module instead! 0045 * 0046 * @param className Class's name of child class. 0047 * @param channelType Channel type. 0048 */ 0049 ModuleObject(const std::string &className, ChannelType::Type channelType); 0050 0051 /** 0052 * Default destructor. 0053 */ 0054 virtual ~ModuleObject(); 0055 0056 virtual ModuleObject* clone() const = 0; 0057 virtual std::string toString() const; 0058 virtual void resolveObjectDependencies(); 0059 virtual void run(); 0060 0061 /** 0062 * Test of modules. 0063 * 0064 * @return List of results. 0065 */ 0066 virtual std::vector<double> test(); 0067 0068 /** 0069 * Provides a generic method to configure all types of modules by passing a Parameters object. 0070 * Parameters class represents a list of couples key/value (see Parameters class documentation for more info). 0071 * 0072 * @param parameters ElemUtils::Parameters object. 0073 */ 0074 virtual void configure(const ElemUtils::Parameters ¶meters); 0075 0076 /** 0077 * Method used in automation to prepare all the modules used by this current module and configure them recursively. 0078 * The recursion is linked to the imbrication in XML files. \n 0079 * Can be implemented in the child class if it needs modules not needed by the parent class. But there must be first a call to the parent method. 0080 * @param subModulesData Data used to retrieve the needed modules and their configuration. 0081 */ 0082 virtual void prepareSubModules( 0083 const std::map<std::string, BaseObjectData>& subModulesData); 0084 0085 /** 0086 * Get reference module id. 0087 */ 0088 unsigned int getReferenceModuleId() const; 0089 0090 /** 0091 * Set reference module id. 0092 */ 0093 void setReferenceModuleId(unsigned int referenceModuleId); 0094 0095 /** 0096 * Get channel type. 0097 */ 0098 ChannelType::Type getChannelType() const; 0099 0100 protected: 0101 0102 /*** 0103 * Copy constructor. 0104 * Used by the factory to clone modules, shouldn't be used directly. 0105 * 0106 * @param other Object to be copied. 0107 */ 0108 ModuleObject(const ModuleObject &other); 0109 0110 /** 0111 * Pointer tp module object factory. 0112 */ 0113 ModuleObjectFactory* m_pModuleObjectFactory; 0114 0115 /** 0116 * Pure virtual function that provides skeleton for module initialization. 0117 * Children must define and override it. 0118 */ 0119 virtual void initModule() = 0; 0120 0121 /** 0122 * Pure virtual function that provides skeleton to check if the module is well initialized and configured. 0123 * Children must define and override it. 0124 */ 0125 virtual void isModuleWellConfigured() = 0; 0126 0127 private: 0128 0129 /** 0130 * Reference module id. 0131 */ 0132 unsigned int m_referenceModuleId; 0133 0134 /** 0135 * Channel type. 0136 */ 0137 ChannelType::Type m_channelType; 0138 }; 0139 0140 } /* namespace PARTONS */ 0141 0142 #endif /* MODULE_OBJECT_H */
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|