本文整理汇总了C++中DeviceMap::find方法的典型用法代码示例。如果您正苦于以下问题:C++ DeviceMap::find方法的具体用法?C++ DeviceMap::find怎么用?C++ DeviceMap::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DeviceMap
的用法示例。
在下文中一共展示了DeviceMap::find方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: myRelease
static ULONG __stdcall myRelease(ID3D10Device *pDevice) {
//TODO: Move logic to HardHook.
// Call base without active hook in case of no trampoline.
ReleaseType oRelease = (ReleaseType) hhRelease.call;
hhRelease.restore();
ULONG res = oRelease(pDevice);
hhRelease.inject();
Mutex m;
DeviceMap::iterator it = devices.find(pDevice);
if (it != devices.end()) {
D10State *ds = it->second;
// If we are receiving a lot of subsequent releases lets eagerly drop
// our state object. If the device presents something again a state
// object is created again just fine anyway.
if (res < ds->lHighMark / 2) {
ods("D3D10: Deleting resources %u < 0.5 * %u", res, ds->lHighMark);
devices.erase(it);
chains.erase(ds->pSwapChain);
delete ds;
ods("D3D10: Deleted");
ds = NULL;
}
}
return res;
}
示例2: AddDevice
int32_t CParseDevice::AddDevice(DeviceInfo& deviceInfo)
{
//check Id
DeviceMap::iterator deviceIter = g_deviceMap.find(deviceInfo.m_nId);
if (deviceIter != g_deviceMap.end())
{
return fail;
}
//new
DeviceInfo* pDeviceInfo = new DeviceInfo;
*pDeviceInfo = deviceInfo;
//bool bHasUserInfo = false;
//if ((0 != strlen(deviceInfo.m_szUser)) && (0 != strlen(deviceInfo.m_szPassword)))
//{
// bHasUserInfo = true;
//}
//if (0 == strcmp("DH", deviceInfo.m_szIdentifier))
//{
// if (deviceInfo.m_nRate)
// {
// sprintf(pDeviceInfo->m_szSourceUrl, "rtsp://%s:%d/cam/realmonitor?channel=2&subtype=1", deviceInfo.m_szIP, deviceInfo.m_nPort);
// }
// else
// {
// sprintf(pDeviceInfo->m_szSourceUrl, "rtsp://%s:%d/cam/realmonitor?channel=2&subtype=0", deviceInfo.m_szIP, deviceInfo.m_nPort);
// }
//}
//else if (0 == strcmp("HK", deviceInfo.m_szIdentifier))
//{
// if (deviceInfo.m_nRate)
// {
// sprintf(pDeviceInfo->m_szSourceUrl, "rtsp://%s:%d/h264/ch1/main/av_stream", deviceInfo.m_szIP, deviceInfo.m_nPort);
// }
// else
// {
// sprintf(pDeviceInfo->m_szSourceUrl, "rtsp://%s:%d/h264/ch1/sub/av_stream", deviceInfo.m_szIP, deviceInfo.m_nPort);
// }
//}
//else
//{
// delete pDeviceInfo;
// return fail;
//}
//±êʶÃû
//sprintf(pDeviceInfo->m_szIdname, "%s%s%d", deviceInfo.m_szIdentifier, deviceInfo.m_szModel, deviceInfo.m_nId);
//insert
g_deviceMap.insert(make_pair(pDeviceInfo->m_nId, pDeviceInfo));
return success;
}
示例3: DelDevice
int32_t CParseDevice::DelDevice(uint32_t nId)
{
//check Id
DeviceMap::iterator deviceIter = g_deviceMap.find(nId);
if (deviceIter == g_deviceMap.end())
{
return fail;
}
//delete
delete (*deviceIter).second;
g_deviceMap.erase(deviceIter);
return success;
}
示例4: myAddRef
static ULONG __stdcall myAddRef(ID3D10Device *pDevice) {
//TODO: Move logic to HardHook.
// Call base without active hook in case of no trampoline.
AddRefType oAddRef = (AddRefType) hhAddRef.call;
hhAddRef.restore();
ULONG res = oAddRef(pDevice);
hhAddRef.inject();
Mutex m;
DeviceMap::iterator it = devices.find(pDevice);
if (it != devices.end()) {
it->second->lHighMark = res;
}
return res;
}
示例5: AddDevice
int32_t CParseDevice::AddDevice(DeviceInfo& deviceInfo)
{
//check Id
pthread_mutex_lock(&dmt);
DeviceMap::iterator deviceIter = g_deviceMap.find(deviceInfo.m_szSourceUrl);
if (deviceIter != g_deviceMap.end())
{
printf("INFO::%s exsit\n",deviceInfo.m_szSourceUrl);
pthread_mutex_unlock(&dmt);
return success;
}
//new
DeviceInfo* pDeviceInfo = new DeviceInfo;
*pDeviceInfo = deviceInfo;
//insert
g_deviceMap.insert(make_pair(pDeviceInfo->m_szSourceUrl, pDeviceInfo));
pthread_mutex_unlock(&dmt);
return success;
}
示例6: logging
/*
* Build a map of uids to discovery information for all NVM-DIMM in the system
*/
void monitor::EventMonitor::buildDeviceMap(DeviceMap& map, bool addStoredTopology)
{
LogEnterExit logging(__FUNCTION__, __FILE__, __LINE__);
// build a map of the current devices
int devCount = nvm_get_device_count();
if (devCount < 0) // error getting dimm count
{
COMMON_LOG_ERROR_F("nvm_get_device_count failed with error %d", devCount);
}
else if (devCount > 0) // at least one dimm
{
struct device_discovery devList[devCount];
devCount = nvm_get_devices(devList, devCount);
if (devCount < 0) // error get dimm discovery
{
COMMON_LOG_ERROR_F("nvm_get_devices failed with error %d", devCount);
}
else if (devCount > 0) // at least one dimm
{
for (int i = 0; i < devCount; i++)
{
NVM_UID uidStr;
uid_copy(devList[i].uid, uidStr);
struct deviceInfo devInfo;
memset(&devInfo, 0, sizeof (deviceInfo));
devInfo.discovered = true;
devInfo.discovery = devList[i];
if (devList[i].manageability == MANAGEMENT_VALIDCONFIG)
{
// Fetch the device status
int rc = nvm_get_device_status(devList[i].uid, &devInfo.status);
if (rc != NVM_SUCCESS)
{
COMMON_LOG_ERROR_F("nvm_get_device_status failed for dimm %s, error = %d",
uidStr, rc);
}
}
map[uidStr] = devInfo;
}
}
}
// add stored db info
if (addStoredTopology)
{
int valid = 0;
PersistentStore *pStore = get_lib_store();
if (pStore)
{
if ((get_config_value_int(SQL_KEY_TOPOLOGY_STATE_VALID, &valid) == COMMON_SUCCESS) &&
(valid))
{
int topoStateCount = 0;
if (db_get_topology_state_count(pStore, &topoStateCount) == DB_SUCCESS &&
topoStateCount > 0)
{
// Populate the previous topology state map
struct db_topology_state topologyState[topoStateCount];
if (db_get_topology_states(pStore, topologyState, topoStateCount) == topoStateCount)
{
for (int i = 0; i < topoStateCount; i++)
{
std::string uidStr = topologyState[i].uid;
if (map.find(uidStr) == map.end()) // doesn't exist - missing dimm
{
struct deviceInfo devInfo;
memset(&devInfo, 0, sizeof (deviceInfo));
devInfo.discovered = false;
devInfo.stored = true;
devInfo.storedState = topologyState[i];
map[uidStr] = devInfo;
}
else
{
map[uidStr].stored = true;
map[uidStr].storedState = topologyState[i];
}
}
}
}
}
}
}
}