T.R | Title | User | Personal Name | Date | Lines |
---|
2473.1 | how about using a sequence (basically a variable size array) instead? | VAXCPU::michaud | Jeff Michaud - ObjectBroker | Thu May 01 1997 13:00 | 28 |
| > interface Bar {
> typedef octet buf[1000];
>
> long Read(out buf b);
> };
I don't have answers for the core dumps, but I do have a question
and possible suggestion that may end up working around the problem.
It looks like you are trying to mimic the read() system call? And
the return value of Bar::Read is the length of how much was actaully
read (ie. how much of "buf" is actually valid data)?
If the answer is "yes", then using a fixed length array as a
parameter (in or out) will result in a 1,000 octet array being
marshalled and passed across the wire, and unmarshalled, even
though only 10 octets are valid.
If you instead used a sequence, it would not only be more efficient
(as far as how many octets are being transfered), but Bar::Read also
would then not be limited by the "max" (ie. 1,000 octets) it could
return (unless you define it to be a bounded sequence). Ex.
interface Bar {
typedef sequence<octet> buf;
void Read(out buf b);
};
|
2473.2 | blobs | NNTPD::"[email protected]" | Paul Healy | Thu May 01 1997 13:47 | 10 |
| Thanks for the suggestion. The point of the read method is to move
binary large objects (10MB-100MB+), so a couple of k at the end
wasn't an issue.
I stayed away from sequences for this because of the element by
element access limitation (operator[]). But right now I would be
happy to have anything working..!
Paul
[Posted by WWW Notes gateway]
|
2473.3 | You could code in C instead :-) | VAXCPU::michaud | Jeff Michaud - ObjectBroker | Thu May 01 1997 21:17 | 20 |
| > I stayed away from sequences for this because of the element by
> element access limitation (operator[]).
Hmm, you're right, the C++ language binding does not allow the
user to get directly at the array (at least not portably :-),
you can only do it using the C language binding. Another OMG
oversight I guess as one of the generated constructors takes
an array :-(
If you wanted to do something non-portable, you could edit the
generated include file and make the "T *_data" member public, or
get a the pointer to the array by taking the address of the first
sequence element, ie.
&foo[0]
where foo is an instance of your octet sequence.
Luckily no hacking is needed to convert an array into a sequence
using the appropriate generated constructor.
|