当前位置: 首页>>代码示例>>C++>>正文


C++ CService::HaveAbility方法代码示例

本文整理汇总了C++中CService::HaveAbility方法的典型用法代码示例。如果您正苦于以下问题:C++ CService::HaveAbility方法的具体用法?C++ CService::HaveAbility怎么用?C++ CService::HaveAbility使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CService的用法示例。


在下文中一共展示了CService::HaveAbility方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OnInitialize


//.........这里部分代码省略.........
							bInitializeMdbDataSource = true;
						}
					}
					if(bConfigMdbDomain && !m_pRepItf->RegisterMdbTransfer())
						return false;
				}
			}
		}

		//Create Remote Memory Database
		if(pConfigSystem->OpenConfig(oAccess, "RemoteMdb", true))
		{
			CString oServerAddr;
			uint32 nServerPort;
			const char* sDbList;
			oAccess.OpenIdxVal();
			while(oAccess.Query())
			{
				sVal = oAccess.GetVal("ServerPort", nLength);
				if(!sVal || sVal[nLength-1])
				{
					FocpLog(FOCP_LOG_ERROR, ("The config 'RemoteMdb.ServerPort' is invalid"));
					return false;
				}
				nServerPort = CString::Atoi(sVal);
				if(!nServerPort || nServerPort > 65535)
				{
					FocpLog(FOCP_LOG_ERROR, ("The config 'RemoteMdb.ServerPort' is invalid"));
					return false;
				}
				sVal = oAccess.GetVal("ServerAddr", nLength);
				if(!sVal || !sVal[0] || sVal[nLength-1])
				{
					FocpLog(FOCP_LOG_ERROR, ("The config 'RemoteMdb.ServerAddr' is invalid"));
					return false;
				}
				oServerAddr = sVal;
				sVal = oAccess.GetVal("MdbList", nLength);
				if(sVal && sVal[nLength-1])
				{
					FocpLog(FOCP_LOG_ERROR, ("The config 'RemoteMdb.MdbList' is invalid"));
					return false;
				}
				sDbList = sVal;

				if(m_pRdbItf == NULL)
				{
					m_pRdbItf = new CRemoteMdbItf;
					if(!m_pRdbItf->Valid())
						return false;
				}

				void* pRdbList = m_pRdbItf->CreateMdbClient(sDbList, oServerAddr.GetStr(), (uint16)nServerPort);
				if(pRdbList == NULL)
					return false;
				m_oMdbClients.Insert((char*)pRdbList);
			}
		}

		// Create Mdb Server
		if(nMdbSvr)
		{
			CService* pService = CServiceManager::GetInstance()->QueryService("AcmService");
			if(!pService)
			{
				FocpLog(FOCP_LOG_ERROR, ("MdbService need AcmService for MdbSvrModule, but there isn't it"));
				return false;
			}
			if(!Wait(pService, FOCP_SERVICE_INITIALIZED))
				return false;
			if(!pService->HaveAbility(ACM_TCPSVR_ABILITY))
			{
				FocpLog(FOCP_LOG_ERROR, ("MdbService need AcmService's tcp server ability for MdbSvrModule, but there isn't it"));
				return false;
			}
			m_pSvrItf = new CMdbServerItf;
			if(!m_pSvrItf->Valid())
				return false;
		}

		if(!bConfigMdbDomain && m_pRepItf)
		{
			m_pRepItf->CleanupMdbReplication();
			delete m_pStoItf;
			m_pStoItf = NULL;
		}

		if(!bInitializeMdbDataSource && m_pStoItf)
		{
			m_pStoItf->CleanupMdbStorage();
			delete m_pStoItf;
			m_pStoItf = NULL;
		}

		const char* sCreateCode = GetEnvVar("CreateMdbCode");
		if(sCreateCode && sCreateCode[0] == '1')
			CMdb::CreateCppCode();

		return true;
	}
开发者ID:nightstyles,项目名称:focp,代码行数:101,代码来源:MdbService.cpp


注:本文中的CService::HaveAbility方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。