Medical Imaging Interaction Toolkit  2024.06.00
Medical Imaging Interaction Toolkit
berry::Expression Class Referenceabstract

#include <berryExpression.h>

Inheritance diagram for berry::Expression:
Collaboration diagram for berry::Expression:

Public Member Functions

 berryObjectMacro (Expression)
 
 Expression ()
 
 ~Expression () override
 
uint HashCode () const override
 
virtual SmartPointer< const EvaluationResultEvaluate (IEvaluationContext *context) const =0
 
virtual const ExpressionInfoComputeExpressionInfo () const
 
virtual void CollectExpressionInfo (ExpressionInfo *info) const
 
QString ToString () const override
 
bool operator== (const Object *object) const override
 
- Public Member Functions inherited from berry::Object
virtual QString GetClassName () const
 
virtual Reflection::TypeInfo GetTypeInfo () const
 
virtual QList< Reflection::TypeInfoGetSuperclasses () const
 
virtual void Delete ()
 
QDebug Print (QDebug os, Indent Indent=0) const
 
virtual bool operator< (const Object *) const
 
void Register () const
 
void UnRegister (bool del=true) const
 
int GetReferenceCount () const
 
void SetReferenceCount (int)
 
void AddDestroyListener (const MessageAbstractDelegate<> &delegate) const
 
void RemoveDestroyListener (const MessageAbstractDelegate<> &delegate) const
 

Static Public Attributes

static const uint HASH_CODE_NOT_COMPUTED
 
static const uint HASH_FACTOR
 
static const QString ATT_VALUE
 
static const Expression::Pointer TRUE_EVAL
 
static const Expression::Pointer FALSE_EVAL
 

Protected Member Functions

virtual uint ComputeHashCode () const
 
- Protected Member Functions inherited from berry::Object
 Object ()
 
virtual ~Object ()
 
virtual QDebug PrintSelf (QDebug os, Indent indent) const
 
virtual QDebug PrintHeader (QDebug os, Indent indent) const
 
virtual QDebug PrintTrailer (QDebug os, Indent indent) const
 

Static Protected Member Functions

static bool Equals (const QList< Expression::Pointer > &leftArray, const QList< Expression::Pointer > &rightArray)
 
static bool Equals (const QList< Object::Pointer > &leftArray, const QList< Object::Pointer > &rightArray)
 
static uint HashCode (Expression::Pointer object)
 
static uint HashCode (const QList< Expression::Pointer > &array)
 
static uint HashCode (const QList< Object::Pointer > &array)
 

Additional Inherited Members

- Public Types inherited from berry::Object
typedef Object Self
 
typedef berry::SmartPointer< SelfPointer
 
typedef berry::SmartPointer< const SelfConstPointer
 
typedef berry::WeakPointer< SelfWeakPtr
 
typedef berry::WeakPointer< const SelfConstWeakPtr
 
- Static Public Member Functions inherited from berry::Object
static const char * GetStaticClassName ()
 
static Reflection::TypeInfo GetStaticTypeInfo ()
 
static QList< Reflection::TypeInfoGetStaticSuperclasses ()
 
- Protected Attributes inherited from berry::Object
QAtomicInt m_ReferenceCount
 
QMutex m_ReferenceCountLock
 

Detailed Description

Abstract base class for all expressions provided by the common expression language.

An expression is evaluated by calling Evaluate.

This class may be subclassed to provide specific expressions.

Definition at line 37 of file berryExpression.h.

Constructor & Destructor Documentation

◆ Expression()

berry::Expression::Expression ( )

◆ ~Expression()

berry::Expression::~Expression ( )
override

Member Function Documentation

◆ berryObjectMacro()

berry::Expression::berryObjectMacro ( Expression  )

◆ CollectExpressionInfo()

virtual void berry::Expression::CollectExpressionInfo ( ExpressionInfo info) const
virtual

Collects information about this expression tree. This default implementation add the expression's type to the set of misbehaving expression types.

Parameters
infothe expression information object used to collect the information

Reimplemented in berry::FALSE_EVALExpression, and berry::TRUE_EVALExpression.

◆ ComputeExpressionInfo()

virtual const ExpressionInfo* berry::Expression::ComputeExpressionInfo ( ) const
virtual

