Helios++
Helios software for LiDAR simulations
PySimulationCycleCallback.h
1 #pragma once
2 
3 #ifdef PYTHON_BINDING
4 
5 #include <SimulationCycleCallback.h>
6 #include <PyHeliosOutputWrapper.h>
7 #include <boost/python.hpp>
8 
9 using namespace boost::python;
10 using boost::ref;
11 
20 public:
21  // *** ATTRIBUTES *** //
22  // ******************** //
23  PyObject *pyCallback;
24 
25  // *** CONSTRUCTION / DESTRUCTION *** //
26  // ************************************ //
27  PySimulationCycleCallback(PyObject *pyCallback) : pyCallback(pyCallback) {}
28  virtual ~PySimulationCycleCallback() {}
29 
30  // *** F U N C T O R *** //
31  // *********************** //
32  void operator() (
33  std::vector<Measurement> &measurements,
34  std::vector<Trajectory> &trajectories
35  ) {
36  PyHeliosOutputWrapper phow(measurements, trajectories, false);
37  PyGILState_STATE gilState = PyGILState_Ensure();
38  call<void>(pyCallback, ref(phow));
39  PyGILState_Release(gilState);
40  }
41 
42 };
43 
44 
45 #endif
Python callback for each simulation cycle that has been completed.
Definition: PySimulationCycleCallback.h:19
Abstract class to handle simulation cycle callbacks.
Definition: SimulationCycleCallback.h:12
Python wrapper for helios output.
Definition: PyHeliosOutputWrapper.h:16