|
SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00007 // Encapsulates binary reading operations on a file 00008 /****************************************************************************/ 00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00010 // Copyright (C) 2001-2011 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 BinaryInputDevice_h 00020 #define BinaryInputDevice_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 <string> 00033 #include <fstream> 00034 00035 00036 // =========================================================================== 00037 // class definitions 00038 // =========================================================================== 00054 class BinaryInputDevice { 00055 public: 00060 BinaryInputDevice(const std::string& name) throw(); 00061 00062 00064 ~BinaryInputDevice() throw(); 00065 00066 00071 bool good() const throw(); 00072 00073 00080 friend BinaryInputDevice& operator>>(BinaryInputDevice& os, int& i) throw(); 00081 00082 00089 friend BinaryInputDevice& operator>>(BinaryInputDevice& os, unsigned int& i) throw(); 00090 00091 00098 friend BinaryInputDevice& operator>>(BinaryInputDevice& os, SUMOReal& f) throw(); 00099 00100 00107 friend BinaryInputDevice& operator>>(BinaryInputDevice& os, bool& b) throw(); 00108 00109 00122 friend BinaryInputDevice& operator>>(BinaryInputDevice& os, std::string& s) throw(); 00123 00124 00131 friend BinaryInputDevice& operator>>(BinaryInputDevice& os, long& l) throw(); 00132 00133 00134 private: 00136 std::ifstream myStream; 00137 00139 char myBuffer[1000]; 00140 00141 }; 00142 00143 00144 #endif 00145 00146 /****************************************************************************/ 00147