![]() |
Rosetta Utilities
2014.35
|
The ResourceLocatorFactory instantiates ResourceLocator objects given their corresponding locator-type strings. It uses the load-time factory registration scheme, meaning that it is a singleton and takes an instance of a Creator object (a ResourceLocatorCreator) in its "factory_register" method. Templated instances of the ResourceLocatorRegistrator classes should be placed in the library init.cc files (e.g. core/init/init.cc or protocols/init/init.ResourceLocatorRegistrators.ihh) More...
#include <ResourceLocatorFactory.hh>
Public Member Functions | |
virtual | ~ResourceLocatorFactory () |
Automatically generated virtual destructor for class deriving directly from ReferenceCount. More... | |
ResourceLocatorOP | create_resource_locator (std::string const &locator_type, std::string const &locator_tag, utility::tag::TagCOP tags) const |
Create a ResourceLocator given its locator_type, giving the newly created instance the name locator_tag. More... | |
void | factory_register (ResourceLocatorCreatorOP creator) |
This function is called on the singleton instance to give a ResourceLocatorCreator to the factory, usually through the constructor of a ResourceLocatorRegistrator class. 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 between two ResourceLocatorCreators that register for the same name. More... | |
Static Public Member Functions | |
static ResourceLocatorFactory * | get_instance () |
Singleton access method; return the single instance of the object. More... | |
Private Member Functions | |
ResourceLocatorFactory () | |
Singleton has a private constructor. More... | |
Static Private Member Functions | |
static ResourceLocatorFactory * | 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, ResourceLocatorCreatorOP > | creator_map_ |
Static Private Attributes | |
static ResourceLocatorFactory * | instance_ |
The ResourceLocatorFactory instantiates ResourceLocator objects given their corresponding locator-type strings. It uses the load-time factory registration scheme, meaning that it is a singleton and takes an instance of a Creator object (a ResourceLocatorCreator) in its "factory_register" method. Templated instances of the ResourceLocatorRegistrator classes should be placed in the library init.cc files (e.g. core/init/init.cc or protocols/init/init.ResourceLocatorRegistrators.ihh)
|
virtual |
Automatically generated virtual destructor for class deriving directly from ReferenceCount.
Auto-generated virtual destructor
|
private |
Singleton has a private constructor.
singleton has a private constructor
Referenced by create_singleton_instance().
ResourceLocatorOP basic::resource_manager::ResourceLocatorFactory::create_resource_locator | ( | std::string const & | locator_type, |
std::string const & | locator_tag, | ||
utility::tag::TagCOP | tags | ||
) | const |
Create a ResourceLocator given its locator_type, giving the newly created instance the name locator_tag.
Create a resource locator from a tags object locator_type This is the type of the resource locator, e.g., DatabaseResourceLocator locator_tag This is the name of the instance of the the resource locator, e.g., coming from the 'tag' field in the ResourceLocator tag 'stage_1_resfiles'. tags this is the tag structure that is parsed by the ResourceLocator to initialize itself.
References creator_map_.
Referenced by basic::resource_manager::LazyResourceManager::add_default_resource_locator().
|
staticprivate |
private singleton creation function to be used with utility::thread::threadsafe_singleton
References ResourceLocatorFactory().
Referenced by get_instance().
void basic::resource_manager::ResourceLocatorFactory::factory_register | ( | ResourceLocatorCreatorOP | creator | ) |
This function is called on the singleton instance to give a ResourceLocatorCreator to the factory, usually through the constructor of a ResourceLocatorRegistrator class.
References creator_map_, throw_on_double_registration_, and utility_exit_with_message.
|
static |
Singleton access method; return the single instance of the object.
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::add_default_resource_locator().
void basic::resource_manager::ResourceLocatorFactory::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 between two ResourceLocatorCreators that register for the same name.
References throw_on_double_registration_.
|
private |
Referenced by create_resource_locator(), and factory_register().
|
staticprivate |
Referenced by get_instance().
|
private |
Referenced by factory_register(), and set_throw_on_double_registration().