Grok 20.3.2
GrkObjectWrapper.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2016-2026 Grok Image Compression Inc.
3 *
4 * This source code is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Affero General Public License, version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This source code is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Affero General Public License for more details.
12 *
13 * You should have received a copy of the GNU Affero General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 */
17
18#pragma once
19
20#include <cassert>
21#include <cstdint>
22
23#include "grok.h"
24#include "RefCounted.h"
25
26namespace grk
27{
28
29template<typename T>
31{
32public:
33 explicit GrkObjectWrapperImpl(T* wrap) : wrappee(wrap) {}
34 T* getWrappee(void)
35 {
36 assert(wrappee);
37 return wrappee;
38 }
39
40protected:
41 virtual ~GrkObjectWrapperImpl(void) override
42 {
43 delete wrappee;
44 wrappee = nullptr;
45 }
46
47private:
49};
50
51} // namespace grk
GrkObjectWrapperImpl(T *wrap)
Definition GrkObjectWrapper.h:33
T * getWrappee(void)
Definition GrkObjectWrapper.h:34
virtual ~GrkObjectWrapperImpl(void) override
Definition GrkObjectWrapper.h:41
T * wrappee
Definition GrkObjectWrapper.h:48
RefCounted()
Definition RefCounted.h:70
ResWindow.
Definition CompressedChunkCache.h:36