57 lines
748 B
C++
Executable file
57 lines
748 B
C++
Executable file
#include <iostream>
|
|
#include <vector>
|
|
|
|
using namespace std;
|
|
|
|
//Funtional, might need more functionality
|
|
|
|
//template<typename T>
|
|
class Attribute {
|
|
//a named column of a relation
|
|
string name;
|
|
string type;
|
|
bool key;
|
|
int size;
|
|
|
|
public:
|
|
vector<string> values;
|
|
|
|
Attribute(string n, string t, bool k){
|
|
name = n;
|
|
type = t;
|
|
key = k;
|
|
size = 0;
|
|
}
|
|
|
|
void addRow(string v) {
|
|
values.push_back(v);
|
|
}
|
|
|
|
string getName(){
|
|
return name;
|
|
}
|
|
|
|
string getType(){
|
|
return type;
|
|
}
|
|
|
|
bool isKey(){
|
|
return key;
|
|
}
|
|
|
|
void display()
|
|
{
|
|
cout<<"Attribute name:\t"<< name <<"\n";
|
|
cout<<"Elements: ";
|
|
|
|
for (int i = 0; i < values.size(); ++i)
|
|
{
|
|
cout<<values[i]<<" ";
|
|
}
|
|
}
|
|
|
|
int getSize()
|
|
{
|
|
return values.size();
|
|
}
|
|
};
|