SheafSystem  0.0.0.0
poset_state_handle.h
Go to the documentation of this file.
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 
20 
21 #ifndef POSET_STATE_HANDLE_H
22 #define POSET_STATE_HANDLE_H
23 
24 #ifndef SHEAF_DLL_SPEC_H
25 #include "SheafSystem/sheaf_dll_spec.h"
26 #endif
27 
28 #ifndef ABSTRACT_POSET_MEMBER_H
29 #include "SheafSystem/abstract_poset_member.h"
30 #endif
31 
32 #ifndef POOL_H
33 #include "SheafSystem/pool.h"
34 #endif
35 
36 #ifndef POSET_CRG_STATE_H
37 #include "SheafSystem/poset_crg_state.h"
38 #endif
39 
40 #ifndef POSET_MEMBER_H
41 #include "SheafSystem/poset_member.h"
42 #endif
43 
44 #ifndef POSET_POWERSET_STATE_H
45 #include "SheafSystem/poset_powerset_state.h"
46 #endif
47 
48 #ifndef POSET_STATE_H
49 #include "SheafSystem/poset_state.h"
50 #endif
51 
52 #ifndef POSET_TABLE_STATE_H
53 #include "SheafSystem/poset_table_state.h"
54 #endif
55 
56 #ifndef READ_WRITE_MONITOR_HANDLE_H
57 #include "SheafSystem/read_write_monitor_handle.h"
58 #endif
59 
60 #ifndef SCHEMA_POSET_MEMBER_H
61 #include "SheafSystem/schema_poset_member.h"
62 #endif
63 
64 #ifndef SCOPED_INDEX_H
65 #include "SheafSystem/scoped_index.h"
66 #endif
67 
68 #ifndef SHEAF_H
69 #include "SheafSystem/sheaf.h"
70 #endif
71 
72 #ifndef STD_IOSTREAM_H
73 #include "SheafSystem/std_iostream.h"
74 #endif
75 
76 #ifndef STD_STRING_H
77 #include "SheafSystem/std_string.h"
78 #endif
79 
80 #ifndef SUBPOSET_H
81 #include "SheafSystem/subposet.h"
82 #endif
83 
84 #ifndef NAME_MULTIMAP_H
85 #include "SheafSystem/name_multimap.h"
86 #endif
87 
88 
89 namespace sheaf
90 {
91 
92 template <typename T> class block;
93 template <typename T> class depth_first_itr;
94 class namespace_poset;
95 class primitives_poset;
96 class depth_first_iterator;
97 class index_equivalence_iterator;
98 class index_map;
99 class implict_crg_interval;
100 class index_iterator;
101 class namespace_poset_member;
102 class poset_bounds;
103 class poset_component;
104 class poset_dof_map;
105 class poset_handle_factory;
106 class subposet_names_record;
107 class storage_agent;
108 class subposet_state;
109 class zn_to_bool;
110 
111 // Following functions must be forward declared before friend statement.
112 
116 SHEAF_DLL_SPEC
117 std::ostream & operator << (std::ostream &os, const poset_state_handle& p);
118 
128 SHEAF_DLL_SPEC
129 size_t deep_size(const poset_state_handle& xp,
130  bool xinclude_shallow = true,
131  size_t xresults[4] = 0);
132 
136 class SHEAF_DLL_SPEC poset_state_handle : public read_write_monitor_handle
137 {
138  friend class abstract_poset_member;
139  friend class array_poset_dof_map;
140  friend class block_poset_builder;
141  friend class depth_first_iterator; // needs powerset_member()
142  template<typename T>
143  friend class depth_first_itr; // needs powerset_member()
144  friend class dof_tuple_record_set; // needs initialize_dof_id_space()
145  friend class member_record; // needs crg()
146  friend class member_record_set; // needs crg()
147  friend class namespace_poset; // needs state functions.
148  friend class poset_component; // needs version_to_name(), state_obj()
149  friend class poset_handle_factory; // needs destructor.
150  friend class poset_joiner; // needs cross_link()
151  friend class poset_scaffold; // needs member_name_map(), table()
152  friend class poset_slicer; // needs contains_members(list_cover_set*)
153  friend class primitives_poset_dof_map; // needs state_obj()
154  friend class schema_poset_member;
155  friend class storage_agent; // needs powerset() and table()
156  friend class subposet_joiner; // needs cross_link()
157  friend class subposet_names_record; // needs version_to_name()
158  friend class table_dof_tuple_record; // needs new_state()
159  friend SHEAF_DLL_SPEC std::ostream & sheaf::operator << (std::ostream &os, const poset_state_handle& p); // needs state_obj()
160  friend SHEAF_DLL_SPEC size_t sheaf::deep_size(const poset_state_handle& xp, bool xinclude_shallow, size_t xresults[4]);
161 
162  // ===========================================================
164  // ===========================================================
166 
167 public:
168 
169 protected:
170 
177  static poset_state_handle*
178  new_poset_handle(const std::string& xclass_name, poset_type xsheaf_base_class_id);
179 
183  static poset_handle_factory& factory();
184 
189 
193  virtual ~poset_state_handle();
194 
199 
204 
209  {
210  return const_cast<poset_state_handle&>(*this);
211  };
212 
213 private:
214 
216 
217 
218  // ===========================================================
220  // ===========================================================
222 
223 public:
224 
228  virtual poset_type type_id() const;
229 
233  virtual const char* class_name() const;
234 
243 
247  virtual void begin_jim_edit_mode(bool xauto_access = true);
248 
252  virtual void end_jim_edit_mode(bool xensure_lattice_invariant = true,
253  bool xauto_access = true);
254 
258  bool in_jim_edit_mode() const;
259 
264  int jim_edit_depth(bool xauto_access) const;
265 
272  bool is_external() const;
273 
277  virtual void get_read_access() const;
278 
285  virtual void get_read_write_access(bool xrelease_read_only_access = false);
286 
291  virtual void release_access(bool xall = false) const;
292 
296  virtual bool is_attached() const;
297 
301  bool is_same_state(const poset_state_handle* xother) const;
302 
303 protected:
304 
309 
313  virtual poset_state* state_obj() const;
314 
315  // The following attach_to_state is not virtual because it
316  // calls attach_handle_data_members, which is virtual.
317 
321  void attach_to_state(const poset_state_handle* xother);
322 
327  virtual void attach_to_state(const namespace_poset* xhost, pod_index_type xindex);
328 
333  void attach_to_state(const namespace_poset* xhost, const scoped_index& xindex);
334 
339  virtual void attach_to_state(const namespace_poset* xhost, const std::string& xname);
340 
344  virtual void attach_to_state(const abstract_poset_member* xmbr);
345 
349  virtual void detach_from_state();
350 
351 // ///
352 // /// Detaches this handle and deletes its state
353 // ///
354 // void delete_state(bool xauto_access);
355 
361  void new_state(namespace_poset& xns, const poset_path& xpath, const schema_poset_member& xschema, array_poset_dof_map& xdof_map);
362 
367  virtual void new_state(const poset_path& xpath, const schema_poset_member& xschema, array_poset_dof_map& xdof_map);
368 
376  virtual void initialize_handle_data_members(const namespace_poset& xns);
377 
383  virtual void attach_handle_data_members();
384 
388  void ensure_lattice_invariant();
389 
394  virtual void terminate_access();
395 
396 private:
397 
399 
400 
401  // ===========================================================
403  // ===========================================================
405 
406 public:
407 
412  namespace_poset* host() const;
413 
417  namespace_poset* name_space() const;
418 
422  const scoped_index& index() const;
423 
427  virtual const primitives_poset& primitives() const;
428 
432  virtual std::string name() const;
433 
437  virtual std::string name(bool xauto_access) const;
438 
442  virtual poset_path path(bool xauto_access = true) const;
443 
444 protected:
445 
450 
455 
460  virtual void initialize_namespace(namespace_poset& xns,
461  const std::string& xposet_name,
462  bool xauto_link = true);
463 
464 private:
465 
467 
468 
469  // ===========================================================
471  // ===========================================================
473 
474 public:
475 
476  // poset_state_handle* hplus(poset_state_handle* other);
477  // void hplus_pa(poset_state_handle* other, poset_state_handle* result);
478  // void hplus_sa(poset_state_handle* other);
479  // // horizontal sum of this and other (this hplus other), auto- and pre-, and self-allocated versions
480 
481  // poset_state_handle* vplus(poset_state_handle* other);
482  // void vplus_pa(poset_state_handle* other, poset_state_handle* result);
483  // void vplus_sa(poset_state_handle* other);
484  // // vertical sum of this and other (this vplus other), auto- and pre-, and self-allocated versions
485 
486 protected:
487 
488 private:
489 
491 
492 
493  // ===========================================================
495  // ===========================================================
497 
498 public:
499 
508  virtual pod_index_type new_member(bool xis_jim, pod_index_type xtuple_hub_id);
509 
518  void new_member(bool xis_jim, const scoped_index& xtuple_id, scoped_index& result);
519 
529  virtual pod_index_type new_member(bool xis_jim, poset_dof_map* xdof_map = 0, bool xcopy_dof_map = false);
530 
540  void new_member(bool xis_jim, poset_dof_map* xdof_map,
541  bool xcopy_dof_map, scoped_index& result);
542 
551  virtual pod_index_type new_member_interval(const std::string& xinterval_type,
552  size_type xsize,
553  const block<pod_index_type>& xtuple_hub_ids,
554  const block<pod_index_type>& xdata);
555 
564  void new_member_interval(const std::string& xinterval_type, size_type xsize,
565  const block<pod_index_type>& xtuple_hub_ids,
566  const block<pod_index_type>& xdata,
567  scoped_index& result);
568 
576  virtual void delete_member(pod_index_type xmbr_hub_id);
577 
585  void delete_member(const scoped_index& xmbr_id);
586 
590  virtual int member_ct() const;
591 
596  virtual int standard_member_ct() const;
597 
602  bool has_standard_member_ct() const;
603 
607  virtual scoped_index member_index_ub() const;
608 
613  index_iterator member_iterator() const;
614 
619  virtual bool contains_member(pod_index_type xmbr_hub_id, bool xauto_access = true) const;
620 
625  bool contains_member(const scoped_index& xmbr_id, bool xauto_access = true) const;
626 
631  virtual bool contains_member(pod_index_type xmbr_hub_id, int xversion, bool xauto_access = true) const;
632 
637  bool contains_member(const scoped_index& xmbr_id, int xversion, bool xauto_access = true) const;
638 
642  virtual bool contains_member(const std::string& xname, bool xauto_access = true) const;
643 
647  bool contains_member(const abstract_poset_member* xmbr, bool xauto_access = true) const;
648 
652  bool contains_members(const scoped_index* xmbrs, int xmbrs_ct, bool xauto_access = true) const;
653 
657  bool contains_members(pod_index_type* xmbrs, int xmbrs_ct, bool xauto_access = true) const;
658 
662  bool contains_members(const std::string* xnames, int xnames_ct, bool xauto_access = true) const;
663 
667  bool contains_members(const block<pod_index_type>& p, bool xauto_access = true) const;
668 
672  bool contains_members(const block<scoped_index>& p, bool xauto_access = true) const;
673 
677  bool contains_members(const block<std::string>& p, bool xauto_access = true) const;
678 
682  bool is_empty() const;
683 
689  virtual bool is_jim(pod_index_type xmbr_hub_id, bool xin_current_version = true) const;
690 
696  bool is_jim(const scoped_index& xmbr_id, bool xin_current_version = true) const;
697 
703  bool is_jim(const std::string& xname, bool xin_current_version = true) const;
704 
708  virtual bool is_atom(pod_index_type xmbr_hub_id) const;
709 
713  bool is_atom(const scoped_index& xmbr_id) const;
714 
718  abstract_poset_member& top();
719 
723  const abstract_poset_member& top() const;
724 
728  abstract_poset_member& bottom();
729 
733  const abstract_poset_member& bottom() const;
734 
735 protected:
736 
741 
746 
751  {
752  return *(state_obj()->crg());
753  };
754 
758  virtual void initialize_standard_members();
759 
763  inline void put_standard_member_ct(int xct)
764  {
765  crg().put_standard_member_ct(xct);
766  };
767 
771  inline void put_standard_row_dof_tuple_ct(int xct)
772  {
773  table().put_standard_row_dof_tuple_ct(xct);
774  };
775 
779  bool index_in_bounds(const scoped_index& xmbr_id) const;
780 
784  bool index_in_bounds(const block<scoped_index>& indices) const;
785 
794  virtual void new_member(pod_index_type xmbr_hub_id,
795  bool xis_jim,
796  const scoped_index& xdof_tuple_id);
797 
807  void new_member(pod_index_type xmbr_hub_id,
808  bool xis_jim,
809  poset_dof_map* xdof_map,
810  bool xcopy_dof_map);
811 
824  virtual pod_index_type new_member_interval(const std::string& xinterval_type, size_type xsize);
825 
839  virtual void new_member_interval(pod_index_type xmbr_hub_id,
840  const std::string& xinterval_type,
841  size_type xsize);
842 
843 private:
844 
846 
847  // ===========================================================
849  // ===========================================================
851 
852 public:
853 
857  poset_path member_path(pod_index_type xmbr_hub_id, bool xauto_access) const;
858 
862  virtual std::string member_name(pod_index_type xmbr_hub_id, bool xauto_access = false) const;
863 
867  std::string member_name(const scoped_index& xmbr_id, bool xauto_access = false) const;
868 
872  void all_member_names(pod_index_type xmbr_hub_id,
873  block<std::string>& xresult,
874  bool xauto_access = false) const;
875 
879  void all_member_names(const scoped_index& xmbr_id,
880  block<std::string>& xresult,
881  bool xauto_access = false) const;
882 
886  size_type member_name_ct(pod_index_type xmbr_hub_id, bool xauto_access) const;
887 
891  size_type member_name_ct(const scoped_index& xmbr_id, bool xauto_access) const;
892 
896  bool member_has_name(pod_index_type xmbr_hub_id,
897  const std::string& xname,
898  bool xauto_access = false) const;
899 
903  bool member_has_name(const scoped_index& xmbr_hub_id,
904  const std::string& xname,
905  bool xauto_access = false) const;
906 
911  virtual void put_member_name(pod_index_type xmbr_hub_id,
912  const std::string& xname,
913  bool xunique,
914  bool xauto_access = false);
915 
920  void put_member_name(const scoped_index& xmbr_id,
921  const std::string& xname,
922  bool xunique,
923  bool xauto_access = false);
924 
928  void delete_member_name(const std::string& xname, bool xauto_access = false);
929 
933  void delete_all_member_names(pod_index_type xmbr_hub_id,
934  bool xauto_access = false);
935 
939  void delete_all_member_names(const scoped_index& xmbr_id,
940  bool xauto_access = false);
941 
942 protected:
943 
948 
952  member_name_map_type& member_name_map(bool xrequire_write_access = false);
953 
954 private:
955 
957 
958 
959  // ===========================================================
961  // ===========================================================
963 
964 public:
965 
969  const index_space_family& member_id_spaces(bool xauto_access) const;
970 
974  index_space_family& member_id_spaces(bool xauto_access);
975 
979  const hub_index_space_handle& member_hub_id_space(bool xauto_access) const;
980 
985  virtual const scoped_index& member_id(bool xauto_access) const;
986 
990  scoped_index member_id(pod_index_type xid, bool xauto_access) const;
991 
995  virtual pod_index_type member_id(const std::string& xname, bool xauto_access) const;
996 
1000  void member_id(const std::string& xname, scoped_index& result, bool xauto_access) const;
1001 
1002 protected:
1003 
1007  void update_standard_member_id_spaces();
1008 
1012  void clear_member_id_spaces(bool xauto_access);
1013 
1018  pod_index_type new_term(size_type xct, bool xauto_access);
1019 
1026  void extend_last_member_term(size_type xct, bool xauto_access);
1027 
1028 private:
1029 
1031 
1032 
1033  // ===========================================================
1035  // ===========================================================
1037 
1038 public:
1039 
1043  virtual bool le(pod_index_type xgreater, pod_index_type xlesser) const;
1044 
1048  bool le(const scoped_index& xgreater, const scoped_index& xlesser) const;
1049 
1053  virtual bool leqv(pod_index_type xgreater, pod_index_type xlesser) const;
1054 
1058  bool leqv(const scoped_index& xgreater, const scoped_index& xlesser) const;
1059 
1063  virtual bool is_jem(pod_index_type xmbr_hub_id, pod_index_type xother_hub_id) const;
1064 
1068  bool is_jem(const scoped_index& xmbr_id, const scoped_index& xother_id) const;
1069 
1074  virtual pod_index_type greatest_jem(pod_index_type xmbr_hub_id) const;
1075 
1079  void greatest_jem(const scoped_index& xmbr_id, scoped_index& result) const;
1080 
1085  virtual pod_index_type least_jem(pod_index_type xmbr_hub_id) const;
1086 
1090  void least_jem(const scoped_index& xmbr_id, scoped_index& result) const;
1091 
1097  void link_greatest_jem(pod_index_type xjem1, pod_index_type xjem2);
1098 
1104  void link_greatest_jem(const scoped_index& xjem1, const scoped_index& xjem2);
1105 
1111  void link_least_jem(pod_index_type xjem1, pod_index_type xjem2);
1112 
1118  void link_least_jem(const scoped_index& xjem1, const scoped_index& xjem2);
1119 
1124  virtual void merge_jems(pod_index_type xjem1, pod_index_type xjem2);
1125 
1129  void merge_jems(const scoped_index& xjem1, const scoped_index& xjem2);
1130 
1131 protected:
1132 
1133 private:
1134 
1136 
1137 
1138  // ===========================================================
1140  // ===========================================================
1142 
1143 public:
1144 
1152  virtual void new_link(pod_index_type xgreater, pod_index_type xlesser);
1153 
1161  void new_link(const scoped_index& xgreater, const scoped_index& xlesser);
1162 
1166  virtual void delete_link(pod_index_type xgreater, pod_index_type xlesser);
1167 
1171  void delete_link(const scoped_index& xgreater, const scoped_index& xlesser);
1172 
1176  virtual bool contains_link(pod_index_type xgreater, pod_index_type xlesser) const;
1177 
1181  bool contains_link(const scoped_index& xgreater, const scoped_index& xlesser) const;
1182 
1187  pod_index_type cover_id_space_id(bool xlower, pod_index_type xmbr_hub_id) const;
1188 
1193  pod_index_type cover_id_space_id(bool xlower, const scoped_index& xmbr_id) const;
1194 
1199  index_space_handle& get_cover_id_space(bool xlower, pod_index_type xmbr_hub_id) const;
1200 
1205  index_space_handle& get_cover_id_space(bool xlower, const scoped_index& xmbr_id) const;
1206 
1212  template <typename handle_type>
1213  handle_type& get_cover_id_space(bool xlower, pod_index_type xmbr_index) const;
1214 
1219  template<typename handle_type>
1220  bool cover_id_space_handle_conforms_to(bool xlower, pod_index_type xmbr_index) const;
1221 
1225  void release_cover_id_space(index_space_handle& xcover_id_space) const;
1226 
1231  index_space_iterator& get_cover_id_space_iterator(bool xlower, pod_index_type xmbr_hub_id) const;
1232 
1233 
1238  index_space_iterator& get_cover_id_space_iterator(bool xlower, const scoped_index& xmbr_id) const;
1239 
1243  void release_cover_id_space_iterator(index_space_iterator& xcover_itr) const;
1244 
1250  bool cover_contains_iterator(bool xlower,
1251  pod_index_type xmbr_hub_id,
1252  const index_space_iterator& xitr) const;
1253 
1259  bool cover_contains_iterator(bool xlower,
1260  const scoped_index& xmbr_id,
1261  const index_space_iterator& xitr) const;
1262 
1268  bool cover_is_empty(bool xlower, pod_index_type xmbr_hub_id) const;
1269 
1275  bool cover_is_empty(bool xlower, const scoped_index& xmbr_id) const;
1276 
1282  bool cover_is_singleton(bool xlower, pod_index_type xmbr_hub_id) const;
1283 
1289  bool cover_is_singleton(bool xlower, const scoped_index& xmbr_id) const;
1290 
1295  virtual size_type cover_ct(bool xlower, pod_index_type xmbr_hub_id) const;
1296 
1301  size_type cover_ct(bool xlower, const scoped_index& xmbr_id) const;
1302 
1308  bool cover_contains_member(bool xlower,
1309  pod_index_type xmbr_hub_id,
1310  pod_index_type xother_mbr_hub_id) const;
1311 
1317  bool cover_contains_member(bool xlower,
1318  const scoped_index& xmbr_id,
1319  const scoped_index& xother_mbr_id) const;
1320 
1328  bool cover_is_equal(bool xlower,
1329  pod_index_type xmbr_hub_id,
1330  pod_index_type xother_mbr_hub_id) const;
1331 
1339  bool cover_is_equal(bool xlower,
1340  const scoped_index& xmbr_id,
1341  const scoped_index& xother_mbr_id) const;
1342 
1347  pod_index_type first_cover_member(bool xlower, pod_index_type xmbr_hub_id) const;
1348 
1353  void first_cover_member(bool xlower, const scoped_index& xmbr_id,
1354  scoped_index& result) const;
1355 
1360  void insert_cover_member(pod_index_type xother_mbr_hub_id,
1361  bool xlower,
1362  pod_index_type xmbr_hub_id);
1363 
1368  void insert_cover_member(const scoped_index& xother_mbr_id,
1369  bool xlower,
1370  const scoped_index& xmbr_id);
1371 
1378  void insert_cover_member(pod_index_type xother_mbr_hub_id,
1379  bool xlower,
1380  pod_index_type xmbr_hub_id,
1381  index_space_iterator& xitr);
1382 
1389  void insert_cover_member(const scoped_index& xother_mbr_id,
1390  bool xlower,
1391  const scoped_index& xmbr_id,
1392  index_space_iterator& xitr);
1393 
1398  void remove_cover_member(pod_index_type xother_mbr_hub_id,
1399  bool xlower,
1400  pod_index_type xmbr_hub_id);
1401 
1406  void remove_cover_member(const scoped_index& xother_mbr_id,
1407  bool xlower,
1408  const scoped_index& xmbr_id);
1409 
1416  void remove_cover_member(index_space_iterator& xitr,
1417  bool xlower,
1418  pod_index_type xmbr_hub_id);
1419 
1426  void remove_cover_member(index_space_iterator& xitr,
1427  bool xlower,
1428  const scoped_index& xmbr_id);
1429 
1435  template <typename filter_type>
1436  void remove_cover_members(const filter_type& xfilter,
1437  bool xlower,
1438  pod_index_type xmbr_hub_id);
1439 
1445  template <typename filter_type>
1446  void remove_cover_members(const filter_type& xfilter,
1447  bool xlower,
1448  const scoped_index& xmbr_id);
1449 
1455  void replace_cover_member(const scoped_index& xold_other_mbr_hub_id,
1456  const scoped_index& xnew_other_mbr_hub_id,
1457  bool xlower,
1458  const scoped_index& xmbr_hub_id);
1459 
1464  void replace_cover_member(pod_index_type xold_other_mbr_id,
1465  pod_index_type xnew_other_mbr_id,
1466  bool xlower,
1467  pod_index_type xmbr_id);
1468 
1473  void clear_cover(bool xlower, pod_index_type xmbr_hub_id);
1474 
1479  void clear_cover(bool xlower, const scoped_index& xmbr_id);
1480 
1486  void copy_cover(bool xlower,
1487  pod_index_type xmbr_hub_id,
1488  pod_index_type xother_mbr_hub_id);
1489 
1495  void copy_cover(bool xlower,
1496  const scoped_index& xmbr_id,
1497  const scoped_index& xother_mbr_id);
1498 
1504  void append_upper_cover_of_bottom(pod_index_type xmbr_hub_begin,
1505  pod_index_type xmbr_hub_end);
1506 
1512  void append_upper_cover_of_bottom(const scoped_index& xmbr_begin,
1513  const scoped_index& xmbr_end);
1514 
1515 protected:
1516 
1522  void transfer_cover(pod_index_type xsrc, pod_index_type xdst, bool lower);
1523 
1524 private:
1525 
1527 
1528 
1529 
1530  // ===========================================================
1532  // ===========================================================
1534 
1535 public:
1536 
1540  virtual size_type subposet_ct() const;
1541 
1546  virtual int standard_subposet_ct() const;
1547 
1552  bool has_standard_subposet_ct() const;
1553 
1557  virtual scoped_index subposet_index_ub() const;
1558 
1562  virtual pod_index_type subposet_id(const std::string& xname) const;
1563 
1567  virtual void subposet_id(const std::string& xname, scoped_index& result) const;
1568 
1573  virtual index_space_iterator& get_subposet_id_space_iterator() const;
1574 
1578  virtual void release_subposet_id_space_iterator(index_space_iterator& xitr) const;
1579 
1583  virtual bool includes_subposet(pod_index_type xsubposet_hub_id,
1584  bool xauto_access = true) const;
1585 
1589  bool includes_subposet(const scoped_index& xsubposet_id,
1590  bool xauto_access = true) const;
1591 
1595  bool includes_subposet(const std::string& xname, bool xauto_access = true) const;
1596 
1600  bool includes_subposet(const subposet* xs, bool xauto_access = true) const;
1601 
1605  bool includes_subposets(const block<pod_index_type>& xhub_ids, bool xauto_access = true) const;
1606 
1610  bool includes_subposets(const block<scoped_index>& xids, bool xauto_access = true) const;
1611 
1615  virtual pod_index_type new_subposet(bool xinitialize = true);
1616 
1620  void new_subposet(bool xinitialize, scoped_index& result);
1621 
1626  virtual pod_index_type new_subposet(const block<pod_index_type>& xmembers);
1627 
1632  virtual void new_subposet(const block<scoped_index>& xmembers, scoped_index& result);
1633 
1637  virtual void delete_subposet(pod_index_type xsubposet_hub_id);
1638 
1642  void delete_subposet(const scoped_index& xsubposet_id);
1643 
1647  virtual const subposet& whole() const;
1648 
1652  virtual subposet& jims();
1653 
1657  virtual const subposet& jims() const;
1658 
1662  subposet& table_dof_subposet();
1663 
1667  const subposet& table_dof_subposet() const;
1668 
1672  subposet& row_dof_subposet();
1673 
1677  const subposet& row_dof_subposet() const;
1678 
1682  static const std::string& coarsest_common_refinement_name();
1683 
1684 protected:
1685 
1690 
1694  virtual subposet& resident();
1695 
1699  virtual const subposet& resident() const;
1700 
1704  poset_powerset_state& powerset() const;
1705 
1709  virtual void initialize_standard_subposets(const std::string& xname);
1710 
1714  void put_standard_subposet_ct(int xct);
1715 
1716 private:
1717 
1719 
1720  // ===========================================================
1722  // ===========================================================
1724 
1725 public:
1726 
1730  virtual std::string subposet_name(pod_index_type xsubposet_hub_id, bool xauto_access = false) const;
1731 
1735  std::string subposet_name(const scoped_index& xsubposet_id, bool xauto_access = false) const;
1736 
1740  void all_subposet_names(pod_index_type xsubposet_hub_id,
1741  block<std::string>& xresult,
1742  bool xauto_access = false) const;
1743 
1747  void all_subposet_names(const scoped_index& xsubposet_id,
1748  block<std::string>& xresult,
1749  bool xauto_access = false) const;
1750 
1754  size_type subposet_name_ct(pod_index_type xsubposet_hub_id, bool xauto_access) const;
1755 
1759  size_type subposet_name_ct(const scoped_index& xsubposet_id, bool xauto_access) const;
1760 
1764  bool subposet_has_name(pod_index_type xsubposet_hub_id, const std::string& xname, bool xauto_access = false) const;
1765 
1769  bool subposet_has_name(const scoped_index& xsubposet_id, const std::string& xname, bool xauto_access = false) const;
1770 
1775  virtual void put_subposet_name(pod_index_type xsubposet_hub_id,
1776  const std::string& xname,
1777  bool xunique,
1778  bool xauto_access);
1779 
1784  void put_subposet_name(const scoped_index& xsubposet_id,
1785  const std::string& xname,
1786  bool xunique,
1787  bool xauto_access);
1788 
1792  void delete_subposet_name(const std::string& xname, bool xauto_access = false);
1793 
1797  void delete_all_subposet_names(pod_index_type xsubposet_hub_id,
1798  bool xauto_access = false);
1799 
1803  void delete_all_subposet_names(const scoped_index& xsubposet_id,
1804  bool xauto_access = false);
1805 
1806 protected:
1807 
1808 private:
1809 
1811 
1812 
1813  // ===========================================================
1815  // ===========================================================
1817 
1818 public:
1819 
1823  const index_space_family& subposet_id_spaces(bool xauto_access) const;
1824 
1828  index_space_family& subposet_id_spaces(bool xauto_access);
1829 
1833  const hub_index_space_handle& subposet_hub_id_space(bool xauto_access) const;
1834 
1840  virtual const scoped_index& subposet_id(bool xauto_access) const;
1841 
1845  scoped_index subposet_id(pod_index_type xid, bool xauto_access) const;
1846 
1847 protected:
1848 
1849 private:
1850 
1852 
1853 
1854 
1855  // ===========================================================
1857  // ===========================================================
1859 
1860 public:
1861 
1866 
1870  virtual schema_poset_member& schema();
1871 
1875  virtual const schema_poset_member& schema() const;
1876 
1880  schema_poset_member& schema(bool xauto_access);
1881 
1885  const schema_poset_member& schema(bool xauto_access) const;
1886 
1890  virtual bool schema_is_ancestor_of(const schema_poset_member* xother_schema) const;
1891 
1895  bool schema_is(const std::string& xschema_name) const;
1896 
1900  bool same_schema(const poset_state_handle* xother) const;
1901 
1905  bool same_schema(const abstract_poset_member* xother) const;
1906 
1907 protected:
1908 
1909 private:
1910 
1912 
1913  // ===========================================================
1915  // ===========================================================
1917 
1918 public:
1919 
1920 
1925  virtual bool table_dof_map_conforms(const poset_dof_map* xdof_map) const;
1926 
1931  virtual bool row_dof_map_conforms(const poset_dof_map* xdof_map) const;
1932 
1936  virtual array_poset_dof_map& table_dof_map(bool xrequire_write_access = false);
1937 
1941  virtual const array_poset_dof_map& table_dof_map(bool xrequire_write_access = false) const;
1942 
1947  void table_dof_tuple(void* xbuf, size_t xbuflen) const;
1948 
1952  void* table_dofs();
1953 
1957  const void* table_dofs() const;
1958 
1962  void* table_dofs(bool xauto_access);
1963 
1967  const void* table_dofs(bool xauto_access) const;
1968 
1969 protected:
1970 
1974  poset_table_state& table() const;
1975 
1979  void initialize_table_dofs(void* xtable_dofs, size_t xtable_dof_ub);
1980 
1984  void initialize_table_dof_tuple(array_poset_dof_map* xdof_tuple);
1985 
1986 private:
1987 
1989 
1990  // ===========================================================
1992  // ===========================================================
1994 
1995 public:
1996 
2001  virtual poset_dof_map& row_dof_map(pod_index_type xtuple_hub_id,
2002  bool xrequire_write_access = false) const;
2003 
2008  poset_dof_map& row_dof_map(const scoped_index& xtuple_id,
2009  bool xrequire_write_access = false) const;
2010 
2014  virtual const scoped_index& new_row_dof_map();
2015 
2019  virtual const scoped_index& clone_row_dof_map(const poset_dof_map& xprototype);
2020 
2025  poset_dof_map& member_dof_map(pod_index_type xmbr_hub_id, bool xrequire_write_access = false);
2026 
2030  poset_dof_map& member_dof_map(const scoped_index& xmbr_id, bool xrequire_write_access = false);
2031 
2036  const poset_dof_map& member_dof_map(pod_index_type xmbr_hub_id, bool xrequire_write_access = false) const;
2037 
2041  const poset_dof_map& member_dof_map(const scoped_index& xmbr_id, bool xrequire_write_access = false) const;
2042 
2047  void member_dof_tuple(pod_index_type xmbr_hub_id, void* xbuf, size_t xbuf_len, bool xauto_access) const;
2048 
2053  void put_member_dof_tuple(pod_index_type xmbr_hub_id, void* xbuf, size_t xbuf_len, bool xauto_access);
2054 
2058  pod_index_type member_dof_tuple_id(pod_index_type xmbr_hub_id, bool xauto_access) const;
2059 
2063  void member_dof_tuple_id(const scoped_index& xmbr_id, scoped_index& result, bool xauto_access) const;
2064 
2069  void put_member_dof_tuple_id(pod_index_type xmbr_hub_id,
2070  pod_index_type xtuple_hub_id,
2071  bool xauto_access);
2072 
2077  void put_member_dof_tuple_id(const scoped_index& xmbr_id,
2078  const scoped_index& xtuple_id,
2079  bool xauto_access);
2080 
2084  bool contains_row_dof_tuple(pod_index_type xtuple_hub_id) const;
2085 
2089  bool contains_row_dof_tuple(const scoped_index& xtuple_id) const;
2090 
2094  size_type row_dof_tuple_ct() const;
2095 
2100  int standard_row_dof_tuple_ct() const;
2101 
2106  bool has_standard_row_dof_tuple_ct() const;
2107 
2108 protected:
2109 
2110 private:
2111 
2113 
2114  // ===========================================================
2116  // ===========================================================
2118 
2119 public:
2120 
2124  const index_space_family& dof_tuple_id_spaces(bool xauto_access) const;
2125 
2129  index_space_family& dof_tuple_id_spaces(bool xauto_access);
2130 
2134  const hub_index_space_handle& dof_tuple_hub_id_space(bool xauto_access) const;
2135 
2141  virtual const scoped_index& dof_tuple_id(bool xauto_access) const;
2142 
2146  scoped_index dof_tuple_id(pod_index_type xid, bool xauto_access) const;
2147 
2148 protected:
2149 
2150 private:
2151 
2153 
2154 
2155  // ===========================================================
2157  // ===========================================================
2159 
2160 public:
2161 
2166  virtual bool is_schematized(bool xauto_access) const;
2167 
2172  virtual void schematize(subposet* xtable_dof_subposet,
2173  subposet* xrow_dof_subposet,
2174  bool xall_members = false);
2175 
2176 protected:
2177 
2181  void initialize_dof_id_space(subposet& xdof_subposet);
2182 
2183 private:
2184 
2186 
2187 
2188  // ===========================================================
2190  // ===========================================================
2192 
2193 public:
2194 
2198  virtual int version_ct() const;
2199 
2203  virtual int version() const;
2204 
2208  virtual pod_index_type version_index(int xversion) const;
2209 
2213  void version_index(int xversion, scoped_index& result) const;
2214 
2218  virtual pod_index_type version_jims_index(int xversion) const;
2219 
2223  void version_jims_index(int xversion, scoped_index& result) const;
2224 
2228  bool has_version(int xversion) const;
2229 
2233  bool is_version() const;
2234 
2235 protected:
2236 
2240  static const std::string& VERSION_PREFIX();
2241 
2245  static int VERSION_PREFIX_LENGTH();
2246 
2250  bool is_version_name(const std::string& xname) const;
2251 
2255  std::string version_to_name(int xversion) const;
2256 
2260  int version_from_name(const std::string& xname) const;
2261 
2265  void put_version(int xversion);
2266 
2267 private:
2268 
2270 
2271 
2272  // ===========================================================
2274  // ===========================================================
2276 
2277 public:
2278 
2279  // The product subposet hack, version 2 (PSH2).
2280  // ============================================
2281  // The abstraction that PSH2 exports via the virtual functions below
2282  // and their use in the i/o susbsystem is:
2283  //
2284  // 1) All member ids, in particular those associated with bounds and
2285  // bound iterators, are actual member ids for the poset they belong to.
2286  // The PSH1 use of section space schema member ids that were actually
2287  // base space member ids is now gone.
2288  //
2289  // 2) Subposet ids appearing in bounds are base space subposet ids
2290  // for section space schema classes and ordinary subposet ids for
2291  // all other classes.
2292  //
2293  // 3) All conversion of base space ids to schema ids is handled by
2294  // virtual functions in poset_state_handle, schema_poset_member,
2295  // and their descendants.
2296 
2303  virtual schema_poset_member*
2304  new_schema_handle(const std::string& xid_space_name,
2305  pod_index_type xschema_member_ext_id,
2306  pod_index_type xbase_space_ext_id,
2307  pod_index_type xfiber_schema_ext_id,
2308  pod_index_type xlocal_schema_ext_id);
2309 
2315  virtual index_iterator* get_decomposition(pod_index_type xindex) const;
2316 
2324  index_iterator* bound_iterator(const poset_bounds& xbnd_id, bool xis_ub) const;
2325 
2333  bool bound_contains_member(const poset_bounds& xbounds,
2334  bool xis_ub,
2335  const scoped_index& xindex) const;
2336 
2341  pod_index_type get_int_id(pod_index_type xext_id,
2342  const std::string& xid_space_name,
2343  bool xauto_access) const;
2344 
2349  virtual bool is_valid_int_id(pod_index_type xint_id,
2350  const std::string& xid_space_name,
2351  bool xauto_access) const;
2352 
2357  bool is_valid_int_id(const scoped_index& xint_id,
2358  const std::string& xid_space_name,
2359  bool xauto_access) const;
2360 
2365  virtual pod_index_type get_ext_id(pod_index_type xint_id,
2366  const std::string& xid_space_name,
2367  bool xauto_access) const;
2368 
2373  pod_index_type get_ext_id(const scoped_index& xint_id,
2374  const std::string& xid_space_name,
2375  bool xauto_access) const;
2376 
2380  virtual pod_index_type prereq_id(int xi) const;
2381 
2382 protected:
2383 
2384 private:
2385 
2387 
2388 
2389  // ===========================================================
2391  // ===========================================================
2393 
2394 public:
2395 
2399  void to_stream(std::ostream& xos = std::cout);
2400 
2404  std::string to_string();
2405 
2406 protected:
2407 
2408 private:
2409 
2411 
2412 
2413  // ===========================================================
2415  // ===========================================================
2417 
2418 public:
2419 
2423  virtual bool is_ancestor_of(const any* other) const;
2424 
2429  virtual poset_state_handle* clone() const;
2430 
2434  virtual bool invariant() const;
2435 
2436 protected:
2437 
2438 private:
2439 
2441 };
2442 
2443 
2444 // ===========================================================
2445 // NON-MEMBER FUNCTIONS
2446 // ===========================================================
2447 
2448 
2449 
2450 } // namespace sheaf
2451 
2452 #endif // POSET_STATE_HANDLE_H
2453 
2454 
SHEAF_DLL_SPEC void lower(const met &xmetric, const ed &xvector, ed &xresult, bool xauto_access)
Lower vector (pre-allocated version for persistent type).
Definition: met.cc:943
A client handle for a subposet.
Definition: subposet.h:86
The data structure representing the cover relation graph of a poset.
The private state of a partially ordered set.
Definition: poset_state.h:49
An abstract iterator over the ids of an id space.
A wrapper/adapter for the table dof tuple record. Intended for transferring data between the kernel a...
poset_state_handle(const poset_state_handle &xother)
Copy constructor; disabled.
The default name space; a poset which contains other posets as members.
A factory for creating poset handles.
poset_type
Identifiers for poset types.
Definition: poset_type.h:41
A handle for a hidden read_write_monitor state.
A client handle for a general, abstract partially order set.
A wrapper/adapter for the subposet names record. Intended for transferring subposet name data between...
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
void put_standard_row_dof_tuple_ct(int xct)
Sets the number of standard row dof tuples automatically allocated by the constructor.
A partial multi-valued relation with total injective inverse between names and indices of type index_...
Definition: name_multimap.h:63
abstract_poset_member * _top
Top member of poset.
An abstract handle to a space of alternate integer identifiers (aliases) for a subset of a hub set of...
A (lower, upper) bounds pair for a poset. Specifies a portion of a poset for a bounded i/o operation...
Definition: poset_bounds.h:50
Features shared by poset_member and subposet. Subposet and poset_member objects can be attached...
namespace_poset * _name_space
The namespace this poset resides in.
The general, abstract map from dof ids to dof values.
Definition: poset_dof_map.h:59
An implementation of class sum_index_space_handle that has a primary sum id space state...
abstract_poset_member * _bottom
Bottom members of poset.
The poset containing the primitive type definitions.
Abstract base class with useful features for all objects.
Definition: any.h:39
A record_set containing records of type member_record.
A record buffer for transferring member data between the kernel and the i/o subsystem.
Definition: member_record.h:54
The general depth-first iterator over the intersection of a poset member anchor&#39;s whole with its down...
A factory for instanting descendants of an abstract type T, given the class name of the descendant...
Definition: eval_family.h:49
poset_crg_state::member_name_map_type member_name_map_type
The type of the member name map.
A map from schema poset member ids to dof values for primitives_poset members.
An index within the external ("client") scope of a given id space.
Definition: scoped_index.h:116
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.
subposet _resident
The subposet of members with resident dof tuples.
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
Definition: sheaf.h:52
void put_standard_member_ct(int xct)
Sets the number of standard members automatically allocated by the constructor.
scoped_index _index
The member index of this poset in the namespace.
A record_set which contains dof tuple records. Supports both record selection and record restriction ...
Iterates over the subset of Zn defined by the characteristic function host().
poset_state * _state
State object for this poset.
poset_crg_state & crg() const
The cover relation graph.
T::table_dofs_type & table_dofs(T &x0)
The table dofs pod type for x0 (mutable version).
int_type pod_index_type
The plain old data index type.
Definition: pod_types.h:49
SHEAF_DLL_SPEC std::ostream & operator<<(std::ostream &os, const dof_descriptor_array &p)
Insert dof_descriptor_array& p into ostream& os.
Namespace for the sheaves component of the sheaf system.
A poset specific collection of data converters, various buffers and other data used while transferrin...
poset_state_handle & operator=(const poset_state_handle &xother)
Assignment operator; disabled.
schema_poset_member schema_type
The type of schema member for this class.
An abstract client handle for a member of a poset.
Factory and container for a family of id spaces.
An array representation of abstract class poset_dof_map.
Computes the join of given poset members.
Definition: poset_joiner.h:43
The set of subsets of a poset.
Traverser to compute intersection of the down set (up set) of the anchor with a given subposet...
Definition: poset_slicer.h:45
A client handle for a poset member which has been prepared for use as a schema.
The data structure representing the table containing the dof tuples of the members of a poset...
Agent responsible for importing and exporting posets from an external name space which resides on dis...
Definition: storage_agent.h:74