Loading...
Searching...
No Matches
dynamic-graph-py.hh
Go to the documentation of this file.
1#ifndef DYNAMIC_GRAPH_PY
2#define DYNAMIC_GRAPH_PY
3
4#include <dynamic-graph/debug.h>
5#include <dynamic-graph/exception-factory.h>
6#include <dynamic-graph/signal-base.h>
7
8#include <boost/python.hpp>
9#include <boost/python/stl_iterator.hpp>
10#include <iostream>
11#include <sstream>
12
14
15namespace bp = boost::python;
16
17namespace dynamicgraph {
18namespace python {
19
20template <typename Iterator>
21inline bp::list to_py_list(Iterator begin, Iterator end) {
22 typedef typename Iterator::value_type T;
23 bp::list lst;
24 std::for_each(begin, end, [&](const T& t) { lst.append(t); });
25 return lst;
26}
27
28template <typename Iterator>
29inline bp::tuple to_py_tuple(Iterator begin, Iterator end) {
30 return bp::tuple(to_py_list(begin, end));
31}
32
33template <typename T>
34inline std::vector<T> to_std_vector(const bp::object& iterable) {
35 return std::vector<T>(bp::stl_input_iterator<T>(iterable),
36 bp::stl_input_iterator<T>());
37}
38
39void exposeSignals();
40
41// Declare functions defined in other source files
42namespace signalBase {
43SignalBase<int>* createSignalWrapper(const char* name, const char* type,
44 bp::object object);
45} // namespace signalBase
46namespace entity {
47
49void addCommands(boost::python::object obj);
50void addSignals(boost::python::object obj);
51
52Entity* create(const char* type, const char* name);
53bp::object executeCmd(bp::tuple args, bp::dict);
54} // namespace entity
55
56namespace factory {
57bp::tuple getEntityClassList();
58}
59namespace pool {
60void writeGraph(const char* filename);
61bp::list getEntityList();
62const std::map<std::string, Entity*>* getEntityMap();
63} // namespace pool
64namespace debug {
65void addLoggerFileOutputStream(const char* filename);
71} // namespace debug
72
73} // namespace python
74} // namespace dynamicgraph
75
76#endif
void realTimeLoggerDestroy()
Definition debug-py.cc:43
void addLoggerCoutOutputStream()
Definition debug-py.cc:41
void closeLoggerFileOutputStream()
Definition debug-py.cc:37
void addLoggerFileOutputStream(const char *filename)
Definition debug-py.cc:27
void realTimeLoggerSpinOnce()
Definition debug-py.cc:45
void realTimeLoggerInstance()
Definition debug-py.cc:47
void addCommands(boost::python::object obj)
Entity * create(const char *type, const char *name)
Create an instance of Entity.
Definition entity-py.cc:57
void addSignals(boost::python::object obj)
bp::object executeCmd(bp::tuple args, bp::dict)
Definition entity-py.cc:79
bp::tuple getEntityClassList()
Get name of entity.
Definition factory-py.cc:20
void writeGraph(const char *filename)
Definition pool-py.cc:15
const std::map< std::string, Entity * > * getEntityMap()
Definition pool-py.cc:19
bp::list getEntityList()
Get list of entities.
Definition pool-py.cc:26
SignalBase< int > * createSignalWrapper(const char *name, const char *type, bp::object object)
Create an instance of SignalWrapper.
Definition signal-base-py.cc:156
std::vector< T > to_std_vector(const bp::object &iterable)
Definition dynamic-graph-py.hh:34
bp::tuple to_py_tuple(Iterator begin, Iterator end)
Definition dynamic-graph-py.hh:29
void exposeSignals()
Definition signal-base-py.cc:109
bp::list to_py_list(Iterator begin, Iterator end)
Definition dynamic-graph-py.hh:21
Definition convert-dg-to-py.hh:8