summaryrefslogtreecommitdiff
path: root/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_ch.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_ch.cpp')
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_ch.cpp101
1 files changed, 42 insertions, 59 deletions
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_ch.cpp
index ffa84c7497c..cb507e4ca8b 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_ch.cpp
@@ -20,13 +20,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_valuetype.h"
-
-ACE_RCSID(be_visitor_valuetype, valuetype_init_ch, "$Id$")
+ACE_RCSID (be_visitor_valuetype,
+ valuetype_init_ch,
+ "$Id$")
be_visitor_valuetype_init_ch::be_visitor_valuetype_init_ch (
be_visitor_context *ctx
@@ -42,11 +38,10 @@ be_visitor_valuetype_init_ch::~be_visitor_valuetype_init_ch (void)
int
be_visitor_valuetype_init_ch::visit_valuetype (be_valuetype *node)
{
-
- if (node->is_abstract_valuetype ())
- {
- return 0;
- }
+ if (node->is_abstract ())
+ {
+ return 0;
+ }
// There are three possible situations.
// (1) If there is no initializers but at least one operation.
@@ -61,9 +56,10 @@ be_visitor_valuetype_init_ch::visit_valuetype (be_valuetype *node)
FactoryStyle factory_style = determine_factory_style (node);
- if(factory_style == FS_NO_FACTORY) // nothing to do
+ if (factory_style == FS_NO_FACTORY)
{
- return 0; // bail out
+ // Nothing to do.
+ return 0;
}
TAO_OutStream& os = *(this->ctx_->stream ());
@@ -72,27 +68,24 @@ be_visitor_valuetype_init_ch::visit_valuetype (be_valuetype *node)
os.gen_ifdef_macro (node->flat_name (), "_init");
- //@@ If I'm generating concrete class I need a RefCounter
+ //@@ If I'm generating concrete class I need a RefCounter.
os << "class " << be_global->stub_export_macro ()
<< " " << node->local_name ()
<< "_init : public virtual CORBA_ValueFactoryBase" << be_nl;
- // generate the body
+ // Generate the body.
os << "{" << be_nl
<< "public:" << be_idt_nl;
- if(factory_style == FS_CONCRETE_FACTORY)
+ if (factory_style == FS_CONCRETE_FACTORY)
{
- // public ctor
- os << node->local_name () << "_init ();" << be_nl;
+ // Public constructor.
+ os << node->local_name () << "_init (void);" << be_nl;
}
- // virtual public dtor
- os << "virtual ~" << node->local_name () << "_init ();" << be_nl;
-
+ // Virtual destructor.
+ os << "virtual ~" << node->local_name () << "_init (void);";
- // custom methods
- os << be_nl;
if (this->visit_valuetype_scope (node) == -1)
{
@@ -103,42 +96,44 @@ be_visitor_valuetype_init_ch::visit_valuetype (be_valuetype *node)
-1);
}
- os << be_nl;
+ // Generate _downcast method.
+ os << be_nl << be_nl
+ << "static " << node->local_name () << "_init* "
+ << "_downcast (CORBA_ValueFactoryBase* );";
- // generate _downcast method
- os << "static " << node->local_name () << "_init* "
- << "_downcast (CORBA_ValueFactoryBase* );" << be_nl;
-
- if(factory_style == FS_CONCRETE_FACTORY)
+ if (factory_style == FS_CONCRETE_FACTORY)
{
//@@ Boris: create_for_unmarshal is still public...
// generate create_for_unmarshal
- os << be_nl
- << "virtual CORBA_ValueBase* "
- << "create_for_unmarshal" << " "
- << "(void);" << be_nl;
+ os << be_nl << be_nl
+ << "virtual CORBA::ValueBase *"
+ << "create_for_unmarshal (void);";
+
+ if (node->supports_abstract ())
+ {
+ os << be_nl << be_nl
+ << "virtual CORBA::AbstractBase_ptr "
+ << "create_for_unmarshal_abstract (void);";
+ }
}
- os << be_nl;
+ os << be_nl << be_nl;
- // propriate extensions
+ // Proprietary extensions.
os << "// TAO-specific extensions"
<< be_uidt_nl
<< "public:" << be_idt_nl;
+ os << "virtual const char* tao_repository_id (void);";
- os << "virtual const char* tao_repository_id (void);\n";
-
- if(factory_style == FS_ABSTRACT_FACTORY)
+ if (factory_style == FS_ABSTRACT_FACTORY)
{
- // protected ctor
- os << be_uidt_nl
+ // Protected constructor.
+ os << be_uidt_nl << be_nl
<< "protected:" << be_idt_nl;
-
os << node->local_name () << "_init ();";
-
}
- os << be_uidt_nl << "};" << be_nl;
+ os << be_uidt_nl << "};" << be_nl << be_nl;
// Generate the endif macro.
os.gen_endif ();
@@ -166,20 +161,10 @@ be_visitor_valuetype_init_ch::visit_factory (be_factory *node)
// we grab a visitor that generates the parameter listing.
be_visitor_context ctx (*this->ctx_);
ctx.state (TAO_CodeGen::TAO_VALUETYPE_INIT_ARGLIST_CH);
- be_visitor* visitor = tao_cg->make_visitor (&ctx);
-
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_valuetype_init_ch::"
- "visit_factory - "
- "Bad visitor to argument list\n"),
- -1);
- }
+ be_visitor_valuetype_init_arglist_ch visitor (&ctx);
- if (node->accept (visitor) == -1)
+ if (node->accept (&visitor) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_valuetype_init_arglist__ch::"
"visit_operation - "
@@ -187,9 +172,7 @@ be_visitor_valuetype_init_ch::visit_factory (be_factory *node)
-1);
}
- delete visitor;
-
- // make pure virtual
+ // Make pure virtual.
os << " = 0;" << be_nl;
return 0;