20 #include <ast_argument.h> 21 #include <ast_attribute.h> 22 #include <ast_component_fwd.h> 24 #include <ast_enum_val.h> 25 #include <ast_eventtype.h> 26 #include <ast_eventtype_fwd.h> 27 #include <ast_exception.h> 28 #include <ast_factory.h> 30 #include <ast_interface.h> 31 #include <ast_module.h> 32 #include <ast_native.h> 33 #include <ast_operation.h> 34 #include <ast_predefined_type.h> 36 #include <ast_sequence.h> 37 #include <ast_structure.h> 38 #include <ast_union.h> 39 #include <ast_valuetype.h> 40 #include <ast_valuetype_fwd.h> 41 #include <utl_identifier.h> 42 #include <utl_string.h> 43 #include <utl_exceptlist.h> 45 #include <nr_extern.h> 69 : scope_(scope), error_(false), java_ts_only_(java_ts_only)
73 const bool generate_xtypes = !
be_global->suppress_xtypes() && !java_ts_only;
74 to_gen_.produce_output(generate_xtypes);
75 to_gen_.produce_xtypes_complete(generate_xtypes &&
be_global->xtypes_complete());
76 if (generate_xtypes &&
be_global->old_typeobject_encoding()) {
77 to_gen_.use_old_typeobject_encoding();
94 if (
be_global->language_mapping() != BE_GlobalData::LANGMAP_NONE) {
114 ACE_TEXT(
"(%N:%l) dds_visitor::visit_root -")
115 ACE_TEXT(
" visit_scope failed\n")), -1);
125 if (node->nmembers() > 0) {
126 UTL_ScopeActiveIterator si(node, UTL_Scope::IK_decls);
129 while (!si.is_done()) {
134 ACE_TEXT(
"(%N:%l) dds_visitor::visit_")
135 ACE_TEXT(
"scope - bad node in this scope\n")), -1);
138 if (d->node_type() == AST_Decl::NT_pre_defined) {
143 if (d->ast_accept(
this) == -1) {
145 ACE_TEXT(
"(%N:%l) dds_visitor::visit_")
146 ACE_TEXT(
"scope - failed to accept visitor\n")), -1);
160 if (node->builtin()) {
164 const char*
name = node->local_name()->get_string();
172 ACE_TEXT(
"(%N:%l) dds_visitor::visit_module -")
173 ACE_TEXT(
" visit_scope failed\n")), -1);
182 const char*
name = node->local_name()->get_string();
188 vector<AST_Interface*> inherits(node->n_inherits());
189 for (
int i = 0; i < node->n_inherits(); ++i) {
190 inherits[i] =
dynamic_cast<AST_Interface*
>(node->inherits()[i]);
193 vector<AST_Interface*> inherits_flat(node->inherits_flat(),
194 node->inherits_flat()
195 + node->n_inherits_flat());
197 vector<AST_Attribute*> attrs;
201 vector<AST_Operation*> ops;
207 inherits, inherits_flat, attrs, ops,
213 ACE_TEXT(
"(%N:%l) dds_visitor::visit_interface ")
214 ACE_TEXT(
"- visit_scope failed\n")), -1);
223 const char*
name = node->local_name()->get_string();
233 idl_global->err()->misc_error(error.
what(), error.
node());
237 IDL_GlobalData::DCPS_Data_Type_Info* info = idl_global->is_dcps_type(node->name());
239 if (
be_global->warn_about_dcps_data_type()) {
240 idl_global->err()->misc_warning(
"\n" 241 " DCPS_DATA_TYPE and DCPS_DATA_KEY pragma statements are deprecated; please use\n" 242 " topic type annotations instead.\n" 243 " See docs/migrating_to_topic_type_annotations.md in the OpenDDS source code for\n" 244 " more information.", node);
252 set<string> topic_type_keys, dcps_data_type_keys;
256 topic_type_keys.insert(i.path());
259 IDL_GlobalData::DCPS_Data_Type_Info_Iter iter(info->key_list_);
260 for (
ACE_TString* kp = 0; iter.next(kp) != 0; iter.advance()) {
264 if (topic_type_keys != dcps_data_type_keys) {
265 string message =
"\n" 266 " The keys are inconsistent on this struct declared to be a topic type using\n" 267 " both a DCPS_DATA_TYPE pragma and the annotation-based system.";
270 for (set<string>::iterator i = topic_type_keys.begin();
271 i != topic_type_keys.end(); ++i) {
272 if (dcps_data_type_keys.find(*i) == dcps_data_type_keys.end()) {
275 " The following keys were declared using @key, but not DCPS_DATA_KEY:";
278 message +=
"\n " + *i;
283 for (set<string>::iterator i = dcps_data_type_keys.begin();
284 i != dcps_data_type_keys.end(); ++i) {
285 if (topic_type_keys.find(*i) == topic_type_keys.end()) {
288 " The following keys were declared using DCPS_DATA_KEY, but not @key:";
291 message +=
"\n " + *i;
296 " DCPS_DATA_TYPE and DCPS_DATA_KEY are deprecated, so the annotation-based keys\n" 299 idl_global->err()->misc_warning(message.c_str(), node);
304 vector<AST_Field*> field_vec;
305 field_vec.reserve(node->nfields());
306 const Fields fields(node);
309 field_vec.push_back(*i);
314 node->size_type(), node->repoID());
317 if (!node->imported() &&
be_global->java()) {
327 if (node->imported()) {
331 const char*
name = node->local_name()->get_string();
343 const char*
name = node->local_name()->get_string();
360 const char*
name = node->local_name()->get_string();
366 vector<AST_EnumVal*> contents;
380 const char*
name = node->local_name()->get_string();
394 const char*
name = node->local_name()->get_string();
407 const char*
name = node->local_name()->get_string();
413 AST_Decl* d = ScopeAsDecl(node->defined_in());
415 bool nested = d && (d->node_type() == AST_Decl::NT_interface);
427 const char*
name = node->local_name()->get_string();
443 const char*
name = node->local_name()->get_string();
448 vector<AST_UnionBranch*> branches;
449 branches.reserve(node->nfields());
450 const Fields fields(node);
453 AST_UnionBranch* ub =
dynamic_cast<AST_UnionBranch*
>(*i);
455 idl_global->err()->misc_error(
"expected union to only contain UnionBranches", ub);
459 branches.push_back(ub);
574 const char*
name = node->local_name()->get_string();
virtual int visit_scope(UTL_Scope *node)
void scope2vector(std::vector< T *> &v, UTL_Scope *s, AST_Decl::NodeType nt)
virtual int visit_eventtype(AST_EventType *node)
virtual int visit_string(AST_String *node)
virtual int visit_component(AST_Component *node)
virtual int visit_connector(AST_Connector *node)
virtual int visit_interface_fwd(AST_InterfaceFwd *node)
virtual int visit_typedef(AST_Typedef *node)
virtual int visit_extended_port(AST_Extended_Port *node)
virtual int visit_param_holder(AST_Param_Holder *node)
virtual int visit_valuebox(AST_ValueBox *node)
virtual int visit_operation(AST_Operation *node)
virtual int visit_array(AST_Array *node)
bool gen_union(AST_Union *node, UTL_ScopedName *name, const std::vector< AST_UnionBranch *> &branches, AST_Type *discriminator, const char *repoid)
virtual int visit_component_fwd(AST_ComponentFwd *node)
virtual int visit_attribute(AST_Attribute *node)
#define ACE_TEXT_ALWAYS_CHAR(STRING)
bool gen_const(UTL_ScopedName *name, bool nestedInInteface, AST_Constant *constant)
virtual const char * what() const
virtual int visit_enum(AST_Enum *node)
bool gen_interf_fwd(UTL_ScopedName *name)
bool gen_native(AST_Native *node, UTL_ScopedName *name, const char *repoid)
bool gen_interf(AST_Interface *node, UTL_ScopedName *name, bool local, const std::vector< AST_Interface *> &inherits, const std::vector< AST_Interface *> &inherits_flat, const std::vector< AST_Attribute *> &attrs, const std::vector< AST_Operation *> &ops, const char *repoid)
virtual int visit_sequence(AST_Sequence *node)
virtual int visit_predefined_type(AST_PredefinedType *node)
composite_generator gen_target_
virtual int visit_factory(AST_Factory *node)
virtual int visit_field(AST_Field *node)
virtual int visit_valuetype(AST_ValueType *node)
virtual int visit_consumes(AST_Consumes *node)
virtual int visit_native(AST_Native *node)
dds_visitor(AST_Decl *scope, bool java_ts_only)
virtual int visit_type(AST_Type *node)
virtual int visit_template_module(AST_Template_Module *node)
virtual int visit_structure(AST_Structure *node)
virtual int visit_valuetype_fwd(AST_ValueTypeFwd *node)
Christopher Diggins *renamed files *fixing compilation errors *adding Visual C project file *removed make Max Lybbert *removed references to missing and unused header
virtual int visit_constant(AST_Constant *node)
virtual int visit_exception(AST_Exception *node)
virtual int visit_union(AST_Union *node)
virtual int visit_uses(AST_Uses *node)
virtual int visit_porttype(AST_PortType *node)
bool gen_typedef(AST_Typedef *node, UTL_ScopedName *name, AST_Type *base, const char *repoid)
virtual int visit_enum_val(AST_EnumVal *node)
virtual int visit_union_branch(AST_UnionBranch *node)
virtual int visit_interface(AST_Interface *node)
virtual int visit_mirror_port(AST_Mirror_Port *node)
virtual int visit_expression(AST_Expression *node)
virtual int visit_union_label(AST_UnionLabel *node)
virtual int visit_argument(AST_Argument *node)
virtual int visit_eventtype_fwd(AST_EventTypeFwd *node)
virtual int visit_template_module_ref(AST_Template_Module_Ref *node)
void add_generator(dds_generator *gen)
BE_GlobalData * be_global
virtual int visit_template_module_inst(AST_Template_Module_Inst *node)
virtual int visit_structure_fwd(AST_StructureFwd *node)
virtual int visit_publishes(AST_Publishes *node)
bool gen_struct_fwd(UTL_ScopedName *name, AST_Type::SIZE_TYPE size)
virtual int visit_emits(AST_Emits *node)
#define ACE_ERROR_RETURN(X, Y)
virtual int visit_root(AST_Root *node)
virtual int visit_finder(AST_Finder *node)
virtual int visit_module(AST_Module *node)
virtual int visit_union_fwd(AST_UnionFwd *node)
bool gen_union_fwd(AST_UnionFwd *, UTL_ScopedName *name, AST_Type::SIZE_TYPE size)
virtual int visit_provides(AST_Provides *node)
virtual int visit_decl(AST_Decl *d)
bool gen_struct(AST_Structure *node, UTL_ScopedName *name, const std::vector< AST_Field *> &fields, AST_Type::SIZE_TYPE size, const char *repoid)
void generate(AST_Structure *node)
called directly by dds_visitor::visit_structure() if -Wb,java
bool gen_enum(AST_Enum *node, UTL_ScopedName *name, const std::vector< AST_EnumVal *> &contents, const char *repoid)
virtual int visit_home(AST_Home *node)