<HTML><HEAD><link type="text/css" href="../css/main_styles.css" rel="stylesheet"></HEAD>
<BODY><TITLE>%mqc_check_multi_layer_cat</TITLE><H1>%mqc_check_multi_layer_cat </H1><P CLASS="Paragraph">Classname: <B>%mqc_check_multi_layer_cat </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>
    Check if the specified layers are collected in proper category
Parameters:
   (List)   layer_category_map:     -  List of description strings of the
                                       'Layers | Category ' mapping relations.
                                       For example:
                                       {
                                          "1-20     |    SOLID",
                                          "21-40    |    WIREFRAME",
                                          "60       |    CENTERLINE",
                                          "1-40     |    PART"
                                        };
                                       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 specified layers are collected in the proper category
    FAILED  -- if any layer in the specified layers is not collected in the proper category

<B>See Also:</B>
    %mqc_check_single_layer_cat
=============================================================================================
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 layers category mapping strings for interactive selections.
       ( List )   layer_category_map_init:
                      List of strings of layer(s) and category mapping descriptions.
                      It must have the format like:
                        {
                            "layer_range_1 | category_name_1",
                            "layer_range_2 | category_name_2  ",
                             ...
                            "layer_range_n | category_name_n"
                        };
                      The layer_range and the category_name must be separated by '|'.
                             e.g. "1,5-10   |   SOLID "
                      Mutiple layer 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:
                     {
                        "1-20     |    SOLID",
                        "21-40    |    WIREFRAME",
                        "60       |    CENTERLINE",
                        "1-40     |    PART"
                     };
  4. (Optinal) change the default log type
      (integer) log_type:  1;
=============================================================================================
</PRE><PRE><FONT COLOR= blue>DefClass: %mqc_check_multi_layer_cat( %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 Layer / Category 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\">   Attributes for selecting spec to check</PRE><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>   ( List Parameter )        layer_category_map:layer_category_map_init:;
</SPAN></FONT></PRE></DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\">  parameter for log_option                                       </PRE><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>   ( String )                layer_category_map_label: "Layers  /  Category";
   ( List )                  layer_category_map_init:
                             {
                              };

</SPAN></FONT></PRE></DIV><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>   ( Integer Parameter )    log_type: 1;
</SPAN></FONT></PRE></DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\">  parameter for log_message     </PRE><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";
</SPAN></FONT></PRE></DIV><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>   ( 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?(layer_category_map:)
       Then
       {}
       Else
       @{
           Loop
           {
              
               For  $each_sel  In  layer_category_map:;
               
               For  $sel_list  Is  Splitstring( $each_sel, "|" );
               For  $moveblank Is  mqc_removePreSufBlank($sel_list);
                    
               For  $layer_str  Is  First ( $moveblank );
               For  $category   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 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 Loop
                    {
                        For  $each_rule  In  rules_to_check:;
                        For  $layer_str  Is  First( $each_rule ); 
                        For  $category  Is  Second( $each_rule );

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

                          Then
                              ug_mqc_checkLayerCategory( $layer_str;
                                                         $category;
                                                         Nth( log_type:, log_type_option: );
                                                         log_msg:;
                                                         )

                          Else
                              donothing;
                    };

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