1///////////////////////////////////////////////////////////////////////////
2//
3// Copyright (c) 2003, 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//	Optional Standard Attributes
39//
40//-----------------------------------------------------------------------------
41
42#include <ImfStandardAttributes.h>
43
44
45#define IMF_STRING(name) #name
46
47#define IMF_STD_ATTRIBUTE_IMP(name,suffix,type)				 \
48									 \
49    void								 \
50    add##suffix (Header &header, const type &value)			 \
51    {									 \
52	header.insert (IMF_STRING (name), TypedAttribute<type> (value)); \
53    }									 \
54									 \
55    bool								 \
56    has##suffix (const Header &header)					 \
57    {									 \
58	return header.findTypedAttribute <TypedAttribute <type> >	 \
59		(IMF_STRING (name)) != 0;				 \
60    }									 \
61									 \
62    const TypedAttribute<type> &					 \
63    name##Attribute (const Header &header)				 \
64    {									 \
65	return header.typedAttribute <TypedAttribute <type> >		 \
66		(IMF_STRING (name));					 \
67    }									 \
68									 \
69    TypedAttribute<type> &						 \
70    name##Attribute (Header &header)					 \
71    {									 \
72	return header.typedAttribute <TypedAttribute <type> >		 \
73		(IMF_STRING (name));					 \
74    }									 \
75									 \
76    const type &							 \
77    name (const Header &header)						 \
78    {									 \
79	return name##Attribute(header).value();				 \
80    }									 \
81									 \
82    type &								 \
83    name (Header &header)						 \
84    {									 \
85	return name##Attribute(header).value();				 \
86    }
87
88
89namespace Imf {
90
91
92IMF_STD_ATTRIBUTE_IMP (chromaticities, Chromaticities, Chromaticities)
93IMF_STD_ATTRIBUTE_IMP (whiteLuminance, WhiteLuminance, float)
94IMF_STD_ATTRIBUTE_IMP (adoptedNeutral, AdoptedNeutral, Imath::V2f)
95IMF_STD_ATTRIBUTE_IMP (renderingTransform, RenderingTransform, std::string)
96IMF_STD_ATTRIBUTE_IMP (lookModTransform, LookModTransform, std::string)
97IMF_STD_ATTRIBUTE_IMP (xDensity, XDensity, float)
98IMF_STD_ATTRIBUTE_IMP (owner, Owner, std::string)
99IMF_STD_ATTRIBUTE_IMP (comments, Comments, std::string)
100IMF_STD_ATTRIBUTE_IMP (capDate, CapDate, std::string)
101IMF_STD_ATTRIBUTE_IMP (utcOffset, UtcOffset, float)
102IMF_STD_ATTRIBUTE_IMP (longitude, Longitude, float)
103IMF_STD_ATTRIBUTE_IMP (latitude, Latitude, float)
104IMF_STD_ATTRIBUTE_IMP (altitude, Altitude, float)
105IMF_STD_ATTRIBUTE_IMP (focus, Focus, float)
106IMF_STD_ATTRIBUTE_IMP (expTime, ExpTime, float)
107IMF_STD_ATTRIBUTE_IMP (aperture, Aperture, float)
108IMF_STD_ATTRIBUTE_IMP (isoSpeed, IsoSpeed, float)
109IMF_STD_ATTRIBUTE_IMP (envmap, Envmap, Envmap)
110IMF_STD_ATTRIBUTE_IMP (keyCode, KeyCode, KeyCode)
111IMF_STD_ATTRIBUTE_IMP (timeCode, TimeCode, TimeCode)
112IMF_STD_ATTRIBUTE_IMP (wrapmodes, Wrapmodes, std::string)
113IMF_STD_ATTRIBUTE_IMP (framesPerSecond, FramesPerSecond, Rational)
114
115
116} // namespace Imf
117