|
|
|
|||||
|
effects of C++ Array Mapping for Sequences
Hello all,
I'm concerned about the impact of metadata directives. Suppose my server has a method defined as interface File { void write(["cpp:array"] Ice::ByteSeq contents); }; my questions are: 1. If my client application is also written in C++, does that mean my client program has to pass an array when invoking this method? Can my client use a separate slice definition without the "cpp:array" directive to make the call? I.e., can my client use the C++ code generated from the slice definition void write(Ice::ByteSeq contents) ? 2. What if my client application is written in other languages? If the answer to the previous question is no problem, I guess there's no problem here either. 3. can I have multiple metadata directives for different languages? for example, void write(["cpp:array"]["java:type:java.util.ArrayList"] Ice::ByteSeq contents); 4. If the answer to the first question is no problem, can my server just use a derived interface with an overidden method in implementation without changing the overall slice interface definition? What I mean is: interface File { void write(Ice::ByteSeq contents); }; interface ServerIFile extends File { void write(["cpp:type:std::list"] Ice::ByteSeq contents); }; interface ServerIIFile extends File { void write(["cpp:array"] Ice::ByteSeq contents); }; while my client program only know the first definition. I guess the answer would be no for my last question. Last edited by smu : 01-10-2007 at 08:59 PM. |
|
|||||
|
Thanks Marc! That helps a lot.
Actually the reason I asked those question is that I saw the following paragraph on page 344 of Ice 3.1.1 Documentation. I'm not familiar with java but it seemed like the client needed to follow the metadata directive of server interface definition: Quote:
By the way, a non-technical issue of your forum registration form: "If you were referred to this site by an existing member of ZeroC Forums, enter their name here." I though it was cool that you could directly look up the name for me , but it turns out I should input their username here, not the actual name.Thanks again, Shang |
|
||||||
|
The client and server contract is not affected by Slice metadata. In general, given a Slice definition, you can add, change, or delete whatever metadata you like on just the client side, just the server side, or both, and the data that is sent over the wire does not change. In other words, changes to metadata never invalidate the client-server contract.
However, many metadata directives affect the APIs. So, for example, if you use metadata to change the type of a parameter from an array to a list, you will need to pass the correct type. However, the client choose to pass the parameter as an array, and the server can choose to receive as a list. To do that, simply compile client and server with the same Slice definitions, except with the metadata directive changed as appropriate. Cheers, Michi. |
|
|||||
|
Another question:
can array mapping be nested in other definitions? sequence<byte> ImageData; sequence<["cpp:array"]ImageData> MultiImages; interface I { MultiImages GetImages(); } Is that legal? in the sense of nesting and in the sense of "array mapping for sequences applies to input parameters and to out parameters of AMI and AMD operations" Thank you all! Shang |
|
||||||
|
Quote:
Code:
["cpp:type:std::list< ::Ice::Byte>"] sequence<byte> ImageData;
sequence<ImageData> MultiImages;
Dwayne |
|
||||||
|
The reason for disallowing such nested definitions is that it greatly complicates language mappings. There are all sorts of corner cases that need to be dealt with, such as anonymous types, scoping conflicts, etc. The bottom line is that the feature simply isn't worth the trouble.
Cheers, Michi. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| No sequences of objects in Ice-E? | bartley | Help Center | 5 | 05-30-2006 06:44 PM |
| Memory problem using dictionary or array as parameters | enrico | Help Center | 6 | 03-27-2006 12:35 PM |
| Slice and array??? | surfer | Help Center | 4 | 11-14-2005 10:11 AM |
| how to pass binary char array to remote host efficiatively? | socketref | Help Center | 7 | 09-18-2005 11:15 AM |
| slice array type mapping to c++ | yomi | Help Center | 2 | 04-05-2004 12:32 AM |