PicoScenes API Docs
 
Loading...
Searching...
No Matches
SystemTools.hxx File Reference
#include <chrono>
#include <optional>
#include <iostream>
#include <fstream>
#include <vector>
#include <array>
#include <random>
#include <condition_variable>
#include <filesystem>
#include <type_traits>
#include <net/if.h>
#include <arpa/inet.h>
#include "BoostHeaders.hxx"
#include "LoggingService.hxx"
#include "TimeTools.hxx"
Include dependency graph for SystemTools.hxx:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  SystemTools
 
namespace  SystemTools::Shared
 
namespace  SystemTools::File
 
namespace  SystemTools::Net
 
namespace  SystemTools::Math
 
namespace  SystemTools::Persistence
 
namespace  SystemTools::Thread
 
namespace  SystemTools::Misc
 

Functions

uint32_t SystemTools::Shared::getUID ()
 
uint32_t SystemTools::Shared::getPID ()
 
uint32_t SystemTools::Shared::getParentPID ()
 
std::string SystemTools::Shared::getCurrentUserName ()
 
std::string SystemTools::Shared::getFilePathForPID (uint32_t pid)
 
std::string SystemTools::Shared::getCurrentProcessFullPath ()
 
std::string SystemTools::Shared::getCurrentCommandLineContent ()
 
std::string SystemTools::Shared::getProcessName (uint32_t pid)
 
std::string SystemTools::Shared::invokeCommandLineCommand (const std::string &cmdString, int *returnStatus=nullptr)
 
std::string SystemTools::Shared::getKernelVersion ()
 
uint8_t SystemTools::Shared::getCPUNumber ()
 
uint64_t SystemTools::Shared::getSystemFreeMemory ()
 
void SystemTools::Shared::openURLWithDefaultBrowser (const std::string &url)
 
std::string SystemTools::File::getHomeDirectory ()
 
bool SystemTools::File::checkCommandExists (const std::string &command)
 
std::vector< struct timespec > SystemTools::File::getAccessChangeModifyTimeOfFile (const std::string &file)
 
bool SystemTools::File::touchFile (const std::string &file, std::optional< struct timespec > targetTimeOrNow)
 
std::string SystemTools::File::getFileOwner (const std::string &filePath)
 
std::vector< uint8_t > SystemTools::File::readContentFromFile (const std::string &file)
 
std::string SystemTools::File::readContentFromFileAsString (const std::string &file)
 
std::vector< std::string > SystemTools::File::readContentFromFileLineByLine (const std::string &filePath)
 
void SystemTools::File::writeContent2File (const std::string &file, const uint8_t *buffer, size_t bufferLength)
 
void SystemTools::File::writeContent2File (const std::string &file, const std::string &content)
 
bool SystemTools::File::removeFile (const std::string &filePath)
 
std::vector< fs::path > SystemTools::File::listFilesWithExtension (fs::path folderPath, std::string prefix="", std::string surfix="")
 
std::vector< fs::path > SystemTools::File::listFilesRecursivelyWithExtension (fs::path folderPath, std::string prefix="", std::string surfix="")
 
template<typename ParseType >
ParseType SystemTools::File::readValueFromFilePath (const std::string &path)
 
template<typename ParseType >
int SystemTools::File::writeValue2FilePath (const std::string &path, const ParseType &value, const std::string &formatStr="{}")
 
bool SystemTools::Net::hasInternetConnection ()
 
std::tuple< bool, std::string, std::optional< TimePoint_System_Millisecond > > SystemTools::Net::checkInternetConnectionAndGetGMTTime (bool forceRefresh=false)
 
std::vector< uint8_t > SystemTools::Net::curlDownloadNoBody (const std::string &url, uint32_t timeout_ms=0, long *httpResponseCode=nullptr)
 
std::vector< uint8_t > SystemTools::Net::curlDownload (const std::string &url, uint32_t timeout_ms=0, long *httpResponseCode=nullptr)
 
std::string SystemTools::Net::curlDownloadContentAsString (const std::string &url, uint32_t timeout_ms=0, long *httpResponseCode=nullptr)
 
int SystemTools::Net::udpSendData (const std::string &sessionName, const uint8_t *data, uint32_t bufferLength, const std::string &targetIP, uint16_t targetPoint, std::optional< uint16_t > sourcePort=std::nullopt)
 
template<typename DataType >
DataType SystemTools::Math::uniformRandomNumberWithinRange (DataType min, DataType max)
 
std::string SystemTools::Persistence::boostPropertyTree2JSON (const pt::ptree &tree, bool prettyOutput=true)
 
pt::ptree SystemTools::Persistence::jSON2BoostPropertyTree (const std::string &jsonContent)
 
std::string SystemTools::Persistence::boostPropertyTree2INI (const pt::ptree &tree, bool prettyOutput=true)
 
pt::ptree SystemTools::Persistence::INI2BoostPropertyTree (const std::string &iniContent)
 
std::string SystemTools::Thread::getThreadName (uint64_t threadId)
 
void SystemTools::Thread::setThreadName (uint64_t threadId, const std::string &threadName)
 
std::string SystemTools::Thread::getCurrentThreadName ()
 
void SystemTools::Thread::setName4CurrentThread (const std::string &threadName)
 
uint64_t SystemTools::Thread::getCurrentThreadId ()
 
std::string SystemTools::Misc::getCPUGovernor ()
 
bool SystemTools::Misc::isPackageInstalled (const std::string &packageName)