DocumentationOverviewBuilding ASL Documentation Library Wiki Docs Indices Browse Perforce More InfoRelease NotesWiki Site Search License Success Stories Contributors MediaDownloadPerforce Depots SupportASL SourceForge HomeMailing Lists Discussion Forums Report Bugs Suggest Features Contribute to ASL RSSShort-text newsFull-text news File releases Other Adobe ProjectsAdobe AirAdobe GIL Adobe Labs Adobe Media Gallery Adobe XMP Tamarin project (Mozilla Foundation) Other ResourcesBoostRIAForge SGI STL |
dng_abort_sniffer.hGo to the documentation of this file.00001 /*****************************************************************************/ 00002 // Copyright 2006-2007 Adobe Systems Incorporated 00003 // All Rights Reserved. 00004 // 00005 // NOTICE: Adobe permits you to use, modify, and distribute this file in 00006 // accordance with the terms of the Adobe license agreement accompanying it. 00007 /*****************************************************************************/ 00008 00009 /* $Id: //mondo/dng_sdk_1_2/dng_sdk/source/dng_abort_sniffer.h#1 $ */ 00010 /* $DateTime: 2008/03/09 14:29:54 $ */ 00011 /* $Change: 431850 $ */ 00012 /* $Author: tknoll $ */ 00013 00018 /*****************************************************************************/ 00019 00020 #ifndef __dng_abort_sniffer__ 00021 #define __dng_abort_sniffer__ 00022 00023 /*****************************************************************************/ 00024 00025 #include "dng_types.h" 00026 00027 /*****************************************************************************/ 00028 00034 class dng_abort_sniffer 00035 { 00036 00037 friend class dng_sniffer_task; 00038 00039 public: 00040 00041 virtual ~dng_abort_sniffer (); 00042 00046 00047 static inline void SniffForAbort (dng_abort_sniffer *sniffer) 00048 { 00049 if (sniffer) 00050 sniffer->Sniff (); 00051 } 00052 00053 protected: 00054 00056 00057 virtual void Sniff () = 0; 00058 00063 00064 virtual void StartTask (const char *name, 00065 real64 fract); 00066 00068 00069 virtual void EndTask (); 00070 00073 00074 virtual void UpdateProgress (real64 fract); 00075 00076 }; 00077 00078 /******************************************************************************/ 00079 00083 00084 class dng_sniffer_task 00085 { 00086 00087 private: 00088 00089 dng_abort_sniffer *fSniffer; 00090 00091 public: 00092 00097 00098 dng_sniffer_task (dng_abort_sniffer *sniffer, 00099 const char *name = NULL, 00100 real64 fract = 0.0) 00101 00102 : fSniffer (sniffer) 00103 00104 { 00105 if (fSniffer) 00106 fSniffer->StartTask (name, fract); 00107 } 00108 00109 ~dng_sniffer_task () 00110 { 00111 if (fSniffer) 00112 fSniffer->EndTask (); 00113 } 00114 00116 00117 void Sniff () 00118 { 00119 if (fSniffer) 00120 fSniffer->Sniff (); 00121 } 00122 00125 00126 void UpdateProgress (real64 fract) 00127 { 00128 if (fSniffer) 00129 fSniffer->UpdateProgress (fract); 00130 } 00131 00135 00136 void UpdateProgress (uint32 done, 00137 uint32 total) 00138 { 00139 UpdateProgress ((real64) done / 00140 (real64) total); 00141 } 00142 00144 00145 void Finish () 00146 { 00147 UpdateProgress (1.0); 00148 } 00149 00150 private: 00151 00152 // Hidden copy constructor and assignment operator. 00153 00154 dng_sniffer_task (const dng_sniffer_task &task); 00155 00156 dng_sniffer_task & operator= (const dng_sniffer_task &task); 00157 00158 }; 00159 00160 /*****************************************************************************/ 00161 00162 #endif 00163 00164 /*****************************************************************************/ | |||
