B
Bo Peng
Dear list,
I am looking for a way to store a large amount of unique sequences that
will be accessed by objects. The most important operations are:
1. Direct access to the sequences (from pointers stored in each object).
Access through key lookup is not acceptable.
2. Given a new sequence, determine if it is already in the factory of
sequences. If so, increase the reference count of the existing sequence
and use it; Otherwise, put the new sequence into the factory.
3. If no object is using a sequence, the sequence should be removed from
the factory.
For the purpose of 2, I think I need a hash table algorithm. I will need
reference count and direct access to sequences for 1 and 3. Is there an
existing library that provide such facility? STL hash does not seem to
work (but I am not quite sure).
Of course, any implementation suggestion is welcome and performance is
at the highest priority here.
Many thanks in advance.
Bo
I am looking for a way to store a large amount of unique sequences that
will be accessed by objects. The most important operations are:
1. Direct access to the sequences (from pointers stored in each object).
Access through key lookup is not acceptable.
2. Given a new sequence, determine if it is already in the factory of
sequences. If so, increase the reference count of the existing sequence
and use it; Otherwise, put the new sequence into the factory.
3. If no object is using a sequence, the sequence should be removed from
the factory.
For the purpose of 2, I think I need a hash table algorithm. I will need
reference count and direct access to sequences for 1 and 3. Is there an
existing library that provide such facility? STL hash does not seem to
work (but I am not quite sure).
Of course, any implementation suggestion is welcome and performance is
at the highest priority here.
Many thanks in advance.
Bo