librostlab-blast
1.0.0
|
00001 00002 /* A Bison parser, made by GNU Bison 2.4.1. */ 00003 00004 /* Stack handling for Bison parsers in C++ 00005 00006 Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software 00007 Foundation, Inc. 00008 00009 This program is free software: you can redistribute it and/or modify 00010 it under the terms of the GNU General Public License as published by 00011 the Free Software Foundation, either version 3 of the License, or 00012 (at your option) any later version. 00013 00014 This program is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 GNU General Public License for more details. 00018 00019 You should have received a copy of the GNU General Public License 00020 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 00021 00022 /* As a special exception, you may create a larger work that contains 00023 part or all of the Bison parser skeleton and distribute that work 00024 under terms of your choice, so long as that work isn't itself a 00025 parser generator using the skeleton or a modified version thereof 00026 as a parser skeleton. Alternatively, if you modify or redistribute 00027 the parser skeleton itself, you may (at your option) remove this 00028 special exception, which will cause the skeleton and the resulting 00029 Bison output files to be licensed under the GNU General Public 00030 License without this special exception. 00031 00032 This special exception was added by the Free Software Foundation in 00033 version 2.2 of Bison. */ 00034 00035 #ifndef BISON_ROSTLAB_BLAST_PARSER_STACK_H 00036 # define BISON_ROSTLAB_BLAST_PARSER_STACK_H 00037 00038 #include <deque> 00039 00040 00041 /* Line 1067 of lalr1.cc */ 00042 #line 22 "blast-parser-parser.ypp" 00043 namespace rostlab { namespace blast { 00044 00045 /* Line 1067 of lalr1.cc */ 00046 #line 47 "rostlab/blast-parser-stack.h" 00047 template <class T, class S = std::deque<T> > 00048 class stack 00049 { 00050 public: 00051 00052 // Hide our reversed order. 00053 typedef typename S::reverse_iterator iterator; 00054 typedef typename S::const_reverse_iterator const_iterator; 00055 00056 stack () : seq_ () 00057 { 00058 } 00059 00060 stack (unsigned int n) : seq_ (n) 00061 { 00062 } 00063 00064 inline 00065 T& 00066 operator [] (unsigned int i) 00067 { 00068 return seq_[i]; 00069 } 00070 00071 inline 00072 const T& 00073 operator [] (unsigned int i) const 00074 { 00075 return seq_[i]; 00076 } 00077 00078 inline 00079 void 00080 push (const T& t) 00081 { 00082 seq_.push_front (t); 00083 } 00084 00085 inline 00086 void 00087 pop (unsigned int n = 1) 00088 { 00089 for (; n; --n) 00090 seq_.pop_front (); 00091 } 00092 00093 inline 00094 unsigned int 00095 height () const 00096 { 00097 return seq_.size (); 00098 } 00099 00100 inline const_iterator begin () const { return seq_.rbegin (); } 00101 inline const_iterator end () const { return seq_.rend (); } 00102 00103 private: 00104 00105 S seq_; 00106 }; 00107 00109 template <class T, class S = stack<T> > 00110 class slice 00111 { 00112 public: 00113 00114 slice (const S& stack, 00115 unsigned int range) : stack_ (stack), 00116 range_ (range) 00117 { 00118 } 00119 00120 inline 00121 const T& 00122 operator [] (unsigned int i) const 00123 { 00124 return stack_[range_ - i]; 00125 } 00126 00127 private: 00128 00129 const S& stack_; 00130 unsigned int range_; 00131 }; 00132 00133 /* Line 1153 of lalr1.cc */ 00134 #line 22 "blast-parser-parser.ypp" 00135 } } // rostlab::blast 00136 00137 /* Line 1153 of lalr1.cc */ 00138 #line 139 "rostlab/blast-parser-stack.h" 00139 00140 #endif // not BISON_ROSTLAB_BLAST_PARSER_STACK_H[]dnl 00141