Computes the expression information for the given expression tree.

This is a convenience method for collecting the expression information using Expression#CollectExpressionInfo.

Returns
the expression information

◆ ComputeHashCode()

virtual uint berry::Expression::ComputeHashCode ( ) const
protectedvirtual

Method to compute the hash code for this object. The result returned from this method is cached in the fHashCode field. If the value returned from the method equals HASH_CODE_NOT_COMPUTED (e.g. -1) then the value is incremented by one.

This default implementation calls super.hashCode()

Returns
a hash code for this object.

◆ Equals() [1/2]

static bool berry::Expression::Equals ( const QList< Expression::Pointer > &  leftArray,
const QList< Expression::Pointer > &  rightArray 
)
staticprotected

Tests whether two arrays of objects are equal to each other. The arrays must not be null, but their elements may be null.

Parameters
leftArraythe left array to compare; may be null, and may be empty and may contain null elements.
rightArraythe right array to compare; may be null, and may be empty and may contain null elements.
Returns
TRUE_EVAL if the arrays are equal length and the elements at the same position are equal; FALSE_EVAL otherwise.

◆ Equals() [2/2]

static bool berry::Expression::Equals ( const QList< Object::Pointer > &  leftArray,
const QList< Object::Pointer > &  rightArray 
)
staticprotected

◆ Evaluate()

virtual SmartPointer<const EvaluationResult> berry::Expression::Evaluate ( IEvaluationContext context) const
pure virtual

Evaluates this expression.

Parameters
contextan evaluation context providing information like variable, name spaces, etc. necessary to evaluate this expression
Returns
the result of the expression evaluation
Exceptions
CoreExceptionif the evaluation failed. The concrete reason is defined by the subclass implementing this method

Implemented in berry::FALSE_EVALExpression, and berry::TRUE_EVALExpression.

◆ HashCode() [1/4]

uint berry::Expression::HashCode ( ) const
overridevirtual

Returns a hash code value for the object.

Reimplemented from berry::Object.

◆ HashCode() [2/4]

static uint berry::Expression::HashCode ( const QList< Expression::Pointer > &  array)
staticprotected

Returns the hash code for the given array. This method handles null.

Parameters
arraythe array for which the hash code is desired; may be null.
Returns
the hash code of the array; zero if the object is null.

◆ HashCode() [3/4]

static uint berry::Expression::HashCode ( const QList< Object::Pointer > &  array)
staticprotected

◆ HashCode() [4/4]

static uint berry::Expression::HashCode ( Expression::Pointer  object)
staticprotected

Returns the hash code for the given object. This method handles null.

Parameters
objectthe object for which the hash code is desired; may be null.
Returns
The hash code of the object; zero if the object is null.

◆ operator==()

bool berry::Expression::operator== ( const Object ) const
overridevirtual

A generic comparison method. Override this method in subclasses and cast to your derived class to provide a more detailed comparison.

Reimplemented from berry::Object.

◆ ToString()

QString berry::Expression::ToString ( ) const
overridevirtual

Returns a string representation of this object. The default implementation returns an empty string.

Reimplemented from berry::Object.

Member Data Documentation

◆ ATT_VALUE

const QString berry::Expression::ATT_VALUE
static

Name of the value attribute of an expression (value is value).

Definition at line 57 of file berryExpression.h.

◆ FALSE_EVAL

const Expression::Pointer berry::Expression::FALSE_EVAL
static

The expression corresponding to EvaluationResult#FALSE_EVAL.

Definition at line 136 of file berryExpression.h.

◆ HASH_CODE_NOT_COMPUTED

const uint berry::Expression::HASH_CODE_NOT_COMPUTED
static

The constant integer hash code value meaning the hash code has not yet been computed.

Definition at line 47 of file berryExpression.h.

◆ HASH_FACTOR

const uint berry::Expression::HASH_FACTOR
static

A factor for computing the hash code for all expressions.

Definition at line 52 of file berryExpression.h.

◆ TRUE_EVAL

const Expression::Pointer berry::Expression::TRUE_EVAL
static

The expression corresponding to EvaluationResult#TRUE_EVAL.

Definition at line 131 of file berryExpression.h.


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