Mercurial > hg > octave-lojdl
changeset 10766:f0304c545588
make map constructors from octave_fields public
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Fri, 02 Jul 2010 14:10:57 +0200 |
parents | 3952b4c4e44a |
children | 2b041d3995a3 |
files | src/oct-map.cc src/oct-map.h |
diffstat | 2 files changed, 13 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/oct-map.cc +++ b/src/oct-map.cc @@ -42,6 +42,14 @@ (*rep)[fields(i)] = i; } +octave_fields::octave_fields (const char * const *fields) + : rep (new fields_rep) +{ + octave_idx_type n = 0; + while (*fields) + (*rep)[std::string (*fields++)] = n++; +} + bool octave_fields::isfield (const std::string& field) const { @@ -112,8 +120,6 @@ { bool retval = true; - octave_idx_type n = nfields (); - iterator p = begin (), q = other.begin (); for (; p != end () && q != other.end (); p++, q++) { @@ -135,8 +141,6 @@ octave_fields::equal_up_to_order (const octave_fields& other, Array<octave_idx_type>& perm) const { - bool retval = true; - octave_idx_type n = nfields (); if (perm.length () != n) perm.clear (1, n);
--- a/src/oct-map.h +++ b/src/oct-map.h @@ -58,6 +58,7 @@ octave_fields (void) : rep (&nil_rep) { rep->count++; } octave_fields (const string_vector&); + octave_fields (const char * const *); ~octave_fields (void) { @@ -145,11 +146,11 @@ class OCTINTERP_API octave_scalar_map { +public: + octave_scalar_map (const octave_fields& k) : xkeys (k), xvals (k.nfields ()) { } -public: - octave_scalar_map (void) : xkeys (), xvals () { } octave_scalar_map (const string_vector& k) @@ -253,14 +254,14 @@ class OCTINTERP_API octave_map { +public: + octave_map (const octave_fields& k) : xkeys (k), xvals (k.nfields ()), dimensions () { } octave_map (const dim_vector& dv, const octave_fields& k) : xkeys (k), xvals (k.nfields (), Cell (dv)), dimensions (dv) { } -public: - typedef octave_scalar_map element_type; octave_map (void) : xkeys (), xvals (), dimensions () { }