Rosetta Utilities  2014.35
Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
basic::resource_manager::ResourceLocatorFactory Class Reference

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 ResourceLocatorFactoryget_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 ResourceLocatorFactorycreate_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 ResourceLocatorFactoryinstance_
 

Detailed Description

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)

Constructor & Destructor Documentation

basic::resource_manager::ResourceLocatorFactory::~ResourceLocatorFactory ( )
virtual

Automatically generated virtual destructor for class deriving directly from ReferenceCount.

Auto-generated virtual destructor

basic::resource_manager::ResourceLocatorFactory::ResourceLocatorFactory ( )
private

Singleton has a private constructor.

singleton has a private constructor

Referenced by create_singleton_instance().

Member Function Documentation

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().

ResourceLocatorFactory * basic::resource_manager::ResourceLocatorFactory::create_singleton_instance ( )
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.

ResourceLocatorFactory * basic::resource_manager::ResourceLocatorFactory::get_instance ( )
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_.

Member Data Documentation

std::map< std::string, ResourceLocatorCreatorOP > basic::resource_manager::ResourceLocatorFactory::creator_map_
private
ResourceLocatorFactory * basic::resource_manager::ResourceLocatorFactory::instance_
staticprivate

Referenced by get_instance().

bool basic::resource_manager::ResourceLocatorFactory::throw_on_double_registration_
private

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