00001 /* -*- c++ -*- */ 00002 00014 #ifndef ListTuple_H 00015 #define ListTuple_H 00016 00017 #include "datasrcs/DataSource.h" 00018 00019 #include <boost/python.hpp> 00020 00032 class ListTuple : public DataSource 00033 { 00034 00035 private: 00036 00039 std::vector < boost::python::list > m_data; 00040 00045 mutable std::vector < double > m_row; 00046 00047 public: 00048 00051 ListTuple (); 00052 00055 virtual ~ListTuple(); 00056 00060 virtual void copy ( const DataSource & ); 00061 00065 virtual void notifyObservers ( ) const; 00066 00069 virtual unsigned int rows () const; 00070 00073 virtual bool empty () const; 00074 00075 virtual double valueAt ( unsigned int row, unsigned int column ) const; 00076 00085 int addColumn ( const std::string & label, 00086 boost::python::list seq ); 00087 00093 void replaceColumn ( unsigned int index, 00094 boost::python::list array ); 00095 00101 void replaceColumn ( const std::string & label, 00102 boost::python::list array ); 00103 00106 virtual const std::vector < double > & getRow ( unsigned int index ) const; 00107 00114 virtual void setShape ( std::vector < unsigned int > & shape ); 00115 00118 const std::vector < unsigned int > & getShape () const; 00119 00123 unsigned int getRank () const; 00124 00128 virtual void clear (); 00129 00133 virtual void reserve ( unsigned int count ); 00134 00138 virtual void addRow ( const std::vector < double > & row ); 00139 00142 virtual double 00143 operator [] ( std::vector < unsigned int > & indices ) const; 00144 00145 private: 00146 00150 bool isAcceptable ( const boost::python::list & seq ); 00151 00152 }; 00153 00154 #endif // ListTuple_H