iCub-main
skinContactList.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2010-2011 RobotCub Consortium
3  * Author: Andrea Del Prete
4  * CopyPolicy: Released under the terms of the GNU GPL v2.0.
5  *
6  */
7 
25 #ifndef __SKINCONTLIST_H__
26 #define __SKINCONTLIST_H__
27 
28 #include <vector>
29 #include <map>
30 #include <yarp/os/Portable.h>
33 
34 namespace iCub
35 {
36 namespace skinDynLib
37 {
38 
44 class skinContactList : public std::vector<skinContact>, public yarp::os::Portable
45 {
46 protected:
47 
48 public:
49  //~~~~~~~~~~~~~~~~~~~~~~
50  // CONSTRUCTORS
51  //~~~~~~~~~~~~~~~~~~~~~~
53  skinContactList(const size_type &n, const skinContact& value = skinContact());
54 
60  virtual skinContactList filterBodyPart(const BodyPart &bp);
61 
65  virtual std::map<BodyPart, skinContactList> splitPerBodyPart();
66 
70  virtual std::map<SkinPart, skinContactList> splitPerSkinPart();
71 
72 
73  //~~~~~~~~~~~~~~~~~~~~~~~~~
74  // SERIALIZATION methods
75  //~~~~~~~~~~~~~~~~~~~~~~~~~
76  /*
77  * Read skinContactList from a connection.
78  * return true iff a skinContactList was read correctly
79  */
80  virtual bool read(yarp::os::ConnectionReader& connection);
81 
86  virtual bool write(yarp::os::ConnectionWriter& connection) const;
87 
92  virtual dynContactList toDynContactList() const;
93 
98  //virtual bool fromDynContactList(dynContactList &l);
99 
103  virtual std::string toString(const int &precision=-1) const;
104 };
105 
106 }
107 
108 }
109 #endif
110 
Class representing a list of external contacts.
Class representing a list of external contacts acting on the iCub' skin.
virtual skinContactList filterBodyPart(const BodyPart &bp)
Select all the contacts that have the specified body part.
virtual std::map< BodyPart, skinContactList > splitPerBodyPart()
Split the list in N lists dividing the contacts per body part.
virtual std::map< SkinPart, skinContactList > splitPerSkinPart()
Split the list in N lists dividing the contacts per skin part.
virtual bool read(yarp::os::ConnectionReader &connection)
virtual std::string toString(const int &precision=-1) const
Create a skinContactList starting from a dynContactList.
virtual bool write(yarp::os::ConnectionWriter &connection) const
Write skinContactList to a connection.
virtual dynContactList toDynContactList() const
Convert this skinContactList to a dynContactList casting all its elements to dynContact.
Class representing an external contact acting on the iCub' skin.
Definition: skinContact.h:50
int n
This file contains the definition of unique IDs for the body parts and the skin parts of the robot.