diff liboctave/Sparse.h @ 5900:c20eb7330d13

[project @ 2006-07-22 08:31:16 by jwe]
author jwe
date Sat, 22 Jul 2006 08:31:17 +0000
parents ace8d8d26933
children 143b556ce725
line wrap: on
line diff
--- a/liboctave/Sparse.h	Wed Jul 19 23:00:22 2006 +0000
+++ b/liboctave/Sparse.h	Sat Jul 22 08:31:17 2006 +0000
@@ -460,6 +460,7 @@
   T& xdata (octave_idx_type i) { return rep->data (i); }
 
   T data (octave_idx_type i) const { return rep->data (i); }
+  // FIXME -- shouldn't this be returning const T*?
   T* data (void) const { return rep->d; }
 
   octave_idx_type* ridx (void) { make_unique (); return rep->r; }
@@ -468,6 +469,7 @@
   octave_idx_type& xridx (octave_idx_type i) { return rep->ridx (i); }
 
   octave_idx_type ridx (octave_idx_type i) const { return rep->cridx (i); }
+  // FIXME -- shouldn't this be returning const octave_idx_type*?
   octave_idx_type* ridx (void) const { return rep->r; }
 
   octave_idx_type* cidx (void) { make_unique (); return rep->c; }
@@ -476,6 +478,7 @@
   octave_idx_type& xcidx (octave_idx_type i) { return rep->cidx (i); }
 
   octave_idx_type cidx (octave_idx_type i) const { return rep->ccidx (i); }
+  // FIXME -- shouldn't this be returning const octave_idx_type*?
   octave_idx_type* cidx (void) const { return rep->c; }
 
   octave_idx_type ndims (void) const { return dimensions.length (); }
@@ -504,6 +507,13 @@
 
   void print_info (std::ostream& os, const std::string& prefix) const;
 
+  // Unsafe.  These functions exist to support the MEX interface.
+  // You should not use them anywhere else.
+  void *mex_get_data (void) const { return const_cast<T *> (data ()); }
+
+  octave_idx_type *mex_get_ir (void) const { return const_cast<octave_idx_type *> (ridx ()); }
+
+  octave_idx_type *mex_get_jc (void) const { return const_cast<octave_idx_type *> (cidx ()); }
 };
 
 // NOTE: these functions should be friends of the Sparse<T> class and