A decorator of CStringList special for keeping logs.
#include <mrpt/utils/CLog.h>
Public Member Functions | |
CLog () | |
virtual | ~CLog () |
void | pushMessages (std::string message) |
push a message More... | |
void | pushMessages (mrpt::utils::CStringList messages) |
push a list of messages More... | |
void | popMessages (std::string &message) |
pop the current unpublished message (clear the content of "message") More... | |
void | popMessages (mrpt::utils::CStringList &messages) |
pop all unpublished messages (clear the content of "messages") More... | |
void | getMessages (size_t begin, size_t end, mrpt::utils::CStringList &messages) |
get messages from "begin" to "end" (clear the content of "messages") More... | |
void | saveLog (std::string name) |
save the current log More... | |
void | loadLog (std::string name) |
load a log (clear the previous content) More... | |
void | clearLog () |
clear the log content More... | |
void | setLastMessageIndex (size_t index) |
change the last unpublished message. More... | |
size_t | getLastMessageIndex () |
get the current unpublished message index. More... | |
Protected Member Functions | |
void | add (const std::string &str) |
Appends a new string at the end of the string list. More... | |
CStringList & | operator<< (const std::string &s) |
An alternative way of adding strings to the list. More... | |
void | insert (size_t index, const std::string &str) |
Inserts a new item at a given position (0=insert at the beggining,1=put into the second position,...) More... | |
void | set (size_t index, const std::string &str) |
Overwrites an existing position with a new value (0=first elements) More... | |
void | set (const std::string &keyName, const std::string &value) |
Sets the value of a given key ("key=value"), overwritten previous value if it existed. More... | |
void | set (const std::string &keyName, const int &value) |
Sets the value of a given key ("key=value"), overwritten previous value if it existed. More... | |
void | set (const std::string &keyName, const float &value) |
Sets the value of a given key ("key=value"), overwritten previous value if it existed. More... | |
void | set (const std::string &keyName, const double &value) |
Sets the value of a given key ("key=value"), overwritten previous value if it existed. More... | |
void | set (const std::string &keyName, const bool &value) |
Sets the value of a given key ("key=value"), overwritten previous value if it existed. More... | |
void | clear () |
Clear the whole list. More... | |
size_t | size () const |
Returns the number of text lines in the list. More... | |
void | remove (size_t index) |
Delete the element at a given position (0=first element) More... | |
bool | find (const std::string &compareText, size_t foundIndex, bool caseSensitive=true) const |
Looks for a given string in the list, and returns its index, or returns "false" otherwise. More... | |
void | get (size_t index, std::string &outText) const |
Returns one string from the line list. More... | |
std::string | operator() (size_t index) const |
Returns one string from the line list. More... | |
std::string & | operator() (size_t index) |
Returns a reference to one string from the line list. More... | |
void | getText (std::string &outText) const |
Returns the whole string list as a single string with '\r ' characters for newlines. More... | |
std::string | getText () const |
Returns the whole string list as a single string with '\r ' characters for newlines. More... | |
void | setText (const std::string &inText) |
Fills the string list by parsing a single string with '\r', ' ', or '\r ' characters indicatng newlines. More... | |
void | loadFromFile (const std::string &fileName) |
Load the string list from a file. More... | |
void | saveToFile (const std::string &fileName) const |
Save the string list to a file. More... | |
std::string | get_string (const std::string &keyName) |
Returns the value of the given key ("key=value"). More... | |
float | get_float (const std::string &keyName) |
Returns the value of the given key ("key=value"). More... | |
int | get_int (const std::string &keyName) |
Returns the value of the given key ("key=value"). More... | |
double | get_double (const std::string &keyName) |
Returns the value of the given key ("key=value"). More... | |
bool | get_bool (const std::string &keyName) |
Returns the value of the given key ("key=value"). More... | |
CSerializable virtual methods | |
void | writeToStream (mrpt::utils::CStream &out, int *getVersion) const MRPT_OVERRIDE |
void | readFromStream (mrpt::utils::CStream &in, int version) MRPT_OVERRIDE |
Protected Attributes | |
mrpt::synch::CCriticalSection | semaphore |
size_t | last |
std::deque< std::string > | m_strings |
The internal list of strings. More... | |
RTTI stuff <br> | |
typedef CStringListPtr | SmartPtr |
static mrpt::utils::CLASSINIT | _init_CStringList |
static mrpt::utils::TRuntimeClassId | classCStringList |
static const mrpt::utils::TRuntimeClassId * | classinfo |
static const mrpt::utils::TRuntimeClassId * | _GetBaseClass () |
static mrpt::utils::CObject * | CreateObject () |
static CStringListPtr | Create () |
virtual const mrpt::utils::TRuntimeClassId * | GetRuntimeClass () const MRPT_OVERRIDE |
virtual mrpt::utils::CObject * | duplicate () const MRPT_OVERRIDE |
|
inherited |
A typedef for the associated smart pointer
Definition at line 35 of file CStringList.h.
mrpt::utils::CLog::CLog | ( | ) |
|
virtual |
|
staticprotectedinherited |
|
inherited |
|
inherited |
Clear the whole list.
void mrpt::utils::CLog::clearLog | ( | ) |
clear the log content
|
staticinherited |
|
staticinherited |
|
virtualinherited |
|
inherited |
Looks for a given string in the list, and returns its index, or returns "false" otherwise.
|
inherited |
Returns one string from the line list.
|
inherited |
Returns the value of the given key ("key=value").
std::exception | If the key is not found in the string list. |
|
inherited |
Returns the value of the given key ("key=value").
std::exception | If the key is not found in the string list. |
|
inherited |
Returns the value of the given key ("key=value").
std::exception | If the key is not found in the string list. |
|
inherited |
Returns the value of the given key ("key=value").
std::exception | If the key is not found in the string list. |
|
inherited |
Returns the value of the given key ("key=value").
std::exception | If the key is not found in the string list. |
size_t mrpt::utils::CLog::getLastMessageIndex | ( | ) |
get the current unpublished message index.
void mrpt::utils::CLog::getMessages | ( | size_t | begin, |
size_t | end, | ||
mrpt::utils::CStringList & | messages | ||
) |
get messages from "begin" to "end" (clear the content of "messages")
|
virtualinherited |
|
inlineinherited |
Returns the whole string list as a single string with '\r
' characters for newlines.
Definition at line 116 of file CStringList.h.
|
inherited |
Returns the whole string list as a single string with '\r
' characters for newlines.
|
inherited |
|
inherited |
Load the string list from a file.
void mrpt::utils::CLog::loadLog | ( | std::string | name | ) |
load a log (clear the previous content)
|
inherited |
Returns a reference to one string from the line list.
|
inherited |
Returns one string from the line list.
|
inlineinherited |
An alternative way of adding strings to the list.
Definition at line 66 of file CStringList.h.
void mrpt::utils::CLog::popMessages | ( | mrpt::utils::CStringList & | messages | ) |
pop all unpublished messages (clear the content of "messages")
void mrpt::utils::CLog::popMessages | ( | std::string & | message | ) |
pop the current unpublished message (clear the content of "message")
void mrpt::utils::CLog::pushMessages | ( | mrpt::utils::CStringList | messages | ) |
push a list of messages
void mrpt::utils::CLog::pushMessages | ( | std::string | message | ) |
push a message
|
protectedinherited |
|
inherited |
Delete the element at a given position (0=first element)
void mrpt::utils::CLog::saveLog | ( | std::string | name | ) |
save the current log
|
inherited |
Save the string list to a file.
|
inherited |
Sets the value of a given key ("key=value"), overwritten previous value if it existed.
|
inherited |
Sets the value of a given key ("key=value"), overwritten previous value if it existed.
|
inherited |
Sets the value of a given key ("key=value"), overwritten previous value if it existed.
|
inherited |
Sets the value of a given key ("key=value"), overwritten previous value if it existed.
|
inherited |
Sets the value of a given key ("key=value"), overwritten previous value if it existed.
|
inherited |
Overwrites an existing position with a new value (0=first elements)
void mrpt::utils::CLog::setLastMessageIndex | ( | size_t | index | ) |
change the last unpublished message.
IMPORTANT: this function should not be used directly.
|
inherited |
Fills the string list by parsing a single string with '\r', '
', or '\r
' characters indicatng newlines.
|
inherited |
Returns the number of text lines in the list.
|
protectedinherited |
|
staticprotectedinherited |
Definition at line 35 of file CStringList.h.
|
staticinherited |
Definition at line 35 of file CStringList.h.
|
staticinherited |
Definition at line 35 of file CStringList.h.
|
protectedinherited |
The internal list of strings.
Definition at line 40 of file CStringList.h.
|
protected |
Page generated by Doxygen 1.9.5 for MRPT 1.4.0 SVN: at Mon Dec 26 04:51:47 UTC 2022 |