Skip to content

Commit

Permalink
Revert "Define the CONSOLE_BRIDGE_* macros for bag.h"
Browse files Browse the repository at this point in the history
This reverts commit b6ee1e5.
  • Loading branch information
clalancette committed Aug 22, 2017
1 parent b6ee1e5 commit a2be1c0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 41 deletions.
31 changes: 1 addition & 30 deletions tools/rosbag_storage/include/rosbag/bag.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,35 +74,6 @@
# undef logError
#endif

#if defined logError
# undef logError
#endif
#if defined logWarn
# undef logWarn
#endif
#if defined logInform
# undef logInform
#endif
#if defined logDebug
# undef logDebug
#endif
#if !defined CONSOLE_BRIDGE_logError
#define CONSOLE_BRIDGE_logError(fmt, ...) \
console_bridge::log(__FILE__, __LINE__, console_bridge::CONSOLE_BRIDGE_LOG_ERROR, fmt, ##__VA_ARGS__)
#endif
#if !defined CONSOLE_BRIDGE_logWarn
#define CONSOLE_BRIDGE_logWarn(fmt, ...) \
console_bridge::log(__FILE__, __LINE__, console_bridge::CONSOLE_BRIDGE_LOG_WARN, fmt, ##__VA_ARGS__)
#endif
#if !defined CONSOLE_BRIDGE_logInform
#define CONSOLE_BRIDGE_logInform(fmt, ...) \
console_bridge::log(__FILE__, __LINE__, console_bridge::CONSOLE_BRIDGE_LOG_INFO, fmt, ##__VA_ARGS__)
#endif
#if !defined CONSOLE_BRIDGE_logDebug
#define CONSOLE_BRIDGE_logDebug(fmt, ...) \
console_bridge::log(__FILE__, __LINE__, console_bridge::CONSOLE_BRIDGE_LOG_DEBUG, fmt, ##__VA_ARGS__)
#endif

namespace rosbag {

namespace bagmode
Expand Down Expand Up @@ -646,7 +617,7 @@ void Bag::writeMessageDataRecord(uint32_t conn_id, ros::Time const& time, T cons
file_size_ = file_.getOffset();

CONSOLE_BRIDGE_logDebug("Writing MSG_DATA [%llu:%d]: conn=%d sec=%d nsec=%d data_len=%d",
(unsigned long long) file_.getOffset(), getChunkOffset(), conn_id, time.sec, time.nsec, msg_ser_len);
(unsigned long long) file_.getOffset(), getChunkOffset(), conn_id, time.sec, time.nsec, msg_ser_len);

writeHeader(header);
writeDataLength(msg_ser_len);
Expand Down
22 changes: 11 additions & 11 deletions tools/rosbag_storage/src/bag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ void Bag::writeFileHeaderRecord() {
chunk_count_ = chunks_.size();

CONSOLE_BRIDGE_logDebug("Writing FILE_HEADER [%llu]: index_pos=%llu connection_count=%d chunk_count=%d",
(unsigned long long) file_.getOffset(), (unsigned long long) index_data_pos_, connection_count_, chunk_count_);
(unsigned long long) file_.getOffset(), (unsigned long long) index_data_pos_, connection_count_, chunk_count_);

// Write file header record
M_string header;
Expand Down Expand Up @@ -391,7 +391,7 @@ void Bag::readFileHeaderRecord() {
}

CONSOLE_BRIDGE_logDebug("Read FILE_HEADER: index_pos=%llu connection_count=%d chunk_count=%d",
(unsigned long long) index_data_pos_, connection_count_, chunk_count_);
(unsigned long long) index_data_pos_, connection_count_, chunk_count_);

// Skip the data section (just padding)
seek(data_size, std::ios::cur);
Expand Down Expand Up @@ -461,7 +461,7 @@ void Bag::writeChunkHeader(CompressionType compression, uint32_t compressed_size
chunk_header.uncompressed_size = uncompressed_size;

CONSOLE_BRIDGE_logDebug("Writing CHUNK [%llu]: compression=%s compressed=%d uncompressed=%d",
(unsigned long long) file_.getOffset(), chunk_header.compression.c_str(), chunk_header.compressed_size, chunk_header.uncompressed_size);
(unsigned long long) file_.getOffset(), chunk_header.compression.c_str(), chunk_header.compressed_size, chunk_header.uncompressed_size);

M_string header;
header[OP_FIELD_NAME] = toHeaderString(&OP_CHUNK);
Expand Down Expand Up @@ -640,7 +640,7 @@ void Bag::writeConnectionRecords() {

void Bag::writeConnectionRecord(ConnectionInfo const* connection_info) {
CONSOLE_BRIDGE_logDebug("Writing CONNECTION [%llu:%d]: topic=%s id=%d",
(unsigned long long) file_.getOffset(), getChunkOffset(), connection_info->topic.c_str(), connection_info->id);
(unsigned long long) file_.getOffset(), getChunkOffset(), connection_info->topic.c_str(), connection_info->id);

M_string header;
header[OP_FIELD_NAME] = toHeaderString(&OP_CONNECTION);
Expand Down Expand Up @@ -829,7 +829,7 @@ void Bag::decompressLz4Chunk(ChunkHeader const& chunk_header) const {
CompressionType compression = compression::LZ4;

CONSOLE_BRIDGE_logDebug("lz4 compressed_size: %d uncompressed_size: %d",
chunk_header.compressed_size, chunk_header.uncompressed_size);
chunk_header.compressed_size, chunk_header.uncompressed_size);

chunk_buffer_.setSize(chunk_header.compressed_size);
file_.read((char*) chunk_buffer_.getData(), chunk_header.compressed_size);
Expand Down Expand Up @@ -890,9 +890,9 @@ void Bag::writeChunkInfoRecords() {
header[COUNT_FIELD_NAME] = toHeaderString(&chunk_connection_count);

CONSOLE_BRIDGE_logDebug("Writing CHUNK_INFO [%llu]: ver=%d pos=%llu start=%d.%d end=%d.%d",
(unsigned long long) file_.getOffset(), CHUNK_INFO_VERSION, (unsigned long long) chunk_info.pos,
chunk_info.start_time.sec, chunk_info.start_time.nsec,
chunk_info.end_time.sec, chunk_info.end_time.nsec);
(unsigned long long) file_.getOffset(), CHUNK_INFO_VERSION, (unsigned long long) chunk_info.pos,
chunk_info.start_time.sec, chunk_info.start_time.nsec,
chunk_info.end_time.sec, chunk_info.end_time.nsec);

writeHeader(header);

Expand Down Expand Up @@ -936,9 +936,9 @@ void Bag::readChunkInfoRecord() {
readField(fields, COUNT_FIELD_NAME, true, &chunk_connection_count);

CONSOLE_BRIDGE_logDebug("Read CHUNK_INFO: chunk_pos=%llu connection_count=%d start=%d.%d end=%d.%d",
(unsigned long long) chunk_info.pos, chunk_connection_count,
chunk_info.start_time.sec, chunk_info.start_time.nsec,
chunk_info.end_time.sec, chunk_info.end_time.nsec);
(unsigned long long) chunk_info.pos, chunk_connection_count,
chunk_info.start_time.sec, chunk_info.start_time.nsec,
chunk_info.end_time.sec, chunk_info.end_time.nsec);

// Read the topic count entries
for (uint32_t i = 0; i < chunk_connection_count; i ++) {
Expand Down

0 comments on commit a2be1c0

Please sign in to comment.