OpenDDS  Snapshot(2023/04/07-19:43)
Public Member Functions | Protected Attributes | List of all members
dds_visitor Class Reference

#include <dds_visitor.h>

Inheritance diagram for dds_visitor:
Inheritance graph
[legend]
Collaboration diagram for dds_visitor:
Collaboration graph
[legend]

Public Member Functions

 dds_visitor (AST_Decl *scope, bool java_ts_only)
 
virtual ~dds_visitor ()
 
virtual int visit_decl (AST_Decl *d)
 
virtual int visit_scope (UTL_Scope *node)
 
virtual int visit_type (AST_Type *node)
 
virtual int visit_predefined_type (AST_PredefinedType *node)
 
virtual int visit_module (AST_Module *node)
 
virtual int visit_interface (AST_Interface *node)
 
virtual int visit_interface_fwd (AST_InterfaceFwd *node)
 
virtual int visit_valuetype (AST_ValueType *node)
 
virtual int visit_valuetype_fwd (AST_ValueTypeFwd *node)
 
virtual int visit_component (AST_Component *node)
 
virtual int visit_component_fwd (AST_ComponentFwd *node)
 
virtual int visit_eventtype (AST_EventType *node)
 
virtual int visit_eventtype_fwd (AST_EventTypeFwd *node)
 
virtual int visit_home (AST_Home *node)
 
virtual int visit_factory (AST_Factory *node)
 
virtual int visit_structure (AST_Structure *node)
 
virtual int visit_structure_fwd (AST_StructureFwd *node)
 
virtual int visit_exception (AST_Exception *node)
 
virtual int visit_expression (AST_Expression *node)
 
virtual int visit_enum (AST_Enum *node)
 
virtual int visit_operation (AST_Operation *node)
 
virtual int visit_field (AST_Field *node)
 
virtual int visit_argument (AST_Argument *node)
 
virtual int visit_attribute (AST_Attribute *node)
 
virtual int visit_union (AST_Union *node)
 
virtual int visit_union_fwd (AST_UnionFwd *node)
 
virtual int visit_union_branch (AST_UnionBranch *node)
 
virtual int visit_union_label (AST_UnionLabel *node)
 
virtual int visit_constant (AST_Constant *node)
 
virtual int visit_enum_val (AST_EnumVal *node)
 
virtual int visit_array (AST_Array *node)
 
virtual int visit_sequence (AST_Sequence *node)
 
virtual int visit_string (AST_String *node)
 
virtual int visit_typedef (AST_Typedef *node)
 
virtual int visit_root (AST_Root *node)
 
virtual int visit_native (AST_Native *node)
 
virtual int visit_valuebox (AST_ValueBox *node)
 
virtual int visit_template_module (AST_Template_Module *node)
 
virtual int visit_template_module_inst (AST_Template_Module_Inst *node)
 
virtual int visit_template_module_ref (AST_Template_Module_Ref *node)
 
virtual int visit_param_holder (AST_Param_Holder *node)
 
virtual int visit_porttype (AST_PortType *node)
 
virtual int visit_provides (AST_Provides *node)
 
virtual int visit_uses (AST_Uses *node)
 
virtual int visit_publishes (AST_Publishes *node)
 
virtual int visit_emits (AST_Emits *node)
 
virtual int visit_consumes (AST_Consumes *node)
 
virtual int visit_extended_port (AST_Extended_Port *node)
 
virtual int visit_mirror_port (AST_Mirror_Port *node)
 
virtual int visit_connector (AST_Connector *node)
 
virtual int visit_finder (AST_Finder *node)
 

Protected Attributes

AST_Decl * scope_
 
bool error_
 
bool java_ts_only_
 
composite_generator gen_target_
 

Detailed Description

Definition at line 25 of file dds_visitor.h.

Constructor & Destructor Documentation

◆ dds_visitor()

dds_visitor::dds_visitor ( AST_Decl *  scope,
bool  java_ts_only 
)

Definition at line 70 of file dds_visitor.cpp.

References composite_generator::add_generator(), be_global, and gen_target_.

71  : scope_(scope), error_(false), java_ts_only_(java_ts_only)
72 {
73  if (!be_global->no_default_gen()) {
74  gen_target_.add_generator(&to_gen_);
75  const bool generate_xtypes = !be_global->suppress_xtypes() && !java_ts_only;
76  to_gen_.produce_output(generate_xtypes);
77  to_gen_.produce_xtypes_complete(generate_xtypes && be_global->xtypes_complete());
78  if (generate_xtypes && be_global->old_typeobject_encoding()) {
79  to_gen_.use_old_typeobject_encoding();
80  }
81 
82  if (be_global->value_reader_writer()) {
83  gen_target_.add_generator(&value_reader_generator_);
84  gen_target_.add_generator(&value_writer_generator_);
85  }
86 
87  gen_target_.add_generator(&mar_gen_);
88  gen_target_.add_generator(&key_gen_);
89  gen_target_.add_generator(&ts_gen_);
90  gen_target_.add_generator(&mc_gen_);
91  }
92  if (be_global->itl()) {
93  gen_target_.add_generator(&itl_gen_);
94  }
95  if (be_global->language_mapping() != BE_GlobalData::LANGMAP_NONE) {
96  gen_target_.add_generator(&lm_gen_);
97  lm_gen_.init();
98  }
99 }
bool java_ts_only_
Definition: dds_visitor.h:136
composite_generator gen_target_
Definition: dds_visitor.h:137
void add_generator(dds_generator *gen)
BE_GlobalData * be_global
Definition: be_global.cpp:43
AST_Decl * scope_
Definition: dds_visitor.h:134

◆ ~dds_visitor()

dds_visitor::~dds_visitor ( )
virtual

Definition at line 101 of file dds_visitor.cpp.

102 {
103 }

Member Function Documentation

◆ visit_argument()

int dds_visitor::visit_argument ( AST_Argument *  node)
virtual

Definition at line 605 of file dds_visitor.cpp.

606 {
607  return 0;
608 }

◆ visit_array()

int dds_visitor::visit_array ( AST_Array *  node)
virtual

Definition at line 497 of file dds_visitor.cpp.

498 {
499  //arrays always appear as typedefs, see visit_typedef ()
500  return 0;
501 }

◆ visit_attribute()

int dds_visitor::visit_attribute ( AST_Attribute *  node)
virtual

Definition at line 490 of file dds_visitor.cpp.

491 {
492  // attributes are taken care of by visit_interface ()
493  return 0;
494 }

◆ visit_component()

int dds_visitor::visit_component ( AST_Component *  node)
virtual

Definition at line 518 of file dds_visitor.cpp.

519 {
520  return 0;
521 }

◆ visit_component_fwd()

int dds_visitor::visit_component_fwd ( AST_ComponentFwd *  node)
virtual

Definition at line 524 of file dds_visitor.cpp.

525 {
526  return 0;
527 }

◆ visit_connector()

int dds_visitor::visit_connector ( AST_Connector *  node)
virtual

Definition at line 684 of file dds_visitor.cpp.

685 {
686  return 0;
687 }

◆ visit_constant()

int dds_visitor::visit_constant ( AST_Constant *  node)
virtual

Definition at line 401 of file dds_visitor.cpp.

References error_, composite_generator::gen_const(), gen_target_, java_ts_only_, and name.

402 {
403  const char* name = node->local_name()->get_string();
404 
405  BE_Comment_Guard g("CONST", name);
406 
407  ACE_UNUSED_ARG(g);
408 
409  AST_Decl* d = ScopeAsDecl(node->defined_in());
410 
411  bool nested = d && (d->node_type() == AST_Decl::NT_interface);
412 
413  if (!java_ts_only_) {
414  error_ |= !gen_target_.gen_const(node->name(), nested, node);
415  }
416 
417  return 0;
418 }
bool gen_const(UTL_ScopedName *name, bool nestedInInteface, AST_Constant *constant)
bool java_ts_only_
Definition: dds_visitor.h:136
composite_generator gen_target_
Definition: dds_visitor.h:137
const char *const name
Definition: debug.cpp:60

◆ visit_consumes()

int dds_visitor::visit_consumes ( AST_Consumes *  node)
virtual

Definition at line 669 of file dds_visitor.cpp.

670 {
671  return 0;
672 }

