-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ullingerc
committed
Oct 12, 2024
1 parent
309f6b7
commit 854b81f
Showing
5 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
// Chair of Algorithms and Data Structures. | ||
// Author: Johannes Kalmbach <[email protected]> | ||
#include "engine/sparqlExpressions/NaryExpressionImpl.h" | ||
#include "engine/sparqlExpressions/SparqlExpressionValueGetters.h" | ||
|
||
namespace sparqlExpression { | ||
namespace detail { | ||
|
@@ -33,6 +34,15 @@ inline auto subtract = makeNumericExpression<std::minus<>>(); | |
NARY_EXPRESSION(SubtractExpression, 2, | ||
FV<decltype(subtract), NumericValueGetter>); | ||
|
||
// Power | ||
struct powOp { | ||
constexpr double operator()(const double base, const double exp) { | ||
return std::pow(base, exp); | ||
} | ||
}; | ||
inline auto pow = makeNumericExpression<powOp>(); | ||
NARY_EXPRESSION(PowExpression, 2, FV<decltype(pow), NumericValueGetter>); | ||
|
||
// Or | ||
inline auto orLambda = [](TernaryBool a, TernaryBool b) { | ||
using enum TernaryBool; | ||
|
@@ -96,4 +106,9 @@ SparqlExpression::Ptr makeOrExpression(SparqlExpression::Ptr child1, | |
SparqlExpression::Ptr child2) { | ||
return std::make_unique<OrExpression>(std::move(child1), std::move(child2)); | ||
} | ||
|
||
SparqlExpression::Ptr makePowExpression(SparqlExpression::Ptr child1, | ||
SparqlExpression::Ptr child2) { | ||
return std::make_unique<PowExpression>(std::move(child1), std::move(child2)); | ||
} | ||
} // namespace sparqlExpression |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters