bag_manager.hpp
Go to the documentation of this file.
00001 #ifndef __BAG_MANAGER__
00002 #define __BAG_MANAGER__
00003 
00004 #include <ros/ros.h>
00005 #include <rosbag/bag.h>
00006 #include <boost/filesystem.hpp>
00007 
00008 namespace generic_control_toolbox
00009 {
00013 class BagManager
00014 {
00015  public:
00022   BagManager(const std::string &path, const std::string &default_topic);
00023   ~BagManager();
00024 
00030   template <class T>
00031   void write(const T &msg);
00032 
00039   template <class T>
00040   void write(const std::string &topic, const T &msg);
00041 
00042  private:
00043   rosbag::Bag bag_;
00044   std::string default_topic_;
00045 
00052   int numOfFiles(const std::string &path) const;
00053 };
00054 
00055 template <class T>
00056 void BagManager::write(const T &msg)
00057 {
00058   bag_.write(default_topic_, ros::Time::now(), msg);
00059 }
00060 
00061 template <class T>
00062 void BagManager::write(const std::string &topic, const T &msg)
00063 {
00064   bag_.write(topic, ros::Time::now(), msg);
00065 }
00066 }  // namespace generic_control_toolbox
00067 
00068 #endif


generic_control_toolbox
Author(s): diogo
autogenerated on Thu Jun 6 2019 18:02:57