#include <Resource.h>
Public Member Functions | |
CResource () | |
CResource. | |
~CResource () | |
~CResource | |
void | Create (CNetworkPlayer *) |
Create. | |
void | Process () |
Process. | |
void | SetHost (uint32 port) |
SetHost. | |
void | SetClient (const CResource *pHostResource) |
SetClient. | |
bool | AddParticipant (CParticipant *pParticipant) |
AddParticipant. | |
void | GetParticipants (vector< CParticipant * > &parts) const |
GetParticipants. | |
void | GetParticipantCount (uint32 &Humans, uint32 &AIs) const |
GetParticipantCount. | |
uint32 | GetParticipantCount () const |
GetParticipantCount. | |
void | ResetResource (bool bKillImmobile) |
ResetResource. | |
void | UpdateBenchmark () |
UpdateBenchmark. | |
uint64 | GetBenchmark () const |
GetBenchmark. | |
bool | operator< (const CResource other) const |
operator < | |
void | SendMessage (CMessage *pMsg) const |
SendMessage. | |
bool | IsMsgAvail () const |
IsMsgAvail. | |
CMessage * | GetMessage () const |
GetMessage. | |
const CDescription * | GetDescription () const |
GetDescription. | |
int8 * | GetAddress (int8 *buffer) const |
GetAddress. | |
uint32 | GetAvgPing () const |
GetAvgPing. | |
int32 | GetError () const |
GetError. | |
uint16 | GetPort () const |
GetPort. | |
Protected Member Functions | |
bool | ProcessSystemMessage (CSystemMessage *pMsg) |
ProcessSystemMessage. | |
void | ProcessModules () |
ProcessModules. | |
void | ProcessFileTx () |
ProcessFileTx. |
Description:
Limitations:
|
CResource. Description: This constructor initializes internal class attributes.
|
|
~CResource Description: This destructor frees all allocated resources.
|
|
AddParticipant. Description: This function adds a participant to the resource. This function is normally called indirectly by the CParticipant::AssignResource function.
|
|
Create. Description: This function creates a resource's connect to a client machine.
|
|
GetAddress. Description: This function returns the IP address of the resource.
|
|
GetAvgPing. Description: This function returns the average calculated ping between the tournament server and the resource machine.
|
|
GetBenchmark. Description: This function returns the benchmark value collected from the resource machine. Check the bechmarking state to determine if this value is valid. The benchmark is only valid when the following condition is true. m_ResourceState.bnchState == BENCH_READY
|
|
GetDescription. Description: This function returns the description associated with the resource.
|
|
GetError. Description: This function returns the last error code incurred by the CNetworkPlayer governing the resource connection.
|
|
GetMessage. Description: This function retrieves the oldest message received from the resource. Only messages that were not processed by the resource object are returned.
|
|
GetParticipantCount. Description: This function returns the total number of attached participants.
|
|
GetParticipantCount. Description: This function retrieves the number of each type of participant.
|
|
GetParticipants. Description: This function retrieves that list of attached participants.
|
|
GetPort. Description: This function returns the port number that the resource will use. If the resource machine is a host, it will host of the returned port. If client, the resource will attempt to connect to the host machine on the port.
|
|
IsMsgAvail. Description: This function checks to see if any messages are available to read. Only messages that are not handled by the CResource's internal message handlers are made available.
|
|
operator < Description: This comparision operator is used to sort Resource objects. The objects are sorted based on the resources benchmark value.
|
|
Process. Description: This function performs 'thread' processing and should be called at a period rate.
|
|
ProcessFileTx. Description: This function governs the file transfer state machine. File transfer proceeds in the following steps: 1) The file trasfer is iniated when the state is set to TX_START_TRANSFER. This is done in the module loading state machine. 2) Once initated, the file is broken up into segments are each segment is sent to the client. 3) The final states are TX_COMPLETE, TX_FAILURE. This state machine is imcomplete but has been included for future implementation. The current implementation automatically generates automatically transitions to the TX_FAILURE state.
|
|
ProcessModules. Description: This function runs the module loading state machine. It reads in module load request from the m_LoadQueue queue. Processing follows the following steps: 1) The existence of the module on the client machine is checked. 2) If the module is not on the client machine, the file transfer state machine is activated. 3) Once the file is on the client machine, the module is loaded. 4) The final states are MOD_FAILURE or MOD_COMPLETE. It is important to note that the state machine is affected by the message processing function, OnSystemMessage, where the response messages are processed.
to the client. |
|
ProcessSystemMessage. Description:
|
|
ResetResource. Description: This function commands the resource to reset. All mobile participants are unloaded.
|
|
SendMessage. Description: This funtion sends a message to the resource.
|
|
SetClient. Description: This function configures the resource as a cleint. Client machines have subordiant clients and dispatchers. The machine will be commanded to connect to the specifed host resource.
|
|
SetHost. Description: This function configures the resource as a host. Host machines have dominant clients and dispatchers. The machine will be set to host on the specified port.
|
|
UpdateBenchmark. Description: This function request the benchmark value of the resource The benchmark can be retrieved later once the following state condition is met: m_ResourceState.bnchState == BENCH_READY
|