home *** CD-ROM | disk | FTP | other *** search
- /*
- IXRecordManager.h
- Copyright 1991, NeXT Computer, Inc.
- */
-
- #import <btree/IXPostingCursor.h>
- #import <mach/cthreads.h>
-
- #import "IXAttributeParser.h"
- #import "IXPostingList.h"
-
- @class IXStore, IXAttribute, IXBTreeCursor;
-
- extern IXAttributeParser *IXDefaultAttributeParser();
-
- // The count method returns the number of user supplied objects, plus the
- // number of attributes. To find the number of user supplied objects, subtract
- // the number of attributes, returned by attributeCount, from the count.
-
- // Note that when the class of an object activated by a record manager doesn't
- // exist in the executable image, new class and meta class objects are created
- // and added to the run time. The method list is empty, restricting instances
- // to behavior inherited from existing superclasses. If another version of the
- // class is found in the executable image, however, then the method list of the
- // loaded version will be copied to the new class.
-
- @interface IXRecordManager: Object
- <IXNameAndFileAccess, IXRecordWriting, IXTransientAccess, IXTransientMessaging, IXAttributeBinding>
- {
- struct mutex _mutexLock;
- id _storeDirectory;
- id _dataRepository;
- BOOL _freeStore;
- unsigned _handle;
- char *_handleName;
- IXStore *_store;
- struct _NXMapTable *_attributeNames;
- struct _NXMapTable *_attributeLists;
- struct _NXMapTable *_privateCursors;
- IXBTreeCursor *_attributeBTree;
- IXBTreeCursor *_attributeTable;
- id _delegate;
- }
-
- // Returns the store, e.g., [[client store] startTransaction].
- - (IXStore *)store;
-
- // These methods manage named attributes based on selectors.
-
- - removeAttributeNamed:(const char *)name;
- - addAttributeNamed:(const char *)name forSelector:(SEL)selector;
- - (BOOL)hasAttributeNamed:(const char *)name;
-
- - (unsigned)attributeCount; // returns the number of attributes.
-
- - (char *)attributeNames;
- - (IXPostingCursor *)cursorForAttributeNamed:(const char *)name;
- - (SEL)selectorForAttributeNamed:(const char *)name;
-
- - (char *)classNames;
- - (char *)attributeNamesForClass:aClass;
-
- - clean; // removes all discarded records.
- - discardRecord:(unsigned)record; // marks a record for later removal.
- - reclaimRecord:(unsigned)record; // reclaims a discarded record.
-
- - (unsigned)capacity; // returns the highest record number in use.
- - (IXPostingList *)contents; // returns all records in the receiver.
-
- - (IXPostingList *)discards; // returns the discarded records.
- - (IXPostingList *)removals; // returns the handles of all removed records.
-
- - (IXPostingList *)recordsForClass:aClass; // does not include subclasses.
-
- // These methods manage the subset of the class hierarchy to which a given
- // attribute applies. They are version sensitive.
-
- - setTargetClass:aClass forAttributeNamed:(const char *)name;
- - getTargetName:(const char **)target andVersion:(unsigned *)version
- forAttributeNamed:(const char *)name;
-
- // These methods manage an optional user supplied attribute description.
-
- - getDescription:(char **)aDescription forAttributeNamed:(const char *)name;
- - setDescription:(const char *)aDescription
- forAttributeNamed:(const char *)name;
-
- // Setting a comparison format provides for access to the standard BTree
- // comparators. The comparison format is remembered across frees.
-
- - (const char *)comparisonFormatForAttributeNamed:(const char *)name;
- - setComparisonFormat:(const char *)aFormat
- forAttributeNamed:(const char *)name;
-
- // This defaults to string comparison. Otherwise, it must be set every time
- // the record manager is initialized from the store.
-
- - getComparator:(IXComparator **)comparator andContext:(const void **)context
- forAttributeNamed:(const char *)name;
- - setComparator:(IXComparator *)comparator andContext:(const void *)context
- forAttributeNamed:(const char *)name;
-
- // Setting a parser on an attribute causes it to be potentially multi- valued.
- // The attribute's value is parsed into one or more sub- values for inversion.
-
- - (IXAttributeParser *)parserForAttributeNamed:(const char *)name;
- - setParser:(IXAttributeParser *)aParser
- forAttributeNamed:(const char *)name;
-
- // The delegate is passed as the source for the IXRecordTranscription protocol
- - setDelegate:anObject;
- - delegate;
-
- // These methods are used to get and set the value of named properties
- // consisting of arbitrary binary data. Setting a length of zero removes the
- // named property from the record altogether.
-
- - (BOOL)getValue:(void **)value andLength:(unsigned *)length
- ofBlob:(const char *)name forRecord:(unsigned)record;
- - (BOOL)setValue:(const void *)value andLength:(unsigned)length
- ofBlob:(const char *)name forRecord:(unsigned)record;
-
- // These methods are used to establish and access attributes other than the
- // method attributes managed by name by the preceding methods.
-
- - addAttribute:(IXAttribute *)anAttribute;
- - (const IXAttribute *)attributeNamed:(const char *)name;
- - removeAttribute:(IXAttribute *)anAttribute;
-
- @end
-
- // Any or all of the following methods are optional.
-
- @interface Object(IXRecordManagerDelegate)
-
- // Called after an object was read from the data repository.
- - source:aSource didRead:anObject forRecord:(unsigned)record;
-
- // Called after an object was added to the data repository.
- - source:aSource didAdd:anObject forRecord:(unsigned)record;
-
- // Called after an object was removed from the data repository.
- - source:aSource didRemove:anObject forRecord:(unsigned)record;
-
- @end
-
-