Debian Codegraph @

Source/Utilities/Container/CSortedNegLinker.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_UTILITIES_CONTAINER_CSORTEDNEGLINKER_H
22 #define KONCLUDE_UTILITIES_CONTAINER_CSORTEDNEGLINKER_H
23
24 // Namespace includes
25 #include "ContainerSettings.h"
26 #include "CSortedLinker.h"
27 #include "CNegLinker.h"
28
29 // Library includes
30
31 // Other includes
32
33 // Logger includes
34 #include "Logger/CLogger.h"
35
36
37 namespace Konclude {
38
39 namespace Utilities {
40
41 namespace Container {
42
43 template<class T> class CNegLinkerOperatorCompareFunctor;
44
45 template<class T>
46 class CNegLinkerOperatorCompareFunctor<T*> {
47 public:
48 static inline bool sortedNegLinkerDataCompare(T* const & beforeData1, const bool& negation1, T* const & data2, const bool& negation2) {
49 return *beforeData1 <= *data2;
50 }
51 };
52
53 template<class T>
54 class CNegLinkerOperatorCompareFunctor {
55 public:
56 static inline bool sortedNegLinkerDataCompare(const T& beforeData1, const bool& negation1, const T& data2, const bool& negation2) {
57 return beforeData1 <= data2;
58 }
59 };
60
61
62 /*!
63 *
64 * \class CSortedNegLinkerBase
65 * \author Andreas Steigmiller
66 * \version 0.1
67 * \brief TODO
68 *
69 */
70 template<class T, class S, class C = CNegLinkerOperatorCompareFunctor<T> >
71 class CSortedNegLinkerBase : public CNegLinkerBase<T,S> {
72 // public methods
73 public:
74 // Constructor
75 inline CSortedNegLinkerBase();
76 inline CSortedNegLinkerBase(const T& dataElement, bool negation = false, CSortedNegLinkerBase<T,S,C>* nextLink = nullptr);
77
78 //! Destructor
79 inline ~CSortedNegLinkerBase();
80
81
82 S* insertSortedNextSorted(CSortedNegLinkerBase<T,S,C>* nextLink);
83 S* insertNextSorted(CSortedNegLinkerBase<T,S,C>* nextLink);
84
85
86 // protected methods
87 protected:
88 bool isSortedBeforeCompare(const T& checkData, const bool& checkNegation, const T& linkedData, const bool& linkedNegation) const;
89
90 // protected variables
91 protected:
92
93 // private methods
94 private:
95
96 // private variables
97 private:
98 };
99
100
101 /*!
102 *
103 * \class CSortedNegLinker
104 * \author Andreas Steigmiller
105 * \version 0.1
106 * \brief TODO
107 *
108 */
109 template<class T, class C = CNegLinkerOperatorCompareFunctor<T> >
110 class CXSortedNegLinker : public CSortedNegLinkerBase<T,CXSortedNegLinker<T>,C> {
111 // public methods
112 public:
113 // Constructor
114 inline CXSortedNegLinker() : CSortedNegLinkerBase<T,CXSortedNegLinker<T>,C>() {};
115 inline CXSortedNegLinker(const T& dataElement, bool negation = false, CXSortedNegLinker<T,C>* nextLink = nullptr) : CSortedNegLinkerBase<T,CXSortedNegLinker<T>,C>(dataElement,negation,nextLink) {};
116
117 //! Destructor
118 inline ~CXSortedNegLinker() {};
119 };
120
121
122 }; // end namespace Container
123
124 }; // end namespace Utilities
125
126 }; // end namespace Konclude
127
128 #include "CSortedNegLinker.cpp"
129
130 #endif // KONCLUDE_UTILITIES_CONTAINER_CSORTEDNEGLINKER_H