Download Wrapping Persistent ROOT Framework Objects in an Object

Transcript
The upper layer code is small compared with the lower layer. The upper layer interacts with
C++ layer using it’s foreign function interface. A foreign function definition is realized using the
following calls [3]:
a) Define the implementation in C of a foreign AmosQL function, e. g.,
void row_open(a_callcontext, a_tuple)
row_open opens a container to be used in AmosQL queries;
b) Register the foreign function name to Amos II:
a_extfunction("row_open", row_open);
c) Define the foreign function signature as AmosQL:
create function row_open(Charstring file, Charstring innerPath, Charstring tree)->Integer
as foreign "row_open";
row_open is one of the typical lower layer’s interface functions. Although they could be called
directly by the user, the upper layer provides a more convenient encapsulation of the lower layer’s
interface as well as additional functionality. It manages the ROOTContainer Amos II type defined
in the meta-data schema. Instead of always repeating a compound key identificator (file, innerPath,
tree) the user can instead operate with a single ROOTContainer object. ROOTContainer functions
allow to access both key and type information associated with a particular container.
The duplicate type removal stored procedure is also implemented in upper layer.
The upper layer uses a trigger for setting which members of a certain type should not be
retrieved. This provides an escape from forming of cyclic objects of type Struct which are not
supported by Amos II garbage collector. As meta-data objects are persistent objects in the database,
the lower layer implementation maintains a transient copy of meta-data in the memory. Whenever
the object in the image is changed, lower layer must be informed to also update its information. It
easily done by overriding default Amos II setter using function set_setfunction() with manually
programmed code that performs a suitable call to external layer (see Amos II documentation, [3, 4,
17]).
6.5 Limitations
In this section we discuss some system limitations.
6.5.1 Reference breaking
Consider two types, A and B:
class B;
class A {
B * b;
37