HCE project C++ developers source code library  1.1.1
HCE project developer library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ReducingOutputMessageBuilder.cpp
Go to the documentation of this file.
2 
3 namespace HCE
4 {
5 namespace reduce
6 {
7 
8 using namespace Poco;
9 using namespace reduce_types;
10 using namespace std;
11 
12 ReducingOutputMessageBuilder::ReducingOutputMessageBuilder
13  (const SharedPtr<ReducingExceptionsTranslatorIf>& reducingExceptionsTranslator)
14 {
15  this->_reducingExceptionsTranslator = reducingExceptionsTranslator;
16 }
17 
19 {
20 }
21 
22 SharedPtr<ReducingOutputMessage> ReducingOutputMessageBuilder::build(
23  const types::MessageType& msgType, const int ttl, const string& json)
24 {
25  int errCode = 0;
26  string errMsg = "";
27  int elapsedTime = 0;
28  SharedPtr<ReducingOutputMessage> buildMessage(new ReducingOutputMessage
29  (msgType, ttl, json, errCode, errMsg, elapsedTime));
30  return buildMessage;
31 }
32 
33 SharedPtr<ReducingOutputMessage> ReducingOutputMessageBuilder::
35 {
36  string emptyJSON = "";
37  int ttl = 0;
38  int elapsedTime = 0;
39  int errCode = _reducingExceptionsTranslator->translateToErrorCode(e);
40  string errMsg = _reducingExceptionsTranslator->translateToErrorMsg(e);
41 
42  SharedPtr<ReducingOutputMessage> buildMessage(new ReducingOutputMessage
43  (HCE::types::MessageType::mtNull, ttl, emptyJSON, errCode, errMsg, elapsedTime));
44  return buildMessage;
45 }
46 
47 }
48 }