Classes | Public Member Functions | Protected Types | Protected Attributes | Friends

Allows to setup and store user-specified log records of algorithmic information. More...

#include <log_record.hpp>

List of all members.

Classes

struct  LogRecordData

Public Member Functions

returnValue addItem (LogName _name, const char *const _label=DEFAULT_LABEL)
returnValue addItem (const Expression &_name, const char *const _label=DEFAULT_LABEL)
returnValue disableWriteProtection (LogName _name)
returnValue disableWriteProtection (const Expression &_name)
returnValue enableWriteProtection (LogName _name)
returnValue enableWriteProtection (const Expression &_name)
returnValue getAll (LogName _name, MatrixVariablesGrid &values) const
returnValue getAll (const Expression &_name, MatrixVariablesGrid &values) const
returnValue getAll (uint _name, LogRecordItemType _type, MatrixVariablesGrid &values) const
returnValue getFirst (LogName _name, DMatrix &firstValue) const
returnValue getFirst (const Expression &_name, DMatrix &firstValue) const
returnValue getFirst (LogName _name, VariablesGrid &firstValue) const
returnValue getFirst (const Expression &_name, VariablesGrid &firstValue) const
returnValue getFirst (uint _name, LogRecordItemType _type, DMatrix &firstValue) const
returnValue getLast (LogName _name, DMatrix &lastValue) const
returnValue getLast (const Expression &_name, DMatrix &lastValue) const
returnValue getLast (LogName _name, VariablesGrid &lastValue) const
returnValue getLast (const Expression &_name, VariablesGrid &lastValue) const
returnValue getLast (uint _name, LogRecordItemType _type, DMatrix &lastValue) const
LogFrequency getLogFrequency () const
uint getMaxNumMatrices () const
uint getNumDoubles () const
uint getNumItems () const
PrintScheme getPrintScheme () const
BooleanType hasItem (LogName _name) const
BooleanType hasItem (const Expression &_name) const
BooleanType hasItem (uint _name, LogRecordItemType _type) const
BooleanType hasNonEmptyItem (LogName _name) const
BooleanType hasNonEmptyItem (const Expression &_name) const
BooleanType isEmpty () const
 LogRecord (LogFrequency _frequency=LOG_AT_EACH_ITERATION, PrintScheme _printScheme=PS_DEFAULT)
returnValue operator<< (LogName _name)
returnValue operator<< (const Expression &_name)
returnValue print (std::ostream &_stream=std::cout, LogPrintMode _mode=PRINT_ITEM_BY_ITEM) const
returnValue printInfo () const
returnValue setAll (LogName _name, const MatrixVariablesGrid &values)
returnValue setAll (const Expression &_name, const MatrixVariablesGrid &values)
returnValue setAll (uint _name, LogRecordItemType _type, const MatrixVariablesGrid &values)
returnValue setLast (LogName _name, const DMatrix &value, double time=-INFTY)
returnValue setLast (const Expression &_name, const DMatrix &value, double time=-INFTY)
returnValue setLast (LogName _name, VariablesGrid &value, double time=-INFTY)
returnValue setLast (const Expression &_name, VariablesGrid &value, double time=-INFTY)
returnValue setLast (uint _name, LogRecordItemType _type, const DMatrix &value, double time=-INFTY)
returnValue setLogFrequency (LogFrequency _frequency)
returnValue setPrintScheme (PrintScheme _printScheme)
returnValue updateLogRecord (LogRecord &_record) const
 ~LogRecord ()

Protected Types

typedef std::map< std::pair
< int, LogRecordItemType >
, LogRecordData
LogRecordItems

Protected Attributes

int aliasIdx
LogFrequency frequency
LogRecordItems items
PrintScheme printScheme

Friends

class Logging

Detailed Description

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.

Author:
Hans Joachim Ferreau, Boris Houska, Milan Vukov

Definition at line 72 of file log_record.hpp.


Member Typedef Documentation

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.


Constructor & Destructor Documentation

Constructor which takes information in the log frequency and the general output file.

Parameters:
[in]_frequencyFrequency determining at which time instants the numerical values are to be stored.
[in]_printSchemePrint 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.


Member Function Documentation

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.

Parameters:
[in]_nameInternal name of item to be added.
[in]_labelLabel of item to be added.
Returns:
SUCCESSFUL_RETURN,
RET_LOG_RECORD_CORRUPTED

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.

Parameters:
[in]_nameInternal name of item to be added.
[in]_labelLabel of item to be added.
Returns:
SUCCESSFUL_RETURN,
RET_LOG_RECORD_CORRUPTED

Definition at line 84 of file log_record.cpp.

Disables write protection of item with given name. As long as write protection is enabled, numerical values of this item cannot be modified.

Parameters:
[in]_nameInternal name of item.
Returns:
SUCCESSFUL_RETURN

Disables write protection of item with given name. As long as write protection is enabled, numerical values of this item cannot be modified.

Parameters:
[in]_nameInternal name of item.
Returns:
SUCCESSFUL_RETURN

Enables write protection of item with given name. As long as write protection is enabled, numerical values of this item cannot be modified.

Parameters:
[in]_nameInternal name of item.
Returns:
SUCCESSFUL_RETURN

Enables write protection of item with given name. As long as write protection is enabled, numerical values of this item cannot be modified.

Parameters:
[in]_nameInternal name of item.
Returns:
SUCCESSFUL_RETURN
returnValue LogRecord::getAll ( LogName  _name,
MatrixVariablesGrid values 
) const [inline]

Gets all numerical values at all time instants of the item with given name.

Parameters:
[in]_nameInternal name of item.
[out]valuesAll numerical values at all time instants of given item.
Note:
All public getAll member functions make use of the protected getAll function.
Returns:
SUCCESSFUL_RETURN,
RET_LOG_ENTRY_DOESNT_EXIST
returnValue LogRecord::getAll ( const Expression _name,
MatrixVariablesGrid values 
) const [inline]

Gets all numerical values at all time instants of the item with given name.

Parameters:
[in]_nameInternal name of item.
[out]valuesAll numerical values at all time instants of given item.
Note:
All public getAll member functions make use of the protected getAll function.
Returns:
SUCCESSFUL_RETURN,
RET_LOG_ENTRY_DOESNT_EXIST
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.

Parameters:
[in]_nameInternal name of item.
[in]_typeInternal type of item.
[out]valuesAll numerical values at all time instants of given item.
Note:
All public getAll member functions make use of this protected function.
Returns:
SUCCESSFUL_RETURN,
RET_LOG_ENTRY_DOESNT_EXIST

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.

Parameters:
[in]_nameInternal name of item.
[out]firstValueNumerical value at first time instant of given item.
Note:
All public getFirst member functions make use of the protected getFirst function.
Returns:
SUCCESSFUL_RETURN,
RET_LOG_ENTRY_DOESNT_EXIST
returnValue LogRecord::getFirst ( const Expression _name,
DMatrix firstValue 
) const [inline]

Gets numerical value at first time instant of the item with given name.

Parameters:
[in]_nameInternal name of item.
[out]firstValueNumerical value at first time instant of given item.
Note:
All public getFirst member functions make use of the protected getFirst function.
Returns:
SUCCESSFUL_RETURN,
RET_LOG_ENTRY_DOESNT_EXIST
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).

Parameters:
[in]_nameInternal name of item.
[out]firstValueNumerical value at first time instant of given item.
Note:
All public getFirst member functions make use of the protected getFirst function.
Returns:
SUCCESSFUL_RETURN,
RET_LOG_ENTRY_DOESNT_EXIST
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).

Parameters:
[in]_nameInternal name of item.
[out]firstValueNumerical value at first time instant of given item.
Note:
All public getFirst member functions make use of the protected getFirst function.
Returns:
SUCCESSFUL_RETURN,
RET_LOG_ENTRY_DOESNT_EXIST
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.

Parameters:
[in]_nameInternal name of item.
[in]_typeInternal type of item.
[out]firstValueNumerical value at first time instant of given item.
Note:
All public getFirst member functions make use of this protected function.
Returns:
SUCCESSFUL_RETURN,
RET_LOG_ENTRY_DOESNT_EXIST

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.

Parameters:
[in]_nameInternal name of item.
[out]lastValueNumerical value at last time instant of given item.
Note:
All public getLast member functions make use of the protected getLast function.
Returns:
SUCCESSFUL_RETURN,
RET_LOG_ENTRY_DOESNT_EXIST
returnValue LogRecord::getLast ( const Expression _name,
DMatrix lastValue 
) const [inline]

Gets numerical value at last time instant of the item with given name.

Parameters:
[in]_nameInternal name of item.
[out]lastValueNumerical value at last time instant of given item.
Note:
All public getLast member functions make use of the protected getLast function.
Returns:
SUCCESSFUL_RETURN,
RET_LOG_ENTRY_DOESNT_EXIST
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).

Parameters:
[in]_nameInternal name of item.
[out]lastValueNumerical value at last time instant of given item.
Note:
All public getLast member functions make use of the protected getLast function.
Returns:
SUCCESSFUL_RETURN,
RET_LOG_ENTRY_DOESNT_EXIST
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).

Parameters:
[in]_nameInternal name of item.
[out]lastValueNumerical value at last time instant of given item.
Note:
All public getLast member functions make use of the protected getLast function.
Returns:
SUCCESSFUL_RETURN,
RET_LOG_ENTRY_DOESNT_EXIST
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.

Parameters:
[in]_nameInternal name of item.
[in]_typeInternal type of item.
[out]lastValueNumerical value at last time instant of given item.
Note:
All public getLast member functions make use of this protected function.
Returns:
SUCCESSFUL_RETURN,
RET_LOG_ENTRY_DOESNT_EXIST

Definition at line 241 of file log_record.cpp.

Returns current log frequency determining at which time instants the numerical values are to be stored.

Returns:
Current log frequency

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.

Returns:
Maximum number of matrices per item

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.

Returns:
Number of items

Returns current print scheme defining the output format of the information.

Returns:
Current print scheme
BooleanType LogRecord::hasItem ( LogName  _name) const [inline]

Returns whether an (possibly empty) item with given internal name exists or not.

Parameters:
[in]_nameInternal name of item.
Returns:
BT_TRUE iff item exists,
BT_FALSE otherwise
BooleanType LogRecord::hasItem ( const Expression _name) const [inline]

Returns whether an (possibly empty) item with given internal name exists or not.

Parameters:
[in]_nameInternal name of item.
Returns:
BT_TRUE iff item exists,
BT_FALSE otherwise
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.

Parameters:
[in]_nameInternal name of item.
[in]_typeInternal type of item.
Returns:
BT_TRUE iff item exists,
BT_FALSE otherwise
BooleanType LogRecord::hasNonEmptyItem ( LogName  _name) const [inline]

Returns whether a non-empty item with given internal name exists or not.

Parameters:
[in]_nameInternal name of item.
Returns:
BT_TRUE iff non-empty item exists,
BT_FALSE otherwise
BooleanType LogRecord::hasNonEmptyItem ( const Expression _name) const [inline]

Returns whether a non-empty item with given internal name exists or not.

Parameters:
[in]_nameInternal name of item.
Returns:
BT_TRUE iff non-empty item exists,
BT_FALSE otherwise
BooleanType LogRecord::isEmpty ( ) const [inline]

Returns whether the record is empty (i.e. contains no items) or not.

Returns:
BT_TRUE iff record is empty,
BT_FALSE otherwise
returnValue LogRecord::operator<< ( LogName  _name)

Adds an item of given name to the singly-linked list.

Parameters:
[in]_nameInternal name of item to be added.
Note:
This function is doing the same as the corresponding addItem member function and is introduced for syntax reasons only.
Returns:
SUCCESSFUL_RETURN

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.

Parameters:
[in]_nameInternal name of item to be added.
Note:
This function is doing the same as the corresponding addItem member function and is introduced for syntax reasons only.
Returns:
SUCCESSFUL_RETURN

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.

