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 NS_LOG_COMPONENT_DEFINE("SatBeamUserInfo");
27 
28 namespace ns3
29 {
30 
32 {
33  NS_LOG_FUNCTION(this);
34 }
35 
36 SatBeamUserInfo::SatBeamUserInfo(uint32_t utCount, uint32_t userCountPerUt)
37 {
38  NS_LOG_FUNCTION(this << utCount << userCountPerUt);
39 
40  NS_ASSERT(utCount > 0);
41  NS_ASSERT(userCountPerUt > 0);
42 
43  for (uint32_t i = 0; i < utCount; i++)
44  {
45  m_userCount.push_back(userCountPerUt);
46  }
47 }
48 
49 uint32_t
51 {
52  NS_LOG_FUNCTION(this);
53 
54  return m_userCount.size();
55 }
56 
57 uint32_t
58 SatBeamUserInfo::GetUtUserCount(uint32_t utIndex) const
59 {
60  NS_LOG_FUNCTION(this << utIndex);
61 
62  NS_ASSERT(utIndex < m_userCount.size());
63 
64  return m_userCount[utIndex];
65 }
66 
67 void
68 SatBeamUserInfo::SetUtUserCount(uint32_t utIndex, uint32_t userCount)
69 {
70  NS_LOG_FUNCTION(this << utIndex << userCount);
71 
72  NS_ASSERT(utIndex < m_userCount.size());
73 
74  m_userCount[utIndex] = userCount;
75 }
76 
77 void
78 SatBeamUserInfo::AppendUt(uint32_t userCount)
79 {
80  NS_LOG_FUNCTION(this << userCount);
81 
82  NS_ASSERT(userCount > 0);
83 
84  m_userCount.push_back(userCount);
85 }
86 
87 void
88 SatBeamUserInfo::SetPositions(std::vector<std::pair<GeoCoordinate, uint32_t>> positions)
89 {
90  m_positions = positions;
91 }
92 
93 std::vector<std::pair<GeoCoordinate, uint32_t>>
95 {
96  return m_positions;
97 }
98 
99 } // 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.