A Discrete-Event Network Simulator
API
lena-cc-helper.cc
Go to the documentation of this file.
1/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2015 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
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
22#include "ns3/core-module.h"
23#include "ns3/config-store.h"
24#include <ns3/buildings-helper.h>
25#include "ns3/component-carrier.h"
26#include "ns3/cc-helper.h"
27
28using namespace ns3;
29
30
31void Print ( ComponentCarrier cc);
32
33int main (int argc, char *argv[])
34{
35 CommandLine cmd (__FILE__);
36 cmd.Parse (argc, argv);
37
38 Config::SetDefault ("ns3::ComponentCarrier::UlBandwidth", UintegerValue (50));
39 Config::SetDefault ("ns3::ComponentCarrier::PrimaryCarrier", BooleanValue (true));
40
41 // Parse again so you can override default values from the command line
42 cmd.Parse (argc, argv);
43
44 Ptr<CcHelper> cch = CreateObject<CcHelper> ();
45 cch->SetNumberOfComponentCarriers(2);
46
47 std::map< uint8_t, ComponentCarrier > ccm = cch->EquallySpacedCcs ();
48
49 std::map< uint8_t, ComponentCarrier >::iterator it;
50
51 std::cout << " CcMap size " << ccm.size () << std::endl;
52 for (it = ccm.begin (); it !=ccm.end (); it++)
53 {
54 Print (it->second);
55 }
56
57
58 Simulator::Stop (Seconds (1.05));
59
60 Simulator::Run ();
61
62 // GtkConfigStore config;
63 // config.ConfigureAttributes ();
64
65 Simulator::Destroy ();
66 return 0;
67}
68
70{
71 std::cout << " UlBandwidth " << uint16_t (cc.GetUlBandwidth ())
72 << " DlBandwidth " << uint16_t (cc.GetDlBandwidth ())
73 << " Dl Earfcn " << cc.GetDlEarfcn ()
74 << " Ul Earfcn " << cc.GetUlEarfcn ()
75 << " - Is this the Primary Channel? " << cc.IsPrimary ()
76 << std::endl;
77}
AttributeValue implementation for Boolean.
Definition: boolean.h:37
Parse command-line arguments.
Definition: command-line.h:229
ComponentCarrier Object, it defines a single Carrier This is the parent class for both ComponentCarri...
uint32_t GetDlEarfcn() const
uint16_t GetUlBandwidth() const
uint16_t GetDlBandwidth() const
uint32_t GetUlEarfcn() const
bool IsPrimary() const
Checks if the carrier is the primary carrier.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
Hold an unsigned integer type.
Definition: uinteger.h:44
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:849
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1244
void Print(ComponentCarrier cc)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
cmd
Definition: second.py:35