Library of Assembled Shared Sources
 
Loading...
Searching...
No Matches
Data Member Export Macros

Detailed Description

Export C++ class data members as Python properties.

These macros create Python properties that provide access to C++ class data through various access patterns: getter/setter methods, free functions, or direct public member access.

Macro names follow the regular grammar (see Python Macro Name Conventions), but there are no _QUALIFIED versions.

Read/Write
Member Methods Free Functions Public Member
PY_CLASS_MEMBER_RW() PY_CLASS_FREE_MEMBER_RW() PY_CLASS_PUBLIC_MEMBER()
PY_CLASS_MEMBER_RW_NAME() PY_CLASS_FREE_MEMBER_RW_NAME() PY_CLASS_PUBLIC_MEMBER_NAME()
PY_CLASS_MEMBER_RW_DOC() PY_CLASS_FREE_MEMBER_RW_DOC() PY_CLASS_PUBLIC_MEMBER_DOC()
PY_CLASS_MEMBER_RW_NAME_DOC() PY_CLASS_FREE_MEMBER_RW_NAME_DOC() PY_CLASS_PUBLIC_MEMBER_NAME_DOC()
PY_CLASS_MEMBER_RW_EX() PY_CLASS_FREE_MEMBER_RW_EX() PY_CLASS_PUBLIC_MEMBER_EX()
Read-only
Member Methods Free Functions Public Member
PY_CLASS_MEMBER_R() PY_CLASS_FREE_MEMBER_R() PY_CLASS_PUBLIC_MEMBER_R()
PY_CLASS_MEMBER_R_NAME() PY_CLASS_FREE_MEMBER_R_NAME() PY_CLASS_PUBLIC_MEMBER_R_NAME()
PY_CLASS_MEMBER_R_DOC() PY_CLASS_FREE_MEMBER_R_DOC() PY_CLASS_PUBLIC_MEMBER_R_DOC()
PY_CLASS_MEMBER_R_NAME_DOC() PY_CLASS_FREE_MEMBER_R_NAME_DOC() PY_CLASS_PUBLIC_MEMBER_R_NAME_DOC()
PY_CLASS_MEMBER_R_EX() PY_CLASS_FREE_MEMBER_R_EX() PY_CLASS_PUBLIC_MEMBER_R_EX()

Member Method Properties

Use C++ methods as getter/setter to define a Python property

Non-const and Const Getter

Although Python doesn't know the concept of constness, Python Shadow Classes may contain a reference to a constant shadowee instance. Getters may be overloaded on this constness and the PY_CLASS_MEMBER_* macros will take this into account. This allows you to overload a getter and return a non-const pointer to a member if the shadowee isn't const.

class Foo
{
public:
lass::util::SharedPtr<const Bar> bar() const;
lass::util::SharedPtr<Bar> bar();
};
PY_SHADOW_CLASS(DLL_EXPORT, PyFoo, Foo)
PY_DECLARE_CLASS_NAME(PyFoo, "Foo")
PY_CLASS_MEMBER_R(PyFoo, bar) // will return SharedPtr<const Bar> or SharedPtr<Bar> depending on Foo constness
#define PY_DECLARE_CLASS_NAME(t_cppClass, s_name)
Declare a Python class with custom name but no documentation.
#define PY_CLASS_MEMBER_R(i_cppClass, i_cppGetter)
Export a getter as a read-only Python property.
#define PY_SHADOW_CASTERS(t_ShadowObject)
Define lass::python::ShadoweeTraits for shadow class.
#define PY_SHADOW_CLASS(dllInterface, i_PyObjectShadowClass, t_CppClass)
Declare Python shadow class with util::SharedPtr as default shadowee pointer type.

This also works in combination with a setter, using the PY_CLASS_MEMBER_RW* macros.

Two Forms of Setters

Setters may have one of following signatures:

  • take the new value as parameter, and have void as return type:
    void setName(const std::string& name);
  • have no paramater, but return a non-const reference to the member so it can be assigned to.
    float& price();

See example below.

Example
class Parrot: public lass::python::PyObjectPlus
{
public:
bool isAlive() const;
const std::string& name() const;
void setName(const std::string& name); // setter with parameter
float price() const;
float& price(); // setter through non-const reference
};
PY_CLASS_MEMBER_R_NAME_DOC(Parrot, isAlive, "alive", "is True if parrot isn't dead yet") // p.alive
PY_CLASS_MEMBER_RW(Parrot, name, setName) // p.name
PY_CLASS_MEMBER_RW(Parrot, price, price) // p.price
#define PY_DECLARE_CLASS(i_cppClass)
Declare a Python class with automatic name and no documentation.
#define PY_CLASS_MEMBER_R_NAME_DOC(i_cppClass, i_cppGetter, s_memberName, s_doc)
Export a getter as a read-only Python property, with custom name and docstring.
#define PY_CLASS_MEMBER_RW(i_cppClass, i_cppGetter, i_cppSetter)
Export a getter/setter pair as a Python property.
#define PY_HEADER(t_parentClass)
Place as first line of your Pythonized class.
Note
Member exports cannot be overloaded on types, and there are no qualified versions of these macros.
#define PY_CLASS_MEMBER_RW_EX(t_cppClass, i_cppGetter, i_cppSetter, s_memberName, s_doc, i_dispatcher)
 Export a getter/setter pair as a Python property, with full control.
 
#define PY_CLASS_MEMBER_RW_NAME_DOC(i_cppClass, i_cppGetter, i_cppSetter, s_memberName, s_doc)
 Export a getter/setter pair as a Python property, with custom name and docstring.
 
