A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
snr-tag.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2005,2006 INRIA
3
* Copyright (c) 2009 MIRKO BANCHI
4
* Copyright (c) 2013 University of Surrey
5
*
6
* SPDX-License-Identifier: GPL-2.0-only
7
*
8
* Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
9
* Mirko Banchi <mk.banchi@gmail.com>
10
* Konstantinos Katsaros <dinos.katsaros@gmail.com>
11
*/
12
13
#include "
snr-tag.h
"
14
15
#include "ns3/double.h"
16
17
namespace
ns3
18
{
19
20
NS_OBJECT_ENSURE_REGISTERED
(SnrTag);
21
22
TypeId
23
SnrTag::GetTypeId
()
24
{
25
static
TypeId
tid =
TypeId
(
"ns3::SnrTag"
)
26
.
SetParent
<
Tag
>()
27
.SetGroupName(
"Wifi"
)
28
.AddConstructor<
SnrTag
>()
29
.AddAttribute(
"Snr"
,
30
"The SNR of the last packet received"
,
31
DoubleValue
(0.0),
32
MakeDoubleAccessor
(&
SnrTag::Get
),
33
MakeDoubleChecker<double>
());
34
return
tid;
35
}
36
37
TypeId
38
SnrTag::GetInstanceTypeId
()
const
39
{
40
return
GetTypeId
();
41
}
42
43
SnrTag::SnrTag
()
44
: m_snr(0)
45
{
46
}
47
48
uint32_t
49
SnrTag::GetSerializedSize
()
const
50
{
51
return
sizeof
(
double
);
52
}
53
54
void
55
SnrTag::Serialize
(
TagBuffer
i)
const
56
{
57
i.
WriteDouble
(
m_snr
);
58
}
59
60
void
61
SnrTag::Deserialize
(
TagBuffer
i)
62
{
63
m_snr
= i.
ReadDouble
();
64
}
65
66
void
67
SnrTag::Print
(std::ostream& os)
const
68
{
69
os <<
"Snr="
<<
m_snr
;
70
}
71
72
void
73
SnrTag::Set
(
double
snr)
74
{
75
m_snr
= snr;
76
}
77
78
double
79
SnrTag::Get
()
const
80
{
81
return
m_snr
;
82
}
83
84
}
// namespace ns3
double
ns3::DoubleValue
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition
double.h:31
ns3::SnrTag
Introspection did not find any typical Config paths.
Definition
snr-tag.h:24
ns3::SnrTag::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
snr-tag.cc:23
ns3::SnrTag::GetInstanceTypeId
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition
snr-tag.cc:38
ns3::SnrTag::Set
void Set(double snr)
Set the SNR to the given value.
Definition
snr-tag.cc:73
ns3::SnrTag::Serialize
void Serialize(TagBuffer i) const override
Definition
snr-tag.cc:55
ns3::SnrTag::GetSerializedSize
uint32_t GetSerializedSize() const override
Definition
snr-tag.cc:49
ns3::SnrTag::Print
void Print(std::ostream &os) const override
Definition
snr-tag.cc:67
ns3::SnrTag::m_snr
double m_snr
SNR value in linear scale.
Definition
snr-tag.h:57
ns3::SnrTag::SnrTag
SnrTag()
Create a SnrTag with the default SNR 0.
Definition
snr-tag.cc:43
ns3::SnrTag::Deserialize
void Deserialize(TagBuffer i) override
Definition
snr-tag.cc:61
ns3::SnrTag::Get
double Get() const
Return the SNR value.
Definition
snr-tag.cc:79
ns3::TagBuffer
read and write tag data
Definition
tag-buffer.h:41
ns3::TagBuffer::WriteDouble
void WriteDouble(double v)
Definition
tag-buffer.cc:107
ns3::TagBuffer::ReadDouble
double ReadDouble()
Definition
tag-buffer.cc:159
ns3::Tag
tag a set of bytes in a packet
Definition
tag.h:28
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:48
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition
type-id.cc:1001
uint32_t
ns3::MakeDoubleChecker
Ptr< const AttributeChecker > MakeDoubleChecker()
Definition
double.h:82
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:32
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition
object-base.h:35
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 Thu Dec 12 2024 09:20:56 for ns-3 by
1.11.0