◆ visit_decl()

int dds_visitor::visit_decl ( AST_Decl *  d)
virtual

Definition at line 610 of file dds_visitor.cpp.

611 {
612  return 0;
613 }

◆ visit_emits()

int dds_visitor::visit_emits ( AST_Emits *  node)
virtual

Definition at line 664 of file dds_visitor.cpp.

665 {
666  return 0;
667 }

◆ visit_enum()

int dds_visitor::visit_enum ( AST_Enum *  node)
virtual

Definition at line 354 of file dds_visitor.cpp.

References error_, composite_generator::gen_enum(), gen_target_, java_ts_only_, name, and scope2vector().

355 {
356  const char* name = node->local_name()->get_string();
357 
358  BE_Comment_Guard g("ENUM", name);
359 
360  ACE_UNUSED_ARG(g);
361 
362  vector<AST_EnumVal*> contents;
363 
364  scope2vector(contents, node, AST_Decl::NT_enum_val);
365 
366  if (!java_ts_only_) {
367  error_ |= !gen_target_.gen_enum(node, node->name(), contents, node->repoID());
368  }
369 
370  return 0;
371 }
bool java_ts_only_
Definition: dds_visitor.h:136
bool gen_enum(AST_Enum *node, UTL_ScopedName *name, const std::vector< AST_EnumVal *> &contents, const char *repoid)
void scope2vector(std::vector< T *> &v, UTL_Scope *s, AST_Decl::NodeType nt)
Definition: dds_visitor.h:141
composite_generator gen_target_
Definition: dds_visitor.h:137
const char *const name
Definition: debug.cpp:60

◆ visit_enum_val()

int dds_visitor::visit_enum_val ( AST_EnumVal *  node)
virtual

Definition at line 590 of file dds_visitor.cpp.

591 {
592  return 0;
593 }

◆ visit_eventtype()

int dds_visitor::visit_eventtype ( AST_EventType *  node)
virtual

Definition at line 530 of file dds_visitor.cpp.

531 {
532  return 0;
533 }

◆ visit_eventtype_fwd()

int dds_visitor::visit_eventtype_fwd ( AST_EventTypeFwd *  node)
virtual

Definition at line 536 of file dds_visitor.cpp.

537 {
538  return 0;
539 }

◆ visit_exception()

int dds_visitor::visit_exception ( AST_Exception *  node)
virtual

Definition at line 321 of file dds_visitor.cpp.

References name.

322 {
323  if (node->imported()) {
324  return 0;
325  }
326 
327  const char* name = node->local_name()->get_string();
328 
329  BE_Comment_Guard g("EXCEPTION", name);
330 
331  ACE_UNUSED_ARG(g);
332 
333  return 0;
334 }
const char *const name
Definition: debug.cpp:60

◆ visit_expression()

int dds_visitor::visit_expression ( AST_Expression *  node)
virtual

Definition at line 595 of file dds_visitor.cpp.

596 {
597  return 0;
598 }

◆ visit_extended_port()

int dds_visitor::visit_extended_port ( AST_Extended_Port *  node)
virtual

Definition at line 674 of file dds_visitor.cpp.

675 {
676  return 0;
677 }

◆ visit_factory()

int dds_visitor::visit_factory ( AST_Factory *  node)
virtual

Definition at line 548 of file dds_visitor.cpp.

549 {
550  return 0;
551 }

◆ visit_field()

int dds_visitor::visit_field ( AST_Field *  node)
virtual

Definition at line 483 of file dds_visitor.cpp.

484 {
485  // fields are taken care of by visit_interface() for arguments and attributes
486  return 0;
487 }

◆ visit_finder()

int dds_visitor::visit_finder ( AST_Finder *  node)
virtual

Definition at line 689 of file dds_visitor.cpp.

690 {
691  return 0;
692 }

◆ visit_home()

int dds_visitor::visit_home ( AST_Home *  node)
virtual

Definition at line 542 of file dds_visitor.cpp.

543 {
544  return 0;
545 }

◆ visit_interface()

int dds_visitor::visit_interface ( AST_Interface *  node)
virtual

Definition at line 176 of file dds_visitor.cpp.

