I have very limited time and resources and no margin for error. I want to devise this kind of class for many many objects. please kindly review and comment.
class IMaterial
{
private:
TDF_Label root;
Handle(TDataStd_RealArray) attrib;
public:
IMaterial(const TDF_Label& label): root(label)
{
TDataStd_Name::Set(root, "Material");
attrib = TDataStd_RealArray::Set(root, 0, 3);
}
void Set(double E, double nu, double a, double r)
{
attrib->SetValue(0, E);
attrib->SetValue(1, nu);
attrib->SetValue(2, a);
attrib->SetValue(3, r);
}
double E(){attrib->Value(0);}
double Nu(){attrib->Value(1);}
double A(){attrib->Value(2);}
double Rho(){attrib->Value(3);}
};
It would be much nice to hide the passing of the label to each object. might be possible with factory pattern ? ?
class IMaterial
{
private:
TDF_Label root;
Handle(TDataStd_RealArray) attrib;
public:
IMaterial(const TDF_Label& label): root(label)
{
TDataStd_Name::Set(root, "Material");
attrib = TDataStd_RealArray::Set(root, 0, 3);
}
void Set(double E, double nu, double a, double r)
{
attrib->SetValue(0, E);
attrib->SetValue(1, nu);
attrib->SetValue(2, a);
attrib->SetValue(3, r);
}
double E(){attrib->Value(0);}
double Nu(){attrib->Value(1);}
double A(){attrib->Value(2);}
double Rho(){attrib->Value(3);}
};
It would be much nice to hide the passing of the label to each object. might be possible with factory pattern ? ?