SheafSystem  0.0.0.0
sec_tuple.impl.h
Go to the documentation of this file.
1 // $RCSfile: class.h,v $ $Revision: 1.2 $ $Date: 2010/06/25 20:44:19 $
2 
3 // $Name: $
4 //
5 // Copyright (c) 2008 Limit Point Systems, Inc.
6 //
7 
10 
11 #ifndef SEC_TUPLE_IMPL_H
12 #define SEC_TUPLE_IMPL_H
13 
14 #ifndef SEC_TUPLE_H
15 #include "SheafSystem/sec_tuple.h"
16 #endif
17 
18 #ifndef NAMESPACE_POSET_H
19 #include "SheafSystem/namespace_poset.h"
20 #endif
21 
22 #ifndef BINARY_SECTION_SPACE_SCHEMA_MEMBER_H
23 #include "SheafSystem/binary_section_space_schema_member.h"
24 #endif
25 
26 #ifndef BINARY_SECTION_SPACE_SCHEMA_POSET_H
27 #include "SheafSystem/binary_section_space_schema_poset.h"
28 #endif
29 
30 using namespace fiber_bundle; // Workaround for MS C++ bug.
31 
32 template <typename S>
35 standard_host_path(const poset_path& xbase_path,
36  const poset_path& xrep_path,
37  const std::string& xsection_suffix,
38  const std::string& xfiber_suffix)
39 {
40  // Preconditions:
41 
42  require(xbase_path.full());
43  require(xrep_path.empty() || xrep_path.full());
44  require(xsection_suffix.empty() || poset_path::is_valid_name(xsection_suffix));
45  require(xfiber_suffix.empty() || poset_path::is_valid_name(xfiber_suffix));
46 
47  // Body:
48 
49  typedef typename S::fiber_type fiber_type;
50 
51  poset_path lstd_fiber_path(fiber_type::template standard_host_path<fiber_type>(xfiber_suffix));
52  poset_path lrep_path = !xrep_path.empty() ? xrep_path : S::standard_rep_path();
53 
54  std::string lposet_name(lstd_fiber_path.poset_name());
55  lposet_name += "_on_";
56  lposet_name += xbase_path.poset_name();
57  lposet_name += "_";
58  lposet_name += xbase_path.member_name();
59  lposet_name += "_";
60  lposet_name += lrep_path.member_name();
61  lposet_name += xsection_suffix;
62 
63  poset_path result(lposet_name, "");
64 
65  // Postconditions:
66 
67  ensure(!result.empty());
68  ensure(!result.full());
69 
70  // Exit:
71 
72  return result;
73 }
74 
75 template <typename S>
76 bool
79  const poset_path& xbase_path,
80  const poset_path& xrep_path,
81  const std::string& xsection_suffix,
82  const std::string& xfiber_suffix,
83  bool xauto_access)
84 {
85  // Preconditions:
86 
87  xns.state_is_auto_read_accessible(xauto_access);
88  require(xbase_path.full());
89  require(xrep_path.empty() || xrep_path.full());
90  require(xsection_suffix.empty() || poset_path::is_valid_name(xsection_suffix));
91  require(xfiber_suffix.empty() || poset_path::is_valid_name(xfiber_suffix));
92 
93  // Body:
94 
95  typedef typename S::host_type host_type;
96 
97  poset_path lstd_path(S::template standard_host_path<S>(xbase_path, xrep_path, xsection_suffix, xfiber_suffix));
98 
99  bool result = xns.path_is_available<host_type>(lstd_path, xauto_access);
100 
101  // Postconditions:
102 
103  // Exit:
104 
105  return result;
106 }
107 
108 
109 #endif // ifndef SEC_TUPLE_IMPL_H
static poset_path standard_host_path(const poset_path &xbase_path, const poset_path &xrep_path, const std::string &xsection_suffix, const std::string &xfiber_suffix)
The standard host path for section type S with base path xbase_path, representation path xrep_path...
bool full() const
True if both poset name and member name are not empty.
Definition: poset_path.cc:311
A Cartesian product section space.
The default name space; a poset which contains other posets as members.
bool state_is_auto_read_accessible(bool xauto_access) const
True if the state is auto accessible for read, that is, if the state is already accessible for read o...
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
static bool standard_host_is_available(const namespace_poset &xns, const poset_path &xbase_path, const poset_path &xrep_path, const std::string &xsection_suffix, const std::string &xfiber_suffix, bool xauto_access)
True if and only if the host with path standard_host_path<S>(xbase_path, xrep_path, xsection_suffix, xfiber_suffix) does not exist in namespace xns, or if it exists, conforms to S::host_type.
bool path_is_available(const poset_path &xpath, bool xauto_access) const
True if the state referred to xpath does not exist or exists and conforms to poset type P...
std::string poset_name() const
The poset name part of the path.
Definition: poset_path.cc:473
A member of a Cartesian product space; a tuple of attributes (persistent version).
Definition: tuple.h:191
bool empty() const
True if both poset name and member name are empty.
Definition: poset_path.cc:291
std::string member_name() const
The member name part of the path.
Definition: poset_path.cc:511
static bool is_valid_name(const std::string &xname)
True if xname is not empty and contains only name legal characters.
Definition: poset_path.cc:331
Namespace for the fiber_bundles component of the sheaf system.