duhber / rcf-cpp

Automatically exported from code.google.com/p/rcf-cpp
0 stars 0 forks source link

define Interface para with const failed #25

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi, Jarl
Recently, I upgrade my code from RCF0.9 to RCF1.1, I find a problem.

I define a interface below:
RCF_METHOD_R2(int,RCF_GetPartInfo,const vector<int>&,CPartInfoArray&);

when I call this method, I get a error:
Thread-id=5252 : Timestamp(ms)=72203: THROW : class RCF::Exception : [57: 
Input data format error.][0: No sub system.][0: ][What: ][Context: ]: 
byte=, 

I try to debug this problem, I find the const parameter is also serialized 
and sent to client when the server implementation has done(sever return 
result to client).But the client just deserialize the out and return 
Type.That's weird.

Then I change the const vector<int>& to vector<int>& , it works fine.
I try other interfaces with const parameter, they have the same error as 
described before.
PS:
RCF_METHOD_R2(int,RCF_GetPartInfo,const vector<int>&,CPartInfoArray&);
s interface works fine with RCF0.9.

How to fix my probelm? Thanks very much.

What steps will reproduce the problem?

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?
WinXP VC6.0 SP6 boost1.33

Please provide any additional information below.
1)In server side , I used RCF::SessionObjectFactoryServicePtr to create 
server object.
2)And I build with these preprocessor definitions:
WIN32,_DEBUG,_WINDOWS,_MBCS,_USRDLL,RCFSERIALIZEDLL_EXPORTS,_WINSOCKAPI_,RC
F_MULTI_THREADED,RCF_RCF_USE_SF_SERIALIZATION,_DLL,_WIN32_WINNT=0x0500,WIN3
2_LEAN_AND_MEAN

in attachments, the interface is 
RCF_METHOD_R2(int, RCF_GetAlarmCase, const ALARMCASEFILTER&, 
ALARMCASE_VCT&);
you can see in response(see call stack),the ALARMCASEFILTER has been 
serialized.
Erro Info:
Thread-id=3088 : Timestamp(ms)=52203: THROW : class RCF::Exception : [57: 
Input data format error.][0: No sub system.][0: ][What: no end symbol]
[Context: ]:  

Original issue reported on code.google.com by lor...@126.com on 1 Feb 2010 at 7:31

Attachments:

GoogleCodeExporter commented 9 years ago
such interface will be OK
RCF_METHOD_R1(int, RCF_AddAlarmCase, const ALARMCASE&);

it seems like if interface has out para and const para&, there will have Input 
data 
format error.

Original comment by lor...@126.com on 1 Feb 2010 at 8:51

GoogleCodeExporter commented 9 years ago

Thanks for the detailed error report - the information was very helpful.

I've done some digging and it turns out that this will only happen when Visual 
C++ 6 
is used with Boost 1.33. Visual C++ 6 with Boost 1.34 or later is fine, and 
other 
compilers with boost 1.33 are fine.

I will update RCF 1.2 to fix this. In the mean time, with RCF 1.1, if you 
locate 
this code in Marshal.hpp:919

    template<typename T>
    struct IsOutParameter
    {
        typedef typename
        boost::mpl::and_<
            boost::is_reference<T>,
            boost::mpl::not_< 
                boost::is_const< 
                    typename boost::remove_reference<T>::type
                > 
            > 
        >::type type;
        enum { value = type::value };
    };

, and change it to:

    template<typename T>
    struct IsOutParameter
    {
        typedef typename
        boost::mpl::and_<
            IsReference<T>,
            boost::mpl::not_< 
                boost::is_const< 
                    typename RemoveReference<T>::type
                > 
            > 
        >::type type;
        enum { value = type::value };
    };

, it should work better.

Original comment by jarl.lin...@gmail.com on 5 Feb 2010 at 5:02

GoogleCodeExporter commented 9 years ago

Original comment by jarl.lin...@gmail.com on 14 Feb 2010 at 9:16

GoogleCodeExporter commented 9 years ago

Original comment by jarl.lin...@gmail.com on 16 Feb 2010 at 2:38