All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LogPlay.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2014 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 
18 #ifndef _LOGPLAY_HH_
19 #define _LOGPLAY_HH_
20 
21 #include <tinyxml.h>
22 
23 #include <list>
24 #include <string>
25 #include <fstream>
26 
28 
29 namespace gazebo
30 {
31  namespace util
32  {
35 
46  class LogPlay : public SingletonT<LogPlay>
47  {
49  private: LogPlay();
50 
52  private: virtual ~LogPlay();
53 
59  public: void Open(const std::string &_logFile);
60 
63  public: bool IsOpen() const;
64 
68  public: std::string GetLogVersion() const;
69 
73  public: std::string GetGazeboVersion() const;
74 
78  public: uint32_t GetRandSeed() const;
79 
82  public: bool Step(std::string &_data);
83 
86  public: unsigned int GetChunkCount() const;
87 
92  public: bool GetChunk(unsigned int _index, std::string &_data);
93 
98  public: std::string GetEncoding() const;
99 
103  public: std::string GetHeader() const;
104 
109  private: bool GetChunkData(TiXmlElement *_xml, std::string &_data);
110 
112  private: void ReadHeader();
113 
115  private: TiXmlDocument xmlDoc;
116 
118  private: TiXmlElement *logStartXml;
119 
121  private: TiXmlElement *logCurrXml;
122 
124  private: std::string filename;
125 
128  private: std::string logVersion;
129 
131  private: std::string gazeboVersion;
132 
134  private: uint32_t randSeed;
135 
137  private: std::string encoding;
138 
139  private: std::string currentChunk;
140 
142  private: friend class SingletonT<LogPlay>;
143  };
145  }
146 }
147 
148 #endif