24 #if !defined (octave_oct_map_h)
25 #define octave_oct_map_h 1
39 class fields_rep :
public std::map<std::string, octave_idx_type>
68 if (--rep->
count == 0)
78 if (--rep->
count == 0)
91 if (--rep->
count == 0)
103 const_iterator
begin (
void)
const {
return rep->begin (); }
104 const_iterator
end (
void)
const {
return rep->end (); }
106 std::string
key (const_iterator p)
const {
return p->first; }
109 const_iterator
seek (
const std::string& k)
const
110 {
return rep->find (k); }
118 bool isfield (
const std::string& name)
const;
141 {
return rep == other.
rep; }
159 : xkeys (k), xvals (k.nfields ()) { }
164 : xkeys (k), xvals (k.
length ()) { }
167 : xkeys (m.xkeys), xvals(m.xvals) { }
182 const_iterator
begin (
void)
const {
return xkeys.begin (); }
183 const_iterator
end (
void)
const {
return xkeys.end (); }
185 const_iterator
seek (
const std::string& k)
const {
return xkeys.seek (k); }
187 std::string
key (const_iterator p)
const
188 {
return xkeys.key (p); }
190 {
return xkeys.index (p); }
193 {
return xvals[xkeys.index (p)]; }
196 {
return xvals[xkeys.index (p)]; }
209 {
return xkeys.isfield (name); }
212 {
return isfield (name); }
215 {
return xkeys.fieldnames (); }
218 {
return fieldnames (); }
224 void setfield (
const std::string& key,
const octave_value& val);
226 { setfield (k, val); }
229 void rmfield (
const std::string& key);
230 void del (
const std::string& k) { rmfield (k); }
260 {
return v.scalar_map_value (); }
268 : xkeys (k), xvals (k.nfields ()), dimensions () { }
271 : xkeys (k), xvals (k.nfields (),
Cell (dv)), dimensions (dv) { }
280 : xkeys (k), xvals (k.
length (),
Cell (1, 1)), dimensions (1, 1) { }
283 : xkeys (k), xvals (k.
length (),
Cell (dv)), dimensions (dv) { }
286 : xkeys (m.xkeys), xvals (m.xvals), dimensions (m.dimensions) { }
304 const_iterator
begin (
void)
const {
return xkeys.begin (); }
305 const_iterator
end (
void)
const {
return xkeys.end (); }
307 const_iterator
seek (
const std::string& k)
const {
return xkeys.seek (k); }
309 std::string
key (const_iterator p)
const
310 {
return xkeys.key (p); }
312 {
return xkeys.index (p); }
315 {
return xvals[xkeys.index (p)]; }
318 {
return xvals[xkeys.index (p)]; }
331 {
return xkeys.isfield (name); }
334 {
return isfield (name); }
337 {
return xkeys.fieldnames (); }
340 {
return fieldnames (); }
343 Cell getfield (
const std::string& key)
const;
347 void setfield (
const std::string& key,
const Cell& val);
349 { setfield (k, val); }
352 void rmfield (
const std::string& key);
353 void del (
const std::string& k) { rmfield (k); }
362 Cell contents (
const std::string& k)
const;
363 Cell& contents (
const std::string& k);
374 bool is_empty (
void)
const {
return dimensions.any_zero (); }
388 {
return checkelem (n); }
390 {
return checkelem (i, j); }
394 {
return checkelem (ra_idx); }
402 int ndims (
void)
const {
return dimensions.length (); }
408 void resize (
const dim_vector& dv,
bool fill =
false);
419 bool resize_ok =
false)
const;
422 bool resize_ok =
false)
const;
442 void delete_elements (
int dim,
const idx_vector& i);
463 void optimize_dimensions (
void);
474 {
return v.map_value (); }
const_iterator seek(const std::string &k) const
string_vector keys(void) const
const Cell & contents(const_iterator p) const
octave_value & contents(iterator p)
octave_value & contents(octave_idx_type i)
octave_scalar_map element_type
bool isfield(const std::string &name) const
octave_map(const dim_vector &dv)
octave_idx_type nfields(void) const
Cell & contents(octave_idx_type i)
string_vector keys(void) const
const octave_base_value const Array< octave_idx_type > & ra_idx
Cell & contents(iterator p)
void assign(const std::string &k, const Cell &val)
octave_map(const string_vector &k)
octave_refcount< int > count
const octave_value & contents(const_iterator p) const
bool is_same(const octave_fields &other) const
bool contains(const std::string &name) const
bool contains(const std::string &name) const
octave_idx_type cols(void) const
const Cell & contents(octave_idx_type i) const
static void transpose(octave_idx_type N, const octave_idx_type *ridx, const octave_idx_type *cidx, octave_idx_type *ridx2, octave_idx_type *cidx2)
ComplexNDArray concat(NDArray &ra, ComplexNDArray &rb, const Array< octave_idx_type > &ra_idx)
string_vector fieldnames(void) const
octave_map(const octave_fields &k)
const_iterator end(void) const
octave_map(const octave_map &m)
octave_idx_type index(const_iterator p) const
octave_idx_type numel(void) const
const octave_value & contents(octave_idx_type i) const
octave_scalar_map(const octave_scalar_map &m)
std::vector< Cell > xvals
octave_scalar_map octave_value_extract< octave_scalar_map >(const octave_value &v)
octave_idx_type index(const_iterator p) const
const_iterator end(void) const
std::vector< octave_value > xvals
octave_map(const dim_vector &dv, const string_vector &k)
octave_fields::const_iterator const_iterator
const_iterator begin(void) const
std::string key(const_iterator p) const
bool isfield(const std::string &name) const
octave_idx_type nfields(void) const
std::string key(const_iterator p) const
octave_map(const dim_vector &dv, const octave_fields &k)
dim_vector dims(void) const
const_iterator end(void) const
static octave_value do_cat(const octave_value_list &xargs, int dim, std::string fname)
std::string key(const_iterator p) const
const_iterator begin(void) const
octave_idx_type nfields(void) const
octave_fields(const octave_fields &o)
octave_scalar_map(const octave_fields &k)
void del(const std::string &k)
octave_map octave_value_extract< octave_map >(const octave_value &v)
octave_idx_type rows(void) const
std::map< std::string, octave_idx_type >::const_iterator const_iterator
void assign(const std::string &k, const octave_value &val)
const_iterator begin(void) const
static fields_rep * nil_rep(void)
const_iterator seek(const std::string &k) const
octave_idx_type length(void) const
octave_idx_type columns(void) const
fields_rep(const fields_rep &other)
bool is_empty(void) const
octave_idx_type index(const_iterator p) const
octave_fields::const_iterator const_iterator
const_iterator seek(const std::string &k) const
octave_scalar_map(const string_vector &k)
string_vector fieldnames(void) const
void del(const std::string &k)