My Project
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ParaEngine::CVariable Class Reference

represent any kind of static or animated variable, such as: string, double, float, int, bool, Vector3, Quaternion, or animated data with multiple time, value keys. More...

#include <Variable.h>

Inheritance diagram for ParaEngine::CVariable:
ParaEngine::CDynamicAttributeField

Public Member Functions

 CVariable (DWORD dwType=FieldType_unknown)
 
void Clone (const CVariable &value)
 clone from given variable
 
const char * GetTypeName () const
 
ATTRIBUTE_FIELDTYPE GetType () const
 
bool IsNil () const
 
bool IsStringType () const
 
bool IsAnimated ()
 whether the key is animated or not
 
void ChangeType (ATTRIBUTE_FIELDTYPE newType)
 change type to given type
 
void ToNPLString (std::string &output)
 In case of nil, it is "nil", in case of string, it is in quotation mark. More...
 
void operator= (const CVariable &val)
 
 operator double ()
 
void operator= (double value)
 
 operator float ()
 
void operator= (float value)
 
 operator int ()
 
 operator DWORD ()
 
void operator= (int value)
 
 operator Vector3 ()
 
void operator= (const Vector3 &value)
 
 operator Quaternion ()
 
void operator= (const Quaternion &value)
 
 operator bool ()
 
void operator= (bool value)
 
 operator const string & ()
 
 operator const char * ()
 
bool operator== (const string &value)
 
bool operator== (const char *value)
 
void operator= (const std::string &value)
 
void operator= (const char *value)
 
int GetNumKeys ()
 get total number of animated keys. More...
 
void SetNumKeys (int nKeyCount)
 get set the total number of animated keys. More...
 
int AddKey (int nTime, bool *isKeyExist=NULL)
 add a given key with default value at specified time if there is already a key at the index, we will return the old index. More...
 
void SetTime (int nIndex, int nTime)
 only applied to Animated attribute More...
 
int GetTime (int nIndex)
 
void SetValue (int nIndex, const Quaternion &val)
 
bool GetValue (int nIndex, Quaternion &val)
 
bool GetValueByTime (int nTime, Quaternion &val)
 get interpolated value at the given time. More...
 
void SetValue (int nIndex, const Vector3 &val)
 
bool GetValue (int nIndex, Vector3 &val)
 
bool GetValueByTime (int nTime, Vector3 &val)
 
void SetValue (int nIndex, double val)
 
bool GetValue (int nIndex, double &val)
 
bool GetValueByTime (int nTime, double &val)
 
void SetValue (int nIndex, float val)
 
bool GetValue (int nIndex, float &val)
 
bool GetValueByTime (int nTime, float &val)
 
void SetValue (int nIndex, const std::string &val)
 
bool GetValue (int nIndex, std::string &val)
 

Static Public Member Functions

static const char * GetTypeAsString (DWORD dwType)
 Get Type as string. More...
 

Protected Member Functions

int GetNextKeyIndex (int nTime)
 return the index of the first key whose time is larger than or equal to time. More...
 

Protected Attributes

DWORD m_type
 
union {
   double   m_doubleVal
 
   float   m_floatVal
 
   int   m_intVal
 
   bool   m_boolVal
 
   float   m_vector3 [3]
 
   float   m_vector4 [4]
 
}; 
 
IAnimatedm_pAnimated
 
std::string m_strVal
 

Detailed Description

represent any kind of static or animated variable, such as: string, double, float, int, bool, Vector3, Quaternion, or animated data with multiple time, value keys.

Member Function Documentation

§ AddKey()

int ParaEngine::CVariable::AddKey ( int  nTime,
bool *  isKeyExist = NULL 
)

add a given key with default value at specified time if there is already a key at the index, we will return the old index.

Parameters
isKeyExistif not NULL, it will return whether the given key already exist at the index. return the key index.

§ GetNextKeyIndex()

int ParaEngine::CVariable::GetNextKeyIndex ( int  nTime)
protected

return the index of the first key whose time is larger than or equal to time.

return -1 if no suitable index is found.

§ GetNumKeys()

int ParaEngine::CVariable::GetNumKeys ( )

get total number of animated keys.

For non-animated attribute, this will return 1.

§ GetTypeAsString()

const char * ParaEngine::CVariable::GetTypeAsString ( DWORD  dwType)
static

Get Type as string.

Parameters
dwTypetype of ATTRIBUTE_FIELDTYPE

§ GetValueByTime()

bool ParaEngine::CVariable::GetValueByTime ( int  nTime,
Quaternion val 
)

get interpolated value at the given time.

§ SetNumKeys()

void ParaEngine::CVariable::SetNumKeys ( int  nKeyCount)

get set the total number of animated keys.

§ SetTime()

void ParaEngine::CVariable::SetTime ( int  nIndex,
int  nTime 
)

only applied to Animated attribute

Parameters
nIndexkey index.
nTimein milliseconds

§ ToNPLString()

void ParaEngine::CVariable::ToNPLString ( std::string &  output)

In case of nil, it is "nil", in case of string, it is in quotation mark.

Parameters
outputit will append result to output

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