This repository has been archived on 2025-04-11. You can view files and clone it, but cannot push or open issues or pull requests.
dmspine64backup/Relation.cpp
2015-09-17 18:30:45 -05:00

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";
}