Covalent Bond  0.0.1-alpha
'covalent bond' is a data middle office. As a 2022-2023 Fall SWE final project.
liveThread.hpp
Go to the documentation of this file.
1 #ifndef __SERVER_LIVE_THREAD_HPP_
2 #define __SERVER_LIVE_THREAD_HPP_
3 
4 #ifdef _WIN32
5 #if _MSC_VER > 1000
6 #pragma once
7 #endif
8 #endif
9 
10 #if defined(__unix__) && defined(__clang__)
11 #pragma once
12 #endif
13 
14 #include "sysStatus.hpp"
15 #include "trivial/cfgIO.hpp"
16 
17 class frontThread {
18  public:
19  frontThread(unsigned short httpServerPort, const std::string& name, const std::string& describe)
20  : m_httpServerPort(httpServerPort) {
21  // init all infos
25  strcpy(m_cacheFile.name, name.c_str());
26  strcpy(m_cacheFile.describe, describe.c_str());
27  // create files. store lock. creat html if not exists
29  if (access("./index.html", F_OK)) {
30  std::ofstream fp("./index.html");
31  fp << "<html>Hello World!</html>";
32  fp.close();
33  }
34  }
35 
36  virtual void exec();
37 
38  private:
39  unsigned short m_httpServerPort = 8888;
42 };
43 
44 class daemonThread {};
45 
46 #endif //! __SERVER_LIVE_THREAD_HPP_
frontThread::m_sysInfo
cb::utils::sysInfo m_sysInfo
Definition: liveThread.hpp:40
daemonThread
Definition: liveThread.hpp:44
trivial::cacheFile::name
char name[CFG_CHAR_NUMS]
Definition: cfgIO.hpp:34
frontThread
_WIN32
Definition: liveThread.hpp:17
trivial::cacheFile::osInfo
char osInfo[CFG_CHAR_NUMS_DOUBLE]
Definition: cfgIO.hpp:36
frontThread::frontThread
frontThread(unsigned short httpServerPort, const std::string &name, const std::string &describe)
Definition: liveThread.hpp:19
frontThread::m_cacheFile
trivial::cacheFile m_cacheFile
Definition: liveThread.hpp:41
trivial::cacheFile
Definition: cfgIO.hpp:32
frontThread::m_httpServerPort
unsigned short m_httpServerPort
Definition: liveThread.hpp:39
trivial::cacheFile::describe
char describe[CFG_CHAR_NUMS]
Definition: cfgIO.hpp:35
cb::utils::getOsInfo
void getOsInfo(sysInfo &si)
Definition: sysStatus.cpp:17
trivial::writeCacheFileBinary
bool writeCacheFileBinary(const cacheFile &cf)
Definition: cfgIO.cpp:5
cb::utils::sysInfo
Definition: sysStatus.hpp:36
cfgIO.hpp
Manage all config file. Write to Binary.
frontThread::exec
virtual void exec()
Definition: liveThread.cpp:14
cb::utils::sysInfo::m_osInfo
char m_osInfo[__DESCRIBE_CHAR_MAX_NUMS_DOUBLE]
Definition: sysStatus.hpp:39
cb::utils::getMemoryInfo
void getMemoryInfo(sysInfo &si)
Definition: sysStatus.cpp:6
sysStatus.hpp
utils/sysStatus.hpp ... To get the infomation of system. For both windows and unix....