]> OCCT Git - occt.git/commitdiff
Data Exchange, DE Wrapper - Reorganisation of plugin system for Configuration Nodes...
authorPasukhin Dmitry <dpasukhi@opencascade.com>
Wed, 3 Sep 2025 15:51:18 +0000 (16:51 +0100)
committerGitHub <noreply@github.com>
Wed, 3 Sep 2025 15:51:18 +0000 (16:51 +0100)
- Added Register and UnRegister methods to DE_ConfigurationNode for managing bindings with DE_Wrapper.
- Introduced DE_MultiPluginHolder to facilitate registration of multiple configuration nodes simultaneously.
- Created new plugin factory functions for various configuration nodes (DEBREP, DEXCAF, DEGLTF, DEIGES, DEOBJ, DEPLY, DESTEP, DESTL, DEVRML) to streamline their registration with DE_Wrapper.
- Removed unnecessary DE_PluginHolder instances from individual configuration node implementations.
- Updated CMake files to include newly created source files for each configuration node.
- Implemented singleton patterns in draw commands to ensure plugins are registered only once during initialization.

37 files changed:
src/DataExchange/TKDE/DE/DE_ConfigurationNode.cxx
src/DataExchange/TKDE/DE/DE_ConfigurationNode.hxx
src/DataExchange/TKDE/DE/DE_PluginHolder.hxx
src/DataExchange/TKDE/DE/DE_ShapeFixConfigurationNode.cxx
src/DataExchange/TKDECascade/DEBREP/DEBREP_ConfigurationNode.cxx
src/DataExchange/TKDECascade/DEXCAF/DEXCAF_ConfigurationNode.cxx
src/DataExchange/TKDECascade/FILES.cmake
src/DataExchange/TKDECascade/TKDECascade.cxx [new file with mode: 0644]
src/DataExchange/TKDEGLTF/DEGLTF/DEGLTF_ConfigurationNode.cxx
src/DataExchange/TKDEGLTF/FILES.cmake
src/DataExchange/TKDEGLTF/TKDEGLTF.cxx [new file with mode: 0644]
src/DataExchange/TKDEIGES/DEIGES/DEIGES_ConfigurationNode.cxx
src/DataExchange/TKDEIGES/FILES.cmake
src/DataExchange/TKDEIGES/TKDEIGES.cxx [new file with mode: 0644]
src/DataExchange/TKDEOBJ/DEOBJ/DEOBJ_ConfigurationNode.cxx
src/DataExchange/TKDEOBJ/FILES.cmake
src/DataExchange/TKDEOBJ/TKDEOBJ.cxx [new file with mode: 0644]
src/DataExchange/TKDEPLY/DEPLY/DEPLY_ConfigurationNode.cxx
src/DataExchange/TKDEPLY/FILES.cmake
src/DataExchange/TKDEPLY/TKDEPLY.cxx [new file with mode: 0644]
src/DataExchange/TKDESTEP/DESTEP/DESTEP_ConfigurationNode.cxx
src/DataExchange/TKDESTEP/FILES.cmake
src/DataExchange/TKDESTEP/TKDESTEP.cxx [new file with mode: 0644]
src/DataExchange/TKDESTL/DESTL/DESTL_ConfigurationNode.cxx
src/DataExchange/TKDESTL/FILES.cmake
src/DataExchange/TKDESTL/TKDESTL.cxx [new file with mode: 0644]
src/DataExchange/TKDEVRML/DEVRML/DEVRML_ConfigurationNode.cxx
src/DataExchange/TKDEVRML/FILES.cmake
src/DataExchange/TKDEVRML/TKDEVRML.cxx [new file with mode: 0644]
src/Draw/TKXSDRAWDE/XSDRAWDE/XSDRAWDE.cxx
src/Draw/TKXSDRAWGLTF/XSDRAWGLTF/XSDRAWGLTF.cxx
src/Draw/TKXSDRAWIGES/XSDRAWIGES/XSDRAWIGES.cxx
src/Draw/TKXSDRAWOBJ/XSDRAWOBJ/XSDRAWOBJ.cxx
src/Draw/TKXSDRAWPLY/XSDRAWPLY/XSDRAWPLY.cxx
src/Draw/TKXSDRAWSTEP/XSDRAWSTEP/XSDRAWSTEP.cxx
src/Draw/TKXSDRAWSTL/XSDRAWSTL/XSDRAWSTL.cxx
src/Draw/TKXSDRAWVRML/XSDRAWVRML/XSDRAWVRML.cxx

index bdd37294e0232115e424b3a817ef58e2d3fd4396..f3b834023888ec330dfa3e0a55cc6fc370b48424 100644 (file)
@@ -139,3 +139,17 @@ bool DE_ConfigurationNode::CheckContent(const Handle(NCollection_Buffer)& theBuf
   (void)theBuffer;
   return false;
 }
