/src/FreeImage/Source/OpenEXR/IlmImf/ImfBoxAttribute.cpp

https://bitbucket.org/cabalistic/ogredeps/ · C++ · 110 lines · 51 code · 20 blank · 39 comment · 0 complexity · cf11620b6297c93f6f15069453b4811b MD5 · raw file

  1. ///////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 2004, Industrial Light & Magic, a division of Lucas
  4. // Digital Ltd. LLC
  5. //
  6. // All rights reserved.
  7. //
  8. // Redistribution and use in source and binary forms, with or without
  9. // modification, are permitted provided that the following conditions are
  10. // met:
  11. // * Redistributions of source code must retain the above copyright
  12. // notice, this list of conditions and the following disclaimer.
  13. // * Redistributions in binary form must reproduce the above
  14. // copyright notice, this list of conditions and the following disclaimer
  15. // in the documentation and/or other materials provided with the
  16. // distribution.
  17. // * Neither the name of Industrial Light & Magic nor the names of
  18. // its contributors may be used to endorse or promote products derived
  19. // from this software without specific prior written permission.
  20. //
  21. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  24. // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  25. // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  26. // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  27. // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  28. // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  29. // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  30. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  31. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. //
  33. ///////////////////////////////////////////////////////////////////////////
  34. //-----------------------------------------------------------------------------
  35. //
  36. // class Box2iAttribute
  37. // class Box2fAttribute
  38. //
  39. //-----------------------------------------------------------------------------
  40. #include <ImfBoxAttribute.h>
  41. namespace Imf {
  42. template <>
  43. const char *
  44. Box2iAttribute::staticTypeName ()
  45. {
  46. return "box2i";
  47. }
  48. template <>
  49. void
  50. Box2iAttribute::writeValueTo (OStream &os, int version) const
  51. {
  52. Xdr::write <StreamIO> (os, _value.min.x);
  53. Xdr::write <StreamIO> (os, _value.min.y);
  54. Xdr::write <StreamIO> (os, _value.max.x);
  55. Xdr::write <StreamIO> (os, _value.max.y);
  56. }
  57. template <>
  58. void
  59. Box2iAttribute::readValueFrom (IStream &is, int size, int version)
  60. {
  61. Xdr::read <StreamIO> (is, _value.min.x);
  62. Xdr::read <StreamIO> (is, _value.min.y);
  63. Xdr::read <StreamIO> (is, _value.max.x);
  64. Xdr::read <StreamIO> (is, _value.max.y);
  65. }
  66. template <>
  67. const char *
  68. Box2fAttribute::staticTypeName ()
  69. {
  70. return "box2f";
  71. }
  72. template <>
  73. void
  74. Box2fAttribute::writeValueTo (OStream &os, int version) const
  75. {
  76. Xdr::write <StreamIO> (os, _value.min.x);
  77. Xdr::write <StreamIO> (os, _value.min.y);
  78. Xdr::write <StreamIO> (os, _value.max.x);
  79. Xdr::write <StreamIO> (os, _value.max.y);
  80. }
  81. template <>
  82. void
  83. Box2fAttribute::readValueFrom (IStream &is, int size, int version)
  84. {
  85. Xdr::read <StreamIO> (is, _value.min.x);
  86. Xdr::read <StreamIO> (is, _value.min.y);
  87. Xdr::read <StreamIO> (is, _value.max.x);
  88. Xdr::read <StreamIO> (is, _value.max.y);
  89. }
  90. } // namespace Imf