当前位置: 首页>>代码示例>>C++>>正文


C++ CNode类代码示例

本文整理汇总了C++中CNode的典型用法代码示例。如果您正苦于以下问题:C++ CNode类的具体用法?C++ CNode怎么用?C++ CNode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SplitNode

void TreeCommon::SplitNodeOnce(int node_id) {
    CNode* node = this->GetNode(node_id);
    if (node == NULL || node->type() != CNode::BRANCH) {
        cout << "Error Split Node: " << node_id << endl;
        return;
    }
    CBranch* branch = (CBranch*)node;

	bool is_children_all_leaf = true;
	for (int i = 0; i < branch->linked_nodes.size(); ++i)
		if (branch->linked_nodes[i]->type() != CNode::LEAF) {
			is_children_all_leaf = false;
			break;
		}
    if (is_children_all_leaf && branch->linked_nodes.size() > 2) {
        SplitNode(branch);

        vector<vector<float>> center_pos;
        for (int i = 0; i < branch->linked_nodes.size(); ++i)
            center_pos.push_back(branch->linked_nodes[i]->center_pos);
        branch->average_dis = Utility::GetAverageDistance(center_pos);

        if (branch->level() + 1 > this->max_level_) this->max_level_ = branch->level() + 1;

        for (int i = 0; i < branch->linked_nodes.size(); ++i) {
            id_node_map_.insert(map<int, CNode*>::value_type(branch->linked_nodes[i]->id(), branch->linked_nodes[i]));
        }
    }
}
开发者ID:Edgar324,项目名称:ScatterPointGlyph,代码行数:29,代码来源:tree_common.cpp

示例2: Vector3D

void MyApplication::useSimpleArray()
{
    const SceneManagerPtr& scene = BaseApplication::getSceneManager();
    scene->clear();

    for (s32 col = -2; col < 3; ++col)
    {
        for (s32 row = -2; row < 3; ++row)
        {
            for (s32 width = 0; width < 1; ++width)
            {
                CShape* model = scene->addCube(0, Vector3D((f32)row, (f32)col, -5));
                if (model)
                {
                    model->setName("cube_" + std::to_string(col) + "_" + std::to_string(row));
                    model->setScale(Vector3D(0.5f));
                    model->setRenderTechnique("shaders/default.xml");
                    model->getMaterial()->setTexture(0, "textures/box.jpg");
                }
            }
        }
    }

    CNode* fpsCamera = scene->addFPSCamera(0, Vector3D(0, 0, 0), Vector3D(0.7f, 0, 0.7f));
    fpsCamera->setName("fpsCamera");
    CNode* camera = scene->addCamera(0, Vector3D(0, 0, 0), Vector3D(0.0f, 0, -5.0f));
    camera->setName("camera");

    scene->init();
}
开发者ID:fedoriusv,项目名称:V3DEngine,代码行数:30,代码来源:MyApplication.cpp

示例3: getFormulaDeepChild

CFormulaNode* CFormulaNode::getFormulaDeepFormulaChild( long frame_idx, long child_idx )
{
	CNode *ret = getFormulaDeepChild( frame_idx, child_idx );
	if( !ret || ret->GetType() != NODE_FORMULA )
		return NULL;
	return (CFormulaNode*) ret;
}
开发者ID:Nilis640,项目名称:formulator-mathml,代码行数:7,代码来源:ni_formula.cpp

示例4: OutputDebugString

HydraIRCPlugin::~HydraIRCPlugin( void )
{
#ifdef DEBUG
  OutputDebugString("HydraIRCPlugin::~HydraIRCPlugin() Called for ");
  OutputDebugString(m_Name ? m_Name : "Uninitialised Plugin");
  OutputDebugString("\n");
#endif

  CNode *pNode;
  APIDescriptor_t *APID;

  while (!m_APIList.IsEmpty())
  {
    pNode = m_APIList.GetFirst();
    APID = (APIDescriptor_t *)pNode->m_Data;

    if (APID->m_Type == PLUGIN_PROVIDES && APID->m_pTable) 
      free(APID->m_pTable);

    free(APID);
    pNode->Remove();
    delete pNode;
  }  

  m_Name = NULL;
}
开发者ID:mirror,项目名称:hydrairc,代码行数:26,代码来源:HydraIRCPlugin.cpp

