本文整理汇总了C++中Group::GetTaskIDs方法的典型用法代码示例。如果您正苦于以下问题:C++ Group::GetTaskIDs方法的具体用法?C++ Group::GetTaskIDs怎么用?C++ Group::GetTaskIDs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Group
的用法示例。
在下文中一共展示了Group::GetTaskIDs方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: iter
unsigned int WINAPI TaskSynch::SynchThreadProc(void *pContext)
{
TaskSynch *pSynch = reinterpret_cast<TaskSynch *>(pContext);
WaitForSingleObject(pSynch->m_synchMap.m_synchEvent, INFINITE);
ResetEvent(pSynch->m_synchMap.m_synchEvent);
while(pSynch->m_synchMap.GetCount())
{
SynchData *pSynchData = pSynch->m_synchMap.Get(0);
if(pSynchData)
{
Group *pGroup = pSynch->m_pDataManager->GetGroupManagerInstance()->GetGroup(pSynchData->m_sbGroup);
if(pGroup)
{
int count = 0;
unsigned __int64 *pIDs = pGroup->GetTaskIDs(&count);
//TODO: build sets then use diffSet to get the missing items.. synch the existing items
//and request the missing items
SortedSet<unsigned __int64> localIDs;
localIDs.addAll(pIDs, count);
SortedSet<unsigned __int64> foreignIDs;
delete [] pIDs;
foreignIDs.addAll(pSynchData->m_pIDs, pSynchData->m_taskCount);
CSet<unsigned __int64, 32> remainingIDs = localIDs.diff(foreignIDs);
IterWrapper<Task> iter(pGroup->IterateTasks());
while(iter.Next())
{
pSynch->SynchTaskTreeSeg(iter.Get(), pSynchData->m_ipSet[0]);
}
IterWrapper<unsigned __int64> idIter(remainingIDs.Iterate());
int len = 0;
char * pMsg = NULL;
while(idIter.Next())
{
pMsg = MakeReqTask(*idIter.Get(), &len, true);
pSynch->m_pNetwork->Send(pMsg, len, pSynchData->m_ipSet[0]);
}
}
}
pSynch->m_synchMap.RemoveItem(0);
}
pSynch->m_threadID = 0;
return 0;
}
示例2: HandleGroupSynch
void TaskSynch::HandleGroupSynch(unsigned char *pData, unsigned long len, unsigned long ip, unsigned long response)
{
if(response)return ProcessGroupSynchResponse(pData, len, ip);
else
{
SendMessage(mainAppHWND, WM_STOREPLAN, 0, 0);
unsigned long *pHashLen = reinterpret_cast<unsigned long *>(pData);
int *pCount = reinterpret_cast<int *>(pData + sizeof(unsigned long) + *pHashLen);
int *pGroupNameLen = pCount + 1;
StringBuffer sbGroup(reinterpret_cast<TCHAR *>(pGroupNameLen + 1), *pGroupNameLen / sizeof(TCHAR));
int *pKeyLen = reinterpret_cast<int *>(pData + sizeof(unsigned long) + *pHashLen + (sizeof(int) * 2) + *pGroupNameLen);
StringBuffer sbKey(reinterpret_cast<TCHAR *>(pKeyLen + 1), *pKeyLen / sizeof(TCHAR));
Group *pGroup = m_pDataManager->GetGroupManagerInstance()->GetGroup(sbGroup);
unsigned char *pHashData = (pData + sizeof(unsigned long));
if(pGroup && _tcscmp(pGroup->GetGroupKey(), sbKey) == 0)
{
int taskCount = 0;
StringBuffer sbGroupXML;
GetGroupTasksXML(pGroup, &taskCount, sbGroupXML);
unsigned long ghashLen = 0;
unsigned char *pGroupHash = HashTaskTreeSeg(sbGroupXML, &ghashLen);
if(*pHashLen != ghashLen)
{
OutputDebugString(_T("Hash Lengths don't match, this should not happen... throw exception\n"));
throw _T("Unmatched Hash Lengths");
}
if(memcmp(pHashData, pGroupHash, *pHashLen))
{
int msgLen = 0;
unsigned __int64 *pIDs = pGroup->GetTaskIDs(&taskCount);
char *pMsg = MakeGroupSynchReq(pGroupHash, ghashLen, pIDs, sbGroup, sbKey, taskCount, true, &msgLen);
delete [] pIDs;
m_pNetwork->Send(pMsg, msgLen, ip);
}
delete [] pGroupHash;
}
}
}