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>
70 if (--rep->
count == 0)
80 if (--rep->
count == 0)
95 if (--rep->
count == 0)
118 {
return rep->find (k); }
126 bool isfield (
const std::string&
name)
const;
149 {
return rep == other.
rep; }
166 : xkeys (k), xvals (k.nfields ()) { }
171 : xkeys (k), xvals (k.
numel ()) { }
174 : xkeys (
m.xkeys), xvals (
m.xvals) { }
201 {
return xkeys.key (p); }
203 {
return xkeys.index (p); }
206 {
return xvals[xkeys.index (p)]; }
209 {
return xvals[xkeys.index (p)]; }
222 {
return xkeys.isfield (
name); }
225 {
return isfield (
name); }
228 {
return xkeys.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 : xkeys (k), xvals (k.nfields ()), dimensions () { }
284 : xkeys (k), xvals (k.nfields (),
Cell (dv)), dimensions (dv) { }
293 : xkeys (k), xvals (k.
numel (),
Cell (1, 1)), dimensions (1, 1) { }
296 : xkeys (k), xvals (k.
numel (),
Cell (dv)), dimensions (dv) { }
299 : xkeys (
m.xkeys), xvals (
m.xvals), dimensions (
m.dimensions) { }
307 dimensions =
m.dimensions;
327 {
return xkeys.key (p); }
329 {
return xkeys.index (p); }
332 {
return xvals[xkeys.index (p)]; }
335 {
return xvals[xkeys.index (p)]; }
348 {
return xkeys.isfield (
name); }
351 {
return isfield (
name); }
354 {
return xkeys.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 dimensions.any_zero (); }
404 {
return elem (i, j); }
420 {
return elem (i, j); }
432 int ndims (
void)
const {
return dimensions.ndims (); }
438 void resize (
const dim_vector& dv,
bool fill =
false);
449 bool resize_ok =
false)
const;
452 bool resize_ok =
false)
const;
472 void delete_elements (
int dim,
const idx_vector& i);
493 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.
fields_rep(const fields_rep &other)
octave::refcount< octave_idx_type > count
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 > xvals
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
std::vector< octave_value > xvals
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
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
octave_scalar_map scalar_map_value(void) const
octave_map map_value(void) const
static octave_value do_cat(const octave_value_list &xargs, int dim, std::string fname)
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
octave_value::octave_value(const Array< char > &chm, char type) return retval
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)