StManKarma.h

Classes

StManColumnKarma -- Karma table column storage manager class (full description)
StManKarma -- Karma table storage manager class (full description)

class StManColumnKarma : public StManColumn

Interface

Public Members
StManColumnKarma (StManKarma*, const String& name, int dataType)
~StManColumnKarma()
virtual void doCreate (uInt& nrsca, unsigned int& scaType, char*& scaDesc, uInt& nrarr, unsigned int& arrType, char*& arrDesc)
unsigned int convertDataType (int dataType) const
void get (uInt rownr, Bool* dataPtr)
void get (uInt rownr, uChar* dataPtr)
void get (uInt rownr, Int* dataPtr)
void get (uInt rownr, uInt* dataPtr)
void get (uInt rownr, float* dataPtr)
void get (uInt rownr, double* dataPtr)
void get (uInt rownr, Complex* dataPtr)
void get (uInt rownr, DComplex* dataPtr)
void get (uInt rownr, String* dataPtr)
void put (uInt rownr, const Bool* dataPtr)
void put (uInt rownr, const uChar* dataPtr)
void put (uInt rownr, const Int* dataPtr)
void put (uInt rownr, const uInt* dataPtr)
void put (uInt rownr, const float* dataPtr)
void put (uInt rownr, const double* dataPtr)
void put (uInt rownr, const Complex* dataPtr)
void put (uInt rownr, const DComplex* dataPtr)
void put (uInt rownr, const String* dataPtr)
uInt getBlock (uInt rownr, uInt nrmax, Bool* dataPtr)
uInt getBlock (uInt rownr, uInt nrmax, uChar* dataPtr)
uInt getBlock (uInt rownr, uInt nrmax, Int* dataPtr)
uInt getBlock (uInt rownr, uInt nrmax, uInt* dataPtr)
uInt getBlock (uInt rownr, uInt nrmax, float* dataPtr)
uInt getBlock (uInt rownr, uInt nrmax, double* dataPtr)
uInt getBlock (uInt rownr, uInt nrmax, Complex* dataPtr)
uInt getBlock (uInt rownr, uInt nrmax, DComplex* dataPtr)
uInt getBlock (uInt rownr, uInt nrmax, String* dataPtr)
uInt putBlock (uInt rownr, uInt nrmax, const Bool* dataPtr)
uInt putBlock (uInt rownr, uInt nrmax, const uChar* dataPtr)
uInt putBlock (uInt rownr, uInt nrmax, const Int* dataPtr)
uInt putBlock (uInt rownr, uInt nrmax, const uInt* dataPtr)
uInt putBlock (uInt rownr, uInt nrmax, const float* dataPtr)
uInt putBlock (uInt rownr, uInt nrmax, const double* dataPtr)
uInt putBlock (uInt rownr, uInt nrmax, const Complex* dataPtr)
uInt putBlock (uInt rownr, uInt nrmax, const DComplex* dataPtr)
uInt putBlock (uInt rownr, uInt nrmax, const String* dataPtr)
virtual Bool ok() const
Protected Members
void fillElem (unsigned int& elemType, char*& elemDesc)
Private Members
StManColumnKarma (const StManColumnKarma&)
StManColumnKarma& operator= (const StManColumnKarma&)
const void* getDataPtr (uInt rownr)
void putDataPtr (uInt rownr, const void* dataPtr)

Description

Prerequisite

Etymology

StManColumnKarma handles a column for a Karma storage manager.

Synopsis

StManColumnKarma is used by StManKarma to handle the access to the scalar data in a table column. It is an storage manager based on Karma. It uses the Karma storage package to handle the data. It supports all standard data types except String. Addition and removal of rows are not supported. The exact number of rows have to be allocated at table creation time.

The scalars are represented in Karma as a 1-D array of packets. A packet contains the scalar values for a particular row.

Motivation

StManColumnKarma handles the standard data types. The class is not templated, but a switch statement is used instead. Templates would cause too many instantiations.

To Do

Member Description

StManColumnKarma (StManKarma*, const String& name, int dataType)

Create a column of the given name and type. The name is used as the Karma name of the column. If the column gets renamed in the table, this name will NOT change.

~StManColumnKarma()

Frees up the storage.

virtual void doCreate (uInt& nrsca, unsigned int& scaType, char*& scaDesc, uInt& nrarr, unsigned int& arrType, char*& arrDesc)

Create the Karma description for this scalar column. Only the *sca* arguments are used and filled in.

unsigned int convertDataType (int dataType) const

Convert data type from Aips++ to Karma.

void get (uInt rownr, Bool* dataPtr)
void get (uInt rownr, uChar* dataPtr)
void get (uInt rownr, Int* dataPtr)
void get (uInt rownr, uInt* dataPtr)
void get (uInt rownr, float* dataPtr)
void get (uInt rownr, double* dataPtr)
void get (uInt rownr, Complex* dataPtr)
void get (uInt rownr, DComplex* dataPtr)
void get (uInt rownr, String* dataPtr)

Get a scalar value in the given row.

