File.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2009 by Ulrich Friedrich Klank <klank@in.tum.de>
00003  * 
00004  * This program is free software; you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License as published by
00006  * the Free Software Foundation; either version 3 of the License, or
00007  * (at your option) any later version.
00008  * 
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  * 
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016  */
00017 
00018  
00019 #ifndef FILE_H
00020 #define FILE_H
00021 #include <vector>
00022 #include <string>
00023 #include <fstream>
00024 #include <stdlib.h>
00025 
00026 namespace linfile
00027 {
00028 #define LIN__BUFFERSIZE 256
00029 
00030 class File
00031 {
00032 public:
00033         File(std::string, bool bOut = true, bool bAppend = false);
00034         ~File(void);
00035         double GetNextDouble();
00036         void RestartReading(){m_file.seekg(0);}
00037         int GetNextInt();
00038         char* GetNextCommentLine();
00039         char* GetNextWord();
00040         std::vector<int> GetNextIntVector();
00041         std::vector<double> GetNextDoubleVector();
00042         void WriteInt(const int nValue);
00043         void WriteSingleInt(int nValue);
00044         void WriteIntAsHex(int nValue);
00045         void WriteSingleIntAsHex(int nValue);
00046         void WriteDouble(const double dValue);
00047         void WriteSingleDouble(const double dValue);
00048         void WriteDoubleLimLength(const double dValue, const int nDigits = 1);
00049         void WriteLine(const char* stLine);
00050         void WriteVector(std::vector<int> viData);
00051         void WriteVector(std::vector<double> vdData);
00052         bool Invalid(){return m_file.bad();}
00053         void CloseFile(){m_file.close();}
00054 private:
00055         std::fstream m_file;
00056         char* nextElem;
00057 };
00058 }
00059 #endif //FILE_H
00060 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines


cognitive_perception
Author(s): Ulrich F Klank
autogenerated on Thu May 23 2013 07:38:34