| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
#if !defined( INCLUDED_IREFERENCE_H ) |
| 23 |
#define INCLUDED_IREFERENCE_H |
| 24 |
|
| 25 |
#include "generic/constant.h" |
| 26 |
|
| 27 |
namespace scene |
| 28 |
{ |
| 29 |
class Node; |
| 30 |
} |
| 31 |
|
| 32 |
class ModuleObserver; |
| 33 |
|
| 34 |
class Resource |
| 35 |
{ |
| 36 |
public: |
| 37 |
virtual bool load() = 0; |
| 38 |
virtual bool save() = 0; |
| 39 |
virtual void flush() = 0; |
| 40 |
virtual void refresh() = 0; |
| 41 |
virtual scene::Node* getNode() = 0; |
| 42 |
virtual void setNode( scene::Node* node ) = 0; |
| 43 |
virtual void attach( ModuleObserver& observer ) = 0; |
| 44 |
virtual void detach( ModuleObserver& observer ) = 0; |
| 45 |
virtual void realise() = 0; |
| 46 |
virtual void unrealise() = 0; |
| 47 |
}; |
| 48 |
|
| 49 |
class EntityCreator; |
| 50 |
|
| 51 |
class ReferenceCache |
| 52 |
{ |
| 53 |
public: |
| 54 |
INTEGER_CONSTANT( Version, 1 ); |
| 55 |
STRING_CONSTANT( Name, "reference" ); |
| 56 |
|
| 57 |
virtual Resource* capture( const char* path ) = 0; |
| 58 |
virtual void release( const char* path ) = 0; |
| 59 |
|
| 60 |
virtual void setEntityCreator( EntityCreator& entityCreator ) = 0; |
| 61 |
}; |
| 62 |
|
| 63 |
#include "modulesystem.h" |
| 64 |
|
| 65 |
template<typename Type> |
| 66 |
class GlobalModule; |
| 67 |
typedef GlobalModule<ReferenceCache> GlobalReferenceModule; |
| 68 |
|
| 69 |
template<typename Type> |
| 70 |
class GlobalModuleRef; |
| 71 |
typedef GlobalModuleRef<ReferenceCache> GlobalReferenceModuleRef; |
| 72 |
|
| 73 |
inline ReferenceCache& GlobalReferenceCache(){ |
| 74 |
return GlobalReferenceModule::getTable(); |
| 75 |
} |
| 76 |
|
| 77 |
#endif |