| 94 | } |
| 95 | |
| 96 | bool ts_generator::generate_ts(AST_Type* node, UTL_ScopedName* name) |
| 97 | { |
| 98 | if (idl_template_.empty()) { |
| 99 | // error reported in read_template |
| 100 | return false; |
| 101 | } |
| 102 | if (!node || !name) { |
| 103 | return false; |
| 104 | } |
| 105 | |
| 106 | AST_Structure* struct_node = 0; |
| 107 | AST_Union* union_node = 0; |
| 108 | AST_Type::SIZE_TYPE size_type; |
| 109 | if (node->node_type() == AST_Decl::NT_struct) { |
| 110 | struct_node = dynamic_cast<AST_Structure*>(node); |
| 111 | size_type = struct_node->size_type(); |
| 112 | } else if (node->node_type() == AST_Decl::NT_union) { |
| 113 | union_node = dynamic_cast<AST_Union*>(node); |
| 114 | size_type = union_node->size_type(); |
| 115 | } else { |
| 116 | idl_global->err()->misc_error( |
| 117 | "Could not cast AST Nodes to valid types", node); |
| 118 | return false; |
| 119 | } |
| 120 | |
| 121 | size_t key_count = 0; |
| 122 | IDL_GlobalData::DCPS_Data_Type_Info* info = 0; |
| 123 | TopicKeys keys; |
| 124 | if (struct_node) { |
| 125 | info = idl_global->is_dcps_type(name); |
| 126 | if (be_global->is_topic_type(struct_node)) { |
| 127 | keys = TopicKeys(struct_node); |
| 128 | key_count = keys.count(); |
| 129 | } else if (info) { |
| 130 | key_count = info->key_list_.size(); |
| 131 | } else { |
| 132 | return true; |
| 133 | } |
| 134 | } else if (be_global->is_topic_type(union_node)) { |
| 135 | key_count = be_global->union_discriminator_is_key(union_node) ? 1 : 0; |
| 136 | } else { |
| 137 | return true; |
| 138 | } |
| 139 | |
| 140 | const std::string full_cxx_name = scoped(name); |
| 141 | const std::string short_cxx_name = name->last_component()->get_string(); |
| 142 | const std::string ts_base = "OpenDDS::DCPS::TypeSupportImpl_T<" + short_cxx_name + ">"; |
| 143 | const std::string full_name_from_tsch = scoped(name, EscapeContext_FromGenIdl); |
| 144 | const std::string short_name_from_tsch = to_string( |
| 145 | name->last_component(), EscapeContext_FromGenIdl); |
| 146 | const std::string full_ts_name = full_name_from_tsch + "TypeSupport"; |
| 147 | const std::string short_ts_name = short_name_from_tsch + "TypeSupport"; |
| 148 | const std::string full_tsi_name = full_ts_name + "Impl"; |
| 149 | const std::string short_tsi_name = short_ts_name + "Impl"; |
| 150 | const std::string unescaped_name = |
| 151 | dds_generator::scoped_helper(name, "::", EscapeContext_StripEscapes); |
| 152 | const std::string name_underscores = dds_generator::scoped_helper(name, "_"); |
| 153 | static const std::string ns("OpenDDS::DCPS::"); |
nothing calls this directly
no test coverage detected