コード例 #1
0
ファイル: TestI.cs プロジェクト: nonmore/ice
 public override Ice.Optional <Test.MyEnum> opMyEnum(Ice.Optional <Test.MyEnum> p1, out Ice.Optional <Test.MyEnum> p3,
                                                     Ice.Current current)
 {
     p3 = p1;
     return(p1);
 }
コード例 #2
0
ファイル: TestAMDI.cs プロジェクト: zhoushiyi/ice
 opSerializableAsync(Ice.Optional <SerializableClass> p1, Ice.Current current)
 {
     return(Task.FromResult <Initial_OpSerializableResult>(new Initial_OpSerializableResult(p1, p1)));
 }
コード例 #3
0
ファイル: TestAMDI.cs プロジェクト: zhoushiyi/ice
 opIntOneOptionalDictAsync(Ice.Optional <Dictionary <int, OneOptional> > p1, Ice.Current current)
 {
     return(Task.FromResult <Initial_OpIntOneOptionalDictResult>(new Initial_OpIntOneOptionalDictResult(p1, p1)));
 }
コード例 #4
0
ファイル: TestAMDI.cs プロジェクト: zhoushiyi/ice
 opStringSeqAsync(Ice.Optional <string[]> p1, Ice.Current current)
 {
     return(Task.FromResult <Initial_OpStringSeqResult>(new Initial_OpStringSeqResult(p1, p1)));
 }
コード例 #5
0
ファイル: TestAMDI.cs プロジェクト: zhoushiyi/ice
 opFixedStructListAsync(Ice.Optional <LinkedList <FixedStruct> > p1, Ice.Current current)
 {
     return(Task.FromResult <Initial_OpFixedStructListResult>(new Initial_OpFixedStructListResult(p1, p1)));
 }
コード例 #6
0
ファイル: TestAMDI.cs プロジェクト: zhoushiyi/ice
 opOneOptionalProxyAsync(Ice.Optional <OneOptionalPrx> p1, Ice.Current current)
 {
     return(Task.FromResult <Initial_OpOneOptionalProxyResult>(new Initial_OpOneOptionalProxyResult(p1, p1)));
 }
コード例 #7
0
ファイル: TestAMDI.cs プロジェクト: zhoushiyi/ice
 opFloatSeqAsync(Ice.Optional <float[]> p1, Ice.Current current)
 {
     return(Task.FromResult <Initial_OpFloatSeqResult>(new Initial_OpFloatSeqResult(p1, p1)));
 }
コード例 #8
0
ファイル: TestI.cs プロジェクト: nonmore/ice
 public override Ice.Optional <bool> opBool(Ice.Optional <bool> p1, out Ice.Optional <bool> p3, Ice.Current current)
 {
     p3 = p1;
     return(p1);
 }
コード例 #9
0
ファイル: TestI.cs プロジェクト: nonmore/ice
 public override Ice.Optional <short> opShort(Ice.Optional <short> p1, out Ice.Optional <short> p3, Ice.Current current)
 {
     p3 = p1;
     return(p1);
 }
コード例 #10
0
ファイル: TestI.cs プロジェクト: nonmore/ice
 public override void opDerivedException(Ice.Optional <int> a, Ice.Optional <string> b,
                                         Ice.Optional <Test.OneOptional> o, Ice.Current current)
 {
     throw new Test.DerivedException(false, a, b, o, b, o);
 }
コード例 #11
0
ファイル: TestI.cs プロジェクト: nonmore/ice
 public override Ice.Optional <byte> opByte(Ice.Optional <byte> p1, out Ice.Optional <byte> p3, Ice.Current current)
 {
     p3 = p1;
     return(p1);
 }
コード例 #12
0
ファイル: TestI.cs プロジェクト: nonmore/ice
 public override void returnOptionalClass(bool req, out Ice.Optional <Test.OneOptional> o, Ice.Current current)
 {
     o = new Test.OneOptional(53);
 }
コード例 #13
0
ファイル: TestI.cs プロジェクト: nonmore/ice
 public override void sendOptionalClass(bool req, Ice.Optional <Test.OneOptional> o, Ice.Current current)
 {
 }
コード例 #14
0
ファイル: TestI.cs プロジェクト: nonmore/ice
 public override Ice.Optional <String[]> opStringSeq(Ice.Optional <String[]> p1, out Ice.Optional <String[]> p3,
                                                     Ice.Current current)
 {
     p3 = p1;
     return(p1);
 }
コード例 #15
0
ファイル: Client.cs プロジェクト: weiofcn/ice-demos
        public override int run(string[] args)
        {
            if (args.Length > 0)
            {
                Console.Error.WriteLine(appName() + ": too many arguments");
                return(1);
            }

            ContactDBPrx contactdb = ContactDBPrxHelper.checkedCast(communicator().propertyToProxy("ContactDB.Proxy"));

            if (contactdb == null)
            {
                Console.Error.WriteLine(appName() + ": invalid proxy");
                return(1);
            }

            //
            // Add a contact for "john". All parameters are provided.
            //
            String johnNumber = "123-456-7890";

            contactdb.addContact("john", NumberType.HOME, johnNumber, 0);

            Console.Write("Checking john... ");

            //
            // Find the phone number for "john".
            //
            Ice.Optional <String> number = contactdb.queryNumber("john");

            //
            // HasValue tests if an optional value is set.
            //
            if (!number.HasValue)
            {
                Console.Write("number is incorrect ");
            }

            //
            // Call Value to retrieve the optional value.
            //
            if (!number.Value.Equals(johnNumber))
            {
                Console.Write("number is incorrect ");
            }

            // Optional can also be used in an out parameter.
            Ice.Optional <int> dialgroup;
            contactdb.queryDialgroup("john", out dialgroup);
            if (!dialgroup.HasValue || dialgroup.Value != 0)
            {
                Console.Write("dialgroup is incorrect ");
            }

            Contact info = contactdb.query("john");

            //
            // All of the info parameters should be set. Each of the optional members
            // of the class map to Ice.Optional<T> member.
            //
            if (!info.type.HasValue || !info.number.HasValue || !info.dialGroup.HasValue)
            {
                Console.Write("info is incorrect ");
            }
            if (info.type.Value != NumberType.HOME || !info.number.Value.Equals(johnNumber) || info.dialGroup.Value != 0)
            {
                Console.Write("info is incorrect ");
            }
            Console.WriteLine("ok");

            //
            // Add a contact for "steve". The behavior of the server is to
            // default construct the Contact, and then assign  all set parameters.
            // Since the default value of NumberType in the slice definition
            // is NumberType.HOME and in this case the NumberType is unset it will take
            // the default value.
            //
            // The C# mapping permits Ice.Util.None to be passed to unset optional values.
            //
            String steveNumber = "234-567-8901";

            contactdb.addContact("steve", Ice.Util.None, steveNumber, 1);

            Console.Write("Checking steve... ");
            number = contactdb.queryNumber("steve");
            if (!number.Value.Equals(steveNumber))
            {
                Console.Write("number is incorrect ");
            }

            info = contactdb.query("steve");
            //
            // Check the value for the NumberType.
            //
            if (!info.type.HasValue || info.type.Value != NumberType.HOME)
            {
                Console.Write("info is incorrect ");
            }

            if (!info.number.Value.Equals(steveNumber) || info.dialGroup.Value != 1)
            {
                Console.Write("info is incorrect ");
            }

            contactdb.queryDialgroup("steve", out dialgroup);
            if (!dialgroup.HasValue || dialgroup.Value != 1)
            {
                Console.Write("dialgroup is incorrect ");
            }

            Console.WriteLine("ok");

            //
            // Add a contact from "frank". Here the dialGroup field isn't set.
            //
            String frankNumber = "345-678-9012";

            contactdb.addContact("frank", NumberType.CELL, frankNumber, Ice.Util.None);

            Console.Write("Checking frank... ");

            number = contactdb.queryNumber("frank");
            if (!number.Value.Equals(frankNumber))
            {
                Console.Write("number is incorrect ");
            }

            info = contactdb.query("frank");
            //
            // The dial group field should be unset.
            //
            if (info.dialGroup.HasValue)
            {
                Console.Write("info is incorrect ");
            }
            if (info.type.Value != NumberType.CELL || !info.number.Value.Equals(frankNumber))
            {
                Console.Write("info is incorrect ");
            }

            contactdb.queryDialgroup("frank", out dialgroup);
            if (dialgroup.HasValue)
            {
                Console.Write("dialgroup is incorrect ");
            }
            Console.WriteLine("ok");

            //
            // Add a contact from "anne". The number field isn't set.
            //
            contactdb.addContact("anne", NumberType.OFFICE, Ice.Util.None, 2);

            Console.Write("Checking anne... ");
            number = contactdb.queryNumber("anne");
            if (number.HasValue)
            {
                Console.Write("number is incorrect ");
            }

            info = contactdb.query("anne");
            //
            // The number field should be unset.
            //
            if (info.number.HasValue)
            {
                Console.Write("info is incorrect ");
            }
            if (info.type.Value != NumberType.OFFICE || info.dialGroup.Value != 2)
            {
                Console.Write("info is incorrect ");
            }

            contactdb.queryDialgroup("anne", out dialgroup);
            if (!dialgroup.HasValue || dialgroup.Value != 2)
            {
                Console.Write("dialgroup is incorrect ");
            }

            //
            // The optional fields can be used to determine what fields to
            // update on the contact.  Here we update only the number for anne,
            // the remainder of the fields are unchanged.
            //
            String anneNumber = "456-789-0123";

            contactdb.updateContact("anne", Ice.Util.None, new Ice.Optional <String>(anneNumber), Ice.Util.None);
            number = contactdb.queryNumber("anne");
            if (!number.Value.Equals(anneNumber))
            {
                Console.Write("number is incorrect ");
            }
            info = contactdb.query("anne");
            if (!info.number.Value.Equals(anneNumber) || info.type.Value != NumberType.OFFICE || info.dialGroup.Value != 2)
            {
                Console.Write("info is incorrect ");
            }
            Console.WriteLine("ok");

            contactdb.shutdown();


            return(0);
        }
コード例 #16
0
ファイル: TestI.cs プロジェクト: nonmore/ice
 public override Ice.Optional <int> opInt(Ice.Optional <int> p1, out Ice.Optional <int> p3, Ice.Current current)
 {
     p3 = p1;
     return(p1);
 }
コード例 #17
0
ファイル: TestAMDI.cs プロジェクト: zhoushiyi/ice
 opMyEnumAsync(Ice.Optional <MyEnum> p1, Ice.Current current)
 {
     return(Task.FromResult <Initial_OpMyEnumResult>(new Initial_OpMyEnumResult(p1, p1)));
 }
コード例 #18
0
ファイル: TestI.cs プロジェクト: nonmore/ice
 public override Ice.Optional <float> opFloat(Ice.Optional <float> p1, out Ice.Optional <float> p3, Ice.Current current)
 {
     p3 = p1;
     return(p1);
 }
コード例 #19
0
ファイル: TestAMDI.cs プロジェクト: zhoushiyi/ice
 opBoolSeqAsync(Ice.Optional <bool[]> p1, Ice.Current current)
 {
     return(Task.FromResult <Initial_OpBoolSeqResult>(new Initial_OpBoolSeqResult(p1, p1)));
 }
コード例 #20
0
ファイル: TestI.cs プロジェクト: nonmore/ice
 public override Ice.Optional <double> opDouble(Ice.Optional <double> p1, out Ice.Optional <double> p3,
                                                Ice.Current current)
 {
     p3 = p1;
     return(p1);
 }
