Skip to content

Commit 19d69a6

Browse files
committed
Refs #23716: Add test user data types
Signed-off-by: Carlosespicur <[email protected]>
1 parent 1afdd20 commit 19d69a6

File tree

8 files changed

+942
-0
lines changed

8 files changed

+942
-0
lines changed

test/types/UserData/FooType.hpp

Lines changed: 227 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,227 @@
1+
// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
/*!
16+
* @file FooType.hpp
17+
* This header file contains the declaration of the described types in the IDL file.
18+
*
19+
* This file was generated by the tool fastddsgen (version: 4.1.0).
20+
*/
21+
22+
#ifndef FAST_DDS_GENERATED__FOOTYPE_HPP
23+
#define FAST_DDS_GENERATED__FOOTYPE_HPP
24+
25+
#include <cstdint>
26+
#include <string>
27+
#include <utility>
28+
#include <fastcdr/cdr/fixed_size_string.hpp>
29+
30+
#if defined(_WIN32)
31+
#if defined(EPROSIMA_USER_DLL_EXPORT)
32+
#define eProsima_user_DllExport __declspec( dllexport )
33+
#else
34+
#define eProsima_user_DllExport
35+
#endif // EPROSIMA_USER_DLL_EXPORT
36+
#else
37+
#define eProsima_user_DllExport
38+
#endif // _WIN32
39+
40+
#if defined(_WIN32)
41+
#if defined(EPROSIMA_USER_DLL_EXPORT)
42+
#if defined(FOOTYPE_SOURCE)
43+
#define FOOTYPE_DllAPI __declspec( dllexport )
44+
#else
45+
#define FOOTYPE_DllAPI __declspec( dllimport )
46+
#endif // FOOTYPE_SOURCE
47+
#else
48+
#define FOOTYPE_DllAPI
49+
#endif // EPROSIMA_USER_DLL_EXPORT
50+
#else
51+
#define FOOTYPE_DllAPI
52+
#endif // _WIN32
53+
54+
/*!
55+
* @brief This class represents the structure FooType defined by the user in the IDL file.
56+
* @ingroup FooType
57+
*/
58+
class FooType
59+
{
60+
public:
61+
62+
/*!
63+
* @brief Default constructor.
64+
*/
65+
eProsima_user_DllExport FooType()
66+
{
67+
}
68+
69+
/*!
70+
* @brief Default destructor.
71+
*/
72+
eProsima_user_DllExport ~FooType()
73+
{
74+
}
75+
76+
/*!
77+
* @brief Copy constructor.
78+
* @param x Reference to the object FooType that will be copied.
79+
*/
80+
eProsima_user_DllExport FooType(
81+
const FooType& x)
82+
{
83+
m_num = x.m_num;
84+
85+
m_msg = x.m_msg;
86+
87+
}
88+
89+
/*!
90+
* @brief Move constructor.
91+
* @param x Reference to the object FooType that will be copied.
92+
*/
93+
eProsima_user_DllExport FooType(
94+
FooType&& x) noexcept
95+
{
96+
m_num = x.m_num;
97+
m_msg = std::move(x.m_msg);
98+
}
99+
100+
/*!
101+
* @brief Copy assignment.
102+
* @param x Reference to the object FooType that will be copied.
103+
*/
104+
eProsima_user_DllExport FooType& operator =(
105+
const FooType& x)
106+
{
107+
108+
m_num = x.m_num;
109+
110+
m_msg = x.m_msg;
111+
112+
return *this;
113+
}
114+
115+
/*!
116+
* @brief Move assignment.
117+
* @param x Reference to the object FooType that will be copied.
118+
*/
119+
eProsima_user_DllExport FooType& operator =(
120+
FooType&& x) noexcept
121+
{
122+
123+
m_num = x.m_num;
124+
m_msg = std::move(x.m_msg);
125+
return *this;
126+
}
127+
128+
/*!
129+
* @brief Comparison operator.
130+
* @param x FooType object to compare.
131+
*/
132+
eProsima_user_DllExport bool operator ==(
133+
const FooType& x) const
134+
{
135+
return (m_num == x.m_num &&
136+
m_msg == x.m_msg);
137+
}
138+
139+
/*!
140+
* @brief Comparison operator.
141+
* @param x FooType object to compare.
142+
*/
143+
eProsima_user_DllExport bool operator !=(
144+
const FooType& x) const
145+
{
146+
return !(*this == x);
147+
}
148+
149+
/*!
150+
* @brief This function sets a value in member num
151+
* @param _num New value for member num
152+
*/
153+
eProsima_user_DllExport void num(
154+
int32_t _num)
155+
{
156+
m_num = _num;
157+
}
158+
159+
/*!
160+
* @brief This function returns the value of member num
161+
* @return Value of member num
162+
*/
163+
eProsima_user_DllExport int32_t num() const
164+
{
165+
return m_num;
166+
}
167+
168+
/*!
169+
* @brief This function returns a reference to member num
170+
* @return Reference to member num
171+
*/
172+
eProsima_user_DllExport int32_t& num()
173+
{
174+
return m_num;
175+
}
176+
177+
178+
/*!
179+
* @brief This function copies the value in member msg
180+
* @param _msg New value to be copied in member msg
181+
*/
182+
eProsima_user_DllExport void msg(
183+
const std::string& _msg)
184+
{
185+
m_msg = _msg;
186+
}
187+
188+
/*!
189+
* @brief This function moves the value in member msg
190+
* @param _msg New value to be moved in member msg
191+
*/
192+
eProsima_user_DllExport void msg(
193+
std::string&& _msg)
194+
{
195+
m_msg = std::move(_msg);
196+
}
197+
198+
/*!
199+
* @brief This function returns a constant reference to member msg
200+
* @return Constant reference to member msg
201+
*/
202+
eProsima_user_DllExport const std::string& msg() const
203+
{
204+
return m_msg;
205+
}
206+
207+
/*!
208+
* @brief This function returns a reference to member msg
209+
* @return Reference to member msg
210+
*/
211+
eProsima_user_DllExport std::string& msg()
212+
{
213+
return m_msg;
214+
}
215+
216+
217+
218+
private:
219+
220+
int32_t m_num{0};
221+
std::string m_msg;
222+
223+
};
224+
225+
#endif // _FAST_DDS_GENERATED_FOOTYPE_HPP_
226+
227+

test/types/UserData/FooType.idl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
struct FooType
2+
{
3+
long num;
4+
string msg;
5+
};
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
/*!
16+
* @file FooTypeCdrAux.hpp
17+
* This source file contains some definitions of CDR related functions.
18+
*
19+
* This file was generated by the tool fastddsgen (version: 4.1.0).
20+
*/
21+
22+
#ifndef FAST_DDS_GENERATED__FOOTYPECDRAUX_HPP
23+
#define FAST_DDS_GENERATED__FOOTYPECDRAUX_HPP
24+
25+
#include "FooType.hpp"
26+
constexpr uint32_t FooType_max_cdr_typesize {268UL};
27+
constexpr uint32_t FooType_max_key_cdr_typesize {0UL};
28+
29+
30+
namespace eprosima {
31+
namespace fastcdr {
32+
33+
class Cdr;
34+
class CdrSizeCalculator;
35+
36+
eProsima_user_DllExport void serialize_key(
37+
eprosima::fastcdr::Cdr& scdr,
38+
const FooType& data);
39+
40+
41+
} // namespace fastcdr
42+
} // namespace eprosima
43+
44+
#endif // FAST_DDS_GENERATED__FOOTYPECDRAUX_HPP
45+

0 commit comments

Comments
 (0)