Debian Codegraph @

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