strusBase  0.17
Public Member Functions | List of all members
strus::LocalErrorBuffer Class Reference

Error buffer implementation for a context transforming the error message into an exceptions at the end of its scope. More...

#include <localErrorBuffer.hpp>

Inheritance diagram for strus::LocalErrorBuffer:
strus::ErrorBufferInterface

Public Member Functions

 LocalErrorBuffer ()
 
virtual ~LocalErrorBuffer ()
 
virtual void setLogFile (FILE *)
 Define error log file. More...
 
virtual bool setMaxNofThreads (unsigned int)
 Redefine the maximum number of threads using the error buffer. More...
 
virtual void report (int errorcode, const char *format,...)
 Report an error. More...
 
virtual void explain (const char *format)
 Report an error, overwriting the previous error. More...
 
virtual const char * fetchError ()
 Check, if an error has occurred and return it. More...
 
virtual bool hasError () const
 Check, if an error has occurred. More...
 
virtual void allocContext ()
 Allocate context for current thread. More...
 
virtual void releaseContext ()
 Dellocate context for current thread. More...
 
virtual DebugTraceInterfacedebugTrace () const
 Fetches the debug trace interface if defined. More...
 
int errorCode () const
 
- Public Member Functions inherited from strus::ErrorBufferInterface
virtual ~ErrorBufferInterface ()
 Destructor. More...
 

Additional Inherited Members

- Public Types inherited from strus::ErrorBufferInterface
enum  ErrorClass { None, RuntimeError, BadAlloc }
 

Detailed Description

Error buffer implementation for a context transforming the error message into an exceptions at the end of its scope.

Constructor & Destructor Documentation

strus::LocalErrorBuffer::LocalErrorBuffer ( )
inline
virtual strus::LocalErrorBuffer::~LocalErrorBuffer ( )
inlinevirtual

Member Function Documentation

virtual void strus::LocalErrorBuffer::allocContext ( )
inlinevirtual

Allocate context for current thread.

Remarks
allocContext & releaseContext have only to be called if assignement of thread ids is not fix

Implements strus::ErrorBufferInterface.

virtual DebugTraceInterface* strus::LocalErrorBuffer::debugTrace ( ) const
inlinevirtual

Fetches the debug trace interface if defined.

Returns
the debug trace interface if defined, NULL else

Implements strus::ErrorBufferInterface.

int strus::LocalErrorBuffer::errorCode ( ) const
inline
virtual void strus::LocalErrorBuffer::explain ( const char *  format)
inlinevirtual

Report an error, overwriting the previous error.

Parameters
[in]formaterror message format string
Remarks
must not throw

Implements strus::ErrorBufferInterface.

virtual const char* strus::LocalErrorBuffer::fetchError ( )
inlinevirtual

Check, if an error has occurred and return it.

Returns
an error string, if defined, NULL else
Remarks
resets the error

Implements strus::ErrorBufferInterface.

virtual bool strus::LocalErrorBuffer::hasError ( ) const
inlinevirtual

Check, if an error has occurred.

Returns
an error string, if defined, NULL else

Implements strus::ErrorBufferInterface.

virtual void strus::LocalErrorBuffer::releaseContext ( )
inlinevirtual

Dellocate context for current thread.

Remarks
allocContext & releaseContext have only to be called if assignement of thread ids is not fix

Implements strus::ErrorBufferInterface.

virtual void strus::LocalErrorBuffer::report ( int  errorcode,
const char *  format,
  ... 
)
inlinevirtual

Report an error.

Parameters
[in]errorcodeerror code of the error (errno and beyond)
Note
See include/strus/errorCodes.hpp
Parameters
[in]formaterror message format string
Remarks
must not throw

Implements strus::ErrorBufferInterface.

virtual void strus::LocalErrorBuffer::setLogFile ( FILE *  hnd)
inlinevirtual

Define error log file.

Parameters
[in]hndfile handle to set as log file
Remarks
not thread safe, assumed not to be called outside the main process initialization phase

Implements strus::ErrorBufferInterface.

virtual bool strus::LocalErrorBuffer::setMaxNofThreads ( unsigned  maxNofThreads)
inlinevirtual

Redefine the maximum number of threads using the error buffer.

Parameters
[in]maxNofThreadsnumber of threads
Remarks
not thread safe, may invalidate all objects dependent on this, assumed not to be called outside the main process initialization phase

Implements strus::ErrorBufferInterface.


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