Mantid
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
Mantid::API::AlgorithmHistory Class Reference

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< IAlgorithmcreateAlgorithm () 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< IAlgorithmgetChildAlgorithm (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 AlgorithmHistoriesgetChildHistories () const
 get the child histories of this history object More...
 
const Mantid::Kernel::PropertyHistoriesgetProperties () 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...
 
AlgorithmHistoryoperator= (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
 

Detailed Description

This class stores information about the Command History used by algorithms on a workspace.

Author
Dickon Champion, ISIS, RAL
Date
21/01/2008

Definition at line 41 of file AlgorithmHistory.h.

Constructor & Destructor Documentation

◆ AlgorithmHistory() [1/4]

Mantid::API::AlgorithmHistory::AlgorithmHistory ( const Algorithm *const  alg,
const Types::Core::DateAndTime &  start = Types::Core::DateAndTime::getCurrentTime(),
const double &  duration = -1.0,
std::size_t  uexeccount = 0 
)
explicit

History container.

Constructor.

The date-and-time will be stored as the Mantid::Types::Core::DateAndTime type

Parameters
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().

◆ AlgorithmHistory() [2/4]

Mantid::API::AlgorithmHistory::AlgorithmHistory ( const AlgorithmHistory )
default

◆ AlgorithmHistory() [3/4]

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.

Parameters
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.

◆ AlgorithmHistory() [4/4]

Mantid::API::AlgorithmHistory::AlgorithmHistory ( )
private

Default constructor.

Definition at line 62 of file AlgorithmHistory.cpp.

Member Function Documentation

◆ addChildHistory()

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.

Parameters
childHist:: The child history

Definition at line 138 of file AlgorithmHistory.cpp.

References m_childHistories.

◆ addExecutionInfo()

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.

Parameters
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.

◆ addProperty()

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.

Parameters
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().

◆ childHistorySize()

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().

◆ createAlgorithm()

std::shared_ptr< IAlgorithm > Mantid::API::AlgorithmHistory::createAlgorithm ( ) const

Create a concrete algorithm based on a history record.

Returns
An algorithm object constructed from this history record

Definition at line 224 of file AlgorithmHistory.cpp.

References Mantid::API::Algorithm::fromHistory().

◆ execCount()

const std::size_t & Mantid::API::AlgorithmHistory::execCount ( ) const
inline

get the execution count

Definition at line 72 of file AlgorithmHistory.h.

Referenced by export_AlgorithmHistory().

◆ executionDate()

Mantid::Types::Core::DateAndTime Mantid::API::AlgorithmHistory::executionDate ( ) const
inline

get execution date

Definition at line 70 of file AlgorithmHistory.h.

Referenced by export_AlgorithmHistory().

◆ executionDuration()

double Mantid::API::AlgorithmHistory::executionDuration ( ) const
inline

get execution duration

Definition at line 68 of file AlgorithmHistory.h.

Referenced by export_AlgorithmHistory().

◆ fillAlgorithmHistory()

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.

Parameters
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().

◆ getChildAlgorithm()

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.

Parameters
index:: An index within the workspace history
Returns
A shared pointer to an algorithm object

Definition at line 193 of file AlgorithmHistory.cpp.

References Mantid::API::Algorithm::fromHistory(), and getChildAlgorithmHistory().

Referenced by export_AlgorithmHistory().

◆ getChildAlgorithmHistory()

AlgorithmHistory_sptr Mantid::API::AlgorithmHistory::getChildAlgorithmHistory ( const size_t  index) const

Retrieve a child algorithm history by index.

Parameters
index:: An index within the child algorithm history set
Returns
A pointer to an AlgorithmHistory object
Exceptions
std::out_of_rangeerror 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[]().

◆ getChildHistories()

const AlgorithmHistories & Mantid::API::AlgorithmHistory::getChildHistories ( ) const
inline

get the child histories of this history object

Definition at line 80 of file AlgorithmHistory.h.

Referenced by getChildAlgorithmHistory().

◆ getProperties()

const Mantid::Kernel::PropertyHistories & Mantid::API::AlgorithmHistory::getProperties ( ) const
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().

◆ getPropertyValue()

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.

Parameters
name:: The property to find
Returns
The string value of the property
Exceptions
Exception::NotFoundErrorif 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().

◆ name()

const std::string & Mantid::API::AlgorithmHistory::name ( ) const
inline

◆ operator<()

bool Mantid::API::AlgorithmHistory::operator< ( const AlgorithmHistory other) const
inline

Less than operator.

Definition at line 90 of file AlgorithmHistory.h.

◆ operator=()

AlgorithmHistory & Mantid::API::AlgorithmHistory::operator= ( const AlgorithmHistory A)

Standard Assignment operator.

Parameters
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.

◆ operator==()

bool Mantid::API::AlgorithmHistory::operator== ( const AlgorithmHistory other) const
inline

Equality operator.

Definition at line 92 of file AlgorithmHistory.h.

◆ operator[]()

AlgorithmHistory_sptr Mantid::API::AlgorithmHistory::operator[] ( const size_t  index) const

Add operator[] access.

Index operator[] access to a child algorithm history.

Parameters
index:: An index within the algorithm history
Returns
A pointer to an AlgorithmHistory object
Exceptions
std::out_of_rangeerror if the index is invalid

Definition at line 171 of file AlgorithmHistory.cpp.

References getChildAlgorithmHistory(), and index.

◆ printSelf()

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.

Parameters
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().

◆ 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.

Parameters
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().

◆ setExecCount()

void Mantid::API::AlgorithmHistory::setExecCount ( std::size_t  execCount)
inline

Definition at line 102 of file AlgorithmHistory.h.

◆ setProperties()

void Mantid::API::AlgorithmHistory::setProperties ( const Algorithm *const  alg)
private

Set the history properties for an algorithm pointer.

Parameters
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().

◆ uuid()

const std::string & Mantid::API::AlgorithmHistory::uuid ( ) const
inline

get the uuid

Definition at line 74 of file AlgorithmHistory.h.

◆ version()

const int & Mantid::API::AlgorithmHistory::version ( ) const
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().

Friends And Related Function Documentation

◆ Algorithm

friend class Algorithm
friend

Definition at line 108 of file AlgorithmHistory.h.

Member Data Documentation

◆ m_childHistories

AlgorithmHistories Mantid::API::AlgorithmHistory::m_childHistories
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().

◆ m_execCount

std::size_t Mantid::API::AlgorithmHistory::m_execCount {0}
private

count keeps track of execution order of an algorithm

Definition at line 126 of file AlgorithmHistory.h.

Referenced by fillAlgorithmHistory().

◆ m_executionDate

Mantid::Types::Core::DateAndTime Mantid::API::AlgorithmHistory::m_executionDate
private

The execution date of the algorithm.

Definition at line 120 of file AlgorithmHistory.h.

Referenced by addExecutionInfo(), fillAlgorithmHistory(), operator=(), and printSelf().

◆ m_executionDuration

double Mantid::API::AlgorithmHistory::m_executionDuration {-1.0}
private

The execution duration of the algorithm.

Definition at line 122 of file AlgorithmHistory.h.

Referenced by addExecutionInfo(), fillAlgorithmHistory(), operator=(), and printSelf().

◆ m_name

std::string Mantid::API::AlgorithmHistory::m_name
private

The name of the Algorithm.

Definition at line 116 of file AlgorithmHistory.h.

Referenced by fillAlgorithmHistory(), operator=(), and printSelf().

◆ m_properties

Mantid::Kernel::PropertyHistories Mantid::API::AlgorithmHistory::m_properties
private

The PropertyHistory's defined for the algorithm.

Definition at line 124 of file AlgorithmHistory.h.

Referenced by addProperty(), getPropertyValue(), operator=(), printSelf(), and setProperties().

◆ m_uuid

std::string Mantid::API::AlgorithmHistory::m_uuid
private

UUID for this algorithm history.

Definition at line 130 of file AlgorithmHistory.h.

Referenced by AlgorithmHistory(), operator=(), and printSelf().

◆ m_version

int Mantid::API::AlgorithmHistory::m_version {-1}
private

The version of the algorithm.

Definition at line 118 of file AlgorithmHistory.h.

Referenced by fillAlgorithmHistory(), operator=(), and printSelf().


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