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 f77131de6f821dc5fb1b52fad1dfaaa6965ee511..fd5c83fce11ef200fe7d9faafa5a4e2dc534f143 100644
(file)
--- a/
src/GeomAPI/GeomAPI_Interface.h
+++ b/
src/GeomAPI/GeomAPI_Interface.h
@@
-1,38
+1,62
@@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
// File: GeomAPI_Interface.hxx
// Created: 23 Apr 2014
// Author: Mikhail PONIKAROV
// File: GeomAPI_Interface.hxx
// Created: 23 Apr 2014
// Author: Mikhail PONIKAROV
-#ifndef GeomAPI_Interface_H
eaderFile
-#define GeomAPI_Interface_H
eaderFile
+#ifndef GeomAPI_Interface_H
_
+#define GeomAPI_Interface_H
_
#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
{
{
-
protected
:
-
void* myImpl;
///< pointer to the internal impl object
+
private
:
+
std::shared_ptr<void> myImpl;
///< pointer to the internal impl object
-public:
+
public:
/// None - constructor
/// 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
/// Returns the pointer to the impl
- template<class T> inline T* implPtr() {return static_cast<T*>(myImpl);}
+ template<class T> inline T* implPtr()
+ {
+ 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
/// Returns the reference object of the impl
- template<class T> inline const T& impl() {return *(static_cast<T*>(myImpl));}
+ template<class T> inline const T& impl() const
+ {
+ 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