SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00007 // A district (origin/destination) 00008 /****************************************************************************/ 00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00010 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors 00011 /****************************************************************************/ 00012 // 00013 // This file is part of SUMO. 00014 // SUMO is free software: you can redistribute it and/or modify 00015 // it under the terms of the GNU General Public License as published by 00016 // the Free Software Foundation, either version 3 of the License, or 00017 // (at your option) any later version. 00018 // 00019 /****************************************************************************/ 00020 #ifndef ODDistrict_h 00021 #define ODDistrict_h 00022 00023 00024 // =========================================================================== 00025 // included modules 00026 // =========================================================================== 00027 #ifdef _MSC_VER 00028 #include <windows_config.h> 00029 #else 00030 #include <config.h> 00031 #endif 00032 00033 #include <vector> 00034 #include <string> 00035 #include <utility> 00036 #include <utils/common/Named.h> 00037 #include <utils/common/UtilExceptions.h> 00038 #include <utils/common/RandomDistributor.h> 00039 00040 00041 // =========================================================================== 00042 // class definitions 00043 // =========================================================================== 00051 class ODDistrict : public Named { 00052 public: 00057 ODDistrict(const std::string& id) ; 00058 00059 00061 ~ODDistrict() ; 00062 00063 00077 void addSource(const std::string& id, SUMOReal weight) ; 00078 00079 00093 void addSink(const std::string& id, SUMOReal weight) ; 00094 00095 00104 std::string getRandomSource() const throw(OutOfBoundsException); 00105 00106 00115 std::string getRandomSink() const throw(OutOfBoundsException); 00116 00117 00122 unsigned int sinkNumber() const; 00123 00124 00129 unsigned int sourceNumber() const; 00130 00131 00132 private: 00134 RandomDistributor<std::string> mySources; 00135 00137 RandomDistributor<std::string> mySinks; 00138 00139 00140 private: 00142 ODDistrict(const ODDistrict& s); 00143 00145 ODDistrict& operator=(const ODDistrict& s); 00146 00147 00148 }; 00149 00150 00151 #endif 00152 00153 /****************************************************************************/ 00154