HiPipe  0.7.0
C++17 data pipeline with Python bindings.
pyboost_is_registered.hpp
1 /****************************************************************************
2  * hipipe library
3  * Copyright (c) 2017, Cognexa Solutions s.r.o.
4  * Copyright (c) 2018, Iterait a.s.
5  * Author(s) Filip Matzner
6  *
7  * This file is distributed under the MIT License.
8  * See the accompanying file LICENSE.txt for the complete license agreement.
9  ****************************************************************************/
10 
11 #pragma once
12 #include <hipipe/build_config.hpp>
13 #ifdef HIPIPE_BUILD_PYTHON
14 
15 #include <boost/python.hpp>
16 
17 namespace hipipe::python::utility {
18 
23 template<typename T>
24 bool is_registered()
25 {
26  namespace py = boost::python;
27  py::type_info info = py::type_id<T>();
28  const py::converter::registration* reg = py::converter::registry::query(info);
29  return reg != nullptr && reg->m_to_python != nullptr;
30 }
31 
32 } // end namespace hipipe::python::utility
33 
34 #endif // HIPIPE_BUILD_PYTHON