FLImaging 6.5.8.1
FLImaging::Foundation::CExpression Class Reference

A class representing expression. More...

#include <Expression.h>

Inheritance diagram for FLImaging::Foundation::CExpression:
FLImaging::Base::CFLBase

Public Types

enum  EExpressionValid { EExpressionValid_Initialized = 0 , EExpressionValid_Valid , EExpressionValid_Invalid }
 An enum to express whether the expression is valid. More...
 

Public Member Functions

 CExpression ()
 
 CExpression (const CExpression &rhs)
 
 CExpression (const CExpression *pRhs)
 
 CExpression (const wchar_t *pWcsExpression)
 
virtual ~CExpression ()
 
const CResult Clear ()
 
const CResult Assign (const CExpression &rhs)
 
const CResult Assign (const CExpression *pRhs)
 
const CResult SetExpression (const wchar_t *pWcsExpression)
 
const wchar_t * GetExpression ()
 
Base::CFLString< wchar_t > GetExpression (bool bExponentialNotation, int32_t i32CoeffPrecision)
 
const CResult Evaluate (wchar_t **ppWcsEvaluatorExpression=nullptr)
 
const CResult Solve (const wchar_t *pWcsVariable, Base::CFLArray< std::complex< double > > *pFlaResult, ECoefficientOrder eCoeffOrder=ECoefficientOrder_Ascending, EAccuracy eAccuracy=EAccuracy_Bits64)
 
const CResult Solve (const wchar_t *pWcsVariable, Base::CFLArray< std::complex< double > > *pFlaResult, Base::CFLArray< std::complex< double > > *pFlaDiscontinuous, ECoefficientOrder eCoeffOrder=ECoefficientOrder_Ascending, EAccuracy eAccuracy=EAccuracy_Bits64)
 
const CResult ExpandExpression (wchar_t **ppWcsEvaluatorExpression=nullptr)
 
const CResult UnrollPower (wchar_t **ppWcsEvaluatorExpression=nullptr)
 
const CResult CollectExpression (wchar_t **ppWcsEvaluatorExpression=nullptr)
 
int32_t GetVariableCount ()
 
int32_t GetIndexOfVariable (const wchar_t *pWcsVariableName)
 
int32_t GetIndexOfEvaluatedVariable (const wchar_t *pWcsVariableName)
 
const CResult AssignVariable (int32_t i32Index, double f64Value)
 
const CResult AssignVariable (const wchar_t *pWcsVariableName, double f64Value)
 
const CResult ResetVariable (int32_t i32Index)
 
const CResult ResetVariable (const wchar_t *pWcsVariableName)
 
double * GetVariable (int32_t i32Index)
 
double * GetVariable (const wchar_t *pWcsVariableName)
 
const double GetEvaluatedVariable (int32_t i32Index)
 
const double GetEvaluatedVariable (const wchar_t *pWcsVariableName)
 
EExpressionValid IsExprssionValid ()
 
- Public Member Functions inherited from FLImaging::Base::CFLBase
 CFLBase ()
 Default constructor.
 
virtual ~CFLBase ()
 Destructor.
 
void Lock () const
 Set a lock on an object.
 
bool TryLock () const
 Try to lock the object.
 
void Unlock () const
 Unlock the object.
 
virtual const CProcessingUnitBaseGetProcessingUnit () const
 Returns the set ProcessingUnit.
 
virtual const CResult SetProcessingUnit (const CProcessingUnitBase &pub)
 set the ProcessingUnit
 
virtual const CResult SetProcessingUnit (const CProcessingUnitBase *pPub)
 Set the ProcessingUnit.
 
virtual void ResetProcessingUnit ()
 Rest the ProcessingUnit.
 
virtual bool IsValid () const
 Validate the object.
 
template<class T >
bool IsValid (T &tValue) const
 Validate input values.
 
template<class T >
bool IsValid (T *pTValue) const
 Validate input values.
 
template<class T >
void GenerateMin (T &tValue) const
 Generate the minimum value of that type.
 
template<class T >
void GenerateMin (T *pTValue) const
 Generate the minimum value of that type.
 
template<class T >
void GenerateMinInt32 (T &tValue) const
 Generate minimum signed 32-bit integer value.
 
