Skip to content
Snippets Groups Projects
Commit 88ea5194 authored by Joseph Mirabel's avatar Joseph Mirabel Committed by Joseph Mirabel
Browse files

Use Containers class instead of Container

parent f5671375
No related branches found
No related tags found
No related merge requests found
...@@ -34,15 +34,23 @@ namespace hpp { ...@@ -34,15 +34,23 @@ namespace hpp {
/// it is compatible with hpp::model::urdf::loadHumanoidRobot /// it is compatible with hpp::model::urdf::loadHumanoidRobot
/// ///
/// This class also contains model::Gripper, Handle and \ref JointAndTriangles_t /// This class also contains model::Gripper, Handle and \ref JointAndTriangles_t
class HPP_MANIPULATION_DLLAPI Device : public model::HumanoidRobot, class HPP_MANIPULATION_DLLAPI Device :
protected core::Container <HandlePtr_t>, public model::HumanoidRobot,
protected core::Container <model::GripperPtr_t>, public core::Containers<
protected core::Container <JointAndShapes_t>, boost::mpl::vector < HandlePtr_t,
protected core::Container <model::JointVector_t> model::GripperPtr_t,
JointAndShapes_t,
model::JointVector_t> >
{ {
public: public:
typedef model::HumanoidRobot Parent_t; typedef model::HumanoidRobot Parent_t;
typedef core::Containers<
boost::mpl::vector < HandlePtr_t,
model::GripperPtr_t,
JointAndShapes_t,
model::JointVector_t> > Containers_t;
/// Constructor /// Constructor
/// \param name of the new instance, /// \param name of the new instance,
static DevicePtr_t create (const std::string& name) static DevicePtr_t create (const std::string& name)
...@@ -56,48 +64,6 @@ namespace hpp { ...@@ -56,48 +64,6 @@ namespace hpp {
/// Print object in a stream /// Print object in a stream
virtual std::ostream& print (std::ostream& os) const; 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 /// \name Collisions
/// \{ /// \{
......
...@@ -58,10 +58,10 @@ namespace hpp { ...@@ -58,10 +58,10 @@ namespace hpp {
Parent_t::print (os); Parent_t::print (os);
// print handles // print handles
os << "Handles:" << std::endl; os << "Handles:" << std::endl;
Container <HandlePtr_t>::printPointer (os); Containers_t::print <HandlePtr_t> (os);
// print grippers // print grippers
os << "Grippers:" << std::endl; os << "Grippers:" << std::endl;
Container <model::GripperPtr_t>::printPointer (os); Containers_t::print <model::GripperPtr_t> (os);
return os; return os;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment