library of assembled shared sources

http://lass.cocamware.com

pyobject_plus.h File Reference

#include "util_common.h"
#include "singleton.h"
#include "Python.h"
#include "../meta/is_derived.h"
#include "../meta/select.h"
#include "shared_ptr.h"
#include "string_cast.h"
#include "thread.h"
#include <cstdlib>
#include "pyobject_plus.inl"

Include dependency graph for pyobject_plus.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


Data Structures

struct  lass::python::Caster
struct  lass::python::IsACaster< T >
struct  lass::python::NoCast< T >
struct  lass::python::NoCast< void >
struct  lass::python::PointerCast< T >
struct  lass::python::PointerCast< T & >
struct  lass::python::PointerCast< const T & >
struct  lass::python::PointerCast< T * >
struct  lass::python::PointerCast< const T * >
struct  lass::python::CopyCast< T >
struct  lass::python::CopyCast< T & >
struct  lass::python::CopyCast< const T & >
struct  lass::python::CopyCast< T * >
struct  lass::python::CopyCast< const T * >
struct  lass::python::IsACaster< PointerCast< T > >
struct  lass::python::IsACaster< CopyCast< T > >
struct  lass::python::OwnerCaster< T >
struct  lass::python::PyExportTraits< T >
 PyExportTraits. More...
struct  lass::python::PyExportTraitsEnum< EnumType, IntegerType >
 Helper to specialise PyExportTraits for enumerations. More...
class  lass::python::PyObjectPlus
 PyObjectPlus. More...
class  lass::python::PyObjectStorage< T, Cascade >
 Recommended storage policy for single PyObject objects, implementation of StoragePolicy concept. More...
class  lass::python::PyObjectCounter
 The recommended counter for the pyobject pointers, implementation of CounterPolicy concept. More...
struct  lass::python::PyObjectPtr< T >
 templated "typedef" to a python shared pointer More...
class  lass::python::PythonException
struct  lass::python::IsPyObject< T >
 meta function to detect if a type is a PyObject-derived type More...
class  lass::python::impl::OverloadLink
struct  lass::python::impl::DispatcherConvertor< DispatcherAddress >
struct  lass::python::impl::CompareFunc
struct  lass::python::impl::RichCompare< CppClass >
struct  lass::python::impl::RichCompare< PyObjectPlus >
class  lass::python::impl::StaticMemberHelper
class  lass::python::impl::StaticMemberHelperObject< T >
class  lass::python::impl::StaticMemberHelperObject< PyObject * >
class  lass::python::impl::StaticMemberHelperType
struct  lass::python::impl::StaticMember
class  lass::python::impl::StaticMemberEqual
class  lass::python::impl::PyMethodEqual

Namespaces

namespace  lass
 Library for Assembled Shared Sources.
namespace  lass::python
namespace  lass::python::impl

Defines

#define PySequence_ITEM(o, i)   PySequence_GetItem(o, i)
#define PySequence_Fast_ITEMS(o)   (PyTuple_Check(o) ? ((PyTupleObject *)(o))->ob_item : ((PyListObject *)(o))->ob_item)
#define Py_RETURN_FALSE   return Py_INCREF(Py_False), Py_False
#define Py_RETURN_TRUE   return Py_INCREF(Py_True), Py_True
#define Py_RETURN_NONE   return Py_INCREF(Py_None), Py_None
#define Py_ssize_t   int
#define lenfunc   inquiry
#define ssizeargfunc   intargfunc
#define ssizessizeargfunc   intintargfunc
#define ssizeobjargproc   intobjargproc
#define ssizessizeobjargproc   intintobjargproc
#define PY_HEADER_INTERNAL
#define PY_HEADER(t_parentClass)
 Place as first line of your Pythonized class.
#define PYEXPORTTRAITS_USINGDEPRECATED(t_basicType)
#define PYEXPORTTRAITS_USINGDEPRECATED_TEMPL(t_basicType)
#define PYEXPORTTRAITS_USINGDEPRECATED_TEMPL_2(t_basicType)
#define PYEXPORTTRAITS_USINGDEPRECATED_TEMPL_3(t_basicType)
#define PYEXPORTTRAITS_USINGDEPRECATED_TEMPL_4(t_basicType)

Typedefs

