本文整理匯總了C++中AddNode函數的典型用法代碼示例。如果您正苦於以下問題:C++ AddNode函數的具體用法?C++ AddNode怎麽用?C++ AddNode使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了AddNode函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1:
DataNode& DataNode::operator[](const WString& nodePath)
{
if (auto node = GetNode(nodePath))
return *node;
return *AddNode(nodePath);
}
示例2: AddNode
void dgBroadPhaseDefault::LinkAggregate(dgBroadPhaseAggregate* const aggregate)
{
AddNode(aggregate);
aggregate->m_broadPhase = this;
aggregate->m_updateNode = m_updateList.Append(aggregate);
aggregate->m_myAggregateNode = m_aggregateList.Append(aggregate);
}
示例3: AddItem
//添加元素,即節點
BOOL AddItem(const Item * pi,Tree * ptree)
{
Node * new_node;//新節點
if(TreeIsFull(ptree))//判斷樹是否已滿
{
fprintf(stderr,"Tree is full.\n");
return FALSE;
}
if(SeekItem(pi,ptree).child != NULL)//在樹中查找目標項目
{
fprintf(stderr,"Attempted to add duplicate item\n");
return FALSE;
}
new_node = MakeNode(pi);//創建新節點,成功返回新節點,否則返回NULL
if(new_node == NULL)//創建失敗,返回false
{
fprintf(stderr,"Couldn't create node!\n");
return FALSE;
}
//節點創建成功,向樹中添加節點
ptree->size++;//樹的大小加1
if(ptree->root == NULL)//如果樹為空
{
ptree->root = new_node;
}
else
{
AddNode(new_node,ptree->root);//找到新節點應該添加到的位置
}
return TRUE;
}
示例4: ReadTransforms
/*-----------------------------------------------------------------------------
* ReadTransforms
* Read a set of transforms from a string and transfer it into a file
*-----------------------------------------------------------------------------*/
void ReadTransforms(char* buf, TransformList *list)
{
char type = ' ';
char axis = ' ';
int value = 0;
char* p = buf;
/* Read the buffer */
while(p != NULL)
{
/* Read the contents of the buffer */
sscanf(p, "%c%c %d", &type, &axis, &value);
/* Define a new Transform */
Transform* t;
if((t = malloc(sizeof(Transform))) == NULL)
{
perror("2D"); exit(EXIT_FAILURE);
}
t->type = type;
t->axis = axis;
t->value = value;
/* Add it to the list */
AddNode(list, t);
/* Scan for the next item */
p = strstr(p, ",");
if(p != NULL)
p += 1;
}
}
示例5: AddNode
void CZQCustomClient::SendBuffer(pBlock block)
{
AddNode(block);
if (!m_IsSending)
ReadySendNextData(&m_SendData, 0);
}
示例6: while
int CLocalNav::FindDirectPath(Vector &vecStepStart, Vector &vecDest, float flTargetRadius, BOOL fNoMonsters)
{
Vector vecActualDest;
Vector vecPathDir;
Vector vecNodeLoc;
int nindexLast;
vecPathDir = (vecDest - vecStepStart).Normalize();
vecActualDest = vecDest - (vecPathDir * flTargetRadius);
if (PathTraversable(vecStepStart, vecActualDest, fNoMonsters) == TRAVERSABLE_NO)
return -1;
nindexLast = -1;
vecNodeLoc = vecStepStart;
m_nindexAvailableNode = 0;
while ((vecNodeLoc - vecActualDest).Length2D() >= HOSTAGE_STEPSIZE)
{
vecNodeLoc = vecNodeLoc + (vecPathDir * HOSTAGE_STEPSIZE);
nindexLast = AddNode(nindexLast, vecNodeLoc, 0, 0, 0);
if (nindexLast == -1)
break;
}
return nindexLast;
}
示例7: Node
void List::InsertAfter(void* iterPtr, void* objectPtr)
{
Node* node = new Node();
node->m_Ptr = objectPtr;
AddNode(node, (Node*)iterPtr, ((Node*)iterPtr)->m_NextNode);
}
示例8: AddNode
void IntersectionNodesInAirport::AddNodes( const std::vector<IntersectionNode> newNodes )
{
for(int i=0;i <(int)newNodes.size();i++)
{
AddNode(newNodes[i]);
}
}
示例9: CG2Node
CNeighbour* CNeighboursConnections::OnAccept(CNetworkConnection* pConn)
{
// TODO: Make new CNeighbour deriviate for handshaking with Gnutella clients
systemLog.postLog(LogSeverity::Debug, "CNeighbours::OnAccept");
//qDebug() << "CNeighbours::OnAccept";
if(!m_bActive)
{
pConn->Close();
return 0;
}
if(!m_pSection.tryLock(50))
{
systemLog.postLog(LogSeverity::Debug, "Not accepting incoming connection. Neighbours overloaded");
pConn->Close();
return 0;
}
CG2Node* pNew = new CG2Node();
pNew->AttachTo(pConn);
AddNode(pNew);
pNew->moveToThread(&NetworkThread);
m_pSection.unlock();
return pNew;
}
示例10: main
int main()
{
char ch[10],num[5];
LinkList head;
head=CreatList();
printlist(head);
printf(" Delete node (y/n):");
scanf("%s",num);
if(strcmp(num,"y")==0||strcmp(num,"Y")==0)
{
printf("Please input Delete_data:");
scanf("%s",ch);
DeleteList(head,ch);
printlist(head);
}
printf("Add node ? (y/n): ");
scanf("%s",ch);
if(strcmp(ch,"y")==0||strcmp(ch,"Y")==0)
{
head=AddNode(head);
}
printlist(head);
system("pause");
DeleteAll(head);
}
示例11: m_lru
dSceneGraph::dSceneGraph(const dSceneGraph& me)
:dTree<dGraphNode, unsigned>(), m_lru (0)
{
// add all nodes from me,
Iterator iter (me);
for (iter.Begin(); iter; iter ++) {
dGraphNode& srcNode = iter.GetNode()->GetInfo();
AddNode (srcNode.m_nodeInfo, NULL);
}
//now connect all edges
for (iter.Begin(); iter; iter ++) {
dGraphNode& srcNode = iter.GetNode()->GetInfo();
dGraphNode& myNode = Find(srcNode.m_nodeInfo->GetUniqueID())->GetInfo();
for (dGraphNode::dLink::dListNode* srcEdge = srcNode.m_children.GetFirst(); srcEdge; srcEdge = srcEdge->GetNext()) {
dGraphNode& srcLinkNode = srcEdge->GetInfo()->GetInfo();
dTreeNode* myLinkNode = Find(srcLinkNode.m_nodeInfo->GetUniqueID());
//myNode.m_children.Append(srcEdge->GetInfo());
myNode.m_children.Append(myLinkNode);
}
for (dGraphNode::dLink::dListNode* srcEdge = srcNode.m_parents.GetFirst(); srcEdge; srcEdge = srcEdge->GetNext()) {
dGraphNode& srcLinkNode = srcEdge->GetInfo()->GetInfo();
dTreeNode* myLinkNode = Find(srcLinkNode.m_nodeInfo->GetUniqueID());
//myNode.m_parents.Append(srcEdge->GetInfo());
myNode.m_parents.Append(myLinkNode);
}
}
m_rootNode = Find(me.GetRootNode()->GetInfo().GetNode()->GetUniqueID());
}
示例12: InitTireTree
int InitTireTree(trie_tree_t* pttt, const char* str_table[], int size)
{
if (!pttt)
{
return -1;
}
trie_node_t* root = &pttt->root;
memset(root->childs, 0, sizeof(root->childs));
int i;
for (i = 0; i < size; ++i)
{
trie_node_t* pn = root;
const char *one = str_table[i];
int len = strlen(one);
int j;
for (j = 0; j < len; ++j)
{
int ch = char_map(one[j]);
if (!pn->childs[ch])
{
(void)AddNode(pn, ch);
}
pn = pn->childs[ch];
}
pn->end = 1;
}
return 0;
}
示例13: while
void CTreeBuilder::ReadConfig()
{
int depth = 0;
CTreeNode* pParentNode = NULL;
CTreeNode* pCurrentNode = NULL;
CTreeNode* pSiblings = NULL;
string xmlLine;
ifstream infile;
infile.open (m_sFileName.c_str(), ifstream::in);
while(infile.good())
{
string test;
getline(infile,xmlLine);
if ( !xmlLine.empty())
{
NodeDetails nodeDetails;
string nodeName = "", nodeText = "";
ValidateTag(xmlLine, nodeDetails);
pCurrentNode = AddNode(pCurrentNode, nodeDetails);
}
}
infile.close();
}
示例14: AddNode
void MGADSMTrajectory::AddNodes(const std::vector<TrajectoryNodePtr>& nodes)
{
for (std::size_t i = 0; i < nodes.size(); ++i)
{
AddNode(nodes[i]);
}
}
示例15: DepCompAstRefDAG
DepCompAstRefDAG(const DepCompAstRefAnal& stmtorder, const DepCompAstRefGraphCreate* g)
{
DoublyLinkedListWrap <DepCompAstRefGraphNode*> nodelist;
DepCompAstRefGraphCreate::NodeIterator nodes = g->GetNodeIterator();
for ( ; !nodes.ReachEnd(); nodes.Advance()) {
DepCompAstRefGraphNode* n = nodes.Current();
AddNode(n);
nodelist.AppendLast(n);
}
if (nodelist.size() <= 1)
return;
for (nodes.Reset(); !nodes.ReachEnd(); nodes.Advance()) {
DepCompAstRefGraphNode* n = *nodes;
DepCompAstRef& info = n->GetInfo();
for (DepInfoEdgeIterator edges = g->GetNodeEdgeIterator(n, GraphAccess::EdgeOut);
!edges.ReachEnd(); ++edges) {
DepInfoEdge* e = *edges;
DepCompAstRefGraphNode* n1 = g->GetEdgeEndPoint(e, GraphAccess::EdgeIn);
DepCompAstRef& info1 = n1->GetInfo();
int c = stmtorder.CompareAstRef(info,info1);
if (c < 0) {
AddEdge(n, n1, e);
}
else if (c > 0) {
AddEdge(n1,n,e);
}
}
}
if (DebugRefFuse()) {
std::cerr << GraphToString(*this) << std::endl;
}
}