#define PY_CLASS_MEMBER_RW_NAME(i_cppClass, i_cppGetter, i_cppSetter, s_memberName)
 Export a getter/setter pair as a Python property, with custom Python name.
 
#define PY_CLASS_MEMBER_RW_DOC(i_cppClass, i_cppGetter, i_cppSetter, s_doc)
 Export a getter/setter pair as a Python property, with docstring.
 
#define PY_CLASS_MEMBER_RW(i_cppClass, i_cppGetter, i_cppSetter)
 Export a getter/setter pair as a Python property.
 
#define PY_CLASS_MEMBER_R_EX(t_cppClass, i_cppGetter, s_memberName, s_doc, i_dispatcher)
 Export a getter as a read-only Python property, with full control.
 
#define PY_CLASS_MEMBER_R_NAME_DOC(i_cppClass, i_cppGetter, s_memberName, s_doc)
 Export a getter as a read-only Python property, with custom name and docstring.
 
#define PY_CLASS_MEMBER_R_NAME(i_cppClass, i_cppGetter, s_memberName)
 Export a getter as a read-only Python property, with custom Python name.
 
#define PY_CLASS_MEMBER_R_DOC(i_cppClass, i_cppGetter, s_doc)
 Export a getter as a read-only Python property, with docstring.
 
#define PY_CLASS_MEMBER_R(i_cppClass, i_cppGetter)
 Export a getter as a read-only Python property.
 

Free Function Properties

Export C/C++ free functions as Python properties.

Use these when the getter/setter can't be a member. This is particularly useful for Python Shadow Classes where adding methods directly to the class is undesirable or impossible.

Example
class Parrot
{
PY_HEADER(python::PyObjectPlus)
public:
std::string name;
};
int getName(const Parrot& self)
{
return self.name;
}
void setName(Parrot& self, const std::string& name)
{
self.name = name;
}
PY_CLASS_FREE_MEMBER_RW_NAME(Parrot, getName, setName, "parrot")
#define PY_CLASS_FREE_MEMBER_RW_NAME(i_cppClass, i_cppFreeGetter, i_cppFreeSetter, s_memberName)
Export free accessors as a read-write Python property, with custom Python name.
Note
Member exports cannot be overloaded on types, and there are no qualified versions of these macros.
#define PY_CLASS_FREE_MEMBER_RW_EX(t_cppClass, i_cppFreeGetter, i_cppFreeSetter, s_memberName, s_doc, i_dispatcher)
 Export free accessors as a read-write Python property, with full control.
 
#define PY_CLASS_FREE_MEMBER_RW_NAME_DOC(i_cppClass, i_cppFreeGetter, i_cppFreeSetter, s_memberName, s_doc)
 Export free accessors as a read-write Python property, with custom name and docstring.
 
#define PY_CLASS_FREE_MEMBER_RW_NAME(i_cppClass, i_cppFreeGetter, i_cppFreeSetter, s_memberName)
 Export free accessors as a read-write Python property, with custom Python name.
 
#define PY_CLASS_FREE_MEMBER_RW_DOC(i_cppClass, i_cppFreeGetter, i_cppFreeSetter, s_doc)
 Export free accessors as a read-write Python property, with docstring.
 
#define PY_CLASS_FREE_MEMBER_RW(i_cppClass, i_cppFreeGetter, i_cppFreeSetter)
 Export free accessors as a read-write Python property.
 
#define PY_CLASS_FREE_MEMBER_R_EX(t_cppClass, i_cppFreeGetter, s_memberName, s_doc, i_dispatcher)
 Export a free accessor as a read-only Python property, with full control.
 
#define PY_CLASS_FREE_MEMBER_R_NAME_DOC(i_cppClass, i_cppFreeGetter, s_memberName, s_doc)
 Export a free accessor as a read-only Python property, with custom name and docstring.
 
#define PY_CLASS_FREE_MEMBER_R_NAME(i_cppClass, i_cppFreeGetter, s_memberName)
 Export a free accessor as a read-only Python property, with custom Python name.
 
#define PY_CLASS_FREE_MEMBER_R_DOC(i_cppClass, i_cppFreeGetter, s_doc)
 Export a free accessor as a read-only Python property, with docstring.
 
#define PY_CLASS_FREE_MEMBER_R(i_cppClass, i_cppFreeGetter)
 Export a free accessor as a read-only Python property.
 

Public Member Properties

Exports a public data member directly as a Python property, allowing both read and write access.

This provides direct access to the C++ member variable without requiring getter/setter methods.

Example
class Parrot
{
PY_HEADER(python::PyObjectPlus)
public:
std::string name;
const Color color;
};
PY_CLASS_PUBLIC_MEMBER_DOC(Parrot, name, "Parrot's name")
#define PY_CLASS_PUBLIC_MEMBER_DOC(i_cppClass, i_cppMember, s_doc)
Export a public member as a read-write Python property, with docstring.
#define PY_CLASS_PUBLIC_MEMBER_R(i_cppClass, i_cppMember)
Export a public member as a read-only Python property.
Note
Member exports cannot be overloaded on types, and there are no qualified versions of these macros.
#define PY_CLASS_PUBLIC_MEMBER_EX(t_cppClass, i_cppMember, s_memberName, s_doc, i_dispatcher)
 Export a public member as a read-write Python property, with full control.
 
#define PY_CLASS_PUBLIC_MEMBER_NAME_DOC(i_cppClass, i_cppMember, s_memberName, s_doc)
 Export a public member as a read-write Python property, with custom name and docstring.
 
