[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SV: HashTable specialization



> Ok, like I said in one of the other mails I want HashTable to serialize
> itself, but be aware of *where* it serializes itself to (a PakFile / ZIP
> file / whatever). I looked a bit around in the code and I think the best
> way to accomplish this is to dump the MISC template parameter and replace
> it with an inheritance relationship. Example:
>
> (HashTable only takes the first three template parameters)
> We do a
>
> typedef HashTable <File *,      File::Key,      ppu32> FileHashTable;
> typedef HashTable <Directory *, Directory::Key, ppu32> DirHashTable;
>
> Now Directory just contains
> FileHashTable *m_pFileTable;
> DirHashTable  *m_pDirTable;
>
> which it gets from the virtual factory methods
> FileHashTable *Directory::CreateFileTable ();
> DirHashTable  *Directory::CreateDirTable  ():
>
Why do we need these? We already have virtual serialization methods and the
constructor will, of course, be aware of what class it belongs to. So when
will code in Directory need to create a HashTable derivate?

Of course there is the hash->dynhash thing (for optimizing adding when
building large pak files), but I think that should be a virtual method
itself.

> What do you think? Is there again something I didn't see? ;)
>
I changed my mind (in the other E-mail I say this is a bad idea). I think
this should work perfectly.