YARP
Yet Another Robot Platform
FrameTransformContainer.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3  * SPDX-License-Identifier: LGPL-2.1-or-later
4  */
5 
6 #ifndef YARP_DEV_FRAMETRANSFORM_UTILS_H
7 #define YARP_DEV_FRAMETRANSFORM_UTILS_H
8 
9 
10 #include <yarp/os/Network.h>
12 #include <yarp/sig/Vector.h>
13 #include <yarp/os/PeriodicThread.h>
14 #include <yarp/dev/PolyDriver.h>
16 #include <mutex>
17 #include <map>
18 
31 {
32  using ContainerType = std::vector<yarp::math::FrameTransform>;
33 
34 protected:
35  ContainerType m_transforms;
36 
37 public:
38  mutable std::recursive_mutex m_trf_mutex;
39 
40 public:
41  //non-static transforms older than value (seconds) will be removed by method checkAndRemoveExpired()
42  double m_timeout = 0.2;
43 
44 public:
47 
48  //IFrameTransformStorageSet interface
49  bool setTransforms(const std::vector<yarp::math::FrameTransform>& transforms) override;
50  bool setTransform(const yarp::math::FrameTransform& transform) override;
51 
52  //IFrameTransformStorageGet interface
53  bool getTransforms(std::vector<yarp::math::FrameTransform>& transforms) const override;
54 
55  //IFrameTransformStorageUtils interface
56  bool deleteTransform(std::string t1, std::string t2) override;
57  bool clearAll() override;
58 
59  bool size(size_t& size) const;
60 
61 public:
62  //other
63  bool checkAndRemoveExpired();
64  bool checkAndRemoveExpired() const;
65  ContainerType::iterator begin() {return m_transforms.begin();}
66  ContainerType::iterator end() {return m_transforms.end();}
67 
68  //yarp::math::FrameTransform& operator[] (std::size_t idx) { return m_transforms[idx]; }
69  //bool delete_transform(int id);
70 };
71 
72 #endif // YARP_DEV_FRAMETRANSFORM_UTILS_H
contains the definition of a Vector type
FrameTransformContainer: A class that contains a vector of frame transformations and exposes yarp::de...
bool setTransform(const yarp::math::FrameTransform &transform) override
Save a frame transform in a storage.
bool getTransforms(std::vector< yarp::math::FrameTransform > &transforms) const override
Obtains all frame transforms saved in a storage.
bool size(size_t &size) const
bool setTransforms(const std::vector< yarp::math::FrameTransform > &transforms) override
Save some frame transforms in a storage.
ContainerType::iterator begin()
bool deleteTransform(std::string t1, std::string t2) override
Delete a single transform in the storage.
ContainerType::iterator end()
std::recursive_mutex m_trf_mutex
bool clearAll() override
Delete all transforms in a storage.