#define PY_CLASS_PUBLIC_MEMBER_NAME(i_cppClass, i_cppMember, s_memberName)
 Export a public member as a read-write Python property, with custom Python name.
 
#define PY_CLASS_PUBLIC_MEMBER_DOC(i_cppClass, i_cppMember, s_doc)
 Export a public member as a read-write Python property, with docstring.
 
#define PY_CLASS_PUBLIC_MEMBER(i_cppClass, i_cppMember)
 Export a public member as a read-write Python property.
 
#define PY_CLASS_PUBLIC_MEMBER_R_EX(t_cppClass, i_cppMember, s_memberName, s_doc, i_dispatcher)
 Export a public member as a read-only Python property, with full control.
 
#define PY_CLASS_PUBLIC_MEMBER_R_NAME_DOC(i_cppClass, i_cppMember, s_memberName, s_doc)
 Export a public member as a read-only Python property, with custom name and docstring.
 
#define PY_CLASS_PUBLIC_MEMBER_R_NAME(i_cppClass, i_cppMember, s_memberName)
 Export a public member as a read-only Python property, with custom Python name.
 
#define PY_CLASS_PUBLIC_MEMBER_R_DOC(i_cppClass, i_cppMember, s_doc)
 Export a public member as a read-only Python property, with docstring.
 
#define PY_CLASS_PUBLIC_MEMBER_R(i_cppClass, i_cppMember)
 Export a public member as a read-only Python property.
 

Macro Definition Documentation

◆ PY_CLASS_MEMBER_RW_EX

#define PY_CLASS_MEMBER_RW_EX ( t_cppClass,
i_cppGetter,
i_cppSetter,
s_memberName,
s_doc,
i_dispatcher )

Export a getter/setter pair as a Python property, with full control.

This is the most flexible read-write member export macro, allowing manual dispatcher naming.

Here you can use a fully qualified class name, at the cost of having to provide a unique suffix.

Exports a pair of C++ getter and setter methods as a Python read/write property.

Parameters
t_cppClassC++ class containing the getter and setter methods
i_cppGetterC++ method name of getter
i_cppSetterC++ method name of setter
s_memberNamePython property name (null-terminated C string literal)
s_docProperty documentation string (null-terminated C string literal, may be nullptr)
i_dispatcherUnique identifier for the generated dispatcher functions
Example
PY_CLASS_MEMBER_RW_NAME_DOC(Parrot, getName, setName, "name", "the name of the parrot", parrot_name)
#define PY_CLASS_MEMBER_RW_NAME_DOC(i_cppClass, i_cppGetter, i_cppSetter, s_memberName, s_doc)
Export a getter/setter pair as a Python property, with custom name and docstring.

Definition at line 9728 of file pyobject_macros.h.

◆ PY_CLASS_MEMBER_RW_NAME_DOC

#define PY_CLASS_MEMBER_RW_NAME_DOC ( i_cppClass,
i_cppGetter,
i_cppSetter,
s_memberName,
s_doc )
Value:
PY_CLASS_MEMBER_RW_EX(i_cppClass, i_cppGetter, i_cppSetter, s_memberName, s_doc,\
LASS_UNIQUENAME(LASS_CONCATENATE(lassPyImpl_memberRW, i_cppClass)))
#define PY_CLASS_MEMBER_RW_EX(t_cppClass, i_cppGetter, i_cppSetter, s_memberName, s_doc, i_dispatcher)
Export a getter/setter pair as a Python property, with full control.

Export a getter/setter pair as a Python property, with custom name and docstring.

Wraps PY_CLASS_MEMBER_RW_EX() with auto-generated dispatcher name.

Parameters
i_cppClassC++ class containing the getter and setter methods (unqualified name)
i_cppGetterC++ method name of getter
i_cppSetterC++ method name of setter
s_memberNamePython property name (null-terminated C string literal)
s_docProperty documentation string (null-terminated C string literal, may be nullptr)
Example
PY_CLASS_MEMBER_RW_NAME_DOC(Parrot, getName, setName, "name", "the name of the parrot")

Definition at line 9778 of file pyobject_macros.h.

◆ PY_CLASS_MEMBER_RW_NAME

#define PY_CLASS_MEMBER_RW_NAME ( i_cppClass,
i_cppGetter,
i_cppSetter,
s_memberName )
Value:
PY_CLASS_MEMBER_RW_NAME_DOC(i_cppClass, i_cppGetter, i_cppSetter, s_memberName, 0)

Export a getter/setter pair as a Python property, with custom Python name.

Wraps PY_CLASS_MEMBER_RW_NAME_DOC() with s_doc = nullptr.

Parameters
i_cppClassC++ class containing the getter and setter methods (unqualified name)
i_cppGetterC++ method name of getter
i_cppSetterC++ method name of setter
s_memberNamePython property name (null-terminated C string literal)
Example
PY_CLASS_MEMBER_RW_NAME(Parrot, getName, setName, "name")
#define PY_CLASS_MEMBER_RW_NAME(i_cppClass, i_cppGetter, i_cppSetter, s_memberName)
Export a getter/setter pair as a Python property, with custom Python name.

Definition at line 9797 of file pyobject_macros.h.

◆ PY_CLASS_MEMBER_RW_DOC

#define PY_CLASS_MEMBER_RW_DOC ( i_cppClass,
i_cppGetter,
i_cppSetter,
s_doc )
Value:
PY_CLASS_MEMBER_RW_NAME_DOC(i_cppClass, i_cppGetter, i_cppSetter, LASS_STRINGIFY(i_cppGetter), s_doc)

Export a getter/setter pair as a Python property, with docstring.

Wraps PY_CLASS_MEMBER_RW_NAME_DOC() with s_memberName derived from i_cppGetter.

Parameters
i_cppClassC++ class containing the getter and setter methods (unqualified name)
i_cppGetterC++ method name of getter (also used as Python property name)
i_cppSetterC++ method name of setter
s_docProperty documentation string (null-terminated C string literal, may be nullptr)
Example
PY_CLASS_MEMBER_RW_DOC(Parrot, name, setName, "the name of the parrot")
#define PY_CLASS_MEMBER_RW_DOC(i_cppClass, i_cppGetter, i_cppSetter, s_doc)
Export a getter/setter pair as a Python property, with docstring.

Definition at line 9815 of file pyobject_macros.h.

◆ PY_CLASS_MEMBER_RW

#define PY_CLASS_MEMBER_RW ( i_cppClass,
i_cppGetter,
i_cppSetter )
Value:
PY_CLASS_MEMBER_RW_DOC(i_cppClass, i_cppGetter, i_cppSetter, 0)

Export a getter/setter pair as a Python property.

Wraps PY_CLASS_MEMBER_RW_DOC() with s_doc = nullptr.

Parameters
i_cppClassC++ class containing the getter and setter methods (unqualified name)
i_cppGetterC++ method name of getter (also used as Python property name)
i_cppSetterC++ method name of setter
Example
PY_CLASS_MEMBER_RW_DOC(Parrot, name, setName)

Definition at line 9832 of file pyobject_macros.h.

◆ PY_CLASS_MEMBER_R_EX

#define PY_CLASS_MEMBER_R_EX ( t_cppClass,
i_cppGetter,
s_memberName,
s_doc,
i_dispatcher )

Export a getter as a read-only Python property, with full control.

This is the most flexible read-only member export macro, allowing manual dispatcher naming.

Here you can use a fully qualified class name, at the cost of having to provide a unique suffix.

Exports a C++ getter method as a Python read-only property (no setter provided).

Parameters
t_cppClassC++ class containing the getter method
i_cppGetterC++ method name of getter
s_memberNamePython property name (null-terminated C string literal)
s_docProperty documentation string (null-terminated C string literal, may be nullptr)
i_dispatcherUnique identifier for the generated dispatcher function
Example
PY_CLASS_MEMBER_R_EX(Parrot, isAlive, "alive", "True if parrot isn't dead", parrot_alive)
#define PY_CLASS_MEMBER_R_EX(t_cppClass, i_cppGetter, s_memberName, s_doc, i_dispatcher)
Export a getter as a read-only Python property, with full control.

Definition at line 9857 of file pyobject_macros.h.

◆ PY_CLASS_MEMBER_R_NAME_DOC

#define PY_CLASS_MEMBER_R_NAME_DOC ( i_cppClass,
i_cppGetter,
s_memberName,
s_doc )
Value:
PY_CLASS_MEMBER_R_EX(i_cppClass, i_cppGetter, s_memberName, s_doc,\
LASS_UNIQUENAME(LASS_CONCATENATE(lassPyImpl_memberR, i_cppClass)))

Export a getter as a read-only Python property, with custom name and docstring.

Wraps PY_CLASS_MEMBER_R_EX() with auto-generated dispatcher name.

Parameters
i_cppClassC++ class containing the getter method (unqualified name)
i_cppGetterC++ method name of getter
s_memberNamePython property name (null-terminated C string literal)
s_docProperty documentation string (null-terminated C string literal, may be nullptr)
Example
PY_CLASS_MEMBER_R_DOC(Parrot, isAlive, "alive", "True if the parrot is not dead")
#define PY_CLASS_MEMBER_R_DOC(i_cppClass, i_cppGetter, s_doc)
Export a getter as a read-only Python property, with docstring.

Definition at line 9901 of file pyobject_macros.h.

◆ PY_CLASS_MEMBER_R_NAME

#define PY_CLASS_MEMBER_R_NAME ( i_cppClass,
i_cppGetter,
s_memberName )
Value:
PY_CLASS_MEMBER_R_NAME_DOC(i_cppClass, i_cppGetter, s_memberName, 0)

Export a getter as a read-only Python property, with custom Python name.

Wraps PY_CLASS_MEMBER_R_NAME_DOC() with s_doc = nullptr.

Parameters
i_cppClassC++ class containing the getter method (unqualified name)
i_cppGetterC++ method name of getter
s_memberNamePython property name (null-terminated C string literal)
Example
PY_CLASS_MEMBER_R_DOC(Parrot, isAlive, "alive")

Definition at line 9919 of file pyobject_macros.h.

◆ PY_CLASS_MEMBER_R_DOC

#define PY_CLASS_MEMBER_R_DOC ( i_cppClass,
i_cppGetter,
s_doc )
Value:
PY_CLASS_MEMBER_R_NAME_DOC(i_cppClass, i_cppGetter, LASS_STRINGIFY(i_cppGetter), s_doc)

Export a getter as a read-only Python property, with docstring.

Wraps PY_CLASS_MEMBER_R_NAME_DOC() with s_memberName derived from i_cppGetter.

Parameters
i_cppClassC++ class containing the getter method (unqualified name)
i_cppGetterC++ method name of getter (also used as Python property name)
s_docProperty documentation string (null-terminated C string literal, may be nullptr)
Example
PY_CLASS_MEMBER_R_DOC(Parrot, alive, "True if the parrot is not dead")

Definition at line 9936 of file pyobject_macros.h.

◆ PY_CLASS_MEMBER_R

#define PY_CLASS_MEMBER_R ( i_cppClass,
i_cppGetter )
Value:
PY_CLASS_MEMBER_R_DOC(i_cppClass, i_cppGetter, 0)

Export a getter as a read-only Python property.

Wraps PY_CLASS_MEMBER_R_DOC() with method name as property name and no documentation.

Parameters
i_cppClassC++ class containing the getter method (unqualified name)
i_cppGetterC++ method name of getter (also used as Python property name)
Example
PY_CLASS_MEMBER_R_DOC(Parrot, alive)

Definition at line 9952 of file pyobject_macros.h.

◆ PY_CLASS_FREE_MEMBER_RW_EX

#define PY_CLASS_FREE_MEMBER_RW_EX ( t_cppClass,
i_cppFreeGetter,
i_cppFreeSetter,
s_memberName,
s_doc,
i_dispatcher )

Export free accessors as a read-write Python property, with full control.

Exports a pair of free functions as read/write Python property. Unlike member method-based macros, this uses standalone functions that take the object as their first parameter.

Here you can use a fully qualified class name, at the cost of having to provide a unique suffix.

Parameters
t_cppClassC++ class to add the property to
i_cppFreeGetterFree getter function
i_cppFreeSetterFree setter function
s_memberNamePython property name (null-terminated C string literal)
s_docProperty documentation string (null-terminated C string literal, may be nullptr)
i_dispatcherUnique identifier for the generated dispatcher functions
Example
PY_CLASS_FREE_MEMBER_RW_EX(Parrot, getName, setName, "name", "Parrot's name", parrot_name)
#define PY_CLASS_FREE_MEMBER_RW_EX(t_cppClass, i_cppFreeGetter, i_cppFreeSetter, s_memberName, s_doc, i_dispatcher)
Export free accessors as a read-write Python property, with full control.

Definition at line 10015 of file pyobject_macros.h.

◆ PY_CLASS_FREE_MEMBER_RW_NAME_DOC

#define PY_CLASS_FREE_MEMBER_RW_NAME_DOC ( i_cppClass,
i_cppFreeGetter,
i_cppFreeSetter,
s_memberName,
s_doc )
Value:
PY_CLASS_FREE_MEMBER_RW_EX(i_cppClass, i_cppFreeGetter, i_cppFreeSetter, s_memberName, s_doc,\
LASS_UNIQUENAME(LASS_CONCATENATE(lassPyImpl_freeMemberRW, i_cppClass)))

Export free accessors as a read-write Python property, with custom name and docstring.

Wraps PY_CLASS_FREE_MEMBER_RW_EX() with auto-generated dispatcher name.

Parameters
i_cppClassC++ class to add the property to (unqualified name)
i_cppFreeGetterFree getter function
i_cppFreeSetterFree setter function
s_memberNamePython property name (null-terminated C string literal)
s_docProperty documentation string (null-terminated C string literal, may be nullptr)
Example
PY_CLASS_FREE_MEMBER_RW_NAME_DOC(Parrot, getName, setName, "name", "Parrot's name")
#define PY_CLASS_FREE_MEMBER_RW_NAME_DOC(i_cppClass, i_cppFreeGetter, i_cppFreeSetter, s_memberName, s_doc)
Export free accessors as a read-write Python property, with custom name and docstring.

Definition at line 10049 of file pyobject_macros.h.

◆ PY_CLASS_FREE_MEMBER_RW_NAME

#define PY_CLASS_FREE_MEMBER_RW_NAME ( i_cppClass,
i_cppFreeGetter,
i_cppFreeSetter,
s_memberName )
Value:
PY_CLASS_FREE_MEMBER_RW_NAME_DOC(i_cppClass, i_cppFreeGetter, i_cppFreeSetter, s_memberName, 0)

Export free accessors as a read-write Python property, with custom Python name.

Wraps PY_CLASS_FREE_MEMBER_RW_NAME_DOC() with no documentation.

Parameters
i_cppClassC++ class to add the property to (unqualified name)
i_cppFreeGetterFree getter function
i_cppFreeSetterFree setter function
s_memberNamePython property name (null-terminated C string literal)
Example
PY_CLASS_FREE_MEMBER_RW_NAME_DOC(Parrot, getName, setName, "name")

Definition at line 10068 of file pyobject_macros.h.

◆ PY_CLASS_FREE_MEMBER_RW_DOC

#define PY_CLASS_FREE_MEMBER_RW_DOC ( i_cppClass,
i_cppFreeGetter,
i_cppFreeSetter,
s_doc )
Value:
PY_CLASS_FREE_MEMBER_RW_NAME_DOC(i_cppClass, i_cppFreeGetter, i_cppFreeSetter, LASS_STRINGIFY(i_cppFreeGetter), s_doc)

Export free accessors as a read-write Python property, with docstring.

Wraps PY_CLASS_FREE_MEMBER_RW_NAME_DOC() with function name as property name.

Parameters
i_cppClassC++ class to add the property to (unqualified name)
i_cppFreeGetterFree getter function (also used as Python property name)
i_cppFreeSetterFree setter function
s_docProperty documentation string (null-terminated C string literal, may be nullptr)
Example
PY_CLASS_FREE_MEMBER_RW_DOC(Parrot, name, setName, "Parrot's name")
#define PY_CLASS_FREE_MEMBER_RW_DOC(i_cppClass, i_cppFreeGetter, i_cppFreeSetter, s_doc)
Export free accessors as a read-write Python property, with docstring.

Definition at line 10086 of file pyobject_macros.h.

