Interface.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. //-----------------------------------------------------------------------------
  2. // Basler pylon SDK
  3. // Copyright (c) 2019-2021 Basler AG
  4. // http://www.baslerweb.com
  5. // Author: DV
  6. //-----------------------------------------------------------------------------
  7. /*!
  8. \file
  9. \brief Definiton of Interface interface
  10. */
  11. #ifndef PYLON_INTERFACE_H__
  12. #define PYLON_INTERFACE_H__
  13. #pragma once
  14. #include <pylon/Platform.h>
  15. #ifdef _MSC_VER
  16. # pragma pack(push, PYLON_PACKING)
  17. #endif /* _MSC_VER */
  18. #include <GenICamFwd.h>
  19. #include <pylon/stdinclude.h>
  20. #include <pylon/DeviceFactory.h>
  21. #include <pylon/InterfaceInfo.h>
  22. namespace Pylon
  23. {
  24. /*!
  25. \ingroup Pylon_TransportLayer
  26. \interface IInterface
  27. \brief An interface is used to represent a frame grabber board, a network card, etc.
  28. Currently, this object type is mainly used for the pylon GenTL Consumer Transport Layer, e.g., for CoaXPress.
  29. All other pylon transport layers currently return one default interface.
  30. The 'open' status of an interface instance won't change even if an attached camera is used, e.g., opened or closed.
  31. */
  32. interface PUBLIC_INTERFACE IInterface : public IDeviceFactory
  33. {
  34. /*!
  35. \brief Opens an interface to be able access it's parameters via GetNodeMap().
  36. \note You can use the methods provided by IDeviceFactory regardless of whether the interface is opened or closed.
  37. \post
  38. <ul>
  39. <li> The interface is open.
  40. <li> The node map can be accessed via GetNodeMap().
  41. </ul>
  42. \threading
  43. This method is thread-safe.
  44. \error
  45. Throws a C++ exception if opening the interface fails.
  46. */
  47. virtual void Open() = 0;
  48. /*!
  49. \brief Closes an interface.
  50. \threading
  51. This method is thread-safe.
  52. \post
  53. <ul>
  54. <li> The interface is closed.
  55. <li> Any previously acquired node map using GetNodeMap() has been deleted and must not be used any longer.
  56. </ul>
  57. \error
  58. Does not throw C++ exceptions.
  59. */
  60. virtual void Close() = 0;
  61. /*!
  62. \brief Checks if the interface is open.
  63. \note The 'open' status of an interface instance won't change even if an attached camera is used, e.g., opened or closed.
  64. \return Returns true if when the interface is open.
  65. \threading
  66. This method is thread-safe.
  67. \error
  68. Does not throw C++ exceptions.
  69. */
  70. virtual bool IsOpen() const = 0;
  71. /*! \brief Returns the interface info object storing information like the Interface ID property.
  72. This information is available at all times regardless of whether the interface is open or closed.
  73. \return A reference to the interface info object.
  74. \threading
  75. This method is thread-safe.
  76. \error
  77. Does not throw C++ exceptions.
  78. */
  79. virtual const CInterfaceInfo& GetInterfaceInfo() const = 0;
  80. /*!
  81. \brief Returns the GenApi node map used for accessing parameters provided by the interface.
  82. \note The default interface object does not provide a node map.
  83. \return Returns the GenApi node map used for accessing parameters provided by the interface.
  84. If no parameters are available, NULL is returned.
  85. \threading
  86. This method is thread-safe.
  87. \error
  88. Can throw C++ exceptions.
  89. */
  90. virtual GenApi::INodeMap* GetNodeMap() = 0;
  91. protected:
  92. virtual ~IInterface() = 0;
  93. };
  94. // Note: the C++ standard >= 11 prohibit pure virtual destructors with a function body
  95. // in the declaration. Consequently gcc 4.0 and newer reject an inline implementation
  96. // in the class.
  97. inline IInterface::~IInterface()
  98. {
  99. }
  100. }
  101. #ifdef _MSC_VER
  102. # pragma pack(pop)
  103. #endif /* _MSC_VER */
  104. #endif /* PYLON_INTERFACE_H__ */