template<class T >
void GenerateMinInt32 (T *pTValue) const
 Generate minimum signed 32-bit integer value.
 
template<class T >
void GenerateMinInt31 (T &tValue) const
 Generate minimum signed 31-bit integer value.
 
template<class T >
void GenerateMinInt31 (T *pTValue) const
 Generate minimum signed 31-bit integer value.
 
template<class T >
void GenerateMax (T &tValue) const
 Generate the maximum value of that type.
 
template<class T >
void GenerateMax (T *pTValue) const
 Generate the maximum value of that type.
 
template<class T >
void GenerateMaxInt32 (T &tValue) const
 Generate maximum signed 32-bit integer value.
 
template<class T >
void GenerateMaxInt32 (T *pTValue) const
 Generate maximum signed 32-bit integer value.
 
template<class T >
void GenerateMaxInt31 (T &tValue) const
 Generate maximum signed 31-bit integer value.
 
template<class T >
void GenerateMaxInt31 (T *pTValue) const
 Generate maximum signed 31-bit integer value.
 
template<class T >
void GenerateInvalid (T &tValue) const
 Generate invalid value.
 
template<class T >
void GenerateInvalid (T *pTValue) const
 Generate invalid value.
 
virtual void OnReceiveBroadcast (const CBroadcastMessage *pMessage)
 Callback function. A function that receives a BroadcastMessage.
 
virtual int64_t GetClassType () const =0
 Returns the Type value of Class. The returned value itself has no meaning, but if it is the same type of class, the same value will be displayed, so comparison is possible.
 
const char * GetClassNameWithNamespace () const
 Returns the class name including the namespace of the actual instance.
 
const char * GetClassNameWithoutNamespace () const
 Returns the class name that does not include the namespace of the actual instance.
 
virtual uint32_t GetClassHash () const
 Returns the class hash value of the actual instance. For the same class, even if the instance is different, it has the same value.
 
virtual bool IsLicenseAvailable () const
 Returns whether the algorithm can be used with the current license.
 
const CResult ShareSynchronizationObject (const CFLBase *pSrcObject) const
 Share synchronization object of original object.
 
bool IsSharedSynchronizationObject () const
 Is shared synchronization object.
 
virtual void Throw (const CResult &res, const wchar_t *pWcsExtraMessage=nullptr) const
 Raise an exception. Information and error codes of the object that occurred are recorded in the log.
 
virtual void Throw (const std::exception &res, const wchar_t *pWcsExtraMessage) const
 Raise an exception. Information and error codes of the object that occurred are recorded in the log.
 

Detailed Description

A class representing expression.

Member Enumeration Documentation

◆ EExpressionValid

An enum to express whether the expression is valid.

Enumerator
EExpressionValid_Initialized 

Validation was not performed after the expression was initialized.

EExpressionValid_Valid 

valid expression

EExpressionValid_Invalid 

invalid expression

Constructor & Destructor Documentation

◆ CExpression() [1/4]

FLImaging::Foundation::CExpression::CExpression ( )

Default constructor

◆ CExpression() [2/4]

FLImaging::Foundation::CExpression::CExpression ( const CExpression & rhs)

Copy constructor

Parameters
[in]rhsobject to copy

◆ CExpression() [3/4]

FLImaging::Foundation::CExpression::CExpression ( const CExpression * pRhs)

Copy constructor

Parameters
[in]pRhsobject to copy

◆ CExpression() [4/4]

FLImaging::Foundation::CExpression::CExpression ( const wchar_t * pWcsExpression)

Initialization constructor

Parameters
[in]pWcsExpressionSet the expression of an object to its string

◆ ~CExpression()

virtual FLImaging::Foundation::CExpression::~CExpression ( )
virtual

Default destructor

Member Function Documentation

◆ Assign() [1/2]

const CResult FLImaging::Foundation::CExpression::Assign ( const CExpression & rhs)

Copy the object.

Parameters
[in]rhsobject to copy
Return values
constFLImaging::CResult Information about execution results
See also
FLImaging::CResult

◆ Assign() [2/2]

const CResult FLImaging::Foundation::CExpression::Assign ( const CExpression * pRhs)

Copy the object.

Parameters
[in]pRhsobject to copy
Return values
constFLImaging::CResult Information about execution results
See also
FLImaging::CResult

◆ AssignVariable() [1/2]

const CResult FLImaging::Foundation::CExpression::AssignVariable ( const wchar_t * pWcsVariableName,
double f64Value )

Set the value of a variable.

Parameters
[in]pWcsVariableNamevariable name
[in]f64Valuevariable value
Return values
constFLImaging::CResult Information about execution results
See also
FLImaging::CResult

◆ AssignVariable() [2/2]

const CResult FLImaging::Foundation::CExpression::AssignVariable ( int32_t i32Index,
double f64Value )

Set the value of a variable.

Parameters
[in]i32Indexvariable index
[in]f64Valuevariable value
Return values
constFLImaging::CResult Information about execution results
See also
FLImaging::CResult

◆ Clear()

const CResult FLImaging::Foundation::CExpression::Clear ( )

Initialize the object's variables.

Return values
constFLImaging::CResult Information about execution results
See also
FLImaging::CResult

◆ CollectExpression()

const CResult FLImaging::Foundation::CExpression::CollectExpression ( wchar_t ** ppWcsEvaluatorExpression = nullptr)

Organize the expanded expression by calculating the same terms.

Parameters
[in]ppWcsEvaluatorExpressionOrganized expression string
Return values
constFLImaging::CResult Information about execution results
See also
FLImaging::CResult

◆ Evaluate()

const CResult FLImaging::Foundation::CExpression::Evaluate ( wchar_t ** ppWcsEvaluatorExpression = nullptr)

Put the value set in the variable in the expression and calculate it.

Parameters
[out]ppWcsEvaluatorExpressionExpression string with values in variables
Return values
constFLImaging::CResult Information about execution results
See also
FLImaging::CResult

◆ ExpandExpression()

const CResult FLImaging::Foundation::CExpression::ExpandExpression ( wchar_t ** ppWcsEvaluatorExpression = nullptr)

Expand the expression.

Parameters
[in]ppWcsEvaluatorExpressionExpanded expression string
Return values
constFLImaging::CResult Information about execution results
See also
FLImaging::CResult

◆ GetEvaluatedVariable() [1/2]

const double FLImaging::Foundation::CExpression::GetEvaluatedVariable ( const wchar_t * pWcsVariableName)

Get the value of the calculated variable.

Parameters
[in]pWcsVariableNamevariable name
Return values
constdouble variable value

◆ GetEvaluatedVariable() [2/2]

const double FLImaging::Foundation::CExpression::GetEvaluatedVariable ( int32_t i32Index)

Get the value of the calculated variable.

Parameters
[in]i32Indexvariable index number
Return values
constdouble variable value

◆ GetExpression() [1/2]

const wchar_t * FLImaging::Foundation::CExpression::GetExpression ( )

Get the set expression string.

Return values
constwchar_t* expression string

◆ GetExpression() [2/2]

Base::CFLString< wchar_t > FLImaging::Foundation::CExpression::GetExpression ( bool bExponentialNotation,
int32_t i32CoeffPrecision )

The set expression string is imported in the specified format.

Parameters
[in]bExponentialNotationWhether to display in exponential notation, in case of true, the coefficient is expressed as 4.4e-4, and in case of false, the coefficient is expressed as 0.00044
[in]i32CoeffPrecisionNumber of decimal places for coefficients to be expressed
Return values
FLImaging::Base::CFLString<wchar_t>expression string
See also
FLImaging::Base::CFLString

◆ GetIndexOfEvaluatedVariable()

int32_t FLImaging::Foundation::CExpression::GetIndexOfEvaluatedVariable ( const wchar_t * pWcsVariableName)

Gets the index of a variable whose value is not set.

Parameters
[in]pWcsVariableNameVariable name
Return values
int32_tindex of variable

◆ GetIndexOfVariable()

int32_t FLImaging::Foundation::CExpression::GetIndexOfVariable ( const wchar_t * pWcsVariableName)

Get the index of the variable whose value is set.

Parameters
[in]pWcsVariableNameVariable name
Return values
int32_tindex of variable

