DF_Label aRefLabel = theSO.GetLabel();
SALOMEDSImpl_AttributeReference* aReference;
if ((aReference=(SALOMEDSImpl_AttributeReference*)aRefLabel.FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) {
- for(int i = 0, len = myVariables.size(); i<len; i++) if(myVariables[i]->Label() == aRefLabel) return; //BugID: PAL6192
- myVariables.push_back(aReference);
+ myVariables[aRefLabel.Entry()]=aReference;
}
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
{
std::vector<SALOMEDSImpl_SObject> aSeq;
- for(int i = 0, len = myVariables.size(); i<len; i++)
- aSeq.push_back( SALOMEDSImpl_Study::SObject(myVariables[i]->Label()));
+ for (std::map< std::string , DF_Attribute* >::iterator iter = myVariables.begin(); iter != myVariables.end(); ++iter)
+ aSeq.push_back( SALOMEDSImpl_Study::SObject(iter->second->Label()));
return aSeq;
}
Backup();
DF_Label aRefLabel = theSO.GetLabel();
- std::vector<DF_Attribute*> va;
- for(int i = 0, len = myVariables.size(); i<len; i++) {
- DF_Label L = myVariables[i]->Label();
- if(myVariables[i]->Label() == aRefLabel) continue;
- va.push_back(myVariables[i]);
- }
-
- myVariables.clear();
- myVariables = va;
+ myVariables.erase(aRefLabel.Entry());
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
SALOMEDSImpl_AttributeTarget* REL = dynamic_cast<SALOMEDSImpl_AttributeTarget*>(With);
myRelation = REL->GetRelation();
myVariables.clear();
- for (int i = 0, len = REL->myVariables.size(); i<len; i++) {
- myVariables.push_back(REL->myVariables[i]);
+ for (std::map< std::string , DF_Attribute* >::iterator iter = REL->myVariables.begin(); iter != REL->myVariables.end(); ++iter){
+ myVariables[iter->first]=iter->second;
}
}
SALOMEDSImpl_AttributeTarget* REL = dynamic_cast<SALOMEDSImpl_AttributeTarget*>(into);
REL->SetRelation(myRelation);
REL->myVariables.clear();
- for (int i = 0, len = myVariables.size(); i<len; i++) {
- REL->myVariables.push_back(myVariables[i]);
+ for (std::map< std::string , DF_Attribute* >::iterator iter = myVariables.begin(); iter != myVariables.end(); ++iter){
+ REL->myVariables[iter->first]=iter->second;
}
}
#include <string>
#include "SALOMEDSImpl_GenericAttribute.hxx"
#include "SALOMEDSImpl_SObject.hxx"
+#include <map>
class SALOMEDSIMPL_EXPORT SALOMEDSImpl_AttributeTarget :
public SALOMEDSImpl_GenericAttribute
{
private:
std::string myRelation;
- std::vector<DF_Attribute*> myVariables;
+ std::map< std::string , DF_Attribute* > myVariables;
public:
static const std::string& GetID() ;
void Remove(const SALOMEDSImpl_SObject& theSO);
std::string GetRelation() { return myRelation; }
void SetRelation(const std::string& theRelation);
- std::vector<DF_Attribute*>& GetVariables() { return myVariables; }
+ std::map< std::string , DF_Attribute* >& GetVariables() { return myVariables; }
const std::string& ID() const;
void Restore(DF_Attribute* with) ;
DF_Attribute* NewEmpty() const;