Files
ANSCORE/modules/ANSMOT/ANSMOT.cpp

36 lines
1.3 KiB
C++

#include "ANSMOT.h"
static bool ansmotLicenceValid = false;
// Global once_flag to protect license checking
static std::once_flag ansmotLicenseOnceFlag;
namespace ANSCENTER {
static void VerifyGlobalANSMOTLicense(const std::string& licenseKey) {
try {
ansmotLicenceValid = ANSCENTER::ANSLicenseHelper::LicenseVerification(licenseKey, 1002, "ODHUB-LV");
if (!ansmotLicenceValid) {
ansmotLicenceValid = ANSCENTER::ANSLicenseHelper::LicenseVerification(licenseKey, 1007, "ANSCV");
}
}
catch (std::exception& e) {
ansmotLicenceValid = false;
}
}
void ANSMOT::CheckLicense() {
try {
// Check once globally
std::call_once(ansmotLicenseOnceFlag, [this]() {
VerifyGlobalANSMOTLicense(_licenseKey);
});
// Update this instance's local license flag
_licenseValid = ansmotLicenceValid;
}
catch (const std::exception& e) {
this->_logger.LogFatal("ANSMOT::CheckLicense. Error:", e.what(), __FILE__, __LINE__);
}
}
bool ANSMOT::UpdateParameters(const std::string& trackerParameters) { return true; }
std::string ANSMOT::Update(int modelId, const std::string& detectionData) { return "";}
std::vector<TrackerObject> ANSMOT::UpdateTracker(int modelId, const std::vector<TrackerObject>& detectionObjects) { return std::vector<TrackerObject>(); }
ANSMOT::~ANSMOT() { }
}