IBase.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. //-----------------------------------------------------------------------------
  2. // (c) 2006 by Basler Vision Technologies
  3. // Section: Vision Components
  4. // Project: GenApi
  5. // Author: Fritz Dierks
  6. // $Header$
  7. //
  8. // License: This file is published under the license of the EMVA GenICam Standard Group.
  9. // A text file describing the legal terms is included in your installation as 'GenICam_license.pdf'.
  10. // If for some reason you are missing this file please contact the EMVA or visit the website
  11. // (http://www.genicam.org) for a full copy.
  12. //
  13. // THIS SOFTWARE IS PROVIDED BY THE EMVA GENICAM STANDARD GROUP "AS IS"
  14. // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  15. // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  16. // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE EMVA GENICAM STANDARD GROUP
  17. // OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  18. // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  19. // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  20. // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  21. // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  22. // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  23. // POSSIBILITY OF SUCH DAMAGE.
  24. //-----------------------------------------------------------------------------
  25. /*!
  26. \file
  27. \brief Definition of interface IBase
  28. \ingroup GenApi_PublicInterface
  29. */
  30. #ifndef GENAPI_IBASE_H
  31. #define GENAPI_IBASE_H
  32. #include <GenApi/GenApiDll.h>
  33. #include <GenApi/Types.h>
  34. #include <GenApi/Reference.h>
  35. #ifdef _MSC_VER
  36. # pragma warning ( push )
  37. # pragma warning ( disable : 4251 ) // XXX needs to have dll-interface to be used by clients of class YYY
  38. #endif
  39. namespace GENAPI_NAMESPACE
  40. {
  41. //*************************************************************
  42. // IBase interface
  43. //*************************************************************
  44. /**
  45. \brief Base interface common to all nodes
  46. \ingroup GenApi_PublicInterface
  47. */
  48. interface GENAPI_DECL_ABSTRACT IBase
  49. {
  50. //! Get the access mode of the node
  51. virtual EAccessMode GetAccessMode() const = 0;
  52. //! Virtual destructor enforcing virtual destructor on all derived classes
  53. virtual ~IBase() = 0;
  54. };
  55. // Implementation required for Windows only.
  56. // Note: the C++ standard >= 11 prohibit pure virtual destructors with a function body
  57. // in the declaration. Consequently gcc 4.0 and newer reject an inline implementation
  58. // in the class.
  59. inline IBase::~IBase()
  60. {
  61. // do nothing
  62. }
  63. //*************************************************************
  64. // CBaseRef class
  65. //*************************************************************
  66. #ifndef DOXYGEN_IGNORE
  67. /**
  68. \internal
  69. \brief Reference to an IBase pointer
  70. \ingroup GenApi_PublicImpl
  71. */
  72. template <class T, class I=T>
  73. class CBaseRefT : public CReferenceT<T, I>
  74. {
  75. typedef CReferenceT<T, I> ref;
  76. public:
  77. /*--------------------------------------------------------*/
  78. // IBase
  79. /*--------------------------------------------------------*/
  80. //! Get the access mode of the node
  81. virtual EAccessMode GetAccessMode() const
  82. {
  83. if(ref::m_Ptr)
  84. return ref::m_Ptr->GetAccessMode();
  85. else
  86. return NI;
  87. }
  88. };
  89. //! Reference to an IBase pointer
  90. //! \ingroup GenApi_PublicImpl
  91. typedef CBaseRefT<IBase> CBaseRef;
  92. #endif
  93. }
  94. #ifdef _MSC_VER
  95. # pragma warning ( pop )
  96. #endif
  97. #endif // ifndef GENAPI_IBASE_H