A Discrete-Event Network Simulator
API
lte-phy-tag.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Author: Marco Miozzo <marco.miozzo@cttc.es>
18  * Nicola Baldo <nbaldo@cttc.es>
19  */
20 
21 #include "lte-phy-tag.h"
22 
23 #include "ns3/tag.h"
24 #include "ns3/uinteger.h"
25 
26 namespace ns3
27 {
28 
30 
31 TypeId
33 {
34  static TypeId tid =
35  TypeId("ns3::LtePhyTag").SetParent<Tag>().SetGroupName("Lte").AddConstructor<LtePhyTag>();
36  return tid;
37 }
38 
39 TypeId
41 {
42  return GetTypeId();
43 }
44 
46 {
47 }
48 
49 LtePhyTag::LtePhyTag(uint16_t cellId)
50  : m_cellId(cellId)
51 {
52 }
53 
55 {
56 }
57 
58 uint32_t
60 {
61  return 2;
62 }
63 
64 void
66 {
67  i.WriteU16(m_cellId);
68 }
69 
70 void
72 {
73  m_cellId = i.ReadU16();
74 }
75 
76 void
77 LtePhyTag::Print(std::ostream& os) const
78 {
79  os << m_cellId;
80 }
81 
82 uint16_t
84 {
85  return m_cellId;
86 }
87 
88 } // namespace ns3
Tag used to define PHY parameters.
Definition: lte-phy-tag.h:32
void Print(std::ostream &os) const override
Definition: lte-phy-tag.cc:77
~LtePhyTag() override
Definition: lte-phy-tag.cc:54
uint16_t m_cellId
the cell ID
Definition: lte-phy-tag.h:67
void Deserialize(TagBuffer i) override
Definition: lte-phy-tag.cc:71
LtePhyTag()
Create an empty LtePhyTag.
Definition: lte-phy-tag.cc:45
uint32_t GetSerializedSize() const override
Definition: lte-phy-tag.cc:59
uint16_t GetCellId() const
Get cell ID.
Definition: lte-phy-tag.cc:83
static TypeId GetTypeId()
Get the type ID.
Definition: lte-phy-tag.cc:32
void Serialize(TagBuffer i) const override
Definition: lte-phy-tag.cc:65
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition: lte-phy-tag.cc:40
read and write tag data
Definition: tag-buffer.h:52
TAG_BUFFER_INLINE uint16_t ReadU16()
Definition: tag-buffer.h:206
TAG_BUFFER_INLINE void WriteU16(uint16_t v)
Definition: tag-buffer.h:180
tag a set of bytes in a packet
Definition: tag.h:39
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:931
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:46
Every class exported by the ns3 library is enclosed in the ns3 namespace.