#include <valfunc.h>
Inheritance diagram for ValueFunctionConstant:
Public Member Functions | |
ValueFunctionConstant (double Value=1.0) | |
Constructor The Constant ValueFunction always returns the same value! | |
virtual double | GetValue (double Position) |
To read the value of this function at a given position. | |
virtual ValueFunction * | Clone (void) |
Clone operator. Creates an exact copy of this object. | |
virtual BOOL | IsDifferent (ValueFunction *pOther) |
Comparator. Determines if 2 different ValueFunction objects are considered different. | |
virtual CamelotFileRecord * | WriteFileRecord (INT32 RecordTag, INT32 ExtraBytes, BaseCamelotFilter *pFilter) |
Saves a ValueFunction object to a Xara file. This function will create a new variable-sized record with the given record tag, and will write out whatever data is needed to save this ValueFunction's state to the file. | |
virtual ValueFunctionID | GetUniqueID (void) |
Protected Member Functions | |
virtual ValueFunction * | CreateAndReadFileRecord (CXaraFileRecord *pInputRecord) |
Loads a ValueFunction object from a record which was saved into a file using the WriteFileRecord call. This is called by the base class loader routine ReadFileRecord, which finds an appropriate instance of a derived class to call to load the data in question. | |
Protected Attributes | |
double | Value1 |
Private Member Functions | |
CC_DECLARE_DYNAMIC (ValueFunctionConstant) |
Definition at line 269 of file valfunc.h.
|
Constructor The Constant ValueFunction always returns the same value!
Definition at line 468 of file valfunc.cpp. 00469 { 00470 Value1 = Value; 00471 }
|
|
|
|
Clone operator. Creates an exact copy of this object.
Implements ValueFunction. Definition at line 512 of file valfunc.cpp. 00513 { 00514 ValueFunction *pClone = new ValueFunctionConstant(Value1); 00515 return(pClone); 00516 }
|
|
Loads a ValueFunction object from a record which was saved into a file using the WriteFileRecord call. This is called by the base class loader routine ReadFileRecord, which finds an appropriate instance of a derived class to call to load the data in question.
Implements ValueFunction. Definition at line 651 of file valfunc.cpp. 00652 { 00653 ERROR3IF(pInputRecord == NULL, "Illegal NULL param"); 00654 00655 float ConstValue = (float)1.0; 00656 pInputRecord->ReadFLOAT(&ConstValue); 00657 00658 return(new ValueFunctionConstant((double) ConstValue)); 00659 }
|
|
Implements ValueFunction. Definition at line 282 of file valfunc.h. 00282 { return(ValueFunctionID_Constant); };
|
|
To read the value of this function at a given position.
Implements ValueFunction. Definition at line 492 of file valfunc.cpp. 00493 { 00494 return(Value1); 00495 }
|
|
Comparator. Determines if 2 different ValueFunction objects are considered different.
Reimplemented from ValueFunction. Definition at line 541 of file valfunc.cpp. 00542 { 00543 if (ValueFunction::IsDifferent(pOther)) 00544 return(TRUE); 00545 00546 // Both objects are instances of this class, so compare them more carefully 00547 return(Value1 != ((ValueFunctionConstant *)pOther)->Value1); 00548 }
|
|
Saves a ValueFunction object to a Xara file. This function will create a new variable-sized record with the given record tag, and will write out whatever data is needed to save this ValueFunction's state to the file.
All ValueFunction record data has 3 sections, whiich are recorded as follows: 1. ValueFunction header, identifying which type of VF is being saved INT32 ValueFunctionUniqueID (4 bytes) 2. Derived-class-data (0 or more bytes). This particular class adds: float ConstantValue (4 bytes) 3. Caller data. This is written by the caller to the returned record object. This data must be ExtraBytes (0 or more) bytes in length.
Implements ValueFunction. Definition at line 594 of file valfunc.cpp. 00596 { 00597 ERROR3IF(pFilter == NULL, "Illegal NULL param"); 00598 ERROR3IF(ExtraBytes < 0, "Stupid ExtraBytes request in ValueFunction::WriteFileRecord"); 00599 00600 // Calculate how many bytes of information this VF will write. We do not include 00601 // the header info written by the base class or the ExtraInfo desired by the caller - 00602 // the base class adds all that in for us. 00603 const INT32 MyRecordSize = 4; 00604 00605 // Create an appropriate record, and write our data to it 00606 CamelotFileRecord *pRec = CreateAndWriteFileRecord(RecordTag, MyRecordSize, ExtraBytes, pFilter); 00607 00608 if (pRec != NULL) 00609 { 00610 // Write out our ValueFunction's specific data. If it fails, then we'll return NULL 00611 if (!pRec->WriteFLOAT((float)Value1)) 00612 { 00613 delete pRec; 00614 pRec = NULL; 00615 } 00616 } 00617 00618 return(pRec); 00619 }
|
|
|