GEOS 3.15.0dev
Assert.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2001-2002 Vivid Solutions Inc.
7 * Copyright (C) 2006 Refractions Research Inc.
8 *
9 * This is free software; you can redistribute and/or modify it under
10 * the terms of the GNU Lesser General Public Licence as published
11 * by the Free Software Foundation.
12 * See the COPYING file for more information.
13 *
14 **********************************************************************/
15
16#pragma once
17
18#include <geos/export.h>
19#include <string>
20
21// Forward declarations
22namespace geos {
23namespace geom {
24class CoordinateXY;
25}
26}
27
28namespace geos {
29namespace util { // geos.util
30
31class GEOS_DLL Assert {
32public:
33
34 static void isTrue(bool assertion, const std::string& message);
35
36 static void
37 isTrue(bool assertion)
38 {
39 isTrue(assertion, std::string());
40 }
41
42 template<typename T>
43 static void
44 isNotNull(const T& ptr, const std::string& message)
45 {
46 isTrue(ptr != nullptr, message);
47 }
48
49
50 static void equals(const geom::CoordinateXY& expectedValue,
51 const geom::CoordinateXY& actualValue,
52 const std::string& message);
53
54 static void
55 equals(const geom::CoordinateXY& expectedValue,
56 const geom::CoordinateXY& actualValue)
57 {
58 equals(expectedValue, actualValue, std::string());
59 }
60
61
62 static void shouldNeverReachHere(const std::string& message);
63
64 static void
65 shouldNeverReachHere()
66 {
67 shouldNeverReachHere(std::string());
68 }
69};
70
71} // namespace geos.util
72} // namespace geos
73
Basic namespace for all GEOS functionalities.
Definition geos.h:38