bpp-phyl3 3.0.0
TreeExceptions.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: The Bio++ Development Group
2//
3// SPDX-License-Identifier: CECILL-2.1
4
6
7#include "Node.h"
8#include "Tree.h"
9#include "TreeExceptions.h"
10
11using namespace bpp;
12
13/******************************************************************************/
14
15NodePException::NodePException(const std::string& text, const Node* node) :
16 NodeException(text, node->getId()), node_(node)
17{}
18
19/******************************************************************************/
20
21NodeNotFoundException::NodeNotFoundException(const std::string& text, const std::string& id) :
22 Exception("NodeNotFoundException: " + text + "(" + id + ")"),
23 id_(id) {}
24
25NodeNotFoundException::NodeNotFoundException(const std::string& text, int id) :
26 Exception("NodeNotFoundException: " + text + "(" + TextTools::toString(id) + ")"),
27 id_(TextTools::toString(id)) {}
28
29/******************************************************************************/
30
31TreeException::TreeException(const std::string& text, const Tree* tree) :
32 Exception("TreeException: " + text + (tree != 0 ? "(" + tree->getName() + ")" : "")),
33 tree_(tree) {}
34
35/******************************************************************************/
36
37UnrootedTreeException::UnrootedTreeException(const std::string& text, const Tree* tree) :
38 TreeException("UnrootedTreeException: " + text, tree) {}
39
40/******************************************************************************/
General exception thrown when something is wrong with a particular node.
NodeNotFoundException(const std::string &text, const std::string &id)
Build a new NodeNotFoundException.
The phylogenetic node class.
Definition: Node.h:59
General exception thrown when something wrong happened in a tree.
TreeException(const std::string &text, const Tree *tree=0)
Build a new TreeException.
Interface for phylogenetic tree objects.
Definition: Tree.h:115
UnrootedTreeException(const std::string &text, const Tree *tree=0)
Build a new UnrootedTreeException.
std::string toString(T t)
Defines the basic types of data flow nodes.