本文整理汇总了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;
}
}