![]() |
Rosetta
2021.16
|
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. More... | |
| std::map< std::string, ResourceLoaderCreatorOP > const & | loader_map () const |
| Read access to the set of creators that the factry holds; used to create the schema definition for the ResourceManager. More... | |
Public Member Functions inherited from utility::SingletonBase< T > | |
| SingletonBase () | |
| public constructor (the derived class must have a private constructor, of course). More... | |
Static Public Member Functions | |
| static std::string | complex_type_name_for_loader (std::string const &loader_name) |
| The name mangling function used by ResourceLoaders when they define their complexTypes in the XML Schema. More... | |
Static Public Member Functions inherited from utility::SingletonBase< T > | |
| static T * | get_instance () |
| Safely instantiate a singleton class in a (possibly) multithreaded context. More... | |
Private Member Functions | |
| ResourceLoaderFactory () | |
| singleton has a private constructor More... | |
| ResourceLoaderFactory (ResourceLoaderFactory const &)=delete | |
| ResourceLoaderFactory & | operator= (ResourceLoaderFactory const &)=delete |
Private Attributes | |
| bool | throw_on_double_registration_ |
| std::map< std::string, ResourceLoaderCreatorOP > | creator_map_ |
Friends | |
| class | utility::SingletonBase< ResourceLoaderFactory > |
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
|
privatedelete |
| std::list< std::string > basic::resource_manager::ResourceLoaderFactory::available_resource_loaders | ( | ) | const |
Return a list of all the resource loaders available.
References creator_map_.
|
static |
The name mangling function used by ResourceLoaders when they define their complexTypes in the XML Schema.
Referenced by basic::resource_manager::resource_loader_xsd_type_definition_w_attributes(), basic::resource_manager::resource_loader_xsd_type_definition_w_attributes_and_repeatable_subelements(), and basic::resource_manager::ResourceManager::schema_for_resource_definition_file().
| 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 CREATE_EXCEPTION, and creator_map_.
| 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 CREATE_EXCEPTION, creator_map_, errmsg(), throw_on_double_registration_, and utility_exit_with_message.
| 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_.
| std::map< std::string, ResourceLoaderCreatorOP > const & basic::resource_manager::ResourceLoaderFactory::loader_map | ( | ) | const |
Read access to the set of creators that the factry holds; used to create the schema definition for the ResourceManager.
References creator_map_.
|
privatedelete |
| 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.
References throw_on_double_registration_.
|
friend |
|
private |
Referenced by available_resource_loaders(), create_resource_loader(), factory_register(), has_resource_loader(), and loader_map().
|
private |
Referenced by factory_register(), and set_throw_on_double_registration().
1.8.7