26 #if ! defined (octave_oct_map_h)
27 #define octave_oct_map_h 1
29 #include "octave-config.h"
45 class fields_rep :
public std::map<std::string, octave_idx_type>
52 octave::refcount<octave_idx_type>
m_count;
118 {
return m_rep->find (k); }
126 bool isfield (
const std::string& name)
const;
149 {
return m_rep == other.
m_rep; }
166 : m_keys (k), m_vals (k.nfields ()) { }
171 : m_keys (k), m_vals (k.
numel ()) { }
174 : m_keys (
m.m_keys), m_vals (
m.m_vals) { }
201 {
return m_keys.key (p); }
203 {
return m_keys.index (p); }
206 {
return m_vals[m_keys.index (p)]; }
209 {
return m_vals[m_keys.index (p)]; }
212 {
return m_vals[i]; }
215 {
return m_vals[i]; }
222 {
return m_keys.isfield (name); }
225 {
return isfield (name); }
228 {
return m_keys.fieldnames (); }
231 {
return fieldnames (); }
237 void setfield (
const std::string& key,
const octave_value& val);
239 { setfield (k, val); }
242 void rmfield (
const std::string& key);
243 void del (
const std::string& k) { rmfield (k); }
281 : m_keys (k), m_vals (k.nfields ()), m_dimensions () { }
284 : m_keys (k), m_vals (k.nfields (),
Cell (dv)), m_dimensions (dv) { }
288 octave_map (
void) : m_keys (), m_vals (), m_dimensions () { }
293 : m_keys (k), m_vals (k.
numel (),
Cell (1, 1)), m_dimensions (1, 1) { }
296 : m_keys (k), m_vals (k.
numel (),
Cell (dv)), m_dimensions (dv) { }
299 : m_keys (
m.m_keys), m_vals (
m.m_vals), m_dimensions (
m.m_dimensions) { }
307 m_dimensions =
m.m_dimensions;
327 {
return m_keys.key (p); }
329 {
return m_keys.index (p); }
332 {
return m_vals[m_keys.index (p)]; }
335 {
return m_vals[m_keys.index (p)]; }
338 {
return m_vals[i]; }
341 {
return m_vals[i]; }
348 {
return m_keys.isfield (name); }
351 {
return isfield (name); }
354 {
return m_keys.fieldnames (); }
357 {
return fieldnames (); }
360 Cell getfield (
const std::string& key)
const;
364 void setfield (
const std::string& key,
const Cell& val);
366 { setfield (k, val); }
369 void rmfield (
const std::string& key);
370 void del (
const std::string& k) { rmfield (k); }
379 Cell contents (
const std::string& k)
const;
380 Cell& contents (
const std::string& k);
391 bool isempty (
void)
const {
return m_dimensions.any_zero (); }
404 {
return elem (i, j); }
420 {
return elem (i, j); }
432 int ndims (
void)
const {
return m_dimensions.ndims (); }
438 void resize (
const dim_vector& dv,
bool fill =
false);
449 bool resize_ok =
false)
const;
452 bool resize_ok =
false)
const;
494 void optimize_dimensions (
void);
ComplexNDArray concat(NDArray &ra, ComplexNDArray &rb, const Array< octave_idx_type > &ra_idx)
Vector representing the dimensions (size) of an Array.
octave::refcount< octave_idx_type > m_count
fields_rep(const fields_rep &other)
const_iterator begin(void) const
std::map< std::string, octave_idx_type >::const_iterator const_iterator
std::string key(const_iterator p) const
octave_idx_type nfields(void) const
const_iterator cbegin(void) const
bool is_same(const octave_fields &other) const
octave_fields(const octave_fields &o)
const_iterator cend(void) const
const_iterator end(void) const
const_iterator seek(const std::string &k) const
octave_idx_type index(const_iterator p) const
octave_idx_type columns(void) const
void del(const std::string &k)
const Cell & contents(octave_idx_type i) const
octave_scalar_map checkelem(const Array< octave_idx_type > &ra_idx) const
octave_idx_type nfields(void) const
octave_scalar_map checkelem(octave_idx_type n) const
const_iterator cend(void) const
octave_fields::const_iterator const_iterator
bool isfield(const std::string &name) const
octave_idx_type rows(void) const
octave_idx_type numel(void) const
octave_idx_type cols(void) const
Cell & contents(iterator p)
const_iterator seek(const std::string &k) const
bool contains(const std::string &name) const
void assign(const std::string &k, const Cell &val)
octave_scalar_map element_type
std::string key(const_iterator p) const
const_iterator begin(void) const
Cell & contents(octave_idx_type i)
const_iterator end(void) const
string_vector keys(void) const
const_iterator cbegin(void) const
octave_map(const dim_vector &dv, const string_vector &k)
octave_map(const octave_map &m)
string_vector fieldnames(void) const
octave_map(const string_vector &k)
const Cell & contents(const_iterator p) const
octave_map(const dim_vector &dv, const octave_fields &k)
octave_idx_type length(void) const
dim_vector dims(void) const
std::vector< Cell > m_vals
octave_idx_type index(const_iterator p) const
octave_scalar_map checkelem(octave_idx_type i, octave_idx_type j) const
octave_map(const octave_fields &k)
octave_map(const dim_vector &dv)
string_vector keys(void) const
octave_fields::const_iterator const_iterator
const_iterator cbegin(void) const
octave_scalar_map(const octave_fields &k)
octave_value & contents(octave_idx_type i)
bool contains(const std::string &name) const
const octave_value & contents(const_iterator p) const
const octave_value & contents(octave_idx_type i) const
const_iterator cend(void) const
octave_idx_type nfields(void) const
bool isfield(const std::string &name) const
octave_scalar_map(const string_vector &k)
void assign(const std::string &k, const octave_value &val)
octave_value & contents(iterator p)
octave_idx_type index(const_iterator p) const
const_iterator seek(const std::string &k) const
const_iterator end(void) const
std::vector< octave_value > m_vals
void del(const std::string &k)
string_vector fieldnames(void) const
octave_scalar_map(const octave_scalar_map &m)
const_iterator begin(void) const
std::string key(const_iterator p) const
OCTINTERP_API octave_scalar_map scalar_map_value(void) const
OCTINTERP_API octave_map map_value(void) const
static octave_value do_cat(const octave_value_list &xargs, int dim, std::string fname)
octave::idx_vector idx_vector
octave_scalar_map octave_value_extract< octave_scalar_map >(const octave_value &v)
octave_map octave_value_extract< octave_map >(const octave_value &v)
T::size_type numel(const T &str)
const octave_base_value const Array< octave_idx_type > & ra_idx
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)