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

Annotation of /trunk/pygtk/registry.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 900 - (hide annotations) (download) (as text)
Wed Oct 25 06:03:04 2006 UTC (13 years, 11 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 johnpye 869 #include "registry.h"
2    
3     extern "C"{
4     #include <compiler/importhandler.h>
5     }
6    
7 johnpye 900 #include <stdexcept>
8    
9 johnpye 869 void
10     Registry::setInteger(const char *key, int val){
11     importhandler_setsharedpointer(key,(void *)val);
12     }
13    
14 johnpye 875 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 johnpye 900 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 johnpye 869 #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