Debian Codegraph @

Kernel/tSetAsTree.h

raw symbols SCIP
1 /* This file is part of the FaCT++ DL reasoner
2 Copyright (C) 2003-2015 Dmitry Tsarkov and The University of Manchester
3 Copyright (C) 2015-2017 Dmitry Tsarkov
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20 #ifndef TSETASTREE_H
21 #define TSETASTREE_Hcxx . . $ `Kernel/tSetAsTree.h:21:9`!
22
23 #include <set>
24
25 // implement model cache set as a tree-set
26 class TSetAsTreecxx . . $ TSetAsTree#
27 {
28 protected: // types
29 /// base type
30 typedef stdcxx . . $ std/::setcxx . . $ std/set#<unsigned int> BaseTypecxx . . $ TSetAsTree#BaseType#;
31
32 protected: // members
33 /// set implementation
34 BaseTypecxx . . $ TSetAsTree#BaseType# Basecxx . . $ TSetAsTree#Base.;
35 /// maximal number of elements
36 unsigned int nElemscxx . . $ TSetAsTree#nElems.;
37
38 public: // interface
39 /// empty c'tor taking max possible number of elements in the set
40 explicit TSetAsTreecxx . . $ TSetAsTree#TSetAsTree(cb2f890c2fdad230). ( unsigned int size ) : nElemscxx . . $ TSetAsTree#nElems.(size) {}
41 /// copy c'tor
42 TSetAsTreecxx . . $ TSetAsTree#TSetAsTree(5d667e7359765dc3). ( const TSetAsTreecxx . . $ TSetAsTree#& ) = default;
43 /// move c'tor
44 TSetAsTreecxx . . $ TSetAsTree#TSetAsTree(ce76ab71792e3522). ( TSetAsTreecxx . . $ TSetAsTree#&& ) = default;
45 /// assignment
46 TSetAsTreecxx . . $ TSetAsTree#& operatorcxx . . $ TSetAsTree#`operator=`(452ddc3fba9a18ae).= ( const TSetAsTreecxx . . $ TSetAsTree#& ) = default;
47 /// move assignment
48 TSetAsTreecxx . . $ TSetAsTree#& operatorcxx . . $ TSetAsTree#`operator=`(11993e628416f425).= ( TSetAsTreecxx . . $ TSetAsTree#&& ) = default;
49 /// empty d'tor
50 ~cxx . . $ TSetAsTree#`~TSetAsTree`(49f6e7a06ebc5aa8).TSetAsTreecxx . . $ TSetAsTree#() = default;
51
52 /// adds given index to the set
53 void insertcxx . . $ TSetAsTree#insert(cb2f890c2fdad230). ( unsigned int i )
54 {
55 # ifdef ENABLE_CHECKING
56 fpp_assert ( i > 0 );
57 # endif
58 Basecxx . . $ TSetAsTree#Base..insertcxx . . $ std/set#insert(411a10a755068dfe).(i);
59 }
60 /// completes the set with [1,n)
61 void completeSetcxx . . $ TSetAsTree#completeSet(49f6e7a06ebc5aa8). ( void )
62 {
63 for ( unsigned int i = 1; i < nElemscxx . . $ TSetAsTree#nElems.; ++i )
64 Basecxx . . $ TSetAsTree#Base..insertcxx . . $ std/set#insert(411a10a755068dfe).(i);
65 }
66 /// adds the given set to the current one
67 TSetAsTreecxx . . $ TSetAsTree#& operatorcxx . . $ TSetAsTree#`operator|=`(452ddc3fba9a18ae). |= ( const TSetAsTreecxx . . $ TSetAsTree#& is )
68 {
69 Basecxx . . $ TSetAsTree#Base..insertcxx . . $ std/set#insert(50ef72ff69bc573d). ( is.Basecxx . . $ TSetAsTree#Base..begincxx . . $ std/set#begin(a1617ab40ea76896).(), is.Basecxx . . $ TSetAsTree#Base..endcxx . . $ std/set#end(a1617ab40ea76896).() );
70 return *this;
71 }
72 /// clear the set
73 void clearcxx . . $ TSetAsTree#clear(49f6e7a06ebc5aa8). ( void ) { Basecxx . . $ TSetAsTree#Base..clearcxx . . $ std/set#clear(49f6e7a06ebc5aa8).(); }
74
75 /// check whether the set is empty
76 bool emptycxx . . $ TSetAsTree#empty(50ce9a9e25b4a850). ( void ) const { return Basecxx . . $ TSetAsTree#Base..emptycxx . . $ std/set#empty(50ce9a9e25b4a850).(); }
77 /// check whether I contains in the set
78 bool containscxx . . $ TSetAsTree#contains(8de63fdb265b07c1). ( unsigned int i ) const { return Basecxx . . $ TSetAsTree#Base..findcxx . . $ std/set#find(5d7b472851d10a0f).(i) !=cxx . . $ std/`operator!=`(7e1308a0738ea758). Basecxx . . $ TSetAsTree#Base..endcxx . . $ std/set#end(a1617ab40ea76896).(); }
79 /// check whether the intersection between the current set and IS is nonempty
80 bool intersectscxx . . $ TSetAsTree#intersects(ab1fdfb4b5c1098c). ( const TSetAsTreecxx . . $ TSetAsTree#& is ) const
81 {
82 if ( Basecxx . . $ TSetAsTree#Base..emptycxx . . $ std/set#empty(50ce9a9e25b4a850).() || is.Basecxx . . $ TSetAsTree#Base..emptycxx . . $ std/set#empty(50ce9a9e25b4a850).() )
83 return false;
84
85 BaseTypecxx . . $ TSetAsTree#BaseType#::const_iteratorcxx . . $ std/set#const_iterator# p1 = Basecxx . . $ TSetAsTree#Base..begincxx . . $ std/set#begin(a1617ab40ea76896).(), p1_end = Basecxx . . $ TSetAsTree#Base..endcxx . . $ std/set#end(a1617ab40ea76896).(), p2 = is.Basecxx . . $ TSetAsTree#Base..begincxx . . $ std/set#begin(a1617ab40ea76896).(), p2_end = is.Basecxx . . $ TSetAsTree#Base..endcxx . . $ std/set#end(a1617ab40ea76896).();
86 while ( p1 !=cxx . . $ std/`operator!=`(7e1308a0738ea758). p1_end && p2 !=cxx . . $ std/`operator!=`(7e1308a0738ea758). p2_end )
87 if ( *cxx . . $ std/_Rb_tree_const_iterator#`operator*`(ea465e50d690edfe).p1 == *cxx . . $ std/_Rb_tree_const_iterator#`operator*`(ea465e50d690edfe).p2 )
88 return true;
89 else if ( *cxx . . $ std/_Rb_tree_const_iterator#`operator*`(ea465e50d690edfe).p1 < *cxx . . $ std/_Rb_tree_const_iterator#`operator*`(ea465e50d690edfe).p2 )
90 ++cxx . . $ std/_Rb_tree_const_iterator#operator++(998dce1072ed46d4).p1;
91 else
92 ++cxx . . $ std/_Rb_tree_const_iterator#operator++(998dce1072ed46d4).p2;
93
94 return false;
95 }
96 /// prints the set in a human-readable form
97 void printcxx . . $ TSetAsTree#print(490063bd7e6d8d5d). ( stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& o ) const
98 {
99 o <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "{";
100 if ( !emptycxx . . $ TSetAsTree#empty(50ce9a9e25b4a850).() )
101 {
102 BaseTypecxx . . $ TSetAsTree#BaseType#::const_iteratorcxx . . $ std/set#const_iterator# p = Basecxx . . $ TSetAsTree#Base..begincxx . . $ std/set#begin(a1617ab40ea76896).(), p_end = Basecxx . . $ TSetAsTree#Base..endcxx . . $ std/set#end(a1617ab40ea76896).();
103 o <<cxx . . $ std/basic_ostream#`operator<<`(b4c055c363850233). *cxx . . $ std/_Rb_tree_const_iterator#`operator*`(ea465e50d690edfe).p;
104 while ( ++cxx . . $ std/_Rb_tree_const_iterator#operator++(998dce1072ed46d4).p !=cxx . . $ std/`operator!=`(7e1308a0738ea758). p_end )
105 o <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). ',' <<cxx . . $ std/basic_ostream#`operator<<`(b4c055c363850233). *cxx . . $ std/_Rb_tree_const_iterator#`operator*`(ea465e50d690edfe).p;
106 }
107 o <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "}";
108 }
109 typedef BaseTypecxx . . $ TSetAsTree#BaseType#::const_iteratorcxx . . $ std/set#const_iterator# const_iteratorcxx . . $ TSetAsTree#const_iterator#;
110 const_iteratorcxx . . $ TSetAsTree#const_iterator# begincxx . . $ TSetAsTree#begin(7a1e78672007b7bd). ( void ) const { return Basecxx . . $ TSetAsTree#Base..begincxx . . $ std/set#begin(a1617ab40ea76896).(); }
111 const_iteratorcxx . . $ TSetAsTree#const_iterator# endcxx . . $ TSetAsTree#end(7a1e78672007b7bd). ( void ) const { return Basecxx . . $ TSetAsTree#Base..endcxx . . $ std/set#end(a1617ab40ea76896).(); }
112
113 /// size of a set
114 size_tcxx . . $ size_t# sizecxx . . $ TSetAsTree#size(fe4d2d262d4164a8). ( void ) const { return Basecxx . . $ TSetAsTree#Base..sizecxx . . $ std/set#size(68cb71549629d77b).(); }
115 /// maximal size of a set
116 unsigned int maxSizecxx . . $ TSetAsTree#maxSize(ddd8539a2fcdd4ce). ( void ) const { return nElemscxx . . $ TSetAsTree#nElems.; }
117 }; // TSetAsTree
118
119 #endif