|
SXEval 1.0.3
A generic s-expression interpreter library.
|
The OperationsFactory class is used to manage operations. More...
#include <OperationsFactory.hpp>
Public Member Functions | |
| OperationsFactory () | |
| Default constructor. | |
| template<typename OP > | |
| std::enable_if< std::is_base_of< sxeval::AOperation< T >, OP >::value >::type | add () |
| Register an operation. | |
| std::unique_ptr< AOperation< T > > | create (const std::string &key, const std::vector< IInstruction< T > * > args) |
| Instantiate an operation from its key and arguments. | |
| T | compute (const std::string &key, const std::vector< IInstruction< T > * > args) const |
| Compute the result of an operation from its key and arguments. | |
The OperationsFactory class is used to manage operations.
| T | The 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. |
| sxeval::operations::OperationsFactory< T >::OperationsFactory | ( | ) |
Default constructor.
| std::enable_if< std::is_base_of< sxeval::AOperation< T >, OP >::value >::type sxeval::operations::OperationsFactory< T >::add | ( | ) |
Register an operation.
| OP | The operation to register. The operation must inherit from sxeval::AOperation<T> and provide the static members KEY, ARITY_MIN and ARITY_MAX. |
| T sxeval::operations::OperationsFactory< T >::compute | ( | const std::string & | key, |
| const std::vector< IInstruction< T > * > | args | ||
| ) | const |
Compute the result of an operation from its key and arguments.
| key | The key of the operation to compute. |
| args | The arguments of the operation. |
| std::invalid_argument | if the key is unknown or if the number of arguments is not valid for the operation. |
| std::unique_ptr< sxeval::AOperation< T > > sxeval::operations::OperationsFactory< T >::create | ( | const std::string & | key, |
| const std::vector< IInstruction< T > * > | args | ||
| ) |
Instantiate an operation from its key and arguments.
| key | The key of the operation to create. |
| args | The arguments of the operation. |
| std::invalid_argument | if the key is unknown or if the number of arguments is not valid for the operation. |