A Discrete-Event Network Simulator
API
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  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation;
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
20  * Mirko Banchi <mk.banchi@gmail.com>
21  * Konstantinos Katsaros <dinos.katsaros@gmail.com>
22  */
23 
24 #ifndef SNR_TAG_H
25 #define SNR_TAG_H
26 
27 #include "ns3/tag.h"
28 
29 namespace ns3
30 {
31 
32 class Tag;
33 
34 class SnrTag : public Tag
35 {
36  public:
41  static TypeId GetTypeId();
42 
46  SnrTag();
47 
48  TypeId GetInstanceTypeId() const override;
49  uint32_t GetSerializedSize() const override;
50  void Serialize(TagBuffer i) const override;
51  void Deserialize(TagBuffer i) override;
52  void Print(std::ostream& os) const override;
53 
59  void Set(double snr);
65  double Get() const;
66 
67  private:
68  double m_snr;
69 };
70 
71 } // namespace ns3
72 
73 #endif /* SNR_TAG_H */
static TypeId GetTypeId()
Get the type ID.
Definition: snr-tag.cc:34
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition: snr-tag.cc:49
void Set(double snr)
Set the SNR to the given value.
Definition: snr-tag.cc:84
void Serialize(TagBuffer i) const override
Definition: snr-tag.cc:66
uint32_t GetSerializedSize() const override
Definition: snr-tag.cc:60
void Print(std::ostream &os) const override
Definition: snr-tag.cc:78
double m_snr
SNR value in linear scale.
Definition: snr-tag.h:68
SnrTag()
Create a SnrTag with the default SNR 0.
Definition: snr-tag.cc:54
void Deserialize(TagBuffer i) override
Definition: snr-tag.cc:72
double Get() const
Return the SNR value.
Definition: snr-tag.cc:90
read and write tag data
Definition: tag-buffer.h:52
tag a set of bytes in a packet
Definition: tag.h:39
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.