ImfOpaqueAttribute.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. //
  2. // SPDX-License-Identifier: BSD-3-Clause
  3. // Copyright (c) Contributors to the OpenEXR Project.
  4. //
  5. #ifndef INCLUDED_IMF_OPAQUE_ATTRIBUTE_H
  6. #define INCLUDED_IMF_OPAQUE_ATTRIBUTE_H
  7. //-----------------------------------------------------------------------------
  8. //
  9. // class OpaqueAttribute
  10. //
  11. // When an image file is read, OpqaqueAttribute objects are used
  12. // to hold the values of attributes whose types are not recognized
  13. // by the reading program. OpaqueAttribute objects can be read
  14. // from an image file, copied, and written back to to another image
  15. // file, but their values are inaccessible.
  16. //
  17. //-----------------------------------------------------------------------------
  18. #include "ImfExport.h"
  19. #include "ImfNamespace.h"
  20. #include "ImfAttribute.h"
  21. #include "ImfArray.h"
  22. OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
  23. class IMF_EXPORT_TYPE OpaqueAttribute: public Attribute
  24. {
  25. public:
  26. //----------------------------
  27. // Constructors and destructor
  28. //----------------------------
  29. IMF_EXPORT OpaqueAttribute (const char typeName[]);
  30. IMF_EXPORT OpaqueAttribute (const OpaqueAttribute &other);
  31. IMF_EXPORT virtual ~OpaqueAttribute ();
  32. //-------------------------------
  33. // Get this attribute's type name
  34. //-------------------------------
  35. IMF_EXPORT virtual const char * typeName () const;
  36. //------------------------------
  37. // Make a copy of this attribute
  38. //------------------------------
  39. IMF_EXPORT virtual Attribute * copy () const;
  40. //----------------
  41. // I/O and copying
  42. //----------------
  43. IMF_EXPORT virtual void writeValueTo (OPENEXR_IMF_INTERNAL_NAMESPACE::OStream &os,
  44. int version) const;
  45. IMF_EXPORT virtual void readValueFrom (OPENEXR_IMF_INTERNAL_NAMESPACE::IStream &is,
  46. int size,
  47. int version);
  48. IMF_EXPORT virtual void copyValueFrom (const Attribute &other);
  49. int dataSize() const { return _dataSize; }
  50. const Array<char>& data() const { return _data; }
  51. private:
  52. std::string _typeName;
  53. long _dataSize;
  54. Array<char> _data;
  55. };
  56. OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
  57. #endif