1 /*
  2  * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
  3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4  *
  5  * This code is free software; you can redistribute it and/or modify it
  6  * under the terms of the GNU General Public License version 2 only, as
  7  * published by the Free Software Foundation.  Oracle designates this
  8  * particular file as subject to the "Classpath" exception as provided
  9  * by Oracle in the LICENSE file that accompanied this code.
 10  *
 11  * This code is distributed in the hope that it will be useful, but WITHOUT
 12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 14  * version 2 for more details (a copy is included in the LICENSE file that
 15  * accompanied this code).
 16  *
 17  * You should have received a copy of the GNU General Public License version
 18  * 2 along with this work; if not, write to the Free Software Foundation,
 19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 20  *
 21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 22  * or visit www.oracle.com if you need additional information or have any
 23  * questions.
 24  */
 25 
 26 #include "schema.h"
 27 
 28 int main(int argc, char **argv) {
 29     char *rgbToGrey = (char *) R"(3
 30        (!:32#KernelContext:{
 31           x:s32,
 32           maxX:s32
 33        }),
 34        (?:16+RgbS08x3Image:{
 35            width:s32,height:s32,elementsPerPixel:s32,bufferedImageType:s32,data:[*:?:s8]}),
 36        (?:8+F32Array2D:{width:s32,height:s32,array:[*:?:f32]})
 37     )";
 38     char *gradientRow = (char *) "4(!:32#KernelContext:{x:s32,maxX:s32}),(?:8+F32Array2D:{width:s32,height:s32,array:[*:?:f32]}),(?:8+F32Array2D:{width:s32,height:s32,array:[*:?:f32]}),(?:8+F32Array2D:{width:s32,height:s32,array:[*:?:f32]})";
 39     char *gradientCol = (char *)
 40             "3(!:32#KernelContext:{x:s32,maxX:s32}),(?:8+F32Array2D:{width:s32,height:s32,array:[*:?:f32]}),(?:8+F32Array2D:{width:s32,height:s32,array:[*:?:f32]})";
 41     char* squares = (char*)"2(!:32#KernelContext:{x:s32,maxX:s32}),(?:4+S32Array:{length:s32,array:[*:?:s32]})";
 42     char *suaresadd=(char*)"3(!:32#KernelContext:{x:s32,maxX:s32}),(?:4+S32Array:{length:s32,array:[*:?:s32]}),(?:s32)";
 43     char *cascadeSchema = (char *) R"(6
 44         (!:32#KernelContext:{x:s32,maxX:s32}),
 45         (!:163472#Cascade:{
 46             width:s32,
 47             height:s32,
 48             featureCount:s32,
 49             feature:[2913:
 50                 Feature:{
 51                    id:s32,
 52                    threshold:f32,
 53                    left:{
 54                         hasValue:z8,
 55                         ?:x3,
 56                         anon:<
 57                              featureId:s32|
 58                              value:f32
 59                         >
 60                    },
 61                    right:{
 62                          hasValue:z8,
 63                          ?:x3,
 64                          anon:<
 65                               featureId:s32|
 66                               value:f32
 67                          >
 68                    },
 69                    rect:[3:
 70                        Rect:{
 71                            x:s8,
 72                            y:s8,
 73                            width:s8,
 74                            height:s8,
 75                            weight:f32
 76                        }
 77                    ]
 78                 }
 79             ],
 80             stageCount:s32,
 81             stage:[25:
 82                 Stage:{
 83                     id:s32,
 84                     threshold:f32,
 85                     firstTreeId:s16,
 86                     treeCount:s16
 87                 }
 88             ],
 89             treeCount:s32,
 90             tree:[2913:
 91                 Tree:{
 92                     id:s32,
 93                     firstFeatureId:s16,
 94                     featureCount:s16
 95                 }
 96             ]
 97         }
 98         ),
 99         (?:8+F32Array2D:{width:s32,height:s32,array:[*:?:f32]}),
100         (?:8+F32Array2D:{width:s32,height:s32,array:[*:?:f32]}),
101         (?:8+ScaleTable:{length:s32,multiScaleAccumulativeRange:s32,scale:[*:Scale:{scaleValue:f32,scaledXInc:f32,scaledYInc:f32,invArea:f32,scaledFeatureWidth:s32,scaledFeatureHeight:s32,gridWidth:s32,gridHeight:s32,gridSize:s32,accumGridSizeMin:s32,accumGridSizeMax:s32}]}),
102         (?:8+ResultTable:{length:s32,atomicResultTableCount:s32,result:[*:Result:{x:f32,y:f32,width:f32,height:f32}]}))";
103     char *schema = suaresadd;
104     std::cout << "schema = '" << schema << "'" << std::endl;
105     Cursor cursor(schema);
106     Schema::SchemaNode schemaNode;
107     schemaNode.parse(&cursor);
108 
109 
110     Schema::show(std::cout, &schemaNode);
111 }
112