| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| 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 |
|
#2
| |||
| |||
| 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 |
|
#3
| |||
| |||
| 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 |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.