STAMINA/STORM 0.1
Infinite state-space truncator which generates a probability within a window
StateMemoryPool.h
1#ifndef STATEMEMORYPOOL_H
2#define STATEMEMORYPOOL_H
3
4// #include <deque>
5// #include <ordered_set>
6#include <cstdint>
7#include <vector>
8
29namespace stamina {
30 namespace util {
31 template <typename T>
33 public:
39 StateMemoryPool(uint8_t blockSize = 13); // 2 ^ 12
47 T * allocate(uint32_t number = 1);
51 void freeAll();
52 // Methods that will be implemented when defragmentation is added
53 // void free(T * address); // knows the number used
54 // void defrag();
55 private:
56 const uint32_t blockSize;
57 uint32_t usedThisBlock;
58 std::vector<T *> blocks;
59 // Will be used when defragmentation is implemented
60 // std::deque<std::pair<T*, uint32_t>> deletedBlocks; // Blocks which have been deleted
61 // std::ordered_set<std::pair<T*, uint32_t>> nonSingleBlocks; // Blocks of arrays
62 };
63 }
64}
65
66#endif // STATEMEMORYPOOL_H
Definition: StateMemoryPool.h:32
T * allocate(uint32_t number=1)
Definition: StateMemoryPool.cpp:39
StateMemoryPool(uint8_t blockSize=13)
Definition: StateMemoryPool.cpp:14
~StateMemoryPool()
Definition: StateMemoryPool.cpp:23
void freeAll()
Definition: StateMemoryPool.cpp:31
Definition: ExplicitTruncatedModelBuilder.cpp:40