Rosetta Utilities  2014.35
Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
basic::resource_manager::LazyResourceManager Class Reference

This is a mule class, meant to be derived from. It's job is to hold ResourceOptions and ResourceLocator objects by name (tag) as well as the ResourceConfigurations which serve as complete descriptions for how to construct a Resource. It should be thought of as a mule by classes that derive from it: it won't do anything on its own, but it can be directed to do things. The point of the class is to ake it easier to create ResourceManagers besides the JD2ResourceManager, which, at the time of this documentation, is the only class that derives from the LazyResourceManager. More...

#include <LazyResourceManager.hh>

Public Member Functions

virtual ~LazyResourceManager ()
 
virtual ResourceOP create_resource_by_job_tag (ResourceDescription const &resource_description, JobTag const &job_tag) const
 
virtual void add_resource_tag_by_job_tag (ResourceDescription const &resource_description, JobTag const &job_tag, ResourceTag const &resource_tag)
 
virtual bool has_resource_tag_by_job_tag (ResourceDescription const &resource_description, JobTag const &job_tag) const
 
virtual ResourceTag find_resource_tag_by_job_tag (ResourceDescription const &resource_description, JobTag const &job_tag) const
 
virtual ResourceOP get_resource_by_job_tag (ResourceDescription const &resource_description, JobTag const &job_tag)
 
virtual std::list< ResourceTagget_resource_tags_for_job_tag (JobTag const &job_tag) const
 
virtual platform::Size get_count_of_jobs_associated_with_resource_tag (ResourceTag const &resource_tag) const
 
virtual void mark_job_tag_as_complete (JobTag const &job_tag)
 remove the Job tag from incomplete_job_sets_ for each resource More...
 
virtual void free_resource_by_job_tag (ResourceDescription const &resource_description, JobTag const &job_tag)
 
virtual void free_resource_by_tag (ResourceTag const &resource_tag)
 
virtual void clear ()
 wipe out all data; useful for unit testing, but hard to fathom how it would be useful otherwise. More...
 
virtual void add_job_options (JobTag const &job_tag, JobOptionsOP job_options)
 
virtual bool has_job_options (JobTag const &job_tag) const
 
virtual JobOptionsOP get_job_options (JobTag const &job_tag) const
 
virtual void add_resource_configuration (ResourceTag const &resource_tag, ResourceConfiguration const &resource_configuration)
 
virtual void add_resource_locator (LocatorTag const &locator_tag, ResourceLocatorOP resource_locator)
 
virtual void add_resource_options (ResourceOptionsTag const &resource_options_tag, ResourceOptionsOP resource_options)
 
virtual ResourceConfiguration
const & 
find_resource_configuration (ResourceTag const &resource_tag) const
 
virtual ResourceLocatorOP find_resource_locator (LocatorTag const &locator_tag) const
 
virtual ResourceOptionsOP find_resource_options (ResourceOptionsTag const &resource_options_tag) const
 
virtual bool has_resource (ResourceTag const &resource_tag) const
 Does a resource with a given name exist? More...
 
virtual ResourceOP find_resource (ResourceTag const &resource_tag)
 Get a resource with a given name. More...
 
virtual ResourceOP create_resource (ResourceTag const &resource_tag) const
 
virtual void create_resources (JobTag const &)
 Create all the resources for a particular job; this should be implemented by the derived class. The implementation in this class calls utility::exit. More...
 
virtual void show (std::ostream &out) const
 
bool has_resource_configuration (ResourceTag const &resource_tag) const
 has a ResourceConfiguration been provided to the LazyResourceManager for a Resource with a particular ResourceTag? More...
 
bool has_resource_locator (LocatorTag const &locator_tag) const
 has a ResourceLocator object been provided to the LazyResourceManager which has a particular LocatorTag? More...
 
bool has_resource_options (ResourceOptionsTag const &resource_options_tag) const
 has a ResourceOptions object been provided to the LazyResourceManager which has a particular ResourceOptionsTag? More...
 
