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
51 namespace Imf {
52
53
54 template <>
55 const char *
staticTypeName()56 V2iAttribute::staticTypeName ()
57 {
58 return "v2i";
59 }
60
61
62 template <>
63 void
writeValueTo(OStream & os,int) const64 V2iAttribute::writeValueTo (OStream &os, int) const
65 {
66 Xdr::write <StreamIO> (os, _value.x);
67 Xdr::write <StreamIO> (os, _value.y);
68 }
69
70
71 template <>
72 void
readValueFrom(IStream & is,int,int)73 V2iAttribute::readValueFrom (IStream &is, int, int)
74 {
75 Xdr::read <StreamIO> (is, _value.x);
76 Xdr::read <StreamIO> (is, _value.y);
77 }
78
79
80 template <>
81 const char *
staticTypeName()82 V2fAttribute::staticTypeName ()
83 {
84 return "v2f";
85 }
86
87
88 template <>
89 void
writeValueTo(OStream & os,int) const90 V2fAttribute::writeValueTo (OStream &os, int) const
91 {
92 Xdr::write <StreamIO> (os, _value.x);
93 Xdr::write <StreamIO> (os, _value.y);
94 }
95
96
97 template <>
98 void
readValueFrom(IStream & is,int,int)99 V2fAttribute::readValueFrom (IStream &is, int, int)
100 {
101 Xdr::read <StreamIO> (is, _value.x);
102 Xdr::read <StreamIO> (is, _value.y);
103 }
104
105
106 template <>
107 const char *
staticTypeName()108 V2dAttribute::staticTypeName ()
109 {
110 return "v2d";
111 }
112
113
114 template <>
115 void
writeValueTo(OStream & os,int) const116 V2dAttribute::writeValueTo (OStream &os, int) const
117 {
118 Xdr::write <StreamIO> (os, _value.x);
119 Xdr::write <StreamIO> (os, _value.y);
120 }
121
122
123 template <>
124 void
readValueFrom(IStream & is,int,int)125 V2dAttribute::readValueFrom (IStream &is, int, int)
126 {
127 Xdr::read <StreamIO> (is, _value.x);
128 Xdr::read <StreamIO> (is, _value.y);
129 }
130
131
132 template <>
133 const char *
staticTypeName()134 V3iAttribute::staticTypeName ()
135 {
136 return "v3i";
137 }
138
139
140 template <>
141 void
writeValueTo(OStream & os,int) const142 V3iAttribute::writeValueTo (OStream &os, int) 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
150 template <>
151 void
readValueFrom(IStream & is,int,int)152 V3iAttribute::readValueFrom (IStream &is, int, int)
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
160 template <>
161 const char *
staticTypeName()162 V3fAttribute::staticTypeName ()
163 {
164 return "v3f";
165 }
166
167
168 template <>
169 void
writeValueTo(OStream & os,int) const170 V3fAttribute::writeValueTo (OStream &os, int) 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
178 template <>
179 void
readValueFrom(IStream & is,int,int)180 V3fAttribute::readValueFrom (IStream &is, int, int)
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
188 template <>
189 const char *
staticTypeName()190 V3dAttribute::staticTypeName ()
191 {
192 return "v3d";
193 }
194
195
196 template <>
197 void
writeValueTo(OStream & os,int) const198 V3dAttribute::writeValueTo (OStream &os, int) 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
206 template <>
207 void
readValueFrom(IStream & is,int,int)208 V3dAttribute::readValueFrom (IStream &is, int, int)
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
217