IBoolean.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. //-----------------------------------------------------------------------------
  2. // (c) 2006 by Basler Vision Technologies
  3. // Section: Vision Components
  4. // Project: GenApi
  5. // Author: Margret Albrecht
  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 IBoolean interface
  28. \ingroup GenApi_PublicInterface
  29. */
  30. #ifndef GENAPI_IBOOLEAN_H
  31. #define GENAPI_IBOOLEAN_H
  32. #include <GenApi/GenApiDll.h>
  33. #include <GenApi/Types.h>
  34. #include <GenApi/IValue.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. // IBoolean interface
  43. //*************************************************************
  44. /**
  45. \brief Interface for Boolean properties
  46. \ingroup GenApi_PublicInterface
  47. */
  48. interface GENAPI_DECL_ABSTRACT IBoolean : virtual public IValue
  49. {
  50. public:
  51. //! Set node value
  52. /*!
  53. \param Value The value to set
  54. \param Verify Enables AccessMode and Range verification (default = true)
  55. */
  56. virtual void SetValue(bool Value, bool Verify = true) = 0;
  57. //! Set node value
  58. virtual void operator=(bool Value){ SetValue( Value ); }
  59. //! Get node value
  60. /*!
  61. \param Verify Enables Range verification (default = false). The AccessMode is always checked
  62. \param IgnoreCache If true the value is read ignoring any caches (default = false)
  63. \return The value read
  64. */
  65. virtual bool GetValue(bool Verify = false, bool IgnoreCache = false) const = 0;
  66. //! Get node value
  67. virtual bool operator()() const { return GetValue(); }
  68. };
  69. //*************************************************************
  70. // CBooleanRef class
  71. //*************************************************************
  72. #ifndef DOXYGEN_IGNORE
  73. /**
  74. \internal
  75. \brief Reference to an IInteger pointer
  76. \ingroup GenApi_PublicImpl
  77. */
  78. template <class T>
  79. class CBooleanRefT : public CValueRefT<T>
  80. {
  81. typedef CValueRefT<T> ref;
  82. public:
  83. /*--------------------------------------------------------*/
  84. // IBoolean
  85. /*--------------------------------------------------------*/
  86. //! Set node value
  87. virtual void SetValue(bool Value, bool Verify = true)
  88. {
  89. if(ref::m_Ptr)
  90. return ref::m_Ptr->SetValue(Value, Verify);
  91. else
  92. throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
  93. // unused param *JS* (removed warning)
  94. GC_UNUSED(Verify);
  95. }
  96. //! Set node value
  97. virtual void operator=(bool Value)
  98. {
  99. if(ref::m_Ptr)
  100. return ref::m_Ptr->operator=(Value);
  101. else
  102. throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
  103. }
  104. //! Get node value
  105. virtual bool GetValue(bool Verify = false, bool IgnoreCache = false) const
  106. {
  107. if(ref::m_Ptr)
  108. return ref::m_Ptr->GetValue(Verify, IgnoreCache);
  109. else
  110. throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
  111. }
  112. //! Get node value
  113. virtual bool operator()() const
  114. {
  115. if(ref::m_Ptr)
  116. return ref::m_Ptr->operator()();
  117. else
  118. throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
  119. }
  120. };
  121. //! Reference to an IBoolean pointer
  122. //! \ingroup GenApi_PublicImpl
  123. typedef CBooleanRefT<IBoolean> CBooleanRef;
  124. #endif
  125. }
  126. #ifdef _MSC_VER
  127. # pragma warning ( pop )
  128. #endif
  129. #endif // ifndef GENAPI_IBOOLEAN_H