Main Page | Class Hierarchy | Class List | Directories | File List | Class Members

RNReplicaNet::DataBlock_Function Class Reference

#include <DataBlock_Function.h>

Inheritance diagram for RNReplicaNet::DataBlock_Function:

Inheritance graph
[legend]
Collaboration diagram for RNReplicaNet::DataBlock_Function:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 DataBlock_Function ()
virtual ~DataBlock_Function ()
virtual void Poll (DataBlockReason *reason)
virtual void ParseMessage (MessageHelper *message)
void RegisterInClassPointer (void *classp, void *funcp)
void AddFunctionStateChange (void *data, int len, const char *debug=0)
bool IsAttached (void *data)

Static Public Member Functions

static DataBlock_FunctionRegister (void *classp, void *funcp)
static void SetSessionIDFilter (const int numSessionIDs=0, const int *sessionIDs=0)

Detailed Description

This DataBlock derived class enables class member functions to be called on replicas of an object.
This DataBlock does not do any latency compensation or prediction.
This DataBlock does not use the rules set by SetUpdateDelayMinimum() and SetForceSendMaximumUpdates() because the frequency of calling member functions and hence the frequency of DataBlock updates is defined by the application.
For security reasons only the master can send function calls to other replicas. A replica does not send any function updates to other replicas directly and will only send to the master. Therefore many of the macros, like ALL_REPLICAS_FUNCTION_CALL(), will operate differently depending on if the object is a master or a replica. You can use these macros to call network class member functions:
GLOBAL_FUNCTION_CALL()
Example: GLOBAL_FUNCTION_CALL(ASampleMemberFunction(foo,bar,wibble));
From a master this calls the function on the master and all replicas.
From a replica this only calls the function on the current replica and the master.

ALL_REPLICAS_FUNCTION_CALL()
Example: ALL_REPLICAS_FUNCTION_CALL(ASampleMemberFunction(foo));
From a master this calls the function on the all replicas.
From a replica this only calls the function on the master.

MASTER_FUNCTION_CALL()
Example: MASTER_FUNCTION_CALL(ASampleMemberFunction(bar,wibble));
From a master this calls the function on the all replicas.
From a replica this only calls the function on the master.
ALL_REPLICAS_FUNCTION_CALL() and MASTER_FUNCTION_CALL() have identical implementation, the naming is different to improve code readability.

NOMINATED_REPLICAS_FUNCTION_CALL()
Example: NOMINATED_REPLICAS_FUNCTION_CALL(numSessionIDs,sessionIDs,APublicFunction(random_int,random_float));
From a master this uses DataBlock_Function::SetSessionIDFilter() to propagate function calls to selected session IDs. From a replica this calls the function on the master regardless of the session ID list.


Constructor & Destructor Documentation

RNReplicaNet::DataBlock_Function::DataBlock_Function  ) 
 

The ctor performs some basic initialisation

virtual RNReplicaNet::DataBlock_Function::~DataBlock_Function  )  [virtual]
 

The dtor makes sure everything is tidy


Member Function Documentation

bool RNReplicaNet::DataBlock_Function::IsAttached void *  data  )  [virtual]
 

Given a data pointer this function identifies if this data block is attached to the pointer.

Returns:
returns true if the data pointer is attached to this data block.

Reimplemented from RNReplicaNet::DataBlock.

virtual void RNReplicaNet::DataBlock_Function::ParseMessage MessageHelper *  message  )  [virtual]
 

This parses a message for the derived class of this data block

Parameters:
message The current message buffer that contains the packet data

Reimplemented from RNReplicaNet::DataBlock.

virtual void RNReplicaNet::DataBlock_Function::Poll DataBlockReason reason  )  [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.

Parameters:
reason the reason code that is passed in to this class to enable a response to be calculated

Reimplemented from RNReplicaNet::DataBlock.

static DataBlock_Function* RNReplicaNet::DataBlock_Function::Register void *  classp,
void *  funcp
[static]
 

This registers the memory area with this data block type and returns a new pointer

Parameters:
classp is the pointer to this class that is passed through the message pipeline
funcp the actual function pointer to call that cracks the message
Returns:
Returns a pointer that can be used to attach to a ReplicaObject

void RNReplicaNet::DataBlock_Function::RegisterInClassPointer void *  classp,
void *  funcp
[inline]
 

This registers the memory area with this data block type. This is used when the memory is in datablocks that are allocated as part of a bigger class.

Parameters:
classp is the pointer to this class that is passed through the message pipeline
funcp the actual function pointer to call that cracks the message

static void RNReplicaNet::DataBlock_Function::SetSessionIDFilter const int  numSessionIDs = 0,
const int *  sessionIDs = 0
[static]
 

This configures the next networked function call from a master object to send the function call to the nominated sessionIDs. After the function call is completed all subsequent network function calls are sent without this filter unless this function is used. The NOMINATED_REPLICAS_FUNCTION_CALL() macro also uses this function.
Care must be taken when using this static function that multi-threaded ReplicaObject derived classes do not interrupt calls to this function and the subsequent network function call. The array pointed to by this function must persist until the subsequent network function call.

Parameters:
numSessionIDs The number of session IDs in the array.
sessionIDs An array of session IDs that will receive the next network function call.


The documentation for this class was generated from the following file:
Generated on Sun Oct 30 01:11:57 2005 for ReplicaNet by  doxygen 1.4.1