39 (*
rep)[fields(i)] = i;
47 (*rep)[std::string (*fields++)] = n++;
53 return rep->find (field) !=
rep->end ();
59 fields_rep::iterator p =
rep->find (field);
60 return (p !=
rep->end ()) ? p->second : -1;
66 fields_rep::iterator p =
rep->find (field);
73 return (*
rep)[field] = n;
80 fields_rep::iterator p =
rep->find (field);
88 for (fields_rep::iterator q =
rep->begin (); q !=
rep->end (); q++)
106 for (fields_rep::iterator q =
rep->begin (); q !=
rep->end (); q++)
121 for (; p !=
end () && q != other.
end (); p++, q++)
123 if (p->first == q->first)
124 perm[p->second] = q->second;
132 retval = (p ==
end () && q == other.
end ());
155 retval.
xelem (p->second) = p->first;
171 if (idx < static_cast<octave_idx_type> (
xvals.size ()))
174 xvals.push_back (val);
221 error (
"orderfields: structs must have same fields up to order");
237 if (idx >= static_cast<octave_idx_type> (
xvals.size ()))
238 xvals.resize (idx+1);
243 : xkeys (m.xkeys), xvals (), dimensions (1, 1)
255 : xkeys (m.keys ()), xvals (m.nfields ()), dimensions (m.dims ())
267 return (idx >= 0) ?
xvals[idx] :
Cell ();
279 if (idx < static_cast<octave_idx_type> (
xvals.size ()))
282 xvals.push_back (val);
285 error (
"octave_map::setfield: internal error");
332 error (
"orderfields: structs must have same fields up to order");
348 if (idx >= static_cast<octave_idx_type> (
xvals.size ()))
464 retval.
xvals[i] =
xvals[i].permute (vec, inv);
475 dummy = dummy.
permute (vec, inv);
494 assert (
ndims () == 2);
527 retval.
xvals.reserve (nf);
562 xvals[i].resize (dv);
583 retval.
xvals.reserve (nf);
593 assert (retval.
xvals[j].numel () == n);
595 retval.
xvals[j].xelem (i) = map_list[i].
xvals[j];
604 retval.
xvals.reserve (nf);
611 field_list[i] = map_list[i].
xvals[j];
644 new_map_list[idx] = map_list[idx];
659 (*current_liboctave_error_handler)
660 (
"cat: field names mismatch in concatenating structs");
673 if (dim == -1 || dim == -2)
676 (*current_liboctave_error_handler)
677 (
"cat: invalid dimension");
680 retval = map_list[0];
684 for (idx = 0; idx < n; idx++)
697 bool all_same =
true;
706 do_cat (dim, n, map_list, retval);
714 do_cat (dim, n, new_map_list, retval);
738 if (dim == -1 || dim == -2)
741 (*current_liboctave_error_handler)
742 (
"cat: invalid dimension");
745 retval = map_list[0];
750 for (idx = 0; idx < n; idx++)
761 bool all_same =
true;
774 if (all_same && nf > 0)
775 do_cat (dim, n, map_list, retval);
785 do_cat (dim, n, new_map_list, retval);
795 error (
"dimension mismatch in struct concatenation");
837 retval.
xvals[k] =
xvals[k].index (i, resize_ok);
845 dummy = dummy.
index (i, resize_ok);
856 bool resize_ok)
const
862 retval.
xvals[k] =
xvals[k].index (i, j, resize_ok);
870 dummy = dummy.
index (i, j, resize_ok);
886 retval.
xvals[k] =
xvals[k].index (ia, resize_ok);
894 dummy = dummy.
index (ia, resize_ok);
916 retval =
index (i, resize_ok);
928 retval =
index (i, j, resize_ok);
939 ia(i) = idx(i).index_vector ();
946 retval =
index (ia, resize_ok);
986 dummy.assign (i, rhs_dummy);;
1008 error (
"incompatible fields in struct assignment");
1029 dummy.assign (i, j, rhs_dummy);;
1051 error (
"incompatible fields in struct assignment");
1072 dummy.assign (ia, rhs_dummy);;
1094 error (
"incompatible fields in struct assignment");
1133 ia(i) = idx(i).index_vector ();
1166 if (&
xvals[i] != &ref)
1253 ia(i) = idx(i).index_vector ();
1279 if (pb == rb.
end ())
1281 error (
"field name mismatch in structure concatenation");
1295 error (
"invalid structure concatenation");
1310 error (
"internal error: dimension mismatch across fields in struct");
1318 : map (), key_list (), dimensions (dv)
1326 std::string k = key_vals(i).string_value ();
1332 error (
"Octave_map: expecting keys to be cellstr");
1336 : map (), key_list (), dimensions (m.dims ())
1400 return p !=
end () ? p->second :
Cell ();
1406 int retval = def_val;
1411 retval = c(0).int_value ();
1418 const std::string& def_val)
const
1420 std::string retval = def_val;
1425 retval = c(0).string_value ();
1441 assert (
ndims () == 2);
1466 if (new_dims !=
dims ())
1519 if (pb == rb.
end ())
1521 error (
"field name mismatch in structure concatenation");
1545 error (
"invalid structure concatenation");
1555 bool retval =
false;
1576 if (a_keys[i] != b_keys[i])
1599 std::string k = t_keys[i];
1619 if (
keys_ok (*
this, rhs, t_keys))
1633 error (
"size mismatch in structure assignment");
1639 std::string k = t_keys[i];
1651 error (
"field name mismatch in structure assignment");
1711 error (
"invalid structure assignment");
1737 error (
"invalid structure assignment");
1756 ra_idx(i) = idx(i).index_vector ();
1767 tmp = tmp.Array<octave_value>::index (ra_idx, resize_ok);