Rosetta  2020.46
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Enumerations | Functions
utility::xsd_util Namespace Reference

Enumerations

enum  RosettaModuleType {
  RMT_mover =1, RMT_filter, RMT_task_operation, RMT_res_lvl_task_operation,
  RMT_residue_selector, RMT_sub_element, RMT_invalid, RMT_end_of_list = RMT_invalid
}
 Enum for the types of Rosetta modules covered by the XSD that a UI would want to be able to provide an interface for. More...
 
enum  RosettaModuleOptionType {
  RMOT_rosetta_bool =1, RMOT_integer, RMOT_nonnegative_integer, RMOT_real,
  RMOT_task_operation, RMOT_task_operation_list, RMOT_residue_selector, RMOT_residue_selector_list,
  RMOT_general_string, RMOT_invalid, RMOT_end_of_list = RMOT_invalid
}
 Enum for the types of options (boolean, task operation, string, integer, etc.) that a Rosetta module might have. More...
 

Functions

void generate_tag_given_options (std::stringstream &stringstream_out, std::string const &tag_name, utility::vector1< std::pair< std::string, std::string > > const &option_list, bool const terminal_slash, bool const triangular_brackets)
 Given the name of a tag (tag_name) and a list of options (as pairs of option name, option value), generate the tag. More...
 
std::string get_module_type_as_it_appears_in_xsd (RosettaModuleType const module_type)
 Given a type of module, get its name as it appears in the RosettaScripts xsd. More...
 
std::string get_specific_module_name_as_it_appears_in_xsd (std::string const &module_name, RosettaModuleType const module_type)
 Given a name of a specific module (e.g. "FastDesign") of a particular type (e.g. mover), return the name as it appears in the XSD (e.g. "mover_FastDesign_type"). More...
 
RosettaModuleOptionType get_option_type_from_name (std::string const &, std::string const &type)
 Given an option type that appears in the xsd (e.g. "xs:string", "rosetta_bool", etc.), convert it to an enum. More...
 
void get_rosetta_module_options_from_xsd (std::string const &xsd, RosettaModuleType const module_type, std::string const &module_name, std::string &module_description_out, utility::vector1< std::tuple< RosettaModuleOptionType, std::string, std::string > > &option_list_out, utility::vector1< std::tuple< std::string, std::string, platform::Size, platform::Size > > &sub_element_information_out)
 Given an xsd for RosettaScripts and the name of a module of a given type, get its first-level child options (as a vector of pairs of <RosettaModuleOptionType, option name>). More...
 
bool recursively_find_module_in_xsd (xmlNode *const parent_node, std::string const &module_name, xmlNode **module_node)
 Given an xsd for Rosettascripts and the name of a particular ComplexType element or sub-element, get a pointer to its XMLnode. More...
 
void get_choice_min_and_max (xmlNode *choice_node, platform::Size &choice_min, platform::Size &choice_max)
 Given a "xs:choice" element in an XSD, get the minOccurs and maxOccurs options and store them in unsigned integers. More...
 
void get_mover_names_from_xsd (std::string const &xsd, utility::vector1< std::string > &mover_names_out)
 Given an xsd for RosettaScripts, get all of the names of mover elements. More...
 
void get_filter_names_from_xsd (std::string const &xsd, utility::vector1< std::string > &filter_names_out)
 Given an xsd for RosettaScripts, get all of the names of filter elements. More...
 
void get_task_operation_names_from_xsd (std::string const &xsd, utility::vector1< std::string > &taskop_names_out)
 Given an xsd for RosettaScripts, get all of the names of task operation elements. More...
 
void get_residue_level_task_operation_names_from_xsd (std::string const &xsd, utility::vector1< std::string > &rltaskop_names_out)
 Given an xsd for RosettaScripts, get all of the names of residue-level task operation elements. More...
 
void get_residue_selector_names_from_xsd (std::string const &xsd, utility::vector1< std::string > &residue_selector_names_out)
 Given an xsd for RosettaScripts, get all of the names of residue selector elements. More...
 
void get_module_names_from_xsd (std::string const &xsd, std::string const &module_name, utility::vector1< std::string > &names_out)
 Given an xsd for RosettaScripts, get all of the names of a particular type of Rosetta module. More...
 
std::string get_node_option (xmlNode *node, std::string const &optionname)
 Given a node in an XML tree, get the value of an option. More...
 
std::string generate_human_readable_summary (std::string const &xsd, std::string const &component_name, std::string const &component_type)
 Go through an XSD and generate a human-readable description of a particular Rosetta module. More...
 
