31 template <
typename TT>
33 size_t operator()(TT
const& tt)
const {
return std::hash<TT>()(tt); }
39 inline void hash_combine(
std::size_t& hash_seed, T
const& v) {
40 hash_seed ^= std::hash<T>()(v) + 0x9e3779b9 + (hash_seed << 6) +
44 template <class Tuple, size_t Index = std::tuple_size<Tuple>::value - 1>
45 struct HashValueImpl {
46 static void apply(
size_t& hash_seed, Tuple
const& tuple) {
47 HashValueImpl<Tuple, Index - 1>::apply(hash_seed, tuple);
48 hash_combine(hash_seed, std::get<Index>(tuple));
52 template <
class Tuple>
53 struct HashValueImpl<Tuple, 0> {
54 static void apply(
size_t& hash_seed, Tuple
const& tuple) {
55 hash_combine(hash_seed, std::get<0>(tuple));
61 template <
typename... TT>
65 HashValueImpl<std::tuple<TT...>>::apply(hash_seed, tt);
74 for (
int i = 0; i < (
int)matrix.size(); i++) {
75 auto elem = *(matrix.data() + i);
76 hash_seed ^= std::hash<typename T::Scalar>()(elem) + 0x9e3779b9 +
77 (hash_seed << 6) + (hash_seed >> 2);
94 std::vector<std::string>
SplitString(
const std::string& str,
95 const std::string& delimiters =
" ",
96 bool trim_empty_str =
true);
101 bool ContainsString(
const std::string& src,
const std::string& dst);
111 bool StringEndsWith(
const std::string& src,
const std::string& tar);
113 std::string
JoinStrings(
const std::vector<std::string>& strs,
114 const std::string& delimiter =
", ");
121 const std::string& valid_chars =
"_");
124 const std::string& chars =
"\t\n\v\f\r ");
127 const std::string& chars =
"\t\n\v\f\r ");
132 const std::string& chars =
"\t\n\v\f\r ");
135 std::string
ToLower(
const std::string& s);
138 std::string
ToUpper(
const std::string& s);
141 template <
typename... Args>
143 int size_s = std::snprintf(
nullptr, 0,
format.c_str(), args...) +
146 throw std::runtime_error(
"Error during formatting.");
148 auto size =
static_cast<size_t>(size_s);
149 auto buf = std::make_unique<char[]>(
size);
150 std::snprintf(buf.get(),
size,
format.c_str(), args...);
151 return std::string(buf.get(),
152 buf.get() +
size - 1);
155 void Sleep(
int milliseconds);
159 div_t tmp = std::div(x, y);
160 return tmp.quot + (tmp.rem != 0 ? 1 : 0);
filament::Texture::InternalFormat format
Definition: FilamentResourceManager.cpp:195
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:719
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:474
int DivUp(int x, int y)
Computes the quotient of x/y with rounding up.
Definition: Helper.h:158
std::string ToLower(const std::string &str)
Convert string to the lower case.
Definition: Helper.cpp:83
bool ContainsString(const std::string &src, const std::string &dst)
Definition: Helper.cpp:42
bool StringEndsWith(const std::string &src, const std::string &tar)
Definition: Helper.cpp:51
void Sleep(int milliseconds)
Definition: Helper.cpp:119
std::string GetCurrentTimeStamp()
Returns current time stamp.
Definition: Helper.cpp:127
std::string JoinStrings(const std::vector< std::string > &strs, const std::string &delimiter)
Definition: Helper.cpp:57
std::string & LeftStripString(std::string &str, const std::string &chars)
Definition: Helper.cpp:69
std::string & RightStripString(std::string &str, const std::string &chars)
Definition: Helper.cpp:74
bool StringStartsWith(const std::string &src, const std::string &tar)
Definition: Helper.cpp:46
std::string & StripString(std::string &str, const std::string &chars)
Definition: Helper.cpp:79
std::string ToUpper(const std::string &str)
Convert string to the upper case.
Definition: Helper.cpp:90
std::string FormatString(const std::string &format, Args... args)
Format string.
Definition: Helper.h:142
std::vector< std::string > SplitString(const std::string &str, const std::string &delimiters, bool trim_empty_str)
Definition: Helper.cpp:26
size_t WordLength(const std::string &doc, size_t start_pos, const std::string &valid_chars)
Definition: Helper.cpp:98
Definition: PinholeCameraIntrinsic.cpp:16
std::size_t operator()(T const &matrix) const
Definition: Helper.h:72
std::size_t operator()(T t) const
Definition: Helper.h:87
size_t operator()(std::tuple< TT... > const &tt) const
Definition: Helper.h:63
size_t operator()(TT const &tt) const
Definition: Helper.h:33