コード例 #21
0
ファイル: TestAMDI.cs プロジェクト: zhoushiyi/ice
 opDoubleSeqAsync(Ice.Optional <double[]> p1, Ice.Current current)
 {
     return(Task.FromResult <Initial_OpDoubleSeqResult>(new Initial_OpDoubleSeqResult(p1, p1)));
 }
コード例 #22
0
ファイル: TestI.cs プロジェクト: nonmore/ice
 public override Ice.Optional <string> opString(Ice.Optional <string> p1, out Ice.Optional <string> p3,
                                                Ice.Current current)
 {
     p3 = p1;
     return(p1);
 }
コード例 #23
0
ファイル: TestAMDI.cs プロジェクト: zhoushiyi/ice
 opSmallStructListAsync(Ice.Optional <List <SmallStruct> > p1, Ice.Current current)
 {
     return(Task.FromResult <Initial_OpSmallStructListResult>(new Initial_OpSmallStructListResult(p1, p1)));
 }
コード例 #24
0
ファイル: Server.cs プロジェクト: l64848810/ice
 public override Ice.ObjectPrx getClientProxy(out Ice.Optional <bool> hasRoutingTable, Ice.Current current)
 {
     hasRoutingTable = new Ice.Optional <bool>(true);
     _controller.checkCallPause(current);
     return(null);
 }
コード例 #25
0
ファイル: TestAMDI.cs プロジェクト: zhoushiyi/ice
 opVarStructSeqAsync(Ice.Optional <VarStruct[]> p1, Ice.Current current)
 {
     return(Task.FromResult <Initial_OpVarStructSeqResult>(new Initial_OpVarStructSeqResult(p1, p1)));
 }
コード例 #26
0
ファイル: ContactDBI.cs プロジェクト: zhangtianshan/ice-demos
    public override void addContact(string name, Ice.Optional <Demo.NumberType> type, Ice.Optional <string> number, Ice.Optional <int> dialGroup,
                                    Ice.Current current)
    {
        Contact contact = new Contact();

        contact.name = name;
        if (type.HasValue)
        {
            contact.type = type;
        }
        if (number.HasValue)
        {
            contact.number = number;
        }
        if (dialGroup.HasValue)
        {
            contact.dialGroup = dialGroup;
        }
        _contacts[name] = contact;
    }
コード例 #27
0
ファイル: TestAMDI.cs プロジェクト: zhoushiyi/ice
 opStringIntDictAsync(Ice.Optional <Dictionary <string, int> > p1, Ice.Current current)
 {
     return(Task.FromResult <Initial_OpStringIntDictResult>(new Initial_OpStringIntDictResult(p1, p1)));
 }
コード例 #28
0
ファイル: ContactDBI.cs プロジェクト: zhangtianshan/ice-demos
    public override void updateContact(string name, Ice.Optional <Demo.NumberType> type, Ice.Optional <string> number,
                                       Ice.Optional <int> dialGroup, Ice.Current current)
    {
        Contact c;

        if (_contacts.TryGetValue(name, out c))
        {
            if (type.HasValue)
            {
                c.type = type;
            }
            if (number.HasValue)
            {
                c.number = number;
            }
            if (dialGroup.HasValue)
            {
                c.dialGroup = dialGroup;
            }
        }
    }
コード例 #29
0
ファイル: TestAMDI.cs プロジェクト: zhoushiyi/ice
 sendOptionalClassAsync(bool req, Ice.Optional <OneOptional> o, Ice.Current current)
 {
     return(null);
 }
コード例 #30
0
 opMG2(Ice.Optional <Test.G> p1, Ice.Current current)
 {
     return(new Test.Initial_OpMG2MarshaledResult(p1, p1, current));
 }