ResourceProvider.hpp
Go to the documentation of this file.
1 #pragma once
2 
4 #include <typeindex>
5 #include <unordered_map>
6 #include <functional>
7 
8 namespace iv
9 {
10 
11 class ResourcesRoot;
12 class ResourceManagementSystem;
13 class Instance;
14 class ResourcePath;
15 
21 {
22 public:
24 
25  ResourceProvider( Instance * inst, size_t priority );
27  Instance * instance() const;
28 
35  virtual bool has_path( ResourcePath const & path, std::type_index type ) = 0;
36 
41  virtual std::pair< void *, Instance * > create_resource( ResourcePath const & path, std::type_index type, ResourcesRoot * parent ) = 0;
42 
45  virtual void each_resource( std::type_index type, std::function< void( ResourcePath const & ) > const & ) = 0;
46 
49  virtual void each_type( std::function< void( std::type_index type ) > const & ) = 0;
50 
51 protected:
56  void unregister_provider();
57 
58 private:
59  Instance * inst;
61 };
62 
63 }
64