Ignition Transport

API Reference

7.1.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 <cstdint>
22 #include <cstdio>
23 #include <cstring>
24 #include <limits>
25 #include <string>
26 #include <vector>
27 
28 #include "ignition/transport/config.hh"
29 #include "ignition/transport/Export.hh"
30 
31 namespace ignition
32 {
33  namespace transport
34  {
35  // Inline bracket to help doxygen filtering.
36  inline namespace IGNITION_TRANSPORT_VERSION_NAMESPACE {
37  //
40 
45  bool IGNITION_TRANSPORT_VISIBLE env(const std::string &_name,
46  std::string &_value);
47 
52  std::vector<std::string> IGNITION_TRANSPORT_VISIBLE split(
53  const std::string &_orig,
54  char _delim);
55 
56  // Use safer functions on Windows
57  #ifdef _MSC_VER
58  #define ign_strcat strcat_s
59  #define ign_strcpy strcpy_s
60  #define ign_sprintf sprintf_s
61  #define ign_strdup _strdup
62  #else
63  #define ign_strcat std::strcat
64  #define ign_strcpy std::strcpy
65  #define ign_sprintf std::sprintf
66  #define ign_strdup strdup
67  #endif
68  }
69  }
70 }
71 
72 // IGN_TRANSPORT_HELPERS_HH_
73 #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:39