summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManuel Traut <manut@mecka.net>2012-06-03 18:37:31 +0200
committerManuel Traut <manut@mecka.net>2012-06-03 18:37:31 +0200
commit539deb398f598acbe12b188b65a047c62f8157fb (patch)
treef1682e0f5322d6e1a8be68d5a55ffc980af8eec9
parent1650c22d9f6bcd791a17dc98fb8d9665e8faebcb (diff)
libdistrio_common: error helper - add distrio prefix
- bugfix: won't compile without specifying correct namespace Signed-off-by: Manuel Traut <manut@mecka.net>
-rw-r--r--common/distrio_error.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/common/distrio_error.h b/common/distrio_error.h
new file mode 100644
index 0000000..67ec5ea
--- /dev/null
+++ b/common/distrio_error.h
@@ -0,0 +1,26 @@
+/**
+ * distrio error helper
+ *
+ * - inline functions to ease handling of Distrio::Error
+ *
+ * @author Manuel Traut <manut@mecka.net>
+ * @licence GPLv2
+ */
+
+#include <time.h>
+
+inline Distrio::Error *distrio_success (void) {
+ struct timespec ts;
+ Distrio::Error *e = new Distrio::Error;
+
+ clock_gettime (CLOCK_REALTIME, &ts);
+
+ e->code = Distrio::SUCCESS;
+ e->level = Distrio::L_DEBUG;
+ e->time.seconds = ts.tv_sec;
+ e->time.nanoseconds = ts.tv_nsec;
+ e->module_id = 0;
+ e->description = CORBA::string_dup (__func__);
+
+ return e;
+}