#include <itl_generator.h>
|
| itl_generator () |
|
bool | do_included_files () const |
|
void | gen_prologue () |
|
void | gen_epilogue () |
|
bool | gen_enum (AST_Enum *, UTL_ScopedName *name, const std::vector< AST_EnumVal *> &contents, const char *repoid) |
|
bool | gen_struct (AST_Structure *node, UTL_ScopedName *name, const std::vector< AST_Field *> &fields, AST_Type::SIZE_TYPE size, const char *repoid) |
|
bool | gen_typedef (AST_Typedef *, UTL_ScopedName *, AST_Type *, const char *) |
|
bool | gen_union (AST_Union *, UTL_ScopedName *, const std::vector< AST_UnionBranch *> &, AST_Type *, const char *) |
|
virtual | ~dds_generator ()=0 |
|
virtual bool | gen_const (UTL_ScopedName *, bool, AST_Constant *) |
|
virtual bool | gen_struct_fwd (UTL_ScopedName *, AST_Type::SIZE_TYPE) |
|
virtual bool | gen_interf (AST_Interface *, UTL_ScopedName *, bool, const std::vector< AST_Interface *> &, const std::vector< AST_Interface *> &, const std::vector< AST_Attribute *> &, const std::vector< AST_Operation *> &, const char *) |
|
virtual bool | gen_interf_fwd (UTL_ScopedName *) |
|
virtual bool | gen_native (AST_Native *, UTL_ScopedName *, const char *) |
|
virtual bool | gen_union_fwd (AST_UnionFwd *, UTL_ScopedName *, AST_Type::SIZE_TYPE) |
|
Definition at line 14 of file itl_generator.h.
◆ itl_generator()
itl_generator::itl_generator |
( |
| ) |
|
|
inline |
◆ do_included_files()
bool itl_generator::do_included_files |
( |
| ) |
const |
|
inlinevirtual |
◆ gen_enum()
bool itl_generator::gen_enum |
( |
AST_Enum * |
, |
|
|
UTL_ScopedName * |
name, |
|
|
const std::vector< AST_EnumVal *> & |
contents, |
|
|
const char * |
repoid |
|
) |
| |
|
virtual |
Reimplemented from dds_generator.
Definition at line 162 of file itl_generator.cpp.
References be_global.
Referenced by do_included_files().
168 << Indent(
this) <<
"{\n" 170 << Indent(
this) <<
"\"kind\" : \"alias\",\n" 171 << Indent(
this) <<
"\"name\" : \"" << repoid <<
"\",\n" 172 << Indent(
this) <<
"\"type\" :\n" 174 << Indent(
this) <<
"{\n" 176 << Indent(
this) <<
"\"kind\" : \"int\",\n" 177 << Indent(
this) <<
"\"bits\" : 32,\n" 178 << Indent(
this) <<
"\"unsigned\" : true,\n" 179 << Indent(
this) <<
"\"constrained\" : true,\n" 180 << Indent(
this) <<
"\"values\" : {";
182 for (
size_t i = 0; i < contents.size(); ++i) {
185 be_global->itl_ <<
'"' << contents[i]->local_name()->get_string() <<
'"' 192 << Indent(
this) <<
"}\n" 196 << Indent(
this) <<
"}\n" BE_GlobalData * be_global
◆ gen_epilogue()
void itl_generator::gen_epilogue |
( |
| ) |
|
|
virtual |
◆ gen_prologue()
void itl_generator::gen_prologue |
( |
| ) |
|
|
virtual |
◆ gen_struct()
bool itl_generator::gen_struct |
( |
AST_Structure * |
node, |
|
|
UTL_ScopedName * |
name, |
|
|
const std::vector< AST_Field *> & |
fields, |
|
|
AST_Type::SIZE_TYPE |
size, |
|
|
const char * |
repoid |
|
) |
| |
|
virtual |
Implements dds_generator.
Definition at line 299 of file itl_generator.cpp.
References be_global.
Referenced by do_included_files().
306 const bool is_topic_type =
307 idl_global->is_dcps_type(node->name()) ||
be_global->is_topic_type(node);
312 << Indent(
this) <<
"{\n" 314 << Indent(
this) <<
"\"kind\" : \"alias\",\n" 315 << Indent(
this) <<
"\"name\" : \"" << repoid <<
"\",\n" 318 << Indent(
this) <<
"\"note\" : { \"is_dcps_data_type\" : " 319 << (is_topic_type ?
"true" :
"false")
322 << Indent(
this) <<
"\"type\" :\n" 324 << Indent(
this) <<
"{\n" 326 << Indent(
this) <<
"\"kind\" : \"record\",\n" 327 << Indent(
this) <<
"\"fields\" :\n" 329 << Indent(
this) <<
"[\n";
331 bool comma_flag =
false;
332 for (std::vector<AST_Field*>::const_iterator pos = fields.begin(), limit = fields.end();
335 AST_Field* field = *pos;
337 be_global->itl_ << Indent(
this) <<
",\n";
340 << Indent(
this) <<
"{\n" 342 << Indent(
this) <<
"\"name\" : \"" << field->local_name()->get_string() <<
"\",\n" 343 << Indent(
this) <<
"\"type\" : " <<
InlineType(field->field_type()) <<
"\n" 345 << Indent(
this) <<
"}\n" 353 << Indent(
this) <<
"}\n" 356 << Indent(
this) <<
"}\n"
BE_GlobalData * be_global
◆ gen_typedef()
bool itl_generator::gen_typedef |
( |
AST_Typedef * |
, |
|
|
UTL_ScopedName * |
, |
|
|
AST_Type * |
base, |
|
|
const char * |
repoid |
|
) |
| |
|
virtual |
Implements dds_generator.
Definition at line 202 of file itl_generator.cpp.
References be_global.
Referenced by do_included_files().
208 switch (base->node_type()) {
209 case AST_Decl::NT_sequence:
211 AST_Sequence *seq =
dynamic_cast<AST_Sequence*
>(base);
213 << Indent(
this) <<
"{\n" 215 << Indent(
this) <<
"\"kind\" : \"alias\",\n" 216 << Indent(
this) <<
"\"name\" : \"" << repoid <<
"\",\n" 217 << Indent(
this) <<
"\"type\" :\n" 219 << Indent(
this) <<
"{\n" 221 << Indent(
this) <<
"\"kind\" : \"sequence\",\n";
222 if (!seq->unbounded()) {
223 be_global->itl_ << Indent(
this) <<
"\"capacity\" : " << seq->max_size()->ev()->u.ulval <<
",\n";
227 << Indent(
this) <<
"}\n" 230 << Indent(
this) <<
"}\n" 234 case AST_Decl::NT_array:
236 AST_Array* arr =
dynamic_cast<AST_Array*
>(base);
238 << Indent(
this) <<
"{\n" 240 << Indent(
this) <<
"\"kind\" : \"alias\",\n" 241 << Indent(
this) <<
"\"name\" : \"" << repoid <<
"\",\n" 242 << Indent(
this) <<
"\"type\" :\n" 244 << Indent(
this) <<
"{\n" 246 << Indent(
this) <<
"\"kind\" : \"sequence\",\n" 247 << Indent(
this) <<
"\"type\" : " <<
InlineType(arr->base_type()) <<
",\n" 248 << Indent(
this) <<
"\"size\" : [";
250 for (
size_t i = 0; i < dims; ++i) {
253 be_global->itl_ << arr->dims()[i]->ev()->u.ulval;
257 << Indent(
this) <<
"}\n" 260 << Indent(
this) <<
"}\n" 264 case AST_Decl::NT_fixed:
266 AST_Fixed* fixed =
dynamic_cast<AST_Fixed*
>(base);
267 unsigned digits = fixed->digits()->ev()->u.ulval;
268 unsigned scale = fixed->scale()->ev()->u.ulval;
270 << Open(
this) << Indent(
this) <<
"{\n" << Open(
this)
271 << Indent(
this) <<
"\"kind\" : \"alias\",\n" 272 << Indent(
this) <<
"\"name\" : \"" << repoid <<
"\",\n" 273 << Indent(
this) <<
"\"type\" : { " 274 <<
"\"kind\" : \"fixed\", " 275 <<
"\"digits\" : " << digits <<
", " 276 <<
"\"scale\" : " << scale <<
", " 277 <<
"\"base\" : 10 }\n" 278 << Close(
this) << Indent(
this) <<
"}\n" << Close(
this);
284 << Indent(
this) <<
"{\n" 286 << Indent(
this) <<
"\"kind\" : \"alias\",\n" 287 << Indent(
this) <<
"\"name\" : \"" << repoid <<
"\",\n" 288 << Indent(
this) <<
"\"type\" : " <<
InlineType(base) <<
"\n" 290 << Indent(
this) <<
"}\n"
BE_GlobalData * be_global
◆ gen_union()
bool itl_generator::gen_union |
( |
AST_Union * |
node, |
|
|
UTL_ScopedName * |
, |
|
|
const std::vector< AST_UnionBranch *> & |
cases, |
|
|
AST_Type * |
_d, |
|
|
const char * |
repoid |
|
) |
| |
|
virtual |
Implements dds_generator.
Definition at line 364 of file itl_generator.cpp.
References be_global.
Referenced by do_included_files().
372 << Indent(
this) <<
"{\n" 374 << Indent(
this) <<
"\"kind\" : \"alias\",\n" 375 << Indent(
this) <<
"\"name\" : \"" << repoid <<
"\",\n" 376 << Indent(
this) <<
"\"type\" :\n" 378 << Indent(
this) <<
"{\n" 380 << Indent(
this) <<
"\"kind\" : \"union\",\n" 381 << Indent(
this) <<
"\"discriminator\" : " <<
InlineType(_d) <<
",\n" 382 << Indent(
this) <<
"\"note\" : { \"is_dcps_data_type\" : " 383 << (
be_global->is_topic_type(node) ?
"true" :
"false")
385 << Indent(
this) <<
"\"fields\" :\n" 387 << Indent(
this) <<
"[\n";
389 for (std::vector<AST_UnionBranch*>::const_iterator pos = cases.begin(), limit = cases.end();
392 if (pos != cases.begin())
393 be_global->itl_ << Indent(
this) <<
",\n";
395 AST_UnionBranch *branch = *pos;
398 << Indent(
this) <<
"{\n" 400 << Indent(
this) <<
"\"name\" : \"" << branch->local_name()->get_string() <<
"\",\n" 401 << Indent(
this) <<
"\"type\" : " <<
InlineType(branch->field_type()) <<
",\n" 403 << Indent(
this) <<
"\"labels\" : [";
406 unsigned long count = branch->label_list_length();
407 for (
unsigned long i = 0; i < count; i++)
411 AST_UnionLabel *label = branch->label(i);
412 if (label->label_kind() == AST_UnionLabel::UL_default)
416 be_global->itl_ <<
"\"" << label->label_val()->n()->last_component()->get_string() <<
"\"";
421 << Indent(
this) <<
"}\n" 428 << Indent(
this) <<
"}\n" 431 << Indent(
this) <<
"}\n"
BE_GlobalData * be_global
◆ new_type()
void itl_generator::new_type |
( |
| ) |
|
|
private |
◆ count_
size_t itl_generator::count_ |
|
private |
◆ level_
int itl_generator::level_ |
The documentation for this class was generated from the following files: