[omniORB] How to init a tie pointer safely

Haarek Ryeng Haarek.Ryeng@datarespons.no
Fri, 03 Dec 1999 10:09:17 +0100


This is a multi-part message in MIME format.
--------------A6E96E1332FEF58FD1A5C57D
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit

What is the preferred way to initialise a pointer to a
tie-class?
And how do I maintain this pointer safely?

Ex:
Tie-class: _tie_A<A_i*,false>
Impl-class: A_i

class A_i
{
    // some defs......
    _tie_A< A_i*,false >* _p;
};

A_i::A_i()
{
   _p = NULL // Alright?
}

A_i::InterfaceFactory()
{
  if ( CORBA::is_nil(_p->-this()) ) // Is this the safe way
to check
                                   //for a valid interface
through the tie pointer?
  {
     try
     {
          _p = new _tie_A<A_i*,false>(this);
          boa->obj_is_ready(_p);
      }
     catch( bad_alloc)
     {
        _p = ?  // What do I initialise it to so that the
above “is_nil”
                    //check is safe?
     }
  }// end if
}// end factory function

Any comments?

Regards,

Haarek Ryeng


--------------A6E96E1332FEF58FD1A5C57D
Content-Type: text/x-vcard; charset=us-ascii;
 name="haarek.ryeng.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Hårek Ryeng
Content-Disposition: attachment;
 filename="haarek.ryeng.vcf"

begin:vcard 
adr;dom:;;;N-1322 HØVIK;;;
n:Ryeng;Hårek
x-mozilla-html:FALSE
org:Data Respons AS
version:2.1
email;internet:haarek.ryeng@datarespons.no
title:M.sci (computers & signal processing)
tel;fax:67112050
tel;home:90196734
tel;work:67112071
x-mozilla-cpt:;0
fn:Hårek Ryeng
end:vcard

--------------A6E96E1332FEF58FD1A5C57D--