47 template <
typename TT>
49 size_t operator()(TT
const& tt)
const {
return std::hash<TT>()(tt); }
55 inline void hash_combine(
std::size_t& seed, T
const& v) {
56 seed ^=
hash_tuple<T>()(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
59 template <class Tuple, size_t Index = std::tuple_size<Tuple>::value - 1>
60 struct HashValueImpl {
61 static void apply(
size_t& seed, Tuple
const& tuple) {
62 HashValueImpl<Tuple, Index - 1>::apply(seed, tuple);
63 hash_combine(seed, std::get<Index>(tuple));
67 template <
class Tuple>
68 struct HashValueImpl<Tuple, 0> {
69 static void apply(
size_t& seed, Tuple
const& tuple) {
70 hash_combine(seed, std::get<0>(tuple));
76 template <
typename... TT>
80 HashValueImpl<std::tuple<TT...>>::apply(seed, tt);
89 for (
int i = 0; i < (
int)matrix.size(); i++) {
90 auto elem = *(matrix.data() + i);
91 seed ^= std::hash<typename T::Scalar>()(elem) + 0x9e3779b9 +
92 (seed << 6) + (seed >> 2);
101 template <
typename T>
110 const std::string& str,
111 const std::string& delimiters =
" ",
112 bool trim_empty_str =
true);
119 const std::string& valid_chars =
"_");
122 const std::string& chars =
"\t\n\v\f\r ");
125 const std::string& chars =
"\t\n\v\f\r ");
130 const std::string& chars =
"\t\n\v\f\r ");
133 std::string
ToLower(
const std::string& s);
136 std::string
ToUpper(
const std::string& s);
138 void Sleep(
int milliseconds);
142 div_t tmp = std::div(x, y);
143 return tmp.quot + (tmp.rem != 0 ? 1 : 0);
164 template <
typename T>
166 double p = std::pow(2, power);
168 return static_cast<T
>(1. / p * n);
std::size_t operator()(T t) const
Definition: Helper.h:102
T UniformRandFloatBinaryFriendly(unsigned int power=5)
Definition: Helper.h:165
int UniformRandInt(const int min, const int max)
Definition: Helper.cpp:116
int DivUp(int x, int y)
Computes the quotient of x/y with rounding up.
Definition: Helper.h:141
Definition: Optional.h:922
size_t WordLength(const std::string &doc, size_t start_pos, const std::string &valid_chars)
Definition: Helper.cpp:87
size_t operator()(TT const &tt) const
Definition: Helper.h:49
const char const char value recording_handle imu_sample recording_handle uint8_t size_t data_size k4a_record_configuration_t config target_format k4a_capture_t capture_handle k4a_imu_sample_t imu_sample playback_handle k4a_logging_message_cb_t void min_level device_handle k4a_imu_sample_t timeout_in_ms capture_handle capture_handle capture_handle image_handle temperature_c int
Definition: K4aPlugin.cpp:476
std::size_t operator()(T const &matrix) const
Definition: Helper.h:87
Definition: PinholeCameraIntrinsic.cpp:35
std::string & RightStripString(std::string &str, const std::string &chars)
Definition: Helper.cpp:63
void SplitString(std::vector< std::string > &tokens, const std::string &str, const std::string &delimiters, bool trim_empty_str)
Definition: Helper.cpp:43
const char const char value recording_handle imu_sample recording_handle uint8_t size_t data_size k4a_record_configuration_t config target_format k4a_capture_t capture_handle k4a_imu_sample_t imu_sample playback_handle k4a_logging_message_cb_t void min_level device_handle k4a_imu_sample_t timeout_in_ms capture_handle capture_handle capture_handle image_handle temperature_c k4a_image_t image_handle uint8_t image_handle image_handle image_handle image_handle image_handle timestamp_usec white_balance image_handle k4a_device_configuration_t config device_handle char size_t serial_number_size bool int32_t int32_t int32_t int32_t k4a_color_control_mode_t default_mode value const const k4a_calibration_t calibration char size_t
Definition: K4aPlugin.cpp:721
std::string & StripString(std::string &str, const std::string &chars)
Definition: Helper.cpp:68
std::string ToUpper(const std::string &str)
Convert string to the upper case.
Definition: Helper.cpp:79
void Sleep(int milliseconds)
Definition: Helper.cpp:108
std::string ToLower(const std::string &str)
Convert string to the lower case.
Definition: Helper.cpp:72
std::string & LeftStripString(std::string &str, const std::string &chars)
Definition: Helper.cpp:58
size_t operator()(std::tuple< TT... > const &tt) const
Definition: Helper.h:78