ObjectStore C++ API Reference

os_database_root

An object can be used as a database entry point if you associate a string with it by using a root, an instance of the system-supplied class os_database_root. Each root's sole purpose is to associate an object with a name. Once the association is made, you can retrieve a pointer to the object by performing a lookup on the name using a member function of the class os_database.

The types os_int32 and os_boolean, used throughout this manual, are each defined as a signed 32-bit integer type. The type os_unsigned_int32 is defined as an unsigned 32-bit integer type.

All ObjectStore programs must include the header file <ostore/ostore.hh>.

os_database_root::~os_database_root()

~os_database_root();
Called when an instance of os_database_root is deleted. Deletes the associated name (persistent char*) as well.

os_database_root::find()

static os_database_root *find(char *name, os_database *db);
Returns a pointer to the root in the specified database with the specified name. Returns 0 if not found.

os_database_root::get_name()

char *get_name();
Returns the name associated with the os_database_root for which the function is called.

os_database_root::get_typespec()

os_typespec *get_typespec();
Returns a pointer to the typespec associated with the os_database_root for which the function is called (the typespec last passed to set_value() for the root).

os_database_root::get_value()

void *get_value(os_typespec* = 0);
Returns a pointer to the entry-point object associated with the os_database_root for which the function is called. Note that the return value is typed as void*, so a cast might be necessary when using it. If the specified os_typespec does not match the os_typespec specified when the value was set (see os_database_root::set_value()), err_pvar_type_mismatch is signaled. Note that this exception is signaled if and only if the specified typespec does not match the stored one; the actual type of the entry-point object is not checked.

os_database_root::set_value()

void set_value(void *new_value, os_typespec* = 0);
Establishes the object pointed to by new_value as the entry-point object associated with the os_database_root for which the function is called. If new_value points to transient memory or memory in a database other than the one containing the specified os_database_root, err_invalid_root_value is signaled. The specified os_typespec should designate the type of object pointed to by new_value. The typespec is stored for later use by os_database_root::get_value() (see above).



[previous] [next]

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

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