#include <DataBlock.h>


Public Types | |
| enum | ContinuityBreakTypes { kStop = 1, kSuddenChange = 2, kTeleport = 4 } |
Public Member Functions | |
| DataBlock () | |
| virtual | ~DataBlock () |
| virtual void | Poll (DataBlockReason *reason=0) |
| virtual void | ParseMessage (MessageHelper *message) |
| void | SetVariableName (const char *name=0) |
| void | BindReplicaNet (ReplicaNet *current) |
| void | BindReplicaObject (ReplicaObject *object) |
| void | SetReliableFlag (bool reliable=false) |
| bool | GetReliableFlag (void) |
| void | SetCertainFlag (bool certain=false) |
| bool | GetCertainFlag (void) |
| void | SetAutomaticUpdatesFlag (bool automatic=true) |
| bool | GetAutomaticUpdatesFlag (void) |
| virtual void | GiveDeltaHint (void *pdata, int dataLen) |
| void | GiveDeltaHint (float delta) |
| virtual void | ContinuityBreak (unsigned char breakTypes) |
| virtual bool | IsAttached (void *data) |
| virtual bool | IsAllocated (void) const |
| void | SetIsAllocated (const bool isAllocated=true) |
| void | SetUpdateDelayMinimum (const float delay=0.0f) |
| float | GetUpdateDelayMinimum (void) const |
| void | SetForceSendMaximumUpdates (const int updates=0) |
| int | GetForceSendMaximumUpdates (void) const |
| void | SetForceSendTimeDelay (const float delay=0.0f) |
| float | GetForceSendTimeDelay (void) const |
| void | SetBand (const unsigned int band=0) |
| unsigned int | GetBand (void) const |
Protected Member Functions | |
| void | SetID (int id) |
| const char * | GetROName (ReplicaObject *from=0) |
| void | EmitBaseDebugInfo (const char *name, const char *className, DataBlockReason *reason) |
| void | EmitBaseDebugInfoUpdates (const char *name, const char *className, DataBlockReason *reason) |
| std::string | GetVariableName (void) |
Protected Attributes | |
| short | mID |
| ReplicaNet * | mBoundReplicaNet |
| ReplicaObject * | mBoundObject |
| bool | mReliable |
| bool | mCertain |
| bool | mAutomaticUpdates |
| bool | mIsAllocated |
| bool | mDebugOn |
| char * | mDebugText |
| float | mUpdateDelayMinimum |
| int | mForceSendMaximumUpdates |
| float | mForceSendTimeDelay |
| char * | mVariableName |
| unsigned int | mBand |
Friends | |
| class | ReplicaObject |
| enum ContinuityBreakTypes |
Enums for the continuity break function
| kStop | Indicates the data set value has stopped changing for the time being |
| kSuddenChange | Indicates a sudden change in direction or movement |
| kTeleport | Indicates the value has a large dislocation i.e. An object has teleported. This can result in an update being calculated and sent for a DataBlock so use with care. |
| DataBlock | ( | ) |
The ctor performs some basic initialisation
| virtual ~DataBlock | ( | ) | [virtual] |
The dtor makes sure everything is tidy
| virtual void Poll | ( | DataBlockReason * | reason = 0 |
) | [virtual] |
A poll function that is called by ReplicaNet to check for updates to this particular data block. If this virtual method is implemented by a derived class this base class method should be called before a data packet is created. Processing for this function may occur during the thread context of ReplicaNet so processing time used by this function should be kept to a minimum to avoid performance issues.
| reason | the reason code that is passed in to this class to enable a response to be calculated |
Reimplemented in DataBlock_Function, DataBlock_NData, and DataBlock_Predict_Float.
| virtual void ParseMessage | ( | MessageHelper * | message | ) | [virtual] |
This parses a message for the derived class of this data block. Processing for this function may occur during the thread context of ReplicaNet so processing time used by this function should be kept to a minimum to avoid performance issues.
| message | The current message buffer that contains the packet data |
Reimplemented in DataBlock_Function, DataBlock_NData, and DataBlock_Predict_Float.
| void SetVariableName | ( | const char * | name = 0 |
) |
Sets the name of the variable attached to this DataBlock which is then used to output extended debugging information using the registered DebugHandler if available. The default value for the variable name is null. This function is used by ReplicaNet and the standard DataBlocks added to objects using the ROL Language if the preprocessor define REPLICANET_VISUALDEBUGGER is used. For user allocated DataBlocks this function can be used to set extra debugging information, such as the variable name, useful to the author. Each DataBlock implementation can choose to not output debug information if there is no name set. The standard DataBlocks included with ReplicaNet output the DataBlock class name with a unique hex number identifier prefixed with "<Unknown>" if the variable name is null.
| name | The name of the variable. |
| void BindReplicaNet | ( | ReplicaNet * | current | ) |
Bind this data block with the ReplicaNet pointer. This is called from ReplicaObject::RegisterDataBlock()
| current | the ReplicaNet pointer |
| void BindReplicaObject | ( | ReplicaObject * | object | ) |
Bind this data block with the ReplicaObject pointer. This is called from ReplicaObject::RegisterDataBlock()
| current | the ReplicaObject pointer |
| void SetReliableFlag | ( | bool | reliable = false |
) |
Sets the reliable flag for a particular data set
| reliable | set to true if this data block is meant to be reliable and the certain update is set to be false. The default is false |
| bool GetReliableFlag | ( | void | ) |
Gets the reliable flag for a particular data set
| void SetCertainFlag | ( | bool | certain = false |
) |
Sets the certain flag for a particular data set
| certain | set to true if this data block is meant to be certain and the reliable update is set to be false. The default is false |
| bool GetCertainFlag | ( | void | ) |
Gets the reliable flag for a particular data set
| void SetAutomaticUpdatesFlag | ( | bool | automatic = true |
) |
Sets the automatic update flag for a particular data set. By default a datablock will calculate the best time to create an update for a particular set of data. If the automatic updates are switched off then the datablock relies on hints from the user to calculate updates.
| automatic | set to true if this data block is meant to be automatically updated. The default is true |
| bool GetAutomaticUpdatesFlag | ( | void | ) |
Gets the automatic update flag for a particular data set
| virtual void GiveDeltaHint | ( | void * | pdata, | |
| int | dataLen | |||
| ) | [virtual] |
This is a feedback function used by a master ReplicaObject that enables an application to give a delta hint to a DataBlock. The delta should be expressed in units of change per second.
| pdata | the pointer to the data type to give a hint for | |
| dataLem | the length of the data type |
Reimplemented in DataBlock_Predict_Float.
| void GiveDeltaHint | ( | float | delta | ) | [inline] |
This is a feedback function used by a master ReplicaObject that enables an application to give a delta hint to a DataBlock. This float type call maps to the opaque data type call.
| This | delta hint is a float type |
Reimplemented in DataBlock_Predict_Float.
| virtual void ContinuityBreak | ( | unsigned char | breakTypes | ) | [virtual] |
This is used by a master ReplicaObject to set a continuity break for the data block and provides useful information to any extrapolation algorithms.
| breakTypes | The break types to use for this break. For example : DataBlock::kSuddenChange | DataBlock::kTeleport |
Reimplemented in DataBlock_Predict_Float.
| virtual bool IsAttached | ( | void * | data | ) | [virtual] |
Given a data pointer this function identifies if this data block is attached to the pointer.
Reimplemented in DataBlock_Function, DataBlock_NData, and DataBlock_Predict_Float.
| virtual bool IsAllocated | ( | void | ) | const [virtual] |
| void SetIsAllocated | ( | const bool | isAllocated = true |
) |
| void SetUpdateDelayMinimum | ( | const float | delay = 0.0f |
) |
This sets the minimum possible delay between each update, due to a DataBlock filter condition being met, for this datablock to each ReplicaObject. This allows the bandwidth for this DataBlock to be fine tuned. A value of 1.0f will mean a maximum of 1 update per second to each ReplicaObject. A value of 0.2f will mean a maximum possible 5 updates due to filter conditions per second, one every 0.2 seconds, to each ReplicaObject. This setting is separate from SetForceSendTimeDelay() This can be changed by the user at any time. The default value is 0.0f which disables this mechanism. The actual mechanism is implemented by the derived DataBlock. For user extended DataBlocks this mechanism can be ignored if the DataBlock filter policy method does not require this functionality.
| delay | The minimum delay in seconds. |
| float GetUpdateDelayMinimum | ( | void | ) | const |
This function returns the value set by SetUpdateDelayMinimum()
| void SetForceSendMaximumUpdates | ( | const int | updates = 0 |
) |
This sets the maximum number of consecutive force updates that can be sent from this DataBlock to each ReplicaObject. Forced updates are sent for this DataBlock to a ReplicaObject if the time since the last update, either due to the update filter policy or due to a forced update, is greater than the time set by SetForceSendTimeDelay(). Usually the best possible approximation of the DataBlock change calculated at the time is used. If a normal DataBlock update is sent, in other words an update falls within the DataBlock update filter policy, then the trigger for forced updates is set allowing consecutive forced updates to be started. This feature is useful for unreliable updates where DataBlocks that do not change often usually causing fewer DataBlock updates can be refreshed or force updated. It is a good idea, but not required, to set SetForceSendTimeDelay() before setting this value to be anything greater than 0 because the default value of 0.0f for SetForceSendTimeDelay() could cause many quick consecutive updates to be sent. This can be changed by the user at any time. The default value is 0 which disables this mechanism. The actual mechanism is implemented by the derived DataBlock. For user extended DataBlocks this mechanism can be ignored if the DataBlock filter policy method does not require this functionality.
| int GetForceSendMaximumUpdates | ( | void | ) | const |
This function returns the value set by SetUpdateDelayMaximum()
| void SetForceSendTimeDelay | ( | const float | delay = 0.0f |
) |
This sets a time delay from the previous DataBlock update to a ReplicaObject before another forced send update is required. Setting this to be 0.2f causes a forced send update to be sent if the time since the last DataBlock update is more than 0.2f seconds. Therefore if SetForceSendTimeDelay(0.3f) and SetForceSendMaximumUpdates(3) is used, then a DataBlock that stops changing will get 3 extra updates with a delay of 0.3f of a second between each update. This setting for forced updates overrides the SetUpdateDelayMaximum() setting. This can be changed by the user at any time. The default value is 0.0f which then causes delays to be sent every internal ReplicaNet poll as required by SetMaximumForceSendUpdates() The actual mechanism is implemented by the derived DataBlock. For user extended DataBlocks this mechanism can be ignored if the DataBlock filter policy method does not require this functionality.
| float GetForceSendTimeDelay | ( | void | ) | const |
This function returns the value set by SetUpdateDelayMaximum()
| void SetBand | ( | const unsigned int | band = 0 |
) |
| unsigned int GetBand | ( | void | ) | const |
This function returns the value set by SetBand()
| void SetID | ( | int | id | ) | [protected] |
This sets the ID of the data block when it is used in a ReplicaObject. This function is called from ReplicaObject::RegisterDataBlock()
1.5.3