changeset 10743:cb3ed842bd30

make the new interface more backward compatible
author Jaroslav Hajek <highegg@gmail.com>
date Wed, 23 Jun 2010 12:21:49 +0200
parents 604e13a89c7f
children 4716e2e17118
files src/oct-map.cc src/oct-map.h
diffstat 2 files changed, 16 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/oct-map.cc	Tue Jun 22 15:22:36 2010 +0200
+++ b/src/oct-map.cc	Wed Jun 23 12:21:49 2010 +0200
@@ -501,13 +501,18 @@
 */
 
 void
-octave_map::resize (const dim_vector& dv)
+octave_map::resize (const dim_vector& dv, bool fill)
 {
   octave_idx_type nf = nfields ();
   if (nf > 0)
     {
       for (octave_idx_type i = 0; i < nf; i++)
-        vals[i].resize (dv);
+        {
+          if (fill)
+            vals[i].resize (dv, Cell::resize_fill_value ());
+          else
+            vals[i].resize (dv);
+        }
     }
   else
     {
--- a/src/oct-map.h	Tue Jun 22 15:22:36 2010 +0200
+++ b/src/oct-map.h	Wed Jun 23 12:21:49 2010 +0200
@@ -302,6 +302,9 @@
   bool isfield (const std::string& name) const 
     { return keys.isfield (name); }
 
+  bool contains (const std::string& name) const 
+    { return isfield (name); }
+
   string_vector fieldnames (void) const
     { return keys.fieldnames (); }
 
@@ -314,6 +317,7 @@
 
   // remove a given field. do nothing if not exist.
   void rmfield (const std::string& key);
+  void del (const std::string& key) { rmfield (key); }
 
   // return a copy with fields ordered, optionally along with permutation.
   octave_map orderfields (void) const;
@@ -358,7 +362,7 @@
 
   octave_map reshape (const dim_vector& dv) const;
 
-  void resize (const dim_vector& dv);
+  void resize (const dim_vector& dv, bool fill = false);
 
   static octave_map
   cat (int dim, octave_idx_type n, const octave_scalar_map *map_list);
@@ -366,15 +370,15 @@
   static octave_map
   cat (int dim, octave_idx_type n, const octave_map *map_list);
 
-  octave_map index (const idx_vector& i, bool resize_ok) const;
+  octave_map index (const idx_vector& i, bool resize_ok = false) const;
 
   octave_map index (const idx_vector& i, const idx_vector& j,
-                    bool resize_ok) const;
+                    bool resize_ok = false) const;
 
   octave_map index (const Array<idx_vector>& ia,
-                    bool resize_ok) const;
+                    bool resize_ok = false) const;
 
-  octave_map index (const octave_value_list&, bool resize_ok) const;
+  octave_map index (const octave_value_list&, bool resize_ok = false) const;
   
   void assign (const idx_vector& i, const octave_map& rhs);