Пример #1
0
CORBA::Boolean
CORBA::ValueBase::_tao_read_repository_id_list (TAO_InputCDR& strm,
                                                Repository_Id_List& ids)
{
  CORBA::Long num_ids = 0;

  if (!strm.read_long (num_ids))
    {
      return 0;
    }

  if (num_ids == TAO_OBV_GIOP_Flags::Indirection_tag)
    {
      // Multiple repo id is not indirected.
      return 0;
    }
  else
    {
      for (CORBA::Long i = 0; i < num_ids; ++i)
        {
          ACE_CString id;
          if (!_tao_read_repository_id (strm, id))
            {
              return 0;
            }
          ids.push_back (id);
        }
    }

  return 1;
}
Пример #2
0
void
TestValuetype::_tao_obv_truncatable_repo_ids (Repository_Id_List& ids) const
{
    ids.push_back (this->_tao_obv_static_repository_id ());
}
Пример #3
0
void
OBV_TruncatableTest::Extra1::_tao_obv_truncatable_repo_ids (Repository_Id_List& ids) const
{
  ids.push_back (this->_tao_obv_static_repository_id ());
  OBV_TruncatableTest::TValue1::_tao_obv_truncatable_repo_ids (ids);
}
Пример #4
0
void
ORT_Test::ObjectReferenceFactory::_tao_obv_truncatable_repo_ids (Repository_Id_List& ids) const
{
  ids.push_back (this->_tao_obv_static_repository_id ());
}
Пример #5
0
void
CORBA::ValueBase::_tao_unmarshal_find_factory (
  TAO_InputCDR &strm,
  void *const start_of_valuetype,
  CORBA::ValueBase *&valuetype,
  Repository_Id_List &ids,
  CORBA::Boolean &is_chunked)
{
  valuetype = 0;

  TAO_ORB_Core *orb_core = strm.orb_core ();
  if (!orb_core)
    {
      orb_core = TAO_ORB_Core_instance ();
      if (TAO_debug_level)
        {
          TAOLIB_DEBUG ((
            LM_WARNING,
            ACE_TEXT ("TAO (%P|%t) - %N:%l ValueBase::_tao_unmarshal_find_factory, ")
            ACE_TEXT ("WARNING: extracting valuetype using default ORB_Core\n") ));
        }
    }

  // Find the registered factory for this unmarshalling valuetype. If any
  // factory for the valuetype in its truncatable derivation hierarchy
  // is registered, the factory is used to create value for unmarshalling.
  // Value factories are reference counted. When we get a new value factory
  // from the ORB, its reference count is increased.

  CORBA::ValueFactory_var factory;
  CORBA::Boolean requires_truncation = false;
  const size_t num_ids = ids.size ();
  const char *id = (num_ids) ? ids[0].c_str () : "{Null}";
  for (size_t i = 0u; i < num_ids; ++i)
    {
      factory = orb_core->orb ()->lookup_value_factory (ids[i].c_str ());
      if (factory.in() != 0)
        {
          id = ids[i].c_str ();
          requires_truncation = (i != 0u);
          break;
        }
    }

  // Obtain the actual ValueType from the factory
  if (factory.in() == 0 || !(valuetype = factory->create_for_unmarshal ()))
    {
      if (TAO_debug_level)
        {
          TAOLIB_ERROR ((LM_ERROR,
            ACE_TEXT ("TAO (%P|%t) - %N:%l ValueBase::_tao_unmarshal_find_factory, ")
            ACE_TEXT ("OBV factory is null, id=%C\n"),
            id));
        }

      throw ::CORBA::MARSHAL (CORBA::OMGVMCID | 1, CORBA::COMPLETED_MAYBE);
    }

  if (requires_truncation)
    {
      valuetype->truncation_hook ();
    }
  valuetype->chunking_ = is_chunked;

  // Cache the start of this ValueType for later possiable indirection
  VERIFY_MAP (TAO_InputCDR, value_map, Value_Map);
  if (strm.get_value_map ()->get()->bind (start_of_valuetype, valuetype) != 0)
    {
      TAOLIB_DEBUG ((LM_DEBUG,
        ACE_TEXT ("TAO (%P|%t) - %N:%l ValueBase::_tao_unmarshal_find_factory, ")
        ACE_TEXT ("Failed to bound value %x=%x, id=%C\n"),
        start_of_valuetype, valuetype, id ));
    }
  else if (TAO_debug_level)
    {
      TAOLIB_DEBUG ((LM_DEBUG,
        ACE_TEXT ("TAO (%P|%t) - %N:%l ValueBase::_tao_unmarshal_find_factory, ")
        ACE_TEXT ("bound value %x=%x, id=%C\n"),
        start_of_valuetype, valuetype, id ));
    }
}
Пример #6
0
CORBA::Boolean
CORBA::ValueBase::_tao_unmarshal_header (
  TAO_InputCDR &strm,
  const char *const fallback_repo_id,
  Repository_Id_List &ids,
  CORBA::Boolean &is_null_object,
  CORBA::Boolean &is_indirected,
  CORBA::Boolean &is_chunked)
{
  is_indirected = false;
  is_null_object = false;
  is_chunked = false;

  CORBA::Long valuetag;
  if (!strm.read_long (valuetag))
    {
      return false;
    }

  is_chunked = TAO_OBV_GIOP_Flags::is_chunked (valuetag);

  if (TAO_OBV_GIOP_Flags::is_null_ref (valuetag))
    {
      // null reference is unmarshalled.
      is_null_object = true;
      return true;
    }

  if (TAO_OBV_GIOP_Flags::is_indirection_tag (valuetag))
    {
      // value is redirected
      is_indirected = true;
      return true;
    }

  if (TAO_OBV_GIOP_Flags::has_codebase_url (valuetag))
    {
      // We don't do anything with this url, but it needs
      // to be read and ignored.
      ACE_CString codebase_url;
      if (!_tao_read_codebase_url (strm, codebase_url))
        {
          return false;
        }
    }

  // Obtain the repo_id(s) of the type we are reading

  if (TAO_OBV_GIOP_Flags::has_single_type_info (valuetag))
    {
      ACE_CString id;
      if (!_tao_read_repository_id(strm, id))
        {
          return false;
        }
      ids.push_back (id);
    }
  else if (TAO_OBV_GIOP_Flags::has_list_type_info (valuetag))
    {
      if (!_tao_read_repository_id_list(strm, ids))
        {
          return false;
        }
    }
  else if (TAO_OBV_GIOP_Flags::has_no_type_info (valuetag))
    {
      if (fallback_repo_id)
        {
          ids.push_back (fallback_repo_id);
        }
      else
        {
          TAOLIB_ERROR ((
            LM_ERROR,
            ACE_TEXT ("TAO (%P|%t) - %N:%l ValueBase::_tao_unmarshal_pre, ")
            ACE_TEXT ("unknown repo_id\n") ));
          return false;
        }
    }
  else
    {
      if (TAO_debug_level)
        {
          TAOLIB_ERROR ((
            LM_ERROR,
            ACE_TEXT ("TAO (%P|%t) - %N:%l ValueBase::_tao_unmarshal_pre, ")
            ACE_TEXT ("unknown value tag: %x\n"),
            valuetag  ));
        }

      return false;
    }

  return true;
}