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

SourceForge.net Logo
Project
Download
Mailing lists

 

         

masterfilereader.h

00001 /*
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_MASTER_FILE_READER_H
00012 #define ORCA_ORCALOG_MASTER_FILE_READER_H
00013 
00014 #include <IceUtil/Mutex.h>
00015 #include <orcaice/context.h>
00016 
00017 namespace orcalog
00018 {
00019     namespace detail{
00020         template<typename IndexType>
00021         class FileBreadCrumbs;
00022     }
00023 
00027 class MasterFileReader
00028 {
00029 public:
00030     MasterFileReader( const std::string& filename, const orcaice::Context& context );
00031     ~MasterFileReader();
00032 
00034     void getLogs( std::vector<std::string> &filenames,
00035                   std::vector<std::string> &interfaceTypes,
00036                   std::vector<std::string> &formats,
00037                   std::vector<bool>        &enableds );
00038 
00041     void rewindToStart();
00042 
00047     int getData( int &seconds, int &useconds, int &id, int &index );
00048 
00059     int getDataAtOrAfterTime( int &seconds, int &useconds, int &id, int &index, int seekSec, int seekUsec=0 );
00060 
00062     void placeCursorBeforeTime( int seekSec, int seekUsec=0 );
00063 
00068     int placeCursorAtOrAfterTime( int seekSec, int seekUsec=0 );
00069 
00072     bool getCursorTime( int &seconds, int &useconds );
00073 
00077     void stepBackward();
00078 
00079 private:
00080 
00081     void calcConstituentLogs();
00082     void calcCursorInfo();
00083     int readData( int& seconds, int& useconds, int& id, int& index );
00084     void moveTo( const std::ios::pos_type &pos );
00085 
00086     std::ifstream *file_;
00087 
00088     // The time of the first entry
00089     IceUtil::Time initialCursorTime_;
00090 
00091     // What's at the cursor.  Ie:
00092     //   if (cursorValid): what we'll get if we call getData() now.
00093     //   if (!cursorValid): the last timeStamp in the file.
00094     int cursorSec_;
00095     int cursorUsec_;
00096     int cursorId_;
00097     int cursorIndex_;
00098 
00099     bool cursorValid_;
00100 
00101     // remember the dir where the master file is located
00102     // the individual log files MUST be in the same dir.
00103     std::string dir_;
00104 
00105     // Details of the logs referenced in this master file
00106     std::vector<std::string> filenames_;
00107     std::vector<std::string> interfaceTypes_;
00108     std::vector<std::string> formats_;
00109     std::vector<bool>        enableds_;
00110 
00111     // Used for recording positions in the file.
00112     // detail::FileBreadCrumbs<IceUtil::Time> *breadCrumbs_;
00113     std::auto_ptr< detail::FileBreadCrumbs<IceUtil::Time> > breadCrumbs_;
00114 
00115     orcaice::Context context_;
00116 };
00117 
00118 }
00119 
00120 #endif
 

Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)


Generated for Orca Robotics by  doxygen 1.4.5