# NetworkObject Class Reference

`#include <NetworkObject.h>`

Inheritance diagram for NetworkObject:

List of all members.

## Public Member Functions

| NetworkObject ()
virtual | ~NetworkObject ()
virtual unsigned short | GetID (void) const
virtual void | SetID (unsigned short id)

## Static Public Member Functions

static unsigned short | GetStaticItemID (void)
static void | SetStaticItemID (unsigned short i)

## Static Public Attributes

static BasicDataStructures::AVLBalancedBinarySearchTree< ObjectIDNode > | IDTree

## Protected Attributes

unsigned short | objectID
bool | serverAssignedID

## Static Private Attributes

static unsigned short | staticItemID = 0

## Detailed Description

A NetworkObject is used to identify uniquely an object on the network You can easly create object with network unique id by subclassing this class.

## Constructor & Destructor Documentation

NetworkObject::NetworkObject | ( |  | ) |

| Default Constructor

NetworkObject::~NetworkObject | ( |  | ) | `[virtual]`

| Default Destructor

## Member Function Documentation

unsigned short NetworkObject::GetID | ( | void |  | ) | const`[virtual]`

Get the id of the object

Returns:
  the id of the current object

unsigned short NetworkObject::GetStaticItemID | ( | void |  | ) | `[static]`

These function is only meant to be used when saving games as you should save the HIGHEST value staticItemID has achieved upon save and reload it upon load. Save AFTER you've created all the items derived from this class you are going to create.

Returns:
  the HIGHEST Object Id currently used

void NetworkObject::SetID | ( | unsigned short | id | ) | `[virtual]`

Associate an id to an object

Parameters:

  | id | the new id of the network object.

Note:
  Only the server code should call this.

void NetworkObject::SetStaticItemID | ( | unsigned short | i | ) | `[static]`

These function is only meant to be used when loading games. Load BEFORE you create any new objects that are not SetIDed based on the save data.

Parameters:

  | i | the highest number of NetworkObject reached.

## Member Data Documentation

BasicDataStructures::AVLBalancedBinarySearchTree< ObjectIDNode > NetworkObject::IDTree `[static]`

| Store all object in an AVL using id as key

unsigned short NetworkObject::objectID `[protected]`

| The network ID of this object

bool NetworkObject::serverAssignedID `[protected]`

| Store whether or not its a server assigned ID

unsigned short NetworkObject::staticItemID = 0`[static, private]`

| Number of network object.

The documentation for this class was generated from the following files:

- Projects/raknet/include/raknet/NetworkObject.h
- Projects/raknet/Source/NetworkObject.cpp