orca-robotics INTRODUCTION Overview Download and Install Quick Start Documentation Publications REPOSITORY Interfaces Components Libraries Utilities Software Map DEVELOPER Tutorials Examples Dev Guide Dashboard Wiki login/pass: orca/orca PEOPLE Contributors Users Project Download Mailing lists
|
logwriter.h00001 /* 00002 * Orca-Robotics Project: Components for robotics 00003 * http://orca-robotics.sf.net/ 00004 * Copyright (c) 2004-2008 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_LOGWRITER_H 00012 #define ORCA_ORCALOG_LOGWRITER_H 00013 00014 #include <orcalog/masterfilewriter.h> 00015 #include <orcalog/logwriterinfo.h> 00016 #include <orcalog/masterfilewritehandler.h> 00017 #include <memory> 00018 00019 namespace orcalog 00020 { 00021 00029 class LogWriter 00030 { 00031 public: 00032 00033 LogWriter(); 00034 virtual ~LogWriter(); 00035 00036 const LogWriterInfo &logWriterInfo() const { return *logWriterInfo_; } 00037 00038 // Throws an orcalog::FormatNotSupportedException if the format isn't supported. 00039 virtual void checkFormat( const std::string &format )=0; 00040 00042 void init( const LogWriterInfo &logWriterInfo, MasterFileWriter &masterFileWriter ); 00043 00044 protected: 00045 00046 int numItemsLogged() const { return masterFileWriteHandler_->numItemsLogged(); } 00047 00054 virtual void createLogFile( const std::string &filename, const std::string &format ); 00055 00058 void writeReferenceToMasterFile( const orca::Time &arrivalTime ) 00059 { masterFileWriteHandler_->writeReferenceToMasterFile( arrivalTime ); } 00060 00062 std::ofstream *file_; 00063 00064 private: 00065 00066 std::auto_ptr<LogWriterInfo> logWriterInfo_; 00067 std::auto_ptr<MasterFileWriteHandler> masterFileWriteHandler_; 00068 }; 00069 00070 00073 std::ofstream* openAsciiFileForWriting( const std::string &filename ); 00074 00077 std::ofstream* openBinaryFileForWriting( const std::string &filename ); 00078 00079 } 00080 00081 #endif |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)