Lolly 1.4.27
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
hashtree< K, V > Class Template Reference

#include <hashtree.hpp>

Collaboration diagram for hashtree< K, V >:
Collaboration graph
[legend]

Public Member Functions

 hashtree (const hashtree< K, V > &)
 
 ~hashtree ()
 
hashtree< K, V > & operator= (hashtree< K, V > x)
 
 hashtree ()
 
 hashtree (V val)
 
hashtree_rep< K, V > * operator-> (void)
 
hashtree< K, V > operator() (K key)
 
hashtree< K, V > operator[] (K key)
 

Private Member Functions

 hashtree (bool)
 
void realize ()
 

Private Attributes

hashtree_rep< K, V > * rep
 

Friends

class hashtree_rep< K, V >
 
bool is_nil (hashtree< K, V > ht)
 
int N (hashtree< K, V > ht)
 

Detailed Description

template<class K, class V>
class hashtree< K, V >

Definition at line 87 of file hashtree.hpp.

Constructor & Destructor Documentation

◆ hashtree() [1/4]

template<class K , class V >
hashtree< K, V >::hashtree ( bool )
inlineprivate

Definition at line 92 of file hashtree.hpp.

92: rep (NULL) {}
hashtree_rep< K, V > * rep
Definition hashtree.hpp:89
The list class represents a linked list.
Definition list.hpp:48

◆ hashtree() [2/4]

template<class K , class V >
hashtree< K, V >::hashtree ( const hashtree< K, V > & x)
inline

Definition at line 24 of file hashtree.ipp.

24 : rep (x.rep) {
25 if (this->rep != NULL) INC_COUNT (this->rep);
26}
#define INC_COUNT(R)
Macro used to increment the reference count for a structure object.
Definition classdef.hpp:74
base class of resources
Definition resource.hpp:23

◆ ~hashtree()

template<class K , class V >
hashtree< K, V >::~hashtree ( )
inline

Definition at line 28 of file hashtree.ipp.

28 {
29 if (this->rep != NULL) DEC_COUNT (this->rep);
30}
#define DEC_COUNT(R)
Macro used to decrement the reference count for a structure object and delete it if the count reaches...
Definition classdef.hpp:84

◆ hashtree() [3/4]

template<class K , class V >
hashtree< K, V >::hashtree ( )
inline

Definition at line 103 of file hashtree.hpp.

C * tm_new()

◆ hashtree() [4/4]

template<class K , class V >
hashtree< K, V >::hashtree ( V val)
inline

Definition at line 106 of file hashtree.hpp.

Member Function Documentation

◆ realize()

template<class K , class V >
void hashtree< K, V >::realize ( )
inlineprivate

Definition at line 83 of file hashtree.ipp.

83 {
84 if (rep == NULL) {
86 INC_COUNT (rep);
87 }
88}

◆ operator=()

template<class K , class V >
hashtree< K, V > & hashtree< K, V >::operator= ( hashtree< K, V > x)
inline

Definition at line 34 of file hashtree.ipp.

34 {
35 if (this->rep != NULL) DEC_COUNT (this->rep);
36 this->rep= x.rep;
37 if (x.rep != NULL) INC_COUNT (x.rep);
38 return *this;
39}

◆ operator->()

template<class K , class V >
hashtree_rep< K, V > * hashtree< K, V >::operator-> ( void )
inline

Definition at line 96 of file hashtree.ipp.

96 {
97 // always make sure there is a rep!
98 realize ();
99 return rep;
100}
void realize()
Definition hashtree.ipp:83

◆ operator()()

template<class K , class V >
hashtree< K, V > hashtree< K, V >::operator() ( K key)
inline

Definition at line 111 of file hashtree.ipp.

111 {
112 realize ();
113 if (!(*this)->contains (key)) (*this)->add_new_child (key);
114 return (*this)->children (key);
115}

◆ operator[]()

template<class K , class V >
hashtree< K, V > hashtree< K, V >::operator[] ( K key)
inline

Definition at line 104 of file hashtree.ipp.

104 {
105 if (*this->contains (key)) return *this->children (key);
106 else TM_FAILED ("read-access to non-existent node requested");
107}
bool contains(T a, array< T > b)
Check if an array contains a specified element.
#define TM_FAILED(msg)
Macro used to throw an exception with a specified error message.
Definition basic.hpp:93

Friends And Related Symbol Documentation

◆ hashtree_rep< K, V >

template<class K , class V >
friend class hashtree_rep< K, V >
friend

Definition at line 120 of file hashtree.hpp.

◆ is_nil

template<class K , class V >
bool is_nil ( hashtree< K, V > ht)
friend

Definition at line 123 of file hashtree.ipp.

123 {
124 return ht.rep == NULL;
125}

◆ N

template<class K , class V >
int N ( hashtree< K, V > ht)
friend

Definition at line 129 of file hashtree.ipp.

129 {
130 return N (ht->children);
131}
friend int N(hashtree< K, V > ht)
Definition hashtree.ipp:129

Member Data Documentation

◆ rep

template<class K , class V >
hashtree_rep<K, V>* hashtree< K, V >::rep
private

Definition at line 89 of file hashtree.hpp.


The documentation for this class was generated from the following files: