Use =default for skeleton copy constructor
[ACE_TAO.git] / TAO / TAO_IDL / be / be_visitor_valuebox / valuebox_ci.cpp
blob93d48a76d104e07b83d5024dedf90625bb967a87
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 ()
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 () << " ()"
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 () 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 ()" << 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 () 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 ()" << 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 ()" << 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 () 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 () 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 () 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 () 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 ()" << 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 ()" << 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 == nullptr || (field = dynamic_cast<be_field*> (d)) == nullptr)
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 == nullptr || (member = dynamic_cast<be_union_branch*> (d)) == nullptr)
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 = nullptr;
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 () const" << be_nl
553 << "{" << be_idt_nl
554 << "return this->_pd_value->_d ();" << be_uidt_nl
555 << "}" << be_nl_2;
557 return 0;
562 be_visitor_valuebox_ci::emit_for_predef_enum (be_type *node,
563 const char * type_suffix,
564 bool is_any)
566 TAO_OutStream *os = this->ctx_->stream ();
568 // Retrieve the node being visited by this be_visitor_valuebox_ci.
569 be_decl * vb_node = this->ctx_->node ();
571 TAO_INSERT_COMMENT (os);
573 if (is_any)
575 this->emit_default_constructor_alloc (node);
576 this->emit_copy_constructor_alloc (node);
577 this->emit_constructor_one_arg_alloc (node);
578 this->emit_assignment_alloc (node);
579 this->emit_accessor_modifier (node);
580 this->emit_boxed_access (node, "*");
582 else
584 this->emit_default_constructor ();
585 this->emit_copy_constructor ();
586 this->emit_constructor_one_arg (node, type_suffix);
587 this->emit_assignment (node, type_suffix);
589 // Public accessor method
590 *os << "ACE_INLINE " << node->full_name () << type_suffix << be_nl
591 << vb_node->name () << "::_value () const" << be_nl
592 << "{" << be_idt_nl
593 << "return this->_pd_value;" << be_uidt_nl
594 << "}" << be_nl_2;
596 // Public modifier method
597 *os << "ACE_INLINE void" << be_nl
598 << vb_node->name () << "::_value ("
599 << node->full_name ()
600 << type_suffix << " val)" << be_nl
601 << "{" << be_idt_nl
602 << "this->_pd_value = val;" << be_uidt_nl
603 << "}" << be_nl_2;
605 // Explicit conversion functions
606 *os << "ACE_INLINE " << node->full_name () << type_suffix << be_nl
607 << vb_node->name () << "::_boxed_in () const" << be_nl
608 << "{" << be_idt_nl
609 << "return this->_pd_value;" << be_uidt_nl
610 << "}" << be_nl_2;
612 *os << "ACE_INLINE " << node->full_name () << type_suffix << "&" << be_nl
613 << vb_node->name () << "::_boxed_inout ()" << be_nl
614 << "{" << be_idt_nl
615 << "return this->_pd_value;" << be_uidt_nl
616 << "}" << be_nl_2;
618 *os << "ACE_INLINE " << node->full_name () << type_suffix << "&" << be_nl
619 << vb_node->name () << "::_boxed_out ()" << be_nl
620 << "{" << be_idt_nl
621 << "return this->_pd_value;" << be_uidt_nl
622 << "}" << be_nl_2;
625 return 0;
628 void
629 be_visitor_valuebox_ci::emit_default_constructor ()
631 TAO_OutStream *os = this->ctx_->stream ();
633 // Retrieve the node being visited by this be_visitor_valuebox_ci.
634 be_decl * vb_node = this->ctx_->node ();
636 // Public default constructor
637 *os << "ACE_INLINE" << be_nl;
638 *os << vb_node->name () << "::" << vb_node->local_name ()
639 << " ()" << be_nl;
640 *os << "{}" << be_nl_2;
643 void
644 be_visitor_valuebox_ci::emit_default_constructor_alloc (be_decl *node)
646 TAO_OutStream *os = this->ctx_->stream ();
648 // Retrieve the node being visited by this be_visitor_valuebox_ci
649 be_decl * vb_node = this->ctx_->node ();
650 bool node_not_pod =
651 dynamic_cast<be_type*> (node)->size_type () == AST_Type::VARIABLE;
653 // Public default constructor
654 *os << "ACE_INLINE" << be_nl
655 << vb_node->name () << "::" << vb_node->local_name () << " ()"
656 << be_nl << "{" << be_idt_nl
657 << node->full_name () << "* p = 0;" << be_nl
658 << "ACE_NEW (" << be_idt_nl
659 << "p," << be_nl
660 << node->full_name ()
661 << (node_not_pod ? " ()" : "") << ");" << be_uidt_nl
662 << "this->_pd_value = p;" << be_uidt_nl
663 << "}" << be_nl_2;
666 void
667 be_visitor_valuebox_ci::emit_constructor_one_arg (be_decl *node,
668 const char * type_suffix)
670 TAO_OutStream *os = this->ctx_->stream ();
672 // Retrieve the node being visited by this be_visitor_valuebox_ci.
673 be_decl * vb_node = this->ctx_->node ();
675 // Public constructor with one argument of underlying type
676 *os << "ACE_INLINE" << be_nl
677 << vb_node->name () << "::" << vb_node->local_name () << " ("
678 << node->full_name () << type_suffix << " val)" << be_nl
679 << "{" << be_idt_nl
680 << "this->_pd_value = val;" << be_uidt_nl
681 << "}" << be_nl_2;
684 void
685 be_visitor_valuebox_ci::emit_constructor_one_arg_alloc (be_decl *node)
687 TAO_OutStream *os = this->ctx_->stream ();
689 // Retrieve the node being visited by this be_visitor_valuebox_ci.
690 be_decl * vb_node = this->ctx_->node ();
692 // Public constructor with single argument of type const T&
693 *os << "ACE_INLINE" << be_nl
694 << vb_node->name () << "::" << vb_node->local_name ()
695 << " (const " << node->full_name () << "& value)" << be_nl
696 << "{" << be_idt_nl
697 << node->full_name () << "* p = 0;" << be_nl
698 << "ACE_NEW (" << be_idt_nl
699 << "p," << be_nl
700 << node->full_name () << " (value));" << be_uidt_nl
701 << "this->_pd_value = p;" << be_uidt_nl
702 << "}" << be_nl_2;
705 void
706 be_visitor_valuebox_ci::emit_copy_constructor ()
708 TAO_OutStream *os = this->ctx_->stream ();
710 // Retrieve the node being visited by this be_visitor_valuebox_ci.
711 be_decl * vb_node = this->ctx_->node ();
713 // Public Copy constructor
714 *os << "ACE_INLINE" << be_nl
715 << vb_node->name () << "::" << vb_node->local_name ()
716 << " (const " << vb_node->full_name () << "& val)" << be_idt_nl
717 << ": ::CORBA::ValueBase (val)," << be_nl
718 << " ::CORBA::DefaultValueRefCountBase (val)"
719 << be_uidt_nl
720 << "{" << be_idt_nl
721 << "this->_pd_value = val._pd_value;" << be_uidt_nl
722 << "}" << be_nl_2;
725 void
726 be_visitor_valuebox_ci::emit_copy_constructor_alloc (be_decl *node)
728 TAO_OutStream *os = this->ctx_->stream ();
730 // Retrieve the node being visited by this be_visitor_valuebox_ci.
731 be_decl * vb_node = this->ctx_->node ();
733 // Public copy constructor
734 *os << "ACE_INLINE" << be_nl
735 << vb_node->name () << "::" << vb_node->local_name () << " (const "
736 << vb_node->full_name () << "& val)" << be_idt_nl
737 << ": ::CORBA::ValueBase (val)," << be_nl
738 << " ::CORBA::DefaultValueRefCountBase (val)"
739 << be_uidt_nl
740 << "{" << be_idt_nl
741 << node->full_name () << "* p = 0;" << be_nl
742 << "ACE_NEW (" << be_idt_nl
743 << "p," << be_nl
744 << node->full_name () << " (val._pd_value.in ()));" << be_uidt_nl
745 << "this->_pd_value = p;" << be_uidt_nl
746 << "}" << be_nl_2;
750 void
751 be_visitor_valuebox_ci::emit_assignment (be_decl *node,
752 const char * type_suffix)
754 TAO_OutStream *os = this->ctx_->stream ();
756 // Retrieve the node being visited by this be_visitor_valuebox_ci.
757 be_decl * vb_node = this->ctx_->node ();
759 // Public assignment operator with one argument of underlying type
760 *os << "ACE_INLINE " << vb_node->name () << " &" << be_nl
761 << vb_node->name () << "::operator= ("
762 << node->full_name () << type_suffix << " val)" << be_nl
763 << "{" << be_idt_nl
764 << "this->_pd_value = val;" << be_nl
765 << "return *this;" << be_uidt_nl
766 << "}" << be_nl_2;
769 void
770 be_visitor_valuebox_ci::emit_assignment_alloc (be_decl *node)
772 TAO_OutStream *os = this->ctx_->stream ();
774 // Retrieve the node being visited by this be_visitor_valuebox_ci.
775 be_decl * vb_node = this->ctx_->node ();
777 // Public assignment operator with one argument of type const T&
778 *os << "ACE_INLINE " << vb_node->name () << " &" << be_nl
779 << vb_node->name () << "::operator= (const "
780 << node->full_name () << "& value)" << be_nl
781 << "{" << be_idt_nl
782 << node->full_name () << "* p = 0;" << be_nl
783 << "ACE_NEW_RETURN (" << be_idt_nl
784 << "p," << be_nl
785 << node->full_name () << " (value)," << be_nl
786 << "*this);" << be_uidt_nl << be_nl
787 << "this->_pd_value = p;" << be_nl
788 << "return *this;" << be_uidt_nl
789 << "}" << be_nl_2;
793 void
794 be_visitor_valuebox_ci::emit_accessor_modifier (be_decl *node)
796 TAO_OutStream *os = this->ctx_->stream ();
798 // Retrieve the node being visited by this be_visitor_valuebox_ci.
799 be_decl * vb_node = this->ctx_->node ();
801 // Public accessor method (const)
802 *os << "ACE_INLINE const " << node->full_name () << " &" << be_nl
803 << vb_node->name () << "::_value () const" << be_nl
804 << "{" << be_idt_nl
805 << "return this->_pd_value.in ();" << be_uidt_nl
806 << "}" << be_nl_2;
808 // Public accessor method
809 *os << "ACE_INLINE " << node->full_name () << " &" << be_nl
810 << vb_node->name () << "::_value ()" << be_nl
811 << "{" << be_idt_nl
812 << "return this->_pd_value.inout ();" << be_uidt_nl
813 << "}" << be_nl_2;
815 // Public modifier method
816 *os << "ACE_INLINE void" << be_nl
817 << vb_node->name () << "::_value (const "
818 << node->full_name () << "& value)" << be_nl
819 << "{" << be_idt_nl
820 << node->full_name () << "* p = 0;" << be_nl
821 << "ACE_NEW (" << be_idt_nl
822 << "p," << be_nl
823 << node->full_name () << " (value));" << be_uidt_nl
824 << "this->_pd_value = p;" << be_uidt_nl
825 << "}" << be_nl_2;
828 void
829 be_visitor_valuebox_ci::emit_boxed_access (be_decl *node,
830 const char *out_ref_modifier)
832 TAO_OutStream *os = this->ctx_->stream ();
834 // Retrieve the node being visited by this be_visitor_valuebox_ci.
835 be_decl * vb_node = this->ctx_->node ();
837 // Access to the boxed value for method signatures
838 *os << "ACE_INLINE const " << node->full_name () << " &" << be_nl
839 << vb_node->name () << "::_boxed_in () const" << be_nl
840 << "{" << be_idt_nl
841 << "return this->_pd_value.in ();" << be_uidt_nl
842 << "}" << be_nl_2;
844 *os << "ACE_INLINE " << node->full_name () << "&" << be_nl
845 << vb_node->name () << "::_boxed_inout ()" << be_nl
846 << "{" << be_idt_nl
847 << "return this->_pd_value.inout ();" << be_uidt_nl
848 << "}" << be_nl_2;
850 *os << "ACE_INLINE " << node->full_name ()
851 << out_ref_modifier << "&" << be_nl
852 << vb_node->name () << "::_boxed_out ()" << be_nl
853 << "{" << be_idt_nl
854 << "return this->_pd_value.out ();" << be_uidt_nl
855 << "}" << be_nl_2;