Comment debug output in the new template Python wrapper.
This commit is contained in:
parent
6583efd485
commit
0712b2d44b
|
@ -211,8 +211,8 @@ namespace Isobar3 {
|
|||
PyTypeObject* ob_type = manager->_getTypeObject();
|
||||
ob_type->tp_iter = (getiterfunc)&::Isobar3::_tpIter;
|
||||
|
||||
std::cerr << "Add to manager: <"
|
||||
<< ::Hurricane::demangle(typeid( Hurricane::Collection<CppT*> )) << ">" << std::endl;
|
||||
//std::cerr << "Add to manager: <"
|
||||
// << ::Hurricane::demangle(typeid( Hurricane::Collection<CppT*> )) << ">" << std::endl;
|
||||
PyTypeManager::add< Hurricane::Collection<CppT*> >
|
||||
( module, manager, typeid(Hurricane::Collection<CppT*>).hash_code() );
|
||||
PyTypeManagerLocator<CppT>::create( module, flags );
|
||||
|
|
|
@ -117,7 +117,7 @@ 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 <<endl;
|
||||
//cerr << "elementName: " << elementName <<endl;
|
||||
string keyName = ::Hurricane::demangle(typeid(CppK));
|
||||
cppScope = keyName.find_last_of( "::" );
|
||||
if (cppScope != std::string::npos) keyName = keyName.substr( cppScope+1 );
|
||||
|
@ -218,9 +218,9 @@ namespace Isobar3 {
|
|||
template< typename CppK, typename CppT >
|
||||
PyObject* PyTypeManagerMap<CppK,CppT>::_getMpSubscript ( PyObject* self, PyObject* pyKey )
|
||||
{
|
||||
std::cerr << "PyTypeManagerMap<CppK,CppT>::_getMpSubscript" << endl;
|
||||
std::cerr << "CppK: " << demangle(typeid(CppK)) << std::endl;
|
||||
std::cerr << "CppT: " << demangle(typeid(CppT)) << std::endl;
|
||||
//std::cerr << "PyTypeManagerMap<CppK,CppT>::_getMpSubscript" << endl;
|
||||
//std::cerr << "CppK: " << demangle(typeid(CppK)) << std::endl;
|
||||
//std::cerr << "CppT: " << demangle(typeid(CppT)) << std::endl;
|
||||
std::map<CppK,CppT>* pmap = NULL;
|
||||
if (not pyToC(self,&pmap)) {
|
||||
std::string message = "PyTypeManagerMap<CppK,CppT>::_getMpSubscript(): pyToC<> failed. \".";
|
||||
|
@ -228,7 +228,7 @@ namespace Isobar3 {
|
|||
return NULL;
|
||||
}
|
||||
CppK key;
|
||||
std::cerr << "extracting key, type: " << demangle(typeid(CppK)) << std::endl;
|
||||
//std::cerr << "extracting key, type: " << demangle(typeid(CppK)) << std::endl;
|
||||
if (not pyToC( pyKey, &key )) {
|
||||
std::string message = "PyTypeManagerMap<CppK,CppT>::_getMpSubscript(): Unable to convert key.";
|
||||
PyErr_SetString( HurricaneError, message.c_str() );
|
||||
|
@ -266,10 +266,9 @@ namespace Isobar3 {
|
|||
template< typename CppK, typename CppT >
|
||||
PyTypeManagerMap<CppK,CppT>* PyTypeManagerMap<CppK,CppT>::create ( PyObject* module, uint64_t flags )
|
||||
{
|
||||
cerr << "PyTypeManagerMap<"
|
||||
<< ::Hurricane::demangle(typeid(std::map<CppK,CppT>)) << ">::create()" << endl;
|
||||
|
||||
cerr << "CppK: " << demangle(typeid(CppK)) << endl <<" CppT: " << demangle(typeid(CppT)) << endl;
|
||||
// cerr << "PyTypeManagerMap<"
|
||||
// << ::Hurricane::demangle(typeid(std::map<CppK,CppT>)) << ">::create()" << endl;
|
||||
// cerr << "CppK: " << demangle(typeid(CppK)) << endl <<" CppT: " << demangle(typeid(CppT)) << endl;
|
||||
|
||||
PyTypeManagerMap<CppK,CppT>* manager = new PyTypeManagerMap<CppK,CppT>( flags );
|
||||
|
||||
|
|
|
@ -435,12 +435,12 @@ extern "C" {
|
|||
template< typename CppT >
|
||||
inline PyObject* PyTypeManager::link ( CppT* object )
|
||||
{
|
||||
std::cerr << "PyTypeManager<CppT>::link() " << demangle(typeid(CppT).name())
|
||||
<< "* object = " << (void*)object << ":" << object << std::endl;
|
||||
// std::cerr << "PyTypeManager<CppT>::link() " << demangle(typeid(CppT).name())
|
||||
// << "* object = " << (void*)object << ":" << object << std::endl;
|
||||
if (not object) Py_RETURN_NONE;
|
||||
PyTypeManagerVTrunk<CppT>* manager = dynamic_cast< PyTypeManagerVTrunk<CppT>* >( _get<CppT>() );
|
||||
std::cerr << "_get<CppT>()=" << _get<CppT>() << endl;
|
||||
std::cerr << demangle(typeid(PyTypeManagerVTrunk<CppT>*).name()) << endl;
|
||||
// std::cerr << "_get<CppT>()=" << _get<CppT>() << endl;
|
||||
// std::cerr << demangle(typeid(PyTypeManagerVTrunk<CppT>*).name()) << endl;
|
||||
if (not manager)
|
||||
throw Error( "PyTypeManager<CppT>::link(): No manager for type <%s>."
|
||||
, demangle(typeid(CppT).name()).c_str() );
|
||||
|
@ -1584,7 +1584,7 @@ template< typename T
|
|||
, typename std::enable_if< !std::is_pointer<T>::value, bool >::type = true >
|
||||
inline bool pyToC ( PyObject* pyArg, T* arg )
|
||||
{
|
||||
std::cerr << "template< typename T , typename std::enable_if< !std::is_pointer<T>::value, bool >::type = true > pyToC( PyObject* pyArg, T* arg ) " << " T = " << demangle(typeid(T).name()) <<std::endl;
|
||||
// std::cerr << "template< typename T , typename std::enable_if< !std::is_pointer<T>::value, bool >::type = true > pyToC( PyObject* pyArg, T* arg ) " << " T = " << demangle(typeid(T).name()) <<std::endl;
|
||||
typedef typename std::remove_cv<T>::type NonConstT;
|
||||
Isobar3::PyTypeManager* manager = Isobar3::PyTypeManager::_get<T>();
|
||||
if (not manager) {
|
||||
|
@ -1600,14 +1600,14 @@ inline bool pyToC ( PyObject* pyArg, T* arg )
|
|||
template<typename T>
|
||||
inline bool pyToC ( PyObject* pyArg, T** arg )
|
||||
{
|
||||
std::cerr << "template<typename T> pyToC( PyObject* pyArg, T** arg ) " << " T = " << demangle(typeid(T).name()) <<std::endl;
|
||||
// std::cerr << "template<typename T> pyToC( PyObject* pyArg, T** arg ) " << " T = " << demangle(typeid(T).name()) <<std::endl;
|
||||
|
||||
Isobar3::PyTypeManager* manager = Isobar3::PyTypeManager::_get<T>();
|
||||
if (not manager) {
|
||||
std::cerr << "Isobar3::pyToC<T>(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 "<<std::endl;
|
||||
return true;
|
||||
|
@ -1707,12 +1707,12 @@ namespace Isobar3 {
|
|||
const std::string nth[] = { "First", "Second" , "Third", "Fourth", "Fifth"
|
||||
, "Sixth", "Seventh", "Eight", "Ninth" , "Tenth" };
|
||||
|
||||
std::cerr << "Calling pyToC<" << demangle(typeid(typename Arg<T>::ValueT).name()) << ">" << std::endl;
|
||||
std::cerr << "Calling pyToC<" << demangle(typeid(&(as<T>( args[count]))).name()) << ">" << std::endl;
|
||||
// std::cerr << "Calling pyToC<" << demangle(typeid(typename Arg<T>::ValueT).name()) << ">" << std::endl;
|
||||
// std::cerr << "Calling pyToC<" << demangle(typeid(&(as<T>( args[count]))).name()) << ">" << std::endl;
|
||||
//success = success and pyToC< typename Arg<T>::ValueT >( pyArgs[count]
|
||||
// , &(as<T>( args[count])) );
|
||||
success = success and pyToC( pyArgs[count], &(as<T>( 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() );
|
||||
|
|
Loading…
Reference in New Issue