Info.h 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. //-----------------------------------------------------------------------------
  2. // Basler pylon SDK
  3. // Copyright (c) 2006-2021 Basler AG
  4. // http://www.baslerweb.com
  5. // Author: AH
  6. //-----------------------------------------------------------------------------
  7. /*!
  8. \file
  9. \brief Definition of the IProperties interface and the CInfoBase class
  10. */
  11. #ifndef __INFO_H__
  12. #define __INFO_H__
  13. #if _MSC_VER > 1000
  14. #pragma once
  15. #endif
  16. #include <pylon/Platform.h>
  17. #ifdef _MSC_VER
  18. # pragma pack(push, PYLON_PACKING)
  19. #endif /* _MSC_VER */
  20. #include <pylon/stdinclude.h>
  21. #include <pylon/PylonBase.h>
  22. namespace Pylon
  23. {
  24. /*!
  25. \interface IProperties
  26. \brief interface for a property container
  27. */
  28. interface PUBLIC_INTERFACE IProperties
  29. {
  30. /// Retrieves a list of property names
  31. virtual int GetPropertyNames( StringList_t& ) const = 0;
  32. /// Returns true if a property with the provided name is available
  33. virtual bool GetPropertyAvailable( const String_t& Name ) const = 0;
  34. /// Retrieves a property value
  35. virtual bool GetPropertyValue( const String_t& Name, String_t& Value ) const = 0;
  36. /// Modifies a property value
  37. virtual IProperties& SetPropertyValue( const String_t& Name, const String_t& Value ) = 0;
  38. /// Returns true if all properties of the subset can be found and the values are equal
  39. /// The implementing container may use special knowledge on how to compare the values
  40. /// For instance for IP adresses, 192.2.3.45 == 192.2.3.0x2D
  41. virtual bool IsSubset( const IProperties& Subset ) const = 0;
  42. };
  43. ///This namespace contains values for the different transport layer types
  44. namespace TLType
  45. {
  46. ///Value for the GigE Vision transport layer
  47. const char* const TLTypeGigE = "GEV";
  48. ///Value for the USB3 Vision transport layer
  49. const char* const TLTypeUSB = "U3V";
  50. ///Value for the IIDC 1394 transport layer
  51. const char* const TLType1394 = "IIDC";
  52. ///Value for the BCON transport layer
  53. const char* const TLTypeBCON = "BCON";
  54. ///Value for the Camera Link transport layer
  55. const char* const TLTypeCL = "CL";
  56. ///Value for the camera emulator transport layer
  57. const char* const TLTypeCamEmu = "CamEmu";
  58. ///Value for the IP camera transport layer
  59. const char* const TLTypeIPCam = "IPCam";
  60. ///Value for the CoaXPress transport layer
  61. const char* const TLTypeCXP = "CXP";
  62. ///Value for the "Custom" transport layer
  63. const char* const TLTypeCustom = "Custom";
  64. }
  65. ///This namespace contains keys for accessing the properties of pylon info objects
  66. namespace Key
  67. {
  68. ///Identifies the human readable name of the device.
  69. const char* const FriendlyNameKey = "FriendlyName";
  70. ///Identifies the full name identifying the device.
  71. const char* const FullNameKey = "FullName";
  72. ///Identifies the vendor name of the device.
  73. const char* const VendorNameKey = "VendorName";
  74. ///Identifies the device class device, e.g. Basler1394.
  75. const char* const DeviceClassKey = "DeviceClass";
  76. ///Identifies the transport layer type.
  77. const char* const TLTypeKey = "TLType";
  78. ///Identifies the interface ID.
  79. const char* const InterfaceIDKey = "InterfaceID";
  80. }
  81. class CInfoImpl;
  82. /*!
  83. \brief Base implementation for PYLON info container.
  84. Info container allow a generic access to implemented properties. All
  85. Properties and their values can be accessed without knowing them in
  86. advance. It is possible to enumerate all properties available and corresponding
  87. values. Properties and values are represented as String_t. The normal usage
  88. is to have enumerators that create the info objects and clients that read only.
  89. If the type of the info object is known before client can use specific
  90. accessor function to retrieve the property values
  91. */
  92. class PYLONBASE_API CInfoBase : public IProperties
  93. {
  94. public:
  95. static const char* const PropertyNotAvailable;
  96. CInfoBase& operator=( const CInfoBase& );
  97. /// compare two info objects
  98. bool operator==( const CInfoBase& rhs ) const;
  99. /*!
  100. \brief Compares CInfoBase objects by device class.
  101. \param[in] rhs The right-hand side object of the comparison.
  102. \return Returns true according to this rule: USB < GigE < CameraLink < 1394 < GenTL (incl. CXP) < Bcon < unknown device classes < CamEmu.
  103. \error
  104. Does not throw C++ exceptions.
  105. */
  106. bool operator < ( const CInfoBase& rhs ) const;
  107. /* The underlying implementation does not need to support all the listed properties.
  108. The properties that are not supported always have the value "N/A" which is the value of CInfoBase::PropertyNotAvailable */
  109. ///Retrieves the human readable name of the device.
  110. ///This property is identified by Key::FriendlyNameKey.
  111. String_t GetFriendlyName() const;
  112. ///Sets the above property.
  113. CInfoBase& SetFriendlyName( const String_t& FriendlyNameValue );
  114. ///Returns true if the above property is available.
  115. bool IsFriendlyNameAvailable() const;
  116. ///Retrieves the full name identifying the device.
  117. ///This property is identified by Key::FullNameKey.
  118. String_t GetFullName() const;
  119. ///Sets the above property.
  120. CInfoBase& SetFullName( const String_t& FullNameValue );
  121. ///Returns true if the above property is available.
  122. bool IsFullNameAvailable() const;
  123. ///Retrieves the vendor name of the device.
  124. ///This property is identified by Key::VendorNameKey.
  125. String_t GetVendorName() const;
  126. ///Sets the above property.
  127. CInfoBase& SetVendorName( const String_t& VendorNameValue );
  128. ///Returns true if the above property is available.
  129. bool IsVendorNameAvailable() const;
  130. ///Retrieves the device class device, e.g. Basler1394.
  131. ///This property is identified by Key::DeviceClassKey.
  132. String_t GetDeviceClass() const;
  133. ///Sets the above property.
  134. CInfoBase& SetDeviceClass( const String_t& DeviceClassValue );
  135. ///Returns true if the above property is available.
  136. bool IsDeviceClassAvailable() const;
  137. ///Retrieves the transport layer type.
  138. ///This property is identified by Key::TLTypeKey.
  139. String_t GetTLType() const;
  140. ///Sets the above property.
  141. CInfoBase& SetTLType( const String_t& value );
  142. ///Returns true if the above property is available.
  143. bool IsTLTypeAvailable() const;
  144. public:
  145. static const char* GetPropertyNotAvailable();
  146. virtual int GetPropertyNames( StringList_t& ) const;
  147. virtual bool GetPropertyAvailable( const String_t& Name ) const;
  148. /* Returns the value of the property if this property is supported by the underlying implementation or "N/A". */
  149. virtual bool GetPropertyValue( const String_t& Name, String_t& Value ) const;
  150. virtual IProperties& SetPropertyValue( const String_t& Name, const String_t& Value );
  151. virtual bool IsUserProvided() const;
  152. virtual bool IsSubset( const IProperties& Subset ) const;
  153. protected:
  154. CInfoBase();
  155. CInfoBase( const CInfoBase& );
  156. virtual ~CInfoBase();
  157. protected:
  158. CInfoImpl* m_pImpl;
  159. };
  160. }
  161. #ifdef _MSC_VER
  162. # pragma pack(pop)
  163. #endif /* _MSC_VER */
  164. #endif