44 lines
768 B
C++
Executable file
44 lines
768 B
C++
Executable file
#include <iostream>
|
|
#include <vector>
|
|
#include "Relation.h"
|
|
|
|
Relation::Relation(string n){
|
|
name = n;
|
|
size = 0;
|
|
}
|
|
|
|
Relation::Relation(string n, vector<Attribute> a){
|
|
name = n;
|
|
att = a;
|
|
size = a.size();
|
|
}
|
|
|
|
string Relation::getTableName(){
|
|
return name;
|
|
}
|
|
|
|
vector<Attribute> Relation::getAttributes(){
|
|
return att;
|
|
}
|
|
|
|
vector<string> Relation::getAttributeNames(){
|
|
vector<string> temp;
|
|
for(int i = 0; i < size; ++i){
|
|
temp.push_back(att[i].getName());
|
|
}
|
|
return temp;
|
|
}
|
|
|
|
int Relation::getSize(){
|
|
return size;
|
|
}
|
|
|
|
void Relation::display(){
|
|
cout << "--------------------------\n";
|
|
cout << name << "\n";
|
|
for (int i = 0; i < att.size(); ++i){
|
|
att[i].display();
|
|
}
|
|
|
|
cout << "--------------------------\n";
|
|
}
|