SObject and SComponent, all Attributes, SComponentIterator, ChildIterator, UseCaseIterator and UseCaseBuilder classes now inherit GenericObj class. Thus, servants of these classes now destroyed by common CORBA algorithm (by calling Destroy method in the Client-classes destructors)
#define _SALOMEDS_IDL_
#include "SALOME_Exception.idl"
+#include "SALOME_GenericObj.idl"
/*!
This package contains the interfaces used for creation, managment
*/
//==========================================================================
- interface SObject
+ interface SObject : SALOME::GenericObj
{
/*! Name of the %SObject
*/
%Generic attribute is a base interface for all attributes which can be assigned to the SObjects created in the study.
*/
//==========================================================================
- interface GenericAttribute
+ interface GenericAttribute : SALOME::GenericObj
{
/*! \brief Exception locking all changes
The search is started from the first %SComponent in the list.
*/
//==========================================================================
- interface SComponentIterator
+ interface SComponentIterator : SALOME::GenericObj
{
/*!
Activates the %SComponentIterator.
levels.
*/
//==========================================================================
- interface ChildIterator
+ interface ChildIterator : SALOME::GenericObj
{
/*!
This interface contains a set of methods used for iteration over the objects in the use case.
*/
- interface UseCaseIterator
+ interface UseCaseIterator : SALOME::GenericObj
{
/*!
Activates the %UseCaseIterator.
Use case in the study represents a user-managed subtree, containing all or some of the objects which exist in the study.
The %UseCaseBuilder interface contains a set of methods used for management of the use case in the study.
*/
- interface UseCaseBuilder
+ interface UseCaseBuilder : SALOME::GenericObj
{
/*!
Adds to the use case an object as a child of the current object of the use case.
# Executables targets
BIN = SALOMEDS_Server SALOMEDS_Client
BIN_SRC =
-LIB_SERVER_IDL = SALOMEDS.idl SALOMEDS_Attributes.idl SALOME_Exception.idl
+LIB_SERVER_IDL = SALOMEDS.idl SALOMEDS_Attributes.idl SALOME_Exception.idl SALOME_GenericObj.idl
BIN_SERVER_IDL = SALOMEDS.idl SALOMEDS_Attributes.idl
BIN_CLIENT_IDL =
CPPFLAGS+=$(OCC_INCLUDES) $(HDF5_INCLUDES)
CXXFLAGS+=$(OCC_CXXFLAGS)
-LDFLAGS+= $(HDF5_LIBS) -lTOOLSDS -lSalomeNS -lSalomeHDFPersist -lOpUtil -lSALOMELocalTrace -lSalomeDSImpl $(CAS_LDPATH) -lTKCAF -lTKBO -lTKStdSchema -lSalomeGenericObj -lSalomeLifeCycleCORBA
+LDFLAGS+= $(HDF5_LIBS) -lTOOLSDS -lSalomeNS -lSalomeHDFPersist -lOpUtil -lSALOMELocalTrace -lSalomeDSImpl -lSalomeGenericObj $(CAS_LDPATH) -lTKCAF -lTKBO -lTKStdSchema -lSalomeGenericObj -lSalomeLifeCycleCORBA
# _CS_gbo_090604 Ajout Spécifique Calibre 3, pour l'utilisation de la version 5.12 de la bibliothèque OCC.
# La bibliothèque OCC5.12 a été compilée sur Calibre 3 avec l'extention Xmu (impossible de compiler sans).
SALOMEDS_ChildIterator::~SALOMEDS_ChildIterator()
{
-// if(!_isLocal) CORBA::release(_corba_impl);
+ if(!_isLocal) _corba_impl->Destroy();
}
void SALOMEDS_ChildIterator::Init()
// IDL headers
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SALOMEDS)
-
-
+#include <SALOME_GenericObj_i.hh>
// Cascade headers
#include "SALOMEDSImpl_ChildIterator.hxx"
#include <stdio.h>
-class SALOMEDS_ChildIterator_i: public POA_SALOMEDS::ChildIterator,
- public PortableServer::RefCountServantBase {
+class SALOMEDS_ChildIterator_i: public virtual POA_SALOMEDS::ChildIterator,
+ public virtual PortableServer::RefCountServantBase,
+ public virtual SALOME::GenericObj_i
+{
private:
CORBA::ORB_ptr _orb;
Handle(SALOMEDSImpl_ChildIterator) _it;
SALOMEDS_GenericAttribute::~SALOMEDS_GenericAttribute()
{
+ if (!_isLocal) {
+ _corba_impl->Destroy();
+ }
}
void SALOMEDS_GenericAttribute::CheckLocked()
SALOMEDS::GenericAttribute_ptr SALOMEDS_GenericAttribute_i::CreateAttribute(const Handle(TDF_Attribute)& theAttr,
CORBA::ORB_ptr theOrb)
{
+/*
SALOMEDS::Locker lock;
static std::map<TDF_Attribute*, SALOMEDS_GenericAttribute_i*> _mapOfAttrib;
__CreateGenericCORBAAttribute
_mapOfAttrib[theAttr.operator->()] = attr_servant;
}
+*/
+ // mpv: now servants Destroyed by common algos of CORBA
+ char* aTypeOfAttribute = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(theAttr)->GetClassType().ToCString();
+ SALOMEDS::GenericAttribute_var anAttribute;
+ SALOMEDS_GenericAttribute_i* attr_servant = NULL;
+ __CreateGenericCORBAAttribute
return anAttribute._retn();
}
// IDL headers
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SALOMEDS)
+#include <SALOME_GenericObj_i.hh>
#include <TDF_Attribute.hxx>
#include "SALOMEDS_SObject_i.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class SALOMEDS_GenericAttribute_i: public POA_SALOMEDS::GenericAttribute,
- public PortableServer::RefCountServantBase
+class SALOMEDS_GenericAttribute_i: public virtual POA_SALOMEDS::GenericAttribute,
+ public virtual PortableServer::RefCountServantBase,
+ public virtual SALOME::GenericObj_i
{
protected:
SALOMEDS_SComponentIterator::~SALOMEDS_SComponentIterator()
{
- //if(!_isLocal) CORBA::release(_corba_impl);
+ if(!_isLocal) _corba_impl->Destroy();
}
void SALOMEDS_SComponentIterator::Init()
// IDL headers
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SALOMEDS)
+#include <SALOME_GenericObj_i.hh>
//SALOMEDS headers
#include "SALOMEDS_SComponent_i.hxx"
#include "SALOMEDSImpl_SComponentIterator.hxx"
-class SALOMEDS_SComponentIterator_i:public POA_SALOMEDS::SComponentIterator,
- public PortableServer::RefCountServantBase
+class SALOMEDS_SComponentIterator_i:public virtual POA_SALOMEDS::SComponentIterator,
+ public virtual PortableServer::RefCountServantBase,
+ public virtual SALOME::GenericObj_i
{
private:
SALOMEDS::SComponent_ptr SALOMEDS_SComponent_i::New(const Handle(SALOMEDSImpl_SComponent)& theImpl, CORBA::ORB_ptr theORB)
{
+/*
static std::map<SALOMEDSImpl_SComponent*, SALOMEDS_SComponent_i*> _mapOfSCO;
SALOMEDS::SComponent_var sco;
SALOMEDS_SComponent_i* sco_servant = NULL;
}
sco = SALOMEDS::SComponent::_narrow(sco_servant->SComponent::_this());
+*/
+ SALOMEDS_SComponent_i* sco_servant = new SALOMEDS_SComponent_i(theImpl, theORB);
+ SALOMEDS::SComponent_var sco = SALOMEDS::SComponent::_narrow(sco_servant->SComponent::_this());
return sco._retn();
}
SALOMEDS_SObject::~SALOMEDS_SObject()
{
+ if (!_isLocal) {
+ _corba_impl->Destroy();
+ }
}
std::string SALOMEDS_SObject::GetID()
#include "SALOMEDS_SObject_i.hxx"
#include "SALOMEDS_SComponent_i.hxx"
#include "SALOMEDS_GenericAttribute_i.hxx"
+#include "SALOMEDS_StudyManager_i.hxx"
#include "SALOMEDS.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
#include "SALOMEDSImpl_SComponent.hxx"
SALOMEDS::SObject_ptr SALOMEDS_SObject_i::New(const Handle(SALOMEDSImpl_SObject)& theImpl, CORBA::ORB_ptr theORB)
{
- static std::map<SALOMEDSImpl_SObject*, SALOMEDS_SObject_i*> _mapOfSO;
- SALOMEDS::SObject_var so;
- SALOMEDS_SObject_i* so_servant = NULL;
+ SALOMEDS_SObject_i* so_servant = new SALOMEDS_SObject_i(theImpl, theORB);
+ SALOMEDS::SObject_var so = SALOMEDS::SObject::_narrow(so_servant->_this());
- if(_mapOfSO.find(theImpl.operator->()) != _mapOfSO.end()) {
- so_servant = _mapOfSO[theImpl.operator->()];
- }
- else {
- so_servant = new SALOMEDS_SObject_i(theImpl, theORB);
- _mapOfSO[theImpl.operator->()] = so_servant;
- }
-
- so = SALOMEDS::SObject::_narrow(so_servant->_this());
-
- return so._retn();
+ return so;
}
*/
//============================================================================
SALOMEDS_SObject_i::SALOMEDS_SObject_i(const Handle(SALOMEDSImpl_SObject)& impl, CORBA::ORB_ptr orb)
- :_impl(impl)
+ : _impl(impl)
{
_orb = CORBA::ORB::_duplicate(orb);
+ //SALOME::GenericObj_i::myPOA = SALOMEDS_StudyManager_i::GetPOA(GetStudy());
}
// IDL headers
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SALOMEDS)
+#include <SALOME_GenericObj_i.hh>
// Cascade headers
#include "SALOMEDSImpl_SObject.hxx"
-class SALOMEDS_SObject_i: public POA_SALOMEDS::SObject,
- public PortableServer::RefCountServantBase {
+class SALOMEDS_SObject_i: public virtual POA_SALOMEDS::SObject,
+ public virtual PortableServer::RefCountServantBase,
+ public virtual SALOME::GenericObj_i
+{
protected:
CORBA::ORB_ptr _orb;
Handle(SALOMEDSImpl_SObject) _impl;
#include "Utils_CorbaException.hxx"
#include <strstream>
+#include <map>
using namespace std;
#ifdef WIN32
static SALOMEDS_Driver_i* GetDriver(const Handle(SALOMEDSImpl_SObject)& theObject, CORBA::ORB_ptr orb);
+static std::map<int, PortableServer::POA_ptr> _mapOfPOA;
//============================================================================
/*! Function : SALOMEDS_StudyManager_i
const char* IORStudy = _orb->object_to_string(Study);
aStudyImpl->SetTransientReference((char*)IORStudy);
+
+ _mapOfPOA[Study->StudyId()] = _poa;
+
return Study;
}
return driver;
}
+
+PortableServer::POA_ptr SALOMEDS_StudyManager_i::GetPOA(const SALOMEDS::Study_ptr theStudy) {
+ if (_mapOfPOA.find(theStudy->StudyId()) != _mapOfPOA.end()) return _mapOfPOA[theStudy->StudyId()];
+ return PortableServer::POA::_nil();
+}
+
//===========================================================================
// PRIVATE FUNCTIONS
//===========================================================================
void ping(){};
virtual long GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal);
+
+ static PortableServer::POA_ptr GetPOA(const SALOMEDS::Study_ptr theStudy);
};
#endif
_orb = CORBA::ORB::_duplicate(orb);
_impl = theImpl;
- _useCaseBuilder = new SALOMEDS_UseCaseBuilder_i(_impl->GetUseCaseBuilder(), _orb);
_builder = new SALOMEDS_StudyBuilder_i(_impl->NewBuilder(), _orb);
- _it = new SALOMEDS_SComponentIterator_i(_impl->NewComponentIterator(), _orb);
}
//============================================================================
SALOMEDS::SComponentIterator_ptr SALOMEDS_Study_i::NewComponentIterator()
{
SALOMEDS::Locker lock;
+ SALOMEDS_SComponentIterator_i* _it = new SALOMEDS_SComponentIterator_i(_impl->NewComponentIterator(), _orb);
_it->Init();
return _it->_this();
}
SALOMEDS::UseCaseBuilder_ptr SALOMEDS_Study_i::GetUseCaseBuilder()
{
SALOMEDS::Locker lock;
- return _useCaseBuilder->_this();
+ SALOMEDS_UseCaseBuilder_i* UCBuilder = new SALOMEDS_UseCaseBuilder_i(_impl->GetUseCaseBuilder(), _orb);
+ return UCBuilder->_this();
}
CORBA::ORB_ptr _orb;
Handle(SALOMEDSImpl_Study) _impl;
SALOMEDS_StudyBuilder_i* _builder;
- SALOMEDS_UseCaseBuilder_i* _useCaseBuilder;
- SALOMEDS_SComponentIterator_i* _it;
public:
SALOMEDS_UseCaseBuilder::~SALOMEDS_UseCaseBuilder()
{
- //if(!_isLocal) CORBA::release(_corba_impl);
+ if(!_isLocal) _corba_impl->Destroy();
}
bool SALOMEDS_UseCaseBuilder::Append(SALOMEDSClient_SObject* theObject)
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SALOMEDS)
#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+#include <SALOME_GenericObj_i.hh>
// Cascade headers
#include <Standard_GUID.hxx>
#include "SALOMEDSImpl_UseCaseIterator.hxx"
#include "SALOMEDSImpl_UseCaseBuilder.hxx"
-class SALOMEDS_UseCaseBuilder_i: public POA_SALOMEDS::UseCaseBuilder,
- public PortableServer::RefCountServantBase
+class SALOMEDS_UseCaseBuilder_i: public virtual POA_SALOMEDS::UseCaseBuilder,
+ public virtual PortableServer::RefCountServantBase,
+ public virtual SALOME::GenericObj_i
{
private:
SALOMEDS_UseCaseIterator::~SALOMEDS_UseCaseIterator()
{
- //if(!_isLocal) CORBA::release(_corba_impl);
+ if(!_isLocal) _corba_impl->Destroy();
}
void SALOMEDS_UseCaseIterator::Init(bool theAllLevels)
// IDL headers
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SALOMEDS)
+#include <SALOME_GenericObj_i.hh>
#include "SALOMEDSImpl_UseCaseIterator.hxx"
-class SALOMEDS_UseCaseIterator_i: public POA_SALOMEDS::UseCaseIterator,
- public PortableServer::RefCountServantBase
+class SALOMEDS_UseCaseIterator_i: public virtual POA_SALOMEDS::UseCaseIterator,
+ public virtual PortableServer::RefCountServantBase,
+ public virtual SALOME::GenericObj_i
{
private:
CORBA::ORB_ptr _orb;