From b24f5117f4ddfb071097405cbdb7ea16617d2be8 Mon Sep 17 00:00:00 2001 From: Brandon Jackson <1drummer@att.net> Date: Tue, 15 Sep 2015 20:17:52 -0500 Subject: [PATCH] Create Relation.h --- Relation.h | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 Relation.h diff --git a/Relation.h b/Relation.h new file mode 100644 index 0000000..c41db03 --- /dev/null +++ b/Relation.h @@ -0,0 +1,47 @@ +#include +#include +#include "Attribute.h" + +using namespace std; + +//NOT DONE +class Relation { + //a table with rows and columns + 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].values[j]).assign(tuple[i]); + } + } + } + + void displayTableName() { + cout << "The table name is: " << name << endl; + } + + vector< Attribute > getAttributes(){ + return att; + } + + int getSize() { + return att.size(); + } +};