Package org.omg.DynamicAny

Examples of org.omg.DynamicAny.DynUnion


                        printAny( members[i].value);
                    }
                    break;
                case TCKind._tk_union:
                    System.out.println("[Server]: ** Union **");
                    DynUnion dynunion = (DynUnion)factory.create_dyn_any( a );
                    System.out.println("[Server]: member name " + dynunion.member_name());
                    printAny(dynunion.member().to_any());
                    break;
                case TCKind._tk_sequence:
                    DynSequence dynseq = (DynSequence)factory.create_dyn_any( a );
                    Any[] contents = dynseq.get_elements();
                    System.out.println("[Server]: ** Sequence of length " + contents.length + " **");
 
View Full Code Here


            org.omg.CORBA.ORB.init().create_union_tc("IDL:Nums:1.0",
                    "Nums",
                    org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.from_int(9)),
                    members );

        DynUnion dyn_union =
            (DynUnion)dynFactory.create_dyn_any_from_type_code( union_tc );

        Any discriminator_any = orb.create_any();
        discriminator_any.insert_char('l');
        DynAny discriminator = dynFactory.create_dyn_any(discriminator_any);

        //dyn_enum.set_as_string("salmon");
        //        DynAny discriminator = dyn_enum;

        dyn_union.set_discriminator( discriminator );
        dyn_union.member().insert_long(4711);
        System.out.println("[Client]: Passing a union..." +
                s.generic( dyn_union.to_any()));

        // setting a different union value

        dyn_union.set_to_default_member();
        dyn_union.member().insert_short((short)19);
        System.out.println("[Client]: Passing the  union again..." +
                s.generic( dyn_union.to_any()));

    }
View Full Code Here

        return evaluateIdentifier(value, _defaultMemberName);
    }

    public Any evaluateUnion(Any value, int position) throws EvaluationException
    {
        final DynUnion _dynUnion = toDynUnion(value);

        _dynUnion.seek(0);

        if (logger_.isDebugEnabled())
        {
            logger_.debug("extract idx: " + position + " from Union " + _dynUnion.type());
        }

        String _discrimName = getUnionMemberNameFromDiscriminator(value.type(), position);

        return evaluateIdentifier(_dynUnion, _discrimName);
View Full Code Here

    public Any evaluateDiscriminator(Any any) throws EvaluationException
    {
        switch (any.type().kind().value()) {
        case TCKind._tk_union:
            DynUnion _dynUnion = toDynUnion(any);
            return _dynUnion.get_discriminator().to_any();

        default:
            throw new EvaluationException("any does not contain member _d");
        }
    }
View Full Code Here

                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");
                }
View Full Code Here

        }
        else if ("union".equals (type))
        {
            try
            {
                DynUnion dynUnion = DynUnionHelper.narrow
                    (factory.create_dyn_any(value));

                dynUnion.to_any();
            }
            catch (org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode e)
            {
                throw new INTERNAL();
            }
View Full Code Here

TOP

Related Classes of org.omg.DynamicAny.DynUnion

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.