src/plugin.c: Introduce the `DS_TYPE_TO_STRING' macro.
[collectd.git] / src / plugin.h
index 0ccb198..b35fcf1 100644 (file)
 #define DS_TYPE_DERIVE   2
 #define DS_TYPE_ABSOLUTE 3
 
+#define DS_TYPE_TO_STRING(t) (t == DS_TYPE_COUNTER)     ? "counter"  : \
+                               (t == DS_TYPE_GAUGE)    ? "gauge"    : \
+                               (t == DS_TYPE_DERIVE)   ? "derive"   : \
+                               (t == DS_TYPE_ABSOLUTE) ? "absolute" : \
+                               "unknown"
+
+
 #ifndef LOG_ERR
 # define LOG_ERR 3
 #endif