1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: GeomAPI_Interface.hxx
4 // Created: 23 Apr 2014
5 // Author: Mikhail PONIKAROV
7 #ifndef GeomAPI_Interface_H_
8 #define GeomAPI_Interface_H_
14 /**\class GeomAPI_Interface
16 * \brief General base class for all interfaces in this package
19 class GeomAPI_Interface
22 std::shared_ptr<void> myImpl; ///< pointer to the internal impl object
25 /// None - constructor
26 GEOMAPI_EXPORT GeomAPI_Interface();
28 /// Constructor by the impl pointer (used for internal needs)
29 template<class T> explicit GeomAPI_Interface(T* theImpl)
31 myImpl.reset(theImpl);
35 GEOMAPI_EXPORT virtual ~GeomAPI_Interface();
37 /// Returns the pointer to the impl
38 template<class T> inline T* implPtr()
40 return static_cast<T*>(myImpl.get());
42 /// Returns the pointer to the impl
43 template<class T> inline const T* implPtr() const
45 return static_cast<T*>(myImpl.get());
47 /// Returns the reference object of the impl
48 template<class T> inline const T& impl() const
50 return *(static_cast<T*>(myImpl.get()));
52 /// Updates the impl (deletes the old one)
53 template<class T> inline void setImpl(T* theImpl)
55 myImpl.reset(theImpl);
58 /// Returns true if the impl is empty
59 GEOMAPI_EXPORT bool empty() const;