Debian Codegraph @

Source/Reasoner/Generator/CExpressionHasher.h

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_REASONER_GENERATOR_CEXPRESSIONHASHER_H
22 #define KONCLUDE_REASONER_GENERATOR_CEXPRESSIONHASHER_H
23
24
25 // Libraries includes
26 #include <QHash>
27
28 // Namespace includes
29
30
31 // Other includes
32 #include "Parser/Expressions/CClassTermExpression.h"
33 #include "Parser/Expressions/CObjectPropertyTermExpression.h"
34 #include "Parser/Expressions/CIndividualTermExpression.h"
35
36 // Logger includes
37 #include "Logger/CLogger.h"
38
39
40
41
42
43 namespace Konclude {
44
45 using namespace Parser::Expression;
46
47 namespace Reasoner {
48
49 namespace Generator {
50
51
52 /*!
53 *
54 * \class CExpressionHasher
55 * \author Andreas Steigmiller
56 * \version 0.1
57 * \brief TODO
58 *
59 */
60 class CExpressionHasher {
61 // public methods
62 public:
63 //! Constructor
64 CExpressionHasher(CBuildExpression* expression);
65
66 cint64 getExpressionHashValue() const;
67
68 bool operator==(const CExpressionHasher& expressionHasher) const;
69
70 // protected methods
71 protected:
72
73 // protected variables
74 protected:
75 CBuildExpression* mExpression;
76 cint64 mHashValue;
77
78 // private methods
79 private:
80
81 // private variables
82 private:
83
84 };
85
86 //inline bool operator==(const CExpressionHasher& expressionHasher1, const CExpressionHasher& expressionHasher2) {
87 // return expressionHasher1.operator==(expressionHasher2);
88 //}
89
90 inline uint qHash(const CExpressionHasher& expressionHasher) {
91 qint64 key = (qint64)expressionHasher.getExpressionHashValue();
92 if (sizeof(quint64) > sizeof(uint)) {
93 return uint((key >> (8 * sizeof(uint) - 1)) ^ key);
94 } else {
95 return uint(key);
96 }
97 }
98
99
100 }; // end namespace Generator
101
102 }; // end namespace Reasoner
103
104 }; // end namespace Konclude
105
106 #endif // end KONCLUDE_REASONER_GENERATOR_CEXPRESSIONHASHER_H