Debian Codegraph @

Source/Utilities/CReverseSort.hpp

raw
1 /*
2 * Copyright (C) 2013-2015, 2019 by the Konclude Developer Team.
3 *
4 * This file is part of the reasoning system Konclude.
5 * For details and support, see <http://konclude.com/>.
6 *
7 * Konclude is free software: you can redistribute it and/or modify
8 * it under the terms of version 3 of the GNU Lesser General Public
9 * License (LGPLv3) as published by the Free Software Foundation.
10 *
11 * Konclude 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
14 * GNU (Lesser) General Public License for more details.
15 *
16 * You should have received a copy of the GNU (Lesser) General Public
17 * License along with Konclude. If not, see <http://www.gnu.org/licenses/>.
18 *
19 */
20
21 #ifndef KONCLUDE_UTILITIES_CREVERSESORT_H
22 #define KONCLUDE_UTILITIES_CREVERSESORT_H
23
24 // Libraries includes
25 #include <QPair>
26
27 // Namespace includes
28
29
30 // Other includes
31
32
33
34 // Logger includes
35 #include "Logger/CLogger.h"
36
37 using namespace Konclude::Logger;
38
39
40 namespace Konclude {
41
42 namespace Utilities {
43
44
45
46
47 template<class T> class CReverseSort;
48
49
50 /*!
51 *
52 * \class CReverseSort
53 * \author Andreas Steigmiller
54 * \version 0.1
55 * \brief Spezialised Pointer Version to avoid comparison between addresses
56 *
57 */
58 template<class T>
59 class CReverseSort<T*> {
60 // public Functions
61 public:
62 //! Constructor
63 CReverseSort();
64 CReverseSort(T *&sortObject);
65 //! Destructor
66 virtual ~CReverseSort();
67
68 T*& getData();
69
70 bool operator==(const CReverseSort<T*> &comparisonObject);
71 bool operator<=(const CReverseSort<T*> &comparisonObject);
72 bool operator>=(const CReverseSort<T*> &comparisonObject);
73
74 // private Functions
75 private:
76 T *object;
77
78 // private Variables
79 private:
80
81 };
82
83
84 template<class T>
85 CReverseSort<T*>::CReverseSort() {
86 }
87
88 template<class T>
89 CReverseSort<T*>::CReverseSort(T *&sortObject) {
90 object = sortObject;
91 }
92
93 template<class T>
94 T*& CReverseSort<T*>::getData() {
95 return object;
96 }
97
98 template<class T>
99 bool CReverseSort<T*>::operator==(const CReverseSort<T*> &comparisonObject) {
100 return *object == *comparisonObject;
101 }
102
103
104 template<class T>
105 bool CReverseSort<T*>::operator<=(const CReverseSort<T*> &comparisonObject) {
106 return *object >= *comparisonObject;
107 }
108
109 template<class T>
110 bool CReverseSort<T*>::operator>=(const CReverseSort<T*> &comparisonObject) {
111 return *object <= *comparisonObject;
112 }
113
114
115
116
117
118
119
120 /*!
121 *
122 * \class CReverseSort
123 * \author Andreas Steigmiller
124 * \version 0.1
125 * \brief TODO
126 *
127 */
128 template<class T>
129 class CReverseSort {
130
131 // public Functions
132 public:
133 //! Constructor
134 CReverseSort();
135 CReverseSort(T &sortObject);
136 //! Destructor
137 virtual ~CReverseSort();
138
139 T& getData();
140
141
142 bool operator==(const CReverseSort<T> &comparisonObject);
143 bool operator<=(const CReverseSort<T> &comparisonObject);
144 bool operator>=(const CReverseSort<T> &comparisonObject);
145
146 // private Functions
147 private:
148 T object;
149
150 // private Variables
151 private:
152
153 };
154
155
156 template<class T>
157 CReverseSort<T>::CReverseSort() {
158 }
159
160 template<class T>
161 CReverseSort<T>::CReverseSort(T &sortObject) {
162 object = sortObject;
163 }
164
165
166 template<class T>
167 T& CReverseSort<T>::getData() {
168 return object;
169 }
170
171
172 template<class T>
173 bool CReverseSort<T>::operator==(const CReverseSort<T> &comparisonObject) {
174 return object == comparisonObject;
175 }
176
177
178 template<class T>
179 bool CReverseSort<T>::operator<=(const CReverseSort<T> &comparisonObject) {
180 return object >= comparisonObject;
181 }
182
183 template<class T>
184 bool CReverseSort<T>::operator>=(const CReverseSort<T> &comparisonObject) {
185 return object <= comparisonObject;
186 }
187
188 }; // end namespace Utilities
189
190 }; // end namespace Konclude
191
192 #endif // KONCLUDE_UTILITIES_CREVERSESORT_H