Rogue Wave Server
API Reference Guide
Product Documentation:

Rogue Wave Server
Documentation Home
List of all members | Classes | Public Types | Public Member Functions
IlsDictionary< ValueType > Class Template Reference

Class for storing objects of a given type with an identifier. More...

#include <ilserver/model.h>

Inherits IlsEntityContext.

Classes

class  Iterator
 IlsDictionary iterator. More...
 

Public Types

typedef IlsDictionary< ValueType > Myself
 Myself is the type of the instantiated template class.
 

Public Member Functions

Myselfclear ()
 Empties the dictionary. More...
 
ValueTypeP get (IlsCIdentifierR identifier) const
 Returns a smart pointer to the object matching the identifier passed as its argument. More...
 
unsigned int getCount () const
 Returns the number of objects contained in the dictionary.
 
IlsBoolean isIn (IlsCIdentifierR identifier)
 Returns IlsTrue if the dictionary contains the object that corresponds to the specified identifier. Otherwise, it returns IlsFalse. More...
 
Myselfoperator<< (CValueTypePR v)
 Adds a smart pointer to an object of type ValueType to the dictionary. More...
 
Myselfoperator>> (CValueTypePR)
 This extraction operator removes the smart pointer to an object of type ValueType from the dictionary. More...
 
ValueTypeP operator[] (IlsCIdentifierR identifier) const
 This operator is identical to the function IlsDictionary::get described above.
 
Myselfsuppress (IlsCIdentifierR, IlsBoolean notify_destruction=IlsTrue)
 Removes the object that matches the identifier passed as its argument from the dictionary. More...
 

Detailed Description

template<class ValueType>
class IlsDictionary< ValueType >

Class for storing objects of a given type with an identifier.

Template Parameters
ValueTypeClass of objects stored into the dictionary.

Library: server

Rogue Wave Server lets you store objects of a given type in a dictionary and manipulate these objects by means of their identifier.

A dictionary is an instance of the class template IlsDictionary. You can declare a dictionary for each class that derives directly or transitively from IlsEntity or IlsObject. However, if you declare a dictionary for a class that derives from IlsObject, you must add the getIdentifier member function to the class declaration. The signature of this function must be:

IlsIdentifier getIdentifier() const;

The class IlsEntity contains this member function by default.

See also
IlsException, IlsDictionary::Iterator, IlsEntity, IlsObject.

Member Function Documentation

§ clear()

template<class ValueType>
Myself& IlsDictionary< ValueType >::clear ( )

Empties the dictionary.

Exceptions
IlsClearingOpenTableIf an iterator points to the dictionary when this function is called.

§ get()

template<class ValueType>
ValueTypeP IlsDictionary< ValueType >::get ( IlsCIdentifierR  identifier) const

Returns a smart pointer to the object matching the identifier passed as its argument.

If no object is associated with the specified identifier, a null smart pointer is returned.

Exceptions
IlsNullPointerEncounteredIf the identifier passed to this function is a null smart pointer.

§ isIn()

template<class ValueType>
IlsBoolean IlsDictionary< ValueType >::isIn ( IlsCIdentifierR  identifier)

Returns IlsTrue if the dictionary contains the object that corresponds to the specified identifier. Otherwise, it returns IlsFalse.

Exceptions
IlsNullPointerEncounteredIf the identifier passed to this function is a null smart pointer.

§ operator<<()

template<class ValueType>
Myself& IlsDictionary< ValueType >::operator<< ( CValueTypePR  v)

Adds a smart pointer to an object of type ValueType to the dictionary.

Exceptions
IlsNullPointerEncounteredIf the smart pointer passed to this operator is null.
IlsAlreadyInDictionaryIf the dictionary already contains an object with the same identifier as the one you are trying to add.
IlsAddingToOpenTableIf you try to add an object to a dictionary to which an iterator points.

§ operator>>()

template<class ValueType>
Myself& IlsDictionary< ValueType >::operator>> ( CValueTypePR  )

This extraction operator removes the smart pointer to an object of type ValueType from the dictionary.

Exceptions
IlsNullPointerEncounteredIf the smart pointer passed to this operator is null.
IlsNotFoundIf no object corresponds to the smart pointer passed to the operator.
IlsRemovingFromOpenTableIf you try to remove an object from a dictionary to which an iterator points.

§ suppress()

template<class ValueType>
Myself& IlsDictionary< ValueType >::suppress ( IlsCIdentifierR  ,
IlsBoolean  notify_destruction = IlsTrue 
)

Removes the object that matches the identifier passed as its argument from the dictionary.

Exceptions
IlsNullPointerEncounteredIf the identifier passed to this function is a null smart pointer.
IlsNotFoundIf no object corresponds to the identifier passed to the function.
IlsRemovingFromOpenTableIf you try to remove an object from a dictionary to which an iterator points.

© Copyright 2018, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.