00001
00012 #ifdef _MSC_VER
00013
00014 # pragma warning(disable:4231)
00015
00016
00017 # pragma warning(disable:4251)
00018
00019
00020 # pragma warning(disable:4275)
00021
00022
00023 # pragma warning(disable:4800)
00024 #endif
00025
00026
00027 #include <boost/python.hpp>
00028
00029 #include "PyDataSource.h"
00030 #include "PyNTupleController.h"
00031
00032 #include "datasrcs/CircularBuffer.h"
00033
00034 using std::vector;
00035 using namespace boost::python;
00036
00037 namespace hippodraw {
00038 namespace Python {
00039
00040 void
00041 export_NTupleController()
00042 {
00043 class_ < PyNTupleController, bases<>,
00044 PyNTupleController, boost::noncopyable >
00045 ( "NTupleController",
00046 "A singleton object to manage NTuple objects.",
00047 no_init )
00048
00049 .def ( "instance", &PyNTupleController::instance,
00050 return_value_policy < reference_existing_object > (),
00051 "instance () -> NTupleController\n"
00052 "\n"
00053 "Returns the single instance of the controller" )
00054
00055 .staticmethod( "instance" )
00056
00057 .def ( "createDataArray",
00058 &PyNTupleController::createDataArray,
00059 return_value_policy < manage_new_object > (),
00060 "createDataArray ( filename ) -> DataArray\n"
00061 "\n"
00062 "Creates a DataArray from file." )
00063
00064 .def ( "createNTuple",
00065 ( NTuple * ( PyNTupleController::* )
00066 ( ) )
00067 &PyNTupleController::createNTuple,
00068 return_value_policy < manage_new_object > (),
00069 "Creates an empty NTuple" )
00070
00071 .def ( "createNTuple",
00072 ( DataSource * ( PyNTupleController::* )
00073 ( const std::string & ) )
00074 &PyNTupleController::createNTuple,
00075 return_value_policy < manage_new_object > (),
00076 "createNTuple () -> NTuple\n"
00077 "createNTuple ( string ) -> NTuple\n"
00078 "\n"
00079 "Creates and registers an NTuple. The first method creates an\n"
00080 "empty NTuple object. The second method creates one from a\n"
00081 "file. Both methods return ownership of the created object to\n"
00082 "Python." )
00083
00084 .def ( "createCircularBuffer",
00085 ( CircularBuffer * ( PyNTupleController::* )
00086 ( unsigned int ) )
00087 & PyNTupleController::createCircularBuffer,
00088 return_value_policy < manage_new_object > (),
00089 "createCircularBuffer ( value ) -> CircularBuffer\n"
00090 "\n"
00091 "Creates and registers a CircularBuffer object with set number of\n"
00092 "columns." )
00093
00094 .def ( "registerNTuple",
00095 ( std::string ( PyNTupleController:: * )
00096 ( DataSource * ) )
00097 & PyNTupleController::registerNTuple,
00098 "Register an NTuple to make it visible to the application" )
00099
00100 .def ( "registerNTuple",
00101 ( void ( PyNTupleController:: * )
00102 ( const std::string &, DataSource * ) )
00103 & PyNTupleController::registerNTuple,
00104 "registerNTuple ( DataSource ) -> None\n"
00105 "registerNTuple ( string, DataSource ) -> None\n"
00106 "\n"
00107 "Register an NTuple to make it visible to the application. The\n"
00108 "first form takes the name from the DataSource object, if it has\n"
00109 "one, otherwise generates a unique name. The second form takes\n"
00110 "string argument for the name." )
00111
00112 .def ( "writeToFile",
00113 ( int ( PyNTupleController:: * )
00114 ( DataSource *, const std::string & ) )
00115 & PyNTupleController::writeNTupleToFile,
00116 "writeToFile ( DataSource, string ) -> value\n"
00117 "\n"
00118 "Writes the NTuple to a file as ASCII text. Returns 0 if\n"
00119 "successful." )
00120
00121 .def ( "findNTuple",
00122 ( DataSource * ( PyNTupleController:: * )
00123 ( const std::string & ) const )
00124 & PyNTupleController::findDataSource,
00125 return_value_policy < reference_existing_object > (),
00126 "findNTuple ( string ) -> DataSource\n"
00127 "\n"
00128 "Find an registered NTuple by its name and returns a reference to\n"
00129 "it. If the DataSource can not be found, an exception is thrown.\n"
00130 "\n"
00131 "Warning: if more than one DataSource has the same name,\n"
00132 "the first one found is returned." )
00133
00134 .def ( "changeName",
00135 ( void ( PyNTupleController:: * )
00136 ( DataSource *, const std::string & ) )
00137 & PyNTupleController::changeName,
00138 "changeName ( DataSource, string ) -> None\n"
00139 "\n"
00140 "Change the name of an NTuple.\n"
00141 "This method is deprecated, there's not need to do this" )
00142
00143 ;
00144
00145 }
00146
00147 }
00148 }