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