A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
flow-id-tag.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2008 INRIA
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 2 as
7
* published by the Free Software Foundation;
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
*
18
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19
*/
20
#include "
flow-id-tag.h
"
21
22
namespace
ns3 {
23
24
NS_OBJECT_ENSURE_REGISTERED
(FlowIdTag);
25
26
TypeId
27
FlowIdTag::GetTypeId
(
void
)
28
{
29
static
TypeId
tid =
TypeId
(
"ns3::FlowIdTag"
)
30
.
SetParent
<
Tag
> ()
31
.AddConstructor<FlowIdTag> ()
32
;
33
return
tid;
34
}
35
TypeId
36
FlowIdTag::GetInstanceTypeId
(
void
)
const
37
{
38
return
GetTypeId
();
39
}
40
uint32_t
41
FlowIdTag::GetSerializedSize
(
void
)
const
42
{
43
return
4;
44
}
45
void
46
FlowIdTag::Serialize
(
TagBuffer
buf)
const
47
{
48
buf.
WriteU32
(
m_flowId
);
49
}
50
void
51
FlowIdTag::Deserialize
(
TagBuffer
buf)
52
{
53
m_flowId
= buf.
ReadU32
();
54
}
55
void
56
FlowIdTag::Print
(std::ostream &os)
const
57
{
58
os <<
"FlowId="
<<
m_flowId
;
59
}
60
FlowIdTag::FlowIdTag
()
61
:
Tag
()
62
{
63
}
64
65
FlowIdTag::FlowIdTag
(uint32_t
id
)
66
:
Tag
(),
67
m_flowId (id)
68
{
69
}
70
71
void
72
FlowIdTag::SetFlowId
(uint32_t
id
)
73
{
74
m_flowId
= id;
75
}
76
uint32_t
77
FlowIdTag::GetFlowId
(
void
)
const
78
{
79
return
m_flowId
;
80
}
81
82
uint32_t
83
FlowIdTag::AllocateFlowId
(
void
)
84
{
85
static
uint32_t nextFlowId = 1;
86
uint32_t flowId = nextFlowId;
87
nextFlowId++;
88
return
flowId;
89
}
90
91
}
// namespace ns3
92
src
network
utils
flow-id-tag.cc
Generated on Tue Nov 13 2012 10:32:20 for ns-3 by
1.8.1.2