SynAPSE  0.6.0
Synergistic Analysis of Phase Space Evolution
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
Assert.hh
1 #ifndef ASSERT_HH
2 #define ASSERT_HH
3 
4 // C++ includes
5 #include <iostream>
6 #include <vector>
7 #include <string>
8 #include <map>
9 
10 // Other includes
11 #include "Exception.hh"
12 
19 namespace Assert {
20 
27 template<typename T> void IsNonZero(const std::string& location,
28  const std::string& what,
29  const T& value);
30 
39 template<typename T> void IsGreater(const std::string& location,
40  const std::string& what,
41  const T& value,
42  const T& limit,
43  const bool strictly=false);
44 
53 template<typename T> void IsLower(const std::string& location,
54  const std::string& what,
55  const T& value,
56  const T& limit,
57  const bool strictly=false);
58 
66 template<typename T> void IsEqual(const std::string& location,
67  const std::string& what,
68  const T& a,
69  const T& b);
70 
77 template<typename T> void IsNotEmpty(const std::string& location,
78  const std::string& what,
79  const std::vector<T>& vector);
80 
87 void IsWithinBounds(const std::string& location,
88  const size_t n,
89  const size_t i);
90 
98 template<typename T> void HasAtLeast(const std::string& location,
99  const std::string& what,
100  const std::vector<T>& vector,
101  const size_t n);
102 
110 template<typename T> void HasAtMost(const std::string& location,
111  const std::string& what,
112  const std::vector<T>& vector,
113  const size_t n);
121 template<typename T> void SameSize(const std::string& location,
122  const std::string& what,
123  const std::vector<T>& va,
124  const std::vector<T>& vb);
125 
133 template<typename T> void SameSize(const std::string& location,
134  const std::string& what,
135  const std::vector<std::vector<T>>& ma,
136  const std::vector<std::vector<T>>& mb);
137 
145 template<typename T> void Multiplicable(const std::string& location,
146  const std::string& what,
147  const std::vector<std::vector<T>>& ma,
148  const std::vector<std::vector<T>>& mb);
149 
156 template<typename T> void IsSquare(const std::string& location,
157  const std::string& what,
158  const std::vector<std::vector<T>>& matrix);
159 
166 template<typename T> void IsSymmetric(const std::string& location,
167  const std::string& what,
168  const std::vector<std::vector<T>>& matrix);
169 
177 template<typename T1, typename T2> void Contains(const std::string& location,
178  const std::string& what,
179  const std::map<T1, T2>& map,
180  const T1& key);
181 
190 void IsProbability(const std::string& location,
191  const std::string& what,
192  const double& p,
193  const bool nonzero=true,
194  const bool noncert=true);
195 
196 #include "Assert-inl.hh"
197 
198 } // namespace Assert
199 
200 #endif
void IsGreater(const std::string &location, const std::string &what, const T &value, const T &limit, const bool strictly=false)
Asserts that a value is greater than another.
Definition: Assert.hh:10
void IsNonZero(const std::string &location, const std::string &what, const T &value)
Asserts that a value is non zero.
Definition: Assert.hh:2
void IsProbability(const std::string &location, const std::string &what, const double &p, const bool nonzero, const bool noncert)
Asserts that the value represents a probability (0 < p < 1)
Definition: Assert.cc:13
void IsSquare(const std::string &location, const std::string &what, const std::vector< std::vector< T >> &matrix)
Asserts that a matrix is square.
Definition: Assert.hh:116
void HasAtLeast(const std::string &location, const std::string &what, const std::vector< T > &vector, const size_t n)
Asserts that a vector has at least n elements.
Definition: Assert.hh:61
void Contains(const std::string &location, const std::string &what, const std::map< T1, T2 > &map, const T1 &key)
Asserts that a map contains a specific entry.
Definition: Assert.hh:147
void IsLower(const std::string &location, const std::string &what, const T &value, const T &limit, const bool strictly=false)
Asserts that a value is lower than another.
Definition: Assert.hh:27
void IsEqual(const std::string &location, const std::string &what, const T &a, const T &b)
Asserts that the values are equal.
Definition: Assert.hh:44
void HasAtMost(const std::string &location, const std::string &what, const std::vector< T > &vector, const size_t n)
Asserts that a vector has at most n elements.
Definition: Assert.hh:72
void IsWithinBounds(const std::string &location, const size_t n, const size_t i)
Asserts that the index that is accessed is within bounds.
Definition: Assert.cc:5
void Multiplicable(const std::string &location, const std::string &what, const std::vector< std::vector< T >> &ma, const std::vector< std::vector< T >> &mb)
Asserts that two matrices are multiplicable.
Definition: Assert.hh:105
void IsNotEmpty(const std::string &location, const std::string &what, const std::vector< T > &vector)
Asserts that a vector is not empty.
Definition: Assert.hh:53
void SameSize(const std::string &location, const std::string &what, const std::vector< T > &va, const std::vector< T > &vb)
Asserts that two vectors have the same size.
Definition: Assert.hh:83
void IsSymmetric(const std::string &location, const std::string &what, const std::vector< std::vector< T >> &matrix)
Asserts that a matrix is symmetric.
Definition: Assert.hh:126