export_DataSource.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 "datasrcs/DataSource.h"
30 
31 using std::vector;
32 using namespace boost::python;
33 
34 namespace hippodraw {
35 namespace Python {
36 
37 void
39 {
40  class_ < DataSource, bases<>,
41  DataSource, boost::noncopyable >
42  ( "DataSource",
43  "This class is an abstract base class defining the data table,\n"
44  "called an ntuple. That is a table with some number of columns and a\n"
45  "perhaps large number of rows. It implements some of the\n"
46  "but the actual data storage is done in a derived class.",
47  no_init )
48 
49  .add_property ( "columns",
50  &DataSource::columns )
51 
52  .add_property ( "rows",
53  &DataSource::rows )
54 
55  .def ( "getTitle", &DataSource::title,
56  return_value_policy < copy_const_reference > (),
57  "getTitle () -> string\n"
58  "\n"
59  "Returns the title of the ntuple." )
60 
61  .def ( "setName", &DataSource::setName,
62  "setName ( string ) -> None\n"
63  "\n"
64  "Sets the name of the ntuple. The name should be a unique\n"
65  "string withing a running application. It may appear in the\n"
66  "Inspector." )
67 
68  .def ( "setTitle", &DataSource::setTitle,
69  "setTitle ( string ) -> None\n"
70  "\n"
71  "Sets the title of the ntuple. The title by default appears at\n"
72  "the top of a Display." )
73 
74  .def ( "getLabels", &DataSource::getLabels,
75  return_value_policy < copy_const_reference > (),
76  "getLabels () -> list\n"
77  "\n"
78  "Returns list of column labels." )
79 
80  .def ( "getColumn",
81  ( const std::vector < double > & (DataSource::* ) // fptr
82  ( unsigned int ) const) // function signature
83  &DataSource::getColumn,
84  return_value_policy < copy_const_reference> (),
85  "getColumn ( label ) -> list\n"
86  "getColumn ( index ) -> list\n"
87  "\n"
88  "Get a column by its label or index. Returns copy of the\n"
89  "contents." )
90 
91  .def ( "getColumn",
92  ( const std::vector < double > & (DataSource::* ) // fptr
93  ( const std::string & ) const) // function signature
94  &DataSource::getColumn,
95  return_value_policy < copy_const_reference> () )
96 
97  .def ( "replaceColumn",
98  ( void ( DataSource::* ) // function pointer
99  ( const std::string &,
100  const std::vector < double > & ) ) // signature
101  &DataSource::replaceColumn,
102  "replaceColumn ( label, list ) -> None\n"
103  "\n"
104  "Replaces the column of data by abel." )
105 
106  .def ( "clear",
107  &DataSource::clear,
108  "clear () -> None\n"
109  "\n"
110  "Clears the data elements of the DataSource. That is, remove\n"
111  "all the rows while keeping the column labels." )
112 
113  ;
114 }
115 
116 } // namespace Python
117 } // namespace hippodraw

Generated for HippoDraw Class Library by doxygen