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 #include "datasrcs/NTuple.h"
00027
00028 #include <boost/python.hpp>
00029
00030 using std::vector;
00031 using namespace boost::python;
00032
00033 namespace hippodraw {
00034 namespace Python {
00035
00036 void
00037 export_NTuple()
00038 {
00039 class_ < NTuple, bases < DataSource > >
00040 ( "NTuple",
00041 "A derived class of DataSource that stores its tabular data vectors of\n"
00042 "double preceision numbers in C++. An NTuple object can be created in\n"
00043 "a number of ways including reading from a file using the\n"
00044 "NTupleController",
00045 init<>
00046 ( "NTuple ( None ) -> NTuple\n"
00047 "NTuple ( value ) -> NTuple\n"
00048 "NTuple ( sequence ) -> NTuple\n"
00049 "NTuple ( NTuple ) -> NTuple\n"
00050 "\n"
00051 "The form with no arguments creates an empty NTuple with no rows\n"
00052 "or columns. The form with one value agrument creates an empty\n"
00053 "NTuple with `value' number of columns. The form with a sequence\n"
00054 "argument creates an empty NTuple with the number of columns equal\n"
00055 "to size of the sequence. The sequence should contain string which\n"
00056 "are used as the column labels. The last form form creates an\n"
00057 "NTuple\n wwhose contents is a copy of an existing one." ) )
00058
00059 .def ( init < unsigned int > ( ) )
00060
00061 .def ( init < const std::vector < std::string > & > ( ) )
00062
00063 .def ( init < const NTuple & > () )
00064
00065 .def ( "setLabels", &NTuple::setLabels,
00066 "setLabels ( sequence ) -> None\n"
00067 "\n"
00068 "Sets the labels of the columns from the list of strings. If the\n"
00069 "NTuple is empty, then also sets the number of columns to be the\n"
00070 "size of the list. If the number of columns has already been\n"
00071 "set, the the size of the list should be the same, otherwise\n"
00072 "a RuntimeError exception is thrown." )
00073
00074 .def ( "getLabel", &NTuple::getLabelAt,
00075 return_value_policy < copy_const_reference > (),
00076 "getLabel ( index ) -> string\n"
00077 "\n"
00078 "Returns the label at column index." )
00079
00080 .def ( "addColumn",
00081 ( int ( NTuple::* )
00082 ( const std::string &,
00083 const std::vector < double > & ) )
00084 &NTuple::addColumn,
00085 "addColumn ( label, sequence ) -> index\n"
00086 "\n"
00087 "Adds a new column with label." )
00088
00089 .def ( "replaceColumn",
00090 ( void ( NTuple::* )
00091 ( unsigned int,
00092 const std::vector < double > & ) )
00093 &NTuple::replaceColumn,
00094 "replaceColumn ( index, sequence ) -> None\n"
00095 "\n"
00096 "Replaces the indexed column." )
00097
00098 .def ( "replaceColumn",
00099 ( void ( NTuple::* )
00100 ( const std::string &, const std::vector < double > & ) )
00101 &NTuple::replaceColumn,
00102 "replaceColumn ( label, sequence ) -> None\n"
00103 "\n"
00104 "Replaces the labeled column." )
00105
00106 .def ( "addRow", &NTuple::addRow,
00107 "addRow ( sequence ) -> None\n"
00108 "\n"
00109 "Append a row at the end." )
00110
00111 .def ( "getRow", &NTuple::getRow,
00112 return_value_policy < copy_const_reference> (),
00113 "getRow ( index ) -> list\n"
00114 "\n"
00115 "Returns the index row as list floats." )
00116
00117 .def ( "setIntervalCount", &NTuple::setIntervalCount,
00118 "setIntervalCount ( count ) -> None\n"
00119 "\n"
00120 "Sets the interval count between updates to the observers." )
00121
00122 .def ( "setIntervalEnabled", &NTuple::setIntervalEnabled,
00123 "setIntervalEnable ( boolean ) -> None\n"
00124 "\n"
00125 "Sets the interval counting on or off" )
00126
00127 ;
00128 }
00129
00130 }
00131 }