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

Contents of /trunk/ascxx/registry.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2327 - (show annotations) (download) (as text)
Wed Dec 22 07:17:24 2010 UTC (13 years, 8 months ago) by jpye
File MIME type: text/x-c++src
File size: 883 byte(s)
Merging in refactor of the C++ code, which is moved out of 'pygtk' and into 'ascxx'.
Adding support for IPOPT 3.9.1, the current latest version.
Support in dtar for parallel builds (possibly needs some testing still).
1 #include "registry.h"
2
3 extern "C"{
4 #include <ascend/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("Simulation 'sim' = %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