Rosetta  2019.40
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Private Attributes | Friends | List of all members
utility::options::Option Class Referenceabstract

Program option interface class. More...

#include <Option.hh>

Inheritance diagram for utility::options::Option:
Inheritance graph
[legend]

Public Types

typedef OptionKey key_type
 
typedef std::size_t size_type
 
typedef OptionKey Key
 
typedef std::size_t Size
 

Public Member Functions

virtual Optionclone () const =0
 Clone this. More...
 
virtual ~Option ()
 Destructor. More...
 
virtual void copy_from (Option const &other)=0
 Copy operation – requires that other match the type of this. More...
 
virtual Optionactivate ()=0
 Activate. More...
 
virtual Optiondeactivate ()=0
 Deactivate. More...
 
virtual Optionto_default ()=0
 Set to default value, if any. More...
 
virtual Optionclear ()=0
 Clear. More...
 
virtual Optioncl_value (std::string const &value_str)=0
 Value assignment from a command line string. More...
 
virtual bool legal_specs_report () const =0
 Legal specifications check: Report and return error state. More...
 
virtual bool legal_limits_report () const =0
 Legal value limits check: Report and return error state. More...
 
virtual bool legal_size_report () const =0
 Legal size limits check: Report and return error state. More...
 
virtual bool legal_default_report () const =0
 Legal default value check: Report and return error state. More...
 
virtual void legal_default_check () const =0
 Legal default value check. More...
 
virtual bool legal_report () const =0
 Legal value check: Report and return error state. More...
 
virtual void legal_check () const =0
 Legal value check. More...
 
virtual bool specified_report () const =0
 Required specified option check: Report and return error state. More...
 
virtual void specified_check () const =0
 Required specified option check. More...
 
Optionis_group (bool value)
 
bool is_group () const
 Is this the synonymous option for an option group (e.g. -in:file:file) More...
 
virtual Key const & key () const =0
 Key. More...
 
virtual std::string const & id () const =0
 ID. More...
 
virtual std::string const & identifier () const =0
 Identifier. More...
 
virtual std::string const & code () const =0
 Code. More...
 
virtual std::string const & name () const =0
 Name. More...
 
virtual std::string const & description () const =0
 Description. More...
 
virtual std::string const & short_description () const =0
 short_Description More...
 
virtual bool legal_default () const =0
 Legal or inactive default value? More...
 
virtual bool legal () const =0
 Legal value? More...
 
virtual bool has_default () const =0
 Has a default? More...
 
virtual bool default_active () const =0
 Default active? More...
 
virtual bool default_inactive () const =0
 Default inactive? More...
 
virtual bool active () const =0
 Active? That is, the option has some value, either the default one or specified on the command line. More...
 
virtual bool user () const =0
 User-specified? That is, the option value was specified on the command line. You should probably use active() instead in almost all cases! More...
 
virtual bool is_value (std::string const &value_str) const =0
 Is a string readable as this option's value type? More...
 
virtual bool is_cl_value (std::string const &value_str) const =0
 Is a string readable as this option's value type and a legal command line value? More...
 
virtual bool can_hold_another () const =0
 Can another value be added and stay within any size constraints? More...
 
virtual Size default_size () const =0
 Default size (number of default values) More...
 
virtual Size n_default_value () const =0
 Number of default values (default size) More...
 
virtual Size size () const =0
 Size (number of values) More...
 
virtual Size n_value () const =0
 Number of values (size) More...
 
virtual std::string type_string () const =0
 Option type code string representation. More...
 
virtual std::string legal_string () const =0
 Legal value string representation. More...
 
virtual std::string size_constraint_string () const =0
 Size constraint string representation. More...
 
virtual std::string default_string () const =0
 Default value string representation. More...
 
virtual std::string raw_default_string () const =0
 Default value string representation. More...
 
virtual std::string value_string () const =0
 Value string representation. More...
 
virtual std::string raw_value_string () const =0
 Value string representation. More...
 
