#include <ResourceProvider.hpp>

Public Member Functions

 ResourceProvider (Instance *inst, size_t priority)
 
 ~ResourceProvider ()
 
Instanceinstance () const
 
virtual bool has_path (ResourcePath const &path, std::type_index type)=0
 
virtual std::pair< void *, Instance * > create_resource (ResourcePath const &path, std::type_index type, ResourcesRoot *parent)=0
 
virtual void each_resource (std::type_index type, std::function< void(ResourcePath const &) > const &)=0
 
virtual void each_type (std::function< void(std::type_index type) > const &)=0
 

Public Attributes

ClientMarker cm
 

Protected Member Functions

void unregister_provider ()
 

Detailed Description

Should be able to register self either for all types or for just some specific types. Higher priority providers go first.

Definition at line 20 of file ResourceProvider.hpp.

Constructor & Destructor Documentation

◆ ResourceProvider()

iv::ResourceProvider::ResourceProvider ( Instance inst,
size_t  priority 
)

Definition at line 7 of file ResourceProvider.cpp.

◆ ~ResourceProvider()

iv::ResourceProvider::~ResourceProvider ( )

Definition at line 16 of file ResourceProvider.cpp.

Member Function Documentation

◆ instance()

Instance * iv::ResourceProvider::instance ( ) const

Definition at line 21 of file ResourceProvider.cpp.

◆ has_path()

virtual bool iv::ResourceProvider::has_path ( ResourcePath const &  path,
std::type_index  type 
)
pure virtual

First check for ability to create instance. If this returns true, instance creation might still fail (parsing error) but no other provider will try to instantiate it. Only resource provider with highest priority that returns true here will try to instantiate it. This ResourceProvider must not be removed from ResourceManagementSystem during this method call.

Implemented in iv::VirtualResourceProvider.

◆ create_resource()

virtual std::pair< void *, Instance * > iv::ResourceProvider::create_resource ( ResourcePath const &  path,
std::type_index  type,
ResourcesRoot parent 
)
pure virtual

Is not called if create_instance_async was called on the same path and type before. Should return void pointer to instance of type indentified by argument 'type' and its associated Instance that owns it (for memory management).

Implemented in iv::VirtualResourceProvider.

◆ each_resource()

virtual void iv::ResourceProvider::each_resource ( std::type_index  type,
std::function< void(ResourcePath const &) > const &   
)
pure virtual

Implemented in iv::VirtualResourceProvider.

◆ each_type()

virtual void iv::ResourceProvider::each_type ( std::function< void(std::type_index type) > const &  )
pure virtual

Implemented in iv::VirtualResourceProvider.

◆ unregister_provider()

void iv::ResourceProvider::unregister_provider ( )
protected

Call this to unregister from ResourceManagementSystem prematurely. This does not have to be called, it will eventualy be called from ResourceProvider::~ResourceProvider.

Definition at line 26 of file ResourceProvider.cpp.

Member Data Documentation

◆ cm

ClientMarker iv::ResourceProvider::cm

Definition at line 23 of file ResourceProvider.hpp.


The documentation for this class was generated from the following files: