test.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 TEST_TEST_H_
22 #define TEST_TEST_H_
23 
24 #define FKIE_MESSAGE_FILTERS_IGNORE_ROS_OK
25 
26 #include <gtest/gtest.h>
27 #include <std_msgs/Header.h>
28 #include <ros/message_traits.h>
29 
30 namespace fkie_message_filters
31 {
32 }
33 
34 template<class T>
36 {
37  NotDefaultConstructable() = delete;
38  explicit NotDefaultConstructable(const T& t) : data(t) {}
40  operator const T() const { return data; }
41  bool operator == (const NotDefaultConstructable& other) const { return data == other.data; }
42  bool operator != (const NotDefaultConstructable& other) const { return data != other.data; }
43 private:
44  T data;
45 };
46 
50 
51 template<class T>
52 struct Stamped : public NotDefaultConstructable<T>
53 {
54  explicit Stamped (const T& t, const std::string& frame_id = std::string(), const ros::Time& stamp = ros::Time())
56  {
57  header.frame_id = frame_id;
58  header.stamp = stamp;
59  }
60  std_msgs::Header header;
61 };
62 
63 namespace ros
64 {
65 namespace message_traits
66 {
67 
68 template<class T>
69 struct HasHeader<Stamped<T>> : public TrueType {};
70 
71 } // namespace message_traits
72 } // namespace ros
73 
74 class ExpectedException : public std::runtime_error
75 {
76 public:
77  ExpectedException(const char* what) : std::runtime_error(what) {}
78 };
79 
80 
81 namespace mf = fkie_message_filters;
82 
83 #endif /* TEST_TEST_H_ */
std_msgs::Header header
Definition: test.h:60
Primary namespace.
Definition: buffer.h:33
Stamped(const T &t, const std::string &frame_id=std::string(), const ros::Time &stamp=ros::Time())
Definition: test.h:54
NotDefaultConstructable(const T &t)
Definition: test.h:38
ExpectedException(const char *what)
Definition: test.h:77
const std::string header
Definition: test.h:52


fkie_message_filters
Author(s): Timo Röhling
autogenerated on Mon Feb 28 2022 22:21:43