8#ifndef HPP_ALIB_EXPRESSIONS_PLUGINS_CALCULUS
9#define HPP_ALIB_EXPRESSIONS_PLUGINS_CALCULUS
11#ifndef HPP_ALIB_EXPRESSIONS_COMPILERPLUGIN
16namespace alib {
namespace expressions {
34 #define CALCULUS_CALLBACK(func) func, ALIB_NSTRINGIFY(func)
35 #define CALCULUS_DEFAULT_AUTOCAST nullptr, nullptr
37 #define CALCULUS_CALLBACK(func) func
38 #define CALCULUS_DEFAULT_AUTOCAST nullptr
41#define CALCULUS_SIGNATURE(BoxPointerArray) BoxPointerArray, std::extent<decltype(BoxPointerArray)>::value
285 #if ALIB_DEBUG_MONOMEM
411 const std::type_info&
lhs;
412 const std::type_info&
rhs;
424 + 4026031ul * src.
lhs.hash_code()
425 + 8175383ul * src.
rhs.hash_code();
439 return left.
op == right.
op
525 #if defined(ALIB_DOX)
548 const char* dbgCallbackName,
556 const char* dbgCallbackName,
570 template<
size_t TCapacity>
611 template<
size_t TCapacity>
652 return ( std::hash<String>()(src.
op)
653 + 6949ul * std::hash<Box>()(src.
constVal)
654 + 14033ul * src.
other.hash_code()
655 ) ^ ( src.
constSide == lang::Side::Left ?
static_cast<size_t>( 0)
656 :
static_cast<size_t>(-1) );
669 return lhs.
op == rhs.
op
715 template<
size_t TCapacity>
std::size_t Hashcode() const
Box(*)(Scope &scope, ArgIterator argsBegin, ArgIterator argsEnd) CallbackDecl
const alib::boxing::Box & Type
strings::TString< character > String
Type alias in namespace alib.
boxing::Box Box
Type alias in namespace alib.
String ReverseCastFunctionName
std::vector< String > * OperatorsAccepted
const char * DbgCallbackName
std::vector< String > * OperatorsDeclined
bool operator()(const BinOpOptKey &lhs, const BinOpOptKey &rhs) const
std::size_t operator()(const BinOpOptKey &src) const
const std::type_info & other
The type of the non-constant argument.
const String op
The operator to optimize.
const Box constVal
The type and value of the constant argument.
lang::Side constSide
Denotes a left- or right-hand side optimization.
CTInvokable IsCTInvokable
const char * DbgCallbackName
bool operator()(const OperatorKey &left, const OperatorKey &right) const
std::size_t operator()(const OperatorKey &src) const
const String op
A string defining the operator.
const std::type_info & lhs
Left-hand side type.
const std::type_info & rhs
void AddOperatorAliases(OperatorAliasTableEntry(&table)[TCapacity])
virtual ALIB_API bool TryCompilation(CIFunction &ciFunction) override
std::vector< ConstantIdentifierEntry > ConstantIdentifiers
HashMap< OperatorKey, String, OperatorKey::Hash, OperatorKey::EqualTo > OperatorAliases
HashMap< BinOpOptKey, Box, BinOpOptKey::Hash, BinOpOptKey::EqualTo > BinaryOperatorOptimizations
void AddOperators(OperatorTableEntry(&table)[TCapacity])
void AddBinaryOpOptimizations(BinaryOpOptimizationsTableEntry(&table)[TCapacity])
const std::tuple< String, Type, Type, CallbackDecl, Type, CTInvokable > OperatorTableEntry
std::vector< FunctionEntry > Functions
HashMap< OperatorKey, std::tuple< CallbackDecl, Box, CTInvokable ALIB_DBG(, const char *) >, OperatorKey::Hash, OperatorKey::EqualTo > Operators
void AddOperator(const String &op, Type lhsType, Type rhsType, CallbackDecl callback, const char *dbgCallbackName, Type resultType, CTInvokable cti)
static constexpr CTInvokable ETI
Calculus(const NString &name, Compiler &compiler)
std::vector< AutoCastEntry > AutoCasts
static constexpr CTInvokable CTI
const std::tuple< String, lang::Side, Type, const Box &, const Box & > BinaryOpOptimizationsTableEntry
const std::tuple< String, Type, Type, String > OperatorAliasTableEntry
void AddOperatorAlias(const String &alias, Type lhsType, Type rhsType, const String &op)
virtual ~Calculus() override