Commit 422b2a95 authored by oscar's avatar oscar

修改枚举到int的转换

parent 3af93ee4
......@@ -45,14 +45,14 @@ void TimeQueueObj::PushQueueData(TimeQueueDataPtr& data)
m_timeQueue.push_back(data);
}
m_totelCount++;
m_enumCount[data->dataType]++;
m_enumCount[static_cast<int>(data->dataType)]++;
if (data->dataType == m_baseEnum)
m_baseTimestmap = data->timestamp;//更新基准类型的最新时间戳,为了判断时间差用
if (m_max_num > 0 && m_totelCount > m_max_num)
{
auto begin = m_timeQueue.begin();
m_enumCount[(*begin)->dataType]--;
m_enumCount[static_cast<int>((*begin)->dataType)]--;
m_totelCount--;
m_timeQueue.pop_front();
}
......@@ -97,12 +97,12 @@ int TimeQueueObj::GetQueueData(std::vector<TimeQueueDataPtr>& outs)
}
for (auto iter = m_timeQueue.begin(); iter != m_timeQueue.end(); iter++)
{
if (labs(m_baseTimestmap - (*iter)->timestamp) < std::min(m_baseInterval, detaT[(*iter)->dataType]))
if (labs(m_baseTimestmap - (*iter)->timestamp) < std::min(m_baseInterval, detaT[static_cast<int>((*iter)->dataType)]))
{
if(merge[(*iter)->dataType] == nullptr)
if(merge[static_cast<int>((*iter)->dataType)] == nullptr)
num++;
detaT[(*iter)->dataType] = labs(m_baseTimestmap - (*iter)->timestamp);
merge[(*iter)->dataType] = *iter;
detaT[static_cast<int>((*iter)->dataType)] = labs(m_baseTimestmap - (*iter)->timestamp);
merge[static_cast<int>((*iter)->dataType)] = *iter;
pos = iter;
}
}
......@@ -117,17 +117,17 @@ int TimeQueueObj::GetQueueData(std::vector<TimeQueueDataPtr>& outs)
isFinish = 1;
if ((*iter)->dataType != m_baseEnum)
{
if (m_enumCount[(*iter)->dataType] == 1)
if (m_enumCount[static_cast<int>((*iter)->dataType)] == 1)
obj++;
else
{
m_enumCount[(*iter)->dataType]--;
m_enumCount[static_cast<int>((*iter)->dataType)]--;
obj = m_timeQueue.erase(obj);
}
}
else
{
m_enumCount[(*iter)->dataType]--;
m_enumCount[static_cast<int>((*iter)->dataType)]--;
obj = m_timeQueue.erase(obj);
}
if (isFinish == 1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment