1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 /*
3 * Copyright (c) 2015 Danilo Abrignani
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 * Author: Danilo Abrignani <danilo.abrignani@unibo.it>
19 */
20
21 #include "component-carrier-ue.h"
22 #include <ns3/uinteger.h>
23 #include <ns3/boolean.h>
24 #include <ns3/simulator.h>
25 #include <ns3/log.h>
26 #include <ns3/abort.h>
27 #include <ns3/lte-ue-phy.h>
28 #include <ns3/lte-ue-mac.h>
29 #include <ns3/pointer.h>
30
31 namespace ns3 {
32
33 NS_LOG_COMPONENT_DEFINE ("ComponentCarrierUe");
34
35 NS_OBJECT_ENSURE_REGISTERED ( ComponentCarrierUe);
36
GetTypeId(void)37 TypeId ComponentCarrierUe::GetTypeId (void)
38 {
39 static TypeId
40 tid =
41 TypeId ("ns3::ComponentCarrierUe")
42 .SetParent<ComponentCarrier> ()
43 .AddConstructor<ComponentCarrierUe> ()
44 .AddAttribute ("LteUePhy",
45 "The PHY associated to this EnbNetDevice",
46 PointerValue (),
47 MakePointerAccessor (&ComponentCarrierUe::m_phy),
48 MakePointerChecker <LteUePhy> ())
49 .AddAttribute ("LteUeMac",
50 "The MAC associated to this UeNetDevice",
51 PointerValue (),
52 MakePointerAccessor (&ComponentCarrierUe::m_mac),
53 MakePointerChecker <LteUeMac> ())
54 ;
55 return tid;
56 }
ComponentCarrierUe()57 ComponentCarrierUe::ComponentCarrierUe ()
58 {
59 NS_LOG_FUNCTION (this);
60 }
61
~ComponentCarrierUe(void)62 ComponentCarrierUe::~ComponentCarrierUe (void)
63 {
64 NS_LOG_FUNCTION (this);
65 }
66
67 void
DoDispose()68 ComponentCarrierUe::DoDispose ()
69 {
70 NS_LOG_FUNCTION (this);
71 m_phy->Dispose ();
72 m_phy = 0;
73 m_mac->Dispose ();
74 m_mac = 0;
75 Object::DoDispose ();
76 }
77
78
79 void
DoInitialize(void)80 ComponentCarrierUe::DoInitialize (void)
81 {
82 NS_LOG_FUNCTION (this);
83 m_phy->Initialize ();
84 m_mac->Initialize();
85 }
86
87 void
SetPhy(Ptr<LteUePhy> s)88 ComponentCarrierUe::SetPhy (Ptr<LteUePhy> s)
89 {
90 NS_LOG_FUNCTION (this);
91 m_phy = s;
92 }
93
94
95 Ptr<LteUePhy>
GetPhy() const96 ComponentCarrierUe::GetPhy () const
97 {
98 NS_LOG_FUNCTION (this);
99 return m_phy;
100 }
101
102 void
SetMac(Ptr<LteUeMac> s)103 ComponentCarrierUe::SetMac (Ptr<LteUeMac> s)
104 {
105 NS_LOG_FUNCTION (this);
106 m_mac = s;
107 }
108
109 Ptr<LteUeMac>
GetMac() const110 ComponentCarrierUe::GetMac () const
111 {
112 NS_LOG_FUNCTION (this);
113 return m_mac;
114 }
115
116 } // namespace ns3
117
118
119