Eclipse SUMO - Simulation of Urban MObility
Distribution.h
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 /****************************************************************************/
14 // The base class for distribution descriptions.
15 /****************************************************************************/
16 #ifndef Distribution_h
17 #define Distribution_h
18 
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 #include <config.h>
24 
25 #include <random>
26 #include <utils/common/Named.h>
27 
28 
29 // ===========================================================================
30 // class definitions
31 // ===========================================================================
37 class Distribution : public Named {
38 public:
40  Distribution(const std::string& id) : Named(id) { }
41 
43  virtual ~Distribution() { }
44 
52  virtual double sample(std::mt19937* which = 0) const = 0;
53 
55  virtual double getMax() const = 0;
56 
58  virtual std::string toStr(std::streamsize accuracy) const = 0;
59 
60 };
61 
62 
63 #endif
64 
65 /****************************************************************************/
66 
Distribution
Definition: Distribution.h:37
Named
Base class for objects which have an id.
Definition: Named.h:56
Distribution::toStr
virtual std::string toStr(std::streamsize accuracy) const =0
Returns the string representation of this distribution.
Distribution::getMax
virtual double getMax() const =0
Returns the maximum value of this distribution.
Named.h
Distribution::Distribution
Distribution(const std::string &id)
Constructor.
Definition: Distribution.h:40
config.h
Distribution::~Distribution
virtual ~Distribution()
Destructor.
Definition: Distribution.h:43
Distribution::sample
virtual double sample(std::mt19937 *which=0) const =0
Draw a sample of the distribution.