typedef std::shared_ptr<std::vector<Person>> PersonsInfoPtr;
-// class Engine
EnginePtr Engine::create()
{
LOG_DEBUG(TAG, "create");
std::lock_guard<std::mutex> lock(g_mutex);
if (g_instance.lock()){
LOG_ERROR(TAG, "already exists");
- return EnginePtr(); // nullptr
+ return EnginePtr();
}
EnginePtr instance (new Engine());
g_instance = instance;
observer_list.clear();
}
-
void Engine::setVideoSrc(VideoSrcType type, const std::string& url)
{
reader = VideoReaderFactory::createVideoReader(type, url);
void Engine::addObserver(EngineObserver *observer)
{
+ LOG_DEBUG(TAG, "addObserver");
observer_list.insert(observer);
}
void Engine::onPersonsOut(const std::vector<Person>& p)
{
+ LOG_DEBUG(TAG, "onPersonOut");
PersonsInfoPtr pp = std::make_shared<std::vector<Person>>(p);
eventThread.enqueue(new PersonOutEventWorkItem(this->observer_list, pp));
}
void Engine::onPersonsIn(const std::vector<Person>& p)
{
+ LOG_DEBUG(TAG, "onPersonIn");
PersonsInfoPtr pp = std::make_shared<std::vector<Person>>(p);
eventThread.enqueue(new PersonInEventWorkItem(this->observer_list, pp));
}