MCPcopy Create free account
hub / github.com/OpenDDS/OpenDDS / gen_struct

Method gen_struct

dds/idl/itl_generator.cpp:299–361  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

297}
298
299bool itl_generator::gen_struct(AST_Structure* node, UTL_ScopedName*,
300 const std::vector<AST_Field*>& fields,
301 AST_Type::SIZE_TYPE, const char* repoid)
302{
303 if (!be_global->itl())
304 return true;
305
306 const bool is_topic_type =
307 idl_global->is_dcps_type(node->name()) || be_global->is_topic_type(node);
308
309 new_type();
310
311 be_global->itl_ << Open(this)
312 << Indent(this) << "{\n"
313 << Open(this)
314 << Indent(this) << "\"kind\" : \"alias\",\n"
315 << Indent(this) << "\"name\" : \"" << repoid << "\",\n"
316
317 // Check if this is defined as a primary data type
318 << Indent(this) << "\"note\" : { \"is_dcps_data_type\" : "
319 << (is_topic_type ? "true" : "false")
320 << " },\n"
321
322 << Indent(this) << "\"type\" :\n"
323 << Open(this)
324 << Indent(this) << "{\n"
325 << Open(this)
326 << Indent(this) << "\"kind\" : \"record\",\n"
327 << Indent(this) << "\"fields\" :\n"
328 << Open(this)
329 << Indent(this) << "[\n";
330
331 bool comma_flag = false;
332 for (std::vector<AST_Field*>::const_iterator pos = fields.begin(), limit = fields.end();
333 pos != limit;
334 ++pos) {
335 AST_Field* field = *pos;
336 if (comma_flag) {
337 be_global->itl_ << Indent(this) << ",\n";
338 }
339 be_global->itl_ << Open(this)
340 << Indent(this) << "{\n"
341 << Open(this)
342 << Indent(this) << "\"name\" : \"" << field->local_name()->get_string() << "\",\n"
343 << Indent(this) << "\"type\" : " << InlineType(field->field_type()) << "\n"
344 << Close(this)
345 << Indent(this) << "}\n"
346 << Close(this);
347 comma_flag = true;
348 }
349
350 be_global->itl_ << Indent(this) << "]\n"
351 << Close(this)
352 << Close(this)
353 << Indent(this) << "}\n"
354 << Close(this)
355 << Close(this)
356 << Indent(this) << "}\n"

Callers

nothing calls this directly

Calls 10

OpenClass · 0.85
IndentClass · 0.85
InlineTypeClass · 0.85
CloseClass · 0.85
itlMethod · 0.80
is_topic_typeMethod · 0.80
nameMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
get_stringMethod · 0.45

Tested by

no test coverage detected