Helios++
Helios software for LiDAR simulations
PyHeliosUtils.h
1 #pragma once
2 #ifdef PYTHON_BINDING
3 
4 #include <boost/python/errors.hpp>
5 
7 public:
14  static size_t handlePythonIndex(long _index, size_t n){
15  size_t index = (size_t) _index;
16  if(_index < 0){
17  index = (size_t) (n + _index);
18  }
19  if(index >= n){
20  std::stringstream ss;
21  ss << "Index " << _index << " out of range";
22  PyErr_SetString(PyExc_IndexError, ss.str().c_str());
23  boost::python::throw_error_already_set();
24  }
25  return index;
26  }
27 };
28 
29 #endif
static size_t handlePythonIndex(long _index, size_t n)
Translate received index from python, where negative values have a special meaning (i...
Definition: PyHeliosUtils.h:14
Definition: PyHeliosUtils.h:6