Salome HOME
Merge remote-tracking branch 'origin/Dev_1.1.0' into Dev_1.1.0
[modules/shaper.git] / src / GeomAPI / GeomAPI_Interface.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        GeomAPI_Interface.hxx
4 // Created:     23 Apr 2014
5 // Author:      Mikhail PONIKAROV
6
7 #ifndef GeomAPI_Interface_H_
8 #define GeomAPI_Interface_H_
9
10 #include <GeomAPI.h>
11
12 /**\class GeomAPI_Interface
13  * \ingroup DataModel
14  * \brief General base class for all interfaces in this package
15  */
16
17 class GEOMAPI_EXPORT GeomAPI_Interface
18 {
19  protected:
20   void* myImpl;  ///< pointer to the internal impl object
21
22  public:
23   /// None - constructor
24   GeomAPI_Interface();
25
26   /// Constructor by the impl pointer (used for internal needs)
27   GeomAPI_Interface(void* theImpl);
28
29   /// Destructor
30   virtual ~GeomAPI_Interface();
31
32   /// Returns the pointer to the impl
33   template<class T> inline T* implPtr()
34   {
35     return static_cast<T*>(myImpl);
36   }
37   /// Returns the reference object of the impl
38   template<class T> inline const T& impl()
39   {
40     return *(static_cast<T*>(myImpl));
41   }
42   /// Updates the impl (deletes the old one)
43   void setImpl(void* theImpl);
44 };
45
46 #endif