13 #include <boost/python.hpp>
26 using namespace boost::python;
28 using std::runtime_error;
65 using namespace hippodraw;
67 ListTuple::ListTuple ()
82 PyGILState_STATE gstate;
83 gstate = PyGILState_Ensure ();
87 object obj = sequence.attr (
"__len__" ) ();
88 unsigned int size = extract < unsigned int > ( obj );
92 PyGILState_Release ( gstate );
117 unsigned int size = 0;
118 if (
m_data.empty () == false ) {
138 assert ( column <
m_data.size () );
145 assert ( row < size );
147 object result = seq[row];
148 value = extract < double > ( result );
156 const std::vector < double > &
161 m_row.resize ( size );
175 for (
unsigned int i = 0; i <
size; i++ ) {
176 object obj = array[i];
177 extract < double > check ( obj );
178 if ( check.check() == false ) {
196 string what (
"ListTuple Attempt to add a column whose label"
197 " is same as other column." );
198 throw runtime_error ( what );
201 unsigned int new_size =
getSize ( array );
203 if (
m_data.empty () == false ) {
204 unsigned int old_size =
rows ();
206 if ( old_size != 0 && old_size != new_size ) {
207 string what (
"ListTuple Attempt to add a column whose size"
208 " is not equal to other columns." );
209 throw runtime_error ( what );
213 string what (
"ListTuple: Attempt to add a column with one or more"
214 " elements not convertable to float" );
215 throw runtime_error ( what );
218 m_data.push_back ( array );
231 const string what (
"NunArrayTuple: column doesn't exist" );
232 throw runtime_error ( what );
236 int old_size =
getSize ( old_array );
237 int new_size =
getSize ( array );
239 if ( old_size != 0 && old_size != new_size ) {
240 const string what (
"ListTuple: Attempt to replace column with one "
241 "whose size is not equal to other columns." );
242 throw runtime_error ( what );
254 unsigned int index =
indexOf ( column );
266 const vector < unsigned int > &