diff options
| author | Manuel Traut <manut@mecka.net> | 2012-06-08 00:46:23 +0200 |
|---|---|---|
| committer | Manuel Traut <manut@mecka.net> | 2012-06-08 00:46:23 +0200 |
| commit | 97ce56cf5fa7d6f618eed4020dd7f98405740290 (patch) | |
| tree | 6580354c5c048bbdb9a6765d066760b3900e19e4 | |
| parent | 52eb7064463da8d6aadd7f8669cd675c20bc317c (diff) | |
libdistrio_common: add helper for creating/filling Distrio::Error
can be used after return ...
Signed-off-by: Manuel Traut <manut@mecka.net>
| -rw-r--r-- | common/distrio_error.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/common/distrio_error.h b/common/distrio_error.h index 67ec5ea..36b6c93 100644 --- a/common/distrio_error.h +++ b/common/distrio_error.h @@ -9,6 +9,26 @@ #include <time.h> +inline Distrio::Error *distrio_error (::Distrio::Error_code code, + ::Distrio::Error_level level, + long module_id, + std::string description) +{ + struct timespec ts; + Distrio::Error *e = new Distrio::Error; + + clock_gettime (CLOCK_REALTIME, &ts); + + e->code = code; + e->level = level; + e->time.seconds = ts.tv_sec; + e->time.nanoseconds = ts.tv_nsec; + e->module_id = module_id; + e->description = CORBA::string_dup (description.c_str ()); + + return e; +} + inline Distrio::Error *distrio_success (void) { struct timespec ts; Distrio::Error *e = new Distrio::Error; |
