![]() |
Rosetta Utilities
2014.16.56682
|
Instantiates ResourceLoaders. Creators may be registered with the Factory at any point, though it is recommended they be registered at load time. If two Creators are registered and they both give the same name for the ResourceLoader they say they will instantiate, then the Factory will exit with an error message. More...
#include <ResourceLoaderFactory.hh>
Public Member Functions | |
| ResourceLoaderOP | create_resource_loader (std::string const &loader_type) const |
| Instantiates a resource loader ofa given type; throws an exception if no loader with this type has been previously registered. More... | |
| bool | has_resource_loader (std::string const &loader_type) const |
| Returns true if a resource loader of the given type has been registered with the factory. More... | |
| std::list< std::string > | available_resource_loaders () const |
| Return a list of all the resource loaders available. More... | |
| void | factory_register (ResourceLoaderCreatorOP creator) |
| Register a ResourceLoaderCreator with the factory. The factory asks the Creator for the name of the ResourceLoader that it will create; if another Creator has already registered with the factory that proports to instantiate another ResourceLoader with the same name, then it will exit with an error message, or, if set_throw_on_double_registration() has previously been called, throw an exception. More... | |
| void | set_throw_on_double_registration () |
| Only useful for unit testing. Since factory registration happens (sometimes) at load time, there may be no one to catch a thrown exception in the event of a name collision two FallbackConfigurationCreators that register for the same. More... | |
Static Public Member Functions | |
| static ResourceLoaderFactory * | get_instance () |
| Singleton accessor: ask for the one global instance of the ResourceLoaderFactory. More... | |
Private Member Functions | |
| ResourceLoaderFactory () | |
| singleton has a private constructor More... | |
Static Private Member Functions | |
| static ResourceLoaderFactory * | create_singleton_instance () |
| private singleton creation function to be used with utility::thread::threadsafe_singleton More... | |
Private Attributes | |
| bool | throw_on_double_registration_ |
| std::map< std::string, ResourceLoaderCreatorOP > | creator_map_ |
Static Private Attributes | |
| static ResourceLoaderFactory * | instance_ |
Instantiates ResourceLoaders. Creators may be registered with the Factory at any point, though it is recommended they be registered at load time. If two Creators are registered and they both give the same name for the ResourceLoader they say they will instantiate, then the Factory will exit with an error message.
|
private |
singleton has a private constructor
Referenced by create_singleton_instance().
| std::list< std::string > basic::resource_manager::ResourceLoaderFactory::available_resource_loaders | ( | ) | const |
Return a list of all the resource loaders available.
References creator_map_.
| ResourceLoaderOP basic::resource_manager::ResourceLoaderFactory::create_resource_loader | ( | std::string const & | loader_type | ) | const |
Instantiates a resource loader ofa given type; throws an exception if no loader with this type has been previously registered.
References creator_map_.
|
staticprivate |
private singleton creation function to be used with utility::thread::threadsafe_singleton
References ResourceLoaderFactory().
Referenced by get_instance().
| void basic::resource_manager::ResourceLoaderFactory::factory_register | ( | ResourceLoaderCreatorOP | creator | ) |
Register a ResourceLoaderCreator with the factory. The factory asks the Creator for the name of the ResourceLoader that it will create; if another Creator has already registered with the factory that proports to instantiate another ResourceLoader with the same name, then it will exit with an error message, or, if set_throw_on_double_registration() has previously been called, throw an exception.
References creator_map_, throw_on_double_registration_, and utility_exit_with_message.
|
static |
Singleton accessor: ask for the one global instance of the ResourceLoaderFactory.
static function to get the instance of ( pointer to) this singleton class
References create_singleton_instance(), instance_, and utility::thread::safely_create_singleton().
Referenced by basic::resource_manager::LazyResourceManager::create_resource().
| bool basic::resource_manager::ResourceLoaderFactory::has_resource_loader | ( | std::string const & | loader_type | ) | const |
Returns true if a resource loader of the given type has been registered with the factory.
References creator_map_.
| void basic::resource_manager::ResourceLoaderFactory::set_throw_on_double_registration | ( | ) |
Only useful for unit testing. Since factory registration happens (sometimes) at load time, there may be no one to catch a thrown exception in the event of a name collision two FallbackConfigurationCreators that register for the same.
References throw_on_double_registration_.
|
private |
Referenced by available_resource_loaders(), create_resource_loader(), factory_register(), and has_resource_loader().
|
staticprivate |
Referenced by get_instance().
|
private |
Referenced by factory_register(), and set_throw_on_double_registration().
1.8.7