ClassMethodHolder.cxx

Go to the documentation of this file.
00001 // @(#)root/pyroot:$Id: ClassMethodHolder.cxx 33539 2010-05-18 01:06:54Z wlav $
00002 // Author: Wim Lavrijsen, Aug 2004
00003 
00004 // Bindings
00005 #include "PyROOT.h"
00006 #include "ClassMethodHolder.h"
00007 #include "Adapters.h"
00008 
00009 
00010 //- constructors/destructor -----------------------------------------------------
00011 template< class T, class M >
00012 PyROOT::TClassMethodHolder< T, M >::TClassMethodHolder( const T& klass, const M& method ) :
00013       TMethodHolder< T, M >( klass, method )
00014 {
00015 }
00016 
00017 
00018 //- public members --------------------------------------------------------------
00019 template< class T, class M >
00020 PyObject* PyROOT::TClassMethodHolder< T, M >::operator()(
00021       ObjectProxy*, PyObject* args, PyObject* kwds, Long_t user )
00022 {
00023 // preliminary check in case keywords are accidently used (they are ignored otherwise)
00024    if ( kwds != 0 && PyDict_Size( kwds ) ) {
00025       PyErr_SetString( PyExc_TypeError, "keyword arguments are not yet supported" );
00026       return 0;
00027    }
00028 
00029 // setup as necessary
00030    if ( ! this->Initialize() )
00031       return 0;                              // important: 0, not Py_None
00032 
00033 // translate the arguments
00034    if ( ! this->SetMethodArgs( args, user ) )
00035       return 0;                              // important: 0, not Py_None
00036 
00037 // execute function
00038    return this->Execute( 0 );
00039 }
00040 
00041 //____________________________________________________________________________
00042 template class PyROOT::TClassMethodHolder< PyROOT::TScopeAdapter, PyROOT::TMemberAdapter >;
00043 #ifdef PYROOT_USE_REFLEX
00044 template class PyROOT::TClassMethodHolder< ROOT::Reflex::Scope, ROOT::Reflex::Member >;
00045 #endif

Generated on Tue Jul 5 14:10:11 2011 for ROOT_528-00b_version by  doxygen 1.5.1