|
The Sparta Modeling Framework
|
Contains information describing the simulation instance for the purpose of identifying the simulation and possible recreating it. This information should be written to all log files, reports, cmdline, etc. More...
#include <SimulationInfo.hpp>
Public Member Functions | |
| ~SimulationInfo ()=default | |
| Destruction. | |
| SimulationInfo () | |
| Default Constructor. | |
| SimulationInfo (const SimulationInfo &rhp) | |
| Copy-constructor. | |
| SimulationInfo (SimulationInfo &&)=delete | |
| Not move-constructable. | |
| SimulationInfo & | operator= (const SimulationInfo &rhp) |
| Assignable. | |
| SimulationInfo (const std::string &_sim_name, const std::string &_command_line, const std::string &_working_dir, const std::string &_executable, const std::string &_simulator_version, const std::string &_reproduction_info, const std::vector< std::string > &_other) | |
| SimulationInfo constructor. | |
| SimulationInfo (const std::string &_sim_name, int argc, char **argv, const std::string &_simulator_version, const std::string &_reproduction_info, const std::vector< std::string > &_other) | |
| SimulationInfo constructor with automatic command-line reconstruction. | |
| SimulationInfo (std::ifstream &json_fin, std::map< std::string, std::string > *json_kvpairs=nullptr) | |
| Instantiate a SimulationInfo object from a json, json_reduced, json_detail, or js_json report file. | |
| std::string | getSpartaVersion () const |
| Get the SPARTA version string for this SimulationInfo object. Most of the time, this will be SimulationInfo::sparta_version (const / global). | |
| void | setCommandLine (int argc, char **argv) |
| Assign command_line_ and executable_ from args. | |
| void | setCommandLine (const std::string &cmdline) |
| Assign command line from string. | |
| void | addOtherInfo (const std::string &_other) |
| Add other information to the simulation. | |
| template<typename StreamType = std::ostream> | |
| void | write (StreamType &o, const std::string &line_start="# ", const std::string &line_end="\n", bool show_field_names=true) const |
| Write this information to an ostream. | |
| template<typename ... Args> | |
| std::string | stringize (const Args &...args) const |
| Generate a string using the write function without needing to construct a temporary stringstream. | |
| template<typename ... Args> | |
| std::vector< std::string > | stringizeToLines (const Args &...args) const |
| Generate a vector of lines. | |
| std::vector< std::pair< std::string, std::string > > | getHeaderPairs () const |
| Gets (name, value) pairs for each header entry. | |
| void | postSim () |
| Called once after simulation in saveReports() | |
Static Public Member Functions | |
| static SimulationInfo & | getInstance () |
| Gets the SimulationInfo singleton instance. | |
Public Attributes | |
| const std::string & | sim_name |
| Simulator application name. Note that multiple simulators could exist in the same process space, so this should be the application containing those simulations. If there is only one simulation, this should usually match the simulation name. | |
| const std::string & | command_line |
| Simulator application instance command-line. | |
| const std::string & | working_dir |
| Simulator application instance working dir. | |
| const std::string & | executable |
| Executable being run. | |
| const std::string & | simulator_version |
| Simulator Version of the simulator itself. | |
| const std::string & | reproduction_info |
| versions/buildnums/tags of simulator and dependencies necessary for reproducing the build from a version control system | |
| const std::string & | start_time |
| Time at which the simulation started (roughly) | |
| const std::vector< std::string > & | other |
| other simulator information | |
Static Public Attributes | |
| static const char | sparta_version [] |
| The version of SPARTA. | |
Contains information describing the simulation instance for the purpose of identifying the simulation and possible recreating it. This information should be written to all log files, reports, cmdline, etc.
Definition at line 105 of file SimulationInfo.hpp.
|
inline |
Default Constructor.
Definition at line 186 of file SimulationInfo.hpp.
|
inline |
Copy-constructor.
Definition at line 201 of file SimulationInfo.hpp.
|
inline |
SimulationInfo constructor.
Definition at line 237 of file SimulationInfo.hpp.
|
inline |
SimulationInfo constructor with automatic command-line reconstruction.
Definition at line 261 of file SimulationInfo.hpp.

| sparta::SimulationInfo::SimulationInfo | ( | std::ifstream & | json_fin, |
| std::map< std::string, std::string > * | json_kvpairs = nullptr ) |
Instantiate a SimulationInfo object from a json, json_reduced, json_detail, or js_json report file.
| json_fin | Input file stream for the JSON report file |
| json_kvpairs | Optional output argument to get all the name-value pairs of SimulationInfo properties found in the file. |
|
inline |
Add other information to the simulation.
Definition at line 345 of file SimulationInfo.hpp.
|
inline |
Gets (name, value) pairs for each header entry.
Definition at line 407 of file SimulationInfo.hpp.

|
inlinestatic |
Gets the SimulationInfo singleton instance.
Definition at line 174 of file SimulationInfo.hpp.
|
inline |
Get the SPARTA version string for this SimulationInfo object. Most of the time, this will be SimulationInfo::sparta_version (const / global).
Definition at line 302 of file SimulationInfo.hpp.
|
inline |
Assignable.
Definition at line 221 of file SimulationInfo.hpp.
|
inline |
Called once after simulation in saveReports()
Definition at line 430 of file SimulationInfo.hpp.

|
inline |
Assign command line from string.
Definition at line 338 of file SimulationInfo.hpp.
|
inline |
Assign command_line_ and executable_ from args.
Definition at line 313 of file SimulationInfo.hpp.
|
inline |
Generate a string using the write function without needing to construct a temporary stringstream.
Definition at line 385 of file SimulationInfo.hpp.

|
inline |
Generate a vector of lines.
Definition at line 398 of file SimulationInfo.hpp.

|
inline |
Write this information to an ostream.
| line_start | String to write at the start of each line (per field) |
| line_end | String to write at the end of each line (per field). This is typically "\n", but can be anything. |
| show_field_names | Show the names of each field before printing the values |
Definition at line 358 of file SimulationInfo.hpp.

| const std::string& sparta::SimulationInfo::command_line |
Simulator application instance command-line.
Definition at line 132 of file SimulationInfo.hpp.
| const std::string& sparta::SimulationInfo::executable |
Executable being run.
Definition at line 142 of file SimulationInfo.hpp.
| const std::vector<std::string>& sparta::SimulationInfo::other |
other simulator information
Definition at line 169 of file SimulationInfo.hpp.
| const std::string& sparta::SimulationInfo::reproduction_info |
versions/buildnums/tags of simulator and dependencies necessary for reproducing the build from a version control system
Definition at line 159 of file SimulationInfo.hpp.
| const std::string& sparta::SimulationInfo::sim_name |
Simulator application name. Note that multiple simulators could exist in the same process space, so this should be the application containing those simulations. If there is only one simulation, this should usually match the simulation name.
Definition at line 127 of file SimulationInfo.hpp.
| const std::string& sparta::SimulationInfo::simulator_version |
Simulator Version of the simulator itself.
Definition at line 147 of file SimulationInfo.hpp.
|
static |
The version of SPARTA.
Definition at line 152 of file SimulationInfo.hpp.
| const std::string& sparta::SimulationInfo::start_time |
Time at which the simulation started (roughly)
Definition at line 164 of file SimulationInfo.hpp.
| const std::string& sparta::SimulationInfo::working_dir |
Simulator application instance working dir.
Definition at line 137 of file SimulationInfo.hpp.