15 #include "eckit/log/CodeLocation.h" 22 CodeLocation(
const eckit::CodeLocation& loc ) : loc_( loc ), stored_(
false ) {}
23 CodeLocation(
const char*
file,
int line,
const char*
function,
bool store =
false ) : stored_( store ) {
26 file_str_ = std::string( file );
27 file_ = file_str_.c_str();
30 function_str_ = std::string(
function );
31 function_ = function_str_.c_str();
33 loc_ = eckit::CodeLocation( file_, line, function_ );
36 loc_ = eckit::CodeLocation( file, line,
function );
39 operator const eckit::CodeLocation&()
const {
return loc_; }
42 operator bool()
const {
return loc_; }
44 std::string asString()
const {
return loc_.asString(); }
46 int line()
const {
return loc_.line(); }
48 const char*
file()
const {
return loc_.file(); }
50 const char*
func()
const {
return loc_.func(); }
51 friend std::ostream& operator<<( std::ostream& s,
const CodeLocation& loc );
54 eckit::CodeLocation loc_;
56 const char* file_ =
nullptr;
57 const char* function_ =
nullptr;
58 std::string file_str_;
59 std::string function_str_;
int line() const
accessor to line
Definition: CodeLocation.h:46
const char * file() const
accessor to file
Definition: CodeLocation.h:48
Definition: CodeLocation.h:19
Contains all atlas classes and methods.
Definition: atlas-grids.cc:33
const char * func() const
accessor to function
Definition: CodeLocation.h:50