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
snr-tag.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2005,2006 INRIA
4
* Copyright (c) 2009 MIRKO BANCHI
5
* Copyright (c) 2013 University of Surrey
6
*
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License version 2 as
9
* published by the Free Software Foundation;
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
*
20
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
21
* Author: Mirko Banchi <mk.banchi@gmail.com>
22
* Author: Konstantinos Katsaros <dinos.katsaros@gmail.com>
23
*/
24
25
#include "
snr-tag.h
"
26
#include "ns3/tag.h"
27
#include "ns3/double.h"
28
29
namespace
ns3 {
30
31
NS_OBJECT_ENSURE_REGISTERED
(SnrTag)
32
;
33
34
TypeId
35
SnrTag::GetTypeId
(
void
)
36
{
37
static
TypeId
tid =
TypeId
(
"ns3::SnrTag"
)
38
.
SetParent
<
Tag
> ()
39
.AddConstructor<SnrTag> ()
40
.AddAttribute (
"Snr"
,
"The snr of the last packet received"
,
41
DoubleValue
(0.0),
42
MakeDoubleAccessor (&
SnrTag::Get
),
43
MakeDoubleChecker<double> ())
44
;
45
return
tid;
46
}
47
TypeId
48
SnrTag::GetInstanceTypeId
(
void
)
const
49
{
50
return
GetTypeId
();
51
}
52
53
SnrTag::SnrTag
()
54
: m_snr (0)
55
{
56
}
57
SnrTag::SnrTag
(
double
snr)
58
: m_snr (snr)
59
{
60
}
61
62
63
uint32_t
64
SnrTag::GetSerializedSize
(
void
)
const
65
{
66
return
sizeof
(double);
67
}
68
void
69
SnrTag::Serialize
(
TagBuffer
i)
const
70
{
71
i.
WriteDouble
(
m_snr
);
72
}
73
void
74
SnrTag::Deserialize
(
TagBuffer
i)
75
{
76
m_snr
= i.
ReadDouble
();
77
}
78
void
79
SnrTag::Print
(std::ostream &os)
const
80
{
81
os <<
"Snr="
<<
m_snr
;
82
}
83
void
84
SnrTag::Set
(
double
snr)
85
{
86
m_snr
= snr;
87
}
88
double
89
SnrTag::Get
(
void
)
const
90
{
91
return
m_snr
;
92
}
93
94
95
}
ns3::SnrTag::Set
void Set(double snr)
Set the SNR to the given value.
Definition:
snr-tag.cc:84
ns3::SnrTag::GetTypeId
static TypeId GetTypeId(void)
Definition:
snr-tag.cc:35
ns3::TagBuffer::WriteDouble
void WriteDouble(double v)
Definition:
tag-buffer.cc:115
ns3::SnrTag::Print
virtual void Print(std::ostream &os) const
Definition:
snr-tag.cc:79
ns3::NS_OBJECT_ENSURE_REGISTERED
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
ns3::SnrTag::GetSerializedSize
virtual uint32_t GetSerializedSize(void) const
Definition:
snr-tag.cc:64
ns3::TagBuffer::ReadDouble
double ReadDouble(void)
Definition:
tag-buffer.cc:164
ns3::SnrTag::SnrTag
SnrTag()
Create a SnrTag with the default snr 0.
Definition:
snr-tag.cc:53
ns3::SnrTag::Serialize
virtual void Serialize(TagBuffer i) const
Definition:
snr-tag.cc:69
ns3::SnrTag::Get
double Get(void) const
Return the SNR value.
Definition:
snr-tag.cc:89
ns3::SnrTag::Deserialize
virtual void Deserialize(TagBuffer i)
Definition:
snr-tag.cc:74
ns3::Tag
tag a set of bytes in a packet
Definition:
tag.h:36
snr-tag.h
ns3::SnrTag::GetInstanceTypeId
virtual TypeId GetInstanceTypeId(void) const
Definition:
snr-tag.cc:48
ns3::TagBuffer
read and write tag data
Definition:
tag-buffer.h:51
ns3::SnrTag::m_snr
double m_snr
SNR value.
Definition:
snr-tag.h:69
ns3::DoubleValue
Hold a floating point type.
Definition:
double.h:41
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:49
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Definition:
type-id.cc:611
src
wifi
model
snr-tag.cc
Generated on Sat Apr 19 2014 14:07:11 for ns-3 by
1.8.6