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

Diff of /trunk/pygtk/registry.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 869 by johnpye, Wed Oct 4 14:03:46 2006 UTC revision 900 by johnpye, Wed Oct 25 06:03:04 2006 UTC
# Line 4  extern "C"{ Line 4  extern "C"{
4  #include <compiler/importhandler.h>  #include <compiler/importhandler.h>
5  }  }
6    
7    #include <stdexcept>
8    
9  void  void
10  Registry::setInteger(const char *key, int val){  Registry::setInteger(const char *key, int val){
11      importhandler_setsharedpointer(key,(void *)val);      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  #ifdef ASCXX_USE_PYTHON
36    
37  void  void

Legend:
Removed from v.869  
changed lines
  Added in v.900

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