Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Examples

Exiv2::MakerNote Class Reference

Exif makernote interface. More...

#include <makernote.hpp>

Inheritance diagram for Exiv2::MakerNote:

Inheritance graph
[legend]
Collaboration diagram for Exiv2::MakerNote:

Collaboration graph
[legend]
List of all members.

Public Types

typedef std::auto_ptr< MakerNoteAutoPtr
 Shortcut for a MakerNote auto pointer.

Public Member Functions

Creators
 MakerNote (const MnTagInfo *pMnTagInfo=0, bool alloc=true)
 Constructor. Takes an optional makernote info tag array and allows to choose whether or not memory management is required for the Entries.
virtual ~MakerNote ()
 Virtual destructor.
Manipulators
virtual int read (const byte *buf, long len, ByteOrder byteOrder, long offset)=0
 Read the makernote, including the makernote header, from character buffer buf of length len at position offset (from the start of the TIFF header) and encoded in byte order byteOrder. Return 0 if successful.
virtual long copy (byte *buf, ByteOrder byteOrder, long offset)=0
 Copy (write) the makerNote to the character buffer buf at position offset (from the start of the TIFF header), encoded in byte order byteOrder. Update internal offsets if necessary. Return the number of bytes written.
virtual void add (const Entry &entry)=0
 Add the entry to the makernote. No duplicate-check is performed, i.e., it is possible to add multiple entries with the same tag. The memory allocation mode of the entry to be added must be the same as that of the makernote and the IFD id of the entry must be set to 'makerIfd'.
virtual Entries::iterator begin ()=0
 The first makernote entry.
virtual Entries::iterator end ()=0
 End of the makernote entries.
Accessors
ByteOrder byteOrder () const
 Return the byte order (little or big endian).
long offset () const
 Return the offset of the makernote from the start of the TIFF header.
AutoPtr clone (bool alloc=true) const
 Return an auto-pointer to an newly created, empty instance of the same type as this. The makernote entries are not copied. The caller owns the new object and the auto-pointer ensures that it will be deleted.
virtual std::string tagName (uint16_t tag) const
 Return the name of a makernote tag. The default implementation looks up the makernote info tag array if one is set, else it translates the tag to a string with the hexadecimal value of the tag.
virtual uint16_t tag (const std::string &tagName) const
 Return the tag associated with a makernote tag name. The default implementation looks up the makernote info tag array if one is set, else it expects tag names in the form "0x01ff" and converts them to unsigned integer.
virtual std::string tagDesc (uint16_t tag) const
 Return the description of a makernote tag. The default implementation looks up the makernote info tag array if one is set, else it returns an empty string.
virtual void taglist (std::ostream &os) const
 Print a list of all tags known by this MakerNote to the output stream os. The default implementation prints all tags in the makernote info tag array if one is set.
virtual std::ostream & writeMnTagInfo (std::ostream &os, uint16_t tag) const
 Write the makernote tag info of tag to the output stream os.
virtual Entries::const_iterator begin () const =0
 The first makernote entry.
virtual Entries::const_iterator end () const =0
 End of the makernote entries.
virtual Entries::const_iterator findIdx (int idx) const =0
 Find an entry by idx, return a const iterator to the record.
virtual long size () const =0
 Return the size of the makernote in bytes.
virtual std::string ifdItem () const =0
 Return the name of the makernote item.
virtual std::ostream & printTag (std::ostream &os, uint16_t tag, const Value &value) const =0
 Interpret and print the value of a makernote tag.

Protected Attributes

const MnTagInfopMnTagInfo_
 Pointer to an array of makernote tag infos.
const bool alloc_
 Flag to control the memory management: True: requires memory allocation and deallocation, False: no memory management needed.
long offset_
 Offset of the makernote from the start of the TIFF header (for offset()).
ByteOrder byteOrder_
 Alternative byte order to use, invalid if the byte order of the Exif block can be used.

Detailed Description

Exif makernote interface.

MakerNote is a low-level container for makernote entries. The ExifData container uses makernote entries just like the other Exif metadata. Thus, clients can access Exif and makernote tags and their values uniformly through the ExifData interface. The role of MakerNote is very similar to that of class Ifd (but makernotes do not need to be in IFD format, see below). In addition, it provides MakerNote specific tag descriptions and print functions to interpret the makernote values.

MakerNote holds methods and functionality to

Makernotes can be added to the system by subclassing MakerNote and registering a create function for the new subclass together with the camera make and model (which may contain wildcards) in the MakerNoteFactory. Since the majority of makernotes are in IFD format, subclass IfdMakerNote is provided. It contains an IFD container and implements all interface methods related to the makernote entries.

To implement a new IFD makernote, all that you need to do is

See existing makernote implementations for examples, e.g., CanonMakerNote or FujiMakerNote.

Finally, the implementation files should be named *mn.[ch]pp, so that the magic, which ensures that the makernote is automatically registered in the factory, will pick it up (see mn.sh for details).


Member Function Documentation

MakerNote::AutoPtr Exiv2::MakerNote::clone bool  alloc = true  )  const
 

Return an auto-pointer to an newly created, empty instance of the same type as this. The makernote entries are not copied. The caller owns the new object and the auto-pointer ensures that it will be deleted.

Parameters:
alloc Memory management model for the clone. Indicates if memory required to store data should be allocated and deallocated (true) or not (false). If false, only pointers to the buffer provided to read() will be kept. See Ifd for more background on this concept.

Reimplemented in Exiv2::CanonMakerNote, Exiv2::FujiMakerNote, Exiv2::IfdMakerNote, Exiv2::Nikon1MakerNote, Exiv2::Nikon2MakerNote, Exiv2::Nikon3MakerNote, and Exiv2::SigmaMakerNote.


The documentation for this class was generated from the following files:
Generated on Sun Dec 12 17:54:08 2004 for Exiv2 by  doxygen 1.3.9.1