Esempio n. 1
0
  void
  CompressionManager::register_factory (::Compression::CompressorFactory_ptr
                                        compressor_factory)
  {
    if (!::CORBA::is_nil (compressor_factory))
      {
        ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->mutex_);
        CORBA::ULong const length = this->factories_.length ();

        for (CORBA::ULong i = 0u; i < length; ++i)
          {
            ::Compression::CompressorId const current =
              this->factories_[i]->compressor_id ();

            if (compressor_factory->compressor_id () == current)
              {
                throw ::Compression::FactoryAlreadyRegistered ();
              }
          }
        factories_.length (length + 1u);
        factories_[length] = ::Compression::CompressorFactory::_duplicate (
          compressor_factory);
      }
    else
      {
        // @todo Standardize this minor code
        throw ::CORBA::BAD_PARAM (CORBA::OMGVMCID | 44, CORBA::COMPLETED_NO);
      }
  }
void TIDorb::core::compression::CompressionManagerImpl::register_factory(
    Compression::CompressorFactory_ptr compressor_factory)
throw (Compression::FactoryAlreadyRegistered)
{
    TIDThr::Synchronized synchro(m_recursive_mutex);

    Compression::CompressorId comp_id = compressor_factory->compressor_id();

    CompressorFactoryMapT::iterator it = m_factories.find(comp_id);

    if (it == m_factories.end()) {
        m_factories[comp_id] = compressor_factory;
    }
    else
        throw Compression::FactoryAlreadyRegistered();

}