Home | History | Annotate | Download | only in IlmImf
      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 
     49 namespace Imf {
     50 
     51 
     52 template <>
     53 const char *
     54 M33fAttribute::staticTypeName ()
     55 {
     56     return "m33f";
     57 }
     58 
     59 
     60 template <>
     61 void
     62 M33fAttribute::writeValueTo (OStream &os, int) 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 
     78 template <>
     79 void
     80 M33fAttribute::readValueFrom (IStream &is, int, int)
     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 
     96 template <>
     97 const char *
     98 M33dAttribute::staticTypeName ()
     99 {
    100     return "m33d";
    101 }
    102 
    103 
    104 template <>
    105 void
    106 M33dAttribute::writeValueTo (OStream &os, int) 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 
    122 template <>
    123 void
    124 M33dAttribute::readValueFrom (IStream &is, int, int)
    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 
    140 template <>
    141 const char *
    142 M44fAttribute::staticTypeName ()
    143 {
    144     return "m44f";
    145 }
    146 
    147 
    148 template <>
    149 void
    150 M44fAttribute::writeValueTo (OStream &os, int) 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 
    174 template <>
    175 void
    176 M44fAttribute::readValueFrom (IStream &is, int, int)
    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 
    200 template <>
    201 const char *
    202 M44dAttribute::staticTypeName ()
    203 {
    204     return "m44d";
    205 }
    206 
    207 
    208 template <>
    209 void
    210 M44dAttribute::writeValueTo (OStream &os, int) 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 
    234 template <>
    235 void
    236 M44dAttribute::readValueFrom (IStream &is, int, int)
    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
    261