Examples of DynAny


Examples of org.omg.DynamicAny.DynAny

    * Test accessing a value of some basic type in a DynAny object.
    */
   public void testAccessBasicValue_ulonglong () throws Exception
   {
      TypeCode tc     = orb.get_primitive_tc (org.omg.CORBA.TCKind.tk_ulonglong);
      DynAny   dynAny = createDynAnyFromTypeCode (tc);

      String msg = "Value inserted into DynAny object is not equal to value ";
      msg += "extracted from same DynAny object";

      dynAny.insert_ulonglong (700700700L);
      assertEquals (msg, 700700700L, dynAny.get_ulonglong());
   }
View Full Code Here

Examples of org.omg.DynamicAny.DynAny

        if (logger_.isDebugEnabled())
        {
            logger_.debug("evaluate idx " + position + " on Any");
        }

        DynAny _dynAny = toDynAny(any);

        return evaluateIdentifier(_dynAny, position);
    }
View Full Code Here

Examples of org.omg.DynamicAny.DynAny

            _dynSequence.rewind();

            do
            {
                final DynAny _currentComponent = _dynSequence.current_component();

                final EvaluationResult _currentElement = EvaluationResult.fromAny(_currentComponent.to_any());

                if (element.compareTo(_currentElement) == 0)
                {
                    return EvaluationResult.BOOL_TRUE;
                }
View Full Code Here

Examples of org.omg.DynamicAny.DynAny

    * Test inserting a basic value into a DynAny that has a different typecode.
    */
   public void testInsertMismatch_ulonglong () throws Exception
   {
      TypeCode tc     = orb.get_primitive_tc (org.omg.CORBA.TCKind.tk_boolean);
      DynAny   dynAny = createDynAnyFromTypeCode (tc);

      try
      {
          dynAny.insert_ulonglong (700700700L);
          fail ("should have thrown TypeMismatch");
      }
      catch (TypeMismatch ex)
      {
          // ok
View Full Code Here

Examples of org.omg.DynamicAny.DynAny

     * expensive
     */
    public Any evaluateIdentifier(Any any, String identifier) throws EvaluationException
    {
        // expensive call
        DynAny _dynAny = toDynAny(any);

        // expensive call
        return evaluateIdentifier(_dynAny, identifier);
    }
View Full Code Here

Examples of org.omg.DynamicAny.DynAny

            if (logger_.isDebugEnabled())
            {
                logger_.debug("evaluate " + _strippedIdentifier + " on Any");
            }

            DynAny _cursor = any;

            SWITCH_LABEL:
            switch (any.type().kind().value()) {

            case TCKind._tk_struct:

                logger_.debug("Any is a struct");

                final DynStruct _dynStruct = DynStructHelper.narrow(any);
                String _currentName;

                _dynStruct.rewind();

                do
                {
                    _currentName = _dynStruct.current_member_name();

                    if (logger_.isDebugEnabled())
                    {
                        logger_.debug(" => " + _currentName);
                    }

                    if (_currentName.equals(_strippedIdentifier))
                    {
                        // expensive operation
                        _cursor = _dynStruct.current_component();
                        break SWITCH_LABEL;
                    }
                } while (_dynStruct.next());

                throw new EvaluationException("struct has no member " + _strippedIdentifier);

            case TCKind._tk_union:

                if (logger_.isDebugEnabled())
                {
                    logger_.debug("Any is a Union");
                }

                DynUnion _dynUnion = toDynUnion(any);

                if (_dynUnion.member_name().equals(_strippedIdentifier))
                {
                    _cursor = _dynUnion.member();
                }
                else
                {
                    if (logger_.isDebugEnabled())
                    {
                        logger_.debug(_dynUnion.member_name() + " != " + _strippedIdentifier);
                    }

                    throw new EvaluationException("member " + _strippedIdentifier
                            + " is not active on struct");
                }

                break;

            case TCKind._tk_any:
                logger_.debug("encapsulated any");

                return evaluateIdentifier(any.get_any(), _strippedIdentifier);

            default:
                logger_.debug("unknown " + any.type());

                return null;
            }

            if (logger_.isDebugEnabled())
            {
                logger_.debug("Result: " + _cursor);
            }

            if (_cursor != null && logger_.isDebugEnabled())
            {
                logger_.debug("evaluation result is of type: " + _cursor.type());
            }

            if (_cursor == null)
            {
                logger_.debug("Member not found");

                throw new EvaluationException("member not found");
            }

            return _cursor.to_any();
        } catch (InvalidValue e)
        {
            throw newEvaluationException(e);
        } catch (TypeMismatch e)
        {
View Full Code Here

Examples of org.omg.DynamicAny.DynAny

    * Test retrieving a basic value from a DynAny that has a different typecode.
    */
   public void testRetrieveMismatch_ulonglong () throws Exception
   {
      TypeCode tc     = orb.get_primitive_tc (org.omg.CORBA.TCKind.tk_long);
      DynAny   dynAny = createDynAnyFromTypeCode (tc);
      dynAny.insert_long(700);

      try
      {
          dynAny.get_ulonglong();
          fail ("should have thrown TypeMismatch");
      }
      catch (TypeMismatch ex)
      {
          // ok
View Full Code Here

Examples of org.omg.DynamicAny.DynAny

    * Test accessing a value of some basic type in a DynAny object.
    */
   public void testAccessBasicValue_octet () throws Exception
   {
      TypeCode tc     = orb.get_primitive_tc (org.omg.CORBA.TCKind.tk_octet);
      DynAny   dynAny = createDynAnyFromTypeCode (tc);

      String msg = "Value inserted into DynAny object is not equal to value ";
      msg += "extracted from same DynAny object";

      dynAny.insert_octet ((byte)123);
      assertEquals (msg, (byte)123, dynAny.get_octet());
   }
View Full Code Here

Examples of org.omg.DynamicAny.DynAny

    * Test inserting a basic value into a DynAny that has a different typecode.
    */
   public void testInsertMismatch_octet () throws Exception
   {
      TypeCode tc     = orb.get_primitive_tc (org.omg.CORBA.TCKind.tk_boolean);
      DynAny   dynAny = createDynAnyFromTypeCode (tc);

      try
      {
          dynAny.insert_octet ((byte)87);
          fail ("should have thrown TypeMismatch");
      }
      catch (TypeMismatch ex)
      {
          // ok
View Full Code Here

Examples of org.omg.DynamicAny.DynAny

    * Test retrieving a basic value from a DynAny that has a different typecode.
    */
   public void testRetrieveMismatch_octet () throws Exception
   {
      TypeCode tc     = orb.get_primitive_tc (org.omg.CORBA.TCKind.tk_long);
      DynAny   dynAny = createDynAnyFromTypeCode (tc);
      dynAny.insert_long(700);

      try
      {
          dynAny.get_octet();
          fail ("should have thrown TypeMismatch");
      }
      catch (TypeMismatch ex)
      {
          // ok
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.