activemq-cpp-3.3.0

src/main/decaf/util/Deque.h

Go to the documentation of this file.
00001 /*
00002  * Licensed to the Apache Software Foundation (ASF) under one or more
00003  * contributor license agreements.  See the NOTICE file distributed with
00004  * this work for additional information regarding copyright ownership.
00005  * The ASF licenses this file to You under the Apache License, Version 2.0
00006  * (the "License"); you may not use this file except in compliance with
00007  * the License.  You may obtain a copy of the License at
00008  *
00009  *     http://www.apache.org/licenses/LICENSE-2.0
00010  *
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 
00018 #ifndef _DECAF_UTIL_DEQUE_H_
00019 #define _DECAF_UTIL_DEQUE_H_
00020 
00021 #include <decaf/util/NoSuchElementException.h>
00022 #include <decaf/lang/exceptions/NullPointerException.h>
00023 #include <decaf/lang/exceptions/IllegalArgumentException.h>
00024 #include <decaf/lang/exceptions/IllegalStateException.h>
00025 #include <decaf/util/Config.h>
00026 #include <decaf/util/Queue.h>
00027 
00028 namespace decaf {
00029 namespace util {
00030 
00041     template<typename E>
00042     class Deque : public Queue<E> {
00043     public:
00044 
00045         virtual ~Deque() {}
00046 
00062         virtual void addFirst( const E& element ) = 0;
00063 
00079         virtual void addLast( const E& element ) = 0;
00080 
00096         virtual bool offerFirst( const E& element ) = 0;
00097 
00113         virtual bool offerLast( const E& element ) = 0;
00114 
00123         virtual E removeFirst() = 0;
00124 
00133         virtual E removeLast() = 0;
00134 
00143         virtual bool pollFirst( E& element ) = 0;
00144 
00153         virtual bool pollLast( E& element ) = 0;
00154 
00163         virtual E& getFirst() = 0;
00164         virtual const E& getFirst() const = 0;
00165 
00174         virtual E& getLast() = 0;
00175         virtual const E& getLast() const = 0;
00176 
00185         virtual bool peekFirst( E& value ) const = 0;
00186 
00195         virtual bool peekLast( E& value ) const = 0;
00196 
00209         virtual bool removeFirstOccurrence( const E& value ) = 0;
00210 
00223         virtual bool removeLastOccurrence( const E& value ) = 0;
00224 
00242         virtual void push( const E& element ) = 0;
00243 
00255         virtual E pop() = 0;
00256 
00262         virtual Iterator<E>* descendingIterator() = 0;
00263         virtual Iterator<E>* descendingIterator() const = 0;
00264 
00265     };
00266 
00267 }}
00268 
00269 #endif /* _DECAF_UTIL_DEQUE_H_ */