ObjectStore C++ API Reference

os_type

This class is part of the ObjectStore metaobject protocol, which provides access to ObjectStore schemas. Instances of this class represent C++ types.

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.

Programs using this class must include <ostore/ostore.hh>, followed by <ostore/coll.hh> (if used), followed by <ostore/mop.hh>.

os_type::Anonymous_indirect

This enumerator indicates a const or volatile type. It is a possible return value from os_type::get_kind().

os_type::Array

This enumerator indicates an array type. It is a possible return value from os_type::get_kind().

os_type::Char

This enumerator indicates a character type. It is a possible return value from os_type::get_kind().

os_type::Class

This enumerator indicates a class. It is a possible return value from os_type::get_kind().

os_type::Double

This enumerator indicates the type double. It is a possible return value from os_type::get_kind().

os_type::Enum

This enumerator indicates an enumeration type. It is a possible return value from os_type::get_kind().

os_type::Float

This enumerator indicates the type float. It is a possible return value from os_type::get_kind().

os_type::Function

This enumerator indicates a function type. It is a possible return value from os_type::get_kind().

os_type::get_alignment()

os_unsigned_int32 get_alignment() const;
Gets the alignment associated with the type.

os_type::get_enclosing_class()

const os_class_type *get_enclosing_class() const;
If a class's definition is nested within that of another class, this other class is the enclosing class of the nested class. The function returns a const pointer to the enclosing class, or 0 if there is no enclosing class.

os_class_type *get_enclosing_class();
If a class's definition is nested within that of another class, this other class is the enclosing class of the nested class. The function returns a non-const pointer to the enclosing class, or 0 if there is no enclosing class.

os_type::get_kind()

os_unsigned_int32 get_kind() const;
Returns one of the following enumerators describing the specified instance of os_type: Type, Void, Unsigned_char, Signed_char, Char, Wchar_t, Unsigned_short, Signed_short, Integer, Unsigned_integer, Signed_long, Unsigned_long, Float, Double, Long_double, Named_indirect, Anonymous_indirect, Pointer, Reference, Pointer_to_member, Array, Class, Instantiated_class, Enum, Function, or Undefined. These enumerators are defined within the scope of the class os_type.

os_type::get_kind_string()

static const char *get_kind_string(os_type_kind);
Returns a string representation of a type kind, as specified with one of the enumerators returned by get_kind().

os_type::get_size()

os_unsigned_int32 get_size();
Returns the size of the specified type in bytes.

os_type::get_string()

char *get_string() const;
Returns a new string containing a printable representation of the specified instance of os_type. The string must be deleted after its value has been consumed.

os_type::Instantiated_class

This enumerator indicates a class that is an instantiation of a class template. It is a possible return value from os_type::get_kind().

os_type::Integer

This enumerator indicates the type int. It is a possible return value from os_type::get_kind().

os_type::is_class_type()

os_boolean os_type::is_class_type() cons;t
Returns 1 if the type is an os_class_type or os_instantiated_class_type.

os_type::is_pointer_type()

os_boolean os_type::is_pointer_type() const;
Returns 1 if the type is an os_pointer_type, os_reference_type, or os_pointer_to_member_type.

os_type::is_const()

os_boolean is_const() const;
Returns 1 if and only if the type expression associated with the specified instance of os_type includes a const type specifier.

os_type::is_indirect_type()

os_boolean os_type::is_indirect_type() const;
Returns true if the type is an os_anonymous_indirect_type or os_named_indirect_type.

os_type::is_integral_type()

os_boolean is_integral_type() const;
Returns nonzero if the specified os_type is an instance of os_integral_type (such as one representing the type unsigned int). Returns 0 otherwise.

os_type::is_real_type()

os_boolean is_real_type() const;
Returns nonzero if the specified os_type is an instance of os_real_type (such as one representing the type long double). Returns 0 otherwise.

os_type::is_unspecified()

os_boolean is_unspecified() const;
Returns nonzero if and only if the specified os_type is the unspecified type. Some os_type-valued attributes in the metaobject protocol are required to have values in a consistent schema, but might lack values in the transient schema, before schema installation or evolution is performed. The get function for such an attribute returns a reference to an os_type or os_class_type. The fact that a reference rather than a pointer is returned indicates that the value is required in a consistent schema. In the transient schema, if such an attribute lacks a value (because you have not yet specified it), the get function returns the unspecified type. This is the only os_type for which is_unspecified() returns nonzero.

os_type::is_volatile()

os_boolean is_volatile() const;
Returns 1 if and only if the type expression associated with the specified instance of os_type includes a volatile type specifier.

os_type::Long_double

This enumerator indicates the type long double. It is a possible return value from os_type::get_kind().

os_type::Named_indirect

This enumerator indicates a typedef. It is a possible return value from os_type::get_kind().

os_type::operator const os_anonymous_indirect_type&()

operator const os_anonymous_indirect_type&() const;
Provides for safe casts from const os_type to const os_anonymous_indirect_type&. If the cast is not permissible, err_mop_illegal_cast is signaled.

os_type::operator const os_array_type&()

operator const os_array_type&() const;
Provides for safe casts from const os_type to const os_array_type&. If the cast is not permissible, err_mop_illegal_cast is signaled.

os_type::operator const os_class_type&()

operator const os_class_type&() const;
Provides for safe casts from const os_type to const os_class_type&. If the cast is not permissible, err_mop_illegal_cast is signaled.

os_type::operator const os_enum_type&()

operator const os_enum_type&() const;
Provides for safe casts from const os_type to const os_enum_type&. If the cast is not permissible, err_mop_illegal_cast is signaled.

os_type::operator const os_function_type&()

operator const os_function_type&() const;
Provides for safe casts from const os_type to const os_function_type&. If the cast is not permissible, err_mop_illegal_cast is signaled.

os_type::operator const os_instantiated_class_type&()

operator const os_instantiated_class_type&() const;
Provides for safe casts from const os_type to const os_instantiated_class_type&. If the cast is not permissible, err_mop_illegal_cast is signaled.

os_type::operator const os_integral_type&()

operator const os_integral_type&() const;
Provides for safe casts from const os_type to const os_integral_type&. If the cast is not permissible, err_mop_illegal_cast is signaled.

os_type::operator const os_named_indirect_type&()

operator const os_named_indirect_type&() const;
Provides for safe casts from const os_type to const os_named_indirect_type&. If the cast is not permissible, err_mop_illegal_cast is signaled.

os_type::operator const os_pointer_type&()

operator const os_pointer_type&() const;
Provides for safe casts from const os_type to const os_pointer_type&. If the cast is not permissible, err_mop_illegal_cast is signaled.

os_type::operator const os_pointer_to_member_type&()

operator const os_pointer_to_member_type&() const;
Provides for safe casts from const os_type to const os_pointer_to_member_type&. If the cast is not permissible, err_mop_illegal_cast is signaled.

os_type::operator const os_real_type&()

operator const os_real_type&() const;
Provides for safe casts from const os_type to const os_real_type&. If the cast is not permissible, err_mop_illegal_cast is signaled.

os_type::operator const os_reference_type&()

operator const os_reference_type&() const;
Provides for safe casts from const os_type to const os_reference_type&. If the cast is not permissible, err_mop_illegal_cast is signaled.

os_type::operator const os_type_type&()

operator const os_type_type&() const;
Provides for safe casts from const os_type to const os_type_type&. If the cast is not permissible, err_mop_illegal_cast is signaled.

os_type::operator const os_void_type&()

operator const os_void_type&() const;
Provides for safe casts from const os_type to const os_void_type&. If the cast is not permissible, err_mop_illegal_cast is signaled.

os_type::operator os_anonymous_indirect_type&()

operator os_anonymous_indirect_type&();
Provides for safe casts from os_type to os_anonymous_indirect_type&. If the cast is not permissible, err_mop_illegal_cast is signaled.

os_type::operator os_array_type&()

operator os_array_type&();
Provides for safe casts from os_type to os_array_type&. If the cast is not permissible, err_mop_illegal_cast is signaled.

os_type::operator os_class_type&()

operator os_class_type&();
Provides for safe casts from os_type to os_class_type&. If the cast is not permissible, err_mop_illegal_cast is signaled.

os_type::operator os_enum_type&()

operator os_enum_type&();
Provides for safe casts from os_type to os_enum_type&. If the cast is not permissible, err_mop_illegal_cast is signaled.

os_type::operator os_function_type&()

operator os_function_type&();
Provides for safe casts from os_type to os_function_type&. If the cast is not permissible, err_mop_illegal_cast is signaled.

os_type::operator os_instantiated_class_type&()

operator os_instantiated_class_type&();
Provides for safe casts from os_type to os_instantiated_class_type&. If the cast is not permissible, err_mop_illegal_cast is signaled.

os_type::operator os_integral_type&()

operator os_integral_type&();
Provides for safe casts from os_type to os_integral_type&. If the cast is not permissible, err_mop_illegal_cast is signaled.

os_type::operator os_named_indirect_type&()

operator os_named_indirect_type&();
Provides for safe casts from os_type to os_named_indirect_type&. If the cast is not permissible, err_mop_illegal_cast is signaled.

os_type::operator os_pointer_type&()

operator os_pointer_type&();
Provides for safe casts from os_type to os_pointer_type&. If the cast is not permissible, err_mop_illegal_cast is signaled.

os_type::operator os_pointer_to_member_type&()

operator os_pointer_to_member_type&();
Provides for safe casts from os_type to os_pointer_to_member_type&. If the cast is not permissible, err_mop_illegal_cast is signaled.

