activemq-cpp-3.9.5
Deque.h
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef _DECAF_UTIL_DEQUE_H_
19#define _DECAF_UTIL_DEQUE_H_
20
25#include <decaf/util/Config.h>
26#include <decaf/util/Queue.h>
27
28namespace decaf {
29namespace util {
30
41 template<typename E>
42 class Deque : public Queue<E> {
43 public:
44
45 virtual ~Deque() {}
46
62 virtual void addFirst(const E& element) = 0;
63
79 virtual void addLast(const E& element) = 0;
80
96 virtual bool offerFirst(const E& element) = 0;
97
113 virtual bool offerLast(const E& element) = 0;
114
123 virtual E removeFirst() = 0;
124
133 virtual E removeLast() = 0;
134
143 virtual bool pollFirst(E& element) = 0;
144
153 virtual bool pollLast(E& element) = 0;
154
163 virtual E& getFirst() = 0;
164 virtual const E& getFirst() const = 0;
165
174 virtual E& getLast() = 0;
175 virtual const E& getLast() const = 0;
176
185 virtual bool peekFirst(E& value) const = 0;
186
195 virtual bool peekLast(E& value) const = 0;
196
209 virtual bool removeFirstOccurrence(const E& value) = 0;
210
223 virtual bool removeLastOccurrence(const E& value) = 0;
224
242 virtual void push(const E& element) = 0;
243
255 virtual E pop() = 0;
256
263 virtual Iterator<E>* descendingIterator() const = 0;
264
265 };
266
267}}
268
269#endif /* _DECAF_UTIL_DEQUE_H_ */
Defines a 'Double ended Queue' interface that allows for insertion and removal of elements from both ...
Definition Deque.h:42
virtual const E & getFirst() const =0
virtual void addLast(const E &element)=0
Inserts an element onto the end of the Deque if possible without violating the implementations capaci...
virtual E removeFirst()=0
Removes the topmost element from the Deque and returns it.
virtual void push(const E &element)=0
Pushes an element onto the stack represented by this deque (in other words, at the head of this deque...
virtual E & getLast()=0
Attempts to fetch a reference to the last element in the Deque.
virtual bool pollFirst(E &element)=0
Removes the first element from the Deque assigns it to the element reference passed.
virtual bool offerFirst(const E &element)=0
This method attempts to insert the given element into the Deque at the front end.
virtual Iterator< E > * descendingIterator()=0
Provides an Iterator over this Collection that traverses the element in reverse order.
virtual E & getFirst()=0
Attempts to fetch a reference to the first element in the Deque.
virtual bool peekLast(E &value) const =0
Retrieves the last element contained in this Deque and assigns its value to the reference value passe...
virtual bool peekFirst(E &value) const =0
Retrieves the first element contained in this Deque and assigns its value to the reference value pass...
virtual void addFirst(const E &element)=0
Inserts an element onto the front of the Deque if possible without violating the implementations capa...
virtual bool removeLastOccurrence(const E &value)=0
Removes the last occurrence of the specified element from this Deque.
virtual bool offerLast(const E &element)=0
This method attempts to insert the given element into the Deque at the end.
virtual bool pollLast(E &element)=0
Removes the last element from the Deque assigns it to the element reference passed.
virtual bool removeFirstOccurrence(const E &value)=0
Removes the first occurrence of the specified element from this Deque.
virtual ~Deque()
Definition Deque.h:45
virtual Iterator< E > * descendingIterator() const =0
virtual E removeLast()=0
Removes the last element from the Deque and returns it.
virtual const E & getLast() const =0
virtual E pop()=0
Treats this Deque as a stack and attempts to pop an element off the top.
Defines an object that can be used to iterate over the elements of a collection.
Definition Iterator.h:34
A kind of collection provides advanced operations than other basic collections, such as insertion,...
Definition Queue.h:55
virtual E element() const =0
Gets but not removes the element in the head of the queue.
Definition AbstractCollection.h:33
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
Definition AprPool.h:25