-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathGainConfigureHelper.cpp
More file actions
executable file
·49 lines (44 loc) · 1.14 KB
/
GainConfigureHelper.cpp
File metadata and controls
executable file
·49 lines (44 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//
// GainConfigureHelper.cpp
// AggregationNS3
//
// Created by Alper Sinan Akyurek on 8/21/16.
// Copyright © 2016 Alper Sinan Akyurek. All rights reserved.
//
#include "GainConfigureHelper.hpp"
Application::TGainFunctionPtr
GainConfigureHelper::Configure( std::ifstream & conf )
{
TGainFunctionId gainId;
if ( !( conf >> gainId ) )
{
class GainIdFailed{};
throw GainIdFailed();
}
Application::TGainFunctionPtr gainFunction;
if ( gainId == EnergyId )
{
gainFunction = ns3::Create<EnergyGainFunction>();
}
else if ( gainId == InformationFreshnessId )
{
gainFunction = ns3::Create<InformationFreshnessGainFunction>();
}
else if ( gainId == SuccessId )
{
gainFunction = ns3::Create<SuccessGainFunction>();
}
else if ( gainId == CongestionId )
{
gainFunction = ns3::Create<CongestionGainFunction>();
}
else if ( gainId == SuccessUniformId )
{
gainFunction = ns3::Create<SuccessUniformGainFunction>();
}
else
{
gainFunction = ns3::Create<NoGainFunction>();
}
return ( gainFunction );
}