+ /*!
+ \class SALOME::GenericObj_i
+ \brief Implementation of the base servant for SALOME objects with reference counter.
+
+ This class can be used to implement data entities with life-cycle management based on
+ the reference counting.
+
+ The object is initially created with the reference counter equal to 1.
+ The function Register() can be used to incrfement the reference counter.
+ Function UnRegister() should be used to decrement reference counter.
+ As soon as reference counter goes to zero, the object is automatically deactivated in POA
+ (and, eventually its destructor is automatically called).
+ */
+
+ /*!
+ \brief Constructor.
+ Creates an object with the reference counter initially set to 1.
+
+ The default POA for the servant can be passed as a parameter \a thePOA.
+ By default, root POA is used.
+
+ \param thePOA optional default POA for the servant
+ */
+ GenericObj_i::GenericObj_i(PortableServer::POA_ptr thePOA): myRefCounter(1)
+ {
+ if(MYDEBUG)
+ MESSAGE("GenericObj_i::GenericObj_i() - this = "<<this<<
+ "; CORBA::is_nil(thePOA) = "<<CORBA::is_nil(thePOA));
+ if(CORBA::is_nil(thePOA)) {
+#ifndef WIN32
+ myPOA = PortableServer::ServantBase::_default_POA();
+#else
+ myPOA = ServantBase::_default_POA();
+#endif
+ }
+ else {
+ myPOA = PortableServer::POA::_duplicate(thePOA);
+ }
+ if(MYDEBUG)
+ MESSAGE("GenericObj_i::GenericObj_i thePOA: " << thePOA << " myPOA: " << myPOA);
+ }