summaryrefslogtreecommitdiff
path: root/trunk/TAO/TAO_IDL/be/be_visitor_typecode/objref_typecode.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'trunk/TAO/TAO_IDL/be/be_visitor_typecode/objref_typecode.cpp')
-rw-r--r--trunk/TAO/TAO_IDL/be/be_visitor_typecode/objref_typecode.cpp93
1 files changed, 93 insertions, 0 deletions
diff --git a/trunk/TAO/TAO_IDL/be/be_visitor_typecode/objref_typecode.cpp b/trunk/TAO/TAO_IDL/be/be_visitor_typecode/objref_typecode.cpp
new file mode 100644
index 00000000000..8df2556f997
--- /dev/null
+++ b/trunk/TAO/TAO_IDL/be/be_visitor_typecode/objref_typecode.cpp
@@ -0,0 +1,93 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file objref_typecode.cpp
+ *
+ * $Id$
+ *
+ * Object reference TypeCode generation visitor.
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+
+TAO::be_visitor_objref_typecode::be_visitor_objref_typecode (
+ be_visitor_context * ctx)
+ : be_visitor_typecode_defn (ctx)
+{
+}
+
+int
+TAO::be_visitor_objref_typecode::visit_interface (be_interface * node)
+{
+ if (!node->is_defined ())
+ return this->gen_forward_declared_typecode (node);
+
+ static char const abstract_interface[] = "abstract_interface";
+ static char const component[] = "component";
+ static char const home[] = "home";
+ static char const local_interface[] = "local_interface";
+ static char const objref[] = "objref";
+
+ char const * kind = 0;
+
+ if (dynamic_cast<be_component *> (node))
+ kind = component;
+ else if (dynamic_cast<be_home *> (node))
+ kind = home;
+ else if (node->is_abstract ())
+ kind = abstract_interface;
+ else if (node->is_local ())
+ kind = local_interface;
+ else
+ kind = objref;
+
+ return this->visit_i (kind,
+ node->flat_name (),
+ node->repoID (),
+ node->original_local_name ()->get_string (),
+ node);
+}
+
+int
+TAO::be_visitor_objref_typecode::visit_native (be_native * /* node */)
+{
+ return 0;
+// return this->visit_i ("native",
+// ,
+// ,
+// ,
+// node);
+}
+
+int
+TAO::be_visitor_objref_typecode::visit_i (char const * kind,
+ char const * flat_name,
+ char const * repository_id,
+ char const * original_local_name,
+ be_type * node)
+{
+ TAO_OutStream & os = *this->ctx_->stream ();
+
+ os << be_nl << be_nl
+ << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ // Generate the TypeCode instantiation.
+ os
+ << "static TAO::TypeCode::Objref<char const *," << be_nl
+ << " TAO::Null_RefCount_Policy>"
+ << be_idt_nl
+ << "_tao_tc_" << flat_name << " (" << be_idt_nl
+ << "::CORBA::tk_" << kind << "," << be_nl
+ << "\"" << repository_id << "\"," << be_nl
+ << "\"" << original_local_name << "\");" << be_uidt_nl
+ << be_uidt_nl;
+
+ if (this->gen_typecode_ptr (node) != 0)
+ return -1;
+
+ return 0;
+}