SXEval 1.0.3
A generic s-expression interpreter library.
Loading...
Searching...
No Matches
sxeval::AOperation< T > Class Template Referenceabstract

The AOperation class is an abstract base class for operations in the SXEval library. More...

#include <AOperation.hpp>

Inheritance diagram for sxeval::AOperation< T >:
sxeval::IInstruction< T > sxeval::operations::AbsoluteValue< T > sxeval::operations::Addition< T > sxeval::operations::ArcCosh< T > sxeval::operations::ArcCosine< T > sxeval::operations::ArcSine< T > sxeval::operations::ArcSinh< T > sxeval::operations::ArcTangent< T > sxeval::operations::ArcTangent2< T > sxeval::operations::ArcTanh< T > sxeval::operations::Average< T > sxeval::operations::Ceiling< T > sxeval::operations::Cosh< T > sxeval::operations::Cosine< T > sxeval::operations::DegreesToGradians< T > sxeval::operations::DegreesToRadians< T > sxeval::operations::Division< T > sxeval::operations::Equal< T > sxeval::operations::Exp< T > sxeval::operations::Expm1< T > sxeval::operations::Exponentiation< T > sxeval::operations::Floor< T > sxeval::operations::GradiansToDegrees< T > sxeval::operations::Greater< T > sxeval::operations::GreaterOrEqual< T > sxeval::operations::Hypotenuse< T > sxeval::operations::Less< T > sxeval::operations::LessOrEqual< T > sxeval::operations::Logarithm< T > sxeval::operations::Logarithm10< T > sxeval::operations::Logarithm1p< T > sxeval::operations::Logarithm2< T > sxeval::operations::LogarithmB< T > sxeval::operations::LogicalAnd< T > sxeval::operations::LogicalNand< T > sxeval::operations::LogicalNor< T > sxeval::operations::LogicalNot< T > sxeval::operations::LogicalOr< T > sxeval::operations::LogicalXnor< T > sxeval::operations::LogicalXor< T > sxeval::operations::Maximum< T > sxeval::operations::Minimum< T > sxeval::operations::Modulo< T > sxeval::operations::Multiplication< T > sxeval::operations::NaturalLogarithm< T > sxeval::operations::NotEqual< T > sxeval::operations::RadiansToDegrees< T > sxeval::operations::Round< T > sxeval::operations::Sine< T > sxeval::operations::Sinh< T > sxeval::operations::SquareRoot< T > sxeval::operations::Subtraction< T > sxeval::operations::Tangent< T > sxeval::operations::Tanh< T > sxeval::operations::Truncate< T >

Public Member Functions

 AOperation (const std::vector< IInstruction< T > * > &args)
 Constructor that initializes the operation.
 
 AOperation (const AOperation &other)
 Copy constructor.
 
virtual ~AOperation () override=default
 Default destructor.
 
TgetResult () override
 Get the result of the operation.
 
virtual void execute ()=0
 Execute the operation.
 
- Public Member Functions inherited from sxeval::IInstruction< T >
virtual ~IInstruction ()=default
 Default destructor.
 
virtual std::string toString () const =0
 String representation of the instruction.
 

Static Public Attributes

static constexpr const int UNLIMITED_ARITY = -1
 The value for an unlimited number of arguments.
 
static constexpr const charKEY = "AOperation"
 Default key for the operation.
 
static constexpr const int ARITY_MIN = 0
 Default minimum number of arguments for the operation.
 
static constexpr const int ARITY_MAX = UNLIMITED_ARITY
 Default maximum number of arguments for the operation.
 

Protected Attributes

T _result
 
std::vector< std::reference_wrapper< T > > _args
 

Detailed Description

template<typename T>
class sxeval::AOperation< T >

The AOperation class is an abstract base class for operations in the SXEval library.

It represents an operation that can be executed with a variable number of arguments. The result of the operation is stored in a member variable.

Template Parameters
TThe type of values handled by the SXEval library. The supported types are int, signed char, short int, long int, unsigned int, unsigned char, unsigned long int, float, double and long double.

Constructor & Destructor Documentation

◆ AOperation() [1/2]

template<typename T >
sxeval::AOperation< T >::AOperation ( const std::vector< IInstruction< T > * > &  args)