void put (uInt rownr, const Bool* dataPtr)
void put (uInt rownr, const uChar* dataPtr)
void put (uInt rownr, const Int* dataPtr)
void put (uInt rownr, const uInt* dataPtr)
void put (uInt rownr, const float* dataPtr)
void put (uInt rownr, const double* dataPtr)
void put (uInt rownr, const Complex* dataPtr)
void put (uInt rownr, const DComplex* dataPtr)
void put (uInt rownr, const String* dataPtr)

Put a scalar value into the given row.

uInt getBlock (uInt rownr, uInt nrmax, Bool* dataPtr)
uInt getBlock (uInt rownr, uInt nrmax, uChar* dataPtr)
uInt getBlock (uInt rownr, uInt nrmax, Int* dataPtr)
uInt getBlock (uInt rownr, uInt nrmax, uInt* dataPtr)
uInt getBlock (uInt rownr, uInt nrmax, float* dataPtr)
uInt getBlock (uInt rownr, uInt nrmax, double* dataPtr)
uInt getBlock (uInt rownr, uInt nrmax, Complex* dataPtr)
uInt getBlock (uInt rownr, uInt nrmax, DComplex* dataPtr)
uInt getBlock (uInt rownr, uInt nrmax, String* dataPtr)

Get values from the given row on with a maximum of nrmax values. This is used to get an entire column of scalars. The buffer pointed to by dataPtr has to have the correct length (which is guaranteed by the ScalarColumn getColumn function). This is not implemented yet.

uInt putBlock (uInt rownr, uInt nrmax, const Bool* dataPtr)
uInt putBlock (uInt rownr, uInt nrmax, const uChar* dataPtr)
uInt putBlock (uInt rownr, uInt nrmax, const Int* dataPtr)
uInt putBlock (uInt rownr, uInt nrmax, const uInt* dataPtr)
uInt putBlock (uInt rownr, uInt nrmax, const float* dataPtr)
uInt putBlock (uInt rownr, uInt nrmax, const double* dataPtr)
uInt putBlock (uInt rownr, uInt nrmax, const Complex* dataPtr)
uInt putBlock (uInt rownr, uInt nrmax, const DComplex* dataPtr)
uInt putBlock (uInt rownr, uInt nrmax, const String* dataPtr)

Put nrmax values from the given row on. This is used to put an entire column of scalars. The buffer pointed to by dataPtr has to have the correct length (which is guaranteed by the ScalarColumn putColumn function). This is not implemented yet.

virtual Bool ok() const

Check if the class invariants still hold.

void fillElem (unsigned int& elemType, char*& elemDesc)

Fill in Karma element type and descriptor.

StManColumnKarma (const StManColumnKarma&)

Forbid copy constructor.

StManColumnKarma& operator= (const StManColumnKarma&)

Forbid assignment.

const void* getDataPtr (uInt rownr)

Get a pointer to the scalar value in the given row. Karma knows its data type.

void putDataPtr (uInt rownr, const void* dataPtr)

Put the scalar value into the given row. Karma knows its data type.


class StManKarma : public StMan

Interface

Public Members
StManKarma (SetupNewTable&)
~StManKarma()
String id() const
String type() const
uInt nrow() const
DataStore dataStore()
const String& rowCoordName() const
StManColumn* createScalarColumn (const String& name, int dataType)
StManColumn* createDirArrColumn (const String& name, int dataType)
StManColumn* createIndArrColumn (const String& name, int dataType)
Private Members
void close()
void doCreate (uInt nrrow)
void open (uInt nrrow)

Description

Prerequisite

Etymology

StManKarma is the storage manager using Karma.

Synopsis

StManKarma is a table storage manager based on Karma. It uses the Karma storage package to read and write data in table columns. Currently this package is memory based, but in the (near?) future it will also support regular IO.

Only columns containing scalars or direct arrays are supported. All standard data types, except Strings, are supported. In Karma arrays are stored in C-order, while the AIPS++ arrays are in Fortran order. This means that the axes order is reversed. Indirect arrays may be supported in the further future. Addition and removal of rows and columns is not supported. The exact number of rows have to be allocated at table creation time.

The data of this storage manager is kept in one file. Its name is the table name appended with .N_Karma.kf, where N is the (unique) storage manager sequence number.

Motivation

To Do

Member Description

StManKarma (SetupNewTable&)

Create a storage manager for the given new table.

~StManKarma()

String id() const

Get the id of this class (i.e. StManKarma).

String type() const

Get the type of storage manager (i.e. Karma).

uInt nrow() const

Get the nr of rows in this storage manager .

DataStore dataStore()

Get the Karma data store.

const String& rowCoordName() const

Get the Karma row coordinate name.

StManColumn* createScalarColumn (const String& name, int dataType)

Create a column in the storage manager. This is not possible for data type TpString.

Create a scalar column.

StManColumn* createDirArrColumn (const String& name, int dataType)

Create a column in the storage manager. This is not possible for data type TpString.

Create a direct array column.

StManColumn* createIndArrColumn (const String& name, int dataType)

Create a column in the storage manager. This is not possible for data type TpString.

Create an indirect array column (not possible).

void close()

Flush the data and close the storage manager..

void doCreate (uInt nrrow)

Handle the creation of the storage manager for a new table. This creates the necessary Karma data structures.

void open (uInt nrrow)

Open the storage manager for an existing table.


Copyright © 1995 Associated Universities Inc., Washington, D.C.