virtual std::string equals_string () const =0
 =Value string representation More...
 
virtual void set_value (std::string const &value_str, bool reset=false)=0
 Set the value of the option from a string. More...
 
virtual void set_cl_value (std::string const &value_str)=0
 Set the value of the option from a string from the commandline options. More...
 
void been_accessed () const
 Set access property to true. More...
 
void set_accessed (bool setting) const
 
bool is_been_accessed () const
 Return true if option value was anyhow accessed. More...
 
Optionrestrict_access (bool setting)
 Restrict direct access to option for general use. More...
 
void check_restricted_access (bool do_check) const
 

Protected Types

enum  State { INACTIVE, DEFAULT, USER }
 Option state enumeration. More...
 

Protected Member Functions

 Option ()
 Default constructor. More...
 
 Option (Option const &option)
 Copy constructor. More...
 
Optionoperator= (Option const &option)
 Copy assignment. More...
 

Private Attributes

bool is_group_
 Is this a synonymous option for an option group (e.g. -in:file:file) More...
 
bool been_accessed_
 flag, will be true if application was trying to anyhow access/check option value. Used to create option usage reports. False by default, any access functions ie: user(), active(), value(), operator()() will set it to true. More...
 
bool restricted_access_
 Is directly accessing this option deprecated in favor of accessing it through the resource manager? More...
 

Friends

bool operator< (Option const &a, Option const &b)
 Option < Option. More...
 

Detailed Description

Program option interface class.

Member Typedef Documentation

Member Enumeration Documentation

Option state enumeration.

Enumerator
INACTIVE 
DEFAULT 
USER 

Constructor & Destructor Documentation

utility::options::Option::Option ( )
inlineprotected

Default constructor.

utility::options::Option::Option ( Option const &  option)
inlineprotected

Copy constructor.

virtual utility::options::Option::~Option ( )
inlinevirtual

Destructor.

Member Function Documentation

virtual Option& utility::options::Option::activate ( )
pure virtual
virtual bool utility::options::Option::active ( ) const
pure virtual
void utility::options::Option::been_accessed ( ) const
inline
virtual bool utility::options::Option::can_hold_another ( ) const
pure virtual
void utility::options::Option::check_restricted_access ( bool  do_check) const
inline
virtual Option& utility::options::Option::cl_value ( std::string const &  value_str)
pure virtual
virtual Option& utility::options::Option::clear ( )
pure virtual
virtual Option* utility::options::Option::clone ( ) const
pure virtual

Clone this.

Implemented in utility::options::VectorOption_T_< K, T >, utility::options::VectorOption_T_< PathVectorOptionKey, file::PathName >, utility::options::VectorOption_T_< ResidueChainVectorOptionKey, int >, utility::options::VectorOption_T_< IntegerVectorOptionKey, int >, utility::options::VectorOption_T_< RealVectorOptionKey, double >, utility::options::VectorOption_T_< FileVectorOptionKey, file::FileName >, utility::options::VectorOption_T_< StringVectorOptionKey, std::string >, utility::options::VectorOption_T_< AnyVectorOptionKey, T >, utility::options::VectorOption_T_< BooleanVectorOptionKey, bool >, utility::options::ScalarOption_T_< K, T >, utility::options::ScalarOption_T_< RealOptionKey, double >, utility::options::ScalarOption_T_< AnyOptionKey, T >, utility::options::ScalarOption_T_< IntegerOptionKey, int >, utility::options::ScalarOption_T_< StringOptionKey, std::string >, utility::options::ScalarOption_T_< FileOptionKey, file::FileName >, utility::options::ScalarOption_T_< BooleanOptionKey, bool >, utility::options::ScalarOption_T_< PathOptionKey, file::PathName >, utility::options::AnyOption< T >, utility::options::BooleanOption, utility::options::AnyVectorOption< T >, utility::options::FileOption, utility::options::FileVectorOption, utility::options::PathOption, utility::options::PathVectorOption, utility::options::ResidueChainVectorOption, utility::options::IntegerVectorOption, utility::options::RealOption, utility::options::RealVectorOption, utility::options::IntegerOption, utility::options::BooleanVectorOption, utility::options::StringOption, utility::options::StringVectorOption, utility::options::ScalarOption, and utility::options::VectorOption.

