Classes | Typedefs | Functions

TAO::TypeCodeFactory Namespace Reference

Classes

struct  String_Traits< CORBA::Any::from_string >
struct  String_Traits< CORBA::Any::from_wstring >
struct  TC_Info
class  Recursive_TypeCode
 Recursive TypeCode placeholder. More...

Typedefs

typedef ACE_Array_Base< TC_InfoTC_Info_List
typedef bool(* factory )(CORBA::TCKind, TAO_InputCDR &, CORBA::TypeCode_ptr &, TC_Info_List &)

Functions

bool tc_null_factory (CORBA::TCKind kind, TAO_InputCDR &cdr, CORBA::TypeCode_ptr &tc, TC_Info_List &infos)
bool tc_void_factory (CORBA::TCKind kind, TAO_InputCDR &cdr, CORBA::TypeCode_ptr &tc, TC_Info_List &infos)
bool tc_short_factory (CORBA::TCKind kind, TAO_InputCDR &cdr, CORBA::TypeCode_ptr &tc, TC_Info_List &infos)
bool tc_long_factory (CORBA::TCKind kind, TAO_InputCDR &cdr, CORBA::TypeCode_ptr &tc, TC_Info_List &infos)
bool tc_ushort_factory (CORBA::TCKind kind, TAO_InputCDR &cdr, CORBA::TypeCode_ptr &tc, TC_Info_List &infos)
bool tc_ulong_factory (CORBA::TCKind kind, TAO_InputCDR &cdr, CORBA::TypeCode_ptr &tc, TC_Info_List &infos)
bool tc_float_factory (CORBA::TCKind kind, TAO_InputCDR &cdr, CORBA::TypeCode_ptr &tc, TC_Info_List &infos)
bool tc_double_factory (CORBA::TCKind kind, TAO_InputCDR &cdr, CORBA::TypeCode_ptr &tc, TC_Info_List &infos)
bool tc_boolean_factory (CORBA::TCKind kind, TAO_InputCDR &cdr, CORBA::TypeCode_ptr &tc, TC_Info_List &infos)
bool tc_char_factory (CORBA::TCKind kind, TAO_InputCDR &cdr, CORBA::TypeCode_ptr &tc, TC_Info_List &infos)
bool tc_octet_factory (CORBA::TCKind kind, TAO_InputCDR &cdr, CORBA::TypeCode_ptr &tc, TC_Info_List &infos)
bool tc_any_factory (CORBA::TCKind kind, TAO_InputCDR &cdr, CORBA::TypeCode_ptr &tc, TC_Info_List &infos)
bool tc_TypeCode_factory (CORBA::TCKind kind, TAO_InputCDR &cdr, CORBA::TypeCode_ptr &tc, TC_Info_List &infos)
bool tc_Principal_factory (CORBA::TCKind kind, TAO_InputCDR &cdr, CORBA::TypeCode_ptr &tc, TC_Info_List &infos)
bool tc_objref_factory (CORBA::TCKind kind, TAO_InputCDR &cdr, CORBA::TypeCode_ptr &tc, TC_Info_List &infos)
bool tc_struct_factory (CORBA::TCKind kind, TAO_InputCDR &cdr, CORBA::TypeCode_ptr &tc, TC_Info_List &infos)
bool tc_union_factory (CORBA::TCKind kind, TAO_InputCDR &cdr, CORBA::TypeCode_ptr &tc, TC_Info_List &infos)
bool tc_enum_factory (CORBA::TCKind kind, TAO_InputCDR &cdr, CORBA::TypeCode_ptr &tc, TC_Info_List &infos)
bool tc_string_factory (CORBA::TCKind kind, TAO_InputCDR &cdr, CORBA::TypeCode_ptr &tc, TC_Info_List &infos)
bool tc_sequence_factory (CORBA::TCKind kind, TAO_InputCDR &cdr, CORBA::TypeCode_ptr &tc, TC_Info_List &infos)
bool tc_array_factory (CORBA::TCKind kind, TAO_InputCDR &cdr, CORBA::TypeCode_ptr &tc, TC_Info_List &infos)
bool tc_alias_factory (CORBA::TCKind kind, TAO_InputCDR &cdr, CORBA::TypeCode_ptr &tc, TC_Info_List &infos)
bool tc_except_factory (CORBA::TCKind kind, TAO_InputCDR &cdr, CORBA::TypeCode_ptr &tc, TC_Info_List &infos)
bool tc_longlong_factory (CORBA::TCKind kind, TAO_InputCDR &cdr, CORBA::TypeCode_ptr &tc, TC_Info_List &infos)
bool tc_ulonglong_factory (CORBA::TCKind kind, TAO_InputCDR &cdr, CORBA::TypeCode_ptr &tc, TC_Info_List &infos)
bool tc_longdouble_factory (CORBA::TCKind kind, TAO_InputCDR &cdr, CORBA::TypeCode_ptr &tc, TC_Info_List &infos)
bool tc_wchar_factory (CORBA::TCKind kind, TAO_InputCDR &cdr, CORBA::TypeCode_ptr &tc, TC_Info_List &infos)
bool tc_wstring_factory (CORBA::TCKind kind, TAO_InputCDR &cdr, CORBA::TypeCode_ptr &tc, TC_Info_List &infos)
bool tc_fixed_factory (CORBA::TCKind kind, TAO_InputCDR &cdr, CORBA::TypeCode_ptr &tc, TC_Info_List &infos)
bool tc_value_factory (CORBA::TCKind kind, TAO_InputCDR &cdr, CORBA::TypeCode_ptr &tc, TC_Info_List &infos)
bool tc_value_box_factory (CORBA::TCKind kind, TAO_InputCDR &cdr, CORBA::TypeCode_ptr &tc, TC_Info_List &infos)
bool tc_native_factory (CORBA::TCKind kind, TAO_InputCDR &cdr, CORBA::TypeCode_ptr &tc, TC_Info_List &infos)
bool tc_abstract_interface_factory (CORBA::TCKind kind, TAO_InputCDR &cdr, CORBA::TypeCode_ptr &tc, TC_Info_List &infos)
bool tc_local_interface_factory (CORBA::TCKind kind, TAO_InputCDR &cdr, CORBA::TypeCode_ptr &tc, TC_Info_List &infos)
bool tc_component_factory (CORBA::TCKind kind, TAO_InputCDR &cdr, CORBA::TypeCode_ptr &tc, TC_Info_List &infos)
bool tc_home_factory (CORBA::TCKind kind, TAO_InputCDR &cdr, CORBA::TypeCode_ptr &tc, TC_Info_List &infos)
bool tc_event_factory (CORBA::TCKind kind, TAO_InputCDR &cdr, CORBA::TypeCode_ptr &tc, TC_Info_List &infos)

