IlsDictionary
 
IlsDictionary
Category 
Modeling class template
Inheritance Path 
IlsDictionary
Description 
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();
The class IlsEntity contains this member function by default.
Library 
<server>
Header File 
#include <ilserver/model.h>
Synopsis 
template <class ValueType>
class Dictionary
{
public:
IlsBoolean isIn(IlsCIdentifierR identifier);
Myself& suppress(IlsCIdentifierR);
ValueTypeP get(IlsCIdentifierR identifier);
Myself& clear();
unsigned int getCount();
Myself& operator<<(CValueTypePR);
Myself& operator>>(CValueTypePR);
ValueTypeP operator[](IlsCIdentifierR identifier);
};
Member Functions 
IlsBoolean isIn(IlsCIdentifierR identifier);
This function returns IlsTrue if the dictionary contains the object that corresponds to the specified identifier. Otherwise, it returns IlsFalse.
If the identifier passed to this function is a null smart pointer, the exception IlsNullPointerEncountered is thrown.
Myself& suppress(IlsCIdentifierR);
This function removes the object that matches the identifier passed as its argument from the dictionary.
*If the identifier passed to this function is a null smart pointer, the exception IlsNullPointerEncountered is thrown.
*If no object corresponds to the identifier passed to the function, the exception IlsNotFound is thrown.
*If you try to remove an object from a dictionary to which an iterator points, the exception IlsRemovingFromOpenTable is thrown.
ValueTypeP get(IlsCIdentifierR identifier);
This function 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.
*If the identifier passed to this function is a null smart pointer, the exception IlsNullPointerEncountered is thrown.
Warning: Hashtables and, therefore, Rogue Wave Server dictionaries do not support search for an empty string. You must run a test before calling the “get(name)” function, where “name” is an empty string.
Myself& clear();
This function empties the dictionary. If an iterator points to the dictionary when this function is called, the exception IlsClearingOpenTable is thrown.
unsigned int getCount();
This function returns the number of objects contained in the dictionary.
Operators 
Myself& operator<<(CValueTypePR);
This operator adds a smart pointer to an object of type ValueType to the dictionary.
*If the smart pointer passed to this operator is null, the exception IlsNullPointerEncountered is thrown.
*If the dictionary already contains an object with the same identifier as the one you are trying to add, the exception IlsAlreadyInDictionary is thrown.
*If you try to add an object to a dictionary to which an iterator points, the exception IlsAddingToOpenTable is thrown.
Myself& operator>>(CValueTypePR);
This extraction operator removes the smart pointer to an object of type ValueType from the dictionary.
*If the smart pointer passed to this operator is null, the exception IlsNullPointerEncountered is thrown.
*If no object corresponds to the smart pointer passed to the operator, the exception IlsNotFound is thrown.
*If you try to remove an object from a dictionary to which an iterator points, the exception IlsRemovingFromOpenTable is thrown.
ValueTypeP operator[](IlsCIdentifierR identifier);
This operator is identical to the function IlsDictionary::get described above.
See Also 
Exceptions, IlsDictionary::Iterator, IlsEntity, IlsObject

Version 5.8
Copyright © 2014, Rogue Wave Software, Inc. All Rights Reserved.