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
DRCEFunctionalObjectBase.cpp
Go to the documentation of this file.
1 #include <algorithm>
2 #include <ctype.h>
3 
5 #include "DRCEError.hpp"
6 
7 namespace HCE
8 {
9 namespace drce
10 {
11 //-----------------------------------------------------------------------------
13 :errorMsg(""), errorCode(NO_ERROR), _isError(false), logger()
14 {
15 }
16 //-----------------------------------------------------------------------------
18 {
20 }
21 //-----------------------------------------------------------------------------
23 {
24  logger.setLogStream(os);
25 }
26 //-----------------------------------------------------------------------------
27 std::string DRCEFunctionalObjectBase::logMsg(bool isReset)
28 {
29  return logger.logMsg(isReset);
30 }
31 //-----------------------------------------------------------------------------
32 std::ostream& DRCEFunctionalObjectBase::log(void)
33 {
34  return logger.log();
35 }
36 //-----------------------------------------------------------------------------
38 {
39  logger.setLoggable(loggable);
40 }
41 //-----------------------------------------------------------------------------
43 {
45 }
46 //-----------------------------------------------------------------------------
47 //-----------------------------------------------------------------------------
48 bool DRCEFunctionalObjectBase::insensitiveCompare(const std::string& lhs, const std::string& rhs)
49 {
50  std::string lhsCpy(lhs);
51  std::string rhsCpy(rhs);
52  std::transform(lhsCpy.begin(), lhsCpy.end(), lhsCpy.begin(), tolower);
53  std::transform(rhsCpy.begin(), rhsCpy.end(), rhsCpy.begin(), tolower);
54  return (lhsCpy == rhsCpy);
55 }
56 //-------------------------------------------------------------------
57 size_t DRCEFunctionalObjectBase::getElapsedTimeMsec(const Poco::Timestamp& tsStart)
58 {
59  Poco::Timestamp tsStop;
60  Poco::Timestamp::TimeDiff diff = tsStop-tsStart;
61  return static_cast<size_t>(diff/1000);
62 }
63 //-----------------------------------------------------------------------------
64 //-----------------------------------------------------------------------------
65 } // namespace drce
66 } // namespace HCE