/* ========================================================================== * ÀÛ ¼º ÀÚ : À̼ø±Ô * ÀÛ ¼º ÀÏ : 2007.02.06 * ³» ¿ë : std::hashtable¸¦ Æ÷ÇÔÇÑ Æ÷ÀÎÅÍ ÇØ½Ã¸Ê ÅÛÇø´ * ÁÖÀÇ»çÇ× : ³Î Æ÷ÀÎÅͰ¡ ¿ø¼Ò°¡ µÇ´Â °ÍÀ» Çã¿ëÇÏÁö ¾Ê´Â´Ù. *===========================================================================*/ #pragma once #pragma warning( push ) #pragma warning( disable: 4267 ) #pragma warning( disable: 4311 ) //#pragma warning( disable: 4996 ) #include #include "Hasher.h" #include "Pair.h" #include "Functor.h" using namespace std; /// Æ÷ÀÎÅÍ ÇØ½Ã ¸Ê /// Ű/°ª ½ÖÀ» ÇϳªÀÇ ¿ø¼Ò·Î Ãë±ÞÇÏ´Â ÄÁÅ×À̳ÊÀÌ´Ù. /// Áߺ¹µÈ ۸¦ Çã¿ëÇÏÁö ¾Ê´Â´Ù. /// ³Î Æ÷ÀÎÅͰ¡ ¿ø¼Ò°¡ µÇ´Â °ÍÀ» Çã¿ëÇÏÁö ¾Ê´Â´Ù. template , class EQUAL = tBinaryEqual > class tPointerHashMap { public: typedef typename tPair cPair; private: typedef tPointerHashMap cSelf; typedef _STLP_PRIV _HashMapTraitsT _HashMapTraits; typedef hashtable, EQUAL, allocator > cTable; public: typedef typename cTable::iterator cIterator; typedef typename cTable::const_iterator cConstIterator; typedef typename cTable::hasher cHasher; typedef typename cTable::key_equal cKeyEqual; typedef typename cTable::allocator_type cAllocatorType; private: /// ÇØ½Ã Å×À̺í cTable mTable; public: /* tPointerHashMap(); explicit tPointerHashMap( unsigned int hint ); /// ¸ðµç ¿ø¼ÒµéÀ» Á¦°Å void Clear(); /// ÇØ½Ã Å×À̺íÀÇ ¹öŶ Å©±â¸¦ º¯°æ void Resize( unsigned int hint ); /// µ¿ÀÏÇÑ Å°¸¦ °¡Áö´Â ¿ø¼ÒÀÇ À§Ä¡¸¦ ¸®ÅÏ cIterator Find( const KEY& key ); cConstIterator Find( const KEY& key) const; /// ÇØ´ç Ű¿¡ °ªÀ» »ðÀÔ /// ½ÇÆÐÇϸé false¸¦ ¸®ÅÏÇÑ´Ù. bool Insert( const KEY& key, const T val ); /// ÇØ´ç ۸¦ °¡Áö´Â ¿ø¼Ò¸¦ Á¦°Å /// Á¦°ÅµÈ ¿ø¼ÒÀÇ °³¼ö¸¦ ¸®ÅÏÇÑ´Ù. unsigned int Erase( const KEY& key ); /// posÀ§Ä¡ÀÇ ¿ø¼Ò¸¦ Á¦°Å void Erase( cIterator pos ); /// [first, last) ¹üÀ§ÀÇ ¿ø¼ÒµéÀ» Á¦°Å void Erase( cIterator first, cIterator last ); /// ¹Ýº¹ÀÚ¸¦ ¸®ÅÏ cIterator Begin(); cConstIterator Begin() const; cIterator End(); cConstIterator End() const; /// key¿¡ ÇØ´çÇÏ´Â °ªÀ» ¾ò¾î¿È /// ½ÇÆÐÇϸé false¸¦ ¸®ÅÏÇÑ´Ù. bool GetAt( T* val, const KEY& key ) const; T GetAt( const KEY& key ) const; /// µ¿ÀÏÇÑ key¸¦ °¡Áö´Â ¿ø¼ÒÀÇ °³¼ö¸¦ ¸®ÅÏ unsigned int GetCount( const KEY& key ) const; /// ¿ø¼Ò ¼ö¸¦ ¸®ÅÏ unsigned int GetSize() const; /// ºñ¾îÀÖ´ÂÁö ¿©ºÎ¸¦ ¸®ÅÏ bool IsEmpty() const; /// ÂüÁ¶ ¿¬»ê /// ÁÖÀÇ: ¿ø¼Ò »ðÀÔ ºÒ°¡! °ªÀ» ¾ò´Â ¿ëµµ·Î¸¸ ¾ÈÀüÇÏ°Ô »ç¿ëÇÒ ¼ö ÀÖ´Ù. T operator [] ( const KEY& key ); /// ÁÖÀÇ: ºÎÇϸ¦ ¾ß±âÇÒ ¼ö ÀÖÀ¸¹Ç·Î Á¶½ÉÇØ¼­ »ç¿ëÇÑ´Ù. tPointerHashMap( const cSelf& other ); */ private: cSelf& operator = ( const cSelf& other ); # include "PointerHashMap.inl" }; #pragma warning( pop )