A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
snr-tag.h
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#ifndef SNR_TAG_H
14#define SNR_TAG_H
15
16#include "ns3/tag.h"
17
18namespace ns3
19{
20
21class Tag;
22
23class SnrTag : public Tag
24{
25 public:
26 /**
27 * \brief Get the type ID.
28 * \return the object TypeId
29 */
30 static TypeId GetTypeId();
31
32 /**
33 * Create a SnrTag with the default SNR 0
34 */
35 SnrTag();
36
37 TypeId GetInstanceTypeId() const override;
38 uint32_t GetSerializedSize() const override;
39 void Serialize(TagBuffer i) const override;
40 void Deserialize(TagBuffer i) override;
41 void Print(std::ostream& os) const override;
42
43 /**
44 * Set the SNR to the given value.
45 *
46 * \param snr the value of the SNR to set in linear scale
47 */
48 void Set(double snr);
49 /**
50 * Return the SNR value.
51 *
52 * \return the SNR value in linear scale
53 */
54 double Get() const;
55
56 private:
57 double m_snr; //!< SNR value in linear scale
58};
59
60} // namespace ns3
61
62#endif /* SNR_TAG_H */
static TypeId GetTypeId()
Get the type ID.
Definition snr-tag.cc:23
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition snr-tag.cc:38
void Set(double snr)
Set the SNR to the given value.
Definition snr-tag.cc:73
void Serialize(TagBuffer i) const override
Definition snr-tag.cc:55
uint32_t GetSerializedSize() const override
Definition snr-tag.cc:49
void Print(std::ostream &os) const override
Definition snr-tag.cc:67
double m_snr
SNR value in linear scale.
Definition snr-tag.h:57
SnrTag()
Create a SnrTag with the default SNR 0.
Definition snr-tag.cc:43
void Deserialize(TagBuffer i) override
Definition snr-tag.cc:61
double Get() const
Return the SNR value.
Definition snr-tag.cc:79
read and write tag data
Definition tag-buffer.h:41
tag a set of bytes in a packet
Definition tag.h:28
a unique identifier for an interface.
Definition type-id.h:48
Every class exported by the ns3 library is enclosed in the ns3 namespace.