MOOS 0.2375
/home/toby/moos-ivp/MOOS-2375-Oct0611/Tools/Graphical/uPlayBack/MOOSPlayBackV2.h
Go to the documentation of this file.
00001 
00002 //
00003 //   MOOS - Mission Oriented Operating Suite 
00004 //  
00005 //   A suit of Applications and Libraries for Mobile Robotics Research 
00006 //   Copyright (C) 2001-2005 Massachusetts Institute of Technology and 
00007 //   Oxford University. 
00008 //    
00009 //   This software was written by Paul Newman at MIT 2001-2002 and Oxford 
00010 //   University 2003-2005. email: pnewman@robots.ox.ac.uk. 
00011 //      
00012 //   This file is part of a  MOOS Utility Component. 
00013 //        
00014 //   This program is free software; you can redistribute it and/or 
00015 //   modify it under the terms of the GNU General Public License as 
00016 //   published by the Free Software Foundation; either version 2 of the 
00017 //   License, or (at your option) any later version. 
00018 //          
00019 //   This program is distributed in the hope that it will be useful, 
00020 //   but WITHOUT ANY WARRANTY; without even the implied warranty of 
00021 //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
00022 //   General Public License for more details. 
00023 //            
00024 //   You should have received a copy of the GNU General Public License 
00025 //   along with this program; if not, write to the Free Software 
00026 //   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 
00027 //   02111-1307, USA. 
00028 //
00030 // MOOSPlayBack.h: interface for the CMOOSPlayBack class.
00031 //
00033 
00034 #if !defined(AFX_MOOSPLAYBACK_H__326FF11A_6E11_425E_8626_C016072CF8CC__INCLUDED_)
00035 #define AFX_MOOSPLAYBACK_H__326FF11A_6E11_425E_8626_C016072CF8CC__INCLUDED_
00036 
00037 #include <MOOSGenLib/MOOSGenLib.h>
00038 #include <MOOSLIB/MOOSLib.h>
00039 
00040 using namespace std;
00041 
00042 #include <string>
00043 #include <list>
00044 #include <iostream>
00045 #include <fstream>
00046 #include <set>
00047 
00048 #include <MOOSUtilityLib/MOOSMemoryMapped.h>
00049 
00050 typedef set<string> STRING_SET;
00051 class CMOOSPlayBackV2  
00052 {
00053 public:
00054     
00055     CMOOSMemMappedAlogFile m_ALog;
00056     
00057     bool SetLastTimeProcessed(double dfTime);
00058     string GetStatusString();
00059     bool IsWaitingForClient();
00060     double GetLastMessageTime();
00061     bool ClearFilter();
00062     bool Filter(const std::string & sSrc, bool bWanted);
00063     bool IsFiltered(const std::string & sSrc);
00064     bool SetTickInterval(double dfInterval);
00065     bool Reset();
00066     bool IsEOF();
00067     bool Iterate(MOOSMSG_LIST & Output);
00068     double GetFinishTime();
00069     double GetStartTime();
00070     int GetCurrentLine();
00071     double GetTimeNow();
00072     int GetSize();
00073     bool IsOpen();
00074     bool Initialise(const string & sFileName);
00075     STRING_SET GetSources(){return m_ALog.GetSourceNames();};
00076     CMOOSPlayBackV2();
00077     virtual ~CMOOSPlayBackV2();
00078 
00079     string m_sFileName;
00080     ifstream m_InputFile;
00081     double m_dfLastMessageTime;
00082     int m_nLastLine;
00083     double m_dfTickTime;
00084     double m_dfLastClientProcessedTime;
00085     double m_dfClientLagTime;
00086 
00087 protected:
00088     bool m_bWaitingForClientCatchup;
00089     double m_dfLogStart;
00090 
00091     std::string m_sBinaryFileName;
00092     std::ifstream m_BinaryFile;
00093     bool MessageFromLine(const std::string & sLine,CMOOSMsg & Msg);    
00094     STRING_SET m_SourceFilter;
00095 
00096     int m_nCurrentLine;
00097 public:
00098     bool GotoTime(double dfT);
00099 };
00100 
00101 #endif // !defined(AFX_MOOSPLAYBACK_H__326FF11A_6E11_425E_8626_C016072CF8CC__INCLUDED_)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines