Chapter 8. Base Objects

Table of Contents

8.1. Base Objects
8.2. Composing, Storing and Retrieving Base Objects
8.3. Creating Trees from Base Objects Using TreeNodes
8.4. Writing/Reading Base Objects to/from AbstractPersistenceStream

Chapter Objectives

This chapter contains all the information you need to implement persistence to non-module classes in the ML. Many modules and classes provide special functionality to handle objects derived from the class Base or TreeNode so that they can often handle objects they do not even know explicitly (see Section 8.1, “Base Objects” and Section 8.3, “Creating Trees from Base Objects Using TreeNodes”).

This chapter explains how

See Section 2.1.2.3, “Base Field” for information on how to derive your own class from Base and how to transfer Base objects between modules.

8.1. Base Objects

When you want to include a new class to the ML that is not an ML module (e.g., to pass additional image or segmentation information from one module to another), the Base persistence mechanism of the ML should be used. It permits saving and storing objects, passing objects from one module to another BaseField or simply getting and setting their state via strings. This class represents general ML objects that support import/export via strings (setPersistentState()/persistentState()) or arbitrary tree structures (using addStateToTree() and readStateFromTree()) or through a specialized input/output stream (using writeTo() and readFrom()). It has to be the base class for all objects passed from one BaseField to another (see Section 2.1.2, “ Field).

[Note]Note

This class is the base class for the class Module and all derived modules.

  • It can be represented by using the field concept (class BaseField)

  • It provides an interface to allow for the import/export of a persistent representation of an object's internal state.