NumArrayTuple.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 
14 #ifndef NumArrayTuple_H
15 #define NumArrayTuple_H
16 
17 // for have numarray etc
18 #ifdef HAVE_CONFIG_H
19 #include "config.h"
20 #endif
21 
22 #ifdef HAVE_NUMPY
23 #include <numpy/noprefix.h>
24 #else
25 #ifdef HAVE_NUMERIC
26 #include <Numeric/arrayobject.h>
27 #else
28 #include <numarray/arrayobject.h>
29 typedef int intp;
30 #endif
31 #endif
32 
33 #include "datasrcs/DataSource.h"
34 
35 namespace boost {
36  namespace python {
37  namespace numeric {
38  class array;
39  }
40  }
41 }
42 
43 namespace hippodraw {
44 
54 class NumArrayTuple : public DataSource
55 {
56 
57  private:
58 
61  std::vector < boost::python::numeric::array > m_data;
62 
67  mutable std::vector < double > m_row;
68 
69  public:
70 
73  NumArrayTuple ();
74 
77  virtual ~NumArrayTuple();
78 
82  virtual void copy ( const DataSource & );
83 
87  virtual void notifyObservers ( ) const;
88 
91  virtual unsigned int rows () const;
92 
95  virtual bool empty () const;
96 
97  virtual double valueAt ( unsigned int row, unsigned int column ) const;
98 
107  int addColumn ( const std::string & label,
108  boost::python::numeric::array array );
109 
115  void replaceColumn ( unsigned int index,
116  boost::python::numeric::array array );
117 
123  void replaceColumn ( const std::string & label,
124  boost::python::numeric::array array );
125 
127  boost::python::numeric::array
128  getNumArray( const std::string & label ) const;
129 
131  boost::python::numeric::array
132  getNumArray( unsigned int index ) const;
133 
136  virtual const std::vector < double > & getRow ( unsigned int index ) const;
137 
144  virtual void setShape ( std::vector < unsigned int > & shape );
145 
148  const std::vector < unsigned int > & getShape () const;
149 
156  virtual void fillShape ( std::vector < intptr_t > & v,
157  unsigned int column ) const;
158 
160  virtual void clear ();
161 
163  virtual void reserve ( unsigned int count );
164 
166  virtual double
167  operator [] ( std::vector < unsigned int > & indices ) const;
168 
169 };
170 
171 } // namespace hippodraw
172 
173 #endif // NumArrayTuple_H

Generated for HippoDraw Class Library by doxygen