All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties 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 #include "gazebo/util/system.hh"
29 
30 namespace gazebo
31 {
32  namespace util
33  {
36 
47  class GAZEBO_VISIBLE LogPlay : public SingletonT<LogPlay>
48  {
50  private: LogPlay();
51 
53  private: virtual ~LogPlay();
54 
60  public: void Open(const std::string &_logFile);
61 
64  public: bool IsOpen() const;
65 
69  public: std::string GetLogVersion() const;
70 
74  public: std::string GetGazeboVersion() const;
75 
79  public: uint32_t GetRandSeed() const;
80 
83  public: bool Step(std::string &_data);
84 
87  public: unsigned int GetChunkCount() const;
88 
93  public: bool GetChunk(unsigned int _index, std::string &_data);
94 
99  public: std::string GetEncoding() const;
100 
104  public: std::string GetHeader() const;
105 
110  private: bool GetChunkData(TiXmlElement *_xml, std::string &_data);
111 
113  private: void ReadHeader();
114 
116  private: TiXmlDocument xmlDoc;
117 
119  private: TiXmlElement *logStartXml;
120 
122  private: TiXmlElement *logCurrXml;
123 
125  private: std::string filename;
126 
129  private: std::string logVersion;
130 
132  private: std::string gazeboVersion;
133 
135  private: uint32_t randSeed;
136 
138  private: std::string encoding;
139 
140  private: std::string currentChunk;
141 
143  private: friend class SingletonT<LogPlay>;
144  };
146  }
147 }
148 
149 #endif
GAZEBO_VISIBLE msgs::Header * GetHeader(google::protobuf::Message &_message)
Get the header from a protobuf message.
Singleton template class.
Definition: SingletonT.hh:33
Definition: LogPlay.hh:47
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:48