13 #ifdef ACE_HAS_CDR_FIXED 14 # include <ast_fixed.h> 16 #include <utl_identifier.h> 28 std::string string_ns =
"::CORBA";
32 std::map<AST_PredefinedType::PredefinedType, std::string> primtype_;
35 HLP_STR_VAR, HLP_STR_OUT, HLP_WSTR_VAR, HLP_WSTR_OUT,
36 HLP_STR_MGR, HLP_WSTR_MGR,
37 HLP_FIX_VAR, HLP_VAR_VAR, HLP_OUT,
38 HLP_SEQ, HLP_SEQ_NS, HLP_SEQ_VAR_VAR, HLP_SEQ_FIX_VAR, HLP_SEQ_OUT,
39 HLP_ARR_VAR_VAR, HLP_ARR_FIX_VAR, HLP_ARR_OUT, HLP_ARR_FORANY,
40 HLP_FIXED, HLP_FIXED_CONSTANT
42 std::map<Helper, std::string> helpers_;
44 std::string exporter()
50 std::string array_zero_indices(AST_Array* arr)
61 AST_Array*
const arr =
dynamic_cast<AST_Array*
>(type);
62 std::string ret = array_zero_indices(arr);
65 if (dynamic_cast<AST_Array*>(base)) {
66 ret +=
"[0]" + array_dims(base, elems);
71 void gen_typecode(UTL_ScopedName*
name)
73 if (
be_global->suppress_typecode() ||
be_global->language_mapping() == BE_GlobalData::LANGMAP_CXX11) {
76 const char*
const nm = name->last_component()->get_string();
78 "extern " << exporter() <<
"const ::CORBA::TypeCode_ptr _tc_" << nm
82 "const ::CORBA::TypeCode_ptr _tc_" << nm <<
" = 0;\n";
90 virtual void init() = 0;
91 virtual void gen_sequence(UTL_ScopedName* tdname, AST_Sequence* seq) = 0;
92 virtual bool gen_struct(AST_Structure* s, UTL_ScopedName*
name,
const std::vector<AST_Field*>& fields, AST_Type::SIZE_TYPE size,
const char* x) = 0;
101 if (dynamic_cast<AST_Typedef*>(type)) {
102 return scoped(type->name());
107 return primtype_[
dynamic_cast<AST_PredefinedType*
>(actual)->pt()];
110 const AST_PredefinedType::PredefinedType chartype = (cls &
CL_WIDE)
111 ? AST_PredefinedType::PT_wchar : AST_PredefinedType::PT_char;
112 return map_type_string(chartype,
false);
115 return scoped(type->name());
118 return scoped(type->name()) +
"_var";
120 return "<<unknown>>";
129 virtual std::string
map_type_string(AST_PredefinedType::PredefinedType chartype,
bool constant)
131 return primtype_[chartype] +
'*' + (constant ?
" const" :
"");
134 std::string
map_type(AST_Expression::ExprType type)
136 AST_PredefinedType::PredefinedType pt = AST_PredefinedType::PT_void;
138 #if OPENDDS_HAS_EXPLICIT_INTS 139 case AST_Expression::EV_int8: pt = AST_PredefinedType::PT_int8;
break;
140 case AST_Expression::EV_uint8: pt = AST_PredefinedType::PT_uint8;
break;
142 case AST_Expression::EV_short: pt = AST_PredefinedType::PT_short;
break;
143 case AST_Expression::EV_ushort: pt = AST_PredefinedType::PT_ushort;
break;
144 case AST_Expression::EV_long: pt = AST_PredefinedType::PT_long;
break;
145 case AST_Expression::EV_ulong: pt = AST_PredefinedType::PT_ulong;
break;
146 case AST_Expression::EV_longlong: pt = AST_PredefinedType::PT_longlong;
break;
147 case AST_Expression::EV_ulonglong: pt = AST_PredefinedType::PT_ulonglong;
break;
148 case AST_Expression::EV_float: pt = AST_PredefinedType::PT_float;
break;
149 case AST_Expression::EV_double: pt = AST_PredefinedType::PT_double;
break;
150 case AST_Expression::EV_longdouble: pt = AST_PredefinedType::PT_longdouble;
break;
151 case AST_Expression::EV_char: pt = AST_PredefinedType::PT_char;
break;
152 case AST_Expression::EV_wchar: pt = AST_PredefinedType::PT_wchar;
break;
153 case AST_Expression::EV_octet: pt = AST_PredefinedType::PT_octet;
break;
154 case AST_Expression::EV_bool: pt = AST_PredefinedType::PT_boolean;
break;
155 case AST_Expression::EV_string: pt = AST_PredefinedType::PT_char;
break;
156 case AST_Expression::EV_wstring: pt = AST_PredefinedType::PT_wchar;
break;
157 #ifdef ACE_HAS_CDR_FIXED 158 case AST_Expression::EV_fixed:
159 be_global->add_include(
"FACE/Fixed.h", BE_GlobalData::STREAM_LANG_H);
160 return helpers_[HLP_FIXED_CONSTANT];
166 if (type == AST_Expression::EV_string || type == AST_Expression::EV_wstring)
167 return map_type_string(pt,
true);
169 return primtype_[pt];
175 "typedef " << nm <<
"& " << nm <<
"_out;\n";
181 virtual void struct_decls(UTL_ScopedName* name, AST_Type::SIZE_TYPE size,
const char* struct_or_class =
"struct")
183 be_global->add_include(
"<tao/VarOut_T.h>", BE_GlobalData::STREAM_LANG_H);
184 const char*
const nm = name->last_component()->get_string();
186 struct_or_class <<
' ' << nm <<
";\n";
188 case AST_Type::SIZE_UNKNOWN:
189 be_global->lang_header_ <<
"/* Unknown size */\n";
191 case AST_Type::FIXED:
193 "typedef " << helpers_[HLP_FIX_VAR] <<
'<' << nm <<
"> " << nm <<
"_var;\n" <<
194 "typedef " << nm <<
"& " << nm <<
"_out;\n";
196 case AST_Type::VARIABLE:
198 "typedef " << helpers_[HLP_VAR_VAR] <<
'<' << nm <<
"> " << nm <<
"_var;\n" <<
199 "typedef " << helpers_[HLP_OUT] <<
'<' << nm <<
"> " << nm <<
"_out;\n";
206 std::stringstream first_label;
207 AST_Union::DefaultValue dv;
208 if (the_union->default_value(dv) == -1) {
210 ACE_TEXT(
"(%P|%t) ERROR: generateDefaultValue::")
211 ACE_TEXT(
" computing default value failed\n")));
215 switch (the_union->udisc_type ())
217 #if OPENDDS_HAS_EXPLICIT_INTS 218 case AST_Expression::EV_int8:
219 first_label << signed(dv.u.char_val);
221 case AST_Expression::EV_uint8:
222 first_label << unsigned(dv.u.char_val);
225 case AST_Expression::EV_short:
226 first_label << dv.u.short_val;
228 case AST_Expression::EV_ushort:
229 first_label << dv.u.ushort_val;
231 case AST_Expression::EV_long:
232 first_label << dv.u.long_val;
234 case AST_Expression::EV_ulong:
235 first_label << dv.u.ulong_val;
237 case AST_Expression::EV_char:
238 first_label << (int)dv.u.char_val;
240 case AST_Expression::EV_bool:
241 first_label << (dv.u.bool_val == 0 ?
"false" :
"true");
243 case AST_Expression::EV_enum:
245 AST_Enum* e =
dynamic_cast<AST_Enum*
>(the_union->disc_type());
246 if (
be_global->language_mapping() == BE_GlobalData::LANGMAP_CXX11 ||
247 be_global->language_mapping() == BE_GlobalData::LANGMAP_FACE_CXX) {
248 std::string prefix =
scoped(e->name());
249 if (
be_global->language_mapping() == BE_GlobalData::LANGMAP_FACE_CXX) {
250 size_t pos = prefix.rfind(
"::");
251 if (pos == std::string::npos) {
254 prefix = prefix.substr(0, pos) +
"::";
259 first_label << prefix;
260 UTL_ScopedName* default_name;
261 if (dv.u.enum_val < static_cast<ACE_CDR::ULong>(e->member_count())) {
262 default_name = e->value_to_name(dv.u.enum_val);
264 const Fields fields(the_union);
265 AST_UnionBranch* ub =
dynamic_cast<AST_UnionBranch*
>(*(fields.
begin()));
266 AST_Expression::AST_ExprValue* ev = ub->label(0)->label_val()->ev();
267 default_name = e->value_to_name(ev->u.eval);
269 first_label << default_name->last_component()->get_string();
271 first_label <<
scoped(e->value_to_name(dv.u.enum_val));
275 case AST_Expression::EV_longlong:
276 first_label << dv.u.longlong_val;
278 case AST_Expression::EV_ulonglong:
279 first_label << dv.u.ulonglong_val;
285 return first_label.str();
300 const char* field_name = branch->local_name()->get_string();
301 std::stringstream first_label;
303 AST_UnionLabel* label = branch->label(0);
304 if (label->label_kind() == AST_UnionLabel::UL_default) {
305 first_label << generateDefaultValue(the_union);
306 }
else if (discriminator->node_type() == AST_Decl::NT_enum) {
307 first_label <<
getEnumLabel(label->label_val(), discriminator);
309 first_label << *label->label_val()->ev();
313 AST_Type* field_type = branch->field_type();
314 const std::string field_type_string = generator_->map_type(field_type);
319 " void " << field_name <<
" (" << field_type_string <<
" x) {\n" 321 " this->_u." << field_name <<
" = x;\n" 322 " _discriminator = " << first_label.str() <<
";\n" 324 " " << field_type_string <<
' ' << field_name <<
" () const {\n" 325 " return this->_u." << field_name <<
";\n" 328 const std::string& primtype = (cls &
CL_WIDE) ? primtype_[AST_PredefinedType::PT_wchar] : primtype_[AST_PredefinedType::PT_char];
329 const std::string& helper = (cls &
CL_WIDE) ? helpers_[HLP_WSTR_VAR] : helpers_[HLP_STR_VAR];
331 " void " << field_name <<
" (" << primtype <<
"* x) {\n" 333 " this->_u." << field_name <<
" = x;\n" 334 " _discriminator = " << first_label.str() <<
";\n" 336 " void " << field_name <<
" (const " << primtype <<
"* x) {\n" 338 " this->_u." << field_name <<
" = " << string_ns <<
"::string_dup(x);\n" 339 " _discriminator = " << first_label.str() <<
";\n" 341 " void " << field_name <<
" (const " << helper <<
"& x) {\n" 343 " this->_u." << field_name <<
" = " << string_ns <<
"::string_dup(x.in());\n" 344 " _discriminator = " << first_label.str() <<
";\n" 346 " const " << primtype <<
"* " << field_name <<
" () const {\n" 347 " return this->_u." << field_name <<
";\n" 351 " void " << field_name <<
" (" << field_type_string <<
" x) {\n" 353 " this->_u." << field_name <<
" = " << field_type_string <<
"_dup(x);\n" 354 " _discriminator = " << first_label.str() <<
";\n" 356 " " << field_type_string <<
"_slice* " << field_name <<
" () const {\n" 357 " return this->_u." << field_name <<
";\n" 361 " void " << field_name <<
" (const " << field_type_string <<
"& x) {\n" 363 " this->_u." << field_name <<
" = new " << field_type_string <<
"(x);\n" 364 " _discriminator = " << first_label.str() <<
";\n" 366 " const " << field_type_string <<
"& " << field_name <<
" () const {\n" 367 " return *this->_u." << field_name <<
";\n" 369 " " << field_type_string <<
"& " << field_name <<
" () {\n" 370 " return *this->_u." << field_name <<
";\n" 373 std::cerr <<
"Unsupported type for union element\n";
380 for (std::vector<AST_UnionBranch*>::const_iterator pos = branches.begin(), limit = branches.end();
383 AST_UnionBranch* branch = *pos;
384 for (
unsigned long j = 0; j < branch->label_list_length(); ++j) {
385 AST_UnionLabel* label = branch->label(j);
386 if (label->label_kind() == AST_UnionLabel::UL_default) {
394 static size_t countLabels (
const std::vector<AST_UnionBranch*>& branches)
398 for (std::vector<AST_UnionBranch*>::const_iterator pos = branches.begin(), limit = branches.end();
401 count += (*pos)->label_list_length();
407 static bool needsDefault (
const std::vector<AST_UnionBranch*>& branches, AST_Type* discriminator)
409 return !hasDefaultLabel(branches) &&
needSyntheticDefault(discriminator, countLabels(branches));
414 AST_Type* field_type = branch->field_type();
417 const std::string lang_field_type = generator_->map_type(field_type);
420 " " << lang_field_type <<
' ' << branch->local_name()->get_string() <<
";\n";
422 const AST_PredefinedType::PredefinedType chartype = (cls &
CL_WIDE)
423 ? AST_PredefinedType::PT_wchar : AST_PredefinedType::PT_char;
425 " " << primtype_[chartype] <<
"* " << branch->local_name()->get_string() <<
";\n";
428 " " << lang_field_type <<
"_slice* " << branch->local_name()->get_string() <<
";\n";
431 " " << lang_field_type <<
"* " << branch->local_name()->get_string() <<
";\n";
433 std::cerr <<
"Unsupported type for union element\n";
437 static std::string
generateCopyCtor(
const std::string&, AST_Decl*,
const std::string& name, AST_Type* field_type,
438 const std::string&,
bool,
Intro&,
441 std::stringstream ss;
444 const std::string lang_field_type = generator_->map_type(field_type);
447 " this->_u." << name <<
" = other._u." << name <<
";\n";
450 " this->_u." << name <<
" = (other._u." << name <<
") ? " << string_ns <<
"::string_dup(other._u." << name <<
") : 0 ;\n";
453 " this->_u." << name <<
" = (other._u." << name <<
") ? " << lang_field_type <<
"_dup(other._u." << name <<
") : 0 ;\n";
456 " this->_u." << name <<
" = (other._u." << name <<
") ? new " << lang_field_type <<
"(*other._u." << name <<
") : 0;\n";
458 std::cerr <<
"Unsupported type for union element\n";
464 static std::string
generateAssign(
const std::string&, AST_Decl*,
const std::string& name, AST_Type* field_type,
465 const std::string&,
bool,
Intro&,
468 std::stringstream ss;
471 const std::string lang_field_type = generator_->map_type(field_type);
474 " this->_u." << name <<
" = other._u." << name <<
";\n";
477 " this->_u." << name <<
" = (other._u." << name <<
") ? " << string_ns <<
"::string_dup(other._u." << name <<
") : 0 ;\n";
480 " this->_u." << name <<
" = (other._u." << name <<
") ? " << lang_field_type <<
"_dup(other._u." << name <<
") : 0 ;\n";
483 " this->_u." << name <<
" = (other._u." << name <<
") ? new " << lang_field_type <<
"(*other._u." << name <<
") : 0;\n";
485 std::cerr <<
"Unsupported type for union element\n";
491 static std::string
generateEqual(
const std::string&, AST_Decl*,
const std::string& name, AST_Type* field_type,
492 const std::string&,
bool,
Intro&,
495 std::stringstream ss;
501 " return this->_u." << name <<
" == rhs._u." << name <<
";\n";
504 " return std::strcmp (this->_u." << name <<
", rhs._u." << name <<
") == 0 ;\n";
511 " return *this->_u." << name <<
" == *rhs._u." << name <<
";\n";
513 std::cerr <<
"Unsupported type for union element\n";
519 static std::string
generateReset(
const std::string&, AST_Decl*,
const std::string& name, AST_Type* field_type,
520 const std::string&,
bool,
Intro&,
523 std::stringstream ss;
531 " " << string_ns <<
"::string_free(this->_u." << name <<
");\n" 532 " this->_u." << name <<
" = 0;\n";
535 " " << generator_->map_type(field_type) <<
"_free(this->_u." << name <<
");\n" 536 " this->_u." << name <<
" = 0;\n";
539 " delete this->_u." << name <<
";\n" 540 " this->_u." << name <<
" = 0;\n";
542 std::cerr <<
"Unsupported type for union element\n";
548 virtual bool gen_union(AST_Union* u, UTL_ScopedName* name,
549 const std::vector<AST_UnionBranch*>& branches, AST_Type* discriminator)
552 const char*
const nm = name->last_component()->get_string();
553 struct_decls(name, u->size_type(),
"class");
556 "class " << exporter() << nm <<
"\n" 559 " typedef " << nm <<
"_var _var_type;\n" 560 " typedef " << nm <<
"_out _out_type;\n" 562 " " << nm <<
"(const " << nm <<
"&);\n" 563 " ~" << nm <<
"() { _reset(); };\n" 564 " " << nm <<
"& operator=(const " << nm <<
"&);\n" 565 " void _d(" <<
scoped(discriminator->name()) <<
" d) { _discriminator = d; }\n" 566 " " <<
scoped(discriminator->name()) <<
" _d() const { return _discriminator; }\n";
570 if (needsDefault(branches, discriminator)) {
572 " void _default() {\n" 574 " _discriminator = " << generateDefaultValue(u) <<
";\n" 579 " bool operator==(const " << nm <<
"& rhs) const;\n" 580 " bool operator!=(const " << nm <<
"& rhs) const { return !(*this == rhs); }\n" 581 " OPENDDS_POOL_ALLOCATION_HOOKS\n";
585 " " <<
scoped(discriminator->name()) <<
" _discriminator;\n" 588 std::for_each (branches.begin(), branches.end(), generate_union_field);
597 be_global->add_include(
"dds/DCPS/PoolAllocationBase.h", BE_GlobalData::STREAM_LANG_H);
598 be_global->add_include(
"<ace/CDR_Stream.h>", BE_GlobalData::STREAM_LANG_H);
601 exporter() <<
"ACE_CDR::Boolean operator<< (ACE_OutputCDR& os, const " << nm <<
"& x);\n\n";
603 exporter() <<
"ACE_CDR::Boolean operator>> (ACE_InputCDR& os, " << nm <<
"& x);\n\n";
609 nm <<
"::" << nm <<
"() { std::memset (this, 0, sizeof (" << nm <<
")); }\n\n";
612 nm <<
"::" << nm <<
"(const " << nm <<
"& other)\n" 614 " this->_discriminator = other._discriminator;\n";
615 generateSwitchForUnion(u,
"this->_discriminator", generateCopyCtor, branches, discriminator,
"",
"",
"",
false,
false);
620 nm <<
"& " << nm <<
"::operator=(const " << nm <<
"& other)\n" 622 " if (this == &other) {\n" 626 " this->_discriminator = other._discriminator;\n";
627 generateSwitchForUnion(u,
"this->_discriminator", generateAssign, branches, discriminator,
"",
"",
"",
false,
false);
633 "bool " << nm <<
"::operator==(const " << nm <<
"& rhs) const\n" 635 " if (this->_discriminator != rhs._discriminator) return false;\n";
636 if (
generateSwitchForUnion(u,
"this->_discriminator", generateEqual, branches, discriminator,
"",
"",
"",
false,
false)) {
644 "void " << nm <<
"::_reset()\n" 646 generateSwitchForUnion(u,
"this->_discriminator", generateReset, branches, discriminator,
"",
"",
"",
false,
false);
651 "ACE_CDR::Boolean operator<<(ACE_OutputCDR&, const " << nm <<
"&) { return true; }\n\n";
653 "ACE_CDR::Boolean operator>>(ACE_InputCDR&, " << nm <<
"&) { return true; }\n\n";
660 virtual void gen_array(UTL_ScopedName* tdname, AST_Array* arr)
662 be_global->add_include(
"<tao/Array_VarOut_T.h>", BE_GlobalData::STREAM_LANG_H);
663 be_global->add_include(
"dds/DCPS/SafetyProfilePool.h", BE_GlobalData::STREAM_LANG_H);
664 const char*
const nm = tdname->last_component()->get_string();
665 AST_Type* elem = arr->base_type();
667 const Helper var = (elem->size_type() == AST_Type::VARIABLE)
668 ? HLP_ARR_VAR_VAR : HLP_ARR_FIX_VAR,
670 forany = HLP_ARR_FORANY;
672 std::ostringstream bound, nofirst, total;
673 const std::string zeros = array_zero_indices(arr);
676 bound <<
'[' << extent <<
']';
678 nofirst <<
'[' << extent <<
']';
684 std::string elem_type = map_type(elem);
686 elem_type = helpers_[(elem_cls &
CL_WIDE) ? HLP_WSTR_MGR : HLP_STR_MGR];
689 std::string out_type = nm;
690 if (elem->size_type() == AST_Type::VARIABLE) {
691 out_type = helpers_[out] +
'<' + nm +
", " + nm +
"_var, " + nm +
692 "_slice, " + nm +
"_tag>";
696 "typedef " << elem_type <<
' ' << nm << bound.str() <<
";\n" 697 "typedef " << elem_type <<
' ' << nm <<
"_slice" << nofirst.str() <<
";\n" 698 "struct " << nm <<
"_tag {};\n" 699 "typedef " << helpers_[var] <<
'<' << nm <<
", " << nm <<
"_slice, " 700 << nm <<
"_tag> " << nm <<
"_var;\n" 701 "typedef " << out_type <<
' ' << nm <<
"_out;\n" 702 "typedef " << helpers_[forany] <<
'<' << nm <<
", " << nm <<
"_slice, " 703 << nm <<
"_tag> " << nm <<
"_forany;\n\n" <<
704 exporter() << nm <<
"_slice* " << nm <<
"_alloc();\n" <<
705 exporter() <<
"void " << nm <<
"_init_i(" << elem_type <<
"* begin);\n" <<
706 exporter() <<
"void " << nm <<
"_fini_i(" << elem_type <<
"* begin);\n" <<
707 exporter() <<
"void " << nm <<
"_free(" << nm <<
"_slice* slice);\n" <<
708 exporter() << nm <<
"_slice* " << nm <<
"_dup(const " << nm
709 <<
"_slice* slice);\n" <<
710 exporter() <<
"void " << nm <<
"_copy(" << nm <<
"_slice* dst, const " 711 << nm <<
"_slice* src);\n\n";
714 nm <<
"_slice* " << nm <<
"_alloc()\n" 716 " void* const raw = ACE_Allocator::instance()->malloc" 717 "(sizeof(" << nm <<
"));\n" 718 " " << nm <<
"_slice* const slice = static_cast<" << nm <<
"_slice*" 720 " " << nm <<
"_init_i(slice" << zeros <<
");\n" 723 "void " << nm <<
"_init_i(" << elem_type <<
"* begin)\n" 727 be_global->impl_ <<
" ACE_UNUSED_ARG(begin);\n";
729 std::string indent =
" ";
732 indent << elem_type <<
"_init_i(begin" << nfl.
index_ <<
");\n";
735 " std::uninitialized_fill_n(begin, " << total.str() <<
", " 736 << elem_type <<
"());\n";
741 "void " << nm <<
"_fini_i(" << elem_type <<
"* begin)\n" 745 be_global->impl_ <<
" ACE_UNUSED_ARG(begin);\n";
746 }
else if (elem_cls & CL_ARRAY) {
747 std::string indent =
" ";
750 indent << elem_type <<
"_fini_i(begin" << nfl.
index_ <<
");\n";
752 const std::string::size_type idx_last = elem_type.rfind(
"::");
753 const std::string elem_last =
754 (elem_cls &
CL_STRING) ?
"StringManager" :
755 ((idx_last == std::string::npos) ? elem_type
756 : elem_type.substr(idx_last + 2));
758 " for (int i = 0; i < " << total.str() <<
"; ++i) {\n" 760 "~" << elem_last <<
"();\n" 766 "void " << nm <<
"_free(" << nm <<
"_slice* slice)\n" 768 " if (!slice) return;\n" 769 " " << nm <<
"_fini_i(slice" << zeros <<
");\n" 770 " ACE_Allocator::instance()->free(slice);\n" 772 nm <<
"_slice* " << nm <<
"_dup(const " << nm <<
"_slice* slice)\n" 774 " " << nm <<
"_slice* const arr = " << nm <<
"_alloc();\n" 775 " if (arr) " << nm <<
"_copy(arr, slice);\n" 778 "void " << nm <<
"_copy(" << nm <<
"_slice* dst, const " << nm
781 " if (!src || !dst) return;\n";
784 std::string indent =
" ";
786 if (elem_cls & CL_ARRAY) {
788 indent << elem_type <<
"_copy(dst" << nfl.
index_ <<
", src" 792 indent <<
"dst" << nfl.
index_ <<
" = src" << nfl.
index_ <<
";\n";
800 "inline ACE_CDR::Boolean operator<<(ACE_OutputCDR &, const " << nm <<
"_forany&) { return true; }\n\n" 801 "inline ACE_CDR::Boolean operator>>(ACE_InputCDR &, " << nm <<
"_forany&) { return true; }\n\n";
808 const std::string nm =
scoped(tdname);
809 const std::string zeros = array_zero_indices(arr);
811 "TAO_BEGIN_VERSIONED_NAMESPACE_DECL\nnamespace TAO {\n" 813 "struct " << exporter() <<
"Array_Traits<" << nm <<
"_forany>\n" 815 " static void free(" << nm <<
"_slice* slice)\n" 817 " " << nm <<
"_free(slice);\n" 819 " static " << nm <<
"_slice* dup(const " << nm <<
"_slice* slice)\n" 821 " return " << nm <<
"_dup(slice);\n" 823 " static void copy(" << nm <<
"_slice* dst, const " << nm
826 " " << nm <<
"_copy(dst, src);\n" 828 " static " << nm <<
"_slice* alloc()\n" 830 " return " << nm <<
"_alloc();\n" 832 " static void zero(" << nm <<
"_slice* slice)\n" 834 " " << nm <<
"_fini_i(slice" << zeros <<
");\n" 835 " " << nm <<
"_init_i(slice" << zeros <<
");\n" 837 " static void construct(" << nm <<
"_slice* slice)\n" 839 " " << nm <<
"_init_i(slice" << zeros <<
");\n" 841 " static void destroy(" << nm <<
"_slice* slice)\n" 843 " " << nm <<
"_fini_i(slice" << zeros <<
");\n" 845 "};\n}\nTAO_END_VERSIONED_NAMESPACE_DECL\n\n";
851 "typedef " << map_type(base) <<
"_var " << nm <<
"_var;\n" <<
852 "typedef " << map_type(base) <<
"_slice " << nm <<
"_slice;\n" <<
853 "typedef " << map_type(base) <<
"_forany " << nm <<
"_forany;\n\n" <<
854 "inline " << nm <<
"_slice *" << nm <<
"_alloc() { return " << map_type(base) <<
"_alloc(); }\n" <<
855 "inline " << nm <<
"_slice* " << nm <<
"_dup(" << nm <<
"_slice *a) { return " << map_type(base) <<
"_dup(a); }\n" <<
856 "inline void " << nm <<
"_copy(" << nm <<
"_slice* to, const " << nm <<
"_slice* from) { " << map_type(base) <<
"_copy(to, from); }\n" <<
857 "inline void " << nm <<
"_free(" << nm <<
"_slice *a) { " << map_type(base) <<
"_free(a); }\n";
864 const Helper var = (cls &
CL_WIDE) ? HLP_WSTR_VAR : HLP_STR_VAR,
865 out = (cls &
CL_WIDE) ? HLP_WSTR_OUT : HLP_STR_OUT;
867 "typedef " << helpers_[var] <<
' ' << nm <<
"_var;\n" 868 "typedef " << helpers_[out] <<
' ' << nm <<
"_out;\n";
871 "typedef " << generator_->map_type(base) <<
"_out " << nm <<
"_out;\n";
880 be_global->add_include(
"FACE/types.hpp", BE_GlobalData::STREAM_LANG_H);
881 be_global->add_include(
"FACE/StringManager.h", BE_GlobalData::STREAM_LANG_H);
882 primtype_[AST_PredefinedType::PT_long] =
"::FACE::Long";
883 primtype_[AST_PredefinedType::PT_ulong] =
"::FACE::UnsignedLong";
884 primtype_[AST_PredefinedType::PT_longlong] =
"::FACE::LongLong";
885 primtype_[AST_PredefinedType::PT_ulonglong] =
"::FACE::UnsignedLongLong";
886 primtype_[AST_PredefinedType::PT_short] =
"::FACE::Short";
887 primtype_[AST_PredefinedType::PT_ushort] =
"::FACE::UnsignedShort";
888 primtype_[AST_PredefinedType::PT_float] =
"::FACE::Float";
889 primtype_[AST_PredefinedType::PT_double] =
"::FACE::Double";
890 primtype_[AST_PredefinedType::PT_longdouble] =
"::FACE::LongDouble";
891 primtype_[AST_PredefinedType::PT_char] =
"::FACE::Char";
892 primtype_[AST_PredefinedType::PT_wchar] =
"::FACE::WChar";
893 primtype_[AST_PredefinedType::PT_boolean] =
"::FACE::Boolean";
894 primtype_[AST_PredefinedType::PT_octet] =
"::FACE::Octet";
895 helpers_[HLP_STR_VAR] =
"::FACE::String_var";
896 helpers_[HLP_STR_OUT] =
"::FACE::String_out";
897 helpers_[HLP_WSTR_VAR] =
"::FACE::WString_var";
898 helpers_[HLP_WSTR_OUT] =
"::FACE::WString_out";
899 helpers_[HLP_STR_MGR] =
"::OpenDDS::FaceTypes::String_mgr";
900 helpers_[HLP_WSTR_MGR] =
"::OpenDDS::FaceTypes::WString_mgr";
901 helpers_[HLP_FIX_VAR] =
"::TAO_Fixed_Var_T";
902 helpers_[HLP_VAR_VAR] =
"::TAO_Var_Var_T";
903 helpers_[HLP_OUT] =
"::TAO_Out_T";
904 helpers_[HLP_SEQ] =
"::OpenDDS::FaceTypes::Sequence";
905 helpers_[HLP_SEQ_NS] =
"::OpenDDS::FaceTypes";
906 helpers_[HLP_SEQ_VAR_VAR] =
"::OpenDDS::FaceTypes::SequenceVar";
907 helpers_[HLP_SEQ_FIX_VAR] =
"::OpenDDS::FaceTypes::SequenceVar";
908 helpers_[HLP_SEQ_OUT] =
"::TAO_Seq_Out_T";
909 helpers_[HLP_ARR_VAR_VAR] =
"::TAO_VarArray_Var_T";
910 helpers_[HLP_ARR_FIX_VAR] =
"::TAO_FixedArray_Var_T";
911 helpers_[HLP_ARR_OUT] =
"::TAO_Array_Out_T";
912 helpers_[HLP_ARR_FORANY] =
"::TAO_Array_Forany_T";
913 helpers_[HLP_FIXED] =
"::OpenDDS::FaceTypes::Fixed_T";
914 helpers_[HLP_FIXED_CONSTANT] =
"::OpenDDS::FaceTypes::Fixed";
919 be_global->add_include(
"<tao/Seq_Out_T.h>", BE_GlobalData::STREAM_LANG_H);
920 be_global->add_include(
"FACE/Sequence.h", BE_GlobalData::STREAM_LANG_H);
921 be_global->add_include(
"FACE/SequenceVar.h", BE_GlobalData::STREAM_LANG_H);
922 be_global->add_include(
"<ace/CDR_Stream.h>", BE_GlobalData::STREAM_LANG_H);
923 const char*
const nm = tdname->last_component()->get_string();
924 AST_Type* elem = seq->base_type();
926 const bool bounded = !seq->unbounded();
927 const Helper var = (elem->size_type() == AST_Type::VARIABLE)
928 ? HLP_SEQ_VAR_VAR : HLP_SEQ_FIX_VAR,
931 std::string elem_type = map_type(elem), extra_tmp_args;
933 const AST_Expression::ExprType char_type = (elem_cls &
CL_WIDE)
934 ? AST_Expression::EV_wchar : AST_Expression::EV_char;
935 extra_tmp_args =
", " + helpers_[HLP_SEQ_NS] +
"::StringEltPolicy< " 936 + map_type(char_type) +
">";
938 extra_tmp_args =
", " + helpers_[HLP_SEQ_NS] +
"::ArrayEltPolicy<" 939 + elem_type +
"_forany>";
940 }
else if (elem->size_type() == AST_Type::VARIABLE) {
941 extra_tmp_args =
", " + helpers_[HLP_SEQ_NS] +
"::VariEltPolicy<" 945 std::string bound = helpers_[HLP_SEQ_NS] +
"::Unbounded";
947 std::ostringstream oss;
948 oss << helpers_[HLP_SEQ_NS] <<
"::Bounded<" 949 << seq->max_size()->ev()->u.ulval <<
'>';
953 const std::string base = helpers_[HLP_SEQ] +
"< " + elem_type +
", " + bound
954 + extra_tmp_args +
" >",
955 len_type = primtype_[AST_PredefinedType::PT_ulong],
956 flag_type = primtype_[AST_PredefinedType::PT_boolean];
959 "class " << nm <<
";\n" 960 "typedef " << helpers_[var] <<
'<' << nm <<
"> " << nm <<
"_var;\n" 961 "typedef " << helpers_[out] <<
'<' << nm <<
"> " << nm <<
"_out;\n\n" 962 "class " << exporter() << nm <<
" : public " << base <<
" {\n" 964 " typedef " << nm <<
"_var _var_type;\n" 965 " typedef " << nm <<
"_out _out_type;\n\n" 966 " " << nm <<
"() {}\n" 967 " " << nm <<
"(const " << nm <<
"& seq) : " << base <<
"(seq) {}\n" 968 " friend void swap(" << nm <<
"& a, " << nm <<
"& b) { a.swap(b); }\n" 969 " " << nm <<
"& operator=(const " << nm <<
"& rhs)\n" 971 " " << nm <<
" tmp(rhs);\n" 978 " " << nm <<
"(" << len_type <<
" length, " << elem_type <<
"* data, " 979 << flag_type <<
" release = false)\n" 980 " : " << base <<
"(0u, length, data, release) {}\n";
983 " " << nm <<
"(" << len_type <<
" maximum)\n" 984 " : " << base <<
"(maximum, 0u, 0, true) {}\n" 985 " " << nm <<
"(" << len_type <<
" maximum, " << len_type <<
" length, " 986 << elem_type <<
"* data, " << flag_type <<
" release = false)\n" 987 " : " << base <<
"(maximum, length, data, release) {}\n";
993 "inline ACE_CDR::Boolean operator<< (ACE_OutputCDR&, const " << nm <<
"&) { return true; }\n\n";
996 "inline ACE_CDR::Boolean operator>> (ACE_InputCDR&, " << nm <<
"&) { return true; }\n\n";
1000 const std::vector<AST_Field*>& fields,
1001 AST_Type::SIZE_TYPE size,
1005 const char*
const nm = name->last_component()->get_string();
1006 struct_decls(name, size);
1009 "struct " << exporter() << nm <<
"\n" 1011 " typedef " << nm <<
"_var _var_type;\n" 1012 " typedef " << nm <<
"_out _out_type;\n\n";
1014 for (
size_t i = 0; i < fields.size(); ++i) {
1015 AST_Type* field_type = fields[i]->field_type();
1016 const std::string field_name = fields[i]->local_name()->get_string();
1017 std::string type_name = map_type(field_type);
1021 type_name = helpers_[(cls &
CL_WIDE) ? HLP_WSTR_MGR : HLP_STR_MGR];
1024 " " << type_name <<
' ' << field_name <<
";\n";
1028 " bool operator==(const " << nm <<
"& rhs) const;\n" 1029 " bool operator!=(const " << nm <<
"& rhs) const { return !(*this == rhs); }\n" 1030 " OPENDDS_POOL_ALLOCATION_HOOKS\n" 1033 be_global->add_include(
"dds/DCPS/PoolAllocationBase.h", BE_GlobalData::STREAM_LANG_H);
1034 be_global->add_include(
"<ace/CDR_Stream.h>", BE_GlobalData::STREAM_LANG_H);
1036 if (size == AST_Type::VARIABLE) {
1038 exporter() <<
"void swap(" << nm <<
"& lhs, " << nm <<
"& rhs);\n\n";
1042 exporter() <<
"ACE_CDR::Boolean operator<< (ACE_OutputCDR& os, const " << nm <<
"& x);\n\n";
1044 exporter() <<
"ACE_CDR::Boolean operator>> (ACE_InputCDR& os, " << nm <<
"& x);\n\n";
1049 "bool " << nm <<
"::operator==(const " << nm <<
"& rhs) const\n" 1051 for (
size_t i = 0; i < fields.size(); ++i) {
1052 const std::string field_name = fields[i]->local_name()->get_string();
1056 std::string indent(
" ");
1058 dynamic_cast<AST_Array*>(field_type), indent,
true);
1060 indent <<
"if (" << field_name << nfl.
index_ <<
" != rhs." 1061 << field_name << nfl.
index_ <<
") {\n" <<
1062 indent <<
" return false;\n" <<
1066 " if (" << field_name <<
" != rhs." << field_name <<
") {\n" 1071 be_global->impl_ <<
" return true;\n}\n\n";
1073 if (size == AST_Type::VARIABLE) {
1075 "void swap(" << nm <<
"& lhs, " << nm <<
"& rhs)\n" 1077 " using std::swap;\n";
1078 for (
size_t i = 0; i < fields.size(); ++i) {
1079 const std::string fn = fields[i]->local_name()->get_string();
1084 const std::string flat_fn = fn + array_dims(field_type, elems);
1085 be_global->add_include(
"<algorithm>", BE_GlobalData::STREAM_CPP);
1087 " std::swap_ranges(lhs." << flat_fn <<
", lhs." << flat_fn
1088 <<
" + " << elems <<
", rhs." << flat_fn <<
");\n";
1091 " swap(lhs." << fn <<
", rhs." << fn <<
");\n";
1098 "ACE_CDR::Boolean operator<< (ACE_OutputCDR &, const " << nm <<
"&) { return true; }\n\n";
1100 "ACE_CDR::Boolean operator>> (ACE_InputCDR &, " << nm <<
"&) { return true; }\n\n";
1115 be_global->add_include(
"tao/String_Manager_T.h", BE_GlobalData::STREAM_LANG_H);
1116 be_global->add_include(
"tao/CORBA_String.h", BE_GlobalData::STREAM_LANG_H);
1117 primtype_[AST_PredefinedType::PT_long] =
"CORBA::Long";
1118 primtype_[AST_PredefinedType::PT_ulong] =
"CORBA::ULong";
1119 primtype_[AST_PredefinedType::PT_longlong] =
"CORBA::LongLong";
1120 primtype_[AST_PredefinedType::PT_ulonglong] =
"CORBA::ULongLong";
1121 primtype_[AST_PredefinedType::PT_short] =
"CORBA::Short";
1122 primtype_[AST_PredefinedType::PT_ushort] =
"CORBA::UShort";
1123 #if OPENDDS_HAS_EXPLICIT_INTS 1124 primtype_[AST_PredefinedType::PT_int8] =
"CORBA::Int8";
1125 primtype_[AST_PredefinedType::PT_uint8] =
"CORBA::UInt8";
1127 primtype_[AST_PredefinedType::PT_float] =
"CORBA::Float";
1128 primtype_[AST_PredefinedType::PT_double] =
"CORBA::Double";
1129 primtype_[AST_PredefinedType::PT_longdouble] =
"CORBA::LongDouble";
1130 primtype_[AST_PredefinedType::PT_char] =
"CORBA::Char";
1131 primtype_[AST_PredefinedType::PT_wchar] =
"CORBA::WChar";
1132 primtype_[AST_PredefinedType::PT_boolean] =
"CORBA::Boolean";
1133 primtype_[AST_PredefinedType::PT_octet] =
"CORBA::Octet";
1134 helpers_[HLP_STR_VAR] =
"CORBA::String_var";
1135 helpers_[HLP_STR_OUT] =
"CORBA::String_out";
1136 helpers_[HLP_WSTR_VAR] =
"CORBA::WString_var";
1137 helpers_[HLP_WSTR_OUT] =
"CORBA::WString_out";
1138 helpers_[HLP_STR_MGR] =
"::TAO::String_Manager";
1139 helpers_[HLP_WSTR_MGR] =
"CORBA::WString_mgr";
1140 helpers_[HLP_FIX_VAR] =
"::TAO_Fixed_Var_T";
1141 helpers_[HLP_VAR_VAR] =
"::TAO_Var_Var_T";
1142 helpers_[HLP_OUT] =
"::TAO_Out_T";
1143 helpers_[HLP_SEQ] =
"::OpenDDS::SafetyProfile::Sequence";
1144 helpers_[HLP_SEQ_NS] =
"::OpenDDS::SafetyProfile";
1145 helpers_[HLP_SEQ_VAR_VAR] =
"::OpenDDS::SafetyProfile::SequenceVar";
1146 helpers_[HLP_SEQ_FIX_VAR] =
"::OpenDDS::SafetyProfile::SequenceVar";
1147 helpers_[HLP_SEQ_OUT] =
"::TAO_Seq_Out_T";
1148 helpers_[HLP_ARR_VAR_VAR] =
"::TAO_VarArray_Var_T";
1149 helpers_[HLP_ARR_FIX_VAR] =
"::TAO_FixedArray_Var_T";
1150 helpers_[HLP_ARR_OUT] =
"::TAO_Array_Out_T";
1151 helpers_[HLP_ARR_FORANY] =
"::TAO_Array_Forany_T";
1156 be_global->add_include(
"<tao/Seq_Out_T.h>", BE_GlobalData::STREAM_LANG_H);
1157 be_global->add_include(
"dds/DCPS/SafetyProfileSequence.h", BE_GlobalData::STREAM_LANG_H);
1158 be_global->add_include(
"dds/DCPS/SafetyProfileSequenceVar.h", BE_GlobalData::STREAM_LANG_H);
1159 const char*
const nm = tdname->last_component()->get_string();
1160 AST_Type* elem = seq->base_type();
1162 const bool bounded = !seq->unbounded();
1163 const Helper var = (elem->size_type() == AST_Type::VARIABLE)
1164 ? HLP_SEQ_VAR_VAR : HLP_SEQ_FIX_VAR,
1167 std::string elem_type = map_type(elem), extra_tmp_args;
1169 const AST_Expression::ExprType char_type = (elem_cls &
CL_WIDE)
1170 ? AST_Expression::EV_wchar : AST_Expression::EV_char;
1171 extra_tmp_args =
", " + helpers_[HLP_SEQ_NS] +
"::StringEltPolicy< " 1172 + map_type(char_type) +
">";
1174 extra_tmp_args =
", " + helpers_[HLP_SEQ_NS] +
"::ArrayEltPolicy<" 1175 + elem_type +
"_forany>";
1176 }
else if (elem->size_type() == AST_Type::VARIABLE) {
1177 extra_tmp_args =
", " + helpers_[HLP_SEQ_NS] +
"::VariEltPolicy<" 1181 std::string bound = helpers_[HLP_SEQ_NS] +
"::Unbounded";
1183 std::ostringstream oss;
1184 oss << helpers_[HLP_SEQ_NS] <<
"::Bounded<" 1185 << seq->max_size()->ev()->u.ulval <<
'>';
1189 const std::string base = helpers_[HLP_SEQ] +
"< " + elem_type +
", " + bound
1190 + extra_tmp_args +
" >",
1191 len_type = primtype_[AST_PredefinedType::PT_ulong],
1192 flag_type = primtype_[AST_PredefinedType::PT_boolean];
1195 "class " << nm <<
";\n" 1196 "typedef " << helpers_[var] <<
'<' << nm <<
"> " << nm <<
"_var;\n" 1197 "typedef " << helpers_[out] <<
'<' << nm <<
"> " << nm <<
"_out;\n\n" 1198 "class " << exporter() << nm <<
" : public " << base <<
" {\n" 1200 " typedef " << nm <<
"_var _var_type;\n" 1201 " typedef " << nm <<
"_out _out_type;\n\n" 1202 " " << nm <<
"() {}\n" 1203 " " << nm <<
"(const " << nm <<
"& seq) : " << base <<
"(seq) {}\n" 1204 " friend void swap(" << nm <<
"& a, " << nm <<
"& b) { a.swap(b); }\n" 1205 " " << nm <<
"& operator=(const " << nm <<
"& rhs)\n" 1207 " " << nm <<
" tmp(rhs);\n" 1214 " " << nm <<
"(" << len_type <<
" length, " << elem_type <<
"* data, " 1215 << flag_type <<
" release = false)\n" 1216 " : " << base <<
"(0u, length, data, release) {}\n";
1219 " " << nm <<
"(" << len_type <<
" maximum)\n" 1220 " : " << base <<
"(maximum, 0u, 0, true) {}\n" 1221 " " << nm <<
"(" << len_type <<
" maximum, " << len_type <<
" length, " 1222 << elem_type <<
"* data, " << flag_type <<
" release = false)\n" 1223 " : " << base <<
"(maximum, length, data, release) {}\n";
1229 "inline ACE_CDR::Boolean operator<< (ACE_OutputCDR&, const " << nm <<
"&) { return true; }\n\n";
1232 "inline ACE_CDR::Boolean operator>> (ACE_InputCDR&, " << nm <<
"&) { return true; }\n\n";
1236 const std::vector<AST_Field*>& fields,
1237 AST_Type::SIZE_TYPE size,
1241 const char*
const nm = name->last_component()->get_string();
1242 struct_decls(name, size);
1245 "struct " << exporter() << nm <<
"\n" 1247 " typedef " << nm <<
"_var _var_type;\n" 1248 " typedef " << nm <<
"_out _out_type;\n\n";
1250 for (
size_t i = 0; i < fields.size(); ++i) {
1251 AST_Type* field_type = fields[i]->field_type();
1252 const std::string field_name = fields[i]->local_name()->get_string();
1253 std::string type_name = map_type(field_type);
1256 type_name = helpers_[(cls &
CL_WIDE) ? HLP_WSTR_MGR : HLP_STR_MGR];
1259 " " << type_name <<
' ' << field_name <<
";\n";
1263 " bool operator==(const " << nm <<
"& rhs) const;\n" 1264 " bool operator!=(const " << nm <<
"& rhs) const { return !(*this == rhs); }\n" 1265 " OPENDDS_POOL_ALLOCATION_HOOKS\n" 1268 be_global->add_include(
"dds/DCPS/PoolAllocationBase.h", BE_GlobalData::STREAM_LANG_H);
1269 be_global->add_include(
"<ace/CDR_Stream.h>", BE_GlobalData::STREAM_LANG_H);
1271 if (size == AST_Type::VARIABLE) {
1273 exporter() <<
"void swap(" << nm <<
"& lhs, " << nm <<
"& rhs);\n\n";
1277 exporter() <<
"ACE_CDR::Boolean operator<< (ACE_OutputCDR& os, const " << nm <<
"& x);\n\n";
1279 exporter() <<
"ACE_CDR::Boolean operator>> (ACE_InputCDR& os, " << nm <<
"& x);\n\n";
1284 "bool " << nm <<
"::operator==(const " << nm <<
"& rhs) const\n" 1286 for (
size_t i = 0; i < fields.size(); ++i) {
1287 const std::string field_name = fields[i]->local_name()->get_string();
1291 std::string indent(
" ");
1293 dynamic_cast<AST_Array*>(field_type), indent,
true);
1295 indent <<
"if (" << field_name << nfl.
index_ <<
" != rhs." 1296 << field_name << nfl.
index_ <<
") {\n" <<
1297 indent <<
" return false;\n" <<
1301 " if (" << field_name <<
" != rhs." << field_name <<
") {\n" 1306 be_global->impl_ <<
" return true;\n}\n\n";
1308 if (size == AST_Type::VARIABLE) {
1310 "void swap(" << nm <<
"& lhs, " << nm <<
"& rhs)\n" 1312 " using std::swap;\n";
1313 for (
size_t i = 0; i < fields.size(); ++i) {
1314 const std::string fn = fields[i]->local_name()->get_string();
1319 const std::string flat_fn = fn + array_dims(field_type, elems);
1320 be_global->add_include(
"<algorithm>", BE_GlobalData::STREAM_CPP);
1322 " std::swap_ranges(lhs." << flat_fn <<
", lhs." << flat_fn
1323 <<
" + " << elems <<
", rhs." << flat_fn <<
");\n";
1326 " swap(lhs." << fn <<
", rhs." << fn <<
");\n";
1333 "ACE_CDR::Boolean operator<< (ACE_OutputCDR &, const " << nm <<
"&) { return true; }\n\n";
1335 "ACE_CDR::Boolean operator>> (ACE_InputCDR &, " << nm <<
"&) { return true; }\n\n";
1350 be_global->add_include(
"<cstdint>", BE_GlobalData::STREAM_LANG_H);
1351 be_global->add_include(
"<string>", BE_GlobalData::STREAM_LANG_H);
1352 primtype_[AST_PredefinedType::PT_long] =
"int32_t";
1353 primtype_[AST_PredefinedType::PT_ulong] =
"uint32_t";
1354 primtype_[AST_PredefinedType::PT_longlong] =
"int64_t";
1355 primtype_[AST_PredefinedType::PT_ulonglong] =
"uint64_t";
1356 primtype_[AST_PredefinedType::PT_short] =
"int16_t";
1357 primtype_[AST_PredefinedType::PT_ushort] =
"uint16_t";
1358 #if OPENDDS_HAS_EXPLICIT_INTS 1359 primtype_[AST_PredefinedType::PT_int8] =
"int8_t";
1360 primtype_[AST_PredefinedType::PT_uint8] =
"uint8_t";
1362 primtype_[AST_PredefinedType::PT_float] =
"float";
1363 primtype_[AST_PredefinedType::PT_double] =
"double";
1364 primtype_[AST_PredefinedType::PT_longdouble] =
"long double";
1365 primtype_[AST_PredefinedType::PT_char] =
"char";
1366 primtype_[AST_PredefinedType::PT_wchar] =
"wchar_t";
1367 primtype_[AST_PredefinedType::PT_boolean] =
"bool";
1368 primtype_[AST_PredefinedType::PT_octet] =
"uint8_t";
1369 helpers_[HLP_STR_VAR] =
"std::string";
1370 helpers_[HLP_STR_OUT] =
"std::string";
1371 helpers_[HLP_WSTR_VAR] =
"std::wstring";
1372 helpers_[HLP_WSTR_OUT] =
"std::wstring";
1373 helpers_[HLP_STR_MGR] =
"std::string";
1374 helpers_[HLP_WSTR_MGR] =
"std::wstring";
1375 helpers_[HLP_FIX_VAR] =
"<<fixed-size var>>";
1376 helpers_[HLP_VAR_VAR] =
"<<variable-size var>>";
1377 helpers_[HLP_OUT] =
"<<out>>";
1378 helpers_[HLP_SEQ] =
"std::vector";
1379 helpers_[HLP_SEQ_NS] =
"std";
1380 helpers_[HLP_SEQ_VAR_VAR] =
"<<variable sequence var>>";
1381 helpers_[HLP_SEQ_FIX_VAR] =
"<<fixed sequence var>>";
1382 helpers_[HLP_SEQ_OUT] =
"<<sequence out>>";
1383 helpers_[HLP_ARR_VAR_VAR] =
"<<variable array var>>";
1384 helpers_[HLP_ARR_FIX_VAR] =
"<<fixed array var>>";
1385 helpers_[HLP_ARR_OUT] =
"<<array out>>";
1386 helpers_[HLP_ARR_FORANY] =
"<<array forany>>";
1387 helpers_[HLP_FIXED] =
"IDL::Fixed_T";
1388 helpers_[HLP_FIXED_CONSTANT] =
"IDL::Fixed_T";
1394 be_global->add_include(
"tao/Basic_Types.h", BE_GlobalData::STREAM_LANG_H);
1395 be_global->lang_header_ <<
"extern const ::CORBA::TypeCode_ptr _tc_" << type <<
";\n";
1396 be_global->impl_ <<
"const ::CORBA::TypeCode_ptr _tc_" << type <<
" = nullptr;\n";
1402 return chartype == AST_PredefinedType::PT_char ?
"std::string" :
"std::wstring";
1408 case AST_Expression::EV_string:
1409 case AST_Expression::EV_wstring:
1426 "#if defined(__GNUC__) && !defined(__clang__)\n" 1427 "# pragma GCC diagnostic push\n" 1428 "# pragma GCC diagnostic ignored \"-Wmaybe-uninitialized\"\n" 1435 "#if defined(__GNUC__) && !defined(__clang__)\n" 1436 "# pragma GCC diagnostic pop\n" 1443 "class " << name->last_component()->get_string() <<
";\n";
1446 static void gen_array(AST_Array* arr,
const std::string& type,
const std::string& elem,
const std::string& ind =
"")
1449 std::ostringstream bounds;
1451 array +=
"std::array<";
1452 bounds <<
", " << arr->dims()[dim - 1]->ev()->u.ulval <<
'>';
1454 be_global->add_include(
"<array>", BE_GlobalData::STREAM_LANG_H);
1455 be_global->lang_header_ << ind <<
"using " << type <<
" = " << array << elem << bounds.str() <<
";\n";
1460 gen_array(arr, tdname->last_component()->get_string(), map_type(arr->base_type()));
1467 static void gen_sequence(
const std::string& type,
const std::string& elem,
const std::string& ind =
"")
1469 be_global->add_include(
"<vector>", BE_GlobalData::STREAM_LANG_H);
1470 be_global->lang_header_ << ind <<
"using " << type <<
" = std::vector<" << elem <<
">;\n";
1475 gen_sequence(tdname->last_component()->get_string(), map_type(seq->base_type()));
1482 "class " << exporter() << nm <<
"\n" 1491 "using " << nm <<
"_out = " << nm <<
"&; // for tao_idl compatibility\n\n" 1492 << exporter() <<
"void swap(" << nm <<
"& lhs, " << nm <<
"& rhs);\n\n";
1499 const std::string elem_type = generator_->map_type(af.
as_base_);
1502 }
else if (af.
seq_) {
1507 const std::string lang_field_type = generator_->map_type(field);
1508 const std::string assign_pre =
"{ _" + af.
name_ +
" = ",
1509 assign = assign_pre +
"val; }\n",
1510 move = assign_pre +
"std::move(val); }\n",
1511 ret =
"{ return _" + af.
name_ +
"; }\n";
1512 std::string initializer;
1515 " void " << af.
name_ <<
'(' << lang_field_type <<
" val) " <<
assign <<
1516 " " << lang_field_type <<
' ' << af.
name_ <<
"() const " << ret <<
1517 " " << lang_field_type <<
"& " << af.
name_ <<
"() " << ret;
1519 AST_Enum* enu =
dynamic_cast<AST_Enum*
>(af.
act_);
1520 for (UTL_ScopeActiveIterator it(enu, UTL_Scope::IK_decls); !it.is_done(); it.next()) {
1521 if (it.item()->node_type() == AST_Decl::NT_enum_val) {
1522 initializer =
'{' + generator_->map_type(af.
type_)
1523 +
"::" + it.item()->local_name()->get_string() +
'}';
1534 be_global->add_include(
"<utility>", BE_GlobalData::STREAM_LANG_H);
1536 " void " << af.
name_ <<
"(const " << lang_field_type <<
"& val) " <<
assign <<
1537 " void " << af.
name_ <<
'(' << lang_field_type <<
"&& val) " << move <<
1538 " const " << lang_field_type <<
"& " << af.
name_ <<
"() const " << ret <<
1539 " " << lang_field_type <<
"& " << af.
name_ <<
"() " << ret;
1542 " " << lang_field_type <<
" _" << af.
name_ << initializer <<
";\n\n";
1546 const std::vector<AST_Field*>& fields,
1547 AST_Type::SIZE_TYPE,
const char*)
1551 const char*
const nm = name->last_component()->get_string();
1552 gen_common_strunion_pre(nm);
1554 std::for_each(fields.begin(), fields.end(), gen_struct_members);
1557 " " << nm <<
"() = default;\n" 1558 " " << (fields.size() == 1 ?
"explicit " :
"") << nm <<
'(';
1560 nm <<
"::" << nm <<
'(';
1562 std::string init_list, swaps;
1563 for (
size_t i = 0; i < fields.size(); ++i) {
1564 const std::string fn = fields[i]->local_name()->get_string();
1565 const std::string ft = map_type(fields[i]);
1568 const std::string param = (by_ref ?
"const " :
"") + ft + (by_ref ?
"&" :
"")
1569 +
' ' + fn + (i < fields.size() - 1 ?
",\n " :
")");
1572 init_list +=
'_' + fn +
'(' + fn +
')';
1573 if (i < fields.size() - 1) init_list +=
"\n , ";
1574 swaps +=
" swap(lhs._" + fn +
", rhs._" + fn +
");\n";
1577 be_global->impl_ <<
"\n : " << init_list <<
"\n{}\n\n";
1579 gen_common_strunion_post(nm);
1581 "void swap(" << nm <<
"& lhs, " << nm <<
"& rhs)\n" 1583 " using std::swap;\n" 1584 << swaps <<
"}\n\n";
1585 gen_typecode_ptrs(nm);
1591 AST_Type* field_type = branch->field_type();
1592 const std::string lang_field_type = generator_->map_type(field_type);
1594 " " << lang_field_type <<
" _" << branch->local_name()->get_string()
1600 AST_Type* field_type = branch->field_type();
1602 const std::string lang_field_type = generator_->map_type(field_type);
1604 const char* nm = branch->local_name()->get_string();
1606 AST_UnionLabel* label = branch->label(0);
1607 AST_Union* union_ =
dynamic_cast<AST_Union*
>(branch->defined_in());
1609 const std::string disc_type = generator_->map_type(dtype);
1612 if (label->label_kind() == AST_UnionLabel::UL_default) {
1613 dval = generateDefaultValue(union_);
1614 }
else if (dtype->node_type() == AST_Decl::NT_enum) {
1617 std::ostringstream strm;
1618 strm << *label->label_val()->ev();
1622 std::string disc_param, disc_name = dval;
1623 if (label->label_kind() == AST_UnionLabel::UL_default ||
1624 branch->label_list_length() > 1) {
1626 disc_param =
", " + disc_type +
" disc = " + dval;
1629 const std::string assign_pre =
"{ _activate(" + disc_name +
"); _" 1630 + std::string(nm) +
" = ",
1631 assign = assign_pre +
"val; }\n",
1632 move = assign_pre +
"std::move(val); }\n",
1633 ret =
"{ return _" + std::string(nm) +
"; }\n";
1636 " void " << nm <<
'(' << lang_field_type <<
" val" << disc_param
1637 <<
") " << assign <<
1638 " " << lang_field_type <<
' ' << nm <<
"() const " << ret <<
1639 " " << lang_field_type <<
"& " << nm <<
"() " << ret <<
"\n";
1641 be_global->add_include(
"<utility>", BE_GlobalData::STREAM_LANG_H);
1643 " void " << nm <<
"(const " << lang_field_type <<
"& val" << disc_param
1644 <<
") " << assign <<
1645 " void " << nm <<
'(' << lang_field_type <<
"&& val" << disc_param
1647 " const " << lang_field_type <<
"& " << nm <<
"() const " << ret <<
1648 " " << lang_field_type <<
"& " << nm <<
"() " << ret <<
"\n";
1652 static std::string
union_copy(
const std::string&, AST_Decl*,
const std::string&
name, AST_Type*,
1653 const std::string&,
bool,
Intro&,
1656 return " _" + name +
" = rhs._" + name +
";\n";
1659 static std::string
union_move(
const std::string&, AST_Decl*,
const std::string&
name, AST_Type*,
1660 const std::string&,
bool,
Intro&,
1663 return " _" + name +
" = std::move(rhs._" + name +
");\n";
1666 static std::string
union_assign(
const std::string&, AST_Decl*,
const std::string&
name, AST_Type*,
1667 const std::string&,
bool,
Intro&,
1670 return " " + name +
"(rhs._" + name +
");\n";
1674 const std::string&,
bool,
Intro&,
1677 return " " + name +
"(std::move(rhs._" + name +
"));\n";
1680 static std::string
union_activate(
const std::string&, AST_Decl*,
const std::string&
name, AST_Type* type,
1681 const std::string&,
bool,
Intro&,
1685 const std::string lang_field_type = generator_->map_type(type);
1688 return " new(&_" + name +
") " + lang_field_type +
";\n";
1693 static std::string
union_reset(
const std::string&, AST_Decl*,
const std::string&
name, AST_Type* type,
1694 const std::string&,
bool,
Intro&,
1698 const std::string lang_field_type = generator_->map_type(type);
1701 return " _" + name +
".~basic_string();\n";
1703 const size_t idx = lang_field_type.rfind(
"::");
1704 const std::string dtor_name = (idx == std::string::npos) ? lang_field_type
1705 : lang_field_type.substr(idx + 2);
1706 return " _" + name +
".~" + dtor_name +
"();\n";
1712 const std::vector<AST_UnionBranch*>& branches, AST_Type* discriminator)
1715 const char*
const nm = name->last_component()->get_string();
1716 const std::string d_type = generator_->map_type(discriminator);
1717 const std::string defVal = generateDefaultValue(u);
1719 gen_union_pragma_pre();
1720 gen_common_strunion_pre(nm);
1723 " " << nm <<
"() { _activate(" << defVal <<
"); }\n" 1724 " " << nm <<
"(const " << nm <<
"& rhs);\n" 1725 " " << nm <<
"(" << nm <<
"&& rhs);\n" 1726 " " << nm <<
"& operator=(const " << nm <<
"& rhs);\n" 1727 " " << nm <<
"& operator=(" << nm <<
"&& rhs);\n" 1728 " ~" << nm <<
"() { _reset(); }\n\n" 1729 " " << d_type <<
" _d() const { return _disc; }\n" 1730 " void _d(" << d_type <<
" d) { _disc = d; }\n\n";
1732 std::for_each(branches.begin(), branches.end(), union_accessors);
1733 if (needsDefault(branches, discriminator)) {
1735 " void _default() { _reset(); _activate(" << defVal <<
"); }\n\n";
1740 " bool _set = false;\n" 1741 " " << d_type <<
" _disc;\n\n" 1744 std::for_each(branches.begin(), branches.end(), union_field);
1748 " void _activate(" << d_type <<
" d);\n" 1749 " void _reset();\n";
1751 gen_common_strunion_post(nm);
1752 gen_union_pragma_post();
1756 nm <<
"::" << nm <<
"(const " << nm <<
"& rhs)\n" 1758 " _activate(rhs._disc);\n";
1762 nm <<
"::" << nm <<
'(' << nm <<
"&& rhs)\n" 1764 " _activate(rhs._disc);\n";
1768 nm <<
"& " << nm <<
"::operator=(const " << nm <<
"& rhs)\n" 1770 " if (this == &rhs) {\n" 1775 " _disc = rhs._disc;\n" 1778 nm <<
"& " << nm <<
"::operator=(" << nm <<
"&& rhs)\n" 1780 " if (this == &rhs) {\n" 1783 generateSwitchForUnion(u,
"rhs._disc", union_move_assign, branches, discriminator,
"",
"",
"",
false,
false);
1785 " _disc = rhs._disc;\n" 1788 "void " << nm <<
"::_activate(" << d_type <<
" d)\n" 1790 " if (_set && d != _disc) {\n" 1798 "void " << nm <<
"::_reset()\n" 1800 " if (!_set) return;\n";
1805 "void swap(" << nm <<
"& lhs, " << nm <<
"& rhs)\n" 1807 " std::swap(lhs, rhs);\n" 1810 gen_typecode_ptrs(nm);
1820 switch (
be_global->language_mapping()) {
1821 case BE_GlobalData::LANGMAP_FACE_CXX:
1822 string_ns =
"::FACE";
1826 case BE_GlobalData::LANGMAP_SP_CXX:
1827 string_ns =
"::CORBA";
1831 case BE_GlobalData::LANGMAP_CXX11:
1832 string_ns =
"::CORBA";
1841 AST_Constant* constant)
1844 const char*
const nm = name->last_component()->get_string();
1846 const AST_Expression::ExprType type = constant->et();
1847 const bool is_enum = (type == AST_Expression::EV_enum);
1848 const std::string type_name = is_enum
1849 ?
scoped(constant->enum_full_name()) : generator_->map_type(type);
1851 generator_->const_keyword(type) <<
' ' << type_name <<
' ' << nm <<
" = ";
1854 UTL_ScopedName*
const enumerator = constant->constant_value()->n();
1855 if (generator_->scoped_enum()) {
1856 be_global->lang_header_ << type_name <<
"::" 1857 <<
to_string(enumerator->last_component()) <<
";\n";
1862 be_global->lang_header_ << *constant->constant_value()->ev() <<
";\n";
1868 const std::vector<AST_EnumVal*>& contents,
1872 const char*
const nm = name->last_component()->get_string();
1873 const char* scoped_enum = generator_->scoped_enum() ?
"class " :
"";
1874 const std::string enum_base = generator_->enum_base();
1876 "enum " << scoped_enum << nm << enum_base <<
" {\n";
1877 for (
size_t i = 0; i < contents.size(); ++i) {
1879 " " << contents[i]->local_name()->get_string()
1880 << ((i < contents.size() - 1) ?
",\n" :
"\n");
1884 generator_->gen_simple_out(nm);
1890 AST_Type::SIZE_TYPE size)
1893 generator_->struct_decls(name, size);
1898 const std::vector<AST_Field*>& fields,
1899 AST_Type::SIZE_TYPE size,
1902 return generator_->gen_struct(s, name, fields, size, x);
1907 #ifdef ACE_HAS_CDR_FIXED 1908 void gen_fixed(UTL_ScopedName*
name, AST_Fixed* fixed)
1910 be_global->add_include(
"FACE/Fixed.h", BE_GlobalData::STREAM_LANG_H);
1911 const char*
const nm = name->last_component()->get_string();
1913 "typedef " << helpers_[HLP_FIXED] <<
'<' << *fixed->digits()->ev()
1914 <<
", " << *fixed->scale()->ev() <<
"> " << nm <<
";\n" 1915 "typedef " << nm <<
"& " << nm <<
"_out;\n";
1926 const char*
const nm = name->last_component()->get_string();
1928 switch (base->node_type()) {
1929 case AST_Decl::NT_sequence:
1930 generator_->gen_sequence(name, dynamic_cast<AST_Sequence*>(base));
1932 case AST_Decl::NT_array:
1933 generator_->gen_array(name, arr = dynamic_cast<AST_Array*>(base));
1935 case AST_Decl::NT_fixed:
1936 # ifdef ACE_HAS_CDR_FIXED 1937 gen_fixed(name, dynamic_cast<AST_Fixed*>(base));
1940 std::cerr <<
"ERROR: fixed data type (for " << nm <<
") is not supported" 1941 " with this version of ACE+TAO\n";
1945 if (
be_global->language_mapping() == BE_GlobalData::LANGMAP_CXX11) {
1947 "using " << nm <<
" = " << generator_->map_type(base) <<
";\n";
1950 "typedef " << generator_->map_type(base) <<
' ' << nm <<
";\n";
1953 generator_->gen_typedef_varout(nm, base);
1956 if (actual_base->node_type() == AST_Decl::NT_array) {
1957 generator_->gen_array_typedef(nm, base);
1965 if (arr) generator_->gen_array_traits(name, arr);
1970 UTL_ScopedName*
name,
1971 AST_Type::SIZE_TYPE)
1974 generator_->struct_decls(name, node->full_definition()->size_type(),
"class");
1979 const std::vector<AST_UnionBranch*>& branches,
1980 AST_Type* discriminator,
1983 return generator_->gen_union(u, name, branches, discriminator);
1988 if (
be_global->language_mapping() == BE_GlobalData::LANGMAP_CXX11) {
1994 be_global->add_include(
"<tao/Objref_VarOut_T.h>", BE_GlobalData::STREAM_LANG_H);
1995 const char*
const nm = name->last_component()->get_string();
1997 "class " << nm <<
";\n" 1998 "typedef " << nm <<
'*' << nm <<
"_ptr;\n" 1999 "typedef TAO_Objref_Var_T<" << nm <<
"> " << nm <<
"_var;\n" 2000 "typedef TAO_Objref_Out_T<" << nm <<
"> " << nm <<
"_out;\n";
static size_t countLabels(const std::vector< AST_UnionBranch *> &branches)
bool gen_union(AST_Union *, UTL_ScopedName *name, const std::vector< AST_UnionBranch *> &branches, AST_Type *discriminator, const char *repoid)
bool gen_union(AST_Union *u, UTL_ScopedName *name, const std::vector< AST_UnionBranch *> &branches, AST_Type *discriminator)
Classification classify(AST_Type *type)
virtual void struct_decls(UTL_ScopedName *name, AST_Type::SIZE_TYPE size, const char *struct_or_class="struct")
static std::string union_activate(const std::string &, AST_Decl *, const std::string &name, AST_Type *type, const std::string &, bool, Intro &, const std::string &)
static std::string scoped_helper(UTL_ScopedName *sn, const char *sep, EscapeContext cxt=EscapeContext_Normal)
const char * c_str(void) const
virtual void gen_array_typedef(const char *nm, AST_Type *base)
const Classification CL_STRING
bool gen_union_fwd(AST_UnionFwd *, UTL_ScopedName *name, AST_Type::SIZE_TYPE size)
void gen_array_typedef(const char *, AST_Type *)
static std::string union_assign(const std::string &, AST_Decl *, const std::string &name, AST_Type *, const std::string &, bool, Intro &, const std::string &)
bool gen_typedef(AST_Typedef *, UTL_ScopedName *name, AST_Type *type, const char *repoid)
bool gen_enum(AST_Enum *, UTL_ScopedName *name, const std::vector< AST_EnumVal *> &contents, const char *repoid)
static FaceGenerator instance
const Classification CL_WIDE
bool gen_struct_fwd(UTL_ScopedName *name, AST_Type::SIZE_TYPE size)
const Classification CL_PRIMITIVE
static std::string union_move(const std::string &, AST_Decl *, const std::string &name, AST_Type *, const std::string &, bool, Intro &, const std::string &)
std::string map_type_string(AST_PredefinedType::PredefinedType chartype, bool)
virtual std::string const_keyword(AST_Expression::ExprType)
virtual void gen_simple_out(const char *nm)
static std::string union_reset(const std::string &, AST_Decl *, const std::string &name, AST_Type *type, const std::string &, bool, Intro &, const std::string &)
bool gen_struct(AST_Structure *, UTL_ScopedName *name, const std::vector< AST_Field *> &fields, AST_Type::SIZE_TYPE size, const char *)
static void gen_common_strunion_post(const char *nm)
T::rv_reference move(T &p)
virtual void gen_array_traits(UTL_ScopedName *tdname, AST_Array *arr)
void operator()(AST_UnionBranch *branch)
void gen_simple_out(const char *)
const Classification CL_ARRAY
virtual bool scoped_enum()
bool needSyntheticDefault(AST_Type *disc, size_t n_labels)
static void gen_array(AST_Array *arr, const std::string &type, const std::string &elem, const std::string &ind="")
bool generateSwitchForUnion(AST_Union *u, const char *switchExpr, CommonFn commonFn, const std::vector< AST_UnionBranch *> &branches, AST_Type *discriminator, const char *statementPrefix, const char *namePrefix="", const char *uni="", bool forceDisableDefault=false, bool parens=true, bool breaks=true, CommonFn commonFn2=0)
returns true if a default: branch was generated (no default: label in IDL)
static void union_accessors(AST_UnionBranch *branch)
static void gen_common_strunion_pre(const char *nm)
std::string getEnumLabel(AST_Expression *label_val, AST_Type *disc)
const AstTypeClassification::Classification cls_
bool gen_struct(AST_Structure *, UTL_ScopedName *name, const std::vector< AST_Field *> &fields, AST_Type::SIZE_TYPE size, const char *)
bool gen_struct(AST_Structure *, UTL_ScopedName *name, const std::vector< AST_Field *> &fields, AST_Type::SIZE_TYPE size, const char *repoid)
static std::string generateReset(const std::string &, AST_Decl *, const std::string &name, AST_Type *field_type, const std::string &, bool, Intro &, const std::string &)
static SafetyProfileGenerator instance
virtual void gen_array(UTL_ScopedName *tdname, AST_Array *arr)
static void gen_typecode_ptrs(const std::string &type)
virtual void gen_sequence(UTL_ScopedName *tdname, AST_Sequence *seq)
static std::string union_copy(const std::string &, AST_Decl *, const std::string &name, AST_Type *, const std::string &, bool, Intro &, const std::string &)
AST_Type * resolveActualType(AST_Type *element)
std::string const_keyword(AST_Expression::ExprType type)
static void gen_sequence(const std::string &type, const std::string &elem, const std::string &ind="")
void gen_array_traits(UTL_ScopedName *, AST_Array *)
void struct_decls(UTL_ScopedName *name, AST_Type::SIZE_TYPE, const char *)
static std::string generateDefaultValue(AST_Union *the_union)
virtual std::string enum_base()
virtual std::string map_type_string(AST_PredefinedType::PredefinedType chartype, bool constant)
void gen_sequence(UTL_ScopedName *tdname, AST_Sequence *seq)
const Classification CL_FIXED
std::string scoped(UTL_ScopedName *sn, EscapeContext ec=EscapeContext_Normal)
static std::string generateAssign(const std::string &, AST_Decl *, const std::string &name, AST_Type *field_type, const std::string &, bool, Intro &, const std::string &)
static bool needsDefault(const std::vector< AST_UnionBranch *> &branches, AST_Type *discriminator)
static bool hasDefaultLabel(const std::vector< AST_UnionBranch *> &branches)
void gen_typedef_varout(const char *, AST_Type *)
void gen_array(UTL_ScopedName *tdname, AST_Array *arr)
const Classification CL_STRUCTURE
virtual bool gen_union(AST_Union *u, UTL_ScopedName *name, const std::vector< AST_UnionBranch *> &branches, AST_Type *discriminator)
std::string map_type(AST_Type *type)
bool gen_interf_fwd(UTL_ScopedName *name)
static Cxx11Generator instance
bool gen_const(UTL_ScopedName *name, bool nestedInInteface, AST_Constant *constant)
static void gen_struct_members(AST_Field *field)
BE_GlobalData * be_global
ACE_CDR::ULong array_element_count(AST_Array *arr)
const Classification CL_INTERFACE
std::string map_type(AST_Expression::ExprType type)
const char * to_string(MessageId value)
void assign(EntityId_t &dest, const EntityId_t &src)
bool gen_struct(AST_Structure *, UTL_ScopedName *name, const std::vector< AST_Field *> &fields, AST_Type::SIZE_TYPE, const char *)
void misc_error_and_abort(const std::string &message, AST_Decl *node=0)
Report a miscellaneous error and abort.
virtual void gen_typedef_varout(const char *nm, AST_Type *base)
const Classification CL_ENUM
GenerateUnionAccessors(AST_Union *u, AST_Type *d)
const Classification CL_SEQUENCE
void gen_union_pragma_pre()
static void union_field(AST_UnionBranch *branch)
static std::string generateEqual(const std::string &, AST_Decl *, const std::string &name, AST_Type *field_type, const std::string &, bool, Intro &, const std::string &)
void gen_sequence(UTL_ScopedName *tdname, AST_Sequence *seq)
const Classification CL_UNION
void gen_union_pragma_post()
static void generate_union_field(AST_UnionBranch *branch)
static std::string union_move_assign(const std::string &, AST_Decl *, const std::string &name, AST_Type *, const std::string &, bool, Intro &, const std::string &)
std::string map_type(AST_Field *field)
static std::string generateCopyCtor(const std::string &, AST_Decl *, const std::string &name, AST_Type *field_type, const std::string &, bool, Intro &, const std::string &)
const std::string type_name_