forest-net
an overlay networks for large-scale virtual worlds
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
PacketStore.h
1
9
#ifndef PACKETSTORE_H
10
#define PACKETSTORE_H
11
12
#include <thread>
13
#include <mutex>
14
#include <chrono>
15
16
using
std::mutex;
17
using
std::unique_lock;
18
using
std::thread;
19
20
#include "
Forest.h
"
21
#include "List.h"
22
#include "
Packet.h
"
23
24
namespace
forest {
25
26
typedef
int
pktx;
27
35
class
PacketStore
{
36
public
:
37
PacketStore
(
int
=100000,
int
=50000);
38
~
PacketStore
();
39
40
// getters
41
Packet
&
getPacket
(pktx)
const
;
42
43
// setters
44
//void setPacket(pktx, const Packet&);
45
46
// allocate/free packets
47
pktx
alloc
();
48
void
free
(pktx);
49
pktx
clone
(pktx);
50
pktx
fullCopy
(pktx);
51
52
private
:
53
int
N
;
54
int
M
;
55
int
n
;
56
int
m
;
57
58
mutex
mtx
;
59
60
Packet
*
pkt
;
61
int
*
pb
;
62
63
buffer_t *
buff
;
64
int
*
ref
;
65
66
List *
freePkts
;
67
List *
freeBufs
;
68
};
69
74
inline
Packet
&
PacketStore::getPacket
(pktx px)
const
{
75
return
pkt
[px];
76
}
77
87
}
// ends namespace
88
89
90
#endif
forest-net
cpp
include
PacketStore.h
Generated on Mon Aug 4 2014 11:13:35 for forest-net by
1.8.4