Salome HOME
projects
/
modules
/
shaper.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix for issue #1000
[modules/shaper.git]
/
src
/
GeomAPI
/
GeomAPI_Interface.h
diff --git
a/src/GeomAPI/GeomAPI_Interface.h
b/src/GeomAPI/GeomAPI_Interface.h
index 49db964fc715e995c1495ec72bfaf704fbaa05bd..fd5c83fce11ef200fe7d9faafa5a4e2dc534f143 100644
(file)
--- a/
src/GeomAPI/GeomAPI_Interface.h
+++ b/
src/GeomAPI/GeomAPI_Interface.h
@@
-9,38
+9,54
@@
#include <GeomAPI.h>
#include <GeomAPI.h>
+#include <memory>
+
/**\class GeomAPI_Interface
* \ingroup DataModel
* \brief General base class for all interfaces in this package
*/
/**\class GeomAPI_Interface
* \ingroup DataModel
* \brief General base class for all interfaces in this package
*/
-class G
EOMAPI_EXPORT G
eomAPI_Interface
+class GeomAPI_Interface
{
{
- pr
otected
:
-
void*
myImpl; ///< pointer to the internal impl object
+ pr
ivate
:
+
std::shared_ptr<void>
myImpl; ///< pointer to the internal impl object
public:
/// None - constructor
public:
/// None - constructor
- GeomAPI_Interface();
+ G
EOMAPI_EXPORT G
eomAPI_Interface();
/// Constructor by the impl pointer (used for internal needs)
/// Constructor by the impl pointer (used for internal needs)
- GeomAPI_Interface(void* theImpl);
+ template<class T> explicit GeomAPI_Interface(T* theImpl)
+ {
+ myImpl.reset(theImpl);
+ }
/// Destructor
/// Destructor
- virtual ~GeomAPI_Interface();
+
GEOMAPI_EXPORT
virtual ~GeomAPI_Interface();
/// Returns the pointer to the impl
template<class T> inline T* implPtr()
{
/// Returns the pointer to the impl
template<class T> inline T* implPtr()
{
- return static_cast<T*>(myImpl);
+ return static_cast<T*>(myImpl.get());
+ }
+ /// Returns the pointer to the impl
+ template<class T> inline const T* implPtr() const
+ {
+ return static_cast<T*>(myImpl.get());
}
/// Returns the reference object of the impl
template<class T> inline const T& impl() const
{
}
/// Returns the reference object of the impl
template<class T> inline const T& impl() const
{
- return *(static_cast<T*>(myImpl));
+ return *(static_cast<T*>(myImpl
.get()
));
}
/// Updates the impl (deletes the old one)
}
/// Updates the impl (deletes the old one)
- void setImpl(void* theImpl);
+ template<class T> inline void setImpl(T* theImpl)
+ {
+ myImpl.reset(theImpl);
+ }
+
+ /// Returns true if the impl is empty
+ GEOMAPI_EXPORT bool empty() const;
};
#endif
};
#endif