Topic
9 replies Latest Post - ‏2012-09-26T20:36:52Z by MaitreBart
MaitreBart
MaitreBart
60 Posts
ACCEPTED ANSWER

Pinned topic OMUMap and OMUIterator

‏2012-09-18T13:10:47Z |
I can't barely find anything on the subject over the whole Internet:

What is returned by an OMUIterator over an OMUMap?

Is it the key? Is it the value (element)? Or is it the pair (Item(key, element))?

Everything is void* in a OMUxxx (for a good reason of course!), so it is quite hard to guess...
Updated on 2012-09-26T20:36:52Z at 2012-09-26T20:36:52Z by MaitreBart
  • shanz9903
    shanz9903
    268 Posts
    ACCEPTED ANSWER

    Re: OMUMap and OMUIterator

    ‏2012-09-18T14:22:21Z  in response to MaitreBart
    Isn't http://publib.boulder.ibm.com/infocenter/rhaphlp/v7r6/topic/com.ibm.rhp.frameworks.doc/topics/rhp_r_fw_omumap_class.html
    any use?
    • shanz9903
      shanz9903
      268 Posts
      ACCEPTED ANSWER

      Re: OMUMap and OMUIterator

      ‏2012-09-18T14:37:32Z  in response to shanz9903
      and similarly OMMap's help page has an example with it using an iterator
      http://publib.boulder.ibm.com/infocenter/rhaphlp/v7r6/topic/com.ibm.rhp.frameworks.doc/topics/rhp_r_fw_ommap_class.html
      • MaitreBart
        MaitreBart
        60 Posts
        ACCEPTED ANSWER

        Re: OMUMap and OMUIterator

        ‏2012-09-18T15:25:20Z  in response to shanz9903
        Interesting example.

        However, the problem is that the iterator is used by the queue, not by the map.

        Moreover, the example could have used a list instead of a map as far as the visited container is concerned because the use of the map's value (int) is trivial: The user just wants to check for the presence of the key.

        Thanks anyway.
    • MaitreBart
      MaitreBart
      60 Posts
      ACCEPTED ANSWER

      Re: OMUMap and OMUIterator

      ‏2012-09-18T15:08:07Z  in response to shanz9903
      Yes, I did go to this page: Nothing says anything about iterators.

      And the add() method is not accessible. In OMMap it is not even documented.
      If you take time to inspect all the methods, you'll find most information is trivial (still useful).

      The remove methods indicate they "delete" the elements of the map. Isn't that pernicious?
      Do the methods really call the 'delete' operator on each element?
      What if the user still want to keep a reference on what he most probably called 'new' upon each of them in order to create them?
      Or is it more realistic to think that the remove methods simply move the elements out of the map, without deleting them?
  • MaitreBart
    MaitreBart
    60 Posts
    ACCEPTED ANSWER

    Re: OMUMap and OMUIterator

    ‏2012-09-26T20:36:52Z  in response to MaitreBart
    Well, according to the code in omumap.h, it is a pointer to the value (element) that is returned by an OMUMap iterator.