SheafSystem  0.0.0.0
poset_component.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_COMPONENT_H
22 #define POSET_COMPONENT_H
23 
24 #ifndef SHEAF_DLL_SPEC_H
25 #include "SheafSystem/sheaf_dll_spec.h"
26 #endif
27 
28 #ifndef POSET_STATE_H
29 #include "SheafSystem/poset_state.h"
30 #endif
31 
32 #ifndef READ_WRITE_MONITOR_HANDLE_H
33 #include "SheafSystem/read_write_monitor_handle.h"
34 #endif
35 
36 #ifndef SCOPED_INDEX_H
37 #include "SheafSystem/scoped_index.h"
38 #endif
39 
40 #ifndef STANDARD_VERSION_INDEX_H
41 #include "SheafSystem/standard_version_index.h"
42 #endif
43 
44 #ifndef STD_STRING_H
45 #include "SheafSystem/std_string.h"
46 #endif
47 
48 namespace sheaf
49 {
50 
51  class namespace_poset;
52  class poset;
53  class poset_crg_state;
54  class poset_dof_map;
55  class poset_path;
56  class poset_powerset_state;
57  class poset_state;
58  class poset_state_handle;
59  class subposet_state;
60 
74 class SHEAF_DLL_SPEC poset_component : public read_write_monitor_handle
75 {
76 
77  // ===========================================================
79  // ===========================================================
81 
82 public:
83 
87  virtual ~poset_component();
88 
89 protected:
90 
95 
99  poset_state* state_obj() const;
100 
104  poset_powerset_state* powerset() const;
105 
109  poset_crg_state* crg() const;
110 
114  virtual subposet_state* powerset_member(const scoped_index& xindex) const;
115 
119  poset_dof_map* row_dof_tuple(const scoped_index& xindex) const;
120 
126  virtual void init_handle_data_members();
127 
133  virtual void attach_handle_data_members();
134 
139 
144 
149  int _version;
150 
151 private:
152 
154 
155 
156  // ===========================================================
158  // ===========================================================
160 
161 public:
162 
166  const scoped_index& index() const;
167 
172  virtual bool is_valid_index(const poset_state_handle* xhost,
173  pod_index_type xhub_id,
174  int xversion = CURRENT_HOST_VERSION) const = 0;
175 
180  bool is_valid_index(const poset_state_handle* xhost,
181  const scoped_index& xid,
182  int xversion = CURRENT_HOST_VERSION) const;
183 
187  virtual const hub_index_space_handle& hub_id_space() const = 0;
188 
193  virtual const scoped_index& hub_id() const = 0;
194 
198  virtual scoped_index hub_id(pod_index_type xid) const = 0;
199 
203  virtual pod_index_type get_index_from_name(const poset_state_handle* xhost,
204  const std::string& xname) const = 0;
205 
209  virtual void get_index_from_name(const poset_state_handle* xhost,
210  const std::string& xname,
211  scoped_index& result) const = 0;
212 
218  int version(bool xunalias = true) const;
219 
224  virtual void put_version(int xversion, bool xunalias = false);
225 
230  int unaliased_version(int xversion) const;
231 
235  pod_index_type version_index() const;
236 
240  void version_index(scoped_index& result) const;
241 
245  std::string version_name() const;
246 
250  bool has_version(int xversion) const;
251 
252 protected:
253 
254 private:
255 
257 
258 
259  // ===========================================================
261  // ===========================================================
263 
264 public:
265 
270  std::string name() const;
271 
275  virtual std::string name(bool xauto_access) const = 0;
276 
280  virtual void all_names(block<std::string>& xresult, bool xauto_access = false) const = 0;
281 
285  virtual size_type name_ct(bool xauto_access) const = 0;
286 
290  virtual bool has_name(const std::string& xname, bool xauto_access = false) const = 0;
291 
295  virtual void put_name(const std::string& xname, bool xunique, bool xauto_access) = 0;
296 
300  virtual void delete_name(const std::string& xname, bool xauto_access = false) = 0;
301 
305  virtual void delete_all_names(bool xauto_access = false) = 0;
306 
311  bool is_valid_name(const poset_state_handle* xhost, const std::string& xname) const;
312 
316  poset_path path(bool xauto_access = true) const;
317 
321  bool has_path(const poset_path& xpath, bool xauto_access) const;
322 
323 protected:
324 
325 private:
326 
328 
329 
330  // ===========================================================
332  // ===========================================================
334 
335 public:
336 
340  poset_state_handle* host() const;
341 
345  virtual bool host_is_ancestor_of(const poset_state_handle* xther) const;
346 
351  bool has_same_host(const poset_component* xother) const;
352 
356  inline bool in_same_space(const poset_component* xother) const
357  {
358  return has_same_host(xother);
359  };
360 
361 protected:
362 
363 private:
364 
366 
367 
368  // ===========================================================
370  // ===========================================================
372 
373 public:
374 
378  virtual namespace_poset* name_space() const;
379 
383  virtual bool namespace_is_ancestor_of(const namespace_poset* xother) const;
384 
389  bool same_namespace(const poset_component* xother) const;
390 
395  bool same_namespace(const poset_state_handle* xother) const;
396 
397 protected:
398 
399 private:
400 
402 
403 
404  // ===========================================================
406  // ===========================================================
408 
409 public:
410 
415  void attach_to_state(const poset_state_handle* xhost, pod_index_type xhub_id);
416 
421  void attach_to_state(const poset_state_handle* xhost, const scoped_index& xid);
422 
427  void attach_to_state(const poset_state_handle* xhost, const std::string& xname);
428 
429  // Not included in generated documentation; would just be confusing.
430  inline void attach_to_state(const namespace_poset* xhost, const std::string& xname)
431  {
432  // This routine needed to resolve ambiguity between the preceeding
433  // routine and attach_to_state(namespace_poset*, const poset_path&),
434  // when called with signature (namespace_poset*, const std::string&).
435  // Compiler can't choose between conversion of namespace_poset* to
436  // poset_state_handle* versus conversion of const std::string& to const poset_path&.
437 
438  attach_to_state(reinterpret_cast<const poset_state_handle*>(xhost), xname);
439  };
440 
445  void attach_to_state(const std::string&);
446 
451  void attach_to_state(pod_index_type xhub_id);
452 
457  void attach_to_state(const scoped_index& xid);
458 
462  void attach_to_state(const poset_component* xother);
463 
467  void attach_to_state(const poset_component* xother, bool xauto_access);
468 
472  virtual void detach_from_state();
473 
477  virtual void delete_state(bool xauto_access = false) = 0;
478 
482  virtual bool is_attached() const;
483 
487  bool is_same_state(const poset_state_handle* xhost,
488  pod_index_type xhub_id) const;
489 
493  bool is_same_state(const poset_state_handle* xhost,
494  const scoped_index& xid) const;
495 
500  bool is_same_state(const poset_component* xother) const;
501 
502 protected:
503 
504 private:
505 
507 
508 
509  // ===========================================================
511  // ===========================================================
513 
514 public:
515 
519  virtual void get_read_access() const;
520 
527  virtual void get_read_write_access(bool xrelease_read_only_access = false);
528 
533  virtual void release_access(bool xall = false) const;
534 
535 protected:
536 
537 private:
538 
540 
541 
542  // ===========================================================
544  // ===========================================================
546 
547 public:
548 
552  virtual bool is_ancestor_of(const any* other) const;
553 
557  virtual poset_component* clone() const = 0;
558 
562  virtual bool invariant() const;
563 
564 protected:
565 
566 private:
567 
569 };
570 
571 // ===========================================================
572 // NON-MEMBER FUNCTIONS
573 // ===========================================================
574 
578 
579 SHEAF_DLL_SPEC size_t deep_size(const poset_component& xp, bool xinclude_shallow = true);
580 
581  } // namespace sheaf
582 
583 #endif // ifndef POSET_COMPONENT_H
584 
The data structure representing the cover relation graph of a poset.
The private state of a partially ordered set.
Definition: poset_state.h:49
The default name space; a poset which contains other posets as members.
poset_state_handle * _host
The host poset for this component.
The data structure representing the state of a subposet.
A handle for a hidden read_write_monitor state.
A client handle for a general, abstract partially order set.
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
Features shared by poset_member and subposet. Subposet and poset_member objects can be attached...
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 base class with useful features for all objects.
Definition: any.h:39
scoped_index _index
The index for this component within the host.
bool in_same_space(const poset_component *xother) const
Synonym for has_same_host(xother)
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.
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
Definition: sheaf.h:52
int _version
The version of this component. The version of the host used when evaluating properties of this compon...
int_type pod_index_type
The plain old data index type.
Definition: pod_types.h:49
Namespace for the sheaves component of the sheaf system.
The set of subsets of a poset.