test
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>
35
struct
NotDefaultConstructable
36
{
37
NotDefaultConstructable
() =
delete
;
38
explicit
NotDefaultConstructable
(
const
T& t) :
data
(t) {}
39
NotDefaultConstructable
(
const
NotDefaultConstructable
&) =
default
;
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
47
using
int_M
=
NotDefaultConstructable<int>
;
48
using
double_M
=
NotDefaultConstructable<double>
;
49
using
string_M
=
NotDefaultConstructable<std::string>
;
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
())
55
:
NotDefaultConstructable
<T>(t)
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_ */
fkie_message_filters
Definition:
buffer.h:33
ros::message_traits::TrueType
NotDefaultConstructable::NotDefaultConstructable
NotDefaultConstructable()=delete
NotDefaultConstructable
Definition:
test.h:35
NotDefaultConstructable::operator!=
bool operator!=(const NotDefaultConstructable &other) const
Definition:
test.h:42
ros
NotDefaultConstructable::NotDefaultConstructable
NotDefaultConstructable(const T &t)
Definition:
test.h:38
Stamped::header
std_msgs::Header header
Definition:
test.h:60
NotDefaultConstructable::operator==
bool operator==(const NotDefaultConstructable &other) const
Definition:
test.h:41
ros::message_traits::HasHeader
ExpectedException
Definition:
test.h:74
Stamped::Stamped
Stamped(const T &t, const std::string &frame_id=std::string(), const ros::Time &stamp=ros::Time())
Definition:
test.h:54
message_traits.h
NotDefaultConstructable::data
T data
Definition:
test.h:44
Stamped
Definition:
test.h:52
ros::Time
std
ExpectedException::ExpectedException
ExpectedException(const char *what)
Definition:
test.h:77
fkie_message_filters
Author(s): Timo Röhling
autogenerated on Wed Mar 2 2022 00:18:57