Create Relation.h
This commit is contained in:
parent
2b1141bfe7
commit
c052e7cbf0
1 changed files with 45 additions and 0 deletions
45
Relation.h
Normal file
45
Relation.h
Normal file
|
@ -0,0 +1,45 @@
|
|||
#include <iostream>
|
||||
#include <vector>
|
||||
#include "Attribute.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
//NOT DONE
|
||||
class Relation {
|
||||
//a table with rows and columns
|
||||
string name; //the name of the relation (table)
|
||||
vector<Attribute> att;
|
||||
vector<string> attributeNames;
|
||||
|
||||
public:
|
||||
//Relation();
|
||||
|
||||
void initializeRelation(string n, vector<string> attNames, vector<Attribute> a)
|
||||
{
|
||||
attributeNames = attNames;
|
||||
name = n;
|
||||
att = a;
|
||||
}
|
||||
|
||||
void addTuple(vector< Attribute> tuple);
|
||||
|
||||
void display()
|
||||
{
|
||||
cout<<"\n\nDisplay of relation--------------------------------"<<endl;
|
||||
cout<<"Relation name: "<<name<<endl;
|
||||
for (int i = 0; i < attributeNames.size(); ++i)
|
||||
{
|
||||
|
||||
cout<<"\nAttribute name: "<<attributeNames[i]<<": ";
|
||||
|
||||
/*
|
||||
for (int i = 0; i < att[i].getSize(); ++i)
|
||||
{
|
||||
//cout<<" "<<att[i]<<" ";
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
};
|
Reference in a new issue