activemq-cpp-3.9.5
AbstractMap.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_ABSTRACTMAP_H_
19#define _DECAF_UTIL_ABSTRACTMAP_H_
20
21#include <decaf/util/Config.h>
27#include <decaf/util/Iterator.h>
28#include <decaf/util/Map.h>
29#include <decaf/util/Set.h>
30#include <memory>
31
32namespace decaf {
33namespace util {
34
58 template< typename K, typename V>
59 class AbstractMap : public decaf::util::Map<K, V> {
60 protected:
61
63
64 public:
65
66 AbstractMap() : Map<K, V>(), mutex() {}
67
68 AbstractMap(const Map<K, V>& map DECAF_UNUSED) : Map<K, V>(), mutex() {}
69
70 AbstractMap(const AbstractMap<K, V>& map DECAF_UNUSED) : Map<K, V>(), mutex() {}
71
72 virtual ~AbstractMap() {}
73
74 public:
75
76 virtual void lock() {
77 mutex.lock();
78 }
79
80 virtual bool tryLock() {
81 return mutex.tryLock();
82 }
83
84 virtual void unlock() {
85 mutex.unlock();
86 }
87
88 virtual void wait() {
89 mutex.wait();
90 }
91
92 virtual void wait(long long millisecs) {
93 mutex.wait(millisecs);
94 }
95
96 virtual void wait(long long millisecs, int nanos) {
97 mutex.wait(millisecs, nanos);
98 }
99
100 virtual void notify() {
101 mutex.notify();
102 }
103
104 virtual void notifyAll() {
106 }
107
108 };
109
110}}
111
112#endif /* _DECAF_UTIL_ABSTRACTMAP_H_ */
This class provides a skeletal implementation of the Map interface, to minimize the effort required t...
Definition: AbstractMap.h:59
AbstractMap(const AbstractMap< K, V > &map DECAF_UNUSED)
Definition: AbstractMap.h:70
virtual void unlock()
Unlocks the object.
Definition: AbstractMap.h:84
virtual void lock()
Locks the object.
Definition: AbstractMap.h:76
virtual void notify()
Signals a waiter on this object that it can now wake up and continue.
Definition: AbstractMap.h:100
AbstractMap()
Definition: AbstractMap.h:66
virtual void wait(long long millisecs)
Waits on a signal from this object, which is generated by a call to Notify.
Definition: AbstractMap.h:92
virtual void notifyAll()
Signals the waiters on this object that it can now wake up and continue.
Definition: AbstractMap.h:104
virtual ~AbstractMap()
Definition: AbstractMap.h:72
virtual bool tryLock()
Attempts to Lock the object, if the lock is already held by another thread than this method returns f...
Definition: AbstractMap.h:80
AbstractMap(const Map< K, V > &map DECAF_UNUSED)
Definition: AbstractMap.h:68
virtual void wait()
Waits on a signal from this object, which is generated by a call to Notify.
Definition: AbstractMap.h:88
virtual void wait(long long millisecs, int nanos)
Waits on a signal from this object, which is generated by a call to Notify.
Definition: AbstractMap.h:96
util::concurrent::Mutex mutex
Definition: AbstractMap.h:62
An object that maps keys to values.
Definition: Map.h:88
Mutex object that offers recursive support on all platforms as well as providing the ability to use t...
Definition: Mutex.h:39
virtual void lock()
Locks the object.
virtual void notifyAll()
Signals the waiters on this object that it can now wake up and continue.
virtual bool tryLock()
Attempts to Lock the object, if the lock is already held by another thread than this method returns f...
virtual void unlock()
Unlocks the object.
virtual void wait()
Waits on a signal from this object, which is generated by a call to Notify.
virtual void notify()
Signals a waiter on this object that it can now wake up and continue.
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
Definition: AprPool.h:25