17#ifndef SDFORMAT_TYPES_HH_
18#define SDFORMAT_TYPES_HH_
31#define SDF_DEPRECATED(version) __attribute__((deprecated))
32#define SDF_FORCEINLINE __attribute__((always_inline))
34#define SDF_DEPRECATED(version)
35#define SDF_FORCEINLINE __forceinline
37#define SDF_DEPRECATED(version)
38#define SDF_FORCEINLINE
48 std::vector<std::string>
split(
const std::string &_str,
49 const std::string &_splitter);
55 std::string
trim(
const char *_in);
62 inline bool equal(
const T &_a,
const T &_b,
63 const T &_epsilon = 1e-6f)
65 return std::fabs(_a - _b) <= _epsilon;
80 public:
Color(
float _r = 0.0f,
float _g = 0.0f,
82 :
r(_r),
g(_g),
b(_b),
a(_a)
89 public:
friend std::ostream &operator<< (std::ostream &_out,
92 _out << _pt.
r <<
" " << _pt.
g <<
" " << _pt.
b <<
" " << _pt.
a;
99 public:
friend std::istream &operator>> (std::istream &_in,
Color &_pt)
102 _in.setf(std::ios_base::skipws);
103 _in >> _pt.
r >> _pt.
g >> _pt.
b >> _pt.
a;
110 public:
bool operator ==(
const Color &_clr)
const
112 return equal(this->
r, _clr.
r) &&
144 public:
Time(int32_t _sec, int32_t _nsec)
156 _out << _time.
sec <<
" " << _time.
nsec;
168 _in.setf(std::ios_base::skipws);
169 _in >> _time.
sec >> _time.
nsec;
176 public:
bool operator ==(
const Time &_time)
const
#define SDF_DEPRECATED(version)
Definition Types.hh:37
float g
Green value.
Definition Types.hh:122
float a
Alpha value.
Definition Types.hh:128
float b
Blue value.
Definition Types.hh:125
Color(float _r=0.0f, float _g=0.0f, float _b=0.0f, float _a=1.0f)
Constructor.
Definition Types.hh:80
float r
Red value.
Definition Types.hh:119
A class for inertial information about a link.
Definition Types.hh:190
double mass
Definition Types.hh:191
int32_t nsec
Nanoseconds.
Definition Types.hh:185
int32_t sec
Seconds.
Definition Types.hh:182
friend std::ostream & operator<<(std::ostream &_out, const Time &_time)
Stream insertion operator.
Definition Types.hh:153
Time(int32_t _sec, int32_t _nsec)
Constructor.
Definition Types.hh:144
Time()
Constructor.
Definition Types.hh:136
friend std::istream & operator>>(std::istream &_in, Time &_time)
Stream extraction operator.
Definition Types.hh:164
namespace for Simulation Description Format parser
Definition Console.hh:36
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:62
SDFORMAT_VISIBLE std::string trim(const char *_in)
Trim leading and trailing whitespace from a string.
std::vector< Error > Errors
A vector of Error.
Definition Types.hh:69
SDFORMAT_VISIBLE std::vector< std::string > split(const std::string &_str, const std::string &_splitter)
Split a string using the delimiter in splitter.
#define SDFORMAT_VISIBLE
Use to represent "symbol visible" if supported.
Definition system_util.hh:48