⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 twowaysami.cpp

📁 ICE-3.2 一个开源的中间件
💻 CPP
📖 第 1 页 / 共 3 页
字号:
    virtual void ice_response(const ::Test::ByteSS& rso, const ::Test::ByteSS& bso)    {        test(bso.size() == 2);        test(bso[0].size() == 1);        test(bso[0][0] == Ice::Byte(0xff));        test(bso[1].size() == 3);        test(bso[1][0] == Ice::Byte(0x01));        test(bso[1][1] == Ice::Byte(0x11));        test(bso[1][2] == Ice::Byte(0x12));        test(rso.size() == 4);        test(rso[0].size() == 3);        test(rso[0][0] == Ice::Byte(0x01));        test(rso[0][1] == Ice::Byte(0x11));        test(rso[0][2] == Ice::Byte(0x12));        test(rso[1].size() == 1);        test(rso[1][0] == Ice::Byte(0xff));        test(rso[2].size() == 1);        test(rso[2][0] == Ice::Byte(0x0e));        test(rso[3].size() == 2);        test(rso[3][0] == Ice::Byte(0xf2));        test(rso[3][1] == Ice::Byte(0xf1));        called();    }    virtual void ice_exception(const ::Ice::Exception&)    {        test(false);    }};typedef IceUtil::Handle<AMI_MyClass_opByteSSI> AMI_MyClass_opByteSSIPtr;class AMI_MyClass_opBoolSSI : public Test::AMI_MyClass_opBoolSS, public CallbackBase{public:    virtual void ice_response(const ::Test::BoolSS&, const ::Test::BoolSS& bso)    {        called();    }    virtual void ice_exception(const ::Ice::Exception&)    {        test(false);    }};typedef IceUtil::Handle<AMI_MyClass_opBoolSSI> AMI_MyClass_opBoolSSIPtr;class AMI_MyClass_opShortIntLongSSI : public Test::AMI_MyClass_opShortIntLongSS, public CallbackBase{public:    virtual void ice_response(const ::Test::LongSS&, const ::Test::ShortSS&, const ::Test::IntSS&,                              const ::Test::LongSS&)    {        called();    }    virtual void ice_exception(const ::Ice::Exception&)    {        test(false);    }};typedef IceUtil::Handle<AMI_MyClass_opShortIntLongSSI> AMI_MyClass_opShortIntLongSSIPtr;class AMI_MyClass_opFloatDoubleSSI : public Test::AMI_MyClass_opFloatDoubleSS, public CallbackBase{public:    virtual void ice_response(const ::Test::DoubleSS& rso, const ::Test::FloatSS& fso, const ::Test::DoubleSS& dso)    {        test(fso.size() == 3);        test(fso[0].size() == 1);        test(fso[0][0] == ::Ice::Float(3.14));        test(fso[1].size() == 1);        test(fso[1][0] == ::Ice::Float(1.11));        test(fso[2].size() == 0);        test(dso.size() == 1);        test(dso[0].size() == 3);        test(dso[0][0] == ::Ice::Double(1.1E10));        test(dso[0][1] == ::Ice::Double(1.2E10));        test(dso[0][2] == ::Ice::Double(1.3E10));        test(rso.size() == 2);        test(rso[0].size() == 3);        test(rso[0][0] == ::Ice::Double(1.1E10));        test(rso[0][1] == ::Ice::Double(1.2E10));        test(rso[0][2] == ::Ice::Double(1.3E10));        test(rso[1].size() == 3);        test(rso[1][0] == ::Ice::Double(1.1E10));        test(rso[1][1] == ::Ice::Double(1.2E10));        test(rso[1][2] == ::Ice::Double(1.3E10));        called();    }    virtual void ice_exception(const ::Ice::Exception&)    {        test(false);    }};typedef IceUtil::Handle<AMI_MyClass_opFloatDoubleSSI> AMI_MyClass_opFloatDoubleSSIPtr;class AMI_MyClass_opStringSSI : public Test::AMI_MyClass_opStringSS, public CallbackBase{public:    virtual void ice_response(const ::Test::StringSS& rso, const ::Test::StringSS& sso)    {        test(sso.size() == 5);        test(sso[0].size() == 1);        test(sso[0][0] == "abc");        test(sso[1].size() == 2);        test(sso[1][0] == "de");        test(sso[1][1] == "fghi");        test(sso[2].size() == 0);        test(sso[3].size() == 0);        test(sso[4].size() == 1);        test(sso[4][0] == "xyz");        test(rso.size() == 3);        test(rso[0].size() == 1);        test(rso[0][0] == "xyz");        test(rso[1].size() == 0);        test(rso[2].size() == 0);        called();    }    virtual void ice_exception(const ::Ice::Exception&)    {        test(false);    }};typedef IceUtil::Handle<AMI_MyClass_opStringSSI> AMI_MyClass_opStringSSIPtr;class AMI_MyClass_opByteBoolDI : public Test::AMI_MyClass_opByteBoolD, public CallbackBase{public:    virtual void ice_response(const ::Test::ByteBoolD& ro, const ::Test::ByteBoolD& _do)    {        Test::ByteBoolD di1;        di1[10] = true;        di1[100] = false;        test(_do == di1);        test(ro.size() == 4);        test(ro.find(10) != ro.end());        test(ro.find(10)->second == true);        test(ro.find(11) != ro.end());        test(ro.find(11)->second == false);        test(ro.find(100) != ro.end());        test(ro.find(100)->second == false);        test(ro.find(101) != ro.end());        test(ro.find(101)->second == true);        called();    }    virtual void ice_exception(const ::Ice::Exception&)    {        test(false);    }};typedef IceUtil::Handle<AMI_MyClass_opByteBoolDI> AMI_MyClass_opByteBoolDIPtr;class AMI_MyClass_opShortIntDI : public Test::AMI_MyClass_opShortIntD, public CallbackBase{public:    virtual void ice_response(const ::Test::ShortIntD& ro, const ::Test::ShortIntD& _do)    {        Test::ShortIntD di1;        di1[110] = -1;        di1[1100] = 123123;        test(_do == di1);        test(ro.size() == 4);        test(ro.find(110) != ro.end());        test(ro.find(110)->second == -1);        test(ro.find(111) != ro.end());        test(ro.find(111)->second == -100);        test(ro.find(1100) != ro.end());        test(ro.find(1100)->second == 123123);        test(ro.find(1101) != ro.end());        test(ro.find(1101)->second == 0);        called();    }    virtual void ice_exception(const ::Ice::Exception&)    {        test(false);    }};typedef IceUtil::Handle<AMI_MyClass_opShortIntDI> AMI_MyClass_opShortIntDIPtr;class AMI_MyClass_opLongFloatDI : public Test::AMI_MyClass_opLongFloatD, public CallbackBase{public:    virtual void ice_response(const ::Test::LongFloatD& ro, const ::Test::LongFloatD& _do)    {        Test::LongFloatD di1;        di1[999999110] = Ice::Float(-1.1);        di1[999999111] = Ice::Float(123123.2);        test(_do == di1);        test(ro.size() == 4);        test(ro.find(999999110) != ro.end());        test(ro.find(999999110)->second == Ice::Float(-1.1));        test(ro.find(999999120) != ro.end());        test(ro.find(999999120)->second == Ice::Float(-100.4));        test(ro.find(999999111) != ro.end());        test(ro.find(999999111)->second == Ice::Float(123123.2));        test(ro.find(999999130) != ro.end());        test(ro.find(999999130)->second == Ice::Float(0.5));        called();    }    virtual void ice_exception(const ::Ice::Exception&)    {        test(false);    }};typedef IceUtil::Handle<AMI_MyClass_opLongFloatDI> AMI_MyClass_opLongFloatDIPtr;class AMI_MyClass_opStringStringDI : public Test::AMI_MyClass_opStringStringD, public CallbackBase{public:    virtual void ice_response(const ::Test::StringStringD& ro, const ::Test::StringStringD& _do)    {        Test::StringStringD di1;        di1["foo"] = "abc -1.1";        di1["bar"] = "abc 123123.2";        test(_do == di1);        test(ro.size() == 4);        test(ro.find("foo") != ro.end());        test(ro.find("foo")->second == "abc -1.1");        test(ro.find("FOO") != ro.end());        test(ro.find("FOO")->second == "abc -100.4");        test(ro.find("bar") != ro.end());        test(ro.find("bar")->second == "abc 123123.2");        test(ro.find("BAR") != ro.end());        test(ro.find("BAR")->second == "abc 0.5");        called();    }    virtual void ice_exception(const ::Ice::Exception&)    {        test(false);    }};typedef IceUtil::Handle<AMI_MyClass_opStringStringDI> AMI_MyClass_opStringStringDIPtr;class AMI_MyClass_opStringMyEnumDI : public Test::AMI_MyClass_opStringMyEnumD, public CallbackBase{public:    virtual void ice_response(const ::Test::StringMyEnumD& ro, const ::Test::StringMyEnumD& _do)    {        Test::StringMyEnumD di1;        di1["abc"] = Test::enum1;        di1[""] = Test::enum2;        test(_do == di1);        test(ro.size() == 4);        test(ro.find("abc") != ro.end());        test(ro.find("abc")->second == Test::enum1);        test(ro.find("qwerty") != ro.end());        test(ro.find("qwerty")->second == Test::enum3);        test(ro.find("") != ro.end());        test(ro.find("")->second == Test::enum2);        test(ro.find("Hello!!") != ro.end());        test(ro.find("Hello!!")->second == Test::enum2);        called();    }    virtual void ice_exception(const ::Ice::Exception&)    {        test(false);    }};typedef IceUtil::Handle<AMI_MyClass_opStringMyEnumDI> AMI_MyClass_opStringMyEnumDIPtr;class AMI_MyClass_opIntSI : public Test::AMI_MyClass_opIntS, public CallbackBase{public:    AMI_MyClass_opIntSI(int l) : _l(l) {}    virtual void ice_response(const Test::IntS& r)    {        test(r.size() == static_cast<size_t>(_l));        for(int j = 0; j < _l; ++j)        {            test(r[j] == -j);        }        called();    }    virtual void ice_exception(const ::Ice::Exception&)    {        test(false);    }private:    int _l;};typedef IceUtil::Handle<AMI_MyClass_opIntSI> AMI_MyClass_opIntSIPtr;class AMI_MyClass_opContextEqualI : public Test::AMI_MyClass_opContext, public CallbackBase{public:    AMI_MyClass_opContextEqualI(const Test::StringStringD &d) : _d(d)    {    }    virtual void ice_response(const Test::StringStringD& r)    {        test(r == _d);        called();    }    virtual void ice_exception(const ::Ice::Exception&)    {        test(false);    }private:    Test::StringStringD _d;};typedef IceUtil::Handle<AMI_MyClass_opContextEqualI> AMI_MyClass_opContextEqualIPtr;class AMI_MyClass_opContextNotEqualI : public Test::AMI_MyClass_opContext, public CallbackBase{public:    AMI_MyClass_opContextNotEqualI(const Test::StringStringD &d) : _d(d)    {    }    virtual void ice_response(const Test::StringStringD& r)    {        test(r != _d);        called();    }    virtual void ice_exception(const ::Ice::Exception&)    {        test(false);    }private:    Test::StringStringD _d;};typedef IceUtil::Handle<AMI_MyClass_opContextNotEqualI> AMI_MyClass_opContextNotEqualIPtr;class AMI_MyDerivedClass_opDerivedI : public Test::AMI_MyDerivedClass_opDerived, public CallbackBase{public:    virtual void ice_response()    {        called();    }    virtual void ice_exception(const ::Ice::Exception&)    {        test(false);    }};typedef IceUtil::Handle<AMI_MyDerivedClass_opDerivedI> AMI_MyDerivedClass_opDerivedIPtr;class AMI_MyClass_opDoubleMarshalingI : public Test::AMI_MyClass_opDoubleMarshaling, public CallbackBase{public:    virtual void ice_response()    {        called();    }    virtual void ice_exception(const ::Ice::Exception& ex)    {        test(false);    }};typedef IceUtil::Handle<AMI_MyClass_opDoubleMarshalingI> AMI_MyClass_opDoubleMarshalingIPtr;voidtwowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p){    {        // Check that a call to a void operation raises TwowayOnlyException        // in the ice_exception() callback instead of at the point of call.        Test::MyClassPrx oneway = Test::MyClassPrx::uncheckedCast(p->ice_oneway());        AMI_MyClass_opVoidExIPtr cb = new AMI_MyClass_opVoidExI;        try {            oneway->opVoid_async(cb);        }        catch(const Ice::Exception&)        {            test(false);        }        test(cb->check());    }    {        // Check that a call to a twoway operation raises TwowayOnlyException        // in the ice_exception() callback instead of at the point of call.        Test::MyClassPrx oneway = Test::MyClassPrx::uncheckedCast(p->ice_oneway());        AMI_MyClass_opByteExIPtr cb = new AMI_MyClass_opByteExI;        try        {            oneway->opByte_async(cb, 0, 0);        }        catch(const Ice::Exception&)        {            test(false);        }        test(cb->check());    }    {        AMI_MyClass_opVoidIPtr cb = new AMI_MyClass_opVoidI;        p->opVoid_async(cb);        test(cb->check());        // Let's check if we can reuse the same callback object for another call.        p->opVoid_async(cb);        test(cb->check());    }    {        AMI_MyClass_opByteIPtr cb = new AMI_MyClass_opByteI;        p->opByte_async(cb, Ice::Byte(0xff), Ice::Byte(0x0f));        test(cb->check());    }    {        AMI_MyClass_opBoolIPtr cb = new AMI_MyClass_opBoolI;        p->opBool_async(cb, true, false);        test(cb->check());    }    {        AMI_MyClass_opShortIntLongIPtr cb = new AMI_MyClass_opShortIntLongI;        p->opShortIntLong_async(cb, 10, 11, 12);        test(cb->check());    }    {        AMI_MyClass_opFloatDoubleIPtr cb = new AMI_MyClass_opFloatDoubleI;        p->opFloatDouble_async(cb, Ice::Float(3.14), Ice::Double(1.1E10));        test(cb->check());        // Let's check if we can reuse the same callback object for another call.        p->opFloatDouble_async(cb, Ice::Float(3.14), Ice::Double(1.1E10));        test(cb->check());    }    {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -