[omniORB] operator * for _var types?

Clarke Brunt clarke.brunt at trafficmaster.co.uk
Thu Jul 24 15:17:16 BST 2008


From: Michael Teske [mailto:mteske-csk at t-online.de] 

>This is not exactly where it's used in our code, I probably
oversimplified.
>What is done in our code is, suppose you have a function
>
>void foo (const X::Y &x)
>{
>// whatever
>}
>
>and a
>X::Y_var y;
>one would call
>foo(*y);
>
>here
>foo(y) compiles as well.
>
>another example is if X::Y is a sequence type, I see
>(*y)[n] being used a lot...
>
>But anyway, if this is really nonstandard, I'll have to change the code
in question.

Indeed. Both those uses of '*' are unusual. The _var types are designed
to make standard CORBA argument-passing easy, without the need for extra
'*' or '&'.

And for the sequence example, if you had an actual pointer to an array,
you'd use it with [] without dereferencing it first - same with the
_var.

Jonathan Biggar mentions using the in() method of the _var to
'dereference' it. I didn't mention it myself yesterday because in my
mind I thought that an 'in' struct parameter was passed as 'const S*',
but of course it's 'const S&', so in() (designed for use when you want
an 'in' parameter, but your compiler won't cooperate) is just what's
wanted.

Your 'foo' function above has the same signature are a real CORBA
implementation function, taking the struct as an 'in' arg. Therefore
foo(y), or foo(y.in()) if needed, are correct whether calling the
function internally, or calling a similar CORBA method.

Clarke Brunt
TRAFFICMASTER PLC
UNIT 22 / ST. JOHN'S INNOVATION CENTRE
COWLEY ROAD / CAMBRIDGE / CB4 0WS
T: 01223 422469
F: 
E: clarke.brunt at trafficmaster.co.uk

 
Please consider the environment before printing this email. --------------------------------------------------------

Trafficmaster PLC is a limited Company registered in England and Wales.
Registered number: 2292714   Registered office: Martell House, University Way, Cranfield, BEDS. MK43 0TR
 
This message (and any associated files) is intended only for the use of omniorb-list at omniorb-support.com and may contain information that is confidential, subject to copyright or constitutes a trade secret. If you are not omniorb-list at omniorb-support.com you are hereby notified that any dissemination, copying or distribution of this message, or files associated with this message, is strictly prohibited. If you have received this message in error, please notify us immediately by replying to the message and deleting it from your computer. Any views or opinions presented are solely those of the author clarke.brunt at trafficmaster.co.uk and do not necessarily represent those of the company.
 
Warning: Although the company has taken reasonable precautions to ensure no viruses are present in this email, the company cannot accept responsibility for any loss or damage arising from the use of this email or attachments.
--------------------------------------------------------



More information about the omniORB-list mailing list