SheafSystem  0.0.0.0
block_relation.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 block_relation
19 
20 #include "SheafSystem/assert_contract.h"
21 #include "SheafSystem/block_relation.h"
22 
23 using namespace fiber_bundle; // Workaround for MS C++ bug.
24 
25 // ===========================================================
26 // BLOCK_RELATION FACET
27 // ===========================================================
28 
32 {
33  // Nothing to do.
34 }
35 
39 {
40  // Nothing to do.
41 }
42 
43 
44 // ===========================================================
45 // ANY FACET
46 // ===========================================================
47 
49 bool
51 invariant() const
52 {
53  bool result = true;
54 
55  // Preconditions:
56 
57  // Body:
58 
59  if(invariant_check())
60  {
61  // Prevent recursive calls to invariant
62 
63  disable_invariant_check();
64 
65  invariance(any::invariant());
66 
67  // Finished, turn invariant checking back on.
68 
69  enable_invariant_check();
70  }
71 
72  // Postconditions:
73 
74  // Exit
75 
76  return result;
77 }
78 
80 bool
82 is_ancestor_of(const any* other) const
83 {
84 
85  // Preconditions:
86 
87  require(other != 0);
88 
89  // Body:
90 
91  // True if other conforms to this
92 
93  bool result = dynamic_cast<const block_relation*>(other) != 0;
94 
95  // Postconditions:
96 
97  return result;
98 }
99 
100 
101 
virtual bool invariant() const
Class invariant, intended to be redefined in each descendant. See below for template for invariant in...
Definition: any.cc:153
block_relation()
Default constructor.
virtual bool invariant() const
Class invariant.
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.
virtual ~block_relation()
Destructor.
Abstract cell relation for a block of zones of a given type.
Namespace for the fiber_bundles component of the sheaf system.