- Main Page
- Namespaces
- Classes
- Files
- Examples

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# Exiv2::MakerNote Class Reference

Exif makernote interface. More...

`#include <makernote.hpp>`

Inheritance diagram for Exiv2::MakerNote:

[legend]
List of all members.

## Public Types
typedef std::auto_ptr< MakerNote > | AutoPtr
| Shortcut for a MakerNote auto pointer.
## Public Member Functions
Creators
| MakerNote (bool alloc=true)
| Constructor. 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, long start, ByteOrder byteOrder, long shift=0)=0
| Read the makernote, including the makernote header, from the Exif data buffer.
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.
virtual void | updateBase (byte *pNewBase)=0
| Update the base pointer of the MakerNote and all its entries to pNewBase.
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 | create (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.
AutoPtr | clone () const
| Return an auto-pointer to a clone of this object. The caller owns the new object and the auto-pointer ensures that it will be deleted.
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.
## Protected Attributes
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

- read the makernote from a character buffer
- copy the makernote to a character buffer
- maintain a list of makernote entries (similar to IFD entries)
- interpret (print) the values of makernote tags

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

- subclass IfdMakerNote,
- implement methods to read and check the header (if any) as well as clone and create functions,
- add a list of tag descriptions and appropriate print functions and
- register the camera make/model and create function in the makernote factory.

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

Finally, the header file which defines the static variable register*MakerNote needs to be included from mn.hpp, to ensure that the makernote is automatically registered in the factory.

## Member Function Documentation

MakerNote::AutoPtr Exiv2::MakerNote::clone | ( |  | ) | const

| Return an auto-pointer to a clone of this object. The caller owns the new object and the auto-pointer ensures that it will be deleted. Note: In non-alloc mode the clone potentially contains pointers to the same data buffer as the original. Use updateBase(byte* pNewBase) to adjust them. Reimplemented in Exiv2::CanonMakerNote, Exiv2::FujiMakerNote, Exiv2::IfdMakerNote, Exiv2::MinoltaMakerNote, Exiv2::Nikon1MakerNote, Exiv2::Nikon2MakerNote, Exiv2::Nikon3MakerNote, Exiv2::OlympusMakerNote, Exiv2::PanasonicMakerNote, Exiv2::SigmaMakerNote, and Exiv2::SonyMakerNote.

MakerNote::AutoPtr Exiv2::MakerNote::create | ( | 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 newly created object. 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::MinoltaMakerNote, Exiv2::Nikon1MakerNote, Exiv2::Nikon2MakerNote, Exiv2::Nikon3MakerNote, Exiv2::OlympusMakerNote, Exiv2::PanasonicMakerNote, Exiv2::SigmaMakerNote, and Exiv2::SonyMakerNote.

virtual int Exiv2::MakerNote::read | ( | const byte * | buf,
|  | long | len,
|  | long | start,
|  | ByteOrder | byteOrder,
|  | long | shift = `0`
| ) | `[pure virtual]`

  | Read the makernote, including the makernote header, from the Exif data buffer. Parameters:
  | buf | Pointer to the Exif data buffer that contains the MakerNote to decode. The buffer should contain all Exif data starting from the TIFF header.
  | len | Number of bytes in the Exif data buffer
  | start | MakerNote starts at buf + start.
  | byteOrder | Applicable byte order (little or big endian).
  | shift | IFD offsets are relative to buf + shift.
Returns: 0 if successful. Implemented in Exiv2::CanonMakerNote, Exiv2::IfdMakerNote, and Exiv2::MinoltaMakerNote.

virtual void Exiv2::MakerNote::updateBase | ( | byte * | pNewBase | ) | `[pure virtual]`

| Update the base pointer of the MakerNote and all its entries to pNewBase. Allows to re-locate the underlying data buffer to a new location pNewBase. This method only has an effect in non-alloc mode. Implemented in Exiv2::CanonMakerNote, Exiv2::IfdMakerNote, and Exiv2::MinoltaMakerNote.

The documentation for this class was generated from the following files:

- makernote.hpp
- makernote.cpp