Loading...
Searching...
No Matches
casacore::LogOrigin Class Reference
casa package (libcasa_casa) » Logging_module

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)
| Use this constructor if the log message origination is from a global function.
| LogOrigin (const String &globalFunctionName, const SourceLocation &where)
| LogOrigin (const String &className, const String &memberFuncName)
| Use this constructor if the log message origination is from a class member function.
| LogOrigin (const String &className, const String &memberFuncName, const SourceLocation &where)
| LogOrigin (const String &className, const String &memberFuncName, const ObjectID &id)
| 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 String &className, const String &memberFuncName, const ObjectID &id, const SourceLocation &where)
| 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

String | getNode ()
| Return a String with the MPI rank.
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
String | node_p

## Detailed Description

LogOrigin: The source code location of the originator of a LogMessage.

### Intended use:

Public interface

### Review Status

Reviewed By:
  wbrouw
Date Reviewed:
  1996/08/21
Test programs:
  tLogging
Demo programs:
  dLogging

### Prerequisite

- ObjectID if you are interested in logging from Distributed Objects (don't worry if you don't know what that means - in that case ignore it!).

### Etymology

Log[message] Origin[ation point].

### Synopsis

The LogOriging class is used to record the location at which a LogMessage originates. It consists of:

- A class name, which is blank in the case of a global function.
- A function name - global or member. You should "cut and paste" not only the function name, but also the arguments (but not the return type) to ensure that the function name is unique in the face of overloading.
- A source file name, usually filled in with the WHERE predefined macro.
- A line number, usually filled in with the LINE or WHERE macros.
- An ObjectID if the log message comes from a distributed object (if you don't know what this means, you don't need to worry about it).
- Eventually we may want to canonicalize the path in the filename.

### Example

See the examples for LogMessage and in (see (file="Logging.h"))Logging.h.

### Motivation

It can be very useful for debugging if you know where a message is coming from.

### To Do

- Nothing known

Definition at line 91 of file LogOrigin.h.

## Constructor & Destructor Documentation

## LogOrigin() [1/8]

casacore::LogOrigin::LogOrigin | ( |  | ) |

The default constructor sets a null class name, function name, object id, source file name, and sets the line number to zero.

Referenced by className(), copy_other(), fileName(), functionName(), line(), LogOrigin(), objectID(), operator=(), sourceLocation(), and taskName().

## LogOrigin() [2/8]

casacore::LogOrigin::LogOrigin | ( | const String & | globalFunctionName | ) |

Use this constructor if the log message origination is from a global function.

Normally where is provided using the WHERE macro.

## LogOrigin() [3/8]

casacore::LogOrigin::LogOrigin | ( | const String & | globalFunctionName,
|  | const SourceLocation & | where )

## LogOrigin() [4/8]

casacore::LogOrigin::LogOrigin | ( | const String & | className,
|  | const String & | memberFuncName )

Use this constructor if the log message origination is from a class member function.

Normally where is provided using the WHERE macro.

References className().

## LogOrigin() [5/8]

casacore::LogOrigin::LogOrigin | ( | const String & | className,
|  | const String & | memberFuncName,
|  | const SourceLocation & | where )

References className().

## LogOrigin() [6/8]

casacore::LogOrigin::LogOrigin | ( | const String & | className,
|  | const String & | memberFuncName,
|  | const ObjectID & | id )

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.

References className().

## LogOrigin() [7/8]

casacore::LogOrigin::LogOrigin | ( | const String & | className,
|  | const String & | memberFuncName,
|  | const ObjectID & | id,
|  | const SourceLocation & | where )

References className().

## LogOrigin() [8/8]

casacore::LogOrigin::LogOrigin | ( | const LogOrigin & | other | ) |

Make this LogOrigin a copy of other.

References LogOrigin().

## ~LogOrigin()

casacore::LogOrigin::~LogOrigin | ( |  | ) |

## Member Function Documentation

## className() [1/2]

const String & casacore::LogOrigin::className | ( |  | ) | const

Referenced by className(), LogOrigin(), LogOrigin(), LogOrigin(), and LogOrigin().

## className() [2/2]

LogOrigin & casacore::LogOrigin::className | ( | const String & | className | ) |

References className(), and LogOrigin().

## copy_other()

void casacore::LogOrigin::copy_other | ( | const LogOrigin & | other | ) |

private

Provide common implementation for copy constructor and assignment operator.

References LogOrigin().

## fileName() [1/2]

const String & casacore::LogOrigin::fileName | ( |  | ) | const

Referenced by fileName().

## fileName() [2/2]

LogOrigin & casacore::LogOrigin::fileName | ( | const String & | fileName | ) |

References fileName(), and LogOrigin().

## fullName()

String casacore::LogOrigin::fullName | ( |  | ) | const

Returns class::function for a member function, or ::function for a global function.

## functionName() [1/2]

const String & casacore::LogOrigin::functionName | ( |  | ) | const

## functionName() [2/2]

LogOrigin & casacore::LogOrigin::functionName | ( | const String & | funcName | ) |

References LogOrigin().

## getNode()

String casacore::LogOrigin::getNode | ( |  | ) |

private

Return a String with the MPI rank.

## isUnset()

Bool casacore::LogOrigin::isUnset | ( |  | ) | const

Return true if the line number and file name are not set.

## line() [1/2]

uInt casacore::LogOrigin::line | ( |  | ) | const

## line() [2/2]

LogOrigin & casacore::LogOrigin::line | ( | uInt | which | ) |

References LogOrigin().

## location()

String casacore::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.

## objectID() [1/2]

const ObjectID & casacore::LogOrigin::objectID | ( |  | ) | const

## objectID() [2/2]

LogOrigin & casacore::LogOrigin::objectID | ( | const ObjectID & | id | ) |

References LogOrigin().

## operator=()

LogOrigin & casacore::LogOrigin::operator= | ( | const LogOrigin & | other | ) |

References LogOrigin().

## sourceLocation()

LogOrigin & casacore::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.

References LogOrigin().

## taskName() [1/2]

const String & casacore::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__);
casacore::LogOrigin::LogOrigin
LogOrigin()
The default constructor sets a null class name, function name, object id, source file name,...
casacore::LogOrigin::line
uInt line() const

## taskName() [2/2]

LogOrigin & casacore::LogOrigin::taskName | ( | const String & | funcName | ) |

References LogOrigin().

## toString()

String casacore::LogOrigin::toString | ( |  | ) | const

Turn the entire origin into a String.

## Member Data Documentation

## class_p

String casacore::LogOrigin::class_p

private

Definition at line 177 of file LogOrigin.h.

## file_p

String casacore::LogOrigin::file_p

private

Definition at line 180 of file LogOrigin.h.

## function_p

String casacore::LogOrigin::function_p

private

Definition at line 176 of file LogOrigin.h.

## id_p

ObjectID casacore::LogOrigin::id_p

private

Definition at line 178 of file LogOrigin.h.

## line_p

uInt casacore::LogOrigin::line_p

private

Definition at line 179 of file LogOrigin.h.

## node_p

String casacore::LogOrigin::node_p

private

Definition at line 181 of file LogOrigin.h.

## task_p

String casacore::LogOrigin::task_p

private

Definition at line 175 of file LogOrigin.h.

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

- casa/Logging/LogOrigin.h