export_NumArrayTuple.cxx
Go to the documentation of this file.
1 
12 // for have numarray etc
13 #ifdef HAVE_CONFIG_H
14 #include "config.h"
15 #endif
16 
17 #ifdef _MSC_VER
18 // nonstandard extension used 'extern' before...
19 # pragma warning(disable:4231)
20 
21 // needs to have dll-interface used by client
22 # pragma warning(disable:4251)
23 
24 // non dll-interface struct
25 # pragma warning(disable:4275)
26 
27 // 'int' : forcing value to bool 'true' or 'false' (performance warning)
28 # pragma warning(disable:4800)
29 #endif
30 
31 // include first to avoid _POSIX_C_SOURCE warning.
32 #include <boost/python.hpp>
33 
34 #define PY_ARRAY_UNIQUE_SYMBOL HippoPyArrayHandle
35 
36 //#include "num_util.h"
37 
38 #include "NumArrayTuple.h"
39 
40 using namespace boost::python;
41 
42 namespace hippodraw {
43 namespace Python {
44 
45 void
47 {
48  import_array();
49 
50 #ifdef HAVE_NUMERIC
51  numeric::array::set_module_and_type
52  ( "Numeric",
53  "ArrayType" );
54 #else
55 #ifdef HAVE_NUMPY
56  numeric::array::set_module_and_type
57  ( "numpy",
58  "ndarray" );
59 #else
60  numeric::array::set_module_and_type (); // default numarray & NDarray
61 #endif
62 #endif
63 
64  class_ < NumArrayTuple, bases < DataSource > > ( "NumArrayTuple",
65  "Interface to numarray Python extension module.",
66  init< > ( "Creates an empty NumArrayTuple" ) )
67 
68 // .add_property ( "rows", &NumArrayTuple::rows )
69 
70  .def ( "setLabels", &NumArrayTuple::setLabels,
71  args ( "[label, ...]" ),
72  "Sets the labels of the columns." )
73 
74  .def ( "getLabel", &NumArrayTuple::getLabelAt,
75  return_value_policy < copy_const_reference > () )
76 
77 // .def ( "getLabels", &NumArrayTuple::getLabels,
78 // return_value_policy < copy_const_reference > () )
79 
80  .def ( "addColumn",
81  &NumArrayTuple::addColumn,
82  "Adds the array as a new column with label" )
83 
84  .def ( "replaceColumn",
85  ( void ( NumArrayTuple:: * ) //function pointer
86  ( unsigned int, numeric::array ) ) // signature
87  &NumArrayTuple::replaceColumn,
88  "Replaces existing column with new array\n"
89  "Args:\n"
90  "\t index\n"
91  "\t numarray" )
92 
93  .def ( "replaceColumn",
94  ( void ( NumArrayTuple:: * ) //function pointer
95  ( const std::string &, numeric::array ) ) // signature
96  &NumArrayTuple::replaceColumn,
97  "Replaces existing column with new array\n"
98  "Args:\n"
99  "\t label\n"
100  "\t numarray" )
101 
102  .def ( "notifyObservers",
103  &NumArrayTuple::notifyObservers,
104  "Sends update message to all observers." )
105 
106  ;
107 }
108 
109 } // namespace Python
110 } // namespace hippodraw

Generated for HippoDraw Class Library by doxygen