Hauptseite | Klassenhierarchie | Auflistung der Klassen | Auflistung der Dateien | Klassen-Elemente | Datei-Elemente | Zusätzliche Informationen

Range.h

gehe zur Dokumentation dieser Datei
00001 /* 00002 $Header: /vol/baal-vol3/projekt98/quellen/XCTL_32/INCLUDE/DETECUSE/Range.h,v 1.2 2004/04/15 21:41:53 reinecke Exp $ 00003 00004 Projekt : XCTL 00005 Subsystem : alle 00006 Autor : Jan Picard <picard@informatik.hu-berlin.de> 2001-2002 00007 Institut fuer Informatik, 00008 Humboldt-Universitaet Berlin 00009 Inhalt : Eine Klasse, die ein Intervall mit Ober- und Untergrenzen 00010 realisiert 00011 */ 00012 00013 #ifndef __RANGE_H 00014 #define __RANGE_H 00015 00016 #include <windows.h> 00017 00018 //--||--\\--||--//--||--\\--||--//--||--\\--||--//--||--\\--||--//--||--\\--||-- 00019 00021 template <class TRangeType> 00022 class TRange 00023 { 00028 00029 public: 00030 TRange(TRangeType min, TRangeType max) 00031 { 00032 if ( min < max) 00033 { 00034 _min= min; 00035 _max= max; 00036 } 00037 00038 else 00039 { 00040 _min= max; 00041 _max= min; 00042 } 00043 } 00044 00045 TRangeType ForceIntoRange(TRangeType value) const 00046 { 00047 if ( value < _min) 00048 return _min; 00049 else 00050 if ( _max < value) 00051 return _max; 00052 else 00053 return value; 00054 } 00055 00056 void SetMin(TRangeType value) 00057 { 00058 if (_max < value) 00059 _min= _max; 00060 else 00061 _min= value; 00062 } 00063 00064 void SetMax(TRangeType value) 00065 { 00066 if (value < _min) 00067 _max= _min; 00068 else 00069 _max= value; 00070 } 00071 00072 TRangeType GetMin() const 00073 { 00074 return _min; 00075 } 00076 00077 TRangeType GetMax() const 00078 { 00079 return _max; 00080 } 00081 00082 BOOL includes(TRangeType value) const 00083 { 00084 if ( (value < _min) || (_max < value) ) 00085 return FALSE; 00086 else 00087 return TRUE; 00088 } 00089 00090 private: 00091 TRangeType _min; 00092 TRangeType _max; 00093 }; 00094 00095 #endif // __RANGE_H 00096 00097

Erzeugt am Sat Nov 13 12:48:08 2004 für XCTL32 von doxygen 1.3.7