References ACE_ERROR_RETURN, ACE_TEXT(), error_, composite_generator::gen_interf(), gen_target_, java_ts_only_, LM_ERROR, name, scope2vector(), and visit_scope().

177 {
178  const char* name = node->local_name()->get_string();
179 
180  BE_Comment_Guard g("INTERFACE", name);
181 
182  ACE_UNUSED_ARG(g);
183 
184  vector<AST_Interface*> inherits(node->n_inherits());
185  for (int i = 0; i < node->n_inherits(); ++i) {
186  inherits[i] = dynamic_cast<AST_Interface*>(node->inherits()[i]);
187  }
188 
189  vector<AST_Interface*> inherits_flat(node->inherits_flat(),
190  node->inherits_flat()
191  + node->n_inherits_flat());
192 
193  vector<AST_Attribute*> attrs;
194 
195  scope2vector(attrs, node, AST_Decl::NT_attr);
196 
197  vector<AST_Operation*> ops;
198 
199  scope2vector(ops, node, AST_Decl::NT_op);
200 
201  if (!java_ts_only_) {
202  error_ |= !gen_target_.gen_interf(node, node->name(), node->is_local(),
203  inherits, inherits_flat, attrs, ops,
204  node->repoID());
205  }
206 
207  if (this->visit_scope(node) == -1) {
208  ACE_ERROR_RETURN((LM_ERROR,
209  ACE_TEXT("(%N:%l) dds_visitor::visit_interface ")
210  ACE_TEXT("- visit_scope failed\n")), -1);
211  }
212 
213  return 0;
214 }
bool java_ts_only_
Definition: dds_visitor.h:136
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)
void scope2vector(std::vector< T *> &v, UTL_Scope *s, AST_Decl::NodeType nt)
Definition: dds_visitor.h:141
composite_generator gen_target_
Definition: dds_visitor.h:137
const char *const name
Definition: debug.cpp:60
ACE_TEXT("TCP_Factory")
#define ACE_ERROR_RETURN(X, Y)
virtual int visit_scope(UTL_Scope *node)

◆ visit_interface_fwd()

int dds_visitor::visit_interface_fwd ( AST_InterfaceFwd *  node)
virtual

Definition at line 374 of file dds_visitor.cpp.

References error_, composite_generator::gen_interf_fwd(), gen_target_, java_ts_only_, and name.

375 {
376  const char* name = node->local_name()->get_string();
377  BE_Comment_Guard g("INTERFACE-FWD", name);
378  ACE_UNUSED_ARG(g);
379 
380  if (!java_ts_only_) {
381  error_ |= !gen_target_.gen_interf_fwd(node->name());
382  }
383 
384  return 0;
385 }
bool java_ts_only_
Definition: dds_visitor.h:136
bool gen_interf_fwd(UTL_ScopedName *name)
composite_generator gen_target_
Definition: dds_visitor.h:137
const char *const name
Definition: debug.cpp:60

◆ visit_mirror_port()

int dds_visitor::visit_mirror_port ( AST_Mirror_Port *  node)
virtual

Definition at line 679 of file dds_visitor.cpp.

680 {
681  return 0;
682 }

◆ visit_module()

int dds_visitor::visit_module ( AST_Module *  node)
virtual

Definition at line 158 of file dds_visitor.cpp.

References ACE_ERROR_RETURN, ACE_TEXT(), LM_ERROR, name, and visit_scope().

159 {
160  const char* name = node->local_name()->get_string();
161 
162  BE_Comment_Guard g("MODULE", name);
163 
164  ACE_UNUSED_ARG(g);
165 
166  if (this->visit_scope(node) == -1) {
167  ACE_ERROR_RETURN((LM_ERROR,
168  ACE_TEXT("(%N:%l) dds_visitor::visit_module -")
169  ACE_TEXT(" visit_scope failed\n")), -1);
170  }
171 
172  return 0;
173 }
const char *const name
Definition: debug.cpp:60
ACE_TEXT("TCP_Factory")
#define ACE_ERROR_RETURN(X, Y)
virtual int visit_scope(UTL_Scope *node)

◆ visit_native()

int dds_visitor::visit_native ( AST_Native *  node)
virtual

Definition at line 421 of file dds_visitor.cpp.

