📄 v4nodepool.cpp
字号:
/* V4NodePool.cpp*/#include "safe_include.h"#include <gpac/scenegraph_vrml.h>#include "V4NodePool.h"// FindNode -- search for a node with the specified NodeID or pointeru32 V4NodePool::FindNode(const u32 NodeID, const GF_Node * node) { if ( (NodeID == 0) && (node == NULL) ) return (u32) -1; for (int i = 0; i < Nodes.size(); i++) if ( (NodeID == Nodes.at(i).GetID()) || (node == Nodes.at(i).GetNode()) ) return i; return (u32) -1;}// AddNode --V4Node& V4NodePool::AddNode(GF_Node * _node) { // checks that the node is not already in the pool u32 id = gf_node_get_id(_node); u32 i = FindNode(id); if (i != (u32) -1) return Nodes.at(i); // add a new entry into the pool V4Node node(id, _node); Nodes.push_back(node); count++; return Nodes.back();}// DeleteNode -- Deletes a node from the poolvoid V4NodePool::DeleteNode(const u32 _NodeID, const GF_Node * _node) { u32 i = FindNode(_NodeID, _node); std::vector<V4Node>::iterator iter = Nodes.begin(); for (u32 j=0; j<i; j++) iter++; Nodes.erase(iter);}// GetV4Node -- retrieves a node from the poolV4Node& V4NodePool::GetV4Node(const u32 _NodeID, const GF_Node * _node) { u32 i = FindNode(_NodeID, _node); return Nodes.at(i);}// GetNodesCount -- returns the numbre of nodesu32 V4NodePool::GetNodesCount() const { return Nodes.size();}// FirstNode -- returns the beginning the listV4Node& V4NodePool::at(u32 n) { return Nodes.at(n);}// Clear -- deletes all itemvoid V4NodePool::Clear() { Nodes.clear();}// returns countu32 V4NodePool::GetCount() const { return count;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -