#ifndef TABLE_METADATA_H
#define TABLE_METADATA_H

#include "global.h"
#include "Field.h"
#include "Link.h"
#include <vector>
using namespace std;

/**
* This class represents the metadata in a Table.  
* 
* TableMetaData consists of the description, 
* Fields collection, Link collection, 
*
*/
//Date created - 03 May 2002


class TableMetaData {

	public:
		/**
		* Default constructor.
		*/
		TableMetaData();
		//TableMetaData(Field field[], int numOfFields, Link link[], 
		//			  int numOfLinks, char *desc);

		/**
		* Destructor
		*/
		~TableMetaData();

		/**
		* Assignment operator overloaded.
		*/
		TableMetaData operator=(const TableMetaData &t);

		/**
		* Copy Constructor.
		*/
		TableMetaData(const TableMetaData &t);

		int setDesciption(char *desc, int *status);
		int setFields(vector<Field> f, int *status);
		int setLinks(vector<Link> l, int *status);

		/**
		* Gets total number of Columns i.e. <FIELD> elements
		* in this table.
		*/
		int getNumOfColumns(int  &ncols, int *status);

		/**
		* Gets total number of Links.
		*/
		int getNumOfLinks(int  &nLinks, int *status);

		/**
		* Gets Field, given the index.
		* Index starts at 0.
		*/
		int getField(Field &field, int fieldNum, int *status);

		/**
		* Gets Link, given the index.
		* Index starts at 0.
		*/
		int getLink(Link &link, int linkNum, int *status);

		/**
		* Gets the description of the Table.
		*/
		int getDescription(char *&desc, int *status);		
	
	private: 
		char * description;
		vector<Field> fieldList;
		vector<Link> linkList;

		void makecopy(const TableMetaData &t);
		void cleanup();
		void init(void);

};

#endif