CTR Pia  4.11.3
Game Communication Engine
nn::pia::reckoning::Simple3dReckoningStrategy Class Reference

The ReckoningStrategy class interpolates 3D vectors using linear evaluation functions. More...

Classes

struct  SampleValue
 Contains a value and a stop flag as a set. More...
 
struct  Work
 Stores the pre-calculated result for prediction. More...
 

Public Types

typedef ReckoningCloneElementBase::SampleAccessor< SampleAccessor
 Defines the accessor for the sample buffer.
 
typedef SampleValue Sample
 Specifies the actual type of the sample that is sent and received.
 
typedef bool SetValueArg
 Specifies the type of data to pass to CheckSample and MakeSample when calling SetValue.
 
typedef Vector3f Value
 Specifies the type of value that is set and retrieved using SetValue and GetValue.
 

Public Member Functions

 Simple3dReckoningStrategy (f32 threshold)
 Instantiates the object with default parameters (default constructor). More...
 
bool CheckSample (bool *pIsReliable, const Value &value, const SetValueArg *cpSetValueArg, const Accessor &accessor, nn::pia::clone::ClockValue clock, const Work *cpWork) const
 Determines whether to use the value set with SetValue as a sample. More...
 
bool Estimate (Value *pValue, const Accessor &accessor, nn::pia::clone::ClockValue clock, const Work *cpWork) const
 Calculates the prediction. More...
 
f32 GetThreshold ()
 Gets the threshold to use when determining whether to use the value set using SetValue as a sample. More...
 
void MakeSample (Sample *pSample, const Value &value, const SetValueArg *cpSetValueArg, const Accessor &accessor, nn::pia::clone::ClockValue clock, const Work *cpWork) const
 Calculates the value to save as a sample. More...
 
void OnUpdateSample (const Accessor &accessor, int index, Work *pWork) const
 This is called when a sample is added. More...
 
void SetThreshold (f32 threshold)
 Sets the threshold to use when determining whether to use the value set using SetValue as a sample. More...
 
void Trace (u64 flag) const
 Prints information that is useful for debugging. More...
 

Static Public Attributes

static const size_t BUFFER_SIZE = 10
 Specifies the size of the buffer that holds samples.
 

Detailed Description

The ReckoningStrategy class interpolates 3D vectors using linear evaluation functions.


Revision History:
2013-10-29 Initial version.

Constructor & Destructor Documentation

nn::pia::reckoning::Simple3dReckoningStrategy::Simple3dReckoningStrategy ( f32  threshold)

Instantiates the object with default parameters (default constructor).

Parameters
[in]thresholdSpecifies the threshold value to use for determination.

Member Function Documentation

bool nn::pia::reckoning::Simple3dReckoningStrategy::CheckSample ( bool *  pIsReliable,
const Value value,
const SetValueArg cpSetValueArg,
const Accessor accessor,
nn::pia::clone::ClockValue  clock,
const Work cpWork 
) const

Determines whether to use the value set with SetValue as a sample.

Parameters
[out]pIsReliableOutputs whether reliable communication needs to be used when sending the sample.
[in]valueSpecify the value that was set with SetValue.
[in]cpSetValueArgSpecify the value that was set in the second parameter of SetValue. This flag specifies whether value is stopped.
[in]accessorSpecifies the accessor for the sample buffer.
[in]clockSpecifies the current clock.
[in]cpWorkSpecifies the pre-calculated result for calculating the prediction.
Returns
Returns true if the value will be used as a sample.
bool nn::pia::reckoning::Simple3dReckoningStrategy::Estimate ( Value pValue,
const Accessor accessor,
nn::pia::clone::ClockValue  clock,
const Work cpWork 
) const

Calculates the prediction.

Parameters
[out]pValueOutputs the prediction.
[in]accessorSpecifies the accessor for the sample buffer.
[in]clockSpecifies the current clock.
[in]cpWorkSpecifies the pre-calculated result for calculating the prediction.
Returns
Returns true and stores the prediction in pValue if successful.
f32 nn::pia::reckoning::Simple3dReckoningStrategy::GetThreshold ( )
inline

Gets the threshold to use when determining whether to use the value set using SetValue as a sample.

Returns
Returns the threshold value to use for determination.
void nn::pia::reckoning::Simple3dReckoningStrategy::MakeSample ( Sample pSample,
const Value value,
const SetValueArg cpSetValueArg,
const Accessor accessor,
nn::pia::clone::ClockValue  clock,
const Work cpWork 
) const

Calculates the value to save as a sample.

This is called when CheckSample determines the value is to be used as a sample and the buffer was successfully allocated.

Parameters
[out]pSampleOutputs the sample.
[in]valueSpecify the value that was set with SetValue.
[in]cpSetValueArgSpecify the value that was set in the second parameter of SetValue. This flag specifies whether value is stopped.
[in]accessorSpecifies the accessor for the sample buffer.
[in]clockSpecifies the current clock.
[in]cpWorkSpecifies the pre-calculated result for calculating the prediction.
void nn::pia::reckoning::Simple3dReckoningStrategy::OnUpdateSample ( const Accessor accessor,
int  index,
Work pWork 
) const

This is called when a sample is added.

This function updates the parameters used to calculate the prediction.

Parameters
[in]accessorSpecifies the accessor for the sample buffer.
[in]indexSpecifies the index of the sample.
[in]pWorkSpecifies the pre-calculated result for calculating the prediction.
void nn::pia::reckoning::Simple3dReckoningStrategy::SetThreshold ( f32  threshold)

Sets the threshold to use when determining whether to use the value set using SetValue as a sample.

Parameters
[in]thresholdSpecifies the threshold value to use for determination.
void nn::pia::reckoning::Simple3dReckoningStrategy::Trace ( u64  flag) const

Prints information that is useful for debugging.

Parameters
[in]flagSpecifies the bitwise OR of trace flags. For more information, see the TraceFlag type.