"git@developer.sourcefind.cn:OpenDAS/dgl.git" did not exist on "b740c3f0ba2e89f2bdb6fb26393ac004c2f1ef48"
boost_python_utils.h 577 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Copyright (C) 2013  Davis E. King (davis@dlib.net)
// License: Boost Software License   See LICENSE.txt for the full license.
#ifndef DLIB_BOOST_PYTHON_UtILS_H__
#define DLIB_BOOST_PYTHON_UtILS_H__

#include <boost/python.hpp>

inline bool hasattr(
    boost::python::object obj, 
    const std::string& attr_name
) 
/*!
    ensures
        - if (obj has an attribute named attr_name) then
            - returns true
        - else
            - returns false
!*/
{
     return PyObject_HasAttrString(obj.ptr(), attr_name.c_str());
}

#endif // DLIB_BOOST_PYTHON_UtILS_H__