SUMO - Simulation of Urban MObility
BinaryInputDevice.h
Go to the documentation of this file.
00001 /****************************************************************************/
00008 // Encapsulates binary reading operations on a file
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 BinaryInputDevice_h
00022 #define BinaryInputDevice_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 #include <fstream>
00036 
00037 
00038 // ===========================================================================
00039 // class definitions
00040 // ===========================================================================
00056 class BinaryInputDevice {
00057 public:
00062     BinaryInputDevice(const std::string& name) ;
00063 
00064 
00066     ~BinaryInputDevice() ;
00067 
00068 
00073     bool good() const ;
00074 
00075 
00082     friend BinaryInputDevice& operator>>(BinaryInputDevice& os, int& i) ;
00083 
00084 
00091     friend BinaryInputDevice& operator>>(BinaryInputDevice& os, unsigned int& i) ;
00092 
00093 
00100     friend BinaryInputDevice& operator>>(BinaryInputDevice& os, SUMOReal& f) ;
00101 
00102 
00109     friend BinaryInputDevice& operator>>(BinaryInputDevice& os, bool& b) ;
00110 
00111 
00124     friend BinaryInputDevice& operator>>(BinaryInputDevice& os, std::string& s) ;
00125 
00126 
00133     friend BinaryInputDevice& operator>>(BinaryInputDevice& os, long& l) ;
00134 
00135 
00136 private:
00138     std::ifstream myStream;
00139 
00141     char myBuffer[1000];
00142 
00143 };
00144 
00145 
00146 #endif
00147 
00148 /****************************************************************************/
00149 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines