/////////////////////////////////////////////////////
//
//  PINCLASS.H
//  Pinacle File Manager Class
////////////////////////////////////////////////////

#ifndef PINCLASS_H
#define PINCLASS_H

extern "C" {
#include <pinnacle.h>
}
#include "string.h"
#include "listclas.h"

class Pfm_List: public D_List  {
protected:
    DB db;
    DBTAB table;
    DBCOL default_key;
    DBSEARCH default_dbsearch;
    Boolean is_at_top, // Flags
            is_at_bottom,
            needs_closed;
    char *buffer;
    size_t max_buffer_size;
public:
// Constructors and Destructors
        Pfm_List(char *database, char *table_name,
                 size_t mbs = 1024);
        Pfm_List(DB &open_db, char *table_name,
                  size_t mbs = 1024);
        Pfm_List(DB &open_db, DBTAB &db_table,
                 size_t mbs = 1024);
    virtual ~Pfm_List();

// Database Specific Methods
    DB DBHandle() {return db;}
    DBTAB TableHandle() {return table;}


//  List Status
        virtual Boolean at_top()
        { return( is_at_top); }
        virtual Boolean at_end()
        { return( is_at_bottom); }
    long virtual tell();

//  List Navigation
        virtual Boolean find(void *key),
        find(void *key, char *relation),
        find(char *col, char *relation, void *key);
    virtual void prev(), next(), top(), end();
    virtual Boolean findnext(), findprev();

//  Interface to and from List
    virtual void add();
        virtual void replace(char *field,
                             char *value);
        virtual void replace(char *field,
                              long value);
        virtual void replace(char *field,
                            double value);
//  virtual void replace(char *field, void *value);
        virtual void replace(void *member){ };
        // Not truly defined.
    virtual void remove();
        virtual void *current()
        {return (void *)buffer; }
        long virtual total()
        { return ((long) DB_CountRows(table));}
    virtual char *get(char *field, char *value);
    virtual long get(char *field, long &value);
    virtual double get(char *field, double &value);
    virtual void *get(char *field, void *value);
    
};
#endif
