rmw_fastrtps_dynamic_cpp  master
Implement the ROS middleware interface using eProsima FastRTPS dynamic code generation in C++.
All Classes Namespaces Files Functions Variables Typedefs Macros
macros.hpp
Go to the documentation of this file.
1 // Copyright 2016 Open Source Robotics Foundation, Inc.
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 #ifndef RMW_FASTRTPS_DYNAMIC_CPP__MACROS_HPP_
16 #define RMW_FASTRTPS_DYNAMIC_CPP__MACROS_HPP_
17 
18 #include <limits>
19 #include <string>
20 
21 #define SPECIALIZE_GENERIC_C_SEQUENCE(C_NAME, C_TYPE) \
22  template<> \
23  struct GenericCSequence<C_TYPE> \
24  { \
25  using type = rosidl_runtime_c__ ## C_NAME ## __Sequence; \
26  \
27  static void fini(type * array) { \
28  rosidl_runtime_c__ ## C_NAME ## __Sequence__fini(array); \
29  } \
30  \
31  static bool init(type * array, size_t size) { \
32  return rosidl_runtime_c__ ## C_NAME ## __Sequence__init(array, size); \
33  } \
34  };
35 
36 #endif // RMW_FASTRTPS_DYNAMIC_CPP__MACROS_HPP_