[videodb] remove unused seasons table from episode_view
[xbmc.git] / xbmc / cores / VideoPlayer / DVDResource.h
blob56a1e758cfebaf80d152e47522e2aabf2f81dab1
1 /*
2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #pragma once
11 #include <assert.h>
12 #include <atomic>
14 template<typename T> struct IDVDResourceCounted
16 IDVDResourceCounted() : m_refs(1) {}
17 virtual ~IDVDResourceCounted() = default;
19 IDVDResourceCounted(const IDVDResourceCounted &) = delete;
20 IDVDResourceCounted &operator=(const IDVDResourceCounted &) = delete;
22 virtual T* Acquire()
24 ++m_refs;
25 return static_cast<T*>(this);
28 virtual long Release()
30 long count = --m_refs;
31 assert(count >= 0);
32 if (count == 0)
33 delete static_cast<T*>(this);
34 return count;
36 std::atomic<long> m_refs;