Go to the documentation of this file.
17 #ifndef SDFORMAT_TYPES_HH_
18 #define SDFORMAT_TYPES_HH_
28 #include <sdf/sdf_config.h>
32 #if defined(__GNUC__) || defined(__clang__)
33 #define SDF_DEPRECATED(version) __attribute__((deprecated))
34 #define SDF_FORCEINLINE __attribute__((always_inline))
35 #elif defined(_MSC_VER)
36 #define SDF_DEPRECATED(version)
37 #define SDF_FORCEINLINE __forceinline
39 #define SDF_DEPRECATED(version)
40 #define SDF_FORCEINLINE
44 # define SDF_SUPPRESS_DEPRECATED_BEGIN \
45 _Pragma("GCC diagnostic push") \
46 _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
47 # define SDF_SUPPRESS_DEPRECATED_END _Pragma("GCC diagnostic pop")
48 #elif defined(__clang__)
49 # define SDF_SUPPRESS_DEPRECATED_BEGIN \
50 _Pragma("clang diagnostic push") \
51 _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")
52 # define SDF_SUPPRESS_DEPRECATED_END _Pragma("clang diagnostic pop")
54 # define SDF_SUPPRESS_DEPRECATED_BEGIN
55 # define SDF_SUPPRESS_DEPRECATED_END
61 inline namespace SDF_VERSION_NAMESPACE {
79 std::vector<std::string>
split(
const std::string &_str,
80 const std::string &_splitter);
86 std::string
trim(
const char *_in);
92 std::string
trim(
const std::string &_in);
99 inline bool equal(
const T &_a,
const T &_b,
100 const T &_epsilon = 1e-6f)
102 return std::fabs(_a - _b) <= _epsilon;
128 public:
Time(int32_t _sec, int32_t _nsec)
129 : sec(_sec), nsec(_nsec)
140 _out << _time.
sec <<
" " << _time.
nsec;
152 _in.setf(std::ios_base::skipws);
153 _in >> _time.
sec >> _time.
nsec;
160 public:
bool operator ==(
const Time &_time)
const
162 return this->sec == _time.
sec && this->nsec == _time.
nsec;
188 std::pair<std::string, std::string>
SplitName(
189 const std::string &_absoluteName);
198 const std::string &_scopeName,
const std::string &_localName);
A class for inertial information about a link.
Definition: Types.hh:173
std::vector< std::string > split(const std::string &_str, const std::string &_splitter)
Split a string using the delimiter in splitter.
std::string JoinName(const std::string &_scopeName, const std::string &_localName)
Join two strings with the '::' delimiter.
Time()
Constructor.
Definition: Types.hh:120
constexpr char kSdfStringSource[]
The source path replacement if it was parsed from a string, instead of a file.
Definition: Types.hh:68
namespace for Simulation Description Format parser
Definition: Actor.hh:33
std::string trim(const char *_in)
Trim leading and trailing whitespace from a string.
std::pair< std::string, std::string > SplitName(const std::string &_absoluteName)
Split a name into a two strings based on the '::' delimeter.
std::vector< Error > Errors
A vector of Error.
Definition: Types.hh:106
constexpr char kUrdfStringSource[]
The source path replacement if the urdf was parsed from a string, instead of a file.
Definition: Types.hh:72
const std::string kSdfScopeDelimiter
Definition: Types.hh:64
#define SDFORMAT_VISIBLE
Definition: system_util.hh:41
int32_t nsec
Nanoseconds.
Definition: Types.hh:169
bool equal(const T &_a, const T &_b, const T &_epsilon=1e-6f)
check if two values are equal, within a tolerance
Definition: Types.hh:99
A Time class, can be used to hold wall- or sim-time.
Definition: Types.hh:117
int32_t sec
Seconds.
Definition: Types.hh:166
std::string lowercase(const std::string &_in)
Transforms a string to its lowercase equivalent.
friend std::istream & operator>>(std::istream &_in, Time &_time)
Stream extraction operator.
Definition: Types.hh:148
Time(int32_t _sec, int32_t _nsec)
Constructor.
Definition: Types.hh:128
friend std::ostream & operator<<(std::ostream &_out, const Time &_time)
Stream insertion operator.
Definition: Types.hh:137
double mass
Definition: Types.hh:175
std::ostream & operator<<(std::ostream &os, ParamStreamer< T > s)
Definition: Param.hh:83