# HG changeset patch # User jwe # Date 1020746993 0 # Node ID 311981a9726d147d650dce152804740664fbb661 # Parent 61d4427c016e5e447359f8f0ef58e68b5941ff5c [project @ 2002-05-07 04:49:53 by jwe] diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,12 @@ 2002-05-06 John W. Eaton + * TEMPLATE-INST/Map-oct-obj.cc: New file. + * Makefile.in (TI_XSRC): Add it to the list. + + * oct-map.h (Octave_map): Make CHMap a data + member instead of deriving from CHMap, in + preparation for structure arrays. + * pt-indir.h, pt-indir.cc: Delete. * pt-all.h: Don't include pt-indir.h. diff --git a/src/Makefile.in b/src/Makefile.in --- a/src/Makefile.in +++ b/src/Makefile.in @@ -89,10 +89,10 @@ variables.h version.h xdiv.h xpow.h $(OV_INCLUDES) $(PT_INCLUDES) TI_XSRC := Array-oc.cc Array-os.cc Array-sym.cc Array-tc.cc Map-fnc.cc \ - Map-tc.cc SLList-expr.cc SLList-misc.cc SLList-plot.cc \ - SLList-tc.cc SLList-tm.cc SLStack-i.cc SLStack-ovl.cc SLStack-pc.cc \ - SLStack-str.cc SLStack-sym.cc SLStack-tok.cc \ - SLStack-ue.cc SLStack-ui.cc + Map-oct-obj.cc Map-tc.cc SLList-expr.cc SLList-misc.cc \ + SLList-plot.cc SLList-tc.cc SLList-tm.cc SLStack-i.cc \ + SLStack-ovl.cc SLStack-pc.cc SLStack-str.cc SLStack-sym.cc \ + SLStack-tok.cc SLStack-ue.cc SLStack-ui.cc TI_SRC := $(addprefix TEMPLATE-INST/, $(TI_XSRC)) diff --git a/src/oct-map.cc b/src/oct-map.cc --- a/src/oct-map.cc +++ b/src/oct-map.cc @@ -30,7 +30,6 @@ #include "str-vec.h" -#include "ov.h" #include "oct-map.h" #include "utils.h" diff --git a/src/oct-map.h b/src/oct-map.h --- a/src/oct-map.h +++ b/src/oct-map.h @@ -29,27 +29,61 @@ #include "Map.h" -#include "ov.h" +#include "oct-obj.h" class string_vector; class -Octave_map : public CHMap +Octave_map { public: - Octave_map (void) : CHMap (octave_value ()) { } + Octave_map (void) : map (octave_value_list ()) { } Octave_map (const std::string& key, const octave_value& value) - : CHMap (octave_value ()) + : map (octave_value_list ()) { - CHMap::operator [] (key) = value; + map[key] = octave_value_list (value); } - Octave_map (const Octave_map& m) : CHMap (m) { } + Octave_map (const Octave_map& m) : map (m.map) { } + + Octave_map& operator = (const Octave_map& m) + { + if (this != &m) + map = m.map; + + return *this; + } ~Octave_map (void) { } + int length (void) const { return map.length (); } + + int empty (void) const { return map.empty (); } + + octave_value& operator [] (const std::string& key) { return map[key](0); } + + void del (const std::string& key) { map.del (key); } + + Pix first (void) const { return map.first (); } + void next (Pix& i) const { map.next (i); } + + std::string key (Pix p) const { return map.key (p); } + + octave_value& contents (Pix p) const { return map.contents (p)(0); } + + Pix seek (const std::string& key) const { return map.seek (key); } + + int contains (const std::string& key) const { return map.contains (key); } + + void clear (void) { map.clear (); } + string_vector make_name_list (void); + +private: + + // The map of names to values. + CHMap map; }; #endif