Eclipse SUMO - Simulation of Urban MObility
Distribution_Points.cpp
Go to the documentation of this file.
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3
// Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4
// This program and the accompanying materials
5
// are made available under the terms of the Eclipse Public License v2.0
6
// which accompanies this distribution, and is available at
7
// http://www.eclipse.org/legal/epl-v20.html
8
// SPDX-License-Identifier: EPL-2.0
9
/****************************************************************************/
16
// The description of a distribution by a curve
17
/****************************************************************************/
18
19
20
// ===========================================================================
21
// included modules
22
// ===========================================================================
23
#include <
config.h
>
24
25
#include <cassert>
26
#include <sstream>
27
#include <iomanip>
28
#include <
utils/common/StdDefs.h
>
29
#include "
Distribution_Points.h
"
30
31
32
// ===========================================================================
33
// method definitions
34
// ===========================================================================
35
Distribution_Points::Distribution_Points
(
const
std::string&
id
)
36
:
Distribution
(id) {}
37
38
39
Distribution_Points::~Distribution_Points
() {}
40
41
42
double
43
Distribution_Points::getMax
()
const
{
44
assert(
getVals
().size() > 0);
45
return
getVals
().back();
46
}
47
48
49
std::string
50
Distribution_Points::toStr
(std::streamsize accuracy)
const
{
51
std::stringstream oss;
52
oss << std::setprecision(accuracy);
53
const
std::vector<double> vals =
getVals
();
54
for
(
int
i = 0; i < (int)vals.size(); i++) {
55
if
(i > 0) {
56
oss <<
","
;
57
}
58
oss << vals[i] <<
":"
<<
getProbs
()[i];
59
}
60
return
"points("
+ oss.str() +
")"
;
61
}
62
63
64
/****************************************************************************/
Distribution
Definition:
Distribution.h:38
Distribution_Points::toStr
std::string toStr(std::streamsize accuracy) const
Returns the string representation of this distribution.
Definition:
Distribution_Points.cpp:50
Distribution_Points::getMax
double getMax() const
Returns the maximum value of this distribution.
Definition:
Distribution_Points.cpp:43
RandomDistributor< double >::getProbs
const std::vector< double > & getProbs() const
Returns the probabilities assigned to the members of the distribution.
Definition:
RandomDistributor.h:160
Distribution_Points::~Distribution_Points
virtual ~Distribution_Points()
Destructor.
Definition:
Distribution_Points.cpp:39
Distribution_Points.h
config.h
StdDefs.h
Distribution_Points::Distribution_Points
Distribution_Points(const std::string &id)
Constructor.
Definition:
Distribution_Points.cpp:35
RandomDistributor< double >::getVals
const std::vector< double > & getVals() const
Returns the members of the distribution.
Definition:
RandomDistributor.h:149
src
utils
distribution
Distribution_Points.cpp
Generated on Wed Jan 15 2020 15:04:13 for Eclipse SUMO - Simulation of Urban MObility by
1.8.16