All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Helpers.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 
18 #ifndef IGN_TRANSPORT_HELPERS_HH_
19 #define IGN_TRANSPORT_HELPERS_HH_
20 
21 #include <cstdint>
22 #include <cstdio>
23 #include <cstring>
24 #include <limits>
25 #include <string>
26 
29 
32 
33 #if defined BUILDING_STATIC_LIBS
34  #define IGNITION_TRANSPORT_VISIBLE
35  #define IGNITION_HIDDEN
36 #else
37  #if defined __WIN32 || defined __CYGWIN__
38  #ifdef BUILDING_DLL
39  #ifdef __GNUC__
40  #define IGNITION_TRANSPORT_VISIBLE __attribute__ ((dllexport))
41  #else
42  #define IGNITION_TRANSPORT_VISIBLE __declspec(dllexport)
43  #endif
44  #else
45  #ifdef __GNUC__
46  #define IGNITION_TRANSPORT_VISIBLE __attribute__ ((dllimport))
47  #else
48  #define IGNITION_TRANSPORT_VISIBLE __declspec(dllimport)
49  #endif
50  #endif
51  #define IGNITION_HIDDEN
52  #else
53  #if __GNUC__ >= 4
54  #define IGNITION_TRANSPORT_VISIBLE __attribute__ ((visibility ("default")))
55  #define IGNITION_HIDDEN __attribute__ ((visibility ("hidden")))
56  #else
57  #define IGNITION_TRANSPORT_VISIBLE
58  #define IGNITION_HIDDEN
59  #endif
60  #endif
61 // BUILDING_STATIC_LIBS
62 #endif
63 
64 namespace ignition
65 {
66  namespace transport
67  {
69  static const uint64_t kUnthrottled = std::numeric_limits<uint64_t>::max();
70 
76  bool env(const std::string &_name,
77  std::string &_value);
78  }
79 }
80 
81 // Use safer functions on Windows
82 #ifdef _MSC_VER
83  #define ign_strcat strcat_s
84  #define ign_strcpy strcpy_s
85  #define ign_sprintf sprintf_s
86  #define ign_strdup _strdup
87 #else
88  #define ign_strcat std::strcat
89  #define ign_strcpy std::strcpy
90  #define ign_sprintf std::sprintf
91  #define ign_strdup strdup
92 #endif
93 
94 // __IGN_TRANSPORT_HELPERS_HH_INCLUDED__
95 #endif
#define IGNITION_TRANSPORT_VISIBLE
Use to represent "symbol visible" if supported.
Definition: Helpers.hh:57
static const uint64_t kUnthrottled
Constant used when not interested in throttling.
Definition: Helpers.hh:69
bool env(const std::string &_name, std::string &_value)
Find the environment variable '_name' and return its value.