# HG changeset patch # User Jaroslav Hajek # Date 1269864510 -7200 # Node ID 739109ef88eefa6cde121df329e3c0871a3cb0bb # Parent b2143d97c00299e90c65136c74bca02c62d1645c helper idx_vector methods diff --git a/liboctave/ChangeLog b/liboctave/ChangeLog --- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,8 @@ +2010-03-29 Jaroslav Hajek + + * idx-vector.cc (idx_vector::raw): New method. + * idx-vector.h: Declare it. + 2010-03-27 David Bateman * oct-openmp.h: New file. diff --git a/liboctave/idx-vector.cc b/liboctave/idx-vector.cc --- a/liboctave/idx-vector.cc +++ b/liboctave/idx-vector.cc @@ -990,6 +990,17 @@ return retval; } +const octave_idx_type * +idx_vector::raw (void) +{ + if (rep->idx_class () != class_vector) + *this = as_array (); + + idx_vector_rep * r = dynamic_cast (rep); + assert (r != 0); + return r->get_data (); +} + void idx_vector::copy_data (octave_idx_type *data) const { diff --git a/liboctave/idx-vector.h b/liboctave/idx-vector.h --- a/liboctave/idx-vector.h +++ b/liboctave/idx-vector.h @@ -982,6 +982,10 @@ Array& array, Array& mask) const; Array as_array (void) const; + + // Raw pointer to index array. This is non-const because it may be necessary + // to mutate the index. + const octave_idx_type *raw (void); // FIXME -- these are here for compatibility. They should be removed // when no longer in use.