Rosetta Utilities  2014.35
Public Member Functions | List of all members
basic::resource_manager::FallbackConfiguration Class Referenceabstract

The FallbackConfiguration class describes how a resource should be created if the ResourceManager is not being used, i.e., if resources have been specified through flags on the command line instead of through a resource-definition file. More...

#include <FallbackConfiguration.hh>

Public Member Functions

 FallbackConfiguration ()
 Default constructor for the FallbackConfiguration initializes nothing. More...
 
virtual ~FallbackConfiguration ()
 Destructor for the FallbackConfiguration does nothing. More...
 
virtual bool fallback_specified (ResourceDescription const &desc) const =0
 Return true if a fallback been provided for the given resource description. It is possible that the fallback configuration would be unable to deliver a requested resource, e.g. if the appropriate command line option has not been provided. More...
 
virtual LoaderType get_resource_loader (ResourceDescription const &desc) const =0
 Return the name of the resource loader that should be used to instantiate the desired resource. More...
 
virtual LocatorID get_locator_id (ResourceDescription const &desc) const =0
 Return the locator id that the resource locator should use to find the data used to construct the desired resource - e.g. the file name. More...
 
virtual ResourceOptionsOP get_resource_options (ResourceDescription const &desc) const =0
 Return a pointer to the ResourceOptions object that the ResourceLoader will use to instantiate the given resource. Return 0 if the default ResourceOptions specified by the appropriate ResourceLoader should be used. More...
 
virtual std::string could_not_create_resource_error_message (ResourceDescription const &desc) const =0
 If the FallbackConfiguration has not been provided the appropriate set of command line flags needed to construct the Resource given the resource description, then return an error message informing the user what options must be provided on the command line. More...
 
- Public Member Functions inherited from utility::pointer::ReferenceCount
void ctor ()
 
virtual ~ReferenceCount ()
 Destructor. More...
 
Size ref_count () const
 Reference count. More...
 

Additional Inherited Members

- Public Types inherited from utility::pointer::ReferenceCount
typedef platform::Size Size
 
typedef platform::Size size_type
 
- Protected Member Functions inherited from utility::pointer::ReferenceCount
 ReferenceCount ()
 Default constructor. More...
 
 ReferenceCount (ReferenceCount const &)
 Copy constructor. More...
 
ReferenceCountoperator= (ReferenceCount const &)
 Copy assignment. More...
 

Detailed Description

The FallbackConfiguration class describes how a resource should be created if the ResourceManager is not being used, i.e., if resources have been specified through flags on the command line instead of through a resource-definition file.

A protocol will still query the ResourceManager for its desired resource in such a case (by its "resource_description") and if no resource has been provided for that description, then the ResourceManager will ask the FallbackConfigurationFactory for the FallbackConfiguration that has been registered for that resource description (this registration logic is handled by the FallbackConfigurationCreator) and ask it to provide the information necessary to create the appropriate resource from the command line.

For example, a user can define the loop they are interested in modeling to the loop-modeling protocol via the LoopsFileData resource. The loop modeling protocol once was but is no longer responsible for opening a text file and creating a LoopsFileData object from that text file; instead it asks the ResourceManager directly for the resource. For the sake of backwards compatibility, the ResourceManager must have some way of creating a LoopsFileData object from the command line. If someone is using the loop modeling application, but does not provide a resource definition, then the LoopsFileFallbackConfiguration (derived from FallbackConfiguration) will be called upon by the ResourceManager for three things: 1) the name of the ResourceLoader to use to create the resource ("LoopsFile"), 2) the locator_id for the Resource (which it goes to the command line to find), and 3) a ResourceOptionsOP which is either null (meaning "use the default") or is in some way initialized with options from the command line. With these three bits, the ResourceManager will go the appropriate ResourceLoader and request the construction of the Resource as usual, opening the file using the default ResourceLocator (for the JD2ResourceManager, this is the FileSystemResourceLocator).

Constructor & Destructor Documentation

basic::resource_manager::FallbackConfiguration::FallbackConfiguration ( )
inline

Default constructor for the FallbackConfiguration initializes nothing.

basic::resource_manager::FallbackConfiguration::~FallbackConfiguration ( )
virtual

Destructor for the FallbackConfiguration does nothing.

Member Function Documentation

virtual std::string basic::resource_manager::FallbackConfiguration::could_not_create_resource_error_message ( ResourceDescription const &  desc) const
pure virtual

If the FallbackConfiguration has not been provided the appropriate set of command line flags needed to construct the Resource given the resource description, then return an error message informing the user what options must be provided on the command line.

Implemented in basic::resource_manager::fallback_configuration::NativeFallbackConfiguration.

virtual bool basic::resource_manager::FallbackConfiguration::fallback_specified ( ResourceDescription const &  desc) const
pure virtual

Return true if a fallback been provided for the given resource description. It is possible that the fallback configuration would be unable to deliver a requested resource, e.g. if the appropriate command line option has not been provided.

Implemented in basic::resource_manager::fallback_configuration::NativeFallbackConfiguration.

virtual LocatorID basic::resource_manager::FallbackConfiguration::get_locator_id ( ResourceDescription const &  desc) const
pure virtual

Return the locator id that the resource locator should use to find the data used to construct the desired resource - e.g. the file name.

Implemented in basic::resource_manager::fallback_configuration::NativeFallbackConfiguration.

virtual LoaderType basic::resource_manager::FallbackConfiguration::get_resource_loader ( ResourceDescription const &  desc) const
pure virtual

Return the name of the resource loader that should be used to instantiate the desired resource.

Implemented in basic::resource_manager::fallback_configuration::NativeFallbackConfiguration.

virtual ResourceOptionsOP basic::resource_manager::FallbackConfiguration::get_resource_options ( ResourceDescription const &  desc) const
pure virtual

Return a pointer to the ResourceOptions object that the ResourceLoader will use to instantiate the given resource. Return 0 if the default ResourceOptions specified by the appropriate ResourceLoader should be used.

Implemented in basic::resource_manager::fallback_configuration::NativeFallbackConfiguration.


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