Parameters:
[in]_streamStream to print the record.
[in]_modePrint mode: see documentation of LogPrintMode of details.
Returns:
SUCCESSFUL_RETURN,
RET_INVALID_ARGUMENTS,
RET_UNKNOWN_BUG

Definition at line 95 of file log_record.cpp.

Prints information on the record and its items on screen.

Returns:
SUCCESSFUL_RETURN

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.

Parameters:
[in]_nameInternal name of item.
[in]valuesAll numerical values at all time instants of given item.
Note:
All public setAll member functions make use of the protected setAll function.
Returns:
SUCCESSFUL_RETURN,
RET_LOG_RECORD_CORRUPTED
returnValue LogRecord::setAll ( const Expression _name,
const MatrixVariablesGrid values 
) [inline]

Sets all numerical values at all time instants of the item with given name.

Parameters:
[in]_nameInternal name of item.
[in]valuesAll numerical values at all time instants of given item.
Note:
All public setAll member functions make use of the protected setAll function.
Returns:
SUCCESSFUL_RETURN,
RET_LOG_RECORD_CORRUPTED
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.

Parameters:
[in]_nameInternal name of item.
[in]_typeInternal type of item.
[in]valuesAll numerical values at all time instants of given item.
Note:
All public setAll member functions make use of this protected function.
Returns:
SUCCESSFUL_RETURN,
RET_LOG_RECORD_CORRUPTED

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.

Parameters:
[in]_nameInternal name of item.
[in]lastValueNumerical value at last time instant of given item.
[in]timeTime label of the instant.
Note:
All public setLast member functions make use of the protected setLast function.
Returns:
SUCCESSFUL_RETURN,
RET_LOG_ENTRY_DOESNT_EXIST
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.

Parameters:
[in]_nameInternal name of item.
[in]lastValueNumerical value at last time instant of given item.
[in]timeTime label of the instant.
Note:
All public setLast member functions make use of the protected setLast function.
Returns:
SUCCESSFUL_RETURN,
RET_LOG_ENTRY_DOESNT_EXIST
returnValue LogRecord::setLast ( LogName  _name,
VariablesGrid value,
double  time = -INFTY 
) [inline]

Sets numerical value at last time instant of the item with given name.

Parameters:
[in]_nameInternal name of item.
[in]lastValueNumerical value at last time instant of given item.
[in]timeTime label of the instant.
Note:
All public setLast member functions make use of the protected setLast function.
Returns:
SUCCESSFUL_RETURN,
RET_LOG_ENTRY_DOESNT_EXIST
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.

Parameters:
[in]_nameInternal name of item.
[in]lastValueNumerical value at last time instant of given item.
[in]timeTime label of the instant.
Note:
All public setLast member functions make use of the protected setLast function.
Returns:
SUCCESSFUL_RETURN,
RET_LOG_ENTRY_DOESNT_EXIST
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.

Parameters:
[in]_nameInternal name of item.
[in]_typeInternal type of item.
[in]lastValueNumerical value at last time instant of given item.
[in]timeTime label of the instant.
Note:
All public setLast member functions make use of this protected function.
Returns:
SUCCESSFUL_RETURN,
RET_LOG_ENTRY_DOESNT_EXIST

Definition at line 292 of file log_record.cpp.

Sets the log frequency determining at which time instants the numerical values are to be stored.

Parameters:
[in]_frequencyNew log frequency
Returns:
SUCCESSFUL_RETURN

Sets the print scheme defining the output format of the information.

Parameters:
[in]_printSchemeNew print scheme
Returns:
SUCCESSFUL_RETURN

Update an existing record.

Definition at line 338 of file log_record.cpp.


Friends And Related Function Documentation

friend class Logging [friend]

Definition at line 74 of file log_record.hpp.


Member Data Documentation

int LogRecord::aliasIdx [protected]

Alias index of record (-1 = no alias record).

Definition at line 661 of file log_record.hpp.

Frequency determining at which time instants the numerical values are to be stored.

Definition at line 663 of file log_record.hpp.

Log record items.

Definition at line 694 of file log_record.hpp.

Print scheme defining the output format of the information.

Definition at line 665 of file log_record.hpp.


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


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Thu Aug 27 2015 12:01:39