Commits

bi...@4525493e-7705-40b1-a816-d608a930855b  committed 89d2593

cosmetics

  • Participants
  • Parent commits e5d6e4b

Comments (0)

Files changed (1)

File src/SgPyDataModel.h

      * @param clid The class ID of the wrapped object.
      */
     PyDataBucket( PyObject* obj,
-		  CLID clid );
+                  CLID clid );
 
 
     /**
     virtual void* object() 
     { 
       return m_clid != PyCLID
-	? ObjectProxy_ASVOIDPTR(m_pyObj)
-	: m_pyObj; 
+        ? ObjectProxy_ASVOIDPTR(m_pyObj)
+        : m_pyObj; 
     }
 
 
     {
       PyObject* clid = PyDict_GetItem(m_clids, tp);
       if ( NULL == clid ) {
-	const CLID id = this->clid(tp);
-	if ( id == CLID_NULL ) {
-	  return NULL;
-	}
-	clid = PyLong_FromLong(id);
-	PyDict_SetItem(m_clids, tp, clid);
-	// add reverse look-up entry too
-	PyDict_SetItem(m_clids, clid, tp);
-	//Py_INCREF(clid);
+        const CLID id = this->clid(tp);
+        if ( id == CLID_NULL ) {
+          return NULL;
+        }
+        clid = PyLong_FromLong(id);
+        PyDict_SetItem(m_clids, tp, clid);
+        // add reverse look-up entry too
+        PyDict_SetItem(m_clids, clid, tp);
+        //Py_INCREF(clid);
       }
       return clid;
     }
     {
       PyObject* tp = PyDict_GetItem(m_clids, clid);
       if ( NULL == tp ) {
-	std::string cpp_tp;
-	if (!m_clidSvc->getTypeNameOfID(PyLong_AsUnsignedLong(clid), 
-					cpp_tp).isSuccess()) {
-	  return NULL;
-	}
-	PyObject* alias = PyDict_GetItemString(m_aliases, cpp_tp.c_str());
-	if ( alias ) {
-	  tp = alias;
-	} else {
-	  tp = PyString_FromString(cpp_tp.c_str());
-	}
-	PyDict_SetItem(m_clids, clid, tp);
-	// reverse look-up
-	PyDict_SetItem(m_clids, tp, clid);
-	if (!alias) {
-	  Py_DECREF(tp);
-	}
+        std::string cpp_tp;
+        if (!m_clidSvc->getTypeNameOfID(PyLong_AsUnsignedLong(clid), 
+                                        cpp_tp).isSuccess()) {
+          return NULL;
+        }
+        PyObject* alias = PyDict_GetItemString(m_aliases, cpp_tp.c_str());
+        if ( alias ) {
+          tp = alias;
+        } else {
+          tp = PyString_FromString(cpp_tp.c_str());
+        }
+        PyDict_SetItem(m_clids, clid, tp);
+        // reverse look-up
+        PyDict_SetItem(m_clids, tp, clid);
+        if (!alias) {
+          Py_DECREF(tp);
+        }
       }
       return tp;
     }
       // FIXME: get rid of this massaging when/if ROOT finally
       // standardize on keeping the std:: namespace...
       std::string tn = TClassEdit::ShortType(PyString_AS_STRING(tp),
-					     TClassEdit::kDropAllDefault);
+                                             TClassEdit::kDropAllDefault);
       m_clidSvc->getIDOfTypeName(tn, id).ignore();
       if ( id == CLID_NULL ) {
-	// try an alias...
-	PyObject* alias = PyDict_GetItemString(m_aliases, tn.c_str());
-	if ( alias ){
-	  m_clidSvc->getIDOfTypeName(PyString_AS_STRING(alias), id).ignore();
-	}
+        // try an alias...
+        PyObject* alias = PyDict_GetItemString(m_aliases, tn.c_str());
+        if ( alias ){
+          m_clidSvc->getIDOfTypeName(PyString_AS_STRING(alias), id).ignore();
+        }
       }
       if (id == CLID_NULL) {
-	// then try a type-id name...
-	return this->clid_from_tid (tp);
+        // then try a type-id name...
+        return this->clid_from_tid (tp);
       }
       return id;
     }
       // FIXME: get rid of this massaging when/if ROOT finally
       // standardize on keeping the std:: namespace...
       std::string tn = TClassEdit::ShortType(PyString_AS_STRING(tp),
-					     TClassEdit::kDropAllDefault);
+                                             TClassEdit::kDropAllDefault);
       m_clidSvc->getIDOfTypeInfoName(tn, id).ignore();
       if ( id == CLID_NULL ) {
-	// try an alias...
-	PyObject* alias = PyDict_GetItemString(m_aliases, tn.c_str());
-	if ( alias ){
-	  m_clidSvc->getIDOfTypeInfoName(PyString_AS_STRING(alias), 
-					 id).ignore();
-	}
+        // try an alias...
+        PyObject* alias = PyDict_GetItemString(m_aliases, tn.c_str());
+        if ( alias ){
+          m_clidSvc->getIDOfTypeInfoName(PyString_AS_STRING(alias), 
+                                         id).ignore();
+        }
       }
       return id;
     }
       typedef ClidMap_t::iterator Itr_t;
       Itr_t i = m_clidMap.find(id);
       if (i != m_clidMap.end()) {
-	return i->second.c_str();
+        return i->second.c_str();
       }
       m_clidMap[id] = m_dictSvc->load_type(id).Name(Reflex::SCOPED);
       return m_clidMap[id].c_str();
     {
       const std::string moduleName = "AthenaPython.Bindings";
       PyObject* module = PyImport_ImportModule
-	( const_cast<char*>(moduleName.c_str()) );
+        ( const_cast<char*>(moduleName.c_str()) );
       if ( !module || !PyModule_Check(module) ) {
-	std::cerr << "SG::PyProxyDict WARNING: could not import module '"
-		  << moduleName << "' !\n";
-	Py_XDECREF(module);
-	m_aliases = PyDict_New();
-	return m_aliases;
+        std::cerr << "SG::PyProxyDict WARNING: could not import module '"
+                  << moduleName << "' !\n";
+        Py_XDECREF(module);
+        m_aliases = PyDict_New();
+        return m_aliases;
       }
 
       m_aliases = PyDict_GetItemString(PyModule_GetDict(module),
-				       (char*)"_clid_typename_aliases");
+                                       (char*)"_clid_typename_aliases");
       // borrowed ref. so we increment it
       Py_XINCREF(m_aliases);
       // don't need this one anymore
       Py_DECREF(module);
       
       if ( !m_aliases ) {
-	std::cerr << "SG::PyProxyDict WARNING: could not retrieve the "
-		  << "dictionary of aliases from '"
-		  << moduleName << "' !\n";
-	Py_XDECREF(m_aliases);
-	m_aliases = PyDict_New();
+        std::cerr << "SG::PyProxyDict WARNING: could not retrieve the "
+                  << "dictionary of aliases from '"
+                  << moduleName << "' !\n";
+        Py_XDECREF(m_aliases);
+        m_aliases = PyDict_New();
       }
       return m_aliases;
     }
       PyObject* k = PyTuple_Pack(2, pyclid, pykey);
       PyObject* pyproxy = PyDict_GetItem(m_sgProxies, k);
       if ( NULL == pyproxy ) {
-	CLID id = CLID_NULL;
-	PyArg_Parse( pyclid, "l", &id );
-	const std::string skey = ( pykey == Py_None )
-	  ? ""
-	  : PyString_AS_STRING(pykey);
-	SG::DataProxy* proxy = skey.empty()
-	  ? m_sgSvc->proxy(id)
-	  : m_sgSvc->proxy(id, skey);
-	_SGPY_MSG("PyProxyDict::proxy(" 
-		  << (proxy ? proxy->clID() : id)   << ", "
-		  << (proxy ? proxy->name() : skey) << ")...");
-	pyproxy = TPython::ObjectProxy_FromVoidPtr((void*)proxy, 
-						   "SG::DataProxy");
+        CLID id = CLID_NULL;
+        PyArg_Parse( pyclid, "l", &id );
+        const std::string skey = ( pykey == Py_None )
+          ? ""
+          : PyString_AS_STRING(pykey);
+        SG::DataProxy* proxy = skey.empty()
+          ? m_sgSvc->proxy(id)
+          : m_sgSvc->proxy(id, skey);
+        _SGPY_MSG("PyProxyDict::proxy(" 
+                  << (proxy ? proxy->clID() : id)   << ", "
+                  << (proxy ? proxy->name() : skey) << ")...");
+        pyproxy = TPython::ObjectProxy_FromVoidPtr((void*)proxy, 
+                                                   "SG::DataProxy");
         if (skey.find ("HLTAutoKey") != 0) {
-	  PyDict_SetItem(m_sgProxies, k, pyproxy);
-	}
+          PyDict_SetItem(m_sgProxies, k, pyproxy);
+        }
       }
       Py_DECREF(k);
       _SGPY_MSG("PyProxyDict::proxy(...)... [done]");
     {
       PyObject* obj = PyDict_GetItem( m_objProxies, proxy );
       if ( NULL == obj ) {
-	if ( !(obj = TPython::ObjectProxy_FromVoidPtr((void*)addr, klass)) ) {
-	  throw PyROOT::TPyException();
-	}
-	PyDict_SetItem(m_objProxies, proxy, obj);
+        if ( !(obj = TPython::ObjectProxy_FromVoidPtr((void*)addr, klass)) ) {
+          std::cerr << "--error-- could not create a pyobject...\n";
+          throw PyROOT::TPyException();
+        }
+        PyDict_SetItem(m_objProxies, proxy, obj);
       }
       if ( addr && obj ) {
-	((PyROOT::ObjectProxy*)obj)->fObject = addr;
+        ((PyROOT::ObjectProxy*)obj)->fObject = addr;
       }
       return obj;
     }