Typedef Documentation

Definition at line 39 of file TypeCode_CDR_Extraction.h.

Definition at line 41 of file TypeCode_CDR_Extraction.cpp.


Function Documentation

bool TAO::TypeCodeFactory::tc_abstract_interface_factory ( CORBA::TCKind  kind,
TAO_InputCDR cdr,
CORBA::TypeCode_ptr tc,
TC_Info_List &  infos 
)

Definition at line 1158 of file TypeCode_CDR_Extraction.cpp.

{
  return tc_objref_factory (CORBA::tk_abstract_interface, cdr, tc, infos);
}

bool TAO::TypeCodeFactory::tc_alias_factory ( CORBA::TCKind  kind,
TAO_InputCDR cdr,
CORBA::TypeCode_ptr tc,
TC_Info_List &  infos 
)

Definition at line 911 of file TypeCode_CDR_Extraction.cpp.

{
  // The remainder of a tk_alias or tk_value_box TypeCode is encoded
  // in a CDR encapsulation.
  TAO_InputCDRByteOrderGuard boguard (cdr);
  if (!start_cdr_encap_extraction (cdr))
    return false;

  // Extract the repository ID, name and content type.
  CORBA::String_var id, name;
  CORBA::TypeCode_var content_type;
  if (!(cdr >> TAO_InputCDR::to_string (id.out (), 0)
        && cdr >> TAO_InputCDR::to_string (name.out (), 0)
        && tc_demarshal (cdr, content_type.out (), infos)))
    {
      return false;
    }

  typedef TAO::TypeCode::Alias<
    CORBA::String_var,
    CORBA::TypeCode_var,
    TAO::True_RefCount_Policy> typecode_type;

  ACE_NEW_RETURN (tc,
                  typecode_type (kind,
                                 id.in (),
                                 name.in (),
                                 content_type),
                  false);
  return true;
}

bool TAO::TypeCodeFactory::tc_any_factory ( CORBA::TCKind  kind,
TAO_InputCDR cdr,
CORBA::TypeCode_ptr tc,
TC_Info_List &  infos 
)

Definition at line 301 of file TypeCode_CDR_Extraction.cpp.

bool TAO::TypeCodeFactory::tc_array_factory ( CORBA::TCKind  kind,
TAO_InputCDR cdr,
CORBA::TypeCode_ptr tc,
TC_Info_List &  infos 
)

Definition at line 902 of file TypeCode_CDR_Extraction.cpp.

{
  return tc_sequence_factory (kind, cdr, tc, infos);
}

bool TAO::TypeCodeFactory::tc_boolean_factory ( CORBA::TCKind  kind,
TAO_InputCDR cdr,
CORBA::TypeCode_ptr tc,
TC_Info_List &  infos 
)

Definition at line 268 of file TypeCode_CDR_Extraction.cpp.

