//The macro adds all necessary checks for standardly behaiving attributes
__FindOrCreateAttributeForBuilder
-
+
+
//Add checks for TreeNode and UserID attributes
if (strncmp(aTypeOfAttribute.ToCString(), "AttributeTreeNode",17) == 0 ) {
+
Standard_GUID aTreeNodeGUID;
if (strcmp(aTypeOfAttribute.ToCString(), "AttributeTreeNode") == 0) {
aTreeNodeGUID = SALOMEDSImpl_AttributeTreeNode::GetDefaultTreeID();
} else {
- char* aGUIDString = new char[40];
+ char* aGUIDString = new char[41];
char* aType = (char*)aTypeOfAttribute.ToCString();
sprintf(aGUIDString, &(aType[17]));
if(!Standard_GUID::CheckGUIDFormat(aGUIDString)) {
if (strcmp(aTypeOfAttribute.ToCString(), "AttributeUserID") == 0) {
aUserGUID = SALOMEDSImpl_AttributeUserID::DefaultID();
} else {
- char* aGUIDString = new char[40];
+ char* aGUIDString = new char[41];
char* aType = (char*)aTypeOfAttribute.ToCString();
sprintf(aGUIDString, &(aType[15]));
if(!Standard_GUID::CheckGUIDFormat(aGUIDString)) {
Handle(TDF_Attribute) anAttr;
- char* current_string = new char[hdf_dataset->GetSize()];
+ char* current_string = new char[hdf_dataset->GetSize()+1];
hdf_dataset->ReadFromDisk(current_string);
-
+
if (!strcmp(hdf_dataset->GetName(),"COMPONENTDATATYPE")) {
anAttr = theStudy->NewBuilder()->FindOrCreateAttribute(aSO, "AttributeComment");
} else if (!strcmp(hdf_dataset->GetName(),"AttributeReference") ||
} else {
anAttr = theStudy->NewBuilder()->FindOrCreateAttribute(aSO, hdf_dataset->GetName());
}
-
+
if (!anAttr.IsNull()) {
Handle(SALOMEDSImpl_GenericAttribute) ga = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(anAttr);
ga->Load(current_string);
//cout << "Reading: " << aSO->GetID() << " "<< ga->Type() << " value: " << current_string << endl;
}
-
+
delete(current_string);
hdf_dataset->CloseOnDisk();
}