示例5: DeleteRecord

void DeleteRecord(CList&TelList)
{
 CNode *pLook;
 char szName[20];
        cout<<"请输入您需要删除的姓名(输入0退出,并进入系统菜单)"<<endl;
 cin.getline(szName,20);
 while(strcmp(szName,"0"))
 {
  CTelRecord tel(szName,"0");
  pLook=TelList.LookUp(tel);
  if (pLook)
  {
   cout<<"在电话簿中找到"<<szName<<",内容是:"<<endl;
               pLook->ShowNode();
   cout<<"请确定是否删除此记录(Y/N)【确定删除请输入Y或y,取消删除请输入N或n】:"<<endl;
   char ok;
   cin>>ok;
                        cin.ignore();
   if (ok=='Y'||ok=='y')
   {
       TelList.DeleteNode(pLook);
       cout<<szName<<"的资料删除成功!"<<endl;
       delete pLook;
       count--;
   }
   else if(ok=='N'||ok=='n')
    cout<<szName<<"的资料删除失败"<<endl;
  }
  else
    cout<<"在电话簿中找不到"<<szName<<","<<endl;
  cout<<"请输入您需要删除的姓名(输入0退出,并进入系统菜单)"<<endl;
        cin.getline(szName,20);
 }
开发者ID:HH-LFY,项目名称:HH,代码行数:33,代码来源:电话簿管理系统.cpp

示例6: PtmapLoad

//---------------------------------------------------------------------------
//	@function:
//		CTreeMapTest::EresUnittest_Unrank
//
//	@doc:
//		Rehydrate all trees encoded in the map
//
//---------------------------------------------------------------------------
GPOS_RESULT
CTreeMapTest::EresUnittest_Unrank()
{
	CAutoMemoryPool amp;
	IMemoryPool *pmp = amp.Pmp();
	
	TestMap *ptmap = PtmapLoad(pmp);	
	
	// debug print
	CWStringDynamic str(pmp);
	COstreamString oss(&str);
	
	ULLONG ullCount = ptmap->UllCount();
	
	for (ULONG ulRank = 0; ulRank < ullCount; ulRank++)
	{
		oss << "=== tree rank: " << ulRank << " ===" << std::endl;
		BOOL fFlag = true;
		CNode *pnd = ptmap->PrUnrank(pmp, &fFlag, ulRank);
		(void) pnd->OsPrint(oss);
		
		pnd->Release();
	}
	
	GPOS_TRACE(str.Wsz());
	GPOS_DELETE(ptmap);

	return GPOS_OK;
}
开发者ID:HanumathRao,项目名称:gporca,代码行数:37,代码来源:CTreeMapTest.cpp

示例7: EdgeAddDirected

//=============================================================================
void CGraph::EdgeAddDirected (INode * start, INode * end)
{
    CNode * nodeStart = CNode::From(start);
    CNode * nodeEnd = CNode::From(end);

    nodeStart->AddNeighbor(nodeEnd);
}
开发者ID:Lexdysic,项目名称:Ferrite,代码行数:8,代码来源:PathGraph.cpp

示例8: throw

//***********************************************************************************************
CParticleWorkspace::CNode *CParticleWorkspace::addNode(const std::string &filenameWithFullPath)  throw( NLMISC::EStream)
{	
	nlassert(_OV);				
	// Check that file is not already inserted 	
	std::string fileName = NLMISC::CFile::getFilename(filenameWithFullPath);
	for(uint k = 0; k < _Nodes.size(); ++k)
	{
		if (NLMISC::nlstricmp(_Nodes[k]->getFilename(), fileName) == 0) return NULL;		
	}	
	char resultPath[MAX_PATH];
	std::string dosPath = NLMISC::CPath::standardizeDosPath(getPath());
	std::string relativePath;
	if (!PathRelativePathTo(resultPath, dosPath.c_str(), FILE_ATTRIBUTE_DIRECTORY, filenameWithFullPath.c_str(), 0))
	{
		relativePath = filenameWithFullPath; 
	}
	else
	{
		relativePath = resultPath;
	}
	if (relativePath.size() >= 2)
	{
		if (relativePath[0] == '\\' && relativePath[1] != '\\')
		{
			relativePath = relativePath.substr(1);
		}
	}
	CNode *newNode = new CNode;
	newNode->init(this);
	newNode->setRelativePath(relativePath);
	_Nodes.push_back(newNode);
	setModifiedFlag(true);
	return newNode;	
}
开发者ID:CCChaos,项目名称:RyzomCore,代码行数:35,代码来源:particle_workspace.cpp

示例9: FindNodeWithFreeMem

CNode* CMigrationInfo::FindNodeWithFreeMem(CNode* i_sourceNode, CProcess* i_process)
{
	i_sourceNode->WriteLog("MIGRATION - MEM ISSUES - Searching for destination node to establish migration");
	CNode* returnValue = NULL;
	bool found = false;
	double maxFreeMem = 0;
	uint32_t maxIndex = 0;
	// find out which is the process with the greatest free mem that we can migrate to:
	if (i_sourceNode->GetAvailableBandwidth() > 0)
	{
		for (uint32_t i = 0; i < CMasterSingleton::GetInstance()->GetNodeCount(); ++i)
		{
			CNode* currentNode = CMasterSingleton::GetInstance()->GetNode(i);
			double freeMem = currentNode->GetFreeMem();
			if (maxFreeMem < freeMem && i_sourceNode->GetId() != currentNode->GetId() && CanBeDestination(currentNode, i_process))
			{
				maxFreeMem = freeMem;
				maxIndex = i;
				found = true;
			}
		}

		// if found is false, we will return a null pointer meaning that the migration should not happen
		if (found)
			returnValue = CMasterSingleton::GetInstance()->GetNode(maxIndex);
	}

	return returnValue;
}
开发者ID:maiorescuioandan,项目名称:DistributedSystemSim,代码行数:29,代码来源:MigrationInfo.cpp

示例10: SetName

void CControl::Initialize()
{
    super::Initialize();
    m_bUninitialize = false;
    if ( strcmp( m_strName.c_str(), DEFAULT_CONTROL_NAME ) == 0)
    {
        SetName( GetDefaultName() );
    }
    else
    {
        CWindowManager::GetInstance()->RegisterControl( this );
    }
    CalcInheritColor();
    CRenderTarget* pMainRenderTarget = CRenderManager::GetInstance()->GetCurrentRenderTarget();
    BEATS_ASSERT( pMainRenderTarget );
    CNode* pParentNode = GetParentNode();
    if ( nullptr == pParentNode)
    {
        CWindowManager::GetInstance()->AddToRoot( this );
    }
    if (nullptr == pParentNode || pParentNode->GetType() != eNT_NodeGUI )
    {
        //update control vertex by render target
        OnParentSizeChange( (float)pMainRenderTarget->GetWidth(), (float)pMainRenderTarget->GetHeight());
    }
}
开发者ID:BeyondEngine,项目名称:BeyondEngine,代码行数:26,代码来源:Control.cpp

示例11: locktree

void CNet::locktree (void)
{
  CNode *node;


  for (node = rtree; node != NULL; node = node->data.rtree) node->lock ();
}
开发者ID:AhmedAMohamed,项目名称:Alliance-VLSI-CAD-System,代码行数:7,代码来源:MNet.cpp

示例12: FindNodeWithFreeCpu

CNode* CMigrationInfo::FindNodeWithFreeCpu(CNode* i_sourceNode, CProcess* i_process)
{
	i_sourceNode->WriteLog("MIGRATION - CPU ISSUES - Searching for destination node to establish migration");
	CNode* returnValue = NULL;
	bool found = false;
	uint32_t minIndex = 0;
	double minCpu = 1;
	if (i_sourceNode->GetAvailableBandwidth() > 0)
	{
		for (uint32_t i = 0; i < CMasterSingleton::GetInstance()->GetNodeCount(); ++i)
		{
			CNode* currentNode = CMasterSingleton::GetInstance()->GetNode(i);
			double cpuUsage = currentNode->GetCpuUsage();
			if (minCpu > cpuUsage && i_sourceNode->GetId() != currentNode->GetId() && CanBeDestination(currentNode, i_process))
			{
				minCpu = cpuUsage;
				minIndex = i;
				found = true;
			}
		}

		// if found is false, we will return a null pointer meaning that the migration should not happen
		if (found)
			returnValue = CMasterSingleton::GetInstance()->GetNode(minIndex);
	}

	return returnValue;
}
开发者ID:maiorescuioandan,项目名称:DistributedSystemSim,代码行数:28,代码来源:MigrationInfo.cpp

示例13: Q_ASSERT

void CParentNode::RemoveOrCopyChildren( QVector<CNode*> &children, long nFrom, long nTo, int fRemove )
{
	if( nTo == -1 ) nTo = (long) m_children.size();
	Q_ASSERT( nTo <= (long) m_children.size() );
	Q_ASSERT( nTo >= nFrom );
	children.resize( nTo - nFrom );
	if( children.size() )
	{
		for( long i = 0; i < (long) children.size(); i++ )
		{
			children[ i ] = (fRemove ? m_children[ nFrom + i ] : CreateCopy( m_children[ nFrom + i ] ) );
			children[ i ]->SetParent( NULL );
		}

		children[ 0 ]->SetPrev( NULL );
		children[ children.size() - 1 ]->SetNext( NULL );
		if( fRemove )
		{
			m_children.remove( nFrom, nTo - nFrom );
			CNode *pPrev = (nFrom - 1 > -1 && nFrom - 1 < (long) m_children.size()) ? m_children[ nFrom - 1 ] : NULL;
			CNode *pNext = (nFrom > -1 && nFrom < (long) m_children.size()) ? m_children[ nFrom ] : NULL;
			if( pPrev ) pPrev->SetNext( pNext );
			if( pNext ) pNext->SetPrev( pPrev );
		}
	}
}
开发者ID:Nilis640,项目名称:formulator-mathml,代码行数:26,代码来源:ni_parent.cpp

示例14: nlwarning

// execute
void	CGenericXmlMsgHeaderManager::execute(CBitMemStream &strm)
{
	// check root
	if (_Root == NULL)
	{
		nlwarning("Can't execute message , Root not properly initialized.");
		return;
	}

	CNode	*node = _Root->select(strm);

	// check node
	if (node == NULL)
	{
		nlwarning("Can't execute stream, no valid sequence found");
	}
	// check callback
	else if (node->Callback == NULL)
	{
		nlwarning("Can't execute msg '%s', no callback set", node->Name.c_str());
	}
	// execute callback
	else
	{
		node->Callback(strm);
	}
}
开发者ID:AzyxWare,项目名称:ryzom,代码行数:28,代码来源:generic_xml_msg_mngr.cpp

示例15: getSemanticsOrCTokenNodeWrapped

CFormulaNode* CFormulaNode::getSemanticsOrCTokenNodeWrapped()
{
	for( CNode *curNode = this; curNode != 0; curNode = curNode->GetParent() )
	{
		if( curNode->GetType() == NODE_FORMULA && curNode->to_mathml_data.is_content != 0 )
		{
			if( !xml_strcmp( curNode->to_mathml_data.name, FBL_TAG_semantics ) || 
				!xml_strcmp( curNode->to_mathml_data.name, FBL_TAG_annotation ) || 
				::mml_is_cm_token( curNode->to_mathml_data.name ) )
				return (CFormulaNode*)curNode;
			else if( curNode->to_mathml_data.name == FBL_TAG_annotation_xml )
			{
				QString attrValue = _T("");
				struct HMathMLAttr mml_attr_by_this_node( getMathMLAttr() );
				if( mml_attr_by_this_node.getFilteredAttr( FBL_ATTR_encoding, attrValue ) == 0 &&
					attrValue == FBL_VAL_MathML_Content )
				{
					continue;
				}
				return (CFormulaNode*)curNode;
			}
		}
	}
	return 0;
}
开发者ID:Nilis640,项目名称:formulator-mathml,代码行数:25,代码来源:ni_formula.cpp


注:本文中的CNode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。