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 const char *rgbToGrey = 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 const char *gradientRow = 39 "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]})"; 40 const char *gradientCol = 41 "3(!:32#KernelContext:{x:s32,maxX:s32}),(?:8+F32Array2D:{width:s32,height:s32,array:[*:?:f32]}),(?:8+F32Array2D:{width:s32,height:s32,array:[*:?:f32]})"; 42 const char *squares = "2(!:32#KernelContext:{x:s32,maxX:s32}),(?:4+S32Array:{length:s32,array:[*:?:s32]})"; 43 const char *suaresadd = 44 "3(!:32#KernelContext:{x:s32,maxX:s32}),(?:4+S32Array:{length:s32,array:[*:?:s32]}),(?:s32)"; 45 const char *cascadeSchema = R"(6 46 (!:32#KernelContext:{x:s32,maxX:s32}), 47 (!:163472#Cascade:{ 48 width:s32, 49 height:s32, 50 featureCount:s32, 51 feature:[2913: 52 Feature:{ 53 id:s32, 54 threshold:f32, 55 left:{ 56 hasValue:z8, 57 ?:x3, 58 anon:< 59 featureId:s32| 60 value:f32 61 > 62 }, 63 right:{ 64 hasValue:z8, 65 ?:x3, 66 anon:< 67 featureId:s32| 68 value:f32 69 > 70 }, 71 rect:[3: 72 Rect:{ 73 x:s8, 74 y:s8, 75 width:s8, 76 height:s8, 77 weight:f32 78 } 79 ] 80 } 81 ], 82 stageCount:s32, 83 stage:[25: 84 Stage:{ 85 id:s32, 86 threshold:f32, 87 firstTreeId:s16, 88 treeCount:s16 89 } 90 ], 91 treeCount:s32, 92 tree:[2913: 93 Tree:{ 94 id:s32, 95 firstFeatureId:s16, 96 featureCount:s16 97 } 98 ] 99 } 100 ), 101 (?:8+F32Array2D:{width:s32,height:s32,array:[*:?:f32]}), 102 (?:8+F32Array2D:{width:s32,height:s32,array:[*:?:f32]}), 103 (?: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}]}), 104 (?:8+ResultTable:{length:s32,atomicResultTableCount:s32,result:[*:Result:{x:f32,y:f32,width:f32,height:f32}]}))"; 105 char *schema = (char *) suaresadd; 106 std::cout << "schema = '" << schema << "'" << std::endl; 107 SchemaCursor cursor(schema); 108 Schema::SchemaNode schemaNode; 109 schemaNode.parse(&cursor); 110 111 112 Schema::show(std::cout, &schemaNode); 113 }