DNA Calib 1.1
Project brief
CommandImplBase.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "dnacalib/TypeDefs.h"
7
8namespace dnac {
9
10template<class TCommand>
12 protected:
13 explicit CommandImplBase(MemoryResource* memRes_) : memRes{memRes_} {
14 }
15
16 public:
17 static TCommand* create(MemoryResource* memRes) {
19 return alloc.newObject(memRes);
20 }
21
22 static void destroy(TCommand* instance) {
23 PolyAllocator<TCommand> alloc{instance->getMemoryResource()};
24 alloc.deleteObject(instance);
25 }
26
28 return memRes;
29 }
30
31 private:
33
34};
35
36} // namespace dnac
Definition: CommandImplBase.h:11
MemoryResource * getMemoryResource()
Definition: CommandImplBase.h:27
static void destroy(TCommand *instance)
Definition: CommandImplBase.h:22
CommandImplBase(MemoryResource *memRes_)
Definition: CommandImplBase.h:13
MemoryResource * memRes
Definition: CommandImplBase.h:32
static TCommand * create(MemoryResource *memRes)
Definition: CommandImplBase.h:17
MemoryResource is an abstract class that allows the implementation of polymorphic allocators.
Definition: MemoryResource.h:17
Definition: PolyAllocator.h:129
Definition: Command.h:8