Fixes for C++98
[junction.git] / junction / extra / impl / MapAdapter_Crude.h
1 /*------------------------------------------------------------------------
2   Junction: Concurrent data structures in C++
3   Copyright (c) 2016 Jeff Preshing
4
5   Distributed under the Simplified BSD License.
6   Original location: https://github.com/preshing/junction
7
8   This software is distributed WITHOUT ANY WARRANTY; without even the
9   implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10   See the LICENSE file for more information.
11 ------------------------------------------------------------------------*/
12
13 #ifndef JUNCTION_EXTRA_IMPL_MAPADAPTER_CRUDE_H
14 #define JUNCTION_EXTRA_IMPL_MAPADAPTER_CRUDE_H
15
16 #include <junction/Core.h>
17 #include <junction/ConcurrentMap_Crude.h>
18 #include <turf/Util.h>
19
20 namespace junction {
21 namespace extra {
22
23 class MapAdapter {
24 public:
25     static TURF_CONSTEXPR const char* getMapName() { return "Junction Crude map"; }
26
27     MapAdapter(ureg) {
28     }
29
30     class ThreadContext {
31     public:
32         ThreadContext(MapAdapter&, ureg) {
33         }
34
35         void registerThread() {
36         }
37
38         void unregisterThread() {
39         }
40
41         void update() {
42         }
43     };
44
45     typedef ConcurrentMap_Crude<u32, void*> Map;
46
47     static ureg getInitialCapacity(ureg maxPopulation) {
48         return turf::util::roundUpPowerOf2(ureg(maxPopulation * 1.25f));
49     }
50 };
51
52 } // namespace extra
53 } // namespace junction
54
55 #endif // JUNCTION_EXTRA_IMPL_MAPADAPTER_CRUDE_H