MOOS 0.2375
/home/toby/moos-ivp/MOOS-2375-Oct0611/Tools/Graphical/uPlayBack/MOOSPlayBack.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 
00049 typedef set<string> STRING_SET;
00050 class CMOOSPlayBack  
00051 {
00052 public:
00053     
00054     class CPlaybackEntry
00055     {
00056     public:
00057         double m_dfTime;
00058         string m_sWho;
00059         string m_sWhat;
00060         double m_dfVal;
00061         string m_sVal;
00062         bool   m_bNumeric;
00063 
00064         bool operator <(const CPlaybackEntry & Entry) const
00065         {
00066             if(m_dfTime < Entry.m_dfTime)
00067                 return true;
00068             
00069             if(m_dfTime > Entry.m_dfTime)
00070                 return false;
00071             //mus be equal;
00072             return m_sVal<Entry.m_sVal;
00073 
00074 
00075         };
00076 
00077     protected:
00078 
00079     };
00080 
00081     
00082     bool SetLastTimeProcessed(double dfTime);
00083     string GetStatusString();
00084     bool IsWaitingForClient();
00085     double GetLastMessageTime();
00086     bool ClearFilter();
00087     bool Filter(string sSrc, bool bFilter);
00088     bool SetTickInterval(double dfInterval);
00089     bool Reset();
00090     bool IsEOF();
00091     bool Iterate(MOOSMSG_LIST & Output);
00092     double GetFinishTime();
00093     double GetStartTime();
00094     int GetCurrentLine();
00095     double GetTimeNow();
00096     int GetSize();
00097     bool IsOpen();
00098     bool Initialise(const string & sFileName);
00099     CMOOSPlayBack();
00100     virtual ~CMOOSPlayBack();
00101 
00102 
00103     typedef vector<CPlaybackEntry> PLAYBACKLIST;
00104     PLAYBACKLIST::iterator m_pListIterator;
00105     PLAYBACKLIST m_PlayBackList;
00106     string m_sFileName;
00107     ifstream m_InputFile;
00108     double m_dfLastMessageTime;
00109     int m_nLastLine;
00110     double m_dfTickTime;
00111     double m_dfLastClientProcessedTime;
00112     STRING_SET m_Sources;
00113     STRING_SET m_SourceFilter;
00114     double m_dfClientLagTime;
00115 
00116 protected:
00117     bool m_bWaitingForClientCatchup;
00118     double m_dfLogStart;
00119     bool CrackAndAdjustEntry(CPlaybackEntry & rEntry);
00120     bool Entry2Message(CPlaybackEntry  rEntry,CMOOSMsg & Msg);    
00121     bool m_bEOF;
00122     bool ParseFile();
00123 public:
00124     bool GotoTime(double dfT);
00125 };
00126 
00127 #endif // !defined(AFX_MOOSPLAYBACK_H__326FF11A_6E11_425E_8626_C016072CF8CC__INCLUDED_)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines