Topic
  • 9 replies
  • Latest Post - ‏2012-09-26T20:36:52Z by MaitreBart
MaitreBart
MaitreBart
70 Posts

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
    275 Posts

    Re: OMUMap and OMUIterator

    ‏2012-09-18T14:22:21Z  
    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
    275 Posts

    Re: OMUMap and OMUIterator

    ‏2012-09-18T14:37:32Z  
    • shanz9903
    • ‏2012-09-18T14:22:21Z
    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?
    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
    70 Posts

    Re: OMUMap and OMUIterator

    ‏2012-09-18T15:08:07Z  
    • shanz9903
    • ‏2012-09-18T14:22:21Z
    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?
    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
    70 Posts

    Re: OMUMap and OMUIterator

    ‏2012-09-18T15:25:20Z  
    • shanz9903
    • ‏2012-09-18T14:37:32Z
    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
    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.
  • shanz9903
    shanz9903
    275 Posts

    Re: OMUMap and OMUIterator

    ‏2012-09-18T16:21:00Z  
    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?
    I suppose you may have to resort to the oxf model and code (screenshot attached).
  • MaitreBart
    MaitreBart
    70 Posts

    Re: OMUMap and OMUIterator

    ‏2012-09-18T18:19:16Z  
    • shanz9903
    • ‏2012-09-18T16:21:00Z
    I suppose you may have to resort to the oxf model and code (screenshot attached).
    Interesting. Where do you usually find the oxf project? (.rpy or .rpl)
  • shanz9903
    shanz9903
    275 Posts

    Re: OMUMap and OMUIterator

    ‏2012-09-18T20:57:58Z  
    Interesting. Where do you usually find the oxf project? (.rpy or .rpl)
    I think it's
    C:\Rhapsopdy\Share\etc\LangCpp\oxf\oxf.rpy
  • shanz9903
    shanz9903
    275 Posts

    Re: OMUMap and OMUIterator

    ‏2012-09-19T08:43:26Z  
    • shanz9903
    • ‏2012-09-18T20:57:58Z
    I think it's
    C:\Rhapsopdy\Share\etc\LangCpp\oxf\oxf.rpy
    C:\Rhapsody\Share\LangCpp\oxf\model\oxf.rpy
  • MaitreBart
    MaitreBart
    70 Posts

    Re: OMUMap and OMUIterator

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