Autoware.Auto
drivers/vehicle_interface/include/vehicle_interface/visibility_control.hpp
Go to the documentation of this file.
1 // Copyright 2020 the Autoware Foundation
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 // Co-developed by Tier IV, Inc. and Apex.AI, Inc.
16 #ifndef VEHICLE_INTERFACE__VISIBILITY_CONTROL_HPP_
17 #define VEHICLE_INTERFACE__VISIBILITY_CONTROL_HPP_
18 
19 // This logic was borrowed (then namespaced) from the examples on the gcc wiki:
20 // https://gcc.gnu.org/wiki/Visibility
21 
22 #if defined _WIN32 || defined __CYGWIN__
23  #ifdef __GNUC__
24  #define VEHICLE_INTERFACE_EXPORT __attribute__ ((dllexport))
25  #define VEHICLE_INTERFACE_IMPORT __attribute__ ((dllimport))
26  #else
27  #define VEHICLE_INTERFACE_EXPORT __declspec(dllexport)
28  #define VEHICLE_INTERFACE_IMPORT __declspec(dllimport)
29  #endif
30  #ifdef VEHICLE_INTERFACE_BUILDING_LIBRARY
31  #define VEHICLE_INTERFACE_PUBLIC VEHICLE_INTERFACE_EXPORT
32  #else
33  #define VEHICLE_INTERFACE_PUBLIC VEHICLE_INTERFACE_IMPORT
34  #endif
35  #define VEHICLE_INTERFACE_PUBLIC_TYPE VEHICLE_INTERFACE_PUBLIC
36  #define VEHICLE_INTERFACE_LOCAL
37 #else
38  #define VEHICLE_INTERFACE_EXPORT __attribute__ ((visibility("default")))
39  #define VEHICLE_INTERFACE_IMPORT
40  #if __GNUC__ >= 4
41  #define VEHICLE_INTERFACE_PUBLIC __attribute__ ((visibility("default")))
42  #define VEHICLE_INTERFACE_LOCAL __attribute__ ((visibility("hidden")))
43  #else
44  #define VEHICLE_INTERFACE_PUBLIC
45  #define VEHICLE_INTERFACE_LOCAL
46  #endif
47  #define VEHICLE_INTERFACE_PUBLIC_TYPE
48 #endif
49 
50 #endif // VEHICLE_INTERFACE__VISIBILITY_CONTROL_HPP_