1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-13 14:27:08 +03:00

Data Exchange, DE Wrapper - Reorganisation of plugin system for Configuration Nodes (#696)

- 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.
This commit is contained in:
Pasukhin Dmitry
2025-09-03 16:51:18 +01:00
committed by GitHub
parent 1f02122211
commit e7e1f8a0a2
37 changed files with 373 additions and 34 deletions

View 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);
}

View 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

View 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

View 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)

View 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
//=================================================================================================

View 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
//=================================================================================================

View File

@@ -4,4 +4,5 @@ set(OCCT_TKDECascade_FILES_LOCATION "${CMAKE_CURRENT_LIST_DIR}")
set(OCCT_TKDECascade_FILES
EXTERNLIB
PACKAGES
TKDECascade.cxx
)

View File

@@ -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)

View 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
//=================================================================================================

View File

@@ -4,4 +4,5 @@ set(OCCT_TKDEGLTF_FILES_LOCATION "${CMAKE_CURRENT_LIST_DIR}")
set(OCCT_TKDEGLTF_FILES
EXTERNLIB
PACKAGES
TKDEGLTF.cxx
)

View File

@@ -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)

View 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
//=================================================================================================

View File

@@ -5,4 +5,5 @@ set(OCCT_TKDEIGES_FILES
EXTERNLIB
PACKAGES
TKDEIGES_pch.hxx
TKDEIGES.cxx
)

View File

@@ -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)

View 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
//=================================================================================================

View File

@@ -4,4 +4,5 @@ set(OCCT_TKDEOBJ_FILES_LOCATION "${CMAKE_CURRENT_LIST_DIR}")
set(OCCT_TKDEOBJ_FILES
EXTERNLIB
PACKAGES
TKDEOBJ.cxx
)

View File

@@ -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)

View 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
//=================================================================================================

View File

@@ -4,4 +4,5 @@ set(OCCT_TKDEPLY_FILES_LOCATION "${CMAKE_CURRENT_LIST_DIR}")
set(OCCT_TKDEPLY_FILES
EXTERNLIB
PACKAGES
TKDEPLY.cxx
)

View File

@@ -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)

View 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
//=================================================================================================

View File

@@ -5,4 +5,5 @@ set(OCCT_TKDESTEP_FILES
EXTERNLIB
PACKAGES
TKDESTEP_pch.hxx
TKDESTEP.cxx
)

View File

@@ -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)

View 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
//=================================================================================================

View File

@@ -4,4 +4,5 @@ set(OCCT_TKDESTL_FILES_LOCATION "${CMAKE_CURRENT_LIST_DIR}")
set(OCCT_TKDESTL_FILES
EXTERNLIB
PACKAGES
TKDESTL.cxx
)

View File

@@ -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)

View 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
//=================================================================================================

View File

@@ -4,4 +4,5 @@ set(OCCT_TKDEVRML_FILES_LOCATION "${CMAKE_CURRENT_LIST_DIR}")
set(OCCT_TKDEVRML_FILES
EXTERNLIB
PACKAGES
TKDEVRML.cxx
)

View File

@@ -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)

View 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>
@@ -31,6 +33,16 @@
#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

View 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>
@@ -30,6 +32,16 @@
#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] "

View 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",

View 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",

View 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",

View 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",

View 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",

View 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",