source: nrEngine/include/ResourceSystem.h @ 1

Revision 1, 3.2 KB checked in by art, 13 years ago (diff)
Line 
1/***************************************************************************
2 *                                                                         *
3 *   (c) Art Tevs, MPI Informatik Saarbruecken                             *
4 *       mailto: <tevs@mpi-sb.mpg.de>                                      *
5 *                                                                         *
6 *   This program is free software; you can redistribute it and/or modify  *
7 *   it under the terms of the GNU General Public License as published by  *
8 *   the Free Software Foundation; either version 2 of the License, or     *
9 *   (at your option) any later version.                                   *
10 *                                                                         *
11 ***************************************************************************/
12#ifndef _NR__RESOURCES_SYSTEM_H
13#define _NR__RESOURCES_SYSTEM_H
14
15/*!
16 * \defgroup resource Resource managment
17 *
18 * <b>nrEngine</b> has support for resource managment. Each resource can be
19 * loaded or unloaded at the runtime. There is a class for generic support
20 * of resource managment system ResourceManager. This class provides generic
21 * functions used for resource reservation/allocation/release. We also provides
22 * a possibility to unload the resource at runtime but not to delete it from
23 * the memory completly. So the application can still access to it and will
24 * get only empty resource back.
25 *
26 * Each resource class has to be derived from IResource and provide
27 * their own functions for returning an empty resource. ResourcePtr is a
28 * class representing smart pointer to any resource. This pointers can be
29 * used as normal pointers and will give you transparent access to empty
30 * item if this resource is not present in the memory.
31 *
32 * So with the help of
33 * such subsystem you do not have to check each time you want to use the
34 * data if it still exists in the memory. This happens transparent to you and
35 * will stay efficient.
36 *
37 * <img src="../dias/Resources.png">
38 **/
39
40 
41
42//----------------------------------------------------------------------------------
43// Includes
44//----------------------------------------------------------------------------------
45#include "Prerequisities.h"
46#include "Priority.h"
47#include "Property.h"
48
49//----------------------------------------------------------------------------------
50// Types
51//----------------------------------------------------------------------------------
52namespace nrEngine{
53               
54        //! Smart pointer pointing to a loader
55        typedef SharedPtr<IResourceLoader> ResourceLoader;
56       
57        //! This handle will store something like resource id.
58        typedef uint32                                  ResourceHandle;
59
60        //! Cast a resource loader of basis type to any derived type
61        template<class T>
62        SharedPtr<T> ResourceLoaderCast (ResourceLoader loader)
63        {
64                return boost::dynamic_pointer_cast<T, IResourceLoader>(loader);
65        }
66};
67
68
69//----------------------------------------------------------------------------------
70// Includes for teh system
71//----------------------------------------------------------------------------------
72#include "ResourceManager.h"
73#include "Resource.h"
74#include "ResourceHolder.h"
75#include "ResourceLoader.h"
76#include "ResourcePtr.h"
77
78
79#endif
Note: See TracBrowser for help on using the repository browser.