Ignition Transport

API Reference

8.0.0
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 <zmq.h>
22 
23 #include <cstdint>
24 #include <cstdio>
25 #include <cstring>
26 #include <limits>
27 #include <string>
28 #include <vector>
29 
30 #include "ignition/transport/config.hh"
31 #include "ignition/transport/Export.hh"
32 
33 #define STR_HELPER(x) #x
34 #define STR(x) STR_HELPER(x)
35 
36 // Avoid using deprecated message send/receive function when possible.
37 #if ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 3, 1)
38  #define IGN_ZMQ_POST_4_3_1
39 #endif
40 
41 namespace ignition
42 {
43  namespace transport
44  {
45  // Inline bracket to help doxygen filtering.
46  inline namespace IGNITION_TRANSPORT_VERSION_NAMESPACE {
47  //
50 
55  bool IGNITION_TRANSPORT_VISIBLE env(const std::string &_name,
56  std::string &_value);
57 
62  std::vector<std::string> IGNITION_TRANSPORT_VISIBLE split(
63  const std::string &_orig,
64  char _delim);
65 
66  // Use safer functions on Windows
67  #ifdef _MSC_VER
68  #define ign_strcat strcat_s
69  #define ign_strcpy strcpy_s
70  #define ign_sprintf sprintf_s
71  #define ign_strdup _strdup
72  #else
73  #define ign_strcat std::strcat
74  #define ign_strcpy std::strcpy
75  #define ign_sprintf std::sprintf
76  #define ign_strdup strdup
77  #endif
78  }
79  }
80 }
81 
82 // IGN_TRANSPORT_HELPERS_HH_
83 #endif
STL class.
std::vector< std::string > split(const std::string &_orig, char _delim)
split at a one character delimiter to get a vector of something
T max(T... args)
Definition: AdvertiseOptions.hh:28
bool env(const std::string &_name, std::string &_value)
Find the environment variable &#39;_name&#39; and return its value.
static const uint64_t kUnthrottled
Constant used when not interested in throttling.
Definition: Helpers.hh:49