<HTML><HEAD><link type="text/css" href="../css/main_styles.css" rel="stylesheet"></HEAD>
<BODY><TITLE>%mqc_check_multi_cat_layermask</TITLE><H1>%mqc_check_multi_cat_layermask </H1><P CLASS="Paragraph">Classname: <B>%mqc_check_multi_cat_layermask </B></P><P CLASS="Paragraph">Inherits from: <B><A href=..\checkmate\xug_base_checker.html>%ug_base_checker </A></B></P><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"> </PRE><PRE STYLE=\"text-align : left;\" CLASS=\"Code\">
<B>Description:</B>
    Validate the layer mask of category.  This function will check if the secified category
    collects all specified layers, including empty layers.
Parameters:
   (List)category_layermask_map: - List of description strings of
                                   the 'Category | Layer Mask' mapping relations.
                                   For example:
                                   {
                                       "SOLID           |    1",
                                       "WIREFRAME       |    2",
                                       "CENTERLINE      |    3",
                                       "PART            |    1-3"
                                    };
                                   This is the mandatory parameter for the checker.
    (Boolean)  disabled?        -  If it is true, the checker is disabled.
                                     Default is False.
    (Boolean)  save_log_in_part -  The flag indicates whether the checking results can
                                     be saved to the part file
                                     Default is True.
   (Integer) log_type:           - Indicate which logging type to use to report
                                   the violation
                                   1 - log error
                                   2 - log warning
                                   3 - log information
                                   The default value is 1 which is to log error.
   (String)  log_msg:            - user defined message to be added when the system
                                   reports the violation.
                                   The default is no additional message.
Results:
    PASS    --  If all queried categories collect and only collect the specified layers.
    FAILED  --  If any queried category collects improper layers.
    The system will generate a warning if the given categories does not exist.

<B>See Also:</B>
    %mqc_check_single_cat_layermask
=============================================================================================
Create a new checker from this template by specifying the values of the mandatory parameters:
  1. (Must)     change the class name, and the category name
  2. (Optional) change the display name. (optional)
  3. (Must)     specify the category layer mapping strings for interactive selections.
       ( list )   category_layermask_map_init:
                      List of strings of category and layer mask mapping descriptions.
                      It must have the format like:
                        {
                            "category_name_1  |  layermask_range_1",
                            "category_name_2  |  layermask_range_2",
                            ...
                            "category_name_n  |  layermask_range_n"
                        };
                      The category_name and the layermask_range must be separated by '|'.
                             e.g. "SOLID   |   1,5-10 "
                      Mutiple layer mask ranges in the description strings
                      must be separated by commas,
                             e.g. "1,3-5,7,9" means layer 1, layers 3 to 5
                                  plus layer 7, and layer 9.
                      For example:
                           {
                               "SOLID           |    1",
                               "WIREFRAME       |    2",
                               "CENTERLINE      |    3",
                               "PART            |    1-3"
                           };
  4. (Optinal) change the default log type
      (integer) log_type:  1;
=============================================================================================
</PRE><PRE><FONT COLOR= blue>DefClass: %mqc_check_multi_cat_layermask( %ug_base_checker );
</FONT></PRE><PRE STYLE=\"text-align : left;\" CLASS=\"Code\">  Check-Mate attributes and parameters</PRE><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>( String )                      %test_category: "Template.File Structure";
( String )                      %displayed_name: "Check Category / Layer Mask Mappings ";

</SPAN></FONT></PRE></DIV><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>( Boolean Parameter )           disabled?: false;
( Boolean Parameter )           save_log_in_part: true;
</SPAN></FONT></PRE></DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\">  Checker specific parameters and attributes</PRE><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>( String )                      category_layermask_map_label: "Category / Layer Mask";
( List )                        category_layermask_map_init: 
                                {
                                };

 # parameter for log_option                                       
</SPAN></FONT></PRE></DIV><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>( List )                    log_type_option: { LOG_ERROR, LOG_WARNING, LOG_INFO, LOG_ANY };
( String )                  log_type_label: "Log Option";
 # parameter for log_message     
</SPAN></FONT></PRE></DIV><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>( List Parameter )              category_layermask_map: category_layermask_map_init:;
( Integer Parameter )        log_type: 1;
( String Parameter )        log_msg: "";
</SPAN></FONT></PRE></DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\">  Attribute for check rules:</PRE><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>( String )                  log_msg_label: "Log Message";

</SPAN></FONT></PRE></DIV><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>( List ) rules_to_check:
@{
    If Empty?(category_layermask_map:)
    Then
    {}
    Else
    @{      
          
        Loop      
        {      
            For  $each_sel  In  category_layermask_map:;      
            For  $sel_list  Is  Splitstring( $each_sel, "|" );    
            For  $moveblank Is  mqc_removePreSufBlank($sel_list);         
          
            For  $category  Is  First ( $moveblank );     
            For  $layer_str Is  Second( $moveblank );     
              
            For  $valid_map Is  ( -( $category = "" ) ) & ( -( $category = noValue ) ) &  ( -( $layer_str = "" ) ) & ( -( $layer_str = noValue ) ); 
              
            For  $valid_layer  Is  ( -( $layer_str = "" ) ) & ( -( $layer_str = noValue ) ) &( ug_rexp_match( $layer_str, "[0-9][0-9,\-]{0,}" ) );
             
            Do  If ( $valid_map )
                Then  If ( $valid_layer )
                      Then donothing
                      Else  ug_mqc_log( LOG_WARNING, {}, "Category "+$category+" with invalid layer mask string." )
                Else  ug_mqc_log( LOG_WARNING, {}, "Invalid mapping: " + $each_sel +" ." );
            If  ( $valid_layer ) & ( $valid_map )
                  Append { $moveblank };                            
                
         };
      };
 };



</SPAN></FONT></PRE></DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\">  checking ...</PRE><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>( Any Uncached ) do_check: 

      If ( Empty?( rules_to_check: ) )

      Then
          ug_mqc_empty_param_warning()

      Else
      @{
          $rules_table << If ( mqc_is_nestedList( rules_to_check: ) )
                          Then rules_to_check:
                          Else { rules_to_check: }; 
      
          $check_rules << Loop
          {
              For  $each_rule  In  $rules_table;

              For  $is_param_list_right  Is  mqc_check_param_list( $each_rule, true, { STRING, STRING } );

              Do

                If ( $is_param_list_right )

                Then
                @{
                    $category_name << First( $each_rule );

                    $layer_array << Second( $each_rule );

                    If ( 0 = ug_mqc_checkRequiredCategory( { $category_name }, LOG_WARNING, "" ) )

                    Then
                        ug_mqc_checkLayerOfCategory( $category_name, 
                                                     4, 
                                                     $layer_array,
                                                     nth( log_type:, log_type_option: ), 
                                                     log_msg:)

                    Else
                        category_not_exist;
                }

                Else
                    param_list_false;
           };
      };

</SPAN></FONT></PRE></DIV></TABLE><p class=EndLine>&nbsp;</p><p class=blank>&nbsp;</p></BODY></HTML>