version
0.0.1
Defines the C++ API for MsPASS
|
Lightweight data structure to completely describe an algorithm. More...
#include <ProcessManager.h>
Public Member Functions | |
AlgorithmDefinition () | |
AlgorithmDefinition (const std::string name, const std::string typin, const std::string typout, const std::string id) | |
AlgorithmDefinition (const AlgorithmDefinition &parent) | |
std::string | name () const |
std::string | id () const |
return the id as a string. More... | |
void | set_id (const std::string id) |
AlgorithmDefinition & | operator= (const AlgorithmDefinition &parent) |
Lightweight data structure to completely describe an algorithm.
Processing data always involves application of one or more algorithms. Most algorithms have one to many parameters that define the algorithm's detailed behavior. Because the size of parametric input can sometimes be huge MsPASS needed a way to carry a concise summary of algorithms applied to data. The issue is complicated by the fact that the same algorithm may be applied to data at diffrent stages with different parameters (e.g. bandpass filters applied before and after deconvolution). To address this problem we save input parameters for any instance of an algorithm in MongoDB as a document in the history collection. This implementation uses a simple string to define a particular instance. In the current implementation of MsPASS that is set as the string representation of the ObjectID defined for that document. An alternative would be UUID as used in TimeSeries and Seismogram objects, but we prefer the ObjectID string here as it is a guaranteed unique key by MongoDB, always has an index defined for the collection, and reduces the size of the history collection by not requiring a uuid attribute.
Any algorithm for which no optional parameters are needed will have the id field empty.
A special case is readers that act as origins from "raw" which may not literally be "raw" but is just a signal that a reader initiated a history chain. For readers input_type is set to "NotApplicable" and output_type is to be defined for that reader. Readers may or may not have control parameters.
|
inline |
|
inline |
Primary constructor.
This constructor sets the two primary attributes of this object. name is a descriptive (unique) name assigned to the algorithm and id is a unique id key. In MsPASS it is the string representation of the ObjectID assigned to the MongoDB document holding the parameter data that defines this instance of an algorithm.
name | is the algorithm's (unique) name |
id | is a unique id string defining the parameters that were used for this instance of an algorithm. |
References id().
|
inline |
return the id as a string.
In MsPASS the id is normally a MongoDB ObjectID string representation of the documnt saved in the database that holds the paramters defining a particular algorithm instance. If the algorithm has no parameters this string will be null. Callers should test that condition by calling the length method of std::string to verify the id is not zero length
|
inline |
Set a new id string.
The id straing is used to define a unique instance of an algorithm for a particular set of parameters. This is the only putter for this class because it is the only attribute that should ever be changed after construction. The reason is the name and type constraints are fixed, but id defines a particular instance that may be variable.
References id().