43#ifndef LASS_GUARDIAN_OF_INCLUSION_UTIL_MODULE_DEFINITION_H
44#define LASS_GUARDIAN_OF_INCLUSION_UTIL_MODULE_DEFINITION_H
136 const char*
name()
const {
return name_.get(); }
141 void setName(
const char* name);
144 const char*
doc()
const {
return doc_.get(); }
149 void setDoc(
const char* doc);
152 PyObject*
module()
const {
return module_; }
158 void setPreInject(
const TPreInject& callback);
164 void setPostInject(
const TPostInject& callback);
173 void addFunctionDispatcher(PyCFunction dispatcher,
const char* name,
const char* doc, PyCFunction& overloadChain);
192 void addObject(PyObject*
object,
const char* name);
198 void addLong(
long object,
const char* name);
204 void addString(
const char*
object,
const char* name);
211 void injectLong(
const char* name,
long value);
218 void injectString(
const char* name,
const char* value);
225 template <
typename T>
228 PyModule_AddObject(module_,
name, lass::python::pyBuildSimpleObject( std::forward<T>(
object) ));
244 typedef std::unique_ptr<char[]> TScopedCString;
245 typedef std::vector<impl::ClassDefinition*> TClassDefs;
246 typedef std::vector<EnumDefinitionBase*> TEnumDefs;
247 typedef std::vector<PyMethodDef> TMethods;
261 TScopedCString object;
263 typedef std::vector<NamedObject*> TObjects;
264 typedef std::vector<LongObject*> TLongObjects;
265 typedef std::vector<StringObject*> TStringObjects;
268 PyObject* doInject();
274 TLongObjects longObjects_;
275 TStringObjects stringObjects_;
276 TScopedCString name_;
278 TPreInject preInject_;
279 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.