本文整理汇总了C++中CPVRDatabase::GetClientId方法的典型用法代码示例。如果您正苦于以下问题:C++ CPVRDatabase::GetClientId方法的具体用法?C++ CPVRDatabase::GetClientId怎么用?C++ CPVRDatabase::GetClientId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPVRDatabase
的用法示例。
在下文中一共展示了CPVRDatabase::GetClientId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RegisterClient
int CPVRClients::RegisterClient(AddonPtr client, bool* newRegistration/*=NULL*/)
{
int iClientId(-1);
if (newRegistration)
*newRegistration = false;
if (!client->Enabled())
return -1;
CLog::Log(LOGDEBUG, "%s - registering add-on '%s'", __FUNCTION__, client->Name().c_str());
CPVRDatabase *database = GetPVRDatabase();
if (!database)
return -1;
// check whether we already know this client
iClientId = database->GetClientId(client->ID());
// try to register the new client in the db
if (iClientId < 0)
{
if ((iClientId = database->Persist(client)) < 0)
{
CLog::Log(LOGERROR, "PVR - %s - can't add client '%s' to the database", __FUNCTION__, client->Name().c_str());
return -1;
}
else if (newRegistration)
*newRegistration = true;
}
PVR_CLIENT addon;
// load and initialise the client libraries
{
CSingleLock lock(m_critSection);
PVR_CLIENTMAP_CITR existingClient = m_clientMap.find(iClientId);
if (existingClient != m_clientMap.end())
{
// return existing client
addon = existingClient->second;
}
else
{
// create a new client instance
addon = boost::dynamic_pointer_cast<CPVRClient>(client);
m_clientMap.insert(std::make_pair(iClientId, addon));
}
}
if (iClientId < 0)
CLog::Log(LOGERROR, "PVR - %s - can't register add-on '%s'", __FUNCTION__, client->Name().c_str());
return iClientId;
}