MOOS 0.2375
|
00001 //simple template class that keep track of the 00002 //minimum keyed pair 00003 #ifndef TMINPAIRH 00004 #define TMINPAIRH 00005 template <class TKey,class TData> class TMinPair 00006 { 00007 public: 00008 00009 TMinPair() : m_bLive(false){}; 00010 TKey Key(){return m_Key;}; 00011 TData Data(){return m_Data;}; 00012 bool Valid(){return m_bLive;}; 00013 void Clear(){m_bLive = false;}; 00014 00015 00016 void Update(const TKey & NewKey, const TData & NewData) 00017 { 00018 if(NewKey<m_Key || m_bLive==false) 00019 { 00020 m_bLive = true; 00021 m_Key = NewKey; 00022 m_Data = NewData; 00023 } 00024 } 00025 00026 private: 00027 TKey m_Key; 00028 TData m_Data; 00029 bool m_bLive; 00030 00031 }; 00032 #endif 00033