C++ API Reference

os_soft_pointer64<T>

template <class T> 
class os_soft_pointer64 : public os_soft_pointer64_base
ObjectStore provides several soft pointer classes, but usually your code should refer only to instantiations of the class template os_soft_pointer<T>, such as os_soft_pointer<employee>. The template parameter is the referent type, the type of object referred to by the soft pointer. See the entry for the macro os_soft_pointer.

Instances of this class are ObjectStore soft pointers for 64-bit platforms. Soft pointers provide an alternative to using regular pointers to persistent memory. Soft pointers reduce address space usage by deferring the reservation of address space for the soft pointer's referent until the soft pointer is dereferenced. See the Advanced C++ API User Guide.

You can also use soft pointers to allow 32-bit applications to access persistent pointers stored by 64-bit applications, as well as to allow 64-bit applications to access pointers stored by 32-bit applications.

Dereferencing a soft pointer is somewhat slower than dereferencing a regular, hard pointer, but the soft pointer facility uses a caching mechanism to increase soft-pointer efficiency.

In a database, a soft pointer has the same format as a hard pointer. When one application stores a soft pointer in a database, another application can subsequently use the pointer as a regular, hard pointer. Inversely, when one application stores a hard pointer in a database, another application can subsequently use the pointer as a soft pointer.

An application's (or DLL's) schema specifies those pointers that are treated as soft by the application (or DLL). For any pointer-valued data member in a database schema, the application's schema can specify the member's value type as a soft pointer class instead of a pointer type. These definitions are schema compatible.

Because an application's schema specifies those pointers that are to be treated as soft, only values of data members can be treated as soft pointers. Top-level pointers, or pointers in top-level arrays, cannot be treated as soft.

To defer address-space reservation for referents of top-level pointers, replace the top-level pointers with instances of os_Reference. This class has an API just like the soft pointer API.

os_soft_pointer64<T> defines constructors, assignment operators, a conversion operator, operator ->(), and resolve(). Other soft pointer operations are inherited from os_soft_pointer64_base.

If you use a soft pointer type whose referent type is not a class, you must call the macro OS_SOFT_POINTER64_NOCLASS(), passing the referent type.

If a soft pointer refers to an object in a database that is not open, ObjectStore opens the database automatically when the object is accessed (unless the autoopen mode is auto_open_disable). The mode in which the database is opened is determined by the value of objectstore::get_auto_open_mode().

In some cases, comparing two references has a different result from comparing the corresponding pointers. See os_soft_pointer64_base for more information.

os_soft_pointer64<T>::operator =()

os_soft_pointer64<T> &operator =(
      const os_soft_pointer64<T> const &
);
os_soft_pointer64<T> &operator =(
      const os_soft_pointer32<T> const &
);
Establishes the referent of the right operand as the referent of the left operand.

os_soft_pointer64<T> &operator =(T*);
Establishes the object pointed to by the right operand as the referent of the left operand. If the right operand is 0, the left operand becomes a null soft pointer.

os_soft_pointer64<T>::operator T*()

operator T*() const;
Returns a hard pointer with the same referent as the this soft pointer. Returns 0 if this is a null soft pointer.

os_soft_pointer64<T>::operator ->()

T* operator ->() const;
Returns a hard pointer with the same referent as the this soft pointer. Returns 0 if this is a null soft pointer.

os_soft_pointer64<T>::os_soft_pointer64()

os_soft_pointer64();
Constructs a null soft pointer.

os_soft_pointer64(T* hard_ptr);
Constructs a soft pointer with the same referent as the specifed hard pointer. If hard_ptr is 0, constructs a null soft pointer.

os_soft_pointer64(os_soft_pointer64<T> const& soft_ptr);
os_soft_pointer64(os_soft_pointer32<T> const& soft_ptr);
Constructs a soft pointer with the same referent as the specifed soft pointer. If the specified soft pointer is null, constructs a null soft pointer.

os_soft_pointer64<T>::resolve()

T *resolve() const;
Returns a hard pointer with the same referent as the this soft pointer. Returns 0 if this is a null soft pointer.



[previous] [next]

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

Updated: 03/15/99 16:41:22