Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

d_Dictionary< K, V > Class Template Reference

#include <d_Dictionary.h>

Inheritance diagram for d_Dictionary< K, V >:

d_Collection< d_Association< K, V > > d_Object List of all members.

Public Methods

 d_Dictionary ()
 ~d_Dictionary ()
void bind (const K &iKey, const V &iValue)
void unbind (const K &iKey)
lookup (const K &iKey)
d_Boolean contains_key (const K &iKey)
virtual d_Boolean allows_duplicates () const
virtual d_Boolean is_ordered () const
d_Iterator< d_Association<
K, V > > 
create_iterator ()
d_Iterator< d_Association<
K, V > > 
begin ()
d_Iterator< d_Association<
K, V > > 
end ()
 d_Dictionary (d_Object::DynaFactoryConstructor *iObj)

Public Attributes

d_Iterator< d_Association<
K, V > > 
iter

Detailed Description

template<class K, class V>
class d_Dictionary< K, V >

It's an unordered collection of associations.

An association is compound of the couple key and value. Key and value can be of any types. It's like to the C++ STL map<> container, but the collection is transparently persistent.

This collection type is useful when items in the collection can be associated with keys. This collection offers methods to retrieve an item by a key.

LOCATION: d_Dictionary.h

USAGE: d_Dictionary< , <value-type> > <property-name>;

Where:

<key-type >: Key type. Can be a literal or a user type <value-type >: Value type. Can be a literal or a user type <PROPERTY-NAME>: NAME OF PROPERTY

<key-type> must be an ODMG literal or a user type but with the definition of operator<.

EXAMPLES: * DEFINITION OF A DICTIONARY OF CODE/PRODUCT d_Dictionary< d_String, d_Ref<Product> > Code_Products;

...

* INSERT A PRODUCT WITH ASSOCIATED ITS CODE

Code_Products.bind( "10345", product );

...

* LOOKUP OF A PRODUUCT BY CODE d_Ref<Product> product = Code_Products.lookup( "10345" );

SEE ALSO: d_Association, d_Collection, d_Iterator

ODMG: Compliant


Constructor & Destructor Documentation

template<class K, class V>
d_Dictionary< K, V >::d_Dictionary  
 

Default Constructor.

ODMG : Compliant

template<class K, class V>
d_Dictionary< K, V >::~d_Dictionary  
 

Destructor.

ODMG : Compliant

template<class K, class V>
d_Dictionary< K, V >::d_Dictionary d_Object::DynaFactoryConstructor   iObj [inline]
 


Member Function Documentation

template<class K, class V>
virtual d_Boolean d_Dictionary< K, V >::allows_duplicates   const [virtual]
 

Returns always false.

ODMG : Compliant

Implements d_Collection< d_Association< K, V > >.

template<class K, class V>
d_Iterator< d_Association<K,V> > d_Dictionary< K, V >::begin  
 

Returns an iterator that points to the first element.

Permits to handle the container by STL classes.

SEE ALSO: create_iterator() ODMG : Compliant

template<class K, class V>
void d_Dictionary< K, V >::bind const K &    iKey,
const V &    iValue
 

Insert a new association in the dictionary.

Creates a new association between and and insert it in the dictionary. If an association with key is already present in the dictionary, the old value is replaced with the new value .

SEE ALSO: unbind(), lookup() ODMG : Compliant

template<class K, class V>
d_Boolean d_Dictionary< K, V >::contains_key const K &    iKey
 

Check if an association is present in the dictionary.

Searches, in the dictionary, the association with key . If found returns true, otherwise false.

SEE ALSO: lookup() ODMG : Compliant

template<class K, class V>
d_Iterator< d_Association<K,V> > d_Dictionary< K, V >::create_iterator  
 

Returns an iterator that points to the first element.

SEE ALSO: begin() ODMG : Compliant

template<class K, class V>
d_Iterator< d_Association<K,V> > d_Dictionary< K, V >::end  
 

Returns an iterator that points to the last element.

Permits to handle the container by STL classes.

SEE ALSO: begin() ODMG : Compliant

template<class K, class V>
virtual d_Boolean d_Dictionary< K, V >::is_ordered   const [virtual]
 

Returns always false.

ODMG : Compliant

Implements d_Collection< d_Association< K, V > >.

template<class K, class V>
V d_Dictionary< K, V >::lookup const K &    iKey
 

Retrieve an association by key.

Searches, in the dictionary, the association with key . If found returns the value of the association, otherwise a d_Error_ElementNotFound exception is thrown.

SEE ALSO: contains_key() ODMG : Compliant

template<class K, class V>
void d_Dictionary< K, V >::unbind const K &    iKey
 

Remove an association by the dictionary.

If the dictionary contains an association with the key , it is removed from the dictionary.

SEE ALSO: bind() ODMG : Compliant


Member Data Documentation

template<class K, class V>
d_Iterator< d_Association<K,V> > d_Dictionary< K, V >::iter
 


The documentation for this class was generated from the following file:
Generated on Fri Nov 29 17:12:14 2002 for Orient ODBMS Just Edition v. 2.0e by doxygen1.3-rc1