+
+//=================================================================================================
+
+void DE_ConfigurationNode::Register(const Handle(DE_Wrapper)& theWrapper) const
+{
+  theWrapper->Bind(this);
+}
+
+//=================================================================================================
+
+void DE_ConfigurationNode::UnRegister(const Handle(DE_Wrapper)& theWrapper) const
+{
+  theWrapper->UnBind(this);
+}
index 68075ee15b9293c1b4e31363011c700b7b19f3ab..fa975baea173e471c4747fd3d7a14f578a143d8d 100644 (file)
@@ -18,6 +18,7 @@
 
 class DE_ConfigurationContext;
 class DE_Provider;
+class DE_Wrapper;
 class NCollection_Buffer;
 
 //! Base class to work with CAD transfer properties.
@@ -154,6 +155,16 @@ public:
                                     //!< unit is unknown, default 1.0 (MM)
   } GlobalParameters;
 
+public:
+
+  //! Registers configuration node with the specified wrapper
+  //! @param[in] theWrapper wrapper to register with
+  Standard_EXPORT virtual void Register(const Handle(DE_Wrapper)& theWrapper) const;
+
+  //! Unregisters configuration node from the specified wrapper
+  //! @param[in] theWrapper wrapper to unregister from
+  Standard_EXPORT virtual void UnRegister(const Handle(DE_Wrapper)& theWrapper) const;
+
 private:
   Standard_Boolean myIsEnabled; //!< Flag to use a current provider for Read or Write process via DE_Wrapper
   // clang-format on
index 57ed9f2302ed3ff6ea9c8b9c23f46b1bb766aa4a..c70ae9f285b01387e80e989dd44454ef957e6fd3 100644 (file)
@@ -15,6 +15,7 @@
 #define _DE_PluginHolder_HeaderFile
 
 #include <DE_Wrapper.hxx>
+#include <tuple>
 
 //! Base class to work with DE_Wrapper global registration of components.
 //! Control life-time of current configuration node.
@@ -29,17 +30,80 @@ public:
   {
     Standard_Mutex::Sentry aLock(DE_Wrapper::GlobalLoadMutex());
     myInternalConfiguration = new TheConfType;
-    DE_Wrapper::GlobalWrapper()->Bind(myInternalConfiguration);
+    myInternalConfiguration->Register(DE_Wrapper::GlobalWrapper());
   }
 
   ~DE_PluginHolder()
   {
     Standard_Mutex::Sentry aLock(DE_Wrapper::GlobalLoadMutex());
-    DE_Wrapper::GlobalWrapper()->UnBind(myInternalConfiguration);
+    myInternalConfiguration->UnRegister(DE_Wrapper::GlobalWrapper());
   }
 
 private:
   Handle(TheConfType) myInternalConfiguration; //!< Wrapped object
 };
 
+//! Helper class for variadic plugin registration.
+//! Allows registration of multiple configuration node types simultaneously.
+template <typename... TheConfTypes>
+class DE_MultiPluginHolder
+{
+public:
+  DE_MultiPluginHolder()
+      : myHolders{}
+  {
+  }
+
+private:
+  std::tuple<DE_PluginHolder<TheConfTypes>...> myHolders; //!< Tuple of individual plugin holders
+};
+
+//! Macro to define plugin factory function for DE_Wrapper configuration nodes.
+//! @param[in] theNodeType - first configuration node class to instantiate
+//! @param[in] ... - additional configuration node classes to instantiate (optional)
+//! Needs to be called after loading of the library to register configuration nodes.
+//!
+//! Example of usage:
+//! @code
+//! // Inside implementation of the configuration node source file:
+//! DEPLUGIN(DESTEP_ConfigurationNode)
+//!
+//! // For multiple node types:
+//! DEPLUGIN(DESTEP_ConfigurationNode, DEIGES_ConfigurationNode, DEVRML_ConfigurationNode)
+//! @endcode
+//!
+//! After loading of the library TKDESTEP:
+//! @code
+//! OSD_SharedLibrary aSharedLibrary("libTKDESTEP.so");
+//! if (!aSharedLibrary.DlOpen(OSD_RTLD_LAZY))
+//! {
+//!   // Error handling
+//!   return;
+//! }
+//!
+//! typedef void (*PluginFactoryFunc)();
+//! PluginFactoryFunc aFunc = (PluginFactoryFunc)aSharedLibrary.DlSymb("PLUGINFACTORY");
+//! if (aFunc == NULL)
+//! {
+//!   // Error handling
+//!   return;
+//! }
+//!
+//! aFunc(); // Call factory function to register configuration nodes
+//! @endcode
+//!
+//! Will create instances of all specified configuration nodes and set them to DE_Wrapper global
+//! configuration.
+//!
+//! Note: if OCCT_NO_PLUGINS is defined, macro does nothing.
+#ifdef OCCT_NO_PLUGINS
+  #define DEPLUGIN(theNodeType, ...)
+#else
+  #define DEPLUGIN(theNodeType, ...)                                                               \
+    extern "C" Standard_EXPORT void PLUGINFACTORY()                                                \
+    {                                                                                              \
+      static DE_MultiPluginHolder<theNodeType, ##__VA_ARGS__> aMultiHolder;                        \
+    }
+#endif
+
 #endif // _DE_PluginHolder_HeaderFile
index 51d9cf3e4638227c969e1e88697e6da15fe8fb23..15b0c051282c41f977593cb84645ba7ef235960f 100644 (file)
@@ -14,7 +14,6 @@
 #include <DE_ShapeFixConfigurationNode.hxx>
 
 #include <DE_ConfigurationContext.hxx>
-#include <DE_PluginHolder.hxx>
 #include <DE_Wrapper.hxx>
 
 IMPLEMENT_STANDARD_RTTIEXT(DE_ShapeFixConfigurationNode, DE_ConfigurationNode)
index 2bc9ff7fd3024ffb4053096d246d6eafd2d66648..c83a29e9473486dd0e38028d30e3e5098c0e4c60 100644 (file)
@@ -15,7 +15,6 @@
 
 #include <DEBREP_Provider.hxx>
 #include <DE_ConfigurationContext.hxx>
-#include <DE_PluginHolder.hxx>
 #include <NCollection_Buffer.hxx>
 
 IMPLEMENT_STANDARD_RTTIEXT(DEBREP_ConfigurationNode, DE_ConfigurationNode)
@@ -28,8 +27,6 @@ static const TCollection_AsciiString& THE_CONFIGURATION_SCOPE()
   return aScope;
 }
 
-// Wrapper to auto-load DE component
-DE_PluginHolder<DEBREP_ConfigurationNode> THE_OCCT_BREP_COMPONENT_PLUGIN;
 } // namespace
 
 //=================================================================================================
index 3ba0cd70724f5ff71fa7e994b18aad39810e8e24..37fb688a9e586a58f5565b764eaadf102c8540e2 100644 (file)
@@ -15,7 +15,6 @@
 
 #include <DEXCAF_Provider.hxx>
 #include <DE_ConfigurationContext.hxx>
-#include <DE_PluginHolder.hxx>
 #include <NCollection_Buffer.hxx>
 
 IMPLEMENT_STANDARD_RTTIEXT(DEXCAF_ConfigurationNode, DE_ConfigurationNode)
@@ -28,8 +27,6 @@ static const TCollection_AsciiString& THE_CONFIGURATION_SCOPE()
   return aScope;
 }
 
-// Wrapper to auto-load DE component
-DE_PluginHolder<DEXCAF_ConfigurationNode> THE_OCCT_XCAF_COMPONENT_PLUGIN;
 } // namespace
 
 //=================================================================================================
index 52a3fd0bae8daaad89de6ced91f93f799c7ed4a0..49d783f4d02e019967307e641651dae49c681a08 100644 (file)
@@ -4,4 +4,5 @@ set(OCCT_TKDECascade_FILES_LOCATION "${CMAKE_CURRENT_LIST_DIR}")
 set(OCCT_TKDECascade_FILES
   EXTERNLIB
   PACKAGES
+  TKDECascade.cxx
 )
diff --git a/src/DataExchange/TKDECascade/TKDECascade.cxx b/src/DataExchange/TKDECascade/TKDECascade.cxx
new file mode 100644 (file)
index 0000000..00fb8c4
--- /dev/null
@@ -0,0 +1,21 @@
+// Copyright (c) 2025 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <DEBREP_ConfigurationNode.hxx>
+#include <DEXCAF_ConfigurationNode.hxx>
+#include <DE_PluginHolder.hxx>
+
+//! Plugin factory function to register TKDECascade configuration nodes.
+//! Call PLUGINFACTORY() to register both DEBREP_ConfigurationNode and DEXCAF_ConfigurationNode
+//! with the global DE_Wrapper.
+DEPLUGIN(DEBREP_ConfigurationNode, DEXCAF_ConfigurationNode)
\ No newline at end of file
index 4e7538ffd6278648d28da7fb79389840d0148537..d0b70fad77c500a294ddaf497b5c15c0c6ed685f 100644 (file)
@@ -15,7 +15,6 @@
 
 #include <DEGLTF_Provider.hxx>
 #include <DE_ConfigurationContext.hxx>
-#include <DE_PluginHolder.hxx>
 
 IMPLEMENT_STANDARD_RTTIEXT(DEGLTF_ConfigurationNode, DE_ConfigurationNode)
 
@@ -27,8 +26,6 @@ static const TCollection_AsciiString& THE_CONFIGURATION_SCOPE()
   return aScope;
 }
 
-// Wrapper to auto-load DE component
-DE_PluginHolder<DEGLTF_ConfigurationNode> THE_OCCT_GLTF_COMPONENT_PLUGIN;
 } // namespace
 
 //=================================================================================================
index fa16044912f8b1acc483838ea6459fb63b5f5da2..d4f61b411a4d9528c59dd197f7f5cfdc0704ced8 100644 (file)
@@ -4,4 +4,5 @@ set(OCCT_TKDEGLTF_FILES_LOCATION "${CMAKE_CURRENT_LIST_DIR}")
 set(OCCT_TKDEGLTF_FILES
   EXTERNLIB
   PACKAGES
+  TKDEGLTF.cxx
 )
