vision
Loading...
Searching...
No Matches
YarpCropCallback.hpp
1// -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-
2
3#ifndef __YARP_CROP_CALLBACK_HPP__
4#define __YARP_CROP_CALLBACK_HPP__
5
6#include <mutex>
7#include <utility> // std::pair
8#include <vector>
9
10#include <yarp/conf/version.h>
11
12#include <yarp/os/Bottle.h>
13#include <yarp/os/TypedReaderCallback.h>
14
15#if YARP_VERSION_COMPARE(<, 4, 0, 0)
16#include <yarp/sig/Vector.h>
17#endif
18
19namespace roboticslab
20{
21
27class YarpCropCallback : public yarp::os::TypedReaderCallback<yarp::os::Bottle>
28{
29public:
30 using VertexType = std::pair<int, int>;
31
32 void onRead(yarp::os::Bottle & bot, const yarp::os::TypedReader<yarp::os::Bottle> & reader) override;
33#if YARP_VERSION_COMPARE(>=, 4, 0, 0)
34 std::vector<VertexType> getVertices() const;
35#else
36 yarp::sig::VectorOf<VertexType> getVertices() const;
37#endif
38
39private:
40#if YARP_VERSION_COMPARE(>=, 4, 0, 0)
41 std::vector<VertexType> cropVertices;
42#else
43 yarp::sig::VectorOf<VertexType> cropVertices;
44#endif
45 mutable std::mutex cropMutex;
46 bool isCropping {false};
47};
48
49} // namespace roboticslab
50
51#endif // __YARP_CROP_CALLBACK_HPP__
Definition YarpCropCallback.hpp:28
The main, catch-all namespace for Robotics Lab UC3M.
Definition groups.dox:5