satellite-beam-user-info.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2013 Magister Solutions Ltd
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: Sami Rantanen <sami.rantanen@magister.fi>
19  */
20 
22 
23 #include "ns3/assert.h"
24 #include "ns3/log.h"
25 
26 #include <utility>
27 #include <vector>
28 
29 NS_LOG_COMPONENT_DEFINE("SatBeamUserInfo");
30 
31 namespace ns3
32 {
33 
35 {
36  NS_LOG_FUNCTION(this);
37 }
38 
39 SatBeamUserInfo::SatBeamUserInfo(uint32_t utCount, uint32_t userCountPerUt)
40 {
41  NS_LOG_FUNCTION(this << utCount << userCountPerUt);
42 
43  NS_ASSERT(utCount > 0);
44  NS_ASSERT(userCountPerUt > 0);
45 
46  for (uint32_t i = 0; i < utCount; i++)
47  {
48  m_userCount.push_back(userCountPerUt);
49  }
50 }
51 
52 uint32_t
54 {
55  NS_LOG_FUNCTION(this);
56 
57  return m_userCount.size();
58 }
59 
60 uint32_t
61 SatBeamUserInfo::GetUtUserCount(uint32_t utIndex) const
62 {
63  NS_LOG_FUNCTION(this << utIndex);
64 
65  NS_ASSERT(utIndex < m_userCount.size());
66 
67  return m_userCount[utIndex];
68 }
69 
70 void
71 SatBeamUserInfo::SetUtUserCount(uint32_t utIndex, uint32_t userCount)
72 {
73  NS_LOG_FUNCTION(this << utIndex << userCount);
74 
75  NS_ASSERT(utIndex < m_userCount.size());
76 
77  m_userCount[utIndex] = userCount;
78 }
79 
80 void
81 SatBeamUserInfo::AppendUt(uint32_t userCount)
82 {
83  NS_LOG_FUNCTION(this << userCount);
84 
85  NS_ASSERT(userCount > 0);
86 
87  m_userCount.push_back(userCount);
88 }
89 
90 void
91 SatBeamUserInfo::SetPositions(std::vector<std::pair<GeoCoordinate, uint32_t>> positions)
92 {
93  m_positions = positions;
94 }
95 
96 std::vector<std::pair<GeoCoordinate, uint32_t>>
98 {
99  return m_positions;
100 }
101 
102 } // namespace ns3
uint32_t GetUtUserCount(uint32_t utIndex) const
void AppendUt(uint32_t userCount)
Appends new UT to end of the list with given user count for the appended UT.
std::vector< std::pair< GeoCoordinate, uint32_t > > GetPositions()
void SetUtUserCount(uint32_t utIndex, uint32_t userCount)
Sets user count for the UT with given uIndex.
void SetPositions(std::vector< std::pair< GeoCoordinate, uint32_t >> positions)
Set the list of custom positions to create, and associated group.
std::vector< std::pair< GeoCoordinate, uint32_t > > m_positions
SatBeamUserInfo()
Default constructor for SatBeamUserInfo enables creating an empty information structure.
std::vector< uint32_t > m_userCount
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.