SUMO - Simulation of Urban MObility
Named.h
Go to the documentation of this file.
00001 /****************************************************************************/
00008 // Base class for objects which do have an id.
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 #ifndef Named_h
00022 #define Named_h
00023 
00024 
00025 // ===========================================================================
00026 // included modules
00027 // ===========================================================================
00028 #ifdef _MSC_VER
00029 #include <windows_config.h>
00030 #else
00031 #include <config.h>
00032 #endif
00033 
00034 #include <string>
00035 
00036 
00037 // ===========================================================================
00038 // class definitions
00039 // ===========================================================================
00044 class Named {
00045 public:
00050     Named(const std::string& id) : myID(id) { }
00051 
00052 
00054     virtual ~Named() { }
00055 
00056 
00061     const std::string& getID() const {
00062         return myID;
00063     }
00064 
00065 
00067     void setID(const std::string& newID) {
00068         myID = newID;
00069     }
00070 
00071 
00073     struct ComparatorIdLess {
00074         bool operator()(Named* const a, Named* const b) {
00075             return (a->getID() < b->getID());
00076         }
00077     };
00078 
00079 
00080 
00081 protected:
00083     std::string myID;
00084 
00085 };
00086 
00087 
00088 #endif
00089 
00090 /****************************************************************************/
00091 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines