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

QAvatar Class Reference

#include <QAvatar.h>

Inheritance diagram for QAvatar:

Inheritance graph
[legend]
List of all members.

Detailed Description

Base avatar class representing multiple users.

Author:
Chris Scharver
Revision
1.6
Date
2004/04/13 19:10:09
This class represents a user and any associated data pertaining to that user that must be transferred over a network. Each avatar has three buffers: hello data is sent to other users to indicate arrival; aux data is sent to announce any miscellaneous message; and tracker data continuously updates position information. Subclasses have several key responsibilities:

See also:
QAvatarFactory, QAvatarListener, QAvatarManager

Definition at line 58 of file QAvatar.h.

Public Member Functions

 QAvatar (const long &)
 Parameterized constructor takes an identification number.

 QAvatar (const long &, const size_t &, const size_t &, const size_t &)
 Parameterized constructor takes id and data sizes.

virtual ~QAvatar ()
 Virtual destructor.

virtual void lock ()
 Locks the avatar's mutex.

virtual void unlock ()
 Unlocks the avatar's mutex.

long getID ()
 Returns the avatar's identification number.

void setAuxData (const char *, const size_t &)
 Sets the avatar's aux data.

void setHelloData (const char *, const size_t &)
 Sets the avatar's hello data.

void setTrackerData (const char *, const size_t &)
 Sets the avatar's tracker data.

double getLastUpdateTime ()
 Returns the last time the avatar was updated.

void markUpdateTime ()
 Marks the avatar as updated.


Protected Attributes

const long m_id
 Unique identification number for the avatar.

double m_lastUpdateTime
 Last time the avatar was updated.

QUANTAts_mutex_c * m_mutex
 Mutual exclusion lock can serialize multi-thread access.


Constructor & Destructor Documentation

QAvatar::QAvatar const long &  avID,
const size_t &  auxSize,
const size_t &  helloSize,
const size_t &  trackerSize
 

Parameterized constructor takes id and data sizes.

The parameterized constructor initializes the instance's constants using its paramters. The order is important, as other the data sizes will not be correct during program execution. This constructor is preferred, and subclasses should perform call it from their own constructors. The data buffer sizes may only be set once, so make sure that there is appropriate memory allocated.

Parameters:
avId - unique avatar id
auxSize - aux data buffer size
helloSize - hello data buffer size
trackerSize - tracker data buffer size

Definition at line 66 of file QAvatar.cxx.

QAvatar::~QAvatar  )  [virtual]
 

Virtual destructor.

The destructor deletes the avatar's m_mutex. It also deletes all data buffers that have been allocated for use with the avatar instance.

Definition at line 77 of file QAvatar.cxx.

References m_auxData, m_helloData, m_mutex, and m_trackerData.


Member Function Documentation

void QAvatar::setAuxData const char *  dataBuffer,
const size_t &  dataSize
 

Sets the avatar's aux data.

This method accepts a pointer to a data buffer and the size of that data. These values are copied into the avatar's aux data.

Parameters:
dataBuffer pointer to a buffer
dataSize size in bytes of the buffer

Definition at line 148 of file QAvatar.cxx.

References m_auxData, and m_auxSize.

Referenced by QAvatarManager::handleHailingData().

void QAvatar::setHelloData const char *  dataBuffer,
const size_t &  dataSize
 

Sets the avatar's hello data.

This method accepts a pointer to a data buffer and the size of that data. These values are copied into the avatar's hello data.

Parameters:
dataBuffer pointer to a buffer
dataSize size in bytes of the buffer

Definition at line 166 of file QAvatar.cxx.

References m_helloData, and m_helloSize.

Referenced by QAvatarManager::handleHailingData().

void QAvatar::setTrackerData const char *  dataBuffer,
const size_t &  dataSize
 

Sets the avatar's tracker data.

This method accepts a pointer to a data buffer and the size of that data. These values are copied into the avatar's tracker data.

Parameters:
dataBuffer pointer to a buffer
dataSize size in bytes of the buffer

Definition at line 184 of file QAvatar.cxx.

References m_trackerData, and m_trackerSize.

Referenced by QAvatarManager::handleTrackerData().


The documentation for this class was generated from the following files:
Generated on Tue Apr 13 16:42:26 2004 for QAvatar by doxygen 1.3.6