![]() |
Rosetta Utilities
2014.35
|
The ResourceOptionsFactory class is responsible for maintaining the map between the names of the ResourceOptions classes (strings) and the ResourceOptionsCreator classes that are responsible for instantiating the ResourceOption classes. This is a singleton class. It is initialized at load time – or at least after the call to devel::init( argc, argv ) – and populated with the help of ResourceOptionsRegistrator instances. More...
#include <ResourceOptionsFactory.hh>
Public Member Functions | |
virtual | ~ResourceOptionsFactory () |
ResourceOptionsOP | create_resource_options (std::string const &options_type, utility::tag::TagCOP tag) const |
Create an instance of a ResourceOptions class given the name of the class (options_type) and initialize it from the given tag object. Throws an EXCN_Msg_Exception exception if the options_type string is not recognized. More... | |
void | factory_register (ResourceOptionsCreatorOP creator) |
Register the given ResourceOptionsCreator object with the factory. Invoked by an instance of the templated ResourceOptionsRegistrator class. More... | |
void | set_throw_on_double_registration () |
Instruct the ResourceOptionsFactory to throw an exception if two ResourceOptionCreators are registered with the factory that report the same "options_type" string instead of invoking utility_exit_with_message. More... | |
Static Public Member Functions | |
static ResourceOptionsFactory * | get_instance () |
Singleton accessor function. Return the globally-unique instance of the class. More... | |
Private Types | |
typedef std::map< std::string, ResourceOptionsCreatorOP > | ResourceOptionsCreatorMap |
Private Member Functions | |
ResourceOptionsFactory () | |
Singleton private constructor. More... | |
Static Private Member Functions | |
static ResourceOptionsFactory * | create_singleton_instance () |
private singleton creation function to be used with utility::thread::threadsafe_singleton More... | |
Private Attributes | |
bool | throw_on_double_registration_ |
ResourceOptionsCreatorMap | creator_map_ |
Static Private Attributes | |
static ResourceOptionsFactory * | instance_ |
The ResourceOptionsFactory class is responsible for maintaining the map between the names of the ResourceOptions classes (strings) and the ResourceOptionsCreator classes that are responsible for instantiating the ResourceOption classes. This is a singleton class. It is initialized at load time – or at least after the call to devel::init( argc, argv ) – and populated with the help of ResourceOptionsRegistrator instances.
|
private |
|
virtual |
|
private |
Singleton private constructor.
Referenced by create_singleton_instance().
ResourceOptionsOP basic::resource_manager::ResourceOptionsFactory::create_resource_options | ( | std::string const & | options_type, |
utility::tag::TagCOP | tag | ||
) | const |
Create an instance of a ResourceOptions class given the name of the class (options_type) and initialize it from the given tag object. Throws an EXCN_Msg_Exception exception if the options_type string is not recognized.
References creator_map_, and basic::options::OptionKeys::frags::contacts::type.
|
staticprivate |
private singleton creation function to be used with utility::thread::threadsafe_singleton
References ResourceOptionsFactory().
Referenced by get_instance().
void basic::resource_manager::ResourceOptionsFactory::factory_register | ( | ResourceOptionsCreatorOP | creator | ) |
Register the given ResourceOptionsCreator object with the factory. Invoked by an instance of the templated ResourceOptionsRegistrator class.
References creator_map_, throw_on_double_registration_, and utility_exit_with_message.
|
static |
Singleton accessor function. Return the globally-unique instance of the class.
static function to get the instance of ( pointer to) this singleton class
References create_singleton_instance(), instance_, and utility::thread::safely_create_singleton().
void basic::resource_manager::ResourceOptionsFactory::set_throw_on_double_registration | ( | ) |
Instruct the ResourceOptionsFactory to throw an exception if two ResourceOptionCreators are registered with the factory that report the same "options_type" string instead of invoking utility_exit_with_message.
Only useful for unit testing. Since factory registration can happen any time between load time and the call to devel::init, there may be no one to catch a thrown exception in the event of a name collision between two ResourceOptionsCreators that register for the same name, and so the default behavior is to call utility_exit_with_message. For the sake of unit testing, however, it is useful to change the default behavior so that exceptions can be thrown and then caught.
References throw_on_double_registration_.
|
private |
Referenced by create_resource_options(), and factory_register().
|
staticprivate |
Referenced by get_instance().
|
private |
Referenced by factory_register(), and set_throw_on_double_registration().