void generate_human_readable_recursive (xmlNode *rootnode, std::stringstream &description, std::stringstream &tags, std::stringstream &options, platform::Size const level, std::string const &complextype, std::string const &tag_name_to_print)
 Go through an XSD XML and generate a human-readable version, recursively. More...
 
std::string get_tag_name (xmlNode *node)
 Given a node in an XML tree representing a tag, get the string that starts the tag. (e.g. "DeclareBond" in "<DeclareBond .... />"). More...
 
void output_all_tag_options (xmlNode *node, std::string const &tagname, platform::Size const level, std::stringstream &tags, std::stringstream &options)
 Given a node in an XML tree representing a tag, get all options in that tag, write their descriptions to "options", and write their names and types to "tags". More...
 
void generate_human_readable_documentation (xmlNode *parent_node, std::stringstream &outstream)
 Given a documentation node in an XML tree, parse out the documentation and print it. More...
 
std::string get_type_name (std::string const &xsd_type)
 Given an XSD simple type (e.g. "rosetta_bool"), return a more human-readable type (e.g. "bool"). More...
 

Enumeration Type Documentation

Enum for the types of options (boolean, task operation, string, integer, etc.) that a Rosetta module might have.

This is provided for the convenience of user interface code that will want to know whether a particular option is a boolean, an integer, etc. It should NOT be confused with the enums in XMLSchemaGeneration.hh and XMLSchemaGeneration.fwd.hh, which are a more comprehensive and detailed list of the possible types of data.

Author
Vikram K. Mulligan (vmull.nosp@m.ig@u.nosp@m.w.edu).
Enumerator
RMOT_rosetta_bool 
RMOT_integer 
RMOT_nonnegative_integer 
RMOT_real 
RMOT_task_operation 
RMOT_task_operation_list 
RMOT_residue_selector 
RMOT_residue_selector_list 
RMOT_general_string 
RMOT_invalid 
RMOT_end_of_list 

Enum for the types of Rosetta modules covered by the XSD that a UI would want to be able to provide an interface for.

If you add to this list, update the get_module_type_as_it_appears_in_xsd() function and the get_specific_module_name_as_it_appears_in_xsd() function.

Author
Vikram K. Mulligan (vmull.nosp@m.ig@u.nosp@m.w.edu).
Enumerator
RMT_mover 
RMT_filter 
RMT_task_operation 
RMT_res_lvl_task_operation 
RMT_residue_selector 
RMT_sub_element 
RMT_invalid 
RMT_end_of_list 

Function Documentation

void utility::xsd_util::generate_human_readable_documentation ( xmlNode *  doc_node,
std::stringstream &  outstream 
)

Given a documentation node in an XML tree, parse out the documentation and print it.

Author
Vikram K. Mulligan (vmull.nosp@m.ig@u.nosp@m.w.edu)

References utility::strip().

Referenced by generate_human_readable_recursive(), get_rosetta_module_options_from_xsd(), and output_all_tag_options().

void utility::xsd_util::generate_human_readable_recursive ( xmlNode *  rootnode,
std::stringstream &  description,
std::stringstream &  tags,
std::stringstream &  options,
platform::Size const  level,
std::string const &  complextype,
std::string const &  tag_name_to_print 
)
std::string utility::xsd_util::generate_human_readable_summary ( std::string const &  xsd,
std::string const &  component_name,
std::string const &  component_type 
)

Go through an XSD and generate a human-readable description of a particular Rosetta module.

Calls generate_human_readable_recursive.

Note
If component_name and component_type are provided, then summary information is only returned for that particular object type. For example, component_name="DeclareBond" and component_type="mover" would return information on the DeclareBond mover. Also note, this function uses raw pointers, unfortunately – the libxml2 functions that I'm calling require it. As such, no premature return statements should be added prior to the xmlFreeDoc and xmlCleanupParser statements at the end of the function.
Author
Vikram K. Mulligan (vmull.nosp@m.ig@u.nosp@m.w.edu).

References generate_human_readable_recursive(), options, and basic::options::OptionKeys::in::file::tags.

Referenced by utility::tag::XMLSchemaDefinition::human_readable_summary().

void utility::xsd_util::generate_tag_given_options ( std::stringstream &  stringstream_out,
std::string const &  tag_name,
utility::vector1< std::pair< std::string, std::string > > const &  option_list,
bool const  terminal_slash,
bool const  triangular_brackets 
)

Given the name of a tag (tag_name) and a list of options (as pairs of option name, option value), generate the tag.

If terminal_slash is true, a slash is added at the end of the tag. If triangular_brackets is true, everything is enclosed in triangular brackets.

void utility::xsd_util::get_choice_min_and_max ( xmlNode *  choice_node,
platform::Size choice_min,
platform::Size choice_max 
)

Given a "xs:choice" element in an XSD, get the minOccurs and maxOccurs options and store them in unsigned integers.

Stores 0 for "unbounded" or for anything that can't be interpreted as a nonnegative integer.

Parameters
[in]choice_nodeA pointer ot an xmlNode representing an <xs:choice ... /> tag.
[out]choice_minThe value parsed from minOccurs.
[out]choice_maxThe value parsed from maxOccurs.

References get_node_option().

Referenced by get_rosetta_module_options_from_xsd().

void utility::xsd_util::get_filter_names_from_xsd ( std::string const &  xsd,
utility::vector1< std::string > &  filter_names_out 
)

Given an xsd for RosettaScripts, get all of the names of filter elements.

The filter_names_out vector is cleared and repopulated by this operation.

Author
Vikram K. Mulligan (vmull.nosp@m.ig@u.nosp@m.w.edu).

References get_module_names_from_xsd().

void utility::xsd_util::get_module_names_from_xsd ( std::string const &  xsd,
std::string const &  module_name,
utility::vector1< std::string > &  names_out 
)

Given an xsd for RosettaScripts, get all of the names of a particular type of Rosetta module.

The names_out vector is cleared and repopulated by this operation.

Author
Vikram K. Mulligan (vmull.nosp@m.ig@u.nosp@m.w.edu).

References get_node_option().

Referenced by get_filter_names_from_xsd(), get_mover_names_from_xsd(), get_residue_level_task_operation_names_from_xsd(), get_residue_selector_names_from_xsd(), and get_task_operation_names_from_xsd().

std::string utility::xsd_util::get_module_type_as_it_appears_in_xsd ( RosettaModuleType const  module_type)

Given a type of module, get its name as it appears in the RosettaScripts xsd.

Given a type of module (mover, filter, etc.), get its name as it appears in the RosettaScripts xsd (e.g. "mover", "filter", etc.).

Author
Vikram K. Mulligan (vmull.nosp@m.ig@u.nosp@m.w.edu).

References RMT_filter, RMT_mover, RMT_res_lvl_task_operation, RMT_residue_selector, RMT_sub_element, and RMT_task_operation.

void utility::xsd_util::get_mover_names_from_xsd ( std::string const &  xsd,
utility::vector1< std::string > &  mover_names_out 
)

Given an xsd for RosettaScripts, get all of the names of mover elements.

The mover_names_out vector is cleared and repopulated by this operation.

Author
Vikram K. Mulligan (vmull.nosp@m.ig@u.nosp@m.w.edu).

References get_module_names_from_xsd().

std::string utility::xsd_util::get_node_option ( xmlNode *  node,
std::string const &  optionname 
)
RosettaModuleOptionType utility::xsd_util::get_option_type_from_name ( std::string const &  ,
std::string const &  type 
)

Given an option type that appears in the xsd (e.g. "xs:string", "rosetta_bool", etc.), convert it to an enum.

Note that for certain string types, this function looks at the specific name to determine whether this is a task operation/residue selector list.

Author
Vikram K. Mulligan (vmull.nosp@m.ig@u.nosp@m.w.edu).

References RMOT_general_string, RMOT_integer, RMOT_nonnegative_integer, RMOT_real, and RMOT_rosetta_bool.

Referenced by get_rosetta_module_options_from_xsd().

void utility::xsd_util::get_residue_level_task_operation_names_from_xsd ( std::string const &  xsd,
utility::vector1< std::string > &  rltaskop_names_out 
)

Given an xsd for RosettaScripts, get all of the names of residue-level task operation elements.

The rltaskop_names_out vector is cleared and repopulated by this operation.

Author
Vikram K. Mulligan (vmull.nosp@m.ig@u.nosp@m.w.edu).

References get_module_names_from_xsd().

void utility::xsd_util::get_residue_selector_names_from_xsd ( std::string const &  xsd,
utility::vector1< std::string > &  residue_selector_names_out 
)

Given an xsd for RosettaScripts, get all of the names of residue selector elements.

The residue_selector_names_out vector is cleared and repopulated by this operation.

