00001
00013 #ifdef _MSC_VER
00014
00015 # pragma warning(disable:4231)
00016
00017
00018 # pragma warning(disable:4251)
00019
00020
00021 # pragma warning(disable:4275)
00022
00023
00024 # pragma warning(disable:4800)
00025 #endif
00026
00027
00028 #include <boost/python.hpp>
00029
00030 #include "PyNTuple.h"
00031
00032 using std::vector;
00033 using namespace boost::python;
00034
00035 namespace hippodraw {
00036 namespace Python {
00037
00038 void
00039 export_NTuple()
00040 {
00041 class_ < NTuple, bases < DataSource > >
00042 ( "NTupleInternal",
00043 "A derived class of DataSource that stores its tabular data vectors of\n"
00044 "double precision numbers in C++. An NTuple object can be created in\n"
00045 "a number of ways including reading from a file using the\n"
00046 "NTupleController",
00047 init<>
00048 ( "NTuple ( None ) -> NTuple\n"
00049 "NTuple ( value ) -> NTuple\n"
00050 "NTuple ( sequence ) -> NTuple\n"
00051 "NTuple ( NTuple ) -> NTuple\n"
00052 "\n"
00053 "The form with no arguments creates an empty NTuple with no rows\n"
00054 "or columns. The form with one value argument creates an empty\n"
00055 "NTuple with `value' number of columns. The form with a sequence\n"
00056 "argument creates an empty NTuple with the number of columns equal\n"
00057 "to size of the sequence. The sequence should contain string which\n"
00058 "are used as the column labels. The last form form creates an\n"
00059 "NTuple\n whose contents is a copy of an existing one." ) )
00060
00061 .def ( init < unsigned int > ( ) )
00062
00063 .def ( init < const std::vector < std::string > & > ( ) )
00064
00065 .def ( init < const NTuple & > () )
00066
00067 .def ( "setLabels", &NTuple::setLabels,
00068 "setLabels ( sequence ) -> None\n"
00069 "\n"
00070 "Sets the labels of the columns from the list of strings. If the\n"
00071 "NTuple is empty, then also sets the number of columns to be the\n"
00072 "size of the list. If the number of columns has already been\n"
00073 "set, the the size of the list should be the same, otherwise\n"
00074 "a RuntimeError exception is thrown." )
00075
00076 .def ( "getLabel", &NTuple::getLabelAt,
00077 return_value_policy < copy_const_reference > (),
00078 "getLabel ( index ) -> string\n"
00079 "\n"
00080 "Returns the label at column index." )
00081
00082 .def ( "getRow", &NTuple::getRow,
00083 return_value_policy < copy_const_reference> (),
00084 "getRow ( index ) -> list\n"
00085 "\n"
00086 "Returns the index row as list floats." )
00087
00088 .def ( "setIntervalCount", &NTuple::setIntervalCount,
00089 "setIntervalCount ( count ) -> None\n"
00090 "\n"
00091 "Sets the interval count between updates to the observers." )
00092
00093 .def ( "setIntervalEnabled", &NTuple::setIntervalEnabled,
00094 "setIntervalEnable ( Boolean ) -> None\n"
00095 "\n"
00096 "Sets the interval counting on or off" )
00097
00098 ;
00099 }
00100
00101 void
00102 export_PyNTuple()
00103 {
00104 class_ < PyNTuple, bases < NTuple > >
00105 ( "NTuple",
00106 "A derived class of DataSource that stores its tabular data vectors of\n"
00107 "double precision numbers in C++. An NTuple object can be created in\n"
00108 "a number of ways including reading from a file using the\n"
00109 "NTupleController",
00110 init<>
00111 ( "NTuple ( None ) -> NTuple\n"
00112 "NTuple ( value ) -> NTuple\n"
00113 "NTuple ( sequence ) -> NTuple\n"
00114 "NTuple ( NTuple ) -> NTuple\n"
00115 "\n"
00116 "The form with no arguments creates an empty NTuple with no rows\n"
00117 "or columns. The form with one value argument creates an empty\n"
00118 "NTuple with `value' number of columns. The form with a sequence\n"
00119 "argument creates an empty NTuple with the number of columns equal\n"
00120 "to size of the sequence. The sequence should contain string which\n"
00121 "are used as the column labels. The last form form creates an\n"
00122 "NTuple\n whose contents is a copy of an existing one." ) )
00123
00124 .def ( init < unsigned int > ( ) )
00125
00126 .def ( init < const std::vector < std::string > & > ( ) )
00127
00128 .def ( init < const PyNTuple & > () )
00129
00130 .def ( "setTitle", &PyNTuple::setTitle,
00131 "setTitle ( string ) -> None\n"
00132 "\n"
00133 "Sets the title of the ntuple. The title by default appears at\n"
00134 "the top of a Display." )
00135
00136 .def ( "addColumn",
00137 &PyNTuple::addColumn,
00138 "addColumn ( label, sequence ) -> index\n"
00139 "\n"
00140 "Adds a new column with label." )
00141
00142 .def ( "append", &PyNTuple::append,
00143 "append ( DataSource ) -> None\n"
00144 "\n"
00145 "Appends the contents of the DataSource to the NTuple." )
00146
00147 .def ( "replaceColumn",
00148 ( void ( PyNTuple::* )
00149 ( unsigned int,
00150 const std::vector < double > & ) )
00151 &PyNTuple::replaceColumn,
00152 "replaceColumn ( index, sequence ) -> None\n"
00153 "\n"
00154 "Replaces the indexed column." )
00155
00156 .def ( "replaceColumn",
00157 ( void ( PyNTuple::* )
00158 ( const std::string &, const std::vector < double > & ) )
00159 &PyNTuple::replaceColumn,
00160 "replaceColumn ( label, sequence ) -> None\n"
00161 "\n"
00162 "Replaces the labeled column." )
00163
00164 .def ( "addRow",
00165 &PyNTuple::addRow,
00166 "addRow ( sequence ) -> None\n"
00167 "\n"
00168 "Append a row at the end." )
00169
00170 .def ( "clear",
00171 &PyNTuple::clear,
00172 "clear () -> None\n"
00173 "\n"
00174 "Clears the data elements of the DataSource. That is, remove\n"
00175 "all the rows while keeping the column labels." )
00176
00177 ;
00178 }
00179 }
00180 }