CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
Public Member Functions | List of all members
OdFdFieldEvaluator Class Referenceabstract

#include <FdField.h>

Inheritance diagram for OdFdFieldEvaluator:
OdRxObject

Public Member Functions

 ODRX_DECLARE_MEMBERS (OdFdFieldEvaluator)
 
virtual const OdString evaluatorId () const =0
 
virtual const OdString evaluatorId (OdDbField *pField) const =0
 
virtual OdResult initialize (OdDbField *pField) const =0
 
virtual OdResult compile (OdDbField *pField, OdDbDatabase *pDb, OdFdFieldResult *pResult) const =0
 
virtual OdResult evaluate (OdDbField *pField, int nContext, OdDbDatabase *pDb, OdFdFieldResult *pResult) const =0
 
virtual OdResult format (OdDbField *pField, OdString &pszValue) const =0
 
- Public Member Functions inherited from OdRxObject
 ODRX_HEAP_OPERATORS ()
 
 OdRxObject ()
 
virtual ~OdRxObject ()
 
virtual OdRxObjectqueryX (const OdRxClass *pClass) const
 
virtual OdRxObjectx (const OdRxClass *pClass) const
 
virtual OdRxClassisA () const
 
virtual void addRef ()=0
 
virtual void release ()=0
 
virtual long numRefs () const
 
bool isKindOf (const OdRxClass *pClass) const
 
virtual OdRxObjectPtr clone () const
 
virtual void copyFrom (const OdRxObject *pSource)
 
virtual OdRx::Ordering comparedTo (const OdRxObject *pOther) const
 
virtual bool isEqualTo (const OdRxObject *pOther) const
 

Additional Inherited Members

- Static Public Member Functions inherited from OdRxObject
static OdRxObjectPtr cast (const OdRxObject *pointer)
 
static OdRxClassdesc ()
 

Detailed Description

This class is an abstract base class that defines the field evaluator interface.

Remarks
Applications implement evaluators for fields by deriving from this class. The evaluator object instantiated from this class is obtained from the field evaluator loader using the evaluator ID stored in the field. An evaluator class can be implemented for each type of field, or a single evaluator class can support multiple types of fields.

<group Other_Classes>

Definition at line 54 of file FdField.h.

Member Function Documentation

◆ compile()

virtual OdResult OdFdFieldEvaluator::compile ( OdDbField pField,
OdDbDatabase pDb,
OdFdFieldResult pResult 
) const
pure virtual

This function is called by the field framework to compile a field when the field code is changed.

Parameters
pField[in] Input field to compile.
pDb[in] Input database pointer.
pResult[in] Input field result object to set the compilation status.
Remarks
The evaluator can do any parsing of the field code here and store the parsed data in the field. This method will be called only when the field code is changed, unlike evaluate(), which is called whenever the field needs to be evaluated.

◆ evaluate()

virtual OdResult OdFdFieldEvaluator::evaluate ( OdDbField pField,
int  nContext,
OdDbDatabase pDb,
OdFdFieldResult pResult 
) const
pure virtual

This function is called by the field framework when the field needs to be evaluated.

Parameters
pField[in] Input field to evaluate.
nContext[in] Input context in which the field is evaluated; this context flag is passed to the evaluator and can be one of the predefined by the OdDbField::EvalContext enumeration flags or a user-defined context flag.
pDb[in] Input database pointer, which can be NULL if a database could not be obtained in the current context.
pResult[in] Input field result object to set the evaluation result and status.
Remarks
A field will be evaluated only when the evaluation option set in the field matches the context in which the field evaluation is invoked. For example, if a field option is set to evaluate only manually, then the field will be evaluated only when the user updates the specific field or all fields in the drawing manually.

The evaluator should evaluate the field and set the evaluated value using OdFdFieldResult::setFieldValue() and the error status using OdFdFieldResult::setEvaluationStatus() in the passed result object, which in turn will set them in the field object.

The passed database pointer may be NULL if the field is not a database resident and a database could not be obtained in the current context. If the field evaluation requires a database, then this method can set the evaluation error status in the field result object and return an error.

If the evaluation fails for any reason, the previously cached result in the field object can be left intact and used as the field value. Alternatively, the cached result can be deleted and substituted with an error string (for example, "#ERR"), which will be displayed as a field value.

◆ evaluatorId() [1/2]

virtual const OdString OdFdFieldEvaluator::evaluatorId ( ) const
pure virtual

Returns the evaluator IDs supported by this evaluator.

Remarks
This function can return more than one evaluator ID if the evaluator supports multiple IDs. If more than one ID is returned, the evaluator IDs are separated by commas.

◆ evaluatorId() [2/2]

virtual const OdString OdFdFieldEvaluator::evaluatorId ( OdDbField pField) const
pure virtual

Returns the evaluator ID for the specified field code.

Parameters
pField[in] Input field for which to return an evaluator ID.
Remarks
This version will be called to find an evaluator for a field code that does not have an evaluator ID set. Implementations of this function should examine the field code. If the field code is recognized by the evaluator and can be handled by it, then this function should return the evaluator ID.

◆ format()

virtual OdResult OdFdFieldEvaluator::format ( OdDbField pField,
OdString pszValue 
) const
pure virtual

This function is called by the field framework when a field is queried to get the evaluated field value as a string.

Parameters
pField[in] Field whose value is to be formatted.
pszValue[out] Pointer to the string that is the field value formatted as a string.
Remarks
The evaluator can implement this method to support custom formatting of field values. If the evaluator does not implement this method, the standard data types will be formatted using default formats.

◆ initialize()

virtual OdResult OdFdFieldEvaluator::initialize ( OdDbField pField) const
pure virtual

This function is called by the field framework. It calls this method to initialize a new field.

Parameters
pField[in] Input field to initialize.
Remarks
This method is called after setting a field code in the field and before compile() is called. The evaluator can change the default options that are set in the field when it is created. This method will be called only once for a field.

◆ ODRX_DECLARE_MEMBERS()

OdFdFieldEvaluator::ODRX_DECLARE_MEMBERS ( OdFdFieldEvaluator  )

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