ObjectStore C++ API Reference

os_typespec

Instances of this class are passed to persistent new by applications using the ObjectStore C++ library interface. Typespecs must be transiently allocated; you should not allocate a typespec in persistent memory.

If a user-defined class includes a member declaration exactly like this:

      static os_typespec *get_os_typespec();
the ObjectStore schema generator will automatically supply a body for this function, which will return a pointer to a typespec for the class. The first time such a function is called by a particular process, it will allocate the typespec and return a pointer to it. Subsequent calls to the function in the same process do not result in further allocation; instead, a pointer to the same os_typespec object is returned.

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

os_typespec::get_char()

static os_typespec *get_char();
Returns a pointer to a typespec for the type char. The first time such a function is called by a particular process, it will allocate the typespec and return a pointer to it. Subsequent calls to the function in the same process do not result in further allocation; instead, a pointer to the same os_typespec object is returned.

os_typespec::get_double()

static os_typespec *get_double();
Returns a pointer to a typespec for the type double. The first time such a function is called by a particular process, it will allocate the typespec and return a pointer to it. Subsequent calls to the function in the same process do not result in further allocation; instead, a pointer to the same os_typespec object is returned.

os_typespec::get_float()

static os_typespec *get_float();
Returns a pointer to a typespec for the type float. The first time such a function is called by a particular process, it will allocate the typespec and return a pointer to it. Subsequent calls to the function in the same process do not result in further allocation; instead, a pointer to the same os_typespec object is returned.

os_typespec::get_int()

static os_typespec *get_int();
Returns a pointer to a typespec for the type int. The first time such a function is called by a particular process, it will allocate the typespec and return a pointer to it. Subsequent calls to the function in the same process do not result in further allocation; instead, a pointer to the same os_typespec object is returned.

os_typespec::get_long()

static os_typespec *get_long();
Returns a pointer to a typespec for the type long. The first time such a function is called by a particular process, it will allocate the typespec and return a pointer to it. Subsequent calls to the function in the same process do not result in further allocation; instead, a pointer to the same os_typespec object is returned.

os_typespec::get_long_double()

static os_typespec *get_long_double();
Returns a pointer to a typespec for the type long_double. The first time such a function is called by a particular process, it will allocate the typespec and return a pointer to it. Subsequent calls to the function in the same process do not result in further allocation; instead, a pointer to the same os_typespec object is returned.

os_typespec::get_name()

char *get_name();
Returns the name of the type designated by the specified typespec.

os_typespec::get_pointer()

static os_typespec *get_pointer();
Returns a pointer to a typespec for the type void*. The first time such a function is called by a particular process, it will allocate the typespec and return a pointer to it. Subsequent calls to the function in the same process do not result in further allocation; instead, a pointer to the same os_typespec object is returned.

os_typespec::get_short()

static os_typespec *get_short();
Returns a pointer to a typespec for the type short. The first time such a function is called by a particular process, it will allocate the typespec and return a pointer to it. Subsequent calls to the function in the same process do not result in further allocation; instead, a pointer to the same os_typespec object is returned.

os_typespec::get_signed_char()

static os_typespec *get_signed_char();
Returns a pointer to a typespec for the type signed_char. The first time such a function is called by a particular process, it will allocate the typespec and return a pointer to it. Subsequent calls to the function in the same process do not result in further allocation; instead, a pointer to the same os_typespec object is returned.

os_typespec::get_signed_int()

static os_typespec *get_signed_int();
Returns a pointer to a typespec for the type signed_int. The first time such a function is called by a particular process, it will allocate the typespec and return a pointer to it. Subsequent calls to the function in the same process do not result in further allocation; instead, a pointer to the same os_typespec object is returned.

os_typespec::get_signed_long()

static os_typespec *get_signed_long();
Returns a pointer to a typespec for the type signed_long. The first time such a function is called by a particular process, it will allocate the typespec and return a pointer to it. Subsequent calls to the function in the same process do not result in further allocation; instead, a pointer to the same os_typespec object is returned.

os_typespec::get_signed_short()

static os_typespec *get_signed_short();
Returns a pointer to a typespec for the type signed_short. The first time such a function is called by a particular process, it will allocate the typespec and return a pointer to it. Subsequent calls to the function in the same process do not result in further allocation; instead, a pointer to the same os_typespec object is returned.

os_typespec::get_unsigned_char()

static os_typespec *get_unsigned_char();
Returns a pointer to a typespec for the type unsigned_char. The first time such a function is called by a particular process, it will allocate the typespec and return a pointer to it. Subsequent calls to the function in the same process do not result in further allocation; instead, a pointer to the same os_typespec object is returned.

os_typespec::get_unsigned_int()

static os_typespec *get_unsigned_int();
Returns a pointer to a typespec for the type unsigned_int. The first time such a function is called by a particular process, it will allocate the typespec and return a pointer to it. Subsequent calls to the function in the same process do not result in further allocation; instead, a pointer to the same os_typespec object is returned.

os_typespec::get_unsigned_long()

static os_typespec *get_unsigned_long();
Returns a pointer to a typespec for the type unsigned_long. The first time such a function is called by a particular process, it will allocate the typespec and return a pointer to it. Subsequent calls to the function in the same process do not result in further allocation; instead, a pointer to the same os_typespec object is returned.

os_typespec::get_unsigned_short()

static os_typespec *get_unsigned_short();
Returns a pointer to a typespec for the type unsigned_short. The first time such a function is called by a particular process, it will allocate the typespec and return a pointer to it. Subsequent calls to the function in the same process do not result in further allocation; instead, a pointer to the same os_typespec object is returned.

os_typespec::operator ==()

os_boolean operator ==(const os_typespec&) const;
Returns nonzero (true) if the two typespecs designate the same type; returns 0 (false) otherwise.

os_typespec::os_typespec()

os_typespec(char *type_name);
Constructs an os_typespec representing the type with the specified name. This must be a name for a built-in type (such as int or char), a class, or a pointer-to-class or pointer-to-built-in type. For example, foo** is not allowed - use void* instead. Typedef names are not allowed. Typespecs must be allocated transiently; they should not be allocated in persistent memory.

In general, make use of typespecs for fundamental types, described in the ObjectStore C++ API User Guide in Typespecs for Fundamental Types, or typespecs for classes, described in Typespecs for Classes, rather than the os_typespec constructor. If you must use the os_typespec constructor, be sure to adhere to the guidelines outlined in The os_typespec Constructor in the ObjectStore C++ API User Guide.

If you use const or volatile in specifying the type, always put the const or volatile specifier after the type it modifies. For example, use

char const *
rather than

const char *


[previous] [next]

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

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