bool TAO::TypeCodeFactory::tc_char_factory ( CORBA::TCKind  kind,
TAO_InputCDR cdr,
CORBA::TypeCode_ptr tc,
TC_Info_List &  infos 
)

Definition at line 279 of file TypeCode_CDR_Extraction.cpp.

bool TAO::TypeCodeFactory::tc_component_factory ( CORBA::TCKind  kind,
TAO_InputCDR cdr,
CORBA::TypeCode_ptr tc,
TC_Info_List &  infos 
)

Definition at line 1176 of file TypeCode_CDR_Extraction.cpp.

{
  return tc_objref_factory (CORBA::tk_component, cdr, tc, infos);
}

bool TAO::TypeCodeFactory::tc_double_factory ( CORBA::TCKind  kind,
TAO_InputCDR cdr,
CORBA::TypeCode_ptr tc,
TC_Info_List &  infos 
)

Definition at line 257 of file TypeCode_CDR_Extraction.cpp.

bool TAO::TypeCodeFactory::tc_enum_factory ( CORBA::TCKind  kind,
TAO_InputCDR cdr,
CORBA::TypeCode_ptr tc,
TC_Info_List &  infos 
)

Definition at line 790 of file TypeCode_CDR_Extraction.cpp.

{
  // The remainder of a tk_enum TypeCode is encoded in a CDR
  // encapsulation.
  TAO_InputCDRByteOrderGuard boguard (cdr);
  if (!start_cdr_encap_extraction (cdr))
    return false;

  // Extract the repository ID, name and number of fields.
  CORBA::String_var id, name;
  CORBA::ULong nenumerators;

  if (!(cdr >> TAO_InputCDR::to_string (id.out (), 0)
        && cdr >> TAO_InputCDR::to_string (name.out (), 0)
        && cdr >> nenumerators))
    return false;

  ACE_Array_Base<CORBA::String_var> enumerators (nenumerators);

  for (CORBA::ULong i = 0; i < nenumerators; ++i)
    {
      if (!(cdr >> TAO_InputCDR::to_string (enumerators[i].out (), 0)))
        return false;
    }

  typedef TAO::TypeCode::Enum<
    CORBA::String_var,
    ACE_Array_Base<CORBA::String_var>,
    TAO::True_RefCount_Policy> typecode_type;

  ACE_NEW_RETURN (tc,
                  typecode_type (id.in (),
                                 name.in (),
                                 enumerators,     // Will be copied.
                                 nenumerators),
                  false);

  return true;
}

bool TAO::TypeCodeFactory::tc_event_factory ( CORBA::TCKind  kind,
TAO_InputCDR cdr,
CORBA::TypeCode_ptr tc,
TC_Info_List &  infos 
)

Definition at line 1194 of file TypeCode_CDR_Extraction.cpp.

{
  return tc_value_factory (kind, cdr, tc, infos);
}

bool TAO::TypeCodeFactory::tc_except_factory ( CORBA::TCKind  kind,
TAO_InputCDR cdr,
CORBA::TypeCode_ptr tc,
TC_Info_List &  infos 
)

Definition at line 947 of file TypeCode_CDR_Extraction.cpp.

{
  return tc_struct_factory (kind, cdr, tc, infos);
}

bool TAO::TypeCodeFactory::tc_fixed_factory ( CORBA::TCKind  kind,
TAO_InputCDR cdr,
CORBA::TypeCode_ptr tc,
TC_Info_List &  infos 
)

Definition at line 1009 of file TypeCode_CDR_Extraction.cpp.

{
  // A tk_fixed TypeCode has a simple parameter list, i.e. it is not
  // encoded in a CDR encapsulation.

  CORBA::UShort digits, scale;
  if (!(cdr >> digits && cdr >> scale))
    return false;

  typedef TAO::TypeCode::Fixed<TAO::True_RefCount_Policy> typecode_type;

  ACE_NEW_RETURN (tc,
                  typecode_type (digits, scale),
                  false);

  return true;
}

bool TAO::TypeCodeFactory::tc_float_factory ( CORBA::TCKind  kind,
TAO_InputCDR cdr,
CORBA::TypeCode_ptr tc,
TC_Info_List &  infos 
)

Definition at line 246 of file TypeCode_CDR_Extraction.cpp.

bool TAO::TypeCodeFactory::tc_home_factory ( CORBA::TCKind  kind,
TAO_InputCDR cdr,
CORBA::TypeCode_ptr tc,
TC_Info_List &  infos 
)

Definition at line 1185 of file TypeCode_CDR_Extraction.cpp.

{
  return tc_objref_factory (CORBA::tk_home, cdr, tc, infos);
}

bool TAO::TypeCodeFactory::tc_local_interface_factory ( CORBA::TCKind  kind,
TAO_InputCDR cdr,
CORBA::TypeCode_ptr tc,
TC_Info_List &  infos 
)

Definition at line 1167 of file TypeCode_CDR_Extraction.cpp.

{
  return tc_objref_factory (CORBA::tk_local_interface, cdr, tc, infos);
}

bool TAO::TypeCodeFactory::tc_long_factory ( CORBA::TCKind  kind,
TAO_InputCDR cdr,
CORBA::TypeCode_ptr tc,
TC_Info_List &  infos 
)

Definition at line 213 of file TypeCode_CDR_Extraction.cpp.

bool TAO::TypeCodeFactory::tc_longdouble_factory ( CORBA::TCKind  kind,
TAO_InputCDR cdr,
CORBA::TypeCode_ptr tc,
TC_Info_List &  infos 
)

Definition at line 978 of file TypeCode_CDR_Extraction.cpp.

bool TAO::TypeCodeFactory::tc_longlong_factory ( CORBA::TCKind  kind,
TAO_InputCDR cdr,
CORBA::TypeCode_ptr tc,
TC_Info_List &  infos 
)

Definition at line 956 of file TypeCode_CDR_Extraction.cpp.

bool TAO::TypeCodeFactory::tc_native_factory ( CORBA::TCKind  kind,
TAO_InputCDR cdr,
CORBA::TypeCode_ptr tc,
TC_Info_List &  infos 
)

Definition at line 1149 of file TypeCode_CDR_Extraction.cpp.

{
  return tc_objref_factory (CORBA::tk_native, cdr, tc, infos);
}

bool TAO::TypeCodeFactory::tc_null_factory ( CORBA::TCKind  kind,
TAO_InputCDR cdr,
CORBA::TypeCode_ptr tc,
TC_Info_List &  infos 
)

Definition at line 180 of file TypeCode_CDR_Extraction.cpp.

bool TAO::TypeCodeFactory::tc_objref_factory ( CORBA::TCKind  kind,
TAO_InputCDR cdr,
CORBA::TypeCode_ptr tc,
TC_Info_List &  infos 
)

Definition at line 334 of file TypeCode_CDR_Extraction.cpp.

{
  // The remainder of a tk_objref TypeCode is encoded in a CDR
  // encapsulation.
  TAO_InputCDRByteOrderGuard boguard (cdr);
  if (!start_cdr_encap_extraction (cdr))
    return false;

  // Extract the repository ID and name.
  CORBA::String_var id;
  if (!(cdr >> TAO_InputCDR::to_string (id.out (), 0)))
    return false;

  static char const Object_id[]    = "IDL:omg.org/CORBA/Object:1.0";
  static char const CCMObject_id[] = "IDL:omg.org/CORBA/CCMObject:1.0";
  static char const CCMHome_id[]   = "IDL:omg.org/CORBA/CCMHome:1.0";

  char const * tc_constant_id = "";

  switch (kind)
    {
    case CORBA::tk_component:
      tc_constant_id = CCMObject_id;
      break;
    case CORBA::tk_home:
      tc_constant_id = CCMHome_id;
      break;
    case CORBA::tk_objref:
      tc_constant_id = Object_id;
      break;
    default:
      break;
    }

  if (ACE_OS::strcmp (id.in (),  // len >= 0!!!
                      tc_constant_id) == 0)
    {
      if (!cdr.skip_string ())  // No need to demarshal the name.
        return false;

      CORBA::TypeCode_ptr tc_constant = CORBA::TypeCode::_nil ();
      switch (kind)
        {
        case CORBA::tk_component:
          tc_constant = CORBA::_tc_Component;
          break;
        case CORBA::tk_home:
          tc_constant = CORBA::_tc_Home;
          break;
        case CORBA::tk_objref:
          tc_constant = CORBA::_tc_Object;
          break;
        default:
          break;
        }

      // No need to create a TypeCode.  Just use the TypeCode
      // constant.
      tc =
        CORBA::TypeCode::_duplicate (tc_constant);
    }
  else
    {
      CORBA::String_var name;

      if (!(cdr >> TAO_InputCDR::to_string (name.out (), 0)))
        return false;

      typedef TAO::TypeCode::Objref<CORBA::String_var,
                                    TAO::True_RefCount_Policy> typecode_type;

      ACE_NEW_RETURN (tc,
                      typecode_type (kind,
                                     id.in (),
                                     name.in ()),
                      false);
    }

  return true;
}

bool TAO::TypeCodeFactory::tc_octet_factory ( CORBA::TCKind  kind,
TAO_InputCDR cdr,
CORBA::TypeCode_ptr tc,
TC_Info_List &  infos 
)

Definition at line 290 of file TypeCode_CDR_Extraction.cpp.

bool TAO::TypeCodeFactory::tc_Principal_factory ( CORBA::TCKind  kind,
TAO_InputCDR cdr,
CORBA::TypeCode_ptr tc,
TC_Info_List &  infos 
)

Definition at line 323 of file TypeCode_CDR_Extraction.cpp.

bool TAO::TypeCodeFactory::tc_sequence_factory ( CORBA::TCKind  kind,
TAO_InputCDR cdr,
CORBA::TypeCode_ptr tc,
TC_Info_List &  infos 
)

Definition at line 869 of file TypeCode_CDR_Extraction.cpp.

{
  ACE_ASSERT (kind == CORBA::tk_sequence || kind == CORBA::tk_array);

  // The remainder of a tk_sequence TypeCode is encoded in a CDR
  // encapsulation.
  TAO_InputCDRByteOrderGuard boguard (cdr);
  if (!start_cdr_encap_extraction (cdr))
    return false;

  // Extract the repository ID, name and content type.
  CORBA::TypeCode_var content_type;
  CORBA::ULong length;

  if (!(tc_demarshal (cdr, content_type.out (), infos)
        && cdr >> length))
    return false;

  typedef TAO::TypeCode::Sequence<
    CORBA::TypeCode_var,
    TAO::True_RefCount_Policy> typecode_type;

  ACE_NEW_RETURN (tc,
                  typecode_type (kind, content_type, length),
                  false);

  return true;
}

bool TAO::TypeCodeFactory::tc_short_factory ( CORBA::TCKind  kind,
TAO_InputCDR cdr,
CORBA::TypeCode_ptr tc,
TC_Info_List &  infos 
)

Definition at line 202 of file TypeCode_CDR_Extraction.cpp.

bool TAO::TypeCodeFactory::tc_string_factory ( CORBA::TCKind  kind,
TAO_InputCDR cdr,
CORBA::TypeCode_ptr tc,
TC_Info_List &  infos 
)

Definition at line 834 of file TypeCode_CDR_Extraction.cpp.

{
  // A tk_string/tk_wstring TypeCode has a simple parameter list,
  // i.e. it is not encoded in a CDR encapsulation.

  CORBA::ULong bound;
  if (!(cdr >> bound))
    return false;

  if (bound == 0)
    {
      // Just use the TypeCode constant.
      if (kind == CORBA::tk_string)
        tc = CORBA::TypeCode::_duplicate (CORBA::_tc_string);
      else if (kind == CORBA::tk_wstring)
        tc = CORBA::TypeCode::_duplicate (CORBA::_tc_wstring);
      else
        return false;

      return true;
    }

  typedef TAO::TypeCode::String<TAO::True_RefCount_Policy> typecode_type;

  ACE_NEW_RETURN (tc,
                  typecode_type (kind, bound),
                  false);

  return true;
}

bool TAO::TypeCodeFactory::tc_struct_factory ( CORBA::TCKind  kind,
TAO_InputCDR cdr,
CORBA::TypeCode_ptr tc,
TC_Info_List &  infos 
)

Definition at line 419 of file TypeCode_CDR_Extraction.cpp.

{
  ACE_ASSERT (kind == CORBA::tk_struct || kind == CORBA::tk_except);

  // The remainder of a tk_struct/tk_except TypeCode is encoded in
  // a CDR encapsulation.
  TAO_InputCDRByteOrderGuard boguard (cdr);
  if (!start_cdr_encap_extraction (cdr))
    return false;

  // Extract the repository ID, name and number of fields.
  CORBA::String_var id, name;
  CORBA::ULong nfields;

  if (!(cdr >> TAO_InputCDR::to_string (id.out (), 0)
        && cdr >> TAO_InputCDR::to_string (name.out (), 0)
        && cdr >> nfields))
    return false;

  typedef ACE_Array_Base<TAO::TypeCode::Struct_Field<CORBA::String_var,
                                                     CORBA::TypeCode_var> >
    member_array_type;

  member_array_type fields (nfields);

  for (CORBA::ULong i = 0; i < nfields; ++i)
    {
      if (!(cdr >> TAO_InputCDR::to_string (fields[i].name.out (), 0)
            && tc_demarshal (cdr, fields[i].type.out (), infos)))
        return false;
    }

  typedef TAO::TypeCode::Struct<
    CORBA::String_var,
    CORBA::TypeCode_var,
    member_array_type,
    TAO::True_RefCount_Policy> typecode_type;

  // Check if struct TypeCode is recursive.
  TAO::TypeCodeFactory::TC_Info_List recursive_tc;
  if (kind == CORBA::tk_struct && find_recursive_tc (id.in (), recursive_tc, infos))
    {
      // Set remaining parameters.
      typedef TAO::TypeCode::Recursive_Type<typecode_type,
                                            CORBA::TypeCode_var,
                                            member_array_type>
        recursive_typecode_type;

      size_t const len = recursive_tc.size ();

      bool assigned_params = false;
      for (size_t i = 0; i < len; ++i)
        {
          TAO::TypeCodeFactory::TC_Info & info = recursive_tc[i];

          recursive_typecode_type * const rtc =
            dynamic_cast<recursive_typecode_type *> (info.type);

          if (!rtc)
            return false;  // Should never occur.

          assigned_params |= rtc->struct_parameters (name.in (), fields, nfields);
        }

      // If no parameters were assigned then the reference in the
      // fields variable will be released when the variable is destroyed.
      // Increment the reference count.
      if ( !assigned_params)
        {
          tc = CORBA::TypeCode::_duplicate(recursive_tc[0].type);
        }
      else
        {
          tc = recursive_tc[0].type;
        }
    }
  else
    {
      ACE_NEW_RETURN (tc,
                      typecode_type (kind,
                                     id.in (),
                                     name.in (),
                                     fields,     // Will be copied.
                                     nfields),
                      false);
    }

  return true;
}

