From 45f40503178ce9ede19e9def0744a1d06e5bfceb Mon Sep 17 00:00:00 2001 From: Florent Lamiraux <florent@laas.fr> Date: Thu, 17 May 2012 23:21:20 +0200 Subject: [PATCH] Add documentation for RosTime, RosExport and RosImport entity classes. --- src/ros_export.cpp | 9 +++++++++ src/ros_export.hh | 2 ++ src/ros_import.cpp | 10 ++++++++++ src/ros_import.hh | 2 ++ src/ros_time.cpp | 10 ++++++++++ src/ros_time.hh | 3 +++ 6 files changed, 36 insertions(+) diff --git a/src/ros_export.cpp b/src/ros_export.cpp index 6a8bffa..70a5f6e 100644 --- a/src/ros_export.cpp +++ b/src/ros_export.cpp @@ -116,6 +116,11 @@ namespace dynamicgraph } // end of errorEstimator. } // end of namespace command. + const std::string RosExport::docstring_ + ("Export dynamic-graph signals as ROS topics.\n" + "\n" + " Use command \"add\" to export a new signal.\n"); + RosExport::RosExport (const std::string& n) : dynamicgraph::Entity(n), nh_ (rosInit (true)), @@ -194,4 +199,8 @@ namespace dynamicgraph bindedSignal_.clear (); } + std::string RosExport::getDocString () const + { + return docstring_; + } } // end of namespace dynamicgraph. diff --git a/src/ros_export.hh b/src/ros_export.hh index e0573b1..bae0fac 100644 --- a/src/ros_export.hh +++ b/src/ros_export.hh @@ -66,6 +66,7 @@ namespace dynamicgraph RosExport (const std::string& n); virtual ~RosExport (); + virtual std::string getDocString () const; void display (std::ostream& os) const; void add (const std::string& signal, const std::string& topic); @@ -100,6 +101,7 @@ namespace dynamicgraph template <typename T> friend class internal::Add; private: + static const std::string docstring_; ros::NodeHandle& nh_; std::map<std::string, bindedSignal_t> bindedSignal_; }; diff --git a/src/ros_import.cpp b/src/ros_import.cpp index 9623e2e..7ce1ce4 100644 --- a/src/ros_import.cpp +++ b/src/ros_import.cpp @@ -119,6 +119,11 @@ namespace dynamicgraph } // end of errorEstimator. } // end of namespace command. + const std::string RosImport::docstring_ + ("Import ROS topics as dynamic-graph signals.\n" + "\n" + " Use command \"add\" to import a new ROS topic.\n"); + RosImport::RosImport (const std::string& n) : dynamicgraph::Entity(n), // rosImport do not use callback so do not create a useless spinner. @@ -223,4 +228,9 @@ namespace dynamicgraph return dummy; } + std::string RosImport::getDocString () const + { + return docstring_; + } + } // end of namespace dynamicgraph. diff --git a/src/ros_import.hh b/src/ros_import.hh index 368b944..632bfd5 100644 --- a/src/ros_import.hh +++ b/src/ros_import.hh @@ -65,6 +65,7 @@ namespace dynamicgraph RosImport (const std::string& n); virtual ~RosImport (); + virtual std::string getDocString () const; void display (std::ostream& os) const; void add (const std::string& signal, const std::string& topic); @@ -87,6 +88,7 @@ namespace dynamicgraph void add (const std::string& signal, const std::string& topic); private: + static const std::string docstring_; ros::NodeHandle& nh_; std::map<std::string, bindedSignal_t> bindedSignal_; dynamicgraph::SignalTimeDependent<int,int> trigger_; diff --git a/src/ros_time.cpp b/src/ros_time.cpp index 81fdd3e..50a2367 100644 --- a/src/ros_time.cpp +++ b/src/ros_time.cpp @@ -16,6 +16,12 @@ namespace dynamicgraph { using namespace boost::posix_time; + const std::string RosTime::docstring_ + ("Export ROS time into dynamic-graph.\n" + "\n" + " Signal \"time\" provides time as given by ros::time as\n" + " boost::posix_time::ptime type.\n"); + RosTime::RosTime (const std::string& name) : Entity (name), now_ ("RosTime("+name+")::output(boost::posix_time::ptime)::time") @@ -32,4 +38,8 @@ namespace dynamicgraph { return time; } + std::string RosTime::getDocString () const + { + return docstring_; + } } // namespace dynamicgraph diff --git a/src/ros_time.hh b/src/ros_time.hh index b715209..23f27f6 100644 --- a/src/ros_time.hh +++ b/src/ros_time.hh @@ -19,9 +19,12 @@ namespace dynamicgraph { public: Signal <boost::posix_time::ptime, int> now_; RosTime (const std::string& name); + virtual std::string getDocString () const; protected: boost::posix_time::ptime& update (boost::posix_time::ptime& time, const int& t); + private: + static const std::string docstring_; }; // class RosTime } // namespace dynamicgraph -- GitLab