Mercurial > hg > octave-nkf
changeset 10475:739109ef88ee
helper idx_vector methods
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Mon, 29 Mar 2010 14:08:30 +0200 |
parents | b2143d97c002 |
children | f261f936bf36 |
files | liboctave/ChangeLog liboctave/idx-vector.cc liboctave/idx-vector.h |
diffstat | 3 files changed, 20 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,8 @@ +2010-03-29 Jaroslav Hajek <highegg@gmail.com> + + * idx-vector.cc (idx_vector::raw): New method. + * idx-vector.h: Declare it. + 2010-03-27 David Bateman <dbateman@free.fr> * oct-openmp.h: New file.
--- 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<idx_vector_rep *> (rep); + assert (r != 0); + return r->get_data (); +} + void idx_vector::copy_data (octave_idx_type *data) const {
--- a/liboctave/idx-vector.h +++ b/liboctave/idx-vector.h @@ -982,6 +982,10 @@ Array<double>& array, Array<bool>& mask) const; Array<octave_idx_type> 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.