next up previous contents index
Next: Addressing Up: Design of Persistent Storage Previous: Design Goals

Interfaces

  As described above, the interfaces to the persistent storage must be harmonious with the C++ standard ones. A flowchart of object manipulation is effective in the evaluation of such harmony. Here is an example of object manipulation procedure.

Object *p = 0; // pointer declaration and initialization
p = new Object(parameters, ...); // allocation and construction
p->manipulate(parameters, ...); // manipulation
delete p; p = 0; // destruction and deallocation; pointer invalidation


  
Figure 2.1: Layers of Object Manipulation
\begin{figure}
\begin{center}

\includegraphics [scale=1]{layers.ps}
\end{center}\end{figure}

The flowchart of this manipulation is analyzed into four layers of operations (See Figure 2.1). The top layer is the identity and reference layer. The pointer serves as both the identity of the object and the manipulation clue to it. The assignment p = 0 after the delete operation means that the pointer is no longer valid.

The second layer is the storage allocation layer. The first half of the new operator and the second half of the delete operator are the allocation and the deallocation of storage block for the object, respectively.

The third layer is the object instantiation layer. The second half of the new operator and the first half of the delete operator are the construction and the destruction of the object, respectively. These operations are attained through the automatic execution of its constructor and destructor.

The fourth layer is the object manipulation layer. A sequence of various manipulations on the object can be performed though there is only one operation in this example.

All the objects in C++ have almost the same framework of life cycles. Local and static objects are different in that they are identified and referenced by their variable names, constructors are called at the declaration and destructors are called at the end of their scopes.


  
Figure 2.2: Layers of Persistent Object Manipulation
\begin{figure}
\begin{center}

\includegraphics [scale=1]{newlayers.ps}
\end{center}\end{figure}

An analysis concludes that the extra operations required for the implementation of the persistent storage reside in the different representations of the identity and the reference of an object. This means that there must be a new layer of object manipulation. The identity and reference layer must be divided into two layers: the identity layer and the reference layer. In addition, the storage allocation layer must be placed between the identity layer and the reference layer. In the reference layer, the persistent identity of an object is converted to a normal pointer for reference and manipulation (See Figure 2.2). If the object has already been instantiated in the persistent storage, the storage allocation layer and the instantiation layer are omitted.


next up previous contents index
Next: Addressing Up: Design of Persistent Storage Previous: Design Goals
Mori Tetsuya / t2y3141592@gmail.com