version  0.0.1
Defines the C++ API for MsPASS
Loading...
Searching...
No Matches
Public Member Functions | List of all members
mspass::utility::ProcessManager Class Reference

Public Member Functions

 ProcessManager (std::string fname)
 
AlgorithmDefinition algorithm (const std::string name, const size_t instance=0) const
 
std::string jobname () const
 
std::string jobid () const
 
std::string new_newid ()
 Get a new UUID to define unique job run.
 

Constructor & Destructor Documentation

◆ ProcessManager()

mspass::utility::ProcessManager::ProcessManager ( )
10: jobnm() { job_uuid = gen(); };

Member Function Documentation

◆ algorithm()

AlgorithmDefinition mspass::utility::ProcessManager::algorithm ( const std::string  name,
const size_t  instance = 0 
) const
47 {
48 size_t i;
49 map<string, vector<AlgorithmDefinition>>::const_iterator aptr;
50 aptr = algs.find(name);
51 if (aptr == algs.end()) {
52 /* If the name is not registered the map we don't want this
53 method to throw an error. Instead we return the name with
54 the id field set to UNDEFINED*/
55 return AlgorithmDefinition(name, "UNDEFINED", "UNDEFINED", "UNDEFINED");
56 } else {
57 i = instance;
58 if (instance >= (aptr->second.size())) {
59 cerr << "ProcessManager::algorithm(Warning): "
60 << "algorithm=" << name
61 << " was defined but requested instance=" << instance
62 << " exceeds number of defined instances=" << aptr->second.size()
63 << endl
64 << "Set to id for instance=" << aptr->second.size() - 1 << endl
65 << "History data may be invalid" << endl;
66 i = aptr->second.size() - 1;
67 }
68 }
69 return aptr->second[i];
70}

◆ jobid()

std::string mspass::utility::ProcessManager::jobid ( ) const
inline
123{ return boost::uuids::to_string(job_uuid); };

◆ jobname()

std::string mspass::utility::ProcessManager::jobname ( ) const
inline
122{ return jobnm; };

◆ new_newid()

std::string mspass::utility::ProcessManager::new_newid ( )
inline

Get a new UUID to define unique job run.

MsPASS data objects are tagged with a UUID to properly handle processing history. Procedures can call his method to get a uuid based on boost's random_generator. We keep the generator in this object because web conversations suggest construction of random_generator is expensive in time and needs to not be done at the object level.

Returns
new uuid definign this job in string form.
135 {
136 boost::uuids::uuid id;
137 id = gen();
138 return boost::uuids::to_string(id);
139 }

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