A Discrete-Event Network Simulator
API
lte-enb-component-carrier-manager.cc
Go to the documentation of this file.
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 
23 #include <ns3/log.h>
24 
25 namespace ns3 {
26 
27 NS_LOG_COMPONENT_DEFINE ("LteEnbComponentCarrierManager");
28 NS_OBJECT_ENSURE_REGISTERED (LteEnbComponentCarrierManager);
29 
30 
32 {
33 
34 }
35 
37 {
38 }
39 
40 TypeId
42 {
43  static TypeId tid = TypeId ("ns3::LteEnbComponentCarrierManager")
44  .SetParent<Object> ()
45  .SetGroupName("Lte")
46  ;
47  return tid;
48 }
49 
50 void
52 {
53 }
54 
55 void
57 {
58  NS_LOG_FUNCTION (this << s);
59  m_ccmRrcSapUser = s;
60 }
61 
64 {
65  NS_LOG_FUNCTION (this);
66  return m_ccmRrcSapProvider;
67 }
68 
71 {
72  NS_LOG_FUNCTION (this);
73  return m_macSapProvider;
74 }
75 
78 {
79  NS_LOG_FUNCTION (this);
80  return m_ccmMacSapUser;
81 }
82 
83 bool
85 {
86  NS_LOG_FUNCTION (this);
87  bool res = false;
88  std::map <uint8_t, LteMacSapProvider*>::iterator it = m_macSapProvidersMap.find (componentCarrierId);
89  if ((uint16_t) componentCarrierId > m_noOfComponentCarriers)
90  {
91  NS_FATAL_ERROR ("Inconsistent componentCarrierId or you didn't call SetNumberOfComponentCarriers before calling this method");
92  }
93  if (it != m_macSapProvidersMap.end ())
94  {
95  NS_FATAL_ERROR ("Tried to allocated an existing componentCarrierId");
96  }
97  else
98  {
99  m_macSapProvidersMap.insert (std::pair<uint8_t, LteMacSapProvider*>(componentCarrierId, sap));
100  res = true;
101  }
102  return res;
103 
104 }
105 
106 bool
108 {
109  NS_LOG_FUNCTION (this);
110  bool res = false;
111  std::map< uint8_t,LteCcmMacSapProvider*>::iterator it = m_ccmMacSapProviderMap.find (componentCarrierId);
112 
113  if (it == m_ccmMacSapProviderMap.end ())
114  {
115  m_ccmMacSapProviderMap.insert (std::pair <uint8_t,LteCcmMacSapProvider*> (componentCarrierId, sap));
116  }
117 
118  res = true;
119  return res;
120 
121 }
122 
123 void
125 {
126  NS_LOG_FUNCTION (this);
127  NS_ABORT_MSG_IF (noOfComponentCarriers < MIN_NO_CC || noOfComponentCarriers > MAX_NO_CC, "Number of component carriers should be greater than 0 and less than 6");
128  m_noOfComponentCarriers = noOfComponentCarriers;
129  //Set the number of component carriers in eNB RRC
130  m_ccmRrcSapUser->SetNumberOfComponentCarriers (noOfComponentCarriers);
131 }
132 
133 } // end of namespace ns3
Service Access Point (SAP) offered by the component carrier manager (CCM) by MAC to CCM.
Service Access Point (SAP) offered by MAC to the component carrier manager (CCM).
Service Access Point (SAP) offered by the Component Carrier Manager (CCM) instance to the eNodeB RRC ...
Service Access Point (SAP) offered by the eNodeB RRC instance to the component carrier manager (CCM) ...
virtual void SetNumberOfComponentCarriers(uint16_t noOfComponentCarriers)=0
Set the number of component carriers.
virtual LteCcmMacSapUser * GetLteCcmMacSapUser()
This function returns a pointer to the LteCcmMacSapUser interface, which is used by MAC to communicat...
LteCcmRrcSapProvider * m_ccmRrcSapProvider
A pointer to the SAP interface of the CCM instance to receive API calls from the eNodeB RRC instance.
virtual LteMacSapProvider * GetLteMacSapProvider()
Returns the pointer to the LteMacSapProvider interface, the provider of MAC, which is this new archit...
LteMacSapProvider * m_macSapProvider
A pointer to main SAP interface of the MAC instance, which is in this case handled by CCM.
std::map< uint8_t, LteMacSapProvider * > m_macSapProvidersMap
A map of pointers to real SAP interfaces of MAC instances.
std::map< uint8_t, LteCcmMacSapProvider * > m_ccmMacSapProviderMap
A map of pointers to the SAP interfaces of CCM instance that provides the CCM specific functionalitie...
virtual LteCcmRrcSapProvider * GetLteCcmRrcSapProvider()
Export the "provider" part of the ComponentCarrier Management SAP interface.
virtual bool SetMacSapProvider(uint8_t componentCarrierId, LteMacSapProvider *sap)
Set LteMacSapProvider interface for the MAC object of the specified component carrier.
virtual void SetNumberOfComponentCarriers(uint16_t noOfComponentCarriers)
Sets the total number of component carriers.
uint16_t m_noOfComponentCarriers
The number component of carriers that are supported by this eNb.
virtual bool SetCcmMacSapProviders(uint8_t componentCarrierId, LteCcmMacSapProvider *sap)
Set LteCcmMacSapProvider interface for the MAC object of the specified component carrier.
virtual void SetLteCcmRrcSapUser(LteCcmRrcSapUser *s)
Set the "user" part of the ComponentCarrier Management SAP interface that this ComponentCarrier algor...
LteCcmMacSapUser * m_ccmMacSapUser
LteCcmMacSapUser is extended version of LteMacSapUser interface.
LteCcmRrcSapUser * m_ccmRrcSapUser
A pointer to SAP interface of RRC instance, i.e.
virtual void DoDispose()
Destructor implementation.
Service Access Point (SAP) offered by the MAC to the RLC See Femto Forum MAC Scheduler Interface Spec...
Definition: lte-mac-sap.h:37
A base class which provides memory management and object aggregation.
Definition: object.h:88
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:922
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:165
#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:205
#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:45
#define MAX_NO_CC
Definition: lte-enb-rrc.h:57
Every class exported by the ns3 library is enclosed in the ns3 namespace.