// wzbnode.h #ifndef _PROGRAMCOMMON_WZBNODE_H_ #define _PROGRAMCOMMON_WZBNODE_H_ #include "wztypedef.h" template class CWzBTree; //------------------------------------------------------------------------------ /** @class CWzBNode - ´Üµ¶À¸·Î´Â ¾µ ÀÏÀÌ ¾ø°í, CWzBTree¶û °°ÀÌ ¾¸ */ template class CWzBNode { public: // »ý¼ºÀÚ/¼Ò¸êÀÚ CWzBNode( void ); CWzBNode( const T& data, const S& cmpVal ); ~CWzBNode( void ); // µ¥ÀÌŸ ¼³Á¤ void SetData( const T& data ); // µ¥ÀÌŸ ¾ò±â const T& GetData( void ) const; // ºñ±³°ª ¾ò±â const S& GetValue( void ) const; private: // ºñ±³°ª ¼³Á¤ void SetValue( const S& cmpVal ); // ¿ÞÂÊ ³ëµå ¼³Á¤ void SetLeft( CWzBNode* left ); // ¿ÞÂÊ ³ëµå ¾ò±â CWzBNode* GetLeft( void ) const; // ¿À¸¥ÂÊ ³ëµå ¼³Á¤ void SetRight( CWzBNode* right ); // ¿À¸¥ÂÊ ³ëµå ¾ò±â CWzBNode* GetRight( void ) const; // ºÎ¸ð ³ëµå ¾ò±â CWzBNode* GetParent( void ) const; private: friend class CWzBTree; CWzBNode* m_left; CWzBNode* m_right; CWzBNode* m_parent; T m_data; S m_cmpVal; }; //------------------------------------------------------------------------------ /** */ template CWzBNode::CWzBNode( void ) : m_left( NULL ) , m_right( NULL ) , m_parent( NULL ) { // empty } //------------------------------------------------------------------------------ /** */ template CWzBNode::CWzBNode( const T& data, const S& cmpVal ) : m_left( NULL ) , m_right( NULL ) , m_parent( NULL ) { m_data = data; m_cmpVal = cmpVal; } //------------------------------------------------------------------------------ /** */ template CWzBNode::~CWzBNode( void ) { // empty } //------------------------------------------------------------------------------ /** */ template void CWzBNode::SetData( const T& data ) { m_data = data; } //------------------------------------------------------------------------------ /** */ template const T& CWzBNode::GetData( void ) const { return m_data; } //------------------------------------------------------------------------------ /** */ template void CWzBNode::SetValue( const S& cmpVal ) { m_cmpVal = cmpVal; } //------------------------------------------------------------------------------ /** */ template const S& CWzBNode::GetValue( void ) const { return m_cmpVal; } //------------------------------------------------------------------------------ /** */ template void CWzBNode::SetLeft( CWzBNode* left ) { m_left = left; if( left ) { left->m_parent = this; } } //------------------------------------------------------------------------------ /** */ template CWzBNode* CWzBNode::GetLeft( void ) const { return m_left; } //------------------------------------------------------------------------------ /** */ template void CWzBNode::SetRight( CWzBNode* right ) { m_right = right; if( right ) { right->m_parent = this; } } //------------------------------------------------------------------------------ /** */ template CWzBNode* CWzBNode::GetRight( void ) const { return m_right; } //------------------------------------------------------------------------------ /** */ template CWzBNode* CWzBNode::GetParent( void ) const { return m_parent; } #endif // _PROGRAMCOMMON_WZBNODE_H_