activemq-cpp-3.6.0
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_ */