//! match) and Same State (that is, IsEqual is not required)
//! Once added, stores its attached Protocol in correspondance
Standard_EXPORT void Add (const Handle(IGESData_SpecificModule)& amodule, const Handle(IGESData_Protocol)& aprotocol);
-
+
+ //! Removes a Module from the list
+ Standard_EXPORT void Remove(const Handle(IGESData_SpecificModule)& amodule);
+
//! Returns the Module stored in a given GlobalNode
Standard_EXPORT const Handle(IGESData_SpecificModule)& Module() const;
//! match) and Same State (that is, IsEqual is not required)
//! Once added, stores its attached Protocol in correspondance
Standard_EXPORT void Add (const Handle(IGESData_ReadWriteModule)& amodule, const Handle(IGESData_Protocol)& aprotocol);
-
+
+ //! Removes a Module from the list
+ Standard_EXPORT void Remove(const Handle(IGESData_ReadWriteModule)& amodule);
+
//! Returns the Module stored in a given GlobalNode
Standard_EXPORT const Handle(IGESData_ReadWriteModule)& Module() const;
//! Adds a couple (Module-Protocol) into the global definition set
//! for this class of Library.
Standard_EXPORT static void SetGlobal (const Handle(IGESData_SpecificModule)& amodule, const Handle(IGESData_Protocol)& aprotocol);
-
+
+ //! Releases a module from the global definition set.
+ Standard_EXPORT static void ReleaseGlobal(const Handle(IGESData_SpecificModule)& amodule);
+
//! Creates a Library which complies with a Protocol, that is :
//! Same class (criterium IsInstance)
//! This creation gets the Modules from the global set, those
//! Adds a couple (Module-Protocol) into the global definition set
//! for this class of Library.
Standard_EXPORT static void SetGlobal (const Handle(IGESData_ReadWriteModule)& amodule, const Handle(IGESData_Protocol)& aprotocol);
-
+
+ //! Releases a module from the global definition set.
+ Standard_EXPORT static void ReleaseGlobal(const Handle(IGESData_ReadWriteModule)& amodule);
+
//! Creates a Library which complies with a Protocol, that is :
//! Same class (criterium IsInstance)
//! This creation gets the Modules from the global set, those
//! Adds a couple (Module-Protocol) into the global definition set
//! for this class of Library.
Standard_EXPORT static void SetGlobal (const Handle(Interface_GeneralModule)& amodule, const Handle(Interface_Protocol)& aprotocol);
-
+
+ //! Releases a module from the global definition set.
+ Standard_EXPORT static void ReleaseGlobal(const Handle(Interface_GeneralModule)& amodule);
+
//! Creates a Library which complies with a Protocol, that is :
//! Same class (criterium IsInstance)
//! This creation gets the Modules from the global set, those
//! match) and Same State (that is, IsEqual is not required)
//! Once added, stores its attached Protocol in correspondance
Standard_EXPORT void Add (const Handle(Interface_GeneralModule)& amodule, const Handle(Interface_Protocol)& aprotocol);
-
+
+ //! Removes a Module from the list
+ Standard_EXPORT void Remove(const Handle(Interface_GeneralModule)& amodule);
+
//! Returns the Module stored in a given GlobalNode
Standard_EXPORT const Handle(Interface_GeneralModule)& Module() const;
//! match) and Same State (that is, IsEqual is not required)
//! Once added, stores its attached Protocol in correspondance
Standard_EXPORT void Add (const Handle(Interface_ReaderModule)& amodule, const Handle(Interface_Protocol)& aprotocol);
-
+
+ //! Removes a Module from the list
+ Standard_EXPORT void Remove(const Handle(Interface_ReaderModule)& amodule);
+
//! Returns the Module stored in a given GlobalNode
Standard_EXPORT const Handle(Interface_ReaderModule)& Module() const;
//! Adds a couple (Module-Protocol) into the global definition set
//! for this class of Library.
Standard_EXPORT static void SetGlobal (const Handle(Interface_ReaderModule)& amodule, const Handle(Interface_Protocol)& aprotocol);
-
+
+ //! Releases a module from the global definition set.
+ Standard_EXPORT static void ReleaseGlobal(const Handle(Interface_ReaderModule)& amodule);
+
//! Creates a Library which complies with a Protocol, that is :
//! Same class (criterium IsInstance)
//! This creation gets the Modules from the global set, those
else thenext->Add (amodule,aprotocol);
}
+void LibCtl_GlobalNode::Remove(const Handle(TheModule)& amodule)
+{
+ if (themod == amodule)
+ {
+ if (thenext.IsNull())
+ {
+ themod = Handle(TheModule)();
+ theprot = Handle(TheProtocol)();
+ }
+ else
+ {
+ themod = thenext->themod;
+ theprot = thenext->theprot;
+ thenext = thenext->thenext;
+ }
+ }
+ else if (!thenext.IsNull())
+ thenext->Remove(amodule);
+}
+
const Handle(TheModule)& LibCtl_GlobalNode::Module () const
{ return themod; }
theglobal->Add(amodule,aprotocol);
}
+void LibCtl_Library::ReleaseGlobal(const Handle(TheModule)& amodule)
+{
+ if (!theglobal.IsNull())
+ theglobal->Remove(amodule);
+}
+
// Constructeur d apres Protocole
LibCtl_Library::LibCtl_Library (const Handle(TheProtocol)& aprotocol)
{
#include <StepAP214_Protocol.hxx>
#include <StepData_WriterLib.hxx>
-static int THE_RWStepAP214_init = 0;
+DEFINE_STANDARD_HANDLE(RWStepAP214_Mgr, Standard_Transient)
+
+class RWStepAP214_Mgr : public Standard_Transient
+{
+public:
+ RWStepAP214_Mgr()
+ {
+ myProtocol = StepAP214::Protocol();
+ myGeneralModule = new RWStepAP214_GeneralModule;
+ myRWModule = new RWStepAP214_ReadWriteModule;
+ Interface_GeneralLib::SetGlobal(myGeneralModule, myProtocol);
+ Interface_ReaderLib::SetGlobal(myRWModule, myProtocol);
+ StepData_WriterLib::SetGlobal(myRWModule, myProtocol);
+ }
+
+ virtual ~RWStepAP214_Mgr()
+ {
+ Interface_GeneralLib::ReleaseGlobal(myGeneralModule);
+ Interface_ReaderLib::ReleaseGlobal(myRWModule);
+ StepData_WriterLib::ReleaseGlobal(myRWModule);
+ }
+
+ DEFINE_STANDARD_RTTI_INLINE(RWStepAP214_Mgr, Standard_Transient)
+
+private:
+ Handle(StepAP214_Protocol) myProtocol;
+ Handle(RWStepAP214_ReadWriteModule) myRWModule;
+ Handle(RWStepAP214_GeneralModule) myGeneralModule;
+};
+
+static Handle(RWStepAP214_Mgr) THE_MGR;
void RWStepAP214::Init()
{
- if (THE_RWStepAP214_init)
+ if (THE_MGR.IsNull())
{
- return;
+ RWHeaderSection::Init();
+ THE_MGR = new RWStepAP214_Mgr;
}
- THE_RWStepAP214_init = 1;
- RWHeaderSection::Init();
- Handle(StepAP214_Protocol) proto = StepAP214::Protocol();
- Interface_GeneralLib::SetGlobal (new RWStepAP214_GeneralModule,proto);
- Interface_ReaderLib::SetGlobal (new RWStepAP214_ReadWriteModule,proto);
- StepData_WriterLib::SetGlobal (new RWStepAP214_ReadWriteModule,proto);
}
IMPLEMENT_STANDARD_RTTIEXT(STEPCAFControl_Controller,STEPControl_Controller)
+
+DEFINE_STANDARD_HANDLE(STEPCAF_Mgr, Standard_Transient)
+
+class STEPCAF_Mgr : public Standard_Transient
+{
+public:
+ STEPCAF_Mgr()
+ {
+ myCtl = new STEPCAFControl_Controller;
+ // do something to avoid warnings...
+ myCtl->AutoRecord();
+ }
+
+ virtual ~STEPCAF_Mgr()
+ {
+ myCtl->AutoRelease();
+ }
+
+ DEFINE_STANDARD_RTTI_INLINE(STEPCAF_Mgr, Standard_Transient)
+
+private:
+ Handle(STEPCAFControl_Controller) myCtl;
+};
+
+static Handle(STEPCAF_Mgr) THE_MGR;
+
+
//=======================================================================
//function : STEPCAFControl_Controller
//purpose :
static Standard_Boolean inic = Standard_False;
if (inic) return Standard_True;
inic = Standard_True;
- // self-registering
- Handle(STEPCAFControl_Controller) STEPCTL = new STEPCAFControl_Controller;
// do XSAlgo::Init, cause it does not called before.
XSAlgo::Init();
- // do something to avoid warnings...
- STEPCTL->AutoRecord();
+ THE_MGR = new STEPCAF_Mgr;
//-----------------------------------------------------------
// Few variables for advanced control of translation process
//! match) and Same State (that is, IsEqual is not required)
//! Once added, stores its attached Protocol in correspondance
Standard_EXPORT void Add (const Handle(StepData_ReadWriteModule)& amodule, const Handle(StepData_Protocol)& aprotocol);
-
+
+ //! Removes a Module from the list
+ Standard_EXPORT void Remove(const Handle(StepData_ReadWriteModule)& amodule);
+
//! Returns the Module stored in a given GlobalNode
Standard_EXPORT const Handle(StepData_ReadWriteModule)& Module() const;
//! Adds a couple (Module-Protocol) into the global definition set
//! for this class of Library.
Standard_EXPORT static void SetGlobal (const Handle(StepData_ReadWriteModule)& amodule, const Handle(StepData_Protocol)& aprotocol);
-
+
+ //! Releases a module from the global definition set.
+ Standard_EXPORT static void ReleaseGlobal(const Handle(StepData_ReadWriteModule)& amodule);
+
//! Creates a Library which complies with a Protocol, that is :
//! Same class (criterium IsInstance)
//! This creation gets the Modules from the global set, those
listad.Bind(theName, this);
}
+void XSControl_Controller::Release(const Standard_CString theName) const
+{
+ if (listad.IsBound(theName)) {
+ listad.UnBind(theName);
+ }
+}
+
//=======================================================================
//function : Recorded
//purpose :
Record (Name(Standard_True));
Record (Name(Standard_False));
}
+
+ //! Removes <me> from the general dictionary under Short and Long
+ //! Names (see method Name)
+ void AutoRelease() const
+ {
+ Release (Name(Standard_True));
+ Release (Name(Standard_False));
+ }
//! Records <me> in a general dictionary under a name
//! Error if <name> already used for another one
Standard_EXPORT void Record (const Standard_CString name) const;
+ //! Removes <me> from the general dictionary under a name
+ Standard_EXPORT void Release(const Standard_CString name) const;
+
//! Returns the Controller attached to a given name
//! Returns a Null Handle if <name> is unknown
Standard_EXPORT static Handle(XSControl_Controller) Recorded (const Standard_CString name);