#include <ReplicaObject.h>
Collaboration diagram for RNReplicaNet::ReplicaObject:
Public Member Functions | |
ReplicaObject () | |
virtual | ~ReplicaObject () |
bool | IsReplica (void) const |
bool | IsMaster (void) const |
void | Publish (void) |
virtual const int | GetClassID (void)=0 |
virtual void | SetRegistered (bool flag=true)=0 |
virtual bool | GetRegistered (void)=0 |
int | GetUniqueID (void) |
int | GetSessionID (void) |
ReplicaNet * | GetBoundReplicaNet (void) |
virtual bool | ApproveFault (void) |
virtual bool | ApproveMigration (void) |
virtual void | OwnerChange (void) |
void | GiveOwnership (int sessionID) |
void | RequestOwnership (void) |
virtual float | CalculateDistanceToObject (ReplicaObject *object) |
float | GetDistanceToObject (ReplicaObject *object) |
virtual void | SetOpaquePointer (void *data) |
virtual void * | GetOpaquePointer (void *data=0) |
DataBlock * | FindDataBlock (void *pdata) |
void | GiveDeltaHint (float &variable, float delta) |
void | ContinuityBreak (float &variable, unsigned char breakTypes) |
void | UpdateSetReliable (void) |
void | UpdateSetCertain (void) |
void | UpdateSetUnreliable (void) |
bool | UpdateIsReliable (void) |
bool | UpdateIsCertain (void) |
bool | UpdateIsUnreliable (void) |
void | SetLoadBalancing (const bool enable=false) |
void | SetLoadBalancingDefault (const bool defaultValue=false) |
bool | GetLoadBalancing (void) |
void | SetLoadScore (const float load=0.0f) |
void | SetLoadScoreDefault (const float defaultLoad=0.0f) |
float | GetLoadScore (void) |
virtual void | PostObjectCreate (void) |
virtual void | UserRegisterDataBlocks (void) |
void | AddAutoRegisterDataBlock (DataBlock *const dataBlock) |
void | SetMessageReflectionID (const int sessionID=kReplicaObjectUnknownUniqueID) |
int | GetMessageReflectionID (void) const |
void | SetPropagateToSessionDistance (const float distance=kReplicaObject_InfiniteDistance) |
void | SetPropagateToSessionDistanceDefault (const float distance=kReplicaObject_InfiniteDistance) |
float | GetPropagateToSessionDistance (void) const |
void | SetPropagateToSessionDistanceRecalculationDelay (const float delay=0.1f) |
void | SetSessionPropagationFilter (const bool enable=false) |
bool | GetSessionPropagationFilter (void) const |
void | GetSessionPropagationSet (std::set< int > &theSet) |
bool | SessionPropagationAddSession (const int sessionID) |
bool | SessionPropagationRemoveSession (const int sessionID) |
virtual void | DataBlockPacketDataReceived (const DataBlock *datablock) |
virtual s_RO_RegistryBlock * | GetRegistryBlock (void) const =0 |
Static Public Member Functions | |
static ReplicaObject * | AllocateForReplicaNet (void) |
static void | DeleteForReplicaNet (ReplicaObject *object) |
Protected Member Functions | |
virtual void | _Internal_GetUpdateType (void) |
virtual void | _Internal_SetupLoadBalance (void) |
virtual void | _Internal_SetupLoadBalanceScore (void) |
virtual void | _Internal_SetupLoadBalanceDefault (void) |
virtual void | _Internal_SetupLoadBalanceScoreDefault (void) |
virtual void | _Internal_SetupOpaquePointer (void) |
virtual void | _Internal_SetupPropagateDistance (void) |
virtual void | _Internal_SetupPropagateDistanceDefault (void) |
void | _Internal_SetFullyQualifiedName (const char *name=0) |
const char * | _Internal_GetFullyQualifiedName (void) |
void | _DebugInternal_EmitClassCreate (const int packetSize, const int toSession) |
void | _DebugInternal_EmitClassDelete (const int packetSize, const int toSession) |
virtual void | RegisterDataBlock (DataBlock *block) |
Protected Attributes | |
bool | mDataBlocksRegistered |
Friends | |
class | ReplicaNet |
class | ReplicaNetPrivate |
struct | SessionUnique |
class | DataBlock |
|
The ctor performs some basic initialisation |
|
The dtor makes sure everything is tidy. If this object has been published the dtor also calls ReplicaNet::RemoveObject(this) to remove the references ReplicaNet holds about this object. |
|
This function allows DataBlocks to automatically register when a ReplicaObject is created. It is required that the same DataBlocks are registered in the same order for all master and replica objects.
|
|
This static function can be defined in a derived class to enable the allocation of a ReplicaObjet derived class to be implemented. The default implementation is to use new.
|
|
Use this virtual callback to approve or deny that this object is fault tolerant and can change owner when a session leaves.
|
|
Use this virtual callback to approve or deny that this object can migrate when a migrate request is made.
|
|
The callback for calculating the distance to an object. This can (and should) be replaced by the application's object types.
|
|
This is used to set a continuity break for the data set and provides useful information to the extrapolation algorithm
|
|
This virtual callback is triggered by ReplicaNet every time an update packet for a DataBlock is received. See also FindDataBlock()
|
|
This static function can be defined in a derived class to enable the de-allocation of a ReplicaObjet derived class to be implemented. The default implementation is to use delete. Care must be taken to use ReplicaNet::RemoveObject(this) properly to remove references held by ReplicaNet if this function is user implemented.
|
|
Given a pointer to memory this functions finds a data block attached to that memory area
|
|
Gets the object's bound ReplicaNet class
|
|
Gets the class id that is set
|
|
Gets the distance to another supplied ReplicaObject. This function applies a caching mechanism to avoid too many unwanted calculations
|
|
Gets the status of the load balancing flag
|
|
Gets the object to report a score based on its "load" for the master session. The definition of "load" units is left to the user. The default return value is 0.0f
|
|
This function gets the sessionID used to reflect message updates
|
|
This is a useful virtual call that can be used to obtain opaque pointers to classes or data in a ReplicaObject or the derived class
|
|
Allows the distance value to be read for this ReplicaObject set by SetPropagateToSessionDistance(). This function can be used on a master or replica ReplicaObject
|
|
Returns the registered flag status of this class
|
|
A pure virtual access method to return the registry block associated with this ReplicaObject class type. This registry block is set when the ReplicaObject derived class is registered with ReplicaNet and the standard interface is implemented by the macro _RO_DO_STD_FRAMEWORK()
|
|
Returns the session id of the object which is global for the whole network session
|
|
Allows the status of the session propagation filter mechanism to be read.
|
|
Gets the current propagation set.
|
|
Returns the unique id of the object local to the session. To identify an object for the entire network session you need to use GetUniqueID() and GetSessionID().
|
|
This gives a delta hint for a particular variable that has a float type
|
|
This tries to change the ownership on a ReplicaObject to another session. This only succeeds if the ReplicaObject is a Master object. This only succeeds if the ApproveMigration() callback returns true for the object.
|
|
Tests the status of the object to see if it is a master object
|
|
Tests the status of the object to see if it is a master object
|
|
This callback is used whenever an object changes owner |
|
This virtual method callback is called by ReplicaNet when a class is created and the initial data from the data blocks has been filled in. The user can choose to override this function if needed. The base class method does not need to be called. |
|
Publish this object on to the network. This uses ReplicaNet::AddObject(this) to add a reference of this object to ReplicaNet. |
|
Registers a datablock from the derived class to this class. This calls DataBlock::BindReplicaNet(ReplicaObject::GetBoundReplicaNet()), DataBlock::BindReplicaObject(ReplicaObject::this) and DataBlock::SetID(theNextInternalID)
|
|
This requests a change of the ownership on a ReplicaObject to be the calling session. This only succeeds if the ReplicaObject is a Replica. This only succeeds if the ApproveMigration() callback returns true for the object. |
|
When the session propagation filter mechanism is enabled this function tells this ReplicaObject to propagate to the supplied session ID. This function will only operate correctly when the session propagation filter mechanism is enabled. The session ID must be a valid ID known to the network session. The session ID from the callback ReplicaNet::JoinerSessionIDPre() can be safely added to objects. If the session ID has already been added to the list (without a corresponding remove) then ReplicaNet will ignore extra additions.
|
|
When the session propagation filter mechanism is enabled this function tells this ReplicaObject to finish propagating to the supplied session ID. This function will only operate correctly when the session propagation filter mechanism is enabled. The session ID must be a valid ID known to the network session. The session ID from the callback ReplicaNet::LeaverSessionIDPre() can be safely added to objects. If the session ID has already been removed from the list (without a corresponding add) then ReplicaNet will ignore extra remove requests.
|
|
Enables or disables load balancing for this ReplicaObject.
|
|
This sets the default value that the load balancing uses. Setting the default value in the object constructor to the same value that is set for the load balancing will result in a smaller data packet being sent.
|
|
Sets the object load unit score.. The definition of "load" units is left to the user. The default return value is 0.0f
|
|
This sets the default value that the load balancing score uses. Setting the default value in the object constructor to the same value that is set for the load balancing will result in a smaller data packet being sent when an object is published. When setting a default value the same value must be set on the master and all replica objects otherwise the different sessions will assume different default values. If a replica is unable to know that other replicas will set the same default value then not using the function will ensure that the correct value is propagated.
|
|
This function allows an object to state which sessionID should be used for sending messages to other sessions. By default the master object is used to send DataBlock and message updates.
|
|
This is a useful virtual call that can be used to set an opaque pointer to classes or data in a ReplicaObject or the derived class
|
|
This functions sets the distance that an object has to be within for it to be propagated relative to a session observer. If a session has an observer and the CalculateDistanceToObject() result is greater than the value specified then the session will not receive object updates. If a session has no registered observer then the object will always be propagated to that session. It is therefore a good idea to publish and set the observer for a session before joining a ReplicaNet session so that the joining session does not receive objects that will then quickly get removed again. The default value for a ReplicaObject is to have this distance set to kReplicaObject_InfiniteDistance, which means that the object will always be propogated to a session. This function can only be used if the ReplicaObject is a master and SetSessionPropagationFilter() is not activated. This distance can be changed at runtime. To ensure this functionality is enabled the first use of this function must be before the object is published using the Publish() method. If the ReplicaObject owner changes, notified through the OwnerChange() callback, then SetPropagateToSessionDistance() must be called to enable this functionality on the new master.
|
|
This sets the default value that the propagate distance uses. Setting the default value in the object constructor to the same value that is set for the distance will result in a smaller data packet being sent when an object is published. When setting a default value the same value must be set on the master and all replica objects otherwise the different sessions will assume different default values. If a replica is unable to know that other replicas will set the same default value then not using the function will ensure that the correct value is propagated.
|
|
This function sets the minimum recalculation delay that this object will use when it calculates distance based propagation.
|
|
Sets the registered flag to the bool value
|
|
This allows the session propagation filter mechanism to be enabled or disabled for a master ReplicaObject. When enabled the ReplicaObject will ignore all joining sessions and the user application is then responsible for supplying the session IDs that this object will propagate to. This mechanism effectively turns off all ReplicaNet object propagation functions for this object, including the distance based propagation. This mechanism can only be enabled or disabled before the object is published to ReplicaNet. If the object is set to reflect updates, using SetMessageReflectionID(), then the reflect session ID must also be added to the session propagation list. If the ReplicaObject owner changes, notified through the OwnerChange() callback, then the previous list of propagated sessions is discarded. SetSessionPropagationFilter() must be called to enable this functionality on the new master and the sessions to propagate to must again be added using SessionPropagationAddSession().
|
|
Tests the update type for this object.
|
|
Tests the update type for this object.
|
|
Tests the update type for this object.
|
|
This sets this object to use the 'certain' packet type when transmitting information about this object to other sessions. |
|
This sets this object to use the 'reliable' packet type when transmitting information about this object to other sessions. |
|
This sets this object to use the 'normal' packet type when transmitting information about this object to other sessions. |
|
Allows the user to expand the datablock mechanism with custom registering of datablocks if needed. It is required that the same DataBlocks are registered in the same order for all master and replica objects. These datablocks are registered after the internal ReplicaObject, ROL derived class datablocks and auto-added datablocks. Any datablocks added by this function should be added using RegisterDataBlock() and not AddAutoRegisterDataBlock() Do not call this function directly, this function is only called by ReplicaNet. |