Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:23

0001 // Copyright (c) 2023 OPEN CASCADE SAS
0002 //
0003 // This file is part of Open CASCADE Technology software library.
0004 //
0005 // This library is free software; you can redistribute it and/or modify it under
0006 // the terms of the GNU Lesser General Public License version 2.1 as published
0007 // by the Free Software Foundation, with special exception defined in the file
0008 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0009 // distribution for complete text of the license and disclaimer of any warranty.
0010 //
0011 // Alternatively, this file may be used under the terms of Open CASCADE
0012 // commercial license or contractual agreement.
0013 
0014 #ifndef _DE_PluginHolder_HeaderFile
0015 #define _DE_PluginHolder_HeaderFile
0016 
0017 #include <DE_Wrapper.hxx>
0018 
0019 //! Base class to work with DE_Wrapper global registration of components.
0020 //! Control life-time of current configuration node.
0021 //! In creating stage load into global configuration.
0022 //! On destroying stage unload from global configuration.
0023 //! Operation to load/unload are thread safety.
0024 template <class TheConfType>
0025 class DE_PluginHolder
0026 {
0027 public:
0028   DE_PluginHolder()
0029   {
0030     Standard_Mutex::Sentry aLock(DE_Wrapper::GlobalLoadMutex());
0031     myInternalConfiguration = new TheConfType;
0032     DE_Wrapper::GlobalWrapper()->Bind(myInternalConfiguration);
0033   }
0034 
0035   ~DE_PluginHolder()
0036   {
0037     Standard_Mutex::Sentry aLock(DE_Wrapper::GlobalLoadMutex());
0038     DE_Wrapper::GlobalWrapper()->UnBind(myInternalConfiguration);
0039   }
0040 
0041 private:
0042   Handle(TheConfType) myInternalConfiguration; //!< Wrapped object
0043 };
0044 
0045 #endif // _DE_PluginHolder_HeaderFile