A Discrete-Event Network Simulator
API
lte-ue-component-carrier-manager.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 Danilo Abrignani
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: Danilo Abrignani <danilo.abrignani@unibo.it>
18  *
19  */
20 
22 
23 #include "lte-common.h"
24 
25 #include <ns3/log.h>
26 
27 namespace ns3
28 {
29 
30 NS_LOG_COMPONENT_DEFINE("LteUeComponentCarrierManager");
31 NS_OBJECT_ENSURE_REGISTERED(LteUeComponentCarrierManager);
32 
34  : m_ccmRrcSapUser(nullptr),
35  m_ccmRrcSapProvider(nullptr),
36  m_noOfComponentCarriers(0)
37 {
38  NS_LOG_FUNCTION(this);
39 }
40 
42 {
43  NS_LOG_FUNCTION(this);
44 }
45 
46 TypeId
48 {
49  static TypeId tid =
50  TypeId("ns3::LteUeComponentCarrierManager").SetParent<Object>().SetGroupName("Lte");
51  return tid;
52 }
53 
54 void
56 {
57  NS_LOG_FUNCTION(this);
58 }
59 
60 void
62 {
63  NS_LOG_FUNCTION(this << s);
64  m_ccmRrcSapUser = s;
65 }
66 
69 {
70  NS_LOG_FUNCTION(this);
71  return m_ccmRrcSapProvider;
72 }
73 
74 bool
76  LteMacSapProvider* sap)
77 {
78  NS_LOG_FUNCTION(this);
79  bool result = false;
80  auto it = m_macSapProvidersMap.find(componentCarrierId);
81  if (componentCarrierId > m_noOfComponentCarriers)
82  {
83  NS_FATAL_ERROR("Inconsistent componentCarrierId or you didn't call "
84  "SetNumberOfComponentCarriers before calling this method");
85  }
86  if (it != m_macSapProvidersMap.end())
87  {
88  NS_FATAL_ERROR("Tried to allocated an existing componentCarrierId");
89  }
90  else
91  {
92  m_macSapProvidersMap.insert(
93  std::pair<uint8_t, LteMacSapProvider*>(componentCarrierId, sap));
94  result = true;
95  }
96  return result;
97 }
98 
99 void
101 {
102  NS_LOG_FUNCTION(this);
103  NS_ABORT_MSG_IF(noOfComponentCarriers < MIN_NO_CC || noOfComponentCarriers > MAX_NO_CC,
104  "Number of component carriers should be greater than 0 and less than 6");
105  m_noOfComponentCarriers = noOfComponentCarriers;
106  // Set the number of component carriers in UE RRC
107  m_ccmRrcSapUser->SetNumberOfComponentCarriers(noOfComponentCarriers);
108 }
109 
110 } // end of namespace ns3
Service Access Point (SAP) offered by the MAC to the RLC See Femto Forum MAC Scheduler Interface Spec...
Definition: lte-mac-sap.h:36
Service Access Point (SAP) offered by the UE component carrier manager to the UE RRC.
Service Access Point (SAP) offered by the UE RRC to the UE CCM.
virtual void SetNumberOfComponentCarriers(uint16_t noOfComponentCarriers)=0
Set the number of component carriers.
LteUeCcmRrcSapProvider * m_ccmRrcSapProvider
Receive API calls from the UE RRC instance.
void SetNumberOfComponentCarriers(uint8_t noOfComponentCarriers)
Sets number of component carriers that are supported by this UE.
std::map< uint8_t, LteMacSapProvider * > m_macSapProvidersMap
Map of pointers to SAP to interfaces of the MAC instance if the flows of this UE.
uint8_t m_noOfComponentCarriers
The number of component carriers that this UE can support.
virtual void SetLteCcmRrcSapUser(LteUeCcmRrcSapUser *s)
Set the "user" part of the ComponentCarrier Management SAP interface that this UE component carrier m...
LteUeCcmRrcSapUser * m_ccmRrcSapUser
Interface to the UE RRC instance.
void DoDispose() override
Destructor implementation.
virtual LteUeCcmRrcSapProvider * GetLteCcmRrcSapProvider()
Exports the "provider" part of the ComponentCarrier Management SAP interface.
bool SetComponentCarrierMacSapProviders(uint8_t componentCarrierId, LteMacSapProvider *sap)
Sets a pointer to SAP interface of MAC instance for the specified carrier.
A base class which provides memory management and object aggregation.
Definition: object.h:89
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_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:179
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
Definition: abort.h:108
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#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.
constexpr uint32_t MAX_NO_CC
Maximum number of carrier components allowed by 3GPP up to R13.
Definition: lte-common.h:39