help on difference between _ptr and _var?

This is a discussion on help on difference between _ptr and _var? within the Object forums in Theory and Concepts category; Hi, I am a new corba learner. While learning, I don not know when to use _ptr variable and when to use _var variable. I want to know the differences between these two types of variables and when to use _ptr or _var. Could you help me? Yours, Jesse...

Go Back   Application Development Forum > Theory and Concepts > Object

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 10-09-2003, 10:02 AM
Jesse
Guest
 
Default help on difference between _ptr and _var?

Hi,

I am a new corba learner. While learning, I don not know when to use
_ptr variable and when to use _var variable. I want to know the
differences between these two types of variables and when to use _ptr
or _var.

Could you help me?

Yours, Jesse
Reply With Quote
  #2  
Old 10-09-2003, 10:34 AM
Douglas C. Schmidt
Guest
 
Default Re: help on difference between _ptr and _var?

Hi Jesse,

>> I am a new corba learner. While learning, I don not know when to use
>> _ptr variable and when to use _var variable. I want to know the
>> differences between these two types of variables and when to use _ptr
>> or _var.
>>
>> Could you help me?


This topic (and many others) is covered in detail in the classic book
"Advanced CORBA Programming with C++" by Henning and Vinoski. I
recommend that you purchase this book since it'll help address MANY of
your issues/question with CORBA. In the meantime, here's a brief
summary:

An IDL compiler generates two different object reference types for
each interface:

.. <interface>_ptr} -> C++ pointer to object reference

. An ``unmanaged type'' that requires programmers to manipulate
reference ownership via <proxy>::_duplicate() and
CORBA::release()

.. <interface>_var -> ``Smart pointer'' to object reference

. Manages reference lifetime by assuming ownership of dynamically
allocated memory and deallocating it when the _var goes out
of scope

. operator->() delegates to the underlying pointer value
. _var types are essential for writing exception-safe code


Take care,

Doug
--
Dr. Douglas C. Schmidt, Professor TEL: (615) 343-8197
Electrical Engineering and Computer Science FAX: (615) 343-7440
Vanderbilt University WEB: www.cs.wustl.edu/~schmidt/
Nashville, TN 37203 NET: d.schmidt@vanderbilt.edu
Reply With Quote
  #3  
Old 10-10-2003, 10:48 AM
Jesse
Guest
 
Default Re: help on difference between _ptr and _var?

Dear Sir,

Thank you for your kind help!

yours,
Jesse

schmidt@ace.cs.wustl.edu (Douglas C. Schmidt) wrote in message news:<bm3rlv$g4o@ace.cs.wustl.edu>...
> Hi Jesse,
>
> >> I am a new corba learner. While learning, I don not know when to use
> >> _ptr variable and when to use _var variable. I want to know the
> >> differences between these two types of variables and when to use _ptr
> >> or _var.
> >>
> >> Could you help me?

>
> This topic (and many others) is covered in detail in the classic book
> "Advanced CORBA Programming with C++" by Henning and Vinoski. I
> recommend that you purchase this book since it'll help address MANY of
> your issues/question with CORBA. In the meantime, here's a brief
> summary:
>
> An IDL compiler generates two different object reference types for
> each interface:
>
> . <interface>_ptr} -> C++ pointer to object reference
>
> . An ``unmanaged type'' that requires programmers to manipulate
> reference ownership via <proxy>::_duplicate() and
> CORBA::release()
>
> . <interface>_var -> ``Smart pointer'' to object reference
>
> . Manages reference lifetime by assuming ownership of dynamically
> allocated memory and deallocating it when the _var goes out
> of scope
>
> . operator->() delegates to the underlying pointer value
> . _var types are essential for writing exception-safe code
>
>
> Take care,
>
> Doug

Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 08:02 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.