os_type::operator os_real_type&()

operator os_real_type&();
Provides for safe casts from os_type to os_real_type&. If the cast is not permissible, err_mop_illegal_cast is signaled.

os_type::operator os_reference_type&()

operator os_reference_type&();
Provides for safe casts from os_type to os_reference_type&. If the cast is not permissible, err_mop_illegal_cast is signaled.

os_type::operator os_type_type&()

operator os_type_type&();
Provides for safe casts from os_type to os_type_type&. If the cast is not permissible, err_mop_illegal_cast is signaled.

os_type::operator os_void_type&()

operator os_void_type&();
Provides for safe casts from os_type to os_void_type&. If the cast is not permissible, err_mop_illegal_cast is signaled.

os_type::Pointer

This enumerator indicates a pointer type. It is a possible return value from os_type::get_kind().

os_type::Pointer_to_member

This enumerator indicates a pointer-to-member type. It is a possible return value from os_type::get_kind().

os_type::Reference

This enumerator indicates a reference type. It is a possible return value from os_type::get_kind().

os_type::set_alignment()

void set_alignment(os_unsigned_int32);
Sets the alignment associated with the type.

os_type::set_size()

void set_size (os_unsigned_int32 size) _OS_throw (err_mop);
Sets the size of the specified type in bytes.

os_type::Signed_char

This enumerator indicates the type signed char. It is a possible return value from os_type::get_kind().

os_type::Signed_long

This enumerator indicates the type long. It is a possible return value from os_type::get_kind().

os_type::Signed_short

This enumerator indicates the type short. It is a possible return value from os_type::get_kind().

os_type::strip_indirect_types()

const os_type &strip_indirect_types() const;
For types with const or volatile specifiers, this function returns a const reference to the type being specified as const or volatile. For example, if the specified os_type represents the type const int, strip_indirect_types() will return an os_type representing the type int. If the specified os_type represents the type char const * const, strip_indirect_types() will return an os_type representing the type char const *.

For typedefs, this function returns the original type for which the typedef is an alias.

This function calls itself recursively until the result is not an os_indirect_type. So, for example, consider an os_named_indirect_type representing

      typedef const part const_part
The result of applying strip_indirect_types() to this is an os_class_type representing the class part (not an os_anonymous_indirect_type representing const part - which would be the result of os_indirect_type::get_target_type()).

os_type &strip_indirect_types();
For types with const or volatile specifiers, this function returns a non-const reference to the type being specified as const or volatile. For example, if the specified os_type represents the type const int, strip_indirect_types() will return an os_type representing the type int. If the specified os_type represents the type char const * const, strip_indirect_types() will return an os_type representing the type char const *.

For typedefs, this function returns the original type for which the typedef is an alias.

This function calls itself recursively until the result is not an os_indirect_type. So, for example, consider an os_named_indirect_type representing

      typedef const part const_part
The result of applying strip_indirect_types() to this is an os_class_type representing the class part (not an os_anonymous_indirect_type representing const part - which would be the result of os_indirect_type::get_target_type()).

os_type::Type

This enumerator indicates a type serving as a parameter to a class or function template. It is a possible return value from os_type::get_kind().

os_type::type_at()

static const os_type *type_at(const void *p);
Returns the type of the object that begins at location p. p should point to the beginning of an instance of a class or built-in type such as int. The instance can be allocated at top level, or it can be the value of a data member or the subobject corresponding to a base class. If p does not point to the beginning of such an instance, 0 is returned. If two or more objects start at p, the type of the innermost object is returned.

os_type::type_containing()

static const os_type *type_containing
      const void *p,
      const void *&p_container,
      os_unsigned_int32 &element_count
);
If the outermost object that contains the location p is not an array, this function returns the type of the outermost containing object. The argument p_container is modified to point to the containing object, and element_count is set to 1.

If the outermost containing object is an array, the function sets element_count to the number of elements in the array, adjusts p_container to point to the first element of the array, and returns the element type of the array.

If p points to freed or transient memory, 0 is returned, and p_container and element_count are set to 0.

os_type::Undefined

This enumerator indicates a type whose kind cannot be determined. It is a possible return value from os_type::get_kind().

os_type::Unsigned_char

This enumerator indicates the type unsigned char. It is a possible return value from os_type::get_kind().

os_type::Unsigned_integer

This enumerator indicates the type unsigned int. It is a possible return value from os_type::get_kind().

os_type::Unsigned_long

This enumerator indicates the type unsigned long. It is a possible return value from os_type::get_kind().

os_type::Unsigned_short

This enumerator indicates the type unsigned short. It is a possible return value from os_type::get_kind().

os_type::Void

This enumerator indicates the type void. It is a possible return value from os_type::get_kind().



[previous] [next]

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

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