Initialization of the virtual column engine is done by the functions create (for new tables), open (for existing tables) and prepare. The engine can be flushed by the function flush, which allows to write some data. The function open can read these data back. VirtualColumnEngine is closely related with the table system.
A number of (pure) virtual functions have been defined. The pure virtual functions must be implemented in the derived class. The non-pure virtual functions have a default implementation throwing a "not possible" exception. They need to be implemented if they are used for this engine (e.g. makeIndArrColumn does not need to be implemented if the engine does not handle arrays). Furthermore the pure virtual function dataManagerType (defined in DataManager.h) has to be implemented. This should return the name of the data manager, which is usually its class name. This name has to be unique; so if the engine is templated, the template parameter has to be part of the data manager name.
The engine has to be registered before it can be used by the table system. This means that a special makeObject function has to be made known to the table system, which allows the table system to reconstruct the engine using its name.
An example of a virtual column engine can be found in dVirtColEng.{h,cc} in the test directory of the Tables module. Another exanple is class ScaledArray.
Assignment cannot be used for this base class. The private declaration of this operator makes it unusable.
The data manager is not a storage manager?
Flush the data in the engine object. If the object contains persistent data, this is the place to write them. This can be done in two ways:
Resync the storage manager with the new file contents. This is done by clearing the cache. The default implementation does nothing.
Initialize the object for a new table containing initially nrrow rows. It can be used to initialize variables (possibly using data from other columns in the table). The default implementation does nothing.
Initialize the object for an existing table containing nrrow rows. It can be used to read values back (written by close) and/or to initialize variables (possibly using data from other columns in the table). The default implementation does nothing.
Let the data manager initialize itself further. Prepare is called after create/open has been called for all columns. In this way one can be sure that referenced columns are read back and partly initialized. The default implementation does nothing.
The data manager will be deleted (because all its columns are requested to be deleted). So clean up the things needed (e.g. delete files). By default it assumes that nothing has to be done.
Make a column object in the engine on behalf of a table column. This column object class is derived from VirtualScalarColumn or VirtualArrayColumn. It handles the gets and puts of data.
Create a scalar column. The default implementation throws an exception that it cannot do it for this column.
Make a column object in the engine on behalf of a table column. This column object class is derived from VirtualScalarColumn or VirtualArrayColumn. It handles the gets and puts of data.
Create a direct array column. The default implementation calls makeIndArrColumn (when reading the user sees no difference between direct and indirect).
Make a column object in the engine on behalf of a table column. This column object class is derived from VirtualScalarColumn or VirtualArrayColumn. It handles the gets and puts of data.
Create an indirect array column. The default implementation throws an exception that it cannot do it for this column.