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