/////////////////////////////////////////////////////////////////////////////
// Name:        sqltable.h
// Author:      Stefan Liersch
// Contact:		stefan.liersch@ufz.de stefan.liersch@googlemail.com
// Created:     2007-02-05
/////////////////////////////////////////////////////////////////////////////

#ifndef HEADER_INCLUDED__sqltable_H
#define HEADER_INCLUDED__sqltable_H
///////////////////////////////////////////////////////////////////////
// ToDO
//---------------------------------------------------------------------
// - GetValue functions should return not only string values, but
//   data type corresponding to the field type
//---------------------------------------------------------------------

//---------------------------------------------------------
#include <iostream>
#include <string>
#include <vector>
using std::vector;
using std::string;
using std::cout;
using std::endl;

typedef vector<string> vector_str;
typedef vector<int> vector_int;
typedef vector< vector<string> > array;

#include "saga_api/convert_sl.h"
//using namespace convert_sl;

//---------------------------------------------------------

class Csqltable
{
	friend class CSimpleFeature;

public:
	Csqltable::Csqltable();

	Csqltable::Csqltable(string TableName);

	Csqltable::Csqltable(string TableName, bool loadFromDB);

	Csqltable::Csqltable(int ncols, int nrows);
	
	Csqltable::Csqltable(string TableName,
						 int ncols,
						 int nrows);

	Csqltable::~Csqltable(void);

	//-------------------------------------------
	// GET FUNCTIONS
	//-------------------------------------------
	string			GetTableName();
	const char*		Get_TableName() { return(mTableName.c_str()); }
	int				Get_ncols();
	int				Get_nrows();
	string			GetFieldName(int index);
	string			GetFieldType(int index);
	int				GetFieldTypeInt(int index);
	string			GetConstraints(int index);
	string			GetValue(int col, int row);
	//array			GetMatrix();
	//-------------------------------------------
	// SET FUNCTIONS
	//-------------------------------------------
	void			SetTableName(string name);
	void			Set_ncols(int n);
	void			Set_nrows(int n);
	void			SetFieldName(string name, int n);
	void			SetFieldType(string type, int n);
	void			SetFieldTypeInt(int type, int n);
	void			SetConstraints(string constraint, int n);
	void			SetValue(int value, int col, int row);
	void			SetValue(float value, int col, int row);
	void			SetValue(double value, int col, int row);
	void			SetValue(string value, int col, int row);

	void			resize_fields(int ncols, int nrows);
protected:
	// Table Attributes
	string			mTableName;
	int				ncols;
	int				nrows;
	vector_str		fieldname;
	vector_str		fieldtype;
	vector_int		fieldtypeInt;
	vector_str		constraints;
	array			matrix;

	//void			resize_fields(int ncols, int nrows);

	//CTypeConversion	convert;

private:


};

#endif /* #ifndef HEADER_INCLUDED__sqltable */