11 #if defined(__GNUC__) && !defined(__clang__)
15 #include <dpsim-models/Definitions.h>
16 #include <dpsim-models/Logger.h>
21 template <
typename T> String className(T *ptr,
const String &prefix =
"CPS::") {
23 mangled =
typeid(*ptr).name();
24 #if !defined(__GNUC__) || defined(__clang__)
29 const char *unmangled;
30 unmangled = abi::__cxa_demangle(mangled, NULL, NULL, &status);
35 String ret(unmangled);
36 free((
void *)unmangled);
37 if (ret.find(prefix) == 0)
38 return ret.substr(prefix.size());
48 static Rgb gradient(
double x) {
52 Rgb c = {2.0 * x, 2.0 * (1 - x), 0.0};
63 return fmt::format(
"#{:02x}{:02x}{:02x}", (
unsigned)(r * 255),
64 (
unsigned)(g * 255), (
unsigned)(b * 255));