Skip to content

Commit 792e711

Browse files
committed
fdsdump: abstract away allocator choice
1 parent 7cca7cf commit 792e711

File tree

3 files changed

+37
-4
lines changed

3 files changed

+37
-4
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* @file
3+
* @author Michal Sedlak <[email protected]>
4+
* @brief Select allocator implementation
5+
*/
6+
7+
#pragma once
8+
9+
#ifndef FDSDUMP_USE_STD_ALLOCATOR
10+
11+
#include <aggregator/arenaAllocator.hpp>
12+
13+
namespace fdsdump {
14+
namespace aggregator {
15+
16+
using Allocator = ArenaAllocator;
17+
18+
} // aggregator
19+
} // fdsdump
20+
21+
#else
22+
23+
#include <aggregator/stdAllocator.hpp>
24+
25+
namespace fdsdump {
26+
namespace aggregator {
27+
28+
using Allocator = StdAllocator;
29+
30+
} // aggregator
31+
} // fdsdump
32+
33+
#endif

src/tools/fdsdump/src/aggregator/fastHashTable.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
#ifdef __SSE2__
99

10-
#include <aggregator/arenaAllocator.hpp>
10+
#include <aggregator/allocator.hpp>
1111

1212
#include <cstdint>
1313
#include <vector>
@@ -75,7 +75,7 @@ class FastHashTable {
7575
std::vector<HashTableBlock> m_blocks;
7676
std::vector<uint8_t *> m_items;
7777

78-
ArenaAllocator m_allocator;
78+
Allocator m_allocator;
7979

8080
bool
8181
lookup(uint8_t *key, uint8_t *&item, bool create_if_not_found);

src/tools/fdsdump/src/aggregator/stdHashTable.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
#pragma once
77

8-
#include "stdAllocator.hpp"
8+
#include "allocator.hpp"
99

1010
#include <cstdint>
1111
#include <functional>
@@ -66,7 +66,7 @@ class StdHashTable {
6666
std::size_t m_key_size;
6767
std::size_t m_value_size;
6868
std::vector<uint8_t *> m_items;
69-
StdAllocator m_allocator;
69+
Allocator m_allocator;
7070
Map m_map;
7171
};
7272

0 commit comments

Comments
 (0)