9 #ifndef IFW_CTD_TOOLS_HPP_
10 #define IFW_CTD_TOOLS_HPP_
20 #include "rad/logger.hpp"
21 #include "rad/exceptions.hpp"
29 std::string
Write(
const char* format, ...);
33 #define IFW_LOCATION {\
34 std::string(__FILE__), \
35 std::string(__FUNCTION__), \
36 std::to_string(__LINE__)}
44 std::string
GenUniqueId(
const std::string& prefix =
"");
61 std::vector<TYPE>& clean_vect) {
63 for (
const TYPE& el : vect) {
65 clean_vect.insert(el);
84 std::vector<TYPE>& valid_values);
102 template <
class TYPE>
104 const std::string& separator =
"\n") {
107 std::stringstream tmp_buf;
109 for (
auto it = vector.begin(); it != vector.end(); it++, i++) {
110 tmp_buf << *it << separator;
112 return tmp_buf.str();
116 template <
class MAP_TYPE>
118 const MAP_TYPE& map) {
121 return (map.find(key) != map.end());
131 #endif // IFW_CTD_DEFINES_HPP_
std::string DumpVector(const std::vector< TYPE > &vector, const std::string &separator="\n")
Dump contents of a list into a string buffer.
Definition: tools.hpp:103
std::string GenUniqueId(const std::string &prefix)
Generate a unique UUID based ID. A prefix may be prepended, if requested.
Definition: defines.cpp:15
bool ElInMap(const std::string &key, const MAP_TYPE &map)
Check if a given key is contained in an STL map.
Definition: tools.hpp:117
std::string Write(const char *format,...)
Create formatted string, return formatted string (C formatting convention).
Definition: defines.cpp:54
void CleanVector(const std::vector< TYPE > &vect, const TYPE &pattern, std::vector< TYPE > &clean_vect)
@ brief STL like list that can be indexed with []'s.
Definition: tools.hpp:59
void IFW_DEBUG(const char *format,...)
Print out a temporary debug log. These kind of logs should be removed from the code.
Definition: defines.cpp:71
void CheckRange(const std::string &par, TYPE value, TYPE lower_limit, TYPE upper_limit)
Check if a value is within a given range.