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