ISelector.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. //-----------------------------------------------------------------------------
  2. // (c) 2006 by Basler Vision Technologies
  3. // Section: Vision Components
  4. // Project: GenApi
  5. // Author: Hartmut Nebelung
  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 ISelector
  28. */
  29. #ifndef GENAPI_ISELECTOR_H
  30. #define GENAPI_ISELECTOR_H
  31. #include <GenApi/GenApiDll.h>
  32. #ifdef _MSC_VER
  33. # pragma warning ( push )
  34. # pragma warning ( disable : 4251 ) // XXX needs to have dll-interface to be used by clients of class YYY
  35. #endif
  36. namespace GENAPI_NAMESPACE
  37. {
  38. /**
  39. \brief Interface for groups of features selected by a single one
  40. \ingroup GenApi_PublicImpl
  41. */
  42. interface GENAPI_DECL_ABSTRACT ISelector : virtual public IBase
  43. {
  44. //! true iff this feature selects a group of features
  45. virtual bool IsSelector() const = 0;
  46. //! retrieve the group of selected features
  47. virtual void GetSelectedFeatures( FeatureList_t& ) const = 0;
  48. //! retrieve the group of features selecting this node
  49. virtual void GetSelectingFeatures( FeatureList_t& ) const = 0;
  50. };
  51. //*************************************************************
  52. // CSelectorRef class
  53. //*************************************************************
  54. /**
  55. \internal
  56. \brief Reference to an ISelector pointer
  57. \ingroup GenApi_PublicImpl
  58. */
  59. template <class T>
  60. class CSelectorRefT : public CBaseRefT<T>
  61. {
  62. typedef CBaseRefT<T> ref;
  63. public:
  64. /*--------------------------------------------------------*/
  65. // ISelector
  66. /*--------------------------------------------------------*/
  67. //! Get all features of the Selector
  68. virtual void GetSelectedFeatures(FeatureList_t &Features) const
  69. {
  70. if(ref::m_Ptr)
  71. return ref::m_Ptr->GetSelectedFeatures( Features );
  72. else
  73. throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
  74. }
  75. //! retrieve the group of features selecting this node
  76. virtual void GetSelectingFeatures( FeatureList_t& Features) const
  77. {
  78. if(ref::m_Ptr)
  79. return ref::m_Ptr->GetSelectingFeatures( Features );
  80. else
  81. throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
  82. }
  83. //! true iff this feature selects a group of features
  84. virtual bool IsSelector() const
  85. {
  86. if(ref::m_Ptr)
  87. return ref::m_Ptr->IsSelector();
  88. else
  89. throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
  90. }
  91. };
  92. //! Reference to an ISelector pointer
  93. //! \ingroup GenApi_PublicImpl
  94. typedef CSelectorRefT<ISelector> CSelectorRef;
  95. }
  96. #ifdef _MSC_VER
  97. # pragma warning ( pop )
  98. #endif
  99. #endif // GENAPI_ISELECTOR_H