diff --git a/src/DataExchange/TKDEGLTF/TKDEGLTF.cxx b/src/DataExchange/TKDEGLTF/TKDEGLTF.cxx
new file mode 100644 (file)
index 0000000..55f4d77
--- /dev/null
@@ -0,0 +1,19 @@
+// Copyright (c) 2025 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <DEGLTF_ConfigurationNode.hxx>
+#include <DE_PluginHolder.hxx>
+
+//! Plugin factory function to register DEGLTF configuration node.
+//! Call PLUGINFACTORY() to register the DEGLTF_ConfigurationNode with the global DE_Wrapper.
+DEPLUGIN(DEGLTF_ConfigurationNode)
\ No newline at end of file
index b4cd3d62faf86a66c0d11b808f0f3195fba4bbdd..82e7440f8ddcd50b83f719fd78f57e64973e6653 100644 (file)
@@ -15,7 +15,6 @@
 
 #include <DEIGES_Provider.hxx>
 #include <DE_ConfigurationContext.hxx>
-#include <DE_PluginHolder.hxx>
 #include <NCollection_Buffer.hxx>
 
 IMPLEMENT_STANDARD_RTTIEXT(DEIGES_ConfigurationNode, DE_ShapeFixConfigurationNode)
@@ -28,8 +27,6 @@ static const TCollection_AsciiString& THE_CONFIGURATION_SCOPE()
   return aScope;
 }
 
-// Wrapper to auto-load DE component
-DE_PluginHolder<DEIGES_ConfigurationNode> THE_OCCT_IGES_COMPONENT_PLUGIN;
 } // namespace
 
 //=================================================================================================
index df850f869eeaf42a92b35b539496fb2d59c9576b..7eac9b5ecda854656236dfe146c4f68f3dd10071 100644 (file)
@@ -5,4 +5,5 @@ set(OCCT_TKDEIGES_FILES
   EXTERNLIB
   PACKAGES
   TKDEIGES_pch.hxx
+  TKDEIGES.cxx
 )
diff --git a/src/DataExchange/TKDEIGES/TKDEIGES.cxx b/src/DataExchange/TKDEIGES/TKDEIGES.cxx
new file mode 100644 (file)
index 0000000..13bbce0
--- /dev/null
@@ -0,0 +1,19 @@
+// Copyright (c) 2025 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <DEIGES_ConfigurationNode.hxx>
+#include <DE_PluginHolder.hxx>
+
+//! Plugin factory function to register DEIGES configuration node.
+//! Call PLUGINFACTORY() to register the DEIGES_ConfigurationNode with the global DE_Wrapper.
+DEPLUGIN(DEIGES_ConfigurationNode)
\ No newline at end of file
index 826b1508482d3fbf77b341e2ff0babea31a0feee..8315f871f123908b1ee608dc3ee148fbc885f0d9 100644 (file)
@@ -15,7 +15,6 @@
 
 #include <DEOBJ_Provider.hxx>
 #include <DE_ConfigurationContext.hxx>
-#include <DE_PluginHolder.hxx>
 
 IMPLEMENT_STANDARD_RTTIEXT(DEOBJ_ConfigurationNode, DE_ConfigurationNode)
 
@@ -27,8 +26,6 @@ static const TCollection_AsciiString& THE_CONFIGURATION_SCOPE()
   return aScope;
 }
 
-// Wrapper to auto-load DE component
-DE_PluginHolder<DEOBJ_ConfigurationNode> THE_OCCT_OBJ_COMPONENT_PLUGIN;
 } // namespace
 
 //=================================================================================================
index 22c8cbb208ac30808af2db47e735252fc3e7a0d1..7258953a724a6b64704c8d65a19e4bb23a2983d0 100644 (file)
@@ -4,4 +4,5 @@ set(OCCT_TKDEOBJ_FILES_LOCATION "${CMAKE_CURRENT_LIST_DIR}")
 set(OCCT_TKDEOBJ_FILES
   EXTERNLIB
   PACKAGES
+  TKDEOBJ.cxx
 )
diff --git a/src/DataExchange/TKDEOBJ/TKDEOBJ.cxx b/src/DataExchange/TKDEOBJ/TKDEOBJ.cxx
new file mode 100644 (file)
index 0000000..bc65fc1
--- /dev/null
@@ -0,0 +1,19 @@
+// Copyright (c) 2025 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <DEOBJ_ConfigurationNode.hxx>
+#include <DE_PluginHolder.hxx>
+
+//! Plugin factory function to register DEOBJ configuration node.
+//! Call PLUGINFACTORY() to register the DEOBJ_ConfigurationNode with the global DE_Wrapper.
+DEPLUGIN(DEOBJ_ConfigurationNode)
\ No newline at end of file
index fa47112c8fc6b5de5fdcca3ba1dfdd054abb97ee..0804e3748c079d8d11f5a468ea1ab121e5bc5056 100644 (file)
@@ -15,7 +15,6 @@
 
 #include <DEPLY_Provider.hxx>
 #include <DE_ConfigurationContext.hxx>
-#include <DE_PluginHolder.hxx>
 #include <NCollection_Buffer.hxx>
 
 IMPLEMENT_STANDARD_RTTIEXT(DEPLY_ConfigurationNode, DE_ConfigurationNode)
@@ -28,8 +27,6 @@ static const TCollection_AsciiString& THE_CONFIGURATION_SCOPE()
   return aScope;
 }
 
-// Wrapper to auto-load DE component
-DE_PluginHolder<DEPLY_ConfigurationNode> THE_OCCT_PLY_COMPONENT_PLUGIN;
 } // namespace
 
 //=================================================================================================
index eb1dcc6d48da3ddb83e9455f571f382f2d7ddf8e..fa42bda9f72ea6e4f089822290fc41797a43cbd9 100644 (file)
@@ -4,4 +4,5 @@ set(OCCT_TKDEPLY_FILES_LOCATION "${CMAKE_CURRENT_LIST_DIR}")
 set(OCCT_TKDEPLY_FILES
   EXTERNLIB
   PACKAGES
+  TKDEPLY.cxx
 )
diff --git a/src/DataExchange/TKDEPLY/TKDEPLY.cxx b/src/DataExchange/TKDEPLY/TKDEPLY.cxx
new file mode 100644 (file)
index 0000000..bbe527b
--- /dev/null
@@ -0,0 +1,19 @@
+// Copyright (c) 2025 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <DEPLY_ConfigurationNode.hxx>
+#include <DE_PluginHolder.hxx>
+
+//! Plugin factory function to register DEPLY configuration node.
+//! Call PLUGINFACTORY() to register the DEPLY_ConfigurationNode with the global DE_Wrapper.
+DEPLUGIN(DEPLY_ConfigurationNode)
\ No newline at end of file
index ed460f445a681aefa112a19394c1a222bcf8dff8..388ba5c99e03ebd5242cd914198c0872f5d92b88 100644 (file)
@@ -15,7 +15,6 @@
 
 #include <DESTEP_Provider.hxx>
 #include <DE_ConfigurationContext.hxx>
-#include <DE_PluginHolder.hxx>
 #include <NCollection_Buffer.hxx>
 
 IMPLEMENT_STANDARD_RTTIEXT(DESTEP_ConfigurationNode, DE_ShapeFixConfigurationNode)
@@ -28,8 +27,6 @@ static const TCollection_AsciiString& THE_CONFIGURATION_SCOPE()
   return aScope;
 }
 
-// Wrapper to auto-load DE component
-DE_PluginHolder<DESTEP_ConfigurationNode> THE_OCCT_STEP_COMPONENT_PLUGIN;
 } // namespace
 
 //=================================================================================================
index ee212ff486a436e6723e7bc8e569eb4f89e28715..74005a3689ab96ae7daaa4bd531439bf4d44faab 100644 (file)
@@ -5,4 +5,5 @@ set(OCCT_TKDESTEP_FILES
   EXTERNLIB
   PACKAGES
   TKDESTEP_pch.hxx
+  TKDESTEP.cxx
 )
diff --git a/src/DataExchange/TKDESTEP/TKDESTEP.cxx b/src/DataExchange/TKDESTEP/TKDESTEP.cxx
new file mode 100644 (file)
index 0000000..2349d29
--- /dev/null
@@ -0,0 +1,19 @@
+// Copyright (c) 2025 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <DESTEP_ConfigurationNode.hxx>
+#include <DE_PluginHolder.hxx>
+
+//! Plugin factory function to register DESTEP configuration node.
+//! Call PLUGINFACTORY() to register the DESTEP_ConfigurationNode with the global DE_Wrapper.
+DEPLUGIN(DESTEP_ConfigurationNode)
\ No newline at end of file
index cdcf2c16ffe43aa920c47bbb55af1c5af913a70e..4281fba468e25828a4b2a71f17badb1504b0526b 100644 (file)
@@ -15,7 +15,6 @@
 
 #include <DESTL_Provider.hxx>
 #include <DE_ConfigurationContext.hxx>
-#include <DE_PluginHolder.hxx>
 #include <NCollection_Buffer.hxx>
 
 IMPLEMENT_STANDARD_RTTIEXT(DESTL_ConfigurationNode, DE_ConfigurationNode)
@@ -28,8 +27,6 @@ static const TCollection_AsciiString& THE_CONFIGURATION_SCOPE()
   return aScope;
 }
 
-// Wrapper to auto-load DE component
-DE_PluginHolder<DESTL_ConfigurationNode> THE_OCCT_STL_COMPONENT_PLUGIN;
 } // namespace
 
 //=================================================================================================
index 93e35cccfde7586e1fa3a6e815f655cd6ffae7ce..c58b3113884b22a3e8b5affbb6c55976240d774f 100644 (file)
@@ -4,4 +4,5 @@ set(OCCT_TKDESTL_FILES_LOCATION "${CMAKE_CURRENT_LIST_DIR}")
 set(OCCT_TKDESTL_FILES
   EXTERNLIB
   PACKAGES
+  TKDESTL.cxx
 )
