dht::value Class Reference

A value in DHT. More...

#include <dht/value.h>

Inheritance diagram for dht::value:

dht::store_data dht::basic_data List of all members.

Public Member Functions

 value ()
 default constructor
 value (const void *data, size_t len, bool aht=true)
 constructs value from data
 value (const char *str, bool aht=true)
 constructs value from C-string
 value (const std::string &str, bool aht=true)
 constructs value from string
dht::name_value_mapmeta ()
 returns reference to the meta data
const dht::name_value_mapmeta () const
 returns const reference to the meta data

Detailed Description

A value in DHT.

Represents a value that is stored/obtained to/from DHT with a key.

A value in DHT can, besides the actual value, contain meta data. Not all DHTs do, so supporting meta data is optional and implementation specific. If value is passed with meta data there is no guarantee the DHT implementation does anything with it.

By default the DHT is allowed to perform a one way hash to the value data to squeeze it into whatever bit size the DHT supports for values. This does not apply to meta data, which must be retrievable like it was stored or not at all.

See also:
key, store_data


Constructor & Destructor Documentation

dht::value::value (  )  [inline]

default constructor

Constructs an empty value.

dht::value::value ( const void *  data,
size_t  len,
bool  aht = true 
) [inline]

constructs value from data

Parameters:
data pointer to data
len data length
aht if true a one way hash to the data is allowed

dht::value::value ( const char *  str,
bool  aht = true 
) [inline]

constructs value from C-string

Parameters:
str NULL terminated string
aht if true a one way hash to the data is allowed

dht::value::value ( const std::string &  str,
bool  aht = true 
) [inline]

constructs value from string

Parameters:
str string
aht if true a one way hash to the data is allowed


Member Function Documentation

name_value_map & dht::value::meta (  )  [inline]

returns reference to the meta data

The meta data is stored as dht::name_value_map structure. The meta values can be set by obtaining the reference with this function to the name_value_map.

const name_value_map & dht::value::meta (  )  const [inline]

returns const reference to the meta data

The meta data is stored as dht::name_value_map structure.


The documentation for this class was generated from the following file:
Generated on Thu Mar 1 16:18:47 2007 for libdht by  doxygen 1.5.1