Ejemplo n.º 1
1
CORBA::TypeCode_ptr
TAO_Repository_i::get_canonical_typecode_i (CORBA::TypeCode_ptr tc)
{
  CORBA::TCKind kind = tc->kind ();

  switch (kind)
  {
    // For all the TCKinds not covered below, no change is needed.
    default:
      return CORBA::TypeCode::_duplicate (tc);
    case CORBA::tk_fixed:
      throw CORBA::NO_IMPLEMENT ();
    case CORBA::tk_array:
    {
      CORBA::ULong length = tc->length ();

      CORBA::TypeCode_var ctype = tc->content_type ();

      CORBA::TypeCode_var canon_ctype =
        this->get_canonical_typecode_i (ctype.in ());

      return this->tc_factory ()->create_array_tc (length,
                                                   canon_ctype.in ());
    }
    case CORBA::tk_sequence:
    {
      CORBA::ULong length = tc->length ();

      CORBA::TypeCode_var ctype = tc->content_type ();

      CORBA::TypeCode_var canon_ctype =
        this->get_canonical_typecode_i (ctype.in ());

      return this->tc_factory ()->create_sequence_tc (length,
                                                      canon_ctype.in ());
    }
    case CORBA::tk_alias:
    case CORBA::tk_objref:
    case CORBA::tk_struct:
    case CORBA::tk_union:
    case CORBA::tk_enum:
    case CORBA::tk_except:
    case CORBA::tk_value:
    case CORBA::tk_value_box:
    case CORBA::tk_native:
    case CORBA::tk_abstract_interface:
    case CORBA::tk_component:
    case CORBA::tk_home:
    {
      CORBA::String_var id = tc->id ();

      ACE_TString path;
      int status =
        this->config ()->get_string_value (this->repo_ids_key (),
                                           id.in (),
                                           path);

      // TODO - something in case the repo id is an empty string,
      //        or if it is not found in this repository
      if (status != 0)
        {
          return CORBA::TypeCode::_nil ();
        }

      ACE_Configuration_Section_Key key;
      this->config ()->expand_path (this->root_key (),
                                    path,
                                    key,
                                    0);

      // An ExceptionDef is not an IDLType.
      if (kind == CORBA::tk_except)
        {
          TAO_ExceptionDef_i impl (this->repo_);
          impl.section_key (key);
          return impl.type_i ();
        }
      else
        {
          TAO_IDLType_i *impl =
            TAO_IFR_Service_Utils::path_to_idltype (path,
                                                    this);
          impl->section_key (key);
          return impl->type_i ();
        }
    }
  }
}
Ejemplo n.º 2
0
CORBA::Boolean
TAO::TypeCode::Alias<StringType,
                     TypeCodeType,
                     RefCountPolicy>::equal_i (CORBA::TypeCode_ptr tc) const
{
  // The CORBA::TypeCode base class already verified equality of the
  // base attributes (id and name).  Perform an equality comparison of
  // the content.

  CORBA::TypeCode_var rhs_content_type = tc->content_type ();

  return
    Traits<StringType>::get_typecode (this->content_type_)->equal (
      rhs_content_type.in ());
}
Ejemplo n.º 3
0
void
DynAnyAnalyzer::analyze_basic_seq (CORBA::TypeCode_ptr tc,
                                   DynamicAny::DynAny_ptr da)
{
  CORBA::TypeCode_var ct = tc->content_type ();
  CORBA::TCKind tk = ct->kind ();

  tab (level_);

  if (debug_)
    {
      ACE_DEBUG ((LM_DEBUG,
                  "BASIC TYPE SEQUENCE\n"));
    }

  switch (tk)
    {
      CASEBS (boolean, Boolean, "  Value (bool) = %d\n");
      CASEBS (octet, Octet, "  Value (octet) = %c\n");
      CASEBS (char, Char, "  Value (char) = %c\n");
      CASEBS (wchar, WChar, "  Value (wchar) = %u\n");
      CASEBS (short, Short, "  Value (short) = %d\n");
      CASEBS (ushort, UShort, "  Value (ushort) = %u\n");
      CASEBS (long, Long, "  Value (long) = %d\n");
      CASEBS (ulong, ULong, "  Value (ulong) = %u\n");
      CASEBS (longlong, LongLong, "  Value (longlong) = %Ld\n");
      CASEBS (ulonglong, ULongLong, "  Value (ulonglong) = %Lu\n");
      CASEBS (float, Float, "  Value (float) = %f\n");
      CASEBS (double, Double, "  Value (double) = %f\n");
      case CORBA::tk_longdouble:
      default:
        tab (level_);

        if (debug_)
          {
            ACE_DEBUG ((LM_DEBUG,
                        "  unhandled typecode = %d\n",
                        static_cast<int> (tk)));
          }

        break;
    }
}