bool TAO::TypeCodeFactory::tc_TypeCode_factory ( CORBA::TCKind  kind,
TAO_InputCDR cdr,
CORBA::TypeCode_ptr tc,
TC_Info_List &  infos 
)

Definition at line 312 of file TypeCode_CDR_Extraction.cpp.

bool TAO::TypeCodeFactory::tc_ulong_factory ( CORBA::TCKind  kind,
TAO_InputCDR cdr,
CORBA::TypeCode_ptr tc,
TC_Info_List &  infos 
)

Definition at line 235 of file TypeCode_CDR_Extraction.cpp.

bool TAO::TypeCodeFactory::tc_ulonglong_factory ( CORBA::TCKind  kind,
TAO_InputCDR cdr,
CORBA::TypeCode_ptr tc,
TC_Info_List &  infos 
)

Definition at line 967 of file TypeCode_CDR_Extraction.cpp.

bool TAO::TypeCodeFactory::tc_union_factory ( CORBA::TCKind  kind,
TAO_InputCDR cdr,
CORBA::TypeCode_ptr tc,
TC_Info_List &  infos 
)

Definition at line 513 of file TypeCode_CDR_Extraction.cpp.

{
  // The remainder of a tk_enum TypeCode is encoded in a CDR
  // encapsulation.

  TAO_InputCDRByteOrderGuard boguard (cdr);
  if (!start_cdr_encap_extraction (cdr))
    return false;

  // Extract the repository ID, name, discriminant type, default index
  // and case count.
  CORBA::String_var id, name;
  CORBA::TypeCode_var discriminant_type;
  CORBA::Long default_index = -1;
  CORBA::ULong ncases = 0;  // Just 'n case :-)

  if (!(cdr >> TAO_InputCDR::to_string (id.out (), 0)
        && cdr >> TAO_InputCDR::to_string (name.out (), 0)
        && cdr >> discriminant_type.out ())) // No need to use tc_demarshal()
    return false;

  CORBA::TCKind const discriminant_kind =
    discriminant_type->kind ();

  // Check for valid discriminant type.
  if (!(discriminant_kind == CORBA::tk_enum
        || discriminant_kind == CORBA::tk_ulong
        || discriminant_kind == CORBA::tk_long
        || discriminant_kind == CORBA::tk_ushort
        || discriminant_kind == CORBA::tk_short
        || discriminant_kind == CORBA::tk_char
        || discriminant_kind == CORBA::tk_boolean
        || discriminant_kind == CORBA::tk_longlong
        || discriminant_kind == CORBA::tk_ulonglong))
    return false;

  if (!(cdr >> default_index
        && default_index >= -1
        && cdr >> ncases))
    return false;

  typedef union_elem_type       elem_type;
  typedef union_case_array_type case_array_type;

  case_array_type cases (ncases);

  for (CORBA::ULong i = 0; i < ncases; ++i)
    {
      elem_type & member = cases[i];

      TAO::TypeCode::Case<CORBA::String_var, CORBA::TypeCode_var> * the_case = 0;

      // Ugly.  *sigh*
      switch (discriminant_kind)
        {
        case CORBA::tk_enum:
          {
            CORBA::ULong label;
            if (!(cdr >> label))
              return false;

            typedef TypeCode::Case_Enum_T<CORBA::String_var,
                                          CORBA::TypeCode_var> case_type;

            ACE_NEW_RETURN (the_case,
                            case_type (discriminant_type.in(), label),
                            false);
          }
          break;
        case CORBA::tk_ulong:
          {
            CORBA::ULong label;
            if (!(cdr >> label))
              return false;

            typedef TypeCode::Case_T<CORBA::ULong,
                                     CORBA::String_var,
                                     CORBA::TypeCode_var> case_type;

            ACE_NEW_RETURN (the_case,
                            case_type (label),
                            false);
          }
          break;
        case CORBA::tk_long:
          {
            CORBA::Long label;
            if (!(cdr >> label))
              return false;

            typedef TypeCode::Case_T<CORBA::Long,
                                     CORBA::String_var,
                                     CORBA::TypeCode_var> case_type;

            ACE_NEW_RETURN (the_case,
                            case_type (label),
                            false);
          }
          break;
        case CORBA::tk_ushort:
          {
            CORBA::UShort label;
            if (!(cdr >> label))
              return false;

            typedef TypeCode::Case_T<CORBA::UShort,
                                     CORBA::String_var,
                                     CORBA::TypeCode_var> case_type;

            ACE_NEW_RETURN (the_case,
                            case_type (label),
                            false);
          }
          break;
        case CORBA::tk_short:
          {
            CORBA::Short label;
            if (!(cdr >> label))
              return false;

            typedef TypeCode::Case_T<CORBA::Short,
                                     CORBA::String_var,
                                     CORBA::TypeCode_var> case_type;

            ACE_NEW_RETURN (the_case,
                            case_type (label),
                            false);
          }
          break;
        case CORBA::tk_char:
          {
            CORBA::Char label;
            if (!(cdr >> CORBA::Any::to_char (label)))
              return false;

            typedef TypeCode::Case_T<CORBA::Char,
                                     CORBA::String_var,
                                     CORBA::TypeCode_var> case_type;

            ACE_NEW_RETURN (the_case,
                            case_type (label),
                            false);
          }
          break;
        case CORBA::tk_boolean:
          {
            CORBA::Boolean label;
             if (!(cdr >> CORBA::Any::to_boolean (label)))
              return false;

            typedef TypeCode::Case_T<CORBA::Boolean,
                                     CORBA::String_var,
                                     CORBA::TypeCode_var> case_type;

            ACE_NEW_RETURN (the_case,
                            case_type (label),
                            false);
          }
          break;
        case CORBA::tk_longlong:
          {
            CORBA::LongLong label;
            if (!(cdr >> label))
              return false;

            typedef TypeCode::Case_T<CORBA::LongLong,
                                     CORBA::String_var,
                                     CORBA::TypeCode_var> case_type;

            ACE_NEW_RETURN (the_case,
                            case_type (label),
                            false);
          }
          break;
#if !defined (ACE_LACKS_LONGLONG_T)
        case CORBA::tk_ulonglong:
          {
            CORBA::ULongLong label;
            if (!(cdr >> label))
              return false;
 
            typedef TypeCode::Case_T<CORBA::ULongLong,
                                     CORBA::String_var,
                                      CORBA::TypeCode_var> case_type;

            ACE_NEW_RETURN (the_case,
                            case_type (label),
                            false);
          }
          break;
#endif  /* !ACE_LACKS_LONGLONG_T */
        default:
          return false;
        }

      elem_type case_value (the_case);
      member.swap (case_value);  // Exception-safe

      CORBA::String_var the_name;
      CORBA::TypeCode_var the_type;

      if (!(cdr >> TAO_InputCDR::to_string (the_name.out (), 0)
            && tc_demarshal (cdr, the_type.out (), infos)))
        return false;

      member->name (the_name.in ());
      member->type (the_type.in ());
    }

  typedef TAO::TypeCode::Union<CORBA::String_var,
                               CORBA::TypeCode_var,
                               case_array_type,
                               TAO::True_RefCount_Policy> typecode_type;

  // Check if we have recursive members.  There could be multiple.
  TAO::TypeCodeFactory::TC_Info_List recursive_tc;
  if (find_recursive_tc (id.in (), recursive_tc, infos))
    {
      // Set remaining parameters.

      typedef TAO::TypeCode::Recursive_Type<typecode_type,
                                            CORBA::TypeCode_var,
                                            case_array_type>
        recursive_typecode_type;

      size_t const len = recursive_tc.size ();

      bool assigned_params = false;
      for (size_t i = 0; i < len; ++i)
        {
          TAO::TypeCodeFactory::TC_Info & info = recursive_tc[i];

          recursive_typecode_type * const rtc =
            dynamic_cast<recursive_typecode_type *> (info.type);

          if (!rtc)
            return false;  // Should never occur.

          assigned_params |= rtc->union_parameters (name.in (),
                                                    discriminant_type,
                                                    cases,  // Will be copied.
                                                    ncases,
                                                    default_index);

        }

      // If no parameters were assigned then the reference in the
      // cases variable  will be released when the variable is destroyed.
      // Increment the reference count.
      if ( !assigned_params)
        {
          tc = CORBA::TypeCode::_duplicate(recursive_tc[0].type);
        }
      else
        {
          tc = recursive_tc[0].type;
        }
    }
  else
    {
      ACE_NEW_RETURN (tc,
                      typecode_type (id.in (),
                                     name.in (),
                                     discriminant_type,
                                     cases,     // Will be copied.
                                     ncases,
                                     default_index),
                      false);
    }

  return true;
}