◆ PY_CLASS_FREE_MEMBER_RW

#define PY_CLASS_FREE_MEMBER_RW ( i_cppClass,
i_cppFreeGetter,
i_cppFreeSetter )
Value:
PY_CLASS_FREE_MEMBER_RW_DOC(i_cppClass, i_cppFreeGetter, i_cppFreeSetter, 0)

Export free accessors as a read-write Python property.

Wraps PY_CLASS_FREE_MEMBER_RW_DOC() with function name as property name and no documentation.

Parameters
i_cppClassC++ class to add the property to (unqualified name)
i_cppFreeGetterFree getter function (also used as Python property name)
i_cppFreeSetterFree setter function
Example
PY_CLASS_FREE_MEMBER_RW_DOC(Parrot, name, setName)

Definition at line 10103 of file pyobject_macros.h.

◆ PY_CLASS_FREE_MEMBER_R_EX

#define PY_CLASS_FREE_MEMBER_R_EX ( t_cppClass,
i_cppFreeGetter,
s_memberName,
s_doc,
i_dispatcher )

Export a free accessor as a read-only Python property, with full control.

Exports a free function as read-only Python property. Unlike member method-based macros, this uses a standalone function that takes the object as its first parameter.

Here you can use a fully qualified class name, at the cost of having to provide a unique suffix.

Parameters
t_cppClassC++ class to add the property to
i_cppFreeGetterFree getter function
s_memberNamePython property name (null-terminated C string literal)
s_docProperty documentation string (null-terminated C string literal, may be nullptr)
i_dispatcherUnique identifier for the generated dispatcher functions
Example
PY_CLASS_FREE_MEMBER_R_EX(Parrot, getColor, "color", "Parrot's color", parrot_color)
#define PY_CLASS_FREE_MEMBER_R_EX(t_cppClass, i_cppFreeGetter, s_memberName, s_doc, i_dispatcher)
Export a free accessor as a read-only Python property, with full control.

Definition at line 10127 of file pyobject_macros.h.

◆ PY_CLASS_FREE_MEMBER_R_NAME_DOC

#define PY_CLASS_FREE_MEMBER_R_NAME_DOC ( i_cppClass,
i_cppFreeGetter,
s_memberName,
s_doc )
Value:
PY_CLASS_FREE_MEMBER_R_EX(i_cppClass, i_cppFreeGetter, s_memberName, s_doc,\
LASS_UNIQUENAME(LASS_CONCATENATE(lassPyImpl_freeMemberR, i_cppClass)))

Export a free accessor as a read-only Python property, with custom name and docstring.

Wraps PY_CLASS_FREE_MEMBER_R_EX() with auto-generated dispatcher name.

Parameters
i_cppClassC++ class to add the property to (unqualified name)
i_cppFreeGetterFree getter function
s_memberNamePython property name (null-terminated C string literal)
s_docProperty documentation string (null-terminated C string literal, may be nullptr)
Example
PY_CLASS_FREE_MEMBER_R_NAME_DOC(Parrot, getColor, "color", "Parrot's color")
#define PY_CLASS_FREE_MEMBER_R_NAME_DOC(i_cppClass, i_cppFreeGetter, s_memberName, s_doc)
Export a free accessor as a read-only Python property, with custom name and docstring.

Definition at line 10155 of file pyobject_macros.h.

◆ PY_CLASS_FREE_MEMBER_R_NAME

#define PY_CLASS_FREE_MEMBER_R_NAME ( i_cppClass,
i_cppFreeGetter,
s_memberName )
Value:
PY_CLASS_FREE_MEMBER_R_NAME_DOC(i_cppClass, i_cppFreeGetter, s_memberName, 0)

Export a free accessor as a read-only Python property, with custom Python name.

Wraps PY_CLASS_FREE_MEMBER_R_NAME_DOC() with no documentation.

Parameters
i_cppClassC++ class to add the property to (unqualified name)
i_cppFreeGetterFree getter function
s_memberNamePython property name (null-terminated C string literal)
Example
PY_CLASS_FREE_MEMBER_R_NAME(Parrot, getColor, "color")
#define PY_CLASS_FREE_MEMBER_R_NAME(i_cppClass, i_cppFreeGetter, s_memberName)
Export a free accessor as a read-only Python property, with custom Python name.

Definition at line 10173 of file pyobject_macros.h.

◆ PY_CLASS_FREE_MEMBER_R_DOC

#define PY_CLASS_FREE_MEMBER_R_DOC ( i_cppClass,
i_cppFreeGetter,
s_doc )
Value:
PY_CLASS_FREE_MEMBER_R_NAME_DOC(i_cppClass, i_cppFreeGetter, LASS_STRINGIFY(i_cppFreeGetter), s_doc)

Export a free accessor as a read-only Python property, with docstring.

Wraps PY_CLASS_FREE_MEMBER_R_NAME_DOC() with function name as property name.

Parameters
i_cppClassC++ class to add the property to (unqualified name)
i_cppFreeGetterFree getter function (also used as Python property name)
s_docProperty documentation string (null-terminated C string literal, may be nullptr)
Example
PY_CLASS_FREE_MEMBER_R_DOC(Parrot, color, "Parrot's color")
#define PY_CLASS_FREE_MEMBER_R_DOC(i_cppClass, i_cppFreeGetter, s_doc)
Export a free accessor as a read-only Python property, with docstring.

Definition at line 10190 of file pyobject_macros.h.

◆ PY_CLASS_FREE_MEMBER_R