typedef PyObjectPtr< PyObject >
::Type 
lass::python::TPyObjPtr
 PyObjectPtr to a PyObject.
typedef std::vector< CompareFunc > lass::python::impl::TCompareFuncs
typedef util::SharedPtr
< StaticMemberHelper > 
lass::python::impl::TStaticMemberHelperPtr
typedef std::vector< StaticMember > lass::python::impl::TStaticMembers

Functions

template<typename T >
PyObject * lass::python::pyBuildSimpleObject (T &iV)
template<typename T >
PyObject * lass::python::pyBuildSimpleObject (const T &iV)
template<typename T >
PyObject * lass::python::pyBuildSimpleObject (std::auto_ptr< T > iV)
template<typename T >
int lass::python::pyGetSimpleObject (PyObject *iV, T &oV)
util::CriticalSection & lass::python::impl::referenceMutex ()
template<typename T >
T * lass::python::impl::fixObjectType (T *iObject)
const std::string lass::python::impl::exceptionExtractMessage (const TPyObjPtr &type, const TPyObjPtr &value)
template<class T >
lass::util::SharedPtr< T,
PyObjectStorage,
PyObjectCounter > 
lass::python::fromNakedToSharedPtrCast (PyObject *object)
 fromNakedToSharedPtrCast.
template<class T >
PyObject * lass::python::fromSharedPtrToNakedCast (const util::SharedPtr< T, PyObjectStorage, PyObjectCounter > &object)
 fromSharedPtrToNakedCast.
template<typename Out , typename In >
Out lass::python::staticPyCast (const In &in)
 static_cast for python pointers
template<typename Out , typename In >
Out lass::python::dynamicPyCast (const In &in)
 dynamic_cast for python pointers
TPyObjPtr lass::python::getPyObjectByName (const std::string &iName)
 retrieve pointer to PyObject by its name in the script.
void lass::python::impl::dealloc (PyObject *obj)
PyObject * lass::python::impl::repr (PyObject *obj)
PyObject * lass::python::impl::str (PyObject *obj)
template<PyCFunction DispatcherAddress>
PyObject * lass::python::impl::unaryDispatcher (PyObject *iSelf)
template<PyCFunction DispatcherAddress>
PyObject * lass::python::impl::binaryDispatcher (PyObject *iSelf, PyObject *iOther)
template<PyCFunction DispatcherAddress>
PyObject * lass::python::impl::ternaryDispatcher (PyObject *iSelf, PyObject *iArgs, PyObject *iKw)
template<PyCFunction DispatcherAddress>
PyObject * lass::python::impl::ssizeargDispatcher (PyObject *iSelf, Py_ssize_t iSize)
template<PyCFunction DispatcherAddress>
PyObject * lass::python::impl::ssizessizeargDispatcher (PyObject *iSelf, Py_ssize_t iSize, Py_ssize_t iSize2)
template<PyCFunction DispatcherAddress>
Py_ssize_t lass::python::impl::lenDispatcher (PyObject *iSelf)
template<PyCFunction DispatcherAddress>
int lass::python::impl::ssizeobjargDispatcher (PyObject *iSelf, Py_ssize_t iSize, PyObject *iOther)
template<PyCFunction DispatcherAddress>
int lass::python::impl::ssizessizeobjargDispatcher (PyObject *iSelf, Py_ssize_t iSize, Py_ssize_t iSize2, PyObject *iOther)
template<PyCFunction DispatcherAddress>
int lass::python::impl::objobjDispatcher (PyObject *iSelf, PyObject *iOther)
template<typename T >
TStaticMemberHelperPtr lass::python::impl::staticMemberHelperObject (const T &obj)
TStaticMemberHelperPtr lass::python::impl::staticMemberHelperType (PyTypeObject *type)
StaticMember lass::python::impl::createStaticMember (const char *iName, const char *iDocumentation, const TStaticMemberHelperPtr &iMember, PyTypeObject *iParentType, std::vector< PyMethodDef > *iMethods, std::vector< PyGetSetDef > *iGetSetters, const TStaticMembers *iStatics)
PyMethodDef lass::python::impl::createPyMethodDef (const char *ml_name, PyCFunction ml_meth, int ml_flags, const char *ml_doc)
PyGetSetDef lass::python::impl::createPyGetSetDef (const char *name, getter get, setter set, const char *doc, void *closure)
void lass::python::impl::injectStaticMembers (PyTypeObject &iPyType, const TStaticMembers &iStatics)
void lass::python::impl::finalizePyType (PyTypeObject &iPyType, PyTypeObject &iPyParentType, std::vector< PyMethodDef > &iMethods, std::vector< PyGetSetDef > &iGetSetters, const TStaticMembers &iStatics, const char *iModuleName, const char *iDocumentation)
void lass::python::impl::addModuleFunction (std::vector< PyMethodDef > &ioModuleMethods, const char *iMethodName, const char *iDocumentation, PyCFunction iMethodDispatcher, PyCFunction &oOverloadChain)
void lass::python::impl::addClassMethod (PyTypeObject &pyType, std::vector< PyMethodDef > &classMethods, TCompareFuncs &compareFuncs, const char *methodName, const char *documentation, PyCFunction dispatcher, unaryfunc dispatcherUnary, binaryfunc dispatcherBinary, ternaryfunc dispatcherTernary, ssizeargfunc dispatcherSsizeArg, ssizessizeargfunc dispatcherSsizeSsizeArg, lenfunc dispatcherLen, ssizeobjargproc dispatcherSsizeObjArgProc, ssizessizeobjargproc dispatcherSsizeSsizeObjArgProc, objobjproc dispatcherObjObjProc, OverloadLink &overloadChain)
template<typename CppClass >
void lass::python::impl::injectClassInModule (PyObject *iModule, const char *iClassDocumentation)
template<typename CppClass >
void lass::python::impl::addClassStaticMethod (const char *iMethodName, const char *iDocumentation, PyCFunction iMethodDispatcher, PyCFunction &oOverloadChain)
 
