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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
17 // The base class for distribution descriptions.
18 /****************************************************************************/
19 #ifndef Distribution_h
20 #define Distribution_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #ifdef _MSC_VER
27 #include <windows_config.h>
28 #else
29 #include <config.h>
30 #endif
31 
32 #include <random>
33 #include <utils/common/Named.h>
34 
35 
36 // ===========================================================================
37 // class definitions
38 // ===========================================================================
44 class Distribution : public Named {
45 public:
47  Distribution(const std::string& id) : Named(id) { }
48 
50  virtual ~Distribution() { }
51 
59  virtual double sample(std::mt19937* which = 0) const = 0;
60 
62  virtual double getMax() const = 0;
63 
65  virtual std::string toStr(std::streamsize accuracy) const = 0;
66 
67 };
68 
69 
70 #endif
71 
72 /****************************************************************************/
73 
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:47
Base class for objects which have an id.
Definition: Named.h:45
virtual ~Distribution()
Destructor.
Definition: Distribution.h:50