hce-node application  1.4.3
HCE Hierarchical Cluster Engine node application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
DRCEFunctionalObjectBase.hpp
Go to the documentation of this file.
1 
14 #ifndef DRCE_FUNCTIONAL_OBJECT_BASE_HPP
15 #define DRCE_FUNCTIONAL_OBJECT_BASE_HPP
16 
17 #include <Poco/Timestamp.h>
18 #include <sstream>
19 #include <iostream>
20 
21 #include "LoggerStream.hpp"
22 #include "DRCETaskRequest.hpp"
23 
24 namespace HCE
25 {
26 namespace drce
27 {
28 //-----------------------------------------------------------------------------
30 {
31 public:
33  virtual ~DRCEFunctionalObjectBase(void) {}
34 
35  void setErrorMsg(const std::string& errorMsg_) {errorMsg=errorMsg_;}
36  std::string getErrorMsg(void) const {return errorMsg;}
37 
38  void setErrorCode(unsigned int errorCode_) {errorCode=errorCode_;}
39  unsigned int getErrorCode(void) const {return errorCode;}
40 
41  void isError(bool isError_) {_isError=isError_;}
42  bool isError(void) const {return _isError;}
43 
44  void resetLogStream(void);
45  void setLogStream(std::ostream& os);
46 
47  std::string logMsg(bool isReset=true);
48  std::ostream& log(LoggerStream::Priority logPriority);
49 
50  void setLoggable(Loggable loggable);
51  void resetLoggable(void);
52 
53  void setEnvironments(const std::string& env);
54  void applyEnvironments(DRCETaskRequest* pTaskRequest);
55 
56 protected:
57  static bool insensitiveCompare(const std::string& lhs, const std::string& rhs);
58  static size_t getElapsedTimeMsec(const Poco::Timestamp& ts); // return msec
59 protected:
60  std::string errorMsg;
61  unsigned int errorCode;
62  bool _isError;
63 
65 
66  std::vector<std::pair<std::string, std::string> > environments;
67 };
68 //-----------------------------------------------------------------------------
69 //-----------------------------------------------------------------------------
70 } // namespace drce
71 } // namespace HCE
72 
73 #endif // DRCE_FUNCTIONAL_OBJECT_BASE_HPP