Rosetta  2020.46
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes | List of all members
utility::tag::Tag Class Reference

#include <Tag.hh>

Inheritance diagram for utility::tag::Tag:
Inheritance graph
[legend]

Public Types

typedef std::map< std::string,
std::string > 
options_t
 
typedef utility::vector0< TagCOPtags_t
 

Public Member Functions

 ~Tag () override
 Automatically generated virtual destructor for class deriving directly from VirtualBase. More...
 
 Tag ()
 
TagCOP get_self_ptr () const
 self pointers More...
 
TagOP get_self_ptr ()
 
TagCAP get_self_weak_ptr () const
 
TagAP get_self_weak_ptr ()
 
void clear ()
 
size_t size () const
 
void setName (std::string const &name)
 
std::string const & getName () const
 
TagCAP const & getParent () const
 
void addTag (TagOP tag)
 
utility::vector0< TagCOP > const & getTags () const
 
utility::vector0< TagCOP > const & getTags (std::string const &name) const
 
TagCOP const & getTag (std::string const &name) const
 
bool hasTag (std::string const &name) const
 Does the Tag have a specific sub-tag (branch) within (such as a MoveMap, etc.)? More...
 
bool hasOption (std::string const &key) const
 Does the Tag have a specific option? More...
 
template<class T >
void setOption (std::string const &key, T const &value)
 
void setAccessed (std::string const &key) const
 Set the 'accessed' annotation of this option, without bothering to get the value. Used to prevent no-longer relevant options from crashing the XML parsing. More...
 
template<class T >
T getOption (std::string const &key, T const &t_default) const
 Retrieve an option from the Tag with the given key name, using the provided default value (t_default) if the option is not present in the tag. More...
 
template<class T >
T getOption (std::string const &, int const ) const =delete
 Variant that will only be defined for Sizes. More...
 
template<class T >
T getOption (std::string const &key, char const *default_as_string_literal) const =delete
 Variant for the case in which the developer has mistakenly provided a string literal instead of a value of type T. For anything but a boolean or a string type, this produces a compilation error. More...
 
template<class T >
T getOption (std::string const &key) const
 Retrieve an option from the Tag with the given key name. More...
 
options_t const & getOptions () const
 
void setOptions (options_t const &options)
 
void read (std::istream &in)
 
void read (std::string const &tag_string)
 
void write (std::ostream &out, int num_tabs=0) const
 
std::string to_string (int num_tabs=0) const
 returns the string that would be written by write() More...
 
TagCOP const & operator[] (std::string const &key) const
 
Tagoperator= (Tag const &other)
 
void reset_accessed_options () const
 Recursively reset that accessed_options_ variable so that a re-parsing of the tag can identify options that have been given but that have not been read. More...
 
void die_for_unaccessed_options () const
 
void die_for_unaccessed_options_recursively () const
 
TagOP clone () const
 
void set_quote_options (bool const quote_options_val)
 if true, options will be quoted when the tag is outputted if false, options will be left as-is (default) More...
 
template<>
bool getOption (std::string const &key, bool const &t_default) const
 
template<>
bool getOption (std::string const &key, char const *default_as_string_literal) const
 This is for the variant in which someone has specified a default using "true" instead of true, or "false" instead of false. More...
 
template<>
bool getOption (std::string const &key) const
 
template<>
AutoBool getOption (std::string const &key, AutoBool const &t_default) const
 
template<>
AutoBool getOption (std::string const &key, char const *default_as_string_literal) const
 This is for the variant in which someone has specified a default using "true" instead of true, or "false" instead of false. More...
 
template<>
AutoBool getOption (std::string const &key) const
 
template<>
int getOption (std::string const &key, int const default_int) const
 Special-casing for signed ints. More...
 
template<>
int64_t getOption (std::string const &key, int const default_int) const
 Special-casing for int64_t. More...
 
template<>
bool getOption (std::string const &key, bool const &t_default) const
 This is explicit specialization for boolean values to allow for use of "true" "false" etc. in addition to 1 and 0. More...
 
template<>
bool getOption (std::string const &key, char const *default_as_string_literal) const
 This is for the variant in which someone has specified a default using "true" instead of true, or "false" instead of false. More...
 
template<>
bool getOption (std::string const &key) const
 
template<>
AutoBool getOption (std::string const &key, AutoBool const &t_default) const
 
template<>
AutoBool getOption (std::string const &key, char const *default_as_string_literal) const
 This is for the variant in which someone has specified a default using "true" instead of true, or "false" instead of false. More...
 
template<>
AutoBool getOption (std::string const &key) const
 
