diff --git a/hurricane/src/configuration/Configuration.cpp b/hurricane/src/configuration/Configuration.cpp index 7ffef7ce..dce64338 100644 --- a/hurricane/src/configuration/Configuration.cpp +++ b/hurricane/src/configuration/Configuration.cpp @@ -78,7 +78,7 @@ namespace Cfg { Parameter* Configuration::getParameter ( string name, Parameter::Type type ) const { - map::const_iterator iparameter = _parameters.find(name); + map::const_iterator iparameter = _parameters.find(name); if ( iparameter == _parameters.end() ) return NULL; if ( type != Parameter::Unknown ) { diff --git a/hurricane/src/configuration/ConfigurationWidget.cpp b/hurricane/src/configuration/ConfigurationWidget.cpp index c4f7faec..a5a857fb 100644 --- a/hurricane/src/configuration/ConfigurationWidget.cpp +++ b/hurricane/src/configuration/ConfigurationWidget.cpp @@ -172,8 +172,8 @@ namespace Cfg { void ConfigurationWidget::syncSlaves () { - const map& parameters = Configuration::get()->getParameters (); - map::const_iterator iparam = parameters.begin(); + const map& parameters = Configuration::get()->getParameters (); + map::const_iterator iparam = parameters.begin(); for ( ; iparam != parameters.end() ; ++iparam ) { if ( (*iparam).second->getSlaves().empty() ) continue; diff --git a/hurricane/src/configuration/hurricane/configuration/Configuration.h b/hurricane/src/configuration/hurricane/configuration/Configuration.h index c48fbb62..01c7d7e6 100644 --- a/hurricane/src/configuration/hurricane/configuration/Configuration.h +++ b/hurricane/src/configuration/hurricane/configuration/Configuration.h @@ -55,7 +55,7 @@ namespace Cfg { // Methods. ConfigurationWidget* buildWidget ( unsigned int flags ); ConfigurationDialog* buildDialog (); - inline const std::map& + inline const std::map& getParameters () const; const std::set& getLogs ( unsigned int ilog ) const; inline unsigned int getFlags () const; @@ -80,7 +80,7 @@ namespace Cfg { private: // Attributes. static Configuration* _singleton; - std::map _parameters; + std::map _parameters; LayoutDescription _layout; unsigned int _flags; std::map< unsigned int, std::set > _logSets; @@ -90,7 +90,7 @@ namespace Cfg { // Inline Methods. - inline const std::map& Configuration::getParameters () const + inline const std::map& Configuration::getParameters () const { return _parameters; } inline const LayoutDescription& Configuration::getLayout () const { return _layout; } diff --git a/hurricane/src/configuration/hurricane/configuration/PyMap.h b/hurricane/src/configuration/hurricane/configuration/PyMap.h index 3324bb3f..dad38f6e 100644 --- a/hurricane/src/configuration/hurricane/configuration/PyMap.h +++ b/hurricane/src/configuration/hurricane/configuration/PyMap.h @@ -117,10 +117,10 @@ namespace Isobar3 { string elementName = ::Hurricane::demangle(typeid(CppT)); size_t cppScope = elementName.find_last_of( "::" ); if (cppScope != std::string::npos) elementName = elementName.substr( cppScope+1 ); + cerr << "elementName: " << elementName <_setTypeNames( "MapIteratorOf" + elementName + "By" + keyName ); manager->_setupPyType(); PyTypeObject* ob_type = manager->_getTypeObject(); @@ -218,6 +218,9 @@ namespace Isobar3 { template< typename CppK, typename CppT > PyObject* PyTypeManagerMap::_getMpSubscript ( PyObject* self, PyObject* pyKey ) { + std::cerr << "PyTypeManagerMap::_getMpSubscript" << endl; + std::cerr << "CppK: " << demangle(typeid(CppK)) << std::endl; + std::cerr << "CppT: " << demangle(typeid(CppT)) << std::endl; std::map* pmap = NULL; if (not pyToC(self,&pmap)) { std::string message = "PyTypeManagerMap::_getMpSubscript(): pyToC<> failed. \"."; @@ -225,6 +228,7 @@ namespace Isobar3 { return NULL; } CppK key; + std::cerr << "extracting key, type: " << demangle(typeid(CppK)) << std::endl; if (not pyToC( pyKey, &key )) { std::string message = "PyTypeManagerMap::_getMpSubscript(): Unable to convert key."; PyErr_SetString( HurricaneError, message.c_str() ); @@ -262,8 +266,11 @@ namespace Isobar3 { template< typename CppK, typename CppT > PyTypeManagerMap* PyTypeManagerMap::create ( PyObject* module, uint64_t flags ) { - // cerr << "PyTypeManagerMap<" - // << ::Hurricane::demangle(typeid(std::map)) << ">::create()" << endl; + cerr << "PyTypeManagerMap<" + << ::Hurricane::demangle(typeid(std::map)) << ">::create()" << endl; + + cerr << "CppK: " << demangle(typeid(CppK)) << endl <<" CppT: " << demangle(typeid(CppT)) << endl; + PyTypeManagerMap* manager = new PyTypeManagerMap( flags ); string elementName = ::Hurricane::demangle(typeid(CppT)); @@ -280,6 +287,7 @@ namespace Isobar3 { ob_type->tp_as_mapping = &(manager->_mappingMethods); ob_type->tp_iter = (getiterfunc)&::Isobar3::_tpIter; + PyTypeManager::add( module, manager ); PyTypeManager::add< std::map >( module, manager ); PyTypeManagerMapIterator::create( module, flags ); diff --git a/hurricane/src/configuration/hurricane/configuration/PyTypeManager.h b/hurricane/src/configuration/hurricane/configuration/PyTypeManager.h index 8ee4e032..c80e37b0 100644 --- a/hurricane/src/configuration/hurricane/configuration/PyTypeManager.h +++ b/hurricane/src/configuration/hurricane/configuration/PyTypeManager.h @@ -264,6 +264,7 @@ extern "C" { if (element == _managerByPyTypes.end()) throw Error( "PyTypeManager::get(PyTypeObject*): Unregistered type <%s>." , obType->tp_name ); + //std::cerr << "returning element "<< (*element) << " second " << (*element).second << std::endl; return (*element).second; } @@ -434,12 +435,12 @@ extern "C" { template< typename CppT > inline PyObject* PyTypeManager::link ( CppT* object ) { - // std::cerr << "PyTypeManager::link() " << demangle(typeid(CppT).name()) - // << "* object = " << (void*)object << ":" << object << std::endl; + std::cerr << "PyTypeManager::link() " << demangle(typeid(CppT).name()) + << "* object = " << (void*)object << ":" << object << std::endl; if (not object) Py_RETURN_NONE; PyTypeManagerVTrunk* manager = dynamic_cast< PyTypeManagerVTrunk* >( _get() ); - // std::cerr << "_get()=" << _get() << endl; - // std::cerr << demangle(typeid(PyTypeManagerVTrunk*).name()) << endl; + std::cerr << "_get()=" << _get() << endl; + std::cerr << demangle(typeid(PyTypeManagerVTrunk*).name()) << endl; if (not manager) throw Error( "PyTypeManager::link(): No manager for type <%s>." , demangle(typeid(CppT).name()).c_str() ); @@ -1577,11 +1578,13 @@ namespace Isobar3 { // ------------------------------------------------------------------- // Standard Python to C types converters. +using Hurricane::demangle; template< typename T , typename std::enable_if< !std::is_pointer::value, bool >::type = true > inline bool pyToC ( PyObject* pyArg, T* arg ) { + std::cerr << "template< typename T , typename std::enable_if< !std::is_pointer::value, bool >::type = true > pyToC( PyObject* pyArg, T* arg ) " << " T = " << demangle(typeid(T).name()) <::type NonConstT; Isobar3::PyTypeManager* manager = Isobar3::PyTypeManager::_get(); if (not manager) { @@ -1597,13 +1600,16 @@ inline bool pyToC ( PyObject* pyArg, T* arg ) template inline bool pyToC ( PyObject* pyArg, T** arg ) { + std::cerr << "template pyToC( PyObject* pyArg, T** arg ) " << " T = " << demangle(typeid(T).name()) <(); if (not manager) { - std::cerr << "Isobar3::pyToC(T*&): Unsupported type \"" << typeid(T).name() << "\"" << std::endl; + std::cerr << "Isobar3::pyToC(T*&): Unsupported type \"" << demangle(typeid(T).name()) << "\"" << std::endl; return false; } - // std::cerr << "pyToC< " << demangle(typeid(T).name()) << " >() called." << std::endl; + std::cerr << "pyToC< " << demangle(typeid(T).name()) << " >() called." << std::endl; *arg = (T*)( Isobar3::object1( pyArg )); + std::cerr << "returning "<::ValueT).name()) << ">" << std::endl; - //std::cerr << "Calling pyToC<" << demangle(typeid(&(as( args[count]))).name()) << ">" << std::endl; + std::cerr << "Calling pyToC<" << demangle(typeid(typename Arg::ValueT).name()) << ">" << std::endl; + std::cerr << "Calling pyToC<" << demangle(typeid(&(as( args[count]))).name()) << ">" << std::endl; //success = success and pyToC< typename Arg::ValueT >( pyArgs[count] // , &(as( args[count])) ); success = success and pyToC( pyArgs[count], &(as( args[count])) ); - //std::cerr << "success=" << success << std::endl; + std::cerr << "success=" << success << std::endl; if (not success) { message += "\n " + getString(nth) + " X argument is not convertible to \"" + Hurricane::demangle(typeid(T).name()) + "\"."; PyErr_SetString( Isobar3::ConstructorError, message.c_str() );