strusBase  0.17
errorBufferInterface.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 Patrick P. Frey
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7  */
10 #ifndef _STRUS_BASE_ERROR_BUFFER_INTERFACE_HPP_INCLUDED
11 #define _STRUS_BASE_ERROR_BUFFER_INTERFACE_HPP_INCLUDED
12 #include "strus/errorCodes.hpp"
14 #include <cstdio>
15 
17 namespace strus
18 {
19 
25 {
26 public:
28  {
29  None,
32  };
33 
36 
40  virtual void setLogFile( FILE* hnd)=0;
41 
45  virtual bool setMaxNofThreads( unsigned int maxNofThreads)=0;
46 
52  virtual void report( int errorcode, const char* format, ...)
53 #ifdef __GNUC__
54  __attribute__ ((format (printf, 3, 4)))
55 #endif
56  =0;
60  virtual void explain( const char* format)=0;
61 
65  virtual const char* fetchError()=0;
66 
69  virtual bool hasError() const=0;
70 
73  virtual void allocContext()=0;
74 
77  virtual void releaseContext()=0;
78 
81  virtual DebugTraceInterface* debugTrace() const=0;
82 };
83 
84 }//namespace
85 #endif
86 
ErrorClass
Definition: errorBufferInterface.hpp:27
Interface for reporting debug trace messages in a uniform way.
virtual void releaseContext()=0
Dellocate context for current thread.
virtual void report(int errorcode, const char *format,...)=0
Report an error.
memory allocation error
Definition: errorBufferInterface.hpp:31
virtual bool hasError() const =0
Check, if an error has occurred.
virtual void explain(const char *format)=0
Report an error, overwriting the previous error.
Managing interface for reporting debug trace messages in a uniform way.
Definition: debugTraceInterface.hpp:81
virtual const char * fetchError()=0
Check, if an error has occurred and return it.
runtime error
Definition: errorBufferInterface.hpp:30
Interface for reporting and catching errors in modules.
Definition: errorBufferInterface.hpp:24
virtual void allocContext()=0
Allocate context for current thread.
virtual ~ErrorBufferInterface()
Destructor.
Definition: errorBufferInterface.hpp:35
virtual void setLogFile(FILE *hnd)=0
Define error log file.
Structured error codes for strus components.
no error
Definition: errorBufferInterface.hpp:29
virtual DebugTraceInterface * debugTrace() const =0
Fetches the debug trace interface if defined.
virtual bool setMaxNofThreads(unsigned int maxNofThreads)=0
Redefine the maximum number of threads using the error buffer.