#define PY_CLASS_FREE_MEMBER_R ( i_cppClass,
i_cppFreeGetter )
Value:
PY_CLASS_FREE_MEMBER_R_DOC(i_cppClass, i_cppFreeGetter, 0)

Export a free accessor as a read-only Python property.

Wraps PY_CLASS_FREE_MEMBER_R_DOC() with function name as property name and no documentation.

Parameters
i_cppClassC++ class to add the property to (unqualified name)
i_cppFreeGetterFree getter function (also used as Python property name)
Example
PY_CLASS_FREE_MEMBER_R(Parrot, color)
#define PY_CLASS_FREE_MEMBER_R(i_cppClass, i_cppFreeGetter)
Export a free accessor as a read-only Python property.

Definition at line 10206 of file pyobject_macros.h.

◆ PY_CLASS_PUBLIC_MEMBER_EX

#define PY_CLASS_PUBLIC_MEMBER_EX ( t_cppClass,
i_cppMember,
s_memberName,
s_doc,
i_dispatcher )

Export a public member as a read-write Python property, with full control.

Exports a public data member directly as a Python property, allowing both read and write access. This provides direct access to the C++ member variable without requiring getter/setter methods.

Here you can use a fully qualified class name, at the cost of having to provide a unique suffix.

Parameters
t_cppClassC++ class containing the public member
i_cppMemberC++ public data member name to export
s_memberNamePython property name (null-terminated C string literal)
s_docProperty documentation string (null-terminated C string literal, may be nullptr)
i_dispatcherUnique identifier for the generated dispatcher functions
Example
PY_CLASS_PUBLIC_MEMBER_EX(Parrot, name, "name", "Parrot's name", parrot_name)
#define PY_CLASS_PUBLIC_MEMBER_EX(t_cppClass, i_cppMember, s_memberName, s_doc, i_dispatcher)
Export a public member as a read-write Python property, with full control.

Definition at line 10259 of file pyobject_macros.h.

◆ PY_CLASS_PUBLIC_MEMBER_NAME_DOC

#define PY_CLASS_PUBLIC_MEMBER_NAME_DOC ( i_cppClass,
i_cppMember,
s_memberName,
s_doc )
Value:
PY_CLASS_PUBLIC_MEMBER_EX( i_cppClass, i_cppMember, s_memberName, s_doc,\
LASS_UNIQUENAME(LASS_CONCATENATE(lassPyImpl_publicMember_, i_cppClass)))

Export a public member as a read-write Python property, with custom name and docstring.

Wraps PY_CLASS_PUBLIC_MEMBER_EX() with auto-generated dispatcher name.

Parameters
i_cppClassC++ class containing the public member (unqualified name)
i_cppMemberC++ public data member name to export
s_memberNamePython property name (null-terminated C string literal)
s_docProperty documentation string (null-terminated C string literal, may be nullptr)
Example
PY_CLASS_PUBLIC_MEMBER_NAME_DOC(Parrot, name, "name", "Parrot's name")
#define PY_CLASS_PUBLIC_MEMBER_NAME_DOC(i_cppClass, i_cppMember, s_memberName, s_doc)
Export a public member as a read-write Python property, with custom name and docstring.

Definition at line 10302 of file pyobject_macros.h.

◆ PY_CLASS_PUBLIC_MEMBER_NAME

#define PY_CLASS_PUBLIC_MEMBER_NAME ( i_cppClass,
i_cppMember,
s_memberName )
Value:
PY_CLASS_PUBLIC_MEMBER_NAME_DOC( i_cppClass, i_cppMember, s_memberName, 0 )

Export a public member as a read-write Python property, with custom Python name.

Wraps PY_CLASS_PUBLIC_MEMBER_NAME_DOC() with no documentation.

Parameters
i_cppClassC++ class containing the public member (unqualified name)
i_cppMemberC++ public data member name to export
s_memberNamePython property name (null-terminated C string literal)
Example
PY_CLASS_PUBLIC_MEMBER_NAME(Parrot, name, "name")
#define PY_CLASS_PUBLIC_MEMBER_NAME(i_cppClass, i_cppMember, s_memberName)
Export a public member as a read-write Python property, with custom Python name.

Definition at line 10320 of file pyobject_macros.h.

◆ PY_CLASS_PUBLIC_MEMBER_DOC

#define PY_CLASS_PUBLIC_MEMBER_DOC ( i_cppClass,
i_cppMember,
s_doc )
Value:
PY_CLASS_PUBLIC_MEMBER_NAME_DOC( i_cppClass, i_cppMember, LASS_STRINGIFY(i_cppMember), s_doc )

Export a public member as a read-write Python property, with docstring.

Wraps PY_CLASS_PUBLIC_MEMBER_NAME_DOC() with member name as property name.

Parameters
i_cppClassC++ class containing the public member (unqualified name)
i_cppMemberC++ public data member name to export (also used as Python property name)
s_docProperty documentation string (null-terminated C string literal, may be nullptr)
Example
PY_CLASS_PUBLIC_MEMBER_NAME_DOC(Parrot, name, "name")

Definition at line 10337 of file pyobject_macros.h.

◆ PY_CLASS_PUBLIC_MEMBER

#define PY_CLASS_PUBLIC_MEMBER ( i_cppClass,
i_cppMember )
Value:
PY_CLASS_PUBLIC_MEMBER_NAME_DOC( i_cppClass, i_cppMember, LASS_STRINGIFY(i_cppMember), 0 )

Export a public member as a read-write Python property.

Wraps PY_CLASS_PUBLIC_MEMBER_NAME_DOC() with member name as property name and no documentation.