template<>
std::string getOption (std::string const &key, char const *default_as_string_literal) const
 Special-casing the string literal version for string options. In this case, there shouldn't be an error thrown. A string literal should be allowed to set the default value for a string. More...
 
template<>
platform::Size getOption (std::string const &key, int const default_int) const
 Special-casing to ensure that 0 gets interpreted as Size(0) rather than nullptr. More...
 
template<>
int getOption (std::string const &key, int const default_int) const
 Special-casing for signed ints. More...
 
template<>
int64_t getOption (std::string const &key, int const default_int) const
 Special-casing for int64_t. More...
 
- Public Member Functions inherited from utility::VirtualBase
 VirtualBase ()=default
 Default constructor. More...
 
virtual ~VirtualBase ()=default
 The virtual destructor is one of the main reasons for the VirtualBase class. More...
 
 VirtualBase (VirtualBase const &)=default
 
 VirtualBase (VirtualBase &&)=default
 
VirtualBaseoperator= (VirtualBase const &)=default
 
VirtualBaseoperator= (VirtualBase &&)=default
 

Static Public Member Functions

static TagOP create (std::istream &in)
 
static TagOP create (std::string const &instring)
 

Private Attributes

std::string name_
 
options_t mOptions_
 
options_t accessed_options_
 
tags_t vTags_
 
std::map< std::string, tags_tmvTags_
 
TagCAP parentTag_
 
bool quote_options_
 if true, options will be quoted when the tag is outputted (default) if false, options will be left without quotes More...
 

Static Private Attributes

static utility::vector0
< TagCOP > const 
vEmpty_
 

Member Typedef Documentation

typedef std::map<std::string, std::string > utility::tag::Tag::options_t

Constructor & Destructor Documentation

utility::tag::Tag::~Tag ( )
overridedefault

Automatically generated virtual destructor for class deriving directly from VirtualBase.

Auto-generated virtual destructor

utility::tag::Tag::Tag ( )

Referenced by operator=().

Member Function Documentation

void utility::tag::Tag::addTag ( TagOP  tag)

References get_self_weak_ptr(), mvTags_, and vTags_.

Referenced by operator=().

void utility::tag::Tag::clear ( )

References mOptions_, mvTags_, name_, parentTag_, and vTags_.

Referenced by operator=().

TagOP utility::tag::Tag::clone ( ) const
TagOP utility::tag::Tag::create ( std::istream &  in)
static
TagOP utility::tag::Tag::create ( std::string const &  instring)
static
void utility::tag::Tag::die_for_unaccessed_options ( ) const
void utility::tag::Tag::die_for_unaccessed_options_recursively ( ) const
TagCOP utility::tag::Tag::get_self_ptr ( ) const
inline

self pointers

TagOP utility::tag::Tag::get_self_ptr ( )
inline
TagCAP utility::tag::Tag::get_self_weak_ptr ( ) const
inline

Referenced by addTag().

TagAP utility::tag::Tag::get_self_weak_ptr ( )
inline
std::string const& utility::tag::Tag::getName ( ) const
inline

References name_.

Referenced by add_protocols(), and reverse_convert().

template<class T >
T utility::tag::Tag::getOption ( std::string const &  key,
T const &  t_default 
) const
inline

Retrieve an option from the Tag with the given key name, using the provided default value (t_default) if the option is not present in the tag.

Exceptions
Throwsa utility::excn::EXCN_Msg_Exception if the boost::lexical_cast fails to convert the input type as requested.

References accessed_options_, CREATE_EXCEPTION, basic::options::OptionKeys::cloud::key, and mOptions_.

template<class T >
T utility::tag::Tag::getOption ( std::string const &  ,
int  const 
) const
delete

Variant that will only be defined for Sizes.

Note
Older clang compilers have trouble with the general case being deleted and then specialized cases being defined, even though this is supposed to be supported by the cxx11 standard.
Author
Vikram K. Mulligan (vmull.nosp@m.igan.nosp@m.@flat.nosp@m.iron.nosp@m.insti.nosp@m.tute.nosp@m..org).
template<class T >
T utility::tag::Tag::getOption ( std::string const &  key,
char const *  default_as_string_literal 
) const
delete

Variant for the case in which the developer has mistakenly provided a string literal instead of a value of type T. For anything but a boolean or a string type, this produces a compilation error.

Note
Older clang compilers have trouble with the general case being deleted and then specialized cases being defined, even though this is supposed to be supported by the cxx11 standard.
Author
Vikram K. Mulligan (vmull.nosp@m.igan.nosp@m.@flat.nosp@m.iron.nosp@m.insti.nosp@m.tute.nosp@m..org).
template<class T >
T utility::tag::Tag::getOption ( std::string const &  key) const
inline

