Example #1
0
::PortableGroup::FactoryInfos * TAO::PG_FactoryRegistry::list_factories_by_role (
    const char * role,
    CORBA::String_out type_id)
{
  METHOD_ENTRY(TAO::PG_FactoryRegistry::list_factories_by_role);

  // allocate stucture to be returned.
  PortableGroup::FactoryInfos_var result = 0;
  ACE_NEW_THROW_EX (result, ::PortableGroup::FactoryInfos(),
    CORBA::NO_MEMORY (TAO::VMCID, CORBA::COMPLETED_NO));


  RoleInfo * role_info = 0;
  if (this->registry_.find(role, role_info) == 0)
  {
    type_id =  CORBA::string_dup(role_info->type_id_.c_str());
    (*result) = role_info->infos_;
  }
  else
  {
    type_id = CORBA::string_dup("");
    ORBSVCS_ERROR(( LM_INFO,
      "%s: list_factories_by_role: unknown role %s\n",
      this->identity_.c_str(),
      role
      ));
  }
  METHOD_RETURN(TAO::PG_FactoryRegistry::list_factories_by_role) result._retn();
}
Example #2
0
void FT_ReplicaFactory_i::delete_object (
    const PortableGroup::GenericFactory::FactoryCreationId & factory_creation_id)
{
  METHOD_ENTRY(FT_ReplicaFactory_i::delete_object);

  ACE_GUARD (TAO_SYNCH_MUTEX, guard, this->internals_);

  CORBA::ULong factoryId;
  factory_creation_id >>= factoryId;
  if (factoryId < this->replicas_.size())
  {
    if(this->replicas_[factoryId] != 0)
    {
      this->replicas_[factoryId]->request_quit();
    }
    else
    {
      throw ::PortableGroup::ObjectNotFound();
    }
  }
  else
  {
    throw ::PortableGroup::ObjectNotFound();
  }
  METHOD_RETURN(FT_ReplicaFactory_i::delete_object);
}
Example #3
0
FT::FaultNotifier::ConsumerId TAO::FT_FaultNotifier_i::connect_sequence_fault_consumer (
    CosNotifyComm::SequencePushConsumer_ptr push_consumer,
    CosNotifyFilter::Filter_ptr filter
)
{
    METHOD_ENTRY(TAO::FT_FaultNotifier_i::connect_sequence_fault_consumer);
    /////////////////////////
    // find a ProxyInfo entry
    // use the first nil entry or a new entry if no nils found

    size_t infoPos = 0;
    int looking = 1;
    for ( size_t pos = 0; looking && pos < this->proxy_infos_.size (); ++pos)
    {
        ProxyInfo & pi = this->proxy_infos_[pos];
        if (CORBA::is_nil(pi.proxyVar_.in ()))
        {
            infoPos = pos;
            looking = 0;
        }
    }
    if (looking)
    {
        infoPos = this->proxy_infos_.size();
        this->proxy_infos_.push_back(ProxyInfo());
    }

    ///////////////////////////////////////
    // Assign an ID, populate the ProxyInfo
    FT::FaultNotifier::ConsumerId result = infoPos;
    ProxyInfo & info = this->proxy_infos_[infoPos];
    info.proxyVar_
        = this->consumer_admin_->obtain_notification_push_supplier (
              ::CosNotifyChannelAdmin::SEQUENCE_EVENT,
              info.proxyId_);

    this->consumer_connects_ += 1;

    ::CosNotifyChannelAdmin::SequenceProxyPushSupplier_var proxySupplier
        = ::CosNotifyChannelAdmin::SequenceProxyPushSupplier::_narrow(info.proxyVar_.in ());
    if ( CORBA::is_nil (proxySupplier.in ()))
    {
        // this is a shoould-not-occur situation.  The consumer admin returned
        // the wrong kind of object.
        ORBSVCS_ERROR(( LM_ERROR,
                        "%T %n (%P|%t) Unexpected result: Wrong type of object returned from obtain_notification_push_supplier\n"
                      ));
    }
    else
    {
        proxySupplier->connect_sequence_push_consumer ( push_consumer);

        if (! CORBA::is_nil (filter))
        {
            proxySupplier->add_filter(filter);
        }
    }
    METHOD_RETURN(TAO::FT_FaultNotifier_i::connect_sequence_fault_consumer) result;
}
Example #4
0
////////////////////////////////////////////////////////////////////////////////
///
/// \brief Defines the center of the circle
///
/// \param _fRadius Radius of the circle
///
////////////////////////////////////////////////////////////////////////////////
void CCircle::setRadius(const double& _fRadius)
{
    METHOD_ENTRY("CCircle::setRadius")

    m_fRadius = _fRadius;
    
    this->updateGeometry();
}
Example #5
0
void FT_ReplicaFactory_i::shutdown (void)
{
  METHOD_ENTRY(FT_FaultDetectorFactory_i::shutdown);
  ACE_GUARD (TAO_SYNCH_MUTEX, guard, this->internals_);
  shutdown_i ();
  this->quit_requested_ = 1;
  METHOD_RETURN(FT_FaultDetectorFactory_i::shutdown);
}
Example #6
0
////////////////////////////////////////////////////////////////////////////////
///
/// \brief Sets the circle type
///
/// \param _CircleType Circle type
///
////////////////////////////////////////////////////////////////////////////////
void CCircle::setCircleType(const CircleType& _CircleType)
{
    METHOD_ENTRY("CCircle::setCircleType")

    m_CircleType = _CircleType;
    
    this->updateGeometry();
}
Example #7
0
////////////////////////////////////////////////////////////////////////////////
///
/// \brief Defines the center of the circle
///
/// \param _vecC Center of the circle
///
////////////////////////////////////////////////////////////////////////////////
void CCircle::setCenter(const Vector2d& _vecC)
{
    METHOD_ENTRY("CCircle::setCenter")

    m_vecCenter0 = _vecC;
    m_vecCenter = _vecC;
    
    this->updateGeometry();
}
Example #8
0
void TAO::FT_FaultNotifier_i::push_structured_fault (
    const CosNotification::StructuredEvent & event
)
{
    METHOD_ENTRY(TAO::FT_FaultNotifier_i::push_structured_fault);

    this->structured_proxy_push_consumer_->push_structured_event (event);

    METHOD_RETURN(TAO::FT_FaultNotifier_i::push_structured_fault);
}
Example #9
0
void TAO::FT_FaultNotifier_i::push_sequence_fault (
    const CosNotification::EventBatch & events
)
{
    METHOD_ENTRY(TAO::FT_FaultNotifier_i::push_sequence_fault);

    this->sequence_proxy_push_consumer_->push_structured_events (events);

    METHOD_RETURN(TAO::FT_FaultNotifier_i::push_sequence_fault);
}
Example #10
0
////////////////////////////////////////////////////////////////////////////////
///
/// \brief Clones circle
///
/// \return Pointer to cloned circle
///
////////////////////////////////////////////////////////////////////////////////
CCircle* CCircle::clone() const
{
    METHOD_ENTRY("CCircle::clone");
    
    CCircle* pClone = new CCircle();
    MEM_ALLOC("IShape")
        
    pClone->copy(this);
    
    return pClone;
}
///////////////////////////////////////////////////////////////////////////////
///
/// \brief Constructor
///
///////////////////////////////////////////////////////////////////////////////
CWorldDataStorage::CWorldDataStorage() : m_pUniverse(nullptr),
                                         m_bFrontNew(false),
                                         m_fTimeScale(1.0)                                 
{
    METHOD_ENTRY("CWorldDataStorage::CWorldDataStorage")
    CTOR_CALL("CWorldDataStorage::CWorldDataStorage")
    
    // Setup a clean environment
    m_UIDUsersByValue.resizeBuffer(WDS_DEFAULT_UID_BUFFER_SIZE);
    m_UIDUsersByValue.fillBuffer(nullptr);
}
Example #12
0
////////////////////////////////////////////////////////////////////////////////
///
/// \brief Copies information of a given circle
///
/// This method does not create a new circle, use clone in that case!
///
/// \param _pShape Shape to be copied
///
////////////////////////////////////////////////////////////////////////////////
void CCircle::myCopy(const IShape* const _pShape)
{
    METHOD_ENTRY("CCircle::myCopy");
    
    const CCircle* const pCircle = static_cast<const CCircle* const>(_pShape);
    m_CircleType   = pCircle->m_CircleType;
    m_vecCenter    = pCircle->m_vecCenter;
    m_vecCenter0   = pCircle->m_vecCenter0;
    m_fAngle       = pCircle->m_fAngle;
    m_fRadius      = pCircle->m_fRadius;
}
Example #13
0
::CosNotifyFilter::Filter_ptr TAO::FT_FaultNotifier_i::create_subscription_filter (
    const char * constraint_grammar
)
{
    METHOD_ENTRY(TAO::FT_FaultNotifier_i::create_subscription_filter);
    ACE_UNUSED_ARG (constraint_grammar); //@@todo

    CosNotifyFilter::Filter_var filter = this->filter_factory_->create_filter ("ETCL");
    METHOD_RETURN(TAO::FT_FaultNotifier_i::create_subscription_filter)
    filter._retn ();
}
Example #14
0
////////////////////////////////////////////////////////////////////////////////
///
/// \brief Defines the center of the circle
///
/// \param _fX Center-x of the circle
/// \param _fY Center-y of the circle
///
////////////////////////////////////////////////////////////////////////////////
void CCircle::setCenter(const double& _fX, const double& _fY)
{
    METHOD_ENTRY("CCircle::setCenter")

    m_vecCenter0[0] = _fX;
    m_vecCenter0[1] = _fY;

    m_vecCenter[0] = _fX;
    m_vecCenter[1] = _fY;
    
    this->updateGeometry();
}
Example #15
0
///////////////////////////////////////////////////////////////////////////////
///
/// \brief Constructor, initialising members
///
///////////////////////////////////////////////////////////////////////////////
CCircle::CCircle() : m_CircleType(CircleType::FILLED),
                     m_fAngle(0.0),
                     m_fRadius(1.0)
                     
                     
{
    METHOD_ENTRY("CCircle::CCircle");
    CTOR_CALL ("CCircle::CCircle");
    
    m_vecCenter0.setZero();
    m_vecCenter.setZero();
}
Example #16
0
////////////////////////////////////////////////////////////////////////////////
///
/// \brief Constructor
///
////////////////////////////////////////////////////////////////////////////////
IShape::IShape() :  IUIDUser(),
                    m_bIsValid(false),
                    m_fArea(0.0),
                    m_fInertia(0.0),
                    m_fMass(1.0),
                    m_nDepthlayers(SHAPE_DEPTH_ALL),
                    m_fThickness(1.0)
{
    METHOD_ENTRY("IShape::IShape")
    CTOR_CALL("IShape::IShape")
    
    m_vecCentroid.setZero();
}
////////////////////////////////////////////////////////////////////////////////
///
/// \brief Creates random color for a shape of given size.
///
/// \param _pvecColor Color of shape to be created
/// \param _Generator Generator for random numbers
/// \param _Distribution Distribution of generated random numbers
///
///////////////////////////////////////////////////////////////////////////////
void createColor(std::vector<float>* const _pvecColor,
                 std::mt19937& _Generator, std::uniform_real_distribution<float>& _Distribution
)
{
    METHOD_ENTRY("createColor")
  
    (*_pvecColor)[0] = _Distribution(_Generator)*0.5f+0.5f;
    (*_pvecColor)[1] = _Distribution(_Generator)*0.5f+0.5f;
    (*_pvecColor)[2] = _Distribution(_Generator)*0.5f+0.5f;
    (*_pvecColor)[3] = _Distribution(_Generator)*0.5f+0.5f;
    (*_pvecColor)[4] = _Distribution(_Generator)*0.5f+0.5f;
    (*_pvecColor)[5] = _Distribution(_Generator)*0.5f+0.5f;
    (*_pvecColor)[6] = _Distribution(_Generator)*0.5f+0.5f;
    (*_pvecColor)[7] = _Distribution(_Generator)*0.5f+0.5f;
    (*_pvecColor)[8] = _Distribution(_Generator)*0.5f+0.5f;
}
Example #18
0
///////////////////////////////////////////////////////////////////////////////
///
/// \brief Transforms the shape
///
/// \param _fAngle Rotation angle
/// \param _vecCOM Center of mass in local (object) coordinates
/// \param _vecV Translation vector
///
///////////////////////////////////////////////////////////////////////////////
void CCircle::transform( const double& _fAngle,
                         const Vector2d& _vecCOM,
                         const Vector2d& _vecV )
{
    METHOD_ENTRY("CCircle::transform");

    Rotation2Dd Rotation(_fAngle);

    m_vecCenter = Rotation * (m_vecCenter0-_vecCOM) + _vecCOM + _vecV;

    m_fAngle = _fAngle;

    // Update bounding box
    m_AABB.setLowerLeft( m_vecCenter - Vector2d(m_fRadius,m_fRadius));
    m_AABB.setUpperRight(m_vecCenter + Vector2d(m_fRadius,m_fRadius));
}
Example #19
0
////////////////////////////////////////////////////////////////////////////////
///
/// \brief Copies shape information and calls copy for inherited shapes
///
/// \param _pShape Shape to be copied
///
////////////////////////////////////////////////////////////////////////////////
void IShape::copy(const IShape* const _pShape)
{
    METHOD_ENTRY("IShape::copy")

    // From IUIDUser
    m_UID             = _pShape->m_UID;
    
    m_AABB            = _pShape->m_AABB;
    m_bIsValid        = _pShape->m_bIsValid;
    m_fArea           = _pShape->m_fArea;
    m_fInertia        = _pShape->m_fInertia;
    m_fMass           = _pShape->m_fMass;
    m_nDepthlayers    = _pShape->m_nDepthlayers;
    m_vecCentroid     = _pShape->m_vecCentroid;
    m_fThickness      = _pShape->m_fThickness;
    
    this->myCopy(_pShape);
}
Example #20
0
////////////////////////////////////////////////////////////////////////////////
///
/// \brief Update geometry relevant data, e.g. inertia, area, center of mass
///
////////////////////////////////////////////////////////////////////////////////
void CCircle::myUpdateGeometry()
{
    METHOD_ENTRY("CCircle::myUpdateGeometry")
    
    // Calculate COM, shape no longer valid
    m_vecCentroid = m_vecCenter0;
    m_fArea = M_PI * m_fRadius * m_fRadius;
    switch (m_CircleType)
    {
        case CircleType::FILLED:
            m_fInertia = m_fMass * m_fRadius * m_fRadius * 0.5;
            break;
        case CircleType::OUTLINE:
            m_fInertia = m_fMass * m_fRadius * m_fRadius;
            break;
    }
    DOM_VAR(DEBUG_MSG("Circle", "Inertia calculated: " << m_fInertia))
}
Example #21
0
////////////////////////////////////////////////////////////////////////////////
///
/// \brief Output stream for game state information
///
/// \param _os  Source stream
///
/// \return Stream with game state information of CCircle instance
///
////////////////////////////////////////////////////////////////////////////////
std::ostream& CCircle::myStreamOut(std::ostream& _os)
{
    METHOD_ENTRY("CCircle::myStreamOut")
    
    _os << "Circle" << std::endl;
    
    // Cast strongly typed enum CircleType to streamable base type
    auto nCircleType = static_cast<std::underlying_type<CircleType>::type>(m_CircleType);
    _os << nCircleType << std::endl;
    _os << m_vecCenter[0] << " " <<
           m_vecCenter[1] << std::endl;
    _os << m_vecCenter0[0] << " " <<
           m_vecCenter0[1] << std::endl;
    _os << m_fAngle << std::endl;
    _os << m_fRadius << std::endl;
    
    return _os;
}
Example #22
0
void TAO::PG_FactoryRegistry::unregister_factory_by_role (
    const char * role
  )
{
  METHOD_ENTRY(TAO::PG_FactoryRegistry::unregister_factory_by_role);

  RoleInfo * role_info = 0;
  if (this->registry_.unbind(role, role_info) == 0)
  {
    ORBSVCS_DEBUG(( LM_DEBUG,
      "%s: Unregistering all factories for role %s\n",
      this->identity_.c_str(),
      role
      ));
    // delete the entire set of factories for this location.
    delete role_info;
  }
  else
  {
    ORBSVCS_ERROR(( LM_INFO,
      "%s: Unregister_factory_by_role: unknown role: %s\n",
      this->identity_.c_str(),
      role
      ));
  }

  /////////////////////
  // Function complete
  // check quit options
  if (registry_.current_size() == 0 && quit_state_ == LIVE)
  {
    ORBSVCS_ERROR(( LM_INFO,
      "%s is idle\n",
      identity()
      ));
    if (quit_on_idle_)
    {
        this->poa_->deactivate_object (this->object_id_.in ());
        quit_state_ = DEACTIVATED;
    }
  }

  METHOD_RETURN(TAO::PG_FactoryRegistry::unregister_factory_by_role);
}
Example #23
0
////////////////////////////////////////////////////////////////////////////////
///
/// \brief Input stream for game state information
///
/// \param _is  Source stream
///
/// \return Remaining stream with game state information
///
////////////////////////////////////////////////////////////////////////////////
std::istream& CCircle::myStreamIn(std::istream& _is)
{
    METHOD_ENTRY("CCircle::myStreamIn")
    
    std::string strTmp;
    _is >> strTmp;
    
    // Cast streamable basetype to strongly typed enum CircleType
    std::underlying_type<CircleType>::type nCircleType;
    _is >> nCircleType; m_CircleType = static_cast<CircleType>(nCircleType);
    _is >> m_vecCenter[0];
    _is >> m_vecCenter[1];
    _is >> m_vecCenter0[0];
    _is >> m_vecCenter0[1];
    _is >> m_fAngle;
    _is >> m_fRadius;
    
    return _is;
}
Example #24
0
::PortableGroup::FactoryInfos * TAO::PG_FactoryRegistry::list_factories_by_location (
    const PortableGroup::Location & location
  )
{
  METHOD_ENTRY(TAO::PG_FactoryRegistry::list_factories_by_location);
  ::PortableGroup::FactoryInfos_var result;
  ACE_NEW_THROW_EX (
    result,
    ::PortableGroup::FactoryInfos(
      static_cast<CORBA::ULong> (this->registry_.current_size())),
    CORBA::NO_MEMORY (TAO::VMCID, CORBA::COMPLETED_NO));


  size_t result_length = 0;

  // iterate through the registery
  for (RegistryType_Iterator it = this->registry_.begin();
       it != this->registry_.end();
       ++it)
  {
    RegistryType_Entry & entry = *it;
    RoleInfo * role_info = entry.int_id_;

    PortableGroup::FactoryInfos & found_infos = role_info->infos_;
    // iterate through the entry for this type
    int found = 0;
    CORBA::ULong length = found_infos.length();
    for (CORBA::ULong nInfo = 0u; !found && nInfo < length; ++nInfo)
    {
      PortableGroup::FactoryInfo & info = found_infos[nInfo];
      if (info.the_location == location)
      {
        found = 1;
        result_length += 1;
        result->length (static_cast<CORBA::ULong> (result_length));
        (*result)[static_cast<CORBA::ULong> (result_length-1u)] = info;
      }
    }
  }

  METHOD_RETURN(TAO::PG_FactoryRegistry::list_factories_by_location) result._retn();
}
////////////////////////////////////////////////////////////////////////////////
///
/// \brief Usage to call program
///
////////////////////////////////////////////////////////////////////////////////
void usage()
{
    METHOD_ENTRY("usage")
    std::cout << "Usage: pw_gl_test_font_rendering <data path>" << std::endl;
}
Example #26
0
void TAO::PG_FactoryRegistry::unregister_factory (
    const char * role,
    const PortableGroup::Location & location)
{
  METHOD_ENTRY(TAO::PG_FactoryRegistry::unregister_factory);

  RoleInfo * role_info = 0;
  if (this->registry_.find(role, role_info) == 0)
  {
    PortableGroup::FactoryInfos & infos = role_info->infos_;
    int found = 0;
    CORBA::ULong length = infos.length();
    for (CORBA::ULong nInfo = 0u; !found && nInfo < length; ++nInfo)
    {
      PortableGroup::FactoryInfo & info = infos[nInfo];
      if (info.the_location == location)
      {
        found = 1;

        ORBSVCS_ERROR(( LM_INFO,
          "%s: Unregistering  factory %s@%s\n",
            this->identity_.c_str(),
            role,
            static_cast<const char *> (location[0].id)
          ));
        if (length > 1)
        {
          // if this is not the last entry
          if (nInfo + 1 < length)
          {
            // move last entry into newly-emptied slot
            infos[nInfo] = infos[length - 1];
            nInfo = length -1;
          }
          infos.length(nInfo);
        }
        else
        {
          ACE_ASSERT ( length == 1 );
          if (this->registry_.unbind (role) == 0)
          {
            ORBSVCS_DEBUG(( LM_INFO,
              "%s: No more factories registered for %s\n",
              this->identity_.c_str(),
              role
              ));
            delete role_info;
          }
          else
          {
            ORBSVCS_ERROR ((LM_ERROR,
              "%s: LOGIC ERROR AT " __FILE__ " (%d): Entry to be deleted disappeared\n",
              this->identity_.c_str(),
              __LINE__));
          }
        }
      }
    }
  }
  else
  {
    ORBSVCS_ERROR(( LM_ERROR,
      "%s, Attempt to unregister factory for unknown role %s\n",
      this->identity_.c_str(),
      role
      ));
    throw PortableGroup::MemberNotFound();
  }

  //////////////////////
  // request complete
  // check quit-on-idle
  if (registry_.current_size() == 0 && quit_state_ == LIVE)
  {
    ORBSVCS_ERROR(( LM_INFO,
      "%s is idle\n",
      identity()
      ));
    if (quit_on_idle_)
    {
        this->poa_->deactivate_object (this->object_id_.in ());
        quit_state_ = DEACTIVATED;
    }
  }

  METHOD_RETURN(TAO::PG_FactoryRegistry::unregister_factory);
}
Example #27
0
void TAO::FT_FaultNotifier_i::disconnect_consumer (
    FT::FaultNotifier::ConsumerId connection
)
{
    METHOD_ENTRY(TAO::FT_FaultNotifier_i::disconnect_consumer);

    size_t index = static_cast<size_t> (connection);
    if (index < this->proxy_infos_.size())
    {
        ProxyInfo & info = this->proxy_infos_[index];
        if (CORBA::is_nil(info.proxyVar_.in ()) )
        {
            throw CosEventComm::Disconnected();
        }
        else
        {
            ::CosNotifyChannelAdmin::StructuredProxyPushSupplier_var proxySupplier
                = ::CosNotifyChannelAdmin::StructuredProxyPushSupplier::_narrow(info.proxyVar_.in ());
            if (! CORBA::is_nil (proxySupplier.in ()))
            {
                proxySupplier->disconnect_structured_push_supplier ();
                info.proxyVar_ = ::CosNotifyChannelAdmin::ProxySupplier::_nil();
            }
            else
            {
                ::CosNotifyChannelAdmin::SequenceProxyPushSupplier_var proxySupplier
                    = ::CosNotifyChannelAdmin::SequenceProxyPushSupplier::_narrow(info.proxyVar_.in ());
                if (! CORBA::is_nil (proxySupplier.in ()))
                {
                    proxySupplier->disconnect_sequence_push_supplier ();
                    info.proxyVar_ = ::CosNotifyChannelAdmin::ProxySupplier::_nil();
                }
                else
                {
                    ORBSVCS_ERROR((LM_ERROR,
                                   "%T %n (%P|%t) Unexpected proxy supplier type\n"
                                  ));
                    throw CosEventComm::Disconnected();
                }
            }
        }
    }
    else
    {
        throw CosEventComm::Disconnected();
    }

    this->consumer_disconnects_ += 1;
    if (this->quit_on_idle_)
    {
        if (! this->quitting_
                && this->consumer_connects_ == this->consumer_disconnects_)
        {
            ORBSVCS_ERROR((LM_ERROR,
                           "FaultNotifier (%P|%t) quit on idle: connects %d, disconnects %d\n",
                           static_cast<unsigned int> (this->consumer_connects_),
                           static_cast<unsigned int> (this->consumer_disconnects_)
                          ));
            this->poa_->deactivate_object (this->object_id_.in ());
            this->quitting_ = 1;
        }
    }

    METHOD_RETURN(TAO::FT_FaultNotifier_i::disconnect_consumer);
}
Example #28
0
void TAO::PG_FactoryRegistry::unregister_factory_by_location (
    const PortableGroup::Location & location)
{
  METHOD_ENTRY(TAO::PG_FactoryRegistry::unregister_factory_by_location);

  ////////////////////////////////////////////
  // a vector of roles that need to be deleted.
  ACE_Vector<ACE_CString> emptyRoles;

  // iterate through the registery
  for (RegistryType_Iterator it = this->registry_.begin();
       it != this->registry_.end();
       ++it)
  {
    RegistryType_Entry & entry = *it;
    ACE_CString & role = entry.ext_id_;
    RoleInfo * role_info =  entry.int_id_;

    PortableGroup::FactoryInfos & infos = role_info->infos_;
    // ORBSVCS_ERROR((LM_INFO,  "unregister_factory_by_location: Checking role %s\n", role.c_str()  ));

    int found = 0;
    CORBA::ULong length = infos.length();
    for (CORBA::ULong nInfo = 0u; !found && nInfo < length; ++nInfo)
    {
      PortableGroup::FactoryInfo & info = infos[nInfo];
      if (info.the_location == location)
      {

        ORBSVCS_ERROR((LM_INFO,
          "%s: Unregister_factory_by_location: Removing: [%d] %s@%s\n",
          this->identity_.c_str(),
          static_cast<int> (nInfo),
          role.c_str(),
          static_cast<const char *> (location[0].id)
          ));
        found = 1;
        if (length > 1)
        {
          while (nInfo + 1 < length)
          {
            ORBSVCS_ERROR((LM_INFO,
              "%s: Unregister_factory_by_location: Move: [%d] %s to [%d]\n",
              this->identity_.c_str(),
              (int)nInfo + 1, role.c_str(), (int)nInfo
              ));
            infos[nInfo] = infos[nInfo + 1];
            nInfo += 1;
          }
          ORBSVCS_ERROR((LM_INFO,
            "%s: unregister_factory_by_location: New length [%d] %s\n",
            this->identity_.c_str(),
            (int)nInfo, role.c_str()
            ));
          infos.length(nInfo);
        }
        else
        {
          ORBSVCS_ERROR((LM_INFO,
            "%s: Removed all entries for %s\n",
            this->identity_.c_str(),
            role.c_str()
            ));
          ACE_ASSERT ( length == 1 );
          // remember entries to be deleted
          emptyRoles.push_back(entry.ext_id_);
        }
      }
    }
  }

  // now remove any roles that became empty

  for (size_t nRole = 0; nRole < emptyRoles.size(); ++nRole)
  {
    ORBSVCS_ERROR((LM_INFO,
      "%s: Remove role %s\n",
      this->identity_.c_str(),
      emptyRoles[nRole].c_str()
      ));
    RoleInfo * role_info;
    if (this->registry_.unbind(emptyRoles[nRole], role_info) == 0)
    {
      delete role_info;
    }
    else
    {
      ORBSVCS_ERROR ((LM_ERROR,
        "%s: LOGIC ERROR AT " __FILE__ " (%d): Role to be deleted disappeared\n",
        this->identity_.c_str(),
        __LINE__));
    }
  }
  //////////////////////////
  // If all types are gone...
  if (registry_.current_size() == 0 && quit_state_ == LIVE)
  {
    ORBSVCS_ERROR(( LM_INFO,
      "%s is idle\n",
      identity()
      ));
    if (quit_on_idle_)
    {
        this->poa_->deactivate_object (this->object_id_.in ());
        quit_state_ = DEACTIVATED;
    }
  }

  METHOD_RETURN(TAO::PG_FactoryRegistry::unregister_factory_by_location);
}
////////////////////////////////////////////////////////////////////////////////
///
/// \brief Usage to call program
///
///////////////////////////////////////////////////////////////////////////////
void usage()
{
    METHOD_ENTRY("usage")
    std::cout << "Usage: pw_gl_test_render_to_texture" << std::endl;
}
Example #30
0
CORBA::Object_ptr FT_ReplicaFactory_i::create_object (
    const char * type_id,
    const PortableGroup::Criteria & the_criteria,
    PortableGroup::GenericFactory::FactoryCreationId_out factory_creation_id)
{
  METHOD_ENTRY(FT_ReplicaFactory_i::create_object);
  ACE_UNUSED_ARG (type_id);
  ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, guard, this->internals_, CORBA::Object::_nil ());

  ::TAO::PG_Property_Set decoder (the_criteria);

  // boolean, becomes true if a required parameter is missing
  int missingParameter = 0;
  const char * missingParameterName = 0;

  CORBA::Long initialValue = 0;
  if (! ::TAO::find (decoder, criterion_initial_value, initialValue) )
  {
    // not required.  Otherwise:
    // missingParameter = 1;
    // missingParameterName = criterion_initial_value;
  }

  const char * role = "replica";
  if (! ::TAO::find (decoder, PortableGroup::role_criterion, role) )
  {
    ACE_ERROR((LM_INFO,
      "Property \"%s\" not found?\n", PortableGroup::role_criterion
      ));
    // not required.  Otherwise:
    // missingParameter = 1;
    // missingParameterName = PortableGroup::role_criterion;
  }

  if (missingParameter)
  {
    ACE_ERROR ((LM_ERROR,
      "Throwing 'InvalidCriteria' due to missing %s\n",
      missingParameterName
      ));
    throw PortableGroup::InvalidCriteria();
  }

  FT_TestReplica_i * replica = create_replica(role);
  if (replica == 0)
  {
    ACE_ERROR ((LM_ERROR,
      "New Replica_i returned NULL.  Throwing ObjectNotCreated.\n"
      ));
    throw PortableGroup::ObjectNotCreated();
  }

  ACE_NEW_THROW_EX ( factory_creation_id,
    PortableGroup::GenericFactory::FactoryCreationId,
    PortableGroup::ObjectNotCreated());
  CORBA::ULong factory_id = replica->factory_id();
  (*factory_creation_id) <<= factory_id;

  ACE_ERROR ((LM_INFO,
    "Created %s@%C#%d.\n", role, this->location_.c_str (), static_cast<int> (factory_id)
    ));


  ::CORBA::Object_ptr replica_obj =
    replica->_default_POA()->servant_to_reference(replica);
  METHOD_RETURN(FT_ReplicaFactory_i::create_object) replica_obj->_duplicate(replica_obj);
}