-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathTime_t.i
More file actions
109 lines (92 loc) · 3.8 KB
/
Copy pathTime_t.i
File metadata and controls
109 lines (92 loc) · 3.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
// Copyright 2022 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
%{
#include <fastdds/rtps/common/Time_t.hpp>
%}
// There are two definitions of Time_t in different namespaces
// As SWIG flattens the namespaces, we cannot have two classes with the same name
// We remove the one that is not used in the user API
// We also remove all the related operators
%rename(RTPSTime_t) eprosima::fastdds::rtps::Time_t;
%ignore eprosima::fastdds::rtps::operator==(const Time_t&, const Time_t&);
%ignore eprosima::fastdds::rtps::operator!=(const Time_t&, const Time_t&);
%ignore eprosima::fastdds::rtps::operator<(const Time_t&, const Time_t&);
%ignore eprosima::fastdds::rtps::operator<=(const Time_t&, const Time_t&);
%ignore eprosima::fastdds::rtps::operator>(const Time_t&, const Time_t&);
%ignore eprosima::fastdds::rtps::operator>=(const Time_t&, const Time_t&);
%ignore eprosima::fastdds::rtps::operator+(const Time_t&, const Time_t&);
%ignore eprosima::fastdds::rtps::operator-(const Time_t&, const Time_t&);
%ignore eprosima::fastdds::rtps::operator<<(std::ostream&, const Time_t&);
%ignore eprosima::fastdds::rtps::operator>>(std::istream&, Time_t&);
// Also ignore the insertion/exraction operator of the remaining Time_t,
// as it makes no sense on the target language
%ignore eprosima::fastdds::operator<<(std::ostream&, const Time_t&);
%ignore eprosima::fastdds::operator>>(std::istream&, Time_t&);
// Ignore the global comparison and arithmetic operators
// and make them class-internal
%ignore eprosima::fastdds::operator==(const Time_t&, const Time_t&);
%ignore eprosima::fastdds::operator!=(const Time_t&, const Time_t&);
%ignore eprosima::fastdds::operator<(const Time_t&, const Time_t&);
%ignore eprosima::fastdds::operator<=(const Time_t&, const Time_t&);
%ignore eprosima::fastdds::operator>(const Time_t&, const Time_t&);
%ignore eprosima::fastdds::operator>=(const Time_t&, const Time_t&);
%ignore eprosima::fastdds::operator+(const Time_t&, const Time_t&);
%ignore eprosima::fastdds::operator-(const Time_t&, const Time_t&);
%include <fastdds/rtps/common/Time_t.hpp>
// Declare the comparison operators as internal to the class
%extend eprosima::fastdds::Time_t {
bool operator==(const eprosima::fastdds::Time_t& other) const
{
return *$self == other;
}
bool operator!=(const eprosima::fastdds::Time_t& other) const
{
return *$self != other;
}
bool operator<(const eprosima::fastdds::Time_t& other) const
{
return *$self < other;
}
bool operator>(const eprosima::fastdds::Time_t& other) const
{
return *$self > other;
}
bool operator<=(const eprosima::fastdds::Time_t& other) const
{
return *$self <= other;
}
bool operator>=(const eprosima::fastdds::Time_t& other) const
{
return *$self >= other;
}
eprosima::fastdds::Time_t operator+ (const eprosima::fastdds::Time_t& other) const
{
return *$self + other;
}
eprosima::fastdds::Time_t operator- (const eprosima::fastdds::Time_t& other) const
{
return *$self - other;
}
}
namespace eprosima {
namespace fastdds {
struct Duration_t : public Time_t
{
Duration_t();
Duration_t(
int32_t sec,
uint32_t nsec);
};
} // namespace fastdds
} // namespace eprosima