Back to home page

EIC code displayed by LXR

 
 

    


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

0001 #ifndef SCENARIO_H
0002 #define SCENARIO_H
0003 
0004 /**
0005  * @file Scenario.h
0006  * @author Bryan BERTHOU (SPhN / CEA Saclay)
0007  * @date January 30, 2015
0008  * @version 1.0
0009  */
0010 
0011 #include <stddef.h>
0012 #include <ctime>
0013 #include <string>
0014 #include <vector>
0015 
0016 #include "../system/FileObject.h"
0017 #include "Task.h"
0018 
0019 namespace PARTONS {
0020 
0021 /**
0022  * @class Scenario
0023  *
0024  * @brief Class representing single scenario.
0025   *
0026  * This class represents a single scenario, i.e. a set of tasks to be evaluated by services.
0027  * 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.
0028  * Therefore, this class may be seen as a representation of a single scenario encoded in a xml file, like:
0029  \code{.py}
0030  <scenario date="2016-03-25" description="Descriptions allow you to distinguish between many scenarios.">
0031 
0032      <task service="GPDService" method="computeGPDModel" storeInDB="0">
0033 
0034          <kinematics type="GPDKinematic">
0035              <param name="x" value="0.1" />
0036              <param name="xi" value="0.05" />
0037              <param name="t" value="-0.3" />
0038              <param name="MuF2" value="8." />
0039              <param name="MuR2" value="8." />
0040          </kinematics>
0041 
0042          <computation_configuration>
0043              <module type="GPDModule">
0044                  <param name="className" value="GK11Model" />
0045              </module>
0046          </computation_configuration>
0047      </task>
0048  </scenario>
0049  \endcode
0050  */
0051 class Scenario: public FileObject {
0052 
0053 public:
0054 
0055     /**
0056      * Default constructor.
0057      */
0058     Scenario();
0059 
0060     /**
0061      * Copy constructor.
0062      * @param other Object to be copied.
0063      */
0064     Scenario(const Scenario &other);
0065 
0066     /**
0067      * Assignment constructor.
0068      * @param description Description of this scenario.
0069      * @param filePath Path to file.
0070      * @param hashSum Hash sum of file content.
0071      * @param file String containing file content.
0072      */
0073     Scenario(const std::string &description,
0074             const std::string& filePath,
0075             const std::string &hashSum, const std::string &file);
0076 
0077     /**
0078      * Destructor.
0079      */
0080     virtual ~Scenario();
0081 
0082     /**
0083      * Get reference to task of a given id.
0084      * @param i Id of task to be retrieved.
0085      * @return Requested task.
0086      */
0087     const Task& getTask(unsigned int i) const;
0088 
0089     /**
0090      * Get reference to task of a given id.
0091      * @param i Id of task to be retrieved.
0092      * @return Requested task.
0093      */
0094     Task& getTask(unsigned int i);
0095 
0096     /**
0097      * Add a given task to this scenario.
0098      * @param task Task to be added.
0099      */
0100     void add(const Task &task);
0101 
0102     /**
0103      *  Return number of tasks in this scenario.
0104      */
0105     size_t size() const;
0106 
0107     virtual std::string toString() const;
0108 
0109     //********************************************************
0110     //*** SETTERS AND GETTERS ********************************
0111     //********************************************************
0112 
0113     /**
0114      * Get description of this scenario.
0115      */
0116     const std::string& getDescription() const;
0117 
0118     /**
0119      * Set description of this scenario.
0120      */
0121     void setDescription(const std::string& description);
0122 
0123     /**
0124      * Get vector containing tasks associated to this scenario.
0125      */
0126     const std::vector<Task>& getTasks() const;
0127 
0128     /**
0129      * Set vector containing tasks associated to this scenario.
0130      */
0131     void setTasks(const std::vector<Task>& tasks);
0132 
0133 private:
0134 
0135     /**
0136      * Description of this scenario.
0137      */
0138     std::string m_description;
0139 
0140     /**
0141      * Vector containing tasks associated to this scenario.
0142      */
0143     std::vector<Task> m_tasks;
0144 };
0145 
0146 } /* namespace PARTONS */
0147 
0148 #endif /* SCENARIO_H */