Merge pull request #2216 from jwillemsen/jwi-cxxversionchecks
[ACE_TAO.git] / TAO / TAO_IDL / be / be_visitor_structure / structure_cs.cpp
blobf7652d69f8e83df9436f3e92f331474e6ef1f11c
2 //=============================================================================
3 /**
4 * @file structure_cs.cpp
6 * Visitor generating code for Structures in the client stubs file.
8 * @author Aniruddha Gokhale
9 */
10 //=============================================================================
12 #include "structure.h"
14 // ***************************************************************************
15 // For client stubs.
16 // ***************************************************************************
18 be_visitor_structure_cs::be_visitor_structure_cs (be_visitor_context *ctx)
19 : be_visitor_structure (ctx)
23 be_visitor_structure_cs::~be_visitor_structure_cs ()
27 int
28 be_visitor_structure_cs::visit_structure (be_structure *node)
30 if (node->cli_stub_gen () || node->imported ())
32 return 0;
35 if (be_global->tc_support ())
37 be_visitor_context ctx (*this->ctx_);
38 TAO::be_visitor_struct_typecode visitor (&ctx);
40 if (visitor.visit_structure (node) == -1)
42 ACE_ERROR_RETURN ((LM_ERROR,
43 "(%N:%l) be_visitor_structure_cs::"
44 "visit_structure - "
45 "TypeCode definition failed\n"),
46 -1);
50 if (be_global->any_support ())
52 TAO_OutStream *os = this->ctx_->stream ();
54 *os << be_nl_2;
55 TAO_INSERT_COMMENT (os);
57 *os << "void" << be_nl
58 << node->name ()
59 << "::_tao_any_destructor (" << be_idt << be_idt_nl
60 << "void *_tao_void_pointer)" << be_uidt
61 << be_uidt_nl
62 << "{" << be_idt_nl
63 << node->local_name () << " *_tao_tmp_pointer =" << be_idt_nl
64 << "static_cast<" << node->local_name ()
65 << " *> (_tao_void_pointer);" << be_uidt_nl
66 << "delete _tao_tmp_pointer;" << be_uidt_nl
67 << "}";
70 // Do any code generation required for the scope members
71 // all we have to do is to visit the scope.
72 if (this->visit_scope (node) == -1)
74 ACE_ERROR_RETURN ((LM_ERROR,
75 "(%N:%l) be_visitor_structure_cs::"
76 "visit_structure - "
77 "codegen for scope failed\n"),
78 -1);
81 node->cli_stub_gen (true);
82 return 0;