How Display and Iterate through vsSwitch Nodes and Masks

原创 2006年05月27日 21:26:00

 

 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

 
 

关于: Don't know how to iterate over supplied "items" in &lt;forEach&gt;

javax.servlet.ServletException: javax.servlet.jsp.JspTagException: Don't know how to iterate over su...
  • hx18652266251
  • hx18652266251
  • 2017年02月19日 23:37
  • 741

关于出现Don't know how to iterate over supplied "items" in &amp;amp;lt;forEach&amp;amp;gt;异常

 关于出现Dont know how to iterate over supplied "items" in <forEach>异常 index.jsp页面的一段代码是         ...
  • wlxtaking
  • wlxtaking
  • 2009年10月30日 20:10
  • 18201

Don't know how to iterate over supplied "items" in &lt;forEach&gt;问题的解决方法

曾经碰到如下错误: org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspT...
  • zhangchao19890805
  • zhangchao19890805
  • 2014年12月12日 20:21
  • 8959

javax.servlet.jsp.JspTagException: Don't know how to iterate over supplied "items" in &lt;forEach&gt

c ${vh.title} ...
  • u011329762
  • u011329762
  • 2014年04月26日 19:11
  • 2895

c++ iterate

指针与数组 指针与其它数据结构呢?比如说链表? 存储空间是非连续的。不能通过对指向这种数据结构的指针做累加来遍历。 能不能提供一个行为类似指针的类,来对非数组的数据结构进行遍历呢?这...
  • Joehanhan
  • Joehanhan
  • 2017年02月08日 11:28
  • 341

jsp中c:foreach标签遍历问题

HTTP Status 500 - javax.servlet.ServletException: javax.servlet.jsp.JspTagException: Don't know how ...
  • Aitex
  • Aitex
  • 2016年10月06日 15:49
  • 1345

Paxos (computer science)

Paxos is a family of protocols for solving consensus in a network of unreliable processors. Consens...
  • guolong1983811
  • guolong1983811
  • 2017年11月18日 11:31
  • 102

IBatis之Iterate

Iterate:这属性遍历整个集合,并为 List 集合中的元素重复元素体的内容。 Iterate 的属性: prepend - 可被覆盖的 SQL 语句组成部分,添加在语句的前面...
  • qincidong
  • qincidong
  • 2012年04月28日 14:48
  • 2376

BPTT(BackPropagation Through Time)

推荐博客: http://www.cnblogs.com/wacc/p/5341670.html
  • haitaolang
  • haitaolang
  • 2017年03月04日 17:29
  • 293

Iterate through pixels of textures/images

Hello KenzaburOe, I have a setup that you may be able to use for your value collection. Please note...
  • pizi0475
  • pizi0475
  • 2016年09月13日 13:52
  • 281
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:How Display and Iterate through vsSwitch Nodes and Masks
举报原因:
原因补充:

(最多只允许输入30个字)