Sleeping Wombat GUI  0.100
swGUI
Public Types | Public Member Functions | Public Attributes | Private Member Functions | List of all members
KeySet< KeyType > Struct Template Reference

Set of animation keys and interpolators. More...

#include <KeySet.h>

Public Types

typedef IInterpolator< KeyTypeInterpolator
 

Public Member Functions

 KeySet ()
 Constructor insert default KeyType in time 0.0;. More...
 
Key< KeyType > * GetKey (TimeType time)
 
bool AddKey (TimeType time, const KeyType &value)
 Adds key. If key exists updates this key. More...
 
bool AddKey (TimeType time, const KeyType &value, InterpolatorType type)
 Adds key. If key exists updates this key. More...
 
bool UpdateKey (TimeType time, const KeyType &value)
 Updates key. More...
 
bool RemoveKey (TimeType time)
 Removes key. Last key can't be removed. More...
 
KeyType Evaluate (TimeType time)
 
bool ChangeInterpolator (Size idx, UPtr< Interpolator > &&interpolator)
 

Public Attributes

std::vector< Key< KeyType > > Keys
 
std::vector< UPtr< Interpolator > > Interpolators
 

Private Member Functions

std::vector< Key< KeyType > >::iterator FindKey (TimeType time)
 
std::vector< Key< KeyType > >::iterator FindPlace (TimeType time)
 
void AddDefaultInterpolator (Size keyIndex)
 Adds default interpolator for given type. Adds interpolator defined by function DefaultInterpolators::Create< KeyType> for key added under given index. More...
 
void UpdateInterpolator (Size index)
 Updates interpolator under index. If interpolator doesn't exists, nothing bad happens. More...
 

Detailed Description

template<typename KeyType>
struct KeySet< KeyType >

Set of animation keys and interpolators.

Attention
You can directly access Keys and Interpolators arrays but it's better to use functions designed to do this.

Member Typedef Documentation

template<typename KeyType>
typedef IInterpolator< KeyType > KeySet< KeyType >::Interpolator

Constructor & Destructor Documentation

template<typename KeyType >
KeySet< KeyType >::KeySet ( )
inlineexplicit

Constructor insert default KeyType in time 0.0;.

Member Function Documentation

template<typename KeyType >
void KeySet< KeyType >::AddDefaultInterpolator ( Size  keyIndex)
inlineprivate

Adds default interpolator for given type. Adds interpolator defined by function DefaultInterpolators::Create< KeyType> for key added under given index.

Parameters
[in]keyIndexIndex of added key.
template<typename KeyType >
bool KeySet< KeyType >::AddKey ( TimeType  time,
const KeyType value 
)
inline

Adds key. If key exists updates this key.

Returns
Returns false if key existed and have been updated.
template<typename KeyType >
bool KeySet< KeyType >::AddKey ( TimeType  time,
const KeyType value,
InterpolatorType  type 
)
inline

Adds key. If key exists updates this key.

Parameters
[in]typeAdds one of built in interpolators.
Returns
Returns false if key existed and have been updated.
template<typename KeyType >
bool KeySet< KeyType >::ChangeInterpolator ( Size  idx,
UPtr< Interpolator > &&  interpolator 
)
inline
template<typename KeyType >
KeyType KeySet< KeyType >::Evaluate ( TimeType  time)
inline
Todo:
Check if we can find keywith std::lower_bound or FindPlace. Messure performance in cases with multiple keys and choose better version.
template<typename KeyType >
std::vector< Key< KeyType > >::iterator KeySet< KeyType >::FindKey ( TimeType  time)
inlineprivate
template<typename KeyType >
std::vector< Key< KeyType > >::iterator KeySet< KeyType >::FindPlace ( TimeType  time)
inlineprivate
template<typename KeyType >
Key< KeyType > * KeySet< KeyType >::GetKey ( TimeType  time)
inline
template<typename KeyType >
bool KeySet< KeyType >::RemoveKey ( TimeType  time)
inline

Removes key. Last key can't be removed.

Returns
Returns false if key couldn't be found or it was last key..
template<typename KeyType >
void KeySet< KeyType >::UpdateInterpolator ( Size  index)
inlineprivate

Updates interpolator under index. If interpolator doesn't exists, nothing bad happens.

template<typename KeyType >
bool KeySet< KeyType >::UpdateKey ( TimeType  time,
const KeyType value 
)
inline

Updates key.

Returns
Returns false if key couldn't be found.

Member Data Documentation

template<typename KeyType>
std::vector< UPtr< Interpolator > > KeySet< KeyType >::Interpolators
template<typename KeyType>
std::vector< Key< KeyType > > KeySet< KeyType >::Keys

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