ValueFunctionRamp Class Reference

Provides an interface by which the caller can obtain the value of a given function at a given "position". More...

#include <valfunc.h>

Inheritance diagram for ValueFunctionRamp:

ValueFunction ListItem CCObject SimpleCCObject ValueFunctionBevelEnds ValueFunctionDecay ValueFunctionDoubleRampS ValueFunctionIntestine ValueFunctionPropeller ValueFunctionRampL ValueFunctionRampL2 ValueFunctionRampLinear ValueFunctionRampS ValueFunctionRampS2 ValueFunctionSawTooth List of all members.

Public Member Functions

 ValueFunctionRamp (double StartValue=1.0, double EndValue=0.0)
 Constructor Ramp functions interpolate between two values in some fashion Derived classes provide such things as linear and sine-wave interpolations.
virtual BOOL IsDifferent (ValueFunction *pOther)
 Comparator. Determines if 2 different ValueFunction objects are considered different.
virtual CamelotFileRecordWriteFileRecord (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.

Protected Attributes

double Value1
double Value2

Private Member Functions

 CC_DECLARE_DYNAMIC (ValueFunctionRamp)

Detailed Description

Provides an interface by which the caller can obtain the value of a given function at a given "position".

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/12/96
ValueFunctionRampLinear provides a linear ramp between 2 values

ValueFunctionRampS provides a half-sine-wave (S) ramp between 2 values

Definition at line 367 of file valfunc.h.


Constructor & Destructor Documentation

ValueFunctionRamp::ValueFunctionRamp double  StartValue = 1.0,
double  EndValue = 0.0
 

Constructor Ramp functions interpolate between two values in some fashion Derived classes provide such things as linear and sine-wave interpolations.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/12/96
Parameters:
StartValue - The value to be used at the 0.0 position [INPUTS] EndValue - The value to be used at the 1.0 position

Definition at line 945 of file valfunc.cpp.

00946 {
00947     Value1 = StartValue;
00948     Value2 = EndValue;
00949 }


Member Function Documentation

ValueFunctionRamp::CC_DECLARE_DYNAMIC ValueFunctionRamp   )  [private]
 

BOOL ValueFunctionRamp::IsDifferent ValueFunction pOther  )  [virtual]
 

Comparator. Determines if 2 different ValueFunction objects are considered different.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/1/97
Parameters:
pOther - Another ValueFunction object to compare this one to [INPUTS]
Returns:
TRUE if the objects are considered different, FALSE if they are considered identical
Notes: Calls the base class to see if they are different classes, and then compares identical classes by checking member vars

Reimplemented from ValueFunction.

Definition at line 974 of file valfunc.cpp.

00975 {
00976     if (ValueFunction::IsDifferent(pOther))
00977         return(TRUE);
00978     
00979     // Both objects are instances of this class, so compare them more carefully
00980     return( (Value1 != ((ValueFunctionRamp *)pOther)->Value1) ||
00981             (Value2 != ((ValueFunctionRamp *)pOther)->Value2) );
00982 }

CamelotFileRecord * ValueFunctionRamp::WriteFileRecord INT32  RecordTag,
INT32  ExtraBytes,
BaseCamelotFilter pFilter
[virtual]
 

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.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/1/97
Parameters:
RecordTag - the tag to write this record under [INPUTS] ExtraBytes - The number of extra bytes of information the caller will write into the record after caling this function (Space for this many extra bytes will be reserved by this function when it creates the new file record) This may be 0 or more bytes. pFilter - The filter to write to
Returns:
NULL if it failed, else a pointer to a record which saves the state of this valueFunction object. Once the caller has written the record, they MUST DELETE it.
"ExtraBytes" bytes will be added to the record size to reserve space at the end of the record for the caller to add their own data. This is to allow ValueFunctions to be saved embedded in other object's record structures (e.g. inside different types of attributes).

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 Value1 float Value2 (8 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 1027 of file valfunc.cpp.

01029 {
01030     ERROR3IF(pFilter == NULL, "Illegal NULL param");
01031     ERROR3IF(ExtraBytes < 0, "Stupid ExtraBytes request in ValueFunction::WriteFileRecord");
01032 
01033     // Calculate how many bytes of information this VF will write. We do not include
01034     // the header info written by the base class or the ExtraInfo desired by the caller -
01035     // the base class adds all that in for us.
01036     const INT32 MyRecordSize = 8;
01037 
01038     // Create an appropriate record, and write our data to it
01039     CamelotFileRecord *pRec = CreateAndWriteFileRecord(RecordTag, MyRecordSize, ExtraBytes, pFilter);
01040 
01041     if (pRec != NULL)
01042     {
01043         BOOL ok = TRUE;
01044         if (ok)     ok = pRec->WriteFLOAT((FLOAT) Value1);
01045         if (ok)     ok = pRec->WriteFLOAT((FLOAT) Value2);
01046 
01047         if (!ok)            // If we failed, clean up & return NULL
01048         {
01049             delete pRec;
01050             pRec = NULL;
01051         }
01052     }
01053 
01054     return(pRec);
01055 }


Member Data Documentation

double ValueFunctionRamp::Value1 [protected]
 

Definition at line 379 of file valfunc.h.

double ValueFunctionRamp::Value2 [protected]
 

Definition at line 380 of file valfunc.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 04:02:48 2007 for Camelot by  doxygen 1.4.4