Mantid
|
This class stores information about the Command History used by algorithms on a workspace. More...
#include <API/MAntidAPI/AlgorithmHistory.h>
Public Member Functions | |
void | addChildHistory (const AlgorithmHistory_sptr &childHist) |
add a child algorithm history record to this history object More... | |
void | addExecutionInfo (const Types::Core::DateAndTime &start, const double &duration) |
Add details of an algorithm's execution to an existing history object. More... | |
void | addProperty (const std::string &name, const std::string &value, bool isdefault, const unsigned int &direction=99) |
Add a property to the history. More... | |
AlgorithmHistory (const Algorithm *const alg, const Types::Core::DateAndTime &start=Types::Core::DateAndTime::getCurrentTime(), const double &duration=-1.0, std::size_t uexeccount=0) | |
History container. More... | |
AlgorithmHistory (const AlgorithmHistory &)=default | |
AlgorithmHistory (std::string name, int vers, std::string uuid, const Types::Core::DateAndTime &start=Types::Core::DateAndTime::getCurrentTime(), const double &duration=-1.0, std::size_t uexeccount=0) | |
Construct AlgorithmHistory by name. More... | |
size_t | childHistorySize () const |
Retrieve the number of child algorithms. More... | |
std::shared_ptr< IAlgorithm > | createAlgorithm () const |
Create a concrete algorithm based on a history record. More... | |
const std::size_t & | execCount () const |
get the execution count More... | |
Mantid::Types::Core::DateAndTime | executionDate () const |
get execution date More... | |
double | executionDuration () const |
get execution duration More... | |
void | fillAlgorithmHistory (const Algorithm *const alg, const Types::Core::DateAndTime &start, const double &duration, std::size_t uexeccount) |
Set data on history after it is created. More... | |
std::shared_ptr< IAlgorithm > | getChildAlgorithm (const size_t index) const |
Create an child algorithm from a history record at a given index. More... | |
AlgorithmHistory_sptr | getChildAlgorithmHistory (const size_t index) const |
Retrieve a child algorithm history by index. More... | |
const AlgorithmHistories & | getChildHistories () const |
get the child histories of this history object More... | |
const Mantid::Kernel::PropertyHistories & | getProperties () const |
get parameter list of algorithm in history const More... | |
const std::string & | getPropertyValue (const std::string &name) const |
get the string representation of a specified property More... | |
const std::string & | name () const |
get name of algorithm in history const More... | |
bool | operator< (const AlgorithmHistory &other) const |
Less than operator. More... | |
AlgorithmHistory & | operator= (const AlgorithmHistory &) |
Standard Assignment operator. More... | |
bool | operator== (const AlgorithmHistory &other) const |
Equality operator. More... | |
AlgorithmHistory_sptr | operator[] (const size_t index) const |
Add operator[] access. More... | |
void | printSelf (std::ostream &, const int indent=0, const size_t maxPropertyLength=0) const |
print contents of object More... | |
void | saveNexus (::NeXus::File *file, int &algCount) const |
Write this history object to a nexus file. More... | |
void | setExecCount (std::size_t execCount) |
const std::string & | uuid () const |
get the uuid More... | |
const int & | version () const |
get version number of algorithm in history const More... | |
Private Member Functions | |
AlgorithmHistory () | |
Default constructor. More... | |
void | setProperties (const Algorithm *const alg) |
Set the history properties for an algorithm pointer. More... | |
Private Attributes | |
AlgorithmHistories | m_childHistories |
set of child algorithm histories for this history record More... | |
std::size_t | m_execCount {0} |
count keeps track of execution order of an algorithm More... | |
Mantid::Types::Core::DateAndTime | m_executionDate |
The execution date of the algorithm. More... | |
double | m_executionDuration {-1.0} |
The execution duration of the algorithm. More... | |
std::string | m_name |
The name of the Algorithm. More... | |
Mantid::Kernel::PropertyHistories | m_properties |
The PropertyHistory's defined for the algorithm. More... | |
std::string | m_uuid |
UUID for this algorithm history. More... | |
int | m_version {-1} |
The version of the algorithm. More... | |
Friends | |
class | Algorithm |
This class stores information about the Command History used by algorithms on a workspace.
Definition at line 41 of file AlgorithmHistory.h.
|
explicit |
History container.
Constructor.
The date-and-time will be stored as the Mantid::Types::Core::DateAndTime type
alg | :: A pointer to the algorithm for which the history should be constructed |
start | :: The start time of the algorithm execution (optional) |
duration | :: The time (in seconds) that it took to run this algorithm (optional) |
uexeccount | :: an unsigned int for algorithm execution order |
Definition at line 51 of file AlgorithmHistory.cpp.
References m_uuid, and setProperties().
|
default |
Mantid::API::AlgorithmHistory::AlgorithmHistory | ( | std::string | name, |
int | vers, | ||
std::string | uuid, | ||
const Types::Core::DateAndTime & | start = Types::Core::DateAndTime::getCurrentTime() , |
||
const double & | duration = -1.0 , |
||
std::size_t | uexeccount = 0 |
||
) |
Construct AlgorithmHistory by name.
Can be used for rstoring the history from saved records.
name | :: The algorithm name. |
vers | :: The algorithm version. |
uuid | :: The universally unique id assigned to this alghistory on creation during assignment to history. |
start | :: The start time of the algorithm execution (optional). |
duration | :: The time (in seconds) that it took to run this algorithm (optional). |
uexeccount | :: an unsigned int for algorithm execution order |
Definition at line 76 of file AlgorithmHistory.cpp.
|
private |
Default constructor.
Definition at line 62 of file AlgorithmHistory.cpp.
void Mantid::API::AlgorithmHistory::addChildHistory | ( | const AlgorithmHistory_sptr & | childHist | ) |
add a child algorithm history record to this history object
Add a child algorithm history to history.
childHist | :: The child history |
Definition at line 138 of file AlgorithmHistory.cpp.
References m_childHistories.
void Mantid::API::AlgorithmHistory::addExecutionInfo | ( | const Types::Core::DateAndTime & | start, |
const double & | duration | ||
) |
Add details of an algorithm's execution to an existing history object.
start | :: The start time of the algorithm execution |
duration | :: The time (in seconds) that it took to run this algorithm |
Definition at line 119 of file AlgorithmHistory.cpp.
References m_executionDate, and m_executionDuration.
void Mantid::API::AlgorithmHistory::addProperty | ( | const std::string & | name, |
const std::string & | value, | ||
bool | isdefault, | ||
const unsigned int & | direction = 99 |
||
) |
Add a property to the history.
name | :: The name of the property |
value | :: The value of the property |
isdefault | :: True if the property is default |
direction | :: The direction of the property |
Definition at line 130 of file AlgorithmHistory.cpp.
References m_properties, name(), and value.
Referenced by Mantid::API::WorkspaceHistory::parseAlgorithmHistory().
size_t Mantid::API::AlgorithmHistory::childHistorySize | ( | ) | const |
Retrieve the number of child algorithms.
Definition at line 150 of file AlgorithmHistory.cpp.
References m_childHistories.
Referenced by export_AlgorithmHistory().
std::shared_ptr< IAlgorithm > Mantid::API::AlgorithmHistory::createAlgorithm | ( | ) | const |
Create a concrete algorithm based on a history record.
Definition at line 224 of file AlgorithmHistory.cpp.
References Mantid::API::Algorithm::fromHistory().
|
inline |
get the execution count
Definition at line 72 of file AlgorithmHistory.h.
Referenced by export_AlgorithmHistory().
|
inline |
get execution date
Definition at line 70 of file AlgorithmHistory.h.
Referenced by export_AlgorithmHistory().
|
inline |
get execution duration
Definition at line 68 of file AlgorithmHistory.h.
Referenced by export_AlgorithmHistory().
void Mantid::API::AlgorithmHistory::fillAlgorithmHistory | ( | const Algorithm *const | alg, |
const Types::Core::DateAndTime & | start, | ||
const double & | duration, | ||
std::size_t | uexeccount | ||
) |
Set data on history after it is created.
Fill the algoirthm history object after it has been created.
alg | :: A pointer to the algorithm for which the history should be constructed |
start | :: The start time of the algorithm execution (optional) |
duration | :: The time (in seconds) that it took to run this algorithm (optional) |
uexeccount | :: an unsigned int for algorithm execution order |
Definition at line 105 of file AlgorithmHistory.cpp.
References m_execCount, m_executionDate, m_executionDuration, m_name, m_version, Mantid::API::Algorithm::name(), setProperties(), and Mantid::API::Algorithm::version().
std::shared_ptr< IAlgorithm > Mantid::API::AlgorithmHistory::getChildAlgorithm | ( | const size_t | index | ) | const |
Create an child algorithm from a history record at a given index.
Create an algorithm from a history record at a given index.
index | :: An index within the workspace history |
Definition at line 193 of file AlgorithmHistory.cpp.
References Mantid::API::Algorithm::fromHistory(), and getChildAlgorithmHistory().
Referenced by export_AlgorithmHistory().
AlgorithmHistory_sptr Mantid::API::AlgorithmHistory::getChildAlgorithmHistory | ( | const size_t | index | ) | const |
Retrieve a child algorithm history by index.
index | :: An index within the child algorithm history set |
std::out_of_range | error if the index is invalid |
Definition at line 158 of file AlgorithmHistory.cpp.
References getChildHistories(), index, and m_childHistories.
Referenced by export_AlgorithmHistory(), getChildAlgorithm(), and operator[]().
|
inline |
get the child histories of this history object
Definition at line 80 of file AlgorithmHistory.h.
Referenced by getChildAlgorithmHistory().
|
inline |
get parameter list of algorithm in history const
Definition at line 76 of file AlgorithmHistory.h.
Referenced by Mantid::API::ScriptBuilder::buildAlgorithmString(), Mantid::API::ScriptBuilder::buildCommentString(), and getPropertiesAsList().
const std::string & Mantid::API::AlgorithmHistory::getPropertyValue | ( | const std::string & | name | ) | const |
get the string representation of a specified property
Gets the value of a specified algorithm property.
name | :: The property to find |
Exception::NotFoundError | if the named property is unknown |
Definition at line 179 of file AlgorithmHistory.cpp.
References history, m_properties, and name().
Referenced by Mantid::API::ScriptBuilder::buildAlgorithmString(), and export_AlgorithmHistory().
|
inline |
get name of algorithm in history const
Definition at line 64 of file AlgorithmHistory.h.
Referenced by addProperty(), Mantid::API::ScriptBuilder::buildAlgorithmString(), Mantid::API::ScriptBuilder::buildCommentString(), export_AlgorithmHistory(), and getPropertyValue().
|
inline |
Less than operator.
Definition at line 90 of file AlgorithmHistory.h.
AlgorithmHistory & Mantid::API::AlgorithmHistory::operator= | ( | const AlgorithmHistory & | A | ) |
Standard Assignment operator.
A | :: AlgorithmHistory Item to assign to 'this' |
Definition at line 230 of file AlgorithmHistory.cpp.
References m_childHistories, m_executionDate, m_executionDuration, m_name, m_properties, m_uuid, and m_version.
|
inline |
Equality operator.
Definition at line 92 of file AlgorithmHistory.h.
AlgorithmHistory_sptr Mantid::API::AlgorithmHistory::operator[] | ( | const size_t | index | ) | const |
Add operator[] access.
Index operator[] access to a child algorithm history.
index | :: An index within the algorithm history |
std::out_of_range | error if the index is invalid |
Definition at line 171 of file AlgorithmHistory.cpp.
References getChildAlgorithmHistory(), and index.
void Mantid::API::AlgorithmHistory::printSelf | ( | std::ostream & | os, |
const int | indent = 0 , |
||
const size_t | maxPropertyLength = 0 |
||
) | const |
print contents of object
Prints a text representation of itself.
os | :: The output stream to write to |
indent | :: an indentation value to make pretty printing of object and sub-objects |
maxPropertyLength | :: the max length for any property value string (0 = full length) |
Definition at line 204 of file AlgorithmHistory.cpp.
References m_executionDate, m_executionDuration, m_name, m_properties, m_uuid, and m_version.
Referenced by Mantid::API::Algorithm::logAlgorithmInfo(), Mantid::API::operator<<(), and saveNexus().
void Mantid::API::AlgorithmHistory::saveNexus | ( | ::NeXus::File * | file, |
int & | algCount | ||
) | const |
Write this history object to a nexus file.
Write out this history record to file.
file | :: The handle to the nexus file to save to |
algCount | :: Counter of the number of algorithms written to file. |
Definition at line 260 of file AlgorithmHistory.cpp.
References history, m_childHistories, and printSelf().
|
inline |
Definition at line 102 of file AlgorithmHistory.h.
|
private |
Set the history properties for an algorithm pointer.
alg | :: A pointer to the algorithm for which the history should be constructed |
Definition at line 86 of file AlgorithmHistory.cpp.
References Mantid::API::Algorithm::getProperties(), and m_properties.
Referenced by AlgorithmHistory(), and fillAlgorithmHistory().
|
inline |
get the uuid
Definition at line 74 of file AlgorithmHistory.h.
|
inline |
get version number of algorithm in history const
Definition at line 66 of file AlgorithmHistory.h.
Referenced by Mantid::API::ScriptBuilder::buildAlgorithmString(), and export_AlgorithmHistory().
|
friend |
Definition at line 108 of file AlgorithmHistory.h.
|
private |
set of child algorithm histories for this history record
Definition at line 128 of file AlgorithmHistory.h.
Referenced by addChildHistory(), childHistorySize(), getChildAlgorithmHistory(), operator=(), and saveNexus().
|
private |
count keeps track of execution order of an algorithm
Definition at line 126 of file AlgorithmHistory.h.
Referenced by fillAlgorithmHistory().
|
private |
The execution date of the algorithm.
Definition at line 120 of file AlgorithmHistory.h.
Referenced by addExecutionInfo(), fillAlgorithmHistory(), operator=(), and printSelf().
|
private |
The execution duration of the algorithm.
Definition at line 122 of file AlgorithmHistory.h.
Referenced by addExecutionInfo(), fillAlgorithmHistory(), operator=(), and printSelf().
|
private |
The name of the Algorithm.
Definition at line 116 of file AlgorithmHistory.h.
Referenced by fillAlgorithmHistory(), operator=(), and printSelf().
|
private |
The PropertyHistory's defined for the algorithm.
Definition at line 124 of file AlgorithmHistory.h.
Referenced by addProperty(), getPropertyValue(), operator=(), printSelf(), and setProperties().
|
private |
UUID for this algorithm history.
Definition at line 130 of file AlgorithmHistory.h.
Referenced by AlgorithmHistory(), operator=(), and printSelf().
|
private |
The version of the algorithm.
Definition at line 118 of file AlgorithmHistory.h.
Referenced by fillAlgorithmHistory(), operator=(), and printSelf().