Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / TAO_IDL / be / be_connector.cpp
blobf2314613a4033b9258133e8693828ff4364fab8d
1 #include "be_connector.h"
2 #include "be_visitor.h"
3 #include "ast_module.h"
4 #include "ast_template_module_inst.h"
6 #include "utl_identifier.h"
8 be_connector::be_connector (
9 UTL_ScopedName *n,
10 AST_Connector *base_connector)
11 : COMMON_Base (false,
12 false),
13 AST_Decl (AST_Decl::NT_connector,
14 n),
15 AST_Type (AST_Decl::NT_connector,
16 n),
17 UTL_Scope (AST_Decl::NT_connector),
18 AST_Interface (n,
23 false,
24 false),
25 AST_Component (n,
26 base_connector,
30 0),
31 AST_Connector (n,
32 base_connector),
33 be_scope (AST_Decl::NT_connector),
34 be_decl (AST_Decl::NT_connector,
35 n),
36 be_type (AST_Decl::NT_connector,
37 n),
38 be_interface (n,
43 false,
44 false),
45 be_component (n,
46 base_connector,
50 0),
51 dds_connector_ (false),
52 ami_connector_ (false)
54 if (! this->imported ())
56 this->check_ancestors ();
60 be_connector::~be_connector (void)
64 void
65 be_connector::destroy (void)
67 this->AST_Connector::destroy ();
68 this->be_component::destroy ();
71 int
72 be_connector::accept (be_visitor *visitor)
74 return visitor->visit_connector (this);
77 bool
78 be_connector::dds_connector (void)
80 return this->dds_connector_;
83 bool
84 be_connector::ami_connector (void)
86 return this->ami_connector_;
89 void
90 be_connector::check_ancestors (void)
92 AST_Connector *base = this;
94 while (base != 0)
96 const char *base_fname = base->full_name ();
98 if (ACE_OS::strcmp (base_fname, "CCM_DDS::DDS_Base") == 0)
100 this->dds_connector_ = true;
101 idl_global->dds_connector_seen_ = true;
102 break;
104 else if (ACE_OS::strcmp (base_fname, "CCM_AMI::AMI4CCM_Base") == 0)
106 this->ami_connector_ = true;
107 idl_global->ami_connector_seen_ = true;
108 break;
110 else
112 // If we have a templated module, enable it as dds_connector_
113 // for the moment
114 AST_Module *m =
115 dynamic_cast<AST_Module*> (this->defined_in ());
116 AST_Template_Module_Inst *t_inst = 0;
117 while (t_inst == 0 && m != 0)
119 t_inst = m->from_inst ();
120 m = dynamic_cast<AST_Module*> (m->defined_in ());
122 if (t_inst != 0 && t_inst->template_args () != 0)
124 if (t_inst->template_args ()->size () > 0)
126 this->dds_connector_ = true;
127 idl_global->dds_connector_seen_ = true;
132 base = base->base_connector ();
136 IMPL_NARROW_FROM_DECL (be_connector)
137 IMPL_NARROW_FROM_SCOPE (be_connector)