Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

rutz::error_context Class Reference

#include <rutz/error_context.h>

Collaboration diagram for rutz::error_context:

Collaboration graph
[legend]
List of all members.

Detailed Description

Don't use this class directly; use the GVX_ERR_CONTEXT() macro instead.

Definition at line 46 of file error_context.h.

Public Member Functions

 error_context ()
 Constructor (but use current() to get the current context).
 ~error_context ()
 Destructor.
bool add_entry (const error_context_entry *e)
 Add an entry to the context stack.
void remove_entry (const error_context_entry *e)
 Remove an entry from the context stack.
rutz::fstring get_text () const
 get the text of all context entries, separated by newlines
template<class S>
void prepend_to (S &str) const
 Prepend our message (if any) to the given string.

Static Public Member Functions

static const rutz::error_contextcurrent ()
 Get the current thread-local error context object.


Constructor & Destructor Documentation

rutz::error_context::error_context  ) 
 

Constructor (but use current() to get the current context).

Definition at line 92 of file error_context.cc.

rutz::error_context::~error_context  ) 
 

Destructor.

Definition at line 94 of file error_context.cc.


Member Function Documentation

bool rutz::error_context::add_entry const error_context_entry e  ) 
 

Add an entry to the context stack.

Definition at line 101 of file error_context.cc.

References rutz::static_stack< T, N >::push().

Referenced by rutz::error_context_entry::error_context_entry().

const rutz::error_context & rutz::error_context::current  )  [static]
 

Get the current thread-local error context object.

Definition at line 96 of file error_context.cc.

References GVX_DBG_REGISTER::get_current_context().

Referenced by sendlog_aux().

rutz::fstring rutz::error_context::get_text  )  const
 

get the text of all context entries, separated by newlines

Definition at line 112 of file error_context.cc.

References i, and rutz::static_stack< T, N >::size().

Referenced by prepend_to().

template<class S>
void rutz::error_context::prepend_to S &  str  )  const [inline]
 

Prepend our message (if any) to the given string.

This function is a template that is designed to work with either std::string or rutz::fstring (but without naming std::string explicitly here, we can avoid needing to include the 50K lines of code from <string>).

Example usage:

      std::string mymsg = "something bad happened";
      rutz::error_context::current().prepend_to(mymsg);

Definition at line 81 of file error_context.h.

References rutz::fstring::c_str(), get_text(), and rutz::fstring::length().

Referenced by sendlog_aux().

void rutz::error_context::remove_entry const error_context_entry e  ) 
 

Remove an entry from the context stack.

Definition at line 106 of file error_context.cc.

References GVX_ASSERT, rutz::static_stack< T, N >::pop(), and rutz::static_stack< T, N >::top().

Referenced by rutz::error_context_entry::~error_context_entry().


The documentation for this class was generated from the following files:
Generated on Sun Nov 22 13:51:42 2009 for iLab Neuromorphic Vision Toolkit by  doxygen 1.4.4