17 #include <utl_identifier.h> 55 to_long(
const AST_Expression::AST_ExprValue& ev)
58 case AST_Expression::EV_octet:
60 #if OPENDDS_HAS_EXPLICIT_INTS 61 case AST_Expression::EV_uint8:
63 case AST_Expression::EV_int8:
66 case AST_Expression::EV_short:
68 case AST_Expression::EV_ushort:
70 case AST_Expression::EV_long:
72 case AST_Expression::EV_ulong:
74 case AST_Expression::EV_wchar:
76 case AST_Expression::EV_char:
78 case AST_Expression::EV_bool:
80 case AST_Expression::EV_enum:
91 virtual std::ostream& print_on(std::ostream& out)
const = 0;
95 operator<<(std::ostream& out,
const Printer& printer)
97 return printer.print_on(out);
100 template <
typename T>
101 struct ValuePrinter : Printer {
102 explicit ValuePrinter(
const T& a_value) :
value(a_value) {}
107 template <
typename T>
108 struct UintPrinter : ValuePrinter<T> {
109 explicit UintPrinter(
const T& a_value) : ValuePrinter<T>(a_value) {}
111 std::ostream& print_on(std::ostream& out)
const 113 return out << static_cast<unsigned int>(this->
value);
117 struct SBoundPrinter : UintPrinter<OpenDDS::XTypes::SBound> {
122 struct LBoundPrinter : UintPrinter<OpenDDS::XTypes::LBound> {
127 struct EquivalenceKindPrinter : ValuePrinter<OpenDDS::XTypes::EquivalenceKind> {
131 std::ostream& print_on(std::ostream& out)
const 133 switch (this->
value) {
135 return out <<
"XTypes::EK_MINIMAL";
137 return out <<
"XTypes::EK_COMPLETE";
139 return out <<
"XTypes::EK_BOTH";
145 struct BitmaskPrintHelper {
146 explicit BitmaskPrintHelper(std::ostream& os) :
os_(os), first_(true) {}
151 BitmaskPrintHelper&
operator<<(
const char* str)
162 ~BitmaskPrintHelper()
170 struct MemberFlagPrinter : ValuePrinter<OpenDDS::XTypes::MemberFlag> {
174 std::ostream& print_on(std::ostream& out)
const 176 BitmaskPrintHelper bph(out);
178 bph <<
"XTypes::TRY_CONSTRUCT1";
181 bph <<
"XTypes::TRY_CONSTRUCT2";
184 bph <<
"XTypes::IS_EXTERNAL";
187 bph <<
"XTypes::IS_OPTIONAL";
190 bph <<
"XTypes::IS_MUST_UNDERSTAND";
193 bph <<
"XTypes::IS_KEY";
196 bph <<
"XTypes::IS_DEFAULT";
202 struct CollectionElementFlagPrinter : MemberFlagPrinter {
206 struct StructMemberFlagPrinter : MemberFlagPrinter {
210 struct UnionMemberFlagPrinter : MemberFlagPrinter {
214 struct UnionDiscriminatorFlagPrinter : MemberFlagPrinter {
218 struct EnumeratedLiteralFlagPrinter : MemberFlagPrinter {
222 struct AliasMemberFlagPrinter : MemberFlagPrinter {
226 struct TypeFlagPrinter : ValuePrinter<OpenDDS::XTypes::TypeFlag> {
230 std::ostream& print_on(std::ostream& out)
const 232 BitmaskPrintHelper bph(out);
234 bph <<
"XTypes::IS_FINAL";
237 bph <<
"XTypes::IS_APPENDABLE";
240 bph <<
"XTypes::IS_MUTABLE";
243 bph <<
"XTypes::IS_NESTED";
246 bph <<
"XTypes::IS_AUTOID_HASH";
252 struct StructTypeFlagPrinter : TypeFlagPrinter {
256 struct UnionTypeFlagPrinter : TypeFlagPrinter {
260 struct CollectionTypeFlagPrinter : TypeFlagPrinter {
264 struct AliasTypeFlagPrinter : TypeFlagPrinter {
268 struct EnumTypeFlagPrinter : TypeFlagPrinter {
272 struct MemberIdPrinter : UintPrinter<OpenDDS::XTypes::MemberId> {
277 struct BitBoundPrinter : UintPrinter<OpenDDS::XTypes::BitBound> {
288 out <<
"XTypes::SBoundSeq()";
290 out <<
".append(" << SBoundPrinter(*pos) <<
")";
298 out <<
"XTypes::LBoundSeq()";
300 out <<
".append(" << LBoundPrinter(*pos) <<
")";
308 return out <<
"XTypes::StringSTypeDefn(" << SBoundPrinter(string_sdefn.
bound) <<
")";
314 return out <<
"XTypes::StringLTypeDefn(" << LBoundPrinter(string_ldefn.
bound) <<
")";
322 <<
"XTypes::PlainCollectionHeader(" 323 << EquivalenceKindPrinter(header.
equiv_kind) <<
", " 332 <<
"XTypes::PlainSequenceSElemDefn(" 333 << seq_sdefn.
header <<
", " 334 << SBoundPrinter(seq_sdefn.
bound) <<
", " 343 <<
"XTypes::PlainSequenceLElemDefn(" 344 << seq_ldefn.
header <<
", " 345 << LBoundPrinter(seq_ldefn.
bound) <<
", " 354 <<
"XTypes::PlainArraySElemDefn(" 355 << array_sdefn.
header <<
", " 365 <<
"XTypes::PlainArrayLElemDefn(" 366 << array_ldefn.
header <<
", " 376 <<
"XTypes::PlainMapSTypeDefn(" 377 << map_sdefn.
header <<
", " 378 << SBoundPrinter(map_sdefn.
bound) <<
", " 380 << CollectionElementFlagPrinter(map_sdefn.
key_flags) <<
", " 389 <<
"XTypes::PlainMapLTypeDefn(" 390 << map_ldefn.
header <<
", " 391 << LBoundPrinter(map_ldefn.
bound) <<
", " 393 << CollectionElementFlagPrinter(map_ldefn.
key_flags) <<
", " 402 <<
"XTypes::EquivalenceHashWrapper(" 411 <<
"XTypes::TypeObjectHashId(" 412 << EquivalenceKindPrinter(
id.kind) <<
", " 421 <<
"XTypes::StronglyConnectedComponentId(" 431 out <<
"XTypes::TypeIdentifier(";
434 out <<
"XTypes::TK_NONE";
437 out <<
"XTypes::TK_BOOLEAN";
440 out <<
"XTypes::TK_BYTE";
443 out <<
"XTypes::TK_INT8";
446 out <<
"XTypes::TK_INT16";
449 out <<
"XTypes::TK_INT32";
452 out <<
"XTypes::TK_INT64";
455 out <<
"XTypes::TK_UINT8";
458 out <<
"XTypes::TK_UINT16";
461 out <<
"XTypes::TK_UINT32";
464 out <<
"XTypes::TK_UINT64";
467 out <<
"XTypes::TK_FLOAT32";
470 out <<
"XTypes::TK_FLOAT64";
473 out <<
"XTypes::TK_FLOAT128";
476 out <<
"XTypes::TK_CHAR8";
479 out <<
"XTypes::TK_CHAR16";
482 out <<
"XTypes::TI_STRING8_SMALL, " << ti.string_sdefn();
485 out <<
"XTypes::TI_STRING16_SMALL, " << ti.string_sdefn();
488 out <<
"XTypes::TI_STRING8_LARGE, " << ti.string_ldefn();
491 out <<
"XTypes::TI_STRING16_LARGE, " << ti.string_ldefn();
494 out <<
"XTypes::TI_PLAIN_SEQUENCE_SMALL, " << ti.seq_sdefn();
497 out <<
"XTypes::TI_PLAIN_SEQUENCE_LARGE, " << ti.seq_ldefn();
500 out <<
"XTypes::TI_PLAIN_ARRAY_SMALL, " << ti.array_sdefn();
503 out <<
"XTypes::TI_PLAIN_ARRAY_LARGE, " << ti.array_ldefn();
506 out <<
"XTypes::TI_PLAIN_MAP_SMALL, " << ti.map_sdefn();
509 out <<
"XTypes::TI_PLAIN_MAP_LARGE, " << ti.map_ldefn();
512 out <<
"XTypes::TI_STRONGLY_CONNECTED_COMPONENT, " << ti.sc_component_id();
515 out <<
"XTypes::EK_COMPLETE, " << ti.equivalence_hash();
518 out <<
"XTypes::EK_MINIMAL, " << ti.equivalence_hash();
537 for (
const char* ptr = buffer.rd_ptr(); ptr != buffer.wr_ptr(); ++ptr) {
538 if (ptr != buffer.rd_ptr()) {
541 be_global->impl_ << int(*reinterpret_cast<const unsigned char*>(ptr));
550 if (!produce_output_ || get_type_map_declared_) {
553 get_type_map_declared_ =
true;
555 be_global->add_include(
"dds/DCPS/XTypes/TypeObject.h", BE_GlobalData::STREAM_H);
557 be_global->impl_ <<
"static const XTypes::TypeMap& get_minimal_type_map();\n";
559 if (produce_xtypes_complete_) {
560 be_global->impl_ <<
"static const XTypes::TypeMap& get_complete_type_map();\n";
569 typeid_encoding_ = &enc;
575 be_global->add_include(
"dds/DCPS/Service_Participant.h");
577 if (!produce_output_ || !get_type_map_declared_) {
587 for (OpenDDS::XTypes::TypeMap::const_iterator pos = minimal_type_map_.begin();
588 pos != minimal_type_map_.end(); ++pos, ++idx) {
590 "XTypes::TypeObject minimal_to" << idx <<
"()\n" 592 " const unsigned char to_bytes[] = { ";
593 dump_bytes(pos->second);
594 be_global->add_include(
"<stdexcept>", BE_GlobalData::STREAM_CPP);
597 " XTypes::TypeObject to;\n" 598 " if (!to_type_object(to_bytes, sizeof(to_bytes), to)) {\n" 599 " throw std::runtime_error(\"Could not deserialize minimal Type Object " << idx <<
"\");\n" 606 "XTypes::TypeMap get_minimal_type_map_private()\n" 608 " XTypes::TypeMap tm;\n";
611 for (OpenDDS::XTypes::TypeMap::const_iterator pos = minimal_type_map_.begin();
612 pos != minimal_type_map_.end(); ++pos, ++idx) {
613 be_global->impl_ <<
" tm[" << pos->first <<
"] = minimal_to" << idx <<
"();\n";
620 if (produce_xtypes_complete_) {
622 for (OpenDDS::XTypes::TypeMap::const_iterator pos = complete_type_map_.begin();
623 pos != complete_type_map_.end(); ++pos, ++idx) {
625 "XTypes::TypeObject complete_to" << idx <<
"()\n" 627 " const unsigned char to_bytes[] = {\n";
628 dump_bytes(pos->second);
629 be_global->add_include(
"<stdexcept>", BE_GlobalData::STREAM_CPP);
632 " XTypes::TypeObject to;\n" 633 " if (!to_type_object(to_bytes, sizeof(to_bytes), to)) {\n" 634 " throw std::runtime_error(\"Could not deserialize complete Type Object " << idx <<
"\");\n" 641 "XTypes::TypeMap get_complete_type_map_private()\n" 643 " XTypes::TypeMap tm;\n";
646 for (OpenDDS::XTypes::TypeMap::const_iterator pos = complete_type_map_.begin();
647 pos != complete_type_map_.end(); ++pos, ++idx) {
648 be_global->impl_ <<
" tm[" << pos->first <<
"] = complete_to" << idx <<
"();\n";
657 const std::string common =
"{\n" 658 " static XTypes::TypeMap tm;\n" 659 " ACE_GUARD_RETURN(ACE_Thread_Mutex, guard, TheServiceParticipant->get_static_xtypes_lock(), tm);\n" 660 " if (tm.empty()) {\n";
663 "const XTypes::TypeMap& get_minimal_type_map()\n" << common <<
664 " tm = get_minimal_type_map_private();\n" 669 if (produce_xtypes_complete_) {
671 "const XTypes::TypeMap& get_complete_type_map()\n" << common <<
672 " tm = get_complete_type_map_private();\n" 687 const std::vector<AST_EnumVal*>&,
const char*)
694 const std::vector<AST_Field*>&, AST_Type::SIZE_TYPE,
const char*)
701 AST_Type*,
const char*)
708 const std::vector<AST_UnionBranch*>&, AST_Type*,
717 switch (type->node_type()) {
718 case AST_ConcreteType::NT_union_fwd:
720 AST_UnionFwd*
const n =
dynamic_cast<AST_UnionFwd*
>(type);
721 type = n->full_definition();
724 case AST_ConcreteType::NT_struct_fwd:
726 AST_StructureFwd*
const n =
dynamic_cast<AST_StructureFwd*
>(type);
727 type = n->full_definition();
734 if (element_.find(type) == element_.end()) {
735 strong_connect(type, anonymous_name);
737 }
else if (element_[type].on_stack) {
745 switch (type->node_type()) {
746 case AST_ConcreteType::NT_union_fwd:
748 AST_UnionFwd*
const n =
dynamic_cast<AST_UnionFwd*
>(type);
749 type = n->full_definition();
752 case AST_ConcreteType::NT_struct_fwd:
754 AST_StructureFwd*
const n =
dynamic_cast<AST_StructureFwd*
>(type);
755 type = n->full_definition();
767 stack_.push_back(type);
771 AST_Structure*
const stru =
dynamic_cast<AST_Structure*
>(type);
772 switch (type->node_type()) {
774 case AST_ConcreteType::NT_union:
776 AST_Union*
const n =
dynamic_cast<AST_Union*
>(type);
779 AST_Type* discriminator = n->disc_type();
782 consider(v, discriminator, v.
name +
".d");
788 AST_UnionBranch* ub =
dynamic_cast<AST_UnionBranch*
>(*i);
796 case AST_ConcreteType::NT_struct:
798 AST_Structure*
const n =
dynamic_cast<AST_Structure*
>(type);
808 AST_Field* field = *i;
816 case AST_ConcreteType::NT_array:
818 AST_Array*
const n =
dynamic_cast<AST_Array*
>(type);
819 v.
name = anonymous_name +
".a";
820 consider(v, n->base_type(), v.
name);
824 case AST_ConcreteType::NT_sequence:
826 AST_Sequence*
const n =
dynamic_cast<AST_Sequence*
>(type);
827 v.
name = anonymous_name +
".s";
828 consider(v, n->base_type(), v.
name);
832 case AST_ConcreteType::NT_typedef:
834 AST_Typedef*
const n =
dynamic_cast<AST_Typedef*
>(type);
838 consider(v, n->base_type(), v.
name +
".0");
842 case AST_ConcreteType::NT_enum:
844 AST_Enum*
const n =
dynamic_cast<AST_Enum*
>(type);
849 case AST_ConcreteType::NT_string:
850 case AST_ConcreteType::NT_wstring:
851 case AST_ConcreteType::NT_pre_defined:
852 case AST_ConcreteType::NT_fixed:
853 case AST_ConcreteType::NT_interface:
854 case AST_ConcreteType::NT_interface_fwd:
857 case AST_ConcreteType::NT_struct_fwd:
858 case AST_ConcreteType::NT_union_fwd:
859 case AST_ConcreteType::NT_native:
860 case AST_ConcreteType::NT_factory:
861 case AST_ConcreteType::NT_finder:
862 case AST_ConcreteType::NT_component:
863 case AST_ConcreteType::NT_component_fwd:
864 case AST_ConcreteType::NT_home:
865 case AST_ConcreteType::NT_eventtype:
866 case AST_ConcreteType::NT_eventtype_fwd:
867 case AST_ConcreteType::NT_valuebox:
868 case AST_ConcreteType::NT_type:
869 case AST_ConcreteType::NT_porttype:
870 case AST_ConcreteType::NT_provides:
871 case AST_ConcreteType::NT_uses:
872 case AST_ConcreteType::NT_publishes:
873 case AST_ConcreteType::NT_emits:
874 case AST_ConcreteType::NT_consumes:
875 case AST_ConcreteType::NT_ext_port:
876 case AST_ConcreteType::NT_mirror_port:
877 case AST_ConcreteType::NT_connector:
878 case AST_ConcreteType::NT_param_holder:
879 case AST_ConcreteType::NT_annotation_decl:
880 case AST_ConcreteType::NT_annotation_appl:
881 case AST_ConcreteType::NT_annotation_member:
882 case AST_ConcreteType::NT_module:
883 case AST_ConcreteType::NT_root:
884 case AST_ConcreteType::NT_valuetype:
885 case AST_ConcreteType::NT_valuetype_fwd:
886 case AST_ConcreteType::NT_const:
887 case AST_ConcreteType::NT_except:
888 case AST_ConcreteType::NT_attr:
889 case AST_ConcreteType::NT_op:
890 case AST_ConcreteType::NT_argument:
891 case AST_ConcreteType::NT_union_branch:
892 case AST_ConcreteType::NT_field:
893 case AST_ConcreteType::NT_enum_val:
899 typedef std::vector<Element> List;
908 }
while (wt != v.
type);
911 std::sort(scc.begin(), scc.end());
913 if (scc.size() == 1) {
914 generate_type_identifier(scc[0].type,
false);
920 minimal_ti.sc_component_id().scc_length =
static_cast<int>(scc.size());
927 for (List::const_iterator pos = scc.begin(); pos != scc.end(); ++pos) {
928 minimal_ti.sc_component_id().scc_index =
static_cast<int>(++idx);
929 complete_ti.sc_component_id().scc_index = minimal_ti.sc_component_id().scc_index;
931 hash_type_identifier_map_[pos->type] = ti_pair;
937 for (List::const_iterator pos = scc.begin(); pos != scc.end(); ++pos) {
938 generate_type_identifier(pos->type,
true);
940 minimal_seq.
append(type_object_map_[pos->type].minimal);
941 complete_seq.
append(type_object_map_[pos->type].complete);
949 if (!(minimal_ser << minimal_seq)) {
963 if (!(complete_ser << complete_seq)) {
972 for (List::const_iterator pos = scc.begin(); pos != scc.end(); ++pos) {
973 minimal_ti.sc_component_id().scc_index =
static_cast<int>(++idx);
974 complete_ti.sc_component_id().scc_index = minimal_ti.sc_component_id().scc_index;
976 hash_type_identifier_map_[pos->type] = ti_pair;
981 for (List::const_iterator pos = scc.begin(); pos != scc.end(); ++pos) {
982 generate_type_identifier(pos->type,
true);
985 minimal_type_map_[minimal_ti] = type_object_map_[pos->type].minimal;
986 complete_type_map_[complete_ti] = type_object_map_[pos->type].complete;
998 type_object_map_[type] = to_pair;
1004 if (hash_type_identifier_map_.count(type) == 0) {
1008 hash_type_identifier_map_[type] = ti_pair;
1010 minimal_type_map_[minimal_ti] = minimal_to;
1011 complete_type_map_[complete_ti] = complete_to;
1020 std::string hash_name;
1034 AST_Structure*
const n =
dynamic_cast<AST_Structure*
>(type);
1066 AST_Field* field = *i;
1077 if (
be_global->is_must_understand(field)) {
1105 if (
be_global->old_typeobject_member_order()) {
1110 update_maps(type, minimal_to, complete_to);
1116 AST_Union*
const n =
dynamic_cast<AST_Union*
>(type);
1117 AST_Type* discriminator = n->disc_type();
1138 if (
be_global->union_discriminator_is_key(n)) {
1154 AST_UnionBranch* branch =
dynamic_cast<AST_UnionBranch*
>(*i);
1157 bool is_default =
false;
1158 for (
unsigned long j = 0; j < branch->label_list_length(); ++j) {
1159 AST_UnionLabel* label = branch->label(j);
1160 if (label->label_kind() == AST_UnionLabel::UL_default) {
1178 minimal_member.
common.
type_id = get_minimal_type_identifier(branch->field_type());
1180 for (
unsigned long j = 0; j < branch->label_list_length(); ++j) {
1181 AST_UnionLabel* label = branch->label(j);
1182 if (label->label_kind() != AST_UnionLabel::UL_default) {
1195 complete_member.
common.
type_id = get_complete_type_identifier(branch->field_type());
1204 if (
be_global->old_typeobject_member_order()) {
1209 update_maps(type, minimal_to, complete_to);
1215 AST_Enum*
const n =
dynamic_cast<AST_Enum*
>(type);
1216 std::vector<AST_EnumVal*> contents;
1218 bool has_extensibility_annotation =
false;
1225 size_t default_literal_idx = 0;
1226 for (
size_t i = 0; i != contents.size(); ++i) {
1227 if (contents[i]->annotations().find(
"@default_literal")) {
1228 default_literal_idx = i;
1236 if (has_extensibility_annotation || !
be_global->default_enum_extensibility_zero()) {
1244 if (has_extensibility_annotation || !
be_global->default_enum_extensibility_zero()) {
1250 for (
size_t i = 0; i != contents.size(); ++i) {
1252 minimal_lit.
common.
value = contents[i]->constant_value()->ev()->u.eval;
1267 update_maps(type, minimal_to, complete_to);
1273 AST_Array*
const n =
dynamic_cast<AST_Array*
>(type);
1277 if (
be_global->is_external(n->base_type())) {
1283 if (
be_global->is_plain(type) && !force_type_object) {
1291 max_bound = std::max(max_bound, n->dims()[dim]->ev()->u.ulval);
1294 if (max_bound < 256) {
1296 minimal_ti.array_sdefn().header.equiv_kind = minimal_ek;
1297 minimal_ti.array_sdefn().header.element_flags = cef;
1299 minimal_ti.array_sdefn().array_bound_seq.append(n->dims()[dim]->ev()->u.ulval);
1301 minimal_ti.array_sdefn().element_identifier = minimal_elem_ti;
1304 fully_desc_type_identifier_map_[type] = minimal_ti;
1307 complete_ti.array_sdefn().header.equiv_kind = complete_ek;
1308 complete_ti.array_sdefn().header.element_flags = cef;
1309 complete_ti.array_sdefn().array_bound_seq = minimal_ti.array_sdefn().array_bound_seq;
1310 complete_ti.array_sdefn().element_identifier = complete_elem_ti;
1313 hash_type_identifier_map_[type] = ti_pair;
1317 minimal_ti.array_ldefn().header.equiv_kind = minimal_ek;
1318 minimal_ti.array_ldefn().header.element_flags = cef;
1320 minimal_ti.array_ldefn().array_bound_seq.append(n->dims()[dim]->ev()->u.ulval);
1322 minimal_ti.array_ldefn().element_identifier = minimal_elem_ti;
1325 fully_desc_type_identifier_map_[type] = minimal_ti;
1328 complete_ti.array_ldefn().header.equiv_kind = complete_ek;
1329 complete_ti.array_ldefn().header.element_flags = cef;
1330 complete_ti.array_ldefn().array_bound_seq = minimal_ti.array_ldefn().array_bound_seq;
1331 complete_ti.array_ldefn().element_identifier = complete_elem_ti;
1334 hash_type_identifier_map_[type] = ti_pair;
1355 update_maps(type, minimal_to, complete_to);
1362 AST_Sequence*
const n =
dynamic_cast<AST_Sequence*
>(type);
1365 if (!n->unbounded()) {
1366 bound = n->max_size()->ev()->u.ulval;
1371 if (
be_global->is_external(n->base_type())) {
1377 if (
be_global->is_plain(type) && !force_type_object) {
1384 minimal_ti.seq_sdefn().header.equiv_kind = minimal_ek;
1385 minimal_ti.seq_sdefn().header.element_flags = cef;
1386 minimal_ti.seq_sdefn().bound = bound;
1387 minimal_ti.seq_sdefn().element_identifier = minimal_elem_ti;
1390 fully_desc_type_identifier_map_[type] = minimal_ti;
1393 complete_ti.seq_sdefn().header.equiv_kind = complete_ek;
1394 complete_ti.seq_sdefn().header.element_flags = cef;
1395 complete_ti.seq_sdefn().bound = bound;
1396 complete_ti.seq_sdefn().element_identifier = complete_elem_ti;
1399 hash_type_identifier_map_[type] = ti_pair;
1403 minimal_ti.seq_ldefn().header.equiv_kind = minimal_ek;
1404 minimal_ti.seq_ldefn().header.element_flags = cef;
1405 minimal_ti.seq_ldefn().bound = bound;
1406 minimal_ti.seq_ldefn().element_identifier = minimal_elem_ti;
1409 fully_desc_type_identifier_map_[type] = minimal_ti;
1412 complete_ti.seq_ldefn().header.equiv_kind = complete_ek;
1413 complete_ti.seq_ldefn().header.element_flags = cef;
1414 complete_ti.seq_ldefn().bound = bound;
1415 complete_ti.seq_ldefn().element_identifier = complete_elem_ti;
1418 hash_type_identifier_map_[type] = ti_pair;
1435 update_maps(type, minimal_to, complete_to);
1442 AST_Typedef*
const n =
dynamic_cast<AST_Typedef*
>(type);
1454 update_maps(type, minimal_to, complete_to);
1460 AST_PredefinedType*
const n =
dynamic_cast<AST_PredefinedType*
>(type);
1462 case AST_PredefinedType::PT_long:
1465 case AST_PredefinedType::PT_ulong:
1468 case AST_PredefinedType::PT_longlong:
1471 case AST_PredefinedType::PT_ulonglong:
1474 case AST_PredefinedType::PT_short:
1477 case AST_PredefinedType::PT_ushort:
1480 #if OPENDDS_HAS_EXPLICIT_INTS 1481 case AST_PredefinedType::PT_int8:
1484 case AST_PredefinedType::PT_uint8:
1488 case AST_PredefinedType::PT_float:
1491 case AST_PredefinedType::PT_double:
1494 case AST_PredefinedType::PT_longdouble:
1497 case AST_PredefinedType::PT_char:
1500 case AST_PredefinedType::PT_wchar:
1503 case AST_PredefinedType::PT_boolean:
1506 case AST_PredefinedType::PT_octet:
1509 case AST_PredefinedType::PT_any:
1510 case AST_PredefinedType::PT_object:
1511 case AST_PredefinedType::PT_value:
1512 case AST_PredefinedType::PT_abstract:
1513 case AST_PredefinedType::PT_void:
1514 case AST_PredefinedType::PT_pseudo:
1523 switch (type->node_type()) {
1525 case AST_ConcreteType::NT_union:
1527 generate_union_type_identifier(type);
1531 case AST_ConcreteType::NT_struct:
1533 generate_struct_type_identifier(type);
1537 case AST_ConcreteType::NT_enum:
1539 generate_enum_type_identifier(type);
1543 case AST_ConcreteType::NT_string:
1545 AST_String*
const n =
dynamic_cast<AST_String*
>(type);
1549 ti.string_sdefn().bound = bound;
1550 fully_desc_type_identifier_map_[type] = ti;
1553 ti.string_ldefn().bound = bound;
1554 fully_desc_type_identifier_map_[type] = ti;
1559 case AST_ConcreteType::NT_wstring:
1561 AST_String*
const n =
dynamic_cast<AST_String*
>(type);
1565 ti.string_sdefn().bound = bound;
1566 fully_desc_type_identifier_map_[type] = ti;
1569 ti.string_ldefn().bound = bound;
1570 fully_desc_type_identifier_map_[type] = ti;
1575 case AST_ConcreteType::NT_array:
1577 generate_array_type_identifier(type, force_type_object);
1581 case AST_ConcreteType::NT_sequence:
1583 generate_sequence_type_identifier(type, force_type_object);
1587 case AST_ConcreteType::NT_typedef:
1589 generate_alias_type_identifier(type);
1593 case AST_ConcreteType::NT_pre_defined:
1595 generate_primitive_type_identifier(type);
1599 case AST_ConcreteType::NT_fixed:
1600 case AST_ConcreteType::NT_interface:
1601 case AST_ConcreteType::NT_interface_fwd:
1607 case AST_ConcreteType::NT_struct_fwd:
1608 case AST_ConcreteType::NT_union_fwd:
1609 case AST_ConcreteType::NT_native:
1610 case AST_ConcreteType::NT_factory:
1611 case AST_ConcreteType::NT_finder:
1612 case AST_ConcreteType::NT_component:
1613 case AST_ConcreteType::NT_component_fwd:
1614 case AST_ConcreteType::NT_home:
1615 case AST_ConcreteType::NT_eventtype:
1616 case AST_ConcreteType::NT_eventtype_fwd:
1617 case AST_ConcreteType::NT_valuebox:
1618 case AST_ConcreteType::NT_type:
1619 case AST_ConcreteType::NT_porttype:
1620 case AST_ConcreteType::NT_provides:
1621 case AST_ConcreteType::NT_uses:
1622 case AST_ConcreteType::NT_publishes:
1623 case AST_ConcreteType::NT_emits:
1624 case AST_ConcreteType::NT_consumes:
1625 case AST_ConcreteType::NT_ext_port:
1626 case AST_ConcreteType::NT_mirror_port:
1627 case AST_ConcreteType::NT_connector:
1628 case AST_ConcreteType::NT_param_holder:
1629 case AST_ConcreteType::NT_annotation_decl:
1630 case AST_ConcreteType::NT_annotation_appl:
1631 case AST_ConcreteType::NT_annotation_member:
1632 case AST_ConcreteType::NT_module:
1633 case AST_ConcreteType::NT_root:
1634 case AST_ConcreteType::NT_valuetype:
1635 case AST_ConcreteType::NT_valuetype_fwd:
1636 case AST_ConcreteType::NT_const:
1637 case AST_ConcreteType::NT_except:
1638 case AST_ConcreteType::NT_attr:
1639 case AST_ConcreteType::NT_op:
1640 case AST_ConcreteType::NT_argument:
1641 case AST_ConcreteType::NT_union_branch:
1642 case AST_ConcreteType::NT_field:
1643 case AST_ConcreteType::NT_enum_val:
1652 switch(type->node_type()) {
1653 case AST_Decl::NT_union_fwd:
1655 AST_UnionFwd*
const td =
dynamic_cast<AST_UnionFwd*
>(type);
1656 return get_minimal_type_identifier(td->full_definition());
1658 case AST_Decl::NT_struct_fwd:
1660 AST_StructureFwd*
const td =
dynamic_cast<AST_StructureFwd*
>(type);
1661 return get_minimal_type_identifier(td->full_definition());
1667 if (fully_desc_type_identifier_map_.count(type) != 0) {
1668 return fully_desc_type_identifier_map_[type];
1671 HashTypeIdentifierMap::const_iterator pos = hash_type_identifier_map_.find(type);
1673 return pos->second.minimal;
1680 switch(type->node_type()) {
1681 case AST_Decl::NT_union_fwd:
1683 AST_UnionFwd*
const td =
dynamic_cast<AST_UnionFwd*
>(type);
1684 return get_complete_type_identifier(td->full_definition());
1686 case AST_Decl::NT_struct_fwd:
1688 AST_StructureFwd*
const td =
dynamic_cast<AST_StructureFwd*
>(type);
1689 return get_complete_type_identifier(td->full_definition());
1695 if (fully_desc_type_identifier_map_.count(type) != 0) {
1696 return fully_desc_type_identifier_map_[type];
1699 HashTypeIdentifierMap::const_iterator pos = hash_type_identifier_map_.find(type);
1701 return pos->second.complete;
1707 strong_connect(node,
"");
1709 if (!produce_output_) {
1714 const string clazz = tag_type(name);
1716 be_global->header_ <<
"struct " << clazz <<
" {};\n";
1718 const std::string common =
" static XTypes::TypeIdentifier ti;\n" 1719 " ACE_GUARD_RETURN(ACE_Thread_Mutex, guard, TheServiceParticipant->get_static_xtypes_lock(), ti);\n" 1720 " if (ti.kind() == XTypes::TK_NONE) {\n";
1723 const string decl =
"getMinimalTypeIdentifier<" + clazz +
">";
1724 Function gti(decl.c_str(),
"const XTypes::TypeIdentifier&",
"");
1728 " ti = " << ti <<
";\n" 1733 declare_get_type_map();
1735 const string decl =
"getMinimalTypeMap<" + clazz +
">";
1736 Function gti(decl.c_str(),
"const XTypes::TypeMap&",
"");
1739 " return get_minimal_type_map();\n";
1742 if (produce_xtypes_complete_) {
1744 const string decl =
"getCompleteTypeIdentifier<" + clazz +
">";
1745 Function gti(decl.c_str(),
"const XTypes::TypeIdentifier&",
"");
1748 if (produce_xtypes_complete_) {
1751 " ti = " << ti <<
";\n" 1756 " static XTypes::TypeIdentifier ti;\n" 1762 const string decl =
"getCompleteTypeMap<" + clazz +
">";
1763 Function gti(decl.c_str(),
"const XTypes::TypeMap&",
"");
1766 " return get_complete_type_map();\n";
UnionMemberFlag member_flags
TypeIdentifier related_type
MemberFlag StructMemberFlag
void scope2vector(std::vector< T *> &v, UTL_Scope *s, AST_Decl::NodeType nt)
const TypeKind TK_SEQUENCE
PlainCollectionHeader header
CompleteCollectionElement element
MinimalEnumeratedType enumerated_type
External< TypeIdentifier > element_identifier
const LogLevel::Value value
TypeIdentifier member_type_id
MemberFlag UnionMemberFlag
MinimalCollectionHeader header
const TypeKind TK_FLOAT128
const Encoding & get_typeobject_encoding()
CORBA::Boolean operator<<(TAO_OutputCDR &, const CORBA::Object *)
External< TypeIdentifier > element_identifier
CommonStructMember common
const EquivalenceKind EK_BOTH
CompleteArrayType array_type
const TypeIdentifierKind TI_STRING8_LARGE
size_t length(void) const
bool generate(AST_Type *node, UTL_ScopedName *name)
const TypeFlag IS_MUTABLE
StructMemberFlag member_flags
void MD5Hash(MD5Result &result, const void *input, size_t size)
CompleteMemberDetail detail
CommonCollectionHeader common
CompleteUnionMemberSeq member_seq
void strong_connect(AST_Type *type, const std::string &anonymous_name)
CompleteStructType struct_type
String to_dds_string(unsigned short to_convert)
Optional< DCPS::String > hash_id
static std::string get_xtag_name(UTL_ScopedName *name)
const TypeIdentifierKind TI_PLAIN_SEQUENCE_LARGE
MinimalCollectionElement element
const MemberFlag IS_MUST_UNDERSTAND
QualifiedTypeName type_name
ACE_CDR::Octet kind() const
#define OPENDDS_ASSERT(C)
CompleteUnionHeader header
void declare_get_type_map()
MinimalEnumeratedLiteralSeq literal_seq
PlainCollectionHeader header
CollectionElementFlag element_flags
const TypeIdentifierKind TI_STRING16_LARGE
bool is_fully_descriptive(const TypeIdentifier &ti)
void generate_enum_type_identifier(AST_Type *type)
const_iterator end() const
EquivalenceKind equiv_kind
void serialized_size(const Encoding &encoding, size_t &size, const SequenceNumber &)
const MemberFlag TRY_CONSTRUCT2
CompleteTypeDetail detail
CommonCollectionElement common
static std::string tag_type(UTL_ScopedName *name)
bool gen_enum(AST_Enum *node, UTL_ScopedName *name, const std::vector< AST_EnumVal *> &contents, const char *repoid)
CommonEnumeratedHeader common
Members::const_iterator const_iterator
char * rd_ptr(void) const
External< TypeIdentifier > element_identifier
LBoundSeq array_bound_seq
void generate_primitive_type_identifier(AST_Type *type)
const TypeIdentifierKind TI_STRING8_SMALL
CommonDiscriminatorMember common
CompleteEnumeratedLiteralSeq literal_seq
MinimalMemberDetail detail
CompleteStructHeader header
PlainCollectionHeader header
bool gen_struct(AST_Structure *node, UTL_ScopedName *name, const std::vector< AST_Field *> &fields, AST_Type::SIZE_TYPE size, const char *repoid)
CompleteSequenceType sequence_type
const EquivalenceKind EK_COMPLETE
const TypeIdentifierKind TI_PLAIN_MAP_LARGE
void generate_union_type_identifier(AST_Type *type)
ACE_CDR::UShort MemberFlag
CommonEnumeratedLiteral common
CommonCollectionHeader common
const TypeFlag IS_AUTOID_HASH
UnionDiscriminatorFlag member_flags
CompleteTypeDetail detail
MemberFlag UnionDiscriminatorFlag
const MemberFlag TryConstructTrimValue
Class to serialize and deserialize data for DDS.
PlainCollectionHeader header
EnumeratedLiteralFlag flags
StructTypeFlag struct_flags
std::string canonical_name(UTL_ScopedName *sn)
const TypeKind TK_BOOLEAN
void update_maps(AST_Type *type, const OpenDDS::XTypes::TypeObject &minimal_to, const OpenDDS::XTypes::TypeObject &complete_to)
const TypeIdentifierKind TI_PLAIN_MAP_SMALL
MemberFlag CollectionElementFlag
unsigned char MD5Result[16]
const TypeIdentifierKind TI_PLAIN_ARRAY_LARGE
Christopher Diggins *renamed files *fixing compilation errors *adding Visual C project file *removed make Max Lybbert *removed references to missing and unused header
const TypeIdentifierKind TI_PLAIN_ARRAY_SMALL
TypeObjectHashId sc_component_id
CompleteUnionType union_type
CompleteMemberDetail detail
bool gen_union(AST_Union *node, UTL_ScopedName *name, const std::vector< AST_UnionBranch *> &branches, AST_Type *type, const char *repoid)
External< TypeIdentifier > element_identifier
MinimalDiscriminatorMember discriminator
const MemberFlag TryConstructUseDefaultValue
CompleteAliasType alias_type
DCPS::String equivalence_hash_to_string(const EquivalenceHash &equivalence_hash)
CompleteStructMemberSeq member_seq
CommonEnumeratedHeader common
void set_builtin_member_annotations(AST_Decl *member, OpenDDS::XTypes::Optional< OpenDDS::XTypes::AppliedBuiltinMemberAnnotations > &annotations)
PlainCollectionHeader header
Optional< AppliedBuiltinMemberAnnotations > ann_builtin
void generate_array_type_identifier(AST_Type *type, bool force_type_object)
CompleteArrayHeader header
CompleteCollectionHeader header
MinimalUnionMemberSeq member_seq
TypeFlag CollectionTypeFlag
External< TypeIdentifier > element_identifier
virtual bool node_value_exists(AST_Decl *node, T &value) const
bool skip_sequence_dheader() const
UnionTypeFlag union_flags
SBoundSeq array_bound_seq
void consider(Element &v, AST_Type *type, const std::string &anonymous_name)
const TypeKind TK_STRUCTURE
void generate_sequence_type_identifier(AST_Type *type, bool force_type_object)
void hash_member_name(NameHash &name_hash, const OPENDDS_STRING &name)
CompleteTypeDetail detail
CompleteMemberDetail detail
void use_old_typeobject_encoding()
Sequence & append(const T &member)
bool gen_typedef(AST_Typedef *node, UTL_ScopedName *name, AST_Type *type, const char *repoid)
const TypeKind TK_FLOAT32
MinimalSequenceType sequence_type
OpenDDS::XTypes::TypeIdentifier get_minimal_type_identifier(AST_Type *type)
OpenDDS::XTypes::TypeIdentifier get_complete_type_identifier(AST_Type *type)
ACE_CDR::Octet EquivalenceHash[14]
External< TypeIdentifier > key_identifier
CompleteTypeDetail detail
ACE_CDR::Octet EquivalenceKind
External< TypeIdentifier > element_identifier
void generate_alias_type_identifier(AST_Type *type)
CompleteEnumeratedType enumerated_type
MinimalMemberDetail detail
MinimalArrayType array_type
const MemberFlag TRY_CONSTRUCT1
const MemberFlag TryConstructDiscardValue
MinimalStructMemberSeq member_seq
MinimalCollectionElement element
void generate_type_identifier(AST_Type *type, bool force_type_object)
const MemberFlag IS_OPTIONAL
BE_GlobalData * be_global
MemberFlag AliasMemberFlag
External< TypeIdentifier > key_identifier
const TypeIdentifierKind TI_PLAIN_SEQUENCE_SMALL
MinimalAliasType alias_type
CompleteAliasHeader header
MinimalUnionType union_type
CollectionElementFlag key_flags
UnionCaseLabelSeq label_seq
MemberFlag EnumeratedLiteralFlag
MinimalStructType struct_type
const TypeFlag IS_APPENDABLE
const EquivalenceKind EK_MINIMAL
const TypeIdentifierKind TI_STRING16_SMALL
const MemberFlag IS_DEFAULT
const TypeIdentifierKind TI_STRONGLY_CONNECTED_COMPONENT
void misc_error_and_abort(const std::string &message, AST_Decl *node=0)
Report a miscellaneous error and abort.
UnionTypeFlag union_flags
CommonCollectionElement common
MinimalMemberDetail detail
const DCPS::Encoding encoding(DCPS::Encoding::KIND_UNALIGNED_CDR, DCPS::ENDIAN_BIG)
CompleteCollectionElement element
CommonDiscriminatorMember common
CommonEnumeratedLiteral common
PlainCollectionHeader header
MinimalStructHeader header
TypeIdentifier makeTypeIdentifier(const TypeObject &type_object, const DCPS::Encoding *encoding_option)
CollectionElementFlag element_flags
The Internal API and Implementation of OpenDDS.
CompleteTypeObject complete
void generate_struct_type_identifier(AST_Type *type)
MinimalArrayHeader header
CommonStructMember common
CompleteDiscriminatorMember discriminator
CollectionElementFlag key_flags
const MemberFlag IS_EXTERNAL
CompleteEnumeratedHeader header
MinimalTypeObject minimal
const TypeKind TK_FLOAT64
StructTypeFlag struct_flags
CompleteTypeDetail detail
MinimalEnumeratedHeader header
void generate(AST_Structure *node)
called directly by dds_visitor::visit_structure() if -Wb,java
const_iterator begin() const