Rudiments
Public Member Functions | List of all members
dictionarynode< keytype, valuetype > Class Template Reference

Public Member Functions

 dictionarynode (keytype key, valuetype value)
 
virtual ~dictionarynode ()
 
void setKey (keytype key)
 
void setValue (valuetype value)
 
keytype getKey () const
 
valuetype getValue () const
 
int32_t compare (keytype testkey) const
 
int32_t compare (dictionarynode< keytype, valuetype > *testnode) const
 
void print () const
 

Detailed Description

template<class keytype, class valuetype>
class dictionarynode< keytype, valuetype >

The dictionarynode class stores the key/value pairs that compose a dictionary.

Constructor & Destructor Documentation

◆ dictionarynode()

template<class keytype, class valuetype>
dictionarynode< keytype, valuetype >::dictionarynode ( keytype  key,
valuetype  value 
)

Creates an instance of the dictionary node class with key "key" and value "value".

◆ ~dictionarynode()

template<class keytype, class valuetype>
virtual dictionarynode< keytype, valuetype >::~dictionarynode ( )
virtual

Deletes this instance of the dictionarynode class. Note however, that neither the key nor value stored in the dictionarynode are deleted by this call.

Member Function Documentation

◆ compare() [1/2]

template<class keytype, class valuetype>
int32_t dictionarynode< keytype, valuetype >::compare ( keytype  testkey) const

Returns a negative number,0 or a positive number depending on whether the key stored in the node is respectively less than, equal to or greater than "testkey".

◆ compare() [2/2]

template<class keytype, class valuetype>
int32_t dictionarynode< keytype, valuetype >::compare ( dictionarynode< keytype, valuetype > *  testnode) const

Returns a negative number,0 or a positive number depending on whether the key stored in the node is respectively less than, equal to or greater than "testkey".

◆ getKey()

template<class keytype, class valuetype>
keytype dictionarynode< keytype, valuetype >::getKey ( ) const

Returns the key stored in the node.

◆ getValue()

template<class keytype, class valuetype>
valuetype dictionarynode< keytype, valuetype >::getValue ( ) const

Returns the value stored in the node.

◆ print()

template<class keytype, class valuetype>
void dictionarynode< keytype, valuetype >::print ( ) const

Prints a representation of the key and value stored in the node.

◆ setKey()

template<class keytype, class valuetype>
void dictionarynode< keytype, valuetype >::setKey ( keytype  key)

Sets the key stored in the node to "key".

◆ setValue()

template<class keytype, class valuetype>
void dictionarynode< keytype, valuetype >::setValue ( valuetype  value)

Sets the value stored in the node to "value".