diff --git a/src/DataExchange/TKDESTL/TKDESTL.cxx b/src/DataExchange/TKDESTL/TKDESTL.cxx
new file mode 100644 (file)
index 0000000..abfb6f3
--- /dev/null
@@ -0,0 +1,19 @@
+// Copyright (c) 2025 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <DESTL_ConfigurationNode.hxx>
+#include <DE_PluginHolder.hxx>
+
+//! Plugin factory function to register DESTL configuration node.
+//! Call PLUGINFACTORY() to register the DESTL_ConfigurationNode with the global DE_Wrapper.
+DEPLUGIN(DESTL_ConfigurationNode)
\ No newline at end of file
index 66e48f77b3f69fd9bcbe32b0bdfe6930e8a1d355..80ae61d938f9163f20252e15f32a07723f39495d 100644 (file)
@@ -15,7 +15,6 @@
 
 #include <DEVRML_Provider.hxx>
 #include <DE_ConfigurationContext.hxx>
-#include <DE_PluginHolder.hxx>
 
 IMPLEMENT_STANDARD_RTTIEXT(DEVRML_ConfigurationNode, DE_ConfigurationNode)
 
@@ -27,8 +26,6 @@ static const TCollection_AsciiString& THE_CONFIGURATION_SCOPE()
   return aScope;
 }
 
-// Wrapper to auto-load DE component
-DE_PluginHolder<DEVRML_ConfigurationNode> THE_OCCT_VRML_COMPONENT_PLUGIN;
 } // namespace
 
 //=================================================================================================
index 42e6cd4c1dd228c5e489b08ae750b11a2ed53a15..6c1f98c65f1d3c64a4a186a70a4ec02d0a98b56e 100644 (file)
@@ -4,4 +4,5 @@ set(OCCT_TKDEVRML_FILES_LOCATION "${CMAKE_CURRENT_LIST_DIR}")
 set(OCCT_TKDEVRML_FILES
   EXTERNLIB
   PACKAGES
+  TKDEVRML.cxx
 )
diff --git a/src/DataExchange/TKDEVRML/TKDEVRML.cxx b/src/DataExchange/TKDEVRML/TKDEVRML.cxx
new file mode 100644 (file)
index 0000000..0642232
--- /dev/null
@@ -0,0 +1,19 @@
+// Copyright (c) 2025 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <DEVRML_ConfigurationNode.hxx>
+#include <DE_PluginHolder.hxx>
+
+//! Plugin factory function to register DEVRML configuration node.
+//! Call PLUGINFACTORY() to register the DEVRML_ConfigurationNode with the global DE_Wrapper.
+DEPLUGIN(DEVRML_ConfigurationNode)
\ No newline at end of file
index 1d3ed8f6ba12ef00c52e642f7b5899c45c18c547..c985ae3e9221238cceaef1b8b04663955bfe2b66 100644 (file)
@@ -20,6 +20,8 @@
 #include <DE_Provider.hxx>
 #include <DE_Wrapper.hxx>
 #include <DEBREP_ConfigurationNode.hxx>
+#include <DEXCAF_ConfigurationNode.hxx>
+#include <DE_PluginHolder.hxx>
 #include <Draw.hxx>
 #include <Draw_Interpretor.hxx>
 #include <Draw_PluginMacro.hxx>
 #include <XSControl_WorkSession.hxx>
 #include <XSDRAW.hxx>
 
+namespace
+{
+// Singleton to ensure DEBREP and DEXCAF plugins are registered only once
+void DECascadeSingleton()
+{
+  static DE_MultiPluginHolder<DEBREP_ConfigurationNode, DEXCAF_ConfigurationNode> aHolder;
+  (void)aHolder;
+}
+} // namespace
+
 //=================================================================================================
 
 static Standard_Integer DumpConfiguration(Draw_Interpretor& theDI,
@@ -364,6 +376,9 @@ void XSDRAWDE::Factory(Draw_Interpretor& theDI)
   }
   aIsActivated = Standard_True;
 
+  //! Ensure DEBREP and DEXCAF plugins are registered
+  DECascadeSingleton();
+
   Standard_CString aGroup = "XDE translation commands";
   theDI.Add("DumpConfiguration",
             "DumpConfiguration [-path <path>] [-recursive {on|off}] [-format fmt1 fmt2 ...] "
@@ -428,10 +443,6 @@ void XSDRAWDE::Factory(Draw_Interpretor& theDI)
 
   // Load XSDRAW session for pilot activation
   XSDRAW::LoadDraw(theDI);
-
-  // Workaround to force load TKDECascade lib
-  DEBREP_ConfigurationNode aTmpObj;
-  (void)aTmpObj;
 }
 
 // Declare entry point PLUGINFACTORY
index 191d862218db739d69844014644146982d9ad323..e3f9334acba232bc2bb5eaa49ec9b4be57938109 100644 (file)
@@ -16,6 +16,8 @@
 #include <DBRep.hxx>
 #include <DDocStd.hxx>
 #include <DDocStd_DrawDocument.hxx>