Retrieve an option from the Tag with the given key name.

Exceptions
Throwsa utility::excn::EXCN_Msg_Exception if the an option with the given key is not present, or if the boost::lexical_cast fails to convert the input type as requested.

References accessed_options_, CREATE_EXCEPTION, basic::options::OptionKeys::cloud::key, mOptions_, and pyrosetta.distributed.cluster.exceptions::T.

template<>
bool utility::tag::Tag::getOption ( std::string const &  key,
bool const &  t_default 
) const

This is explicit specialization for boolean values to allow for use of "true" "false" etc. in addition to 1 and 0.

template<>
bool utility::tag::Tag::getOption ( std::string const &  key,
char const *  default_as_string_literal 
) const

This is for the variant in which someone has specified a default using "true" instead of true, or "false" instead of false.

Author
Vikram K. Mulligan (vmull.nosp@m.igan.nosp@m.@flat.nosp@m.iron.nosp@m.insti.nosp@m.tute.nosp@m..org).
template<>
bool utility::tag::Tag::getOption ( std::string const &  key) const
template<>
AutoBool utility::tag::Tag::getOption ( std::string const &  key,
AutoBool const &  t_default 
) const
template<>
AutoBool utility::tag::Tag::getOption ( std::string const &  key,
char const *  default_as_string_literal 
) const

This is for the variant in which someone has specified a default using "true" instead of true, or "false" instead of false.

Author
Vikram K. Mulligan (vmull.nosp@m.igan.nosp@m.@flat.nosp@m.iron.nosp@m.insti.nosp@m.tute.nosp@m..org).
template<>
AutoBool utility::tag::Tag::getOption ( std::string const &  key) const
template<>
std::string utility::tag::Tag::getOption ( std::string const &  key,
char const *  default_as_string_literal 
) const

Special-casing the string literal version for string options. In this case, there shouldn't be an error thrown. A string literal should be allowed to set the default value for a string.

Author
Vikram K. Mulligan (vmull.nosp@m.igan.nosp@m.@flat.nosp@m.iron.nosp@m.insti.nosp@m.tute.nosp@m..org).
template<>
bool utility::tag::Tag::getOption ( std::string const &  key,
bool const &  t_default 
) const

This is explicit specialization for boolean values to allow for use of "true" "false" etc. in addition to 1 and 0

Exceptions
Throwsa utility::excn::EXCN_Msg_Exception if the option is proviced, but the string that's given is not a valid true/false string (either "true", "false", "1" or "0").

References CREATE_EXCEPTION, utility::is_false_string(), utility::is_true_string(), and basic::options::OptionKeys::cloud::key.

template<>
platform::Size utility::tag::Tag::getOption ( std::string const &  key,
int const  default_int 
) const

Special-casing to ensure that 0 gets interpreted as Size(0) rather than nullptr.

Author
Vikram K. Mulligan (vmull.nosp@m.igan.nosp@m.@flat.nosp@m.iron.nosp@m.insti.nosp@m.tute.nosp@m..org).
template<>
bool utility::tag::Tag::getOption ( std::string const &  key,
char const *  default_as_string_literal 
) const

This is for the variant in which someone has specified a default using "true" instead of true, or "false" instead of false.

References CREATE_EXCEPTION, utility::is_false_string(), utility::is_true_string(), basic::options::OptionKeys::cloud::key, and runtime_assert_string_msg.

template<>
int utility::tag::Tag::getOption ( std::string const &  key,
int const  default_int 
) const

Special-casing for signed ints.

Author
Vikram K. Mulligan (vmull.nosp@m.igan.nosp@m.@flat.nosp@m.iron.nosp@m.insti.nosp@m.tute.nosp@m..org).
template<>
int64_t utility::tag::Tag::getOption ( std::string const &  key,
int const  default_int 
) const

Special-casing for int64_t.

Author
Vikram K. Mulligan (vmull.nosp@m.igan.nosp@m.@flat.nosp@m.iron.nosp@m.insti.nosp@m.tute.nosp@m..org).
template<>
bool utility::tag::Tag::getOption ( std::string const &  key) const
Exceptions
Throwsa utility::excn::EXCN_Msg_Exception if none of the accepted boolean strings is provided.

References CREATE_EXCEPTION, utility::is_false_string(), utility::is_true_string(), and basic::options::OptionKeys::cloud::key.

