Chemical Data Processing Library C++ API - Version 1.1.1
Expression.hpp
Go to the documentation of this file.
1 /*
2  * Expression.hpp
3  *
4  * Copyright (C) 2003 Thomas Seidel <thomas.seidel@univie.ac.at>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this library; see the file COPYING. If not, write to
18  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21 
27 #ifndef CDPL_MATH_EXPRESSION_HPP
28 #define CDPL_MATH_EXPRESSION_HPP
29 
30 
31 namespace CDPL
32 {
33 
34  namespace Math
35  {
36 
37  template <typename E>
38  class Expression
39  {
40 
41  public:
42  typedef E ExpressionType;
43 
44  protected:
47 
48  private:
49  const Expression& operator=(const Expression&);
50  };
51 
52  template <typename E>
53  class VectorExpression : public Expression<E>
54  {
55 
56  public:
57  typedef E ExpressionType;
58 
59  const ExpressionType& operator()() const
60  {
61  return *static_cast<const ExpressionType*>(this);
62  }
63 
65  {
66  return *static_cast<ExpressionType*>(this);
67  }
68 
69  protected:
72  };
73 
74  template <typename E>
75  class MatrixExpression : public Expression<E>
76  {
77 
78  public:
79  typedef E ExpressionType;
80 
81  const ExpressionType& operator()() const
82  {
83  return *static_cast<const ExpressionType*>(this);
84  }
85 
87  {
88  return *static_cast<ExpressionType*>(this);
89  }
90 
91  protected:
94  };
95 
96  template <typename E>
97  class QuaternionExpression : public Expression<E>
98  {
99 
100  public:
101  typedef E ExpressionType;
102 
103  const ExpressionType& operator()() const
104  {
105  return *static_cast<const ExpressionType*>(this);
106  }
107 
109  {
110  return *static_cast<ExpressionType*>(this);
111  }
112 
113  protected:
116  };
117 
118  template <typename E>
119  class GridExpression : public Expression<E>
120  {
121 
122  public:
123  typedef E ExpressionType;
124 
125  const ExpressionType& operator()() const
126  {
127  return *static_cast<const ExpressionType*>(this);
128  }
129 
131  {
132  return *static_cast<ExpressionType*>(this);
133  }
134 
135  protected:
138  };
139 
140  template <typename C>
142  {
143 
144  public:
145  typedef C ContainerType;
146 
147  const ContainerType& operator()() const
148  {
149  return *static_cast<const ContainerType*>(this);
150  }
151 
153  {
154  return *static_cast<ContainerType*>(this);
155  }
156 
157  protected:
160  };
161 
162  template <typename C>
164  {
165 
166  public:
167  typedef C ContainerType;
168 
169  const ContainerType& operator()() const
170  {
171  return *static_cast<const ContainerType*>(this);
172  }
173 
175  {
176  return *static_cast<ContainerType*>(this);
177  }
178 
179  protected:
182  };
183 
184  template <typename C>
186  {
187 
188  public:
189  typedef C ContainerType;
190 
191  const ContainerType& operator()() const
192  {
193  return *static_cast<const ContainerType*>(this);
194  }
195 
197  {
198  return *static_cast<ContainerType*>(this);
199  }
200 
201  protected:
204  };
205 
206  template <typename C>
207  class GridContainer : public GridExpression<C>
208  {
209 
210  public:
211  typedef C ContainerType;
212 
213  const ContainerType& operator()() const
214  {
215  return *static_cast<const ContainerType*>(this);
216  }
217 
219  {
220  return *static_cast<ContainerType*>(this);
221  }
222 
223  protected:
226  };
227  } // namespace Math
228 } // namespace CDPL
229 
230 #endif // CDPL_MATH_EXPRESSION_HPP
CDPL::Math::MatrixExpression::ExpressionType
E ExpressionType
Definition: Expression.hpp:79
CDPL::Chem::CIPDescriptor::E
const unsigned int E
Specifies that the stereocenter has E configuration.
Definition: CIPDescriptor.hpp:96
CDPL::Math::MatrixContainer::operator()
ContainerType & operator()()
Definition: Expression.hpp:174
CDPL::Math::GridExpression::~GridExpression
~GridExpression()
Definition: Expression.hpp:137
CDPL::Math::RealQuaternion
Definition: Quaternion.hpp:483
CDPL::Math::InitListMatrix
Definition: Matrix.hpp:212
CDPL::Math::QuaternionContainer::ContainerType
C ContainerType
Definition: Expression.hpp:189
CDPL::Math::GridExpression::operator()
const ExpressionType & operator()() const
Definition: Expression.hpp:125
CDPL::Math::MatrixContainer::~MatrixContainer
~MatrixContainer()
Definition: Expression.hpp:181
CDPL::Math::VectorExpression
Definition: Expression.hpp:54
CDPL::Math::MatrixExpression::MatrixExpression
MatrixExpression()
Definition: Expression.hpp:92
CDPL::Math::SparseVector
Definition: Vector.hpp:507
CDPL::Math::QuaternionContainer::QuaternionContainer
QuaternionContainer()
Definition: Expression.hpp:202
CDPL::Math::VectorContainer::operator()
const ContainerType & operator()() const
Definition: Expression.hpp:147
CDPL::Math::QuaternionContainer::operator()
ContainerType & operator()()
Definition: Expression.hpp:196
CDPL::Math::VectorContainer::~VectorContainer
~VectorContainer()
Definition: Expression.hpp:159
CDPL::Math::MatrixExpression
Definition: Expression.hpp:76
CDPL::Math::QuaternionContainer
Definition: Expression.hpp:186
CDPL::Math::VectorExpression::operator()
const ExpressionType & operator()() const
Definition: Expression.hpp:59
CDPL::Math::QuaternionExpression
Definition: Expression.hpp:98
CDPL::Math::GridContainer::ContainerType
C ContainerType
Definition: Expression.hpp:211
CDPL::Math::MatrixExpression::operator()
ExpressionType & operator()()
Definition: Expression.hpp:86
CDPL::Math::Expression::Expression
Expression()
Definition: Expression.hpp:45
CDPL::Math::MatrixExpression::operator()
const ExpressionType & operator()() const
Definition: Expression.hpp:81
CDPL::Math::Expression::~Expression
~Expression()
Definition: Expression.hpp:46
CDPL::Math::GridContainer::GridContainer
GridContainer()
Definition: Expression.hpp:224
CDPL::Math::ScalarGrid
Definition: Math/Grid.hpp:605
CDPL::Math::MatrixExpression::~MatrixExpression
~MatrixExpression()
Definition: Expression.hpp:93
CDPL::Math::QuaternionExpression::operator()
const ExpressionType & operator()() const
Definition: Expression.hpp:103
CDPL::Math::MatrixContainer::ContainerType
C ContainerType
Definition: Expression.hpp:167
CDPL::Math::VectorExpression::operator()
ExpressionType & operator()()
Definition: Expression.hpp:64
CDPL::Math::VectorExpression::ExpressionType
E ExpressionType
Definition: Expression.hpp:57
CDPL::Math::GridExpression::operator()
ExpressionType & operator()()
Definition: Expression.hpp:130
CDPL::Math::VectorContainer
Definition: Expression.hpp:142
CDPL::Math::VectorContainer::operator()
ContainerType & operator()()
Definition: Expression.hpp:152
CDPL::Math::MatrixContainer::operator()
const ContainerType & operator()() const
Definition: Expression.hpp:169
CDPL::Math::GridContainer::~GridContainer
~GridContainer()
Definition: Expression.hpp:225
CDPL::Math::GridContainer::operator()
const ContainerType & operator()() const
Definition: Expression.hpp:213
CDPL::Math::VectorContainer::ContainerType
C ContainerType
Definition: Expression.hpp:145
CDPL::Math::GridExpression
Definition: Expression.hpp:120
CDPL::Math::QuaternionExpression::ExpressionType
E ExpressionType
Definition: Expression.hpp:101
CDPL
The namespace of the Chemical Data Processing Library.
CDPL::Math::QuaternionExpression::operator()
ExpressionType & operator()()
Definition: Expression.hpp:108
CDPL::Math::VectorContainer::VectorContainer
VectorContainer()
Definition: Expression.hpp:158
CDPL::Math::GridContainer
Definition: Expression.hpp:208
CDPL::Math::GridExpression::ExpressionType
E ExpressionType
Definition: Expression.hpp:123
CDPL::Math::QuaternionContainer::operator()
const ContainerType & operator()() const
Definition: Expression.hpp:191
CDPL::Math::MatrixContainer::MatrixContainer
MatrixContainer()
Definition: Expression.hpp:180
CDPL::Math::VectorUnary
Definition: VectorExpression.hpp:48
CDPL::Math::QuaternionExpression::~QuaternionExpression
~QuaternionExpression()
Definition: Expression.hpp:115
CDPL::Math::Expression
Definition: Expression.hpp:39
CDPL::Math::VectorExpression::VectorExpression
VectorExpression()
Definition: Expression.hpp:70
CDPL::Math::GridExpression::GridExpression
GridExpression()
Definition: Expression.hpp:136
CDPL::Math::Expression::ExpressionType
E ExpressionType
Definition: Expression.hpp:42
CDPL::Math::QuaternionContainer::~QuaternionContainer
~QuaternionContainer()
Definition: Expression.hpp:203
CDPL::Chem::AtomType::C
const unsigned int C
Specifies Carbon.
Definition: AtomType.hpp:92
CDPL::Math::GridContainer::operator()
ContainerType & operator()()
Definition: Expression.hpp:218
CDPL::Math::QuaternionExpression::QuaternionExpression
QuaternionExpression()
Definition: Expression.hpp:114
CDPL::Math::VectorExpression::~VectorExpression
~VectorExpression()
Definition: Expression.hpp:71
CDPL::Math::MatrixContainer
Definition: Expression.hpp:164