ObjectStore C++ API Reference

os_object_cursor

An object cursor allows retrieval of the objects stored in a specified segment, one object at a time, in an arbitrary order. This order is stable across traversals of the segment, as long as no objects are created or deleted from the segment, and no reorganization is performed (using schema evolution or compaction). Operations are provided for creating a cursor, advancing a cursor, and for testing whether a cursor is currently positioned at an object (or has run off the end of the segment). It is also possible to position a cursor at a specified object in the segment.

In addition, an operation is provided for retrieving the object at which a cursor is positioned, together with an os_type representing the type of the object, and, for an object that is an array, a number indicating how many elements it has.

os_object_cursor::current()

os_boolean current(
      void* &pointer, 
      const os_type* &type, 
      os_int32 &count
) const;
If the cursor is positioned at an object, returns nonzero (true), sets pointer to refer to the address of the object, and sets type to refer to an os_type representing the object's type. If the object is an array, count is set to refer to the number of elements it has; if the object is not an array, count is set to 0. If the cursor is not positioned at an object, 0 (false) is returned, and all three arguments are set to refer to 0.

os_object_cursor::first()

void first();
Positions the cursor at the first object in the cursor's associated segment. The object is first in an arbitrary order that is stable across traversals of the segment, as long as no objects are created or deleted from the segment, and no reorganization is performed (using schema evolution or compaction). If there are no objects in the cursor's associated segment, the cursor is positioned at no object.

os_object_cursor::more()

os_boolean more() const;
Returns nonzero (true) if the cursor is positioned at an object. Returns 0 (false) otherwise.

os_object_cursor::next()

void next();
Positions the cursor at the next object in the cursor's associated segment. The object is next in an arbitrary order that is stable across traversals of the segment, as long as no objects are created or deleted from the segment, and no reorganization is performed (using schema evolution or compaction). If the cursor is positioned at no object, err_cursor_at_end is signaled. Otherwise, if there is no next object, the cursor is positioned at no object.

os_object_cursor::os_object_cursor()

os_object_cursor(os_segment *seg);
Creates a new os_object_cursor associated with the specified segment. If the segment is empty, the cursor is positioned at no object; otherwise it is positioned at the first object in the cursor's associated segment. The object is first in an arbitrary order that is stable across traversals of the segment, as long as no objects are created or deleted from the segment, and no reorganization is performed (using schema evolution or compaction).

os_object_cursor::set()

void set(const void *ptr);
Positions the cursor at the object containing the address ptr. If ptr is not an address in the specified cursor's associated segment, signals err_cursor_not_at_object. If ptr is in the cursor's associated segment but within unallocated space, the cursor is positioned at no object or is arbitrarily positioned at an object in the segment.

os_object_cursor::~os_object_cursor()

~os_object_cursor();
Performs internal maintenance associated with os_object_cursor deallocation.



[previous] [next]

Copyright © 1997 Object Design, Inc. All rights reserved.

Updated: 03/31/98 17:25:09