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_rational.h00001 /*****************************************************************************/ 00002 // Copyright 2006 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/workarea/stern/camera_raw/dng_sdk/source/dng_rational.h#3 $ */ 00010 /* $DateTime: 2006/03/19 21:45:16 $ */ 00011 /* $Change: 211775 $ */ 00012 /* $Author: stern $ */ 00013 00014 /*****************************************************************************/ 00015 00016 #ifndef __dng_rational__ 00017 #define __dng_rational__ 00018 00019 /*****************************************************************************/ 00020 00021 #include "dng_types.h" 00022 00023 /*****************************************************************************/ 00024 00025 class dng_srational 00026 { 00027 00028 public: 00029 00030 int32 n; // Numerator 00031 int32 d; // Denominator 00032 00033 public: 00034 00035 dng_srational () 00036 : n (0) 00037 , d (0) 00038 { 00039 } 00040 00041 dng_srational (int32 nn, int32 dd) 00042 : n (nn) 00043 , d (dd) 00044 { 00045 } 00046 00047 void Clear () 00048 { 00049 n = 0; 00050 d = 0; 00051 } 00052 00053 bool IsValid () const 00054 { 00055 return d != 0; 00056 } 00057 00058 bool NotValid () const 00059 { 00060 return !IsValid (); 00061 } 00062 00063 real64 As_real64 () const; 00064 00065 void Set_real64 (real64 x, int32 dd = 0); 00066 00067 void ReduceByFactor (int32 factor); 00068 00069 }; 00070 00071 /*****************************************************************************/ 00072 00073 class dng_urational 00074 { 00075 00076 public: 00077 00078 uint32 n; // Numerator 00079 uint32 d; // Denominator 00080 00081 public: 00082 00083 dng_urational () 00084 : n (0) 00085 , d (0) 00086 { 00087 } 00088 00089 dng_urational (uint32 nn, uint32 dd) 00090 : n (nn) 00091 , d (dd) 00092 { 00093 } 00094 00095 void Clear () 00096 { 00097 n = 0; 00098 d = 0; 00099 } 00100 00101 bool IsValid () const 00102 { 00103 return d != 0; 00104 } 00105 00106 bool NotValid () const 00107 { 00108 return !IsValid (); 00109 } 00110 00111 real64 As_real64 () const; 00112 00113 void Set_real64 (real64 x, uint32 dd = 0); 00114 00115 void ReduceByFactor (uint32 factor); 00116 00117 }; 00118 00119 /*****************************************************************************/ 00120 00121 #endif 00122 00123 /*****************************************************************************/ |