Package org.omg.CORBA

Examples of org.omg.CORBA.TCKind


        }
        return tc;
    }

    public static TypeCode getPrimitiveTypeCode(ORB orb, QName type) {
        TCKind kind = PRIMITIVE_TYPECODES.get(type);
        if (kind != null) {
            return orb.get_primitive_tc(kind);
        }

        // There is a possiblitity that the idl type will not have its namespace URI set if it has
View Full Code Here


        }
        return name;
    }

    public static boolean isPrimitiveIdlType(QName idltype) {
        TCKind kind = PRIMITIVE_TYPECODES.get(idltype);
        if (kind != null) {
            return true;
        }

        // There is a possiblitity that the idl type will not have its namespace URI set if it has
View Full Code Here

        }      
        return tc;
    }

    public static TypeCode getPrimitiveTypeCode(ORB orb, QName type) {
        TCKind kind = PRIMITIVE_TYPECODES.get(type);
        if (kind != null) {
            return orb.get_primitive_tc(kind);
        }

        // There is a possiblitity that the idl type will not have its namespace URI set if it has
View Full Code Here

        }
        return name;
    }

    public static boolean isPrimitiveIdlType(QName idltype) {
        TCKind kind = PRIMITIVE_TYPECODES.get(idltype);
        if (kind != null) {
            return true;
        }

        // There is a possiblitity that the idl type will not have its namespace URI set if it has
View Full Code Here

   /**
    *  Return the LocalIDLType for the given TypeCode.
    */
   static LocalIDLType getIDLType(TypeCode typeCode, RepositoryImpl repository)
   {
      TCKind tcKind = typeCode.kind();

      if (PrimitiveDefImpl.isPrimitiveTCKind(tcKind))
         return new PrimitiveDefImpl(typeCode, repository);

      if (tcKind == TCKind.tk_sequence)
         return repository.getSequenceImpl(typeCode);

      if (tcKind == TCKind.tk_value || tcKind == TCKind.tk_value_box ||
          tcKind == TCKind.tk_alias || tcKind == TCKind.tk_struct ||
          tcKind == TCKind.tk_union || tcKind == TCKind.tk_enum ||
          tcKind == TCKind.tk_objref) {
         try {
            return (LocalIDLType)repository._lookup_id(typeCode.id());
         } catch (BadKind ex) {
            throw new RuntimeException("Bad kind for TypeCode.id()");
         }
      }

      throw new RuntimeException("TODO: tcKind=" + tcKind.value());
   }
View Full Code Here

        type = tc;
        setValue(val);
    }

    public java.io.Serializable extract_Value() {
        TCKind kind = type.kind();

        if (kind == TCKind.tk_value || kind == TCKind.tk_value_box
            || kind == TCKind.tk_abstract_interface)
        {
            return (java.io.Serializable) getValue();
View Full Code Here

    * Test accessing the discriminator of a DynUnion object.
    */
   public void testAccessUnionDisc ()
   {
      String msg;
      TCKind discKind = null;
      org.omg.CORBA.TypeCode tc = null;
      org.omg.DynamicAny.DynUnion dynAny = null;
      org.omg.DynamicAny.DynEnum disc = null;
      org.omg.DynamicAny.DynAny invalidDisc = null;

      tc = UnionDefaultTypeHelper.type ();
      dynAny = createDynAnyFromTypeCode (tc);

      // test setting the discriminator
      try
      {
         disc = (org.omg.DynamicAny.DynEnum)
            factory.create_dyn_any_from_type_code (EnumTypeHelper.type ());
      }
      catch (Throwable ex)
      {
         fail ("Failed to create DynAny with correct TypeCode: " + ex);
      }

      try
      {
         disc.set_as_string ("second"); // specific to IDL
      }
      catch (Throwable ex)
      {
         fail ("Failed to set value of discriminator: " + ex);
      }

      try
      {
         dynAny.set_discriminator (disc);
      }
      catch (Throwable ex)
      {
         msg = "Failed to set the value of the discriminator using the ";
         msg += "DynUnion::set_discriminator operation";
         fail (msg + ": " + ex);
      }

      // test getting the discriminator
      msg = "Failed to get the correct value of the discriminator using the ";
      msg += "DynUnion::get_discriminator operation";
      disc = (org.omg.DynamicAny.DynEnum) dynAny.get_discriminator ();

      // specific to IDL
      assertEquals (msg, EnumType.second.value (), disc.get_as_ulong ());

      // test getting the kind of the discriminator
      msg = "Failed to get the correct kind of the discriminator using ";
      msg += "DynUnion::discriminator_kind operation";
      discKind = dynAny.discriminator_kind ();

      // specific to IDL
      assertEquals (msg, TCKind._tk_enum, discKind.value ());

      // test setting an invalid discriminator
      tc = orb.get_primitive_tc (TCKind.tk_long);
      try
      {
View Full Code Here

   public void testAccessNamedUnionMember ()
   {
      String msg;
      int testVal = 10;
      UnionDefaultType type;
      TCKind memberKind = null;
      String memberName = null;
      int memberVal = -1;
      org.omg.CORBA.Any any = null;
      org.omg.DynamicAny.DynUnion dynAny = null;
      org.omg.DynamicAny.DynAny member = null; // specific to IDL

      type = new UnionDefaultType ();
      type.win (testVal);
      any = orb.create_any ();
      UnionDefaultTypeHelper.insert (any, type);
      dynAny = createDynAnyFromAny (any);

      // test getting the kind of the active member
      msg = "Failed to get the correct kind of the active member using ";
      msg += "DynUnion::member_kind operation";
      try
      {
         memberKind = dynAny.member_kind ();
      }
      catch (Throwable ex)
      {
         fail (msg + ": " + ex);
      }

      // specific to IDL
      assertEquals (msg, TCKind._tk_long, memberKind.value ());

      // test getting the name of the active member
      msg = "Failed to get the correct name of the active member using ";
      msg += "DynUnion::member_name operation";
      try
View Full Code Here

    */
   public void testAccessStructMembers ()
   {
      String msg;
      String memberName = null;
      TCKind memberKind = null;
      org.omg.CORBA.Any any = null;
      EmptyException exception = null;
      org.omg.DynamicAny.DynStruct dynAny = null;

      exception = new EmptyException ();
View Full Code Here

    */
   public void testAccessStructMembers () throws Exception
   {
      String msg;
      String memberName = null;
      TCKind memberKind = null;
      org.omg.CORBA.TypeCode tc = null;
      org.omg.DynamicAny.DynStruct dynAny = null;

      tc = StructTypeHelper.type ();
      dynAny = createDynAnyFromTypeCode (tc);

      // test getting the name of the current member
      msg = "Failed to get the correct name of the first member using ";
      msg += "DynStruct::current_member_name operation";
      memberName = dynAny.current_member_name ();

      assertEquals (msg, "field1", memberName); // specific to IDL

      // test getting the kind of the current member
      msg = "Failed to get the correct kind of the first member using ";
      msg += "DynStruct::current_member_kind operation";
      memberKind = dynAny.current_member_kind ();

      // specific to IDL
      assertEquals (msg, TCKind._tk_long, memberKind.value ());

      // move to the next position
      dynAny.next ();

      // test getting the name of the current member
      msg = "Failed to get the correct name of the second member using ";
      msg += "DynStruct::current_member_name operation";

      memberName = dynAny.current_member_name ();

      assertEquals (msg, "field2", memberName); // specific to IDL

      // test getting the kind of the current member
      msg = "Failed to get the correct kind of the second member using ";
      msg += "DynStruct::current_member_kind operation";

      memberKind = dynAny.current_member_kind ();

      // specific to IDL
      assertEquals (msg, TCKind._tk_string, memberKind.value ());

      // move to an invalid position
      dynAny.seek (-1);

      // test getting the name of the current member
View Full Code Here

TOP

Related Classes of org.omg.CORBA.TCKind

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.