| 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 SEARCHABLESTACK_H |
| 21 | #define SEARCHABLESTACK_Hcxx . . $ `Kernel/SearchableStack.h:21:9`! |
| 22 | |
| 23 | // template class for stack with opportunity of search duplicate elements |
| 24 | #include <vector> |
| 25 | |
| 26 | template <typename T> |
| 27 | class SearchableStackcxx . . $ SearchableStack# |
| 28 | { |
| 29 | protected: |
| 30 | std::vectorcxx . . $ std/vector#<T> Basecxx . . $ SearchableStack#Base.; |
| 31 | |
| 32 | public: |
| 33 | // from vector.h |
| 34 | typedef T value_typecxx . . $ SearchableStack#value_type#; |
| 35 | typedef typename std::vectorcxx . . $ std/vector#<T>::pointer pointercxx . . $ SearchableStack#pointer#; |
| 36 | typedef typename std::vectorcxx . . $ std/vector#<T>::const_pointer const_pointercxx . . $ SearchableStack#const_pointer#; |
| 37 | typedef typename std::vectorcxx . . $ std/vector#<T>::iterator iteratorcxx . . $ SearchableStack#iterator#; |
| 38 | typedef typename std::vectorcxx . . $ std/vector#<T>::const_iterator const_iteratorcxx . . $ SearchableStack#const_iterator#; |
| 39 | typedef typename std::vectorcxx . . $ std/vector#<T>::reference referencecxx . . $ SearchableStack#reference#; |
| 40 | typedef typename std::vectorcxx . . $ std/vector#<T>::const_reference const_referencecxx . . $ SearchableStack#const_reference#; |
| 41 | |
| 42 | public: |
| 43 | |
| 44 | /*********** constructors **************/ |
| 45 | SearchableStackcxx . . $ SearchableStack#`SearchableStack<T>`(49f6e7a06ebc5aa8). ( void ) {} |
| 46 | SearchableStackcxx . . $ SearchableStack#`SearchableStack<T>`(95217bd989ffdc64). ( const SearchableStackcxx . . $ SearchableStack#<T>& v ) : Basecxx . . $ SearchableStack#Base. (v.Basecxx . . $ SearchableStack#Base.) {} |
| 47 | |
| 48 | SearchableStack& operatorcxx . . $ SearchableStack#`operator=`(cc31164e86a1ff3f). = ( const SearchableStackcxx . . $ SearchableStack#<T>& v ) |
| 49 | { |
| 50 | Basecxx . . $ SearchableStack#Base. = v.Basecxx . . $ SearchableStack#Base.; |
| 51 | return *this; |
| 52 | } |
| 53 | |
| 54 | /*********** iterators **************/ |
| 55 | iteratorcxx . . $ SearchableStack#iterator# begincxx . . $ SearchableStack#begin(80289270cbe5e6a0).() { return Basecxx . . $ SearchableStack#Base..begincxx . . $ std/vector#begin(33b10a496a38335b).(); } |
| 56 | const_iteratorcxx . . $ SearchableStack#const_iterator# begincxx . . $ SearchableStack#begin(7fbc76ecd1fff2b4).() const { return Basecxx . . $ SearchableStack#Base..begincxx . . $ std/vector#begin(33b10a496a38335b).(); } |
| 57 | iteratorcxx . . $ SearchableStack#iterator# endcxx . . $ SearchableStack#end(80289270cbe5e6a0).() { return Basecxx . . $ SearchableStack#Base..endcxx . . $ std/vector#end(33b10a496a38335b).(); } |
| 58 | const_iteratorcxx . . $ SearchableStack#const_iterator# endcxx . . $ SearchableStack#end(7fbc76ecd1fff2b4).() const { return Basecxx . . $ SearchableStack#Base..endcxx . . $ std/vector#end(33b10a496a38335b).(); } |
| 59 | |
| 60 | /*********** stack operations **************/ |
| 61 | void pushcxx . . $ SearchableStack#push(77d9f17553126ecb). ( const T& val ) { Basecxx . . $ SearchableStack#Base..push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(val); } |
| 62 | referencecxx . . $ SearchableStack#reference# topcxx . . $ SearchableStack#top(ce3ba953f324383c). ( void ) { return Basecxx . . $ SearchableStack#Base..backcxx . . $ std/vector#back(feee51535944b307).(); } |
| 63 | const_referencecxx . . $ SearchableStack#const_reference# topcxx . . $ SearchableStack#top(535908e0c00a99ac). ( void ) const { return Basecxx . . $ SearchableStack#Base..backcxx . . $ std/vector#back(feee51535944b307).(); } |
| 64 | void popcxx . . $ SearchableStack#pop(49f6e7a06ebc5aa8). ( void ) { Basecxx . . $ SearchableStack#Base..pop_backcxx . . $ std/vector#pop_back(49f6e7a06ebc5aa8).(); } |
| 65 | /* iterator find ( const T& val ) const |
| 66 | { |
| 67 | for ( iterator p = begin(); p != end(); ++p ) |
| 68 | if ( *p == val ) |
| 69 | return p; |
| 70 | |
| 71 | return end(); |
| 72 | }*/ |
| 73 | const_iteratorcxx . . $ SearchableStack#const_iterator# findcxx . . $ SearchableStack#find(4a01aaccc588630f). ( const T& val ) const |
| 74 | { |
| 75 | for ( const_iteratorcxx . . $ SearchableStack#const_iterator# p = begincxx . . $ SearchableStack#begin(80289270cbe5e6a0).(); p != endcxx . . $ SearchableStack#end(80289270cbe5e6a0).(); ++p ) |
| 76 | if ( *p == val ) |
| 77 | return p; |
| 78 | |
| 79 | return endcxx . . $ SearchableStack#end(80289270cbe5e6a0).(); |
| 80 | } |
| 81 | bool containscxx . . $ SearchableStack#contains(8877ebe272b9620d). ( const T& val ) const { return ( findcxx . . $ SearchableStack#find(4a01aaccc588630f).(val) != endcxx . . $ SearchableStack#end(80289270cbe5e6a0).() ); } |
| 82 | bool emptycxx . . $ SearchableStack#empty(50ce9a9e25b4a850). ( void ) const { return Basecxx . . $ SearchableStack#Base..emptycxx . . $ std/vector#empty(50ce9a9e25b4a850). (); } |
| 83 | }; // SearchableStack |
| 84 | |
| 85 | #endif |