PARTONS  
PARtonic Tomography Of Nucleon Software
Public Member Functions | Private Attributes | List of all members
PARTONS::ScenarioDaoService Class Reference

Scenario information Data Access Object (DAO) service. More...

Inheritance diagram for PARTONS::ScenarioDaoService:
PARTONS::BaseObject

Public Member Functions

 ScenarioDaoService ()
 Default constructor. More...
 
virtual ~ScenarioDaoService ()
 Destructor. More...
 
int insert (const Scenario &scenario) const
 Insert into database a new Scenario object with transactions mechanisms. More...
 
int getScenarioIdByHashSum (const std::string &hashSum) const
 Try to find unique id of database entry containing scenario information that matches with given hash sum value. More...
 
std::string getXMLFileByIndexId (const int indexId) const
 Retrieve xml file scenario representation by given unique id of computation. More...
 
int getScenarioIdByComputationId (const int computationId) const
 Retrieve unique id of row containing scenario information in the database by id of that containing computation information. More...
 
ScenariogetScenarioById (const int scenarioId)
 Try to find an entry in the database containing scenario information that matches with given unique id value. More...
 
std::string getHashSumById (const int scenarioId)
 Retrieve hash sum associated to scenario information stored in row in the database of unique id. More...
 
void updateScenarioFile (const int scenarioId, const std::string &file)
 Update row containing scenario information in the database. More...
 
- Public Member Functions inherited from PARTONS::BaseObject
 BaseObject (const std::string &className)
 Constructor. More...
 
virtual ~BaseObject ()
 Default destructor. More...
 
virtual BaseObjectclone () const
 Virtual clone function to allow the factory to clone all derived members object stored in the BaseObjectRegistry. More...
 
virtual void resolveObjectDependencies ()
 Because of the initialization step order of the program, objects are registered in a total random order and some objects depend on others. More...
 
virtual std::string toString () const
 Return a pre-formatted characters string for output visualization of class member's values. More...
 
void serialize (ElemUtils::Packet &packet) const
 Used to split a complex C++ object into a concatenation of simple types. More...
 
void unserialize (ElemUtils::Packet &packet)
 Used to rebuild a complex C++ object from a concatenation of simple type. More...
 
bool operator< (const BaseObject &other) const
 Overload of < operator to sort BaseObject object by its indexId value. More...
 
const std::string & getClassName () const
 
unsigned int getObjectId () const
 
int getIndexId () const
 
void setIndexId (int indexId)
 

Private Attributes

ScenarioDao m_scenarioDao
 ScenarioDao object to perform database queries. More...
 
ResourceManagerm_pResourceManager
 Pointer to ResourceManager. More...
 

Additional Inherited Members

- Protected Member Functions inherited from PARTONS::BaseObject
 BaseObject (const BaseObject &other)
 Copy constructor. More...
 
void info (const std::string &functionName, const std::string &message) const
 Print info message into logger. More...
 
void debug (const std::string &functionName, const std::string &message) const
 Print debug message into logger. More...
 
void warn (const std::string &functionName, const std::string &message) const
 Print warning message into logger. More...
 
void errorMissingParameter (const std::string &parameterName) const
 Use in automation process to throw exception when a parameter is missing from the XML scenario file. More...
 

Detailed Description

Scenario information Data Access Object (DAO) service.

It deals with Scenario C++ object and related tables from the database.

With this service you can insert, select or remove scenario information from the database. It ensures the integrity of the database by using transaction and rollback mechanisms - if something wrong happened, the database will stay always in a stable state. In addition, it improves querying speed by using transaction and commit mechanisms for a large amount of simultaneous queries.

Constructor & Destructor Documentation

◆ ScenarioDaoService()

PARTONS::ScenarioDaoService::ScenarioDaoService ( )

Default constructor.

◆ ~ScenarioDaoService()

PARTONS::ScenarioDaoService::~ScenarioDaoService ( )
virtual

Destructor.

Member Function Documentation

◆ getHashSumById()

std::string PARTONS::ScenarioDaoService::getHashSumById ( const int  scenarioId)

Retrieve hash sum associated to scenario information stored in row in the database of unique id.

Parameters
scenarioIdUnique id of row containing scenario information in the database.
Returns
Associated hash sum.

◆ getScenarioById()

Scenario * PARTONS::ScenarioDaoService::getScenarioById ( const int  scenarioId)

Try to find an entry in the database containing scenario information that matches with given unique id value.

Parameters
scenarioIdUnique id of database entry to be found.
Returns
Pointer to Scenario object filled with the retrieved data or null pointer if couldn't find it. If successful, Scenario object is automatically registered in ResourceManager.

◆ getScenarioIdByComputationId()

int PARTONS::ScenarioDaoService::getScenarioIdByComputationId ( const int  computationId) const

Retrieve unique id of row containing scenario information in the database by id of that containing computation information.

Parameters
computationIdUnique id of row containing scenario information in the database.
Returns
Unique id of selected row in the database.

◆ getScenarioIdByHashSum()

int PARTONS::ScenarioDaoService::getScenarioIdByHashSum ( const std::string &  hashSum) const

Try to find unique id of database entry containing scenario information that matches with given hash sum value.

Parameters
hashSumHash sum value of database entry to be retrieved.
Returns
Unique id of database entry that matches with hash sum value.

◆ getXMLFileByIndexId()

std::string PARTONS::ScenarioDaoService::getXMLFileByIndexId ( const int  indexId) const

Retrieve xml file scenario representation by given unique id of computation.

Parameters
indexIdUnique id of row containing scenario information to be selected.
Returns
String containing xml representation.

◆ insert()

int PARTONS::ScenarioDaoService::insert ( const Scenario scenario) const

Insert into database a new Scenario object with transactions mechanisms.

Parameters
scenarioReference to Scenario object to be inserted.
Returns
Unique id related to the new entry inserted into the database.

◆ updateScenarioFile()

void PARTONS::ScenarioDaoService::updateScenarioFile ( const int  scenarioId,
const std::string &  file 
)

Update row containing scenario information in the database.

Parameters
scenarioIdUnique id of scenario information to be selected.
fileXml file scenario representation.

Member Data Documentation

◆ m_pResourceManager

ResourceManager* PARTONS::ScenarioDaoService::m_pResourceManager
private

Pointer to ResourceManager.

◆ m_scenarioDao

ScenarioDao PARTONS::ScenarioDaoService::m_scenarioDao
private

ScenarioDao object to perform database queries.


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