comments...

Change-Id: I1e2ab316114c4a21a10fe710a168f38b47f458f1
diff --git a/src/detail/ndncert-common.cpp b/src/detail/ndncert-common.cpp
index 1915082..0c7c033 100644
--- a/src/detail/ndncert-common.cpp
+++ b/src/detail/ndncert-common.cpp
@@ -23,34 +23,36 @@
 namespace ndn {
 namespace ndncert {
 
-const std::map<ErrorCode, std::string> errorCodeText = {
-  {ErrorCode::NO_ERROR,             "NO_ERROR"},
-  {ErrorCode::BAD_INTEREST_FORMAT,  "BAD_INTEREST_FORMAT"},
-  {ErrorCode::BAD_PARAMETER_FORMAT, "BAD_PARAMETER_FORMAT"},
-  {ErrorCode::BAD_SIGNATURE,        "BAD_SIGNATURE"},
-  {ErrorCode::INVALID_PARAMETER,    "INVALID_PARAMETER"},
-  {ErrorCode::NAME_NOT_ALLOWED,     "NAME_NOT_ALLOWED"},
-  {ErrorCode::BAD_VALIDITY_PERIOD,  "BAD_VALIDITY_PERIOD"},
-  {ErrorCode::OUT_OF_TRIES,         "OUT_OF_TRIES"},
-  {ErrorCode::OUT_OF_TIME,          "OUT_OF_TIME"},
-  {ErrorCode::NO_AVAILABLE_NAMES,   "NO_AVAILABLE_NAMES"}
-};
-
-const std::map<RequestType, std::string> requestTypeText = {
-  {RequestType::NEW, "New"},
-  {RequestType::RENEW, "Renew"},
-  {RequestType::REVOKE, "Revoke"},
-  {RequestType::NOTINITIALIZED, "Not Initialized"},
-};
-
-std::string errorCodeToString(ErrorCode code)
+std::ostream&
+operator<<(std::ostream& out, ErrorCode code)
 {
-  return errorCodeText.at(code);
+  switch (code) {
+    case ErrorCode::NO_ERROR: out << "NO_ERROR"; break;
+    case ErrorCode::BAD_INTEREST_FORMAT: out << "BAD_INTEREST_FORMAT"; break;
+    case ErrorCode::BAD_PARAMETER_FORMAT: out << "BAD_PARAMETER_FORMAT"; break;
+    case ErrorCode::BAD_SIGNATURE: out << "BAD_SIGNATURE"; break;
+    case ErrorCode::INVALID_PARAMETER: out << "INVALID_PARAMETER"; break;
+    case ErrorCode::NAME_NOT_ALLOWED: out << "NAME_NOT_ALLOWED"; break;
+    case ErrorCode::BAD_VALIDITY_PERIOD: out << "BAD_VALIDITY_PERIOD"; break;
+    case ErrorCode::OUT_OF_TRIES: out << "OUT_OF_TRIES"; break;
+    case ErrorCode::OUT_OF_TIME: out << "OUT_OF_TIME"; break;
+    case ErrorCode::NO_AVAILABLE_NAMES: out << "NO_AVAILABLE_NAMES"; break;
+    default: out << "UNKNOWN_ERROR"; break;
+  }
+  return out;
 }
 
-std::string requestTypeToString(RequestType type)
+std::ostream&
+operator<<(std::ostream& out, RequestType type)
 {
-  return requestTypeText.at(type);
+  switch(type) {
+    case RequestType::NEW: out << "New"; break;
+    case RequestType::RENEW: out << "Renew"; break;
+    case RequestType::REVOKE: out << "Revoke"; break;
+    case RequestType::NOTINITIALIZED: out << "Not Initialized"; break;
+    default: out << "UNKNOWN_REQUEST_TYPE"; break;
+  }
+  return out;
 }
 
 } // namespace ndncert
diff --git a/src/detail/ndncert-common.hpp b/src/detail/ndncert-common.hpp
index 5805f74..1773bf9 100644
--- a/src/detail/ndncert-common.hpp
+++ b/src/detail/ndncert-common.hpp
@@ -97,7 +97,7 @@
 typedef boost::property_tree::ptree JsonSection;
 
 // NDNCERT error code
-enum class ErrorCode : uint16_t {
+enum class ErrorCode : uint64_t {
   NO_ERROR = 0,
   BAD_INTEREST_FORMAT = 1,
   BAD_PARAMETER_FORMAT = 2,
@@ -111,11 +111,11 @@
 };
 
 // Convert error code to string
-std::string
-errorCodeToString(ErrorCode code);
+std::ostream&
+operator<<(std::ostream& os, ErrorCode code);
 
 // NDNCERT request type
-enum class RequestType : uint16_t {
+enum class RequestType : uint64_t {
   NOTINITIALIZED = 0,
   NEW = 1,
   RENEW = 2,
@@ -123,8 +123,8 @@
 };
 
 // Convert request type to string
-std::string
-requestTypeToString(RequestType type);
+std::ostream&
+operator<<(std::ostream& out, RequestType type);
 
 } // namespace ndncert
 } // namespace ndn
diff --git a/src/requester.cpp b/src/requester.cpp
index 737d0cc..710780a 100644
--- a/src/requester.cpp
+++ b/src/requester.cpp
@@ -34,6 +34,7 @@
 #include <ndn-cxx/util/io.hpp>
 #include <ndn-cxx/util/random.hpp>
 #include <ndn-cxx/metadata-object.hpp>
+#include <boost/lexical_cast.hpp>
 
 namespace ndn {
 namespace ndncert {
@@ -313,10 +314,10 @@
     return;
   }
   NDN_LOG_ERROR("Error info replied from the CA with Error code: " +
-            errorCodeToString(std::get<0>(errorInfo)) +
+            boost::lexical_cast<std::string>(std::get<0>(errorInfo)) +
             " and Error Info: " + std::get<1>(errorInfo));
   NDN_THROW(std::runtime_error("Error info replied from the CA with Error code: " +
-                                           errorCodeToString(std::get<0>(errorInfo)) +
+                                       boost::lexical_cast<std::string>(std::get<0>(errorInfo)) +
                                            " and Error Info: " + std::get<1>(errorInfo)));
 }