Back to home page

EIC code displayed by LXR

 
 

    


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

0001 #ifndef TASK_H
0002 #define TASK_H
0003 
0004 /**
0005  * @file Task.h
0006  * @author Bryan BERTHOU (SPhN / CEA Saclay)
0007  * @date July 03, 2015
0008  * @version 1.0
0009  */
0010 
0011 #include <string>
0012 
0013 #include "BaseObjectData.h"
0014 
0015 namespace PARTONS {
0016 
0017 class Scenario;
0018 
0019 /**
0020  * @class Task
0021  *
0022  * @brief Class representing single task.
0023  *
0024  * This class represents a single task to be evaluated by one of services.
0025  * An object of this class is intended to be created by a xml parser during running PARTONS with a specific xml file, which can be local or can be retrieved from a database.
0026  * Therefore, this class may be seen as a representation of a single task encoded in a xml file, like:
0027  \code{.py}
0028  <task service="GPDService" method="computeGPDModel" storeInDB="0">
0029 
0030      <kinematics type="GPDKinematic">
0031          <param name="x" value="0.1" />
0032          <param name="xi" value="0.05" />
0033          <param name="t" value="-0.3" />
0034          <param name="MuF2" value="8." />
0035          <param name="MuR2" value="8." />
0036      </kinematics>
0037 
0038      <computation_configuration>
0039          <module type="GPDModule">
0040              <param name="className" value="GK11Model" />
0041          </module>
0042      </computation_configuration>
0043  </task>
0044  \endcode
0045  */
0046 class Task: public BaseObject {
0047 
0048 public:
0049 
0050     /**
0051      * Default constructor.
0052      */
0053     Task();
0054 
0055     /**
0056      * Destructor.
0057      */
0058     virtual ~Task();
0059 
0060     virtual std::string toString() const;
0061 
0062     //********************************************************
0063     //*** SETTERS AND GETTERS ********************************
0064     //********************************************************
0065 
0066     /**
0067      * Get pointer to the scenario that holds this task.
0068      */
0069     Scenario* getScenario() const;
0070 
0071     /**
0072      * Set pointer to the scenario that holds this task.
0073      */
0074     void setScenario(Scenario* pScenario);
0075 
0076     /**
0077      * Get name of service responsible for running this scenario.
0078      */
0079     const std::string& getServiceName() const;
0080 
0081     /**
0082      * Set name of service responsible for running this scenario.
0083      */
0084     void setServiceName(const std::string& serviceName);
0085 
0086     /**
0087      * Get name of function to be evaluated by this task.
0088      */
0089     const std::string& getFunctionName() const;
0090 
0091     /**
0092      * Set name of function to be evaluated by this task.
0093      */
0094     void setFunctionName(const std::string& functionName);
0095 
0096     /**
0097      * Check if the result of this task is going to be store in the database.
0098      */
0099     bool isStoreInDB() const;
0100 
0101     /**
0102      * Set if the result of this task is going to be store in the database.
0103      */
0104     void setStoreInDB(bool storeInDb);
0105 
0106     /**
0107      * Get index of this task in a given scenario holding it.
0108      */
0109     unsigned int getScenarioTaskIndexNumber() const;
0110 
0111     /**
0112      * Set index of this task in a given scenario holding it.
0113      */
0114     void setScenarioTaskIndexNumber(unsigned int scenarioTaskIndexNumber);
0115 
0116     /**
0117      * Get base object data stored in xml block given by XMLParserI::COMPUTATION_CONFIGURATION_NODE_NAME tag.
0118      */
0119     const BaseObjectData& getModuleComputationConfiguration() const;
0120 
0121     /**
0122      * Set base object data stored in xml block given by XMLParserI::COMPUTATION_CONFIGURATION_NODE_NAME tag.
0123      */
0124     void setModuleComputationConfiguration(
0125             const BaseObjectData& moduleComputationConfiguration);
0126 
0127     /**
0128      * Get base object data stored in xml block given by XMLParserI::KINEMATICS_NODE_NAME tag.
0129      */
0130     const BaseObjectData& getKinematicsData() const;
0131 
0132     /**
0133      * Set base object data stored in xml block given by XMLParserI::KINEMATICS_NODE_NAME tag.
0134      */
0135     void setKinematicsData(const BaseObjectData& kinematicsData);
0136 
0137     /**
0138      * Get base object data stored in xml block given by XMLParserI::TASK_NODE_NAME tag.
0139      */
0140     const BaseObjectData& getTaskParameters() const;
0141 
0142     /**
0143      * Set base object data stored in xml block given by XMLParserI::TASK_NODE_NAME tag.
0144      */
0145     void setTaskParameters(const BaseObjectData& taskParameters);
0146 
0147 private:
0148 
0149     /**
0150      * Pointer to the scenario that holds this task.
0151      */
0152     Scenario* m_pScenario;
0153 
0154     /**
0155      * Name of service responsible for running this scenario.
0156      */
0157     std::string m_serviceName;
0158 
0159     /**
0160      * Name of function to be evaluated by this task.
0161      */
0162     std::string m_functionName;
0163 
0164     /**
0165      * Switch indicating if the result of this task is going to be store in the database.
0166      */
0167     bool m_storeInDB;
0168 
0169     /**
0170      * Index of this task in a given scenario holding it.
0171      */
0172     unsigned int m_scenarioTaskIndexNumber;
0173 
0174     /**
0175      * Base object data stored in xml block given by XMLParserI::COMPUTATION_CONFIGURATION_NODE_NAME tag.
0176      */
0177     BaseObjectData m_moduleComputationConfiguration;
0178 
0179     /**
0180      * Base object data stored in xml block given by XMLParserI::KINEMATICS_NODE_NAME tag.
0181      */
0182     BaseObjectData m_kinematicsData;
0183 
0184     /**
0185      * Base object data stored in xml block given by XMLParserI::TASK_NODE_NAME tag.
0186      */
0187     BaseObjectData m_taskParameters;
0188 };
0189 
0190 } /* namespace PARTONS */
0191 
0192 #endif /* TASK_H */