Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Lookup system in DLL
Message
Information générale
Forum:
Visual C++
Catégorie:
Autre
Divers
Thread ID:
00212931
Message ID:
00213789
Vues:
18
>>What I have tried is: char lookuplist[1000][5]={"abcd","bcde","cdef"...}
>>
>>This works ok. What I now have to do is find a fast way of searching this array OR an alternative to this. My current project will have two arrays; one of 5 bytes, the other 7 bytes. I'm not sure yet how many rows in each array. If it were 1000 then that will be no problem on size.
>
>A better way to do this is to use a CMapStringToOb class (this is a MFC class) or a map class (this is from Standard Template Library (STL)). Both of them have fast search algorithms and both let you lookup an object (in this case a string) based on a key.
>
>I prefer the map from STL and I would give it a try. I never used either of these classes with thousands of elements, so, I can't tell you they will be fast enough for you. But it's pretty strait forward to write a small test program to try it and have some benchmarks on their perfomance.
>
>The map has several advantages vs. CMapStringToOb:
>1. It's standard C++ (so, you can use any compiler/system)
>2. The STL collection classes are extremly flexible
>3. You do not depend on MFC dlls and their versioning problems
>
>But, since performance seems to be the key here, I would try them both before any decision. Both implement a dictionary type of data structure.
>
>>My next project however, will have larger arrays. If the data is embedded in one DLL, it may get a bit too big. If there were another way of doing this, I would probably adopt that approach. That is what I was asking.
>
>Why don't you use a database? Any special reason not to do it?
>
>>The data is currently in DBFs so I can write a program to generate the declaration (I'm not typing that lot!!). Any ideas would be appreciated.
>
>What are the advantages in embeding data into a dll? Why not write a dll that accesses this dbf?
>
>Vlad

Thanks Vlad, I'll give these a try this weekend - I've got a basic for loop working (at least it works) but it's a little slow on my old notebook. I don't want to put any databases into this as this is going to be packaged and I need to stick to one file only - the DLL. I think I may have vastly over-estimated the size, I don't think it will be anywhere near 1Mb after all. Thanks for your help in this and apologies for the initial confusing thread - I was a little frustrated when I wrote it.
Nigel B Coates
NBC Software Services
Dublin, Ireland.
eMail: Nigel.Coates@NBCSoftware.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform