summaryrefslogtreecommitdiffstats
path: root/xbmc/utils/BufferObjectFactory.h
diff options
context:
space:
mode:
Diffstat (limited to 'xbmc/utils/BufferObjectFactory.h')
-rw-r--r--xbmc/utils/BufferObjectFactory.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/xbmc/utils/BufferObjectFactory.h b/xbmc/utils/BufferObjectFactory.h
new file mode 100644
index 0000000..a466e84
--- /dev/null
+++ b/xbmc/utils/BufferObjectFactory.h
@@ -0,0 +1,48 @@
1/*
2 * Copyright (C) 2005-2020 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
8
9#pragma once
10
11#include "BufferObject.h"
12
13#include <functional>
14#include <list>
15#include <memory>
16
17/**
18 * @brief Factory that provides CBufferObject registration and creation
19 *
20 */
21class CBufferObjectFactory
22{
23public:
24 /**
25 * @brief Create a CBufferObject from the registered BufferObject types.
26 * In the future this may include some criteria for selecting a specific
27 * CBufferObject derived type. Currently it returns the CBufferObject
28 * implementation that was registered last.
29 *
30 * @return std::unique_ptr<CBufferObject>
31 */
32 static std::unique_ptr<CBufferObject> CreateBufferObject(bool needsCreateBySize);
33
34 /**
35 * @brief Registers a CBufferObject class to class to the factory.
36 *
37 */
38 static void RegisterBufferObject(std::function<std::unique_ptr<CBufferObject>()>);
39
40 /**
41 * @brief Clears the list of registered CBufferObject types
42 *
43 */
44 static void ClearBufferObjects();
45
46protected:
47 static std::list<std::function<std::unique_ptr<CBufferObject>()>> m_bufferObjects;
48};