summaryrefslogtreecommitdiff
path: root/TAO/CIAO/ciao/Servant_Impl_Base.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/CIAO/ciao/Servant_Impl_Base.cpp')
-rw-r--r--TAO/CIAO/ciao/Servant_Impl_Base.cpp206
1 files changed, 122 insertions, 84 deletions
diff --git a/TAO/CIAO/ciao/Servant_Impl_Base.cpp b/TAO/CIAO/ciao/Servant_Impl_Base.cpp
index 51c1ae27867..4dff1298c16 100644
--- a/TAO/CIAO/ciao/Servant_Impl_Base.cpp
+++ b/TAO/CIAO/ciao/Servant_Impl_Base.cpp
@@ -127,9 +127,9 @@ namespace CIAO
PortableServer::ObjectId_var oid;
- this->container_->uninstall_component ( ccmobjref.in (),
- oid.out ()
- ACE_ENV_ARG_PARAMETER);
+ this->container_->uninstall_component (ccmobjref.in (),
+ oid.out ()
+ ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
this->home_servant_->update_component_map (oid);
@@ -173,11 +173,9 @@ namespace CIAO
this->get_all_receptacles (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_CHECK_RETURN (0);
- /*
::Components::ConsumerDescriptions_var consumer_desc =
this->get_all_consumers (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_CHECK_RETURN (0);
- */
::Components::EmitterDescriptions_var emitter_desc =
this->get_all_emitters (ACE_ENV_SINGLE_ARG_PARAMETER);
@@ -189,7 +187,7 @@ namespace CIAO
retv->facets (facets_desc.in ());
retv->receptacles (receptacle_desc.in ());
- // retv->consumers (consumer_desc.in ());
+ retv->consumers (consumer_desc.in ());
retv->emitters (emitter_desc.in ());
retv->publishers (publisher_desc.in ());
@@ -204,7 +202,7 @@ namespace CIAO
ACE_THROW_SPEC ((CORBA::SystemException,
Components::InvalidName))
{
- if (name == 0)
+ if (0 == name)
{
ACE_THROW_RETURN (Components::InvalidName (),
CORBA::Object::_nil ());
@@ -242,7 +240,7 @@ namespace CIAO
{
tmp = this->lookup_facet_description (names[i].in ());
- if (tmp == 0)
+ if (0 == tmp)
{
ACE_THROW_RETURN (Components::InvalidName (),
0);
@@ -267,15 +265,15 @@ namespace CIAO
::Components::FacetDescriptions_var retval = tmp;
- retval->length (this->facet_table_.current_size ());
+ retval->length (this->facet_table_.size ());
CORBA::ULong i = 0;
- for (FacetTable::iterator iter = this->facet_table_.begin ();
+ for (FacetTable::const_iterator iter = this->facet_table_.begin ();
iter != this->facet_table_.end ();
++iter, ++i)
{
- FacetTable::ENTRY & entry = *iter;
- retval[i] = entry.int_id_;
+ FacetTable::const_reference entry = *iter;
+ retval[i] = entry.second;
}
return retval._retn ();
@@ -288,25 +286,25 @@ namespace CIAO
)
ACE_THROW_SPEC ((CORBA::SystemException))
{
-
::Components::ConsumerDescriptions *tmp = 0;
ACE_NEW_THROW_EX (tmp,
::Components::ConsumerDescriptions (
- this->consumer_table_.current_size ()),
+ this->consumer_table_.size ()),
CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
::Components::ConsumerDescriptions_var retval = tmp;
- retval->length (this->consumer_table_.current_size ());
+ retval->length (this->consumer_table_.size ());
CORBA::ULong i = 0;
- for (ConsumerTable::iterator iter = this->consumer_table_.begin ();
+ for (ConsumerTable::const_iterator iter = this->consumer_table_.begin ();
iter != this->consumer_table_.end ();
++iter, ++i)
{
// ACE_DEBUG ((LM_DEBUG, "EXECUTING \n"));
- ConsumerTable::ENTRY & entry = *iter;
- retval[i] = entry.int_id_;
+ ConsumerTable::const_reference entry = *iter;
+ retval[i] = entry.second;
}
return retval._retn ();
@@ -321,7 +319,7 @@ namespace CIAO
ACE_THROW_SPEC ((CORBA::SystemException,
Components::InvalidName))
{
- if (sink_name == 0)
+ if (0 == sink_name)
{
ACE_THROW_RETURN (Components::InvalidName (),
Components::EventConsumerBase::_nil ());
@@ -339,18 +337,6 @@ namespace CIAO
return retval;
}
- ::Components::EventConsumerBase_ptr
- Servant_Impl_Base::disconnect_consumer (
- const char * /* source_name */
- ACE_ENV_ARG_DECL
- )
- ACE_THROW_SPEC ((CORBA::SystemException,
- Components::InvalidName,
- Components::NoConnection))
- {
- ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0);
- }
-
::Components::ConsumerDescriptions *
Servant_Impl_Base::get_named_consumers (
const ::Components::NameList & names
@@ -372,7 +358,7 @@ namespace CIAO
{
tmp = this->lookup_consumer_description (names[i].in ());
- if (tmp == 0)
+ if (0 == tmp)
{
ACE_THROW_RETURN (Components::InvalidName (),
0);
@@ -385,15 +371,6 @@ namespace CIAO
}
::Components::EmitterDescriptions *
- Servant_Impl_Base::get_all_emitters (
- ACE_ENV_SINGLE_ARG_DECL
- )
- ACE_THROW_SPEC ((CORBA::SystemException))
- {
- ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0);
- }
-
- ::Components::EmitterDescriptions *
Servant_Impl_Base::get_named_emitters (
const ::Components::NameList & /* names */
ACE_ENV_ARG_DECL
@@ -405,15 +382,6 @@ namespace CIAO
}
::Components::ReceptacleDescriptions *
- Servant_Impl_Base::get_all_receptacles (
- ACE_ENV_SINGLE_ARG_DECL
- )
- ACE_THROW_SPEC ((CORBA::SystemException))
- {
- ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0);
- }
-
- ::Components::ReceptacleDescriptions *
Servant_Impl_Base::get_named_receptacles (
const ::Components::NameList & /* names */
ACE_ENV_ARG_DECL
@@ -425,15 +393,6 @@ namespace CIAO
}
::Components::PublisherDescriptions *
- Servant_Impl_Base::get_all_publishers (
- ACE_ENV_SINGLE_ARG_DECL
- )
- ACE_THROW_SPEC ((CORBA::SystemException))
- {
- ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0);
- }
-
- ::Components::PublisherDescriptions *
Servant_Impl_Base::get_named_publishers (
const ::Components::NameList & /* names */
ACE_ENV_ARG_DECL
@@ -448,46 +407,84 @@ namespace CIAO
void
Servant_Impl_Base::add_facet (const char *port_name,
- CORBA::Object_ptr port_ref)
+ ::CORBA::Object_ptr port_ref
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC (( ::CORBA::SystemException))
{
+ if (0 == port_name || ::CORBA::is_nil (port_ref))
+ {
+ ACE_THROW ( ::CORBA::BAD_PARAM ());
+ return;
+ }
+
::Components::FacetDescription *fd = 0;
ACE_NEW (fd,
- OBV_Components::FacetDescription);
+ ::OBV_Components::FacetDescription);
::Components::FacetDescription_var safe = fd;
fd->name (port_name);
fd->type_id (port_ref->_interface_repository_id ());
fd->facet_ref (port_ref);
- if (this->facet_table_.bind (port_name, fd) == 0)
- {
- safe._retn ();
- }
+ FacetTable::value_type entry;
+ entry.first = port_name;
+ entry.second = safe._retn ();
+
+ ACE_WRITE_GUARD (TAO_SYNCH_MUTEX, mon, this->lock_);
+
+ (void) this->facet_table_.insert (entry);
}
CORBA::Object_ptr
Servant_Impl_Base::lookup_facet (const char *port_name)
{
- ::Components::FacetDescription_var fd;
+ if (0 == port_name)
+ {
+ return CORBA::Object::_nil ();
+ }
+
+ ACE_READ_GUARD_RETURN (TAO_SYNCH_MUTEX,
+ mon,
+ this->lock_,
+ CORBA::Object::_nil ());
- if (this->facet_table_.find (port_name, fd) != 0)
+ FacetTable::const_iterator iter =
+ this->facet_table_.find (port_name);
+
+ if (iter == this->facet_table_.end ())
{
return CORBA::Object::_nil ();
}
- return CORBA::Object::_duplicate (fd.in ()->facet_ref ());
+ return CORBA::Object::_duplicate (iter->second->facet_ref ());
}
::Components::FacetDescription *
Servant_Impl_Base::lookup_facet_description (const char *port_name)
{
- ::Components::FacetDescription_var fd;
-
- if (this->facet_table_.find (port_name, fd) != 0)
+ if (0 == port_name)
{
+ /// Calling function will throw InvalidName after getting this.
return 0;
}
+ ::Components::FacetDescription_var fd;
+ FacetTable::const_iterator iter;
+
+ {
+ ACE_READ_GUARD_RETURN (TAO_SYNCH_MUTEX,
+ mon,
+ this->lock_,
+ 0);
+
+ iter = this->facet_table_.find (port_name);
+
+ if (iter != this->facet_table_.end ())
+ {
+ fd = iter->second;
+ }
+ }
+
return fd._retn ();
}
@@ -495,35 +492,59 @@ namespace CIAO
Servant_Impl_Base::add_consumer (
const char *port_name,
::Components::EventConsumerBase_ptr port_ref
+ ACE_ENV_ARG_DECL
)
+ ACE_THROW_SPEC (( ::CORBA::SystemException))
{
+ if (0 == port_name || ::CORBA::is_nil (port_ref))
+ {
+ ACE_THROW ( ::CORBA::BAD_PARAM ());
+ return;
+ }
+
::Components::ConsumerDescription *cd = 0;
ACE_NEW (cd,
- OBV_Components::ConsumerDescription);
+ ::OBV_Components::ConsumerDescription);
::Components::ConsumerDescription_var safe = cd;
cd->name (port_name);
cd->type_id (port_ref->_interface_repository_id ());
cd->consumer (port_ref);
- if (this->consumer_table_.bind (port_name, cd) == 0)
- {
- safe._retn ();
- }
+ ConsumerTable::value_type entry;
+ entry.first = port_name;
+ entry.second = safe._retn ();
+
+ ACE_WRITE_GUARD (TAO_SYNCH_MUTEX, mon, this->lock_);
+
+ (void) this->consumer_table_.insert (entry);
}
::Components::EventConsumerBase_ptr
Servant_Impl_Base::lookup_consumer (const char *port_name)
{
- ::Components::ConsumerDescription_var cd;
+ if (0 == port_name)
+ {
+ return ::Components::EventConsumerBase::_nil ();
+ }
+
+ ACE_READ_GUARD_RETURN (TAO_SYNCH_MUTEX,
+ mon,
+ this->lock_,
+ ::Components::EventConsumerBase::_nil ());
- if (this->consumer_table_.find (port_name, cd) != 0)
+ ConsumerTable::const_iterator iter =
+ this->consumer_table_.find (port_name);
+
+ if (iter == this->consumer_table_.end ())
{
return ::Components::EventConsumerBase::_nil ();
}
return
- ::Components::EventConsumerBase::_duplicate (cd.in ()->consumer ());
+ ::Components::EventConsumerBase::_duplicate (
+ iter->second->consumer ()
+ );
}
::Components::ConsumerDescription *
@@ -531,17 +552,33 @@ namespace CIAO
const char *port_name
)
{
- ::Components::ConsumerDescription_var cd;
-
- if (this->consumer_table_.find (port_name, cd) != 0)
+ if (0 == port_name)
{
+ /// Calling function will throw InvalidName after getting this.
return 0;
}
+ ::Components::ConsumerDescription_var cd;
+ ConsumerTable::const_iterator iter;
+
+ {
+ ACE_READ_GUARD_RETURN (TAO_SYNCH_MUTEX,
+ mon,
+ this->lock_,
+ 0);
+
+ iter = this->consumer_table_.find (port_name);
+
+ if (iter != this->consumer_table_.end ())
+ {
+ cd = iter->second;
+ }
+ }
+
return cd._retn ();
}
-
- ::Components::StandardConfigurator_ptr
+
+ ::Components::StandardConfigurator_ptr
Servant_Impl_Base::get_standard_configurator (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
@@ -568,3 +605,4 @@ namespace CIAO
PortableServer::POA::_duplicate (container_->the_POA ());
}
}
+