OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
PythonExtension.h
Go to the documentation of this file.
1/*****************************************************************/
8#pragma once
9
10#include <Python.h>
11
12#include <string>
13
15
16 static PyObject* OT_GetPropertyValue(PyObject* _self, PyObject* _args);
17
18 static PyObject* OT_GetScript(PyObject* _self, PyObject* _args);
19
20 static PyObject* OT_SetPropertyValue(PyObject* _self, PyObject* _args);
21
22 static PyObject* OT_Flush(PyObject* _self, PyObject* _args);
23
24 static PyObject* OT_FlushEntity(PyObject* _self, PyObject* _args);
25
26 static PyObject* OT_GetTableCell(PyObject* _self, PyObject* _args);
27
28 static PyObject* OT_GetPortData(PyObject* _self, PyObject* _args);
29
30 static PyObject* OT_SetPortData(PyObject* _self, PyObject* _args);
31
32 static PyMethodDef OTMethods[] = {
33
34 {"GetPropertyValue", OT_GetPropertyValue, METH_VARARGS, "Get the value of a requested property from a requested entity."},
35 {"GetTableCellValue", OT_GetTableCell, METH_VARARGS, "Get the value of a cell from a requested entity."},
36 {"SetPropertyValue", OT_SetPropertyValue, METH_VARARGS, "Set the property value of a requested property from a requested entity."},
37 {"Flush", OT_Flush, METH_NOARGS, "Apply all changes on entity properties."},
38 {"FlushEntity", OT_FlushEntity, METH_VARARGS, "Apply all changes on requested entity."},
39 {"GetPythonScript", OT_GetScript, METH_VARARGS, "Executes another python script that is stored within OpenTwin."},
40 {"GetPortData", OT_GetPortData, METH_VARARGS, "For Block Items. Gets datachunks from the ingoing ports."},
41 {"SetPortData", OT_SetPortData, METH_VARARGS, "For Block Items. Sets datachunks from the outgoing ports."},
42 {NULL, NULL, 0, NULL} // Sentinel
43 };
44
45 static std::string otModuleDescription = "This module holds functions that call c++ functions, provided by the OpenTwin framework. These functions enable the access to OpenTwin's entities and their properties.";
46
47 static struct PyModuleDef OTModule = {
48 PyModuleDef_HEAD_INIT,
49 "OpenTwin", // name of module
50 otModuleDescription.c_str(), // module documentation, may be NULL
51 -1, // size of per-interpreter state of the module, or -1 if the module keeps state in global variables.
53 };
54
55
56
57 PyMODINIT_FUNC
59 {
60 return PyModule_Create(&OTModule);
61 }
62
63};
64
65#include "PythonExtension.hpp"
Definition PythonExtension.h:14
static PyObject * OT_GetTableCell(PyObject *_self, PyObject *_args)
Definition PythonExtension.hpp:108
PyMODINIT_FUNC PyInit_OpenTwin(void)
Definition PythonExtension.h:58
static PyMethodDef OTMethods[]
Definition PythonExtension.h:32
static PyObject * OT_GetPropertyValue(PyObject *_self, PyObject *_args)
Definition PythonExtension.hpp:13
static PyObject * OT_Flush(PyObject *_self, PyObject *_args)
Definition PythonExtension.hpp:87
static PyObject * OT_GetPortData(PyObject *_self, PyObject *_args)
Definition PythonExtension.hpp:128
static PyObject * OT_SetPropertyValue(PyObject *_self, PyObject *_args)
Definition PythonExtension.hpp:71
static PyObject * OT_GetScript(PyObject *_self, PyObject *_args)
Definition PythonExtension.hpp:27
static PyObject * OT_FlushEntity(PyObject *_self, PyObject *_args)
Definition PythonExtension.hpp:97
static PyObject * OT_SetPortData(PyObject *_self, PyObject *_args)
Definition PythonExtension.hpp:140
static std::string otModuleDescription
Definition PythonExtension.h:45
static struct PyModuleDef OTModule
Definition PythonExtension.h:47