/*! @header FTPersistentSet @abstract Module of FT @availability OS X, GNUstep @copyright 2004, 2005, 2006 Free Software Foundation, Inc. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  -------------------------------------------------------------------------
  Modification history

  30.03.06 ola     initial version
  23.08.06 ola     license changed
  -------------------------------------------------------------------------
  
*/ #if !defined(__FTPersistentSet_H) #define __FTPersistentSet_H #include #include #include #include /*! * @class FTPersistentSet * @abstract Utility class which uses a BDB database in order to manage a * set of objects in the database. Before using a set either * createDBUsingDataFile or openDBUsingDataFile has to be called. * @description TODO:The currently implemented version works without any caching * althought this might be very helpful here.

* So operations evaluating all entries within a set may require * iteration over all database records thus they are very expensive * at present. Examples of such operations: count, member */ @protocol FTPersistentSet /*! * @method addObject * @abstract Adds a object to the set. This object must implement * NSCoding. * @result self */ - addObject: (id) anObject; /*! * @method closeDB * @abstract closes the underlying database. After this call the * object may not be used any more. */ - (void) closeDB; /*! * @method containsObject * @abstract This is an expensive operation at present * @result YES if the specified object is to be found in the set. */ - (BOOL) containsObject: (id) anObject; /*! * @method count * @abstract Expensive operation used to determine the number of elements * in this set * @description TODO: optimize this operation * @result number of elements in the current set */ - (unsigned) count; /*! * @method createDBUsingDataFile * @abstract Creates a persistent set using the specified file name as * data file * @param aFilename fully qualified name of datafile to use for the * set * @result self */ - createDBUsingDataFile: (NSString *) aFilename; /*! * @method iterator * @abstract Returns an iterator over all members of this set. This is an * expensive operation at present * @result iterator over all elements of the set */ - (id ) iterator; /*! * @method openDBUsingDataFile * @abstract Opens a persistent set using the specified file name as * data file. Call failes if file does not exist. * @param aFilename fully qualified name of datafile to use for the * set * @result self */ - openDBUsingDataFile: (NSString *) aFilename; /*! * @method removeObject * @abstract removes the specified object from the set. Operation is ignored * the object could no be found within the set. * @result self */ - removeObject: (id) anObject; @end #endif