2 //=============================================================================
6 * Visitor generating code for Map in the client header
10 //=============================================================================
14 // Root visitor for client header.
15 be_visitor_map_ch::be_visitor_map_ch (be_visitor_context
*ctx
)
16 : be_visitor_decl (ctx
)
20 int be_visitor_map_ch::visit_map (be_map
*node
)
22 if (node
->defined_in () == nullptr)
24 // The node is a nested map, and has had no scope defined.
25 node
->set_defined_in (DeclAsScope (this->ctx_
->scope ()->decl ()));
28 // First create a name for ourselves.
29 if (node
->create_name (this->ctx_
->tdef ()) == -1)
31 ACE_ERROR_RETURN ((LM_ERROR
,
32 ACE_TEXT ("be_visitor_map_ch::")
33 ACE_TEXT ("visit_map - ")
34 ACE_TEXT ("failed creating name\n")),
38 TAO_OutStream
*os
= this->ctx_
->stream ();
42 TAO_INSERT_COMMENT (os
);
44 os
->gen_ifdef_macro (node
->flat_name ());
48 *os
<< "using " << node
->local_name () << " = std::map<";
50 be_type
* kt
= node
->key_type();
51 be_type
* vt
= node
->value_type();
53 // Generate the base type for the buffer.
54 be_visitor_context
ctx (*this->ctx_
);
55 ctx
.state (TAO_CodeGen::TAO_MAP_BUFFER_TYPE_CH
);
56 be_visitor_map_buffer_type
bt_visitor (&ctx
);
58 if (kt
->accept (&bt_visitor
) == -1)
60 ACE_ERROR_RETURN ((LM_ERROR
,
61 ACE_TEXT ("be_visitor_map_ch::")
62 ACE_TEXT ("visit_map - ")
63 ACE_TEXT ("buffer type visit failed\n")),
69 if (vt
->accept (&bt_visitor
) == -1)
71 ACE_ERROR_RETURN ((LM_ERROR
,
72 ACE_TEXT ("be_visitor_map_ch::")
73 ACE_TEXT ("visit_map - ")
74 ACE_TEXT ("buffer type visit failed\n")),
81 node
->cli_hdr_gen (true);