Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 07-01-2007
n2503v n2503v is offline
Registered User
 
Name: Alex Makarenko
Organization: ACFR, University of Sydney
Project: Orca
 
Join Date: Jun 2005
Posts: 82
Freeze Map bidirectional iterator?

Is it possible to traverse a Freeze Map backwards? Reverse/bidirectional iterators don't seem to be implemented.

A related question: how to to get the last entry in a Freeze Map (without operator-- cannot step back one entry from the end() )

thanks, alex
__________________
Alex Makarenko
Australian Centre for Field Robotics
The University of Sydney
www.cas.edu.au
project: orca-robotics.sf.net
Reply With Quote
  #2 (permalink)  
Old 07-02-2007
bernard's Avatar
bernard bernard is online now
ZeroC Staff
 
Name: Bernard Normier
Organization: ZeroC, Inc.
Project: Ice
 
Join Date: Feb 2003
Location: Palm Beach Gardens, FL
Posts: 818
Hi Alex,

Currently Freeze provides only forward iterators; it should be easy to add bidirectional operators, since the underlying feature (Berkeley DB cursors) is bidirectional.

I don't see a good way to get the last element of a map (which is meaningful for a sorted map). With bidirectional iterators, I am not sure end()-- would be correct; however you could use rbegin().

Cheers,
Bernard
__________________
Bernard Normier
ZeroC, Inc.
Reply With Quote
  #3 (permalink)  
Old 07-04-2007
n2503v n2503v is offline
Registered User
 
Name: Alex Makarenko
Organization: ACFR, University of Sydney
Project: Orca
 
Join Date: Jun 2005
Posts: 82
Hi Bernard,

Quote:
Currently Freeze provides only forward iterators; it should be easy to add bidirectional operators, since the underlying feature (Berkeley DB cursors) is bidirectional.
Easy for you or for me? :) Can I add it myself? I guess not easily since it needs to talk to Berkeley DB.
I think it'd be useful. Here's my application as an example. I have a map of timestamped data and want to retrieve a "window" around a particular point. I could define the window in terms of time and look for the boundaries but for what I want to it's more natural to define this window in terms of samples.

Quote:
I don't see a good way to get the last element of a map (which is meaningful for a sorted map). With bidirectional iterators, I am not sure end()-- would be correct; however you could use rbegin().
Finding the end and stepping back one record would do the trick. Of course, a reverse iterator would also work but it also seems not to be implemented Freeze::Map. Is it true?

thanks for you help,
alex
__________________
Alex Makarenko
Australian Centre for Field Robotics
The University of Sydney
www.cas.edu.au
project: orca-robotics.sf.net
Reply With Quote
  #4 (permalink)  
Old 07-05-2007
bernard's Avatar
bernard bernard is online now
ZeroC Staff
 
Name: Bernard Normier
Organization: ZeroC, Inc.
Project: Ice
 
Join Date: Feb 2003
Location: Palm Beach Gardens, FL
Posts: 818
In general, adding features to Freeze depends very much on what the underlying database system provides. In this case, Freeze iterators map to Berkeley DB cursors; since Berkeley DB cursors are bidirectional, I don't see any difficulty in adding this feature to Freeze Maps. It won't require lots of code, but naturally adding such feature requires some understanding of the Freeze Map implementation and some new Berkeley DB API calls.

Currently, Freeze provides only forward iterators for Freeze dictionaries: no operator-- and no reverse iterators.

Cheers,
Bernard
__________________
Bernard Normier
ZeroC, Inc.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
getting normal map from freeze map ctennis Help Center 2 03-09-2007 08:48 AM
Freeze Map doubt pradeep Help Center 1 11-30-2006 10:28 AM
Freeze Map iterator should add operator += n -=n dragzhb Comments 4 10-18-2004 11:48 PM
Freeze map ordering dwk Help Center 1 04-26-2004 08:44 PM
about Freeze::Map::iterator sylvain Comments 4 07-21-2003 12:28 PM


All times are GMT -4. The time now is 11:57 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.