@@ -11,7 +11,7 @@ using namespace tesseract_common;
1111PropertyTree buildConfigSchema ()
1212{
1313 PropertyTree schema;
14- auto & cfg = schema. get ( " config" ) ;
14+ auto & cfg = schema[ " config" ] ;
1515 cfg.setAttribute (property_attribute::TYPE, property_type::CONTAINER);
1616 cfg.setAttribute (property_attribute::DOC, " Main config for plugin" );
1717 cfg.setAttribute (property_attribute::REQUIRED, true );
@@ -22,43 +22,43 @@ PropertyTree buildConfigSchema()
2222
2323 // conditional
2424 {
25- auto & prop = cfg. get ( " conditional" ) ;
25+ auto & prop = cfg[ " conditional" ] ;
2626 prop.setAttribute (property_attribute::TYPE, property_type::BOOL);
2727 prop.setAttribute (property_attribute::DEFAULT, true );
2828 prop.setAttribute (property_attribute::DOC, " Enable conditional execution" );
2929 prop.setAttribute (property_attribute::REQUIRED, true );
3030 }
3131 // inputs
3232 {
33- auto & inputs = cfg. get ( " inputs" ) ;
33+ auto & inputs = cfg[ " inputs" ] ;
3434 inputs.setAttribute (property_attribute::TYPE, property_type::CONTAINER);
3535 inputs.setAttribute (property_attribute::DOC, " Input sources" );
3636 inputs.setAttribute (property_attribute::REQUIRED, true );
3737 // program
3838 {
39- auto & prop = inputs. get ( " program" ) ;
39+ auto & prop = inputs[ " program" ] ;
4040 prop.setAttribute (property_attribute::TYPE, property_type::STRING);
4141 prop.setAttribute (property_attribute::DOC, " The composite instruction" );
4242 prop.setAttribute (property_attribute::REQUIRED, true );
4343 }
4444 // environment
4545 {
46- auto & prop = inputs. get ( " environment" ) ;
46+ auto & prop = inputs[ " environment" ] ;
4747 // env.setAttribute("enum", YAML::Load(R"(["dev","stag","prod"])"));
4848 prop.setAttribute (property_attribute::TYPE, property_type::STRING);
4949 prop.setAttribute (property_attribute::DOC, " The tesseract environment" );
5050 prop.setAttribute (property_attribute::REQUIRED, true );
5151 }
5252 // profiles
5353 {
54- auto & prop = inputs. get ( " profiles" ) ;
54+ auto & prop = inputs[ " profiles" ] ;
5555 prop.setAttribute (property_attribute::TYPE, property_type::STRING);
5656 prop.setAttribute (property_attribute::DOC, " The tesseract profiles" );
5757 prop.setAttribute (property_attribute::REQUIRED, true );
5858 // prof.setAttribute("enum", YAML::Load(R"(["A","B"])"));
5959 // prof.addValidator(validateEnum);
6060 // prof.addValidator([](auto const& node, auto& errs, const auto& path){
61- // auto s = node.getValue ().template as<std::string>();
61+ // auto s = node[Value ().template as<std::string>();
6262 // if (s.find(',') == std::string::npos) {
6363 // errs.push_back(path + ": profiles should be comma-separated");
6464 // return false;
@@ -69,19 +69,19 @@ PropertyTree buildConfigSchema()
6969 }
7070 // outputs
7171 {
72- auto & outputs = cfg. get ( " outputs" ) ;
72+ auto & outputs = cfg[ " outputs" ] ;
7373 outputs.setAttribute (property_attribute::TYPE, property_type::CONTAINER);
7474 outputs.setAttribute (property_attribute::DOC, " Output sources" );
7575 outputs.setAttribute (property_attribute::REQUIRED, true );
7676 {
77- auto & prop = outputs. get ( " program" ) ;
77+ auto & prop = outputs[ " program" ] ;
7878 prop.setAttribute (property_attribute::TYPE, property_type::STRING);
7979 prop.setAttribute (property_attribute::REQUIRED, true );
8080 }
8181 }
8282 // format_result_as_input
8383 {
84- auto & prop = cfg. get ( " format_result_as_input" ) ;
84+ auto & prop = cfg[ " format_result_as_input" ] ;
8585 prop.setAttribute (property_attribute::TYPE, property_type::BOOL);
8686 prop.setAttribute (property_attribute::DEFAULT, false );
8787 }
@@ -95,52 +95,52 @@ tesseract_common::PropertyTree getTaskComposerGraphSchema()
9595 schema.setAttribute (property_attribute::TYPE, property_type::CONTAINER);
9696 schema.setAttribute (property_attribute::DOC, " TaskComposerGraph" );
9797 {
98- auto & prop = schema. get ( " class" ) ;
98+ auto & prop = schema[ " class" ] ;
9999 prop.setAttribute (property_attribute::TYPE, property_type::STRING);
100100 prop.setAttribute (property_attribute::DOC, " The class factory name" );
101101 prop.setAttribute (property_attribute::REQUIRED, true );
102102 }
103103
104- auto & config_schema = schema. get ( " config" ) ;
104+ auto & config_schema = schema[ " config" ] ;
105105 config_schema.setAttribute (property_attribute::TYPE, property_type::CONTAINER);
106106 config_schema.setAttribute (property_attribute::REQUIRED, true );
107107 {
108- auto & prop = config_schema. get ( " conditional" ) ;
108+ auto & prop = config_schema[ " conditional" ] ;
109109 prop.setAttribute (property_attribute::TYPE, property_type::BOOL);
110110 prop.setAttribute (property_attribute::DEFAULT, true );
111111 prop.setAttribute (property_attribute::DOC, " Enable conditional execution" );
112112 prop.setAttribute (property_attribute::REQUIRED, true );
113113 }
114114
115115 {
116- auto & inputs = config_schema. get ( " inputs" ) ;
116+ auto & inputs = config_schema[ " inputs" ] ;
117117 inputs.setAttribute (property_attribute::TYPE, property_type::CONTAINER);
118118 inputs.setAttribute (property_attribute::DOC, " Input sources" );
119119 }
120120
121121 {
122- auto & outputs = config_schema. get ( " outputs" ) ;
122+ auto & outputs = config_schema[ " outputs" ] ;
123123 outputs.setAttribute (property_attribute::TYPE, property_type::CONTAINER);
124124 outputs.setAttribute (property_attribute::DOC, " Output sources" );
125125 }
126126
127127 {
128- auto & prop = config_schema. get ( " nodes" ) ;
128+ auto & prop = config_schema[ " nodes" ] ;
129129 prop.setAttribute (property_attribute::TYPE, " TaskComposerGraphNode{}" );
130130 prop.setAttribute (property_attribute::DOC, " Map of all task nodes" );
131131 prop.setAttribute (property_attribute::REQUIRED, true );
132132 }
133133
134134 {
135- auto & prop = config_schema. get ( " edges" ) ;
135+ auto & prop = config_schema[ " edges" ] ;
136136 prop.setAttribute (property_attribute::TYPE, " TaskComposerGraphEdge[]" );
137137 prop.setAttribute (property_attribute::DOC, " List of graph edges" );
138138 prop.setAttribute (property_attribute::REQUIRED, true );
139139 prop.addValidator (validateCustomType);
140140 }
141141
142142 {
143- auto & prop = config_schema. get ( " terminals" ) ;
143+ auto & prop = config_schema[ " terminals" ] ;
144144 prop.setAttribute (property_attribute::TYPE, property_type::createList (property_type::STRING));
145145 prop.setAttribute (property_attribute::DOC, " List of terminal tasks" );
146146 prop.setAttribute (property_attribute::REQUIRED, true );
@@ -157,14 +157,14 @@ tesseract_common::PropertyTree getTaskComposerGraphEdgeSchema()
157157 schema.setAttribute (property_attribute::TYPE, property_type::CONTAINER);
158158 schema.setAttribute (property_attribute::DOC, " TaskComposerGraphEdge" );
159159 {
160- auto & prop = schema. get ( " source" ) ;
160+ auto & prop = schema[ " source" ] ;
161161 prop.setAttribute (property_attribute::TYPE, property_type::STRING);
162162 prop.setAttribute (property_attribute::DOC, " The source task name" );
163163 prop.setAttribute (property_attribute::REQUIRED, true );
164164 }
165165
166166 {
167- auto & prop = schema. get ( " destinations" ) ;
167+ auto & prop = schema[ " destinations" ] ;
168168 prop.setAttribute (property_attribute::TYPE, property_type::createList (property_type::STRING));
169169 prop.setAttribute (property_attribute::DOC, " The list of destination task name" );
170170 prop.setAttribute (property_attribute::REQUIRED, true );
@@ -185,116 +185,116 @@ tesseract_common::PropertyTree getTaskComposerRasterOnlySchema()
185185 return_options[1 ] = " Successful" ;
186186 schema.setAttribute (" return_options" , YAML::Node (return_options));
187187 {
188- auto & prop = schema. get ( " class" ) ;
188+ auto & prop = schema[ " class" ] ;
189189 prop.setAttribute (property_attribute::TYPE, property_type::STRING);
190190 prop.setAttribute (property_attribute::DOC, " The class factory name" );
191191 prop.setAttribute (property_attribute::REQUIRED, true );
192192 }
193193
194- auto & config_schema = schema. get ( " config" ) ;
194+ auto & config_schema = schema[ " config" ] ;
195195 config_schema.setAttribute (property_attribute::TYPE, property_type::CONTAINER);
196196 config_schema.setAttribute (property_attribute::REQUIRED, true );
197197 {
198- auto & prop = config_schema. get ( " conditional" ) ;
198+ auto & prop = config_schema[ " conditional" ] ;
199199 prop.setAttribute (property_attribute::TYPE, property_type::BOOL);
200200 prop.setAttribute (property_attribute::DEFAULT, true );
201201 prop.setAttribute (property_attribute::DOC, " Enable conditional execution" );
202202 prop.setAttribute (property_attribute::REQUIRED, true );
203203 }
204204
205205 {
206- auto & inputs = config_schema. get ( " inputs" ) ;
206+ auto & inputs = config_schema[ " inputs" ] ;
207207 inputs.setAttribute (property_attribute::TYPE, property_type::CONTAINER);
208208 inputs.setAttribute (property_attribute::DOC, " Input sources" );
209209
210210 // program
211211 {
212- auto & prop = inputs. get ( " program" ) ;
212+ auto & prop = inputs[ " program" ] ;
213213 prop.setAttribute (property_attribute::TYPE, property_type::STRING);
214214 prop.setAttribute (property_attribute::DOC, " The composite instruction" );
215215 prop.setAttribute (property_attribute::REQUIRED, true );
216216 }
217217 // environment
218218 {
219- auto & prop = inputs. get ( " environment" ) ;
219+ auto & prop = inputs[ " environment" ] ;
220220 prop.setAttribute (property_attribute::TYPE, property_type::STRING);
221221 prop.setAttribute (property_attribute::DOC, " The tesseract environment" );
222222 prop.setAttribute (property_attribute::REQUIRED, true );
223223 }
224224 }
225225
226226 {
227- auto & outputs = config_schema. get ( " outputs" ) ;
227+ auto & outputs = config_schema[ " outputs" ] ;
228228 outputs.setAttribute (property_attribute::TYPE, property_type::CONTAINER);
229229 outputs.setAttribute (property_attribute::DOC, " Output sources" );
230230 // program
231231 {
232- auto & prop = outputs. get ( " program" ) ;
232+ auto & prop = outputs[ " program" ] ;
233233 prop.setAttribute (property_attribute::TYPE, property_type::STRING);
234234 prop.setAttribute (property_attribute::DOC, " The composite instruction" );
235235 prop.setAttribute (property_attribute::REQUIRED, true );
236236 }
237237 }
238238
239239 {
240- auto & raster = config_schema. get ( " raster" ) ;
240+ auto & raster = config_schema[ " raster" ] ;
241241 raster.setAttribute (property_attribute::TYPE, property_type::CONTAINER);
242242 raster.setAttribute (property_attribute::DOC, " The raster task" );
243243 raster.setAttribute (property_attribute::REQUIRED, true );
244244 {
245- auto & prop = raster. get ( " task" ) ;
245+ auto & prop = raster[ " task" ] ;
246246 prop.setAttribute (property_attribute::TYPE, property_type::STRING);
247247 prop.setAttribute (property_attribute::DOC, " The task name" );
248248 prop.setAttribute (property_attribute::REQUIRED, true );
249249 }
250- auto & raster_config = raster. get ( " config" ) ;
250+ auto & raster_config = raster[ " config" ] ;
251251 raster_config.setAttribute (property_attribute::TYPE, property_type::CONTAINER);
252252 raster_config.setAttribute (property_attribute::REQUIRED, true );
253253 {
254- auto & prop = raster_config. get ( " abort_terminal" ) ;
254+ auto & prop = raster_config[ " abort_terminal" ] ;
255255 prop.setAttribute (property_attribute::TYPE, property_type::INT);
256256 prop.setAttribute (property_attribute::MINIMUM, 0 );
257257 prop.setAttribute (property_attribute::DOC, " The abort terminal" );
258258 }
259259 {
260- auto & prop = raster_config. get ( " remapping" ) ;
260+ auto & prop = raster_config[ " remapping" ] ;
261261 prop.setAttribute (property_attribute::TYPE, property_type::createMap (property_type::STRING));
262262 prop.setAttribute (property_attribute::DOC, " The remapping of input and output keys" );
263263 }
264264 {
265- auto & prop = raster_config. get ( " indexing" ) ;
265+ auto & prop = raster_config[ " indexing" ] ;
266266 prop.setAttribute (property_attribute::TYPE, property_type::createList (property_type::STRING));
267267 prop.setAttribute (property_attribute::DOC, " The input and output keys to index" );
268268 }
269269 }
270270
271271 {
272- auto & transition = config_schema. get ( " transition" ) ;
272+ auto & transition = config_schema[ " transition" ] ;
273273 transition.setAttribute (property_attribute::TYPE, property_type::CONTAINER);
274274 transition.setAttribute (property_attribute::DOC, " The transition task" );
275275 transition.setAttribute (property_attribute::REQUIRED, true );
276276 {
277- auto & prop = transition. get ( " task" ) ;
277+ auto & prop = transition[ " task" ] ;
278278 prop.setAttribute (property_attribute::TYPE, property_type::STRING);
279279 prop.setAttribute (property_attribute::DOC, " The task name" );
280280 prop.setAttribute (property_attribute::REQUIRED, true );
281281 }
282- auto & transition_config = transition. get ( " config" ) ;
282+ auto & transition_config = transition[ " config" ] ;
283283 transition_config.setAttribute (property_attribute::TYPE, property_type::CONTAINER);
284284 transition_config.setAttribute (property_attribute::REQUIRED, true );
285285 {
286- auto & prop = transition_config. get ( " abort_terminal" ) ;
286+ auto & prop = transition_config[ " abort_terminal" ] ;
287287 prop.setAttribute (property_attribute::TYPE, property_type::INT);
288288 prop.setAttribute (property_attribute::MINIMUM, 0 );
289289 prop.setAttribute (property_attribute::DOC, " The abort terminal" );
290290 }
291291 {
292- auto & prop = transition_config. get ( " remapping" ) ;
292+ auto & prop = transition_config[ " remapping" ] ;
293293 prop.setAttribute (property_attribute::TYPE, property_type::createMap (property_type::STRING));
294294 prop.setAttribute (property_attribute::DOC, " The remapping of input and output keys" );
295295 }
296296 {
297- auto & prop = transition_config. get ( " indexing" ) ;
297+ auto & prop = transition_config[ " indexing" ] ;
298298 prop.setAttribute (property_attribute::TYPE, property_type::createList (property_type::STRING));
299299 prop.setAttribute (property_attribute::DOC, " The input and output keys to index" );
300300 }
@@ -399,7 +399,7 @@ int testBasic()
399399 return 1 ;
400400 }
401401
402- bool cond = schema. get ( " config" ). get ( " conditional" ) .getValue ().as <bool >();
402+ bool cond = schema[ " config" ][ " conditional" ] .getValue ().as <bool >();
403403 std::cout << " conditional = " << std::boolalpha << cond << " \n " ;
404404 return 0 ;
405405}
0 commit comments