Class COM.odi.jcpp.CPlusPlus

java.lang.Object
   |
   +----COM.odi.jcpp.CPlusPlus

public class CPlusPlus
extends Object
implements IPersistent, ICPlusPlus
CPlusPlus is the abstract superclass for peer classes. You cannot export Java peer objects. For additional information, see Developing ObjectStore Java Applications That Access C++.


Method Index

 o delete()
Deletes a Java peer object, which has the effect of deleting a C++ object.
 o getTransientDatabase()
Returns the database object associated with transient C++ objects.
 o getTransientSegment()
Returns the segment object associated with transient C++ objects.
 o noteJavaCppClassAssociation(String, String)
Creates an association between the C++ class name and the Java class name.

Methods

 o delete
  public abstract void delete()
Deletes a Java peer object, which has the effect of deleting a C++ object. Deleting a C++ object makes the corresponding Java peer object stale. Subsequent attempts to invoke methods on the deleted object in the same transaction throw ObjectException.

When you delete a C++ object, ensure that there are no objects with pointers or references to the deleted object. If an application tries to dereference a pointer or reference to a deleted C++ object, the results are unpredictable.

Also, you must not invoke delete() on an object that is not a top-level heap-allocated object. If you delete an embedded object, it can have unpredictable results.

An alternate way to delete a C++ object is to call the ObjectStore.destroy() method on the corresponding peer object. The peer class overrides the destroy() method so that the destructor for the object is invoked in C++. After this happens, ObjectStore reclaims the storage associated with the peer object.

When you invoke ObjectStore.destroy() on a primary Java object, ObjectStore leaves a tombstone. If any objects try to access the destroyed object, the tombstone causes ObjectStore to throw ObjectNotFoundException.

There is a bug that prevents ObjectStore from leaving a tombstone when you destroy a Java peer object. This will be fixed in a future release. For now, you must be careful that you do not destroy a Java peer object that is still referred to by another object and then try to use that reference. While doing so is always a mistake, in the current product there is no tombstone to flag the mistake for Java peer objects.

 o noteJavaCppClassAssociation
  public static void noteJavaCppClassAssociation(String javaClassName,
                                                 String cppClassName)
Creates an association between the C++ class name and the Java class name. The peer generator tool does this for you.

However, if you are coding your own peer classes, you must invoke this method. The result is that ObjectStore maps the specified C++ class to the specified Java peer class.

Parameters:
javaName - Name of the Java peer class. This must be a String type and not a java.lang.Class instance. This avoids loading the class until it is required.

cppName - Name of the C++ class.

Throws: ObjectStoreException
If the C++ class is already mapped to some other Java class.
 o getTransientDatabase
  public static Database getTransientDatabase()
Returns the database object associated with transient C++ objects.

Returns:
The transient database.

Throws: ObjectStoreException
If the current thread is not associated with a session and there is no global session.
 o getTransientSegment
  public static Segment getTransientSegment()
Returns the segment object associated with transient C++ objects.

Returns:
The transient segment.

Throws: ObjectStoreException
If the current thread is not associated with a session and there is no global session.

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