template<typename CppClass , typename T >
void lass::python::impl::addClassStaticConst (const char *iName, const T &iValue)
template<typename InnerCppClass >
void lass::python::impl::addClassInnerClass (TStaticMembers &oOuterStatics, const char *iInnerClassName, const char *iDocumentation)
template<typename In , typename Out >
int lass::python::impl::pyNumericCast (In iIn, Out &oOut)
template<typename Integer >
int lass::python::impl::pyGetSignedObject (PyObject *iValue, Integer &oV)
template<typename Integer >
int lass::python::impl::pyGetUnsignedObject (PyObject *iValue, Integer &oV)
template<typename Float >
int lass::python::impl::pyGetFloatObject (PyObject *iValue, Float &oV)
void lass::python::impl::addMessageHeader (const std::string &iHeader)
bool lass::python::impl::checkSequenceSize (PyObject *iValue, Py_ssize_t iExpectedSize)
TPyObjPtr lass::python::impl::checkedFastSequence (PyObject *iValue, Py_ssize_t iExpectedSize)


Detailed Description

Author:
Bram de Greve (bramz@users.sourceforge.net)

Tom De Muer (tomdemuer@users.sourceforge.net)

*** BEGIN LICENSE INFORMATION ***

The contents of this file are subject to the Common Public Attribution License Version 1.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://lass.sourceforge.net/cpal-license. The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover use of software over a computer network and provide for limited attribution for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B.

Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.

The Original Code is LASS - Library of Assembled Shared Sources.

The Initial Developer of the Original Code is Bram de Greve and Tom De Muer. The Original Developer is the Initial Developer.

All portions of the code written by the Initial Developer are: Copyright (C) 2004-2007 the Initial Developer. All Rights Reserved.

Contributor(s):

Alternatively, the contents of this file may be used under the terms of the GNU General Public License Version 2 or later (the GPL), in which case the provisions of GPL are applicable instead of those above. If you wish to allow use of your version of this file only under the terms of the GPL and not to allow others to use your version of this file under the CPAL, indicate your decision by deleting the provisions above and replace them with the notice and other provisions required by the GPL License. If you do not delete the provisions above, a recipient may use your version of this file under either the CPAL or the GPL.

*** END LICENSE INFORMATION ***

Definition in file pyobject_plus.h.


Define Documentation

#define PySequence_ITEM ( o,
 )     PySequence_GetItem(o, i)

Definition at line 70 of file pyobject_plus.h.

Referenced by lass::python::impl::pyGetSequenceObject().

