PageRenderTime 47ms CodeModel.GetById 10ms app.highlight 32ms RepoModel.GetById 2ms app.codeStats 0ms

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

https://bitbucket.org/cabalistic/ogredeps/
C++ | 260 lines | 167 code | 52 blank | 41 comment | 0 complexity | 60ca567c5ac91ae9ba2f3b578559e072 MD5 | raw file
  1///////////////////////////////////////////////////////////////////////////
  2//
  3// Copyright (c) 2002, 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
 37//-----------------------------------------------------------------------------
 38//
 39//	class M33fAttribute
 40//	class M33dAttribute
 41//	class M44fAttribute
 42//	class M44dAttribute
 43//
 44//-----------------------------------------------------------------------------
 45
 46#include <ImfMatrixAttribute.h>
 47
 48
 49namespace Imf {
 50
 51
 52template <>
 53const char *
 54M33fAttribute::staticTypeName ()
 55{
 56    return "m33f";
 57}
 58
 59
 60template <>
 61void
 62M33fAttribute::writeValueTo (OStream &os, int version) const
 63{
 64    Xdr::write <StreamIO> (os, _value[0][0]);
 65    Xdr::write <StreamIO> (os, _value[0][1]);
 66    Xdr::write <StreamIO> (os, _value[0][2]);
 67
 68    Xdr::write <StreamIO> (os, _value[1][0]);
 69    Xdr::write <StreamIO> (os, _value[1][1]);
 70    Xdr::write <StreamIO> (os, _value[1][2]);
 71
 72    Xdr::write <StreamIO> (os, _value[2][0]);
 73    Xdr::write <StreamIO> (os, _value[2][1]);
 74    Xdr::write <StreamIO> (os, _value[2][2]);
 75}
 76
 77
 78template <>
 79void
 80M33fAttribute::readValueFrom (IStream &is, int size, int version)
 81{
 82    Xdr::read <StreamIO> (is, _value[0][0]);
 83    Xdr::read <StreamIO> (is, _value[0][1]);
 84    Xdr::read <StreamIO> (is, _value[0][2]);
 85
 86    Xdr::read <StreamIO> (is, _value[1][0]);
 87    Xdr::read <StreamIO> (is, _value[1][1]);
 88    Xdr::read <StreamIO> (is, _value[1][2]);
 89
 90    Xdr::read <StreamIO> (is, _value[2][0]);
 91    Xdr::read <StreamIO> (is, _value[2][1]);
 92    Xdr::read <StreamIO> (is, _value[2][2]);
 93}
 94
 95
 96template <>
 97const char *
 98M33dAttribute::staticTypeName ()
 99{
100    return "m33d";
101}
102
103
104template <>
105void
106M33dAttribute::writeValueTo (OStream &os, int version) const
107{
108    Xdr::write <StreamIO> (os, _value[0][0]);
109    Xdr::write <StreamIO> (os, _value[0][1]);
110    Xdr::write <StreamIO> (os, _value[0][2]);
111
112    Xdr::write <StreamIO> (os, _value[1][0]);
113    Xdr::write <StreamIO> (os, _value[1][1]);
114    Xdr::write <StreamIO> (os, _value[1][2]);
115
116    Xdr::write <StreamIO> (os, _value[2][0]);
117    Xdr::write <StreamIO> (os, _value[2][1]);
118    Xdr::write <StreamIO> (os, _value[2][2]);
119}
120
121
122template <>
123void
124M33dAttribute::readValueFrom (IStream &is, int size, int version)
125{
126    Xdr::read <StreamIO> (is, _value[0][0]);
127    Xdr::read <StreamIO> (is, _value[0][1]);
128    Xdr::read <StreamIO> (is, _value[0][2]);
129
130    Xdr::read <StreamIO> (is, _value[1][0]);
131    Xdr::read <StreamIO> (is, _value[1][1]);
132    Xdr::read <StreamIO> (is, _value[1][2]);
133
134    Xdr::read <StreamIO> (is, _value[2][0]);
135    Xdr::read <StreamIO> (is, _value[2][1]);
136    Xdr::read <StreamIO> (is, _value[2][2]);
137}
138
139
140template <>
141const char *
142M44fAttribute::staticTypeName ()
143{
144    return "m44f";
145}
146
147
148template <>
149void
150M44fAttribute::writeValueTo (OStream &os, int version) const
151{
152    Xdr::write <StreamIO> (os, _value[0][0]);
153    Xdr::write <StreamIO> (os, _value[0][1]);
154    Xdr::write <StreamIO> (os, _value[0][2]);
155    Xdr::write <StreamIO> (os, _value[0][3]);
156
157    Xdr::write <StreamIO> (os, _value[1][0]);
158    Xdr::write <StreamIO> (os, _value[1][1]);
159    Xdr::write <StreamIO> (os, _value[1][2]);
160    Xdr::write <StreamIO> (os, _value[1][3]);
161
162    Xdr::write <StreamIO> (os, _value[2][0]);
163    Xdr::write <StreamIO> (os, _value[2][1]);
164    Xdr::write <StreamIO> (os, _value[2][2]);
165    Xdr::write <StreamIO> (os, _value[2][3]);
166
167    Xdr::write <StreamIO> (os, _value[3][0]);
168    Xdr::write <StreamIO> (os, _value[3][1]);
169    Xdr::write <StreamIO> (os, _value[3][2]);
170    Xdr::write <StreamIO> (os, _value[3][3]);
171}
172
173
174template <>
175void
176M44fAttribute::readValueFrom (IStream &is, int size, int version)
177{
178    Xdr::read <StreamIO> (is, _value[0][0]);
179    Xdr::read <StreamIO> (is, _value[0][1]);
180    Xdr::read <StreamIO> (is, _value[0][2]);
181    Xdr::read <StreamIO> (is, _value[0][3]);
182
183    Xdr::read <StreamIO> (is, _value[1][0]);
184    Xdr::read <StreamIO> (is, _value[1][1]);
185    Xdr::read <StreamIO> (is, _value[1][2]);
186    Xdr::read <StreamIO> (is, _value[1][3]);
187
188    Xdr::read <StreamIO> (is, _value[2][0]);
189    Xdr::read <StreamIO> (is, _value[2][1]);
190    Xdr::read <StreamIO> (is, _value[2][2]);
191    Xdr::read <StreamIO> (is, _value[2][3]);
192
193    Xdr::read <StreamIO> (is, _value[3][0]);
194    Xdr::read <StreamIO> (is, _value[3][1]);
195    Xdr::read <StreamIO> (is, _value[3][2]);
196    Xdr::read <StreamIO> (is, _value[3][3]);
197}
198
199
200template <>
201const char *
202M44dAttribute::staticTypeName ()
203{
204    return "m44d";
205}
206
207
208template <>
209void
210M44dAttribute::writeValueTo (OStream &os, int version) const
211{
212    Xdr::write <StreamIO> (os, _value[0][0]);
213    Xdr::write <StreamIO> (os, _value[0][1]);
214    Xdr::write <StreamIO> (os, _value[0][2]);
215    Xdr::write <StreamIO> (os, _value[0][3]);
216
217    Xdr::write <StreamIO> (os, _value[1][0]);
218    Xdr::write <StreamIO> (os, _value[1][1]);
219    Xdr::write <StreamIO> (os, _value[1][2]);
220    Xdr::write <StreamIO> (os, _value[1][3]);
221
222    Xdr::write <StreamIO> (os, _value[2][0]);
223    Xdr::write <StreamIO> (os, _value[2][1]);
224    Xdr::write <StreamIO> (os, _value[2][2]);
225    Xdr::write <StreamIO> (os, _value[2][3]);
226
227    Xdr::write <StreamIO> (os, _value[3][0]);
228    Xdr::write <StreamIO> (os, _value[3][1]);
229    Xdr::write <StreamIO> (os, _value[3][2]);
230    Xdr::write <StreamIO> (os, _value[3][3]);
231}
232
233
234template <>
235void
236M44dAttribute::readValueFrom (IStream &is, int size, int version)
237{
238    Xdr::read <StreamIO> (is, _value[0][0]);
239    Xdr::read <StreamIO> (is, _value[0][1]);
240    Xdr::read <StreamIO> (is, _value[0][2]);
241    Xdr::read <StreamIO> (is, _value[0][3]);
242
243    Xdr::read <StreamIO> (is, _value[1][0]);
244    Xdr::read <StreamIO> (is, _value[1][1]);
245    Xdr::read <StreamIO> (is, _value[1][2]);
246    Xdr::read <StreamIO> (is, _value[1][3]);
247
248    Xdr::read <StreamIO> (is, _value[2][0]);
249    Xdr::read <StreamIO> (is, _value[2][1]);
250    Xdr::read <StreamIO> (is, _value[2][2]);
251    Xdr::read <StreamIO> (is, _value[2][3]);
252
253    Xdr::read <StreamIO> (is, _value[3][0]);
254    Xdr::read <StreamIO> (is, _value[3][1]);
255    Xdr::read <StreamIO> (is, _value[3][2]);
256    Xdr::read <StreamIO> (is, _value[3][3]);
257}
258
259
260} // namespace Imf