Author
Vikram K. Mulligan (vmull.nosp@m.ig@u.nosp@m.w.edu).

References get_module_names_from_xsd().

void utility::xsd_util::get_rosetta_module_options_from_xsd ( std::string const &  xsd,
RosettaModuleType const  module_type,
std::string const &  module_name,
std::string &  module_description_out,
utility::vector1< std::tuple< RosettaModuleOptionType, std::string, std::string > > &  option_list_out,
utility::vector1< std::tuple< std::string, std::string, platform::Size, platform::Size > > &  sub_element_information_out 
)

Given an xsd for RosettaScripts and the name of a module of a given type, get its first-level child options (as a vector of pairs of <RosettaModuleOptionType, option name>).

The option_list_out vector is cleared and repopulated by this operation. The tuple is (type, name, description). If module_type is utility::xsd_util::RMT_sub_element, then we search for the sub-element complextype by its complextype name.

Author
Vikram K. Mulligan (vmull.nosp@m.ig@u.nosp@m.w.edu).

References utility::tag::element_type_name(), generate_human_readable_documentation(), get_choice_min_and_max(), get_node_option(), get_option_type_from_name(), get_specific_module_name_as_it_appears_in_xsd(), recursively_find_module_in_xsd(), RMT_sub_element, and runtime_assert_string_msg.

std::string utility::xsd_util::get_specific_module_name_as_it_appears_in_xsd ( std::string const &  module_name,
RosettaModuleType const  module_type 
)

Given a name of a specific module (e.g. "FastDesign") of a particular type (e.g. mover), return the name as it appears in the XSD (e.g. "mover_FastDesign_type").

Author
Vikram K. Mulligan (vmull.nosp@m.ig@u.nosp@m.w.edu).

References RMT_filter, RMT_mover, RMT_res_lvl_task_operation, RMT_residue_selector, RMT_sub_element, and RMT_task_operation.

Referenced by get_rosetta_module_options_from_xsd().

std::string utility::xsd_util::get_tag_name ( xmlNode *  node)

Given a node in an XML tree representing a tag, get the string that starts the tag. (e.g. "DeclareBond" in "<DeclareBond .... />").

From a string of format "*_name_type" or "*_name", extracts out "name".

Author
Vikram K. Mulligan (vmull.nosp@m.ig@u.nosp@m.w.edu)
Vikram K. Mulligan (vmull.nosp@m.ig@u.nosp@m.w.edu)

References debug_assert, get_node_option(), and utility::string_split().

Referenced by generate_human_readable_recursive().

void utility::xsd_util::get_task_operation_names_from_xsd ( std::string const &  xsd,
utility::vector1< std::string > &  taskop_names_out 
)

Given an xsd for RosettaScripts, get all of the names of task operation elements.

The taskop_names_out vector is cleared and repopulated by this operation.

Author
Vikram K. Mulligan (vmull.nosp@m.ig@u.nosp@m.w.edu).

References get_module_names_from_xsd().

std::string utility::xsd_util::get_type_name ( std::string const &  xsd_type)

Given an XSD simple type (e.g. "rosetta_bool"), return a more human-readable type (e.g. "bool").

Author
Vikram K. Mulligan (vmull.nosp@m.ig@u.nosp@m.w.edu)

Referenced by output_all_tag_options().

void utility::xsd_util::output_all_tag_options ( xmlNode *  node,
std::string const &  tagname,
platform::Size const  level,
std::stringstream &  tags,
std::stringstream &  options 
)

Given a node in an XML tree representing a tag, get all options in that tag, write their descriptions to "options", and write their names and types to "tags".

Heads the section in "options" with the tag name.

Author
Vikram K. Mulligan (vmull.nosp@m.ig@u.nosp@m.w.edu)

References generate_human_readable_documentation(), get_node_option(), get_type_name(), basic::options::OptionKeys::out::level, name, and DRRAFTER::type.

Referenced by generate_human_readable_recursive().

bool utility::xsd_util::recursively_find_module_in_xsd ( xmlNode *const  parent_node,
std::string const &  module_name,
xmlNode **  module_node 
)

Given an xsd for Rosettascripts and the name of a particular ComplexType element or sub-element, get a pointer to its XMLnode.

The module_node pointer is set by this operation. Returns "false" if not found. No recusion limit.

Note
Yes, this accepts a pointer to a pointer. The address stored in the pointer is modified by this function.

References get_node_option().

Referenced by get_rosetta_module_options_from_xsd().