Commit 447d0974 authored by Pierre NARVOR's avatar Pierre NARVOR
Browse files

[messages] Added some print utilities

parent dfa1abf8
......@@ -5,6 +5,7 @@
#include <type_traits>
#include <seatrac_driver/SeatracTypes.h>
#include <seatrac_driver/print_utils.h>
namespace narval { namespace seatrac { namespace messages {
......
......@@ -2,21 +2,26 @@
#define _DEF_SEATRAC_DRIVER_PRINT_UTILS_H_
#include <iostream>
#include <vector>
#include <seatrac_driver/SeatracTypes.h>
namespace narval { namespace seatrac { namespace print_utils {
// inline void print_message(std::ostream& os, const std::vector<uint8_t>& msg)
// {
// using namespace narval::seatrac;
// using namespace narval::seatrac::messages;
// switch(msg[0]) {
// default:
// //os << "Unknown message (CID : " << (uint32_t)msg[0] << ")" << std::endl;
// break;
// case CID_STATUS: os << *reinterpret_cast<const Status*>(msg.data()) << std::endl; break;
// case CID_SYS_INFO: os << *reinterpret_cast<const SysInfo*>(msg.data()) << std::endl; break;
// }
// }
template <typename T>
void indent(const T& msg, std::ostream& os, const std::string& prefix=" ")
{
std::ostringstream oss;
oss << msg;
for(char c : oss.str()) {
if(c == '\n') {
os << c << prefix;
}
else {
os << c;
}
}
}
}; //namespace print_utils
}; //namespace seatrac
}; //namespace narval
#endif //_DEF_SEATRAC_DRIVER_PRINT_UTILS_H_
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment