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

The FallbackConfigurationFactory is a singleton factory with which FallbackConfigurationCreator objects should be registered. The "fallback" system serves as a mechanism for preserving command-line functionality even while switching more protocols from requesting resources from the ResourceManager rather than reading directly from the command line. More...

#include <FallbackConfigurationFactory.hh>

Public Member Functions

FallbackConfigurationOP create_fallback_configuration (std::string const &resource_description) const
 
void factory_register (FallbackConfigurationCreatorOP creator)
 
bool has_fallback_for_resource (std::string const &desc) const
 
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
FallbackConfigurationFactory
get_instance ()
 static function to get the instance of ( pointer to) this singleton class More...
 

Private Types

typedef std::map< std::string,
FallbackConfigurationCreatorOP
FallbackConfigurationCreatorsMap
 

Private Member Functions

 FallbackConfigurationFactory ()
 

Static Private Member Functions

static
FallbackConfigurationFactory
create_singleton_instance ()
 private singleton creation function to be used with utility::thread::threadsafe_singleton More...
 

Private Attributes

bool throw_on_double_registration_
 
FallbackConfigurationCreatorsMap creators_map_
 

Static Private Attributes

static
FallbackConfigurationFactory
instance_
 

Detailed Description

The FallbackConfigurationFactory is a singleton factory with which FallbackConfigurationCreator objects should be registered. The "fallback" system serves as a mechanism for preserving command-line functionality even while switching more protocols from requesting resources from the ResourceManager rather than reading directly from the command line.

When a resource with a particular resource-description string is requested from the ResourceManager, and the ResourceManager does not have any instructions on how to load a resource matching that description, then the ResourceManager will then ask the FallbackConfigurationFactory for help. The FallbackConfigurationFactory can first answer "does this resource description match any resource descriptions for which you have a registered FallbackConfigurationCreator?" and if the answer is "yes", then the ResourceManager can request that FallbackConfigurationCreator and ask, first, if it is able to construct a resource (FallbackConfigurations often read from the command line, and it's possible that the required flags have not been put on the command line), and if so, then request data from the FallbackConfiguration needed to contruct that resource.

Member Typedef Documentation

Constructor & Destructor Documentation

basic::resource_manager::FallbackConfigurationFactory::FallbackConfigurationFactory ( )
private

Member Function Documentation

FallbackConfigurationOP basic::resource_manager::FallbackConfigurationFactory::create_fallback_configuration ( std::string const &  resource_description) const

References creators_map_.

FallbackConfigurationFactory * basic::resource_manager::FallbackConfigurationFactory::create_singleton_instance ( )
staticprivate

private singleton creation function to be used with utility::thread::threadsafe_singleton

References FallbackConfigurationFactory().

Referenced by get_instance().

void basic::resource_manager::FallbackConfigurationFactory::factory_register ( FallbackConfigurationCreatorOP  creator)
FallbackConfigurationFactory * basic::resource_manager::FallbackConfigurationFactory::get_instance ( )
static

static function to get the instance of ( pointer to) this singleton class

References create_singleton_instance(), instance_, and utility::thread::safely_create_singleton().

bool basic::resource_manager::FallbackConfigurationFactory::has_fallback_for_resource ( std::string const &  desc) const

References creators_map_.

void basic::resource_manager::FallbackConfigurationFactory::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_.

Member Data Documentation

FallbackConfigurationCreatorsMap basic::resource_manager::FallbackConfigurationFactory::creators_map_
private
FallbackConfigurationFactory * basic::resource_manager::FallbackConfigurationFactory::instance_
staticprivate

Referenced by get_instance().

bool basic::resource_manager::FallbackConfigurationFactory::throw_on_double_registration_
private

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