Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / TAO_IDL / be / be_visitor_valuebox / valuebox_ci.cpp
blob067758873e7b67df21d6991614b183c64601ac41
2 //=============================================================================
3 /**
4 * @file valuebox_ci.cpp
6 * Visitor generating code for valueboxes in the client inline file
8 * @author Gary Maxey
9 */
10 //=============================================================================
12 #include "valuebox.h"
14 be_visitor_valuebox_ci::be_visitor_valuebox_ci (be_visitor_context *ctx)
15 : be_visitor_valuebox (ctx)
19 be_visitor_valuebox_ci::~be_visitor_valuebox_ci (void)
23 int
24 be_visitor_valuebox_ci::visit_valuebox (be_valuebox *node)
26 // Nothing to do if we are imported or code is already generated.
27 if (node->imported () || node->cli_inline_gen ())
29 return 0;
32 TAO_OutStream *os = this->ctx_->stream ();
34 this->ctx_->node (node); // save the node
36 be_type *bt = dynamic_cast<be_type*> (node->boxed_type ());
38 // Emit the type specific elements. The visit_* methods in this
39 // module do that work.
40 if (!bt || (bt->accept (this) == -1))
42 ACE_ERROR_RETURN ((LM_ERROR,
43 " (%N:%l) be_visitor_valuebox_ci::visit_valuebox - "
44 "type-specific valuebox code generation failed\n"),
45 -1);
48 TAO_INSERT_COMMENT (os);
50 *os << "ACE_INLINE const char*" << be_nl
51 << node->name () << "::_tao_obv_static_repository_id ()" << be_nl
52 << "{" << be_idt_nl
53 << "return \"" << node->repoID () << "\";" << be_uidt_nl
54 << "}" << be_nl_2;
56 // Indicate that code is already generated for this node.
57 node->cli_inline_gen (true);
59 return 0;
62 int
63 be_visitor_valuebox_ci::visit_array (be_array *node)
65 TAO_OutStream *os = this->ctx_->stream ();
67 // Retrieve the node being visited by this be_visitor_valuebox_ch.
68 be_decl * vb_node = this->ctx_->node ();
70 TAO_INSERT_COMMENT (os);
72 // Public default constructor
73 *os << "ACE_INLINE" << be_nl
74 << vb_node->name () << "::" << vb_node->local_name () << " (void)"
75 << be_nl << "{" << be_idt_nl
76 << "this->_pd_value = " << node->full_name () << "_alloc ();"
77 << be_uidt_nl << "}" << be_nl_2;
79 // Public constructor that takes a const array argument
80 *os << "ACE_INLINE" << be_nl
81 << vb_node->name () << "::" << vb_node->local_name () << " (const "
82 << node->full_name () << " val)" << be_nl
83 << "{" << be_idt_nl
84 << "this->_pd_value = " << node->full_name () << "_dup (val);"
85 << be_uidt_nl
86 << "}" << be_nl_2;
88 // Public copy constructor
89 *os << "ACE_INLINE" << be_nl
90 << vb_node->name () << "::" << vb_node->local_name () << " (const "
91 << vb_node->local_name () << "& val)" << be_idt_nl
92 << ": ::CORBA::ValueBase (val)," << be_nl
93 << " ::CORBA::DefaultValueRefCountBase (val)"
94 << be_uidt_nl
95 << "{" << be_idt_nl
96 << "this->_pd_value = " << node->full_name ()
97 << "_dup (val._pd_value.in ());" << be_uidt_nl
98 << "}" << be_nl_2;
100 // Public assignment operator that takes a const array argument
101 *os << "ACE_INLINE " << vb_node->name () << " &" << be_nl
102 << vb_node->name () << "::operator= (const "
103 << node->full_name () << " val)" << be_nl
104 << "{" << be_idt_nl
105 << "this->_pd_value = " << node->full_name ()
106 << "_dup (val);" << be_nl
107 << "return *this;" << be_uidt_nl
108 << "}" << be_nl_2;
110 // Public accessor and modifier methods
111 *os << "ACE_INLINE const " << node->full_name () << "_slice*" << be_nl
112 << vb_node->name () << "::_value (void) const" << be_nl
113 << "{" << be_idt_nl
114 << "return this->_pd_value.in ();" << be_uidt_nl
115 << "}" << be_nl_2;
117 *os << "ACE_INLINE " << node->full_name () << "_slice*" << be_nl
118 << vb_node->name () << "::_value (void)" << be_nl
119 << "{" << be_idt_nl
120 << "return this->_pd_value.inout ();" << be_uidt_nl
121 << "}" << be_nl_2;
123 *os << "ACE_INLINE void" << be_nl
124 << vb_node->name () << "::_value (const " << node->full_name ()
125 << " val)" << be_nl
126 << "{" << be_idt_nl
127 << "this->_pd_value = " << node->full_name () << "_dup (val);"
128 << be_uidt_nl
129 << "}" << be_nl_2;
131 // Overloaded subscript operators
132 *os << "ACE_INLINE const " << node->full_name () << "_slice &" << be_nl
133 << vb_node->name () << "::operator[] ( ::CORBA::ULong index) const"
134 << be_nl
135 << "{" << be_idt_nl
136 << "return this->_pd_value[index];" << be_uidt_nl
137 << "}" << be_nl_2;
139 *os << "ACE_INLINE "<< node->full_name () << "_slice &" << be_nl
140 << vb_node->name () << "::operator[] ( ::CORBA::ULong index)" << be_nl
141 << "{" << be_idt_nl
142 << "return this->_pd_value[index];" << be_uidt_nl
143 << "}" << be_nl_2;
145 // Explicit conversion functions
146 *os << "ACE_INLINE const " << node->full_name () << "_slice *" << be_nl
147 << vb_node->name () << "::_boxed_in (void) const" << be_nl
148 << "{" << be_idt_nl
149 << "return this->_pd_value.in ();" << be_uidt_nl
150 << "}" << be_nl_2;
152 *os << "ACE_INLINE " << node->full_name () << "_slice *" << be_nl
153 << vb_node->name () << "::_boxed_inout (void)" << be_nl
154 << "{" << be_idt_nl
155 << "return this->_pd_value.inout ();" << be_uidt_nl
156 << "}" << be_nl_2;
158 *os << "ACE_INLINE " << node->full_name () << "_slice *" << be_nl
159 << vb_node->name () << "::_boxed_out (void)" << be_nl
160 << "{" << be_idt_nl
161 << "return this->_pd_value.out ();" << be_uidt_nl
162 << "}" << be_nl_2;
164 return 0;
168 be_visitor_valuebox_ci::visit_enum (be_enum *node)
170 return this->emit_for_predef_enum (node, "", false);
174 be_visitor_valuebox_ci::visit_interface (be_interface *node)
176 return this->emit_for_predef_enum (node, "_ptr", false);
180 be_visitor_valuebox_ci::visit_predefined_type (be_predefined_type *node)
182 bool is_any = false;
184 switch (node->pt())
186 case AST_PredefinedType::PT_boolean:
187 break;
189 case AST_PredefinedType::PT_char:
190 break;
192 case AST_PredefinedType::PT_wchar:
193 break;
195 case AST_PredefinedType::PT_octet:
196 break;
198 case AST_PredefinedType::PT_any:
199 is_any = true;
200 break;
202 default:
203 break;
206 return this->emit_for_predef_enum (node, "", is_any);
210 be_visitor_valuebox_ci::visit_sequence (be_sequence *node)
212 TAO_OutStream *os = this->ctx_->stream ();
214 // Retrieve the node being visited by this be_visitor_valuebox_ch.
215 be_decl * vb_node = this->ctx_->node ();
217 TAO_INSERT_COMMENT (os);
219 this->emit_default_constructor_alloc (node);
220 this->emit_constructor_one_arg_alloc (node);
221 this->emit_copy_constructor_alloc (node);
222 this->emit_assignment_alloc (node);
223 this->emit_accessor_modifier (node);
224 this->emit_boxed_access(node, "*");
226 // Generate maximum() accessor
227 *os << "ACE_INLINE ::CORBA::ULong" << be_nl
228 << vb_node->name () << "::maximum (void) const" << be_nl
229 << "{" << be_idt_nl
230 << "return this->_pd_value->maximum ();" << be_uidt_nl
231 << "}" << be_nl_2;
233 // Generate length() accessor
234 *os << "ACE_INLINE ::CORBA::ULong" << be_nl
235 << vb_node->name () << "::length (void) const" << be_nl
236 << "{" << be_idt_nl
237 << "return this->_pd_value->length ();" << be_uidt_nl
238 << "}" << be_nl_2;
240 // Generate length() setter
241 *os << "ACE_INLINE void" << be_nl
242 << vb_node->name () << "::length ( ::CORBA::ULong length)" << be_nl
243 << "{" << be_idt_nl
244 << "this->_pd_value->length (length);" << be_uidt_nl
245 << "}" << be_nl_2;
247 return 0;
251 be_visitor_valuebox_ci::visit_string (be_string *node)
253 TAO_OutStream *os = this->ctx_->stream ();
255 const char *string_type;
256 const char *char_type;
257 if (node->node_type () == AST_Decl::NT_string)
259 string_type = "String";
260 char_type = "::CORBA::Char";
262 else if (node->node_type () == AST_Decl::NT_wstring)
264 string_type = "WString";
265 char_type = "::CORBA::WChar";
267 else
269 ACE_ERROR ((LM_ERROR,
270 "(%N:%l) be_visitor_valuebox_ci::visit_string -"
271 "unexpected string node type=%d\n", node->node_type ()));
272 return -1;
275 // Retrieve the node being visited by this be_visitor_valuebox_ch.
276 be_decl * vb_node = this->ctx_->node ();
278 TAO_INSERT_COMMENT (os);
280 this->emit_default_constructor ();
281 this->emit_constructor_one_arg (node, "");
282 this->emit_copy_constructor ();
283 this->emit_assignment (node, "");
285 // Public constructor with one const argument of underlying type
286 *os << "ACE_INLINE" << be_nl
287 << vb_node->name () << "::" << vb_node->local_name () << " (const "
288 << node->full_name () << " val)" << be_nl
289 << "{" << be_idt_nl
290 << "this->_pd_value = val;" << be_uidt_nl
291 << "}" << be_nl_2;
294 // Public constructor with one argument of type const CORBA::String_var&
295 *os << "ACE_INLINE" << be_nl
296 << vb_node->name () << "::" << vb_node->local_name ()
297 << " (const ::CORBA::" << string_type << "_var& var)" << be_nl
298 << "{" << be_idt_nl
299 << "this->_pd_value = var;" << be_uidt_nl
300 << "}" << be_nl_2;
302 // Public assignment operator with one argument of type const char *
303 *os << "ACE_INLINE " << vb_node->name () << " &" << be_nl
304 << vb_node->name () << "::operator= (const "
305 << node->full_name () << " val)" << be_nl
306 << "{" << be_idt_nl
307 << "this->_pd_value = val;" << be_nl
308 << "return *this;" << be_uidt_nl
309 << "}" << be_nl_2;
311 // Public assignment operator with one argument of type
312 // const CORBA::String_var&
313 *os << "ACE_INLINE " << vb_node->name () << " &" << be_nl
314 << vb_node->name () << "::operator= (const ::CORBA::"
315 << string_type << "_var& var)"
316 << be_nl
317 << "{" << be_idt_nl
318 << "this->_pd_value = var;" << be_nl
319 << "return *this;" << be_uidt_nl
320 << "}" << be_nl_2;
322 // Accessor function takes no arguments and returns a const char *
323 *os << "ACE_INLINE const " << node->full_name () << be_nl
324 << vb_node->name () << "::_value (void) const" << be_nl
325 << "{" << be_idt_nl
326 << "return this->_pd_value.in ();" << be_uidt_nl
327 << "}" << be_nl_2;
329 // Modifier function with one argument of type char *
330 *os << "ACE_INLINE void" << be_nl
331 << vb_node->name () << "::_value ("
332 << node->full_name () << " val)" << be_nl
333 << "{" << be_idt_nl
334 << "this->_pd_value = val;" << be_uidt_nl
335 << "}" << be_nl_2;
337 // Modifier function with one argument of type const char *
338 *os << "ACE_INLINE void" << be_nl
339 << vb_node->name () << "::_value (const "
340 << node->full_name () << " val)" << be_nl
341 << "{" << be_idt_nl
342 << "this->_pd_value = val;" << be_uidt_nl
343 << "}" << be_nl_2;
345 // Modifier function with one argument of type const CORBA::String_var&
346 *os << "ACE_INLINE void" << be_nl
347 << vb_node->name () << "::_value (const ::CORBA::" << string_type
348 << "_var& var)" << be_nl
349 << "{" << be_idt_nl
350 << "this->_pd_value = var;" << be_uidt_nl
351 << "}" << be_nl_2;
353 // Access to the boxed value for method signatures
354 *os << "ACE_INLINE const " << node->full_name () << be_nl
355 << vb_node->name () << "::_boxed_in (void) const" << be_nl
356 << "{" << be_idt_nl
357 << "return this->_pd_value.in ();" << be_uidt_nl
358 << "}" << be_nl_2;
360 *os << "ACE_INLINE " << node->full_name () << "&" << be_nl
361 << vb_node->name () << "::_boxed_inout (void)" << be_nl
362 << "{" << be_idt_nl
363 << "return this->_pd_value.inout ();" << be_uidt_nl
364 << "}" << be_nl_2;
366 *os << "ACE_INLINE " << node->full_name () << "&" << be_nl
367 << vb_node->name () << "::_boxed_out (void)" << be_nl
368 << "{" << be_idt_nl
369 << "return this->_pd_value.out ();" << be_uidt_nl
370 << "}" << be_nl_2;
372 // Overloaded subscript operators
373 *os << "ACE_INLINE " << char_type << " &" << be_nl
374 << vb_node->name () << "::operator[] ( ::CORBA::ULong slot)" << be_nl
375 << "{" << be_idt_nl
376 << "return this->_pd_value[slot];" << be_uidt_nl
377 << "}" << be_nl_2;
379 *os << "ACE_INLINE " << char_type << be_nl
380 << vb_node->name () << "::operator[] ( ::CORBA::ULong slot) const" << be_nl
381 << "{" << be_idt_nl
382 << "return this->_pd_value[slot];" << be_uidt_nl
383 << "}" << be_nl_2;
385 return 0;
389 be_visitor_valuebox_ci::visit_structure (be_structure *node)
391 TAO_OutStream *os = this->ctx_->stream ();
393 TAO_INSERT_COMMENT (os);
395 this->emit_default_constructor_alloc (node);
396 this->emit_constructor_one_arg_alloc (node);
397 this->emit_copy_constructor_alloc (node);
398 this->emit_assignment_alloc (node);
399 this->emit_accessor_modifier (node);
401 // Access to the boxed value for method signatures
402 if (node->size_type() == AST_Type::FIXED)
404 this->emit_boxed_access (node, "");
406 else
408 this->emit_boxed_access (node, "*");
411 // Now generate the accessor and modifier functions for each struct
412 // member. These functions have the same signatures as
413 // acessor and modifier functions for union members.
414 AST_Decl *d;
415 be_field *field;
416 be_visitor_context ctx (*this->ctx_);
418 for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
419 !si.is_done ();
420 si.next ())
422 d = si.item ();
424 if (d == 0 || (field = dynamic_cast<be_field*> (d)) == 0)
426 ACE_ERROR ((LM_ERROR,
427 "(%N:%l) be_visitor_valuebox_cs::visit_structure -"
428 "bad node in this scope\n"));
429 break;
432 // Create a visitor and use that to process the field type.
433 be_visitor_valuebox_field_ci visitor (&ctx);
435 if (visitor.visit_field (field) == -1)
437 ACE_ERROR_RETURN ((LM_ERROR,
438 "(%N:%l) be_visitor_valuebox_cs::visit_structure - "
439 "visit_field failed\n"
440 ), -1);
443 // Restore the valuebox node in the field visitor's context.
444 ctx.node (this->ctx_->node ());
447 return 0;
451 be_visitor_valuebox_ci::visit_typedef (be_typedef *node)
453 // Make a decision based on the primitive base type.
454 be_type *bt = node->primitive_base_type ();
456 if (!bt || (bt->accept (this) == -1))
458 ACE_ERROR_RETURN ((LM_ERROR,
459 "(%N:%l) be_visitor_valuebox_ci::"
460 "visit_typedef - "
461 "Bad primitive type\n"),
462 -1);
465 return 0;
469 be_visitor_valuebox_ci::visit_union (be_union *node)
471 TAO_OutStream *os = this->ctx_->stream ();
473 TAO_INSERT_COMMENT (os);
475 this->emit_default_constructor_alloc (node);
476 this->emit_constructor_one_arg_alloc (node);
477 this->emit_copy_constructor_alloc (node);
478 this->emit_assignment_alloc (node);
479 this->emit_accessor_modifier (node);
481 be_valuebox *vb_node =
482 dynamic_cast<be_valuebox*> (this->ctx_->node ());
484 if (node->size_type() == AST_Type::FIXED)
486 this->emit_boxed_access (node, "");
488 else
490 this->emit_boxed_access (node, "*");
493 // Now generate the accessor and modifier functions for each union
494 // member.
495 AST_Decl *d;
496 be_union_branch *member;
497 be_visitor_context ctx (*this->ctx_);
499 for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
500 !si.is_done ();
501 si.next ())
503 d = si.item ();
505 if (d == 0 || (member = dynamic_cast<be_union_branch*> (d)) == 0)
507 ACE_ERROR ((LM_ERROR,
508 "(%N:%l) be_visitor_valuebox_ci::visit_union -"
509 "bad node in this scope\n"));
510 break;
513 // Create a visitor and use that to process the union member type.
514 be_visitor_valuebox_union_member_ci visitor (&ctx);
516 if (visitor.visit_union_member (member) == -1)
518 ACE_ERROR_RETURN ((LM_ERROR,
519 "(%N:%l) be_visitor_valuebox_cs::visit_structure - "
520 "visit_field failed\n"
521 ), -1);
524 // Restore the valuebox node to the union member visitor's
525 // context.
526 ctx.node (vb_node);
530 // Retrieve the disriminant type.
531 be_type *bt = 0;
532 bt = dynamic_cast<be_type*> (node->disc_type ());
534 if (!bt)
536 ACE_ERROR_RETURN ((LM_ERROR,
537 "(%N:%l) be_visitor_valuebox_ci::visit_union - "
538 "bad disciminant type\n"),
539 -1);
543 // Generate modifier and accessor for discriminant
544 *os << "ACE_INLINE void" << be_nl
545 << vb_node->name () << "::_d (" << bt->nested_type_name (node) << " val)"
546 << be_nl
547 << "{" << be_idt_nl
548 << "this->_pd_value->_d (val);" << be_uidt_nl
549 << "}" << be_nl_2;
551 *os << "ACE_INLINE " << bt->nested_type_name (node) << be_nl
552 << vb_node->name () << "::_d (void) const" << be_nl
553 << "{" << be_idt_nl
554 << "return this->_pd_value->_d ();" << be_uidt_nl
555 << "}" << be_nl_2;
557 return 0;
563 be_visitor_valuebox_ci::emit_for_predef_enum (be_type *node,
564 const char * type_suffix,
565 bool is_any)
567 TAO_OutStream *os = this->ctx_->stream ();
569 // Retrieve the node being visited by this be_visitor_valuebox_ci.
570 be_decl * vb_node = this->ctx_->node ();
572 TAO_INSERT_COMMENT (os);
574 if (is_any)
576 this->emit_default_constructor_alloc (node);
577 this->emit_copy_constructor_alloc (node);
578 this->emit_constructor_one_arg_alloc (node);
579 this->emit_assignment_alloc (node);
580 this->emit_accessor_modifier (node);
581 this->emit_boxed_access (node, "*");
583 else
585 this->emit_default_constructor ();
586 this->emit_copy_constructor ();
587 this->emit_constructor_one_arg (node, type_suffix);
588 this->emit_assignment (node, type_suffix);
590 // Public accessor method
591 *os << "ACE_INLINE " << node->full_name () << type_suffix << be_nl
592 << vb_node->name () << "::_value (void) const" << be_nl
593 << "{" << be_idt_nl
594 << "return this->_pd_value;" << be_uidt_nl
595 << "}" << be_nl_2;
597 // Public modifier method
598 *os << "ACE_INLINE void" << be_nl
599 << vb_node->name () << "::_value ("
600 << node->full_name ()
601 << type_suffix << " val)" << be_nl
602 << "{" << be_idt_nl
603 << "this->_pd_value = val;" << be_uidt_nl
604 << "}" << be_nl_2;
606 // Explicit conversion functions
607 *os << "ACE_INLINE " << node->full_name () << type_suffix << be_nl
608 << vb_node->name () << "::_boxed_in (void) const" << be_nl
609 << "{" << be_idt_nl
610 << "return this->_pd_value;" << be_uidt_nl
611 << "}" << be_nl_2;
613 *os << "ACE_INLINE " << node->full_name () << type_suffix << "&" << be_nl
614 << vb_node->name () << "::_boxed_inout (void)" << be_nl
615 << "{" << be_idt_nl
616 << "return this->_pd_value;" << be_uidt_nl
617 << "}" << be_nl_2;
619 *os << "ACE_INLINE " << node->full_name () << type_suffix << "&" << be_nl
620 << vb_node->name () << "::_boxed_out (void)" << be_nl
621 << "{" << be_idt_nl
622 << "return this->_pd_value;" << be_uidt_nl
623 << "}" << be_nl_2;
627 return 0;
630 void
631 be_visitor_valuebox_ci::emit_default_constructor (void)
633 TAO_OutStream *os = this->ctx_->stream ();
635 // Retrieve the node being visited by this be_visitor_valuebox_ci.
636 be_decl * vb_node = this->ctx_->node ();
638 // Public default constructor
639 *os << "ACE_INLINE" << be_nl;
640 *os << vb_node->name () << "::" << vb_node->local_name ()
641 << " (void)" << be_nl;
642 *os << "{}" << be_nl_2;
645 void
646 be_visitor_valuebox_ci::emit_default_constructor_alloc (be_decl *node)
648 TAO_OutStream *os = this->ctx_->stream ();
650 // Retrieve the node being visited by this be_visitor_valuebox_ci
651 be_decl * vb_node = this->ctx_->node ();
652 bool node_not_pod =
653 dynamic_cast<be_type*> (node)->size_type () == AST_Type::VARIABLE;
655 // Public default constructor
656 *os << "ACE_INLINE" << be_nl
657 << vb_node->name () << "::" << vb_node->local_name () << " (void)"
658 << be_nl << "{" << be_idt_nl
659 << node->full_name () << "* p = 0;" << be_nl
660 << "ACE_NEW (" << be_idt_nl
661 << "p," << be_nl
662 << node->full_name ()
663 << (node_not_pod ? " ()" : "") << ");" << be_uidt_nl
664 << "this->_pd_value = p;" << be_uidt_nl
665 << "}" << be_nl_2;
668 void
669 be_visitor_valuebox_ci::emit_constructor_one_arg (be_decl *node,
670 const char * type_suffix)
672 TAO_OutStream *os = this->ctx_->stream ();
674 // Retrieve the node being visited by this be_visitor_valuebox_ci.
675 be_decl * vb_node = this->ctx_->node ();
677 // Public constructor with one argument of underlying type
678 *os << "ACE_INLINE" << be_nl
679 << vb_node->name () << "::" << vb_node->local_name () << " ("
680 << node->full_name () << type_suffix << " val)" << be_nl
681 << "{" << be_idt_nl
682 << "this->_pd_value = val;" << be_uidt_nl
683 << "}" << be_nl_2;
686 void
687 be_visitor_valuebox_ci::emit_constructor_one_arg_alloc (be_decl *node)
689 TAO_OutStream *os = this->ctx_->stream ();
691 // Retrieve the node being visited by this be_visitor_valuebox_ci.
692 be_decl * vb_node = this->ctx_->node ();
694 // Public constructor with single argument of type const T&
695 *os << "ACE_INLINE" << be_nl
696 << vb_node->name () << "::" << vb_node->local_name ()
697 << " (const " << node->full_name () << "& value)" << be_nl
698 << "{" << be_idt_nl
699 << node->full_name () << "* p = 0;" << be_nl
700 << "ACE_NEW (" << be_idt_nl
701 << "p," << be_nl
702 << node->full_name () << " (value));" << be_uidt_nl
703 << "this->_pd_value = p;" << be_uidt_nl
704 << "}" << be_nl_2;
707 void
708 be_visitor_valuebox_ci::emit_copy_constructor (void)
710 TAO_OutStream *os = this->ctx_->stream ();
712 // Retrieve the node being visited by this be_visitor_valuebox_ci.
713 be_decl * vb_node = this->ctx_->node ();
715 // Public Copy constructor
716 *os << "ACE_INLINE" << be_nl
717 << vb_node->name () << "::" << vb_node->local_name ()
718 << " (const " << vb_node->full_name () << "& val)" << be_idt_nl
719 << ": ::CORBA::ValueBase (val)," << be_nl
720 << " ::CORBA::DefaultValueRefCountBase (val)"
721 << be_uidt_nl
722 << "{" << be_idt_nl
723 << "this->_pd_value = val._pd_value;" << be_uidt_nl
724 << "}" << be_nl_2;
727 void
728 be_visitor_valuebox_ci::emit_copy_constructor_alloc (be_decl *node)
730 TAO_OutStream *os = this->ctx_->stream ();
732 // Retrieve the node being visited by this be_visitor_valuebox_ci.
733 be_decl * vb_node = this->ctx_->node ();
735 // Public copy constructor
736 *os << "ACE_INLINE" << be_nl
737 << vb_node->name () << "::" << vb_node->local_name () << " (const "
738 << vb_node->full_name () << "& val)" << be_idt_nl
739 << ": ::CORBA::ValueBase (val)," << be_nl
740 << " ::CORBA::DefaultValueRefCountBase (val)"
741 << be_uidt_nl
742 << "{" << be_idt_nl
743 << node->full_name () << "* p = 0;" << be_nl
744 << "ACE_NEW (" << be_idt_nl
745 << "p," << be_nl
746 << node->full_name () << " (val._pd_value.in ()));" << be_uidt_nl
747 << "this->_pd_value = p;" << be_uidt_nl
748 << "}" << be_nl_2;
752 void
753 be_visitor_valuebox_ci::emit_assignment (be_decl *node,
754 const char * type_suffix)
756 TAO_OutStream *os = this->ctx_->stream ();
758 // Retrieve the node being visited by this be_visitor_valuebox_ci.
759 be_decl * vb_node = this->ctx_->node ();
761 // Public assignment operator with one argument of underlying type
762 *os << "ACE_INLINE " << vb_node->name () << " &" << be_nl
763 << vb_node->name () << "::operator= ("
764 << node->full_name () << type_suffix << " val)" << be_nl
765 << "{" << be_idt_nl
766 << "this->_pd_value = val;" << be_nl
767 << "return *this;" << be_uidt_nl
768 << "}" << be_nl_2;
771 void
772 be_visitor_valuebox_ci::emit_assignment_alloc (be_decl *node)
774 TAO_OutStream *os = this->ctx_->stream ();
776 // Retrieve the node being visited by this be_visitor_valuebox_ci.
777 be_decl * vb_node = this->ctx_->node ();
779 // Public assignment operator with one argument of type const T&
780 *os << "ACE_INLINE " << vb_node->name () << " &" << be_nl
781 << vb_node->name () << "::operator= (const "
782 << node->full_name () << "& value)" << be_nl
783 << "{" << be_idt_nl
784 << node->full_name () << "* p = 0;" << be_nl
785 << "ACE_NEW_RETURN (" << be_idt_nl
786 << "p," << be_nl
787 << node->full_name () << " (value)," << be_nl
788 << "*this);" << be_uidt_nl << be_nl
789 << "this->_pd_value = p;" << be_nl
790 << "return *this;" << be_uidt_nl
791 << "}" << be_nl_2;
795 void
796 be_visitor_valuebox_ci::emit_accessor_modifier (be_decl *node)
798 TAO_OutStream *os = this->ctx_->stream ();
800 // Retrieve the node being visited by this be_visitor_valuebox_ci.
801 be_decl * vb_node = this->ctx_->node ();
803 // Public accessor method (const)
804 *os << "ACE_INLINE const " << node->full_name () << " &" << be_nl
805 << vb_node->name () << "::_value (void) const" << be_nl
806 << "{" << be_idt_nl
807 << "return this->_pd_value.in ();" << be_uidt_nl
808 << "}" << be_nl_2;
810 // Public accessor method
811 *os << "ACE_INLINE " << node->full_name () << " &" << be_nl
812 << vb_node->name () << "::_value (void)" << be_nl
813 << "{" << be_idt_nl
814 << "return this->_pd_value.inout ();" << be_uidt_nl
815 << "}" << be_nl_2;
817 // Public modifier method
818 *os << "ACE_INLINE void" << be_nl
819 << vb_node->name () << "::_value (const "
820 << node->full_name () << "& value)" << be_nl
821 << "{" << be_idt_nl
822 << node->full_name () << "* p = 0;" << be_nl
823 << "ACE_NEW (" << be_idt_nl
824 << "p," << be_nl
825 << node->full_name () << " (value));" << be_uidt_nl
826 << "this->_pd_value = p;" << be_uidt_nl
827 << "}" << be_nl_2;
830 void
831 be_visitor_valuebox_ci::emit_boxed_access (be_decl *node,
832 const char *out_ref_modifier)
834 TAO_OutStream *os = this->ctx_->stream ();
836 // Retrieve the node being visited by this be_visitor_valuebox_ci.
837 be_decl * vb_node = this->ctx_->node ();
839 // Access to the boxed value for method signatures
840 *os << "ACE_INLINE const " << node->full_name () << " &" << be_nl
841 << vb_node->name () << "::_boxed_in (void) const" << be_nl
842 << "{" << be_idt_nl
843 << "return this->_pd_value.in ();" << be_uidt_nl
844 << "}" << be_nl_2;
846 *os << "ACE_INLINE " << node->full_name () << "&" << be_nl
847 << vb_node->name () << "::_boxed_inout (void)" << be_nl
848 << "{" << be_idt_nl
849 << "return this->_pd_value.inout ();" << be_uidt_nl
850 << "}" << be_nl_2;
852 *os << "ACE_INLINE " << node->full_name ()
853 << out_ref_modifier << "&" << be_nl
854 << vb_node->name () << "::_boxed_out (void)" << be_nl
855 << "{" << be_idt_nl
856 << "return this->_pd_value.out ();" << be_uidt_nl
857 << "}" << be_nl_2;