The recorded database is has two wrappers, for supporting the internal records and external records.
Currently, the interface to internal records requires that
the programmer explicitly call the dupicate() and erase() methods - in
future, it is intended that this will be done automatically by a new
PlRecord
class, so that the internal records behave like
"smart pointers"; in the meantime, the PlRecord
provides a
trivial wrapper around the various recorded database functions.
The class PlRecord
supports the following methods:
PlRecord
object.
The class PlRecord
provides direct access to the
reference counting aspects of the recorded term (through the duplicate()
and erase() methods), but does not connect these with C++'s
copy constructor, assignment operator, or destructor. If the recorded
term is encapsulated within an object, then the containing object can
use the duplicate() and erase() methods in its copy and move
constructors and assignment operators (and the erase() method in the
destructor).21The copy constructor
and assignment use the duplicate() method; the move constructor and
assignment use the duplicate() method to assign to the destination and
the erase() method on the source; and the destructor uses erase().
Alternatively, the std::shared_ptr
or std::unique_ptr
can be used with the supplied PlrecordDeleter
, which calls
the erase() method when the shared_ptr
reference count goes
to zero or when the std::unique_ptr
goes out of scope.
For example:
std::shared_ptr<PlRecord> r(new PlRecord(t.record()), PlRecordDeleter()); assert(t.unify_term(r->term()));
The class PlRecordExternalCopy
keeps the external
record as an uninterpreted string. It supports the following
methods.