/[projects]/smsdaemon/Common.cpp
ViewVC logotype

Diff of /smsdaemon/Common.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 26 by torben, Mon Jun 9 18:15:53 2008 UTC revision 92 by torben, Mon Jun 16 11:30:20 2008 UTC
# Line 7  Line 7 
7  #include <sstream>  #include <sstream>
8  #include <time.h>  #include <time.h>
9    
10    #include "TaskManager.h"
11    #include "PluginManager.h"
12    
13  using namespace std;  using namespace std;
14  char* Months[] = { "", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov","Dec"};  const char* Months[] = { "", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov","Dec"};
15    
16  Common* Common::instance()  Common* Common::instance()
17  {  {
# Line 17  Common* Common::instance() Line 20  Common* Common::instance()
20  }  }
21    
22    
23    Common::Common()
24            : _pluginManager(0), _taskManager(0)
25    {
26            _pluginManager = new PluginManager();
27            _taskManager = new TaskManager();
28    }
29    
30    
31    Common::~Common()
32    {
33            if (_pluginManager)
34                    delete _pluginManager;
35    
36            if (_taskManager)
37                    delete _taskManager;
38    }
39    
40    PluginManager* Common::GetPluginManager()
41    {
42            return _pluginManager;
43    }
44    
45    TaskManager* Common::GetTaskManager()
46    {
47            return _taskManager;
48    }
49    
50  void Common::logMessage(string msg)  void Common::logMessage(string msg)
51  {        {      
52          time_t t = time(0);          time_t t = time(0);
# Line 95  void Common::loadConfig(int argc, char* Line 125  void Common::loadConfig(int argc, char*
125          if (! ( isDaemon || isDebug))          if (! ( isDaemon || isDebug))
126                  printUsage();                  printUsage();
127  }  }
128    
129    
130    std::string Common::getStatusMessage()
131    {
132            long int now = time(0);
133    
134            long int diff = now - this->daemonStart;
135    
136    
137            std::ostringstream out;
138            out << "Uptime " << diff << " seconds. ";
139            out << "Messages received:" << this->smsCounter.incomming << ". ";
140            out << "Messages sent:" << this->smsCounter.outgoing << ".";
141            
142            return out.str();
143    }

Legend:
Removed from v.26  
changed lines
  Added in v.92

  ViewVC Help
Powered by ViewVC 1.1.20