dng_host Class Reference

The main class for communication between the application and the DNG SDK. Used to customize memory allocation and other behaviors. More...

#include <dng_host.h>

List of all members.


Public Member Functions

 dng_host (dng_memory_allocator *allocator=NULL, dng_abort_sniffer *sniffer=NULL)
virtual ~dng_host ()
dng_memory_allocatorAllocator ()
 Getter for host's memory allocator.
virtual dng_memory_blockAllocate (uint32 logicalSize)
void SetSniffer (dng_abort_sniffer *sniffer)
 Setter for host's abort sniffer.
dng_abort_snifferSniffer ()
 Getter for host's abort sniffer.
virtual void SniffForAbort ()
void SetNeedsMeta (bool needs)
bool NeedsMeta () const
 Getter for flag determining whether all XMP metadata should be parsed.
void SetNeedsImage (bool needs)
bool NeedsImage () const
 Setter for flag determining whether DNG image data is needed.
void SetForPreview (bool preview)
bool ForPreview () const
void SetMinimumSize (uint32 size)
uint32 MinimumSize () const
 Getter for the minimum preview size.
void SetPreferredSize (uint32 size)
uint32 PreferredSize () const
 Getter for the preferred preview size.
void SetMaximumSize (uint32 size)
uint32 MaximumSize () const
 Getter for the maximum preview size.
void SetCropFactor (real64 cropFactor)
real64 CropFactor () const
 Getter for the cropping factor.
void ValidateSizes ()
 Makes sures minimum, preferred, and maximum sizes are reasonable.
void SetSaveDNGVersion (uint32 version)
virtual uint32 SaveDNGVersion () const
 Getter for what version to save DNG file compatible with.
void SetSaveLinearDNG (bool linear)
virtual bool SaveLinearDNG (const dng_negative &negative) const
 Getter for flag determining whether to save a linear DNG file.
void SetKeepOriginalFile (bool keep)
bool KeepOriginalFile ()
 Getter for flag determining whether to keep original RAW file data.
virtual bool IsTransientError (dng_error_code code)
virtual void PerformAreaTask (dng_area_task &task, const dng_rect &area)
virtual dng_exifMake_dng_exif ()
virtual dng_shared * Make_dng_shared ()
virtual dng_ifdMake_dng_ifd ()
virtual dng_negativeMake_dng_negative ()
virtual dng_imageMake_dng_image (const dng_rect &bounds, uint32 planes, uint32 pixelType)
virtual dng_opcode * Make_dng_opcode (uint32 opcodeID, dng_stream &stream)
virtual void ApplyOpcodeList (dng_opcode_list &list, dng_negative &negative, AutoPtr< dng_image > &image)

Detailed Description

The main class for communication between the application and the DNG SDK. Used to customize memory allocation and other behaviors.

dng_host allows setting parameters for the DNG conversion, mediates callback style interactions between the host application and the DNG SDK, and allows controlling certain internal behavior of the SDK such as memory allocation. Many applications will be able to use the default implementation of dng_host by just setting the dng_memory_allocator and dng_abort_sniffer in the constructor. More complex interactions will require deriving a class from dng_host.

Multiple dng_host objects can be allocated in a single process. This may be useful for DNG processing on separate threads. (Distinct dng_host objects are completely threadsafe for read/write. The application is responsible for establishing mutual exclusion for read/write access to a single dng_host object if it is used in multiple threads.)


Constructor & Destructor Documentation

dng_host::dng_host ( dng_memory_allocator allocator = NULL,
dng_abort_sniffer sniffer = NULL 
)

Allocate a dng_host object, possiblly with custom allocator and sniffer.

Parameters:
allocator Allows controlling all memory allocation done via this dng_host. Defaults to singleton global dng_memory_allocator, which calls new/delete dng_malloc_block for appropriate size.
sniffer Used to periodically check if pending DNG conversions should be aborted and to communicate progress updates. Defaults to singleton global dng_abort_sniffer, which never aborts and ignores progress updated.

dng_host::~dng_host (  )  [virtual]

Clean up direct memory for dng_host. Memory allocator and abort sniffer are not deleted. Objects such as dng_image and others returned from host can still be used after host is deleted.


Member Function Documentation

dng_memory_block * dng_host::Allocate ( uint32  logicalSize  )  [virtual]

Alocate a new dng_memory_block using the host's memory allocator. Uses the Allocator() property of host to allocate a new block of memory. Will call ThrowMemoryFull if block cannot be allocated.

Parameters:
logicalSize Number of usable bytes returned dng_memory_block must contain.

References dng_memory_allocator::Allocate(), and Allocator().

Referenced by dng_mosaic_info::InterpolateGeneric().

void dng_host::ApplyOpcodeList ( dng_opcode_list &  list,
dng_negative negative,
AutoPtr< dng_image > &  image 
) [virtual]

Factory method to apply a dng_opcode_list. Can be used to override opcode list applications.

bool dng_host::ForPreview (  )  const [inline]

