/[ascend]/trunk/pygtk/registry.cpp
ViewVC logotype

Contents of /trunk/pygtk/registry.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 900 - (show annotations) (download) (as text)
Wed Oct 25 06:03:04 2006 UTC (13 years, 3 months ago) by johnpye
File MIME type: text/x-c++src
File size: 874 byte(s)
The 'sim' object is correctly accessible from script methods now, even if run during on_load.
Added 'getSimulation' to registry.cpp, added 'runDefaultMethod' to Simulation, added 'getMethod' to Type.
Running of 'on_load' is instigated at the Python level now, so that relevent python variables are set at simulations are built, etc. This appears to have cause some changes to the way the solver behaves, possibly.
Added SearchProcList to exports in libascend.

1 #include "registry.h"
2
3 extern "C"{
4 #include <compiler/importhandler.h>
5 }
6
7 #include <stdexcept>
8
9 void
10 Registry::setInteger(const char *key, int val){
11 importhandler_setsharedpointer(key,(void *)val);
12 }
13
14 void
15 Registry::setPointer(const char *key, void *val){
16 importhandler_setsharedpointer(key,val);
17 }
18
19 Instanc *
20 Registry::getInstance(const char *key){
21 return new Instanc((struct Instance*)importhandler_getsharedpointer(key));
22 }
23
24 Simulation &
25 Registry::getSimulation(const char *key){
26 // how dangerous is this!
27 Simulation *s = (Simulation *)importhandler_getsharedpointer(key);
28 if(s==NULL){
29 throw std::runtime_error("Simulation pointer was NULL");
30 }
31 CONSOLE_DEBUG("Pointer value is %p",s);
32 return (Simulation &)(*s);
33 }
34
35 #ifdef ASCXX_USE_PYTHON
36
37 void
38 Registry::setPyObject(const char *key, PyObject *val){
39 importhandler_setsharedpointer(key,(void *)val);
40 }
41
42 #endif

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