ListTuple.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 
14 #ifndef ListTuple_H
15 #define ListTuple_H
16 
17 #include "datasrcs/DataSource.h"
18 
19 namespace boost {
20  namespace python {
21  class list;
22  }
23 }
24 
25 namespace hippodraw {
26 
40 class ListTuple : public DataSource
41 {
42 
43 private:
44 
47  std::vector < boost::python::list > m_data;
48 
53  mutable std::vector < double > m_row;
54 
55 public:
56 
59  ListTuple ();
60 
63  virtual ~ListTuple();
64 
74  unsigned int static getSize ( const boost::python::list & sequence );
75 
79  virtual void copy ( const DataSource & );
80 
84  virtual void notifyObservers ( ) const;
85 
88  virtual unsigned int rows () const;
89 
92  virtual bool empty () const;
93 
94  virtual double valueAt ( unsigned int row, unsigned int column ) const;
95 
104  int addColumn ( const std::string & label,
105  boost::python::list seq );
106 
112  void replaceColumn ( unsigned int index,
113  boost::python::list array );
114 
120  void replaceColumn ( const std::string & label,
121  boost::python::list array );
122 
125  virtual const std::vector < double > & getRow ( unsigned int index ) const;
126 
133  virtual void setShape ( std::vector < unsigned int > & shape );
134 
137  const std::vector < unsigned int > & getShape () const;
138 
142  virtual void clear ();
143 
147  virtual void reserve ( unsigned int count );
148 
151  virtual double
152  operator [] ( std::vector < unsigned int > & indices ) const;
153 
154 private:
155 
159  bool isAcceptable ( const boost::python::list & seq );
160 
161 };
162 
163 } // namespace hippodraw
164 
165 #endif // ListTuple_H
virtual void clear()
Raises assertion because the contained Python list should not be changed.
Definition: ListTuple.cxx:274
column
The column indices for 2 dimension data point tuple.
virtual void reserve(unsigned int count)
Raises assertion because the contained Python list should not be changed.
Definition: ListTuple.cxx:281
const std::vector< unsigned int > & getShape() const
Returns the shape of the data elements.
Definition: ListTuple.cxx:268
std::vector< intptr_t > shape(numeric::array arr)
Definition: num_util.cpp:317
virtual double operator[](std::vector< unsigned int > &indices) const
Raises assertion because this method is not implemented yet.
Definition: ListTuple.cxx:288
virtual void notifyObservers() const
Notifies observers.
Definition: ListTuple.cxx:108
hippodraw::DataSource class interface.
ListTuple()
The default constructor.
Definition: ListTuple.cxx:67
virtual void setShape(std::vector< unsigned int > &shape)
Sets the shape of the data elements.
Definition: ListTuple.cxx:261
bool isAcceptable(const boost::python::list &seq)
Returns true if all the elements of the list seq can be converted to type double, otherwise returns f...
Definition: ListTuple.cxx:171
void replaceColumn(unsigned int index, boost::python::list array)
Replaces the column indexed by index with the array.
Definition: ListTuple.cxx:226
virtual void copy(const DataSource &)
Raises an exception as with this release copying is not supported.
Definition: ListTuple.cxx:101
std::vector< boost::python::list > m_data
The numarray objects that contains the data.
Definition: ListTuple.h:47
virtual double valueAt(unsigned int row, unsigned int column) const
Returns the value in the table in position given by the row and column indexes.
Definition: ListTuple.cxx:136
int addColumn(const std::string &label, boost::python::list seq)
Adds a column to the end of the ListTuple.
Definition: ListTuple.cxx:190
virtual unsigned int rows() const
Returns the size of the slice for the next to last dimension.
Definition: ListTuple.cxx:115
unsigned static int getSize(const boost::python::list &sequence)
Definition: ListTuple.cxx:78
std::vector< double > m_row
A temporary array of data from one row of each column.
Definition: ListTuple.h:53
return index
Definition: PickTable.cxx:182
virtual bool empty() const
Returns true, if ListTuple is empty, i.e.
Definition: ListTuple.cxx:129
A wrapper class for Python list objects.
Definition: python.dir:41
A DataSource class implemented with a Python list to store the column data.
Definition: ListTuple.h:40
virtual ~ListTuple()
The destructor.
Definition: ListTuple.cxx:72
Base class for DataSource.
Definition: DataSource.h:55
virtual const std::vector< double > & getRow(unsigned int index) const
Returns a const reference to slice along the axis known as a row.
Definition: ListTuple.cxx:158

Generated for HippoDraw Class Library by doxygen