Allows to setup and store user-specified log records of algorithmic information. More...
#include <log_record.hpp>
Allows to setup and store user-specified log records of algorithmic information.
The class LogRecord allows to setup and store user-specified log records of algorithmic information consisting of numerical values during runtime.
A log record comprises arbitrarily many LogRecordItems stored in a simple singly-linked list. Within these items, the actual numerical values of the algorithmic to be logged as well as settings defining their output format is stored. Several commonly-used output formats are pre-defined within so-called PrintSchemes.
Additionally, a log record stores two important settings: (i) the LogFrequency defining whether the information is stored at each iteration or only at the start or end, respectively; (ii) the file, e.g. a file or the screen, to which the whole log record including all its items can be printed.
Finally, it is interesting to know that LogRecords can be setup by the user and flushed to UserInterface classes. Internally, LogRecords are stored as basic singly-linked within a LogCollection.
Definition at line 72 of file log_record.hpp.
typedef std::map<std::pair<int, LogRecordItemType>, LogRecordData> LogRecord::LogRecordItems [protected] |
Type definition for Log record items.
Definition at line 692 of file log_record.hpp.
BEGIN_NAMESPACE_ACADO LogRecord::LogRecord | ( | LogFrequency | _frequency = LOG_AT_EACH_ITERATION , |
PrintScheme | _printScheme = PS_DEFAULT |
||
) |
Constructor which takes information in the log frequency and the general output file.
[in] | _frequency | Frequency determining at which time instants the numerical values are to be stored. |
[in] | _printScheme | Print scheme defining the output format of the information. |
Definition at line 44 of file log_record.cpp.
Destructor.
Definition at line 54 of file log_record.cpp.
returnValue LogRecord::addItem | ( | LogName | _name, |
const char *const | _label = DEFAULT_LABEL |
||
) |
Adds an item of given internal name to the singly-linked list. In addition, label of the item can be specified.
[in] | _name | Internal name of item to be added. |
[in] | _label | Label of item to be added. |
Definition at line 70 of file log_record.cpp.
returnValue LogRecord::addItem | ( | const Expression & | _name, |
const char *const | _label = DEFAULT_LABEL |
||
) |
Adds an item of given internal name to the singly-linked list. In addition, label of the item can be specified.
[in] | _name | Internal name of item to be added. |
[in] | _label | Label of item to be added. |
Definition at line 84 of file log_record.cpp.
returnValue LogRecord::disableWriteProtection | ( | LogName | _name | ) | [inline] |
Disables write protection of item with given name. As long as write protection is enabled, numerical values of this item cannot be modified.
[in] | _name | Internal name of item. |
returnValue LogRecord::disableWriteProtection | ( | const Expression & | _name | ) | [inline] |
Disables write protection of item with given name. As long as write protection is enabled, numerical values of this item cannot be modified.
[in] | _name | Internal name of item. |
returnValue LogRecord::enableWriteProtection | ( | LogName | _name | ) | [inline] |
Enables write protection of item with given name. As long as write protection is enabled, numerical values of this item cannot be modified.
[in] | _name | Internal name of item. |
returnValue LogRecord::enableWriteProtection | ( | const Expression & | _name | ) | [inline] |
Enables write protection of item with given name. As long as write protection is enabled, numerical values of this item cannot be modified.
[in] | _name | Internal name of item. |
returnValue LogRecord::getAll | ( | LogName | _name, |
MatrixVariablesGrid & | values | ||
) | const [inline] |
Gets all numerical values at all time instants of the item with given name.
[in] | _name | Internal name of item. |
[out] | values | All numerical values at all time instants of given item. |
returnValue LogRecord::getAll | ( | const Expression & | _name, |
MatrixVariablesGrid & | values | ||
) | const [inline] |
Gets all numerical values at all time instants of the item with given name.
[in] | _name | Internal name of item. |
[out] | values | All numerical values at all time instants of given item. |
returnValue LogRecord::getAll | ( | uint | _name, |
LogRecordItemType | _type, | ||
MatrixVariablesGrid & | values | ||
) | const |
Gets all numerical values at all time instants of the item with given internal name and internal type.
[in] | _name | Internal name of item. |
[in] | _type | Internal type of item. |
[out] | values | All numerical values at all time instants of given item. |
Definition at line 208 of file log_record.cpp.
returnValue LogRecord::getFirst | ( | LogName | _name, |
DMatrix & | firstValue | ||
) | const [inline] |
Gets numerical value at first time instant of the item with given name.
[in] | _name | Internal name of item. |
[out] | firstValue | Numerical value at first time instant of given item. |
returnValue LogRecord::getFirst | ( | const Expression & | _name, |
DMatrix & | firstValue | ||
) | const [inline] |
Gets numerical value at first time instant of the item with given name.
[in] | _name | Internal name of item. |
[out] | firstValue | Numerical value at first time instant of given item. |
returnValue LogRecord::getFirst | ( | LogName | _name, |
VariablesGrid & | firstValue | ||
) | const [inline] |
Gets numerical value at first time instant of the item with given name (converts internally used DMatrix into VariablesGrid).
[in] | _name | Internal name of item. |
[out] | firstValue | Numerical value at first time instant of given item. |
returnValue LogRecord::getFirst | ( | const Expression & | _name, |
VariablesGrid & | firstValue | ||
) | const [inline] |
Gets numerical value at first time instant of the item with given name (converts internally used DMatrix into VariablesGrid).
[in] | _name | Internal name of item. |
[out] | firstValue | Numerical value at first time instant of given item. |
returnValue LogRecord::getFirst | ( | uint | _name, |
LogRecordItemType | _type, | ||
DMatrix & | firstValue | ||
) | const |
Gets numerical value at first time instant of the item with given internal name and internal type.
[in] | _name | Internal name of item. |
[in] | _type | Internal type of item. |
[out] | firstValue | Numerical value at first time instant of given item. |
Definition at line 223 of file log_record.cpp.
returnValue LogRecord::getLast | ( | LogName | _name, |
DMatrix & | lastValue | ||
) | const [inline] |
Gets numerical value at last time instant of the item with given name.
[in] | _name | Internal name of item. |
[out] | lastValue | Numerical value at last time instant of given item. |
returnValue LogRecord::getLast | ( | const Expression & | _name, |
DMatrix & | lastValue | ||
) | const [inline] |
Gets numerical value at last time instant of the item with given name.
[in] | _name | Internal name of item. |
[out] | lastValue | Numerical value at last time instant of given item. |
returnValue LogRecord::getLast | ( | LogName | _name, |
VariablesGrid & | lastValue | ||
) | const [inline] |
Gets numerical value at last time instant of the item with given name (converts internally used DMatrix into VariablesGrid).
[in] | _name | Internal name of item. |
[out] | lastValue | Numerical value at last time instant of given item. |
returnValue LogRecord::getLast | ( | const Expression & | _name, |
VariablesGrid & | lastValue | ||
) | const [inline] |
Gets numerical value at last time instant of the item with given name (converts internally used DMatrix into VariablesGrid).
[in] | _name | Internal name of item. |
[out] | lastValue | Numerical value at last time instant of given item. |
returnValue LogRecord::getLast | ( | uint | _name, |
LogRecordItemType | _type, | ||
DMatrix & | lastValue | ||
) | const |
Gets numerical value at last time instant of the item with given internal name and internal type.
[in] | _name | Internal name of item. |
[in] | _type | Internal type of item. |
[out] | lastValue | Numerical value at last time instant of given item. |
Definition at line 241 of file log_record.cpp.
LogFrequency LogRecord::getLogFrequency | ( | ) | const [inline] |
Returns current log frequency determining at which time instants the numerical values are to be stored.
uint LogRecord::getMaxNumMatrices | ( | ) | const |
Returns maximum number of matrices per item. Remember that the numerical values of each item is stored in a MatrixVariablesGrid and that the number of matrices might be different from one item to the other.
Definition at line 188 of file log_record.cpp.
uint LogRecord::getNumDoubles | ( | ) | const [inline] |
uint LogRecord::getNumItems | ( | ) | const [inline] |
Returns number of items contained in the record.
PrintScheme LogRecord::getPrintScheme | ( | ) | const [inline] |
Returns current print scheme defining the output format of the information.
BooleanType LogRecord::hasItem | ( | LogName | _name | ) | const [inline] |
Returns whether an (possibly empty) item with given internal name exists or not.
[in] | _name | Internal name of item. |
BooleanType LogRecord::hasItem | ( | const Expression & | _name | ) | const [inline] |
Returns whether an (possibly empty) item with given internal name exists or not.
[in] | _name | Internal name of item. |
BooleanType LogRecord::hasItem | ( | uint | _name, |
LogRecordItemType | _type | ||
) | const [inline] |
Returns whether an (possibly empty) item with given internal name and internal type exists or not.
[in] | _name | Internal name of item. |
[in] | _type | Internal type of item. |
BooleanType LogRecord::hasNonEmptyItem | ( | LogName | _name | ) | const [inline] |
Returns whether a non-empty item with given internal name exists or not.
[in] | _name | Internal name of item. |
BooleanType LogRecord::hasNonEmptyItem | ( | const Expression & | _name | ) | const [inline] |
Returns whether a non-empty item with given internal name exists or not.
[in] | _name | Internal name of item. |
BooleanType LogRecord::isEmpty | ( | ) | const [inline] |
Returns whether the record is empty (i.e. contains no items) or not.
returnValue LogRecord::operator<< | ( | LogName | _name | ) |
Adds an item of given name to the singly-linked list.
[in] | _name | Internal name of item to be added. |
Definition at line 57 of file log_record.cpp.
returnValue LogRecord::operator<< | ( | const Expression & | _name | ) |
Adds an item of given internal name to the singly-linked list.
[in] | _name | Internal name of item to be added. |
Definition at line 63 of file log_record.cpp.
returnValue LogRecord::print | ( | std::ostream & | _stream = std::cout , |
LogPrintMode | _mode = PRINT_ITEM_BY_ITEM |
||
) | const |
Prints whole record into a stream; all items are printed according to the output format settings.
[in] | _stream | Stream to print the record. |
[in] | _mode | Print mode: see documentation of LogPrintMode of details. |
Definition at line 95 of file log_record.cpp.
returnValue LogRecord::printInfo | ( | ) | const |
Prints information on the record and its items on screen.
Definition at line 174 of file log_record.cpp.
returnValue LogRecord::setAll | ( | LogName | _name, |
const MatrixVariablesGrid & | values | ||
) | [inline] |
Sets all numerical values at all time instants of the item with given name.
[in] | _name | Internal name of item. |
[in] | values | All numerical values at all time instants of given item. |
returnValue LogRecord::setAll | ( | const Expression & | _name, |
const MatrixVariablesGrid & | values | ||
) | [inline] |
Sets all numerical values at all time instants of the item with given name.
[in] | _name | Internal name of item. |
[in] | values | All numerical values at all time instants of given item. |
returnValue LogRecord::setAll | ( | uint | _name, |
LogRecordItemType | _type, | ||
const MatrixVariablesGrid & | values | ||
) |
Sets all numerical values at all time instants of the item with given internal name and internal type.
[in] | _name | Internal name of item. |
[in] | _type | Internal type of item. |
[in] | values | All numerical values at all time instants of given item. |
Definition at line 260 of file log_record.cpp.
returnValue LogRecord::setLast | ( | LogName | _name, |
const DMatrix & | value, | ||
double | time = -INFTY |
||
) | [inline] |
Sets numerical value at last time instant of the item with given name.
[in] | _name | Internal name of item. |
[in] | lastValue | Numerical value at last time instant of given item. |
[in] | time | Time label of the instant. |
returnValue LogRecord::setLast | ( | const Expression & | _name, |
const DMatrix & | value, | ||
double | time = -INFTY |
||
) | [inline] |
Sets numerical value at last time instant of the item with given name.
[in] | _name | Internal name of item. |
[in] | lastValue | Numerical value at last time instant of given item. |
[in] | time | Time label of the instant. |
returnValue LogRecord::setLast | ( | LogName | _name, |
VariablesGrid & | value, | ||
double | time = -INFTY |
||
) | [inline] |
Sets numerical value at last time instant of the item with given name.
[in] | _name | Internal name of item. |
[in] | lastValue | Numerical value at last time instant of given item. |
[in] | time | Time label of the instant. |
returnValue LogRecord::setLast | ( | const Expression & | _name, |
VariablesGrid & | value, | ||
double | time = -INFTY |
||
) | [inline] |
Sets numerical value at last time instant of the item with given name.
[in] | _name | Internal name of item. |
[in] | lastValue | Numerical value at last time instant of given item. |
[in] | time | Time label of the instant. |
returnValue LogRecord::setLast | ( | uint | _name, |
LogRecordItemType | _type, | ||
const DMatrix & | value, | ||
double | time = -INFTY |
||
) |
Sets numerical value at last time instant of the item with given internal name and internal type.
[in] | _name | Internal name of item. |
[in] | _type | Internal type of item. |
[in] | lastValue | Numerical value at last time instant of given item. |
[in] | time | Time label of the instant. |
Definition at line 292 of file log_record.cpp.
returnValue LogRecord::setLogFrequency | ( | LogFrequency | _frequency | ) | [inline] |
Sets the log frequency determining at which time instants the numerical values are to be stored.
[in] | _frequency | New log frequency |
returnValue LogRecord::setPrintScheme | ( | PrintScheme | _printScheme | ) | [inline] |
Sets the print scheme defining the output format of the information.
[in] | _printScheme | New print scheme |
returnValue LogRecord::updateLogRecord | ( | LogRecord & | _record | ) | const |
Update an existing record.
Definition at line 338 of file log_record.cpp.
friend class Logging [friend] |
Definition at line 74 of file log_record.hpp.
int LogRecord::aliasIdx [protected] |
Alias index of record (-1 = no alias record).
Definition at line 661 of file log_record.hpp.
LogFrequency LogRecord::frequency [protected] |
Frequency determining at which time instants the numerical values are to be stored.
Definition at line 663 of file log_record.hpp.
LogRecordItems LogRecord::items [protected] |
Log record items.
Definition at line 694 of file log_record.hpp.
PrintScheme LogRecord::printScheme [protected] |
Print scheme defining the output format of the information.
Definition at line 665 of file log_record.hpp.