SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FileHelpers.h
Go to the documentation of this file.
1 /****************************************************************************/
8 // Functions for an easier usage of files
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
11 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
12 /****************************************************************************/
13 //
14 // This file is part of SUMO.
15 // SUMO is free software: you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation, either version 3 of the License, or
18 // (at your option) any later version.
19 //
20 /****************************************************************************/
21 #ifndef FileHelpers_h
22 #define FileHelpers_h
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
34 #include <fstream>
35 #include <string>
36 #include "SUMOTime.h"
37 
38 
39 // ===========================================================================
40 // class definitions
41 // ===========================================================================
46 class FileHelpers {
47 public:
49 
50 
56  static bool exists(std::string path);
58 
59 
60 
62 
63 
69  static std::string getFilePath(const std::string& path);
70 
71 
84  static std::string getConfigurationRelative(const std::string& configPath,
85  const std::string& path);
86 
87 
96  static bool isSocket(const std::string& name);
97 
98 
109  static bool isAbsolute(const std::string& path);
110 
111 
123  static std::string checkForRelativity(std::string filename,
124  const std::string& basePath);
126 
127 
128 
130 
131 
138  static std::ostream& writeInt(std::ostream& strm, int value);
139 
140 
147  static std::ostream& writeUInt(std::ostream& strm, unsigned int value);
148 
149 
158  static std::ostream& writeFloat(std::ostream& strm, SUMOReal value);
159 
160 
167  static std::ostream& writeByte(std::ostream& strm, unsigned char value);
168 
169 
180  static std::ostream& writeString(std::ostream& strm, const std::string& value);
182 
192  static std::ostream& writeTime(std::ostream& strm, SUMOTime value);
193 
194 
195 };
196 
197 
198 #endif
199 
200 /****************************************************************************/
201