# PacketPool Class Reference

Manage memory for packet. More...

`#include <PacketPool.h>`

List of all members.

## Public Member Functions

| PacketPool ()
| ~PacketPool ()
Packet * | GetPointer (void)
void | ReleasePointer (Packet *p)
void | ClearPool (void)

## Static Public Member Functions

static PacketPool * | Instance ()

## Private Attributes

BasicDataStructures::Queue< Packet * > | pool
SimpleMutex | poolMutex

## Static Private Attributes

static PacketPool | I

## Detailed Description

Manage memory for packet.

The PacketPool class as multiple roles :

- Managing memory associated to packets
- Reuse memory of old packet to increase performances.
  Note:
    it implements Singleton Pattern

## Constructor & Destructor Documentation

PacketPool::PacketPool | ( |  | ) |

| Constructor

PacketPool::~PacketPool | ( |  | ) |

| Destructor

## Member Function Documentation

void PacketPool::ClearPool | ( | void |  | ) |

| Clear the Packet Pool

Packet * PacketPool::GetPointer | ( | void |  | ) |

Get Memory for a packet

Returns:
  a Packet object

static PacketPool* PacketPool::Instance | ( |  | ) | `[inline, static]`

Retrieve the unique instance of a PacketPool.

Returns:
  A pointer to the pool.

void PacketPool::ReleasePointer | ( | Packet * | p | ) |

Free Memory for a packet

Parameters:

  | p | The packet to free

## Member Data Documentation

PacketPool PacketPool::I`[static, private]`

| Singleton Pattern unique instance

BasicDataStructures::Queue<Packet*> PacketPool::pool`[private]`

| Store packets

SimpleMutex PacketPool::poolMutex`[private]`

| Exclusive access to the pool

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

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