
DataStor(UI)         Cube Reference Manual         DataStor(UI)

NAME
     DataStore - base class  for  a  common  interface  for  disk
     object or memory objects

SYNOPSIS
     #include <Cube/datastore.h>

DESCRIPTION
     A DataStore provide a common protocol to get  and  put  data
     either from or to memory or disk.

PUBLIC OPERATIONS
     DataStore()
          Construct an uninitialized dataStore.

     DataStore(unsigned long len)
          Construct a DataStore with a certain length.

     virtual ~DataStore()
          Delete the data if a MemDataStore, Close and remove the
          file if a DiskDataStore.

     unsigned long Length()
          Return the length of the dataStore.

     virtual void SetLength( unsigned long len )
          Set the length. This will open  the  file  or  allocate
          memory  depending  on  the type of data store. If some-
          thing already exists it will be copied in the beginning
          of the new storage.

     virtual void* Get( unsigned long offs, unsigned long num )
          Get a copy of the data from offset offs, of length num.

     virtual void Put(void* dat,unsigned long offs,
                      unsigned long num)
          Put the data at the offset offs on  a  length  of  num.
          MemDataStore does a copy into the internal buffer.

     virtual void ReadFromFile(FILE* f,unsigned long offs,
                               unsigned long num)
     virtual void WriteToFile( FILE* f, unsigned long offs,
                               unsigned long num )
          Read or Write data from the given file descriptor . The
          data are read and put into the storage. Or the data are
          retrieved from storage and written.

     virtual void CopyData( DataStore * from, unsigned long fromoffs,
     unsigned long tooffs, unsigned long num)
          Copy a portion of the data from another dataStore.

     virtual void Zero()

DataStor(UI)         Cube Reference Manual         DataStor(UI)

          Initialize all the data to zero.

     virtual void* Data()
          Get the data. DiskDataStore returns nil.

     virtual void SetData(void*)
          Set the Data. DiskDataStore copies this  data  to  disk
          and then deletes the data.

DERIVED CLASS
     MemDataStore()
     MemDataStore( unsigned long len )

     MemDataStore( DataStore* )
          Construct a Memory data store. If the length  is  given
          the  memory  is  allocated. If a DataStore is given the
          data are copied from the input data store.

     DiskDataStore()
     DiskDataStore( unsigned long len )

     DiskDataStore( DataStore* )
          Construct a Disk data store. If a length is  given  the
          file  is open and seek to this position to really allo-
          cate the disk space. If a DataStore is given  the  data
          are copied from the input data store.

SEE ALSO
     InterViews, intro

