export_NTuple.cxx
Go to the documentation of this file.
1 
13 #ifdef _MSC_VER
14 // nonstandard extension used 'extern' before...
15 # pragma warning(disable:4231)
16 
17 // needs to have dll-interface used by client
18 # pragma warning(disable:4251)
19 
20 // non dll-interface struct
21 # pragma warning(disable:4275)
22 
23 // 'int' : forcing value to bool 'true' or 'false' (performance warning)
24 # pragma warning(disable:4800)
25 #endif
26 
27 // include first to avoid _POSIX_C_SOURCE warning.
28 #include <boost/python.hpp>
29 
30 #include "PyNTuple.h"
31 
32 using std::vector;
33 using namespace boost::python;
34 
35 namespace hippodraw {
36 namespace Python {
37 
38 void
40 {
41  class_ < NTuple, bases < DataSource > >
42  ( "NTupleInternal",
43  "A derived class of DataSource that stores its tabular data vectors of\n"
44  "double precision numbers in C++. An NTuple object can be created in\n"
45  "a number of ways including reading from a file using the\n"
46  "NTupleController",
47  init<>
48  ( "NTuple ( None ) -> NTuple\n"
49  "NTuple ( value ) -> NTuple\n"
50  "NTuple ( sequence ) -> NTuple\n"
51  "NTuple ( NTuple ) -> NTuple\n"
52  "\n"
53  "The form with no arguments creates an empty NTuple with no rows\n"
54  "or columns. The form with one value argument creates an empty\n"
55  "NTuple with `value' number of columns. The form with a sequence\n"
56  "argument creates an empty NTuple with the number of columns equal\n"
57  "to size of the sequence. The sequence should contain string which\n"
58  "are used as the column labels. The last form form creates an\n"
59  "NTuple\n whose contents is a copy of an existing one." ) )
60 
61  .def ( init < unsigned int > ( ) )
62 
63  .def ( init < const std::vector < std::string > & > ( ) )
64 
65  .def ( init < const NTuple & > () )
66 
67  .def ( "setLabels", &NTuple::setLabels,
68  "setLabels ( sequence ) -> None\n"
69  "\n"
70  "Sets the labels of the columns from the list of strings. If the\n"
71  "NTuple is empty, then also sets the number of columns to be the\n"
72  "size of the list. If the number of columns has already been\n"
73  "set, the the size of the list should be the same, otherwise\n"
74  "a RuntimeError exception is thrown." )
75 
76  .def ( "getLabel", &NTuple::getLabelAt,
77  return_value_policy < copy_const_reference > (),
78  "getLabel ( index ) -> string\n"
79  "\n"
80  "Returns the label at column index." )
81 
82  .def ( "getRow", &NTuple::getRow,
83  return_value_policy < copy_const_reference> (),
84  "getRow ( index ) -> list\n"
85  "\n"
86  "Returns the index row as list floats." )
87 
88  .def ( "setIntervalCount", &NTuple::setIntervalCount,
89  "setIntervalCount ( count ) -> None\n"
90  "\n"
91  "Sets the interval count between updates to the observers." )
92 
93  .def ( "setIntervalEnabled", &NTuple::setIntervalEnabled,
94  "setIntervalEnable ( Boolean ) -> None\n"
95  "\n"
96  "Sets the interval counting on or off" )
97 
98  ;
99 }
100 
101 void
103 {
104  class_ < PyNTuple, bases < NTuple > >
105  ( "NTuple",
106  "A derived class of DataSource that stores its tabular data vectors of\n"
107  "double precision numbers in C++. An NTuple object can be created in\n"
108  "a number of ways including reading from a file using the\n"
109  "NTupleController",
110  init<>
111  ( "NTuple ( None ) -> NTuple\n"
112  "NTuple ( value ) -> NTuple\n"
113  "NTuple ( sequence ) -> NTuple\n"
114  "NTuple ( NTuple ) -> NTuple\n"
115  "\n"
116  "The form with no arguments creates an empty NTuple with no rows\n"
117  "or columns. The form with one value argument creates an empty\n"
118  "NTuple with `value' number of columns. The form with a sequence\n"
119  "argument creates an empty NTuple with the number of columns equal\n"
120  "to size of the sequence. The sequence should contain string which\n"
121  "are used as the column labels. The last form form creates an\n"
122  "NTuple\n whose contents is a copy of an existing one." ) )
123 
124  .def ( init < unsigned int > ( ) )
125 
126  .def ( init < const std::vector < std::string > & > ( ) )
127 
128  .def ( init < const PyNTuple & > () )
129 
130  .def ( "setTitle", &PyNTuple::setTitle,
131  "setTitle ( string ) -> None\n"
132  "\n"
133  "Sets the title of the ntuple. The title by default appears at\n"
134  "the top of a Display." )
135 
136  .def ( "addColumn",
137  &PyNTuple::addColumn,
138  "addColumn ( label, sequence ) -> index\n"
139  "\n"
140  "Adds a new column with label." )
141 
142  .def ( "append", &PyNTuple::append,
143  "append ( DataSource ) -> None\n"
144  "\n"
145  "Appends the contents of the DataSource to the NTuple." )
146 
147  .def ( "replaceColumn",
148  ( void ( PyNTuple::* ) // function pointer cast
149  ( unsigned int,
150  const std::vector < double > & ) )
151  &PyNTuple::replaceColumn,
152  "replaceColumn ( index, sequence ) -> None\n"
153  "\n"
154  "Replaces the indexed column." )
155 
156  .def ( "replaceColumn",
157  ( void ( PyNTuple::* ) // function pointer cast
158  ( const std::string &, const std::vector < double > & ) )
159  &PyNTuple::replaceColumn,
160  "replaceColumn ( label, sequence ) -> None\n"
161  "\n"
162  "Replaces the labeled column." )
163 
164  .def ( "addRow",
165  &PyNTuple::addRow,
166  "addRow ( sequence ) -> None\n"
167  "\n"
168  "Append a row at the end." )
169 
170  .def ( "clear",
171  &PyNTuple::clear,
172  "clear () -> None\n"
173  "\n"
174  "Clears the data elements of the DataSource. That is, remove\n"
175  "all the rows while keeping the column labels." )
176 
177  ;
178 }
179 } // namespace Python
180 } // namespace hippodraw

Generated for HippoDraw Class Library by doxygen