Archived

This forum has been archived. Please start a new discussion on GitHub.

cpp:array for output parameters

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:

Comments

  • xdm
    xdm La Coruña, Spain

    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.