HRCore V1.1.0
A High Resolution Calculation Library
Loading...
Searching...
No Matches
HRCore::Utils::Expression< T, U > Class Template Reference

A class to get and evaluate expression. More...

Public Member Functions

 Expression (U *helper=nullptr)
 
bool eval ()
 Evaluate the expression. More...
 
getResult ()
 Get the Result object. Make sure eval() returned true first, otherwise Segment Fault! More...
 

Friends

std::istream & operator>> (std::istream &is, Expression< T, U > &rhs)
 Convert a stream into an expression. More...
 
std::ostream & operator<< (std::ostream &os, Expression< T, U > &rhs)
 Output the value of an expression. More...
 

Detailed Description

template<typename T, typename U>
class HRCore::Utils::Expression< T, U >

A class to get and evaluate expression.

Template Parameters
TData type, choose from 'Integer' and 'Float'
UStorage implement type
Note
Invalid T will not be able to create a object

Definition at line 431 of file Utils.hpp.

Constructor & Destructor Documentation

◆ Expression()

template<typename T , typename U >
HRCore::Utils::Expression< T, U >::Expression ( U *  helper = nullptr)
inline

Definition at line 471 of file Utils.hpp.

◆ ~Expression()

template<typename T , typename U >
HRCore::Utils::Expression< T, U >::~Expression ( )
inline

Definition at line 475 of file Utils.hpp.

Member Function Documentation

◆ eval()

template<typename T , typename U >
bool HRCore::Utils::Expression< T, U >::eval ( )
inline

Evaluate the expression.

Returns
true
false

Definition at line 491 of file Utils.hpp.

◆ getResult()

template<typename T , typename U >
T HRCore::Utils::Expression< T, U >::getResult ( )
inline

Get the Result object. Make sure eval() returned true first, otherwise Segment Fault!

Definition at line 525 of file Utils.hpp.

Friends And Related Function Documentation

◆ operator<<

template<typename T , typename U >
std::ostream & operator<< ( std::ostream &  os,
Expression< T, U > &  rhs 
)
friend

Output the value of an expression.

Definition at line 618 of file Utils.hpp.

◆ operator>>

template<typename T , typename U >
std::istream & operator>> ( std::istream &  is,
Expression< T, U > &  rhs 
)
friend

Convert a stream into an expression.

The function will reads std::istream object until EOF. If something invalid read, throw Exception::ExpressionConvertFailed.

Note
"--" "++"" is not allowed!

Definition at line 534 of file Utils.hpp.


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