The Sparta Modeling Framework
Loading...
Searching...
No Matches
SpartaSharedPointerBaseAllocator.hpp
1#pragma once
2
3namespace sparta
4{
5
6#ifndef DO_NOT_DOCUMENT
8 // Internals to support cross object allocation (derivative types)
9 // using Allocators. In a nutshell, if one SSP
10 // (SpartaSharedPointer) of the base type is being reclaimed via
11 // an allocator, we want to steer that deallocation to the correct
12 // deallocator.
13 template <class PointerT>
14 class SpartaSharedPointer;
15
18 class BaseAllocator {
19 public:
20 virtual ~BaseAllocator() {}
21
22 struct MemBlockBase {
23 MemBlockBase(BaseAllocator * alloc_in) : alloc(alloc_in) {}
24 virtual ~MemBlockBase() {}
25 BaseAllocator * const alloc = nullptr;
26 };
27
28 template<class PointerT>
29 friend class SpartaSharedPointer;
30
31 protected:
32 // Release an object; release the block
33 virtual void releaseObject_(void * block) const noexcept = 0;
34 virtual void releaseBlock_(void * block) = 0;
35 };
36#endif
37
38}
Macros for handling exponential backoff.