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_unsigned_int32 get_alignment() const;Gets the alignment associated with the type.
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_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.
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_unsigned_int32 get_size();Returns the size of the specified type in bytes.
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_boolean os_type::is_class_type() cons;tReturns 1 if the type is an os_class_type or os_instantiated_class_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_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_boolean os_type::is_indirect_type() const;Returns true if the type is an os_anonymous_indirect_type or os_named_indirect_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_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_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_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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
void set_alignment(os_unsigned_int32);Sets the alignment associated with the type.
void set_size (os_unsigned_int32 size) _OS_throw (err_mop);Sets the size of the specified type in bytes.
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_partThe 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_partThe 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()).
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.
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.
Updated: 03/31/98 17:25:09