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
/****************************************************************************/
15
// The description of a distribution by a curve
16
/****************************************************************************/
17
18
19
// ===========================================================================
20
// included modules
21
// ===========================================================================
22
#include <
config.h
>
23
24
#include <cassert>
25
#include <sstream>
26
#include <iomanip>
27
#include <
utils/common/StdDefs.h
>
28
#include "
Distribution_Points.h
"
29
30
31
// ===========================================================================
32
// method definitions
33
// ===========================================================================
34
Distribution_Points::Distribution_Points
(
const
std::string&
id
)
35
:
Distribution
(id) {}
36
37
38
Distribution_Points::~Distribution_Points
() {}
39
40
41
double
42
Distribution_Points::getMax
()
const
{
43
assert(
getVals
().size() > 0);
44
return
getVals
().back();
45
}
46
47
48
std::string
49
Distribution_Points::toStr
(std::streamsize accuracy)
const
{
50
std::stringstream oss;
51
oss << std::setprecision(accuracy);
52
const
std::vector<double> vals =
getVals
();
53
for
(
int
i = 0; i < (int)vals.size(); i++) {
54
if
(i > 0) {
55
oss <<
","
;
56
}
57
oss << vals[i] <<
":"
<<
getProbs
()[i];
58
}
59
return
"points("
+ oss.str() +
")"
;
60
}
61
62
63
/****************************************************************************/
Distribution
Definition:
Distribution.h:37
Distribution_Points::toStr
std::string toStr(std::streamsize accuracy) const
Returns the string representation of this distribution.
Definition:
Distribution_Points.cpp:49
Distribution_Points::getMax
double getMax() const
Returns the maximum value of this distribution.
Definition:
Distribution_Points.cpp:42
RandomDistributor< double >::getProbs
const std::vector< double > & getProbs() const
Returns the probabilities assigned to the members of the distribution.
Definition:
RandomDistributor.h:162
Distribution_Points::~Distribution_Points
virtual ~Distribution_Points()
Destructor.
Definition:
Distribution_Points.cpp:38
Distribution_Points.h
config.h
StdDefs.h
Distribution_Points::Distribution_Points
Distribution_Points(const std::string &id)
Constructor.
Definition:
Distribution_Points.cpp:34
RandomDistributor< double >::getVals
const std::vector< double > & getVals() const
Returns the members of the distribution.
Definition:
RandomDistributor.h:151
src
utils
distribution
Distribution_Points.cpp
Generated on Thu Jan 16 2020 21:12:23 for Eclipse SUMO - Simulation of Urban MObility by
1.8.16