shared_gc_data.h

Go to the documentation of this file.
00001 /*
00002 **  ClanLib SDK
00003 **  Copyright (c) 1997-2011 The ClanLib Team
00004 **
00005 **  This software is provided 'as-is', without any express or implied
00006 **  warranty.  In no event will the authors be held liable for any damages
00007 **  arising from the use of this software.
00008 **
00009 **  Permission is granted to anyone to use this software for any purpose,
00010 **  including commercial applications, and to alter it and redistribute it
00011 **  freely, subject to the following restrictions:
00012 **
00013 **  1. The origin of this software must not be misrepresented; you must not
00014 **     claim that you wrote the original software. If you use this software
00015 **     in a product, an acknowledgment in the product documentation would be
00016 **     appreciated but is not required.
00017 **  2. Altered source versions must be plainly marked as such, and must not be
00018 **     misrepresented as being the original software.
00019 **  3. This notice may not be removed or altered from any source distribution.
00020 **
00021 **  Note: Some of the libraries ClanLib may link to may have additional
00022 **  requirements or restrictions.
00023 **
00024 **  File Author(s):
00025 **
00026 **    Magnus Norddahl
00027 **    Harry Storbacka
00028 **    Mark Page
00029 */
00030 
00033 
00034 #pragma once
00035 
00036 #include "../api_display.h"
00037 #include "../../Core/IOData/virtual_directory.h"
00038 #include "../../Core/Signals/signal_v0.h"
00039 #include "texture.h"
00040 #include "../Image/image_import_description.h"
00041 #include <vector>
00042 #include <map>
00043 
00044 class CL_GraphicContext;
00045 class CL_DisposableObject;
00046 class CL_SharedGCData_Impl;
00047 
00051 class CL_SharedGCData
00052 {
00053 public:
00054 
00056         static void add_ref();
00057 
00059         static void release_ref();
00060 
00064         static CL_SharedGCData *get_instance();
00065 
00066         static std::vector<CL_GraphicContextProvider*> &get_gc_providers();
00067 
00069         static void dispose_objects();
00070 
00074         static void add_disposable(CL_DisposableObject *disposable);
00075 
00079         static void remove_disposable(CL_DisposableObject *disposable);
00080 
00084         static CL_Signal_v0 &func_gc_destruction_imminent();
00085 
00093         static CL_Texture load_texture(CL_GraphicContext &gc, const CL_String &filename, const CL_VirtualDirectory &virtual_directory = CL_VirtualDirectory(), const CL_ImageImportDescription &import_desc = CL_ImageImportDescription ());
00094 
00103         static bool add_texture(CL_Texture &texture, const CL_String &filename, const CL_VirtualDirectory &virtual_directory = CL_VirtualDirectory(), const CL_ImageImportDescription &import_desc = CL_ImageImportDescription());
00104 
00109         static void unload_texture(const CL_String &filename, const CL_VirtualDirectory &virtual_directory = CL_VirtualDirectory(), const CL_ImageImportDescription &import_desc = CL_ImageImportDescription ());
00110 
00112         static void unload_all_textures();
00113 
00114 private:
00115         CL_SharedGCData();
00116         ~CL_SharedGCData();
00117 
00118         CL_SharedPtr<CL_SharedGCData_Impl> impl;
00119 };
00120 
00122