Adaptagrams
exceptions.h
1 /*
2  * vim: ts=4 sw=4 et tw=0 wm=0
3  *
4  * libcola - A library providing force-directed network layout using the
5  * stress-majorization method subject to separation constraints.
6  *
7  * Copyright (C) 2008 Monash University
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  * See the file LICENSE.LGPL distributed with the library.
14  *
15  * This library is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18  *
19 */
20 
21 #ifndef SEEN_LIBCOLA_EXCEPTIONS_H
22 #define SEEN_LIBCOLA_EXCEPTIONS_H
23 #include <string>
24 #include <sstream>
25 
26 namespace cola {
27 class CompoundConstraint;
28 
29 struct InvalidConstraint {
30  InvalidConstraint(CompoundConstraint *c):constraint(c) {}
31  CompoundConstraint *constraint;
32 };
33 
34 
35 class InvalidVariableIndexException
36 {
37 public:
38  InvalidVariableIndexException(CompoundConstraint *c, unsigned i)
39  : constraint(c),
40  index(i)
41  { }
42  std::string what() const throw()
43  {
44  std::stringstream s;
45  s << "Invalid variable index: " << index;
46  return s.str();
47  }
48  CompoundConstraint *constraint;
49  unsigned index;
50 };
51 
52 
53 } // namespace cola
54 #endif //SEEN_LIBCOLA_EXCEPTIONS_H
libcola: Force-directed network layout subject to separation constraints library. ...
Definition: box.cpp:25