]> git.tdb.fi Git - libs/gl.git/blob - source/resource.h
Foundation for a resource management system
[libs/gl.git] / source / resource.h
1 #ifndef MSP_GL_RESOURCE_H_
2 #define MSP_GL_RESOURCE_H_
3
4 #include <msp/io/seekable.h>
5
6 namespace Msp {
7 namespace GL {
8
9 class ResourceManager;
10
11 class Resource
12 {
13 public:
14         class AsyncLoader
15         {
16         protected:
17                 AsyncLoader() { }
18         public:
19                 virtual ~AsyncLoader() { }
20
21                 virtual bool needs_sync() const = 0;
22                 virtual bool process() = 0;
23         };
24
25 protected:
26         ResourceManager *manager;
27
28         Resource();
29 public:
30         virtual ~Resource();
31
32         void set_manager(ResourceManager *);
33         virtual AsyncLoader *load(IO::Seekable &) = 0;
34         virtual void unload() = 0;
35 };
36
37 } // namespace GL
38 } // namespace Msp
39
40 #endif