◆ GetVariable() [1/2]

double * FLImaging::Foundation::CExpression::GetVariable ( const wchar_t * pWcsVariableName)

Get the set variable.

Parameters
[in]pWcsVariableNamevariable name
Return values
double*Pointer of variable

◆ GetVariable() [2/2]

double * FLImaging::Foundation::CExpression::GetVariable ( int32_t i32Index)

Get the set variable.

Parameters
[in]i32Indexvariable index number
Return values
double*Pointer of variable

◆ GetVariableCount()

int32_t FLImaging::Foundation::CExpression::GetVariableCount ( )

Get the number of variables.

Return values
int32_tnumber of variables

◆ IsExprssionValid()

EExpressionValid FLImaging::Foundation::CExpression::IsExprssionValid ( )

Determine if a calculated expression is valid

Return values
FLImaging::Foundation::CExpression::EExpressionValidReturns whether a expression is valid
See also
FLImaging::Foundation::CExpression::EExpressionValid

◆ ResetVariable() [1/2]

const CResult FLImaging::Foundation::CExpression::ResetVariable ( const wchar_t * pWcsVariableName)

Reset the variable.

Parameters
[in]pWcsVariableNamevariable name
Return values
constFLImaging::CResult Information about execution results
See also
FLImaging::CResult

◆ ResetVariable() [2/2]

const CResult FLImaging::Foundation::CExpression::ResetVariable ( int32_t i32Index)

Reset the variable.

Parameters
[in]i32Indexvariable index
Return values
constFLImaging::CResult Information about execution results
See also
FLImaging::CResult

◆ SetExpression()

const CResult FLImaging::Foundation::CExpression::SetExpression ( const wchar_t * pWcsExpression)

Sets the expression string.

Parameters
[in]pWcsExpressionExpression string to set
Return values
constFLImaging::CResult Information about execution results
See also
FLImaging::CResult

◆ Solve() [1/2]

const CResult FLImaging::Foundation::CExpression::Solve ( const wchar_t * pWcsVariable,
Base::CFLArray< std::complex< double > > * pFlaResult,
Base::CFLArray< std::complex< double > > * pFlaDiscontinuous,
ECoefficientOrder eCoeffOrder = ECoefficientOrder_Ascending,
EAccuracy eAccuracy = EAccuracy_Bits64 )

Calculate the solution of a one-variable equation in a expression. If there is a variable in the denominator, the value of the variable whose denominator is 0 is also returned.

Parameters
[in]pWcsVariableunknown symbol
[out]pFlaResultsolution of the equation
[out]pFlaDiscontinuousThe value of a variable whose denominator is zero
[in]eCoeffOrderSpecifies how the coefficients are arranged in an array
[in]eAccuracyAccuracy of calculation
Return values
constFLImaging::CResult Information about execution results
See also
FLImaging::CResult
FLImaging::Base::CFLArray
FLImaging::Foundation::ECoefficientOrder
FLImaging::Foundation::EAccuracy

◆ Solve() [2/2]

const CResult FLImaging::Foundation::CExpression::Solve ( const wchar_t * pWcsVariable,
Base::CFLArray< std::complex< double > > * pFlaResult,
ECoefficientOrder eCoeffOrder = ECoefficientOrder_Ascending,
EAccuracy eAccuracy = EAccuracy_Bits64 )

Calculate the solution of a one-variable equation in a expression.

Parameters
[in]pWcsVariableunknown symbol
[out]pFlaResultsolution of the equation
[in]eCoeffOrderSpecifies how the coefficients are arranged in an array
[in]eAccuracyAccuracy of calculation
Return values
constFLImaging::CResult Information about execution results
See also
FLImaging::CResult
FLImaging::Base::CFLArray
FLImaging::Foundation::ECoefficientOrder
FLImaging::Foundation::EAccuracy

◆ UnrollPower()

const CResult FLImaging::Foundation::CExpression::UnrollPower ( wchar_t ** ppWcsEvaluatorExpression = nullptr)

Expands the square expression in the equation into a multiplicative expression.

Parameters
[in]ppWcsEvaluatorExpressionExpanded expression string
Return values
constFLImaging::CResult Information about execution results
See also
FLImaging::CResult