SheafSystem  0.0.0.0
geometry_namespace.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 geometry_namespace
19 
20 #include "SheafSystem/geometry_namespace.h"
21 
22 #include "SheafSystem/assert_contract.h"
23 #include "SheafSystem/at0.h"
24 #include "SheafSystem/base_space_member.h"
25 #include "SheafSystem/error_message.h"
26 #include "SheafSystem/e1.h"
27 #include "SheafSystem/e2.h"
28 #include "SheafSystem/e3.h"
29 #include "SheafSystem/poset_path.h"
30 #include "SheafSystem/sec_rep_descriptor.h"
31 #include "SheafSystem/sec_rep_descriptor_poset.h"
32 #include "SheafSystem/std_iostream.h"
33 #include "SheafSystem/wsv_block.h"
34 
35 //#define DIAGNOSTIC_OUTPUT
36 
37 using namespace std;
38 using namespace geometry; // Workaround for MSVC++ bug.
39 
40 // =============================================================================
41 // GEOMETRY_NAMESPACE FACET
42 // =============================================================================
43 
44 // PUBLIC MEMBER FUNCTIONS
45 
46 
48 geometry_namespace(const std::string& xname)
49 {
50  // Preconditions:
51 
52  require(precondition_of(new_state(xname)));
53 
54  // Body:
55 
56  // Create the state.
57 
58  new_state(xname);
59 
60  // Postconditions:
61 
62  ensure(postcondition_of(new_state(xname)));
63 
64  // Exit:
65 
66  return;
67 }
68 
69 // PROTECTED MEMBER FUNCTIONS
70 
73 {
74 
75  // Preconditions:
76 
77 
78  // Body:
79 
80  // Nothing to do.
81 
82  // Postconditions:
83 
84  ensure(!is_attached());
85 
86  // Exit:
87 
88  return;
89 }
90 
93 {
94  // Preconditions:
95 
96  // Body:
97 
98  // Nothing to do.
99 
100  // Postconditions:
101 
102  // Exit:
103 
104  return;
105 }
106 
107 
108 // =============================================================================
109 // ANY FACET
110 // =============================================================================
111 
113 bool
115 is_ancestor_of(const any *other) const
116 {
117 
118  // Preconditions:
119 
120  require(other != 0);
121 
122  // Body:
123 
124  // True if other conforms to this
125 
126  bool result = dynamic_cast<const geometry_namespace*>(other) != 0;
127 
128  // Postconditions:
129 
130  return result;
131 }
132 
136 clone() const
137 {
138  geometry_namespace* result;
139 
140  // Preconditions:
141 
142  // Body:
143 
144  result = new geometry_namespace();
145 
146  // Postconditions:
147 
148  ensure(result != 0);
149  ensure(is_same_type(result));
150 
151  // Exit:
152 
153  return result;
154 }
155 
156 
161 {
162 
163  // Preconditions:
164 
165 
166  // Body:
167 
168  not_implemented();
169 
170  // Postconditions:
171 
172  ensure(invariant());
173 
174  // Exit
175 
176  return *this;
177 }
178 
180 bool
182 invariant() const
183 {
184  bool result = true;
185 
186  if(invariant_check())
187  {
188  // Prevent recursive calls to invariant
189 
190  disable_invariant_check();
191 
192  // Must satisfy base class invariant
193 
194  invariance(fiber_bundles_namespace::invariant());
195 
196  // Invariances for this class:
197 
198  // Finished, turn invariant checking back on.
199 
200  enable_invariant_check();
201  }
202 
203  // Exit
204 
205  return result;
206 }
207 
208 
209 // =============================================================================
210 // NON-MEMBER FUNCTIONS
211 // =============================================================================
212 
Namespace for GEOMETRY component.
geometry_namespace & operator=(const geometry_namespace &xother)
Assignment operator.
virtual geometry_namespace * clone() const
Virtual constructor, makes a new instance of the same type as this.
virtual bool invariant() const
Class invariant.
STL namespace.
geometry_namespace()
Default constructor; creates an unattached handle.
virtual ~geometry_namespace()
Destructor.
Abstract base class with useful features for all objects.
Definition: any.h:39
virtual bool is_ancestor_of(const any *other) const
Conformance test; true if other conforms to this.
Namespace for geometry component of sheaf system.
Definition: field_vd.h:54