LEFT | RIGHT |
(no file at all) | |
| 1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
| 2 /* |
| 3 * Copyright (c) 2011 Konstantinos Katsaros |
| 4 * |
| 5 * This program is free software; you can redistribute it and/or modify |
| 6 * it under the terms of the GNU General Public License version 2 as |
| 7 * published by the Free Software Foundation; |
| 8 * |
| 9 * This program is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 * GNU General Public License for more details. |
| 13 * |
| 14 * You should have received a copy of the GNU General Public License |
| 15 * along with this program; if not, write to the Free Software |
| 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 17 * |
| 18 * Authors: Konstantinos Katsaros <K.Katsaros@surrey.ac.uk> |
| 19 */ |
| 20 |
| 21 |
| 22 #ifndef SNR_TAG_H |
| 23 #define SNR_TAG_H |
| 24 |
| 25 #include "ns3/tag.h" |
| 26 #include <stdint.h> |
| 27 |
| 28 namespace ns3 { |
| 29 /// Tag used to get SNR value from PHY layer to other layers |
| 30 struct SnrTag : public Tag |
| 31 { |
| 32 /// Positive if output device is fixed in RouteOutput |
| 33 double snr; |
| 34 |
| 35 SnrTag (double s = -1) : Tag(), snr (s) {} |
| 36 |
| 37 static TypeId GetTypeId () |
| 38 { |
| 39 static TypeId tid = TypeId ("ns3::SnrTag").SetParent<Tag> (); |
| 40 return tid; |
| 41 } |
| 42 |
| 43 TypeId GetInstanceTypeId () const |
| 44 { |
| 45 return GetTypeId (); |
| 46 } |
| 47 |
| 48 uint32_t GetSerializedSize () const |
| 49 { |
| 50 return sizeof(double); |
| 51 } |
| 52 |
| 53 void Serialize (TagBuffer i) const |
| 54 { |
| 55 i.WriteDouble(snr); |
| 56 } |
| 57 |
| 58 void Deserialize (TagBuffer i) |
| 59 { |
| 60 snr = i.ReadDouble(); |
| 61 } |
| 62 |
| 63 void Print (std::ostream &os) const |
| 64 { |
| 65 os << "SNRTag: SNR value of received packet = " << snr; |
| 66 } |
| 67 }; |
| 68 } |
| 69 #endif |
LEFT | RIGHT |