bpp-phyl  2.2.0
TreeExceptions.cpp
Go to the documentation of this file.
1 //
2 // File: TreeExceptions.cpp
3 // Created by: Julien Dutheil
4 // Created on: Mon Nov 3 17:04:46 2003
5 //
6 
7 /*
8  Copyright or © or Copr. CNRS, (November 16, 2004)
9 
10  Julien.Dutheil@univ-montp2.fr
11 
12  This software is a computer program whose purpose is to provide classes
13  for phylogenetic data analysis.
14 
15  This software is governed by the CeCILL license under French law and
16  abiding by the rules of distribution of free software. You can use,
17  modify and/ or redistribute the software under the terms of the CeCILL
18  license as circulated by CEA, CNRS and INRIA at the following URL
19  "http://www.cecill.info".
20 
21  As a counterpart to the access to the source code and rights to copy,
22  modify and redistribute granted by the license, users are provided only
23  with a limited warranty and the software's author, the holder of the
24  economic rights, and the successive licensors have only limited
25  liability.
26 
27  In this respect, the user's attention is drawn to the risks associated
28  with loading, using, modifying and/or developing or reproducing the
29  software by the user in light of its specific status of free software,
30  that may mean that it is complicated to manipulate, and that also
31  therefore means that it is reserved for developers and experienced
32  professionals having in-depth computer knowledge. Users are therefore
33  encouraged to load and test the software's suitability as regards their
34  requirements in conditions enabling the security of their systems and/or
35  data to be ensured and, more generally, to use and operate it in the
36  same conditions as regards security.
37 
38  The fact that you are presently reading this means that you have had
39  knowledge of the CeCILL license and that you accept its terms.
40  */
41 
42 #include "TreeExceptions.h"
43 #include "Node.h"
44 #include "Tree.h"
45 
46 #include <Bpp/Text/TextTools.h>
47 
48 using namespace bpp;
49 
50 /******************************************************************************/
51 
52 NodePException::NodePException(const std::string& text, const Node* node) :
53  NodeException(text, node->getId()), node_(node)
54 {}
55 
56 /******************************************************************************/
57 
58 NodeNotFoundException::NodeNotFoundException(const std::string& text, const std::string& id) :
59  Exception("NodeNotFoundException: " + text + "(" + id + ")"),
60  id_(id) {}
61 
62 NodeNotFoundException::NodeNotFoundException(const std::string& text, int id) :
63  Exception("NodeNotFoundException: " + text + "(" + TextTools::toString(id) + ")"),
64  id_(TextTools::toString(id)) {}
65 
66 /******************************************************************************/
67 
68 TreeException::TreeException(const std::string& text, const Tree* tree) :
69  Exception("TreeException: " + text + (tree != 0 ? "(" + tree->getName() + ")" : "")),
70  tree_(tree) {}
71 
72 /******************************************************************************/
73 
74 UnrootedTreeException::UnrootedTreeException(const std::string& text, const Tree* tree) :
75  TreeException("UnrootedTreeException: " + text, tree) {}
76 
77 /******************************************************************************/
78 
Interface for phylogenetic tree objects.
Definition: Tree.h:148
General exception thrown when something wrong happened in a tree.
UnrootedTreeException(const std::string &text, const Tree *tree=0)
Build a new UnrootedTreeException.
The phylogenetic node class.
Definition: Node.h:90
NodeNotFoundException(const std::string &text, const std::string &id)
Build a new NodeNotFoundException.
TreeException(const std::string &text, const Tree *tree=0)
Build a new TreeException.
General exception thrown when something is wrong with a particular node.
NodePException(const std::string &text, const Node *node=0)
Build a new NodePException.