1 // (C) Copyright 2006 Douglas Gregor <doug.gregor -at- gmail.com>
2 
3 // Use, modification and distribution is subject to the Boost Software
4 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
6 
7 //  Authors: Douglas Gregor
8 
9 /** @file timer.cpp
10  *
11  *  This file reflects the Boost.MPI @c timer class into
12  *  Python.
13  */
14 #include <boost/python.hpp>
15 #include <boost/mpi/timer.hpp>
16 
17 using namespace boost::python;
18 using namespace boost::mpi;
19 
20 namespace boost { namespace mpi { namespace python {
21 
22 extern const char* timer_docstring;
23 extern const char* timer_default_constructor_docstring;
24 extern const char* timer_restart_docstring;
25 extern const char* timer_elapsed_docstring;
26 extern const char* timer_elapsed_min_docstring;
27 extern const char* timer_elapsed_max_docstring;
28 extern const char* timer_time_is_global_docstring;
29 
export_timer()30 void export_timer()
31 {
32   using boost::python::arg;
33   using boost::python::object;
34 
35   class_<timer>("Timer", timer_docstring)
36     .def(init<>())
37     .def("restart", &timer::restart, timer_restart_docstring)
38     .add_property("elapsed", &timer::elapsed, timer_elapsed_docstring)
39     .add_property("elapsed_min", &timer::elapsed_min,
40                   timer_elapsed_min_docstring)
41     .add_property("elapsed_max", &timer::elapsed_max,
42                   timer_elapsed_max_docstring)
43     .add_property("time_is_global", &timer::time_is_global,
44                   timer_time_is_global_docstring)
45     ;
46 }
47 
48 } } } // end namespace boost::mpi::python
49