template<>
AutoBool utility::tag::Tag::getOption ( std::string const &  key,
AutoBool const &  t_default 
) const
template<>
AutoBool utility::tag::Tag::getOption ( std::string const &  key,
char const *  default_as_string_literal 
) const

This is for the variant in which someone has specified a default using "true" instead of true, or "false" instead of false.

References utility::tag::Auto, CREATE_EXCEPTION, utility::tag::False, utility::is_false_string(), utility::is_true_string(), basic::options::OptionKeys::cloud::key, runtime_assert_string_msg, utility::tag::True, and utility::upper().

template<>
AutoBool utility::tag::Tag::getOption ( std::string const &  key) const
Exceptions
Throwsa utility::excn::EXCN_Msg_Exception if none of the accepted boolean strings is provided.

References utility::tag::Auto, CREATE_EXCEPTION, utility::tag::False, utility::is_false_string(), utility::is_true_string(), basic::options::OptionKeys::cloud::key, utility::tag::True, and utility::upper().

template<>
int utility::tag::Tag::getOption ( std::string const &  key,
int const  default_int 
) const
template<>
int64_t utility::tag::Tag::getOption ( std::string const &  key,
int const  default_int 
) const
Tag::options_t const & utility::tag::Tag::getOptions ( ) const

References mOptions_.

TagCAP const& utility::tag::Tag::getParent ( ) const
inline

References parentTag_.

TagCOP const & utility::tag::Tag::getTag ( std::string const &  name) const
utility::vector0< TagCOP > const & utility::tag::Tag::getTags ( ) const

References vTags_.

Referenced by add_protocols(), getTag(), hasTag(), and reverse_convert().

utility::vector0< TagCOP > const & utility::tag::Tag::getTags ( std::string const &  name) const

References mvTags_, and vEmpty_.

bool utility::tag::Tag::hasOption ( std::string const &  key) const

Does the Tag have a specific option?

References mOptions_.

bool utility::tag::Tag::hasTag ( std::string const &  name) const

Does the Tag have a specific sub-tag (branch) within (such as a MoveMap, etc.)?

References getTags().

Tag & utility::tag::Tag::operator= ( Tag const &  other)

References addTag(), clear(), mOptions_, name_, Tag(), tag, and vTags_.

TagCOP const & utility::tag::Tag::operator[] ( std::string const &  key) const

References getTag().

void utility::tag::Tag::read ( std::istream &  in)

References ObjexxFCL::read().

void utility::tag::Tag::read ( std::string const &  tag_string)
void utility::tag::Tag::reset_accessed_options ( ) const

Recursively reset that accessed_options_ variable so that a re-parsing of the tag can identify options that have been given but that have not been read.

References accessed_options_, and vTags_.

void utility::tag::Tag::set_quote_options ( bool const  quote_options_val)

if true, options will be quoted when the tag is outputted if false, options will be left as-is (default)

Parameters
[in]quote_options_valWhether or not option values should be quoted. Default=false
[in]quote_options_valWhether or not option values should be quoted. Default=true
void utility::tag::Tag::setAccessed ( std::string const &  key) const
inline

Set the 'accessed' annotation of this option, without bothering to get the value. Used to prevent no-longer relevant options from crashing the XML parsing.

References accessed_options_, and basic::options::OptionKeys::cloud::key.

void utility::tag::Tag::setName ( std::string const &  name)

References name, and name_.

template<class T >
void utility::tag::Tag::setOption ( std::string const &  key,
T const &  value 
)
inline
void utility::tag::Tag::setOptions ( options_t const &  options)

References accessed_options_, mOptions_, and options.

size_t utility::tag::Tag::size ( ) const

References vTags_.

std::string utility::tag::Tag::to_string ( int  num_tabs = 0) const

returns the string that would be written by write()

References basic::options::OptionKeys::mh::match::ss, and write().

void utility::tag::Tag::write ( std::ostream &  out,
int  num_tabs = 0 
) const

Member Data Documentation

options_t utility::tag::Tag::accessed_options_
mutableprivate
options_t utility::tag::Tag::mOptions_
private
std::map<std::string,tags_t> utility::tag::Tag::mvTags_
private

Referenced by addTag(), clear(), and getTags().

std::string utility::tag::Tag::name_
private
TagCAP utility::tag::Tag::parentTag_
private

Referenced by clear(), and getParent().

bool utility::tag::Tag::quote_options_
private

if true, options will be quoted when the tag is outputted (default) if false, options will be left without quotes

Referenced by write().

utility::vector0< TagCOP > const utility::tag::Tag::vEmpty_
staticprivate

Referenced by getTags().

tags_t utility::tag::Tag::vTags_
private

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