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 
iCub::skinDynLib::skinContactList::splitPerSkinPart
virtual std::map< SkinPart, skinContactList > splitPerSkinPart()
Split the list in N lists dividing the contacts per skin part.
Definition: skinContactList.cpp:50
iCub::skinDynLib::skinContactList
Definition: skinContactList.h:44
iCub
This file contains the definition of unique IDs for the body parts and the skin parts of the robot.
Definition: emotionInterface.h:17
iCub::skinDynLib::skinContactList::filterBodyPart
virtual skinContactList filterBodyPart(const BodyPart &bp)
Select all the contacts that have the specified body part.
Definition: skinContactList.cpp:33
iCub::skinDynLib::skinContactList::toDynContactList
virtual dynContactList toDynContactList() const
Convert this skinContactList to a dynContactList casting all its elements to dynContact.
Definition: skinContactList.cpp:94
iCub::skinDynLib::skinContactList::write
virtual bool write(yarp::os::ConnectionWriter &connection) const
Write skinContactList to a connection.
Definition: skinContactList.cpp:80
n
int n
Definition: debugFunctions.cpp:58
iCub::skinDynLib::skinContact
Definition: skinContact.h:49
string
string(REPLACE "-rdynamic" "" CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS}") include_directories($
Definition: CMakeLists.txt:9
iCub::skinDynLib::skinContactList::read
virtual bool read(yarp::os::ConnectionReader &connection)
Definition: skinContactList.cpp:60
iCub::skinDynLib::dynContactList
Definition: dynContactList.h:42
iCub::skinDynLib::BodyPart
BodyPart
Definition: common.h:44
iCub::skinDynLib::skinContactList::toString
virtual std::string toString(const int &precision=-1) const
Create a skinContactList starting from a dynContactList.
Definition: skinContactList.cpp:114
iCub::skinDynLib::skinContactList::splitPerBodyPart
virtual std::map< BodyPart, skinContactList > splitPerBodyPart()
Split the list in N lists dividing the contacts per body part.
Definition: skinContactList.cpp:42
skinContact.h
iCub::skinDynLib::skinContactList::skinContactList
skinContactList()
Definition: skinContactList.cpp:27
dynContactList.h