virtual std::string const& utility::options::Option::code ( ) const
pure virtual
virtual void utility::options::Option::copy_from ( Option const &  other)
pure virtual
virtual Option& utility::options::Option::deactivate ( )
pure virtual
virtual bool utility::options::Option::default_active ( ) const
pure virtual
virtual bool utility::options::Option::default_inactive ( ) const
pure virtual
virtual Size utility::options::Option::default_size ( ) const
pure virtual
virtual std::string utility::options::Option::default_string ( ) const
pure virtual
virtual std::string const& utility::options::Option::description ( ) const
pure virtual
virtual std::string utility::options::Option::equals_string ( ) const
pure virtual
virtual bool utility::options::Option::has_default ( ) const
pure virtual
virtual std::string const& utility::options::Option::id ( ) const
pure virtual

ID.

Implemented in utility::options::VectorOption_T_< K, T >, utility::options::VectorOption_T_< PathVectorOptionKey, file::PathName >, utility::options::VectorOption_T_< ResidueChainVectorOptionKey, int >, utility::options::VectorOption_T_< IntegerVectorOptionKey, int >, utility::options::VectorOption_T_< RealVectorOptionKey, double >, utility::options::VectorOption_T_< FileVectorOptionKey, file::FileName >, utility::options::VectorOption_T_< StringVectorOptionKey, std::string >, utility::options::VectorOption_T_< AnyVectorOptionKey, T >, utility::options::VectorOption_T_< BooleanVectorOptionKey, bool >, utility::options::ScalarOption_T_< K, T >, utility::options::ScalarOption_T_< RealOptionKey, double >, utility::options::ScalarOption_T_< AnyOptionKey, T >, utility::options::ScalarOption_T_< IntegerOptionKey, int >, utility::options::ScalarOption_T_< StringOptionKey, std::string >, utility::options::ScalarOption_T_< FileOptionKey, file::FileName >, utility::options::ScalarOption_T_< BooleanOptionKey, bool >, and utility::options::ScalarOption_T_< PathOptionKey, file::PathName >.

Referenced by utility::options::OptionCollection::check_key(), utility::options::operator<<(), utility::options::show_accessed_options_T(), utility::options::OptionCollection::show_all(), utility::options::OptionCollection::show_all_hier(), utility::options::OptionCollection::show_inaccessed_user_options(), utility::options::OptionCollection::show_option_help(), utility::options::OptionCollection::show_option_help_hier(), utility::options::OptionCollection::show_table_text(), utility::options::OptionCollection::show_table_Wiki(), utility::options::show_unused_options_T(), and utility::options::OptionCollection::show_user().

virtual std::string const& utility::options::Option::identifier ( ) const
pure virtual
bool utility::options::Option::is_been_accessed ( ) const
inline
virtual bool utility::options::Option::is_cl_value ( std::string const &  value_str) const
pure virtual
Option& utility::options::Option::is_group ( bool  value)
inline
bool utility::options::Option::is_group ( ) const
inline

Is this the synonymous option for an option group (e.g. -in:file:file)

References is_group_.

virtual bool utility::options::Option::is_value ( std::string const &  value_str) const
pure virtual
virtual Key const& utility::options::Option::key ( ) const
pure virtual
virtual bool utility::options::Option::legal ( ) const
pure virtual
virtual void utility::options::Option::legal_check ( ) const
pure virtual
virtual bool utility::options::Option::legal_default ( ) const
pure virtual
virtual void utility::options::Option::legal_default_check ( ) const
pure virtual
virtual bool utility::options::Option::legal_default_report ( ) const
pure virtual
virtual bool utility::options::Option::legal_limits_report ( ) const
pure virtual
virtual bool utility::options::Option::legal_report ( ) const
pure virtual
virtual bool utility::options::Option::legal_size_report ( ) const
pure virtual
virtual bool utility::options::Option::legal_specs_report ( ) const
pure virtual
virtual std::string utility::options::Option::legal_string ( ) const
pure virtual
virtual Size utility::options::Option::n_default_value ( ) const
pure virtual
virtual Size utility::options::Option::n_value ( ) const
pure virtual
virtual std::string const& utility::options::Option::name ( ) const
pure virtual
Option& utility::options::Option::operator= ( Option const &  option)
inlineprotected
virtual std::string utility::options::Option::raw_default_string ( ) const
pure virtual
virtual std::string utility::options::Option::raw_value_string ( ) const
pure virtual
Option& utility::options::Option::restrict_access ( bool  setting)
inline

Restrict direct access to option for general use.

In the past, protocols were able to access the values of options in the option system directly. However this tied protocol behavior tightly to setting specific options on the command line, making it difficult to use Rosetta using other workflows. Now, options are accessed through the resource manager, which has control over which options are passed to which protocols.

basic::resource_manager::ResourceManager::get_instance()->get_option(key);

To incrementally deprectate direct usage of options, an option is set to have restricted access in basic/options/options_rosetta.py

References restricted_access_.

void utility::options::Option::set_accessed ( bool  setting) const
inline
virtual void utility::options::Option::set_cl_value ( std::string const &  value_str)
pure virtual

Set the value of the option from a string from the commandline options.

The difference between set_value() and set_cl_value() is that set_cl_value() assumes that the options have been pre-vectorized by the commandline, and the string is being passed in (multiple) vectorized pieces. set_value(), in contrast, assumes that it's being passed a pre-vectorized string.

Implemented in utility::options::ScalarOption, and utility::options::VectorOption.

virtual void utility::options::Option::set_value ( std::string const &  value_str,
bool  reset = false 
)
pure virtual

Set the value of the option from a string.

The difference between set_value() and set_cl_value() is that set_cl_value() assumes that the options have been pre-vectorized by the commandline, and the string is being passed in (multiple) vectorized pieces. set_value(), in contrast, assumes that it's being passed a pre-vectorized string. For scalar options, set_value() will set the value as-is, including any spaces. For vector options, it will split according to spaces. If reset is false, set_value() will act like multiple instances of the option on the commandline. If reset is true, vector options will be cleared before adding the new items.

Implemented in utility::options::VectorOption, and utility::options::ScalarOption.

virtual std::string const& utility::options::Option::short_description ( ) const
pure virtual
virtual Size utility::options::Option::size ( ) const
pure virtual
virtual std::string utility::options::Option::size_constraint_string ( ) const
pure virtual
virtual void utility::options::Option::specified_check ( ) const
pure virtual
virtual bool utility::options::Option::specified_report ( ) const
pure virtual
virtual Option& utility::options::Option::to_default ( )
pure virtual
virtual std::string utility::options::Option::type_string ( ) const
pure virtual
virtual bool utility::options::Option::user ( ) const
pure virtual
virtual std::string utility::options::Option::value_string ( ) const
pure virtual

Friends And Related Function Documentation

bool operator< ( Option const &  a,
Option const &  b 
)
friend

Option < Option.

Note
Key-based ordering
Needed for use as option in associative containers

Member Data Documentation

bool utility::options::Option::been_accessed_
mutableprivate

flag, will be true if application was trying to anyhow access/check option value. Used to create option usage reports. False by default, any access functions ie: user(), active(), value(), operator()() will set it to true.

Referenced by been_accessed(), is_been_accessed(), operator=(), and set_accessed().

bool utility::options::Option::is_group_
private

Is this a synonymous option for an option group (e.g. -in:file:file)

Referenced by is_group(), and operator=().

bool utility::options::Option::restricted_access_
private

Is directly accessing this option deprecated in favor of accessing it through the resource manager?

Referenced by check_restricted_access(), operator=(), and restrict_access().


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