ObjectStore C++ API Reference

os_mop

This class is part of the ObjectStore metaobject protocol, which provides access to ObjectStore schemas. The members provided concern the transient schema.

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

os_mop::bind()

void os_mop::bind (
      const char* hetero_set,
      os_schema_options* schema_options,
      os_boolean make_neutral_changes,
      os_boolean allow_schema_reorg,
      const char** neutral_output
);
Causes all classes in the transient schema to be bound for the current architecture. A default invocation of this binding function occurs automatically when classes are installed into a database schema. This interface allows the binding to occur independently, and allows additional functionality beyond the default behavior to be invoked.

It is important to consider the effects of heterogeneity on schema neutralization. See ossg Neutralization Options in Chapter 5 of ObjectStore Building C++ Interface Applications for detailed information.

The hetero_set argument can specify any heterogeneity set supported for the current platform, or can be set to null if no heterogenity is requested.

The schema_options argument specifies the compiler options and pragmas to be used on this and other platforms.

The make_neutral_changes argument controls whether os_mop automatically modifies the schema to make it neutral. If make_neutral_changes is set to false and the schema is not neutral, the exception err_mop_not_neutral is signaled.

The allow_schema_reorg argument permits os_mop to make more complex modifications in order to ensure schema neutralization.

The neutral_output argument allows the caller to receive a string containing a description of the neutralization changes and/or failures encountered. The caller must delete the returned string.

Neutralization failures
If the schema is not neutral and cannot be made neutral for some reason, the exception err_mop_cannot_neutralize is signaled. This could occur if

See ObjectStore Building C++ Interface Applications, Chapter 5, Building Applications for Use on Multiple Platforms, for more details on schema neutralization options and regulations.

os_mop::copy_classes()

static void copy_classes (
      const os_schema &schema,
      os_const_classes &classes
);
Copies the specified classes into the transient schema. If any of the given classes is not well formed or is not from the given schema, or the given schema is the transient schema, an exception is raised.

os_mop::current()

static os_schema &current ();
Returns the schema currently bound. The bound schema is the schema in which dynamically created types are deposited. After initialization of schema services, the current schema is bound to the schema found in the transient database.

os_mop::find_namespace()

static os_namespace *find_namespace (const char* name);
Returns the os_namespace associated with the given name in the 
os_schema denoted by os_mop::current(). 

os_mop::find_type()

static os_type *find_type(const char *name);
Returns a pointer to the type in the transient schema with the specified name; returns 0 if there is no such type.

os_mop::get_transient_schema()

static os_schema &get_transient_schema();
Returns a reference to the transient schema.

os_mop::get_failure_classes()

os_classes osmop::get_failure_classes ();
Following a call to bind() and before a call to os_mop::reset or os_database_schema::install(), the function get_failure_classes() returns the classes for which no valid neutralization was found.

This list should be empty except after a call to bind() that results in err_mop_cannot_neutralize's being signaled. Note that the neutralization failure of a class can hide further neutralization failures because no attempt is made to neutralize types derived from or that embed failing classes.

os_mop::get_neutralized_classes()

os_classes osmop::get_neutralized_classes();
Following a call to bind() and before a call to os_mop::reset or os_database_schema::install(), the function get_neutralized_classes() returns the classes for which changes were required. If the previous call to bind resulted in err_mop_cannot_neutralize's being signaled, this list is not necessarily complete.

os_mop::initialize()

static void initialize();
Must be called before you use the transient schema, that is, before you create any schema objects and before you copy any classes into the transient schema.

os_mop::initialize_object_metadata()

static void os_mop::initialize_object_metadata(
      void *object,
      const char *type_name);
This interface initializes the compiler metadata, if any, associated with the object. The object instance can be transient or persistent; however, the schema for its class must be present in the application schema. If the object is transient, the type_name argument must be nonnull, and indicates the name of the class of the object.

If the object is persistent, the type_name can be null. If nonnull, it must match exactly the real type of the object; otherwise an exception is generated. For example, names returned by the os_types or os_mop subsystem are safe to use, and will match correctly. The best method is to pass a null type_name when the instance is persistent.

This call must be made while inside a transaction. The object pointer must be a pointer to a valid top-level object. Pointers to embedded objects will generate an exception in the case of persistent pointers where this case can be verified. In the case of transient instances, no such checking is possible, and a bad initialization could result.

Top-level arrays must be initialized one element at a time. The object pointer must point beyond any vector headers in a top-level array. Embedded arrays within objects are initialized correctly. Also, any compiler metadata inside a union with discriminants will not be initialized. It is very difficult to arrange to call union discriminant functions during this initialization.

Virtual base class pointers, vector headers, and any other compiler metadata are not affected by this interface. It also has no effect on normal class data.

The equivalent C interface is found in Chapter 6, C Library Interface.

os_mop::reset()

static void reset ();
Reset the portion of schema services responsible for the access and construction of schema types through the MOP interface. After this operation, the current schema is empty



[previous] [next]

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

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