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

The EncapsulatedVariable class represents a variable that can be encapsulated in an unaccessible Object. More...

#include <EncapsulatedVariable.hpp>

Inheritance diagram for sxeval::EncapsulatedVariable< T >:
sxeval::IOperand< T > sxeval::IInstruction< T >

Public Member Functions

 EncapsulatedVariable (const std::function< T(void)> get, const std::string &name)
 Default constructor.
 
TgetResult () override
 Get a reference to the variable.
 
void retrieve ()
 Retrieve the value of the encapsulated variable.
 
std::string toString () const override
 String representation of the encapsulated variable.
 
- Public Member Functions inherited from sxeval::IOperand< T >
virtual ~IOperand () override=default
 Default destructor.
 
- Public Member Functions inherited from sxeval::IInstruction< T >
virtual ~IInstruction ()=default
 Default destructor.
 

Detailed Description

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

The EncapsulatedVariable class represents a variable that can be encapsulated in an unaccessible Object.

Template Parameters
TThe type of the variable. 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

◆ EncapsulatedVariable()

template<typename T >
sxeval::EncapsulatedVariable< T >::EncapsulatedVariable ( const std::function< T(void)>  get,
const std::string &  name 
)
inline

Default constructor.

Parameters
getThe function to retrieve the value of the variable.
nameThe name of the variable.
Note
The name is used for debugging and string representation purposes.

Member Function Documentation

◆ getResult()

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

Get a reference to the variable.

Returns
A reference to the variable.

Implements sxeval::IInstruction< T >.

◆ retrieve()

template<typename T >
void sxeval::EncapsulatedVariable< T >::retrieve ( )
inline

Retrieve the value of the encapsulated variable.

◆ toString()

template<typename T >
std::string sxeval::EncapsulatedVariable< T >::toString ( ) const
inlineoverridevirtual

String representation of the encapsulated variable.

Returns
The name of the encapsulated variable.

Implements sxeval::IInstruction< T >.


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