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 boost::ref;
10 using boost::python::call;
11 
12 namespace pyhelios{
13 
22 public:
23  // *** ATTRIBUTES *** //
24  // ******************** //
25  PyObject *pyCallback;
26 
27  // *** CONSTRUCTION / DESTRUCTION *** //
28  // ************************************ //
29  PySimulationCycleCallback(PyObject *pyCallback) : pyCallback(pyCallback) {}
30  virtual ~PySimulationCycleCallback() {}
31 
32  // *** F U N C T O R *** //
33  // *********************** //
35  std::vector<Measurement> &measurements,
36  std::vector<Trajectory> &trajectories,
37  std::string const &outpath
38  ) {
40  measurements,
41  trajectories,
42  outpath,
43  std::vector<std::string>{outpath},
44  false
45  );
46  PyGILState_STATE gilState = PyGILState_Ensure();
47  call<void>(pyCallback, ref(phow));
48  PyGILState_Release(gilState);
49  }
50 
51 };
52 
53 }
54 
55 #endif
Abstract class to handle simulation cycle callbacks.
Definition: SimulationCycleCallback.h:12
Python wrapper for helios output.
Definition: PyHeliosOutputWrapper.h:19
Python callback for each simulation cycle that has been completed.
Definition: PySimulationCycleCallback.h:21
void operator()(std::vector< Measurement > &measurements, std::vector< Trajectory > &trajectories, std::string const &outpath)
Callback functor which operates over vector of measurements.
Definition: PySimulationCycleCallback.h:34