PageRenderTime 30ms CodeModel.GetById 15ms app.highlight 13ms RepoModel.GetById 1ms app.codeStats 0ms

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

https://bitbucket.org/cabalistic/ogredeps/
C++ | 216 lines | 129 code | 44 blank | 43 comment | 0 complexity | 5bd314a6dc835477107f270f5846b492 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
 37//-----------------------------------------------------------------------------
 38//
 39//	class V2iAttribute
 40//	class V2fAttribute
 41//	class V2dAttribute
 42//	class V3iAttribute
 43//	class V3fAttribute
 44//	class V3dAttribute
 45//
 46//-----------------------------------------------------------------------------
 47
 48#include <ImfVecAttribute.h>
 49
 50
 51namespace Imf {
 52
 53
 54template <>
 55const char *
 56V2iAttribute::staticTypeName ()
 57{
 58    return "v2i";
 59}
 60
 61
 62template <>
 63void
 64V2iAttribute::writeValueTo (OStream &os, int version) const
 65{
 66    Xdr::write <StreamIO> (os, _value.x);
 67    Xdr::write <StreamIO> (os, _value.y);
 68}
 69
 70
 71template <>
 72void
 73V2iAttribute::readValueFrom (IStream &is, int size, int version)
 74{
 75    Xdr::read <StreamIO> (is, _value.x);
 76    Xdr::read <StreamIO> (is, _value.y);
 77}
 78
 79
 80template <>
 81const char *
 82V2fAttribute::staticTypeName ()
 83{
 84    return "v2f";
 85}
 86
 87
 88template <>
 89void
 90V2fAttribute::writeValueTo (OStream &os, int version) const
 91{
 92    Xdr::write <StreamIO> (os, _value.x);
 93    Xdr::write <StreamIO> (os, _value.y);
 94}
 95
 96
 97template <>
 98void
 99V2fAttribute::readValueFrom (IStream &is, int size, int version)
100{
101    Xdr::read <StreamIO> (is, _value.x);
102    Xdr::read <StreamIO> (is, _value.y);
103}
104
105
106template <>
107const char *
108V2dAttribute::staticTypeName ()
109{
110    return "v2d";
111}
112
113
114template <>
115void
116V2dAttribute::writeValueTo (OStream &os, int version) const
117{
118    Xdr::write <StreamIO> (os, _value.x);
119    Xdr::write <StreamIO> (os, _value.y);
120}
121
122
123template <>
124void
125V2dAttribute::readValueFrom (IStream &is, int size, int version)
126{
127    Xdr::read <StreamIO> (is, _value.x);
128    Xdr::read <StreamIO> (is, _value.y);
129}
130
131
132template <>
133const char *
134V3iAttribute::staticTypeName ()
135{
136    return "v3i";
137}
138
139
140template <>
141void
142V3iAttribute::writeValueTo (OStream &os, int version) const
143{
144    Xdr::write <StreamIO> (os, _value.x);
145    Xdr::write <StreamIO> (os, _value.y);
146    Xdr::write <StreamIO> (os, _value.z);
147}
148
149
150template <>
151void
152V3iAttribute::readValueFrom (IStream &is, int size, int version)
153{
154    Xdr::read <StreamIO> (is, _value.x);
155    Xdr::read <StreamIO> (is, _value.y);
156    Xdr::read <StreamIO> (is, _value.z);
157}
158
159
160template <>
161const char *
162V3fAttribute::staticTypeName ()
163{
164    return "v3f";
165}
166
167
168template <>
169void
170V3fAttribute::writeValueTo (OStream &os, int version) const
171{
172    Xdr::write <StreamIO> (os, _value.x);
173    Xdr::write <StreamIO> (os, _value.y);
174    Xdr::write <StreamIO> (os, _value.z);
175}
176
177
178template <>
179void
180V3fAttribute::readValueFrom (IStream &is, int size, int version)
181{
182    Xdr::read <StreamIO> (is, _value.x);
183    Xdr::read <StreamIO> (is, _value.y);
184    Xdr::read <StreamIO> (is, _value.z);
185}
186
187
188template <>
189const char *
190V3dAttribute::staticTypeName ()
191{
192    return "v3d";
193}
194
195
196template <>
197void
198V3dAttribute::writeValueTo (OStream &os, int version) const
199{
200    Xdr::write <StreamIO> (os, _value.x);
201    Xdr::write <StreamIO> (os, _value.y);
202    Xdr::write <StreamIO> (os, _value.z);
203}
204
205
206template <>
207void
208V3dAttribute::readValueFrom (IStream &is, int size, int version)
209{
210    Xdr::read <StreamIO> (is, _value.x);
211    Xdr::read <StreamIO> (is, _value.y);
212    Xdr::read <StreamIO> (is, _value.z);
213}
214
215
216} // namespace Imf