Debian Codegraph @

Source/Reasoner/Answerer/CRedlandRasqalLiteralHasher.cpp

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 #ifdef KONCLUDE_REDLAND_INTEGRATION
21
22 #include "CRedlandRasqalLiteralHasher.h"
23
24
25 namespace Konclude {
26
27 namespace Reasoner {
28
29 namespace Answerer {
30
31
32 CRedlandRasqalLiteralHasher::CRedlandRasqalLiteralHasher(rasqal_literal* node) {
33 mNode = rasqal_new_literal_from_literal(node);
34 rasqal_literal_type litType = rasqal_literal_get_type(mNode);
35
36 if (litType == RASQAL_LITERAL_URI) {
37 mHashValue = hash_c_string((const char*)rasqal_literal_as_string(mNode));
38 } else {
39 mHashValue = hash_c_string((const char*)rasqal_literal_as_string(mNode));
40 }
41 }
42
43 CRedlandRasqalLiteralHasher::CRedlandRasqalLiteralHasher(const CRedlandRasqalLiteralHasher& hasher) {
44 mNode = rasqal_new_literal_from_literal(hasher.mNode);
45 mHashValue = hasher.mHashValue;
46 }
47
48
49 CRedlandRasqalLiteralHasher& CRedlandRasqalLiteralHasher::operator=(const CRedlandRasqalLiteralHasher& hasher) {
50 mNode = rasqal_new_literal_from_literal(hasher.mNode);
51 mHashValue = hasher.mHashValue;
52 return *this;
53 }
54
55
56 CRedlandRasqalLiteralHasher::~CRedlandRasqalLiteralHasher() {
57 rasqal_free_literal(mNode);
58 }
59
60
61 }; // end namespace Answerer
62
63 }; // end namespace Reasoner
64
65 }; // end namespace Konclude
66
67 #endif // !KONCLUDE_REDLAND_INTEGRATION