本文整理汇总了C++中ListNode::GetNext方法的典型用法代码示例。如果您正苦于以下问题:C++ ListNode::GetNext方法的具体用法?C++ ListNode::GetNext怎么用?C++ ListNode::GetNext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ListNode
的用法示例。
在下文中一共展示了ListNode::GetNext方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EncodePrimaryObjectiveList
// This should encode the current priority of all primary objectives
short EncodePrimaryObjectiveList (uchar teammask, uchar **buffer)
{
uchar *data,*datahead;
ListNode lp;
POData pod;
short size,count=0,team,teams=0;
// 'teammask' determines which team data we're sending. If no such
// team exists, there's no reason to send the data. Check for this
for (team=0; team<NUM_TEAMS; team++)
{
if (!TeamInfo[team])
teammask &= ~(1 << team);
else if (teammask & (1 << team))
teams++;
}
// Determine size
size = sizeof(uchar) + sizeof(short);
lp = PODataList->GetFirstElement();
while (lp)
{
count++;
lp = lp->GetNext();
}
size += count * (sizeof(VU_ID) + sizeof(short)*teams);
// Write the data
data = datahead = new uchar[size];
memcpy(data, &teammask, sizeof(uchar)); data += sizeof(uchar);
memcpy(data, &count, sizeof(short)); data += sizeof(short);
lp = PODataList->GetFirstElement();
while (lp)
{
pod = (POData) lp->GetUserData();
memcpy(data, &pod->objective, sizeof(VU_ID)); data += sizeof(VU_ID);
for (team=0; team<NUM_TEAMS; team++)
{
if (teammask & (1 << team))
{
memcpy(data, &pod->player_priority[team], sizeof(short));
data += sizeof(short);
}
}
lp = lp->GetNext();
}
*buffer = datahead;
return size;
}
示例2: Remove
void LinkedList::Remove(void* item)
{
if (frontNode)
{
ListNode* currNode = frontNode;
do
{
if (currNode->GetItem() == item)
{
break;
}
currNode = currNode->GetNext();
} while (currNode);
if (currNode)
{
delete currNode;
numItems--;
if (numItems == 0)
{
frontNode = NULL;
backNode = NULL;
}
}
}
}
示例3:
template <class Type> Type List<Type>::GetNext(LISTNODE &pNode)
{
ListNode<Type> *pListNode = (ListNode<Type> *)pNode;
// Faults if you pass NULL
_ASSERTE(pNode);
Type item = pListNode->GetItem();
pNode = (LISTNODE)(pListNode->GetNext());
return item;
}
示例4: NodeAt
ListNode* LinkedList::NodeAt(int index)
{
if (index == 0)
{
return frontNode;
}
else if (index == numItems - 1)
{
return backNode;
}
else if (index < numItems)
{
int temp = numItems >> 1;
if (index >= temp)
{
int currIndex = numItems - 1;
ListNode* currNode = backNode;
do
{
currNode = currNode->GetPrevious();
currIndex--;
} while (index != currIndex);
return currNode;
}
else
{
int currIndex = 0;
ListNode* currNode = frontNode;
if (index != currIndex)
{
do
{
currNode = currNode->GetNext();
currIndex++;
} while (index != currIndex);
}
return currNode;
}
}