+#include <DEGLTF_ConfigurationNode.hxx>
+#include <DE_PluginHolder.hxx>
 #include <Draw.hxx>
 #include <Draw_Interpretor.hxx>
 #include <Draw_PluginMacro.hxx>
 #include <XSControl_WorkSession.hxx>
 #include <XSDRAW.hxx>
 
+namespace
+{
+// Singleton to ensure DEGLTF plugin is registered only once
+void DEGLTFSingleton()
+{
+  static DE_PluginHolder<DEGLTF_ConfigurationNode> aHolder;
+  (void)aHolder;
+}
+} // namespace
+
 //=============================================================================
 // function : parseNameFormat
 // purpose  : Parse RWMesh_NameFormat enumeration
@@ -509,6 +521,9 @@ void XSDRAWGLTF::Factory(Draw_Interpretor& theDI)
   }
   aIsActivated = Standard_True;
 
+  //! Ensure DEGLTF plugin is registered
+  DEGLTFSingleton();
+
   const char* aGroup = "XSTEP-STL/VRML"; // Step transfer file commands
   theDI.Add("ReadGltf",
             "ReadGltf Doc file [-parallel {on|off}] [-listExternalFiles] [-noCreateDoc] "
index a9d0c2edea29cec80b0ad0cc87b12858f23e761f..0c4d5e2dfde2b25a228c8c87a8238f9cd5b31453 100644 (file)
@@ -17,6 +17,8 @@
 #include <DBRep.hxx>
 #include <DDocStd.hxx>
 #include <DDocStd_DrawDocument.hxx>
+#include <DEIGES_ConfigurationNode.hxx>
+#include <DE_PluginHolder.hxx>
 #include <Draw.hxx>
 #include <DrawTrSurf.hxx>
 #include <Draw_Interpretor.hxx>
@@ -1108,6 +1110,16 @@ static Standard_Integer WriteIges(Draw_Interpretor& theDI,
   return 0;
 }
 
+namespace
+{
+// Singleton to ensure DEIGES plugin is registered only once
+void DEIGESSingleton()
+{
+  static DE_PluginHolder<DEIGES_ConfigurationNode> aHolder;
+  (void)aHolder;
+}
+} // namespace
+
 //=================================================================================================
 
 void XSDRAWIGES::Factory(Draw_Interpretor& theDI)
@@ -1121,6 +1133,9 @@ void XSDRAWIGES::Factory(Draw_Interpretor& theDI)
 
   IGESControl_Controller::Init();
 
+  //! Ensure DEIGES plugin is registered
+  DEIGESSingleton();
+
   const char* aGroup = "DE: IGES";
 
   theDI.Add("tplosttrim",
index 9c7e7c0f2562ca56d325837dbaf5d56d5092237d..1654bd4aa1a9cd47b63ab34af5b21db331bc3512 100644 (file)
@@ -17,6 +17,8 @@
 #include <DBRep.hxx>
 #include <DDocStd.hxx>
 #include <DDocStd_DrawDocument.hxx>
+#include <DEOBJ_ConfigurationNode.hxx>
+#include <DE_PluginHolder.hxx>
 #include <Draw.hxx>
 #include <Draw_Interpretor.hxx>
 #include <Draw_PluginMacro.hxx>
@@ -335,6 +337,16 @@ static Standard_Integer WriteObj(Draw_Interpretor& theDI,
   return 0;
 }
 
+namespace
+{
+// Singleton to ensure DEOBJ plugin is registered only once
+void DEOBJSingleton()
+{
+  static DE_PluginHolder<DEOBJ_ConfigurationNode> aHolder;
+  (void)aHolder;
+}
+} // namespace
+
 //=================================================================================================
 
 void XSDRAWOBJ::Factory(Draw_Interpretor& theDI)
@@ -346,6 +358,9 @@ void XSDRAWOBJ::Factory(Draw_Interpretor& theDI)
   }
   aIsActivated = Standard_True;
 
+  //! Ensure DEOBJ plugin is registered
+  DEOBJSingleton();
+
   const char* aGroup = "XSTEP-STL/VRML"; // Step transfer file commands
   theDI.Add(
     "ReadObj",
index 7bb9bd6c6529631e26f691986d26d9d6411be116..aeee1734dc63b4b28db58763cb01984d5e4e9fe7 100644 (file)
@@ -18,6 +18,8 @@
 #include <DBRep.hxx>
 #include <DDocStd.hxx>
 #include <DDocStd_DrawDocument.hxx>
+#include <DEPLY_ConfigurationNode.hxx>
+#include <DE_PluginHolder.hxx>
 #include <Draw.hxx>
 #include <Draw_Interpretor.hxx>
 #include <Draw_PluginMacro.hxx>
@@ -295,6 +297,16 @@ static Standard_Integer WritePly(Draw_Interpretor& theDI,
   return 0;
 }
 
+namespace
+{
+// Singleton to ensure DEPLY plugin is registered only once
+void DEPLYSingleton()
+{
+  static DE_PluginHolder<DEPLY_ConfigurationNode> aHolder;
+  (void)aHolder;
+}
+} // namespace
+
 //=================================================================================================
 
 void XSDRAWPLY::Factory(Draw_Interpretor& theDI)
@@ -306,6 +318,9 @@ void XSDRAWPLY::Factory(Draw_Interpretor& theDI)
   }
   aIsActivated = Standard_True;
 
+  //! Ensure DEPLY plugin is registered
+  DEPLYSingleton();
+
   const char* aGroup = "XSTEP-STL/VRML"; // Step transfer file commands
   // XSDRAW::LoadDraw(theCommands);
   theDI.Add("WritePly",
index 3ed5126b29080d0f413deea7d45e2340f0deb7e6..1f250efdd049c7b3d7ecba418c5f5a98262d2b13 100644 (file)
@@ -17,6 +17,8 @@
 #include <DDF.hxx>
 #include <DDocStd.hxx>
 #include <DDocStd_DrawDocument.hxx>
+#include <DESTEP_ConfigurationNode.hxx>
+#include <DE_PluginHolder.hxx>
 #include <Draw.hxx>
 #include <Draw_Interpretor.hxx>
 #include <Draw_PluginMacro.hxx>
@@ -1092,6 +1094,16 @@ static Standard_Integer WriteStep(Draw_Interpretor& theDI,
   return 0;
 }
 
+namespace
+{
+// Singleton to ensure DESTEP plugin is registered only once
+void DESTEPSingleton()
+{
+  static DE_PluginHolder<DESTEP_ConfigurationNode> aHolder;
+  (void)aHolder;
+}
+} // namespace
+
 //=================================================================================================
 
 void XSDRAWSTEP::Factory(Draw_Interpretor& theDI)
@@ -1104,6 +1116,9 @@ void XSDRAWSTEP::Factory(Draw_Interpretor& theDI)
   STEPCAFControl_Controller::Init();
   aIsActivated = Standard_True;
 
+  //! Ensure DESTEP plugin is registered
+  DESTEPSingleton();
+
   const char* aGroup = "DE: STEP"; // Step transfer file commands
   theDI.Add("stepwrite", "stepwrite mode[0-4 afsmw] shape", __FILE__, stepwrite, aGroup);
   theDI.Add("testwritestep",
index 4632aba138458236a11e65f9082bde6f9ea89266..b2065b76273498282c8ffcf6a4bcb565f3dc5e8f 100644 (file)
@@ -18,6 +18,8 @@
 #include <DBRep.hxx>
 #include <DDocStd.hxx>
 #include <DDocStd_DrawDocument.hxx>
+#include <DESTL_ConfigurationNode.hxx>
+#include <DE_PluginHolder.hxx>
 #include <Draw.hxx>
 #include <Draw_Interpretor.hxx>
 #include <Draw_PluginMacro.hxx>
@@ -1233,6 +1235,16 @@ static Standard_Integer meshinfo(Draw_Interpretor& theDI,
   return 0;
 }
 
+namespace
+{
+// Singleton to ensure DESTL plugin is registered only once
+void DESTLSingleton()
+{
+  static DE_PluginHolder<DESTL_ConfigurationNode> aHolder;
+  (void)aHolder;
+}
+} // namespace
+
 //=================================================================================================
 
 void XSDRAWSTL::Factory(Draw_Interpretor& theDI)
@@ -1244,6 +1256,9 @@ void XSDRAWSTL::Factory(Draw_Interpretor& theDI)
   }
   aIsActivated = Standard_True;
 
+  //! Ensure DESTL plugin is registered
+  DESTLSingleton();
+
   const char* aGroup = "XSTEP-STL/VRML"; // Step transfer file commands
 
   theDI.Add("writestl",
index 815cb3fd7870ba6cbd013260632739a13ea62027..f7dbe042028d5231a1832d173304a7950b38ca4f 100644 (file)
@@ -16,6 +16,8 @@
 #include <DBRep.hxx>
 #include <DDocStd.hxx>
 #include <DDocStd_DrawDocument.hxx>
+#include <DEVRML_ConfigurationNode.hxx>
+#include <DE_PluginHolder.hxx>
 #include <Draw.hxx>
 #include <Draw_Interpretor.hxx>
 #include <Draw_PluginMacro.hxx>
@@ -408,6 +410,16 @@ static Standard_Integer writevrml(Draw_Interpretor& di, Standard_Integer argc, c
   return 0;
 }
 
+namespace
+{
+// Singleton to ensure DEVRML plugin is registered only once
+void DEVRMLSingleton()
+{
+  static DE_PluginHolder<DEVRML_ConfigurationNode> aHolder;
+  (void)aHolder;
+}
+} // namespace
+
 //=================================================================================================
 
 void XSDRAWVRML::Factory(Draw_Interpretor& theDI)
@@ -419,6 +431,9 @@ void XSDRAWVRML::Factory(Draw_Interpretor& theDI)
   }
   anInitActor = Standard_True;
 
+  //! Ensure DEVRML plugin is registered
+  DEVRMLSingleton();
+
   Standard_CString aGroup = "XDE translation commands";
   theDI.Add(
     "ReadVrml",