From 88ea5194d86893f583b2cd6f4e4db72aade5688e Mon Sep 17 00:00:00 2001
From: Joseph Mirabel <jmirabel@laas.fr>
Date: Tue, 22 Mar 2016 11:32:14 +0100
Subject: [PATCH] Use Containers class instead of Container

---
 include/hpp/manipulation/device.hh | 60 +++++++-----------------------
 src/device.cc                      |  4 +-
 2 files changed, 15 insertions(+), 49 deletions(-)

diff --git a/include/hpp/manipulation/device.hh b/include/hpp/manipulation/device.hh
index ff872cbe..e3089948 100644
--- a/include/hpp/manipulation/device.hh
+++ b/include/hpp/manipulation/device.hh
@@ -34,15 +34,23 @@ namespace hpp {
     /// it is compatible with hpp::model::urdf::loadHumanoidRobot
     ///
     /// This class also contains model::Gripper, Handle and \ref JointAndTriangles_t
-    class HPP_MANIPULATION_DLLAPI Device : public model::HumanoidRobot,
-      protected core::Container <HandlePtr_t>,
-      protected core::Container <model::GripperPtr_t>,
-      protected core::Container <JointAndShapes_t>,
-      protected core::Container <model::JointVector_t>
+    class HPP_MANIPULATION_DLLAPI Device :
+      public model::HumanoidRobot,
+      public core::Containers<
+        boost::mpl::vector < HandlePtr_t,
+                             model::GripperPtr_t,
+                             JointAndShapes_t,
+                             model::JointVector_t> >
     {
       public:
         typedef model::HumanoidRobot Parent_t;
 
+        typedef core::Containers<
+          boost::mpl::vector < HandlePtr_t,
+          model::GripperPtr_t,
+          JointAndShapes_t,
+          model::JointVector_t> > Containers_t;
+
         /// Constructor
         /// \param name of the new instance,
         static DevicePtr_t create (const std::string& name)
@@ -56,48 +64,6 @@ namespace hpp {
         /// Print object in a stream
         virtual std::ostream& print (std::ostream& os) const;
 
-        /// \name Accessors to container elements
-        /// Contained elements are of type model::Gripper, Handle and
-        /// \ref JointAndTriangles_t
-        /// \{
-
-        /// Get an element of a container
-        template <typename Element>
-          const Element& get (const std::string& name) const
-        {
-          return core::Container <Element>::get (name);
-        }
-
-        /// Check if a Container has a key.
-        template <typename Element>
-          bool has (const std::string& name) const
-        {
-          return core::Container <Element>::has (name);
-        }
-
-        /// Get the keys of a container
-        template <typename Element, typename ReturnType>
-          ReturnType getKeys () const
-        {
-          return core::Container <Element>::template getKeys <ReturnType> ();
-        }
-
-        /// Get the underlying map of a container
-        template <typename Element>
-          const typename core::Container<Element>::ElementMap_t& getAll () const
-        {
-          return core::Container <Element>::getAll ();
-        }
-
-        /// Add an element to a container
-        template <typename Element>
-          void add (const std::string& name, const Element& element)
-        {
-          core::Container <Element>::add (name, element);
-        }
-
-        /// \}
-
         /// \name Collisions
         /// \{
 
diff --git a/src/device.cc b/src/device.cc
index c8f320fe..36a6b68d 100644
--- a/src/device.cc
+++ b/src/device.cc
@@ -58,10 +58,10 @@ namespace hpp {
       Parent_t::print (os);
       // print handles
       os << "Handles:" << std::endl;
-      Container <HandlePtr_t>::printPointer (os);
+      Containers_t::print <HandlePtr_t> (os);
       // print grippers
       os << "Grippers:" << std::endl;
-      Container <model::GripperPtr_t>::printPointer (os);
+      Containers_t::print <model::GripperPtr_t> (os);
       return os;
     }
 
-- 
GitLab