| 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_CVARIANTQUADBASE_H |
| 22 |
#define KONCLUDE_UTILITIES_CVARIANTQUADBASE_H |
| 23 |
|
| 24 |
// Libraries includes |
| 25 |
#include <QPair> |
| 26 |
|
| 27 |
// Namespace includes |
| 28 |
|
| 29 |
|
| 30 |
// Other includes |
| 31 |
|
| 32 |
|
| 33 |
// Logger includes |
| 34 |
#include "Logger/CLogger.h" |
| 35 |
|
| 36 |
using namespace Konclude::Logger; |
| 37 |
|
| 38 |
|
| 39 |
namespace Konclude { |
| 40 |
|
| 41 |
namespace Utilities { |
| 42 |
|
| 43 |
/*! |
| 44 |
* |
| 45 |
* \class CVariantQuadBase |
| 46 |
* \author Andreas Steigmiller |
| 47 |
* \version 0.1 |
| 48 |
* \brief TODO |
| 49 |
* |
| 50 |
*/ |
| 51 |
template<class BASE, class T1, class T2, class T3, class T4> |
| 52 |
class CVariantQuadBase : public QPair<QPair<T1,T2>, QPair<T3, T4>> { |
| 53 |
|
| 54 |
// public Functions |
| 55 |
public: |
| 56 |
//! Constructor |
| 57 |
CVariantQuadBase(const T1& first, const T2& second, const T3& third, const T4& fourth); |
| 58 |
|
| 59 |
const T1& getFirst() const; |
| 60 |
const T2& getSecond() const; |
| 61 |
const T3& getThird() const; |
| 62 |
const T4& getFourth() const; |
| 63 |
|
| 64 |
BASE* setFirst(const T1& first); |
| 65 |
BASE* setSecond(const T2& second); |
| 66 |
BASE* setThird(const T3& third); |
| 67 |
BASE* setFourth(const T4& fourth); |
| 68 |
|
| 69 |
BASE* set(const T1& first, const T2& second, const T3& third, const T4& fourth); |
| 70 |
|
| 71 |
// private Functions |
| 72 |
private: |
| 73 |
|
| 74 |
// private Variables |
| 75 |
private: |
| 76 |
|
| 77 |
}; |
| 78 |
|
| 79 |
|
| 80 |
template<class BASE, class T1, class T2, class T3, class T4> |
| 81 |
CVariantQuadBase<BASE,T1,T2,T3,T4>::CVariantQuadBase(const T1 &first, const T2 &second, const T3 &third, const T4& fourth) { |
| 82 |
this->first.first = first; |
| 83 |
this->first.second = second; |
| 84 |
this->second.first = third; |
| 85 |
this->second.second = fourth; |
| 86 |
} |
| 87 |
|
| 88 |
template<class BASE, class T1, class T2, class T3, class T4> |
| 89 |
BASE* CVariantQuadBase<BASE,T1,T2,T3,T4>::setFirst(const T1 &first) { |
| 90 |
this->first.first = first; |
| 91 |
return (BASE*)this; |
| 92 |
} |
| 93 |
|
| 94 |
template<class BASE, class T1, class T2, class T3, class T4> |
| 95 |
BASE* CVariantQuadBase<BASE,T1,T2,T3,T4>::setSecond(const T2 &second) { |
| 96 |
this->first.second = second; |
| 97 |
return (BASE*)this; |
| 98 |
} |
| 99 |
|
| 100 |
template<class BASE, class T1, class T2, class T3, class T4> |
| 101 |
BASE* CVariantQuadBase<BASE,T1,T2,T3,T4>::setThird(const T3 &third) { |
| 102 |
this->second.first = third; |
| 103 |
return (BASE*)this; |
| 104 |
} |
| 105 |
|
| 106 |
template<class BASE, class T1, class T2, class T3, class T4> |
| 107 |
BASE* CVariantQuadBase<BASE,T1,T2,T3,T4>::setFourth(const T4 &fourth) { |
| 108 |
this->second.second = fourth; |
| 109 |
return (BASE*)this; |
| 110 |
} |
| 111 |
|
| 112 |
template<class BASE, class T1, class T2, class T3, class T4> |
| 113 |
BASE* CVariantQuadBase<BASE,T1,T2,T3,T4>::set(const T1 &first, const T2 &second, const T3 &third, const T4& fourth) { |
| 114 |
this->first.first = first; |
| 115 |
this->first.second = second; |
| 116 |
this->second.first = third; |
| 117 |
this->second.second = fourth; |
| 118 |
return (BASE*)this; |
| 119 |
} |
| 120 |
|
| 121 |
|
| 122 |
template<class BASE, class T1, class T2, class T3, class T4> |
| 123 |
const T1& CVariantQuadBase<BASE,T1,T2,T3,T4>::getFirst() const { |
| 124 |
return this->first.first; |
| 125 |
} |
| 126 |
|
| 127 |
template<class BASE, class T1, class T2, class T3, class T4> |
| 128 |
const T2& CVariantQuadBase<BASE,T1,T2,T3,T4>::getSecond() const { |
| 129 |
return this->first.second; |
| 130 |
} |
| 131 |
|
| 132 |
template<class BASE, class T1, class T2, class T3, class T4> |
| 133 |
const T3& CVariantQuadBase<BASE,T1,T2,T3,T4>::getThird() const { |
| 134 |
return this->second.first; |
| 135 |
} |
| 136 |
|
| 137 |
template<class BASE, class T1, class T2, class T3, class T4> |
| 138 |
const T4& CVariantQuadBase<BASE,T1,T2,T3,T4>::getFourth() const { |
| 139 |
return this->second.second; |
| 140 |
} |
| 141 |
|
| 142 |
|
| 143 |
template<class T1, class T2, class T3, class T4> |
| 144 |
class CVariantQuad : public CVariantQuadBase<CVariantQuad<T1,T2,T3,T4>,T1,T2,T3,T4> { |
| 145 |
public: |
| 146 |
CVariantQuad(const T1 &first, const T2 &second, const T3 &third, const T4& fourth) : CVariantQuadBase<CVariantQuad<T1,T2,T3,T4>,T1,T2,T3,T4>(first,second,third, fourth) { |
| 147 |
} |
| 148 |
}; |
| 149 |
|
| 150 |
|
| 151 |
}; // end namespace Utilities |
| 152 |
|
| 153 |
}; // end namespace Konclude |
| 154 |
|
| 155 |
#endif // KONCLUDE_UTILITIES_CVARIANTQUADBASE_H |