casa
$Rev:20696$
|
LogOrigin: The source code location of the originator of a LogMessage. More...
#include <LogOrigin.h>
Public Member Functions | |
LogOrigin () | |
The default constructor sets a null class name, function name, object id, source file name, and sets the line number to zero. | |
LogOrigin (const String &globalFunctionName, const SourceLocation *where=0) | |
Use this constructor if the log message origination is from a global function. | |
LogOrigin (const String &className, const String &memberFuncName, const SourceLocation *where=0) | |
Use this constructor if the log message origination is from a class member function. | |
LogOrigin (const String &className, const String &memberFuncName, const ObjectID &id, const SourceLocation *where=0) | |
Use this constructor if the log message origination is from a distributed object (don't worry if you don't know what this means). | |
LogOrigin (const LogOrigin &other) | |
Make this LogOrigin a copy of other . | |
LogOrigin & | operator= (const LogOrigin &other) |
~LogOrigin () | |
const String & | taskName () const |
Get or set the corresponding element of the source location. | |
LogOrigin & | taskName (const String &funcName) |
const String & | functionName () const |
LogOrigin & | functionName (const String &funcName) |
const String & | className () const |
LogOrigin & | className (const String &className) |
const ObjectID & | objectID () const |
LogOrigin & | objectID (const ObjectID &id) |
uInt | line () const |
LogOrigin & | line (uInt which) |
const String & | fileName () const |
LogOrigin & | fileName (const String &fileName) |
LogOrigin & | sourceLocation (const SourceLocation *where) |
Set the file name and line number at the same time. | |
String | fullName () const |
Returns class::function for a member function, or ::function for a global function. | |
String | toString () const |
Turn the entire origin into a String. | |
String | location () const |
Turns the entire origin except for the ObjectID into a String. | |
Bool | isUnset () const |
Return true if the line number and file name are not set. | |
Private Member Functions | |
void | copy_other (const LogOrigin &other) |
Provide common implementation for copy constructor and assignment operator. | |
Private Attributes | |
String | task_p |
String | function_p |
String | class_p |
ObjectID | id_p |
uInt | line_p |
String | file_p |
LogOrigin: The source code location of the originator of a LogMessage.
Public interface
Log[message] Origin[ation point].
The LogOriging
class is used to record the location at which a LogMessage originates. It consists of:
WHERE
predefined macro. __LINE__
or WHERE
macros. See the examples for LogMessage and in (see (file="Logging.h"))Logging.h .
It can be very useful for debugging if you know where a message is coming from.
Definition at line 94 of file LogOrigin.h.
The default constructor sets a null class name, function name, object id, source file name, and sets the line number to zero.
casa::LogOrigin::LogOrigin | ( | const String & | globalFunctionName, |
const SourceLocation * | where = 0 |
||
) |
Use this constructor if the log message origination is from a global function.
Normally where
is provided using the WHERE
macro.
casa::LogOrigin::LogOrigin | ( | const String & | className, |
const String & | memberFuncName, | ||
const SourceLocation * | where = 0 |
||
) |
Use this constructor if the log message origination is from a class member function.
Normally where
is provided using the WHERE
macro.
casa::LogOrigin::LogOrigin | ( | const String & | className, |
const String & | memberFuncName, | ||
const ObjectID & | id, | ||
const SourceLocation * | where = 0 |
||
) |
Use this constructor if the log message origination is from a distributed object (don't worry if you don't know what this means).
Normally where
is provided using the WHERE
macro.
casa::LogOrigin::LogOrigin | ( | const LogOrigin & | other | ) |
Make this
LogOrigin a copy of other
.
const String& casa::LogOrigin::className | ( | ) | const |
LogOrigin& casa::LogOrigin::className | ( | const String & | className | ) |
void casa::LogOrigin::copy_other | ( | const LogOrigin & | other | ) | [private] |
Provide common implementation for copy constructor and assignment operator.
const String& casa::LogOrigin::fileName | ( | ) | const |
LogOrigin& casa::LogOrigin::fileName | ( | const String & | fileName | ) |
String casa::LogOrigin::fullName | ( | ) | const |
Returns class::function
for a member function, or ::function
for a global function.
const String& casa::LogOrigin::functionName | ( | ) | const |
LogOrigin& casa::LogOrigin::functionName | ( | const String & | funcName | ) |
Bool casa::LogOrigin::isUnset | ( | ) | const |
Return true if the line number and file name are not set.
uInt casa::LogOrigin::line | ( | ) | const |
LogOrigin& casa::LogOrigin::line | ( | uInt | which | ) |
String casa::LogOrigin::location | ( | ) | const |
Turns the entire origin except for the ObjectID into a String.
The ObjectID can be turned into a string vie ObjectID::toString.
const ObjectID& casa::LogOrigin::objectID | ( | ) | const |
LogOrigin& casa::LogOrigin::objectID | ( | const ObjectID & | id | ) |
LogOrigin& casa::LogOrigin::sourceLocation | ( | const SourceLocation * | where | ) |
Set the file name and line number at the same time.
Normally where
will be defined with the WHERE
macro.
const String& casa::LogOrigin::taskName | ( | ) | const |
Get or set the corresponding element of the source location.
Note that the "set" functions can be strung together:
LogOrigin where; ..\. where.function("anotherFunc").line(__LINE__);
LogOrigin& casa::LogOrigin::taskName | ( | const String & | funcName | ) |
String casa::LogOrigin::toString | ( | ) | const |
Turn the entire origin into a String.
String casa::LogOrigin::class_p [private] |
Definition at line 174 of file LogOrigin.h.
String casa::LogOrigin::file_p [private] |
Definition at line 177 of file LogOrigin.h.
String casa::LogOrigin::function_p [private] |
Definition at line 173 of file LogOrigin.h.
ObjectID casa::LogOrigin::id_p [private] |
Definition at line 175 of file LogOrigin.h.
uInt casa::LogOrigin::line_p [private] |
Definition at line 176 of file LogOrigin.h.
String casa::LogOrigin::task_p [private] |
Definition at line 172 of file LogOrigin.h.