32 for (
int i=0;i<nSize;++i)
34 m_times[i] = INVALID_TIME;
48 if(m_nCurrentPos<0 || m_nCurrentPos>=m_nSize)
50 m_times.resize(m_nSize, INVALID_TIME);
51 m_values.resize(m_nSize);
63 if(m_nCurrentPos>=m_nSize)
76 m_times[m_nCurrentPos] = time;
77 m_values[m_nCurrentPos] = value;
86 nPos = m_nCurrentPos+nPos;
93 else if(nPos>=m_nSize)
101 return m_times[nPos];
112 nPos = m_nCurrentPos+nPos;
117 return m_values[nPos];
119 else if(nPos>=m_nSize)
123 return m_values[nPos];
127 return m_values[nPos];
141 if(
GetTime(nPos) == INVALID_TIME)
143 nPos = m_nCurrentPos+nPos;
149 value = m_values[nPos];
153 else if(nPos>=m_nSize)
158 value = m_values[nPos];
164 value = m_values[nPos];
180 if(m_times[m_nCurrentPos] == INVALID_TIME)
182 return (m_values[m_nCurrentPos] == right);
191 bool bFirstValue =
true;
192 bool bConstant =
false;
194 for (
int i=0;i<m_nSize;++i)
196 if( m_times[i] != INVALID_TIME)
200 lastValue = m_values[i];
206 if(lastValue != m_values[i])
217 vector <int> m_times;
221 static const int INVALID_TIME = -1;
233 return EqualsTo(&(right[0]), (
int)right.size());
242 memcpy(&((*
this)[0]), pData, nSize);
249 SetData(&(right[0]), (
int)right.size());
256 if((
int)(this->size()) == nSize)
259 for (;i<nSize && ((*this)[i]==pData[i]);++i)
bool GetValue(T &value, int nPos)
get the value in history.
Definition: ValueTracker.h:139
bool IsConstant()
return whether all values in the tracker are the same.
Definition: ValueTracker.h:189
void Push(int time, const T &value)
push a new item to the tracker.
Definition: ValueTracker.h:60
void SetSize(int nSize)
set how many items to be kept in the tracker
Definition: ValueTracker.h:44
different physics engine has different winding order.
Definition: EventBinding.h:32
const T & GetValue(int nPos=0)
get the value in history.
Definition: ValueTracker.h:110
int GetTime(int nPos=0)
get the time in history.
Definition: ValueTracker.h:84
void Update(int time, const T &value)
update the current (latest) value
Definition: ValueTracker.h:74
void SetData(const byte *pData, int nSize)
set data
Definition: ValueTracker.h:237
BOOL CompareWith(const T &right)
return true if the last value.
Definition: ValueTracker.h:178
Definition: enum_maker.hpp:46
void Reset()
make the tracker empty
Definition: ValueTracker.h:29
int GetSize()
Get how many items to be kept in the tracker.
Definition: ValueTracker.h:39
bool EqualsTo(const byte *pData, int nSize)
compare
Definition: ValueTracker.h:254
a class for tracking the history of values.
Definition: ValueTracker.h:14
for tracking binary data, such as custom model data.
Definition: ValueTracker.h:227