8#ifndef HPP_ALIB_EXPRESSIONS_PLUGINS_CALCULUS
9#define HPP_ALIB_EXPRESSIONS_PLUGINS_CALCULUS
13namespace alib {
namespace expressions {
29 #define CALCULUS_CALLBACK(func) func, ALIB_NSTRINGIFY(func)
30 #define CALCULUS_DEFAULT_AUTOCAST nullptr, nullptr
32 #define CALCULUS_CALLBACK(func) func
33 #define CALCULUS_DEFAULT_AUTOCAST nullptr
36#define CALCULUS_SIGNATURE(BoxPointerArray) BoxPointerArray, std::extent<decltype(BoxPointerArray)>::value
382 const std::type_info&
lhs;
383 const std::type_info&
rhs;
395 + 4026031ul * src.
lhs.hash_code()
396 + 8175383ul * src.
rhs.hash_code();
410 return left.
op == right.
op
513 const char* dbgCallbackName,
521 const char* dbgCallbackName,
535 template<
size_t TCapacity>
576 template<
size_t TCapacity>
617 return ( std::hash<String>()(src.
op)
618 + 6949ul * std::hash<Box>()(src.
constVal)
619 + 14033ul * src.
other.hash_code()
620 ) ^ ( src.
constSide == lang::Side::Left ? size_t( 0)
634 return lhs.
op == rhs.
op
677 template<
size_t TCapacity>
std::size_t Hashcode() const
Box(*)(Scope &scope, ArgIterator argsBegin, ArgIterator argsEnd) CallbackDecl
const alib::boxing::Box & Type
Side
Denotes if something is left or right.
monomem::TMonoAllocator< lang::HeapAllocator > MonoAllocator
strings::TString< character > String
Type alias in namespace alib.
boxing::Box Box
Type alias in namespace alib.
An entry of the field AutoCasts. Defines auto-casts for custom types.
String ReverseCastFunctionName
std::vector< String > * OperatorsAccepted
const char * DbgCallbackName
std::vector< String > * OperatorsDeclined
Box Type
The type that is to be automatically cast.
Equality functor for operator hash map.
bool operator()(const BinOpOptKey &lhs, const BinOpOptKey &rhs) const
Hash functor for operator hash map.
std::size_t operator()(const BinOpOptKey &src) const
Key type for operator hash maps Operators and OperatorAliases.
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.
Token Descriptor
The name, minimum length and letter case sensitivity of the function to recognize.
Box Result
The constant result.
Token Descriptor
The name, minimum length and letter case sensitivity of the function to recognize.
CTInvokable IsCTInvokable
const char * DbgCallbackName
size_t SignatureLength
See Signature for more information.
Equality functor for operator hash map.
bool operator()(const OperatorKey &left, const OperatorKey &right) const
Hash functor for operator hash map.
std::size_t operator()(const OperatorKey &src) const
Key type for operator hash maps Operators and OperatorAliases.
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
List of identifiers that return constant values to be compiled by this plug-in.
void AddOperators(OperatorTableEntry(&table)[TCapacity])
void AddBinaryOpOptimizations(BinaryOpOptimizationsTableEntry(&table)[TCapacity])
Calculus(const NString &name, Compiler &compiler, CompilePriorities pPriority)
const std::tuple< String, Type, Type, CallbackDecl, Type, CTInvokable > OperatorTableEntry
std::vector< FunctionEntry > Functions
List of functions to be compiled by this plug-in.
void AddOperator(const String &op, Type lhsType, Type rhsType, CallbackDecl callback, const char *dbgCallbackName, Type resultType, CTInvokable cti)
static constexpr CTInvokable ETI
std::vector< AutoCastEntry > AutoCasts
List of auto-casts to be compiled by this plug-in.
HashMap< MonoAllocator, OperatorKey, std::tuple< CallbackDecl, Box, CTInvokable ALIB_DBG(, const char *) >, OperatorKey::Hash, OperatorKey::EqualTo > Operators
static constexpr CTInvokable CTI
const std::tuple< String, lang::Side, Type, const Box &, const Box & > BinaryOpOptimizationsTableEntry
const std::tuple< String, Type, Type, String > OperatorAliasTableEntry
HashMap< MonoAllocator, OperatorKey, String, OperatorKey::Hash, OperatorKey::EqualTo > OperatorAliases
void AddOperatorAlias(const String &alias, Type lhsType, Type rhsType, const String &op)
virtual ~Calculus() override
Virtual destructor.
HashMap< MonoAllocator, BinOpOptKey, Box, BinOpOptKey::Hash, BinOpOptKey::EqualTo > BinaryOperatorOptimizations