libDwm-0.6.0
Dwm::Patricia< KeyType, ValueType, KeyEqual > Class Template Reference

Pre-declare the Patricia class template. More...

#include <DwmPatricia.hh>

Inheritance diagram for Dwm::Patricia< KeyType, ValueType, KeyEqual >:
Collaboration diagram for Dwm::Patricia< KeyType, ValueType, KeyEqual >:

Public Member Functions

 Patricia ()
 Constructor.
 
 ~Patricia ()
 Destructor.
 
uint32_t Size () const
 
void Clear ()
 
PatriciaNode< KeyType, ValueType > * Insert (const KeyType &key, const ValueType &data)
 Inserts a new (key, data) pair in the Patricia trie, and returns the new node. More...
 
bool Lookup (const KeyType &key, ValueType &value) const
 Searches for the given key. More...
 
PatriciaNode< KeyType, ValueType > * LookupNode (const KeyType &key) const
 Search for the given key, and returns the node that contains it (or NULL). More...
 
PatriciaNode< KeyType, ValueType > * LongestMatchNode (const KeyType &key) const
 
PatriciaNode< KeyType, ValueType > * LongestMatchNode2 (const KeyType &key) const
 DOESN'T WORK PROPERLY.
 
bool Delete (const KeyType &key)
 Remove the node containing the given key. More...
 
void RecursivePrint () const
 
uint32_t StreamedLength () const
 Returns the number of bytes that should be written if one of the Write() members is called. More...
 
std::istream & Read (std::istream &is)
 Read from an istream. Return the istream.
 
std::ostream & Write (std::ostream &os) const
 Write to an ostream. Return the ostream.
 
ssize_t Read (int fd)
 Read from a file descriptor. More...
 
ssize_t Write (int fd) const
 Write to a file descriptor. More...
 
size_t Read (FILE *f)
 NOT YET IMPLEMENTED.
 
size_t Write (FILE *f) const
 NOT YET IMPLEMENTED.
 
int Read (gzFile gzf)
 NOT YET IMPLEMENTED.
 
int Write (gzFile gzf) const
 NOT YET IMPLEMENTED.
 
int BZRead (BZFILE *bzf)
 NOT YET IMPLEMENTED.
 
int BZWrite (BZFILE *bzf) const
 NOT YET IMPLEMENTED.
 
bool operator== (const Patricia< KeyType, ValueType > &pt) const
 
- Public Member Functions inherited from Dwm::Readable
virtual ~Readable ()
 destructor
 
- Public Member Functions inherited from Dwm::Writable
virtual ~Writable ()
 Destructor.
 
- Public Member Functions inherited from Dwm::GZReadable
virtual ~GZReadable ()
 destructor
 
- Public Member Functions inherited from Dwm::GZWritable
virtual ~GZWritable ()
 destructor
 

Detailed Description

template<typename KeyType, typename ValueType, typename KeyEqual = std::equal_to<KeyType>>
class Dwm::Patricia< KeyType, ValueType, KeyEqual >

Pre-declare the Patricia class template.

Implements a Patricia trie structure with keys of type KeyType.

Member Function Documentation

◆ Delete()

template<typename KeyType, typename ValueType, typename KeyEqual = std::equal_to<KeyType>>
bool Dwm::Patricia< KeyType, ValueType, KeyEqual >::Delete ( const KeyType &  key)
inline

Remove the node containing the given key.

Returns true if the operation succeeded, false otherwise.

◆ Insert()

template<typename KeyType, typename ValueType, typename KeyEqual = std::equal_to<KeyType>>
PatriciaNode<KeyType,ValueType>* Dwm::Patricia< KeyType, ValueType, KeyEqual >::Insert ( const KeyType &  key,
const ValueType &  data 
)
inline

Inserts a new (key, data) pair in the Patricia trie, and returns the new node.

Here is the call graph for this function:

◆ Lookup()

template<typename KeyType, typename ValueType, typename KeyEqual = std::equal_to<KeyType>>
bool Dwm::Patricia< KeyType, ValueType, KeyEqual >::Lookup ( const KeyType &  key,
ValueType &  value 
) const
inline

Searches for the given key.

If the key is found, Copies the associated value into value and returns true. If the key is not found, returns false.

◆ LookupNode()

template<typename KeyType, typename ValueType, typename KeyEqual = std::equal_to<KeyType>>
PatriciaNode<KeyType,ValueType>* Dwm::Patricia< KeyType, ValueType, KeyEqual >::LookupNode ( const KeyType &  key) const
inline

Search for the given key, and returns the node that contains it (or NULL).

XXX - does this work properly?

◆ Read()

template<typename KeyType, typename ValueType, typename KeyEqual = std::equal_to<KeyType>>
ssize_t Dwm::Patricia< KeyType, ValueType, KeyEqual >::Read ( int  fd)
inlinevirtual

Read from a file descriptor.

Returns the number of bytes read on success, -1 on failure.

Implements Dwm::Readable.

Here is the call graph for this function:

◆ StreamedLength()

template<typename KeyType, typename ValueType, typename KeyEqual = std::equal_to<KeyType>>
uint32_t Dwm::Patricia< KeyType, ValueType, KeyEqual >::StreamedLength ( ) const
inlinevirtual

Returns the number of bytes that should be written if one of the Write() members is called.

Implements Dwm::Writable.

Here is the call graph for this function:

◆ Write()

template<typename KeyType, typename ValueType, typename KeyEqual = std::equal_to<KeyType>>
ssize_t Dwm::Patricia< KeyType, ValueType, KeyEqual >::Write ( int  fd) const
inlinevirtual

Write to a file descriptor.

Return the number of bytes written on success, -1 on failure.

Implements Dwm::Writable.

Here is the call graph for this function:

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