The Storage Kit: Global Functions, Constants, and Defined Types

This section lists parts of the Storage Kit that aren't contained in classes.


Global Functions


boot_volume()

Declared in: <storage/Volume.h>

      BVolume boot_volume(void)

Returns the BVolume object that represents the machine's "boot" volume. This is the volume that contains the exectuables for the kernel, app server, net server, and so on, that are currently running.

See also: BVolume


database_for()

Declared in: <storage/Database.h>

      BDatabase *database_for(long databaseID)

Returns the BDatabase object that represents the database that's identified by databaseID. Database ID numbers are unique and persistent (within a practical estimation of eternity).

If databaseID is invalid--if it doesn't identify an available database --the function returns NULL.

See also: BDatabase


does_ref_conform()

Declared in: <storage/Record.h>

      bool does_ref_conform(record_ref ref, const char *tableName)

Returns TRUE if the record referred to by ref conforms to the table identified by tableName, either directly or through table-inheritance; otherwise returns FALSE . Although you can use this function anywhere, it's particularly useful when testing refs that you are passed to your application in a BMessage object. Most commonly, you test to see if the refs you have received represent files, directories, or either. The table names that you use for each of these is listed below:

  • The "File" table is used for files.

  • The "Folder" table is used for directories.

  • The "FSItem" table is used for file system items (files and directories).
  • The Be software defines a number of other tables that you can use in the does_ref_conform() test (the names listed above are by far the most useful). The complete list of Be-defined table names can be found in the section Table Definitions .


    get_ref_for_path()

    Declared in: <storage/Store.h>

          long get_ref_for_path(const char *pathName, record_ref *ref)

    This function finds the file (or directory) that's designated by pathName, and returns the file's ref by reference in ref. The path name should be absolute, and should include the volume name as its first element. (Although get_ref_for_path() will try to interpret a relative pathname as branching from the current working directory, you shouldn't rely on this; the identity of the current working directory isn't guaranteed.)

    Note that BDirectory provides a GetRefForPath() member function that accepts absolute or relative path names.


    update_query()

    Declared in: <storage/Query.h>

          void update_query(BMessage *aMessage)

    Used to forward messages from the Storage Server to a live BQuery object. You use this function as part of a derived-class implementation of BApplication's MessageReceived() function; you never call it elsewhere in your application.

    See also: BQuery


    volume_at()

    Declared in: <storage/Volume.h>

          BVolume volume_at(long index)

    Returns the index'th BVolume in your application's volume list (counting from 0). The list is created and administered for you by the Storage Kit.

    If index is out-of-bounds, the function sets the returned object's Error() code to B_ERROR.

    See also: BVolume


    volume_for_database()

    Declared in: <storage/Volume.h>

          BVolume volume_for_database(BDatabase *db)

    Returns the BVolume object that corresponds to the argument database (as represented by a BDatabase object).

    If db is invalid--if it doesn't identify a database--the function sets the returned object's Error() code to B_ERROR.


    Constants


    File Open Modes

    Declared in: <storage/StorageDefs.h>

    Constant Meaning
    B_READ_ONLY The file is open for reading only.
    B_READ_WRITE The file is open for reading and writing.
    B_EXCLUSIVE The file is open for reading and writing, and no one else can open the file until its closed.
    B_FILE_NOT_OPEN The file isn't open.

    The first three constants are used by BFile's Open() function to describe the mode in which the object should open its file. Add the fourth and you have the set of value that can be returned by BFile's OpenMode() function.

    See also: BFile::Open()


    File Seek Constants

    Declared in: <storage/StorageDefs.h>

    Constant Meaning
    B_FILE_TOP Seek from the first byte in the file.
    B_FILE_MIDDLE Seek from the currently-pointed to position.
    B_FILE_BOTTOM Seek from the last byte in the file.

    These constants are used as arguments to BFile's Seek() function to describe where a file seek should start from.

    See also: BFile::Seek()


    Live Query Messages

    Declared in: <storage/Query.h>

    Constant Meaning
    B_RECORD_ADDED A record ref needs to be added to the BQuery's ref list.
    B_RECORD_REMOVED A ref needs to be removed from the list.
    D_RECORD_MODIFIED Data has changed in a record referred to by one of the refs in the ref list.

    These constants are the potential what values of a BMessage that's sent from the Storage Server to your application.

    See also: BQuery::MessageReceived()


    query_op Constants

    Declared in: <storage/Query.h>

    Constant Meaning
    B_EQ equal
    B_NE not equal
    B_GT greater than
    B_GE greater than or equal to
    B_LT less than or equal to
    B_LE less than or equal to
    B_AND logically AND the previous two elements
    B_OR logically OR the previous two elements
    B_NOT negate the previous element
    B_ALL wildcard; matches all records

    These query_op constants are the operator values that can be used in the construction of a BQuery's predicate.

    See also: PushOp() in the BQuery class


    Table Field Flags

    Declared in: <storage/Table.h>

    Constant Meaning
    B_INDEXED_FIELD Create an index based on the values taken by this field.

    Each field that you add to a BTable takes a set of flags. Currently, the only flag that is recognized is B_INDEXED_FIELD.

    See also: BTable::AddLongField()


    Defined Types


    database_id

    Declared in: <storage/StorageDefs.h>

          typedef long database_id

    The database_id type represents values that uniquely identify individual databases.

    See also: record_id, the BDatabase class description


    field_key

    Declared in: <storage/StorageDefs.h>

          typedef long field_key

    The field_key type represents fields in a BTable.

    See also: the BTable class description


    query_op

    Declared in: <storage/StorageDefs.h>

          typedef long enum {...}query_op

    The record_ref type represents a set of constants that can be used in a BQuery's predicate.

    See also: Query Operator Constants


    record_id

    Declared in: <storage/StorageDefs.h>

          typedef long record_id

    The record_id type represents values that uniquely identify records in a known database.

    See also: record_ref, the BRecord class description


    record_ref

    Declared in: <storage/StorageDefs.h>

          typedef struct {
                record_id record;
                database_id database;
             } record_ref

    The record_ref type is a structure that uniquely identifies a particular record among all records in all currently available databases. The structure also defines the == and != operators, thus allowing record_ref structures to be compared as values.

    See also: the BRecord class description






    The Be Book, HTML Edition, for Developer Release 8 of the Be Operating System.

    Copyright © 1996 Be, Inc. All rights reserved.

    Be, the Be logo, BeBox, BeOS, BeWare, and GeekPort are trademarks of Be, Inc.

    Last modified September 6, 1996.