Schnek
types.hpp
1 /*
2  * types.hpp
3  *
4  * Created on: 9 Dec 2011
5  * Author: Holger Schmitz
6  * Email: holger@notjustphysics.com
7  *
8  * Copyright 2012 Holger Schmitz
9  *
10  * This file is part of Schnek.
11  *
12  * Schnek is free software: you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation, either version 3 of the License, or
15  * (at your option) any later version.
16  *
17  * Schnek is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with Schnek. If not, see <http://www.gnu.org/licenses/>.
24  *
25  */
26 
27 #ifndef SCHNEK_TYPES_HPP_
28 #define SCHNEK_TYPES_HPP_
29 
30 #include "../exception.hpp"
31 
32 #pragma GCC diagnostic push
33 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
34 
35 #include <boost/variant.hpp>
36 
37 #pragma GCC diagnostic pop
38 
39 #include <memory>
40 
41 namespace schnek {
42 
44 typedef boost::variant<int, double, std::string> ValueVariant;
45 
47 typedef boost::variant<int*, double*, std::string*> ValuePointerVariant;
48 
49 template<typename vtype> class Expression;
50 typedef std::shared_ptr<Expression<int> > pIntExpression;
51 typedef std::shared_ptr<Expression<double> > pFloatExpression;
52 typedef std::shared_ptr<Expression<std::string> > pStringExpression;
53 
55 typedef boost::variant<pIntExpression, pFloatExpression, pStringExpression> ExpressionVariant;
56 
57 
58 
60 {
61  private:
62  std::string message;
63  public:
64  VariableNotFoundException(std::string message_) : SchnekException(), message(message_) {}
65  //VariableNotFoundException() : SchnekException() {}
66  const std::string& getMessage() { return message; }
67 };
68 
70 {
71  private:
72  std::string message;
73  public:
74  EvaluationException(std::string message_) : SchnekException(), message(message_) {}
75  const std::string& getMessage() { return message; }
76 };
77 
79 {
80  std::string varName;
81  public:
82  VariableNotInitialisedException(std::string varName_)
83  : EvaluationException("Variable was not initialised: " + varName_), varName(varName_)
84  {}
85  std::string getVarName() { return varName; }
86 };
87 
88 
90 {
91  public:
93 };
94 
96 {
97  public:
99 };
100 
102 {
103  public:
105 };
106 
108 {
109  public:
111 };
112 
113 
114 } // namespace
115 
116 #endif // SCHNEK_TYPES_HPP_
Definition: types.hpp:107
Definition: types.hpp:89
Definition: types.hpp:95
Definition: algo.hpp:30
Definition: types.hpp:59
Definition: types.hpp:101
Definition: exception.hpp:33
Definition: types.hpp:69