Rosetta  2020.37
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Attributes | List of all members
protocols::jd2::JobsContainer Class Reference

#include <JobsContainer.hh>

Inheritance diagram for protocols::jd2::JobsContainer:
Inheritance graph
[legend]

Public Member Functions

 JobsContainer ()
 JobsContainer constructor. More...
 
 ~JobsContainer () override
 JobsContainer destructor. More...
 
JobsContainerCOP get_self_ptr () const
 Default (shallow copy) copy constructor/assignment operator is the desired behavior. More...
 
JobsContainerOP get_self_ptr ()
 Get self owning pointers. More...
 
JobOP operator[] (core::Size const index)
 Get a specific job, by number. More...
 
JobCOP operator[] (core::Size const index) const
 Get a specific job, by number (const-access). More...
 
core::Size size () const
 Get the total number of jobs. More...
 
void push_back (JobOP new_job)
 Add a job to the list of jobs. More...
 
void set_total_jobs (core::Size const total_jobs)
 Set the total number of jobs. More...
 
void clear ()
 Clear the jobs list. More...
 
JobOP back ()
 Access the last element. More...
 
void shuffle ()
 Randomize the order of elements (the map keys) More...
 
void erase (core::Size const index)
 Erase an element in the jobs list. More...
 
bool has_job (core::Size const index) const
 Does the job with the given index exist in the currently-loaded list of jobs? More...
 
bool can_be_deleted (core::Size const index) const
 Can the job with the given index be deleted? More...
 
core::Size highest_job_index () const
 Return the index of the highest job currently loaded in memory. More...
 
void set_job_inputter (JobInputterOP jobinputter)
 Set the job inputter. More...
 
void get_loaded_job_indices (utility::vector1< core::Size > &output) const
 Get a list of job indices currently in memory. More...
 
void set_all_current_jobs_as_deletable ()
 Mark all jobs currently in memory as deletable. More...
 
void set_force_job_purging (bool const val=true)
 Set whether or not this JobsContainer forces job purging when higher-numbered jobs are requested. More...
 
bool force_job_purging () const
 Get whether or not this JobsContainer forces job purging when higher-numbered jobs are requested. More...
 

Private Attributes

std::map< core::Size, JobOPjoblist_
 The list of owning pointers to jobs, with the job number as the key. More...
 
core::Size highest_job_index_
 The highest-index job in the joblist_ map. More...
 
core::Size total_jobs_
 The total number of jobs. More...
 
bool total_jobs_set_
 Has the total number of jobs been overridden? More...
 
JobInputterOP job_inputter_
 The JobInputter that populated this object (or which is otherwise associated with it). More...
 
bool force_job_purging_
 If true, and if a job inputter is used that limits the number of jobs in memory at any given time, then when a higher job index is requested than exists in memory, the JobsContainer will force job purging until that job exists in memory. If false (the default), then only deletable jobs will be purged, and the job inputter can attempt to add jobs up to the requested job (which might fail, if the requested job's number is too high). More...
 

Detailed Description

The JobsContainer class contains a list of JobsOPs. It permits the list to be versatile – for example, if one wishes to load only a subset of jobs into memory at any given time.

Constructor & Destructor Documentation

protocols::jd2::JobsContainer::JobsContainer ( )

JobsContainer constructor.

protocols::jd2::JobsContainer::~JobsContainer ( )
overridedefault

JobsContainer destructor.

Member Function Documentation

JobOP protocols::jd2::JobsContainer::back ( )
bool protocols::jd2::JobsContainer::can_be_deleted ( core::Size const  index) const

Can the job with the given index be deleted?

References joblist_.

void protocols::jd2::JobsContainer::clear ( )
void protocols::jd2::JobsContainer::erase ( core::Size const  index)

Erase an element in the jobs list.

References joblist_.

bool protocols::jd2::JobsContainer::force_job_purging ( ) const
inline

Get whether or not this JobsContainer forces job purging when higher-numbered jobs are requested.

If true, and if a job inputter is used that limits the number of jobs in memory at any given time, then when a higher job index is requested than exists in memory, the JobsContainer will force job purging until that job exists in memory. If false (the default), then only deletable jobs will be purged, and the job inputter can attempt to add jobs up to the requested job (which might fail, if the requested job's number is too high).

References force_job_purging_.

Referenced by operator[]().

void protocols::jd2::JobsContainer::get_loaded_job_indices ( utility::vector1< core::Size > &  output) const

Get a list of job indices currently in memory.

The output vector is cleared and populated with the current job indices in memory.

References joblist_.

JobsContainerCOP protocols::jd2::JobsContainer::get_self_ptr ( ) const
inline

Default (shallow copy) copy constructor/assignment operator is the desired behavior.

Get self const owning pointers.

Referenced by operator[]().

JobsContainerOP protocols::jd2::JobsContainer::get_self_ptr ( )
inline

Get self owning pointers.

bool protocols::jd2::JobsContainer::has_job ( core::Size const  index) const

Does the job with the given index exist in the currently-loaded list of jobs?

References joblist_.

Referenced by operator[](), and protocols::jd2::MPIWorkPoolJobDistributor::slave_get_new_job_id().

core::Size protocols::jd2::JobsContainer::highest_job_index ( ) const
inline

Return the index of the highest job currently loaded in memory.

References highest_job_index_.

Referenced by operator[](), and protocols::jd2::MPIWorkPoolJobDistributor::slave_get_new_job_id().

JobOP protocols::jd2::JobsContainer::operator[] ( core::Size const  index)

Get a specific job, by number.

Should work even if jobs have been deleted, since this uses a map instead of an array.

References force_job_purging(), get_self_ptr(), has_job(), highest_job_index(), job_inputter_, joblist_, size(), total_jobs_, and protocols::jd2::TR().

JobCOP protocols::jd2::JobsContainer::operator[] ( core::Size const  index) const

Get a specific job, by number (const-access).

Should work even if jobs have been deleted, since this uses a map instead of an array.

References highest_job_index(), joblist_, and total_jobs_.

void protocols::jd2::JobsContainer::push_back ( JobOP  new_job)
void protocols::jd2::JobsContainer::set_all_current_jobs_as_deletable ( )

Mark all jobs currently in memory as deletable.

This will result in all jobs being purged the next time a higher-index job is requeted.

void protocols::jd2::JobsContainer::set_force_job_purging ( bool const  val = true)
inline

Set whether or not this JobsContainer forces job purging when higher-numbered jobs are requested.

If true, and if a job inputter is used that limits the number of jobs in memory at any given time, then when a higher job index is requested than exists in memory, the JobsContainer will force job purging until that job exists in memory. If false (the default), then only deletable jobs will be purged, and the job inputter can attempt to add jobs up to the requested job (which might fail, if the requested job's number is too high).

References force_job_purging_, and protocols::hybridization::val.

Referenced by protocols::jd2::MPIWorkPoolJobDistributor::MPIWorkPoolJobDistributor().

void protocols::jd2::JobsContainer::set_job_inputter ( JobInputterOP  jobinputter)
inline

Set the job inputter.

Needed if the job list is to be updated by the job inputter.

References job_inputter_.

Referenced by protocols::jd2::LargeNstructJobInputter::fill_jobs().

void protocols::jd2::JobsContainer::set_total_jobs ( core::Size const  total_jobs)

Set the total number of jobs.

This overrides whatever the length of the joblist_ is.

References highest_job_index_, total_jobs_, and total_jobs_set_.

Referenced by protocols::jd2::LargeNstructJobInputter::fill_jobs().

void protocols::jd2::JobsContainer::shuffle ( )

Randomize the order of elements (the map keys)

References joblist_, and core::scoring::rg.

Referenced by protocols::jd2::ScreeningJobInputter::fill_jobs().

core::Size protocols::jd2::JobsContainer::size ( ) const
inline

Member Data Documentation

bool protocols::jd2::JobsContainer::force_job_purging_
private

If true, and if a job inputter is used that limits the number of jobs in memory at any given time, then when a higher job index is requested than exists in memory, the JobsContainer will force job purging until that job exists in memory. If false (the default), then only deletable jobs will be purged, and the job inputter can attempt to add jobs up to the requested job (which might fail, if the requested job's number is too high).

Referenced by force_job_purging(), and set_force_job_purging().

core::Size protocols::jd2::JobsContainer::highest_job_index_
private

The highest-index job in the joblist_ map.

Starts at 0 and counts up as elements are added.

Referenced by back(), clear(), highest_job_index(), push_back(), and set_total_jobs().

JobInputterOP protocols::jd2::JobsContainer::job_inputter_
private

The JobInputter that populated this object (or which is otherwise associated with it).

Referenced by operator[](), and set_job_inputter().

std::map< core::Size, JobOP > protocols::jd2::JobsContainer::joblist_
private

The list of owning pointers to jobs, with the job number as the key.

Referenced by back(), can_be_deleted(), clear(), erase(), get_loaded_job_indices(), has_job(), operator[](), push_back(), and shuffle().

core::Size protocols::jd2::JobsContainer::total_jobs_
private

The total number of jobs.

By default, this will be the size of the joblist_, unless overridden.

Referenced by clear(), operator[](), push_back(), set_total_jobs(), and size().

bool protocols::jd2::JobsContainer::total_jobs_set_
private

Has the total number of jobs been overridden?

Default false.

Referenced by clear(), push_back(), and set_total_jobs().


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