49 lines
917 B
C++
Executable file
49 lines
917 B
C++
Executable file
#include <iostream>
|
|
#include <vector>
|
|
#include "Attribute.h"
|
|
|
|
using namespace std;
|
|
|
|
//NOT DONE
|
|
class Relation {
|
|
string name; //The title the user gives it
|
|
vector<Attribute> att; //A vector of the columns
|
|
|
|
public:
|
|
Relation();
|
|
|
|
//constructor
|
|
Relation(string n, vector<Attribute> a) {
|
|
name = n;
|
|
att = a;
|
|
}
|
|
|
|
void addTuple(vector< string > tuple) {
|
|
//Loop through the attribute columns
|
|
for(int i = 0; i < att.size(); i++) {
|
|
|
|
//Loop through the elements in the i'th column
|
|
for(int j = 0; j < att[i].values.size(); j++){
|
|
|
|
//In this column, at this element's spot, assign an element from the tuple vector to this spot
|
|
att[i].addRow(tuple[i]);
|
|
}
|
|
}
|
|
}
|
|
|
|
string getTableName() {
|
|
return name;
|
|
}
|
|
|
|
void displayTableName() {
|
|
cout << "The table name is: " << name << endl;
|
|
}
|
|
|
|
vector< Attribute > getAttributes(){
|
|
return att;
|
|
}
|
|
|
|
int getSize() {
|
|
return att.size();
|
|
}
|
|
};
|