SheafSystem  0.0.0.0
arg_list.cc
1 
2 //
3 // Copyright (c) 2014 Limit Point Systems, Inc.
4 //
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 
18 // Implementation for class arg_list
19 
20 #include "SheafSystem/arg_list.h"
21 
22 #include "SheafSystem/assert_contract.h"
23 #include "SheafSystem/error_message.h"
24 #include "SheafSystem/namespace_poset.h"
25 #include "SheafSystem/poset_dof_iterator.h"
26 #include "SheafSystem/poset_path.h"
27 #include "SheafSystem/primitive_attributes.h"
28 #include "SheafSystem/schema_poset_member.h"
29 #include "SheafSystem/std_iostream.h"
30 #include "SheafSystem/std_string.h"
31 #include "SheafSystem/std_cstring.h"
32 
33 #include "SheafSystem/block.impl.h"
34 
35 using namespace std;
36 
37 // #define DIAGNOSTIC_OUTPUT
38 
42  : _args(8),
43  _parse_state(GET_NAME)
44 {
45  // Preconditions:
46 
47  // Body:
48 
49  // Postconditions:
50 
51  // Exit:
52 
53  return;
54 }
55 
58 arg_list(const arg_list& xinput)
59  : _args(xinput._args),
60  _parse_state(xinput._parse_state)
61 
62 {
63  // Preconditions:
64 
65  // Body:
66 
67  // Postconditions:
68 
69  ensure(contains_args(xinput));
70 
71  // Exit:
72 
73  return;
74 }
75 
77 arg_list(const arg_type& xarg)
78  : _args(8),
79  _parse_state(GET_NAME)
80 {
81  // Preconditions:
82 
83  // Body:
84 
85  // Construction with an empty arg is mainly to
86  // support initialization by compile-time constant
87  // empty string "", so we can have default value ""
88  // for arg_list args.
89 
90  if(!xarg.empty())
91  {
92  push_back(xarg);
93  }
94 
95  // Postconditions:
96 
97  ensure(empty() == xarg.empty());
98  ensure(!xarg.empty() ? back() == xarg : true);
99 
100  // Exit:
101 
102  return;
103 }
104 
106 arg_list(const char* xarg_name)
107  : _args(8),
108  _parse_state(GET_NAME)
109 {
110  // Preconditions:
111 
112  // Body:
113 
114  // Construction with an empty arg is mainly to
115  // support initialization by compile-time constant
116  // empty string "", so we can have default value ""
117  // for arg_list args.
118 
119  arg_type larg(xarg_name);
120 
121  if(!larg.empty())
122  {
123  push_back(larg);
124  }
125 
126  // Postconditions:
127 
128  ensure(empty() == (strlen(xarg_name) == 0));
129  ensure(!empty() ? back().name == xarg_name : true);
130 
131  // Exit:
132 
133  return;
134 }
135 
137 unsigned int
139 ct() const
140 {
141  return _args.ct();
142 }
143 
144 bool
146 empty() const
147 {
148  // Preconditions:
149 
150 
151  // Body:
152 
153  bool result = _args.ct() == 0;
154 
155  // Postconditions:
156 
157  ensure( result == (ct() == 0));
158 
159  // Exit:
160 
161  return result;
162 }
163 
164 
166 int
168 index(const std::string& xname) const
169 {
170  int result;
171 
172  // Preconditions:
173 
174  require(!xname.empty());
175 
176  // Body:
177 
178  result = -1;
179  for(int i=0; i<_args.ct(); ++i)
180  {
181  if(_args[i].name == xname)
182  {
183  result = i;
184  break;
185  }
186  }
187 
188  // Postconditions:
189 
190  ensure((-1 <= result) && (result < static_cast<int>(ct())));
191 
192  // Exit:
193 
194  return result;
195 }
196 
198 const std::string&
200 name(int xi) const
201 {
202 
203  // Preconditions:
204 
205  require(xi < ct());
206 
207  // Body:
208 
209  const string& result = _args[xi].name;
210 
211  // Postconditions:
212 
213 
214  // Exit:
215 
216  return result;
217 }
218 
220 int
222 type(int xi) const
223 {
224 
225  // Preconditions:
226 
227  require(xi < ct());
228 
229  // Body:
230 
231  int result = _args[xi].type();
232 
233  // Postconditions:
234 
235 
236  // Exit:
237 
238  return result;
239 }
240 
242 int
244 type(const std::string& xname) const
245 {
246 
247  // Preconditions:
248 
249  require(!xname.empty());
250  require(contains_arg(xname));
251 
252  // Body:
253 
254  int result = arg(xname).type();
255 
256  // Postconditions:
257 
258 
259  // Exit:
260 
261  return result;
262 }
263 
267 value(int xi)
268 {
269 
270  // Preconditions:
271 
272  require(xi < ct());
273 
274  // Body:
275 
276  primitive_value& result = _args[xi].value;
277 
278  // Postconditions:
279 
280 
281  // Exit:
282 
283  return result;
284 }
285 
289 value(int xi) const
290 {
291 
292  // Preconditions:
293 
294  require(xi < ct());
295 
296  // Body:
297 
298  const primitive_value& result = _args[xi].value;
299 
300  // Postconditions:
301 
302 
303  // Exit:
304 
305  return result;
306 }
307 
311 value(const std::string& xname)
312 {
313 
314  // Preconditions:
315 
316  require(!xname.empty());
317  require(contains_arg(xname));
318 
319  // Body:
320 
321  primitive_value& result = arg(xname).value;
322 
323  // Postconditions:
324 
325 
326  // Exit:
327 
328  return result;
329 }
330 
334 value(const std::string& xname) const
335 {
336 
337  // Preconditions:
338 
339  require(!xname.empty());
340  require(contains_arg(xname));
341 
342  // Body:
343 
344  const primitive_value& result = arg(xname).value;
345 
346  // Postconditions:
347 
348 
349  // Exit:
350 
351  return result;
352 }
353 
354 // ///
355 // sheaf::arg_list&
356 // sheaf::arg_list::
357 // operator<<(const arg_list& xinput)
358 // {
359 // // Preconditions:
360 
361 // // Body:
362 
363 // size_type linput_ct = xinput._args.ct();
364 
365 // for(size_type i=0; i<linput_ct; ++i)
366 // {
367 // _args.push_back(xinput._args[i]);
368 // }
369 
370 // // Postcondition:
371 
372 // // Exit:
373 
374 // return *this;
375 // }
376 
380 operator+=(const arg_list& xother)
381 {
382  // Preconditions:
383 
384  // Body:
385 
386  size_type lother_ct = xother._args.ct();
387 
388  for(size_type i=0; i<lother_ct; ++i)
389  {
390  _args.push_back(xother._args[i]);
391  }
392 
393  // Postcondition:
394 
395  ensure(contains_args(xother));
396 
397  // Exit:
398 
399  return *this;
400 }
401 
406 {
407  // Preconditions:
408 
409  // Body:
410 
411  switch(_parse_state)
412  {
413  case GET_NAME:
414  if(xinput.id() == C_STRING)
415  {
416  if(*xinput.value().c_string_primitive == '\0')
417  {
418  _parse_state = ERROR;
419  post_fatal_error_message("Empty string given for argument name");
420  }
421  else
422  {
423  _args.push_back(arg_type(xinput.value().c_string_primitive));
424  _parse_state = GET_VALUE;
425  }
426  }
427  else
428  {
429  _parse_state = ERROR;
430  post_fatal_error_message("Found argument value when expecting argument name");
431  }
432 
433  break;
434 
435  case GET_VALUE:
436  // _args.back().type = xinput.id;
437  _args.back().value = xinput;
438  _parse_state = GET_NAME;
439  break;
440 
441  default:
442  _parse_state = ERROR;
443  post_fatal_error_message("Unrecognized parse_state");
444  break;
445  }
446 
447  // Postcondition:
448 
449  // Exit:
450 
451  return *this;
452 }
453 
454 
455 
457 bool
460 {
461  bool result;
462 
463  // Preconditions:
464 
465 
466  // Body:
467 
468  result = (_parse_state == GET_NAME);
469 
470  // Postconditions:
471 
472 
473  // Exit:
474 
475  return result;
476 }
477 
478 
479 
481 bool
484 {
485  bool result;
486 
487  // Preconditions:
488 
489 
490  // Body:
491 
492  result = (_parse_state == GET_VALUE);
493 
494  // Postconditions:
495 
496 
497  // Exit:
498 
499  return result;
500 }
501 
502 
503 
505 bool
508 {
509  bool result;
510 
511  // Preconditions:
512 
513 
514  // Body:
515 
516  result = (_parse_state == ERROR);
517 
518  // Postconditions:
519 
520 
521  // Exit:
522 
523  return result;
524 }
525 
527 bool
530  const poset_path& xschema_path,
531  bool xuse_table_schema,
532  bool xauto_access) const
533 {
534  bool result;
535 
536  // Preconditions:
537 
538  require(xauto_access || xns.state_is_read_accessible());
539  require(xschema_path.member_exists(xauto_access));
540  require(xauto_access || xschema_path.state_is_read_accessible(xauto_access));
541 
542  // Body:
543 
544  schema_poset_member lschema(&xns, xschema_path, xauto_access);
545 
546  result = conforms_to(lschema, xuse_table_schema, xauto_access);
547 
548  lschema.detach_from_state();
549 
550  // Postconditions:
551 
552  // Exit:
553 
554  return result;
555 }
556 
558 bool
561  bool xuse_table_schema,
562  bool xauto_access) const
563 {
564  bool result;
565 
566  // Preconditions:
567 
568  require(xauto_access || xschema.state_is_read_accessible());
569 
570  // Body:
571 
572  if(xauto_access)
573  {
574  xschema.get_read_access();
575  }
576 
577  // Iterate over the dofs, checking type of each arg.
578  // Loop will terminate when we've tested all the dofs defined by the schema
579  // or if an argument is not the right type.
580 
581  poset_dof_iterator* ldof_itr = xschema.dof_iterator(xuse_table_schema);
582  while(!ldof_itr->is_done())
583  {
584  if(!arg_conforms_to(ldof_itr->item()))
585  {
586  break;
587  }
588 
589  ldof_itr->next();
590  }
591 
592  // This conforms to xschema if the list contains all the arguments
593  // and they were the right type.
594 
595  result = ldof_itr->is_done();
596 
597  // Make sure iterator item is detached
598 
599  ldof_itr->force_is_done();
600 
601  delete ldof_itr;
602 
603  if(xauto_access)
604  {
605  xschema.release_access();
606  }
607 
608  // Postconditions:
609 
610  // Exit:
611 
612  return result;
613 }
614 
616 bool
619  const poset_path& xschema_path,
620  const poset_path& xstd_schema_path,
621  bool xuse_table_schema,
622  bool xauto_access) const
623 {
624  bool result;
625 
626  // Preconditions:
627 
628  require(xauto_access || xns.state_is_read_accessible());
629  require(xschema_path.member_exists(xauto_access));
630  require(xauto_access || xschema_path.state_is_read_accessible(xauto_access));
631  require(xstd_schema_path.member_exists(xauto_access));
632  require(xschema_path.conforms_to(xstd_schema_path, xauto_access));
633 
634  // Body:
635 
636  schema_poset_member lschema(&xns, xschema_path, xauto_access);
637  schema_poset_member lstd_schema(&xns, xstd_schema_path, xauto_access);
638 
639  result =
640  conforms_to_extension(lschema, lstd_schema, xuse_table_schema, xauto_access);
641 
642  lschema.detach_from_state();
643  lstd_schema.detach_from_state();
644 
645  // Postconditions:
646 
647  // Exit:
648 
649  return result;
650 }
651 
653 bool
656  const schema_poset_member& xstd_schema,
657  bool xuse_table_schema,
658  bool xauto_access) const
659 {
660  bool result;
661 
662  // Preconditions:
663 
664  require(xauto_access || xschema.state_is_read_accessible());
665 
666  if(xauto_access)
667  {
668  // Get access to xschema.
669  // The next precondition implies that
670  // we don't need to also get access to xstd_schema.
671 
672  xschema.get_read_access();
673  }
674 
675  require(xschema.conforms_to(xstd_schema));
676 
677  // Body:
678 
679  // First, iterate over the down set of xstd_schema, marking its members.
680  // The ct() member function does this conveniently and efficiently.
681 
682  poset_dof_iterator* ldof_itr = xstd_schema.dof_iterator(xuse_table_schema);
683  ldof_itr->ct();
684 
685  // Now change the anchor to xschema and reset without clearing the markers.
686  // Iteration will not visit any of the members of the down set of xschema.
687 
688  ldof_itr->put_anchor(xschema.index());
689  ldof_itr->reset(false);
690 
691  // Iterate over the extended dofs, checking type of each arg.
692  // Loop will terminate when we've tested all the dofs or
693  // if an argument is not the right type.
694 
695  while(!ldof_itr->is_done())
696  {
697  if(!arg_conforms_to(ldof_itr->item()))
698  {
699  break;
700  }
701 
702  ldof_itr->next();
703  }
704 
705  // This conforms to xschema if all the arguments were the right type.
706 
707  result = ldof_itr->is_done();
708 
709  // Make sure iterator item is detached
710 
711  ldof_itr->force_is_done();
712 
713  if(xauto_access)
714  {
715  xschema.release_access();
716  }
717 
718  // Postconditions:
719 
720  // Exit:
721 
722  return result;
723 }
724 
725 
727 void
730 {
731  // Preconditions:
732 
733  // Body:
734 
735  arg_type lempty("");
736  _args.assign(lempty);
737 
738  _args.set_ct(0);
739  _parse_state = GET_NAME;
740 
741  // Postconditions:
742 
743  ensure(ct() == 0);
744 
745  // Exit:
746 
747  return;
748 }
749 
751 void
753 put_type(int xid)
754 {
755  // Preconditions:
756 
757 
758  // Body:
759 
761 
762  // Postconditions:
763 
764 
765  // Exit:
766 
767  return;
768 }
769 
770 // ===========================================================
771 // NON-MEMBER FUNCTIONS
772 // ===========================================================
773 
775 std::ostream&
776 sheaf::
777 operator<<(std::ostream &os, const arg_list& p)
778 {
779  // Preconditions:
780 
781 
782  // Body:
783 
784  for(int i=0; i<p.ct(); ++i)
785  {
786  os << p._args[i] << endl;
787  }
788 
789  // Empty arg name terminates arg list.
790 
791  os << '\t' << endl;
792 
793  // Postconditions:
794 
795  // Exit:
796 
797  return os;
798 }
799 
800 
802 std::istream&
803 sheaf::
804 operator>>(std::istream &is, arg_list& p)
805 {
806  // Preconditions:
807 
808 
809  // Body:
810 
811  arg_list::arg_type larg;
812  while(is >> larg)
813  {
814  if(larg.name.empty())
815  {
816  break;
817  }
818  p._args.push_back(larg);
819  }
820 
821  // Postconditions:
822 
823  // Exit:
824 
825  return is;
826 }
827 
829 std::ostream&
830 sheaf::
831 operator<<(std::ostream &os, const arg_list::arg_type& p)
832 {
833  // Preconditions:
834 
835 
836  // Body:
837 
838  os << p.name << '\t'; // Name terminated by tab.
839  os << p.value.id() << '\t'; // Type terminated by tab.
840  os << p.value.to_string();
841 
842  // Postconditions:
843 
844  // Exit:
845 
846  return os;
847 }
848 
850 std::istream&
851 sheaf::
852 operator>>(std::istream &is, arg_list::arg_type& p)
853 {
854  // Preconditions:
855 
856  require(!is.fail());
857 
858  // Body:
859 
860  // Turn off automatic skipping of leading whitespace
861  // so we can control skipping terminators.
862 
863  is >> noskipws;
864 
865  // Name is terminated by tab, which getline removes
866  // from stream but does not return in name.
867  // Empty name means end of arglist.
868 
869  getline(is, p.name, '\t');
870 
871  if(is && !p.name.empty())
872  {
873  // Type is terminated by tab, which extraction
874  // operator leaves in stream, so we have to explicitly
875  // remove it.
876 
877  char lterm;
878  primitive_type ltype;
879  is >> ltype >> lterm;
880 
881  if(is)
882  {
883  // Dof values terminated by newline;
884  // getline consumes the terminator.
885 
886  string lstr;
887  getline(is, lstr, '\n');
888 
889  if(is)
890  {
891  p.value.id() = ltype;
892  bool success = p.value.from_string(lstr);
893 
894  if(!success)
895  {
896  post_fatal_error_message("Failed to parse arg_list.");
897  }
898  }
899  }
900  }
901 
902  // Postconditions:
903 
904  ensure(is_primitive_index(p.type()) || p.name.empty() || !is);
905 
906  // Exit:
907 
908  return is;
909 }
910 
911 size_t
912 sheaf::
913 deep_size(const arg_list::arg_type& xtype, bool xinclude_shallow)
914 {
915  size_t result;
916 
917  // Preconditions:
918 
919  // Body:
920 
923 
924  result = 0;
925 
926  // Postconditions:
927 
928  ensure(result == 0);
929  //ensure(result >= 0);
930 
931  // Exit
932 
933  return result;
934 }
935 
936 // ===========================================================
937 // PRIVATE MEMBER FUNCTIONS
938 // ===========================================================
939 
941 bool
942 sheaf::arg_list::
943 arg_conforms_to(const schema_poset_member& xschema) const
944 {
945  bool result;
946 
947  // Preconditions:
948 
949 
950  // Body:
951 
952  int lschema_type = xschema.type();
953 
954  int larg_id = index(xschema.name());
955  result = ( (larg_id >= 0) && (lschema_type == type(larg_id)) );
956 
957 #ifdef DIAGNOSTIC_OUTPUT
958 
959  cout << " schema: " << xschema.name()
960  << " " << xschema.type();
961  // << " " << primitive_type_from_index(xschema.type());
962 
963  if(larg_id >= 0)
964  {
965 
966  cout << " arg: " << name(larg_id)
967  << " " << type(larg_id);
968  // << " " << primitive_type_from_index(type(larg_id));
969  }
970  else
971  {
972  cout << " arg: not present";
973  }
974 
975  cout << " conforms_to: " << boolalpha << result << noboolalpha << endl;
976 #endif
977 
978  // Postconditions:
979 
980 
981  // Exit:
982 
983  return result;
984 }
985 
989 arg(int xi)
990 {
991 
992  // Preconditions:
993 
994  require((0 <= xi) && (xi < ct()));
995 
996  // Body:
997 
998  arg_type& result = _args[xi];
999 
1000  // Postconditions:
1001 
1002 
1003  // Exit:
1004 
1005  return result;
1006 }
1007 
1011 arg(int xi) const
1012 {
1013 
1014  // Preconditions:
1015 
1016  require((0 <= xi) && (xi < ct()));
1017 
1018  // Body:
1019 
1020  const arg_type& result = _args[xi];
1021 
1022  // Postconditions:
1023 
1024 
1025  // Exit:
1026 
1027  return result;
1028 }
1029 
1031 bool
1033 contains_arg(const std::string& xname) const
1034 {
1035  // Preconditions:
1036 
1037  require(!xname.empty());
1038 
1039  // Body:
1040 
1041  // Postconditions:
1042 
1043 
1044  // Exit:
1045 
1046  return index(xname) >= 0;
1047 }
1048 
1049 bool
1051 contains_args(const arg_list& xother) const
1052 {
1053  // Preconditions:
1054 
1055  // Body:
1056 
1057  bool result = true;
1058 
1059  size_type lother_ct = xother._args.ct();
1060 
1061  for(size_type i=0; ((i<lother_ct) && result); ++i)
1062  {
1063  const arg_type& larg = xother._args[i];
1064  const string& lname = larg.name;
1065 
1066  result = contains_arg(lname);
1067 
1068  if(result)
1069  {
1070  result = (arg(lname) == larg);
1071  }
1072  }
1073 
1074  // Postconditions:
1075 
1076  // Exit:
1077 
1078  return result;
1079 }
1080 
1084 arg(const std::string& xname)
1085 {
1086 
1087  // Preconditions:
1088 
1089  require(!xname.empty());
1090  require(contains_arg(xname));
1091 
1092  // Body:
1093 
1094  int i = index(xname);
1095  arg_type& result = arg(i);
1096 
1097  // Postconditions:
1098 
1099 
1100  // Exit:
1101 
1102  return result;
1103 }
1104 
1108 arg(const std::string& xname) const
1109 {
1110 
1111  // Preconditions:
1112 
1113  require(!xname.empty());
1114  require(contains_arg(xname));
1115 
1116  // Body:
1117 
1118  int i = index(xname);
1119  const arg_type& result = arg(i);
1120 
1121  // Postconditions:
1122 
1123 
1124  // Exit:
1125 
1126  return result;
1127 }
1128 
1133 {
1134 
1135  // Preconditions:
1136 
1137  require(ct() > 0);
1138 
1139  // Body:
1140 
1141  arg_type& result = _args.back();
1142 
1143  // Postconditions:
1144 
1145 
1146  // Exit:
1147 
1148  return result;
1149 }
1150 
1154 back() const
1155 {
1156 
1157  // Preconditions:
1158 
1159  require(ct() > 0);
1160 
1161  // Body:
1162 
1163  const arg_type& result = _args.back();
1164 
1165  // Postconditions:
1166 
1167 
1168  // Exit:
1169 
1170  return result;
1171 }
1172 
1174 void
1176 push_back(const arg_type& xarg)
1177 {
1178  // Preconditions:
1179 
1180  require(parsing_name());
1181 
1182  // Body:
1183 
1184  define_old_variable(int old_ct = ct());
1185 
1186  _args.push_back(xarg);
1187 
1188  // Postconditions:
1189 
1190  ensure(ct() == old_ct + 1);
1191 
1192  // Exit:
1193 
1194  return;
1195 }
1196 
arg_list & operator+=(const arg_list &xother)
Append arg_list xother.
Definition: arg_list.cc:380
virtual void force_is_done()
Force the iterator to be done.
primitive_value value
The value of the argument.
Definition: arg_list.h:107
arg_type & arg(int xi)
The xi-th arg.
Definition: arg_list.cc:989
int type(int xi) const
The type of the xi-th argument.
Definition: arg_list.cc:222
bool empty() const
True if and only if name is empty.
Definition: arg_list.h:141
virtual void next()
Makes this the next member of the subset.
void clear()
Removes all arguments.
Definition: arg_list.cc:729
bool state_is_read_accessible(bool xauto_access) const
Definition: poset_path.cc:1103
bool conforms_to(const schema_poset_member &xother) const
True if the dofs defined by this agree in type and in order with the dofs defined by xother...
The default name space; a poset which contains other posets as members.
bool state_is_read_accessible() const
True if this is attached and if the state is accessible for read or access control is disabled...
schema_poset_member & item()
The current member of the iteration (mutable version).
arg_type & back()
The last arg.
Definition: arg_list.cc:1132
bool contains_arg(const std::string &xname) const
True if and only if this contains an arg with name xname.
Definition: arg_list.cc:1033
bool parsing_value() const
True if next token should be an argument value.
Definition: arg_list.cc:483
A path defined by a poset name and a member name separated by a forward slash (&#39;/&#39;). For example: "cell_definitions/triangle".
Definition: poset_path.h:48
STL namespace.
virtual bool is_done() const
True if iteration finished.
virtual void get_read_access() const
Get read access to the state associated with this.
const scoped_index & index() const
The index of the component state this handle is attached to.
The internal argument type.
Definition: arg_list.h:76
virtual primitive_type type() const
The primitive type index of the dof defined by this.
virtual void release_access(bool xall=false) const
Release access. If xall is true, release all levels of access. Otherwise, release one level of access...
std::string name
The name of the argument.
Definition: arg_list.h:81
A whitespace separated list of arguments. Insertion operaters are used to insert arguments into the l...
Definition: arg_list.h:63
bool conforms_to(const poset_path &xother, bool xauto_access) const
True if the schema member this refers to conforms to the schema member xother refers to in the curren...
Definition: poset_path.cc:1155
bool parsing_error() const
True if argument input has found an error.
Definition: arg_list.cc:507
std::string to_string() const
Converts this to a string (for stream insertion).
primitive_type
Type ids for sheaf primitives.
primitive_value & value(int xi)
The value of the xi-th argument.
Definition: arg_list.cc:267
bool contains_args(const arg_list &xother) const
True if and only if this contains all the args of xother.
Definition: arg_list.cc:1051
virtual void detach_from_state()
Detach this handle from its state, if any.
SHEAF_DLL_SPEC size_t deep_size(const dof_descriptor_array &xp, bool xinclude_shallow=true)
The deep size of the referenced object of type dof_descriptor_array.
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
Definition: sheaf.h:52
bool empty() const
True if and only if there are no arguments in the list.
Definition: arg_list.cc:146
std::string name(pod_index_type xdof_id, bool xis_table_dof) const
The name of the table dof (xis_table_dof true) or row dof referred to by xdof_id in the schema define...
SHEAF_DLL_SPEC bool is_primitive_index(pod_index_type xindex)
True if xindex is a valid primitive index.
unsigned int ct() const
The number of arguments.
Definition: arg_list.cc:139
primitive_type type() const
The type of the argument.
Definition: arg_list.h:86
bool conforms_to_extension(const namespace_poset &xns, const poset_path &xschema_path, const poset_path &xstd_schema_path, bool xuse_table_schema, bool xauto_access) const
True if the values in this conform to the table schema (xuse_table_schema true) or row schema (xuse_t...
Definition: arg_list.cc:618
bool from_string(const std::string &x)
Converts this from a string (from stream extraction); returns true if operation successful, false otherwise.
primitive_buffer_type & value()
The value of this.
bool member_exists(bool xauto_access) const
Definition: poset_path.cc:1079
bool conforms_to(const namespace_poset &xns, const poset_path &xschema_path, bool xuse_table_schema, bool xauto_access) const
True if the values in this conform to the table schema (xuse_table_schema true) or row schema (xuse_t...
Definition: arg_list.cc:529
primitive_type & id()
Type id of the primitive type.
int index(const std::string &xname) const
The index of the argument with name xname.
Definition: arg_list.cc:168
SHEAF_DLL_SPEC std::istream & operator>>(std::istream &is, dof_tuple_type &xdt)
Extract dof_tuple_type xdt from istream& is.
Iterates in postorder over dofs of a schema member anchor. Attaches a handle of type schema_poset_mem...
virtual poset_dof_iterator * dof_iterator(bool xis_table_dofs, int xversion=CURRENT_MEMBER_VERSION) const
A postorder iterator over the table (xis_table_dofs == true) or row (xis_table_dofs == false) dofs de...
friend SHEAF_DLL_SPEC std::ostream & operator<<(std::ostream &os, const arg_list &xf)
Insert arg_list p into ostream os.
primitive_type id() const
The id for the primitive type associated with this.
SHEAF_DLL_SPEC std::ostream & operator<<(std::ostream &os, const dof_descriptor_array &p)
Insert dof_descriptor_array& p into ostream& os.
void put_type(primitive_type xid)
Sets the type of the argument to xid.
Definition: arg_list.h:94
bool parsing_name() const
True if next token should be an argument name.
Definition: arg_list.cc:459
Abstract object wrapper for an instance of a primitive type.
arg_list()
Default constructor.
Definition: arg_list.cc:41
virtual int ct(bool xreset=false)
The number of members of the iteration set, from the current member to the end, inclusive. If xreset, reset before computing the count.
void push_back(const arg_type &xarg)
Definition: arg_list.cc:1176
const std::string & name(int xi) const
The name of the xi-th argument.
Definition: arg_list.cc:200
A client handle for a poset member which has been prepared for use as a schema.