Recent

Author Topic: My first Attempt making a MultiMap generic  (Read 447 times)

jamie

  • Hero Member
  • *****
  • Posts: 6556
My first Attempt making a MultiMap generic
« on: September 09, 2024, 03:03:51 pm »
I tried to use the Generic.Collections Tdictionary but the compiler choked with a "lj3131" symbol not found error at the end of the project file.

So I went with the TFPGMap generic and gave it a shoot.

There are some items in this MAP I need to disable because it's not going to work well with a Multimap.

This is just a start for me and most likely good enough for the project I am doing.

Attached is a test project with the code in hand.

Any thoughts are welcomed.

The only true wisdom is knowing you know nothing

jamie

  • Hero Member
  • *****
  • Posts: 6556
Re: My first Attempt making a MultiMap generic
« Reply #1 on: September 09, 2024, 04:10:52 pm »
I just added an Enumerator that returns the the Data which in this case is a list instance that hoses the actual data.

I may elect to include a TMultiMapPair but I found that if you need the key there is a INDEXOF(data) that will give you the key.

Going with the pair idea, it looks like I would need to subclass the enumerator to fill the pair record.
The only true wisdom is knowing you know nothing

jamie

  • Hero Member
  • *****
  • Posts: 6556
Re: My first Attempt making a MultiMap generic
« Reply #2 on: September 09, 2024, 11:43:32 pm »
I've been working on this for a few hours now... Here is just the file with the generics in it.

I've also included a TFPGSet. It needs more work but its useable as it is now.

These aren't the most efficient classes because I just wrapped around existing ones to get things done.

I will now integrate this in my current project so I can get that moving.

I do have TMultiMapPair type in there but its not implemented for the FOR LOOP, the class has FIRST, NEXT, PROV and last
to capture a TPair that gives you the Key and Data List.




The only true wisdom is knowing you know nothing

 

TinyPortal © 2005-2018