XMLID.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. //-----------------------------------------------------------------------------
  2. // (c) 2008 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_NAMESPACE 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_NAMESPACE.org) for a full copy.
  12. //
  13. // THIS SOFTWARE IS PROVIDED BY THE EMVA GENICAM_NAMESPACE 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_NAMESPACE 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. */
  28. #ifndef CLPROTOCOL_XMLID_H
  29. #define CLPROTOCOL_XMLID_H
  30. #include <Base/GCBase.h>
  31. #include <Base/GCUtilities.h>
  32. #include <CLProtocol/CVersion.h>
  33. namespace CLProtocol
  34. {
  35. //! Helper class which can split XMLIDs strings into tokens
  36. /*! \ingroup PublicInterfaces */
  37. class CLPROTOCOL_DECL CXMLID
  38. {
  39. public:
  40. //! returns the token separator string
  41. static const char* GetTokenSeparator();
  42. //! returns the token separator string
  43. /** \deprecated This function has been declared <b>deprecated</b> because of a typo in the functions name. Use <b>CXMLID::GetTokenSeparator()</b> instead.
  44. */
  45. GENICAM_DEPRECATED( static const char* GetTokenSeperator() );
  46. //! Constructor
  47. CXMLID();
  48. //! Parses the XML ID
  49. bool FromString(const GENICAM_NAMESPACE::gcstring &XMLID);
  50. //! Returns the original XML ID
  51. GENICAM_NAMESPACE::gcstring ToString();
  52. //! retrieves the schema version of the XML file
  53. CVersion GetSchemaVersion() const;
  54. //! retrieves the schema version of the XML file
  55. CVersion GetDeviceVersion() const;
  56. //! retrieves the schema version of the XML file
  57. GENICAM_NAMESPACE::gcstring GetDeviceIDTemplate() const;
  58. //! Comparison (for sorting)
  59. bool operator>(CXMLID& XMLID);
  60. private:
  61. //! The positions of the tokens within the XMLID string
  62. typedef enum
  63. {
  64. xidSchemaVersion = 0,
  65. xidDeviceIDTemplate = 1,
  66. xidDeviceVersion = 2
  67. } EXMLIDIndex;
  68. //! The original string
  69. GENICAM_NAMESPACE::gcstring m_XMLID;
  70. //! The middle part of the XML ID
  71. GENICAM_NAMESPACE::gcstring m_DeviceIDTemplate;
  72. //! The first part of the XML ID
  73. CVersion m_SchemaVersion;
  74. //! The last part of the XML ID
  75. CVersion m_DeviceVersion;
  76. };
  77. //! for sorting a vector of pointers to CXMLID objects
  78. /*! returns true if pA comes before pB */
  79. inline bool CompareCXMLID( CXMLID *pA, CXMLID *pB )
  80. {
  81. return *pA > *pB;
  82. }
  83. }
  84. #endif // CLPROTOCOL_XMLID_H