#ifndef DB_H
#define DB_H

#include <QString>
#include "dbNode.h"
#include "dbTable.h"

//	---------
//  Max Nodes
//	---------

enum{
	MAXNODES = 900,
	MAXTABLES = 50,
	MAXROWS = 100,
};

//	----------------------------------------------------------------------------
//	db
//	----------------------------------------------------------------------------

class db
{
public:
	db();

public:
	int addRow(int type, void *pointer, const  char *name, const char *desc);
	int addRow(int type, void *pointer, const  char *name, const char *desc, int precision);
	int addRow(int type, void *pointer, const  char *name, const char *desc, const char **list);
	int addRow(int type, void *pointer, const  char *name, const char *desc, const char **list, int precision);
	int addTable(const char *name, int type, int columns, int delta, int message);
	int tableExists(int table);
	int tableRefresh(int table);
	int tableReceiveCount(int table);
	void newTableData(int table);
	int rowExists(int table,int row);
	int tableType(int table);
	const char *rowName(int table,int row);
	const char *tableName(int table);
	const char *dbToString(int table,int row,int col);
	int dbToInt(int table, int row, int col);
	float dbToFloat(int table, int row, int col);

public:
	dbNode *dbNodeS[MAXNODES];
	dbTable *dbTableS[MAXTABLES];
	int nodes;
	int tables;
};

#endif // DB_H
