From 9d17be67b360b1d943a5a53f8e7efd23403ebc32 Mon Sep 17 00:00:00 2001
From: Jan David Mol <mol@astron.nl>
Date: Tue, 13 Mar 2012 14:55:34 +0000
Subject: [PATCH] Task #3128: Provide CN_Command -> string conversion

---
 RTCP/Interface/include/Interface/CN_Command.h | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/RTCP/Interface/include/Interface/CN_Command.h b/RTCP/Interface/include/Interface/CN_Command.h
index b64b7181bc3..c5bb034e9bc 100644
--- a/RTCP/Interface/include/Interface/CN_Command.h
+++ b/RTCP/Interface/include/Interface/CN_Command.h
@@ -24,6 +24,7 @@
 #define LOFAR_INTERFACE_CN_COMMAND_H
 
 #include <Stream/Stream.h>
+#include <string>
 
 
 namespace LOFAR {
@@ -48,6 +49,8 @@ class CN_Command
     void	 read(Stream *);
     void	 write(Stream *) const;
 
+    std::string  name() const;
+
   private:
     struct MarshalledData
     {
@@ -87,6 +90,18 @@ inline void CN_Command::write(Stream *str) const
   str->write(&itsMarshalledData, sizeof itsMarshalledData);
 }
 
+inline std::string CN_Command::name() const
+{
+  switch(itsMarshalledData.value) {
+    case PREPROCESS:  return "PREPROCESS";
+    case PROCESS:     return "PROCESS";
+    case POSTPROCESS: return "POSTPROCESS";
+    case STOP:        return "STOP";
+  }
+
+  return "BAD COMMAND";
+}
+
 
 } // namespace RTCP
 } // namespace LOFAR
-- 
GitLab