cpp:array for output parameters

jafontjafont Member Juan Angel Font BanegasOrganization: University of Castilla la ManchaProject: Practices for subject in Master in Computer Science

Hi,

I am using the metadata directive cpp::array for output parameters, but the generated code is not as expected.

Zeroc-Ice version is 3.5.1, for C++.

The interface definition is:

module A {
sequence ByteSeq;

long readFromFile( string fileName, long offset, long numBytes, out ["cpp:array"] ByteSeq data, out bool eof );

};

The generated code for operation readFromFile is:
virtual ::Ice::Long readFromFile( const ::std::string&, ::ice::Long, ::Ice::Long, ::A::ByteSeq&, bool &, const ::Ice::Current& = ::Ice::Current()) = 0;

Instead, I was expecting the following (due to ["cpp:array"] ):
virtual ::Ice::Long readFromFile( const ::std::string&, ::ice::Long, ::Ice::Long, ::std::pair<::Ice::Byte*, ::Ice::Byte*>&, bool &, const ::Ice::Current& = ::Ice::Current()) = 0;

According to Zeroc-Ice 3.5.1 documentation, ["cpp:array"] can be applied to both input and output parameters.

Why is not the code generated as expected?

Kind regards.

Tagged:

Best Answer

  • xdmxdm ZeroC Staff La Coruña, SpainJose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Accepted Answer

    Hi Juan,

    The array mapping is only used for out parameters of AMI and AMD operations as noted in the documentation

    The array mapping for sequences applies to input parameters and to out parameters of AMI and AMD operations.

    In your case readFromFile is a synchronous method (non AMD) and so the array mapping doesn't apply here.

Answers

  • xdmxdm ZeroC Staff La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Accepted Answer

    Hi Juan,

    The array mapping is only used for out parameters of AMI and AMD operations as noted in the documentation

    The array mapping for sequences applies to input parameters and to out parameters of AMI and AMD operations.

    In your case readFromFile is a synchronous method (non AMD) and so the array mapping doesn't apply here.

Sign In or Register to comment.