References error_, composite_generator::gen_native(), gen_target_, java_ts_only_, and name.

422 {
423  const char* name = node->local_name()->get_string();
424 
425  BE_Comment_Guard g("NATIVE", name);
426 
427  ACE_UNUSED_ARG(g);
428 
429  if (!java_ts_only_) {
430  error_ |= !gen_target_.gen_native(node, node->name(), node->repoID());
431  }
432 
433  return 0;
434 }
bool java_ts_only_
Definition: dds_visitor.h:136
bool gen_native(AST_Native *node, UTL_ScopedName *name, const char *repoid)
composite_generator gen_target_
Definition: dds_visitor.h:137
const char *const name
Definition: debug.cpp:60

◆ visit_operation()

int dds_visitor::visit_operation ( AST_Operation *  node)
virtual

Definition at line 476 of file dds_visitor.cpp.

477 {
478  // operations are taken care of by visit_interface()
479  return 0;
480 }

◆ visit_param_holder()

int dds_visitor::visit_param_holder ( AST_Param_Holder *  node)
virtual

Definition at line 639 of file dds_visitor.cpp.

640 {
641  return 0;
642 }

◆ visit_porttype()

int dds_visitor::visit_porttype ( AST_PortType *  node)
virtual

Definition at line 644 of file dds_visitor.cpp.

645 {
646  return 0;
647 }

◆ visit_predefined_type()

int dds_visitor::visit_predefined_type ( AST_PredefinedType *  node)
virtual

Definition at line 556 of file dds_visitor.cpp.

557 {
558  return 0;
559 }

◆ visit_provides()

int dds_visitor::visit_provides ( AST_Provides *  node)
virtual

Definition at line 649 of file dds_visitor.cpp.

650 {
651  return 0;
652 }

◆ visit_publishes()

int dds_visitor::visit_publishes ( AST_Publishes *  node)
virtual

Definition at line 659 of file dds_visitor.cpp.

660 {
661  return 0;
662 }

◆ visit_root()

int dds_visitor::visit_root ( AST_Root *  node)
virtual

Definition at line 108 of file dds_visitor.cpp.

References ACE_ERROR_RETURN, ACE_TEXT(), error_, composite_generator::gen_epilogue(), composite_generator::gen_prologue(), gen_target_, LM_ERROR, and visit_scope().

109 {
110  error_ = false;
111 
113  if (this->visit_scope(node) == -1) {
114  ACE_ERROR_RETURN((LM_ERROR,
115  ACE_TEXT("(%N:%l) dds_visitor::visit_root -")
116  ACE_TEXT(" visit_scope failed\n")), -1);
117  }
119 
120  return (error_) ? -1 : 0;
121 }
composite_generator gen_target_
Definition: dds_visitor.h:137
ACE_TEXT("TCP_Factory")
#define ACE_ERROR_RETURN(X, Y)
virtual int visit_scope(UTL_Scope *node)

◆ visit_scope()

int dds_visitor::visit_scope ( UTL_Scope *  node)
virtual

Definition at line 124 of file dds_visitor.cpp.

References ACE_ERROR_RETURN, ACE_TEXT(), and LM_ERROR.

Referenced by visit_interface(), visit_module(), and visit_root().

125 {
126  if (node->nmembers() > 0) {
127  UTL_ScopeActiveIterator si(node, UTL_Scope::IK_decls);
128  AST_Decl* d = 0;
129 
130  while (!si.is_done()) {
131  d = si.item();
132 
133  if (d == 0) {
134  ACE_ERROR_RETURN((LM_ERROR,
135  ACE_TEXT("(%N:%l) dds_visitor::visit_")
136  ACE_TEXT("scope - bad node in this scope\n")), -1);
137  }
138 
139  if (d->node_type() == AST_Decl::NT_pre_defined) {
140  si.next();
141  continue;
142  }
143 
144  if (d->ast_accept(this) == -1) {
145  ACE_ERROR_RETURN((LM_ERROR,
146  ACE_TEXT("(%N:%l) dds_visitor::visit_")
147  ACE_TEXT("scope - failed to accept visitor\n")), -1);
148  }
149 
150  si.next();
151  }
152  }
153 
154  return 0;
155 }
ACE_TEXT("TCP_Factory")
#define ACE_ERROR_RETURN(X, Y)

◆ visit_sequence()

int dds_visitor::visit_sequence ( AST_Sequence *  node)
virtual

Definition at line 469 of file dds_visitor.cpp.

470 {
471  //sequences always appear as typedefs, see visit_typedef ()
472  return 0;
473 }

◆ visit_string()

int dds_visitor::visit_string ( AST_String *  node)
virtual

Definition at line 562 of file dds_visitor.cpp.

563 {
564  return 0;
565 }

◆ visit_structure()

int dds_visitor::visit_structure ( AST_Structure *  node)
virtual

Definition at line 217 of file dds_visitor.cpp.

References ACE_TEXT_ALWAYS_CHAR, be_global, TopicKeys::begin(), Fields::begin(), TopicKeys::count(), TopicKeys::end(), Fields::end(), error_, composite_generator::gen_struct(), gen_target_, java_ts_generator::generate(), header, java_ts_only_, name, TopicKeys::Error::node(), and TopicKeys::Error::what().

218 {
219  const char* name = node->local_name()->get_string();
220 
221  BE_Comment_Guard g("STRUCT", name);
222  ACE_UNUSED_ARG(g);
223 
224  // Check That Sample Keys Are Valid
225  TopicKeys topic_keys(node);
226  try {
227  topic_keys.count();
228  } catch (TopicKeys::Error& error) {
229  idl_global->err()->misc_error(error.what(), error.node());
230  return -1;
231  }
232 
233  IDL_GlobalData::DCPS_Data_Type_Info* info = idl_global->is_dcps_type(node->name());
234  if (info) {
235  if (be_global->warn_about_dcps_data_type()) {
236  idl_global->err()->misc_warning("\n"
237  " DCPS_DATA_TYPE and DCPS_DATA_KEY pragma statements are deprecated; please use\n"
238  " topic type annotations instead.\n"
239  " See docs/migrating_to_topic_type_annotations.md in the OpenDDS source code for\n"
240  " more information.", node);
241  }
242 
243  /*
244  * If the struct is declared a topic type using both the older and newer
245  * styles, warn if the keys are inconsistent.
246  */
247  if (be_global->is_topic_type(node)) {
248  set<string> topic_type_keys, dcps_data_type_keys;
249 
250  TopicKeys::Iterator finished = topic_keys.end();
251  for (TopicKeys::Iterator i = topic_keys.begin(); i != finished; ++i) {
252  topic_type_keys.insert(i.path());
253  }
254 
255  IDL_GlobalData::DCPS_Data_Type_Info_Iter iter(info->key_list_);
256  for (ACE_TString* kp = 0; iter.next(kp) != 0; iter.advance()) {
257  dcps_data_type_keys.insert(ACE_TEXT_ALWAYS_CHAR(kp->c_str()));
258  }
259 
260  if (topic_type_keys != dcps_data_type_keys) {
261  string message = "\n"
262  " The keys are inconsistent on this struct declared to be a topic type using\n"
263  " both a DCPS_DATA_TYPE pragma and the annotation-based system.";
264 
265  bool header = false;
266  for (set<string>::iterator i = topic_type_keys.begin();
267  i != topic_type_keys.end(); ++i) {
268  if (dcps_data_type_keys.find(*i) == dcps_data_type_keys.end()) {
269  if (!header) {
270  message += "\n\n"
271  " The following keys were declared using @key, but not DCPS_DATA_KEY:";
272  header = true;
273  }
274  message += "\n " + *i;
275  }
276  }
277 
278  header = false;
279  for (set<string>::iterator i = dcps_data_type_keys.begin();
280  i != dcps_data_type_keys.end(); ++i) {
281  if (topic_type_keys.find(*i) == topic_type_keys.end()) {
282  if (!header) {
283  message += "\n\n"
284  " The following keys were declared using DCPS_DATA_KEY, but not @key:";
285  header = true;
286  }
287  message += "\n " + *i;
288  }
289  }
290 
291  message += "\n\n"
292  " DCPS_DATA_TYPE and DCPS_DATA_KEY are deprecated, so the annotation-based keys\n"
293  " will be used.";
294 
295  idl_global->err()->misc_warning(message.c_str(), node);
296  }
297  }
298  }
299 
300  vector<AST_Field*> field_vec;
301  field_vec.reserve(node->nfields());
302  const Fields fields(node);
303  const Fields::Iterator fields_end = fields.end();
304  for (Fields::Iterator i = fields.begin(); i != fields_end; ++i) {
305  field_vec.push_back(*i);
306  }
307 
308  if (!java_ts_only_) {
309  error_ |= !gen_target_.gen_struct(node, node->name(), field_vec,
310  node->size_type(), node->repoID());
311  }
312 
313  if (!node->imported() && be_global->java()) {
315  }
316 
317  return 0;
318 }
virtual const char * what() const
Definition: topic_keys.cpp:61
bool java_ts_only_
Definition: dds_visitor.h:136
#define ACE_TEXT_ALWAYS_CHAR(STRING)
Christopher Diggins *renamed files *fixing compilation errors *adding Visual C project file *removed make Max Lybbert *removed references to missing and unused header
Definition: CHANGELOG.txt:8
void generate(AST_Structure *node)
called directly by dds_visitor::visit_structure() if -Wb,java
bool gen_struct(AST_Structure *node, UTL_ScopedName *name, const std::vector< AST_Field *> &fields, AST_Type::SIZE_TYPE size, const char *repoid)
composite_generator gen_target_
Definition: dds_visitor.h:137
AST_Decl * node()
Definition: topic_keys.cpp:66
const char *const name
Definition: debug.cpp:60
BE_GlobalData * be_global
Definition: be_global.cpp:43

◆ visit_structure_fwd()

int dds_visitor::visit_structure_fwd ( AST_StructureFwd *  node)
virtual

Definition at line 388 of file dds_visitor.cpp.

References error_, composite_generator::gen_struct_fwd(), gen_target_, java_ts_only_, and name.

389 {
390  const char* name = node->local_name()->get_string();
391  BE_Comment_Guard g("STRUCT-FWD", name);
392 
393  if (!java_ts_only_) {
394  error_ |= !gen_target_.gen_struct_fwd(node->name(), node->size_type());
395  }
396 
397  return 0;
398 }
bool java_ts_only_
Definition: dds_visitor.h:136
composite_generator gen_target_
Definition: dds_visitor.h:137
const char *const name
Definition: debug.cpp:60
bool gen_struct_fwd(UTL_ScopedName *name, AST_Type::SIZE_TYPE size)

◆ visit_template_module()

int dds_visitor::visit_template_module ( AST_Template_Module *  node)
virtual

Definition at line 621 of file dds_visitor.cpp.

622 {
623  return 0;
624 }

◆ visit_template_module_inst()

int dds_visitor::visit_template_module_inst ( AST_Template_Module_Inst *  node)
virtual

Definition at line 627 of file dds_visitor.cpp.

628 {
629  return 0;
630 }

◆ visit_template_module_ref()

int dds_visitor::visit_template_module_ref ( AST_Template_Module_Ref *  node)
virtual

Definition at line 633 of file dds_visitor.cpp.

634 {
635  return 0;
636 }

◆ visit_type()

int dds_visitor::visit_type ( AST_Type *  node)
virtual

Definition at line 600 of file dds_visitor.cpp.

601 {
602  return 0;
603 }

◆ visit_typedef()

int dds_visitor::visit_typedef ( AST_Typedef *  node)
virtual

Definition at line 337 of file dds_visitor.cpp.

References error_, gen_target_, composite_generator::gen_typedef(), java_ts_only_, and name.

338 {
339  const char* name = node->local_name()->get_string();
340 
341  BE_Comment_Guard g("TYPEDEF", name);
342 
343  ACE_UNUSED_ARG(g);
344 
345  if (!java_ts_only_) {
346  error_ |= !gen_target_.gen_typedef(node, node->name(), node->base_type(),
347  node->repoID());
348  }
349 
350  return 0;
351 }
bool java_ts_only_
Definition: dds_visitor.h:136
bool gen_typedef(AST_Typedef *node, UTL_ScopedName *name, AST_Type *base, const char *repoid)
composite_generator gen_target_
Definition: dds_visitor.h:137
const char *const name
Definition: debug.cpp:60

