diff --git a/crlcore/src/ccore/AllianceFramework.cpp b/crlcore/src/ccore/AllianceFramework.cpp index ac53b209..1735e0af 100644 --- a/crlcore/src/ccore/AllianceFramework.cpp +++ b/crlcore/src/ccore/AllianceFramework.cpp @@ -63,6 +63,8 @@ namespace CRL { , _parentLibrary(NULL) , _routingGauges() { + //cerr << "AllianceFramework::AllianceFramework()" << endl; + // Triggers System singleton loading. System::get (); diff --git a/crlcore/src/ccore/Utilities.cpp b/crlcore/src/ccore/Utilities.cpp index a547f508..1aef5391 100644 --- a/crlcore/src/ccore/Utilities.cpp +++ b/crlcore/src/ccore/Utilities.cpp @@ -237,6 +237,23 @@ namespace CRL { bfs::path sysConfDir ( SYS_CONF_DIR ); if ( not sysConfDir.has_root_path() ) { if ( arguments.count("coriolis_top") ) { + // const boptions::variable_value& value = arguments["coriolis_top"]; + // cerr << "value:" + // << " empty:" << boolalpha << value.empty() + // << " defaulted:" << boolalpha << value.defaulted() + // << endl; + // const type_info& info = value.value().type(); + // cerr << "type_info:" << info.name() + // << " vs. " << typeid(string).name() << endl; + // cerr << "Equal:" << boolalpha << (info == typeid(std::string)) << endl; + + // const type_info& info2 = typeid(string); + // cerr << (void*)&(typeid(string)) + // << " vs. " << (void*)&info2 + // << " vs. " << (void*)&info + // << endl; + // cerr << "any_cast:" << boost::any_cast(value.value()) << endl; + sysConfDir = arguments["coriolis_top"].as() / sysConfDir; } else { cerr << Error("Environment variable CORIOLIS_TOP not set," diff --git a/crlcore/src/pyCRL/PyAllianceFramework.cpp b/crlcore/src/pyCRL/PyAllianceFramework.cpp index 9e5f4dc7..cb24607a 100644 --- a/crlcore/src/pyCRL/PyAllianceFramework.cpp +++ b/crlcore/src/pyCRL/PyAllianceFramework.cpp @@ -65,6 +65,26 @@ extern "C" { #if defined(__PYTHON_MODULE__) + static PyObject* PyAllianceFramework_get ( PyObject* ) + { + trace << "PyAllianceFramework_get()" << endl; + + AllianceFramework* af = NULL; + PyAllianceFramework* pyAf = NULL; + + HTRY + af = AllianceFramework::get (); + + pyAf = PyObject_NEW ( PyAllianceFramework, &PyTypeAllianceFramework ); + if ( pyAf == NULL ) return NULL; + + pyAf->_object = af; + HCATCH + + return (PyObject*)pyAf; + } + + extern PyObject* PyAllianceFramework_getLibrary ( PyAllianceFramework* self, PyObject* args ) { trace << "PyAllianceFramework_getLibrary ()" << endl; @@ -160,12 +180,18 @@ extern "C" { PyMethodDef PyAllianceFramework_Methods[] = - { { "getLibrary" , (PyCFunction)PyAllianceFramework_getLibrary, METH_VARARGS, "Gets a Library, by index." } - , { "getCell" , (PyCFunction)PyAllianceFramework_getCell , METH_VARARGS, "Gets an Alliance Cell." } - , { "saveCell" , (PyCFunction)PyAllianceFramework_saveCell , METH_VARARGS, "Saves an Alliance Cell." } - , { "createCell" , (PyCFunction)PyAllianceFramework_createCell, METH_VARARGS, "Create a Cell in the Alliance framework." } - //, { "destroy" , (PyCFunction)PyAllianceFramework_destroy , METH_NOARGS - // , "Destroy the associated hurricane object. The python object remains." } + { { "get" , (PyCFunction)PyAllianceFramework_get , METH_NOARGS|METH_STATIC + , "Gets the Alliance Framework." } + , { "getLibrary" , (PyCFunction)PyAllianceFramework_getLibrary, METH_VARARGS + , "Gets a Library, by index." } + , { "getCell" , (PyCFunction)PyAllianceFramework_getCell , METH_VARARGS + , "Gets an Alliance Cell." } + , { "saveCell" , (PyCFunction)PyAllianceFramework_saveCell , METH_VARARGS + , "Saves an Alliance Cell." } + , { "createCell" , (PyCFunction)PyAllianceFramework_createCell, METH_VARARGS + , "Create a Cell in the Alliance framework." } + //, { "destroy" , (PyCFunction)PyAllianceFramework_destroy , METH_NOARGS + // , "Destroy the associated hurricane object. The python object remains." } , {NULL, NULL, 0, NULL} /* sentinel */ }; @@ -182,26 +208,6 @@ extern "C" { // x=================================================================x - PyObject* PyAllianceFramework_get ( PyObject *module ) - { - trace << "PyAllianceFramework_get()" << endl; - - AllianceFramework* af = NULL; - PyAllianceFramework* pyAf = NULL; - - HTRY - af = AllianceFramework::get (); - - pyAf = PyObject_NEW ( PyAllianceFramework, &PyTypeAllianceFramework ); - if ( pyAf == NULL ) return NULL; - - pyAf->_object = af; - HCATCH - - return (PyObject*)pyAf; - } - - // Link/Creation Method. PyTypeObjectDefinitions(AllianceFramework) diff --git a/crlcore/src/pyCRL/PyCRL.cpp b/crlcore/src/pyCRL/PyCRL.cpp index 49474a6d..7b025773 100644 --- a/crlcore/src/pyCRL/PyCRL.cpp +++ b/crlcore/src/pyCRL/PyCRL.cpp @@ -65,9 +65,7 @@ extern "C" { static PyMethodDef PyCRL_Methods[] = - { { "getAllianceFramework", (PyCFunction)PyAllianceFramework_get, METH_NOARGS - , "Gets the Alliance Framework." } - , { "createPartRing" , (PyCFunction)PyToolBox_createPartRing, METH_VARARGS + { { "createPartRing" , (PyCFunction)PyToolBox_createPartRing, METH_VARARGS , "Partial build of a ring" } , {NULL, NULL, 0, NULL} /* sentinel */ }; @@ -103,12 +101,16 @@ extern "C" { Py_INCREF ( &PyTypeCatalog ); PyModule_AddObject ( module, "Catalog", (PyObject*)&PyTypeCatalog ); + Py_INCREF ( &PyTypeAllianceFramework ); + PyModule_AddObject ( module, "AllianceFramework", (PyObject*)&PyTypeAllianceFramework ); PyCatalog_postModuleInit (); PyObject* dictionnary = PyModule_GetDict ( module ); //DbULoadConstants ( dictionnary ); + + trace << "CRL.so loaded " << (void*)&typeid(string) << endl; } diff --git a/crlcore/src/pyCRL/crlcore/PyAllianceFramework.h b/crlcore/src/pyCRL/crlcore/PyAllianceFramework.h index 5135e95a..5684497f 100644 --- a/crlcore/src/pyCRL/crlcore/PyAllianceFramework.h +++ b/crlcore/src/pyCRL/crlcore/PyAllianceFramework.h @@ -51,7 +51,6 @@ extern "C" { extern PyTypeObject PyTypeAllianceFramework; extern PyMethodDef PyAllianceFramework_Methods[]; - extern PyObject* PyAllianceFramework_get ( PyObject* module ); extern PyObject* PyAllianceFramework_Link ( CRL::AllianceFramework* ); extern void PyAllianceFramework_LinkPyType ();