SALOMEDSImpl_Study.hxx \
SALOMEDSImpl_StudyManager.hxx \
SALOMEDSImpl_OCAFApplication.hxx \
- SALOMEDSImpl_DataMapStringLabel.hxx \
- SALOMEDSImpl_DataMapOfIntegerString.hxx \
SALOMEDSImpl_ChildNodeIterator.hxx \
- Handle_SALOMEDSImpl_DataMapNodeOfDataMapStringLabel.hxx \
- Handle_SALOMEDSImpl_DataMapNodeOfDataMapOfIntegerString.hxx
LIB_CLIENT_IDL =
LIB_SERVER_IDL =
SALOMEDSImpl_AttributeComment.cxx \
SALOMEDSImpl_AttributeReference.cxx \
SALOMEDSImpl_ChildNodeIterator.cxx \
- SALOMEDSImpl_DataMapOfIntegerString_0.cxx \
- SALOMEDSImpl_DataMapIteratorOfDataMapOfIntegerString_0.cxx \
- SALOMEDSImpl_DataMapNodeOfDataMapOfIntegerString_0.cxx \
- SALOMEDSImpl_DataMapIteratorOfDataMapStringLabel_0.cxx \
- SALOMEDSImpl_DataMapNodeOfDataMapStringLabel_0.cxx \
- SALOMEDSImpl_DataMapStringLabel_0.cxx \
SALOMEDSImpl_UseCaseBuilder.cxx \
SALOMEDSImpl_UseCaseIterator.cxx \
SALOMEDSImpl_SComponentIterator.cxx \
using namespace std;
#include <SALOMEDSImpl_AttributeTableOfString.hxx>
#include <Standard_Failure.hxx>
-#include <SALOMEDSImpl_DataMapIteratorOfDataMapOfIntegerString.hxx>
#include <Standard_GUID.hxx>
#include <stdio.h>
#include <TColStd_HSequenceOfExtendedString.hxx>
IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeTableOfString, SALOMEDSImpl_GenericAttribute )
IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeTableOfString, SALOMEDSImpl_GenericAttribute )
+typedef NCollection_DataMap<Standard_Integer, TCollection_ExtendedString>::Iterator DataMapIterator;
+
const Standard_GUID& SALOMEDSImpl_AttributeTableOfString::GetID()
{
static Standard_GUID SALOMEDSImpl_AttributeTableOfStringID ("128371A4-8F52-11d6-A8A3-0001021E8C7F");
CheckLocked();
Backup();
- SALOMEDSImpl_DataMapOfIntegerString aMap;
+ DataMapOfIntegerString aMap;
aMap = myTable;
myTable.Clear();
- SALOMEDSImpl_DataMapIteratorOfDataMapOfIntegerString anIterator(aMap);
+ DataMapIterator anIterator(aMap);
for(; anIterator.More(); anIterator.Next()) {
int aRow = (int)(anIterator.Key()/myNbColumns) + 1;
int aCol = (int)(anIterator.Key() - myNbColumns*(aRow-1));
//Store the table values
l = myTable.Extent();
theStream << l << "\n";
- SALOMEDSImpl_DataMapIteratorOfDataMapOfIntegerString anIterator(myTable);
+ DataMapIterator anIterator(myTable);
for(; anIterator.More(); anIterator.Next()) {
if (anIterator.Value().Length()) { // check empty string in the value table
theStream << anIterator.Key() << "\n";
#include <TColStd_SequenceOfTransient.hxx>
#include <TCollection_ExtendedString.hxx>
#include <TColStd_HSequenceOfExtendedString.hxx>
-#include <SALOMEDSImpl_DataMapOfIntegerString.hxx>
+#include <NCollection_DataMap.hxx>
#include <TColStd_HSequenceOfInteger.hxx>
#include <TCollection_AsciiString.hxx>
#include <strstream>
+typedef NCollection_DataMap <Standard_Integer, TCollection_ExtendedString> DataMapOfIntegerString;
+
class SALOMEDSImpl_AttributeTableOfString : public SALOMEDSImpl_GenericAttribute
{
private:
-SALOMEDSImpl_DataMapOfIntegerString myTable;
+DataMapOfIntegerString myTable;
TCollection_ExtendedString myTitle;
Handle_TColStd_HSequenceOfExtendedString myRows;
Handle_TColStd_HSequenceOfExtendedString myCols;
*/
//============================================================================
SALOMEDSImpl_SComponent::~SALOMEDSImpl_SComponent()
-{
-}
+{}
//============================================================================
using namespace std;
#include "SALOMEDSImpl_SComponentIterator.hxx"
-
+#include "SALOMEDSImpl_Study.hxx"
//============================================================================
/*! Function : constructor
//============================================================================
Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_SComponentIterator::Value()
{
- return new SALOMEDSImpl_SComponent (_it.Value());
+ return SALOMEDSImpl_Study::GetStudy(_it.Value())->GetSComponent (_it.Value());
}
_type = "";
_name = "";
}
-
+
+//============================================================================
+/*! Function : Desctructor
+ * Purpose :
+ */
+//============================================================================
+SALOMEDSImpl_SObject::~SALOMEDSImpl_SObject()
+{}
+
//============================================================================
/*! Function : GetID
* Purpose :
if(LF.IsRoot()) return NULL;
- return new SALOMEDSImpl_SComponent(LF);
+ return GetStudy()->GetSComponent(LF);
}
//============================================================================
//============================================================================
Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_SObject::GetFather()
{
- return new SALOMEDSImpl_SObject(_lab.Father());
+ return GetStudy()->GetSObject(_lab.Father());
}
if (!_lab.FindAttribute(SALOMEDSImpl_AttributeReference::GetID(),Ref))
return false;
- theObject = new SALOMEDSImpl_SObject(Ref->Get());
+ theObject = GetStudy()->GetSObject(Ref->Get());
return true;
}
TDF_Label L = _lab.FindChild(theTag, false);
if (L.IsNull()) return false;
- theObject = new SALOMEDSImpl_SObject(L);
+ theObject = GetStudy()->GetSObject(L);
return true;
}
public:
SALOMEDSImpl_SObject(const TDF_Label& theLabel);
- ~SALOMEDSImpl_SObject() {};
+ ~SALOMEDSImpl_SObject();
virtual TCollection_AsciiString GetID();
virtual Handle(SALOMEDSImpl_SComponent) GetFatherComponent();
#include <CDM_Application.hxx>
#include <TDF_ChildIDIterator.hxx>
-#include "SALOMEDSImpl_DataMapIteratorOfDataMapStringLabel.hxx"
#include "SALOMEDSImpl_ChildNodeIterator.hxx"
#include "SALOMEDSImpl_Attributes.hxx"
#include "SALOMEDSImpl_UseCaseIterator.hxx"
_errorCode = "No label was found by ID";
return NULL;
}
- return new SALOMEDSImpl_SObject(Lab);
+ return GetSObject(Lab);
}
_errorCode = "Can not create a label";
return NULL;
}
- return new SALOMEDSImpl_SObject(Lab);
+ return GetSObject(Lab);
}
TDF_ChildIterator it = NewChildIterator(compo);
for ( ; it.More();it.Next() ) {
- Handle(SALOMEDSImpl_SObject) CSO = new SALOMEDSImpl_SObject(it.Value());
+ Handle(SALOMEDSImpl_SObject) CSO = GetSObject(it.Value());
if ( CSO->GetName() == anObjectName ) {
/* add to list */
listSO->Append(CSO) ;
// firstly searching in the datamap for optimization
if (myIORLabels.IsBound(anObjectIOR)) {
- Handle(SALOMEDSImpl_SObject) aResult = new SALOMEDSImpl_SObject(myIORLabels.Find(anObjectIOR));
+ Handle(SALOMEDSImpl_SObject) aResult = GetSObject(myIORLabels.Find(anObjectIOR));
// 11 oct 2002: forbidden attributes must be checked here
if (!aResult->GetLabel().IsAttribute(SALOMEDSImpl_AttributeIOR::GetID())) {
myIORLabels.UnBind(anObjectIOR);
bool isRelative = false;
if(aLength == 0) { //Empty path - return the current context
- return new SALOMEDSImpl_SObject (_current);
+ return GetSObject(_current);
}
if(aPath.Value(1) != '/') //Relative path
}
else {
if(aPath.Length() == 1 && aPath.Value(1) == '/') { //Root
- return new SALOMEDSImpl_SObject (_doc->Main());
+ return GetSObject(_doc->Main());
}
anIterator.Initialize(_doc->Main(), Standard_False);
}
if(anAttr->Get() == aToken) {
aToken = aPath.Token("/", i+1); //Check if it was the last part of the path
if(aToken.Length() == 0) { //The searched label is found (no part of the path is left)
- return new SALOMEDSImpl_SObject (aLabel);
+ return GetSObject(aLabel);
}
anIterator.Initialize(aLabel, Standard_False);
_errorCode = "InvaidContext";
return "";
}
- Handle(SALOMEDSImpl_SObject) so = new SALOMEDSImpl_SObject (_current);
+ Handle(SALOMEDSImpl_SObject) so = GetSObject(_current);
return GetObjectPath(so);
}
TCollection_AsciiString Val(anAttr->Get());
if (Val == theObjectName)
{
- RefSO = new SALOMEDSImpl_SObject(it.Value());
+ RefSO = GetSObject(it.Value());
_find = true;
}
}
- if (!_find) RefSO = _FindObject(new SALOMEDSImpl_SObject(it.Value()), theObjectName, _find);
+ if (!_find) RefSO = _FindObject(GetSObject(it.Value()), theObjectName, _find);
}
}
return RefSO;
TCollection_AsciiString Val(anAttr->Value());
if (Val == theObjectIOR)
{
- RefSO = new SALOMEDSImpl_SObject(it.Value());
+ RefSO = GetSObject(it.Value());
_find = true;
}
}
- aSO = new SALOMEDSImpl_SObject(it.Value());
+ aSO = GetSObject(it.Value());
if (!_find) RefSO = _FindObjectIOR(aSO, theObjectIOR, _find);
}
}
aTarget->Get(aLabelList);
TDF_ListIteratorOfLabelList anIter(aLabelList);
for(; anIter.More();anIter.Next()) {
- aSeq->Append(new SALOMEDSImpl_SObject(anIter.Value()));
+ aSeq->Append(GetSObject(anIter.Value()));
}
return aSeq;
}
Handle(TDocStd_Application) anApp = Handle(TDocStd_Application)::DownCast(_doc->Application());
if(!anApp.IsNull()) anApp->Close(_doc);
_doc.Nullify();
+ _mapOfSO.Clear();
+ _mapOfSCO.Clear();
}
//============================================================================
//============================================================================
Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::GetSComponent(const TCollection_AsciiString& theEntry)
{
- TDF_Label aLabel;
- TDF_Tool::Label(_doc->GetData(), theEntry, aLabel);
- return new SALOMEDSImpl_SComponent(aLabel);
+ Handle(SALOMEDSImpl_SComponent) aSCO;
+ if(_mapOfSCO.IsBound(theEntry))
+ aSCO = Handle(SALOMEDSImpl_SComponent)::DownCast(_mapOfSCO.Find(theEntry));
+ else {
+ TDF_Label aLabel;
+ TDF_Tool::Label(_doc->GetData(), theEntry, aLabel);
+ aSCO = new SALOMEDSImpl_SComponent(aLabel);
+ _mapOfSCO.Bind(theEntry, aSCO);
+ }
+
+ return aSCO;
+}
+
+//============================================================================
+/*! Function : GetSComponent
+ * Purpose :
+ */
+//============================================================================
+Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::GetSComponent(const TDF_Label& theLabel)
+{
+ TCollection_AsciiString anEntry;
+ TDF_Tool::Entry(theLabel, anEntry);
+ return GetSComponent(anEntry);
}
//============================================================================
//============================================================================
Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::GetSObject(const TCollection_AsciiString& theEntry)
{
-
- TDF_Label aLabel;
- TDF_Tool::Label(_doc->GetData(), theEntry, aLabel);
- return new SALOMEDSImpl_SObject(aLabel);
+ Handle(SALOMEDSImpl_SObject) aSO;
+ if(_mapOfSO.IsBound(theEntry))
+ aSO = Handle(SALOMEDSImpl_SObject)::DownCast(_mapOfSO.Find(theEntry));
+ else {
+ TDF_Label aLabel;
+ TDF_Tool::Label(_doc->GetData(), theEntry, aLabel);
+ aSO = new SALOMEDSImpl_SObject(aLabel);
+ _mapOfSO.Bind(theEntry, aSO);
+ }
+
+ return aSO;
+}
+
+//============================================================================
+/*! Function : GetSObject
+ * Purpose :
+ */
+//============================================================================
+Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::GetSObject(const TDF_Label& theLabel)
+{
+ TCollection_AsciiString anEntry;
+ TDF_Tool::Entry(theLabel, anEntry);
+ return GetSObject(anEntry);
}
//============================================================================
Handle(TDF_Attribute) SALOMEDSImpl_Study::GetAttribute(const TCollection_AsciiString& theEntry,
const TCollection_AsciiString& theType)
{
- TDF_Label aLabel;
- TDF_Tool::Label(_doc->GetData(), theEntry, aLabel);
- Handle(SALOMEDSImpl_SObject) aSO = new SALOMEDSImpl_SObject(aLabel);
+ Handle(SALOMEDSImpl_SObject) aSO = GetSObject(theEntry);
Handle(TDF_Attribute) anAttr;
aSO->FindAttribute(anAttr, theType);
return anAttr;
#include <TColStd_SequenceOfAsciiString.hxx>
#include <TColStd_HSequenceOfAsciiString.hxx>
#include <TColStd_HSequenceOfTransient.hxx>
+#include <NCollection_DataMap.hxx>
//SALOMEDSImpl headers
#include "SALOMEDSImpl_SComponentIterator.hxx"
#include "SALOMEDSImpl_SObject.hxx"
#include "SALOMEDSImpl_StudyBuilder.hxx"
-#include "SALOMEDSImpl_DataMapStringLabel.hxx"
#include "SALOMEDSImpl_UseCaseBuilder.hxx"
#include "SALOMEDSImpl_AttributeStudyProperties.hxx"
#include "SALOMEDSImpl_AttributeIOR.hxx"
class SALOMEDSImpl_StudyManager;
class SALOMEDSImpl_GenericAttribute;
+typedef NCollection_DataMap <TCollection_AsciiString, Handle_Standard_Transient> DataMapOfAsciiStringTransient;
+typedef NCollection_DataMap <TCollection_AsciiString, TDF_Label> DataMapAsciiStringLabel;
+
class SALOMEDSImpl_Study : public MMgt_TShared
{
private:
Handle(SALOMEDSImpl_StudyBuilder) _builder;
Handle(SALOMEDSImpl_UseCaseBuilder) _useCaseBuilder;
+ DataMapOfAsciiStringTransient _mapOfSO;
+ DataMapOfAsciiStringTransient _mapOfSCO;
+
// data structures for postponed destroying of object functionality
TColStd_SequenceOfAsciiString myPostponedIORs; // ordered set of IORs
TColStd_SequenceOfInteger myNbPostponed; // number of IOR in the each transaction
int myNbUndos; // number of current Undos, made by user
- SALOMEDSImpl_DataMapStringLabel myIORLabels;
+ DataMapAsciiStringLabel myIORLabels;
Handle(SALOMEDSImpl_SObject) _FindObject(const Handle(SALOMEDSImpl_SObject)& SO,
virtual bool IsError() { return _errorCode != ""; }
virtual Handle(SALOMEDSImpl_SComponent) GetSComponent(const TCollection_AsciiString& theEntry);
+ virtual Handle(SALOMEDSImpl_SComponent) GetSComponent(const TDF_Label& theLabel);
virtual Handle(SALOMEDSImpl_SObject) GetSObject(const TCollection_AsciiString& theEntry);
+ virtual Handle(SALOMEDSImpl_SObject) GetSObject(const TDF_Label& theEntryLabel);
virtual Handle(TDF_Attribute) GetAttribute(const TCollection_AsciiString& theEntry,
const TCollection_AsciiString& theType);
SALOMEDSImpl_AttributeComment::Set(NL, DataType);
- Handle(SALOMEDSImpl_SComponent) so = new SALOMEDSImpl_SComponent (NL);
+ Handle(SALOMEDSImpl_SComponent) so = Handle(SALOMEDSImpl_Study)::DownCast(_study)->GetSComponent (NL);
if(!_callbackOnAdd.IsNull()) _callbackOnAdd->OnAddSObject(so);
imax++;
TDF_Label NewLab = Lab.FindChild(imax);
- Handle(SALOMEDSImpl_SObject) so = new SALOMEDSImpl_SObject(NewLab);
+ Handle(SALOMEDSImpl_SObject) so = Handle(SALOMEDSImpl_Study)::DownCast(_study)->GetSObject(NewLab);
if(!_callbackOnAdd.IsNull()) _callbackOnAdd->OnAddSObject(so);
return so;
//Create or find label
TDF_Label NewLab = Lab.FindChild(theTag, 1);
- Handle(SALOMEDSImpl_SObject) so = new SALOMEDSImpl_SObject (NewLab);
+ Handle(SALOMEDSImpl_SObject) so = Handle(SALOMEDSImpl_Study)::DownCast(_study)->GetSObject(NewLab);
if(!_callbackOnAdd.IsNull()) _callbackOnAdd->OnAddSObject(so);
if (anID->Value() == FILELOCALID) continue; //SRN: This attribute store a file name, skip it
TCollection_AsciiString persist_ref(Att->Get());
- Handle(SALOMEDSImpl_SObject) so = new SALOMEDSImpl_SObject(current);
+ Handle(SALOMEDSImpl_SObject) so = SALOMEDSImpl_Study::GetStudy(current)->GetSObject(current);
TCollection_AsciiString ior_string = driver->LocalPersistentIDToIOR(so,
persist_ref,
isMultiFile,
if (anEmpty) continue;
}
- Handle(SALOMEDSImpl_SObject) SO = new SALOMEDSImpl_SObject(itchild.Value());
+ Handle(SALOMEDSImpl_SObject) SO = SALOMEDSImpl_Study::GetStudy(itchild.Value())->GetSObject(itchild.Value());
char* scoid = (char*) SO->GetID().ToCString();
hdf_group_sobject = new HDFgroup(scoid, hdf_group_datatype);
SALOMEDSImpl_Driver* theEngine)
{
_errorCode = "";
-
Handle(SALOMEDSImpl_SComponent) aComponent = theObject->GetFatherComponent();
if (aComponent.IsNull()) return false;
if (aComponent->GetLabel() == theObject->GetLabel()) return false;
-
TCollection_AsciiString IOREngine;
if (!aComponent->ComponentIOR(IOREngine)) return false;
-
if (theEngine == NULL) return false;
return theEngine->CanCopy(theObject);
}
PasteLabel(aStudy, theEngine, anIterator.Value(), aStartLabel, aCStudyID, false);
}
- return new SALOMEDSImpl_SObject (aStartLabel);
+ return SALOMEDSImpl_Study::GetStudy(aStartLabel)->GetSObject(aStartLabel);
}
//#######################################################################################################
TCollection_AsciiString ior_string, persistent_string, curid;
for (; itchild.More(); itchild.Next()) {
- Handle(SALOMEDSImpl_SObject) current = new SALOMEDSImpl_SObject(itchild.Value());
+ Handle(SALOMEDSImpl_SObject) current = SALOMEDSImpl_Study::GetStudy(itchild.Value())->GetSObject(itchild.Value());
Handle(SALOMEDSImpl_AttributeIOR) IOR;
if (current->GetLabel().FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(), IOR)) {
ior_string = IOR->Value();
#include "SALOMEDSImpl_UseCaseBuilder.hxx"
#include "SALOMEDSImpl_SObject.hxx"
#include "SALOMEDSImpl_SComponent.hxx"
+#include "SALOMEDSImpl_Study.hxx"
#include "SALOMEDSImpl_Attributes.hxx"
#include <TDF_Label.hxx>
TDF_Label aCurrent = aRef->Get();
if(aCurrent.IsNull()) return NULL;
- return new SALOMEDSImpl_SObject(aCurrent);
+ return SALOMEDSImpl_Study::GetStudy(aCurrent)->GetSObject(aCurrent);
}
//============================================================================
aFatherNode->Append(aNode);
SALOMEDSImpl_AttributeName::Set(aChild, theName);
- return new SALOMEDSImpl_SObject(aChild);
+ return SALOMEDSImpl_Study::GetStudy(aChild)->GetSObject(aChild);
}
//============================================================================
{
TDF_Label aLabel;
TDF_Tool::Label(_doc->GetData(), theEntry, aLabel);
- return new SALOMEDSImpl_SObject(aLabel);
+ return SALOMEDSImpl_Study::GetStudy(aLabel)->GetSObject(aLabel);
}
using namespace std;
#include "SALOMEDSImpl_UseCaseIterator.hxx"
#include "SALOMEDSImpl_SObject.hxx"
+#include "SALOMEDSImpl_Study.hxx"
IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_UseCaseIterator, MMgt_TShared )
IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_UseCaseIterator, MMgt_TShared )
Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_UseCaseIterator::Value()
{
TDF_Label L = _it.Value()->Label();
- return new SALOMEDSImpl_SObject(L);
+ return SALOMEDSImpl_Study::GetStudy(L)->GetSObject(L);
}