本文整理汇总了C++中CService::load方法的典型用法代码示例。如果您正苦于以下问题:C++ CService::load方法的具体用法?C++ CService::load怎么用?C++ CService::load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CService
的用法示例。
在下文中一共展示了CService::load方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: load
Error CServiceManager::load(const Service::Uid & service)
{
LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__);
mSystemServicesMutex.lock();
tServiceSet::const_iterator it = mSystemServices.find(service);
if (mSystemServices.end() == it)
{
mSystemServicesMutex.unlock();
LOG4CPLUS_ERROR(msLogger, "hasn't found the requested service");
return Error(SERVICE_NOT_FOUND, "The service requested: " + service.value()
+ " was not found among system services, please check that it is present in " + mXmlPath, false);
}
mSystemServicesMutex.unlock();
mActiveServicesMutex.lock();
tServiceMap::const_iterator sit = mActiveServices.find(service);
if (mActiveServices.end() != sit)
{
mActiveServicesMutex.unlock();
LOG4CPLUS_ERROR(msLogger, "The requested service is among active!");
return Error(SERVICE_ALREADY_LOADED, "The service requested: " + service.value()
+ " is already loaded!", false);
}
mActiveServicesMutex.unlock();
CService * pService = new CService(mXmlPath, mAppInfo, service);
mCallbacksMutex.lock();
Error cserviceError = pService->load(mCallbacks);
if (!cserviceError.isNoError())
{
mCallbacksMutex.unlock();
LOG4CPLUS_ERROR(msLogger, "CService couldn't load the service: " + cserviceError.toString());
delete pService;
return cserviceError;
}
mCallbacksMutex.unlock();
mActiveServicesMutex.lock();
mActiveServices[service] = pService;
mActiveServicesMutex.unlock();
LOG4CPLUS_TRACE(msLogger, "Loaded a service successfully");
return Error::NoError();
}