tags:

views:

319

answers:

2
+1  Q: 

HashMap in symbian

i want to implement Hashmap in symbian

which takes two values

is there any body who have implement it

there is class RHashMap,RHashTable but i want to pass descrpter and value

or

else is there any class other solution for this

thanks in advance

+2  A: 

I think the documentation doesn't make clear the fact that you should probably have a class that contains an integer and a descriptor.

The THashFunction32 that you need to implement takes one instance of your class and return it's integer member.

The TIdentityRelation that you need to implement takes two instances of your class and compares the integer members.

When you insert an instance of your class into the RHashMap, both the integer and the descriptor members need to have meaningful values.

When you want to retrieve a descriptor from your RHashMap, you create and instance of your class but only set the integer member value. Use that object as a parameter to RHashMap::Find() and it will return the instance of your class that contains the descriptor you were looking for.

QuickRecipesOnSymbianOS
+1  A: 

RHashMap is a templated type. You can use whatever classes you requires as follows:

RhashMap<TInt,TPtr> map;
map.Insert(myInt,myDes);

...

myDes = map.FindL(myInt);
TInt error = map.Remove(myInt);
User::LeaveIfError(error);
map.Close();

Edit: If you wanted a single key to point to two things, then just encapsulate those two things in a single object.

Dynite