A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
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
* Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
21
* Mirko Banchi <mk.banchi@gmail.com>
22
* Konstantinos Katsaros <dinos.katsaros@gmail.com>
23
*/
24
25
#include "ns3/double.h"
26
#include "
snr-tag.h
"
27
28
namespace
ns3
{
29
30
NS_OBJECT_ENSURE_REGISTERED
(SnrTag);
31
32
TypeId
33
SnrTag::GetTypeId
(
void
)
34
{
35
static
TypeId
tid =
TypeId
(
"ns3::SnrTag"
)
36
.
SetParent
<
Tag
> ()
37
.SetGroupName (
"Wifi"
)
38
.AddConstructor<
SnrTag
> ()
39
.AddAttribute (
"Snr"
,
"The SNR of the last packet received"
,
40
DoubleValue
(0.0),
41
MakeDoubleAccessor
(&
SnrTag::Get
),
42
MakeDoubleChecker<double> ())
43
;
44
return
tid;
45
}
46
47
TypeId
48
SnrTag::GetInstanceTypeId
(
void
)
const
49
{
50
return
GetTypeId
();
51
}
52
53
SnrTag::SnrTag
()
54
: m_snr (0)
55
{
56
}
57
58
uint32_t
59
SnrTag::GetSerializedSize
(
void
)
const
60
{
61
return
sizeof
(double);
62
}
63
64
void
65
SnrTag::Serialize
(
TagBuffer
i)
const
66
{
67
i.
WriteDouble
(
m_snr
);
68
}
69
70
void
71
SnrTag::Deserialize
(
TagBuffer
i)
72
{
73
m_snr
= i.
ReadDouble
();
74
}
75
76
void
77
SnrTag::Print
(std::ostream &os)
const
78
{
79
os <<
"Snr="
<<
m_snr
;
80
}
81
82
void
83
SnrTag::Set
(
double
snr)
84
{
85
m_snr
= snr;
86
}
87
88
double
89
SnrTag::Get
(
void
)
const
90
{
91
return
m_snr
;
92
}
93
94
}
ns3::DoubleValue
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition:
double.h:41
ns3::SnrTag
Introspection did not find any typical Config paths.
Definition:
snr-tag.h:35
ns3::SnrTag::Set
void Set(double snr)
Set the SNR to the given value.
Definition:
snr-tag.cc:83
ns3::SnrTag::Serialize
void Serialize(TagBuffer i) const override
Definition:
snr-tag.cc:65
ns3::SnrTag::GetSerializedSize
uint32_t GetSerializedSize(void) const override
Definition:
snr-tag.cc:59
ns3::SnrTag::GetInstanceTypeId
TypeId GetInstanceTypeId(void) const override
Get the most derived TypeId for this Object.
Definition:
snr-tag.cc:48
ns3::SnrTag::Print
void Print(std::ostream &os) const override
Definition:
snr-tag.cc:77
ns3::SnrTag::m_snr
double m_snr
SNR value in linear scale.
Definition:
snr-tag.h:69
ns3::SnrTag::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition:
snr-tag.cc:33
ns3::SnrTag::SnrTag
SnrTag()
Create a SnrTag with the default SNR 0.
Definition:
snr-tag.cc:53
ns3::SnrTag::Deserialize
void Deserialize(TagBuffer i) override
Definition:
snr-tag.cc:71
ns3::SnrTag::Get
double Get(void) const
Return the SNR value.
Definition:
snr-tag.cc:89
ns3::TagBuffer
read and write tag data
Definition:
tag-buffer.h:52
ns3::TagBuffer::WriteDouble
void WriteDouble(double v)
Definition:
tag-buffer.cc:115
ns3::TagBuffer::ReadDouble
double ReadDouble(void)
Definition:
tag-buffer.cc:164
ns3::Tag
tag a set of bytes in a packet
Definition:
tag.h:37
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition:
type-id.cc:922
ns3::MakeDoubleAccessor
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition:
double.h:42
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition:
object-base.h:45
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
snr-tag.h
src
wifi
model
snr-tag.cc
Generated on Tue Feb 6 2024 19:21:29 for ns-3 by
1.9.1