SUMO - Simulation of Urban MObility
ODDistrictCont.cpp
Go to the documentation of this file.
00001 /****************************************************************************/
00008 // A container for districts
00009 /****************************************************************************/
00010 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00011 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
00012 /****************************************************************************/
00013 //
00014 //   This file is part of SUMO.
00015 //   SUMO is free software: you can redistribute it and/or modify
00016 //   it under the terms of the GNU General Public License as published by
00017 //   the Free Software Foundation, either version 3 of the License, or
00018 //   (at your option) any later version.
00019 //
00020 /****************************************************************************/
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 <string>
00033 #include "ODDistrict.h"
00034 #include "ODDistrictCont.h"
00035 #include <utils/common/MsgHandler.h>
00036 #include <utils/common/UtilExceptions.h>
00037 #include <utils/common/NamedObjectCont.h>
00038 
00039 #ifdef CHECK_MEMORY_LEAKS
00040 #include <foreign/nvwa/debug_new.h>
00041 #endif // CHECK_MEMORY_LEAKS
00042 
00043 
00044 // ===========================================================================
00045 // method definitions
00046 // ===========================================================================
00047 ODDistrictCont::ODDistrictCont() {}
00048 
00049 
00050 ODDistrictCont::~ODDistrictCont() {}
00051 
00052 
00053 std::string
00054 ODDistrictCont::getRandomSourceFromDistrict(const std::string& name) const throw(OutOfBoundsException, InvalidArgument) {
00055     ODDistrict* district = get(name);
00056     if (district == 0) {
00057         throw InvalidArgument("There is no district '" + name + "'.");
00058     }
00059     return district->getRandomSource();
00060 }
00061 
00062 
00063 std::string
00064 ODDistrictCont::getRandomSinkFromDistrict(const std::string& name) const throw(OutOfBoundsException, InvalidArgument) {
00065     ODDistrict* district = get(name);
00066     if (district == 0) {
00067         throw InvalidArgument("There is no district '" + name + "'.");
00068     }
00069     return district->getRandomSink();
00070 }
00071 
00072 
00073 
00074 /****************************************************************************/
00075 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines