17 #ifndef GLOBALBPILIB_HPP_ 18 #define GLOBALBPILIB_HPP_ 21 #include "include/json.hpp" 29 #define GEN_BUFFERSIZE 4096 33 #define SOCKETTYPE ST_RAW 44 std::stringstream _localStringStream;
62 std::stringstream _localStringStream;
84 static std::string getConfig(std::string jsonFilePath, std::string attribute);
85 static bool setConfig(std::string jsonFilePath, std::string attribute, std::string value);
86 static nlohmann::json readJsonFile(std::string pathToFile);
87 static void writeJsonFile(nlohmann::json json, std::string pathToFile);
88 static bool deleteConfig(std::string pathToFile, std::string attribute);
100 beg_(clock_::now()) {
103 beg_ = clock_::now();
105 double elapsed()
const {
106 return std::chrono::duration_cast<std::chrono::microseconds>(clock_::now() - beg_).count();
110 typedef std::chrono::high_resolution_clock clock_;
111 std::chrono::time_point<clock_> beg_;
114 static std::string bpiName =
"------";
115 static std::vector<int> childs;
118 std::string bpiGetName();
123 void bpiSystemCall(std::string cmd,
int (*printFct)(std::string) =
nullptr,
int (*printErrFct)(std::string) =
nullptr);
124 void bpiSystemCall2(std::string cmd,
int (*printFct)(std::string) =
nullptr,
int (*printErrFct)(std::string) =
nullptr, std::string cmdId =
"");
129 std::string
bpiConfirm(std::string command, std::string optional);
130 bool readInputFromStdin(std::string* s,
int bufsize = BUFSIZ);
135 std::string macToString(
int len,
char* mac);
136 double getCurrentCpuUsage();
void bpiSystemCall2(std::string cmd, int(*printFct)(std::string)=nullptr, int(*printErrFct)(std::string)=nullptr, std::string cmdId="")
Definition: GlobalBpiLib.cpp:248
Custom bpi printer class.
Definition: GlobalBpiLib.hpp:41
Custom debug printer class.
Definition: GlobalBpiLib.hpp:59
std::string createStatCtrlMessage(int argc,...)
Definition: GlobalBpiLib.cpp:399
std::string bpiGetNamestamp(std::string name)
Definition: GlobalBpiLib.cpp:317
std::string bpiGetNamestampErr(std::string name)
Definition: GlobalBpiLib.cpp:323
int readFromFileDescriptor(int fileDescriptor, std::string &data, int buffersize)
Definition: GlobalBpiLib.cpp:352
void bpiSystemCall(std::string cmd, int(*printFct)(std::string)=nullptr, int(*printErrFct)(std::string)=nullptr)
Definition: GlobalBpiLib.cpp:216
bool deregisterChild(int pid)
Definition: GlobalBpiLib.cpp:197
std::vector< std::string > bpiSplitIntoItems(std::string str, char delimiter)
std::string bpiTimestamp()
Definition: GlobalBpiLib.cpp:287
void bpiSetName(std::string name)
Definition: GlobalBpiLib.cpp:180
void sigtermHandler(int signum)
Definition: GlobalBpiLib.cpp:363
std::string createCtrlMessage(int argc,...)
Definition: GlobalBpiLib.cpp:377
friend BpiOutStream & operator<<(BpiOutStream &bout, std::string s)
Definition: GlobalBpiLib.cpp:118
BpiOutStream(std::ostream &os)
Definition: GlobalBpiLib.cpp:111
std::string bpiConfirm(std::string command, std::string optional)
Definition: GlobalBpiLib.cpp:329
Interface between the application and a local stored json file.
Definition: GlobalBpiLib.hpp:80
bool registerChild(int pid)
Definition: GlobalBpiLib.cpp:188
virtual ~BpiOutStream()
Definition: GlobalBpiLib.cpp:115
Simple timer with µs precision.
Definition: GlobalBpiLib.hpp:97
std::vector< int > getAllChilds()
Definition: GlobalBpiLib.cpp:206
int writeToFileDescriptor(int fileDescriptor, std::string data)
Definition: GlobalBpiLib.cpp:347