bag.h
Go to the documentation of this file.
1 /*********************************************************************
2 * Software License Agreement (BSD License)
3 *
4 * Copyright (c) 2008, Willow Garage, Inc.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following
15 * disclaimer in the documentation and/or other materials provided
16 * with the distribution.
17 * * Neither the name of Willow Garage, Inc. nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 *********************************************************************/
34 
35 #ifndef ROSBAG_BAG_H
36 #define ROSBAG_BAG_H
37 
38 
39 #include "macros.h"
40 
41 #include "buffer.h"
42 #include "chunked_file.h"
43 #include "constants.h"
44 #include "exceptions.h"
45 #include "structures.h"
46 
47 #include "ros/header.h"
48 #include "ros/time.h"
49 #include "ros/message_traits.h"
50 #include "ros/message_event.h"
51 #include "ros/serialization.h"
52 
53 #include <ios>
54 #include <map>
55 #include <queue>
56 #include <set>
57 #include <stdexcept>
58 
59 #include "../../../console_bridge/include/console_bridge/console.h"
60 
61 namespace rosbag {
62 
63 namespace bagmode
64 {
66  enum BagMode
67  {
68  Write = 1,
69  Read = 2,
70  Append = 4
71  };
72 }
74 
75 class MessageInstance;
76 class View;
77 class Query;
78 
79 class ROSBAG_DECL Bag
80 {
81  friend class MessageInstance;
82  friend class View;
83 
84 public:
85  Bag();
86 
88 
94  explicit Bag(std::string const& filename, uint32_t mode = bagmode::Read);
95 
96  ~Bag();
97 
99 
106 
108  void close();
109 
110  std::string getFileName() const;
111  BagMode getMode() const;
112  uint32_t getMajorVersion() const;
113  uint32_t getMinorVersion() const;
114  uint64_t getSize() const;
115 
116  void setCompression(CompressionType compression);
117  CompressionType getCompression() const;
118  std::tuple<std::string, uint64_t, uint64_t> getCompressionInfo() const;
119  void setChunkThreshold(uint32_t chunk_threshold);
120  uint32_t getChunkThreshold() const;
121 
123 
129  template<class T>
130  void write(std::string const& topic, rs2rosinternal::MessageEvent<T> const& event);
131 
133 
141  template<class T>
142  void write(std::string const& topic, rs2rosinternal::Time const& time, T const& msg,
143  std::shared_ptr<rs2rosinternal::M_string> connection_header = std::shared_ptr<rs2rosinternal::M_string>());
144 
146 
154  template<class T>
155  void write(std::string const& topic, rs2rosinternal::Time const& time, std::shared_ptr<T const> const& msg,
156  std::shared_ptr<rs2rosinternal::M_string> connection_header = std::shared_ptr<rs2rosinternal::M_string>());
157 
159 
167  template<class T>
168  void write(std::string const& topic, rs2rosinternal::Time const& time, std::shared_ptr<T> const& msg,
169  std::shared_ptr<rs2rosinternal::M_string> connection_header = std::shared_ptr<rs2rosinternal::M_string>());
170 
171 private:
172  // This helper function actually does the write with an arbitrary serializable message
173  template<class T>
174  void doWrite(std::string const& topic, rs2rosinternal::Time const& time, T const& msg, std::shared_ptr<rs2rosinternal::M_string> const& connection_header);
175 
176  void openRead (std::string const& filename);
177  void openWrite (std::string const& filename);
178  void openAppend(std::string const& filename);
179 
180  void closeWrite();
181 
182  template<class T>
183  std::shared_ptr<T> instantiateBuffer(IndexEntry const& index_entry) const;
184 
185  void startWriting();
186  void stopWriting();
187 
188  void startReadingVersion102();
189  void startReadingVersion200();
190 
191  // Writing
192 
193  void writeVersion();
194  void writeFileHeaderRecord();
195  void writeConnectionRecord(ConnectionInfo const* connection_info);
196  void appendConnectionRecordToBuffer(Buffer& buf, ConnectionInfo const* connection_info);
197  template<class T>
198  void writeMessageDataRecord(uint32_t conn_id, rs2rosinternal::Time const& time, T const& msg);
199  void writeIndexRecords();
200  void writeConnectionRecords();
201  void writeChunkInfoRecords();
202  void startWritingChunk(rs2rosinternal::Time time);
203  void writeChunkHeader(CompressionType compression, uint32_t compressed_size, uint32_t uncompressed_size);
204  void stopWritingChunk();
205 
206  // Reading
207 
208  void readVersion();
209  void readFileHeaderRecord();
210  void readConnectionRecord();
211  void readChunkHeader(ChunkHeader& chunk_header) const;
212  void readChunkInfoRecord();
213  void readConnectionIndexRecord200();
214 
215  void readTopicIndexRecord102();
216  void readMessageDefinitionRecord102();
217  void readMessageDataRecord102(uint64_t offset, rs2rosinternal::Header& header) const;
218 
219  rs2rosinternal::Header readMessageDataHeader(IndexEntry const& index_entry);
220  uint32_t readMessageDataSize(IndexEntry const& index_entry) const;
221 
222  template<typename Stream>
223  void readMessageDataIntoStream(IndexEntry const& index_entry, Stream& stream) const;
224 
225  void decompressChunk(uint64_t chunk_pos) const;
226  void decompressRawChunk(ChunkHeader const& chunk_header) const;
227  void decompressBz2Chunk(ChunkHeader const& chunk_header) const;
228  void decompressLz4Chunk(ChunkHeader const& chunk_header) const;
229  uint32_t getChunkOffset() const;
230 
231  // Record header I/O
232 
233  void writeHeader(rs2rosinternal::M_string const& fields);
234  void writeDataLength(uint32_t data_len);
235  void appendHeaderToBuffer(Buffer& buf, rs2rosinternal::M_string const& fields);
236  void appendDataLengthToBuffer(Buffer& buf, uint32_t data_len);
237 
238  void readHeaderFromBuffer(Buffer& buffer, uint32_t offset, rs2rosinternal::Header& header, uint32_t& data_size, uint32_t& bytes_read) const;
239  void readMessageDataHeaderFromBuffer(Buffer& buffer, uint32_t offset, rs2rosinternal::Header& header, uint32_t& data_size, uint32_t& bytes_read) const;
240  bool readHeader(rs2rosinternal::Header& header) const;
241  bool readDataLength(uint32_t& data_size) const;
242  bool isOp(rs2rosinternal::M_string& fields, uint8_t reqOp) const;
243 
244  // Header fields
245 
246  template<typename T>
247  std::string toHeaderString(T const* field) const;
248 
249  std::string toHeaderString(rs2rosinternal::Time const* field) const;
250 
251  template<typename T>
252  bool readField(rs2rosinternal::M_string const& fields, std::string const& field_name, bool required, T* data) const;
253 
254  bool readField(rs2rosinternal::M_string const& fields, std::string const& field_name, unsigned int min_len, unsigned int max_len, bool required, std::string& data) const;
255  bool readField(rs2rosinternal::M_string const& fields, std::string const& field_name, bool required, std::string& data) const;
256 
257  bool readField(rs2rosinternal::M_string const& fields, std::string const& field_name, bool required, rs2rosinternal::Time& data) const;
258 
259  rs2rosinternal::M_string::const_iterator checkField(rs2rosinternal::M_string const& fields, std::string const& field,
260  unsigned int min_len, unsigned int max_len, bool required) const;
261 
262  // Low-level I/O
263 
264  void write(char const* s, std::streamsize n);
265  void write(std::string const& s);
266  void read(char* b, std::streamsize n) const;
267  void seek(uint64_t pos, int origin = std::ios_base::beg) const;
268 
269 private:
270  BagMode mode_;
271  mutable ChunkedFile file_;
272  int version_;
273  CompressionType compression_;
274  uint32_t chunk_threshold_;
275  uint32_t bag_revision_;
276 
277  uint64_t file_size_;
278  uint64_t file_header_pos_;
279  uint64_t index_data_pos_;
280  uint32_t connection_count_;
281  uint32_t chunk_count_;
282 
283  // Current chunk
284  bool chunk_open_;
285  ChunkInfo curr_chunk_info_;
286  uint64_t curr_chunk_data_pos_;
287 
288  std::map<std::string, uint32_t> topic_connection_ids_;
289  std::map<rs2rosinternal::M_string, uint32_t> header_connection_ids_;
290  std::map<uint32_t, ConnectionInfo*> connections_;
291 
292  std::vector<ChunkInfo> chunks_;
293 
294  std::map<uint32_t, std::multiset<IndexEntry> > connection_indexes_;
295  std::map<uint32_t, std::multiset<IndexEntry> > curr_chunk_connection_indexes_;
296 
297  mutable Buffer header_buffer_;
298  mutable Buffer record_buffer_;
299 
300  mutable Buffer chunk_buffer_;
301  mutable Buffer decompress_buffer_;
302 
303  mutable Buffer outgoing_chunk_buffer_;
304 
305  mutable Buffer* current_buffer_;
306 
307  mutable uint64_t decompressed_chunk_;
308 };
309 
310 } // namespace rosbag
311 
313 
314 namespace rosbag {
315 
316 // Templated method definitions
317 
318 template<class T>
321 }
322 
323 template<class T>
324 void Bag::write(std::string const& topic, rs2rosinternal::Time const& time, T const& msg, std::shared_ptr<rs2rosinternal::M_string> connection_header) {
325  doWrite(topic, time, msg, connection_header);
326 }
327 
328 template<class T>
329 void Bag::write(std::string const& topic, rs2rosinternal::Time const& time, std::shared_ptr<T const> const& msg, std::shared_ptr<rs2rosinternal::M_string> connection_header) {
330  doWrite(topic, time, *msg, connection_header);
331 }
332 
333 template<class T>
334 void Bag::write(std::string const& topic, rs2rosinternal::Time const& time, std::shared_ptr<T> const& msg, std::shared_ptr<rs2rosinternal::M_string> connection_header) {
335  doWrite(topic, time, *msg, connection_header);
336 }
337 
338 template<typename T>
339 std::string Bag::toHeaderString(T const* field) const {
340  return std::string((char*) field, sizeof(T));
341 }
342 
343 template<typename T>
344 bool Bag::readField(rs2rosinternal::M_string const& fields, std::string const& field_name, bool required, T* data) const {
345  rs2rosinternal::M_string::const_iterator i = checkField(fields, field_name, sizeof(T), sizeof(T), required);
346  if (i == fields.end())
347  return false;
348  memcpy(data, i->second.data(), sizeof(T));
349  return true;
350 }
351 
352 template<typename Stream>
353 void Bag::readMessageDataIntoStream(IndexEntry const& index_entry, Stream& stream) const {
355  uint32_t data_size;
356  uint32_t bytes_read;
357  switch (version_)
358  {
359  case 200:
360  {
361  decompressChunk(index_entry.chunk_pos);
362  readMessageDataHeaderFromBuffer(*current_buffer_, index_entry.offset, header, data_size, bytes_read);
363  if (data_size > 0)
364  memcpy(stream.advance(data_size), current_buffer_->getData() + index_entry.offset + bytes_read, data_size);
365  break;
366  }
367  case 102:
368  {
370  data_size = record_buffer_.getSize();
371  if (data_size > 0)
372  memcpy(stream.advance(data_size), record_buffer_.getData(), data_size);
373  break;
374  }
375  default:
376  throw BagFormatException( "Unhandled version: " + std::to_string( version_ ) );
377  }
378 }
379 
380 template<class T>
381 std::shared_ptr<T> Bag::instantiateBuffer(IndexEntry const& index_entry) const {
382  switch (version_)
383  {
384  case 200:
385  {
386  decompressChunk(index_entry.chunk_pos);
387 
388  // Read the message header
390  uint32_t data_size;
391  uint32_t bytes_read;
392  readMessageDataHeaderFromBuffer(*current_buffer_, index_entry.offset, header, data_size, bytes_read);
393 
394  // Read the connection id from the header
395  uint32_t connection_id;
396  readField(*header.getValues(), CONNECTION_FIELD_NAME, true, &connection_id);
397 
398  std::map<uint32_t, ConnectionInfo*>::const_iterator connection_iter = connections_.find(connection_id);
399  if (connection_iter == connections_.end())
400  throw BagFormatException( "Unknown connection ID: " + std::to_string( connection_id ) );
401  ConnectionInfo* connection_info = connection_iter->second;
402 
403  std::shared_ptr<T> p = std::make_shared<T>();
404 
406  predes_params.message = p;
407  predes_params.connection_header = connection_info->header;
409 
410  // Deserialize the message
411  rs2rosinternal::serialization::IStream s(current_buffer_->getData() + index_entry.offset + bytes_read, data_size);
413 
414  return p;
415  }
416  case 102:
417  {
418  // Read the message record
421 
422  rs2rosinternal::M_string& fields = *header.getValues();
423 
424  // Read the connection id from the header
425  std::string topic, latching("0"), callerid;
426  readField(fields, TOPIC_FIELD_NAME, true, topic);
427  readField(fields, LATCHING_FIELD_NAME, false, latching);
428  readField(fields, CALLERID_FIELD_NAME, false, callerid);
429 
430  std::map<std::string, uint32_t>::const_iterator topic_conn_id_iter = topic_connection_ids_.find(topic);
431  if (topic_conn_id_iter == topic_connection_ids_.end())
432  throw BagFormatException( "Unknown topic: " + topic );
433  uint32_t connection_id = topic_conn_id_iter->second;
434 
435  std::map<uint32_t, ConnectionInfo*>::const_iterator connection_iter = connections_.find(connection_id);
436  if (connection_iter == connections_.end())
437  throw BagFormatException( "Unknown connection ID: " + std::to_string( connection_id ) );
438  ConnectionInfo* connection_info = connection_iter->second;
439 
440  std::shared_ptr<T> p = std::make_shared<T>();
441 
442  // Create a new connection header, updated with the latching and callerid values
443  std::shared_ptr<rs2rosinternal::M_string> message_header(std::make_shared<rs2rosinternal::M_string>());
444  for (rs2rosinternal::M_string::const_iterator i = connection_info->header->begin(); i != connection_info->header->end(); i++)
445  (*message_header)[i->first] = i->second;
446  (*message_header)["latching"] = latching;
447  (*message_header)["callerid"] = callerid;
448 
450  predes_params.message = p;
451  predes_params.connection_header = message_header;
453 
454  // Deserialize the message
457 
458  return p;
459  }
460  default:
461  throw BagFormatException( "Unhandled version: " + std::to_string( version_ ) );
462  }
463 }
464 
465 template<class T>
466 void Bag::doWrite(std::string const& topic, rs2rosinternal::Time const& time, T const& msg, std::shared_ptr<rs2rosinternal::M_string> const& connection_header) {
467 
468  if (time < rs2rosinternal::TIME_MIN)
469  {
470  throw BagException("Tried to insert a message with time less than rs2rosinternal::TIME_MIN");
471  }
472 
473  // Whenever we write we increment our revision
474  bag_revision_++;
475 
476  // Get ID for connection header
477  ConnectionInfo* connection_info = NULL;
478  uint32_t conn_id = 0;
479  if (!connection_header) {
480  // No connection header: we'll manufacture one, and store by topic
481 
482  std::map<std::string, uint32_t>::iterator topic_connection_ids_iter = topic_connection_ids_.find(topic);
483  if (topic_connection_ids_iter == topic_connection_ids_.end()) {
484  conn_id = static_cast<uint32_t>(connections_.size());
485  topic_connection_ids_[topic] = conn_id;
486  }
487  else {
488  conn_id = topic_connection_ids_iter->second;
489  connection_info = connections_[conn_id];
490  }
491  }
492  else {
493  // Store the connection info by the address of the connection header
494 
495  // Add the topic name to the connection header, so that when we later search by
496  // connection header, we can disambiguate connections that differ only by topic name (i.e.,
497  // same callerid, same message type), #3755. This modified connection header is only used
498  // for our bookkeeping, and will not appear in the resulting .bag.
499  rs2rosinternal::M_string connection_header_copy(*connection_header);
500  connection_header_copy["topic"] = topic;
501 
502  std::map<rs2rosinternal::M_string, uint32_t>::iterator header_connection_ids_iter = header_connection_ids_.find(connection_header_copy);
503  if (header_connection_ids_iter == header_connection_ids_.end()) {
504  conn_id = static_cast<uint32_t>(connections_.size());
505  header_connection_ids_[connection_header_copy] = conn_id;
506  }
507  else {
508  conn_id = header_connection_ids_iter->second;
509  connection_info = connections_[conn_id];
510  }
511  }
512 
513  {
514  // Seek to the end of the file (needed in case previous operation was a read)
515  seek(0, std::ios::end);
517 
518  // Write the chunk header if we're starting a new chunk
519  if (!chunk_open_)
520  startWritingChunk(time);
521 
522  // Write connection info record, if necessary
523  if (connection_info == NULL) {
524  connection_info = new ConnectionInfo();
525  connection_info->id = conn_id;
526  connection_info->topic = topic;
530  if (connection_header != NULL) {
531  connection_info->header = connection_header;
532  }
533  else {
534  connection_info->header = std::make_shared<rs2rosinternal::M_string>();
535  (*connection_info->header)["type"] = connection_info->datatype;
536  (*connection_info->header)["md5sum"] = connection_info->md5sum;
537  (*connection_info->header)["message_definition"] = connection_info->msg_def;
538  }
539  connections_[conn_id] = connection_info;
540 
541  writeConnectionRecord(connection_info);
543  }
544 
545  // Add to topic indexes
546  IndexEntry index_entry;
547  index_entry.time = time;
548  index_entry.chunk_pos = curr_chunk_info_.pos;
549  index_entry.offset = getChunkOffset();
550 
551  std::multiset<IndexEntry>& chunk_connection_index = curr_chunk_connection_indexes_[connection_info->id];
552  chunk_connection_index.insert(chunk_connection_index.end(), index_entry);
553  std::multiset<IndexEntry>& connection_index = connection_indexes_[connection_info->id];
554  connection_index.insert(connection_index.end(), index_entry);
555 
556  // Increment the connection count
557  curr_chunk_info_.connection_counts[connection_info->id]++;
558 
559  // Write the message data
560  writeMessageDataRecord(conn_id, time, msg);
561 
562  // Check if we want to stop this chunk
564  CONSOLE_BRIDGE_logDebug(" curr_chunk_size=%d (threshold=%d)", chunk_size, chunk_threshold_);
566  // Empty the outgoing chunk
569 
570  // We no longer have a valid curr_chunk_info
571  curr_chunk_info_.pos = -1;
572  }
573  }
574 }
575 
576 template<class T>
577 void Bag::writeMessageDataRecord(uint32_t conn_id, rs2rosinternal::Time const& time, T const& msg) {
582 
583  // Assemble message in memory first, because we need to write its length
585 
586  record_buffer_.setSize(msg_ser_len);
587 
589 
590  // todo: serialize into the outgoing_chunk_buffer & remove record_buffer_
592 
593  // We do an extra seek here since writing our data record may
594  // have indirectly moved our file-pointer if it was a
595  // MessageInstance for our own bag
596  seek(0, std::ios::end);
598 
599  CONSOLE_BRIDGE_logDebug("Writing MSG_DATA [%llu:%d]: conn=%d sec=%d nsec=%d data_len=%d",
600  (unsigned long long) file_.getOffset(), getChunkOffset(), conn_id, time.sec, time.nsec, msg_ser_len);
601 
603  writeDataLength(msg_ser_len);
604  write((char*) record_buffer_.getData(), msg_ser_len);
605 
606  // todo: use better abstraction than appendHeaderToBuffer
609 
612  memcpy(outgoing_chunk_buffer_.getData() + offset, record_buffer_.getData(), msg_ser_len);
613 
614  // Update the current chunk time range
615  if (time > curr_chunk_info_.end_time)
616  curr_chunk_info_.end_time = time;
617  else if (time < curr_chunk_info_.start_time)
619 }
620 
621 } // namespace rosbag
622 
623 #endif
realdds::topics::metadata::key::header
const std::string header
rs2rosinternal::TIME_MIN
const ROSTIME_DECL Time TIME_MIN
rs2rosinternal::Header
Provides functionality to parse a connection header and retrieve values from it.
Definition: header.h:50
rosbag::BagFormatException
Exception thrown on problems reading the bag format.
Definition: exceptions.h:89
rosbag::Buffer::getData
uint8_t * getData()
Definition: buffer.cpp:82
uint8_t
unsigned char uint8_t
Definition: stdint.h:78
rosbag::Bag::topic_connection_ids_
std::map< std::string, uint32_t > topic_connection_ids_
Definition: bag.h:320
rosbag::ChunkedFile
ChunkedFile reads and writes files which contain interleaved chunks of compressed and uncompressed da...
Definition: chunked_file.h:80
rosbag::Bag::file_
ChunkedFile file_
Definition: bag.h:303
rs2rosinternal::Time
Time representation. May either represent wall clock time or ROS clock time.
Definition: time.h:206
rs2rosinternal::serialization::PreDeserialize::notify
static void notify(const PreDeserializeParams< M > &)
Definition: third-party/realsense-file/rosbag/roscpp_serialization/include/ros/serialization.h:912
test-librs-connections.n
n
Definition: test-librs-connections.py:38
rosbag::Bag
Definition: bag.h:111
exceptions.h
fps.required
required
Definition: fps.py:8
EtherSenseClient.chunk_size
int chunk_size
Definition: EtherSenseClient.py:17
std::to_string
std::string to_string(T value)
Definition: android_helpers.h:16
rosbag::Buffer::setSize
void setSize(uint32_t size)
Definition: buffer.cpp:86
rs2rosinternal::serialization::serialize
void serialize(Stream &stream, const T &t)
Serialize an object. Stream here should normally be a rs2rosinternal::serialization::OStream.
Definition: third-party/realsense-file/rosbag/roscpp_serialization/include/ros/serialization.h:144
rosbag::ChunkInfo::start_time
rs2rosinternal::Time start_time
Definition: structures.h:95
rs2rosinternal::MessageEvent::getMessage
std::shared_ptr< M > getMessage() const
Retrieve the message. If M is const, this returns a reference to it. If M is non const and this event...
Definition: message_event.h:153
rs2rosinternal::MessageEvent
Event type for subscriptions, const rs2rosinternal::MessageEvent<M const>& can be used in your callba...
Definition: message_event.h:64
rs2rosinternal::MessageEvent::getReceiptTime
rs2rosinternal::Time getReceiptTime() const
Returns the time at which this message was received.
Definition: message_event.h:176
rosbag::MessageInstance
A class pointing into a bag file.
Definition: message_instance.h:91
rs2rosinternal::serialization::PreDeserializeParams
Definition: third-party/realsense-file/rosbag/roscpp_serialization/include/ros/serialization.h:899
rosbag::Bag::appendHeaderToBuffer
void appendHeaderToBuffer(Buffer &buf, rs2rosinternal::M_string const &fields)
Definition: bag.cpp:1019
b
GLboolean GLboolean GLboolean b
Definition: glad/glad/glad.h:3064
data
Definition: parser.hpp:153
offset
GLintptr offset
Definition: glad/glad/glad.h:2737
rosbag::Bag::readMessageDataHeaderFromBuffer
void readMessageDataHeaderFromBuffer(Buffer &buffer, uint32_t offset, rs2rosinternal::Header &header, uint32_t &data_size, uint32_t &bytes_read) const
Definition: bag.cpp:1068
string
GLsizei const GLchar *const * string
Definition: glad/glad/glad.h:2861
mode
GLenum mode
Definition: glad/glad/glad.h:1385
rosbag::OP_MSG_DATA
static const unsigned char OP_MSG_DATA
Definition: constants.h:107
rosbag::Bag::curr_chunk_info_
ChunkInfo curr_chunk_info_
Definition: bag.h:317
rosbag::Bag::decompressChunk
void decompressChunk(uint64_t chunk_pos) const
Definition: bag.cpp:785
ROSBAG_DECL
#define ROSBAG_DECL
#include <ros/macros.h> // for the DECL's
Definition: rosbag_storage/include/rosbag/macros.h:43
rosbag::Bag::toHeaderString
std::string toHeaderString(T const *field) const
Definition: bag.h:339
rosbag::Buffer
Definition: buffer.h:75
rosbag::Query
Definition: query.h:84
rs2rosinternal::MessageEvent::getConnectionHeaderPtr
const std::shared_ptr< M_string > & getConnectionHeaderPtr() const
Definition: message_event.h:166
rosbag::Bag::seek
void seek(uint64_t pos, int origin=std::ios_base::beg) const
Definition: bag.cpp:1161
rosbag::ConnectionInfo::topic
std::string topic
Definition: structures.h:117
rosbag::ConnectionInfo::md5sum
std::string md5sum
Definition: structures.h:119
rosbag::Bag::writeMessageDataRecord
void writeMessageDataRecord(uint32_t conn_id, rs2rosinternal::Time const &time, T const &msg)
Definition: bag.h:577
rosbag::Bag::write
void write(std::string const &topic, rs2rosinternal::MessageEvent< T > const &event)
Write a message into the bag file.
Definition: bag.h:319
rosbag::ConnectionInfo
Definition: structures.h:80
rosbag::Bag::header_connection_ids_
std::map< rs2rosinternal::M_string, uint32_t > header_connection_ids_
Definition: bag.h:321
message_instance.h
rosbag::Bag::connections_
std::map< uint32_t, ConnectionInfo * > connections_
Definition: bag.h:322
structures.h
rosbag::Bag::stopWritingChunk
void stopWritingChunk()
Definition: bag.cpp:465
rosbag::Bag::checkField
rs2rosinternal::M_string::const_iterator checkField(rs2rosinternal::M_string const &fields, std::string const &field, unsigned int min_len, unsigned int max_len, bool required) const
Definition: bag.cpp:1111
rosbag::IndexEntry::offset
uint32_t offset
absolute byte offset of the chunk record containing the message
Definition: structures.h:113
rosbag::bagmode::Read
@ Read
Definition: bag.h:165
rs2rosinternal::serialization::OStream
Output stream.
Definition: third-party/realsense-file/rosbag/roscpp_serialization/include/ros/serialization.h:765
rs2rosinternal::message_traits::definition
const char * definition()
returns Definition<M>::value();
Definition: message_traits.h:223
rosbag::bagmode::BagMode
BagMode
The possible modes to open a bag in.
Definition: bag.h:130
serialization.h
rosbag::ChunkedFile::getOffset
uint64_t getOffset() const
return current offset from the beginning of the file
Definition: chunked_file.cpp:190
rosbag::BagException
Base class for rosbag exceptions.
Definition: exceptions.h:75
rosbag::IndexEntry::chunk_pos
uint64_t chunk_pos
timestamp of the message
Definition: structures.h:112
rosbag::bagmode::Append
@ Append
Definition: bag.h:166
rs2rosinternal::M_string
std::map< std::string, std::string > M_string
Definition: datatypes.h:44
rosbag::ConnectionInfo::header
std::shared_ptr< rs2rosinternal::M_string > header
Definition: structures.h:122
rosbag::Bag::connection_indexes_
std::map< uint32_t, std::multiset< IndexEntry > > connection_indexes_
Definition: bag.h:326
uint32_t
unsigned int uint32_t
Definition: stdint.h:80
rosbag::Bag::startWritingChunk
void startWritingChunk(rs2rosinternal::Time time)
Definition: bag.cpp:447
rosbag::LATCHING_FIELD_NAME
static const std::string LATCHING_FIELD_NAME
Definition: constants.h:103
rosbag::Bag::appendConnectionRecordToBuffer
void appendConnectionRecordToBuffer(Buffer &buf, ConnectionInfo const *connection_info)
Definition: bag.cpp:695
rosbag::ChunkInfo::connection_counts
std::map< uint32_t, uint32_t > connection_counts
absolute byte offset of chunk record in bag file
Definition: structures.h:99
rosbag::CONNECTION_FIELD_NAME
static const std::string CONNECTION_FIELD_NAME
Definition: constants.h:89
NULL
#define NULL
Definition: tinycthread.c:47
rosbag::ChunkHeader
Definition: structures.h:102
rosbag::Bag::appendDataLengthToBuffer
void appendDataLengthToBuffer(Buffer &buf, uint32_t data_len)
Definition: bag.cpp:1033
buffer
GLenum GLfloat * buffer
Definition: glad/glad/glad.h:2066
rosbag::Bag::getChunkOffset
uint32_t getChunkOffset() const
Definition: bag.cpp:440
uint64_t
unsigned __int64 uint64_t
Definition: stdint.h:90
rosbag::ChunkInfo::end_time
rs2rosinternal::Time end_time
earliest timestamp of a message in the chunk
Definition: structures.h:96
i
int i
Definition: rs-pcl-color.cpp:54
rosbag::Bag::instantiateBuffer
std::shared_ptr< T > instantiateBuffer(IndexEntry const &index_entry) const
deserializes the message held in record_buffer_
Definition: bag.h:381
time.h
rosbag::Bag::writeConnectionRecord
void writeConnectionRecord(ConnectionInfo const *connection_info)
Definition: bag.cpp:682
rs2rosinternal::message_traits::datatype
const char * datatype()
returns DataType<M>::value();
Definition: message_traits.h:214
rs2rosinternal::serialization::serializationLength
uint32_t serializationLength(const T &t)
Determine the serialized length of an object.
Definition: third-party/realsense-file/rosbag/roscpp_serialization/include/ros/serialization.h:162
rosbag::Bag::readMessageDataRecord102
void readMessageDataRecord102(uint64_t offset, rs2rosinternal::Header &header) const
Definition: bag.cpp:816
rosbag::Bag::readField
bool readField(rs2rosinternal::M_string const &fields, std::string const &field_name, bool required, T *data) const
Definition: bag.h:344
rosbag::ConnectionInfo::datatype
std::string datatype
Definition: structures.h:118
rosbag::View
Definition: view.h:81
rosbag::Bag::writeHeader
void writeHeader(rs2rosinternal::M_string const &fields)
Definition: bag.cpp:1007
rosbag::TOPIC_FIELD_NAME
static const std::string TOPIC_FIELD_NAME
Definition: constants.h:83
rosbag::bagmode::Write
@ Write
Definition: bag.h:164
CONSOLE_BRIDGE_logDebug
#define CONSOLE_BRIDGE_logDebug(fmt,...)
Definition: console.h:87
message_traits.h
rs2rosinternal::serialization::deserialize
void deserialize(Stream &stream, T &t)
Deserialize an object. Stream here should normally be a rs2rosinternal::serialization::IStream.
Definition: third-party/realsense-file/rosbag/roscpp_serialization/include/ros/serialization.h:153
rosbag::Buffer::getSize
uint32_t getSize() const
Definition: buffer.cpp:84
rosbag::Bag::file_size_
uint64_t file_size_
Definition: bag.h:309
rs2rosinternal::serialization::IStream
Input stream.
Definition: third-party/realsense-file/rosbag/roscpp_serialization/include/ros/serialization.h:737
rosbag::BagMode
bagmode::BagMode BagMode
Definition: bag.h:105
test-device-discovery.stream
stream
Definition: test-device-discovery.py:295
rs2rosinternal::serialization::PreDeserializeParams::connection_header
std::shared_ptr< std::map< std::string, std::string > > connection_header
Definition: third-party/realsense-file/rosbag/roscpp_serialization/include/ros/serialization.h:902
buffer.h
rosbag::IndexEntry::time
rs2rosinternal::Time time
Definition: structures.h:111
message_event.h
rosbag::IndexEntry
Definition: structures.h:109
rosbag::Bag::current_buffer_
Buffer * current_buffer_
Definition: bag.h:337
rosbag::Bag::writeDataLength
void writeDataLength(uint32_t data_len)
Definition: bag.cpp:1015
macros.h
rs2rosinternal::serialization::PreDeserializeParams::message
std::shared_ptr< M > message
Definition: third-party/realsense-file/rosbag/roscpp_serialization/include/ros/serialization.h:901
rosbag::ConnectionInfo::msg_def
std::string msg_def
Definition: structures.h:120
rosbag::compression::CompressionType
CompressionType
Definition: third-party/realsense-file/rosbag/rosbag_storage/include/rosbag/stream.h:116
test-projection-from-recording.filename
filename
Definition: test-projection-from-recording.py:15
rosbag::Bag::curr_chunk_connection_indexes_
std::map< uint32_t, std::multiset< IndexEntry > > curr_chunk_connection_indexes_
Definition: bag.h:327
rs2rosinternal::TimeBase::sec
uint32_t sec
Definition: time.h:164
rosbag::Bag::readMessageDataIntoStream
void readMessageDataIntoStream(IndexEntry const &index_entry, Stream &stream) const
Definition: bag.h:353
rosbag::ChunkInfo
Definition: structures.h:93
rosbag::Stream
Definition: third-party/realsense-file/rosbag/rosbag_storage/include/rosbag/stream.h:95
rosbag::Bag::chunk_open_
bool chunk_open_
Definition: bag.h:316
rosbag::Bag::version_
int version_
Definition: bag.h:304
p
double p[GRIDW][GRIDH]
Definition: wave.c:109
constants.h
rosbag::TIME_FIELD_NAME
static const std::string TIME_FIELD_NAME
Definition: constants.h:92
rs2rosinternal::TimeBase::nsec
uint32_t nsec
Definition: time.h:164
rosbag::ConnectionInfo::id
uint32_t id
Definition: structures.h:116
rosbag
Definition: bag.h:61
rs2rosinternal::message_traits::md5sum
const char * md5sum()
returns MD5Sum<M>::value();
Definition: message_traits.h:205
rosbag::Bag::outgoing_chunk_buffer_
Buffer outgoing_chunk_buffer_
reusable buffer to read chunk into
Definition: bag.h:335
end
GLuint GLuint end
Definition: glad/glad/glad.h:2395
test-streaming.topic
topic
Definition: test-streaming.py:45
rosbag::OP_FIELD_NAME
static const std::string OP_FIELD_NAME
Definition: constants.h:82
rosbag::Bag::bag_revision_
uint32_t bag_revision_
Definition: bag.h:307
rosbag::CALLERID_FIELD_NAME
static const std::string CALLERID_FIELD_NAME
Definition: constants.h:104
rosbag::Bag::doWrite
void doWrite(std::string const &topic, rs2rosinternal::Time const &time, T const &msg, std::shared_ptr< rs2rosinternal::M_string > const &connection_header)
Definition: bag.h:466
s
GLdouble s
Definition: glad/glad/glad.h:2441
rosbag::ChunkInfo::pos
uint64_t pos
latest timestamp of a message in the chunk
Definition: structures.h:97
chunked_file.h
rosbag::Bag::record_buffer_
Buffer record_buffer_
reusable buffer in which to assemble the record data before writing to file
Definition: bag.h:330
writeHeader
int writeHeader(roslz4_stream *str)
Definition: lz4s.c:124
buf
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glad/glad/glad.h:3610
rosbag::Bag::chunk_threshold_
uint32_t chunk_threshold_
Definition: bag.h:306
header.h
test-streaming.msg
msg
Definition: test-streaming.py:51


librealsense2
Author(s): LibRealSense ROS Team
autogenerated on Fri Aug 2 2024 08:30:01