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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 526 - (show annotations) (download) (as text)
Fri Apr 21 13:47:31 2006 UTC (14 years, 7 months ago) by johnpye
File MIME type: text/x-chdr
File size: 1490 byte(s)
Fixed up a problem with ordering of headers with Python.h.
Removed psyco initialisation, pending evidence that it actually does something :-)
Disabled python 'director' error message callbacks, trying to debug a segfault.
Added ability to disable GCC Visibility, scons WITH_GCCVISIBILITY=0.
Turned off runtime signal tests for SIG_INT and SIG_FPE (makes using GDB a pain), see base/generic/utilities/ascSignal.[ch].
1 #ifndef ASCXX_REPORTER_H
2 #define ASCXX_REPORTER_H
3
4 #include "config.h"
5
6 #ifdef ASCXX_USE_PYTHON
7 # include <Python.h>
8 #endif
9
10 extern "C"{
11 #include <utilities/ascConfig.h>
12 #include <utilities/error.h>
13 }
14
15
16 #ifdef ASCXX_USE_PYTHON
17 extern "C"{
18 /**
19 This function is a hook function that will convey errors
20 back to Python via the C++ 'Reporter' class.
21 */
22 ASC_EXPORT(int) reporter_error_python(ERROR_REPORTER_CALLBACK_ARGS);
23 }
24 #endif
25
26 /**
27 This class provides C++ abstraction of the error.h error callback
28 interface.
29
30 Initially, it's trying to just handling the conveying of error
31 messages back to python, but it could be used to pass back
32 all sorts of other 'messages' eventually.
33
34 Maybe raising alerts, notifying of the progress of big tasks, etc.
35
36 The client_data pointer allows callback context to be set. This will
37 be used to specify which Python function should be used for error
38 reporting, in the case of the Python extension to this class.
39 */
40 class Reporter{
41 private:
42 void *client_data;
43 Reporter(); // This class will be a singleton
44 ~Reporter();
45 static Reporter *_instance;
46 #ifdef ASCXX_USE_PYTHON
47 bool is_python;
48 #endif
49
50 public:
51 static ASC_EXPORT(Reporter *) Instance();
52 void setErrorCallback(error_reporter_callback_t, void *client_data=NULL);
53
54 #ifdef ASCXX_USE_PYTHON
55 void setPythonErrorCallback(PyObject *pyfunc);
56 void clearPythonErrorCallback();
57 int reportErrorPython(ERROR_REPORTER_CALLBACK_ARGS);
58 #endif
59
60 };
61
62 Reporter *getReporter();
63
64 #endif // ASCXX_REPORTER_H

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