SUMO - Simulation of Urban MObility
FileHelpers.h
Go to the documentation of this file.
00001 /****************************************************************************/
00008 // Functions for an easier usage of files
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 FileHelpers_h
00022 #define FileHelpers_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 <fstream>
00035 #include <string>
00036 #include "SUMOTime.h"
00037 
00038 
00039 // ===========================================================================
00040 // class definitions
00041 // ===========================================================================
00046 class FileHelpers {
00047 public:
00049 
00050 
00056     static bool exists(std::string path);
00058 
00059 
00060 
00062 
00063 
00069     static std::string getFilePath(const std::string& path);
00070 
00071 
00084     static std::string getConfigurationRelative(const std::string& configPath,
00085             const std::string& path);
00086 
00087 
00096     static bool isSocket(const std::string& name);
00097 
00098 
00109     static bool isAbsolute(const std::string& path);
00110 
00111 
00123     static std::string checkForRelativity(std::string filename,
00124                                           const std::string& basePath);
00126 
00127 
00128 
00130 
00131 
00138     static std::ostream& writeInt(std::ostream& strm, int value);
00139 
00140 
00147     static std::ostream& writeUInt(std::ostream& strm, unsigned int value);
00148 
00149 
00158     static std::ostream& writeFloat(std::ostream& strm, SUMOReal value);
00159 
00160 
00167     static std::ostream& writeByte(std::ostream& strm, unsigned char value);
00168 
00169 
00180     static std::ostream& writeString(std::ostream& strm, const std::string& value);
00182 
00192     static std::ostream& writeTime(std::ostream& strm, SUMOTime value);
00193 
00194 
00195 };
00196 
00197 
00198 #endif
00199 
00200 /****************************************************************************/
00201 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines