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