How Display and Iterate through vsSwitch Nodes and Masks
来源:互联网 发布:高通网络解锁工具 编辑:程序博客网 时间:2024/06/05 06:17
This example function illustrates how to :
How define vsSwitch::const_iterator_mask iterator to traverse through vsSwitch Nodes Masks
How to get the name of a vsSwitch node
How to display the address of a vsSwitch node
How vsSwitch node masks are stored as an stl::pair
How to retrieve the name of a vsSwitch node masks
How to retrieve the number of active children of a vsSwitch node mask
How to retrieve the vuVector of active children from vsSwitch::Mask
How to iterate through the vuVector of active children
How to retrieve and display the indices of the active children
How to use begin and end iterator more efficently
To use ++Val as pre-increment rather than Val++ post-increment
Code :
--
void
printSwitchDetails( vsSwitch *switchNode ){
// ---------------------------------------------------------
// Public Function
//
// Quick and simple function to display switch node state
//
// Assumes that switchNode is a valid vsSwitch Node
//
// ---------------------------------------------------------
//
// Sanity check we need a node
//
if( switchNode == NULL )
return;
//
// For clarity grab the iterator's for start and end of the list
//
//
// Note that getting the 'Start' and 'End ' iterator's outside
// of the loop is generally considered more efficient than
// getting the iterators inside of the loops
//
vsSwitch::const_iterator_mask swIter = switchNode->begin_mask();
vsSwitch::const_iterator_mask swEnd = switchNode->end_mask();
printf("Getting Masks for switch Node : %s ( %p ) /n/n", switchNode->getName(), switchNode );
//
// Iterate through the Masks which a Vector containing a value pair
//
// std::pair<vuString, vuVector<int> > where
//
// first : is the name of the Mask if it has one
//
// second : is a vector of ints representing the active children
//
//
// Firstly we step through the list of all the masks which is
// vector of ( stl::pair<vuString, vuVector<int> > )
//
//
// Note it is generally accepted that using the ++Iter (pre-increment)
// with iterators is efficent that using iter++ (post-increment)
//
for ( ; swIter != swEnd; ++ swIter ) {
printf(" Mask : %s : Number Active children = %d /n/n",
(*swIter).first.c_str(),
(*swIter).second.size() );
//
// The Second value of the pair is a Vector of Ints which represent
// the active children for the mask
//
// So we need to grab and create some Interators of type vuVector<int>
//
vuVector< int >::const_iterator maskIt = (*swIter).second.begin();
vuVector< int >::const_iterator maskEnd = (*swIter).second.end();
//
// Now step through and show the active childrend indices
//
for ( ; maskIt != maskEnd; ++ maskIt ) {
printf( " Child Index : = %d /n", *maskIt );
}
}
} // printSwitchDetails
- How Display and Iterate through vsSwitch Nodes and Masks
- Iterate through array, for each item with key collect value and make new array with key and array of
- How to Collect and Display System Statistics (CPU and IO) for CBO use (Doc ID 149560.1)
- Display and Promotion Series
- CSS Display and Visibility
- Analyzing Display and Performance
- How to install masterpage,pagelayout,CSS,JS and images through Feature
- How to distribute your own Android library through jCenter and Maven Central from Android Studio
- how to create and submit kernel patch through git step by step
- 9 Adding and Deleting Nodes and Instances
- OGRE中级教程三 Mouse Picking(3D Object Selection) and SceneQuery Masks
- Nodes, Sockets, Cores and FLOPS
- Masks
- How To Display Hierarchical Data by Using Nested Repeater Controls and Visual C# .NET
- How to use OpenCV to capture and display images from a camera
- How To Display Hierarchical Data by Using Nested Repeater Controls and Visual
- How can I display the chevron for toolbar and open dropdowned popup menu with invisible buttons?
- How to Include ASM File and to Highlight Display in Source Insight
- 掌握 Ajax,第 1 部分: Ajax 简介
- 确定开始培训
- 一篇让我思考良久的文章
- JDOM遍历程序
- JSP随笔
- How Display and Iterate through vsSwitch Nodes and Masks
- 掌握 Ajax,第 2 部分: 使用 JavaScript
- nj motorola
- 救助!!EL8086系统中实现抢答器(微型计算机接口技术课程设计)
- 今天去参加EMBA大型公开课了
- ASP.NET 的 WebControl.Attributes 属性
- SIM= Subscriber identity module
- 如何在ASP页面中指定的不同位置显示多个图片
- 八卦的底线