export_NTupleController.cxx
Go to the documentation of this file.
1 
12 #ifdef _MSC_VER
13 // nonstandard extension used 'extern' before...
14 # pragma warning(disable:4231)
15 
16 // needs to have dll-interface used by client
17 # pragma warning(disable:4251)
18 
19 // non dll-interface struct
20 # pragma warning(disable:4275)
21 
22 // 'int' : forcing value to bool 'true' or 'false' (performance warning)
23 # pragma warning(disable:4800)
24 #endif
25 
26 // include first to avoid _POSIX_C_SOURCE warning.
27 #include <boost/python.hpp>
28 
29 #include "PyDataSource.h"
30 #include "PyNTupleController.h"
31 
33 
34 using std::vector;
35 using namespace boost::python;
36 
37 namespace hippodraw {
38 namespace Python {
39 
40 void
42 {
43  class_ < PyNTupleController, bases<>,
44  PyNTupleController, boost::noncopyable >
45  ( "NTupleController",
46  "A singleton object to manage NTuple objects.",
47  no_init )
48 
49  .def ( "instance", &PyNTupleController::instance,
50  return_value_policy < reference_existing_object > (),
51  "instance () -> NTupleController\n"
52  "\n"
53  "Returns the single instance of the controller" )
54 
55  .staticmethod( "instance" )
56 
57  .def ( "createDataArray",
58  &PyNTupleController::createDataArray,
59  return_value_policy < manage_new_object > (),
60  "createDataArray ( filename ) -> DataArray\n"
61  "\n"
62  "Creates a DataArray from file." )
63 
64  .def ( "createNTuple",
65  ( NTuple * ( PyNTupleController::* ) // function point cast
66  ( ) ) // function signature
67  &PyNTupleController::createNTuple,
68  return_value_policy < manage_new_object > (),
69  "Creates an empty NTuple" )
70 
71  .def ( "createNTuple",
72  ( DataSource * ( PyNTupleController::* ) // function point cast
73  ( const std::string & ) ) // function signature
74  &PyNTupleController::createNTuple,
75  return_value_policy < manage_new_object > (),
76  "createNTuple () -> NTuple\n"
77  "createNTuple ( string ) -> NTuple\n"
78  "\n"
79  "Creates and registers an NTuple. The first method creates an\n"
80  "empty NTuple object. The second method creates one from a\n"
81  "file. Both methods return ownership of the created object to\n"
82  "Python." )
83 
84  .def ( "createCircularBuffer",
85  ( CircularBuffer * ( PyNTupleController::* ) // function point cast
86  ( unsigned int ) ) // function signature
87  & PyNTupleController::createCircularBuffer,
88  return_value_policy < manage_new_object > (),
89  "createCircularBuffer ( value ) -> CircularBuffer\n"
90  "\n"
91  "Creates and registers a CircularBuffer object with set number of\n"
92  "columns." )
93 
94  .def ( "registerNTuple",
95  ( std::string ( PyNTupleController:: * ) // function pointer cast
96  ( DataSource * ) ) // function signature
97  & PyNTupleController::registerNTuple,
98  "Register an NTuple to make it visible to the application" )
99 
100  .def ( "registerNTuple",
101  ( void ( PyNTupleController:: * ) // function pointer cast
102  ( const std::string &, DataSource * ) ) // function signature
103  & PyNTupleController::registerNTuple,
104  "registerNTuple ( DataSource ) -> None\n"
105  "registerNTuple ( string, DataSource ) -> None\n"
106  "\n"
107  "Register an NTuple to make it visible to the application. The\n"
108  "first form takes the name from the DataSource object, if it has\n"
109  "one, otherwise generates a unique name. The second form takes\n"
110  "string argument for the name." )
111 
112  .def ( "writeToFile",
113  ( int ( PyNTupleController:: * ) // function pointer cast
114  ( DataSource *, const std::string & ) ) // function signature
115  & PyNTupleController::writeNTupleToFile,
116  "writeToFile ( DataSource, string ) -> value\n"
117  "\n"
118  "Writes the NTuple to a file as ASCII text. Returns 0 if\n"
119  "successful." )
120 
121  .def ( "findNTuple",
122  ( DataSource * ( PyNTupleController:: * ) // function pointer cast
123  ( const std::string & ) const ) // function signature
124  & PyNTupleController::findDataSource,
125  return_value_policy < reference_existing_object > (),
126  "findNTuple ( string ) -> DataSource\n"
127  "\n"
128  "Find an registered NTuple by its name and returns a reference to\n"
129  "it. If the DataSource can not be found, an exception is thrown.\n"
130  "\n"
131  "Warning: if more than one DataSource has the same name,\n"
132  "the first one found is returned." )
133 
134  .def ( "changeName",
135  ( void ( PyNTupleController:: * ) // function pointer cast
136  ( DataSource *, const std::string & ) ) // function signature
137  & PyNTupleController::changeName,
138  "changeName ( DataSource, string ) -> None\n"
139  "\n"
140  "Change the name of an NTuple.\n"
141  "This method is deprecated, there's not need to do this" )
142 
143  ;
144 
145 }
146 
147 } // namespace Python
148 } // namespace hippodraw

Generated for HippoDraw Class Library by doxygen