#include <bag.h>
Public Member Functions | |
Bag (std::string const &filename, uint32_t mode=bagmode::Read) | |
Open a bag file. | |
Bag () | |
void | close () |
Close the bag file. | |
uint32_t | getChunkThreshold () const |
Get the threshold for creating new chunks. | |
CompressionType | getCompression () const |
Get the compression method to use for writing chunks. | |
std::string | getFileName () const |
Get the filename of the bag. | |
uint32_t | getMajorVersion () const |
Get the major-version of the open bag file. | |
uint32_t | getMinorVersion () const |
Get the minor-version of the open bag file. | |
BagMode | getMode () const |
Get the mode the bag is in. | |
uint64_t | getSize () const |
Get the current size of the bag file (a lower bound). | |
void | open (std::string const &filename, uint32_t mode=bagmode::Read) |
Open a bag file. | |
void | setChunkThreshold (uint32_t chunk_threshold) |
Set the threshold for creating new chunks. | |
void | setCompression (CompressionType compression) |
Set the compression method to use for writing chunks. | |
template<class T > | |
void | write (std::string const &topic, ros::Time const &time, boost::shared_ptr< T > const &msg, boost::shared_ptr< ros::M_string > connection_header=boost::shared_ptr< ros::M_string >()) |
Write a message into the bag file. | |
template<class T > | |
void | write (std::string const &topic, ros::Time const &time, boost::shared_ptr< T const > const &msg, boost::shared_ptr< ros::M_string > connection_header=boost::shared_ptr< ros::M_string >()) |
Write a message into the bag file. | |
template<class T > | |
void | write (std::string const &topic, ros::Time const &time, T const &msg, boost::shared_ptr< ros::M_string > connection_header=boost::shared_ptr< ros::M_string >()) |
Write a message into the bag file. | |
template<class T > | |
void | write (std::string const &topic, ros::MessageEvent< T > const &event) |
Write a message into the bag file. | |
~Bag () | |
Private Member Functions | |
void | appendConnectionRecordToBuffer (Buffer &buf, ConnectionInfo const *connection_info) |
void | appendDataLengthToBuffer (Buffer &buf, uint32_t data_len) |
void | appendHeaderToBuffer (Buffer &buf, ros::M_string const &fields) |
ros::M_string::const_iterator | checkField (ros::M_string const &fields, std::string const &field, unsigned int min_len, unsigned int max_len, bool required) const |
void | closeWrite () |
void | decompressBz2Chunk (ChunkHeader const &chunk_header) const |
void | decompressChunk (uint64_t chunk_pos) const |
void | decompressRawChunk (ChunkHeader const &chunk_header) const |
template<class T > | |
void | doWrite (std::string const &topic, ros::Time const &time, T const &msg, boost::shared_ptr< ros::M_string > const &connection_header) |
uint32_t | getChunkOffset () const |
template<class T > | |
boost::shared_ptr< T > | instantiateBuffer (IndexEntry const &index_entry) const |
deserializes the message held in record_buffer_ | |
bool | isOp (ros::M_string &fields, uint8_t reqOp) const |
void | openAppend (std::string const &filename) |
void | openRead (std::string const &filename) |
void | openWrite (std::string const &filename) |
void | read (char *b, std::streamsize n) const |
void | readChunkHeader (ChunkHeader &chunk_header) const |
void | readChunkInfoRecord () |
void | readConnectionIndexRecord200 () |
void | readConnectionRecord () |
bool | readDataLength (uint32_t &data_size) const |
bool | readField (ros::M_string const &fields, std::string const &field_name, bool required, ros::Time &data) const |
bool | readField (ros::M_string const &fields, std::string const &field_name, bool required, std::string &data) const |
bool | readField (ros::M_string const &fields, std::string const &field_name, unsigned int min_len, unsigned int max_len, bool required, std::string &data) const |
template<typename T > | |
bool | readField (ros::M_string const &fields, std::string const &field_name, bool required, T *data) const |
void | readFileHeaderRecord () |
bool | readHeader (ros::Header &header) const |
void | readHeaderFromBuffer (Buffer &buffer, uint32_t offset, ros::Header &header, uint32_t &data_size, uint32_t &bytes_read) const |
ros::Header | readMessageDataHeader (IndexEntry const &index_entry) |
void | readMessageDataHeaderFromBuffer (Buffer &buffer, uint32_t offset, ros::Header &header, uint32_t &data_size, uint32_t &bytes_read) const |
template<typename Stream > | |
void | readMessageDataIntoStream (IndexEntry const &index_entry, Stream &stream) const |
void | readMessageDataRecord102 (uint64_t offset, ros::Header &header) const |
uint32_t | readMessageDataSize (IndexEntry const &index_entry) const |
void | readMessageDefinitionRecord102 () |
void | readTopicIndexRecord102 () |
void | readVersion () |
void | seek (uint64_t pos, int origin=std::ios_base::beg) const |
void | startReadingVersion102 () |
void | startReadingVersion200 () |
void | startWriting () |
void | startWritingChunk (ros::Time time) |
void | stopWriting () |
void | stopWritingChunk () |
std::string | toHeaderString (ros::Time const *field) const |
template<typename T > | |
std::string | toHeaderString (T const *field) const |
void | write (std::string const &s) |
void | write (char const *s, std::streamsize n) |
void | writeChunkHeader (CompressionType compression, uint32_t compressed_size, uint32_t uncompressed_size) |
void | writeChunkInfoRecords () |
void | writeConnectionRecord (ConnectionInfo const *connection_info) |
void | writeConnectionRecords () |
void | writeDataLength (uint32_t data_len) |
void | writeFileHeaderRecord () |
void | writeHeader (ros::M_string const &fields) |
void | writeIndexRecords () |
template<class T > | |
void | writeMessageDataRecord (uint32_t conn_id, ros::Time const &time, T const &msg) |
void | writeVersion () |
Private Attributes | |
uint32_t | bag_revision_ |
Buffer | chunk_buffer_ |
reusable buffer to read chunk into | |
uint32_t | chunk_count_ |
bool | chunk_open_ |
uint32_t | chunk_threshold_ |
std::vector< ChunkInfo > | chunks_ |
CompressionType | compression_ |
uint32_t | connection_count_ |
std::map< uint32_t, std::multiset< IndexEntry > > | connection_indexes_ |
std::map< uint32_t, ConnectionInfo * > | connections_ |
std::map< uint32_t, std::multiset< IndexEntry > > | curr_chunk_connection_indexes_ |
uint64_t | curr_chunk_data_pos_ |
ChunkInfo | curr_chunk_info_ |
Buffer * | current_buffer_ |
Buffer | decompress_buffer_ |
reusable buffer to decompress chunks into | |
uint64_t | decompressed_chunk_ |
position of decompressed chunk | |
ChunkedFile | file_ |
uint64_t | file_header_pos_ |
uint64_t | file_size_ |
Buffer | header_buffer_ |
reusable buffer in which to assemble the record header before writing to file | |
std::map< ros::M_string *, uint32_t > | header_connection_ids_ |
uint64_t | index_data_pos_ |
BagMode | mode_ |
Buffer | outgoing_chunk_buffer_ |
reusable buffer to read chunk into | |
Buffer | record_buffer_ |
reusable buffer in which to assemble the record data before writing to file | |
std::map< std::string, uint32_t > | topic_connection_ids_ |
int | version_ |
Friends | |
class | MessageInstance |
class | View |
Definition at line 78 of file bag.h.
rosbag::Bag::Bag | ( | std::string const & | filename, | |
uint32_t | mode = bagmode::Read | |||
) |
Open a bag file.
filename | The bag file to open | |
mode | The mode to use (either read, write or append) |
Can throw BagException
void rosbag::Bag::appendConnectionRecordToBuffer | ( | Buffer & | buf, | |
ConnectionInfo const * | connection_info | |||
) | [private] |
void rosbag::Bag::appendDataLengthToBuffer | ( | Buffer & | buf, | |
uint32_t | data_len | |||
) | [private] |
void rosbag::Bag::appendHeaderToBuffer | ( | Buffer & | buf, | |
ros::M_string const & | fields | |||
) | [private] |
ros::M_string::const_iterator rosbag::Bag::checkField | ( | ros::M_string const & | fields, | |
std::string const & | field, | |||
unsigned int | min_len, | |||
unsigned int | max_len, | |||
bool | required | |||
) | const [private] |
void rosbag::Bag::decompressBz2Chunk | ( | ChunkHeader const & | chunk_header | ) | const [private] |
void rosbag::Bag::decompressChunk | ( | uint64_t | chunk_pos | ) | const [private] |
void rosbag::Bag::decompressRawChunk | ( | ChunkHeader const & | chunk_header | ) | const [private] |
void rosbag::Bag::doWrite | ( | std::string const & | topic, | |
ros::Time const & | time, | |||
T const & | msg, | |||
boost::shared_ptr< ros::M_string > const & | connection_header | |||
) | [inline, private] |
uint32_t rosbag::Bag::getChunkThreshold | ( | ) | const |
CompressionType rosbag::Bag::getCompression | ( | ) | const |
string rosbag::Bag::getFileName | ( | ) | const |
uint32_t rosbag::Bag::getMajorVersion | ( | ) | const |
uint32_t rosbag::Bag::getMinorVersion | ( | ) | const |
BagMode rosbag::Bag::getMode | ( | ) | const |
uint64_t rosbag::Bag::getSize | ( | ) | const |
boost::shared_ptr< T > rosbag::Bag::instantiateBuffer | ( | IndexEntry const & | index_entry | ) | const [inline, private] |
bool rosbag::Bag::isOp | ( | ros::M_string & | fields, | |
uint8_t | reqOp | |||
) | const [private] |
void rosbag::Bag::open | ( | std::string const & | filename, | |
uint32_t | mode = bagmode::Read | |||
) |
Open a bag file.
filename | The bag file to open | |
mode | The mode to use (either read, write or append) |
Can throw BagException
void rosbag::Bag::openAppend | ( | std::string const & | filename | ) | [private] |
void rosbag::Bag::openRead | ( | std::string const & | filename | ) | [private] |
void rosbag::Bag::openWrite | ( | std::string const & | filename | ) | [private] |
void rosbag::Bag::read | ( | char * | b, | |
std::streamsize | n | |||
) | const [private] |
void rosbag::Bag::readChunkHeader | ( | ChunkHeader & | chunk_header | ) | const [private] |
void rosbag::Bag::readConnectionIndexRecord200 | ( | ) | [private] |
bool rosbag::Bag::readDataLength | ( | uint32_t & | data_size | ) | const [private] |
bool rosbag::Bag::readField | ( | ros::M_string const & | fields, | |
std::string const & | field_name, | |||
bool | required, | |||
ros::Time & | data | |||
) | const [private] |
bool rosbag::Bag::readField | ( | ros::M_string const & | fields, | |
std::string const & | field_name, | |||
bool | required, | |||
std::string & | data | |||
) | const [private] |
bool rosbag::Bag::readField | ( | ros::M_string const & | fields, | |
std::string const & | field_name, | |||
unsigned int | min_len, | |||
unsigned int | max_len, | |||
bool | required, | |||
std::string & | data | |||
) | const [private] |
bool rosbag::Bag::readField | ( | ros::M_string const & | fields, | |
std::string const & | field_name, | |||
bool | required, | |||
T * | data | |||
) | const [inline, private] |
bool rosbag::Bag::readHeader | ( | ros::Header & | header | ) | const [private] |
void rosbag::Bag::readHeaderFromBuffer | ( | Buffer & | buffer, | |
uint32_t | offset, | |||
ros::Header & | header, | |||
uint32_t & | data_size, | |||
uint32_t & | bytes_read | |||
) | const [private] |
ros::Header rosbag::Bag::readMessageDataHeader | ( | IndexEntry const & | index_entry | ) | [private] |
void rosbag::Bag::readMessageDataHeaderFromBuffer | ( | Buffer & | buffer, | |
uint32_t | offset, | |||
ros::Header & | header, | |||
uint32_t & | data_size, | |||
uint32_t & | bytes_read | |||
) | const [private] |
void rosbag::Bag::readMessageDataIntoStream | ( | IndexEntry const & | index_entry, | |
Stream & | stream | |||
) | const [inline, private] |
void rosbag::Bag::readMessageDataRecord102 | ( | uint64_t | offset, | |
ros::Header & | header | |||
) | const [private] |
uint32_t rosbag::Bag::readMessageDataSize | ( | IndexEntry const & | index_entry | ) | const [private] |
void rosbag::Bag::readMessageDefinitionRecord102 | ( | ) | [private] |
void rosbag::Bag::seek | ( | uint64_t | pos, | |
int | origin = std::ios_base::beg | |||
) | const [private] |
void rosbag::Bag::setChunkThreshold | ( | uint32_t | chunk_threshold | ) |
void rosbag::Bag::setCompression | ( | CompressionType | compression | ) |
void rosbag::Bag::startWritingChunk | ( | ros::Time | time | ) | [private] |
std::string rosbag::Bag::toHeaderString | ( | ros::Time const * | field | ) | const [private] |
std::string rosbag::Bag::toHeaderString | ( | T const * | field | ) | const [inline, private] |
void rosbag::Bag::write | ( | std::string const & | s | ) | [private] |
void rosbag::Bag::write | ( | char const * | s, | |
std::streamsize | n | |||
) | [private] |
void rosbag::Bag::write | ( | std::string const & | topic, | |
ros::Time const & | time, | |||
boost::shared_ptr< T > const & | msg, | |||
boost::shared_ptr< ros::M_string > | connection_header = boost::shared_ptr<ros::M_string>() | |||
) | [inline] |
Write a message into the bag file.
topic | The topic name | |
time | Timestamp of the message | |
msg | The message to be added | |
connection_header | A connection header. |
Can throw BagIOException
void rosbag::Bag::write | ( | std::string const & | topic, | |
ros::Time const & | time, | |||
boost::shared_ptr< T const > const & | msg, | |||
boost::shared_ptr< ros::M_string > | connection_header = boost::shared_ptr<ros::M_string>() | |||
) | [inline] |
Write a message into the bag file.
topic | The topic name | |
time | Timestamp of the message | |
msg | The message to be added | |
connection_header | A connection header. |
Can throw BagIOException
void rosbag::Bag::write | ( | std::string const & | topic, | |
ros::Time const & | time, | |||
T const & | msg, | |||
boost::shared_ptr< ros::M_string > | connection_header = boost::shared_ptr<ros::M_string>() | |||
) | [inline] |
Write a message into the bag file.
topic | The topic name | |
time | Timestamp of the message | |
msg | The message to be added | |
connection_header | A connection header. |
Can throw BagIOException
void rosbag::Bag::write | ( | std::string const & | topic, | |
ros::MessageEvent< T > const & | event | |||
) | [inline] |
Write a message into the bag file.
topic | The topic name | |
event | The message event to be added |
Can throw BagIOException
void rosbag::Bag::writeChunkHeader | ( | CompressionType | compression, | |
uint32_t | compressed_size, | |||
uint32_t | uncompressed_size | |||
) | [private] |
void rosbag::Bag::writeConnectionRecord | ( | ConnectionInfo const * | connection_info | ) | [private] |
void rosbag::Bag::writeDataLength | ( | uint32_t | data_len | ) | [private] |
void rosbag::Bag::writeHeader | ( | ros::M_string const & | fields | ) | [private] |
void rosbag::Bag::writeMessageDataRecord | ( | uint32_t | conn_id, | |
ros::Time const & | time, | |||
T const & | msg | |||
) | [inline, private] |
friend class MessageInstance [friend] |
uint32_t rosbag::Bag::bag_revision_ [private] |
Buffer rosbag::Bag::chunk_buffer_ [mutable, private] |
uint32_t rosbag::Bag::chunk_count_ [private] |
bool rosbag::Bag::chunk_open_ [private] |
uint32_t rosbag::Bag::chunk_threshold_ [private] |
std::vector<ChunkInfo> rosbag::Bag::chunks_ [private] |
CompressionType rosbag::Bag::compression_ [private] |
uint32_t rosbag::Bag::connection_count_ [private] |
std::map<uint32_t, std::multiset<IndexEntry> > rosbag::Bag::connection_indexes_ [private] |
std::map<uint32_t, ConnectionInfo*> rosbag::Bag::connections_ [private] |
std::map<uint32_t, std::multiset<IndexEntry> > rosbag::Bag::curr_chunk_connection_indexes_ [private] |
uint64_t rosbag::Bag::curr_chunk_data_pos_ [private] |
ChunkInfo rosbag::Bag::curr_chunk_info_ [private] |
Buffer* rosbag::Bag::current_buffer_ [mutable, private] |
Buffer rosbag::Bag::decompress_buffer_ [mutable, private] |
uint64_t rosbag::Bag::decompressed_chunk_ [mutable, private] |
ChunkedFile rosbag::Bag::file_ [mutable, private] |
uint64_t rosbag::Bag::file_header_pos_ [private] |
uint64_t rosbag::Bag::file_size_ [private] |
Buffer rosbag::Bag::header_buffer_ [mutable, private] |
std::map<ros::M_string*, uint32_t> rosbag::Bag::header_connection_ids_ [private] |
uint64_t rosbag::Bag::index_data_pos_ [private] |
BagMode rosbag::Bag::mode_ [private] |
Buffer rosbag::Bag::outgoing_chunk_buffer_ [mutable, private] |
Buffer rosbag::Bag::record_buffer_ [mutable, private] |
std::map<std::string, uint32_t> rosbag::Bag::topic_connection_ids_ [private] |
int rosbag::Bag::version_ [private] |