A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
src
wave
model
higher-tx-tag.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2008 INRIA
4
* Copyright (c) 2013 Dalian University of Technology
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
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
20
* Junling Bu <linlinjavaer@gmail.com>
21
*/
22
#include "
higher-tx-tag.h
"
23
#include "ns3/log.h"
24
25
namespace
ns3
{
26
27
NS_LOG_COMPONENT_DEFINE
(
"HigherLayerTxVectorTag"
);
28
29
NS_OBJECT_ENSURE_REGISTERED
(HigherLayerTxVectorTag);
30
31
TypeId
32
HigherLayerTxVectorTag::GetTypeId
(
void
)
33
{
34
static
TypeId
tid =
TypeId
(
"ns3::HigherLayerTxVectorTag"
)
35
.
SetParent
<
Tag
> ()
36
.SetGroupName (
"Wave"
)
37
.AddConstructor<
HigherLayerTxVectorTag
> ()
38
;
39
return
tid;
40
}
41
42
TypeId
43
HigherLayerTxVectorTag::GetInstanceTypeId
(
void
)
const
44
{
45
NS_LOG_FUNCTION
(
this
);
46
return
GetTypeId
();
47
}
48
49
HigherLayerTxVectorTag::HigherLayerTxVectorTag
(
void
)
50
: m_adaptable (false)
51
{
52
NS_LOG_FUNCTION
(
this
);
53
}
54
55
HigherLayerTxVectorTag::HigherLayerTxVectorTag
(
WifiTxVector
txVector,
bool
adaptable)
56
: m_txVector (txVector),
57
m_adaptable (adaptable)
58
{
59
NS_LOG_FUNCTION
(
this
);
60
}
61
62
WifiTxVector
63
HigherLayerTxVectorTag::GetTxVector
(
void
)
const
64
{
65
NS_LOG_FUNCTION
(
this
);
66
return
m_txVector
;
67
}
68
69
bool
70
HigherLayerTxVectorTag::IsAdaptable
(
void
)
const
71
{
72
NS_LOG_FUNCTION
(
this
);
73
return
m_adaptable
;
74
}
75
76
uint32_t
77
HigherLayerTxVectorTag::GetSerializedSize
(
void
)
const
78
{
79
NS_LOG_FUNCTION
(
this
);
80
return
(
sizeof
(
WifiTxVector
) + 1);
81
}
82
83
void
84
HigherLayerTxVectorTag::Serialize
(
TagBuffer
i)
const
85
{
86
NS_LOG_FUNCTION
(
this
<< &i);
87
i.
Write
((uint8_t *)&
m_txVector
,
sizeof
(
WifiTxVector
));
88
i.
WriteU8
(static_cast<uint8_t> (
m_adaptable
));
89
}
90
91
void
92
HigherLayerTxVectorTag::Deserialize
(
TagBuffer
i)
93
{
94
NS_LOG_FUNCTION
(
this
<< &i);
95
i.
Read
((uint8_t *)&
m_txVector
,
sizeof
(
WifiTxVector
));
96
m_adaptable
= i.
ReadU8
();
97
}
98
99
void
100
HigherLayerTxVectorTag::Print
(std::ostream &os)
const
101
{
102
NS_LOG_FUNCTION
(
this
<< &os);
103
os <<
" TxVector="
<<
m_txVector
<<
"; Adapter="
<<
m_adaptable
;
104
}
105
106
}
// namespace ns3
ns3::HigherLayerTxVectorTag::m_adaptable
bool m_adaptable
adaptable
Definition:
higher-tx-tag.h:81
ns3::HigherLayerTxVectorTag::HigherLayerTxVectorTag
HigherLayerTxVectorTag(void)
Definition:
higher-tx-tag.cc:49
ns3::TagBuffer::Write
void Write(const uint8_t *buffer, uint32_t size)
Definition:
tag-buffer.cc:125
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
Definition:
log-macros-enabled.h:213
ns3::HigherLayerTxVectorTag::IsAdaptable
bool IsAdaptable(void) const
Definition:
higher-tx-tag.cc:70
ns3::WifiTxVector
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
Definition:
wifi-tx-vector.h:61
higher-tx-tag.h
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition:
object-base.h:45
ns3::HigherLayerTxVectorTag::Print
virtual void Print(std::ostream &os) const
Definition:
higher-tx-tag.cc:100
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition:
log.h:202
ns3::TagBuffer::ReadU8
TAG_BUFFER_INLINE uint8_t ReadU8(void)
Definition:
tag-buffer.h:195
ns3::HigherLayerTxVectorTag
This tag will be used to support higher layer control DataRate and TxPwr_Level for transmission...
Definition:
higher-tx-tag.h:47
ns3::HigherLayerTxVectorTag::Deserialize
virtual void Deserialize(TagBuffer i)
Definition:
higher-tx-tag.cc:92
ns3::HigherLayerTxVectorTag::m_txVector
WifiTxVector m_txVector
transmit vector
Definition:
higher-tx-tag.h:80
ns3::HigherLayerTxVectorTag::GetTxVector
WifiTxVector GetTxVector(void) const
Definition:
higher-tx-tag.cc:63
ns3::HigherLayerTxVectorTag::Serialize
virtual void Serialize(TagBuffer i) const
Definition:
higher-tx-tag.cc:84
ns3::Tag
tag a set of bytes in a packet
Definition:
tag.h:36
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::TagBuffer::WriteU8
TAG_BUFFER_INLINE void WriteU8(uint8_t v)
Definition:
tag-buffer.h:172
ns3::TagBuffer
read and write tag data
Definition:
tag-buffer.h:51
ns3::HigherLayerTxVectorTag::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition:
higher-tx-tag.cc:32
ns3::TagBuffer::Read
void Read(uint8_t *buffer, uint32_t size)
Definition:
tag-buffer.cc:176
ns3::HigherLayerTxVectorTag::GetInstanceTypeId
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition:
higher-tx-tag.cc:43
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:58
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition:
type-id.cc:915
ns3::HigherLayerTxVectorTag::GetSerializedSize
virtual uint32_t GetSerializedSize(void) const
Definition:
higher-tx-tag.cc:77
Generated on Wed Nov 7 2018 10:02:12 for ns-3 by
1.8.14