activemq-cpp-3.8.2
Map.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_MAP_H_
19 #define _DECAF_UTIL_MAP_H_
20 
21 #include <functional>
22 #include <vector>
26 #include <decaf/util/Set.h>
27 #include <decaf/util/Collection.h>
28 #include <decaf/util/MapEntry.h>
29 
30 namespace decaf{
31 namespace util{
32 
87  template <typename K, typename V>
89  public:
90 
94  Map() : concurrent::Synchronizable() {}
95 
96  virtual ~Map() {}
97 
109  virtual bool equals(const Map& source) const = 0;
110 
119  virtual void copy(const Map& source) = 0;
120 
127  virtual void clear() = 0;
128 
139  virtual bool containsKey(const K& key) const = 0;
140 
152  virtual bool containsValue(const V& value) const = 0;
153 
157  virtual bool isEmpty() const = 0;
158 
162  virtual int size() const = 0;
163 
176  virtual V& get(const K& key) = 0;
177 
190  virtual const V& get(const K& key) const = 0;
191 
210  virtual bool put(const K& key, const V& value) = 0;
211 
237  virtual bool put(const K& key, const V& value, V& oldValue) = 0;
238 
252  virtual void putAll(const Map<K, V>& other) = 0;
253 
267  virtual V remove(const K& key) = 0;
268 
281  virtual Set< MapEntry<K,V> >& entrySet() = 0;
282  virtual const Set< MapEntry<K,V> >& entrySet() const = 0;
283 
295  virtual Set<K>& keySet() = 0;
296  virtual const Set<K>& keySet() const = 0;
297 
310  virtual Collection<V>& values() = 0;
311  virtual const Collection<V>& values() const = 0;
312 
313  };
314 
315 }}
316 
317 #endif /*_DECAF_UTIL_MAP_H_*/
A collection that contains no duplicate elements.
Definition: Set.h:45
virtual bool containsValue(const V &value) const =0
Returns true if this map maps one or more keys to the specified value.
Map()
Default constructor - does nothing.
Definition: Map.h:94
virtual void clear()=0
Removes all of the mappings from this map (optional operation).
virtual bool containsKey(const K &key) const =0
Returns true if this map contains a mapping for the specified key.
virtual Collection< V > & values()=0
Returns a Collection view of the values contained in this map.
virtual bool equals(const Map &source) const =0
Compares the specified object with this map for equality.
virtual void copy(const Map &source)=0
Copies the content of the source map into this map.
virtual ~Map()
Definition: Map.h:96
virtual int size() const =0
virtual bool put(const K &key, const V &value)=0
Associates the specified value with the specified key in this map (optional operation).
An object that maps keys to values.
Definition: Map.h:88
virtual void putAll(const Map< K, V > &other)=0
Copies all of the mappings from the specified map to this map (optional operation).
virtual bool isEmpty() const =0
virtual Set< K > & keySet()=0
Returns a Set view of the keys contained in this map.
The interface for all synchronizable objects (that is, objects that can be locked and unlocked)...
Definition: Synchronizable.h:37
virtual Set< MapEntry< K, V > > & entrySet()=0
Returns a Set view of the mappings contained in this map.
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements...
Definition: AprPool.h:25