◆ visit_union()

int dds_visitor::visit_union ( AST_Union *  node)
virtual

Definition at line 437 of file dds_visitor.cpp.

References Fields::begin(), Fields::end(), error_, gen_target_, composite_generator::gen_union(), java_ts_only_, and name.

438 {
439  const char* name = node->local_name()->get_string();
440 
441  BE_Comment_Guard g("UNION", name);
442  ACE_UNUSED_ARG(g);
443 
444  vector<AST_UnionBranch*> branches;
445  branches.reserve(node->nfields());
446  const Fields fields(node);
447  const Fields::Iterator fields_end = fields.end();
448  for (Fields::Iterator i = fields.begin(); i != fields_end; ++i) {
449  AST_UnionBranch* ub = dynamic_cast<AST_UnionBranch*>(*i);
450  if (!ub) {
451  idl_global->err()->misc_error("expected union to only contain UnionBranches", ub);
452  error_ = true;
453  return -1;
454  }
455  branches.push_back(ub);
456  }
457 
458  if (!java_ts_only_) {
459  error_ |= !gen_target_.gen_union(node, node->name(), branches, node->disc_type(),
460  node->repoID());
461  }
462 
463  return 0;
464 }
bool java_ts_only_
Definition: dds_visitor.h:136
bool gen_union(AST_Union *node, UTL_ScopedName *name, const std::vector< AST_UnionBranch *> &branches, AST_Type *discriminator, const char *repoid)
composite_generator gen_target_
Definition: dds_visitor.h:137
const char *const name
Definition: debug.cpp:60

◆ visit_union_branch()

int dds_visitor::visit_union_branch ( AST_UnionBranch *  node)
virtual

Definition at line 580 of file dds_visitor.cpp.

581 {
582  return 0;
583 }

◆ visit_union_fwd()

int dds_visitor::visit_union_fwd ( AST_UnionFwd *  node)
virtual

Definition at line 568 of file dds_visitor.cpp.

References error_, gen_target_, composite_generator::gen_union_fwd(), java_ts_only_, and name.

569 {
570  const char* name = node->local_name()->get_string();
571  BE_Comment_Guard g("UNION-FWD", name);
572 
573  if (!java_ts_only_) {
574  error_ |= !gen_target_.gen_union_fwd(node, node->name(), node->size_type());
575  }
576 
577  return 0;
578 }
bool java_ts_only_
Definition: dds_visitor.h:136
composite_generator gen_target_
Definition: dds_visitor.h:137
bool gen_union_fwd(AST_UnionFwd *, UTL_ScopedName *name, AST_Type::SIZE_TYPE size)
const char *const name
Definition: debug.cpp:60

◆ visit_union_label()

int dds_visitor::visit_union_label ( AST_UnionLabel *  node)
virtual

Definition at line 585 of file dds_visitor.cpp.

586 {
587  return 0;
588 }

◆ visit_uses()

int dds_visitor::visit_uses ( AST_Uses *  node)
virtual

Definition at line 654 of file dds_visitor.cpp.

655 {
656  return 0;
657 }

◆ visit_valuebox()

int dds_visitor::visit_valuebox ( AST_ValueBox *  node)
virtual

Definition at line 615 of file dds_visitor.cpp.

616 {
617  return 0;
618 }

◆ visit_valuetype()

int dds_visitor::visit_valuetype ( AST_ValueType *  node)
virtual

Definition at line 506 of file dds_visitor.cpp.

507 {
508  return 0;
509 }

◆ visit_valuetype_fwd()

int dds_visitor::visit_valuetype_fwd ( AST_ValueTypeFwd *  node)
virtual

Definition at line 512 of file dds_visitor.cpp.

513 {
514  return 0;
515 }

Member Data Documentation

◆ error_

bool dds_visitor::error_
protected

◆ gen_target_

composite_generator dds_visitor::gen_target_
protected

◆ java_ts_only_

bool dds_visitor::java_ts_only_
protected

◆ scope_

AST_Decl* dds_visitor::scope_
protected

Definition at line 134 of file dds_visitor.h.


The documentation for this class was generated from the following files: