Quetzal-CoaTL
The Coalescence Template Library
Loading...
Searching...
No Matches
quetzal::format::newick::generator< T, P1, P2, F1, F2, Policy > Class Template Reference

#include <quetzal/io/newick/generator.hpp>

Detailed Description

template<class T, std::predicate< T > P1, std::predicate< T > P2, Formattable< T > F1, Formattable< T > F2, class Policy = PAUP>
class quetzal::format::newick::generator< T, P1, P2, F1, F2, Policy >

Generate the Newick formula from an external (custom) tree class.

Remarks
This is a non-intrusive interface implementation so users can reuse Newick formatting logic and expose the formatting internals to their own Tree class's DFS.

Public Types

using node_type = T
 Type of node being formatted.
 
using formula_type = std::string
 Type of formula being generated.
 
using policy_type = Policy
 Type of formula being generated.
 

Public Member Functions

 generator (P1 has_parent, P2 has_children, F1 label, F2 branch_length, Policy pol={})
 Constructor.
 
auto pre_order ()
 Operation called in the general DFS algorithm to open a parenthesis if node has children to be visited.
 
auto in_order ()
 Operation called in the general DFS algorithm to add a comma between visited nodes.
 
auto post_order ()
 Operation to be passed to a generic DFS algorithm to open a parenthesis if node has children to be visited.
 
bool has_forbidden_characters (const std::string &s) const
 Check if a string contains characters forbidden by the standard.
 
void clear ()
 Clear the formula buffer to refresh the generator.
 
std::string && take_result () const
 Retrieve the formatted string of the given node in the specified format.
 

Static Public Member Functions

static std::string root_branch_length ()
 
static std::string root_branch_length ()
 
static std::string treat_comments (std::string &s)
 
static std::string treat_comments (std::string &s)
 

Member Function Documentation

◆ post_order()

template<class T , std::predicate< T > P1, std::predicate< T > P2, Formattable< T > F1, Formattable< T > F2, class Policy = PAUP>
auto quetzal::format::newick::generator< T, P1, P2, F1, F2, Policy >::post_order ( )
inline

Operation to be passed to a generic DFS algorithm to open a parenthesis if node has children to be visited.

Parameters
nodethe node currently visited

◆ pre_order()

template<class T , std::predicate< T > P1, std::predicate< T > P2, Formattable< T > F1, Formattable< T > F2, class Policy = PAUP>
auto quetzal::format::newick::generator< T, P1, P2, F1, F2, Policy >::pre_order ( )
inline

Operation called in the general DFS algorithm to open a parenthesis if node has children to be visited.

Parameters
nodethe node currently visited

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