ImfVecAttribute.cpp 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  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 V2iAttribute
  37. // class V2fAttribute
  38. // class V2dAttribute
  39. // class V3iAttribute
  40. // class V3fAttribute
  41. // class V3dAttribute
  42. //
  43. //-----------------------------------------------------------------------------
  44. #include <ImfVecAttribute.h>
  45. OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER
  46. using namespace OPENEXR_IMF_INTERNAL_NAMESPACE;
  47. template <>
  48. const char *
  49. V2iAttribute::staticTypeName ()
  50. {
  51. return "v2i";
  52. }
  53. template <>
  54. void
  55. V2iAttribute::writeValueTo (OPENEXR_IMF_INTERNAL_NAMESPACE::OStream &os, int version) const
  56. {
  57. Xdr::write <StreamIO> (os, _value.x);
  58. Xdr::write <StreamIO> (os, _value.y);
  59. }
  60. template <>
  61. void
  62. V2iAttribute::readValueFrom (OPENEXR_IMF_INTERNAL_NAMESPACE::IStream &is, int size, int version)
  63. {
  64. Xdr::read <StreamIO> (is, _value.x);
  65. Xdr::read <StreamIO> (is, _value.y);
  66. }
  67. template <>
  68. const char *
  69. V2fAttribute::staticTypeName ()
  70. {
  71. return "v2f";
  72. }
  73. template <>
  74. void
  75. V2fAttribute::writeValueTo (OPENEXR_IMF_INTERNAL_NAMESPACE::OStream &os, int version) const
  76. {
  77. Xdr::write <StreamIO> (os, _value.x);
  78. Xdr::write <StreamIO> (os, _value.y);
  79. }
  80. template <>
  81. void
  82. V2fAttribute::readValueFrom (OPENEXR_IMF_INTERNAL_NAMESPACE::IStream &is, int size, int version)
  83. {
  84. Xdr::read <StreamIO> (is, _value.x);
  85. Xdr::read <StreamIO> (is, _value.y);
  86. }
  87. template <>
  88. const char *
  89. V2dAttribute::staticTypeName ()
  90. {
  91. return "v2d";
  92. }
  93. template <>
  94. void
  95. V2dAttribute::writeValueTo (OPENEXR_IMF_INTERNAL_NAMESPACE::OStream &os, int version) const
  96. {
  97. Xdr::write <StreamIO> (os, _value.x);
  98. Xdr::write <StreamIO> (os, _value.y);
  99. }
  100. template <>
  101. void
  102. V2dAttribute::readValueFrom (OPENEXR_IMF_INTERNAL_NAMESPACE::IStream &is, int size, int version)
  103. {
  104. Xdr::read <StreamIO> (is, _value.x);
  105. Xdr::read <StreamIO> (is, _value.y);
  106. }
  107. template <>
  108. const char *
  109. V3iAttribute::staticTypeName ()
  110. {
  111. return "v3i";
  112. }
  113. template <>
  114. void
  115. V3iAttribute::writeValueTo (OPENEXR_IMF_INTERNAL_NAMESPACE::OStream &os, int version) const
  116. {
  117. Xdr::write <StreamIO> (os, _value.x);
  118. Xdr::write <StreamIO> (os, _value.y);
  119. Xdr::write <StreamIO> (os, _value.z);
  120. }
  121. template <>
  122. void
  123. V3iAttribute::readValueFrom (OPENEXR_IMF_INTERNAL_NAMESPACE::IStream &is, int size, int version)
  124. {
  125. Xdr::read <StreamIO> (is, _value.x);
  126. Xdr::read <StreamIO> (is, _value.y);
  127. Xdr::read <StreamIO> (is, _value.z);
  128. }
  129. template <>
  130. const char *
  131. V3fAttribute::staticTypeName ()
  132. {
  133. return "v3f";
  134. }
  135. template <>
  136. void
  137. V3fAttribute::writeValueTo (OPENEXR_IMF_INTERNAL_NAMESPACE::OStream &os, int version) const
  138. {
  139. Xdr::write <StreamIO> (os, _value.x);
  140. Xdr::write <StreamIO> (os, _value.y);
  141. Xdr::write <StreamIO> (os, _value.z);
  142. }
  143. template <>
  144. void
  145. V3fAttribute::readValueFrom (OPENEXR_IMF_INTERNAL_NAMESPACE::IStream &is, int size, int version)
  146. {
  147. Xdr::read <StreamIO> (is, _value.x);
  148. Xdr::read <StreamIO> (is, _value.y);
  149. Xdr::read <StreamIO> (is, _value.z);
  150. }
  151. template <>
  152. const char *
  153. V3dAttribute::staticTypeName ()
  154. {
  155. return "v3d";
  156. }
  157. template <>
  158. void
  159. V3dAttribute::writeValueTo (OPENEXR_IMF_INTERNAL_NAMESPACE::OStream &os, int version) const
  160. {
  161. Xdr::write <StreamIO> (os, _value.x);
  162. Xdr::write <StreamIO> (os, _value.y);
  163. Xdr::write <StreamIO> (os, _value.z);
  164. }
  165. template <>
  166. void
  167. V3dAttribute::readValueFrom (OPENEXR_IMF_INTERNAL_NAMESPACE::IStream &is, int size, int version)
  168. {
  169. Xdr::read <StreamIO> (is, _value.x);
  170. Xdr::read <StreamIO> (is, _value.y);
  171. Xdr::read <StreamIO> (is, _value.z);
  172. }
  173. OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_EXIT