Rosetta  2020.37
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends | 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>

Inheritance diagram for basic::resource_manager::ResourceLocatorFactory:
Inheritance graph
[legend]

Public Member Functions

virtual ~ResourceLocatorFactory ()
 Automatically generated virtual destructor for class deriving directly from VirtualBase. 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...
 
std::map< std::string,
ResourceLocatorCreatorOP >
const & 
locator_map () const
 
- Public Member Functions inherited from utility::SingletonBase< ResourceLocatorFactory >
 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_locator (std::string const &locator_name)
 
- Static Public Member Functions inherited from utility::SingletonBase< ResourceLocatorFactory >
static ResourceLocatorFactory * get_instance ()
 Safely instantiate a singleton class in a (possibly) multithreaded context. More...
 

Private Member Functions

 ResourceLocatorFactory ()
 Singleton has a private constructor. More...
 

Private Attributes

bool throw_on_double_registration_
 
std::map< std::string,
ResourceLocatorCreatorOP
creator_map_
 

Friends

class utility::SingletonBase< ResourceLocatorFactory >
 

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

Automatically generated virtual destructor for class deriving directly from VirtualBase.

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

Singleton has a private constructor.

singleton has a private constructor

Member Function Documentation

std::string basic::resource_manager::ResourceLocatorFactory::complex_type_name_for_locator ( std::string const &  locator_name)
static
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 CREATE_EXCEPTION, and creator_map_.

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 CREATE_EXCEPTION, creator_map_, errmsg(), throw_on_double_registration_, and utility_exit_with_message.

std::map< std::string, ResourceLocatorCreatorOP > const & basic::resource_manager::ResourceLocatorFactory::locator_map ( ) const

References creator_map_.

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_.

Friends And Related Function Documentation

Member Data Documentation

std::map< std::string, ResourceLocatorCreatorOP > basic::resource_manager::ResourceLocatorFactory::creator_map_
private
bool basic::resource_manager::ResourceLocatorFactory::throw_on_double_registration_
private

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