class AudDB

Read and write generic audio databases.

Inheritance:

AudDB


Public Methods

void add(Catalog &ct)
AudDB(void)
AudDB(char *name)
virtual void open(void)
virtual bool read(Catalog& ct)
void setName(char *name)
virtual ~AudDB(void)

Protected Fields

char* db_name
int len_magic
unsigned long* magiclist

Protected Methods

int find(Catalog& ct)
virtual bool read_i(Catalog& ct, int idx)
virtual bool readEntry(ifstream& instr, Catalog& ct)
virtual void write(Catalog& ct, int& oldlen)
virtual bool writeEntry(ofstream& outstr, Catalog& ct)

Documentation

AudDB is a base class for creating databases of Catalog objects.

AudDB(void)
Constructor for the AudDB object. Sets all poiners and counters to 0.

AudDB(char *name)
Overloaded Constructor. Difference: \ref{db_name} is set to a duplicate of the argument name.

virtual ~AudDB(void)
Destructor for the AudDB object.

void setName(char *name)
Sets db_name to a copy of name.

void add(Catalog &ct)
Adds the catalog ct to the database, overwriting any existing entry for ct.

virtual void open(void)
Abstract function for opening the database.

virtual bool read(Catalog& ct)
[virtual]

Reads a catalog entry, ct. Performs a find(), then calls its overloaded version using the index from the find(). Returns false if it can't find ct in the database.

char* db_name
A string containing the filename of the database. If it is a null string, the member methods all return an error.

unsigned long* magiclist
List of magic numbers. Should be set up by open().

int len_magic
Number of elements in magiclist. Also number of entries in the database.

int find(Catalog& ct)
Searches for the catalog ct in the database.
Returns:
a location index or, -1 if ct is not in the database.

virtual void write(Catalog& ct, int& oldlen)
Abstract function to write a catalog entry, ct, to the database. It should update magiclist and set oldlen to the new value of len_magic.

virtual bool read_i(Catalog& ct, int idx)
Abstract function. Searches for the idxth entry in the database. Returns false if idx is out of range, if that entry doesn't exist, or if there is a read error.

virtual bool readEntry(ifstream& instr, Catalog& ct)
Abstract function to read a single entry, ct, from the open stream instr. Returns true on success.

virtual bool writeEntry(ofstream& outstr, Catalog& ct)
Abstract function to write a single entry, ct, to the open stream outstr. Returns true on success.


Direct child classes:
WorkManDB
TiKanDB
See Also:
Catalog

alphabetic index hierarchy of classes


Copyright 1997 by John Weiss [John.Weiss@colorado.edu] "generated by doc++"?! More like mangled ...

generated by doc++