Public Member Functions | Static Public Member Functions | Public Attributes | Protected Attributes | Static Protected Attributes

Context Struct Reference

#include <utility.h>

Collaboration diagram for Context:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Context (const char *ctx)
 Context (const char *ctx, LPCSTR obj)
 Context (const char *ctx, LPCWSTR obj)
 Context (const Context &other)
 ~Context ()
String toString () const
String getStackTrace () const

Static Public Member Functions

static Contextcurrent ()

Public Attributes

const char * _ctx
String _obj

Protected Attributes

Context_last

Static Protected Attributes

static Contexts_current = &Context::s_main
static Context s_main

Detailed Description

Definition at line 1020 of file utility.h.


Constructor & Destructor Documentation

Context::Context ( const char *  ctx ) [inline]

Definition at line 1022 of file utility.h.

     :  _ctx(ctx)
    {
        _last = s_current;
        s_current = this;
    }
Context::Context ( const char *  ctx,
LPCSTR  obj 
) [inline]

Definition at line 1029 of file utility.h.

     :  _ctx(ctx),
        _obj(obj)
    {
        _last = s_current;
        s_current = this;
    }
Context::Context ( const char *  ctx,
LPCWSTR  obj 
) [inline]

Definition at line 1037 of file utility.h.

     :  _ctx(ctx),
        _obj(obj)
    {
        _last = s_current;
        s_current = this;
    }
Context::Context ( const Context other ) [inline]

Definition at line 1045 of file utility.h.

     :  _ctx(other._ctx),
        _obj(other._obj)
    {
        _last = NULL;
    }
Context::~Context (  ) [inline]

Definition at line 1052 of file utility.h.

    {
        if (_last) {
            s_current = _last;
            _last = NULL;
        }
    }

Member Function Documentation

static Context& Context::current (  ) [inline, static]

Definition at line 1066 of file utility.h.

{return *s_current;}
String Context::getStackTrace (  ) const

Definition at line 140 of file utility.cpp.

References _last, ANS, and s_main.

{
    ostringstream str;

    str << "Context Trace:\n";

    for(const Context*p=this; p && p!=&s_main; p=p->_last) {
        str << "- " << p->_ctx;

        if (!p->_obj.empty())
            str << " obj=" << ANS(p->_obj);

        str << '\n';
    }

    return str.str();
}
String Context::toString (  ) const

Definition at line 130 of file utility.cpp.

References _ctx, _obj, String::appendf(), and TEXT.

Referenced by COMException::toString().

{
    String str = _ctx;

    if (!_obj.empty())
        str.appendf(TEXT("\nObject: %s"), (LPCTSTR)_obj);

    return str;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

const char* Context::_ctx

Definition at line 1063 of file utility.h.

Referenced by toString().

Context* Context::_last [protected]

Definition at line 1069 of file utility.h.

Referenced by getStackTrace().

Definition at line 1064 of file utility.h.

Referenced by toString().

Context * Context::s_current = &Context::s_main [static, protected]

Definition at line 1071 of file utility.h.

Context Context::s_main [static, protected]
Todo:
use TLS

Definition at line 1072 of file utility.h.

Referenced by getStackTrace().


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

ROS Explorer Source Code Documentation
generated on 02.01.2013 by doxygen

ROS Explorer Homepage