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