Parameters
i_cppClassC++ class containing the public member (unqualified name)
i_cppMemberC++ public data member name to export (also used as Python property name)
Example

Definition at line 10353 of file pyobject_macros.h.

◆ PY_CLASS_PUBLIC_MEMBER_R_EX

#define PY_CLASS_PUBLIC_MEMBER_R_EX ( t_cppClass,
i_cppMember,
s_memberName,
s_doc,
i_dispatcher )

Export a public member as a read-only Python property, with full control.

Exports a public data member directly as a read-only Python property, allowing only read access. This provides direct read access to the C++ member variable without requiring a getter method. Useful for const members or when write access should be restricted.

Here you can use a fully qualified class name, at the cost of having to provide a unique suffix.

Parameters
t_cppClassC++ class containing the public member
i_cppMemberC++ public data member name to export
s_memberNamePython property name (null-terminated C string literal)
s_docProperty documentation string (null-terminated C string literal, may be nullptr)
i_dispatcherUnique identifier for the generated dispatcher functions
Example
PY_CLASS_PUBLIC_MEMBER_R_EX(Parrot, color, "color", "Parrot's color", parrot_color)
#define PY_CLASS_PUBLIC_MEMBER_R_EX(t_cppClass, i_cppMember, s_memberName, s_doc, i_dispatcher)
Export a public member as a read-only Python property, with full control.

Definition at line 10379 of file pyobject_macros.h.

◆ PY_CLASS_PUBLIC_MEMBER_R_NAME_DOC

#define PY_CLASS_PUBLIC_MEMBER_R_NAME_DOC ( i_cppClass,
i_cppMember,
s_memberName,
s_doc )
Value:
PY_CLASS_PUBLIC_MEMBER_R_EX(i_cppClass, i_cppMember, s_memberName, s_doc,\
LASS_UNIQUENAME(LASS_CONCATENATE(lassPyImpl_publicMemberR_, i_cppClass)))

Export a public member as a read-only Python property, with custom name and docstring.

Wraps PY_CLASS_PUBLIC_MEMBER_R_EX() with auto-generated dispatcher name.

Parameters
i_cppClassC++ class containing the public member (unqualified name)
i_cppMemberC++ public data member name to export
s_memberNamePython property name (null-terminated C string literal)
s_docProperty documentation string (null-terminated C string literal, may be nullptr)
Example
PY_CLASS_PUBLIC_MEMBER_R_NAME_DOC(Parrot, color, "color", "Parrot's color")
#define PY_CLASS_PUBLIC_MEMBER_R_NAME_DOC(i_cppClass, i_cppMember, s_memberName, s_doc)
Export a public member as a read-only Python property, with custom name and docstring.

Definition at line 10412 of file pyobject_macros.h.

◆ PY_CLASS_PUBLIC_MEMBER_R_NAME

#define PY_CLASS_PUBLIC_MEMBER_R_NAME ( i_cppClass,
i_cppMember,
s_memberName )
Value:
PY_CLASS_PUBLIC_MEMBER_R_NAME_DOC(i_cppClass, i_cppMember, s_memberName, 0 )

Export a public member as a read-only Python property, with custom Python name.

Wraps PY_CLASS_PUBLIC_MEMBER_R_NAME_DOC() with no documentation.

Parameters
i_cppClassC++ class containing the public member (unqualified name)
i_cppMemberC++ public data member name to export
s_memberNamePython property name (null-terminated C string literal)
Example
PY_CLASS_PUBLIC_MEMBER_R_NAME(Parrot, color, "color")
#define PY_CLASS_PUBLIC_MEMBER_R_NAME(i_cppClass, i_cppMember, s_memberName)
Export a public member as a read-only Python property, with custom Python name.

Definition at line 10430 of file pyobject_macros.h.

◆ PY_CLASS_PUBLIC_MEMBER_R_DOC

#define PY_CLASS_PUBLIC_MEMBER_R_DOC ( i_cppClass,
i_cppMember,
s_doc )
Value:
PY_CLASS_PUBLIC_MEMBER_R_NAME_DOC(i_cppClass, i_cppMember, LASS_STRINGIFY(i_cppMember), s_doc)

Export a public member as a read-only Python property, with docstring.

Wraps PY_CLASS_PUBLIC_MEMBER_R_NAME_DOC() with member name as property name.

Parameters
i_cppClassC++ class containing the public member (unqualified name)
i_cppMemberC++ public data member name to export (also used as Python property name)
s_docProperty documentation string (null-terminated C string literal, may be nullptr)
Example
PY_CLASS_PUBLIC_MEMBER_R_DOC(Parrot, color, "Parrot's color")
#define PY_CLASS_PUBLIC_MEMBER_R_DOC(i_cppClass, i_cppMember, s_doc)
Export a public member as a read-only Python property, with docstring.

Definition at line 10447 of file pyobject_macros.h.

◆ PY_CLASS_PUBLIC_MEMBER_R

#define PY_CLASS_PUBLIC_MEMBER_R ( i_cppClass,
i_cppMember )
Value:
PY_CLASS_PUBLIC_MEMBER_R_NAME_DOC(i_cppClass, i_cppMember, LASS_STRINGIFY(i_cppMember), 0)

Export a public member as a read-only Python property.

Wraps PY_CLASS_PUBLIC_MEMBER_R_NAME_DOC() with member name as property name and no documentation.

Parameters
i_cppClassC++ class containing the public member (unqualified name)
i_cppMemberC++ public data member name to export (also used as Python property name)
Example

Definition at line 10463 of file pyobject_macros.h.