Autoware.Auto
common/signal_filters/include/signal_filters/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 SIGNAL_FILTERS__VISIBILITY_CONTROL_HPP_
17 #define SIGNAL_FILTERS__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 SIGNAL_FILTERS_EXPORT __attribute__ ((dllexport))
25  #define SIGNAL_FILTERS_IMPORT __attribute__ ((dllimport))
26  #else
27  #define SIGNAL_FILTERS_EXPORT __declspec(dllexport)
28  #define SIGNAL_FILTERS_IMPORT __declspec(dllimport)
29  #endif
30  #ifdef SIGNAL_FILTERS_BUILDING_LIBRARY
31  #define SIGNAL_FILTERS_PUBLIC SIGNAL_FILTERS_EXPORT
32  #else
33  #define SIGNAL_FILTERS_PUBLIC SIGNAL_FILTERS_IMPORT
34  #endif
35  #define SIGNAL_FILTERS_PUBLIC_TYPE SIGNAL_FILTERS_PUBLIC
36  #define SIGNAL_FILTERS_LOCAL
37 #else
38  #define SIGNAL_FILTERS_EXPORT __attribute__ ((visibility("default")))
39  #define SIGNAL_FILTERS_IMPORT
40  #if __GNUC__ >= 4
41  #define SIGNAL_FILTERS_PUBLIC __attribute__ ((visibility("default")))
42  #define SIGNAL_FILTERS_LOCAL __attribute__ ((visibility("hidden")))
43  #else
44  #define SIGNAL_FILTERS_PUBLIC
45  #define SIGNAL_FILTERS_LOCAL
46  #endif
47  #define SIGNAL_FILTERS_PUBLIC_TYPE
48 #endif
49 
50 #endif // SIGNAL_FILTERS__VISIBILITY_CONTROL_HPP_