FeaturePersistence.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. //-----------------------------------------------------------------------------
  2. // Basler pylon SDK
  3. // Copyright (c) 2009-2021 Basler AG
  4. // http://www.baslerweb.com
  5. // Author: Italo Anzioso
  6. //-----------------------------------------------------------------------------
  7. /*!
  8. \file FeaturePersistence.h
  9. \brief Pylon::CFeaturePersistence class with static helper functions for loading
  10. and saving camera features.
  11. \date 2007-09-11
  12. */
  13. #ifndef __PYLON_FeaturePersistence_H_090218_090218_IS_INCLUDED__
  14. #define __PYLON_FeaturePersistence_H_090218_090218_IS_INCLUDED__
  15. #if _MSC_VER > 1000
  16. #pragma once
  17. #endif
  18. #include <pylon/Platform.h>
  19. #ifdef _MSC_VER
  20. # pragma pack(push, PYLON_PACKING)
  21. #endif /* _MSC_VER */
  22. #include <GenICamFwd.h>
  23. #include <pylon/stdinclude.h> // Pylon::String_t
  24. #include <pylon/PylonUtility.h> // defines PYLONUTILITY_API
  25. namespace Pylon
  26. {
  27. /*! \brief Utility class for saving and restoring camera features to and from a file or string.
  28. \note When saving features, the behavior of cameras supporting sequencers depends on the
  29. current setting of the "SequenceEnable" (some GigE models) or
  30. "SequencerConfigurationMode" (USB only) features respectively.
  31. Only if the sequencer is in configuration mode, are the sequence sets exported.
  32. Otherwise, the camera features are exported without sequence sets.
  33. */
  34. class PYLONUTILITY_API CFeaturePersistence
  35. {
  36. public:
  37. /*! \brief Loads the features from the file to the node map.
  38. \param[in] FileName Name of the file that contains the node map values.
  39. \param[in] pNodeMap Pointer to the node map
  40. \param[in] validate If validate==true, all node values will be validated.
  41. In case of an error, a GenICam::RuntimeException will be thrown
  42. \error Throws an exception if loading fails.
  43. */
  44. static void Load( const String_t& FileName,
  45. GenApi::INodeMap* pNodeMap,
  46. bool validate = true
  47. );
  48. /*! \brief Saves the node map to the file.
  49. Sequence sets of a camera are automatically saved if SequenceEnable or
  50. SequencerConfigurationMode is enabled.
  51. \param[in] FileName Name of the file that contains the node map values
  52. \param[in] pNodeMap Pointer to the node map
  53. \error Throws an exception if saving fails.
  54. */
  55. static void Save( const String_t& FileName,
  56. GenApi::INodeMap* pNodeMap
  57. );
  58. /*!
  59. \brief Loads the features from the string to the node map.
  60. \param[in] Features String containing the node map values.
  61. \param[in] pNodeMap Pointer to the node map.
  62. \param[in] validate If validate==true, all node values will be validated.
  63. In case of an error, a GenICam::RuntimeException will be thrown.
  64. \error Throws an exception if loading fails.
  65. */
  66. static void LoadFromString( const String_t& Features,
  67. GenApi::INodeMap* pNodeMap,
  68. bool validate = true
  69. );
  70. /*! \brief Saves the node map to the string.
  71. Sequence sets of a camera are automatically saved, if SequenceEnable or
  72. SequencerConfigurationMode is enabled.
  73. \param[out] Features String containing the node map values
  74. \param[in] pNodeMap Pointer to the node map
  75. \error Throws an exception if saving fails.
  76. */
  77. static void SaveToString( String_t& Features,
  78. GenApi::INodeMap* pNodeMap
  79. );
  80. private:
  81. CFeaturePersistence( void );
  82. ~CFeaturePersistence( void );
  83. };
  84. } // Pylon Namespace
  85. #ifdef _MSC_VER
  86. # pragma pack(pop)
  87. #endif /* _MSC_VER */
  88. #endif //__PYLON_FeaturePersistence_H_090218_090218_IS_INCLUDED__