summaryrefslogtreecommitdiff
path: root/TAO/TAO_IDL/be/be_sequence.cpp
diff options
context:
space:
mode:
authormk1 <mk1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-06-22 16:12:27 +0000
committermk1 <mk1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-06-22 16:12:27 +0000
commit34c75d686c870092289bbd60a578a8f32c9dcabb (patch)
tree8417fe1a22e3bd7a24455361509755f8095d30d4 /TAO/TAO_IDL/be/be_sequence.cpp
parentf887cc690e803090f4e10c5220aac9fb63abf775 (diff)
downloadATCD-34c75d686c870092289bbd60a578a8f32c9dcabb.tar.gz
Mon Jun 22 11:15:40 1998 Michael Kircher <mk1@cs.wustl.edu>
Diffstat (limited to 'TAO/TAO_IDL/be/be_sequence.cpp')
-rw-r--r--TAO/TAO_IDL/be/be_sequence.cpp123
1 files changed, 123 insertions, 0 deletions
diff --git a/TAO/TAO_IDL/be/be_sequence.cpp b/TAO/TAO_IDL/be/be_sequence.cpp
index 318cc8f4968..9f7cd0c1082 100644
--- a/TAO/TAO_IDL/be/be_sequence.cpp
+++ b/TAO/TAO_IDL/be/be_sequence.cpp
@@ -321,6 +321,129 @@ be_sequence::accept (be_visitor *visitor)
return visitor->visit_sequence (this);
}
+
+const char *
+be_sequence::instance_name ()
+{
+ static char namebuf[NAMEBUFSIZE];
+ ACE_OS::memset (namebuf, '\0', NAMEBUFSIZE);
+
+ be_type *bt;
+ bt = be_type::narrow_from_decl (this->base_type ());
+ if (!bt)
+ {
+ ACE_DEBUG ((LM_ERROR,
+ "(%N:%l) be_visitor_sequence_ch::"
+ "gen_instantiate_name - "
+ "Bad element type\n"));
+ return namebuf;
+ }
+
+ // generate the class name
+ be_type *prim_type; // base types
+ if (bt->node_type () == AST_Decl::NT_typedef)
+ {
+ // get the primitive base type of this typedef node
+ be_typedef *t = be_typedef::narrow_from_decl (bt);
+ prim_type = t->primitive_base_type ();
+ }
+ else
+ prim_type = bt;
+
+
+ // generate the appropriate sequence type
+ switch (this->managed_type ())
+ {
+ case be_sequence::MNG_OBJREF: // sequence of objrefs
+ if (this->unbounded ())
+ ACE_OS::sprintf (namebuf,
+ "_TAO_Unbounded_Object_Sequence_%s",
+ this->flatname());
+ else
+ ACE_OS::sprintf (namebuf,
+ "_TAO_Bounded_Object_Sequence_%s_%d",
+ this->flatname(),
+ this->max_size ()->ev()->u.ulval);
+ break;
+ case be_sequence::MNG_STRING: // sequence of strings
+ if (this->unbounded ())
+ ACE_OS::sprintf (namebuf,
+ "TAO_Unbounded_String_Sequence");
+ else
+ ACE_OS::sprintf (namebuf,
+ "_TAO_Bounded_String_Sequence_%s",
+ this->flatname());
+ break;
+ default: // not a managed type
+ if (this->unbounded ())
+ ACE_OS::sprintf (namebuf,
+ "_TAO_Unbounded_Sequence_%s",
+ this->flatname());
+ //prim_type->flatname ());
+ else
+ ACE_OS::sprintf (namebuf,
+ "_TAO_Bounded_Sequence_%s_%d",
+ this->flatname(),
+ //prim_type->flatname (),
+ this->max_size()->ev()->u.ulval);
+ break;
+ }
+
+ return namebuf;
+}
+
+
+const char *
+be_sequence::object_manager_name ()
+{
+ static char namebuf[NAMEBUFSIZE];
+ ACE_OS::memset (namebuf, '\0', NAMEBUFSIZE);
+
+ be_type *bt;
+ bt = be_type::narrow_from_decl (this->base_type ());
+ if (!bt)
+ {
+ ACE_DEBUG ((LM_ERROR,
+ "(%N:%l) be_visitor_sequence_ch::"
+ "gen_instantiate_name - "
+ "Bad element type\n"));
+ return namebuf;
+ }
+
+
+ // We need that later, when we generate it on a global scope
+ /*
+ be_type *prim_type; // base types
+ if (bt->node_type () == AST_Decl::NT_typedef)
+ {
+ // get the primitive base type of this typedef node
+ be_typedef *t = be_typedef::narrow_from_decl (bt);
+ prim_type = t->primitive_base_type ();
+ }
+ else
+ prim_type = bt;
+ */
+ be_scope * bs = be_scope::narrow_from_scope (this->defined_in());
+
+ if (!bs)
+ {
+ ACE_DEBUG ((LM_ERROR,
+ "(%N:%l) be_visitor_sequence_ch::"
+ "gen_instantiate_name - "
+ "Bad element type\n"));
+ return namebuf;
+ }
+
+ ACE_OS::sprintf (namebuf,
+ "_TAO_Object_Manager_%s_%s",
+ bs->decl()->flatname(),
+ bt->flatname());
+
+
+ return namebuf;
+}
+
+
// Narrowing
IMPL_NARROW_METHODS3 (be_sequence, AST_Sequence, be_scope, be_type)
IMPL_NARROW_FROM_DECL (be_sequence)