void ServiceListeners::AddServiceListener(ModuleContext* mc, const ServiceListenerEntry::ServiceListener& listener, void* data, const std::string& filter) { US_UNUSED(Lock(this)); ServiceListenerEntry sle(mc, listener, data, filter); RemoveServiceListener_unlocked(sle); serviceSet.insert(sle); coreCtx->serviceHooks.HandleServiceListenerReg(sle); CheckSimple(sle); }
void ServiceListeners::AddServiceListener(ModuleContext* mc, const ServiceListenerEntry::ServiceListener& listener, void* data, const std::string& filter) { MutexLocker lock(mutex); ServiceListenerEntry sle(mc->GetModule(), listener, data, filter); if (serviceSet.find(sle) != serviceSet.end()) { RemoveServiceListener_unlocked(sle); } serviceSet.insert(sle); CheckSimple(sle); }
SyncLogEntry SyncLogger::ReadEntry(cfg_t* pEntryCFG) { // Assures that the section has been found, which means there is at least one section. assert(pEntryCFG != NULL); // TODO: Copy values string strModType = cfg_getstr(pEntryCFG, MOD_TYPE_VARNAME); if (strModType.length() != 1) { // The log entry does not meet the standard. throw OFSException("The log entry does not meet the standard", 1); } int nModNumber = atoi(cfg_title(pEntryCFG)); SyncLogEntry sle(cfg_getstr(pEntryCFG, FILE_PATH_VARNAME), cfg_getstr(pEntryCFG, MOD_TIME_VARNAME), strModType.c_str()[0], nModNumber); return sle; }
ListenerToken ServiceListeners::AddServiceListener(const std::shared_ptr<BundleContextPrivate>& context, const ServiceListener& listener, void* data, const std::string& filter) { // The following condition is true only if the listener is a non-static member function. // If so, the existing listener is replaced with the new listener. if (data != nullptr) { RemoveServiceListener(context, ListenerTokenId(0), listener, data); } auto token = MakeListenerToken(); ServiceListenerEntry sle(context, listener, data, token.Id(), filter); { auto l = this->Lock(); US_UNUSED(l); serviceSet.insert(sle); CheckSimple_unlocked(sle); } coreCtx->serviceHooks.HandleServiceListenerReg(sle); return token; }
rPonto SegmentoBasico::intercecao(const RetanguloBasico &r) const { float mix = m_ini.x(), miy = m_ini.y(), mfx = m_fim.x(), mfy = m_fim.y(); SegmentoBasico si(r.pontoInferiorEsquerdo(), r.pontoInferiorDireito()), ss(r.pontoSuperiorEsquerdo(), r.pontoSuperiorDireito()), sle(r.pontoSuperiorEsquerdo(),r.pontoInferiorEsquerdo()), sld(r.pontoSuperiorDireito() , r.pontoInferiorDireito()); float s; s = intercecaoS(si); if(s >= 0.f && s <= 1.f) { cout << "OK si" << endl; return rPonto(mix + (mfx-mix)*s, miy + (mfy-miy)*s); } s = intercecaoS(ss); if(s >= 0.f && s <= 1.f) { cout << "OK ss" << endl; return rPonto(mix + (mfx-mix)*s, miy + (mfy-miy)*s); } s = intercecaoS(sle); if(s >= 0.f && s <= 1.f) { cout << "OK sle" << endl; return rPonto(mix + (mfx-mix)*s, miy + (mfy-miy)*s); } s = intercecaoS(sld); if(s >= 0.f && s <= 1.f) { cout << "OK sld" << endl; return rPonto(mix + (mfx-mix)*s, miy + (mfy-miy)*s); } return rPonto(0,0); }