bool TAO::TypeCodeFactory::tc_ushort_factory ( CORBA::TCKind  kind,
TAO_InputCDR cdr,
CORBA::TypeCode_ptr tc,
TC_Info_List &  infos 
)

Definition at line 224 of file TypeCode_CDR_Extraction.cpp.

bool TAO::TypeCodeFactory::tc_value_box_factory ( CORBA::TCKind  kind,
TAO_InputCDR cdr,
CORBA::TypeCode_ptr tc,
TC_Info_List &  infos 
)

Definition at line 1140 of file TypeCode_CDR_Extraction.cpp.

{
  return tc_alias_factory (kind, cdr, tc, infos);
}

bool TAO::TypeCodeFactory::tc_value_factory ( CORBA::TCKind  kind,
TAO_InputCDR cdr,
CORBA::TypeCode_ptr tc,
TC_Info_List &  infos 
)

Definition at line 1031 of file TypeCode_CDR_Extraction.cpp.

{
  // The remainder of a tk_value/tk_event TypeCode is encoded in a
  // CDR encapsulation
  TAO_InputCDRByteOrderGuard boguard (cdr);
  if (!start_cdr_encap_extraction (cdr))
    return false;

  // Extract the repository ID, name and number of fields.
  CORBA::String_var id;
  if (!(cdr >> TAO_InputCDR::to_string (id.out (), 0)))
    return false;

  CORBA::String_var name;
  CORBA::ValueModifier type_modifier;
  CORBA::TypeCode_var concrete_base;
  CORBA::ULong nfields;

  if (!(cdr >> TAO_InputCDR::to_string (name.out (), 0)
        && cdr >> type_modifier
        && cdr >> concrete_base.out ()
        && cdr >> nfields))
    return false;

  typedef ACE_Array_Base<TAO::TypeCode::Value_Field<CORBA::String_var,
                                                    CORBA::TypeCode_var> >
    member_array_type;

  member_array_type fields (nfields);

  for (CORBA::ULong i = 0; i < nfields; ++i)
    {
      TAO::TypeCode::Value_Field<CORBA::String_var,
                                 CORBA::TypeCode_var> & field = fields[i];

      if (!(cdr >> TAO_InputCDR::to_string (field.name.out (), 0)
            && tc_demarshal (cdr, field.type.out (), infos)
            && cdr >> field.visibility))
        return false;
    }

  typedef TAO::TypeCode::Value<
    CORBA::String_var,
    CORBA::TypeCode_var,
    member_array_type,
    TAO::True_RefCount_Policy> typecode_type;

  // Check if valuetype/eventtype TypeCode is recursive.
  TAO::TypeCodeFactory::TC_Info_List recursive_tc;
  if (find_recursive_tc (id.in (), recursive_tc, infos))
    {
      // Set remaining parameters.

      typedef TAO::TypeCode::Recursive_Type<typecode_type,
                                            CORBA::TypeCode_var,
                                            member_array_type>
        recursive_typecode_type;

      size_t const len = recursive_tc.size ();
      bool assigned_params = false;

      for (size_t i = 0; i < len; ++i)
        {
          TAO::TypeCodeFactory::TC_Info & info = recursive_tc[i];

          recursive_typecode_type * const rtc =
            dynamic_cast<recursive_typecode_type *> (info.type);

          if (!rtc)
            return false;  // Should never occur.

          assigned_params |= rtc->valuetype_parameters (name.in (),
                                                        type_modifier,
                                                        concrete_base,
                                                        fields, // Will be copied.
                                                        nfields);
        }
      // If no parameters were assigned then the reference in the
      // fields variable will be released when the variable is destroyed.
      // Increment the reference count.
      if ( !assigned_params)
        {
          tc = CORBA::TypeCode::_duplicate(recursive_tc[0].type);
        }
      else
        {
          tc = recursive_tc[0].type;
        }
    }
  else
    {
      ACE_NEW_RETURN (tc,
                      typecode_type (kind,
                                     id.in (),
                                     name.in (),
                                     type_modifier,
                                     concrete_base,
                                     fields,     // Will be copied.
                                     nfields),
                      false);
    }

  return true;
}

bool TAO::TypeCodeFactory::tc_void_factory ( CORBA::TCKind  kind,
TAO_InputCDR cdr,
CORBA::TypeCode_ptr tc,
TC_Info_List &  infos 
)

Definition at line 191 of file TypeCode_CDR_Extraction.cpp.

bool TAO::TypeCodeFactory::tc_wchar_factory ( CORBA::TCKind  kind,
TAO_InputCDR cdr,
CORBA::TypeCode_ptr tc,
TC_Info_List &  infos 
)

Definition at line 989 of file TypeCode_CDR_Extraction.cpp.

bool TAO::TypeCodeFactory::tc_wstring_factory ( CORBA::TCKind  kind,
TAO_InputCDR cdr,
CORBA::TypeCode_ptr tc,
TC_Info_List &  infos 
)

Definition at line 1000 of file TypeCode_CDR_Extraction.cpp.

{
  return tc_string_factory (kind, cdr, tc, infos);
}

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines