FileMonitorPtr FileMonitor::Create(){ if (sMonitor.expired()){ FileMonitorPtr p(new FileMonitor, [](FileMonitor* obj){ delete obj; }); sMonitor = p; return p; } return sMonitor.lock(); }
bool FileMonitor::HasInstance(){ return !sMonitor.expired(); }
FileMonitor& FileMonitor::GetInstance(){ if (sMonitor.expired()){ Logger::Log(FB_ERROR_LOG_ARG, "FileMonitor is deleted. Program will crash..."); } return *sMonitorRaw; }