SheafSystem  0.0.0.0
int_set.h
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 // Interface for class int_set
19 
20 #ifndef INT_SET_H
21 #define INT_SET_H
22 
23 #ifndef SHEAF_DLL_SPEC_H
24 #include "SheafSystem/sheaf_dll_spec.h"
25 #endif
26 
27 #ifndef STD_SET_H
28 #include "SheafSystem/std_set.h"
29 #endif
30 
31 #ifndef STD_IOSTREAM_H
32 #include "SheafSystem/std_iostream.h"
33 #endif
34 
35 #ifndef STD_ITERATOR_H
36 #include "SheafSystem/std_iterator.h"
37 #endif
38 
39 namespace sheaf
40 {
41 
42 class subposet;
43 
47 class SHEAF_DLL_SPEC int_set : public std::set<int>
48  {
49 
50 public:
51 
55  int_set();
56 
60  int_set(const int_set& other);
61 
65  int_set(const int* xmbrs, int xct);
66 
70  ~int_set();
71 
75  inline void insert_member(int xmbr)
76  {
77  (void) insert(xmbr);
78  } ;
79 
83  inline void remove_member(int xmbr)
84  {
85  (void) erase(xmbr);
86  } ;
87 
91  void insert_members(const int* xmbrs, int xct);
92 
96  void insert_members(const subposet* xmbrs);
97 
98 
99 
104  inline bool contains(int xindex) const
105  {
106  return (find(xindex) != end());
107  };
108 
109 
110 
115  inline bool contains_member(int xindex) const
116  {
117  return (find(xindex) != end());
118  };
119 
123  bool is_singleton() const;
124 
131  bool set_includes(const int_set* other, bool this_is_much_larger = false) const;
132 
136  int_set* set_union(const int_set* other) const;
137 
141  void set_union_pa(const int_set* other, int_set* result) const;
142 
146  void set_union_sa(const int_set* other);
147 
151  int_set* set_intersection(const int_set* other) const;
152 
156  void set_intersection_pa(const int_set* other, int_set* result) const;
157 
161  void set_intersection_sa(const int_set* other);
162 
169  int_set* set_difference(const int_set* other) const;
170 
177  void set_difference_pa(const int_set* other, int_set* result) const;
178 
185  void set_difference_sa(int_set* other, bool this_is_much_larger = false);
186 
190  void print() const;
191  };
192 
193 
194 // NON-MEMBER FUNCTIONS
195 
196 
197 
198 
202 SHEAF_DLL_SPEC
203 std::ostream& operator << (std::ostream& os, const int_set& c);
204 
205 } // namespace sheaf
206 
207 #endif // ifndef INT_SET_H
208 
209 
An STL set representation for a set of integers.
Definition: int_set.h:47
bool contains(int xindex) const
True if this set contains xindex Deprecated - use contains_member(int xindex)
Definition: int_set.h:104
A client handle for a subposet.
Definition: subposet.h:86
bool contains_member(int xindex) const
True if this set contains xindex True if this set contains xindex.
Definition: int_set.h:115
void remove_member(int xmbr)
Remove member with index xmbr; just for consistency with subposet.
Definition: int_set.h:83
SHEAF_DLL_SPEC std::ostream & operator<<(std::ostream &os, const dof_descriptor_array &p)
Insert dof_descriptor_array& p into ostream& os.
void insert_member(int xmbr)
Insert member with index xmbr; just for consistency with subposet.
Definition: int_set.h:75
Namespace for the sheaves component of the sheaf system.