43#ifndef LASS_GUARDIAN_OF_INCLUSION_UTIL_MODULE_DEFINITION_H
44#define LASS_GUARDIAN_OF_INCLUSION_UTIL_MODULE_DEFINITION_H
132 const char*
name()
const {
return name_.get(); }
137 void setName(
const char* name);
140 const char*
doc()
const {
return doc_.get(); }
145 void setDoc(
const char* doc);
148 PyObject*
module()
const {
return module_; }
154 void setPreInject(
const TPreInject& callback);
160 void setPostInject(
const TPostInject& callback);
169 void addFunctionDispatcher(PyCFunction dispatcher,
const char* name,
const char* doc, PyCFunction& overloadChain);
188 void addObject(PyObject*
object,
const char* name);
194 void addLong(
long object,
const char* name);
200 void addString(
const char*
object,
const char* name);
207 void injectLong(
const char* name,
long value);
214 void injectString(
const char* name,
const char* value);
221 template <
typename T>
224 PyModule_AddObject(module_,
name, lass::python::pyBuildSimpleObject( std::forward<T>(
object) ));
240 typedef std::unique_ptr<char[]> TScopedCString;
241 typedef std::vector<impl::ClassDefinition*> TClassDefs;
242 typedef std::vector<EnumDefinitionBase*> TEnumDefs;
243 typedef std::vector<PyMethodDef> TMethods;
257 TScopedCString object;
259 typedef std::vector<NamedObject*> TObjects;
260 typedef std::vector<LongObject*> TLongObjects;
261 typedef std::vector<StringObject*> TStringObjects;
264 PyObject* doInject();
270 TLongObjects longObjects_;
271 TStringObjects stringObjects_;
272 TScopedCString name_;
274 TPreInject preInject_;
275 TPostInject postInject_;
Base class of all enum definitions.
const char * doc() const
Get the module documentation string.
const char * name() const
Get the module name.
void injectObject(T &&object, const char *name)
Inject an arbitrary object directly into an already created module.
PyObject * module() const
Get the Python module object (available after inject() has been called).
ModuleDefinition(const char *name, const char *doc=0)
Construct module definition with name and optional documentation.
util::Callback1< PyObject * > TPostInject
Callback type for post-injection hooks (called after module creation with module object).
util::Callback0 TPreInject
Callback type for pre-injection hooks (called before module creation).
Definition of a Python class.
callback with 0 parameter(s) and without returnvalue.
callback with 1 parameter(s) but without returnvalue.
use as base class if derived should not be copyable
Comprehensive C++ to Python binding library.
Library for Assembled Shared Sources.