text: /****************************************************************************
   * Generated by Hottentot CC Generator
   * Date: 07-05-2016 11:20:04
   * Name: transport_monitor_service_request_handler.cc
   * Description:
   *   This file contains implementation of service's request handler class.
   ****************************************************************************/
   
  #include <string.h>
  
  #include <org/labcrypto/hottentot/runtime/request.h>
  #include <org/labcrypto/hottentot/runtime/response.h>
  
  #include "transport_monitor_service_request_handler.h"
  #include "abstract_transport_monitor_service.h"
  #include "transport_monitor_service.h"
  #include "../enqueue_report.h"
  #include "../transport_message.h"
  
  
  namespace org {
  namespace labcrypto {
  namespace fence {
  namespace transport {
  namespace service {
    void 
    TransportMonitorServiceRequestHandler::HandleRequest(::org::labcrypto::hottentot::runtime::Request &request, ::org::labcrypto::hottentot::runtime::Response &response) {
      if (request.GetMethodId() == 2020316629) {
        ::org::labcrypto::fence::transport::service::AbstractTransportMonitorService *serviceObject = 
          dynamic_cast< ::org::labcrypto::fence::transport::service::AbstractTransportMonitorService*>(service_);
        /*
         * Deserialization and making input variables
         */
        /*
         * Calling service method
         */
        ::org::labcrypto::hottentot::runtime::service::HotContext hotContext;
        
        ::org::labcrypto::hottentot::Utf8String result;
        try {
          serviceObject->GetCurrentStat(result, hotContext);
        } catch (std::exception &e) {
          hotContext.SetFaultyResponse(e.what(), 50);
        } catch (...) {
          hotContext.SetFaultyResponse("Unknown server side exception.", 51);
        }
        /*
         * Serializiation of returned object
         */
        unsigned char *serializedData = 0;
        uint32_t serializedDataLength = 0;
        if (hotContext.GetResponseStatusCode() == 0) {
          serializedData = result.Serialize(&serializedDataLength);
        } else {
          ::org::labcrypto::hottentot::Utf8String faultMessage(hotContext.GetFaultMessage());
          serializedData = faultMessage.Serialize(&serializedDataLength);
        }
        response.SetStatusCode(hotContext.GetResponseStatusCode());
        response.SetData(serializedData);
        response.SetDataLength(serializedDataLength);
        return;
      }
      char errorMessage[] = "Method not found.";
      response.SetStatusCode(1);
      response.SetData((unsigned char*)errorMessage);
      response.SetDataLength(strlen(errorMessage));
    }
  } // END OF NAMESPACE service
  } // END OF NAMESPACE transport
  } // END OF NAMESPACE fence
  } // END OF NAMESPACE labcrypto
  } // END OF NAMESPACE org