shared_gc_data.h
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2015 The ClanLib Team
4 **
5 ** This software is provided 'as-is', without any express or implied
6 ** warranty. In no event will the authors be held liable for any damages
7 ** arising from the use of this software.
8 **
9 ** Permission is granted to anyone to use this software for any purpose,
10 ** including commercial applications, and to alter it and redistribute it
11 ** freely, subject to the following restrictions:
12 **
13 ** 1. The origin of this software must not be misrepresented; you must not
14 ** claim that you wrote the original software. If you use this software
15 ** in a product, an acknowledgment in the product documentation would be
16 ** appreciated but is not required.
17 ** 2. Altered source versions must be plainly marked as such, and must not be
18 ** misrepresented as being the original software.
19 ** 3. This notice may not be removed or altered from any source distribution.
20 **
21 ** Note: Some of the libraries ClanLib may link to may have additional
22 ** requirements or restrictions.
23 **
24 ** File Author(s):
25 **
26 ** Magnus Norddahl
27 ** Harry Storbacka
28 ** Mark Page
29 */
30 
31 
32 #pragma once
33 
34 #include <vector>
35 #include <memory>
36 #include <mutex>
37 
38 namespace clan
39 {
42 
43 class GraphicContext;
44 class GraphicContextProvider;
45 class DisposableObject;
46 class SharedGCData_Impl;
47 
50 {
51 public:
52 
54  static void add_ref();
55 
57  static void release_ref();
58 
60  static void add_provider(GraphicContextProvider *provider);
61 
63  static void remove_provider(GraphicContextProvider *provider);
64 
70  static GraphicContextProvider *get_provider(std::unique_ptr<std::unique_lock<std::recursive_mutex>> &mutex_section);
71 
77  static std::vector<GraphicContextProvider*> &get_gc_providers(std::unique_ptr<std::unique_lock<std::recursive_mutex>> &mutex_section);
78 
82  static void add_disposable(DisposableObject *disposable);
83 
87  static void remove_disposable(DisposableObject *disposable);
88 
89 private:
90  SharedGCData();
91  ~SharedGCData();
92 
93  std::shared_ptr<SharedGCData_Impl> impl;
94 };
95 
96 }
97 
99 
Shared Graphic Context Data.
Definition: shared_gc_data.h:50
static void remove_disposable(DisposableObject *disposable)
Remove disposable.
static void add_disposable(DisposableObject *disposable)
Add disposable.
static std::vector< GraphicContextProvider * > & get_gc_providers(std::unique_ptr< std::unique_lock< std::recursive_mutex >> &mutex_section)
Get the providers.
static void add_provider(GraphicContextProvider *provider)
Add a provider.
DisposableObject.
Definition: disposable_object.h:37
static void release_ref()
Release ref.
Definition: clanapp.h:36
static GraphicContextProvider * get_provider(std::unique_ptr< std::unique_lock< std::recursive_mutex >> &mutex_section)
Get a provider.
Interface for implementing a GraphicContext target.
Definition: graphic_context_provider.h:87
static void remove_provider(GraphicContextProvider *provider)
Remove a provider.
static void add_ref()
Add ref.