Update Attribute.h
This commit is contained in:
parent
758d3e55cc
commit
d4e1e5bc04
1 changed files with 27 additions and 17 deletions
36
Attribute.h
36
Attribute.h
|
@ -5,33 +5,43 @@ using namespace std;
|
|||
|
||||
//Funtional, might need more functionality
|
||||
|
||||
template<typename T>
|
||||
//template<typename T>
|
||||
class Attribute {
|
||||
//a named column of a relation
|
||||
string name;
|
||||
vector<T> values;
|
||||
|
||||
bool isKey;
|
||||
int size;
|
||||
|
||||
public:
|
||||
Attribute(){ }
|
||||
|
||||
Attribute(vector<T> v){
|
||||
this.values = v;
|
||||
}
|
||||
vector<string> values;
|
||||
|
||||
Attribute(const Attribute<T>& a){
|
||||
this.values = a.getAll();
|
||||
}
|
||||
void initializeAttribute(string n, vector<string> a){
|
||||
|
||||
Attribute& operator=(const Attribute<T>& a){
|
||||
this.values = a.getAll();
|
||||
name = n;
|
||||
values = a;
|
||||
}
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
|
||||
vector<T> getAll(){
|
||||
return this.values;
|
||||
Attribute(){ }
|
||||
|
||||
void display()
|
||||
{
|
||||
cout<<"Atribute name:\t"<<name<<"\n";
|
||||
cout<<"Elements: ";
|
||||
for (int i = 0; i < values.size(); ++i)
|
||||
{
|
||||
cout<<values[i]<<" ";
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
vector<string> getElements(){
|
||||
return values;
|
||||
}
|
||||
*/
|
||||
};
|
Reference in a new issue