|
A library for working with phylogenetic and population genetic data.
v0.32.0
|
|
Go to the documentation of this file. 1 #ifndef GENESIS_UTILS_FORMATS_NEXUS_TREES_H_
2 #define GENESIS_UTILS_FORMATS_NEXUS_TREES_H_
99 swap( entries_, other.entries_ );
126 return entries_.empty();
131 return entries_.size();
136 return entries_.end() != std::find_if(
139 [&name] (
Entry const& entry) {
140 return entry.name == name;
160 return entries_.cbegin();
165 return entries_.cend();
174 void add_tree( std::string
const& name, std::string
const& tree )
177 throw std::invalid_argument(
178 "Tree with name '" + name +
"' already exists in this tree block."
187 entries_.push_back({ name, std::vector<std::string>{}, tree });
195 [&name] (
Entry const& entry) {
196 return entry.
name == name;
219 for(
auto& entry : entries_ ) {
220 os <<
" TREE " << entry.name <<
" = ";
221 for(
auto& prop : entry.properties ) {
222 os <<
"[" << prop <<
"] ";
224 os << entry.tree <<
"\n";
250 #endif // include guard
Provides some valuable algorithms that are not part of the C++ 11 STL.
const_iterator end() const
std::vector< Entry > container
std::string block_name() const override
NexusTrees & operator=(NexusTrees const &)=default
const_iterator begin() const
bool has_tree(std::string const &name) const
void swap(Color &lhs, Color &rhs)
void erase_if(Container &c, UnaryPredicate p)
Erases all elements from the container that satisfy a given predicate. An element is erased,...
void erase_tree(std::string const &name)
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
virtual ~NexusTrees() override=default
void swap(NexusTrees &lhs, NexusTrees &rhs)
container::const_iterator const_iterator
void to_stream(std::ostream &os) const override
std::vector< std::string > properties
void swap(NexusTrees &other)
void add_tree(std::string const &name, std::string const &tree)