Constructor that initializes the operation.

◆ AOperation() [2/2]

template<typename T >
sxeval::AOperation< T >::AOperation ( const AOperation< T > &  other)
inline

Copy constructor.

Parameters
otherThe operation to copy.

◆ ~AOperation()

template<typename T >
virtual sxeval::AOperation< T >::~AOperation ( )
overridevirtualdefault

Default destructor.

Member Function Documentation

◆ execute()

template<typename T >
virtual void sxeval::AOperation< T >::execute ( )
pure virtual

Execute the operation.

This method must be implemented by derived classes to perform the specific operation logic.

Implemented in sxeval::operations::AbsoluteValue< T >, sxeval::operations::Addition< T >, sxeval::operations::ArcCosh< T >, sxeval::operations::ArcCosine< T >, sxeval::operations::ArcSine< T >, sxeval::operations::ArcSinh< T >, sxeval::operations::ArcTangent< T >, sxeval::operations::ArcTangent2< T >, sxeval::operations::ArcTanh< T >, sxeval::operations::Average< T >, sxeval::operations::Ceiling< T >, sxeval::operations::Cosh< T >, sxeval::operations::Cosine< T >, sxeval::operations::DegreesToGradians< T >, sxeval::operations::DegreesToRadians< T >, sxeval::operations::Division< T >, sxeval::operations::Equal< T >, sxeval::operations::Exp< T >, sxeval::operations::Expm1< T >, sxeval::operations::Exponentiation< T >, sxeval::operations::Floor< T >, sxeval::operations::GradiansToDegrees< T >, sxeval::operations::Greater< T >, sxeval::operations::GreaterOrEqual< T >, sxeval::operations::Hypotenuse< T >, sxeval::operations::Less< T >, sxeval::operations::LessOrEqual< T >, sxeval::operations::Logarithm< T >, sxeval::operations::Logarithm10< T >, sxeval::operations::Logarithm1p< T >, sxeval::operations::Logarithm2< T >, sxeval::operations::LogarithmB< T >, sxeval::operations::LogicalAnd< T >, sxeval::operations::LogicalNand< T >, sxeval::operations::LogicalNor< T >, sxeval::operations::LogicalNot< T >, sxeval::operations::LogicalOr< T >, sxeval::operations::LogicalXnor< T >, sxeval::operations::LogicalXor< T >, sxeval::operations::Maximum< T >, sxeval::operations::Minimum< T >, sxeval::operations::Modulo< T >, sxeval::operations::Multiplication< T >, sxeval::operations::NaturalLogarithm< T >, sxeval::operations::NotEqual< T >, sxeval::operations::RadiansToDegrees< T >, sxeval::operations::Round< T >, sxeval::operations::Sine< T >, sxeval::operations::Sinh< T >, sxeval::operations::SquareRoot< T >, sxeval::operations::Subtraction< T >, sxeval::operations::Tangent< T >, sxeval::operations::Tanh< T >, and sxeval::operations::Truncate< T >.

◆ getResult()

template<typename T >
T & sxeval::AOperation< T >::getResult ( )
inlineoverridevirtual

Get the result of the operation.

Returns
A reference to the result of the operation.

Implements sxeval::IInstruction< T >.

Member Data Documentation

◆ _args

template<typename T >
std::vector<std::reference_wrapper<T> > sxeval::AOperation< T >::_args
protected

◆ _result

template<typename T >
T sxeval::AOperation< T >::_result
protected

◆ ARITY_MAX

template<typename T >
constexpr const int sxeval::AOperation< T >::ARITY_MAX = UNLIMITED_ARITY
staticconstexpr

Default maximum number of arguments for the operation.

◆ ARITY_MIN

template<typename T >
constexpr const int sxeval::AOperation< T >::ARITY_MIN = 0
staticconstexpr

Default minimum number of arguments for the operation.

◆ KEY

template<typename T >
constexpr const char* sxeval::AOperation< T >::KEY = "AOperation"
staticconstexpr

Default key for the operation.

◆ UNLIMITED_ARITY

template<typename T >
constexpr const int sxeval::AOperation< T >::UNLIMITED_ARITY = -1
staticconstexpr

The value for an unlimited number of arguments.


The documentation for this class was generated from the following file: