MOOS 0.2375
|
00001 #ifndef TMAXPAIRH 00002 #define TMAXPAIRH 00003 //simple template class that keep track of the 00004 //minimum keyed pair 00005 template <class TKey,class TData> class TMaxPair 00006 { 00007 public: 00008 00009 TMaxPair() : 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 void Update(const TKey & NewKey, const TData & NewData) 00016 { 00017 if(NewKey>m_Key || m_bLive==false) 00018 { 00019 m_bLive = true; 00020 m_Key = NewKey; 00021 m_Data = NewData; 00022 } 00023 } 00024 00025 private: 00026 TKey m_Key; 00027 TData m_Data; 00028 bool m_bLive; 00029 00030 }; 00031 #endif