access_ros_header.h
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * fkie_message_filters
4  * Copyright © 2018-2020 Fraunhofer FKIE
5  * Author: Timo Röhling
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  ****************************************************************************/
20 
21 #ifndef INCLUDE_FKIE_MESSAGE_FILTERS_HELPERS_ACCESS_ROS_HEADER_H_
22 #define INCLUDE_FKIE_MESSAGE_FILTERS_HELPERS_ACCESS_ROS_HEADER_H_
23 
24 #include <memory>
25 #include <boost/shared_ptr.hpp>
26 #include <ros/message_event.h>
27 #include <ros/message_traits.h>
28 #include <ros/time.h>
29 #include <string>
30 #include <type_traits>
31 
32 namespace fkie_message_filters
33 {
34 namespace helpers
35 {
36 
37 template<class M>
38 struct AccessRosHeader
39 {
40  static std::string frame_id(const M& m) noexcept { return ros::message_traits::FrameId<std::remove_cv_t<M>>::value(m); }
41  static ros::Time stamp(const M& m) noexcept { return ros::message_traits::TimeStamp<std::remove_cv_t<M>>::value(m); }
42 };
43 
44 template<class M>
45 struct AccessRosHeader<std::shared_ptr<M>>
46 {
47  static std::string frame_id(const std::shared_ptr<M>& m) noexcept { return ros::message_traits::FrameId<std::remove_cv_t<M>>::value(*m); }
48  static ros::Time stamp(const std::shared_ptr<M>& m) noexcept { return ros::message_traits::TimeStamp<std::remove_cv_t<M>>::value(*m); }
49 };
50 
51 template<class M>
52 struct AccessRosHeader<boost::shared_ptr<M>>
53 {
54  static std::string frame_id(const boost::shared_ptr<M>& m) noexcept { return ros::message_traits::FrameId<std::remove_cv_t<M>>::value(*m); }
55  static ros::Time stamp(const boost::shared_ptr<M>& m) noexcept { return ros::message_traits::TimeStamp<std::remove_cv_t<M>>::value(*m); }
56 };
57 
58 template<class M>
59 struct AccessRosHeader<ros::MessageEvent<M>>
60 {
61  static std::string frame_id(const ros::MessageEvent<M>& m) noexcept { return ros::message_traits::FrameId<std::remove_cv_t<M>>::value(*m.getConstMessage()); }
62  static ros::Time stamp(const ros::MessageEvent<M>& m) noexcept { return ros::message_traits::TimeStamp<std::remove_cv_t<M>>::value(*m.getConstMessage()); }
63 };
64 
65 template<class M>
66 std::string access_ros_header_frame_id(const M& m) noexcept
67 {
69 }
70 
71 template<class M>
72 ros::Time access_ros_header_stamp(const M& m) noexcept
73 {
75 }
76 
77 } // namespace helpers
78 } // namespace fkie_message_filters
79 
80 #endif /* INCLUDE_FKIE_MESSAGE_FILTERS_HELPERS_ACCESS_ROS_HEADER_H_ */
ros::message_traits::TimeStamp
fkie_message_filters
Definition: buffer.h:33
fkie_message_filters::helpers::AccessRosHeader::frame_id
static std::string frame_id(const M &m) noexcept
Definition: access_ros_header.h:94
boost::shared_ptr< M >
ros
time.h
boost
fkie_message_filters::helpers::AccessRosHeader::stamp
static ros::Time stamp(const M &m) noexcept
Definition: access_ros_header.h:95
message_traits.h
fkie_message_filters::helpers::access_ros_header_stamp
ros::Time access_ros_header_stamp(const M &m) noexcept
Definition: access_ros_header.h:108
ros::Time
ros::message_traits::FrameId
std
fkie_message_filters::helpers::access_ros_header_frame_id
std::string access_ros_header_frame_id(const M &m) noexcept
Definition: access_ros_header.h:102
message_event.h
ros::MessageEvent


fkie_message_filters
Author(s): Timo Röhling
autogenerated on Wed Mar 2 2022 00:18:57