/[ascend]/trunk/pygtk/interface/reporter.h
ViewVC logotype

Annotation of /trunk/pygtk/interface/reporter.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 387 - (hide annotations) (download) (as text)
Thu Mar 30 05:13:59 2006 UTC (18 years, 3 months ago) by johnpye
File MIME type: text/x-chdr
File size: 1341 byte(s)
Added SConscript for PyGTK interface.
It's not finding the lib files, something wrong with the -L options?
1 johnpye 132 #ifndef ASCXX_REPORTER_H
2     #define ASCXX_REPORTER_H
3    
4     #ifdef ASCXX_USE_PYTHON
5 johnpye 190 # include <Python.h>
6 johnpye 132 #endif
7    
8     #include <cstdarg>
9    
10     extern "C"{
11 johnpye 387 #include <utilities/error.h>
12 johnpye 132 }
13    
14     /**
15     This class provides C++ abstraction of the error.h error callback
16     interface.
17    
18     Initially, it's trying to just handling the conveying of error
19     messages back to python, but it could be used to pass back
20     all sorts of other 'messages' eventually.
21    
22     Maybe raising alerts, notifying of the progress of big tasks, etc.
23    
24     The client_data pointer allows callback context to be set. This will
25     be used to specify which Python function should be used for error
26     reporting, in the case of the Python extension to this class.
27     */
28     class Reporter{
29     private:
30     void *client_data;
31     Reporter(); // This class will be a singleton
32     ~Reporter();
33     static Reporter *_instance;
34     #ifdef ASCXX_USE_PYTHON
35     bool is_python;
36     #endif
37    
38     public:
39     static Reporter *Instance();
40     void setErrorCallback(error_reporter_callback_t, void *client_data=NULL);
41    
42     #ifdef ASCXX_USE_PYTHON
43     void setPythonErrorCallback(PyObject *pyfunc);
44     void clearPythonErrorCallback();
45     int reportErrorPython(ERROR_REPORTER_CALLBACK_ARGS);
46     #endif
47    
48     };
49    
50     Reporter *getReporter();
51    
52     #ifdef ASCXX_USE_PYTHON
53     // Python-invoking callback function
54     int reporter_error_python(ERROR_REPORTER_CALLBACK_ARGS);
55     #endif
56    
57     #endif // ASCXX_REPORTER_H

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22