INTRODUCTION Overview Download and Install Quick Start Documentation Publications NONFRAMEWORK CODE Driver Interfaces Drivers Libraries Utilities FRAMEWORK CODE Interfaces Components Libraries Utilities Full Software Listings DEVELOPER Tutorials Examples Dev Guide Dashboard PEOPLE Contributors Users Project Download Mailing lists
|
logreader.h00001 /* 00002 * Orca-Robotics Project: Components for robotics 00003 * http://orca-robotics.sf.net/ 00004 * Copyright (c) 2004-2009 Alex Brooks, Alexei Makarenko, Tobias Kaupp 00005 * 00006 * This copy of Orca is licensed to you under the terms described in 00007 * the LICENSE file included in this distribution. 00008 * 00009 */ 00010 00011 #ifndef ORCA_ORCALOG_LOGREADER_H 00012 #define ORCA_ORCALOG_LOGREADER_H 00013 00014 #include <string> 00015 #include <vector> 00016 #include <orcaice/context.h> 00017 #include <orcalog/logreaderinfo.h> 00018 00019 namespace orcalog 00020 { 00021 00022 namespace detail{ 00023 template<typename IndexType> 00024 class FileBreadCrumbs; 00025 } 00026 00030 class LogReader 00031 { 00032 public: 00033 00034 LogReader( const LogReaderInfo &logReaderInfo ); 00035 virtual ~LogReader(); 00036 00038 void init(); 00039 00040 const LogReaderInfo &logReaderInfo() const { return logReaderInfo_; } 00041 00043 std::ifstream *file_; 00044 00046 int logIndex() const { return logIndex_; } 00047 00049 void setLogIndex( int index ); 00050 00053 virtual std::string toString() const; 00054 00055 protected: 00056 00057 // Derived classes should call this to let us know when we're at log index zero 00058 void zeroLogIndex(); 00059 00060 // Derived classes should call this when they have just read an item. 00061 void advanceLogIndex(); 00062 00069 virtual void openLogFile(); 00070 00073 virtual void read()=0; 00074 00076 virtual void initialised() {} 00077 00078 //alen - Needed to move this into protected, otherwise openLogFile could not be overwritten 00079 LogReaderInfo logReaderInfo_; 00080 00081 private: 00082 00083 // An index into the log: we're currently pointing at the start of the logIndex_'th object. 00084 int logIndex_; 00085 00086 // As we move through the file, leave a trail of bread-crumbs so we can rewind 00087 // (use the index as the key) 00088 std::auto_ptr< detail::FileBreadCrumbs<int> > breadCrumbs_; 00089 }; 00090 00093 std::ifstream *openAsciiFileForReading( const std::string &filename ); 00094 00097 std::ifstream *openBinaryFileForReading( const std::string &filename ); 00098 00099 } // namespace 00100 00101 #endif |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)