refinery
RAW file processor
Public Member Functions

refinery::DcrawExifData Class Reference

Exif parser copied from dcraw.c. More...

#include <refinery/exif.h>

Inheritance diagram for refinery::DcrawExifData:
Inheritance graph
[legend]
Collaboration diagram for refinery::DcrawExifData:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 DcrawExifData (std::streambuf &istream)
 Constructor.
 DcrawExifData (FILE *f)
 Constructor.
 ~DcrawExifData ()
 destructor.
const char * mime_type () const
 Returns the detected MIME type of this image.
virtual bool hasKey (const char *key) const
 True iff the Exif data contains the given key.
virtual std::string getString (const char *key) const
 Returns the specified Exif value as a string.
virtual void getBytes (const char *key, std::vector< byte > &outBytes) const
 Copies the specified Exif value into a byte-array.
virtual int getInt (const char *key) const
 Returns the specified Exif value as an int.
virtual float getFloat (const char *key) const
 Returns the specified Exif value as a float.

Detailed Description

Exif parser copied from dcraw.c.

Dcraw has impeccable camera-identifying code, but it doesn't store its in-memory data as Exif. For instance, it sometimes hard-codes the known width and height of a particular camera's sensor without looking at Exif tags, unlike refinery, which uses CameraData for all special cases. This class runs dcraw's calculations and then lets users access the results as if they were Exif data.

Example:

 std::ifstream istream("image.NEF");
 DcrawExifData exifData(istream);
 std::string model(exifData.getString("Exif.Image.Model"));
 std::cout << "Camera: " << model << std::endl;
Examples:

util/raw2ppm.cc.

Definition at line 139 of file exif.h.


Constructor & Destructor Documentation

refinery::DcrawExifData::DcrawExifData ( std::streambuf &  istream)

Constructor.

The input stream will be forgotten when this method returns.

Parameters:
[in]istreamInput stream to parse.
refinery::DcrawExifData::DcrawExifData ( FILE *  f)

Constructor.

The input stream will be forgotten when this method returns.

Parameters:
[in]fInput file pointer to parse.
refinery::DcrawExifData::~DcrawExifData ( )

destructor.


Member Function Documentation

virtual void refinery::DcrawExifData::getBytes ( const char *  key,
std::vector< byte > &  outBytes 
) const [virtual]

Copies the specified Exif value into a byte-array.

Existing data will be erased.

This throws an error if the Exif data doesn't exist. Use hasKey() to verify that it does before calling this method.

Parameters:
[in]keyExif key, for instance "Exif.Nikon3.LinearizationTable".
[out]outBytesByte-array to fill.

Implements refinery::ExifData.

virtual float refinery::DcrawExifData::getFloat ( const char *  key) const [virtual]

Returns the specified Exif value as a float.

This throws an error if the Exif data doesn't exist. Use hasKey() to verify that it does before calling this method.

Parameters:
[in]keyExif key, for instance "Exif.Image.XResolution".
Returns:
A float representation of the Exif value.

Implements refinery::ExifData.

virtual int refinery::DcrawExifData::getInt ( const char *  key) const [virtual]

Returns the specified Exif value as an int.

This throws an error if the Exif data doesn't exist. Use hasKey() to verify that it does before calling this method.

Parameters:
[in]keyExif key, for instance "Exif.Image.Orientation".
Returns:
An int representation of the Exif value.

Implements refinery::ExifData.

virtual std::string refinery::DcrawExifData::getString ( const char *  key) const [virtual]

Returns the specified Exif value as a string.

This throws an error if the Exif data doesn't exist. Use hasKey() to verify that it does before calling this method.

Parameters:
[in]keyExif key, for instance "Exif.Image.Model".
Returns:
A string representation of the Exif value.

Implements refinery::ExifData.

virtual bool refinery::DcrawExifData::hasKey ( const char *  key) const [virtual]

True iff the Exif data contains the given key.

Parameters:
[in]keyExif key, for instance "Exif.Image.Orientation".
Returns:
True iff the Exif data contains the key.

Implements refinery::ExifData.

const char* refinery::DcrawExifData::mime_type ( ) const

Returns the detected MIME type of this image.

This method is included as a convenience, since dcraw calculates the MIME type during parsing.

Returns:
A MIME type string, for instance "image/x-nikon-nef".

The documentation for this class was generated from the following file:
 All Classes Functions Variables Typedefs Enumerations Enumerator