- Public Member Functions inherited from basic::resource_manager::ResourceManager
virtual bool has_resource_with_description (ResourceDescription const &resource_description)=0
 A protocol may ask whether a resource with a given resource description has been provided. It is possible that some resources are available sometimes when running a protocol, but not always (e.g. when running abinitio, sometimes you don't know what the native structure is). More...
 
virtual ResourceOP get_resource (ResourceDescription const &resource_description)=0
 Returns the resource with the given resource_description. More...
 
virtual bool get_option (utility::options::BooleanOptionKey key) const =0
 Retrieve the boolean value represented by the given option key. More...
 
virtual utility::vector1< bool >
const & 
get_option (utility::options::BooleanVectorOptionKey key) const =0
 Retrieve the vector of boolean values represented by the given option key. More...
 
virtual
utility::file::FileName const & 
get_option (utility::options::FileOptionKey key) const =0
 Retrieve the FileName value represented by the given option key. More...
 
virtual utility::vector1
< utility::file::FileName >
const & 
get_option (utility::options::FileVectorOptionKey key) const =0
 Retrieve the vector of FileName values represented by the given option key. More...
 
virtual int get_option (utility::options::IntegerOptionKey key) const =0
 Retrieve the integer value represented by the given option key. More...
 
virtual utility::vector1< int >
const & 
get_option (utility::options::IntegerVectorOptionKey key) const =0
 Retrieve the vector of integer values represented by the given option key. More...
 
virtual
utility::file::PathName const & 
get_option (utility::options::PathOptionKey key) const =0
 Retrieve the PathName value represented by the given option key. More...
 
virtual utility::vector1
< utility::file::PathName >
const & 
get_option (utility::options::PathVectorOptionKey key) const =0
 Retrieve the vector of PathName values represented by the given option key. More...
 
virtual platform::Real get_option (utility::options::RealOptionKey key) const =0
 Retrieve the Real value represented by the given option key. More...
 
virtual utility::vector1
< platform::Real > const & 
get_option (utility::options::RealVectorOptionKey key) const =0
 Retrieve the vector of Real values represented by the given option key. More...
 
virtual std::string const & get_option (utility::options::StringOptionKey key) const =0
 Retrieve the string value represented by the given option key. More...
 
virtual utility::vector1
< std::string > const & 
get_option (utility::options::StringVectorOptionKey key) const =0
 Retrieve the vector of string values represented by the given option key. More...
 
virtual bool has_option (utility::options::BooleanOptionKey key) const =0
 Return whether or not a value has been provided for the given option key either on the command line or through for the current job. More...
 
virtual bool has_option (utility::options::BooleanVectorOptionKey key) const =0
 Return whether or not a value has been provided for the given option key either on the command line or through for the current job. More...
 
virtual bool has_option (utility::options::FileOptionKey key) const =0
 Return whether or not a value has been provided for the given option key either on the command line or through for the current job. More...
 
virtual bool has_option (utility::options::FileVectorOptionKey key) const =0
 Return whether or not a value has been provided for the given option key either on the command line or through for the current job. More...
 
virtual bool has_option (utility::options::IntegerOptionKey key) const =0
 Return whether or not a value has been provided for the given option key either on the command line or through for the current job. More...
 
virtual bool has_option (utility::options::IntegerVectorOptionKey key) const =0
 Return whether or not a value has been provided for the given option key either on the command line or through for the current job. More...
 
virtual bool has_option (utility::options::PathOptionKey key) const =0
 Return whether or not a value has been provided for the given option key either on the command line or through for the current job. More...
 
virtual bool has_option (utility::options::PathVectorOptionKey key) const =0
 Return whether or not a value has been provided for the given option key either on the command line or through for the current job. More...
 
virtual bool has_option (utility::options::RealOptionKey key) const =0
 Return whether or not a value has been provided for the given option key either on the command line or through for the current job. More...
 
virtual bool has_option (utility::options::RealVectorOptionKey key) const =0
 Return whether or not a value has been provided for the given option key either on the command line or through for the current job. More...
 
virtual bool has_option (utility::options::StringOptionKey key) const =0
 Return whether or not a value has been provided for the given option key either on the command line or through for the current job. More...
 
virtual bool has_option (utility::options::StringVectorOptionKey key) const =0
 Return whether or not a value has been provided for the given option key either on the command line or through for the current job. More...
 

Protected Member Functions

 LazyResourceManager ()
 Singleton construction scheme; must be protected (and not private) so that derived classes can call this constructor. More...
 
- Protected Member Functions inherited from basic::resource_manager::ResourceManager
 ResourceManager ()
 singleton, private constructor More...
 
virtual void add_resource (ResourceTag const &resource_tag, ResourceOP resource)
 Derived classes, when they instantiate a resource, should name it and give it to the base class for it to hold. A resource may be later deallocated using the "free_resource" function. More...
 
virtual void free_resource (ResourceTag const &resource_tag)
 Derived classes, when they are ready to deallocate a resource, may do so in this function. More...
 

Private Types

typedef std::map< std::pair
< ResourceDescription, JobTag >
, ResourceTag
ResourceTagsMap
 
typedef std::map< JobTag,
std::list< ResourceTag > > 
JobResourceMap
 
typedef std::map< ResourceTag,
std::set< JobTag > > 
ResourceJobMap
 
typedef std::map< ResourceTag,
JobOptionsOP
JobOptionsMap
 
typedef std::map< ResourceTag,
ResourceConfiguration
ResourceConfigurationMap
 
typedef std::map< LocatorTag,
ResourceLocatorOP
ResourceLocatorsMap
 
typedef std::map
< ResourceOptionsTag,
ResourceOptionsOP
ResourceOptionsMap
 

Private Member Functions

void add_default_resource_locator ()
 

Private Attributes

ResourceTagsMap resource_tags_
 
JobResourceMap resource_tag_lists_
 
ResourceJobMap incomplete_job_sets_
 
JobOptionsMap job_options_
 
ResourceConfigurationMap resource_configurations_
 
ResourceLocatorsMap resource_locators_
 
ResourceOptionsMap resource_options_
 

Friends

std::ostream & operator<< (std::ostream &out, LazyResourceManager const &resource_manager)
 

Additional Inherited Members

- Static Public Member Functions inherited from basic::resource_manager::ResourceManager
static ResourceManagerget_instance ()
 Singleton accessor: request access to the resource manager. More...
 

Detailed Description

This is a mule class, meant to be derived from. It's job is to hold ResourceOptions and ResourceLocator objects by name (tag) as well as the ResourceConfigurations which serve as complete descriptions for how to construct a Resource. It should be thought of as a mule by classes that derive from it: it won't do anything on its own, but it can be directed to do things. The point of the class is to ake it easier to create ResourceManagers besides the JD2ResourceManager, which, at the time of this documentation, is the only class that derives from the LazyResourceManager.

Member Typedef Documentation

Constructor & Destructor Documentation

basic::resource_manager::LazyResourceManager::LazyResourceManager ( )
protected

Singleton construction scheme; must be protected (and not private) so that derived classes can call this constructor.

References add_default_resource_locator().

basic::resource_manager::LazyResourceManager::~LazyResourceManager ( )
virtual

Member Function Documentation

void basic::resource_manager::LazyResourceManager::add_default_resource_locator ( )
private
void basic::resource_manager::LazyResourceManager::add_job_options ( JobTag const &  job_tag,
JobOptionsOP  job_options 
)
virtual

References job_options_.

void basic::resource_manager::LazyResourceManager::add_resource_configuration ( ResourceTag const &  resource_tag,
ResourceConfiguration const &  resource_configuration 
)
virtual
void basic::resource_manager::LazyResourceManager::add_resource_locator ( LocatorTag const &  locator_tag,
ResourceLocatorOP  resource_locator 
)
virtual

References resource_locators_.

void basic::resource_manager::LazyResourceManager::add_resource_options ( ResourceOptionsTag const &  resource_options_tag,
ResourceOptionsOP  resource_options 
)
virtual

References options, and resource_options_.

void basic::resource_manager::LazyResourceManager::add_resource_tag_by_job_tag ( ResourceDescription const &  resource_description,
JobTag const &  job_tag,
ResourceTag const &  resource_tag 
)
virtual
void basic::resource_manager::LazyResourceManager::clear ( )
virtual

wipe out all data; useful for unit testing, but hard to fathom how it would be useful otherwise.

Reimplemented from basic::resource_manager::ResourceManager.

References add_default_resource_locator(), job_options_, resource_configurations_, resource_locators_, resource_options_, resource_tag_lists_, and resource_tags_.

ResourceOP basic::resource_manager::LazyResourceManager::create_resource ( ResourceTag const &  resource_tag) const
virtual
ResourceOP basic::resource_manager::LazyResourceManager::create_resource_by_job_tag ( ResourceDescription const &  resource_description,
JobTag const &  job_tag 
) const
virtual
void basic::resource_manager::LazyResourceManager::create_resources ( JobTag const &  )
virtual

Create all the resources for a particular job; this should be implemented by the derived class. The implementation in this class calls utility::exit.

References utility_exit_with_message.

ResourceOP basic::resource_manager::LazyResourceManager::find_resource ( ResourceTag const &  resource_tag)
virtual
ResourceConfiguration const & basic::resource_manager::LazyResourceManager::find_resource_configuration ( ResourceTag const &  resource_tag) const
virtual
ResourceLocatorOP basic::resource_manager::LazyResourceManager::find_resource_locator ( LocatorTag const &  locator_tag) const
virtual

References resource_locators_.

Referenced by create_resource().

ResourceOptionsOP basic::resource_manager::LazyResourceManager::find_resource_options ( ResourceOptionsTag const &  resource_options_tag) const
virtual

References resource_options_.

Referenced by create_resource().

ResourceTag basic::resource_manager::LazyResourceManager::find_resource_tag_by_job_tag ( ResourceDescription const &  resource_description,
JobTag const &  job_tag 
) const
virtual
void basic::resource_manager::LazyResourceManager::free_resource_by_job_tag ( ResourceDescription const &  resource_description,
JobTag const &  job_tag 
)
virtual
void basic::resource_manager::LazyResourceManager::free_resource_by_tag ( ResourceTag const &  resource_tag)
virtual
platform::Size basic::resource_manager::LazyResourceManager::get_count_of_jobs_associated_with_resource_tag ( ResourceTag const &  resource_tag) const
virtual
JobOptionsOP basic::resource_manager::LazyResourceManager::get_job_options ( JobTag const &  job_tag) const
virtual
ResourceOP basic::resource_manager::LazyResourceManager::get_resource_by_job_tag ( ResourceDescription const &  resource_description,
JobTag const &  job_tag 
)
virtual
std::list< ResourceTag > basic::resource_manager::LazyResourceManager::get_resource_tags_for_job_tag ( JobTag const &  job_tag) const
virtual
bool basic::resource_manager::LazyResourceManager::has_job_options ( JobTag const &  job_tag) const
virtual

References job_options_.

bool basic::resource_manager::LazyResourceManager::has_resource ( ResourceTag const &  resource_tag) const
virtual
bool basic::resource_manager::LazyResourceManager::has_resource_configuration ( ResourceTag const &  resource_tag) const

has a ResourceConfiguration been provided to the LazyResourceManager for a Resource with a particular ResourceTag?

References resource_configurations_.

Referenced by find_resource(), and has_resource().

bool basic::resource_manager::LazyResourceManager::has_resource_locator ( LocatorTag const &  locator_tag) const

has a ResourceLocator object been provided to the LazyResourceManager which has a particular LocatorTag?

References resource_locators_.

bool basic::resource_manager::LazyResourceManager::has_resource_options ( ResourceOptionsTag const &  resource_options_tag) const

has a ResourceOptions object been provided to the LazyResourceManager which has a particular ResourceOptionsTag?

References resource_options_.

bool basic::resource_manager::LazyResourceManager::has_resource_tag_by_job_tag ( ResourceDescription const &  resource_description,
JobTag const &  job_tag 
) const
virtual

References resource_tags_.

void basic::resource_manager::LazyResourceManager::mark_job_tag_as_complete ( JobTag const &  job_tag)
virtual

remove the Job tag from incomplete_job_sets_ for each resource

References get_resource_tags_for_job_tag(), and incomplete_job_sets_.

void basic::resource_manager::LazyResourceManager::show ( std::ostream &  out) const
virtual

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  out,
LazyResourceManager const &  resource_manager 
)
friend

Member Data Documentation

ResourceJobMap basic::resource_manager::LazyResourceManager::incomplete_job_sets_
private
JobOptionsMap basic::resource_manager::LazyResourceManager::job_options_
private
ResourceConfigurationMap basic::resource_manager::LazyResourceManager::resource_configurations_
private
ResourceLocatorsMap basic::resource_manager::LazyResourceManager::resource_locators_
private
ResourceOptionsMap basic::resource_manager::LazyResourceManager::resource_options_
private
JobResourceMap basic::resource_manager::LazyResourceManager::resource_tag_lists_
private
ResourceTagsMap basic::resource_manager::LazyResourceManager::resource_tags_
private

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