Path: blob/master/3rdparty/openexr/IlmImf/ImfBoxAttribute.cpp
16337 views
///////////////////////////////////////////////////////////////////////////1//2// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas3// Digital Ltd. LLC4//5// All rights reserved.6//7// Redistribution and use in source and binary forms, with or without8// modification, are permitted provided that the following conditions are9// met:10// * Redistributions of source code must retain the above copyright11// notice, this list of conditions and the following disclaimer.12// * Redistributions in binary form must reproduce the above13// copyright notice, this list of conditions and the following disclaimer14// in the documentation and/or other materials provided with the15// distribution.16// * Neither the name of Industrial Light & Magic nor the names of17// its contributors may be used to endorse or promote products derived18// from this software without specific prior written permission.19//20// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS21// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT22// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR23// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT24// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,25// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT26// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,27// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY28// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT29// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE30// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.31//32///////////////////////////////////////////////////////////////////////////33343536//-----------------------------------------------------------------------------37//38// class Box2iAttribute39// class Box2fAttribute40//41//-----------------------------------------------------------------------------4243#include <ImfBoxAttribute.h>444546namespace Imf {474849template <>50const char *51Box2iAttribute::staticTypeName ()52{53return "box2i";54}555657template <>58void59Box2iAttribute::writeValueTo (OStream &os, int) const60{61Xdr::write <StreamIO> (os, _value.min.x);62Xdr::write <StreamIO> (os, _value.min.y);63Xdr::write <StreamIO> (os, _value.max.x);64Xdr::write <StreamIO> (os, _value.max.y);65}666768template <>69void70Box2iAttribute::readValueFrom (IStream &is, int, int)71{72Xdr::read <StreamIO> (is, _value.min.x);73Xdr::read <StreamIO> (is, _value.min.y);74Xdr::read <StreamIO> (is, _value.max.x);75Xdr::read <StreamIO> (is, _value.max.y);76}777879template <>80const char *81Box2fAttribute::staticTypeName ()82{83return "box2f";84}858687template <>88void89Box2fAttribute::writeValueTo (OStream &os, int) const90{91Xdr::write <StreamIO> (os, _value.min.x);92Xdr::write <StreamIO> (os, _value.min.y);93Xdr::write <StreamIO> (os, _value.max.x);94Xdr::write <StreamIO> (os, _value.max.y);95}969798template <>99void100Box2fAttribute::readValueFrom (IStream &is, int, int)101{102Xdr::read <StreamIO> (is, _value.min.x);103Xdr::read <StreamIO> (is, _value.min.y);104Xdr::read <StreamIO> (is, _value.max.x);105Xdr::read <StreamIO> (is, _value.max.y);106}107108109} // namespace Imf110111112