Getter for flag determining whether image should be preview quality. Preview quality images may be rendered more quickly. Current DNG SDK does not change rendering behavior based on this flag, but derived versions may use this getter to choose between a slower more accurate path and a faster "good enough for preview" one. Data produce with ForPreview set to true should not be written back to a DNG file, except as a preview image.

bool dng_host::IsTransientError ( dng_error_code  code  )  [virtual]

Determine if an error is the result of a temporary, but planned-for occurence such as user cancellation or memory exhaustion. This method is sometimes used to determine whether to try and continue processing a DNG file despite errors in the file format, etc. In such cases, processing will be continued if IsTransientError returns false. This is so that user cancellation and memory exhaustion always terminate processing.

Parameters:
code Error to test for transience.

dng_exif * dng_host::Make_dng_exif (  )  [virtual]

Factory method for dng_exif class. Can be used to customize allocation or to ensure a derived class is used instead of dng_exif.

References ThrowMemoryFull().

Referenced by dng_info::Parse().

dng_ifd * dng_host::Make_dng_ifd (  )  [virtual]

Factory method for dng_ifd class. Can be used to customize allocation or to ensure a derived class is used instead of dng_ifd.

References ThrowMemoryFull().

Referenced by dng_info::Parse().

dng_image * dng_host::Make_dng_image ( const dng_rect &  bounds,
uint32  planes,
uint32  pixelType 
) [virtual]

Factory method for dng_image class. Can be used to customize allocation or to ensure a derived class is used instead of dng_simple_image.

References Allocator(), and ThrowMemoryFull().

Referenced by dng_render::Render().

dng_negative * dng_host::Make_dng_negative (  )  [virtual]

Factory method for dng_negative class. Can be used to customize allocation or to ensure a derived class is used instead of dng_negative.

References Allocator().

dng_opcode * dng_host::Make_dng_opcode ( uint32  opcodeID,
dng_stream stream 
) [virtual]

Factory method for parsing dng_opcode based classs. Can be used to override opcode implementations.

References ThrowMemoryFull().

dng_shared * dng_host::Make_dng_shared (  )  [virtual]

Factory method for dng_shared class. Can be used to customize allocation or to ensure a derived class is used instead of dng_shared.

References ThrowMemoryFull().

Referenced by dng_info::Parse().

void dng_host::PerformAreaTask ( dng_area_task task,
const dng_rect &  area 
) [virtual]

General top-level botttleneck for image processing tasks. Default implementation calls dng_area_task::PerformAreaTask method on task. Can be overridden in derived classes to support multiprocessing, for example.

Parameters:
task Image processing task to perform on area.
area Rectangle over which to perform image processing task.

References Allocator(), dng_area_task::Perform(), and Sniffer().

Referenced by dng_mosaic_info::InterpolateFast(), dng_linearization_info::Linearize(), and dng_render::Render().

void dng_host::SetCropFactor ( real64  cropFactor  )  [inline]

Setter for the cropping factor.

Parameters:
cropFactor Fraction of image to be used after crop.

void dng_host::SetForPreview ( bool  preview  )  [inline]

Setter for flag determining whether image should be preview quality, or full quality.

Parameters:
preview If true, rendered images are for preview.

void dng_host::SetKeepOriginalFile ( bool  keep  )  [inline]

Setter for flag determining whether to keep original RAW file data.

Parameters:
keep If true, origianl RAW data will be kept.

void dng_host::SetMaximumSize ( uint32  size  )  [inline]

Setter for the maximum preview size.

Parameters:
size Maximum pixel size (long side of image).

void dng_host::SetMinimumSize ( uint32  size  )  [inline]

Setter for the minimum preview size.

Parameters:
size Minimum pixel size (long side of image).

Referenced by ValidateSizes().

void dng_host::SetNeedsImage ( bool  needs  )  [inline]

Setter for flag determining whether DNG image data is needed. Defaults to true. Image data might not be needed for applications which only manipulate metadata.

Parameters:
needs If true, image data is needed.

void dng_host::SetNeedsMeta ( bool  needs  )  [inline]

Setter for flag determining whether all XMP metadata should be parsed. Defaults to true. One might not want metadata when doing a quick check to see if a file is readable.

Parameters:
needs If true, metadata is needed.

void dng_host::SetPreferredSize ( uint32  size  )  [inline]

Setter for the preferred preview size.

Parameters:
size Preferred pixel size (long side of image).

Referenced by ValidateSizes().

void dng_host::SetSaveDNGVersion ( uint32  version  )  [inline]

Setter for what version to save DNG file compatible with.

Parameters:
version What version to save DNG file compatible with.

void dng_host::SetSaveLinearDNG ( bool  linear  )  [inline]

Setter for flag determining whether to force saving a linear DNG file.

Parameters:
linear If true, we should force saving a linear DNG file.

void dng_host::SniffForAbort (  )  [virtual]

Check for pending abort. Should call ThrowUserCanceled if an abort is pending.

References Sniffer().

Referenced by dng_mosaic_info::InterpolateGeneric().


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

Copyright © 2006-2009 Adobe Systems Incorporated.

Use of this website signifies your agreement to the Terms of Use and Online Privacy Policy.

Search powered by Google