#define PySequence_Fast_ITEMS (  )     (PyTuple_Check(o) ? ((PyTupleObject *)(o))->ob_item : ((PyListObject *)(o))->ob_item)

#define Py_RETURN_FALSE   return Py_INCREF(Py_False), Py_False

Definition at line 79 of file pyobject_plus.h.

Referenced by lass::python::impl::RichCompare< CppClass >::call().

#define Py_RETURN_TRUE   return Py_INCREF(Py_True), Py_True

#define Py_RETURN_NONE   return Py_INCREF(Py_None), Py_None

#define Py_ssize_t   int

#define lenfunc   inquiry

Definition at line 92 of file pyobject_plus.h.

#define ssizeargfunc   intargfunc

Definition at line 93 of file pyobject_plus.h.

#define ssizessizeargfunc   intintargfunc

Definition at line 94 of file pyobject_plus.h.

#define ssizeobjargproc   intobjargproc

Definition at line 95 of file pyobject_plus.h.

#define ssizessizeobjargproc   intintobjargproc

Definition at line 96 of file pyobject_plus.h.

#define PY_HEADER_INTERNAL

Value:

public: \
        static PyTypeObject   _lassPyType; \
        static ::std::vector<PyMethodDef>    _lassPyMethods; \
        static ::std::vector<PyGetSetDef>    _lassPyGetSetters; \
        virtual PyTypeObject *_lassPyGetType(void) const {return &_lassPyType;};\
    private:

Definition at line 115 of file pyobject_plus.h.

#define PYEXPORTTRAITS_USINGDEPRECATED ( t_basicType   ) 

Value:

template<>\
        struct PyExportTraits< t_basicType >\
        {\
            static PyObject* build(const t_basicType & iv) { return pyBuildSimpleObject_deprecated(iv); }\
            static int get(PyObject* iv, t_basicType & ov) { return pyGetSimpleObject_deprecated(iv,ov); }\
        };\

Definition at line 296 of file pyobject_plus.h.

#define PYEXPORTTRAITS_USINGDEPRECATED_TEMPL ( t_basicType   ) 

Value:

template< typename T >\
        struct PyExportTraits< t_basicType< T > >\
        {\
            static PyObject* build(const t_basicType< T > & iv) { return pyBuildSimpleObject_deprecated(iv); }\
            static int get(PyObject* iv, t_basicType< T > & ov) { return pyGetSimpleObject_deprecated(iv,ov); }\
        };

Definition at line 304 of file pyobject_plus.h.

#define PYEXPORTTRAITS_USINGDEPRECATED_TEMPL_2 ( t_basicType   ) 

Value:

template< typename T, typename U >\
        struct PyExportTraits< t_basicType< T, U > >\
        {\
            static PyObject* build(const t_basicType< T, U > & iv) { return pyBuildSimpleObject_deprecated(iv); }\
            static int get(PyObject* iv, t_basicType< T, U> & ov) { return pyGetSimpleObject_deprecated(iv,ov); }\
        };

Definition at line 311 of file pyobject_plus.h.

#define PYEXPORTTRAITS_USINGDEPRECATED_TEMPL_3 ( t_basicType   ) 

Value:

template< typename T, typename U, typename V >\
        struct PyExportTraits< t_basicType< T, U, V > >\
        {\
            static PyObject* build(const t_basicType< T, U, V > & iv) { return pyBuildSimpleObject_deprecated(iv); }\
            static int get(PyObject* iv, t_basicType< T, U, V   > & ov) { return pyGetSimpleObject_deprecated(iv,ov); }\
        };

Definition at line 318 of file pyobject_plus.h.

#define PYEXPORTTRAITS_USINGDEPRECATED_TEMPL_4 ( t_basicType   ) 

Value:

template< typename T, typename U, typename V, typename W >\
        struct PyExportTraits< t_basicType< T, U, V, W > >\
        {\
            static PyObject* build(const t_basicType< T, U, V, W > & iv) { return pyBuildSimpleObject_deprecated(iv); }\
            static int get(PyObject* iv, t_basicType< T, U, V, W > & ov) { return pyGetSimpleObject_deprecated(iv,ov); }\
        };

Definition at line 325 of file pyobject_plus.h.


Generated on Mon Nov 10 14:22:05 2008 for Library of Assembled Shared Sources by doxygen 1.5.7.1
SourceForge.net Logo