SALOMEDSImpl_StudyBuilder.hxx \
SALOMEDSImpl_Study.hxx \
SALOMEDSImpl_StudyManager.hxx \
- SALOMEDSImpl_OCAFApplication.hxx \
SALOMEDSImpl_ChildNodeIterator.hxx \
SALOMEDSImpl_IParameters.hxx \
SALOMEDSImpl_TMPFile.hxx
-I$(srcdir)/../Basics \
-I$(srcdir)/../SALOMELocalTrace \
-I$(srcdir)/../HDFPersist \
+ -I$(srcdir)/../DF \
@HDF5_INCLUDES@
# This flag is used to resolve the dependencies of OCC libraries.
# This local variable defines the list of dependant libraries common to all target in this package.
COMMON_LIBS =\
../HDFPersist/libSalomeHDFPersist.la \
- @CAS_OCAF@ \
+ ../DF/libDF.la \
@HDF5_LIBS@ \
$(LDXMUFLAGS)
SALOMEDSImpl_SObject.cxx \
SALOMEDSImpl_SComponent.cxx \
SALOMEDSImpl_ChildIterator.cxx \
- SALOMEDSImpl_OCAFApplication.cxx \
SALOMEDSImpl_AttributeIOR.cxx \
SALOMEDSImpl_AttributeExternalFileDef.cxx \
SALOMEDSImpl_AttributeFileType.cxx \
SALOMEDSImpl_ChildNodeIterator.hxx \
SALOMEDSImpl_Driver.hxx \
SALOMEDSImpl_GenericAttribute.hxx \
- SALOMEDSImpl_OCAFApplication.hxx \
SALOMEDSImpl_SComponent.hxx \
SALOMEDSImpl_SComponentIterator.hxx \
SALOMEDSImpl_SObject.hxx \
using namespace std;
#endif
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeComment, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeComment, SALOMEDSImpl_GenericAttribute )
-
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeComment::GetID ()
+const std::string& SALOMEDSImpl_AttributeComment::GetID ()
{
- static Standard_GUID CommentID ("7AF2F7CC-1CA2-4476-BE95-8ACC996BC7B9");
+ static std::string CommentID ("7AF2F7CC-1CA2-4476-BE95-8ACC996BC7B9");
return CommentID;
}
-Handle(SALOMEDSImpl_AttributeComment) SALOMEDSImpl_AttributeComment::Set (const TDF_Label& L,
- const TCollection_ExtendedString& Val)
+SALOMEDSImpl_AttributeComment* SALOMEDSImpl_AttributeComment::Set (const DF_Label& L,
+ const std::string& Val)
{
- Handle(SALOMEDSImpl_AttributeComment) A;
- if (!L.FindAttribute(SALOMEDSImpl_AttributeComment::GetID(), A)) {
+ SALOMEDSImpl_AttributeComment* A = NULL;
+ if (!(A=(SALOMEDSImpl_AttributeComment*)L.FindAttribute(SALOMEDSImpl_AttributeComment::GetID()))) {
A = new SALOMEDSImpl_AttributeComment();
L.AddAttribute(A);
}
//function : SetValue
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeComment::SetValue (const TCollection_ExtendedString& S)
+void SALOMEDSImpl_AttributeComment::SetValue (const string& S)
{
CheckLocked();
//function : ID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeComment::ID () const { return GetID(); }
+const std::string& SALOMEDSImpl_AttributeComment::ID () const { return GetID(); }
//=======================================================================
//function : NewEmpty
//purpose :
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeComment::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_AttributeComment::NewEmpty () const
{
return new SALOMEDSImpl_AttributeComment();
}
//function : Restore
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeComment::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributeComment::Restore(DF_Attribute* with)
{
- myString = Handle(SALOMEDSImpl_AttributeComment)::DownCast (with)->Value ();
+ myString = dynamic_cast<SALOMEDSImpl_AttributeComment*>(with)->Value ();
}
//=======================================================================
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeComment::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT) const
+void SALOMEDSImpl_AttributeComment::Paste (DF_Attribute* into)
{
- Handle(SALOMEDSImpl_AttributeComment)::DownCast (into)->SetValue(myString);
+ dynamic_cast<SALOMEDSImpl_AttributeComment*>(into)->SetValue(myString);
}
#ifndef _SALOMEDSImpl_AttributeComment_HeaderFile
#define _SALOMEDSImpl_AttributeComment_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_ExtendedString.hxx>
-#include <TDF_Label.hxx>
-#include <Standard_GUID.hxx>
+#include "DF_Attribute.hxx"
+#include "DF_Label.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeComment, SALOMEDSImpl_GenericAttribute )
+#include <string>
class SALOMEDSImpl_AttributeComment : public SALOMEDSImpl_GenericAttribute
{
private:
- TCollection_ExtendedString myString;
+ std::string myString;
public:
-Standard_EXPORT static const Standard_GUID& GetID() ;
+Standard_EXPORT static const std::string& GetID() ;
Standard_EXPORT SALOMEDSImpl_AttributeComment() :SALOMEDSImpl_GenericAttribute("AttributeComment") {}
-Standard_EXPORT static Handle(SALOMEDSImpl_AttributeComment) Set(const TDF_Label& L, const TCollection_ExtendedString& Val);
-Standard_EXPORT void SetValue (const TCollection_ExtendedString& S);
-Standard_EXPORT TCollection_ExtendedString Value() const { return myString; }
+Standard_EXPORT static SALOMEDSImpl_AttributeComment* Set(const DF_Label& L, const std::string& Val);
+Standard_EXPORT void SetValue (const std::string& S);
+Standard_EXPORT std::string Value() const { return myString; }
-Standard_EXPORT virtual TCollection_AsciiString Save() { return myString; }
-Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { myString = theValue; }
+Standard_EXPORT virtual std::string Save() { return myString; }
+Standard_EXPORT virtual void Load(const std::string& theValue) { myString = theValue; }
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+Standard_EXPORT const std::string& ID() const;
+Standard_EXPORT void Restore(DF_Attribute* with) ;
+Standard_EXPORT DF_Attribute* NewEmpty() const;
+Standard_EXPORT void Paste(DF_Attribute* into);
Standard_EXPORT ~SALOMEDSImpl_AttributeComment() {}
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeComment )
};
#endif
using namespace std;
#endif
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeDrawable, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeDrawable, SALOMEDSImpl_GenericAttribute )
-
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeDrawable::GetID ()
+const std::string& SALOMEDSImpl_AttributeDrawable::GetID ()
{
- static Standard_GUID SALOMEDSImpl_AttributeDrawableID ("12837184-8F52-11d6-A8A3-0001021E8C7F");
+ static std::string SALOMEDSImpl_AttributeDrawableID ("12837184-8F52-11d6-A8A3-0001021E8C7F");
return SALOMEDSImpl_AttributeDrawableID;
}
//purpose :
//=======================================================================
-Handle(SALOMEDSImpl_AttributeDrawable) SALOMEDSImpl_AttributeDrawable::Set (const TDF_Label& L,
- const Standard_Integer value)
+SALOMEDSImpl_AttributeDrawable* SALOMEDSImpl_AttributeDrawable::Set (const DF_Label& L,
+ const int value)
{
- Handle(SALOMEDSImpl_AttributeDrawable) A;
- if (!L.FindAttribute(SALOMEDSImpl_AttributeDrawable::GetID(),A)) {
+ SALOMEDSImpl_AttributeDrawable* A = NULL;
+ if (!(A=(SALOMEDSImpl_AttributeDrawable*)L.FindAttribute(SALOMEDSImpl_AttributeDrawable::GetID()))) {
A = new SALOMEDSImpl_AttributeDrawable();
L.AddAttribute(A);
}
//function : SetDrawable
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeDrawable::SetDrawable(const Standard_Integer theValue)
+void SALOMEDSImpl_AttributeDrawable::SetDrawable(const int theValue)
{
CheckLocked();
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeDrawable::ID () const { return GetID(); }
+const std::string& SALOMEDSImpl_AttributeDrawable::ID () const { return GetID(); }
//=======================================================================
//purpose :
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeDrawable::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_AttributeDrawable::NewEmpty () const
{
return new SALOMEDSImpl_AttributeDrawable();
}
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeDrawable::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributeDrawable::Restore(DF_Attribute* with)
{
- myValue = Handle(SALOMEDSImpl_AttributeDrawable)::DownCast (with)->IsDrawable ();
+ myValue = dynamic_cast<SALOMEDSImpl_AttributeDrawable*>(with)->IsDrawable ();
}
//=======================================================================
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeDrawable::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT) const
+void SALOMEDSImpl_AttributeDrawable::Paste (DF_Attribute* into)
{
- Handle(SALOMEDSImpl_AttributeDrawable)::DownCast (into)->SetDrawable (myValue);
+ dynamic_cast<SALOMEDSImpl_AttributeDrawable*>(into)->SetDrawable (myValue);
}
#ifndef _SALOMEDSImpl_AttributeDrawable_HeaderFile
#define _SALOMEDSImpl_AttributeDrawable_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <Standard_GUID.hxx>
-#include <TDF_Label.hxx>
+#include "DF_Attribute.hxx"
+#include <string>
+#include "DF_Label.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeDrawable, SALOMEDSImpl_GenericAttribute )
-
-
class SALOMEDSImpl_AttributeDrawable : public SALOMEDSImpl_GenericAttribute
{
private:
-Standard_Integer myValue;
+int myValue;
public:
-Standard_EXPORT virtual TCollection_AsciiString Save() { return (myValue == 0)?(char*)"0":(char*)"1"; }
-Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { (theValue == "0")?myValue=0:myValue=1; }
+Standard_EXPORT virtual std::string Save() { return (myValue == 0)?(char*)"0":(char*)"1"; }
+Standard_EXPORT virtual void Load(const std::string& theValue) { (theValue == "0")?myValue=0:myValue=1; }
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDSImpl_AttributeDrawable Set(const TDF_Label& label,const Standard_Integer value) ;
+Standard_EXPORT static const std::string& GetID() ;
+Standard_EXPORT static SALOMEDSImpl_AttributeDrawable* Set(const DF_Label& label,const int value) ;
-Standard_EXPORT void SetDrawable(const Standard_Integer theValue);
-Standard_EXPORT Standard_Integer IsDrawable() const { return myValue; }
+Standard_EXPORT void SetDrawable(const int theValue);
+Standard_EXPORT int IsDrawable() const { return myValue; }
Standard_EXPORT SALOMEDSImpl_AttributeDrawable();
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+Standard_EXPORT const std::string& ID() const;
+Standard_EXPORT void Restore(DF_Attribute* with) ;
+Standard_EXPORT DF_Attribute* NewEmpty() const;
+Standard_EXPORT void Paste(DF_Attribute* into);
Standard_EXPORT ~SALOMEDSImpl_AttributeDrawable() {}
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeDrawable )
-
};
#endif
using namespace std;
#endif
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeExpandable, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeExpandable, SALOMEDSImpl_GenericAttribute )
-
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeExpandable::GetID ()
+const std::string& SALOMEDSImpl_AttributeExpandable::GetID ()
{
- static Standard_GUID SALOMEDSImpl_AttributeExpandableID ("12837185-8F52-11d6-A8A3-0001021E8C7F");
+ static std::string SALOMEDSImpl_AttributeExpandableID ("12837185-8F52-11d6-A8A3-0001021E8C7F");
return SALOMEDSImpl_AttributeExpandableID;
}
//function : Set
//purpose :
//=======================================================================
-Handle(SALOMEDSImpl_AttributeExpandable) SALOMEDSImpl_AttributeExpandable::Set (const TDF_Label& L,
- const Standard_Integer value)
+SALOMEDSImpl_AttributeExpandable* SALOMEDSImpl_AttributeExpandable::Set (const DF_Label& L,
+ const int value)
{
- Handle(SALOMEDSImpl_AttributeExpandable) A;
- if (!L.FindAttribute(SALOMEDSImpl_AttributeExpandable::GetID(),A)) {
+ SALOMEDSImpl_AttributeExpandable* A = NULL;
+ if (!(A=(SALOMEDSImpl_AttributeExpandable*)L.FindAttribute(SALOMEDSImpl_AttributeExpandable::GetID()))) {
A = new SALOMEDSImpl_AttributeExpandable();
L.AddAttribute(A);
}
//function : SetExpandable
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeExpandable::SetExpandable(const Standard_Integer theValue)
+void SALOMEDSImpl_AttributeExpandable::SetExpandable(const int theValue)
{
CheckLocked();
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeExpandable::ID () const { return GetID(); }
+const std::string& SALOMEDSImpl_AttributeExpandable::ID () const { return GetID(); }
//=======================================================================
//purpose :
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeExpandable::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_AttributeExpandable::NewEmpty () const
{
return new SALOMEDSImpl_AttributeExpandable();
}
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeExpandable::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributeExpandable::Restore(DF_Attribute* with)
{
- myValue = Handle(SALOMEDSImpl_AttributeExpandable)::DownCast (with)->IsExpandable ();
+ myValue = dynamic_cast<SALOMEDSImpl_AttributeExpandable*>(with)->IsExpandable ();
}
//=======================================================================
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeExpandable::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT) const
+void SALOMEDSImpl_AttributeExpandable::Paste (DF_Attribute* into)
{
- Handle(SALOMEDSImpl_AttributeExpandable)::DownCast (into)->SetExpandable (myValue);
+ dynamic_cast<SALOMEDSImpl_AttributeExpandable*>(into)->SetExpandable (myValue);
}
#ifndef _SALOMEDSImpl_AttributeExpandable_HeaderFile
#define _SALOMEDSImpl_AttributeExpandable_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TDF_Label.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <Standard_GUID.hxx>
+#include "DF_Attribute.hxx"
+#include "DF_Label.hxx"
+#include <string>
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeExpandable, SALOMEDSImpl_GenericAttribute )
-
class SALOMEDSImpl_AttributeExpandable : public SALOMEDSImpl_GenericAttribute
{
private:
-Standard_Integer myValue;
+int myValue;
public:
-Standard_EXPORT virtual TCollection_AsciiString Save() { return (myValue == 0)?(char*)"0":(char*)"1"; }
-Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { (theValue == "0")?myValue=0:myValue=1; }
+Standard_EXPORT virtual std::string Save() { return (myValue == 0)?(char*)"0":(char*)"1"; }
+Standard_EXPORT virtual void Load(const std::string& theValue) { (theValue == "0")?myValue=0:myValue=1; }
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDSImpl_AttributeExpandable Set(const TDF_Label& label,const Standard_Integer value) ;
+Standard_EXPORT static const std::string& GetID() ;
+Standard_EXPORT static SALOMEDSImpl_AttributeExpandable* Set(const DF_Label& label,const int value) ;
Standard_EXPORT SALOMEDSImpl_AttributeExpandable();
-Standard_EXPORT void SetExpandable(const Standard_Integer value);
+Standard_EXPORT void SetExpandable(const int value);
Standard_EXPORT int IsExpandable() const { return myValue; }
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+Standard_EXPORT const std::string& ID() const;
+Standard_EXPORT void Restore(DF_Attribute* with) ;
+Standard_EXPORT DF_Attribute* NewEmpty() const;
+Standard_EXPORT void Paste(DF_Attribute* into);
Standard_EXPORT ~SALOMEDSImpl_AttributeExpandable() {}
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeExpandable )
};
#endif
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeExternalFileDef, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeExternalFileDef, SALOMEDSImpl_GenericAttribute )
-
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeExternalFileDef::GetID ()
+const std::string& SALOMEDSImpl_AttributeExternalFileDef::GetID ()
{
- static Standard_GUID SALOMEDSImpl_AttributeExternalFileDefID ("7123AD4C-ACDB-4e3a-8FDC-70EA164D2CBE");
+ static std::string SALOMEDSImpl_AttributeExternalFileDefID ("7123AD4C-ACDB-4e3a-8FDC-70EA164D2CBE");
return SALOMEDSImpl_AttributeExternalFileDefID;
}
//function : Set
//purpose :
//=======================================================================
-Handle(SALOMEDSImpl_AttributeExternalFileDef)
-SALOMEDSImpl_AttributeExternalFileDef::Set (const TDF_Label& L, const TCollection_ExtendedString& S)
+SALOMEDSImpl_AttributeExternalFileDef*
+SALOMEDSImpl_AttributeExternalFileDef::Set (const DF_Label& L, const std::string& S)
{
- Handle(SALOMEDSImpl_AttributeExternalFileDef) A;
- if (!L.FindAttribute(SALOMEDSImpl_AttributeExternalFileDef::GetID(),A)) {
+ SALOMEDSImpl_AttributeExternalFileDef* A = NULL;
+ if (!(A=(SALOMEDSImpl_AttributeExternalFileDef*)L.FindAttribute(SALOMEDSImpl_AttributeExternalFileDef::GetID()))) {
A = new SALOMEDSImpl_AttributeExternalFileDef();
L.AddAttribute(A);
}
//function : SetValue
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeExternalFileDef::SetValue (const TCollection_ExtendedString& S)
+void SALOMEDSImpl_AttributeExternalFileDef::SetValue (const std::string& S)
{
CheckLocked();
//function : ID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeExternalFileDef::ID () const { return GetID(); }
+const std::string& SALOMEDSImpl_AttributeExternalFileDef::ID () const { return GetID(); }
//=======================================================================
//function : NewEmpty
//purpose :
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeExternalFileDef::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_AttributeExternalFileDef::NewEmpty () const
{
return new SALOMEDSImpl_AttributeExternalFileDef();
}
//function : Restore
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeExternalFileDef::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributeExternalFileDef::Restore(DF_Attribute* with)
{
- myString = Handle(SALOMEDSImpl_AttributeExternalFileDef)::DownCast (with)->Value ();
+ myString = dynamic_cast<SALOMEDSImpl_AttributeExternalFileDef*>(with)->Value ();
}
//=======================================================================
//function : Paste
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeExternalFileDef::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT) const
+void SALOMEDSImpl_AttributeExternalFileDef::Paste (DF_Attribute* into)
{
- Handle(SALOMEDSImpl_AttributeExternalFileDef) anAttr = Handle(SALOMEDSImpl_AttributeExternalFileDef)::DownCast(into);
+ SALOMEDSImpl_AttributeExternalFileDef* anAttr = dynamic_cast<SALOMEDSImpl_AttributeExternalFileDef*>(into);
anAttr->SetValue(myString);
}
#ifndef _SALOMEDSImpl_AttributeExternalFileDef_HeaderFile
#define _SALOMEDSImpl_AttributeExternalFileDef_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <Standard_GUID.hxx>
-#include <TDF_Label.hxx>
-#include <TCollection_ExtendedString.hxx>
+#include "DF_Attribute.hxx"
+#include "DF_Label.hxx"
+#include <string>
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeExternalFileDef, SALOMEDSImpl_GenericAttribute )
-
class SALOMEDSImpl_AttributeExternalFileDef : public SALOMEDSImpl_GenericAttribute
{
private:
- TCollection_ExtendedString myString;
+ std::string myString;
public:
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDSImpl_AttributeExternalFileDef Set(const TDF_Label& label,
- const TCollection_ExtendedString& Name);
+Standard_EXPORT static const std::string& GetID() ;
+Standard_EXPORT static SALOMEDSImpl_AttributeExternalFileDef* Set(const DF_Label& label,
+ const std::string& Name);
Standard_EXPORT SALOMEDSImpl_AttributeExternalFileDef();
-Standard_EXPORT void SetValue(const TCollection_ExtendedString& value);
-Standard_EXPORT TCollection_ExtendedString Value() const { return myString; }
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+Standard_EXPORT void SetValue(const std::string& value);
+Standard_EXPORT std::string Value() const { return myString; }
+Standard_EXPORT const std::string& ID() const;
+Standard_EXPORT void Restore(DF_Attribute* with) ;
+Standard_EXPORT DF_Attribute* NewEmpty() const;
+Standard_EXPORT void Paste(DF_Attribute* into);
Standard_EXPORT ~SALOMEDSImpl_AttributeExternalFileDef() {}
-Standard_EXPORT virtual TCollection_AsciiString Save() { return myString; }
-Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { myString = theValue; }
+Standard_EXPORT virtual std::string Save() { return myString; }
+Standard_EXPORT virtual void Load(const std::string& theValue) { myString = theValue; }
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeExternalFileDef )
};
#endif
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeFileType, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeFileType, SALOMEDSImpl_GenericAttribute )
-
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeFileType::GetID ()
+const std::string& SALOMEDSImpl_AttributeFileType::GetID ()
{
- static Standard_GUID SALOMEDSImpl_AttributeFileTypeID ("0181B525-3F15-4ab2-9DE3-5E2F54B5F340");
+ static std::string SALOMEDSImpl_AttributeFileTypeID ("0181B525-3F15-4ab2-9DE3-5E2F54B5F340");
return SALOMEDSImpl_AttributeFileTypeID;
}
//purpose :
//=======================================================================
-Handle(SALOMEDSImpl_AttributeFileType) SALOMEDSImpl_AttributeFileType::Set (const TDF_Label& L,
- const TCollection_ExtendedString& S)
+SALOMEDSImpl_AttributeFileType* SALOMEDSImpl_AttributeFileType::Set (const DF_Label& L,
+ const std::string& S)
{
- Handle(SALOMEDSImpl_AttributeFileType) A;
- if (!L.FindAttribute(SALOMEDSImpl_AttributeFileType::GetID(),A)) {
+ SALOMEDSImpl_AttributeFileType* A = NULL;
+ if (!(A=(SALOMEDSImpl_AttributeFileType*)L.FindAttribute(SALOMEDSImpl_AttributeFileType::GetID()))) {
A = new SALOMEDSImpl_AttributeFileType();
L.AddAttribute(A);
}
//function : SetValue
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeFileType::SetValue (const TCollection_ExtendedString& S)
+void SALOMEDSImpl_AttributeFileType::SetValue (const std::string& S)
{
CheckLocked();
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeFileType::ID () const { return GetID(); }
+const std::string& SALOMEDSImpl_AttributeFileType::ID () const { return GetID(); }
//=======================================================================
//purpose :
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeFileType::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_AttributeFileType::NewEmpty () const
{
return new SALOMEDSImpl_AttributeFileType();
}
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeFileType::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributeFileType::Restore(DF_Attribute* with)
{
- myString = Handle(SALOMEDSImpl_AttributeFileType)::DownCast (with)->Value ();
+ myString = dynamic_cast<SALOMEDSImpl_AttributeFileType*>(with)->Value ();
}
//=======================================================================
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeFileType::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT) const
+void SALOMEDSImpl_AttributeFileType::Paste (DF_Attribute* into)
{
- Handle(SALOMEDSImpl_AttributeFileType)::DownCast (into)->SetValue (myString);
+ dynamic_cast<SALOMEDSImpl_AttributeFileType*>(into)->SetValue (myString);
}
#ifndef _SALOMEDSImpl_AttributeFileType_HeaderFile
#define _SALOMEDSImpl_AttributeFileType_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TDF_Label.hxx>
-#include <Standard_GUID.hxx>
-#include <TCollection_ExtendedString.hxx>
+#include "DF_Attribute.hxx"
+#include "DF_Label.hxx"
+#include <string>
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeFileType, SALOMEDSImpl_GenericAttribute )
-
class SALOMEDSImpl_AttributeFileType : public SALOMEDSImpl_GenericAttribute
{
private:
- TCollection_ExtendedString myString;
+ std::string myString;
public:
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDSImpl_AttributeFileType Set(const TDF_Label& label,
- const TCollection_ExtendedString& Name) ;
+Standard_EXPORT static const std::string& GetID() ;
+Standard_EXPORT static SALOMEDSImpl_AttributeFileType* Set(const DF_Label& label,
+ const std::string& Name) ;
Standard_EXPORT SALOMEDSImpl_AttributeFileType();
-Standard_EXPORT void SetValue(const TCollection_ExtendedString& value);
-Standard_EXPORT TCollection_ExtendedString Value() const { return myString; }
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+Standard_EXPORT void SetValue(const std::string& value);
+Standard_EXPORT std::string Value() const { return myString; }
+Standard_EXPORT const std::string& ID() const;
+Standard_EXPORT void Restore(DF_Attribute* with) ;
+Standard_EXPORT DF_Attribute* NewEmpty() const;
+Standard_EXPORT void Paste(DF_Attribute* into);
Standard_EXPORT ~SALOMEDSImpl_AttributeFileType() {}
-Standard_EXPORT virtual TCollection_AsciiString Save() { return myString; }
-Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { myString = theValue; }
+Standard_EXPORT virtual std::string Save() { return myString; }
+Standard_EXPORT virtual void Load(const std::string& theValue) { myString = theValue; }
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeFileType )
};
// Module : SALOME
#include "SALOMEDSImpl_AttributeFlags.hxx"
-#include <Standard_GUID.hxx>
using namespace std;
have only two states (0 and 1).
*/
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeFlags, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeFlags, SALOMEDSImpl_GenericAttribute )
-
//=======================================================================
//function : SALOMEDSImpl_AttributeFlags::GetID
//purpose : Get GUID of this attribute
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeFlags::GetID ()
+const std::string& SALOMEDSImpl_AttributeFlags::GetID ()
{
- static Standard_GUID SALOMEDSImpl_AttributeFlagsID( "866EEC9F-A517-4cb4-88E6-E208DB8FC96F" );
+ static std::string SALOMEDSImpl_AttributeFlagsID( "866EEC9F-A517-4cb4-88E6-E208DB8FC96F" );
return SALOMEDSImpl_AttributeFlagsID;
}
//function : SALOMEDSImpl_AttributeFlags::Set
//purpose : Set value of the attribute
//=======================================================================
-Handle(SALOMEDSImpl_AttributeFlags) SALOMEDSImpl_AttributeFlags::Set(const TDF_Label& L,
- const Standard_Integer value )
+SALOMEDSImpl_AttributeFlags* SALOMEDSImpl_AttributeFlags::Set(const DF_Label& L,
+ const int value )
{
- Handle(SALOMEDSImpl_AttributeFlags) A;
- if ( !L.FindAttribute(SALOMEDSImpl_AttributeFlags::GetID(),A ) )
+ SALOMEDSImpl_AttributeFlags* A = NULL;
+ if ( !(A=(SALOMEDSImpl_AttributeFlags*)L.FindAttribute(SALOMEDSImpl_AttributeFlags::GetID())) )
{
A = new SALOMEDSImpl_AttributeFlags();
L.AddAttribute( A );
//function : SALOMEDSImpl_AttributeFlags::ID
//purpose : Get GUID of this attribute
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeFlags::ID () const
+const std::string& SALOMEDSImpl_AttributeFlags::ID () const
{
return GetID();
}
//purpose : Create new empty attribute
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeFlags::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_AttributeFlags::NewEmpty () const
{
return new SALOMEDSImpl_AttributeFlags();
}
//function : SALOMEDSImpl_AttributeFlags::Restore
//purpose : Assign given value to the attribute
//=======================================================================
-void SALOMEDSImpl_AttributeFlags::Restore( const Handle(TDF_Attribute)& with )
+void SALOMEDSImpl_AttributeFlags::Restore( DF_Attribute* with )
{
- myValue = Handle(SALOMEDSImpl_AttributeFlags)::DownCast( with )->Get();
+ myValue = dynamic_cast<SALOMEDSImpl_AttributeFlags*>( with )->Get();
return;
}
//function : SALOMEDSImpl_AttributeFlags::Paste
//purpose : Assign internal value to the given attribute
//=======================================================================
-void SALOMEDSImpl_AttributeFlags::Paste(const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT ) const
+void SALOMEDSImpl_AttributeFlags::Paste( DF_Attribute* into)
{
- Handle(SALOMEDSImpl_AttributeFlags)::DownCast( into )->Set( myValue );
+ dynamic_cast<SALOMEDSImpl_AttributeFlags*>( into )->Set( myValue );
}
//=======================================================================
//function : SALOMEDSImpl_AttributeFlags::Set
//purpose : Set value
//=======================================================================
-void SALOMEDSImpl_AttributeFlags::Set( const Standard_Integer v )
+void SALOMEDSImpl_AttributeFlags::Set( const int v )
{
Backup();
myValue=v;
//function : SALOMEDSImpl_AttributeFlags::Get
//purpose : GetValue
//=======================================================================
-Standard_Integer SALOMEDSImpl_AttributeFlags::Get() const
+int SALOMEDSImpl_AttributeFlags::Get() const
{
return myValue;
}
#ifndef SALOMEDSImpl_AttributeFlags_HeaderFile
#define SALOMEDSImpl_AttributeFlags_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TDF_Label.hxx>
+#include "DF_Attribute.hxx"
+#include "DF_Label.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Standard_GUID;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
/*
Class : SALOMEDSImpl_AttributeFlags
Description : This class is intended for storing different object attributes that
have only two states (0 and 1).
*/
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeFlags, SALOMEDSImpl_GenericAttribute )
-
#ifndef WNT
class Standard_EXPORT SALOMEDSImpl_AttributeFlags : public SALOMEDSImpl_GenericAttribute
#else
#endif
{
private:
-Standard_Integer myValue;
+int myValue;
public:
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle(SALOMEDSImpl_AttributeFlags) Set(const TDF_Label&, const Standard_Integer );
+Standard_EXPORT static const std::string& GetID() ;
+Standard_EXPORT static SALOMEDSImpl_AttributeFlags* Set(const DF_Label&, const int theValue );
SALOMEDSImpl_AttributeFlags();
-Standard_EXPORT virtual ~SALOMEDSImpl_AttributeFlags();
+Standard_EXPORT virtual ~SALOMEDSImpl_AttributeFlags();
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore( const Handle(TDF_Attribute)& with );
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste( const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT ) const;
-Standard_EXPORT void Set( const Standard_Integer );
-Standard_EXPORT Standard_Integer Get() const;
+Standard_EXPORT const std::string& ID() const;
+Standard_EXPORT void Restore( DF_Attribute* with );
+Standard_EXPORT DF_Attribute* NewEmpty() const;
+Standard_EXPORT void Paste( DF_Attribute* into);
+Standard_EXPORT void Set( const int );
+Standard_EXPORT int Get() const;
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeFlags )
};
#endif
// Module : SALOME
#include "SALOMEDSImpl_AttributeGraphic.hxx"
-#include <TDF_Attribute.hxx>
-#include <Standard_GUID.hxx>
-#include <TColStd_DataMapIteratorOfDataMapOfIntegerInteger.hxx>
+#include "DF_Attribute.hxx"
+
+using namespace std;
/*
Class : SALOMEDSImpl_AttributeGraphic
graphic representation of objects in dirrent views
*/
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeGraphic, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeGraphic, SALOMEDSImpl_GenericAttribute )
-
//=======================================================================
//function : GetID
//purpose : Get GUID of this attribute
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeGraphic::GetID()
+const std::string& SALOMEDSImpl_AttributeGraphic::GetID()
{
- static Standard_GUID SALOMEDSImpl_AttributeGraphicID( "F17AE8F0-E354-4d6f-8E42-38385C36E67E" );
+ static std::string SALOMEDSImpl_AttributeGraphicID( "F17AE8F0-E354-4d6f-8E42-38385C36E67E" );
return SALOMEDSImpl_AttributeGraphicID;
}
//function : SetVisibility
//purpose : Set visibility of object in given view
//=======================================================================
-void SALOMEDSImpl_AttributeGraphic::SetVisibility(const Standard_Integer theViewId,
- const Standard_Boolean theValue )
+void SALOMEDSImpl_AttributeGraphic::SetVisibility(const int theViewId,
+ const bool theValue )
{
- if ( myVisibility.IsBound( theViewId ) && myVisibility( theViewId ) == theValue )
+ if ( myVisibility.find( theViewId ) != myVisibility.end() && myVisibility[theViewId] == theValue )
return;
Backup();
- if ( myVisibility.IsBound( theViewId ) )
- myVisibility.ChangeFind( theViewId ) = theValue ? 1 : 0;
- else
- myVisibility.Bind( theViewId, theValue ? 1 : 0 );
+ myVisibility[ theViewId ] = theValue ? 1 : 0;
}
//function : Get
//purpose : Get visibility of object in given view
//=======================================================================
-Standard_Boolean SALOMEDSImpl_AttributeGraphic::GetVisibility(const Standard_Integer theViewId ) const
+bool SALOMEDSImpl_AttributeGraphic::GetVisibility(const int theViewId )
{
- return myVisibility.IsBound( theViewId ) ? myVisibility( theViewId ) : false;
+ bool isVisible = false;
+ if(myVisibility.find( theViewId )!=myVisibility.end())
+ isVisible = (bool)myVisibility[theViewId];
+ else
+ isVisible = false;
+
+ return isVisible;
}
//function : ID
//purpose : Get GUID of this attribute
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeGraphic::ID () const
+const std::string& SALOMEDSImpl_AttributeGraphic::ID () const
{
return GetID();
}
//function : NewEmpty
//purpose : Create new empty attribute
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeGraphic::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_AttributeGraphic::NewEmpty () const
{
return new SALOMEDSImpl_AttributeGraphic ();
}
//function : SetVisibility
//purpose : Set visibility of object in all views
//=======================================================================
-void SALOMEDSImpl_AttributeGraphic::SetVisibility( const TColStd_DataMapOfIntegerInteger& theMap )
+void SALOMEDSImpl_AttributeGraphic::SetVisibility( const map<int, int>& theMap )
{
myVisibility = theMap;
}
//function : SetVisibility
//purpose : Get visibility of object in all views
//=======================================================================
-const TColStd_DataMapOfIntegerInteger& SALOMEDSImpl_AttributeGraphic::GetVisibility()
+const map<int, int>& SALOMEDSImpl_AttributeGraphic::GetVisibility()
{
return myVisibility;
}
//function : Restore
//purpose : Restore value of attribute with value of theWith one
//=======================================================================
-void SALOMEDSImpl_AttributeGraphic::Restore( const Handle(TDF_Attribute)& theWith )
+void SALOMEDSImpl_AttributeGraphic::Restore( DF_Attribute* theWith )
{
- Handle(SALOMEDSImpl_AttributeGraphic) anAttr =
- Handle(SALOMEDSImpl_AttributeGraphic)::DownCast( theWith );
+ SALOMEDSImpl_AttributeGraphic* anAttr =
+ dynamic_cast<SALOMEDSImpl_AttributeGraphic*>( theWith );
- if ( !anAttr.IsNull() )
+ if ( anAttr )
SetVisibility( anAttr->GetVisibility() );
}
//function : Paste
//purpose : Paste value of current attribute to the value of entry one
//=======================================================================
-void SALOMEDSImpl_AttributeGraphic::Paste( const Handle(TDF_Attribute)& theInto,
- const Handle(TDF_RelocationTable)& ) const
+void SALOMEDSImpl_AttributeGraphic::Paste( DF_Attribute* theInto)
{
- Handle(SALOMEDSImpl_AttributeGraphic) anAttr =
- Handle(SALOMEDSImpl_AttributeGraphic)::DownCast( theInto );
+ SALOMEDSImpl_AttributeGraphic* anAttr =
+ dynamic_cast<SALOMEDSImpl_AttributeGraphic*>( theInto );
- if ( !anAttr.IsNull() )
+ if ( anAttr )
anAttr->SetVisibility( myVisibility );
}
-//=======================================================================
-//function : Dump
-//purpose : Dump
-//=======================================================================
-Standard_OStream& SALOMEDSImpl_AttributeGraphic::Dump( Standard_OStream& anOS ) const
-{
- anOS << "Visibility of object:" << endl;
- TColStd_DataMapIteratorOfDataMapOfIntegerInteger anIter( myVisibility );
- for ( ; anIter.More(); anIter.Next() )
- {
- char str[ 100 ];
-
- if ( GetVisibility( anIter.Key() ) )
- sprintf( str, "Viewer ID = 0x%X State = VISIBLE\n", anIter.Key() );
- else
- sprintf( str, "Viewer ID = 0x%X State = INVISIBLE\n", anIter.Key() );
-
- anOS << str;
- }
-
- anOS << "Integer";
- return anOS;
-}
-
#ifndef SALOMEDSImpl_AttributeGraphic_HeaderFile
#define SALOMEDSImpl_AttributeGraphic_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TColStd_DataMapOfIntegerInteger.hxx>
-#include <TDF_Label.hxx>
+#include "DF_Attribute.hxx"
+#include "DF_Label.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Standard_GUID;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
+#include <map>
/*
Class : SALOMEDSImpl_AttributeGraphic
graphic representation of objects in dirrent views
*/
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeGraphic, SALOMEDSImpl_GenericAttribute)
-
-
-
#ifndef WNT
class Standard_EXPORT SALOMEDSImpl_AttributeGraphic : public SALOMEDSImpl_GenericAttribute
#else
Standard_EXPORT SALOMEDSImpl_AttributeGraphic();
Standard_EXPORT ~SALOMEDSImpl_AttributeGraphic();
-Standard_EXPORT static const Standard_GUID& GetID() ;
+Standard_EXPORT static const std::string& GetID() ;
-Standard_EXPORT void SetVisibility( const Standard_Integer,
- const Standard_Boolean );
-Standard_EXPORT Standard_Boolean GetVisibility( const Standard_Integer ) const;
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore( const Handle(TDF_Attribute)& theWith );
-Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const;
-Standard_EXPORT void Paste( const Handle(TDF_Attribute)& theInto,
- const Handle(TDF_RelocationTable)& ) const;
-Standard_EXPORT virtual Standard_OStream& Dump( Standard_OStream& anOS ) const;
+Standard_EXPORT void SetVisibility( const int, const bool );
+Standard_EXPORT bool GetVisibility( const int );
+Standard_EXPORT const std::string& ID() const;
+Standard_EXPORT void Restore( DF_Attribute* theWith );
+Standard_EXPORT DF_Attribute* NewEmpty() const;
+Standard_EXPORT void Paste( DF_Attribute* theInto);
-Standard_EXPORT void SetVisibility( const TColStd_DataMapOfIntegerInteger& );
+Standard_EXPORT void SetVisibility( const std::map<int, int>& );
-Standard_EXPORT const TColStd_DataMapOfIntegerInteger& GetVisibility();
+Standard_EXPORT const std::map<int, int>& GetVisibility();
private:
- TColStd_DataMapOfIntegerInteger myVisibility;
+ std::map<int, int> myVisibility;
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeGraphic )
};
#endif
// Module : SALOME
#include "SALOMEDSImpl_AttributeIOR.hxx"
-#include <TCollection_AsciiString.hxx>
#include "SALOMEDSImpl_Study.hxx"
-#include <Standard_GUID.hxx>
#ifndef WNT
using namespace std;
#endif
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeIOR, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeIOR, SALOMEDSImpl_GenericAttribute )
-
-
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeIOR::GetID ()
+const std::string& SALOMEDSImpl_AttributeIOR::GetID ()
{
- static Standard_GUID SALOMEDSImpl_AttributeIORID ("92888E01-7074-11d5-A690-0800369C8A03");
+ static std::string SALOMEDSImpl_AttributeIORID ("92888E01-7074-11d5-A690-0800369C8A03");
return SALOMEDSImpl_AttributeIORID;
}
//purpose :
//=======================================================================
-Handle(SALOMEDSImpl_AttributeIOR) SALOMEDSImpl_AttributeIOR::Set (const TDF_Label& L,
- const TCollection_ExtendedString& S)
+SALOMEDSImpl_AttributeIOR* SALOMEDSImpl_AttributeIOR::Set (const DF_Label& L,
+ const std::string& S)
{
- Handle(SALOMEDSImpl_AttributeIOR) A;
- if (!L.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(),A)) {
+ SALOMEDSImpl_AttributeIOR* A = NULL;
+ if (!(A=(SALOMEDSImpl_AttributeIOR*)L.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) {
A = new SALOMEDSImpl_AttributeIOR();
L.AddAttribute(A);
}
//function : SetValue
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeIOR::SetValue(const TCollection_ExtendedString& theValue)
+void SALOMEDSImpl_AttributeIOR::SetValue(const std::string& theValue)
{
CheckLocked();
- Handle(SALOMEDSImpl_Study) aStudy = SALOMEDSImpl_Study::GetStudy(Label());
- aStudy->AddCreatedPostponed(theValue);
- aStudy->AddPostponed(theValue);
+ SALOMEDSImpl_Study* aStudy = SALOMEDSImpl_Study::GetStudy(Label());
Backup();
myString = theValue;
SALOMEDSImpl_Study::IORUpdated(this);
-
- //SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
//=======================================================================
//function : Value
//purpose :
//=======================================================================
-TCollection_ExtendedString SALOMEDSImpl_AttributeIOR::Value() const
+std::string SALOMEDSImpl_AttributeIOR::Value() const
{
return myString;
}
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeIOR::ID () const { return GetID(); }
+const std::string& SALOMEDSImpl_AttributeIOR::ID () const { return GetID(); }
//=======================================================================
//purpose :
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeIOR::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_AttributeIOR::NewEmpty () const
{
return new SALOMEDSImpl_AttributeIOR();
}
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeIOR::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributeIOR::Restore( DF_Attribute* with)
{
- myString = Handle(SALOMEDSImpl_AttributeIOR)::DownCast (with)->Value();
+ myString = dynamic_cast<SALOMEDSImpl_AttributeIOR*>(with)->Value();
return;
}
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeIOR::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT) const
+void SALOMEDSImpl_AttributeIOR::Paste (DF_Attribute* into)
{
- Handle(SALOMEDSImpl_AttributeIOR)::DownCast (into)->SetValue(myString);
+ dynamic_cast<SALOMEDSImpl_AttributeIOR*>(into)->SetValue(myString);
}
#ifndef _SALOMEDSImpl_AttributeIOR_HeaderFile
#define _SALOMEDSImpl_AttributeIOR_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TCollection_ExtendedString.hxx>
-#include <TDF_Label.hxx>
+#include "DF_Attribute.hxx"
+#include <string>
+#include "DF_Label.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Standard_GUID;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeIOR, SALOMEDSImpl_GenericAttribute )
-
class SALOMEDSImpl_AttributeIOR : public SALOMEDSImpl_GenericAttribute
{
private:
- TCollection_ExtendedString myString;
+ std::string myString;
public:
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDSImpl_AttributeIOR Set(const TDF_Label& label,
- const TCollection_ExtendedString& string);
+Standard_EXPORT static const std::string& GetID() ;
+Standard_EXPORT static SALOMEDSImpl_AttributeIOR* Set(const DF_Label& label,
+ const std::string& IOR);
Standard_EXPORT SALOMEDSImpl_AttributeIOR();
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void SetValue(const TCollection_ExtendedString& theValue);
-Standard_EXPORT TCollection_ExtendedString Value() const ;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+Standard_EXPORT const std::string& ID() const;
+Standard_EXPORT void SetValue(const std::string& theValue);
+Standard_EXPORT std::string Value() const ;
+Standard_EXPORT void Restore(DF_Attribute* with);
+Standard_EXPORT DF_Attribute* NewEmpty() const;
+Standard_EXPORT void Paste(DF_Attribute* into);
Standard_EXPORT ~SALOMEDSImpl_AttributeIOR() {}
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeIOR )
};
#endif
using namespace std;
#endif
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeInteger, SALOMEDSImpl_GenericAttribute)
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeInteger, SALOMEDSImpl_GenericAttribute )
-
+#include <stdlib.h>
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeInteger::GetID ()
+const std::string& SALOMEDSImpl_AttributeInteger::GetID ()
{
- static Standard_GUID IntegerID ("8CC3E213-C9B4-47e4-8496-DD5E62E22018");
+ static std::string IntegerID ("8CC3E213-C9B4-47e4-8496-DD5E62E22018");
return IntegerID;
}
-Handle(SALOMEDSImpl_AttributeInteger) SALOMEDSImpl_AttributeInteger::Set (const TDF_Label& L, Standard_Integer Val)
+SALOMEDSImpl_AttributeInteger* SALOMEDSImpl_AttributeInteger::Set (const DF_Label& L, int Val)
{
- Handle(SALOMEDSImpl_AttributeInteger) A;
- if (!L.FindAttribute(SALOMEDSImpl_AttributeInteger::GetID(), A)) {
+ SALOMEDSImpl_AttributeInteger* A = NULL;
+ if (!(A = (SALOMEDSImpl_AttributeInteger*)L.FindAttribute(SALOMEDSImpl_AttributeInteger::GetID()))) {
A = new SALOMEDSImpl_AttributeInteger();
L.AddAttribute(A);
}
return A;
}
+//=======================================================================
+//function : Value
+//purpose :
+//=======================================================================
+int SALOMEDSImpl_AttributeInteger::Value() const
+{
+ return myValue;
+}
+
//=======================================================================
//function : SetValue
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeInteger::SetValue(const Standard_Integer v)
+void SALOMEDSImpl_AttributeInteger::SetValue(const int v)
{
if(myValue == v) return;
//function : ID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeInteger::ID () const { return GetID(); }
+const std::string& SALOMEDSImpl_AttributeInteger::ID () const { return GetID(); }
//=======================================================================
//function : NewEmpty
//purpose :
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeInteger::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_AttributeInteger::NewEmpty () const
{
return new SALOMEDSImpl_AttributeInteger();
}
//function : Restore
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeInteger::Restore(const Handle(TDF_Attribute)& With)
+void SALOMEDSImpl_AttributeInteger::Restore(DF_Attribute* With)
{
- myValue = Handle(SALOMEDSImpl_AttributeInteger)::DownCast (With)->Value();
+ myValue = dynamic_cast<SALOMEDSImpl_AttributeInteger*>(With)->Value();
}
//=======================================================================
//function : Paste
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeInteger::Paste (const Handle(TDF_Attribute)& Into,
- const Handle(TDF_RelocationTable)& RT) const
+void SALOMEDSImpl_AttributeInteger::Paste (DF_Attribute* Into)
{
- Handle(SALOMEDSImpl_AttributeInteger)::DownCast(Into)->SetValue(myValue);
+ dynamic_cast<SALOMEDSImpl_AttributeInteger*>(Into)->SetValue(myValue);
}
+
+//=======================================================================
+//function : Save
+//purpose :
+//=======================================================================
+string SALOMEDSImpl_AttributeInteger::Save()
+{
+ char buffer[128];
+ sprintf(buffer, "%d", myValue);
+ return string(buffer);
+}
+
+//=======================================================================
+//function : Load
+//purpose :
+//=======================================================================
+void SALOMEDSImpl_AttributeInteger::Load(const string& theValue)
+{
+ myValue = atoi(theValue.c_str());
+}
#ifndef _SALOMEDSImpl_AttributeInteger_HeaderFile
#define _SALOMEDSImpl_AttributeInteger_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TDF_Label.hxx>
+#include "DF_Attribute.hxx"
+#include <string>
+#include "DF_Label.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Standard_GUID;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeInteger, SALOMEDSImpl_GenericAttribute )
-
-
class SALOMEDSImpl_AttributeInteger : public SALOMEDSImpl_GenericAttribute
{
private:
-Standard_Integer myValue;
+int myValue;
public:
-Standard_EXPORT static const Standard_GUID& GetID() ;
+Standard_EXPORT static const std::string& GetID() ;
Standard_EXPORT SALOMEDSImpl_AttributeInteger():SALOMEDSImpl_GenericAttribute("AttributeInteger") {}
-Standard_EXPORT static Handle(SALOMEDSImpl_AttributeInteger) Set (const TDF_Label& L, Standard_Integer Val);
-Standard_EXPORT void SetValue(const Standard_Integer theVal);
-Standard_EXPORT Standard_Integer Value() const { return myValue; }
-Standard_EXPORT virtual TCollection_AsciiString Save() { return TCollection_AsciiString(myValue); }
-Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { myValue = theValue.IntegerValue(); }
-
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+Standard_EXPORT static SALOMEDSImpl_AttributeInteger* Set (const DF_Label& L, int Val);
+Standard_EXPORT void SetValue(const int theVal);
+Standard_EXPORT int Value() const;
+Standard_EXPORT virtual std::string Save();
+Standard_EXPORT virtual void Load(const std::string& theValue);
+
+Standard_EXPORT const std::string& ID() const;
+Standard_EXPORT void Restore(DF_Attribute* with) ;
+Standard_EXPORT DF_Attribute* NewEmpty() const;
+Standard_EXPORT void Paste(DF_Attribute* into);
Standard_EXPORT ~SALOMEDSImpl_AttributeInteger() {}
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeInteger )
-
};
#endif
#include "SALOMEDSImpl_AttributeLocalID.hxx"
-#include <Standard_GUID.hxx>
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeLocalID, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeLocalID, SALOMEDSImpl_GenericAttribute )
-
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeLocalID::GetID ()
+const std::string& SALOMEDSImpl_AttributeLocalID::GetID ()
{
- static Standard_GUID SALOMEDSImpl_AttributeLocalID ("12837196-8F52-11d6-A8A3-0001021E8C7F");
+ static std::string SALOMEDSImpl_AttributeLocalID ("12837196-8F52-11d6-A8A3-0001021E8C7F");
return SALOMEDSImpl_AttributeLocalID;
}
//purpose :
//=======================================================================
-Handle(SALOMEDSImpl_AttributeLocalID) SALOMEDSImpl_AttributeLocalID::Set (const TDF_Label& L,
- const Standard_Integer value)
+SALOMEDSImpl_AttributeLocalID* SALOMEDSImpl_AttributeLocalID::Set (const DF_Label& L,
+ const int value)
{
- Handle(SALOMEDSImpl_AttributeLocalID) A;
- if (!L.FindAttribute(SALOMEDSImpl_AttributeLocalID::GetID(),A)) {
+ SALOMEDSImpl_AttributeLocalID* A = NULL;
+ if (!(A=(SALOMEDSImpl_AttributeLocalID*)L.FindAttribute(SALOMEDSImpl_AttributeLocalID::GetID()))) {
A = new SALOMEDSImpl_AttributeLocalID();
L.AddAttribute(A);
}
//function : Set
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeLocalID::SetValue(const Standard_Integer theValue)
+void SALOMEDSImpl_AttributeLocalID::SetValue(const int theValue)
{
CheckLocked();
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeLocalID::ID () const { return GetID(); }
+const std::string& SALOMEDSImpl_AttributeLocalID::ID () const { return GetID(); }
//=======================================================================
//purpose :
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeLocalID::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_AttributeLocalID::NewEmpty () const
{
return new SALOMEDSImpl_AttributeLocalID();
}
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeLocalID::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributeLocalID::Restore(DF_Attribute* with)
{
- myValue = Handle(SALOMEDSImpl_AttributeLocalID)::DownCast (with)->Value();
+ myValue = dynamic_cast<SALOMEDSImpl_AttributeLocalID*>(with)->Value();
}
//=======================================================================
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeLocalID::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT) const
+void SALOMEDSImpl_AttributeLocalID::Paste (DF_Attribute* into)
{
- Handle(SALOMEDSImpl_AttributeLocalID)::DownCast (into)->SetValue(myValue);
+ dynamic_cast<SALOMEDSImpl_AttributeLocalID*>(into)->SetValue(myValue);
+}
+
+//=======================================================================
+//function : Save
+//purpose :
+//=======================================================================
+string SALOMEDSImpl_AttributeLocalID::Save()
+{
+ char buffer[128];
+ sprintf(buffer, "%d", myValue);
+ return string(buffer);
}
+//=======================================================================
+//function : Load
+//purpose :
+//=======================================================================
+void SALOMEDSImpl_AttributeLocalID::Load(const string& theValue)
+{
+ myValue = atoi(theValue.c_str());
+}
#ifndef _SALOMEDSImpl_AttributeLocalID_HeaderFile
#define _SALOMEDSImpl_AttributeLocalID_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TDF_Label.hxx>
+#include "DF_Attribute.hxx"
+#include <string>
+#include "DF_Label.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Standard_GUID;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeLocalID, SALOMEDSImpl_GenericAttribute )
-
-
-
class SALOMEDSImpl_AttributeLocalID : public SALOMEDSImpl_GenericAttribute
{
private:
-Standard_Integer myValue;
+int myValue;
public:
-Standard_EXPORT virtual TCollection_AsciiString Save() { return TCollection_AsciiString(myValue); }
-Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { myValue = theValue.IntegerValue(); }
+Standard_EXPORT virtual std::string Save();
+Standard_EXPORT virtual void Load(const std::string& theValue);
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDSImpl_AttributeLocalID Set(const TDF_Label& label,const Standard_Integer value) ;
-Standard_EXPORT void SetValue(const Standard_Integer value);
-Standard_EXPORT Standard_Integer Value() const { return myValue; }
+Standard_EXPORT static const std::string& GetID() ;
+Standard_EXPORT static SALOMEDSImpl_AttributeLocalID* Set(const DF_Label& label,const int value) ;
+Standard_EXPORT void SetValue(const int value);
+Standard_EXPORT int Value() const { return myValue; }
Standard_EXPORT SALOMEDSImpl_AttributeLocalID();
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+Standard_EXPORT const std::string& ID() const;
+Standard_EXPORT void Restore(DF_Attribute* with) ;
+Standard_EXPORT DF_Attribute* NewEmpty() const;
+Standard_EXPORT void Paste(DF_Attribute*);
Standard_EXPORT ~SALOMEDSImpl_AttributeLocalID() {}
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeLocalID )
};
#endif
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeName, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeName, SALOMEDSImpl_GenericAttribute )
-
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeName::GetID ()
+const std::string& SALOMEDSImpl_AttributeName::GetID ()
{
- static Standard_GUID NameID ("8650000D-63A0-4651-B621-CC95C9308598");
+ static std::string NameID ("8650000D-63A0-4651-B621-CC95C9308598");
return NameID;
}
-Handle(SALOMEDSImpl_AttributeName) SALOMEDSImpl_AttributeName::Set (const TDF_Label& L,
- const TCollection_ExtendedString& Val)
+SALOMEDSImpl_AttributeName* SALOMEDSImpl_AttributeName::Set (const DF_Label& L,
+ const std::string& Val)
{
- Handle(SALOMEDSImpl_AttributeName) A;
- if (!L.FindAttribute(SALOMEDSImpl_AttributeName::GetID(), A)) {
+ SALOMEDSImpl_AttributeName* A = NULL;
+ if (!(A=(SALOMEDSImpl_AttributeName*)L.FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) {
A = new SALOMEDSImpl_AttributeName();
L.AddAttribute(A);
}
//function : SetValue
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeName::SetValue (const TCollection_ExtendedString& S)
+void SALOMEDSImpl_AttributeName::SetValue (const std::string& S)
{
CheckLocked();
//function : ID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeName::ID () const { return GetID(); }
+const std::string& SALOMEDSImpl_AttributeName::ID () const { return GetID(); }
//=======================================================================
//function : NewEmpty
//purpose :
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeName::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_AttributeName::NewEmpty () const
{
return new SALOMEDSImpl_AttributeName();
}
//function : Restore
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeName::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributeName::Restore(DF_Attribute* with)
{
- myString = Handle(SALOMEDSImpl_AttributeName)::DownCast (with)->Value ();
+ myString = dynamic_cast<SALOMEDSImpl_AttributeName*>(with)->Value ();
}
//=======================================================================
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeName::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT) const
+void SALOMEDSImpl_AttributeName::Paste (DF_Attribute* into)
{
- Handle(SALOMEDSImpl_AttributeName)::DownCast (into)->SetValue(myString);
+ dynamic_cast<SALOMEDSImpl_AttributeName*>(into)->SetValue(myString);
}
#ifndef _SALOMEDSImpl_AttributeName_HeaderFile
#define _SALOMEDSImpl_AttributeName_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_ExtendedString.hxx>
-#include <TDF_Label.hxx>
+#include "DF_Attribute.hxx"
+#include <string>
+#include "DF_Label.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Standard_GUID;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeName, SALOMEDSImpl_GenericAttribute )
-
-
class SALOMEDSImpl_AttributeName : public SALOMEDSImpl_GenericAttribute
{
private:
- TCollection_ExtendedString myString;
+ std::string myString;
public:
-Standard_EXPORT static const Standard_GUID& GetID() ;
+Standard_EXPORT static const std::string& GetID() ;
Standard_EXPORT SALOMEDSImpl_AttributeName():SALOMEDSImpl_GenericAttribute("AttributeName") {}
-Standard_EXPORT static Handle(SALOMEDSImpl_AttributeName) Set (const TDF_Label& L, const TCollection_ExtendedString& Val);
-Standard_EXPORT void SetValue(const TCollection_ExtendedString& theVal);
-Standard_EXPORT TCollection_ExtendedString Value() const { return myString; }
+Standard_EXPORT static SALOMEDSImpl_AttributeName* Set (const DF_Label& L, const std::string& Val);
+Standard_EXPORT void SetValue(const std::string& theVal);
+Standard_EXPORT std::string Value() const { return myString; }
-Standard_EXPORT virtual TCollection_AsciiString Save() { return myString; }
-Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { myString = theValue; }
+Standard_EXPORT virtual std::string Save() { return myString; }
+Standard_EXPORT virtual void Load(const std::string& theValue) { myString = theValue; }
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+Standard_EXPORT const std::string& ID() const;
+Standard_EXPORT void Restore(DF_Attribute* with) ;
+Standard_EXPORT DF_Attribute* NewEmpty() const;
+Standard_EXPORT void Paste(DF_Attribute* into);
Standard_EXPORT ~SALOMEDSImpl_AttributeName() {}
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeName )
};
#endif
#include "SALOMEDSImpl_AttributeOpened.hxx"
-#include <Standard_GUID.hxx>
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeOpened, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeOpened, SALOMEDSImpl_GenericAttribute )
-
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeOpened::GetID ()
+const std::string& SALOMEDSImpl_AttributeOpened::GetID ()
{
- static Standard_GUID SALOMEDSImpl_AttributeOpenedID ("12837186-8F52-11d6-A8A3-0001021E8C7F");
+ static std::string SALOMEDSImpl_AttributeOpenedID ("12837186-8F52-11d6-A8A3-0001021E8C7F");
return SALOMEDSImpl_AttributeOpenedID;
}
//purpose :
//=======================================================================
-Handle(SALOMEDSImpl_AttributeOpened) SALOMEDSImpl_AttributeOpened::Set (const TDF_Label& L,
- const Standard_Integer value)
+SALOMEDSImpl_AttributeOpened* SALOMEDSImpl_AttributeOpened::Set (const DF_Label& L,
+ const int value)
{
- Handle(SALOMEDSImpl_AttributeOpened) A;
- if (!L.FindAttribute(SALOMEDSImpl_AttributeOpened::GetID(),A)) {
+ SALOMEDSImpl_AttributeOpened* A = NULL;
+ if (!(A=(SALOMEDSImpl_AttributeOpened*)L.FindAttribute(SALOMEDSImpl_AttributeOpened::GetID()))) {
A = new SALOMEDSImpl_AttributeOpened();
L.AddAttribute(A);
}
//function : SetOpened
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeOpened::SetOpened(const Standard_Integer theValue)
+void SALOMEDSImpl_AttributeOpened::SetOpened(const int theValue)
{
Backup();
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeOpened::ID () const { return GetID(); }
+const std::string& SALOMEDSImpl_AttributeOpened::ID () const { return GetID(); }
//=======================================================================
//purpose :
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeOpened::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_AttributeOpened::NewEmpty () const
{
return new SALOMEDSImpl_AttributeOpened();
}
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeOpened::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributeOpened::Restore(DF_Attribute* with)
{
- myValue = Handle(SALOMEDSImpl_AttributeOpened)::DownCast (with)->IsOpened ();
+ myValue = dynamic_cast<SALOMEDSImpl_AttributeOpened*>(with)->IsOpened ();
}
//=======================================================================
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeOpened::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT) const
+void SALOMEDSImpl_AttributeOpened::Paste (DF_Attribute* into)
{
- Handle(SALOMEDSImpl_AttributeOpened)::DownCast (into)->SetOpened (myValue);
+ dynamic_cast<SALOMEDSImpl_AttributeOpened*>(into)->SetOpened (myValue);
}
#ifndef _SALOMEDSImpl_AttributeOpened_HeaderFile
#define _SALOMEDSImpl_AttributeOpened_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TDF_Label.hxx>
+#include "DF_Attribute.hxx"
+#include <string>
+#include "DF_Label.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Standard_GUID;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeOpened, SALOMEDSImpl_GenericAttribute )
-
class SALOMEDSImpl_AttributeOpened : public SALOMEDSImpl_GenericAttribute
{
private:
-Standard_Integer myValue;
+int myValue;
public:
-Standard_EXPORT virtual TCollection_AsciiString Save() { return (myValue == 0)?(char*)"0":(char*)"1"; }
-Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { (theValue == "0")?myValue=0:myValue=1; }
+Standard_EXPORT virtual std::string Save() { return (myValue == 0)?(char*)"0":(char*)"1"; }
+Standard_EXPORT virtual void Load(const std::string& theValue) { (theValue == "0")?myValue=0:myValue=1; }
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDSImpl_AttributeOpened Set(const TDF_Label& label,const Standard_Integer value) ;
+Standard_EXPORT static const std::string& GetID() ;
+Standard_EXPORT static SALOMEDSImpl_AttributeOpened* Set(const DF_Label& label,const int value) ;
Standard_EXPORT SALOMEDSImpl_AttributeOpened();
-Standard_EXPORT void SetOpened(const Standard_Integer value);
+Standard_EXPORT void SetOpened(const int value);
Standard_EXPORT int IsOpened() const { return myValue; }
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+Standard_EXPORT const std::string& ID() const;
+Standard_EXPORT void Restore(DF_Attribute* with) ;
+Standard_EXPORT DF_Attribute* NewEmpty() const;
+Standard_EXPORT void Paste(DF_Attribute* into);
Standard_EXPORT ~SALOMEDSImpl_AttributeOpened() {}
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeOpened )
};
#endif
#include "SALOMEDSImpl_AttributeParameter.hxx"
-#include <Standard_Failure.hxx>
#include <stdio.h>
#include <stdlib.h>
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeParameter, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeParameter, SALOMEDSImpl_GenericAttribute )
-
-
// Purpose: Each character in the string is replaced by 3 characters: '%' and hex number
// of the character (2 characters)
string convertString(const string& S)
* Purpose : Returns GUID of the attribute
*/
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeParameter::GetID ()
+const std::string& SALOMEDSImpl_AttributeParameter::GetID ()
{
- static Standard_GUID ParemeterID ("BA75F3A1-E40B-46b8-8D24-B1D3C3BB1A8C");
+ static std::string ParemeterID ("BA75F3A1-E40B-46b8-8D24-B1D3C3BB1A8C");
return ParemeterID;
}
* Purpose : Adds an attribute to the label
*/
//=======================================================================
-Handle(SALOMEDSImpl_AttributeParameter) SALOMEDSImpl_AttributeParameter::Set (const TDF_Label& L)
+SALOMEDSImpl_AttributeParameter* SALOMEDSImpl_AttributeParameter::Set (const DF_Label& L)
{
- Handle(SALOMEDSImpl_AttributeParameter) A;
- if (!L.FindAttribute(SALOMEDSImpl_AttributeParameter::GetID(), A)) {
+ SALOMEDSImpl_AttributeParameter* A = NULL;
+ if (!(A=(SALOMEDSImpl_AttributeParameter*)L.FindAttribute(SALOMEDSImpl_AttributeParameter::GetID()))) {
A = new SALOMEDSImpl_AttributeParameter();
L.AddAttribute(A);
}
//=======================================================================
int SALOMEDSImpl_AttributeParameter::GetInt(const string& theID)
{
- if(!IsSet(theID, PT_INTEGER)) Standard_Failure::Raise("Invalid ID");
+ if(!IsSet(theID, PT_INTEGER)) throw DFexception("Invalid ID");
return _ints[theID];
}
//=======================================================================
double SALOMEDSImpl_AttributeParameter::GetReal(const string& theID)
{
- if(!IsSet(theID, PT_REAL)) Standard_Failure::Raise("Invalid ID");
+ if(!IsSet(theID, PT_REAL)) throw DFexception("Invalid ID");
return _reals[theID];
}
//=======================================================================
string SALOMEDSImpl_AttributeParameter::GetString(const string& theID)
{
- if(!IsSet(theID, PT_STRING)) Standard_Failure::Raise("Invalid ID");
+ if(!IsSet(theID, PT_STRING)) throw DFexception("Invalid ID");
return _strings[theID];
}
//=======================================================================
bool SALOMEDSImpl_AttributeParameter::GetBool(const string& theID)
{
- if(!IsSet(theID, PT_BOOLEAN)) Standard_Failure::Raise("Invalid ID");
+ if(!IsSet(theID, PT_BOOLEAN)) throw DFexception("Invalid ID");
return _bools[theID];
}
//=======================================================================
vector<double> SALOMEDSImpl_AttributeParameter::GetRealArray(const string& theID)
{
- if(!IsSet(theID, PT_REALARRAY)) Standard_Failure::Raise("Invalid ID");
+ if(!IsSet(theID, PT_REALARRAY)) throw DFexception("Invalid ID");
return _realarrays[theID];
}
//=======================================================================
vector<int> SALOMEDSImpl_AttributeParameter::GetIntArray(const string& theID)
{
- if(!IsSet(theID, PT_INTARRAY)) Standard_Failure::Raise("Invalid ID");
+ if(!IsSet(theID, PT_INTARRAY)) throw DFexception("Invalid ID");
return _intarrays[theID];
}
//=======================================================================
vector<string> SALOMEDSImpl_AttributeParameter::GetStrArray(const string& theID)
{
- if(!IsSet(theID, PT_STRARRAY)) Standard_Failure::Raise("Invalid ID");
+ if(!IsSet(theID, PT_STRARRAY)) throw DFexception("Invalid ID");
return _strarrays[theID];
}
* Purpose : Returns a father attribute for this attribute
*/
//=======================================================================
-Handle(SALOMEDSImpl_AttributeParameter) SALOMEDSImpl_AttributeParameter::GetFather()
+SALOMEDSImpl_AttributeParameter* SALOMEDSImpl_AttributeParameter::GetFather()
{
- Handle(SALOMEDSImpl_AttributeParameter) aFather;
- TDF_Label L = Label();
+ SALOMEDSImpl_AttributeParameter* aFather;
+ DF_Label L = Label();
if(L.IsRoot()) return aFather;
while(!L.IsRoot()) {
L = L.Father();
- if(L.FindAttribute(SALOMEDSImpl_AttributeParameter::GetID(), aFather)) break;
+ if((aFather=(SALOMEDSImpl_AttributeParameter*)L.FindAttribute(SALOMEDSImpl_AttributeParameter::GetID()))) break;
}
return aFather;
//=======================================================================
bool SALOMEDSImpl_AttributeParameter::HasFather()
{
- TDF_Label L = Label();
+ DF_Label L = Label();
if(L.IsRoot()) return false;
while(!L.IsRoot()) {
L = L.Father();
* Purpose : Rteurns an GUID of the attribute
*/
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeParameter::ID () const { return GetID(); }
+const std::string& SALOMEDSImpl_AttributeParameter::ID () const { return GetID(); }
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeParameter::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_AttributeParameter::NewEmpty () const
{
return new SALOMEDSImpl_AttributeParameter();
}
* Purpose : Restors the content of the attribute from another
*/
//=======================================================================
-void SALOMEDSImpl_AttributeParameter::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributeParameter::Restore(DF_Attribute* with)
{
- Handle(SALOMEDSImpl_AttributeParameter) A = Handle(SALOMEDSImpl_AttributeParameter)::DownCast (with);
+ SALOMEDSImpl_AttributeParameter* A = dynamic_cast<SALOMEDSImpl_AttributeParameter*>(with);
_ints.clear();
_reals.clear();
_bools.clear();
* Purpose : Pastes the content of attribute to another
*/
//=======================================================================
-void SALOMEDSImpl_AttributeParameter::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT) const
+void SALOMEDSImpl_AttributeParameter::Paste (DF_Attribute* into)
{
into->Restore(this);
}
* Purpose : Saves a content of the attribute as a string
*/
//=======================================================================
-TCollection_AsciiString SALOMEDSImpl_AttributeParameter::Save()
+string SALOMEDSImpl_AttributeParameter::Save()
{
ostrstream buffer;
char *tmpBuffer = new char[255];
delete tmpBuffer;
- TCollection_AsciiString AS((char*)buffer.rdbuf()->str());
+ string AS((char*)buffer.rdbuf()->str());
return AS;
}
* Purpose : Restores the attribute from the string
*/
//=======================================================================
-void SALOMEDSImpl_AttributeParameter::Load(const TCollection_AsciiString& theValue)
+void SALOMEDSImpl_AttributeParameter::Load(const string& theValue)
{
Backup();
_realarrays.clear();
_intarrays.clear();
- istrstream buffer(theValue.ToCString(), strlen(theValue.ToCString()));
+ istrstream buffer(theValue.c_str(), theValue.size());
int size, val, ival;
double val2;
#ifndef _SALOMEDSImpl_AttributeParameter_HeaderFile
#define _SALOMEDSImpl_AttributeParameter_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_ExtendedString.hxx>
-#include <TDF_Label.hxx>
+#include "DF_Attribute.hxx"
+#include "DF_Label.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
#include <vector>
#include <string>
#include <map>
-class Standard_GUID;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeParameter, SALOMEDSImpl_GenericAttribute )
-
enum Parameter_Types {PT_INTEGER, PT_REAL, PT_BOOLEAN, PT_STRING, PT_REALARRAY, PT_INTARRAY, PT_STRARRAY};
/*!
private:
- std::map<std::string, int> _ints;
- std::map<std::string, double> _reals;
- std::map<std::string, std::string> _strings;
- std::map<std::string, bool> _bools;
- std::map< std::string, vector<double> > _realarrays;
- std::map< std::string, vector<int> > _intarrays;
- std::map< std::string, vector<std::string> > _strarrays;
+ std::map<std::string, int> _ints;
+ std::map<std::string, double> _reals;
+ std::map<std::string, std::string> _strings;
+ std::map<std::string, bool> _bools;
+ std::map< std::string, std::vector<double> > _realarrays;
+ std::map< std::string, std::vector<int> > _intarrays;
+ std::map< std::string, std::vector<std::string> > _strarrays;
public:
- Standard_EXPORT static const Standard_GUID& GetID() ;
+ Standard_EXPORT static const std::string& GetID() ;
Standard_EXPORT SALOMEDSImpl_AttributeParameter():SALOMEDSImpl_GenericAttribute("AttributeParameter") {}
- Standard_EXPORT static Handle(SALOMEDSImpl_AttributeParameter) Set (const TDF_Label& L);
+ Standard_EXPORT static SALOMEDSImpl_AttributeParameter* Set (const DF_Label& L);
Standard_EXPORT void SetInt(const std::string& theID, const int& theValue);
Standard_EXPORT bool RemoveID(const std::string& theID, const Parameter_Types theType);
- Standard_EXPORT Handle(SALOMEDSImpl_AttributeParameter) GetFather();
+ Standard_EXPORT SALOMEDSImpl_AttributeParameter* GetFather();
Standard_EXPORT bool HasFather();
Standard_EXPORT bool IsRoot();
Standard_EXPORT void Clear();
- Standard_EXPORT virtual TCollection_AsciiString Save();
- Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue);
+ Standard_EXPORT virtual std::string Save();
+ Standard_EXPORT virtual void Load(const std::string& theValue);
- Standard_EXPORT const Standard_GUID& ID() const;
- Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
- Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
- Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+ Standard_EXPORT const std::string& ID() const;
+ Standard_EXPORT void Restore(DF_Attribute* with) ;
+ Standard_EXPORT DF_Attribute* NewEmpty() const;
+ Standard_EXPORT void Paste(DF_Attribute* into);
Standard_EXPORT ~SALOMEDSImpl_AttributeParameter() {}
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeParameter )
};
#endif
#include "SALOMEDSImpl_AttributePersistentRef.hxx"
-#include <Standard_GUID.hxx>
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributePersistentRef, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributePersistentRef, SALOMEDSImpl_GenericAttribute )
-
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributePersistentRef::GetID ()
+const std::string& SALOMEDSImpl_AttributePersistentRef::GetID ()
{
- static Standard_GUID SALOMEDSImpl_AttributePersistentRefID ("92888E06-7074-11d5-A690-0800369C8A03");
+ static std::string SALOMEDSImpl_AttributePersistentRefID ("92888E06-7074-11d5-A690-0800369C8A03");
return SALOMEDSImpl_AttributePersistentRefID;
}
//purpose :
//=======================================================================
-Handle(SALOMEDSImpl_AttributePersistentRef) SALOMEDSImpl_AttributePersistentRef::Set (const TDF_Label& L,
- const TCollection_ExtendedString& S)
+SALOMEDSImpl_AttributePersistentRef* SALOMEDSImpl_AttributePersistentRef::Set (const DF_Label& L,
+ const std::string& S)
{
- Handle(SALOMEDSImpl_AttributePersistentRef) A;
- if (!L.FindAttribute(SALOMEDSImpl_AttributePersistentRef::GetID(),A)) {
+ SALOMEDSImpl_AttributePersistentRef* A = NULL;
+ if (!(A=(SALOMEDSImpl_AttributePersistentRef*)L.FindAttribute(SALOMEDSImpl_AttributePersistentRef::GetID()))) {
A = new SALOMEDSImpl_AttributePersistentRef();
L.AddAttribute(A);
}
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributePersistentRef::ID () const { return GetID(); }
+const std::string& SALOMEDSImpl_AttributePersistentRef::ID () const { return GetID(); }
//=======================================================================
//function : SetValue
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributePersistentRef::SetValue (const TCollection_ExtendedString& S)
+void SALOMEDSImpl_AttributePersistentRef::SetValue (const std::string& S)
{
CheckLocked();
//purpose :
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributePersistentRef::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_AttributePersistentRef::NewEmpty () const
{
return new SALOMEDSImpl_AttributePersistentRef();
}
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributePersistentRef::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributePersistentRef::Restore(DF_Attribute* with)
{
- myString = Handle(SALOMEDSImpl_AttributePersistentRef)::DownCast (with)->Value ();
+ myString = dynamic_cast<SALOMEDSImpl_AttributePersistentRef*>(with)->Value ();
}
//=======================================================================
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributePersistentRef::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT) const
+void SALOMEDSImpl_AttributePersistentRef::Paste (DF_Attribute* into)
{
- Handle(SALOMEDSImpl_AttributePersistentRef)::DownCast (into)->SetValue(myString);
+ dynamic_cast<SALOMEDSImpl_AttributePersistentRef*>(into)->SetValue(myString);
}
#ifndef _SALOMEDSImpl_AttributePersistentRef_HeaderFile
#define _SALOMEDSImpl_AttributePersistentRef_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_ExtendedString.hxx>
-#include <TDF_Label.hxx>
+#include "DF_Attribute.hxx"
+#include <string>
+#include "DF_Label.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Standard_GUID;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributePersistentRef, SALOMEDSImpl_GenericAttribute )
class SALOMEDSImpl_AttributePersistentRef : public SALOMEDSImpl_GenericAttribute
{
private:
- TCollection_ExtendedString myString;
+ std::string myString;
public:
-Standard_EXPORT virtual TCollection_AsciiString Save() { return myString; }
-Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { myString = theValue; }
+Standard_EXPORT virtual std::string Save() { return myString; }
+Standard_EXPORT virtual void Load(const std::string& theValue) { myString = theValue; }
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDSImpl_AttributePersistentRef Set(const TDF_Label& label,
- const TCollection_ExtendedString& string) ;
+Standard_EXPORT static const std::string& GetID() ;
+Standard_EXPORT static SALOMEDSImpl_AttributePersistentRef* Set(const DF_Label& label,
+ const std::string& value) ;
Standard_EXPORT SALOMEDSImpl_AttributePersistentRef();
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void SetValue(const TCollection_ExtendedString& value);
-Standard_EXPORT TCollection_ExtendedString Value() const { return myString; }
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+Standard_EXPORT const std::string& ID() const;
+Standard_EXPORT void SetValue(const std::string& value);
+Standard_EXPORT std::string Value() const { return myString; }
+Standard_EXPORT void Restore(DF_Attribute* with) ;
+Standard_EXPORT DF_Attribute* NewEmpty() const;
+Standard_EXPORT void Paste(DF_Attribute* into);
Standard_EXPORT ~SALOMEDSImpl_AttributePersistentRef() {}
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributePersistentRef )
};
#endif
// Module : SALOME
#include "SALOMEDSImpl_AttributePixMap.hxx"
-#include <TCollection_ExtendedString.hxx>
-#include <Standard_GUID.hxx>
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributePixMap, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributePixMap, SALOMEDSImpl_GenericAttribute )
-
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributePixMap::GetID ()
+const std::string& SALOMEDSImpl_AttributePixMap::GetID ()
{
- static Standard_GUID SALOMEDSImpl_AttributePixMapID ("12837187-8F52-11d6-A8A3-0001021E8C7F");
+ static std::string SALOMEDSImpl_AttributePixMapID ("12837187-8F52-11d6-A8A3-0001021E8C7F");
return SALOMEDSImpl_AttributePixMapID;
}
//purpose :
//=======================================================================
-Handle(SALOMEDSImpl_AttributePixMap) SALOMEDSImpl_AttributePixMap::Set (const TDF_Label& L,
- const TCollection_ExtendedString& S)
+SALOMEDSImpl_AttributePixMap* SALOMEDSImpl_AttributePixMap::Set (const DF_Label& L,
+ const std::string& S)
{
- Handle(SALOMEDSImpl_AttributePixMap) A;
- if (!L.FindAttribute(SALOMEDSImpl_AttributePixMap::GetID(),A)) {
+ SALOMEDSImpl_AttributePixMap* A = NULL;
+ if (!(A=(SALOMEDSImpl_AttributePixMap*)L.FindAttribute(SALOMEDSImpl_AttributePixMap::GetID()))) {
A = new SALOMEDSImpl_AttributePixMap();
L.AddAttribute(A);
}
//function : SetPixMap
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributePixMap::SetPixMap (const TCollection_ExtendedString& S)
+void SALOMEDSImpl_AttributePixMap::SetPixMap (const std::string& S)
{
CheckLocked();
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributePixMap::ID () const { return GetID(); }
+const std::string& SALOMEDSImpl_AttributePixMap::ID () const { return GetID(); }
//=======================================================================
//purpose :
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributePixMap::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_AttributePixMap::NewEmpty () const
{
return new SALOMEDSImpl_AttributePixMap();
}
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributePixMap::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributePixMap::Restore(DF_Attribute* with)
{
- myString = Handle(SALOMEDSImpl_AttributePixMap)::DownCast (with)->GetPixMap ();
+ myString = dynamic_cast<SALOMEDSImpl_AttributePixMap*>(with)->GetPixMap ();
}
//=======================================================================
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributePixMap::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT) const
+void SALOMEDSImpl_AttributePixMap::Paste (DF_Attribute* into)
{
- Handle(SALOMEDSImpl_AttributePixMap)::DownCast (into)->SetPixMap (myString);
+ dynamic_cast<SALOMEDSImpl_AttributePixMap*>(into)->SetPixMap (myString);
}
#ifndef _SALOMEDSImpl_AttributePixMap_HeaderFile
#define _SALOMEDSImpl_AttributePixMap_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_ExtendedString.hxx>
-#include <TDF_Label.hxx>
+#include "DF_Attribute.hxx"
+#include <string>
+#include "DF_Label.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Standard_GUID;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributePixMap, SALOMEDSImpl_GenericAttribute )
-
-
-
class SALOMEDSImpl_AttributePixMap : public SALOMEDSImpl_GenericAttribute
{
private:
- TCollection_ExtendedString myString;
+ std::string myString;
public:
-Standard_EXPORT virtual TCollection_AsciiString Save() { return myString; }
-Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { myString = theValue; }
+Standard_EXPORT virtual std::string Save() { return myString; }
+Standard_EXPORT virtual void Load(const std::string& theValue) { myString = theValue; }
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDSImpl_AttributePixMap Set(const TDF_Label& label,
- const TCollection_ExtendedString& string) ;
+Standard_EXPORT static const std::string& GetID() ;
+Standard_EXPORT static SALOMEDSImpl_AttributePixMap* Set(const DF_Label& label,
+ const std::string& string) ;
Standard_EXPORT SALOMEDSImpl_AttributePixMap();
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void SetPixMap(const TCollection_ExtendedString& value);
-Standard_EXPORT TCollection_ExtendedString GetPixMap() const { return myString; }
-Standard_EXPORT Standard_Boolean HasPixMap() const { return (myString != "None"); }
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+Standard_EXPORT const std::string& ID() const;
+Standard_EXPORT void SetPixMap(const std::string& value);
+Standard_EXPORT std::string GetPixMap() const { return myString; }
+Standard_EXPORT bool HasPixMap() const { return (myString != "None"); }
+Standard_EXPORT void Restore(DF_Attribute* with) ;
+Standard_EXPORT DF_Attribute* NewEmpty() const;
+Standard_EXPORT void Paste(DF_Attribute* into);
Standard_EXPORT ~SALOMEDSImpl_AttributePixMap() {}
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributePixMap )
};
#endif
// Module : SALOME
#include "SALOMEDSImpl_AttributePythonObject.hxx"
-#include <Standard_GUID.hxx>
-#include <string>
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributePythonObject, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributePythonObject, SALOMEDSImpl_GenericAttribute )
-
-const Standard_GUID& SALOMEDSImpl_AttributePythonObject::GetID()
+const std::string& SALOMEDSImpl_AttributePythonObject::GetID()
{
- static Standard_GUID SALOMEDSImpl_AttributePythonObjectID ("128371A3-8F52-11d6-A8A3-0001021E8C7F");
+ static std::string SALOMEDSImpl_AttributePythonObjectID ("128371A3-8F52-11d6-A8A3-0001021E8C7F");
return SALOMEDSImpl_AttributePythonObjectID;
}
-Handle(SALOMEDSImpl_AttributePythonObject) SALOMEDSImpl_AttributePythonObject::Set(const TDF_Label& label)
+SALOMEDSImpl_AttributePythonObject* SALOMEDSImpl_AttributePythonObject::Set(const DF_Label& label)
{
- Handle(SALOMEDSImpl_AttributePythonObject) anAttr;
- if (!label.FindAttribute(SALOMEDSImpl_AttributePythonObject::GetID(),anAttr)) {
- anAttr = new SALOMEDSImpl_AttributePythonObject();
- label.AddAttribute(anAttr);
+ SALOMEDSImpl_AttributePythonObject* A = NULL;
+ if (!(A = (SALOMEDSImpl_AttributePythonObject*)label.FindAttribute(SALOMEDSImpl_AttributePythonObject::GetID()))) {
+ A = new SALOMEDSImpl_AttributePythonObject();
+ label.AddAttribute(A);
}
- return anAttr;
+ return A;
}
SALOMEDSImpl_AttributePythonObject::SALOMEDSImpl_AttributePythonObject()
:SALOMEDSImpl_GenericAttribute("AttributePythonObject")
{
+ myIsScript = false;
}
-void SALOMEDSImpl_AttributePythonObject::SetObject(const TCollection_AsciiString& theSequence,
+void SALOMEDSImpl_AttributePythonObject::SetObject(const string& theSequence,
const bool theScript)
{
CheckLocked();
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-TCollection_AsciiString SALOMEDSImpl_AttributePythonObject::GetObject() const
+string SALOMEDSImpl_AttributePythonObject::GetObject() const
{
return mySequence;
}
int SALOMEDSImpl_AttributePythonObject::GetLength() const
{
- return mySequence.Length();
+ return mySequence.size();
}
-const Standard_GUID& SALOMEDSImpl_AttributePythonObject::ID() const
+const std::string& SALOMEDSImpl_AttributePythonObject::ID() const
{
return GetID();
}
-void SALOMEDSImpl_AttributePythonObject::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributePythonObject::Restore(DF_Attribute* with)
{
- Handle(SALOMEDSImpl_AttributePythonObject) anObj = Handle(SALOMEDSImpl_AttributePythonObject)::DownCast(with);
+ SALOMEDSImpl_AttributePythonObject* anObj = dynamic_cast<SALOMEDSImpl_AttributePythonObject*>(with);
SetObject(anObj->GetObject(),anObj->IsScript());
}
-Handle(TDF_Attribute) SALOMEDSImpl_AttributePythonObject::NewEmpty() const
+DF_Attribute* SALOMEDSImpl_AttributePythonObject::NewEmpty() const
{
return new SALOMEDSImpl_AttributePythonObject();
}
-void SALOMEDSImpl_AttributePythonObject::Paste(const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)&) const
+void SALOMEDSImpl_AttributePythonObject::Paste(DF_Attribute* into)
{
- Handle(SALOMEDSImpl_AttributePythonObject) anObj = Handle(SALOMEDSImpl_AttributePythonObject)::DownCast(into);
+ SALOMEDSImpl_AttributePythonObject* anObj = dynamic_cast<SALOMEDSImpl_AttributePythonObject*>(into);
anObj->SetObject(GetObject(),IsScript());
}
-TCollection_AsciiString SALOMEDSImpl_AttributePythonObject::Save()
+string SALOMEDSImpl_AttributePythonObject::Save()
{
- TCollection_AsciiString aString = GetObject();
- TCollection_AsciiString aResult = IsScript()?'s':'n';
+ string aString = GetObject();
+ string aResult = IsScript()?"s":"n";
aResult += aString;
return aResult;
}
-void SALOMEDSImpl_AttributePythonObject::Load(const TCollection_AsciiString& value)
+void SALOMEDSImpl_AttributePythonObject::Load(const string& value)
{
- char* aString = value.ToCString();
+ char* aString = (char*)value.c_str();
SetObject(aString + 1, aString[0]=='s');
}
#ifndef _SALOMEDSImpl_AttributePythonObject_HeaderFile
#define _SALOMEDSImpl_AttributePythonObject_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <Standard.hxx>
-#include <TDF_Attribute.hxx>
-#include <TDF_Label.hxx>
-#include <TCollection_AsciiString.hxx>
+#include "DF_Attribute.hxx"
+#include "DF_Label.hxx"
+#include <string>
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Standard_GUID;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributePythonObject, SALOMEDSImpl_GenericAttribute )
-
#ifdef GetObject
#undef GetObject
#endif
{
public:
-Standard_EXPORT virtual TCollection_AsciiString Save();
-Standard_EXPORT virtual void Load(const TCollection_AsciiString&);
+Standard_EXPORT virtual std::string Save();
+Standard_EXPORT virtual void Load(const std::string&);
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDSImpl_AttributePythonObject Set(const TDF_Label& label) ;
+Standard_EXPORT static const std::string& GetID() ;
+Standard_EXPORT static SALOMEDSImpl_AttributePythonObject* Set(const DF_Label& label) ;
Standard_EXPORT SALOMEDSImpl_AttributePythonObject();
-Standard_EXPORT void SetObject(const TCollection_AsciiString& theSequence, const bool theScript) ;
-Standard_EXPORT TCollection_AsciiString GetObject() const;
+Standard_EXPORT void SetObject(const std::string& theSequence, const bool theScript) ;
+Standard_EXPORT std::string GetObject() const;
Standard_EXPORT bool IsScript() const;
Standard_EXPORT int GetLength() const;
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+Standard_EXPORT const std::string& ID() const;
+Standard_EXPORT void Restore(DF_Attribute* with) ;
+Standard_EXPORT DF_Attribute* NewEmpty() const;
+Standard_EXPORT void Paste(DF_Attribute* into);
Standard_EXPORT ~SALOMEDSImpl_AttributePythonObject() {}
private:
-TCollection_AsciiString mySequence;
+std::string mySequence;
bool myIsScript;
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributePythonObject )
-
};
#endif
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeReal, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeReal, SALOMEDSImpl_GenericAttribute )
+#include <stdlib.h>
+
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeReal::GetID ()
+const std::string& SALOMEDSImpl_AttributeReal::GetID ()
{
- static Standard_GUID realID ("1D1992F0-56F4-46b4-8065-CDEA68061CAB");
+ static std::string realID ("1D1992F0-56F4-46b4-8065-CDEA68061CAB");
return realID;
}
-Handle(SALOMEDSImpl_AttributeReal) SALOMEDSImpl_AttributeReal::Set (const TDF_Label& L, const Standard_Real Val)
+SALOMEDSImpl_AttributeReal* SALOMEDSImpl_AttributeReal::Set (const DF_Label& L, const double& Val)
{
- Handle(SALOMEDSImpl_AttributeReal) A;
- if (!L.FindAttribute(SALOMEDSImpl_AttributeReal::GetID(), A)) {
+ SALOMEDSImpl_AttributeReal* A = NULL;
+ if (!(A=(SALOMEDSImpl_AttributeReal*)L.FindAttribute(SALOMEDSImpl_AttributeReal::GetID()))) {
A = new SALOMEDSImpl_AttributeReal();
L.AddAttribute(A);
}
//function : SetValue
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeReal::SetValue(const Standard_Real v)
+void SALOMEDSImpl_AttributeReal::SetValue(const double& v)
{
CheckLocked();
//function : ID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeReal::ID () const
+const std::string& SALOMEDSImpl_AttributeReal::ID () const
{
return GetID();
}
//function : NewEmpty
//purpose :
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeReal::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_AttributeReal::NewEmpty () const
{
return new SALOMEDSImpl_AttributeReal();
}
//function : Restore
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeReal::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributeReal::Restore(DF_Attribute* with)
{
- myValue = Handle(SALOMEDSImpl_AttributeReal)::DownCast (with)->Value ();
+ myValue = dynamic_cast<SALOMEDSImpl_AttributeReal*>(with)->Value ();
}
//=======================================================================
//function : Paste
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeReal::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT) const
+void SALOMEDSImpl_AttributeReal::Paste (DF_Attribute* into)
+{
+ dynamic_cast<SALOMEDSImpl_AttributeReal*>(into)->SetValue(myValue);
+}
+
+//=======================================================================
+//function : Save
+//purpose :
+//=======================================================================
+string SALOMEDSImpl_AttributeReal::Save()
+{
+ char buffer[255];
+ sprintf(buffer, "%.64e", myValue);
+ return string(buffer);
+}
+
+//=======================================================================
+//function : Load
+//purpose :
+//=======================================================================
+void SALOMEDSImpl_AttributeReal::Load(const string& theValue)
{
- Handle(SALOMEDSImpl_AttributeReal)::DownCast (into)->SetValue(myValue);
+ myValue = atof(theValue.c_str());
}
#ifndef _SALOMEDSImpl_AttributeReal_HeaderFile
#define _SALOMEDSImpl_AttributeReal_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TDF_Label.hxx>
+#include "DF_Attribute.hxx"
+#include <string>
+#include "DF_Label.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Standard_GUID;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeReal, SALOMEDSImpl_GenericAttribute )
-
-
class SALOMEDSImpl_AttributeReal : public SALOMEDSImpl_GenericAttribute
{
private:
- Standard_Real myValue;
+ double myValue;
public:
-Standard_EXPORT static const Standard_GUID& GetID() ;
+Standard_EXPORT static const std::string& GetID() ;
Standard_EXPORT SALOMEDSImpl_AttributeReal():SALOMEDSImpl_GenericAttribute("AttributeReal") {}
-Standard_EXPORT static Handle(SALOMEDSImpl_AttributeReal) Set (const TDF_Label& L, const Standard_Real Val);
-Standard_EXPORT void SetValue(const Standard_Real theVal);
-Standard_EXPORT Standard_Real Value() const { return myValue; }
-Standard_EXPORT virtual TCollection_AsciiString Save() { return TCollection_AsciiString(myValue); }
-Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { myValue = theValue.RealValue(); }
-
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+Standard_EXPORT static SALOMEDSImpl_AttributeReal* Set (const DF_Label& L, const double& Val);
+Standard_EXPORT void SetValue(const double& theVal);
+Standard_EXPORT double Value() const { return myValue; }
+Standard_EXPORT virtual std::string Save();
+Standard_EXPORT virtual void Load(const std::string& theValue);
+
+Standard_EXPORT const std::string& ID() const;
+Standard_EXPORT void Restore(DF_Attribute* with) ;
+Standard_EXPORT DF_Attribute* NewEmpty() const;
+Standard_EXPORT void Paste(DF_Attribute* into);
Standard_EXPORT ~SALOMEDSImpl_AttributeReal() {}
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeReal )
-
};
#endif
// Module : SALOME
#include "SALOMEDSImpl_AttributeReference.hxx"
-#include <TDF_Tool.hxx>
-#include <TDF_Data.hxx>
-#include <TDF_RelocationTable.hxx>
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeReference, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeReference, SALOMEDSImpl_GenericAttribute )
-
-
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeReference::GetID ()
+const std::string& SALOMEDSImpl_AttributeReference::GetID ()
{
- static Standard_GUID refID ("D913E0B3-0A9F-4ea6-9480-18A9B72D9D86");
+ static std::string refID ("D913E0B3-0A9F-4ea6-9480-18A9B72D9D86");
return refID;
}
-Handle(SALOMEDSImpl_AttributeReference) SALOMEDSImpl_AttributeReference::Set(const TDF_Label& theLabel,
- const TDF_Label& theRefLabel)
+SALOMEDSImpl_AttributeReference* SALOMEDSImpl_AttributeReference::Set(const DF_Label& theLabel,
+ const DF_Label& theRefLabel)
{
- Handle(SALOMEDSImpl_AttributeReference) A;
- if (!theLabel.FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), A)) {
+ SALOMEDSImpl_AttributeReference* A = NULL;
+ if (!(A=(SALOMEDSImpl_AttributeReference*)theLabel.FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) {
A = new SALOMEDSImpl_AttributeReference();
theLabel.AddAttribute(A);
}
//function : Set
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeReference::Set(const TDF_Label& Origin)
+void SALOMEDSImpl_AttributeReference::Set(const DF_Label& Origin)
{
CheckLocked();
//function : ID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeReference::ID () const { return GetID(); }
+const std::string& SALOMEDSImpl_AttributeReference::ID () const { return GetID(); }
-TCollection_AsciiString SALOMEDSImpl_AttributeReference::Save()
+string SALOMEDSImpl_AttributeReference::Save()
{
- TCollection_AsciiString anEntry;
- TDF_Tool::Entry(myLabel, anEntry);
- return anEntry;
+ return myLabel.Entry();
}
-void SALOMEDSImpl_AttributeReference::Load(const TCollection_AsciiString& value)
+void SALOMEDSImpl_AttributeReference::Load(const string& value)
{
- TDF_Label aLabel;
- TDF_Tool::Label(Label().Data(), value, aLabel);
- myLabel = aLabel;
+ myLabel = DF_Label::Label(Label(), value, true);
}
//=======================================================================
//function : NewEmpty
//purpose :
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeReference::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_AttributeReference::NewEmpty () const
{
return new SALOMEDSImpl_AttributeReference();
}
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeReference::Restore(const Handle(TDF_Attribute)& With)
+void SALOMEDSImpl_AttributeReference::Restore(DF_Attribute* With)
{
- myLabel = Handle(SALOMEDSImpl_AttributeReference)::DownCast (With)->Get ();
+ myLabel = dynamic_cast<SALOMEDSImpl_AttributeReference*>(With)->Get ();
}
//=======================================================================
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeReference::Paste (const Handle(TDF_Attribute)& Into,
- const Handle(TDF_RelocationTable)& RT) const
+void SALOMEDSImpl_AttributeReference::Paste (DF_Attribute* Into)
{
- TDF_Label tLab;
- if (!myLabel.IsNull()) {
- if (!RT->HasRelocation(myLabel,tLab)) tLab = myLabel;
- }
- Handle(SALOMEDSImpl_AttributeReference)::DownCast(Into)->Set(tLab);
+ dynamic_cast<SALOMEDSImpl_AttributeReference*>(Into)->Set(myLabel);
}
#ifndef _SALOMEDSImpl_AttributeReference_HeaderFile
#define _SALOMEDSImpl_AttributeReference_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TDF_Label.hxx>
-#include <TCollection_AsciiString.hxx>
+#include "DF_Attribute.hxx"
+#include "DF_Label.hxx"
+#include <string>
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Standard_GUID;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeReference, SALOMEDSImpl_GenericAttribute )
-
-
-
class SALOMEDSImpl_AttributeReference : public SALOMEDSImpl_GenericAttribute
{
private:
- TDF_Label myLabel;
+ DF_Label myLabel;
public:
-Standard_EXPORT static const Standard_GUID& GetID() ;
+Standard_EXPORT static const std::string& GetID() ;
Standard_EXPORT SALOMEDSImpl_AttributeReference():SALOMEDSImpl_GenericAttribute("AttributeReference") {}
-Standard_EXPORT static Handle(SALOMEDSImpl_AttributeReference) Set(const TDF_Label& theLabel, const TDF_Label& theRefLabel);
-Standard_EXPORT void Set(const TDF_Label& theLabel);
-Standard_EXPORT TDF_Label Get() const { return myLabel; }
-Standard_EXPORT virtual TCollection_AsciiString Save();
-Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue);
+Standard_EXPORT static SALOMEDSImpl_AttributeReference* Set(const DF_Label& theLabel, const DF_Label& theRefLabel);
+Standard_EXPORT void Set(const DF_Label& theLabel);
+Standard_EXPORT DF_Label Get() const { return myLabel; }
+Standard_EXPORT virtual std::string Save();
+Standard_EXPORT virtual void Load(const std::string& theValue);
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+Standard_EXPORT const std::string& ID() const;
+Standard_EXPORT void Restore(DF_Attribute* with) ;
+Standard_EXPORT DF_Attribute* NewEmpty() const;
+Standard_EXPORT void Paste(DF_Attribute* into);
Standard_EXPORT ~SALOMEDSImpl_AttributeReference() {}
-
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeReference )
};
#endif
// Module : SALOME
#include "SALOMEDSImpl_AttributeSelectable.hxx"
-#include <Standard_GUID.hxx>
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeSelectable, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeSelectable, SALOMEDSImpl_GenericAttribute )
-
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeSelectable::GetID ()
+const std::string& SALOMEDSImpl_AttributeSelectable::GetID ()
{
- static Standard_GUID SALOMEDSImpl_AttributeSelectableID ("12837188-8F52-11d6-A8A3-0001021E8C7F");
+ static std::string SALOMEDSImpl_AttributeSelectableID ("12837188-8F52-11d6-A8A3-0001021E8C7F");
return SALOMEDSImpl_AttributeSelectableID;
}
//purpose :
//=======================================================================
-Handle(SALOMEDSImpl_AttributeSelectable) SALOMEDSImpl_AttributeSelectable::Set (const TDF_Label& L,
- const Standard_Integer value)
+SALOMEDSImpl_AttributeSelectable* SALOMEDSImpl_AttributeSelectable::Set (const DF_Label& L,
+ const int value)
{
- Handle(SALOMEDSImpl_AttributeSelectable) A;
- if (!L.FindAttribute(SALOMEDSImpl_AttributeSelectable::GetID(),A)) {
+ SALOMEDSImpl_AttributeSelectable* A = NULL;
+ if (!(A=(SALOMEDSImpl_AttributeSelectable*)L.FindAttribute(SALOMEDSImpl_AttributeSelectable::GetID()))) {
A = new SALOMEDSImpl_AttributeSelectable();
L.AddAttribute(A);
}
//function : SetSelectable
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeSelectable::SetSelectable(const Standard_Integer theValue)
+void SALOMEDSImpl_AttributeSelectable::SetSelectable(const int theValue)
{
Backup();
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeSelectable::ID () const { return GetID(); }
+const std::string& SALOMEDSImpl_AttributeSelectable::ID () const { return GetID(); }
//=======================================================================
//purpose :
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeSelectable::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_AttributeSelectable::NewEmpty () const
{
return new SALOMEDSImpl_AttributeSelectable();
}
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeSelectable::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributeSelectable::Restore(DF_Attribute* with)
{
- myValue = Handle(SALOMEDSImpl_AttributeSelectable)::DownCast (with)->IsSelectable ();
+ myValue = dynamic_cast<SALOMEDSImpl_AttributeSelectable*>(with)->IsSelectable ();
}
//=======================================================================
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeSelectable::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT) const
+void SALOMEDSImpl_AttributeSelectable::Paste (DF_Attribute* into)
{
- Handle(SALOMEDSImpl_AttributeSelectable)::DownCast (into)->SetSelectable (myValue);
+ dynamic_cast<SALOMEDSImpl_AttributeSelectable*>(into)->SetSelectable (myValue);
}
#ifndef _SALOMEDSImpl_AttributeSelectable_HeaderFile
#define _SALOMEDSImpl_AttributeSelectable_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TDF_Label.hxx>
-#include <TCollection_AsciiString.hxx>
+#include "DF_Attribute.hxx"
+#include "DF_Label.hxx"
+#include <string>
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Standard_GUID;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeSelectable, SALOMEDSImpl_GenericAttribute )
-
-
-
class SALOMEDSImpl_AttributeSelectable : public SALOMEDSImpl_GenericAttribute
{
private:
-Standard_Integer myValue;
+int myValue;
public:
-Standard_EXPORT virtual TCollection_AsciiString Save() { return (myValue == 0)?(char*)"0":(char*)"1"; }
-Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { (theValue == "0")?myValue=0:myValue=1; }
+Standard_EXPORT virtual std::string Save() { return (myValue == 0)?(char*)"0":(char*)"1"; }
+Standard_EXPORT virtual void Load(const std::string& theValue) { (theValue == "0")?myValue=0:myValue=1; }
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDSImpl_AttributeSelectable Set(const TDF_Label& label,const Standard_Integer value) ;
+Standard_EXPORT static const std::string& GetID() ;
+Standard_EXPORT static SALOMEDSImpl_AttributeSelectable* Set(const DF_Label& label,const int value) ;
Standard_EXPORT SALOMEDSImpl_AttributeSelectable();
-Standard_EXPORT void SetSelectable(const Standard_Integer value);
-Standard_EXPORT Standard_Integer IsSelectable() const { return myValue; }
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+Standard_EXPORT void SetSelectable(const int value);
+Standard_EXPORT int IsSelectable() const { return myValue; }
+Standard_EXPORT const std::string& ID() const;
+Standard_EXPORT void Restore(DF_Attribute* with) ;
+Standard_EXPORT DF_Attribute* NewEmpty() const;
+Standard_EXPORT void Paste(DF_Attribute* into);
Standard_EXPORT ~SALOMEDSImpl_AttributeSelectable() {}
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeDrawable )
-
};
#endif
// Module : SALOME
#include "SALOMEDSImpl_AttributeSequenceOfInteger.hxx"
-#include <Standard_GUID.hxx>
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeSequenceOfInteger, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeSequenceOfInteger, SALOMEDSImpl_GenericAttribute )
-
-
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeSequenceOfInteger::GetID ()
+const std::string& SALOMEDSImpl_AttributeSequenceOfInteger::GetID ()
{
- static Standard_GUID SALOMEDSImpl_AttributeSequenceOfIntegerID ("12837182-8F52-11d6-A8A3-0001021E8C7F");
+ static std::string SALOMEDSImpl_AttributeSequenceOfIntegerID ("12837182-8F52-11d6-A8A3-0001021E8C7F");
return SALOMEDSImpl_AttributeSequenceOfIntegerID;
}
//purpose :
//=======================================================================
-Handle(SALOMEDSImpl_AttributeSequenceOfInteger) SALOMEDSImpl_AttributeSequenceOfInteger::Set (const TDF_Label& L)
+SALOMEDSImpl_AttributeSequenceOfInteger* SALOMEDSImpl_AttributeSequenceOfInteger::Set (const DF_Label& L)
{
- Handle(SALOMEDSImpl_AttributeSequenceOfInteger) A;
- if (!L.FindAttribute(SALOMEDSImpl_AttributeSequenceOfInteger::GetID(),A)) {
+ SALOMEDSImpl_AttributeSequenceOfInteger* A = NULL;
+ if (!(A = (SALOMEDSImpl_AttributeSequenceOfInteger*)L.FindAttribute(SALOMEDSImpl_AttributeSequenceOfInteger::GetID()))) {
A = new SALOMEDSImpl_AttributeSequenceOfInteger();
L.AddAttribute(A);
}
//=======================================================================
SALOMEDSImpl_AttributeSequenceOfInteger::SALOMEDSImpl_AttributeSequenceOfInteger()
:SALOMEDSImpl_GenericAttribute("AttributeSequenceOfInteger")
-{
- myValue = new TColStd_HSequenceOfInteger();
-}
+{}
//=======================================================================
//function : ID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeSequenceOfInteger::ID () const { return GetID(); }
+const std::string& SALOMEDSImpl_AttributeSequenceOfInteger::ID () const { return GetID(); }
//=======================================================================
//purpose :
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeSequenceOfInteger::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_AttributeSequenceOfInteger::NewEmpty () const
{
return new SALOMEDSImpl_AttributeSequenceOfInteger();
}
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeSequenceOfInteger::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributeSequenceOfInteger::Restore(DF_Attribute* with)
{
- Standard_Integer i;
- Handle(SALOMEDSImpl_AttributeSequenceOfInteger) anSeq = Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(with);
- if(!anSeq->myValue.IsNull()) {
- myValue = new TColStd_HSequenceOfInteger();
- Standard_Integer Len = anSeq->Length();
- for(i = 1; i<=Len; i++) Add(anSeq->Value(i));
- }
- else
- myValue.Nullify();
- return;
+ SALOMEDSImpl_AttributeSequenceOfInteger* anSeq = dynamic_cast<SALOMEDSImpl_AttributeSequenceOfInteger*>(with);
+ myValue.clear();
+ for(int i = 0, len = anSeq->Length(); i<len; i++)
+ myValue.push_back(anSeq->myValue[i]);
}
//=======================================================================
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeSequenceOfInteger::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& ) const
+void SALOMEDSImpl_AttributeSequenceOfInteger::Paste (DF_Attribute* into)
{
- if(!myValue.IsNull()) {
- Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast (into)->Assign(myValue);
- }
+ dynamic_cast<SALOMEDSImpl_AttributeSequenceOfInteger*>(into)->Assign(myValue);
}
-void SALOMEDSImpl_AttributeSequenceOfInteger::Assign(const Handle(TColStd_HSequenceOfInteger)& other)
+void SALOMEDSImpl_AttributeSequenceOfInteger::Assign(const vector<int>& other)
{
CheckLocked();
Backup();
- if (myValue.IsNull()) myValue = new TColStd_HSequenceOfInteger;
- myValue->ChangeSequence() = other->Sequence();
+ myValue = other;
+
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-void SALOMEDSImpl_AttributeSequenceOfInteger::ChangeValue(const Standard_Integer Index,const Standard_Integer Value)
+void SALOMEDSImpl_AttributeSequenceOfInteger::ChangeValue(const int Index,const int Value)
{
CheckLocked();
Backup();
- if(Index <= 0 || Index > myValue->Length()) Standard_Failure::Raise("Out of range");
+ if(Index <= 0 || Index > myValue.size()) throw DFexception("Out of range");
- myValue->SetValue(Index, Value);
+ myValue[Index-1] = Value;
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-void SALOMEDSImpl_AttributeSequenceOfInteger::Add(const Standard_Integer Value)
+void SALOMEDSImpl_AttributeSequenceOfInteger::Add(const int Value)
{
CheckLocked();
Backup();
- myValue->Append(Value);
+ myValue.push_back(Value);
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-void SALOMEDSImpl_AttributeSequenceOfInteger::Remove(const Standard_Integer Index)
+void SALOMEDSImpl_AttributeSequenceOfInteger::Remove(const int Index)
{
CheckLocked();
Backup();
- if(Index <= 0 || Index > myValue->Length()) Standard_Failure::Raise("Out of range");
+ if(Index <= 0 || Index > myValue.size()) throw DFexception("Out of range");
+
+ typedef vector<int>::iterator VI;
+ int i = 1;
+ for(VI p = myValue.begin(); p!=myValue.end(); p++, i++) {
+ if(i == Index) {
+ myValue.erase(p);
+ break;
+ }
+ }
- myValue->Remove(Index);
-
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-Standard_Integer SALOMEDSImpl_AttributeSequenceOfInteger::Length()
+int SALOMEDSImpl_AttributeSequenceOfInteger::Length()
{
- return myValue->Length();
+ return myValue.size();
}
-Standard_Integer SALOMEDSImpl_AttributeSequenceOfInteger::Value(const Standard_Integer Index)
+int SALOMEDSImpl_AttributeSequenceOfInteger::Value(const int Index)
{
- if(Index <= 0 || Index > myValue->Length()) Standard_Failure::Raise("Out of range");
+ if(Index <= 0 || Index > myValue.size()) throw DFexception("Out of range");
- return myValue->Value(Index);
+ return myValue[Index-1];
}
-TCollection_AsciiString SALOMEDSImpl_AttributeSequenceOfInteger::Save()
+string SALOMEDSImpl_AttributeSequenceOfInteger::Save()
{
- Standard_Integer aLength = Length();
+ int aLength = Length();
char* aResult = new char[aLength * 25];
aResult[0] = 0;
- Standard_Integer aPosition = 0;
+ int aPosition = 0;
for (int i = 1; i <= aLength; i++) {
sprintf(aResult + aPosition , "%d ", Value(i));
aPosition += strlen(aResult + aPosition);
}
- TCollection_AsciiString ret(aResult);
+ string ret(aResult);
delete aResult;
return ret;
}
-void SALOMEDSImpl_AttributeSequenceOfInteger::Load(const TCollection_AsciiString& value)
+void SALOMEDSImpl_AttributeSequenceOfInteger::Load(const string& value)
{
- Handle(TColStd_HSequenceOfInteger) CasCadeSeq = new TColStd_HSequenceOfInteger;
-
- char* aCopy = value.ToCString();
+ char* aCopy = (char*)value.c_str();
char* adr = strtok(aCopy, " ");
while (adr) {
int l = atol(adr);
- CasCadeSeq->Append(l);
+ Add(l);
adr = strtok(NULL, " ");
}
- Assign(CasCadeSeq);
}
#ifndef _SALOMEDSImpl_AttributeSequenceOfInteger_HeaderFile
#define _SALOMEDSImpl_AttributeSequenceOfInteger_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TColStd_HSequenceOfInteger.hxx>
-#include <TDF_Label.hxx>
-#include <TCollection_AsciiString.hxx>
+#include "DF_Attribute.hxx"
+#include "DF_Label.hxx"
+#include <vector>
+#include <string>
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Standard_GUID;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeSequenceOfInteger, SALOMEDSImpl_GenericAttribute )
-
class SALOMEDSImpl_AttributeSequenceOfInteger : public SALOMEDSImpl_GenericAttribute
{
public:
-Standard_EXPORT virtual TCollection_AsciiString Save();
-Standard_EXPORT virtual void Load(const TCollection_AsciiString&);
+Standard_EXPORT virtual std::string Save();
+Standard_EXPORT virtual void Load(const std::string&);
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDSImpl_AttributeSequenceOfInteger Set(const TDF_Label& label) ;
+Standard_EXPORT static const std::string& GetID() ;
+Standard_EXPORT static SALOMEDSImpl_AttributeSequenceOfInteger* Set(const DF_Label& label) ;
Standard_EXPORT SALOMEDSImpl_AttributeSequenceOfInteger();
-Standard_EXPORT void Assign(const Handle(TColStd_HSequenceOfInteger)& other) ;
-Standard_EXPORT void ChangeValue(const Standard_Integer Index,const Standard_Integer Value) ;
-Standard_EXPORT void Add(const Standard_Integer value) ;
-Standard_EXPORT Standard_Integer Value(const Standard_Integer Index) ;
-Standard_EXPORT void Remove(const Standard_Integer Index) ;
-Standard_EXPORT Standard_Integer Length() ;
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+Standard_EXPORT void Assign(const std::vector<int>& other) ;
+Standard_EXPORT void ChangeValue(const int Index,const int Value) ;
+Standard_EXPORT void Add(const int value) ;
+Standard_EXPORT int Value(const int Index) ;
+Standard_EXPORT void Remove(const int Index) ;
+Standard_EXPORT int Length() ;
+Standard_EXPORT const std::string& ID() const;
+Standard_EXPORT void Restore(DF_Attribute* with) ;
+Standard_EXPORT DF_Attribute* NewEmpty() const;
+Standard_EXPORT void Paste(DF_Attribute* into);
Standard_EXPORT ~SALOMEDSImpl_AttributeSequenceOfInteger() {}
+Standard_EXPORT const std::vector<int>& Array() { return myValue; }
private:
-
-Handle_TColStd_HSequenceOfInteger myValue;
-
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeSequenceOfInteger )
-
+std::vector<int> myValue;
};
#endif
// Module : SALOME
#include "SALOMEDSImpl_AttributeSequenceOfReal.hxx"
-#include <Standard_GUID.hxx>
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeSequenceOfReal, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeSequenceOfReal, SALOMEDSImpl_GenericAttribute )
-
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeSequenceOfReal::GetID ()
+const std::string& SALOMEDSImpl_AttributeSequenceOfReal::GetID ()
{
- static Standard_GUID SALOMEDSImpl_AttributeSequenceOfRealID ("12837183-8F52-11d6-A8A3-0001021E8C7F");
+ static std::string SALOMEDSImpl_AttributeSequenceOfRealID ("12837183-8F52-11d6-A8A3-0001021E8C7F");
return SALOMEDSImpl_AttributeSequenceOfRealID;
}
//purpose :
//=======================================================================
-Handle(SALOMEDSImpl_AttributeSequenceOfReal) SALOMEDSImpl_AttributeSequenceOfReal::Set (const TDF_Label& L)
+SALOMEDSImpl_AttributeSequenceOfReal* SALOMEDSImpl_AttributeSequenceOfReal::Set (const DF_Label& L)
{
- Handle(SALOMEDSImpl_AttributeSequenceOfReal) A;
- if (!L.FindAttribute(SALOMEDSImpl_AttributeSequenceOfReal::GetID(),A)) {
+ SALOMEDSImpl_AttributeSequenceOfReal* A = NULL;
+ if (!(A=(SALOMEDSImpl_AttributeSequenceOfReal*)L.FindAttribute(SALOMEDSImpl_AttributeSequenceOfReal::GetID()))) {
A = new SALOMEDSImpl_AttributeSequenceOfReal();
L.AddAttribute(A);
}
SALOMEDSImpl_AttributeSequenceOfReal::SALOMEDSImpl_AttributeSequenceOfReal()
:SALOMEDSImpl_GenericAttribute("AttributeSequenceOfReal")
{
- myValue = new TColStd_HSequenceOfReal();
+ myValue.clear();
}
//=======================================================================
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeSequenceOfReal::ID () const { return GetID(); }
+const std::string& SALOMEDSImpl_AttributeSequenceOfReal::ID () const { return GetID(); }
//=======================================================================
//purpose :
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeSequenceOfReal::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_AttributeSequenceOfReal::NewEmpty () const
{
return new SALOMEDSImpl_AttributeSequenceOfReal();
}
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeSequenceOfReal::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributeSequenceOfReal::Restore(DF_Attribute* with)
{
- Standard_Integer i;
- Handle(SALOMEDSImpl_AttributeSequenceOfReal) anSeq = Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(with);
- if(!anSeq->myValue.IsNull()) {
- myValue = new TColStd_HSequenceOfReal();
- Standard_Integer Len = anSeq->Length();
- for(i = 1; i<=Len; i++) Add(anSeq->Value(i));
- }
- else
- myValue.Nullify();
+ SALOMEDSImpl_AttributeSequenceOfReal* anSeq = dynamic_cast<SALOMEDSImpl_AttributeSequenceOfReal*>(with);
+ myValue.clear();
+ for(int i = 0, len = anSeq->Length(); i<len; i++)
+ myValue.push_back(anSeq->myValue[i]);
return;
}
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeSequenceOfReal::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& ) const
+void SALOMEDSImpl_AttributeSequenceOfReal::Paste (DF_Attribute* into)
{
- if(!myValue.IsNull()) {
- Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast (into)->Assign(myValue);
- }
+ dynamic_cast<SALOMEDSImpl_AttributeSequenceOfReal*>(into)->Assign(myValue);
}
-void SALOMEDSImpl_AttributeSequenceOfReal::Assign(const Handle(TColStd_HSequenceOfReal)& other)
+void SALOMEDSImpl_AttributeSequenceOfReal::Assign(const vector<double>& other)
{
CheckLocked();
Backup();
- if (myValue.IsNull()) myValue = new TColStd_HSequenceOfReal;
- myValue->ChangeSequence() = other->Sequence();
+ myValue = other;
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-void SALOMEDSImpl_AttributeSequenceOfReal::ChangeValue(const Standard_Integer Index,const Standard_Real Value)
+void SALOMEDSImpl_AttributeSequenceOfReal::ChangeValue(const int Index,const double& Value)
{
CheckLocked();
Backup();
- if(Index <= 0 || Index > myValue->Length()) Standard_Failure::Raise("Out of range");
+ if(Index <= 0 || Index > myValue.size()) throw DFexception("Out of range");
- myValue->SetValue(Index, Value);
+ myValue[Index-1] = Value;
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-void SALOMEDSImpl_AttributeSequenceOfReal::Add(const Standard_Real Value)
+void SALOMEDSImpl_AttributeSequenceOfReal::Add(const double& Value)
{
CheckLocked();
Backup();
- myValue->Append(Value);
+ myValue.push_back(Value);
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-void SALOMEDSImpl_AttributeSequenceOfReal::Remove(const Standard_Integer Index)
+void SALOMEDSImpl_AttributeSequenceOfReal::Remove(const int Index)
{
CheckLocked();
Backup();
- if(Index <= 0 || Index > myValue->Length()) Standard_Failure::Raise("Out of range");
+ if(Index <= 0 || Index > myValue.size()) throw DFexception("Out of range");
- myValue->Remove(Index);
-
- SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+ typedef vector<double>::iterator VI;
+ int i = 1;
+ for(VI p = myValue.begin(); p!=myValue.end(); p++, i++) {
+ if(i == Index) {
+ myValue.erase(p);
+ break;
+ }
+ }
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-Standard_Integer SALOMEDSImpl_AttributeSequenceOfReal::Length()
+int SALOMEDSImpl_AttributeSequenceOfReal::Length()
{
- return myValue->Length();
+ return myValue.size();
}
-Standard_Real SALOMEDSImpl_AttributeSequenceOfReal::Value(const Standard_Integer Index)
+double SALOMEDSImpl_AttributeSequenceOfReal::Value(const int Index)
{
- if(Index <= 0 || Index > myValue->Length()) Standard_Failure::Raise("Out of range");
- return myValue->Value(Index);
+ if(Index <= 0 || Index > myValue.size()) throw DFexception("Out of range");
+ return myValue[Index-1];
}
-TCollection_AsciiString SALOMEDSImpl_AttributeSequenceOfReal::Save()
+string SALOMEDSImpl_AttributeSequenceOfReal::Save()
{
- Standard_Integer aLength = Length();
- char* aResult = new char[aLength * 25];
+ int aLength = Length();
+ char* aResult = new char[aLength * 127];
aResult[0] = 0;
- Standard_Integer aPosition = 0;
+ int aPosition = 0;
for (int i = 1; i <= aLength; i++) {
- sprintf(aResult + aPosition , "%f ", Value(i));
+ sprintf(aResult + aPosition , "%.64e ", Value(i));
aPosition += strlen(aResult + aPosition);
}
- TCollection_AsciiString ret(aResult);
+ string ret(aResult);
delete aResult;
return ret;
}
-void SALOMEDSImpl_AttributeSequenceOfReal::Load(const TCollection_AsciiString& value)
+void SALOMEDSImpl_AttributeSequenceOfReal::Load(const string& value)
{
- Handle(TColStd_HSequenceOfReal) CasCadeSeq = new TColStd_HSequenceOfReal;
- char* aCopy = value.ToCString();
+ char* aCopy = (char*)value.c_str();
char* adr = strtok(aCopy, " ");
char *err = NULL;
while (adr) {
- Standard_Real r = strtod(adr, &err);
- CasCadeSeq->Append(r);
+ double r = strtod(adr, &err);
+ Add(r);
adr = strtok(NULL, " ");
}
- Assign(CasCadeSeq);
}
#ifndef _SALOMEDSImpl_AttributeSequenceOfReal_HeaderFile
#define _SALOMEDSImpl_AttributeSequenceOfReal_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TColStd_HSequenceOfReal.hxx>
-#include <TDF_Label.hxx>
-#include <TCollection_AsciiString.hxx>
+#include "DF_Attribute.hxx"
+#include "DF_Label.hxx"
+#include <string>
+#include <vector>
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Standard_GUID;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeSequenceOfReal, SALOMEDSImpl_GenericAttribute )
class SALOMEDSImpl_AttributeSequenceOfReal : public SALOMEDSImpl_GenericAttribute
{
public:
-Standard_EXPORT virtual TCollection_AsciiString Save();
-Standard_EXPORT virtual void Load(const TCollection_AsciiString&);
+Standard_EXPORT virtual std::string Save();
+Standard_EXPORT virtual void Load(const std::string&);
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDSImpl_AttributeSequenceOfReal Set(const TDF_Label& label) ;
+Standard_EXPORT static const std::string& GetID() ;
+Standard_EXPORT static SALOMEDSImpl_AttributeSequenceOfReal* Set(const DF_Label& label) ;
Standard_EXPORT SALOMEDSImpl_AttributeSequenceOfReal();
-Standard_EXPORT void Assign(const Handle(TColStd_HSequenceOfReal)& other) ;
-Standard_EXPORT void ChangeValue(const Standard_Integer Index,const Standard_Real Value) ;
-Standard_EXPORT void Add(const Standard_Real Value) ;
-Standard_EXPORT Standard_Real Value(const Standard_Integer Index) ;
-Standard_EXPORT void Remove(const Standard_Integer Index) ;
-Standard_EXPORT Standard_Integer Length() ;
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+Standard_EXPORT void Assign(const std::vector<double>& other) ;
+Standard_EXPORT void ChangeValue(const int Index,const double& Value) ;
+Standard_EXPORT void Add(const double& Value) ;
+Standard_EXPORT double Value(const int Index) ;
+Standard_EXPORT void Remove(const int Index) ;
+Standard_EXPORT int Length() ;
+Standard_EXPORT const std::string& ID() const;
+Standard_EXPORT void Restore(DF_Attribute* with) ;
+Standard_EXPORT DF_Attribute* NewEmpty() const;
+Standard_EXPORT void Paste(DF_Attribute* into);
Standard_EXPORT ~SALOMEDSImpl_AttributeSequenceOfReal() {}
+Standard_EXPORT const std::vector<double>& Array() { return myValue; }
private:
-Handle_TColStd_HSequenceOfReal myValue;
-
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeSequenceOfReal )
+std::vector<double> myValue;
};
using namespace std;
#endif
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeString, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeString, SALOMEDSImpl_GenericAttribute )
-
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeString::GetID ()
+const std::string& SALOMEDSImpl_AttributeString::GetID ()
{
- static Standard_GUID CommentID ("1808A12F-AD0E-4a6a-B58A-395DCF469FE9");
+ static std::string CommentID ("1808A12F-AD0E-4a6a-B58A-395DCF469FE9");
return CommentID;
}
-Handle(SALOMEDSImpl_AttributeString) SALOMEDSImpl_AttributeString::Set (const TDF_Label& L,
- const TCollection_ExtendedString& Val)
+SALOMEDSImpl_AttributeString* SALOMEDSImpl_AttributeString::Set (const DF_Label& L,
+ const std::string& Val)
{
- Handle(SALOMEDSImpl_AttributeString) A;
- if (!L.FindAttribute(SALOMEDSImpl_AttributeString::GetID(), A)) {
+ SALOMEDSImpl_AttributeString* A = NULL;
+ if (!(A=(SALOMEDSImpl_AttributeString*)L.FindAttribute(SALOMEDSImpl_AttributeString::GetID()))) {
A = new SALOMEDSImpl_AttributeString();
L.AddAttribute(A);
}
//function : SetValue
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeString::SetValue (const TCollection_ExtendedString& S)
+void SALOMEDSImpl_AttributeString::SetValue (const std::string& S)
{
CheckLocked();
//function : ID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeString::ID () const { return GetID(); }
+const std::string& SALOMEDSImpl_AttributeString::ID () const { return GetID(); }
//=======================================================================
//function : NewEmpty
//purpose :
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeString::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_AttributeString::NewEmpty () const
{
return new SALOMEDSImpl_AttributeString();
}
//function : Restore
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeString::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributeString::Restore(DF_Attribute* with)
{
- myString = Handle(SALOMEDSImpl_AttributeString)::DownCast (with)->Value ();
+ myString = dynamic_cast<SALOMEDSImpl_AttributeString*>(with)->Value ();
}
//=======================================================================
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeString::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT) const
+void SALOMEDSImpl_AttributeString::Paste (DF_Attribute* into)
{
- Handle(SALOMEDSImpl_AttributeString)::DownCast (into)->SetValue(myString);
+ dynamic_cast<SALOMEDSImpl_AttributeString*>(into)->SetValue(myString);
}
#ifndef _SALOMEDSImpl_AttributeString_HeaderFile
#define _SALOMEDSImpl_AttributeString_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_ExtendedString.hxx>
-#include <TDF_Label.hxx>
-#include <Standard_GUID.hxx>
+#include "DF_Attribute.hxx"
+#include <string>
+#include "DF_Label.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeString, SALOMEDSImpl_GenericAttribute )
class SALOMEDSImpl_AttributeString : public SALOMEDSImpl_GenericAttribute
{
private:
- TCollection_ExtendedString myString;
+ std::string myString;
public:
-Standard_EXPORT static const Standard_GUID& GetID() ;
+Standard_EXPORT static const std::string& GetID() ;
Standard_EXPORT SALOMEDSImpl_AttributeString() :SALOMEDSImpl_GenericAttribute("AttributeString") {}
-Standard_EXPORT static Handle(SALOMEDSImpl_AttributeString) Set(const TDF_Label& L, const TCollection_ExtendedString& Val);
-Standard_EXPORT void SetValue (const TCollection_ExtendedString& S);
-Standard_EXPORT TCollection_ExtendedString Value() const { return myString; }
-
-Standard_EXPORT virtual TCollection_AsciiString Save() { return myString; }
-Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { myString = theValue; }
+Standard_EXPORT static SALOMEDSImpl_AttributeString* Set(const DF_Label& L, const std::string& Val);
+Standard_EXPORT void SetValue (const std::string& S);
+Standard_EXPORT std::string Value() const { return myString; }
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+Standard_EXPORT virtual std::string Save() { return myString; }
+Standard_EXPORT virtual void Load(const std::string& theValue) { myString = theValue; }
+Standard_EXPORT const std::string& ID() const;
+Standard_EXPORT void Restore(DF_Attribute* with) ;
+Standard_EXPORT DF_Attribute* NewEmpty() const;
+Standard_EXPORT void Paste(DF_Attribute* into);
Standard_EXPORT ~SALOMEDSImpl_AttributeString() {}
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeString )
};
#endif
// Module : SALOME
#include <SALOMEDSImpl_AttributeStudyProperties.hxx>
-#include <Standard_GUID.hxx>
-#include <TCollection_ExtendedString.hxx>
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeStudyProperties, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeStudyProperties, SALOMEDSImpl_GenericAttribute )
-const Standard_GUID& SALOMEDSImpl_AttributeStudyProperties::GetID()
+const std::string& SALOMEDSImpl_AttributeStudyProperties::GetID()
{
- static Standard_GUID SALOMEDSImpl_AttributeStudyPropertiesID ("128371A2-8F52-11d6-A8A3-0001021E8C7F");
+ static std::string SALOMEDSImpl_AttributeStudyPropertiesID ("128371A2-8F52-11d6-A8A3-0001021E8C7F");
return SALOMEDSImpl_AttributeStudyPropertiesID;
}
-Handle(SALOMEDSImpl_AttributeStudyProperties) SALOMEDSImpl_AttributeStudyProperties::Set(const TDF_Label& label)
+SALOMEDSImpl_AttributeStudyProperties* SALOMEDSImpl_AttributeStudyProperties::Set(const DF_Label& label)
{
- Handle(SALOMEDSImpl_AttributeStudyProperties) anAttr;
- if (!label.FindAttribute(SALOMEDSImpl_AttributeStudyProperties::GetID(),anAttr)) {
- anAttr = new SALOMEDSImpl_AttributeStudyProperties();
- label.AddAttribute(anAttr);
+ SALOMEDSImpl_AttributeStudyProperties* A = NULL;
+ if (!(A=(SALOMEDSImpl_AttributeStudyProperties*)label.FindAttribute(SALOMEDSImpl_AttributeStudyProperties::GetID()))) {
+ A = new SALOMEDSImpl_AttributeStudyProperties();
+ label.AddAttribute(A);
}
- return anAttr;
+ return A;
}
SALOMEDSImpl_AttributeStudyProperties::SALOMEDSImpl_AttributeStudyProperties()
:SALOMEDSImpl_GenericAttribute("AttributeStudyProperties")
{
- myLocked = Standard_False;
- myLockChanged = Standard_False;
+ myLocked = false;
+ myLockChanged = false;
Init();
}
void SALOMEDSImpl_AttributeStudyProperties::Init()
{
- myUserName = new TColStd_HSequenceOfExtendedString();
- myMinute = new TColStd_HSequenceOfInteger();
- myHour = new TColStd_HSequenceOfInteger();
- myDay = new TColStd_HSequenceOfInteger();
- myMonth = new TColStd_HSequenceOfInteger();
- myYear = new TColStd_HSequenceOfInteger();
-// myModified = 0;
+ myUserName.clear();
+ myMinute.clear();
+ myHour.clear();
+ myDay.clear();
+ myMonth.clear();
+ myYear.clear();
myMode = 0; // none
}
-void SALOMEDSImpl_AttributeStudyProperties::SetModification(const TCollection_ExtendedString& theUserName,
- const Standard_Integer theMinute,
- const Standard_Integer theHour,
- const Standard_Integer theDay,
- const Standard_Integer theMonth,
- const Standard_Integer theYear)
+void SALOMEDSImpl_AttributeStudyProperties::SetModification(const std::string& theUserName,
+ const int theMinute,
+ const int theHour,
+ const int theDay,
+ const int theMonth,
+ const int theYear)
{
if (theMinute<0 || theMinute>60 || theHour<0 || theHour>24 ||
theDay<0 || theDay>31 || theMonth<0 || theMonth>12)
CheckLocked();
Backup();
- myUserName->Append(theUserName);
- myMinute->Append(theMinute);
- myHour->Append(theHour);
- myDay->Append(theDay);
- myMonth->Append(theMonth);
- myYear->Append(theYear);
+ myUserName.push_back(theUserName);
+ myMinute.push_back(theMinute);
+ myHour.push_back(theHour);
+ myDay.push_back(theDay);
+ myMonth.push_back(theMonth);
+ myYear.push_back(theYear);
}
void SALOMEDSImpl_AttributeStudyProperties::GetModifications
- (Handle(TColStd_HSequenceOfExtendedString)& theUserNames,
- Handle(TColStd_HSequenceOfInteger)& theMinutes,
- Handle(TColStd_HSequenceOfInteger)& theHours,
- Handle(TColStd_HSequenceOfInteger)& theDays,
- Handle(TColStd_HSequenceOfInteger)& theMonths,
- Handle(TColStd_HSequenceOfInteger)& theYears) const
+ (vector<string>& theUserNames,
+ vector<int>& theMinutes,
+ vector<int>& theHours,
+ vector<int>& theDays,
+ vector<int>& theMonths,
+ vector<int>& theYears) const
{
theUserNames = myUserName;
theMinutes = myMinute;
theYears = myYear;
}
-TCollection_ExtendedString SALOMEDSImpl_AttributeStudyProperties::GetCreatorName() const
+std::string SALOMEDSImpl_AttributeStudyProperties::GetCreatorName() const
{
- if (myUserName->Length() == 0)
- return TCollection_ExtendedString("");
- return myUserName->Value(1);
+ if (myUserName.size() == 0)
+ return std::string("");
+ return myUserName[0];
}
-Standard_Boolean SALOMEDSImpl_AttributeStudyProperties::GetCreationDate
- (Standard_Integer& theMinute,
- Standard_Integer& theHour,
- Standard_Integer& theDay,
- Standard_Integer& theMonth,
- Standard_Integer& theYear) const
+bool SALOMEDSImpl_AttributeStudyProperties::GetCreationDate
+ (int& theMinute,
+ int& theHour,
+ int& theDay,
+ int& theMonth,
+ int& theYear) const
{
- if (myMinute->Length() != 0) {
- theMinute = myMinute->Value(1);
- theHour = myHour->Value(1);
- theDay = myDay->Value(1);
- theMonth = myMonth->Value(1);
- theYear = myYear->Value(1);
- return Standard_True;
+ if (myMinute.size() != 0) {
+ theMinute = myMinute[0];
+ theHour = myHour[0];
+ theDay = myDay[0];
+ theMonth = myMonth[0];
+ theYear = myYear[0];
+ return true;
}
- return Standard_False;
+ return false;
}
-void SALOMEDSImpl_AttributeStudyProperties::ChangeCreatorName(const TCollection_ExtendedString& theName)
+void SALOMEDSImpl_AttributeStudyProperties::ChangeCreatorName(const std::string& theName)
{
- if (myUserName->Length() > 0) {
+ if (myUserName.size() > 0) {
CheckLocked();
Backup();
- myUserName->SetValue(1, theName);
+ myUserName[0] = theName;
}
}
-void SALOMEDSImpl_AttributeStudyProperties::SetCreationMode(const Standard_Integer theMode)
+void SALOMEDSImpl_AttributeStudyProperties::SetCreationMode(const int theMode)
{
CheckLocked();
Backup();
myMode = theMode;
}
-Standard_Integer SALOMEDSImpl_AttributeStudyProperties::GetCreationMode() const
+int SALOMEDSImpl_AttributeStudyProperties::GetCreationMode() const
{
return myMode;
}
-void SALOMEDSImpl_AttributeStudyProperties::SetModified(const Standard_Integer theModified)
+void SALOMEDSImpl_AttributeStudyProperties::SetModified(const int theModified)
{
myModified = theModified;
}
-Standard_Boolean SALOMEDSImpl_AttributeStudyProperties::IsModified() const
+bool SALOMEDSImpl_AttributeStudyProperties::IsModified() const
{
return (myModified != 0);
}
-Standard_Integer SALOMEDSImpl_AttributeStudyProperties::GetModified() const
+int SALOMEDSImpl_AttributeStudyProperties::GetModified() const
{
return myModified;
}
-void SALOMEDSImpl_AttributeStudyProperties::SetLocked(const Standard_Boolean theLocked)
+void SALOMEDSImpl_AttributeStudyProperties::SetLocked(const bool theLocked)
{
// Backup();
if (myLocked != theLocked) {
- myLockChanged = Standard_True;
+ myLockChanged = true;
myLocked = theLocked;
}
}
-Standard_Boolean SALOMEDSImpl_AttributeStudyProperties::IsLocked() const
+bool SALOMEDSImpl_AttributeStudyProperties::IsLocked() const
{
return myLocked;
}
-Standard_Boolean SALOMEDSImpl_AttributeStudyProperties::IsLockChanged(const Standard_Boolean theErase) {
- if (!myLockChanged) return Standard_False;
- if (theErase) myLockChanged = Standard_False;
- return Standard_True;
+bool SALOMEDSImpl_AttributeStudyProperties::IsLockChanged(const bool theErase) {
+ if (!myLockChanged) return false;
+ if (theErase) myLockChanged = false;
+ return true;
}
-const Standard_GUID& SALOMEDSImpl_AttributeStudyProperties::ID() const
+const std::string& SALOMEDSImpl_AttributeStudyProperties::ID() const
{
return GetID();
}
-void SALOMEDSImpl_AttributeStudyProperties::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributeStudyProperties::Restore(DF_Attribute* with)
{
- Handle(SALOMEDSImpl_AttributeStudyProperties) aProp =
- Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(with);
+ SALOMEDSImpl_AttributeStudyProperties* aProp =
+ dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(with);
+
Init();
- Standard_Integer i;
- Handle(TColStd_HSequenceOfExtendedString) aNames;
- Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears;
+ vector<string> aNames;
+ vector<int> aMinutes, aHours, aDays, aMonths, aYears;
aProp->GetModifications(aNames, aMinutes, aHours, aDays, aMonths, aYears);
- for (i = aNames->Length(); i > 0; i--) {
- myUserName->Prepend(aNames->Value(i));
- myMinute->Prepend(aMinutes->Value(i));
- myHour->Prepend(aHours->Value(i));
- myDay->Prepend(aDays->Value(i));
- myMonth->Prepend(aMonths->Value(i));
- myYear->Prepend(aYears->Value(i));
+ for (int i = 0, len = aNames.size(); i < len; i++) {
+ myUserName.push_back(aNames[i]);
+ myMinute.push_back(aMinutes[i]);
+ myHour.push_back(aHours[i]);
+ myDay.push_back(aDays[i]);
+ myMonth.push_back(aMonths[i]);
+ myYear.push_back(aYears[i]);
}
myMode = aProp->GetCreationMode();
// myModified = aProp->GetModified();
// myLocked = aProp->IsLocked();
}
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeStudyProperties::NewEmpty() const
+DF_Attribute* SALOMEDSImpl_AttributeStudyProperties::NewEmpty() const
{
return new SALOMEDSImpl_AttributeStudyProperties();
}
-void SALOMEDSImpl_AttributeStudyProperties::Paste(const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)&) const
+void SALOMEDSImpl_AttributeStudyProperties::Paste(DF_Attribute* into)
{
- Handle(SALOMEDSImpl_AttributeStudyProperties) aProp =
- Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(into);
+ SALOMEDSImpl_AttributeStudyProperties* aProp =
+ dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(into);
aProp->Init();
- Standard_Integer i;
- for(i = 1; i <= myUserName->Length(); i++) {
- aProp->SetModification(myUserName->Value(i),
- myMinute->Value(i), myHour->Value(i),
- myDay->Value(i), myMonth->Value(i), myYear->Value(i));
+ int i;
+ for(i = 0; i < myUserName.size(); i++) {
+ aProp->SetModification(myUserName[i],
+ myMinute[i], myHour[i],
+ myDay[i], myMonth[i], myYear[i]);
}
aProp->SetCreationMode(myMode);
}
-TCollection_AsciiString SALOMEDSImpl_AttributeStudyProperties::Save()
+string SALOMEDSImpl_AttributeStudyProperties::Save()
{
- Handle(TColStd_HSequenceOfExtendedString) aNames;
- Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears;
+ vector<string> aNames;
+ vector<int> aMinutes, aHours, aDays, aMonths, aYears;
GetModifications(aNames, aMinutes, aHours, aDays, aMonths, aYears);
int aLength, anIndex;
- for (aLength = 0, anIndex = aNames->Length(); anIndex > 0; anIndex--)
- aLength += aNames->Value(anIndex).Length() + 1;
+ for (aLength = 0, anIndex = aNames.size()-1; anIndex >= 0; anIndex--)
+ aLength += aNames[anIndex].size() + 1;
- char* aProperty = new char[3 + aLength + 12 * aNames->Length()];
+ char* aProperty = new char[3 + aLength + 12 * aNames.size()];
char crMode = (char)GetCreationMode();
sprintf(aProperty,"%c%c", crMode, IsLocked()?'l':'u');
- aLength = aNames->Length();
+ aLength = aNames.size();
int a = 2;
- for (anIndex = 1; anIndex <= aLength; anIndex++) {
+ for (anIndex = 0; anIndex < aLength; anIndex++) {
sprintf(&(aProperty[a]),"%2d%2d%2d%2d%4d%s",
- (int)(aMinutes->Value(anIndex)),
- (int)(aHours->Value(anIndex)),
- (int)(aDays->Value(anIndex)),
- (int)(aMonths->Value(anIndex)),
- (int)(aYears->Value(anIndex)),
- (char*)(TCollection_AsciiString(aNames->Value(anIndex)).ToCString()));
+ (int)(aMinutes[anIndex]),
+ (int)(aHours[anIndex]),
+ (int)(aDays[anIndex]),
+ (int)(aMonths[anIndex]),
+ (int)(aYears[anIndex]),
+ (char*)(aNames[anIndex].c_str()));
a = strlen(aProperty);
aProperty[a++] = 1;
}
aProperty[a] = 0;
- TCollection_AsciiString prop(aProperty);
+ string prop(aProperty);
delete aProperty;
return prop;
}
-void SALOMEDSImpl_AttributeStudyProperties::Load(const TCollection_AsciiString& value)
+void SALOMEDSImpl_AttributeStudyProperties::Load(const string& value)
{
- char* aCopy = value.ToCString();
+ char* aCopy = (char*)value.c_str();
int crMode = (int)aCopy[0];
SetCreationMode(crMode);
int anIndex;
- for (anIndex = 2; anIndex + 2 < value.Length() ;) {
+ for (anIndex = 2; anIndex + 2 < value.size() ;) {
char str[10];
- Standard_Integer aMinute, aHour, aDay, aMonth, aYear;
+ int aMinute, aHour, aDay, aMonth, aYear;
str[0] = aCopy[anIndex++];
str[1] = aCopy[anIndex++];
str[2] = 0;
anIndex += aNameSize + 1;
}
if (aCopy[1] == 'l') {
- SetLocked(Standard_True);
+ SetLocked(true);
}
SetModified(0);
}
#ifndef _SALOMEDSImpl_AttributeStudyProperties_HeaderFile
#define _SALOMEDSImpl_AttributeStudyProperties_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <Standard.hxx>
-#include <TDF_Attribute.hxx>
-#include <TDF_Label.hxx>
-#include <TCollection_AsciiString.hxx>
+#include "DF_Attribute.hxx"
+#include "DF_Label.hxx"
+#include <string>
+#include <vector>
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Standard_GUID;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeStudyProperties, SALOMEDSImpl_GenericAttribute )
-
-#include <TColStd_HSequenceOfExtendedString.hxx>
-#include <TColStd_HSequenceOfInteger.hxx>
-
class SALOMEDSImpl_AttributeStudyProperties : public SALOMEDSImpl_GenericAttribute
{
public:
Standard_EXPORT SALOMEDSImpl_AttributeStudyProperties();
Standard_EXPORT ~SALOMEDSImpl_AttributeStudyProperties() {}
-Standard_EXPORT static const Standard_GUID& GetID();
-Standard_EXPORT const Standard_GUID& ID() const;
+Standard_EXPORT static const std::string& GetID();
+Standard_EXPORT const std::string& ID() const;
-Standard_EXPORT static Handle_SALOMEDSImpl_AttributeStudyProperties Set(const TDF_Label& label);
+Standard_EXPORT static SALOMEDSImpl_AttributeStudyProperties* Set(const DF_Label& label);
Standard_EXPORT void Init();
-Standard_EXPORT virtual TCollection_AsciiString Save();
-Standard_EXPORT virtual void Load(const TCollection_AsciiString&);
-
-Standard_EXPORT void SetModification(const TCollection_ExtendedString& theUserName,
- const Standard_Integer theMinute,
- const Standard_Integer theHour,
- const Standard_Integer theDay,
- const Standard_Integer theMonth,
- const Standard_Integer theYear);
-Standard_EXPORT void GetModifications(Handle(TColStd_HSequenceOfExtendedString)& theUserNames,
- Handle(TColStd_HSequenceOfInteger)& theMinutes,
- Handle(TColStd_HSequenceOfInteger)& theHours,
- Handle(TColStd_HSequenceOfInteger)& theDays,
- Handle(TColStd_HSequenceOfInteger)& theMonths,
- Handle(TColStd_HSequenceOfInteger)& theYears) const;
-
-Standard_EXPORT TCollection_ExtendedString GetCreatorName() const;
-Standard_EXPORT Standard_Boolean GetCreationDate(Standard_Integer& theMinute,
- Standard_Integer& theHour,
- Standard_Integer& theDay,
- Standard_Integer& theMonth,
- Standard_Integer& theYear) const;
-
-Standard_EXPORT void ChangeCreatorName(const TCollection_ExtendedString& theUserName);
-
-Standard_EXPORT void SetCreationMode(const Standard_Integer theMode);
-Standard_EXPORT Standard_Integer GetCreationMode() const;
-
-Standard_EXPORT void SetModified(const Standard_Integer theModified);
-Standard_EXPORT Standard_Boolean IsModified() const;
-Standard_EXPORT Standard_Integer GetModified() const;
-
-Standard_EXPORT void SetLocked(const Standard_Boolean theLocked);
-Standard_EXPORT Standard_Boolean IsLocked() const;
-Standard_EXPORT Standard_Boolean IsLockChanged(const Standard_Boolean theErase);
-
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with);
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT) const;
+Standard_EXPORT virtual std::string Save();
+Standard_EXPORT virtual void Load(const std::string&);
+
+Standard_EXPORT void SetModification(const std::string& theUserName,
+ const int theMinute,
+ const int theHour,
+ const int theDay,
+ const int theMonth,
+ const int theYear);
+Standard_EXPORT void GetModifications(std::vector<std::string>& theUserNames,
+ std::vector<int>& theMinutes,
+ std::vector<int>& theHours,
+ std::vector<int>& theDays,
+ std::vector<int>& theMonths,
+ std::vector<int>& theYears) const;
+
+Standard_EXPORT std::string GetCreatorName() const;
+Standard_EXPORT bool GetCreationDate(int& theMinute,
+ int& theHour,
+ int& theDay,
+ int& theMonth,
+ int& theYear) const;
+
+Standard_EXPORT void ChangeCreatorName(const std::string& theUserName);
+
+Standard_EXPORT void SetCreationMode(const int theMode);
+Standard_EXPORT int GetCreationMode() const;
+
+Standard_EXPORT void SetModified(const int theModified);
+Standard_EXPORT bool IsModified() const;
+Standard_EXPORT int GetModified() const;
+
+Standard_EXPORT void SetLocked(const bool theLocked);
+Standard_EXPORT bool IsLocked() const;
+Standard_EXPORT bool IsLockChanged(const bool theErase);
+
+Standard_EXPORT void Restore(DF_Attribute* with);
+Standard_EXPORT DF_Attribute* NewEmpty() const;
+Standard_EXPORT void Paste(DF_Attribute* into);
private:
-Handle_TColStd_HSequenceOfExtendedString myUserName;
-Handle_TColStd_HSequenceOfInteger myMinute;
-Handle_TColStd_HSequenceOfInteger myHour;
-Handle_TColStd_HSequenceOfInteger myDay;
-Handle_TColStd_HSequenceOfInteger myMonth;
-Handle_TColStd_HSequenceOfInteger myYear;
-Standard_Integer myMode;
-Standard_Integer myModified;
-Standard_Boolean myLocked;
-Standard_Boolean myLockChanged;
-
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeStudyProperties )
+std::vector<std::string> myUserName;
+std::vector<int> myMinute;
+std::vector<int> myHour;
+std::vector<int> myDay;
+std::vector<int> myMonth;
+std::vector<int> myYear;
+int myMode;
+int myModified;
+bool myLocked;
+bool myLockChanged;
};
// Author : Michael Ponikarov
// Module : SALOME
-#include <SALOMEDSImpl_AttributeTableOfInteger.hxx>
-#include <Standard_Failure.hxx>
-#include <TColStd_DataMapIteratorOfDataMapOfIntegerInteger.hxx>
-#include <Standard_GUID.hxx>
-#include <TColStd_HSequenceOfExtendedString.hxx>
+#include "SALOMEDSImpl_AttributeTableOfInteger.hxx"
+#include <strstream>
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeTableOfInteger, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeTableOfInteger, SALOMEDSImpl_GenericAttribute )
-
#define SEPARATOR '\1'
+typedef map<int, int>::const_iterator MI;
-static TCollection_ExtendedString getUnit(TCollection_ExtendedString theString)
+static std::string getUnit(std::string theString)
{
- TCollection_ExtendedString aString(theString);
- int aPos = aString.Search(SEPARATOR);
- if(aPos <= 0 || aPos == aString.Length() ) return TCollection_ExtendedString();
- return aString.Split(aPos);
+ std::string aString(theString);
+ int aPos = aString.find(SEPARATOR);
+ if(aPos <= 0 || aPos == aString.size() ) return std::string();
+ return aString.substr(aPos+1, aString.size());
}
-static TCollection_ExtendedString getTitle(TCollection_ExtendedString theString)
+static std::string getTitle(std::string theString)
{
- TCollection_ExtendedString aString(theString);
- int aPos = aString.Search(SEPARATOR);
+ std::string aString(theString);
+ int aPos = aString.find(SEPARATOR);
if(aPos < 1) return aString;
- if(aPos == 1) return TCollection_ExtendedString();
- aString.Split(aPos-1);
- return aString;
+ if(aPos == 1) return std::string();
+ return aString.substr(0, aPos);
}
-const Standard_GUID& SALOMEDSImpl_AttributeTableOfInteger::GetID()
+const std::string& SALOMEDSImpl_AttributeTableOfInteger::GetID()
{
- static Standard_GUID SALOMEDSImpl_AttributeTableOfIntegerID ("128371A0-8F52-11d6-A8A3-0001021E8C7F");
+ static std::string SALOMEDSImpl_AttributeTableOfIntegerID ("128371A0-8F52-11d6-A8A3-0001021E8C7F");
return SALOMEDSImpl_AttributeTableOfIntegerID;
}
-Handle(SALOMEDSImpl_AttributeTableOfInteger) SALOMEDSImpl_AttributeTableOfInteger::Set(const TDF_Label& label)
+SALOMEDSImpl_AttributeTableOfInteger* SALOMEDSImpl_AttributeTableOfInteger::Set(const DF_Label& label)
{
- Handle(SALOMEDSImpl_AttributeTableOfInteger) anAttr;
- if (!label.FindAttribute(SALOMEDSImpl_AttributeTableOfInteger::GetID(),anAttr)) {
- anAttr = new SALOMEDSImpl_AttributeTableOfInteger();
- label.AddAttribute(anAttr);
+ SALOMEDSImpl_AttributeTableOfInteger* A = NULL;
+ if (!(A=(SALOMEDSImpl_AttributeTableOfInteger*)label.FindAttribute(SALOMEDSImpl_AttributeTableOfInteger::GetID()))) {
+ A = new SALOMEDSImpl_AttributeTableOfInteger();
+ label.AddAttribute(A);
}
- return anAttr;
+ return A;
}
SALOMEDSImpl_AttributeTableOfInteger::SALOMEDSImpl_AttributeTableOfInteger()
:SALOMEDSImpl_GenericAttribute("AttributeTableOfInteger")
{
- myRows = new TColStd_HSequenceOfExtendedString();
- myCols = new TColStd_HSequenceOfExtendedString();
myNbRows = 0;
myNbColumns = 0;
}
-void SALOMEDSImpl_AttributeTableOfInteger::SetNbColumns(const Standard_Integer theNbColumns)
+void SALOMEDSImpl_AttributeTableOfInteger::SetNbColumns(const int theNbColumns)
{
CheckLocked();
Backup();
- TColStd_DataMapOfIntegerInteger aMap;
+ map<int, int> aMap;
aMap = myTable;
- myTable.Clear();
+ myTable.clear();
- TColStd_DataMapIteratorOfDataMapOfIntegerInteger anIterator(aMap);
- for(; anIterator.More(); anIterator.Next()) {
- int aRow = (int)(anIterator.Key()/myNbColumns) + 1;
- int aCol = (int)(anIterator.Key() - myNbColumns*(aRow-1));
+
+ for(MI p = aMap.begin(); p != aMap.end(); p++) {
+ int aRow = (int)(p->first/myNbColumns) + 1;
+ int aCol = (int)(p->first - myNbColumns*(aRow-1));
if(aCol == 0) { aCol = myNbColumns; aRow--; }
if(aCol > theNbColumns) continue;
int aKey = (aRow-1)*theNbColumns+aCol;
- myTable.Bind(aKey, anIterator.Value());
+ myTable[aKey] = p->second;
}
myNbColumns = theNbColumns;
- while (myCols->Length() < myNbColumns) { // append empty columns titles
- myCols->Append(TCollection_ExtendedString(""));
+ while (myCols.size() < myNbColumns) { // append empty columns titles
+ myCols.push_back(std::string(""));
}
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-void SALOMEDSImpl_AttributeTableOfInteger::SetTitle(const TCollection_ExtendedString& theTitle)
+void SALOMEDSImpl_AttributeTableOfInteger::SetTitle(const std::string& theTitle)
{
CheckLocked();
Backup();
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfInteger::GetTitle() const
+std::string SALOMEDSImpl_AttributeTableOfInteger::GetTitle() const
{
return myTitle;
}
-void SALOMEDSImpl_AttributeTableOfInteger::SetRowData(const Standard_Integer theRow,
- const Handle(TColStd_HSequenceOfInteger)& theData)
+void SALOMEDSImpl_AttributeTableOfInteger::SetRowData(const int theRow,
+ const vector<int>& theData)
{
CheckLocked();
- if(theData->Length() > myNbColumns) SetNbColumns(theData->Length());
+ if(theData.size() > myNbColumns) SetNbColumns(theData.size());
Backup();
- while (myRows->Length() < theRow) { // append new row titles
- myRows->Append(TCollection_ExtendedString(""));
+ while (myRows.size() < theRow) { // append new row titles
+ myRows.push_back(std::string(""));
}
- Standard_Integer i, aShift = (theRow-1)*myNbColumns, aLength = theData->Length();
+ int i, aShift = (theRow-1)*myNbColumns, aLength = theData.size();
for(i = 1; i <= aLength; i++) {
- myTable.Bind(aShift + i, theData->Value(i));
+ myTable[aShift + i] = theData[i-1];
}
if(theRow > myNbRows) myNbRows = theRow;
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-Handle(TColStd_HSequenceOfInteger) SALOMEDSImpl_AttributeTableOfInteger::GetRowData(const Standard_Integer theRow)
+vector<int> SALOMEDSImpl_AttributeTableOfInteger::GetRowData(const int theRow)
{
- Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger();
- Standard_Integer i, aShift = (theRow-1)*myNbColumns;
+ vector<int> aSeq;
+ int i, aShift = (theRow-1)*myNbColumns;
for(i = 1; i <= myNbColumns; i++) {
- if(myTable.IsBound(aShift+i))
- aSeq->Append(myTable.Find(aShift+i));
+ if(myTable.find(aShift+i) != myTable.end())
+ aSeq.push_back(myTable[aShift+i]);
else
- aSeq->Append(0);
+ aSeq.push_back(0);
}
return aSeq;
}
-void SALOMEDSImpl_AttributeTableOfInteger::SetRowTitle(const Standard_Integer theRow,
- const TCollection_ExtendedString& theTitle)
+void SALOMEDSImpl_AttributeTableOfInteger::SetRowTitle(const int theRow,
+ const std::string& theTitle)
{
CheckLocked();
Backup();
- TCollection_ExtendedString aTitle(theTitle), aUnit = GetRowUnit(theRow);
- if(aUnit.Length()>0) {
+ string aTitle(theTitle), aUnit = GetRowUnit(theRow);
+ if(aUnit.size()>0) {
aTitle += SEPARATOR;
aTitle += aUnit;
}
- myRows->SetValue(theRow, aTitle);
+ myRows[theRow-1] = aTitle;
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-void SALOMEDSImpl_AttributeTableOfInteger::SetRowUnit(const Standard_Integer theRow,
- const TCollection_ExtendedString& theUnit)
+void SALOMEDSImpl_AttributeTableOfInteger::SetRowUnit(const int theRow,
+ const std::string& theUnit)
{
CheckLocked();
Backup();
- TCollection_ExtendedString aTitle = GetRowTitle(theRow);
+ std::string aTitle = GetRowTitle(theRow);
aTitle += SEPARATOR;
aTitle += theUnit;
- myRows->SetValue(theRow, aTitle);
+ myRows[theRow-1] = aTitle;
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-void SALOMEDSImpl_AttributeTableOfInteger::SetRowUnits(const Handle(TColStd_HSequenceOfExtendedString)& theUnits)
+void SALOMEDSImpl_AttributeTableOfInteger::SetRowUnits(const vector<string>& theUnits)
{
- if (theUnits->Length() != GetNbRows()) Standard_Failure::Raise("Invalid number of rows");
- int aLength = theUnits->Length(), i;
- for(i = 1; i <= aLength; i++) SetRowUnit(i, theUnits->Value(i));
+ if (theUnits.size() != GetNbRows()) throw DFexception("Invalid number of rows");
+ int aLength = theUnits.size(), i;
+ for(i = 1; i <= aLength; i++) SetRowUnit(i, theUnits[i-1]);
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfInteger::GetRowUnits()
+vector<string> SALOMEDSImpl_AttributeTableOfInteger::GetRowUnits()
{
- Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
- int aLength = myRows->Length(), i;
- for(i=1; i<=aLength; i++) aSeq->Append(getUnit(myRows->Value(i)));
+ vector<string> aSeq;
+ int aLength = myRows.size(), i;
+ for(i=0; i<aLength; i++) aSeq.push_back(getUnit(myRows[i]));
return aSeq;
}
-void SALOMEDSImpl_AttributeTableOfInteger::SetRowTitles(const Handle(TColStd_HSequenceOfExtendedString)& theTitles)
+void SALOMEDSImpl_AttributeTableOfInteger::SetRowTitles(const vector<string>& theTitles)
{
- if (theTitles->Length() != GetNbRows()) Standard_Failure::Raise("Invalid number of rows");
- int aLength = theTitles->Length(), i;
- for(i = 1; i <= aLength; i++) SetRowTitle(i, theTitles->Value(i));
+ if (theTitles.size() != GetNbRows()) throw DFexception("Invalid number of rows");
+ int aLength = theTitles.size(), i;
+ for(i = 1; i <= aLength; i++) SetRowTitle(i, theTitles[i-1]);
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfInteger::GetRowTitles()
+vector<string> SALOMEDSImpl_AttributeTableOfInteger::GetRowTitles()
{
- Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
- int aLength = myRows->Length(), i;
- for(i=1; i<=aLength; i++) aSeq->Append(getTitle(myRows->Value(i)));
+ vector<string> aSeq;
+ int aLength = myRows.size(), i;
+ for(i=0; i<aLength; i++) aSeq.push_back(getTitle(myRows[i]));
return aSeq;
}
-TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfInteger::GetRowTitle(const Standard_Integer theRow) const
+std::string SALOMEDSImpl_AttributeTableOfInteger::GetRowTitle(const int theRow) const
{
- return getTitle(myRows->Value(theRow));
+ return getTitle(myRows[theRow-1]);
}
-TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfInteger::GetRowUnit(const Standard_Integer theRow) const
+std::string SALOMEDSImpl_AttributeTableOfInteger::GetRowUnit(const int theRow) const
{
- return getUnit(myRows->Value(theRow));
+ return getUnit(myRows[theRow-1]);
}
-void SALOMEDSImpl_AttributeTableOfInteger::SetColumnData(const Standard_Integer theColumn,
- const Handle(TColStd_HSequenceOfInteger)& theData)
+void SALOMEDSImpl_AttributeTableOfInteger::SetColumnData(const int theColumn,
+ const vector<int>& theData)
{
CheckLocked();
if(theColumn > myNbColumns) SetNbColumns(theColumn);
Backup();
- Standard_Integer i, aLength = theData->Length();
+ int i, aLength = theData.size();
for(i = 1; i <= aLength; i++) {
- myTable.Bind(myNbColumns*(i-1)+theColumn, theData->Value(i));
+ myTable[myNbColumns*(i-1)+theColumn] = theData[i-1];
}
if(aLength > myNbRows) {
myNbRows = aLength;
- while (myRows->Length() < myNbRows) { // append empty row titles
- myRows->Append(TCollection_ExtendedString(""));
+ while (myRows.size() < myNbRows) { // append empty row titles
+ myRows.push_back(std::string(""));
}
}
}
-Handle(TColStd_HSequenceOfInteger) SALOMEDSImpl_AttributeTableOfInteger::GetColumnData(const Standard_Integer theColumn)
+vector<int> SALOMEDSImpl_AttributeTableOfInteger::GetColumnData(const int theColumn)
{
- Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger;
-
- Standard_Integer i, anIndex;
+ vector<int> aSeq;
+ int i, anIndex;
for(i = 1; i <= myNbRows; i++) {
anIndex = myNbColumns*(i-1) + theColumn;
- if(myTable.IsBound(anIndex))
- aSeq->Append(myTable.Find(anIndex));
+ if(myTable.find(anIndex) != myTable.end())
+ aSeq.push_back(myTable[anIndex]);
else
- aSeq->Append(0);
+ aSeq.push_back(0);
}
return aSeq;
}
-void SALOMEDSImpl_AttributeTableOfInteger::SetColumnTitle(const Standard_Integer theColumn,
- const TCollection_ExtendedString& theTitle)
+void SALOMEDSImpl_AttributeTableOfInteger::SetColumnTitle(const int theColumn,
+ const std::string& theTitle)
{
CheckLocked();
Backup();
- while(myCols->Length() < theColumn) myCols->Append(TCollection_ExtendedString(""));
- myCols->SetValue(theColumn,theTitle);
+ while(myCols.size() < theColumn) myCols.push_back(std::string(""));
+ myCols[theColumn-1] = theTitle;
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfInteger::GetColumnTitle(const Standard_Integer theColumn) const
+std::string SALOMEDSImpl_AttributeTableOfInteger::GetColumnTitle(const int theColumn) const
{
- if(myCols.IsNull()) return "";
- if(myCols->Length() < theColumn) return "";
- return myCols->Value(theColumn);
+ if(myCols.empty()) return "";
+ if(myCols.size() < theColumn) return "";
+ return myCols[theColumn-1];
}
-void SALOMEDSImpl_AttributeTableOfInteger::SetColumnTitles(const Handle(TColStd_HSequenceOfExtendedString)& theTitles)
+void SALOMEDSImpl_AttributeTableOfInteger::SetColumnTitles(const vector<string>& theTitles)
{
- if (theTitles->Length() != myNbColumns) Standard_Failure::Raise("Invalid number of columns");
- int aLength = theTitles->Length(), i;
- for(i = 1; i <= aLength; i++) myCols->SetValue(i, theTitles->Value(i));
+ if (theTitles.size() != myNbColumns) throw DFexception("Invalid number of columns");
+ int aLength = theTitles.size(), i;
+ for(i = 0; i < aLength; i++) myCols[i] = theTitles[i];
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfInteger::GetColumnTitles()
+vector<string> SALOMEDSImpl_AttributeTableOfInteger::GetColumnTitles()
{
- Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
- int aLength = myCols->Length(), i;
- for(i=1; i<=aLength; i++) aSeq->Append(myCols->Value(i));
+ vector<string> aSeq;
+ int aLength = myCols.size(), i;
+ for(i=0; i<aLength; i++) aSeq.push_back(myCols[i]);
return aSeq;
}
-Standard_Integer SALOMEDSImpl_AttributeTableOfInteger::GetNbRows() const
+int SALOMEDSImpl_AttributeTableOfInteger::GetNbRows() const
{
return myNbRows;
}
-Standard_Integer SALOMEDSImpl_AttributeTableOfInteger::GetNbColumns() const
+int SALOMEDSImpl_AttributeTableOfInteger::GetNbColumns() const
{
return myNbColumns;
}
-void SALOMEDSImpl_AttributeTableOfInteger::PutValue(const Standard_Integer theValue,
- const Standard_Integer theRow,
- const Standard_Integer theColumn)
+void SALOMEDSImpl_AttributeTableOfInteger::PutValue(const int theValue,
+ const int theRow,
+ const int theColumn)
{
CheckLocked();
if(theColumn > myNbColumns) SetNbColumns(theColumn);
- Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn;
- myTable.Bind(anIndex, theValue);
+ int anIndex = (theRow-1)*myNbColumns + theColumn;
+ myTable[anIndex] = theValue;
if(theRow > myNbRows) {
- while (myRows->Length() < theRow) { // append empty row titles
- myRows->Append(TCollection_ExtendedString(""));
+ while (myRows.size() < theRow) { // append empty row titles
+ myRows.push_back(std::string(""));
}
myNbRows = theRow;
}
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-Standard_Boolean SALOMEDSImpl_AttributeTableOfInteger::HasValue(const Standard_Integer theRow,
- const Standard_Integer theColumn)
+bool SALOMEDSImpl_AttributeTableOfInteger::HasValue(const int theRow,
+ const int theColumn)
{
- if(theRow > myNbRows || theRow < 1) return Standard_False;
- if(theColumn > myNbColumns || theColumn < 1) return Standard_False;
- Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn;
- return myTable.IsBound(anIndex);
+ if(theRow > myNbRows || theRow < 1) return false;
+ if(theColumn > myNbColumns || theColumn < 1) return false;
+ int anIndex = (theRow-1)*myNbColumns + theColumn;
+ return (myTable.find(anIndex) != myTable.end());
}
-Standard_Integer SALOMEDSImpl_AttributeTableOfInteger::GetValue(const Standard_Integer theRow,
- const Standard_Integer theColumn)
+int SALOMEDSImpl_AttributeTableOfInteger::GetValue(const int theRow,
+ const int theColumn)
{
- if(theRow > myNbRows || theRow < 1) Standard_Failure::Raise("Invalid cell index");
- if(theColumn > myNbColumns || theColumn < 1) Standard_Failure::Raise("Invalid cell index");
+ if(theRow > myNbRows || theRow < 1) throw DFexception("Invalid cell index");
+ if(theColumn > myNbColumns || theColumn < 1) DFexception("Invalid cell index");
- Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn;
- if(myTable.IsBound(anIndex)) return myTable.Find(anIndex);
+ int anIndex = (theRow-1)*myNbColumns + theColumn;
+ if(myTable.find(anIndex) != myTable.end()) return myTable[anIndex];
- Standard_Failure::Raise("Invalid cell index");
+ throw DFexception("Invalid cell index");
return 0;
}
-const Standard_GUID& SALOMEDSImpl_AttributeTableOfInteger::ID() const
+const std::string& SALOMEDSImpl_AttributeTableOfInteger::ID() const
{
return GetID();
}
-void SALOMEDSImpl_AttributeTableOfInteger::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributeTableOfInteger::Restore(DF_Attribute* with)
{
- Standard_Integer anIndex;
- Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(with);
+ int anIndex;
+ SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(with);
+ if(!aTable) throw DFexception("Can't Restore from a null attribute");
- myTable.Clear();
- myCols->Clear();
- myRows->Clear();
+ myTable.clear();
+ myCols.clear();
+ myRows.clear();
myTable = aTable->myTable;
myNbRows = aTable->myNbRows;
myTitle = aTable->myTitle;
for(anIndex = 1; anIndex <= aTable->GetNbRows();anIndex++)
- myRows->Append(aTable->GetRowTitle(anIndex));
+ myRows.push_back(aTable->GetRowTitle(anIndex));
for(anIndex = 1; anIndex <= aTable->GetNbColumns(); anIndex++)
- myCols->Append(aTable->GetColumnTitle(anIndex));
+ myCols.push_back(aTable->GetColumnTitle(anIndex));
}
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeTableOfInteger::NewEmpty() const
+DF_Attribute* SALOMEDSImpl_AttributeTableOfInteger::NewEmpty() const
{
return new SALOMEDSImpl_AttributeTableOfInteger();
}
-void SALOMEDSImpl_AttributeTableOfInteger::Paste(const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)&) const
+void SALOMEDSImpl_AttributeTableOfInteger::Paste(DF_Attribute* into)
{
- Standard_Integer anIndex;
- Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(into);
+ int anIndex;
+ SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(into);
+ if(!aTable) throw DFexception("Can't Paste into a null attribute");
- aTable->myTable.Clear();
- aTable->myCols->Clear();
- aTable->myRows->Clear();
+ aTable->myTable.clear();
+ aTable->myCols.clear();
+ aTable->myRows.clear();
aTable->myTable = myTable;
aTable->myTitle = myTitle;
aTable->myNbColumns = myNbColumns;
for(anIndex = 1; anIndex <= GetNbRows();anIndex++)
- aTable->myRows->Append(GetRowTitle(anIndex));
+ aTable->myRows.push_back(GetRowTitle(anIndex));
for(anIndex = 1; anIndex <= GetNbColumns(); anIndex++)
- aTable->myCols->Append(GetColumnTitle(anIndex));
+ aTable->myCols.push_back(GetColumnTitle(anIndex));
}
-Handle_TColStd_HSequenceOfInteger SALOMEDSImpl_AttributeTableOfInteger::GetSetRowIndices(const Standard_Integer theRow)
+vector<int> SALOMEDSImpl_AttributeTableOfInteger::GetSetRowIndices(const int theRow)
{
- Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger;
+ vector<int> aSeq;
- Standard_Integer i, aShift = myNbColumns*(theRow-1);
+ int i, aShift = myNbColumns*(theRow-1);
for(i = 1; i <= myNbColumns; i++) {
- if(myTable.IsBound(aShift + i)) aSeq->Append(i);
+ if(myTable.find(aShift + i) != myTable.end()) aSeq.push_back(i);
}
return aSeq;
}
-Handle_TColStd_HSequenceOfInteger SALOMEDSImpl_AttributeTableOfInteger::GetSetColumnIndices(const Standard_Integer theColumn)
+vector<int> SALOMEDSImpl_AttributeTableOfInteger::GetSetColumnIndices(const int theColumn)
{
- Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger;
+ vector<int> aSeq;
- Standard_Integer i, anIndex;
+ int i, anIndex;
for(i = 1; i <= myNbRows; i++) {
anIndex = myNbColumns*(i-1)+theColumn;
- if(myTable.IsBound(anIndex)) aSeq->Append(i);
+ if(myTable.find(anIndex) != myTable.end()) aSeq.push_back(i);
}
return aSeq;
}
-void SALOMEDSImpl_AttributeTableOfInteger::ConvertToString(ostrstream& theStream)
+string SALOMEDSImpl_AttributeTableOfInteger::Save()
{
+ ostrstream theStream;
int i, j, l;
theStream.precision(64);
//Title
- l = myTitle.Length();
+ l = myTitle.size();
theStream << l << "\n";
- for(i=1; i<=l; i++)
- theStream << myTitle.Value(i) << "\n";
+ for(i=0; i<l; i++)
+ theStream << myTitle[i] << "\n";
//Nb rows
theStream << myNbRows << "\n";
//Rows titles
- for(i=1; i<=myNbRows; i++) {
- l = myRows->Value(i).Length();
+ for(i=0; i<myNbRows; i++) {
+ l = myRows[i].size();
theStream << l << "\n";
- for(j=1; j<=l; j++)
- theStream << myRows->Value(i).Value(j) << "\n";
+ for(j=0; j<l; j++)
+ theStream << myRows[i][j] << "\n";
}
//Nb columns
theStream << myNbColumns << "\n";
//Columns titles
- for(i=1; i<=myNbColumns; i++) {
- l = myCols->Value(i).Length();
+ for(i=0; i<myNbColumns; i++) {
+ l = myCols[i].size();
theStream << l << "\n";
- for(j=1; j<=l; j++)
- theStream << myCols->Value(i).Value(j) << "\n";
+ for(j=0; j<l; j++)
+ theStream << myCols[i][j] << "\n";
}
//Store the table values
- l = myTable.Extent();
+ l = myTable.size();
theStream << l << "\n";
- TColStd_DataMapIteratorOfDataMapOfIntegerInteger anIterator(myTable);
- for(; anIterator.More(); anIterator.Next()) {
- theStream << anIterator.Key() << "\n";
- theStream << anIterator.Value() << "\n";
+ for(MI p = myTable.begin(); p != myTable.end(); p++) {
+ theStream << p->first << "\n";
+ theStream << p->second << "\n";
}
- return;
+ string aString((char*)theStream.rdbuf()->str());
+ return aString;
}
-bool SALOMEDSImpl_AttributeTableOfInteger::RestoreFromString(istrstream& theStream)
+void SALOMEDSImpl_AttributeTableOfInteger::Load(const string& value)
{
+ istrstream theStream(value.c_str(), strlen(value.c_str()));
Backup();
int i, j, l;
- Standard_ExtCharacter anExtChar;
- TCollection_ExtendedString aStr;
+ char anExtChar;
+ std::string aStr;
//Title
theStream >> l;
- myTitle = TCollection_ExtendedString(l, 0);
- for(i=1; i<=l; i++) {
+ myTitle = std::string(l, 0);
+ for(i=0; i<l; i++) {
theStream >> anExtChar;
- myTitle.SetValue(i, anExtChar);
+ myTitle[i] = anExtChar;
}
//Nb rows
theStream >> myNbRows;
//Rows titles
- myRows->Clear();
+ myRows.clear();
for(i=1; i<=myNbRows; i++) {
theStream >> l;
- aStr = TCollection_ExtendedString(l,0);
- for(j=1; j<=l; j++) {
+ aStr = std::string(l,0);
+ for(j=0; j<l; j++) {
theStream >> anExtChar;
- aStr.SetValue(j, anExtChar);
+ aStr[j] = anExtChar;
}
- myRows->Append(aStr);
+ myRows.push_back(aStr);
}
//Nb columns
theStream >> myNbColumns;
//Columns titles
- myCols->Clear();
+ myCols.clear();
for(i=1; i<=myNbColumns; i++) {
theStream >> l;
- aStr = TCollection_ExtendedString(l,0);
- for(j=1; j<=l; j++) {
+ aStr = std::string(l,0);
+ for(j=0; j<l; j++) {
theStream >> anExtChar;
- aStr.SetValue(j, anExtChar);
+ aStr[j] = anExtChar;
}
- myCols->Append(aStr);
+ myCols.push_back(aStr);
}
//Restore the table values
theStream >> l;
- myTable.Clear();
+ myTable.clear();
for(i=1; i<=l; i++) {
int aKey, aValue;
theStream >> aKey;
theStream >> aValue;
- myTable.Bind(aKey, aValue);
+ myTable[aKey] = aValue;
}
-
- return true;
-}
-
-
-TCollection_AsciiString SALOMEDSImpl_AttributeTableOfInteger::Save()
-{
- ostrstream ostr;
- ConvertToString(ostr);
- TCollection_AsciiString aString((char*)ostr.rdbuf()->str());
- return aString;
-}
-
-void SALOMEDSImpl_AttributeTableOfInteger::Load(const TCollection_AsciiString& value)
-{
- istrstream aStream(value.ToCString(), strlen(value.ToCString()));
- RestoreFromString(aStream);
}
#ifndef _SALOMEDSImpl_AttributeTableOfInteger_HeaderFile
#define _SALOMEDSImpl_AttributeTableOfInteger_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <Standard.hxx>
-#include <TDF_Attribute.hxx>
-#include <TDF_Label.hxx>
+#include "DF_Attribute.hxx"
+#include "DF_Label.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Standard_GUID;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
+#include <string>
+#include <vector>
+#include <map>
-#include <TColStd_SequenceOfTransient.hxx>
-#include <TCollection_ExtendedString.hxx>
-#include <Handle_TColStd_HSequenceOfExtendedString.hxx>
-#include <TColStd_DataMapOfIntegerInteger.hxx>
-#include <TColStd_HSequenceOfInteger.hxx>
-#include <strstream>
-#include <TCollection_AsciiString.hxx>
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeTableOfInteger, SALOMEDSImpl_GenericAttribute )
class SALOMEDSImpl_AttributeTableOfInteger : public SALOMEDSImpl_GenericAttribute
{
public:
-Standard_EXPORT virtual TCollection_AsciiString Save();
-Standard_EXPORT virtual void Load(const TCollection_AsciiString&);
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDSImpl_AttributeTableOfInteger Set(const TDF_Label& label) ;
+Standard_EXPORT virtual std::string Save();
+Standard_EXPORT virtual void Load(const std::string&);
+Standard_EXPORT static const std::string& GetID() ;
+Standard_EXPORT static SALOMEDSImpl_AttributeTableOfInteger* Set(const DF_Label& label) ;
Standard_EXPORT SALOMEDSImpl_AttributeTableOfInteger();
-Standard_EXPORT void SetNbColumns(const Standard_Integer theNbColumns);
-Standard_EXPORT void SetTitle(const TCollection_ExtendedString& theTitle) ;
-Standard_EXPORT TCollection_ExtendedString GetTitle() const;
-Standard_EXPORT void SetRowData(const Standard_Integer theRow,const Handle(TColStd_HSequenceOfInteger)& theData) ;
-Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetRowData(const Standard_Integer theRow) ;
-Standard_EXPORT void SetRowTitle(const Standard_Integer theRow,const TCollection_ExtendedString& theTitle) ;
-Standard_EXPORT void SetRowUnit(const Standard_Integer theRow,const TCollection_ExtendedString& theUnit) ;
-Standard_EXPORT TCollection_ExtendedString GetRowUnit(const Standard_Integer theRow) const;
-Standard_EXPORT void SetRowUnits(const Handle(TColStd_HSequenceOfExtendedString)& theUnits) ;
-Standard_EXPORT Handle(TColStd_HSequenceOfExtendedString) GetRowUnits();
-Standard_EXPORT void SetRowTitles(const Handle(TColStd_HSequenceOfExtendedString)& theTitles) ;
-Standard_EXPORT Handle(TColStd_HSequenceOfExtendedString) GetRowTitles();
-Standard_EXPORT TCollection_ExtendedString GetRowTitle(const Standard_Integer theRow) const;
-Standard_EXPORT void SetColumnData(const Standard_Integer theColumn,const Handle(TColStd_HSequenceOfInteger)& theData) ;
-Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetColumnData(const Standard_Integer theColumn) ;
-Standard_EXPORT void SetColumnTitle(const Standard_Integer theColumn,const TCollection_ExtendedString& theTitle) ;
-Standard_EXPORT TCollection_ExtendedString GetColumnTitle(const Standard_Integer theColumn) const;
-Standard_EXPORT void SetColumnTitles(const Handle(TColStd_HSequenceOfExtendedString)& theTitles);
-Standard_EXPORT Handle(TColStd_HSequenceOfExtendedString) GetColumnTitles();
-Standard_EXPORT Standard_Integer GetNbRows() const;
-Standard_EXPORT Standard_Integer GetNbColumns() const;
-
-Standard_EXPORT void PutValue(const Standard_Integer theValue,const Standard_Integer theRow,const Standard_Integer theColumn) ;
-Standard_EXPORT Standard_Boolean HasValue(const Standard_Integer theRow,const Standard_Integer theColumn) ;
-Standard_EXPORT Standard_Integer GetValue(const Standard_Integer theRow,const Standard_Integer theColumn) ;
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+Standard_EXPORT void SetNbColumns(const int theNbColumns);
+Standard_EXPORT void SetTitle(const std::string& theTitle) ;
+Standard_EXPORT std::string GetTitle() const;
+Standard_EXPORT void SetRowData(const int theRow,const std::vector<int>& theData) ;
+Standard_EXPORT std::vector<int> GetRowData(const int theRow) ;
+Standard_EXPORT void SetRowTitle(const int theRow,const std::string& theTitle) ;
+Standard_EXPORT void SetRowUnit(const int theRow,const std::string& theUnit) ;
+Standard_EXPORT std::string GetRowUnit(const int theRow) const;
+Standard_EXPORT void SetRowUnits(const std::vector<std::string>& theUnits) ;
+Standard_EXPORT std::vector<std::string> GetRowUnits();
+Standard_EXPORT void SetRowTitles(const std::vector<std::string>& theTitles) ;
+Standard_EXPORT std::vector<std::string> GetRowTitles();
+Standard_EXPORT std::string GetRowTitle(const int theRow) const;
+Standard_EXPORT void SetColumnData(const int theColumn,const std::vector<int>& theData) ;
+Standard_EXPORT std::vector<int> GetColumnData(const int theColumn) ;
+Standard_EXPORT void SetColumnTitle(const int theColumn,const std::string& theTitle) ;
+Standard_EXPORT std::string GetColumnTitle(const int theColumn) const;
+Standard_EXPORT void SetColumnTitles(const std::vector<std::string>& theTitles);
+Standard_EXPORT std::vector<std::string> GetColumnTitles();
+Standard_EXPORT int GetNbRows() const;
+Standard_EXPORT int GetNbColumns() const;
-Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetSetRowIndices(const Standard_Integer theRow);
-Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetSetColumnIndices(const Standard_Integer theColumn);
+Standard_EXPORT void PutValue(const int theValue,const int theRow,const int theColumn) ;
+Standard_EXPORT bool HasValue(const int theRow,const int theColumn) ;
+Standard_EXPORT int GetValue(const int theRow,const int theColumn) ;
+Standard_EXPORT const std::string& ID() const;
+Standard_EXPORT void Restore(DF_Attribute* with) ;
+Standard_EXPORT DF_Attribute* NewEmpty() const;
+Standard_EXPORT void Paste(DF_Attribute* into);
-Standard_EXPORT void ConvertToString(ostrstream& theStream);
-Standard_EXPORT bool RestoreFromString(istrstream& theStream);
+Standard_EXPORT std::vector<int> GetSetRowIndices(const int theRow);
+Standard_EXPORT std::vector<int> GetSetColumnIndices(const int theColumn);
Standard_EXPORT ~SALOMEDSImpl_AttributeTableOfInteger() {}
private:
-TColStd_DataMapOfIntegerInteger myTable;
-TCollection_ExtendedString myTitle;
-Handle_TColStd_HSequenceOfExtendedString myRows;
-Handle_TColStd_HSequenceOfExtendedString myCols;
-Standard_Integer myNbRows;
-Standard_Integer myNbColumns;
+std::map<int, int> myTable;
+std::string myTitle;
+std::vector<std::string> myRows;
+std::vector<std::string> myCols;
+int myNbRows;
+int myNbColumns;
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeTableOfInteger )
};
#endif
// Author : Michael Ponikarov
// Module : SALOME
-#include <SALOMEDSImpl_AttributeTableOfReal.hxx>
-#include <Standard_Failure.hxx>
-#include <TColStd_DataMapIteratorOfDataMapOfIntegerReal.hxx>
-#include <Standard_GUID.hxx>
+#include "SALOMEDSImpl_AttributeTableOfReal.hxx"
#include <stdio.h>
-#include <TColStd_HSequenceOfExtendedString.hxx>
+#include <strstream>
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeTableOfReal, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeTableOfReal, SALOMEDSImpl_GenericAttribute )
-
#define SEPARATOR '\1'
-static TCollection_ExtendedString getUnit(TCollection_ExtendedString theString)
+typedef map<int, double>::const_iterator MI;
+
+static std::string getUnit(std::string theString)
{
- TCollection_ExtendedString aString(theString);
- int aPos = aString.Search(SEPARATOR);
- if(aPos <= 0 || aPos == aString.Length() ) return TCollection_ExtendedString();
- return aString.Split(aPos);
+ std::string aString(theString);
+ int aPos = aString.find(SEPARATOR);
+ if(aPos <= 0 || aPos == aString.size() ) return std::string();
+ return aString.substr(aPos+1, aString.size());
}
-static TCollection_ExtendedString getTitle(TCollection_ExtendedString theString)
+static std::string getTitle(std::string theString)
{
- TCollection_ExtendedString aString(theString);
- int aPos = aString.Search(SEPARATOR);
+ std::string aString(theString);
+ int aPos = aString.find(SEPARATOR);
if(aPos < 1) return aString;
- if(aPos == 1) return TCollection_ExtendedString();
- aString.Split(aPos-1);
- return aString;
+ if(aPos == 1) return std::string();
+ return aString.substr(0, aPos);
}
-const Standard_GUID& SALOMEDSImpl_AttributeTableOfReal::GetID()
+const std::string& SALOMEDSImpl_AttributeTableOfReal::GetID()
{
- static Standard_GUID SALOMEDSImpl_AttributeTableOfRealID ("128371A1-8F52-11d6-A8A3-0001021E8C7F");
+ static std::string SALOMEDSImpl_AttributeTableOfRealID ("128371A1-8F52-11d6-A8A3-0001021E8C7F");
return SALOMEDSImpl_AttributeTableOfRealID;
}
-Handle(SALOMEDSImpl_AttributeTableOfReal) SALOMEDSImpl_AttributeTableOfReal::Set(const TDF_Label& label)
+SALOMEDSImpl_AttributeTableOfReal* SALOMEDSImpl_AttributeTableOfReal::Set(const DF_Label& label)
{
- Handle(SALOMEDSImpl_AttributeTableOfReal) anAttr;
- if (!label.FindAttribute(SALOMEDSImpl_AttributeTableOfReal::GetID(),anAttr)) {
- anAttr = new SALOMEDSImpl_AttributeTableOfReal();
- label.AddAttribute(anAttr);
+ SALOMEDSImpl_AttributeTableOfReal* A = NULL;
+ if (!(A=(SALOMEDSImpl_AttributeTableOfReal*)label.FindAttribute(SALOMEDSImpl_AttributeTableOfReal::GetID()))) {
+ A = new SALOMEDSImpl_AttributeTableOfReal();
+ label.AddAttribute(A);
}
- return anAttr;
+ return A;
}
SALOMEDSImpl_AttributeTableOfReal::SALOMEDSImpl_AttributeTableOfReal()
:SALOMEDSImpl_GenericAttribute("AttributeTableOfReal")
{
- myRows = new TColStd_HSequenceOfExtendedString();
- myCols = new TColStd_HSequenceOfExtendedString();
myNbRows = 0;
myNbColumns = 0;
}
-void SALOMEDSImpl_AttributeTableOfReal::SetNbColumns(const Standard_Integer theNbColumns)
+void SALOMEDSImpl_AttributeTableOfReal::SetNbColumns(const int theNbColumns)
{
CheckLocked();
Backup();
- TColStd_DataMapOfIntegerReal aMap;
+ map<int, double> aMap;
aMap = myTable;
- myTable.Clear();
+ myTable.clear();
- TColStd_DataMapIteratorOfDataMapOfIntegerReal anIterator(aMap);
- for(; anIterator.More(); anIterator.Next()) {
- int aRow = (int)(anIterator.Key()/myNbColumns) + 1;
- int aCol = (int)(anIterator.Key() - myNbColumns*(aRow-1));
+ for(MI p = aMap.begin(); p != aMap.end(); p++) {
+ int aRow = (int)(p->first/myNbColumns) + 1;
+ int aCol = (int)(p->first - myNbColumns*(aRow-1));
if(aCol == 0) { aCol = myNbColumns; aRow--; }
if(aCol > theNbColumns) continue;
int aKey = (aRow-1)*theNbColumns+aCol;
- myTable.Bind(aKey, anIterator.Value());
+ myTable[aKey] = p->second;
}
myNbColumns = theNbColumns;
- while (myCols->Length() < myNbColumns) { // append empty columns titles
- myCols->Append(TCollection_ExtendedString(""));
+ while (myCols.size() < myNbColumns) { // append empty columns titles
+ myCols.push_back(string(""));
}
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-void SALOMEDSImpl_AttributeTableOfReal::SetTitle(const TCollection_ExtendedString& theTitle)
+void SALOMEDSImpl_AttributeTableOfReal::SetTitle(const std::string& theTitle)
{
CheckLocked();
Backup();
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfReal::GetTitle() const
+std::string SALOMEDSImpl_AttributeTableOfReal::GetTitle() const
{
return myTitle;
}
-void SALOMEDSImpl_AttributeTableOfReal::SetRowData(const Standard_Integer theRow,
- const Handle(TColStd_HSequenceOfReal)& theData)
+void SALOMEDSImpl_AttributeTableOfReal::SetRowData(const int theRow,
+ const vector<double>& theData)
{
CheckLocked();
- if(theData->Length() > myNbColumns) SetNbColumns(theData->Length());
+ if(theData.size() > myNbColumns) SetNbColumns(theData.size());
Backup();
- while (myRows->Length() < theRow) { // append new row titles
- myRows->Append(TCollection_ExtendedString(""));
+ while (myRows.size() < theRow) { // append new row titles
+ myRows.push_back(std::string(""));
}
- Standard_Integer i, aShift = (theRow-1)*myNbColumns, aLength = theData->Length();
+ int i, aShift = (theRow-1)*myNbColumns, aLength = theData.size();
for(i = 1; i <= aLength; i++) {
- myTable.Bind(aShift + i, theData->Value(i));
+ myTable[aShift + i] = theData[i-1];
}
if(theRow > myNbRows) myNbRows = theRow;
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-Handle(TColStd_HSequenceOfReal) SALOMEDSImpl_AttributeTableOfReal::GetRowData(const Standard_Integer theRow)
+vector<double> SALOMEDSImpl_AttributeTableOfReal::GetRowData(const int theRow)
{
- Handle(TColStd_HSequenceOfReal) aSeq = new TColStd_HSequenceOfReal();
- Standard_Integer i, aShift = (theRow-1)*myNbColumns;
+ vector<double> aSeq;
+ int i, aShift = (theRow-1)*myNbColumns;
for(i = 1; i <= myNbColumns; i++) {
- if(myTable.IsBound(aShift+i))
- aSeq->Append(myTable.Find(aShift+i));
+ if(myTable.find(aShift+i) != myTable.end())
+ aSeq.push_back(myTable[aShift+i]);
else
- aSeq->Append(0.);
+ aSeq.push_back(0.);
}
return aSeq;
}
-void SALOMEDSImpl_AttributeTableOfReal::SetRowTitle(const Standard_Integer theRow,
- const TCollection_ExtendedString& theTitle)
+void SALOMEDSImpl_AttributeTableOfReal::SetRowTitle(const int theRow,
+ const std::string& theTitle)
{
CheckLocked();
Backup();
- TCollection_ExtendedString aTitle(theTitle), aUnit = GetRowUnit(theRow);
- if(aUnit.Length()>0) {
+ std::string aTitle(theTitle), aUnit = GetRowUnit(theRow);
+ if(aUnit.size()>0) {
aTitle += SEPARATOR;
aTitle += aUnit;
}
- myRows->SetValue(theRow, aTitle);
+ myRows[theRow-1] = aTitle;
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-void SALOMEDSImpl_AttributeTableOfReal::SetRowUnit(const Standard_Integer theRow,
- const TCollection_ExtendedString& theUnit)
+void SALOMEDSImpl_AttributeTableOfReal::SetRowUnit(const int theRow,
+ const std::string& theUnit)
{
CheckLocked();
Backup();
- TCollection_ExtendedString aTitle = GetRowTitle(theRow);
+ std::string aTitle = GetRowTitle(theRow);
aTitle += SEPARATOR;
aTitle += theUnit;
-
- myRows->SetValue(theRow, aTitle);
+
+ myRows[theRow-1] = aTitle;
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-void SALOMEDSImpl_AttributeTableOfReal::SetRowUnits(const Handle(TColStd_HSequenceOfExtendedString)& theUnits)
+void SALOMEDSImpl_AttributeTableOfReal::SetRowUnits(const vector<string>& theUnits)
{
- if (theUnits->Length() != GetNbRows()) Standard_Failure::Raise("Invalid number of rows");
- int aLength = theUnits->Length(), i;
- for(i = 1; i <= aLength; i++) SetRowUnit(i, theUnits->Value(i));
+ if (theUnits.size() != GetNbRows()) throw DFexception("Invalid number of rows");
+ int aLength = theUnits.size(), i;
+ for(i = 1; i <= aLength; i++) SetRowUnit(i, theUnits[i-1]);
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfReal::GetRowUnits()
+vector<string> SALOMEDSImpl_AttributeTableOfReal::GetRowUnits()
{
- Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
- int aLength = myRows->Length(), i;
- for(i=1; i<=aLength; i++) aSeq->Append(getUnit(myRows->Value(i)));
+ vector<string> aSeq;
+ int aLength = myRows.size(), i;
+ for(i=0; i<aLength; i++) aSeq.push_back(getUnit(myRows[i]));
return aSeq;
}
-void SALOMEDSImpl_AttributeTableOfReal::SetRowTitles(const Handle(TColStd_HSequenceOfExtendedString)& theTitles)
+void SALOMEDSImpl_AttributeTableOfReal::SetRowTitles(const vector<string>& theTitles)
{
- if (theTitles->Length() != GetNbRows()) Standard_Failure::Raise("Invalid number of rows");
- int aLength = theTitles->Length(), i;
- for(i = 1; i <= aLength; i++) SetRowTitle(i, theTitles->Value(i));
+ if (theTitles.size() != GetNbRows()) throw DFexception("Invalid number of rows");
+ int aLength = theTitles.size(), i;
+ for(i = 1; i <= aLength; i++) SetRowTitle(i, theTitles[i-1]);
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfReal::GetRowTitles()
+vector<string> SALOMEDSImpl_AttributeTableOfReal::GetRowTitles()
{
- Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
- int aLength = myRows->Length(), i;
- for(i=1; i<=aLength; i++) aSeq->Append(getTitle(myRows->Value(i)));
+ vector<string> aSeq;
+ int aLength = myRows.size(), i;
+ for(i=0; i<aLength; i++) aSeq.push_back(getTitle(myRows[i]));
return aSeq;
}
-TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfReal::GetRowTitle(const Standard_Integer theRow) const
+std::string SALOMEDSImpl_AttributeTableOfReal::GetRowTitle(const int theRow) const
{
- return getTitle(myRows->Value(theRow));
+ return getTitle(myRows[theRow-1]);
}
-TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfReal::GetRowUnit(const Standard_Integer theRow) const
+std::string SALOMEDSImpl_AttributeTableOfReal::GetRowUnit(const int theRow) const
{
- return getUnit(myRows->Value(theRow));
+ return getUnit(myRows[theRow-1]);
}
-void SALOMEDSImpl_AttributeTableOfReal::SetColumnData(const Standard_Integer theColumn,
- const Handle(TColStd_HSequenceOfReal)& theData)
+void SALOMEDSImpl_AttributeTableOfReal::SetColumnData(const int theColumn,
+ const vector<double>& theData)
{
CheckLocked();
if(theColumn > myNbColumns) SetNbColumns(theColumn);
Backup();
- Standard_Integer i, aLength = theData->Length();
+ int i, aLength = theData.size();
for(i = 1; i <= aLength; i++) {
- myTable.Bind(myNbColumns*(i-1)+theColumn, theData->Value(i));
+ myTable[myNbColumns*(i-1)+theColumn] = theData[i-1];
}
if(aLength > myNbRows) {
myNbRows = aLength;
- while (myRows->Length() < myNbRows) { // append empty row titles
- myRows->Append(TCollection_ExtendedString(""));
+ while (myRows.size() < myNbRows) { // append empty row titles
+ myRows.push_back(string(""));
}
}
}
-Handle(TColStd_HSequenceOfReal) SALOMEDSImpl_AttributeTableOfReal::GetColumnData(const Standard_Integer theColumn)
+vector<double> SALOMEDSImpl_AttributeTableOfReal::GetColumnData(const int theColumn)
{
- Handle(TColStd_HSequenceOfReal) aSeq = new TColStd_HSequenceOfReal;
+ vector<double> aSeq;
- Standard_Integer i, anIndex;
+ int i, anIndex;
for(i = 1; i <= myNbRows; i++) {
anIndex = myNbColumns*(i-1) + theColumn;
- if(myTable.IsBound(anIndex))
- aSeq->Append(myTable.Find(anIndex));
+ if(myTable.find(anIndex) != myTable.end())
+ aSeq.push_back(myTable[anIndex]);
else
- aSeq->Append(0.);
+ aSeq.push_back(0.);
}
return aSeq;
}
-void SALOMEDSImpl_AttributeTableOfReal::SetColumnTitle(const Standard_Integer theColumn,
- const TCollection_ExtendedString& theTitle)
+void SALOMEDSImpl_AttributeTableOfReal::SetColumnTitle(const int theColumn,
+ const std::string& theTitle)
{
CheckLocked();
Backup();
- while(myCols->Length() < theColumn) myCols->Append(TCollection_ExtendedString(""));
- myCols->SetValue(theColumn,theTitle);
-
+ while(myCols.size() < theColumn) myCols.push_back(std::string(""));
+ myCols[theColumn-1] = theTitle;
+
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfReal::GetColumnTitle(const Standard_Integer theColumn) const
+std::string SALOMEDSImpl_AttributeTableOfReal::GetColumnTitle(const int theColumn) const
{
- if(myCols.IsNull()) return "";
- if(myCols->Length() < theColumn) return "";
- return myCols->Value(theColumn);
+ if(myCols.empty()) return "";
+ if(myCols.size() < theColumn) return "";
+ return myCols[theColumn-1];
}
-void SALOMEDSImpl_AttributeTableOfReal::SetColumnTitles(const Handle(TColStd_HSequenceOfExtendedString)& theTitles)
+void SALOMEDSImpl_AttributeTableOfReal::SetColumnTitles(const vector<string>& theTitles)
{
- if (theTitles->Length() != myNbColumns) Standard_Failure::Raise("Invalid number of columns");
- int aLength = theTitles->Length(), i;
- for(i = 1; i <= aLength; i++) myCols->SetValue(i, theTitles->Value(i));
+ if (theTitles.size() != myNbColumns) throw DFexception("Invalid number of columns");
+ int aLength = theTitles.size(), i;
+ for(i = 0; i < aLength; i++) myCols[i] = theTitles[i];
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfReal::GetColumnTitles()
+vector<string> SALOMEDSImpl_AttributeTableOfReal::GetColumnTitles()
{
- Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
- int aLength = myCols->Length(), i;
- for(i=1; i<=aLength; i++) aSeq->Append(myCols->Value(i));
+ vector<string> aSeq;
+ int aLength = myCols.size(), i;
+ for(i=0; i<aLength; i++) aSeq.push_back(myCols[i]);
return aSeq;
}
-Standard_Integer SALOMEDSImpl_AttributeTableOfReal::GetNbRows() const
+int SALOMEDSImpl_AttributeTableOfReal::GetNbRows() const
{
return myNbRows;
}
-Standard_Integer SALOMEDSImpl_AttributeTableOfReal::GetNbColumns() const
+int SALOMEDSImpl_AttributeTableOfReal::GetNbColumns() const
{
return myNbColumns;
}
-void SALOMEDSImpl_AttributeTableOfReal::PutValue(const Standard_Real theValue,
- const Standard_Integer theRow,
- const Standard_Integer theColumn)
+void SALOMEDSImpl_AttributeTableOfReal::PutValue(const double& theValue,
+ const int theRow,
+ const int theColumn)
{
CheckLocked();
if(theColumn > myNbColumns) SetNbColumns(theColumn);
- Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn;
- myTable.Bind(anIndex, theValue);
+ int anIndex = (theRow-1)*myNbColumns + theColumn;
+ myTable[anIndex] = theValue;
if(theRow > myNbRows) {
- while (myRows->Length() < theRow) { // append empty row titles
- myRows->Append(TCollection_ExtendedString(""));
+ while (myRows.size() < theRow) { // append empty row titles
+ myRows.push_back(std::string(""));
}
myNbRows = theRow;
}
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-Standard_Boolean SALOMEDSImpl_AttributeTableOfReal::HasValue(const Standard_Integer theRow,
- const Standard_Integer theColumn)
+bool SALOMEDSImpl_AttributeTableOfReal::HasValue(const int theRow,
+ const int theColumn)
{
- if(theRow > myNbRows || theRow < 1) return Standard_False;
- if(theColumn > myNbColumns || theColumn < 1) return Standard_False;
- Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn;
- return myTable.IsBound(anIndex);
+ if(theRow > myNbRows || theRow < 1) return false;
+ if(theColumn > myNbColumns || theColumn < 1) return false;
+ int anIndex = (theRow-1)*myNbColumns + theColumn;
+ return (myTable.find(anIndex) != myTable.end());
}
-Standard_Real SALOMEDSImpl_AttributeTableOfReal::GetValue(const Standard_Integer theRow,
- const Standard_Integer theColumn)
+double SALOMEDSImpl_AttributeTableOfReal::GetValue(const int theRow,
+ const int theColumn)
{
- if(theRow > myNbRows || theRow < 1) Standard_Failure::Raise("Invalid cell index");
- if(theColumn > myNbColumns || theColumn < 1) Standard_Failure::Raise("Invalid cell index");
+ if(theRow > myNbRows || theRow < 1) throw DFexception("Invalid cell index");
+ if(theColumn > myNbColumns || theColumn < 1) throw DFexception("Invalid cell index");
- Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn;
- if(myTable.IsBound(anIndex)) return myTable.Find(anIndex);
+ int anIndex = (theRow-1)*myNbColumns + theColumn;
+ if(myTable.find(anIndex) != myTable.end()) return myTable[anIndex];
- Standard_Failure::Raise("Invalid cell index");
+ throw DFexception("Invalid cell index");
return 0.;
}
-const Standard_GUID& SALOMEDSImpl_AttributeTableOfReal::ID() const
+const std::string& SALOMEDSImpl_AttributeTableOfReal::ID() const
{
return GetID();
}
-void SALOMEDSImpl_AttributeTableOfReal::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributeTableOfReal::Restore(DF_Attribute* with)
{
- Standard_Integer anIndex;
- Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(with);
+ int anIndex;
+ SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(with);
+ if(!aTable) throw DFexception("Can't Restore from a null attribute");
- myTable.Clear();
- myCols->Clear();
- myRows->Clear();
+ myTable.clear();
+ myCols.clear();
+ myRows.clear();
myTable = aTable->myTable;
myNbRows = aTable->myNbRows;
myTitle = aTable->myTitle;
for(anIndex = 1; anIndex <= aTable->GetNbRows();anIndex++)
- myRows->Append(aTable->GetRowTitle(anIndex));
+ myRows.push_back(aTable->GetRowTitle(anIndex));
for(anIndex = 1; anIndex <= aTable->GetNbColumns(); anIndex++)
- myCols->Append(aTable->GetColumnTitle(anIndex));
+ myCols.push_back(aTable->GetColumnTitle(anIndex));
}
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeTableOfReal::NewEmpty() const
+DF_Attribute* SALOMEDSImpl_AttributeTableOfReal::NewEmpty() const
{
return new SALOMEDSImpl_AttributeTableOfReal();
}
-void SALOMEDSImpl_AttributeTableOfReal::Paste(const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)&) const
+void SALOMEDSImpl_AttributeTableOfReal::Paste(DF_Attribute* into)
{
- Standard_Integer anIndex;
- Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(into);
+ int anIndex;
+ SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(into);
+ if(!aTable) throw DFexception("Can't Paste into a null attribute");
- aTable->myTable.Clear();
- aTable->myCols->Clear();
- aTable->myRows->Clear();
+ aTable->myTable.clear();
+ aTable->myCols.clear();
+ aTable->myRows.clear();
aTable->myTable = myTable;
aTable->myTitle = myTitle;
aTable->myNbColumns = myNbColumns;
for(anIndex = 1; anIndex <= GetNbRows();anIndex++)
- aTable->myRows->Append(GetRowTitle(anIndex));
+ aTable->myRows.push_back(GetRowTitle(anIndex));
for(anIndex = 1; anIndex <= GetNbColumns(); anIndex++)
- aTable->myCols->Append(GetColumnTitle(anIndex));
+ aTable->myCols.push_back(GetColumnTitle(anIndex));
}
-Handle_TColStd_HSequenceOfInteger SALOMEDSImpl_AttributeTableOfReal::GetSetRowIndices(const Standard_Integer theRow)
+vector<int> SALOMEDSImpl_AttributeTableOfReal::GetSetRowIndices(const int theRow)
{
- Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger;
+ vector<int> aSeq;
- Standard_Integer i, aShift = myNbColumns*(theRow-1);
+ int i, aShift = myNbColumns*(theRow-1);
for(i = 1; i <= myNbColumns; i++) {
- if(myTable.IsBound(aShift + i)) aSeq->Append(i);
+ if(myTable.find(aShift + i) != myTable.end()) aSeq.push_back(i);
}
return aSeq;
}
-Handle_TColStd_HSequenceOfInteger SALOMEDSImpl_AttributeTableOfReal::GetSetColumnIndices(const Standard_Integer theColumn)
+vector<int> SALOMEDSImpl_AttributeTableOfReal::GetSetColumnIndices(const int theColumn)
{
- Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger;
+ vector<int> aSeq;
- Standard_Integer i, anIndex;
+ int i, anIndex;
for(i = 1; i <= myNbRows; i++) {
anIndex = myNbColumns*(i-1)+theColumn;
- if(myTable.IsBound(anIndex)) aSeq->Append(i);
+ if(myTable.find(anIndex) != myTable.end()) aSeq.push_back(i);
}
return aSeq;
}
-
-
-void SALOMEDSImpl_AttributeTableOfReal::ConvertToString(ostrstream& theStream)
+string SALOMEDSImpl_AttributeTableOfReal::Save()
{
+ ostrstream theStream;
int i, j, l;
-
//Title
- l = myTitle.Length();
+ l = myTitle.size();
theStream << l << "\n";
- for(i=1; i<=l; i++)
- theStream << myTitle.Value(i) << "\n";
+ for(i=0; i<l; i++)
+ theStream << myTitle[i] << "\n";
//Nb rows
theStream << myNbRows << "\n";
//Rows titles
- for(i=1; i<=myNbRows; i++) {
- l = myRows->Value(i).Length();
+ for(i=0; i<myNbRows; i++) {
+ l = myRows[i].size();
theStream << l << "\n";
- for(j=1; j<=l; j++)
- theStream << myRows->Value(i).Value(j) << "\n";
+ for(j=0; j<l; j++)
+ theStream << myRows[i][j] << "\n";
}
//Nb columns
theStream << myNbColumns << "\n";
//Columns titles
- for(i=1; i<=myNbColumns; i++) {
- l = myCols->Value(i).Length();
+ for(i=0; i<myNbColumns; i++) {
+ l = myCols[i].size();
theStream << l << "\n";
- for(j=1; j<=l; j++)
- theStream << myCols->Value(i).Value(j) << "\n";
+ for(j=0; j<l; j++)
+ theStream << myCols[i][j] << "\n";
}
//Store the table values
- l = myTable.Extent();
+ l = myTable.size();
theStream << l << "\n";
char *aBuffer = new char[128];
- TColStd_DataMapIteratorOfDataMapOfIntegerReal anIterator(myTable);
- for(; anIterator.More(); anIterator.Next()) {
- theStream << anIterator.Key() << "\n";
- sprintf(aBuffer, "%.64e", anIterator.Value());
+ for(MI p = myTable.begin(); p != myTable.end(); p++) {
+ theStream << p->first << "\n";
+ sprintf(aBuffer, "%.64e", p->second);
theStream << aBuffer << "\n";
}
delete []aBuffer;
-
- return;
+ string aString((char*)theStream.rdbuf()->str());
+ return aString;
}
-bool SALOMEDSImpl_AttributeTableOfReal::RestoreFromString(istrstream& theStream)
+void SALOMEDSImpl_AttributeTableOfReal::Load(const string& value)
{
+ istrstream theStream(value.c_str(), strlen(value.c_str()));
Backup();
int i, j, l;
- Standard_ExtCharacter anExtChar;
- TCollection_ExtendedString aStr;
+ char anExtChar;
+ std::string aStr;
//Title
theStream >> l;
- myTitle = TCollection_ExtendedString(l, 0);
- for(i=1; i<=l; i++) {
+ myTitle = std::string(l, 0);
+ for(i=0; i<l; i++) {
theStream >> anExtChar;
- myTitle.SetValue(i, anExtChar);
+ myTitle[i] = anExtChar;
}
//Nb rows
theStream >> myNbRows;
//Rows titles
- myRows->Clear();
+ myRows.clear();
for(i=1; i<=myNbRows; i++) {
theStream >> l;
- aStr = TCollection_ExtendedString(l,0);
- for(j=1; j<=l; j++) {
+ aStr = std::string(l,0);
+ for(j=0; j<l; j++) {
theStream >> anExtChar;
- aStr.SetValue(j, anExtChar);
+ aStr[j] = anExtChar;
}
- myRows->Append(aStr);
+ myRows.push_back(aStr);
}
//Nb columns
theStream >> myNbColumns;
//Columns titles
- myCols->Clear();
+ myCols.clear();
for(i=1; i<=myNbColumns; i++) {
theStream >> l;
- aStr = TCollection_ExtendedString(l,0);
- for(j=1; j<=l; j++) {
+ aStr = std::string(l,0);
+ for(j=0; j<l; j++) {
theStream >> anExtChar;
- aStr.SetValue(j, anExtChar);
+ aStr[j] = anExtChar;
}
- myCols->Append(aStr);
+ myCols.push_back(aStr);
}
//Restore the table values
theStream >> l;
- myTable.Clear();
+ myTable.clear();
for(i=1; i<=l; i++) {
- Standard_Integer aKey;
- Standard_Real aValue;
+ int aKey;
+ double aValue;
theStream >> aKey;
theStream >> aValue;
- myTable.Bind(aKey, aValue);
+ myTable[aKey] = aValue;
}
- return true;
-}
-
-TCollection_AsciiString SALOMEDSImpl_AttributeTableOfReal::Save()
-{
- ostrstream ostr;
- ConvertToString(ostr);
- TCollection_AsciiString aString((char*)ostr.rdbuf()->str());
- return aString;
-}
-
-void SALOMEDSImpl_AttributeTableOfReal::Load(const TCollection_AsciiString& value)
-{
- istrstream aStream(value.ToCString(), strlen(value.ToCString()));
- RestoreFromString(aStream);
}
#ifndef _SALOMEDSImpl_AttributeTableOfReal_HeaderFile
#define _SALOMEDSImpl_AttributeTableOfReal_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <Standard.hxx>
-#include <TDF_Attribute.hxx>
-#include <TDF_Label.hxx>
+#include "DF_Attribute.hxx"
+#include "DF_Label.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Standard_GUID;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeTableOfReal, SALOMEDSImpl_GenericAttribute )
-
-#include <TColStd_SequenceOfTransient.hxx>
-#include <TCollection_ExtendedString.hxx>
-#include <TColStd_HSequenceOfExtendedString.hxx>
-#include <TColStd_DataMapOfIntegerReal.hxx>
-#include <TColStd_HSequenceOfInteger.hxx>
-#include <TColStd_HSequenceOfReal.hxx>
-
-#include <strstream>
-#include <TCollection_AsciiString.hxx>
+#include <string>
+#include <vector>
+#include <map>
class SALOMEDSImpl_AttributeTableOfReal : public SALOMEDSImpl_GenericAttribute
{
public:
-Standard_EXPORT virtual TCollection_AsciiString Save();
-Standard_EXPORT virtual void Load(const TCollection_AsciiString&);
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDSImpl_AttributeTableOfReal Set(const TDF_Label& label) ;
+Standard_EXPORT virtual std::string Save();
+Standard_EXPORT virtual void Load(const std::string&);
+Standard_EXPORT static const std::string& GetID() ;
+Standard_EXPORT static SALOMEDSImpl_AttributeTableOfReal* Set(const DF_Label& label) ;
Standard_EXPORT SALOMEDSImpl_AttributeTableOfReal();
-Standard_EXPORT void SetNbColumns(const Standard_Integer theNbColumns);
-Standard_EXPORT void SetTitle(const TCollection_ExtendedString& theTitle) ;
-Standard_EXPORT TCollection_ExtendedString GetTitle() const;
-Standard_EXPORT void SetRowData(const Standard_Integer theRow,const Handle(TColStd_HSequenceOfReal)& theData) ;
-Standard_EXPORT Handle_TColStd_HSequenceOfReal GetRowData(const Standard_Integer theRow) ;
-Standard_EXPORT void SetRowTitle(const Standard_Integer theRow,const TCollection_ExtendedString& theTitle) ;
-Standard_EXPORT void SetRowUnit(const Standard_Integer theRow,const TCollection_ExtendedString& theUnit) ;
-Standard_EXPORT TCollection_ExtendedString GetRowUnit(const Standard_Integer theRow) const;
-Standard_EXPORT void SetRowUnits(const Handle(TColStd_HSequenceOfExtendedString)& theUnits) ;
-Standard_EXPORT Handle(TColStd_HSequenceOfExtendedString) GetRowUnits();
-Standard_EXPORT void SetRowTitles(const Handle(TColStd_HSequenceOfExtendedString)& theTitles) ;
-Standard_EXPORT Handle(TColStd_HSequenceOfExtendedString) GetRowTitles();
-Standard_EXPORT TCollection_ExtendedString GetRowTitle(const Standard_Integer theRow) const;
-Standard_EXPORT void SetColumnData(const Standard_Integer theColumn,const Handle(TColStd_HSequenceOfReal)& theData) ;
-Standard_EXPORT Handle_TColStd_HSequenceOfReal GetColumnData(const Standard_Integer theColumn) ;
-Standard_EXPORT void SetColumnTitle(const Standard_Integer theColumn,const TCollection_ExtendedString& theTitle) ;
-Standard_EXPORT void SetColumnTitles(const Handle(TColStd_HSequenceOfExtendedString)& theTitles);
-Standard_EXPORT Handle(TColStd_HSequenceOfExtendedString) GetColumnTitles();
-Standard_EXPORT TCollection_ExtendedString GetColumnTitle(const Standard_Integer theColumn) const;
-Standard_EXPORT Standard_Integer GetNbRows() const;
-Standard_EXPORT Standard_Integer GetNbColumns() const;
-
-Standard_EXPORT void PutValue(const Standard_Real theValue,const Standard_Integer theRow,const Standard_Integer theColumn) ;
-Standard_EXPORT Standard_Boolean HasValue(const Standard_Integer theRow,const Standard_Integer theColumn) ;
-Standard_EXPORT Standard_Real GetValue(const Standard_Integer theRow,const Standard_Integer theColumn) ;
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
-
-Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetSetRowIndices(const Standard_Integer theRow);
-Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetSetColumnIndices(const Standard_Integer theColumn);
-
-Standard_EXPORT void ConvertToString(ostrstream& theStream);
-Standard_EXPORT bool RestoreFromString(istrstream& theStream);
+Standard_EXPORT void SetNbColumns(const int theNbColumns);
+Standard_EXPORT void SetTitle(const std::string& theTitle) ;
+Standard_EXPORT std::string GetTitle() const;
+Standard_EXPORT void SetRowData(const int theRow,const std::vector<double>& theData) ;
+Standard_EXPORT std::vector<double> GetRowData(const int theRow) ;
+Standard_EXPORT void SetRowTitle(const int theRow,const std::string& theTitle) ;
+Standard_EXPORT void SetRowUnit(const int theRow,const std::string& theUnit) ;
+Standard_EXPORT std::string GetRowUnit(const int theRow) const;
+Standard_EXPORT void SetRowUnits(const std::vector<std::string>& theUnits) ;
+Standard_EXPORT std::vector<std::string> GetRowUnits();
+Standard_EXPORT void SetRowTitles(const std::vector<std::string>& theTitles) ;
+Standard_EXPORT std::vector<std::string> GetRowTitles();
+Standard_EXPORT std::string GetRowTitle(const int theRow) const;
+Standard_EXPORT void SetColumnData(const int theColumn,const std::vector<double>& theData) ;
+Standard_EXPORT std::vector<double> GetColumnData(const int theColumn) ;
+Standard_EXPORT void SetColumnTitle(const int theColumn,const std::string& theTitle) ;
+Standard_EXPORT void SetColumnTitles(const std::vector<std::string>& theTitles);
+Standard_EXPORT std::vector<std::string> GetColumnTitles();
+Standard_EXPORT std::string GetColumnTitle(const int theColumn) const;
+Standard_EXPORT int GetNbRows() const;
+Standard_EXPORT int GetNbColumns() const;
+
+Standard_EXPORT void PutValue(const double& theValue,const int theRow,const int theColumn) ;
+Standard_EXPORT bool HasValue(const int theRow,const int theColumn) ;
+Standard_EXPORT double GetValue(const int theRow,const int theColumn) ;
+Standard_EXPORT const std::string& ID() const;
+Standard_EXPORT void Restore(DF_Attribute* with) ;
+Standard_EXPORT DF_Attribute* NewEmpty() const;
+Standard_EXPORT void Paste(DF_Attribute* into);
+
+Standard_EXPORT std::vector<int> GetSetRowIndices(const int theRow);
+Standard_EXPORT std::vector<int> GetSetColumnIndices(const int theColumn);
Standard_EXPORT ~SALOMEDSImpl_AttributeTableOfReal() {}
private:
-TColStd_DataMapOfIntegerReal myTable;
-TCollection_ExtendedString myTitle;
-Handle_TColStd_HSequenceOfExtendedString myRows;
-Handle_TColStd_HSequenceOfExtendedString myCols;
-Standard_Integer myNbRows;
-Standard_Integer myNbColumns;
-
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeTableOfReal )
+std::map<int, double> myTable;
+std::string myTitle;
+std::vector<std::string> myRows;
+std::vector<std::string> myCols;
+int myNbRows;
+int myNbColumns;
};
// Module : SALOME
#include <SALOMEDSImpl_AttributeTableOfString.hxx>
-#include <Standard_Failure.hxx>
-#include <Standard_GUID.hxx>
#include <stdio.h>
-#include <TColStd_HSequenceOfExtendedString.hxx>
+#include <stdlib.h>
+#include <strstream>
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeTableOfString, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeTableOfString, SALOMEDSImpl_GenericAttribute )
-
-typedef NCollection_DataMap<Standard_Integer, TCollection_ExtendedString>::Iterator DataMapIterator;
-
#define SEPARATOR '\1'
-static TCollection_ExtendedString getUnit(TCollection_ExtendedString theString)
+typedef map<int, string>::const_iterator MI;
+
+static std::string getUnit(std::string theString)
{
- TCollection_ExtendedString aString(theString);
- int aPos = aString.Search(SEPARATOR);
- if(aPos <= 0 || aPos == aString.Length() ) return TCollection_ExtendedString();
- return aString.Split(aPos);
+ std::string aString(theString);
+ int aPos = aString.find(SEPARATOR);
+ if(aPos <= 0 || aPos == aString.size() ) return std::string();
+ return aString.substr(aPos+1, aString.size());
}
-static TCollection_ExtendedString getTitle(TCollection_ExtendedString theString)
+static std::string getTitle(std::string theString)
{
- TCollection_ExtendedString aString(theString);
- int aPos = aString.Search(SEPARATOR);
+ std::string aString(theString);
+ int aPos = aString.find(SEPARATOR);
if(aPos < 1) return aString;
- if(aPos == 1) return TCollection_ExtendedString();
- aString.Split(aPos-1);
- return aString;
+ if(aPos == 1) return std::string();
+ return aString.substr(0, aPos);
}
-const Standard_GUID& SALOMEDSImpl_AttributeTableOfString::GetID()
+const std::string& SALOMEDSImpl_AttributeTableOfString::GetID()
{
- static Standard_GUID SALOMEDSImpl_AttributeTableOfStringID ("128371A4-8F52-11d6-A8A3-0001021E8C7F");
+ static std::string SALOMEDSImpl_AttributeTableOfStringID ("128371A4-8F52-11d6-A8A3-0001021E8C7F");
return SALOMEDSImpl_AttributeTableOfStringID;
}
-Handle(SALOMEDSImpl_AttributeTableOfString) SALOMEDSImpl_AttributeTableOfString::Set(const TDF_Label& label)
+SALOMEDSImpl_AttributeTableOfString* SALOMEDSImpl_AttributeTableOfString::Set(const DF_Label& label)
{
- Handle(SALOMEDSImpl_AttributeTableOfString) anAttr;
- if (!label.FindAttribute(SALOMEDSImpl_AttributeTableOfString::GetID(),anAttr)) {
- anAttr = new SALOMEDSImpl_AttributeTableOfString();
- label.AddAttribute(anAttr);
+ SALOMEDSImpl_AttributeTableOfString* A = NULL;
+ if (!(A=(SALOMEDSImpl_AttributeTableOfString*)label.FindAttribute(SALOMEDSImpl_AttributeTableOfString::GetID()))) {
+ A = new SALOMEDSImpl_AttributeTableOfString();
+ label.AddAttribute(A);
}
- return anAttr;
+ return A;
}
SALOMEDSImpl_AttributeTableOfString::SALOMEDSImpl_AttributeTableOfString()
:SALOMEDSImpl_GenericAttribute("AttributeTableOfString")
{
- myRows = new TColStd_HSequenceOfExtendedString();
- myCols = new TColStd_HSequenceOfExtendedString();
myNbRows = 0;
myNbColumns = 0;
}
-void SALOMEDSImpl_AttributeTableOfString::SetNbColumns(const Standard_Integer theNbColumns)
+void SALOMEDSImpl_AttributeTableOfString::SetNbColumns(const int theNbColumns)
{
CheckLocked();
Backup();
- DataMapOfIntegerString aMap;
+ map<int, string> aMap;
aMap = myTable;
- myTable.Clear();
+ myTable.clear();
- DataMapIterator anIterator(aMap);
- for(; anIterator.More(); anIterator.Next()) {
- int aRow = (int)(anIterator.Key()/myNbColumns) + 1;
- int aCol = (int)(anIterator.Key() - myNbColumns*(aRow-1));
+ for(MI p = aMap.begin(); p!=aMap.end(); p++) {
+ int aRow = (int)(p->first/myNbColumns) + 1;
+ int aCol = (int)(p->first - myNbColumns*(aRow-1));
if(aCol == 0) { aCol = myNbColumns; aRow--; }
if(aCol > theNbColumns) continue;
int aKey = (aRow-1)*theNbColumns+aCol;
- myTable.Bind(aKey, anIterator.Value());
+ myTable[aKey] = p->second;
}
myNbColumns = theNbColumns;
- while (myCols->Length() < myNbColumns) { // append empty columns titles
- myCols->Append(TCollection_ExtendedString(""));
+ while (myCols.size() < myNbColumns) { // append empty columns titles
+ myCols.push_back(std::string(""));
}
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-void SALOMEDSImpl_AttributeTableOfString::SetRowTitle(const Standard_Integer theRow,
- const TCollection_ExtendedString& theTitle)
+void SALOMEDSImpl_AttributeTableOfString::SetRowTitle(const int theRow,
+ const std::string& theTitle)
{
CheckLocked();
Backup();
- TCollection_ExtendedString aTitle(theTitle), aUnit = GetRowUnit(theRow);
- if(aUnit.Length()>0) {
+ std::string aTitle(theTitle), aUnit = GetRowUnit(theRow);
+ if(aUnit.size()>0) {
aTitle += SEPARATOR;
aTitle += aUnit;
}
- myRows->SetValue(theRow, aTitle);
+ myRows[theRow-1] = aTitle;
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-void SALOMEDSImpl_AttributeTableOfString::SetRowUnit(const Standard_Integer theRow,
- const TCollection_ExtendedString& theUnit)
+void SALOMEDSImpl_AttributeTableOfString::SetRowUnit(const int theRow,
+ const std::string& theUnit)
{
CheckLocked();
Backup();
- TCollection_ExtendedString aTitle = GetRowTitle(theRow);
+ std::string aTitle = GetRowTitle(theRow);
aTitle += SEPARATOR;
aTitle += theUnit;
- myRows->SetValue(theRow, aTitle);
+ myRows[theRow-1] = aTitle;
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-void SALOMEDSImpl_AttributeTableOfString::SetRowUnits(const Handle(TColStd_HSequenceOfExtendedString)& theUnits)
+void SALOMEDSImpl_AttributeTableOfString::SetRowUnits(const vector<string>& theUnits)
{
- if (theUnits->Length() != GetNbRows()) Standard_Failure::Raise("Invalid number of rows");
- int aLength = theUnits->Length(), i;
- for(i = 1; i <= aLength; i++) SetRowUnit(i, theUnits->Value(i));
+ if (theUnits.size() != GetNbRows()) throw DFexception("Invalid number of rows");
+ int aLength = theUnits.size(), i;
+ for(i = 1; i <= aLength; i++) SetRowUnit(i, theUnits[i-1]);
}
-Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfString::GetRowUnits()
+vector<string> SALOMEDSImpl_AttributeTableOfString::GetRowUnits()
{
- Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
- int aLength = myRows->Length(), i;
- for(i=1; i<=aLength; i++) aSeq->Append(getUnit(myRows->Value(i)));
+ vector<string> aSeq;
+ int aLength = myRows.size(), i;
+ for(i=0; i<aLength; i++) aSeq.push_back(getUnit(myRows[i]));
return aSeq;
}
-void SALOMEDSImpl_AttributeTableOfString::SetRowTitles(const Handle(TColStd_HSequenceOfExtendedString)& theTitles)
+void SALOMEDSImpl_AttributeTableOfString::SetRowTitles(const vector<string>& theTitles)
{
- if (theTitles->Length() != GetNbRows()) Standard_Failure::Raise("Invalid number of rows");
- int aLength = theTitles->Length(), i;
- for(i = 1; i <= aLength; i++) SetRowTitle(i, theTitles->Value(i));
+ if (theTitles.size() != GetNbRows()) throw DFexception("Invalid number of rows");
+ int aLength = theTitles.size(), i;
+ for(i = 1; i <= aLength; i++) SetRowTitle(i, theTitles[i-1]);
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfString::GetRowTitles()
+vector<string> SALOMEDSImpl_AttributeTableOfString::GetRowTitles()
{
- Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
- int aLength = myRows->Length(), i;
- for(i=1; i<=aLength; i++) aSeq->Append(getTitle(myRows->Value(i)));
+ vector<string> aSeq;
+ int aLength = myRows.size(), i;
+ for(i=0; i<aLength; i++) aSeq.push_back(getTitle(myRows[i]));
return aSeq;
}
-TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfString::GetRowTitle(const Standard_Integer theRow) const
+std::string SALOMEDSImpl_AttributeTableOfString::GetRowTitle(const int theRow) const
{
- return getTitle(myRows->Value(theRow));
+ return getTitle(myRows[theRow-1]);
}
-TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfString::GetRowUnit(const Standard_Integer theRow) const
+std::string SALOMEDSImpl_AttributeTableOfString::GetRowUnit(const int theRow) const
{
- return getUnit(myRows->Value(theRow));
+ return getUnit(myRows[theRow-1]);
}
-void SALOMEDSImpl_AttributeTableOfString::SetRowData(const Standard_Integer theRow,
- const Handle(TColStd_HSequenceOfExtendedString)& theData)
+void SALOMEDSImpl_AttributeTableOfString::SetRowData(const int theRow,
+ const vector<string>& theData)
{
CheckLocked();
- if(theData->Length() > myNbColumns) SetNbColumns(theData->Length());
+ if(theData.size() > myNbColumns) SetNbColumns(theData.size());
Backup();
- while (myRows->Length() < theRow) { // append new row titles
- myRows->Append(TCollection_ExtendedString(""));
+ while (myRows.size() < theRow) { // append new row titles
+ myRows.push_back(std::string(""));
}
- Standard_Integer i, aShift = (theRow-1)*myNbColumns, aLength = theData->Length();
+ int i, aShift = (theRow-1)*myNbColumns, aLength = theData.size();
for(i = 1; i <= aLength; i++) {
- myTable.Bind(aShift + i, theData->Value(i));
+ myTable[aShift + i] = theData[i-1];
}
if(theRow > myNbRows) myNbRows = theRow;
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-void SALOMEDSImpl_AttributeTableOfString::SetTitle(const TCollection_ExtendedString& theTitle)
+void SALOMEDSImpl_AttributeTableOfString::SetTitle(const std::string& theTitle)
{
CheckLocked();
Backup();
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfString::GetTitle() const
+std::string SALOMEDSImpl_AttributeTableOfString::GetTitle() const
{
return myTitle;
}
-Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfString::GetRowData(const Standard_Integer theRow)
+vector<string> SALOMEDSImpl_AttributeTableOfString::GetRowData(const int theRow)
{
- Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString();
- Standard_Integer i, aShift = (theRow-1)*myNbColumns;
+ vector<string> aSeq;
+ int i, aShift = (theRow-1)*myNbColumns;
for(i = 1; i <= myNbColumns; i++) {
- if(myTable.IsBound(aShift+i))
- aSeq->Append(myTable.Find(aShift+i));
+ if(myTable.find(aShift+i) != myTable.end())
+ aSeq.push_back(myTable[aShift+i]);
else
- aSeq->Append(0.);
+ aSeq.push_back("");
}
return aSeq;
}
-void SALOMEDSImpl_AttributeTableOfString::SetColumnData(const Standard_Integer theColumn,
- const Handle(TColStd_HSequenceOfExtendedString)& theData)
+void SALOMEDSImpl_AttributeTableOfString::SetColumnData(const int theColumn,
+ const vector<string>& theData)
{
CheckLocked();
if(theColumn > myNbColumns) SetNbColumns(theColumn);
Backup();
- Standard_Integer i, aLength = theData->Length();
+ int i, aLength = theData.size();
for(i = 1; i <= aLength; i++) {
- myTable.Bind(myNbColumns*(i-1)+theColumn, theData->Value(i));
+ myTable[myNbColumns*(i-1)+theColumn] = theData[i-1];
}
if(aLength > myNbRows) {
myNbRows = aLength;
- while (myRows->Length() < myNbRows) { // append empty row titles
- myRows->Append(TCollection_ExtendedString(""));
+ while (myRows.size() < myNbRows) { // append empty row titles
+ myRows.push_back(std::string(""));
}
}
}
-Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfString::GetColumnData(const Standard_Integer theColumn)
+vector<string> SALOMEDSImpl_AttributeTableOfString::GetColumnData(const int theColumn)
{
- Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
+ vector<string> aSeq;
- Standard_Integer i, anIndex;
+ int i, anIndex;
for(i = 1; i <= myNbRows; i++) {
anIndex = myNbColumns*(i-1) + theColumn;
- if(myTable.IsBound(anIndex))
- aSeq->Append(myTable.Find(anIndex));
+ if(myTable.find(anIndex) != myTable.end())
+ aSeq.push_back(myTable[anIndex]);
else
- aSeq->Append(0.);
+ aSeq.push_back("");
}
return aSeq;
}
-void SALOMEDSImpl_AttributeTableOfString::SetColumnTitle(const Standard_Integer theColumn,
- const TCollection_ExtendedString& theTitle)
+void SALOMEDSImpl_AttributeTableOfString::SetColumnTitle(const int theColumn,
+ const std::string& theTitle)
{
CheckLocked();
Backup();
- while(myCols->Length() < theColumn) myCols->Append(TCollection_ExtendedString(""));
- myCols->SetValue(theColumn,theTitle);
+ while(myCols.size() < theColumn) myCols.push_back(std::string(""));
+ myCols[theColumn-1] = theTitle;
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfString::GetColumnTitle(const Standard_Integer theColumn) const
+std::string SALOMEDSImpl_AttributeTableOfString::GetColumnTitle(const int theColumn) const
{
- if(myCols.IsNull()) return "";
- if(myCols->Length() < theColumn) return "";
- return myCols->Value(theColumn);
+ if(myCols.empty()) return "";
+ if(myCols.size() < theColumn) return "";
+ return myCols[theColumn-1];
}
-void SALOMEDSImpl_AttributeTableOfString::SetColumnTitles(const Handle(TColStd_HSequenceOfExtendedString)& theTitles)
+void SALOMEDSImpl_AttributeTableOfString::SetColumnTitles(const vector<string>& theTitles)
{
- if (theTitles->Length() != myNbColumns) Standard_Failure::Raise("Invalid number of columns");
- int aLength = theTitles->Length(), i;
- for(i = 1; i <= aLength; i++) myCols->SetValue(i, theTitles->Value(i));
+ if (theTitles.size() != myNbColumns) throw DFexception("Invalid number of columns");
+ int aLength = theTitles.size(), i;
+ for(i = 0; i < aLength; i++) myCols[i] = theTitles[i];
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfString::GetColumnTitles()
+vector<string> SALOMEDSImpl_AttributeTableOfString::GetColumnTitles()
{
- Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
- int aLength = myCols->Length(), i;
- for(i=1; i<=aLength; i++) aSeq->Append(myCols->Value(i));
+ vector<string> aSeq;
+ int aLength = myCols.size(), i;
+ for(i=0; i<aLength; i++) aSeq.push_back(myCols[i]);
return aSeq;
}
-Standard_Integer SALOMEDSImpl_AttributeTableOfString::GetNbRows() const
+int SALOMEDSImpl_AttributeTableOfString::GetNbRows() const
{
return myNbRows;
}
-Standard_Integer SALOMEDSImpl_AttributeTableOfString::GetNbColumns() const
+int SALOMEDSImpl_AttributeTableOfString::GetNbColumns() const
{
return myNbColumns;
}
-void SALOMEDSImpl_AttributeTableOfString::PutValue(const TCollection_ExtendedString& theValue,
- const Standard_Integer theRow,
- const Standard_Integer theColumn)
+void SALOMEDSImpl_AttributeTableOfString::PutValue(const std::string& theValue,
+ const int theRow,
+ const int theColumn)
{
CheckLocked();
if(theColumn > myNbColumns) SetNbColumns(theColumn);
- Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn;
- myTable.Bind(anIndex, theValue);
+ int anIndex = (theRow-1)*myNbColumns + theColumn;
+ myTable[anIndex] = theValue;
if(theRow > myNbRows) {
- while (myRows->Length() < theRow) { // append empty row titles
- myRows->Append(TCollection_ExtendedString(""));
+ while (myRows.size() < theRow) { // append empty row titles
+ myRows.push_back(std::string(""));
}
myNbRows = theRow;
}
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-Standard_Boolean SALOMEDSImpl_AttributeTableOfString::HasValue(const Standard_Integer theRow,
- const Standard_Integer theColumn)
+bool SALOMEDSImpl_AttributeTableOfString::HasValue(const int theRow,
+ const int theColumn)
{
- if(theRow > myNbRows || theRow < 1) return Standard_False;
- if(theColumn > myNbColumns || theColumn < 1) return Standard_False;
+ if(theRow > myNbRows || theRow < 1) return false;
+ if(theColumn > myNbColumns || theColumn < 1) return false;
- Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn;
- return myTable.IsBound(anIndex);
+ int anIndex = (theRow-1)*myNbColumns + theColumn;
+ return (myTable.find(anIndex) != myTable.end());
}
-TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfString::GetValue(const Standard_Integer theRow,
- const Standard_Integer theColumn)
+std::string SALOMEDSImpl_AttributeTableOfString::GetValue(const int theRow,
+ const int theColumn)
{
- if(theRow > myNbRows || theRow < 1) Standard_Failure::Raise("Invalid cell index");
- if(theColumn > myNbColumns || theColumn < 1) Standard_Failure::Raise("Invalid cell index");
+ if(theRow > myNbRows || theRow < 1) throw DFexception("Invalid cell index");
+ if(theColumn > myNbColumns || theColumn < 1) throw DFexception("Invalid cell index");
- Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn;
- if(myTable.IsBound(anIndex)) return myTable.Find(anIndex);
+ int anIndex = (theRow-1)*myNbColumns + theColumn;
+ if(myTable.find(anIndex) != myTable.end()) return myTable[anIndex];
- Standard_Failure::Raise("Invalid cell index");
- return 0.;
+ throw DFexception("Invalid cell index");
+ return "";
}
-const Standard_GUID& SALOMEDSImpl_AttributeTableOfString::ID() const
+const std::string& SALOMEDSImpl_AttributeTableOfString::ID() const
{
return GetID();
}
-void SALOMEDSImpl_AttributeTableOfString::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributeTableOfString::Restore(DF_Attribute* with)
{
- Standard_Integer anIndex;
- Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(with);
+ int anIndex;
+ SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(with);
- myTable.Clear();
- myCols->Clear();
- myRows->Clear();
+ myTable.clear();
+ myCols.clear();
+ myRows.clear();
myTable = aTable->myTable;
myNbRows = aTable->myNbRows;
myTitle = aTable->myTitle;
for(anIndex = 1; anIndex <= aTable->GetNbRows();anIndex++)
- myRows->Append(aTable->GetRowTitle(anIndex));
+ myRows.push_back(aTable->GetRowTitle(anIndex));
for(anIndex = 1; anIndex <= aTable->GetNbColumns(); anIndex++)
- myCols->Append(aTable->GetColumnTitle(anIndex));
+ myCols.push_back(aTable->GetColumnTitle(anIndex));
}
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeTableOfString::NewEmpty() const
+DF_Attribute* SALOMEDSImpl_AttributeTableOfString::NewEmpty() const
{
return new SALOMEDSImpl_AttributeTableOfString();
}
-void SALOMEDSImpl_AttributeTableOfString::Paste(const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)&) const
+void SALOMEDSImpl_AttributeTableOfString::Paste(DF_Attribute* into)
{
- Standard_Integer anIndex;
- Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(into);
+ int anIndex;
+ SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(into);
- aTable->myTable.Clear();
- aTable->myCols->Clear();
- aTable->myRows->Clear();
+ aTable->myTable.clear();
+ aTable->myCols.clear();
+ aTable->myRows.clear();
aTable->myTable = myTable;
aTable->myTitle = myTitle;
aTable->myNbColumns = myNbColumns;
for(anIndex = 1; anIndex <= GetNbRows();anIndex++)
- aTable->myRows->Append(GetRowTitle(anIndex));
+ aTable->myRows.push_back(GetRowTitle(anIndex));
for(anIndex = 1; anIndex <= GetNbColumns(); anIndex++)
- aTable->myCols->Append(GetColumnTitle(anIndex));
+ aTable->myCols.push_back(GetColumnTitle(anIndex));
}
-Handle_TColStd_HSequenceOfInteger SALOMEDSImpl_AttributeTableOfString::GetSetRowIndices(const Standard_Integer theRow)
+vector<int> SALOMEDSImpl_AttributeTableOfString::GetSetRowIndices(const int theRow)
{
- Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger;
+ vector<int> aSeq;
- Standard_Integer i, aShift = myNbColumns*(theRow-1);
+ int i, aShift = myNbColumns*(theRow-1);
for(i = 1; i <= myNbColumns; i++) {
- if(myTable.IsBound(aShift + i)) aSeq->Append(i);
+ if(myTable.find(aShift + i) != myTable.end()) aSeq.push_back(i);
}
return aSeq;
}
-Handle_TColStd_HSequenceOfInteger SALOMEDSImpl_AttributeTableOfString::GetSetColumnIndices(const Standard_Integer theColumn)
+vector<int> SALOMEDSImpl_AttributeTableOfString::GetSetColumnIndices(const int theColumn)
{
- Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger;
+ vector<int> aSeq;
- Standard_Integer i, anIndex;
+ int i, anIndex;
for(i = 1; i <= myNbRows; i++) {
anIndex = myNbColumns*(i-1)+theColumn;
- if(myTable.IsBound(anIndex)) aSeq->Append(i);
+ if(myTable.find(anIndex) != myTable.end()) aSeq.push_back(i);
}
return aSeq;
-void SALOMEDSImpl_AttributeTableOfString::ConvertToString(ostrstream& theStream)
+string SALOMEDSImpl_AttributeTableOfString::Save()
{
+ ostrstream theStream;
int i, j, l;
//Title
- l = myTitle.Length();
+ l = myTitle.size();
theStream << l << "\n";
- for(i=1; i<=l; i++)
- theStream << myTitle.Value(i) << "\n";
+ for(i=0; i<l; i++)
+ theStream << myTitle[i] << "\n";
//Nb rows
theStream << myNbRows << "\n";
//Rows titles
- for(i=1; i<=myNbRows; i++) {
- l = myRows->Value(i).Length();
+ for(i=0; i<myNbRows; i++) {
+ l = myRows[i].size();
theStream << l << "\n";
- for(j=1; j<=l; j++)
- theStream << myRows->Value(i).Value(j) << "\n";
+ for(j=0; j<l; j++)
+ theStream << myRows[i][j] << "\n";
}
//Nb columns
theStream << myNbColumns << "\n";
//Columns titles
- for(i=1; i<=myNbColumns; i++) {
- l = myCols->Value(i).Length();
+ for(i=0; i<myNbColumns; i++) {
+ l = myCols[i].size();
theStream << l << "\n";
- for(j=1; j<=l; j++)
- theStream << myCols->Value(i).Value(j) << "\n";
+ for(j=0; j<l; j++)
+ theStream << myCols[i][j] << "\n";
}
//Store the table values
- l = myTable.Extent();
+ l = myTable.size();
theStream << l << "\n";
- DataMapIterator anIterator(myTable);
- for(; anIterator.More(); anIterator.Next()) {
- if (anIterator.Value().Length()) { // check empty string in the value table
- theStream << anIterator.Key() << "\n";
- unsigned long aValueSize = anIterator.Value().Length();
+ for(MI p = myTable.begin(); p!=myTable.end(); p++) {
+ if (p->second.size()) { // check empty string in the value table
+ theStream << p->first << "\n";
+ unsigned long aValueSize = p->second.size();
theStream<<aValueSize << "\n";
- theStream.write((TCollection_AsciiString(anIterator.Value()).ToCString()),aValueSize);
+ theStream.write(p->second.c_str(),aValueSize);
theStream<<"\n";
} else { // write index only of kind: "0key"; "05", for an example
- theStream << "0" << anIterator.Key() << "\n";
+ theStream << "0" << p->first << "\n";
}
}
- return;
+ string aString((char*)theStream.rdbuf()->str());
+ return aString;
}
-bool SALOMEDSImpl_AttributeTableOfString::RestoreFromString(istrstream& theStream)
+void SALOMEDSImpl_AttributeTableOfString::Load(const string& value)
{
+ istrstream theStream(value.c_str(), strlen(value.c_str()));
Backup();
theStream.seekg(0, ios::end);
int i, j, l;
char *aValueString = new char[aSize];
- Standard_ExtCharacter anExtChar;
- TCollection_ExtendedString aStr;
+ char anExtChar;
+ std::string aStr;
//Title
theStream >> l;
- myTitle = TCollection_ExtendedString(l, 0);
- for(i=1; i<=l; i++) {
+ myTitle = std::string(l, 0);
+ for(i=0; i<l; i++) {
theStream >> anExtChar;
- myTitle.SetValue(i, anExtChar);
+ myTitle[i] = anExtChar;
}
//Nb rows
theStream >> myNbRows;
//Rows titles
- myRows->Clear();
- for(i=1; i<=myNbRows; i++) {
+ myRows.clear();
+ for(i=0; i<myNbRows; i++) {
theStream >> l;
- aStr = TCollection_ExtendedString(l,0);
- for(j=1; j<=l; j++) {
+ aStr = std::string(l,0);
+ for(j=0; j<l; j++) {
theStream >> anExtChar;
- aStr.SetValue(j, anExtChar);
+ aStr[j] = anExtChar;
}
- myRows->Append(aStr);
+ myRows.push_back(aStr);
}
//Nb columns
theStream >> myNbColumns;
//Columns titles
- myCols->Clear();
- for(i=1; i<=myNbColumns; i++) {
+ myCols.clear();
+ for(i=0; i<myNbColumns; i++) {
theStream >> l;
- aStr = TCollection_ExtendedString(l,0);
- for(j=1; j<=l; j++) {
+ aStr = std::string(l,0);
+ for(j=0; j<l; j++) {
theStream >> anExtChar;
- aStr.SetValue(j, anExtChar);
+ aStr[j] = anExtChar;
}
- myCols->Append(aStr);
+ myCols.push_back(aStr);
}
//Restore the table values
- TCollection_AsciiString aValue;
+ string aValue;
theStream >> l;
- myTable.Clear();
+ myTable.clear();
theStream.getline(aValueString,aSize,'\n');
for(i=1; i<=l; i++) {
- Standard_Integer aKey;
+ int aKey;
theStream.getline(aValueString,aSize,'\n');
aValue = aValueString;
- aKey = aValue.IntegerValue();
- if (aValue.Value(1) == '0')
+ aKey = atoi(aValue.c_str());
+ if (aValue[0] == '0')
aValue = "";
else {
unsigned long aValueSize;
theStream.read(aValueString, 1); // an '\n' omitting
aValue = aValueString;
}
- myTable.Bind(aKey, aValue);
+ myTable[aKey] = aValue;
}
delete(aValueString);
- return true;
-}
-
-TCollection_AsciiString SALOMEDSImpl_AttributeTableOfString::Save()
-{
- ostrstream ostr;
- ConvertToString(ostr);
- TCollection_AsciiString aString((char*)ostr.rdbuf()->str());
- return aString;
-}
-
-void SALOMEDSImpl_AttributeTableOfString::Load(const TCollection_AsciiString& value)
-{
- istrstream aStream(value.ToCString(), strlen(value.ToCString()));
- RestoreFromString(aStream);
}
#ifndef _SALOMEDSImpl_AttributeTableOfString_HeaderFile
#define _SALOMEDSImpl_AttributeTableOfString_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <Standard.hxx>
-#include <TDF_Label.hxx>
-#include <TDF_Attribute.hxx>
+#include "DF_Label.hxx"
+#include "DF_Attribute.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Standard_GUID;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeTableOfString, SALOMEDSImpl_GenericAttribute )
-
-#include <TColStd_SequenceOfTransient.hxx>
-#include <TCollection_ExtendedString.hxx>
-#include <TColStd_HSequenceOfExtendedString.hxx>
-#include <NCollection_DataMap.hxx>
-#include <TColStd_HSequenceOfInteger.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <strstream>
-
-typedef NCollection_DataMap <Standard_Integer, TCollection_ExtendedString> DataMapOfIntegerString;
+#include <string>
+#include <vector>
+#include <map>
class SALOMEDSImpl_AttributeTableOfString : public SALOMEDSImpl_GenericAttribute
{
public:
-Standard_EXPORT virtual TCollection_AsciiString Save();
-Standard_EXPORT virtual void Load(const TCollection_AsciiString&);
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDSImpl_AttributeTableOfString Set(const TDF_Label& label) ;
+Standard_EXPORT virtual std::string Save();
+Standard_EXPORT virtual void Load(const std::string&);
+Standard_EXPORT static const std::string& GetID() ;
+Standard_EXPORT static SALOMEDSImpl_AttributeTableOfString* Set(const DF_Label& label) ;
Standard_EXPORT SALOMEDSImpl_AttributeTableOfString();
-Standard_EXPORT void SetNbColumns(const Standard_Integer theNbColumns);
-Standard_EXPORT void SetTitle(const TCollection_ExtendedString& theTitle) ;
-Standard_EXPORT TCollection_ExtendedString GetTitle() const;
-Standard_EXPORT void SetRowData(const Standard_Integer theRow,const Handle(TColStd_HSequenceOfExtendedString)& theData) ;
-Standard_EXPORT Handle_TColStd_HSequenceOfExtendedString GetRowData(const Standard_Integer theRow) ;
-Standard_EXPORT void SetRowTitle(const Standard_Integer theRow,const TCollection_ExtendedString& theTitle) ;
-Standard_EXPORT void SetRowUnit(const Standard_Integer theRow,const TCollection_ExtendedString& theUnit) ;
-Standard_EXPORT TCollection_ExtendedString GetRowUnit(const Standard_Integer theRow) const;
-Standard_EXPORT void SetRowUnits(const Handle(TColStd_HSequenceOfExtendedString)& theUnits) ;
-Standard_EXPORT Handle(TColStd_HSequenceOfExtendedString) GetRowUnits();
-Standard_EXPORT void SetRowTitles(const Handle(TColStd_HSequenceOfExtendedString)& theTitles) ;
-Standard_EXPORT Handle(TColStd_HSequenceOfExtendedString) GetRowTitles();
-Standard_EXPORT TCollection_ExtendedString GetRowTitle(const Standard_Integer theRow) const;
-Standard_EXPORT void SetColumnData(const Standard_Integer theColumn,const Handle(TColStd_HSequenceOfExtendedString)& theData) ;
-Standard_EXPORT Handle_TColStd_HSequenceOfExtendedString GetColumnData(const Standard_Integer theColumn) ;
-Standard_EXPORT void SetColumnTitle(const Standard_Integer theColumn,const TCollection_ExtendedString& theTitle) ;
-Standard_EXPORT TCollection_ExtendedString GetColumnTitle(const Standard_Integer theColumn) const;
-Standard_EXPORT void SetColumnTitles(const Handle(TColStd_HSequenceOfExtendedString)& theTitles);
-Standard_EXPORT Handle(TColStd_HSequenceOfExtendedString) GetColumnTitles();
-Standard_EXPORT Standard_Integer GetNbRows() const;
-Standard_EXPORT Standard_Integer GetNbColumns() const;
-
-Standard_EXPORT void PutValue(const TCollection_ExtendedString& theValue,const Standard_Integer theRow,const Standard_Integer theColumn) ;
-Standard_EXPORT Standard_Boolean HasValue(const Standard_Integer theRow,const Standard_Integer theColumn) ;
-Standard_EXPORT TCollection_ExtendedString GetValue(const Standard_Integer theRow,const Standard_Integer theColumn) ;
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
-
-Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetSetRowIndices(const Standard_Integer theRow);
-Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetSetColumnIndices(const Standard_Integer theColumn);
-
-Standard_EXPORT void ConvertToString(ostrstream& theStream);
-Standard_EXPORT bool RestoreFromString(istrstream& theStream);
+Standard_EXPORT void SetNbColumns(const int theNbColumns);
+Standard_EXPORT void SetTitle(const std::string& theTitle) ;
+Standard_EXPORT std::string GetTitle() const;
+Standard_EXPORT void SetRowData(const int theRow,const std::vector<std::string>& theData) ;
+Standard_EXPORT std::vector<std::string> GetRowData(const int theRow) ;
+Standard_EXPORT void SetRowTitle(const int theRow,const std::string& theTitle) ;
+Standard_EXPORT void SetRowUnit(const int theRow,const std::string& theUnit) ;
+Standard_EXPORT std::string GetRowUnit(const int theRow) const;
+Standard_EXPORT void SetRowUnits(const std::vector<std::string>& theUnits) ;
+Standard_EXPORT std::vector<std::string> GetRowUnits();
+Standard_EXPORT void SetRowTitles(const std::vector<std::string>& theTitles) ;
+Standard_EXPORT std::vector<std::string> GetRowTitles();
+Standard_EXPORT std::string GetRowTitle(const int theRow) const;
+Standard_EXPORT void SetColumnData(const int theColumn,const std::vector<std::string>& theData) ;
+Standard_EXPORT std::vector<std::string> GetColumnData(const int theColumn) ;
+Standard_EXPORT void SetColumnTitle(const int theColumn,const std::string& theTitle) ;
+Standard_EXPORT std::string GetColumnTitle(const int theColumn) const;
+Standard_EXPORT void SetColumnTitles(const std::vector<std::string>& theTitles);
+Standard_EXPORT std::vector<std::string> GetColumnTitles();
+Standard_EXPORT int GetNbRows() const;
+Standard_EXPORT int GetNbColumns() const;
+
+Standard_EXPORT void PutValue(const std::string& theValue,const int theRow,const int theColumn) ;
+Standard_EXPORT bool HasValue(const int theRow,const int theColumn) ;
+Standard_EXPORT std::string GetValue(const int theRow,const int theColumn) ;
+Standard_EXPORT const std::string& ID() const;
+Standard_EXPORT void Restore(DF_Attribute* with) ;
+Standard_EXPORT DF_Attribute* NewEmpty() const;
+Standard_EXPORT void Paste(DF_Attribute* into);
+
+Standard_EXPORT std::vector<int> GetSetRowIndices(const int theRow);
+Standard_EXPORT std::vector<int> GetSetColumnIndices(const int theColumn);
Standard_EXPORT ~SALOMEDSImpl_AttributeTableOfString() {}
private:
-DataMapOfIntegerString myTable;
-TCollection_ExtendedString myTitle;
-Handle_TColStd_HSequenceOfExtendedString myRows;
-Handle_TColStd_HSequenceOfExtendedString myCols;
-Standard_Integer myNbRows;
-Standard_Integer myNbColumns;
-
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeTableOfString )
+std::map<int, std::string> myTable;
+std::string myTitle;
+std::vector<std::string> myRows;
+std::vector<std::string> myCols;
+int myNbRows;
+int myNbColumns;
};
#include "SALOMEDSImpl_AttributeTarget.hxx"
#include "SALOMEDSImpl_AttributeReference.hxx"
#include "SALOMEDSImpl_Study.hxx"
-#include <TDF_RelocationTable.hxx>
-#include <TDF_ListIteratorOfAttributeList.hxx>
-#include <Standard_GUID.hxx>
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeTarget, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeTarget, SALOMEDSImpl_GenericAttribute )
-
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeTarget::GetID ()
+const std::string& SALOMEDSImpl_AttributeTarget::GetID ()
{
- static Standard_GUID SALOMEDSImpl_AttributeTargetID ("12837197-8F52-11d6-A8A3-0001021E8C7F");
+ static std::string SALOMEDSImpl_AttributeTargetID ("12837197-8F52-11d6-A8A3-0001021E8C7F");
return SALOMEDSImpl_AttributeTargetID;
}
//purpose :
//=======================================================================
-Handle(SALOMEDSImpl_AttributeTarget) SALOMEDSImpl_AttributeTarget::Set (const TDF_Label& L)
+SALOMEDSImpl_AttributeTarget* SALOMEDSImpl_AttributeTarget::Set (const DF_Label& L)
{
- Handle(SALOMEDSImpl_AttributeTarget) A;
- if (!L.FindAttribute(SALOMEDSImpl_AttributeTarget::GetID(),A)) {
+ SALOMEDSImpl_AttributeTarget* A = NULL;
+ if (!(A=(SALOMEDSImpl_AttributeTarget*)L.FindAttribute(SALOMEDSImpl_AttributeTarget::GetID()))) {
A = new SALOMEDSImpl_AttributeTarget();
L.AddAttribute(A);
}
{
}
-void SALOMEDSImpl_AttributeTarget::SetRelation(const TCollection_ExtendedString& theRelation)
+void SALOMEDSImpl_AttributeTarget::SetRelation(const std::string& theRelation)
{
CheckLocked();
if(myRelation == theRelation) return;
//function : Add
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeTarget::Add(const Handle(SALOMEDSImpl_SObject)& theSO)
+void SALOMEDSImpl_AttributeTarget::Add(const SALOMEDSImpl_SObject& theSO)
{
Backup();
- TDF_Label aRefLabel = theSO->GetLabel();
- Handle(SALOMEDSImpl_AttributeReference) aReference;
- if (aRefLabel.FindAttribute(SALOMEDSImpl_AttributeReference::GetID(),aReference)) {
- TDF_ListIteratorOfAttributeList anIter(GetVariables());
- for(;anIter.More();anIter.Next()) if(anIter.Value()->Label() == aRefLabel) return; //BugID: PAL6192
- GetVariables().Append(aReference);
+ 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);
}
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
//function : Get
//purpose :
//=======================================================================
-Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_AttributeTarget::Get()
+vector<SALOMEDSImpl_SObject> SALOMEDSImpl_AttributeTarget::Get()
{
- Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient;
+ vector<SALOMEDSImpl_SObject> aSeq;
+
+ for(int i = 0, len = myVariables.size(); i<len; i++)
+ aSeq.push_back( SALOMEDSImpl_Study::SObject(myVariables[i]->Label()));
- TDF_ListIteratorOfAttributeList anIter(GetVariables());
- for(;anIter.More();anIter.Next()) {
- const TDF_Label& aLabel = anIter.Value()->Label();
- aSeq->Append( SALOMEDSImpl_Study::SObject(aLabel));
- }
return aSeq;
}
//function : Remove
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeTarget::Remove(const Handle(SALOMEDSImpl_SObject)& theSO)
+void SALOMEDSImpl_AttributeTarget::Remove(const SALOMEDSImpl_SObject& theSO)
{
Backup();
- TDF_Label aRefLabel = theSO->GetLabel();
- TDF_ListIteratorOfAttributeList anIter(GetVariables());
- for(;anIter.More();anIter.Next()) {
- if (anIter.Value()->Label() == aRefLabel) {
- GetVariables().Remove(anIter);
- return;
- }
- }
+ DF_Label aRefLabel = theSO.GetLabel();
+
+ 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;
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
//function : ID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeTarget::ID () const { return GetID(); }
+const std::string& SALOMEDSImpl_AttributeTarget::ID () const { return GetID(); }
//=======================================================================
//function : Restore
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeTarget::Restore(const Handle(TDF_Attribute)& With)
+void SALOMEDSImpl_AttributeTarget::Restore(DF_Attribute* With)
{
- Handle(SALOMEDSImpl_AttributeTarget) REL = Handle(SALOMEDSImpl_AttributeTarget)::DownCast (With);
+ SALOMEDSImpl_AttributeTarget* REL = dynamic_cast<SALOMEDSImpl_AttributeTarget*>(With);
myRelation = REL->GetRelation();
- Handle(SALOMEDSImpl_AttributeReference) V;
- myVariables.Clear();
- for (TDF_ListIteratorOfAttributeList it (REL->GetVariables()); it.More(); it.Next()) {
- V = Handle(SALOMEDSImpl_AttributeReference)::DownCast(it.Value());
- myVariables.Append(V);
+ myVariables.clear();
+ for (int i = 0, len = REL->myVariables.size(); i<len; i++) {
+ myVariables.push_back(REL->myVariables[i]);
}
}
//function : NewEmpty
//purpose :
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeTarget::NewEmpty() const
+DF_Attribute* SALOMEDSImpl_AttributeTarget::NewEmpty() const
{
return new SALOMEDSImpl_AttributeTarget();
}
//function : Paste
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeTarget::Paste(const Handle(TDF_Attribute)& Into,
- const Handle(TDF_RelocationTable)& RT) const
+void SALOMEDSImpl_AttributeTarget::Paste(DF_Attribute* into)
{
- Handle(SALOMEDSImpl_AttributeTarget) REL = Handle(SALOMEDSImpl_AttributeTarget)::DownCast (Into);
+ SALOMEDSImpl_AttributeTarget* REL = dynamic_cast<SALOMEDSImpl_AttributeTarget*>(into);
REL->SetRelation(myRelation);
- Handle(SALOMEDSImpl_AttributeReference) V1,V2;
- for (TDF_ListIteratorOfAttributeList it (myVariables); it.More(); it.Next()) {
- V1 = Handle(SALOMEDSImpl_AttributeReference)::DownCast(it.Value());
- RT->HasRelocation (V1,V2);
- REL->GetVariables().Append(V2);
- }
+ REL->myVariables.clear();
+ for (int i = 0, len = myVariables.size(); i<len; i++) {
+ REL->myVariables.push_back(myVariables[i]);
+ }
}
#ifndef _SALOMEDSImpl_AttributeTarget_HeaderFile
#define _SALOMEDSImpl_AttributeTarget_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TDF_LabelList.hxx>
-#include <TDF_Label.hxx>
-#include <TDF_AttributeList.hxx>
-#include <TCollection_ExtendedString.hxx>
-#include <TColStd_HSequenceOfTransient.hxx>
+#include "DF_Attribute.hxx"
+#include "DF_Label.hxx"
+#include <string>
#include "SALOMEDSImpl_GenericAttribute.hxx"
#include "SALOMEDSImpl_SObject.hxx"
-class Standard_GUID;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeTarget, SALOMEDSImpl_GenericAttribute )
-
-
class SALOMEDSImpl_AttributeTarget : public SALOMEDSImpl_GenericAttribute
{
private:
-TCollection_ExtendedString myRelation;
-TDF_AttributeList myVariables;
+std::string myRelation;
+std::vector<DF_Attribute*> myVariables;
public:
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDSImpl_AttributeTarget Set(const TDF_Label& label) ;
+Standard_EXPORT static const std::string& GetID() ;
+Standard_EXPORT static SALOMEDSImpl_AttributeTarget* Set(const DF_Label& label) ;
Standard_EXPORT SALOMEDSImpl_AttributeTarget();
-Standard_EXPORT void Add(const Handle(SALOMEDSImpl_SObject)& theSO);
-Standard_EXPORT Handle(TColStd_HSequenceOfTransient) Get();
-Standard_EXPORT void Remove(const Handle(SALOMEDSImpl_SObject)& theSO);
-Standard_EXPORT TCollection_ExtendedString GetRelation() { return myRelation; }
-Standard_EXPORT void SetRelation(const TCollection_ExtendedString& theRelation);
-Standard_EXPORT TDF_AttributeList& GetVariables() { return myVariables; }
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+Standard_EXPORT void Add(const SALOMEDSImpl_SObject& theSO);
+Standard_EXPORT std::vector<SALOMEDSImpl_SObject> Get();
+Standard_EXPORT void Remove(const SALOMEDSImpl_SObject& theSO);
+Standard_EXPORT std::string GetRelation() { return myRelation; }
+Standard_EXPORT void SetRelation(const std::string& theRelation);
+Standard_EXPORT std::vector<DF_Attribute*>& GetVariables() { return myVariables; }
+Standard_EXPORT const std::string& ID() const;
+Standard_EXPORT void Restore(DF_Attribute* with) ;
+Standard_EXPORT DF_Attribute* NewEmpty() const;
+Standard_EXPORT void Paste(DF_Attribute* into);
Standard_EXPORT ~SALOMEDSImpl_AttributeTarget() {}
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeTarget )
-
};
#endif
#include "SALOMEDSImpl_AttributeTextColor.hxx"
-#include <Standard_GUID.hxx>
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeTextColor, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeTextColor, SALOMEDSImpl_GenericAttribute )
-
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeTextColor::GetID ()
+const std::string& SALOMEDSImpl_AttributeTextColor::GetID ()
{
- static Standard_GUID SALOMEDSImpl_AttributeTextColorID ("12837189-8F52-11d6-A8A3-0001021E8C7F");
+ static std::string SALOMEDSImpl_AttributeTextColorID ("12837189-8F52-11d6-A8A3-0001021E8C7F");
return SALOMEDSImpl_AttributeTextColorID;
}
SALOMEDSImpl_AttributeTextColor::SALOMEDSImpl_AttributeTextColor()
:SALOMEDSImpl_GenericAttribute("AttributeTextColor")
{
- myValue = new TColStd_HArray1OfReal(1, 3, 0.);
+ myValue.clear();
+ myValue.push_back(0.);
+ myValue.push_back(0.);
+ myValue.push_back(0.);
}
//=======================================================================
//function : SetTextColor
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeTextColor::SetTextColor(const Standard_Real R, const Standard_Real G, const Standard_Real B)
+void SALOMEDSImpl_AttributeTextColor::SetTextColor(const double& R, const double& G, const double& B)
{
CheckLocked();
- if(myValue.IsNull()) return;
+
Backup();
- myValue->SetValue(1, R);
- myValue->SetValue(2, G);
- myValue->SetValue(3, B);
+ myValue[0] = R;
+ myValue[1] = G;
+ myValue[2] = B;
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
//function : TextColor
//purpose :
//=======================================================================
-Handle(TColStd_HArray1OfReal) SALOMEDSImpl_AttributeTextColor::TextColor()
+vector<double> SALOMEDSImpl_AttributeTextColor::TextColor()
{
return myValue;
}
//function : ChangeArray
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeTextColor::ChangeArray(const Handle(TColStd_HArray1OfReal)& newArray)
+void SALOMEDSImpl_AttributeTextColor::ChangeArray(const vector<double>& newArray)
{
Backup();
- for(int i = 1; i <= 3; i++)
- myValue->SetValue(i, newArray->Value(i));
+ for(int i = 0; i < 3; i++)
+ myValue[i] = newArray[i];
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeTextColor::ID () const { return GetID(); }
+const std::string& SALOMEDSImpl_AttributeTextColor::ID () const { return GetID(); }
//=======================================================================
//purpose :
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeTextColor::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_AttributeTextColor::NewEmpty () const
{
return new SALOMEDSImpl_AttributeTextColor();
}
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeTextColor::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributeTextColor::Restore(DF_Attribute* with)
{
- Handle(TColStd_HArray1OfReal) s = Handle(SALOMEDSImpl_AttributeTextColor)::DownCast (with)->TextColor ();
- ChangeArray(s);
+ ChangeArray( dynamic_cast<SALOMEDSImpl_AttributeTextColor*>(with)->TextColor ());
return;
}
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeTextColor::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT) const
+void SALOMEDSImpl_AttributeTextColor::Paste (DF_Attribute* into)
{
- Handle(SALOMEDSImpl_AttributeTextColor)::DownCast (into)->ChangeArray (myValue);
+ dynamic_cast<SALOMEDSImpl_AttributeTextColor*>(into)->ChangeArray (myValue);
}
-TCollection_AsciiString SALOMEDSImpl_AttributeTextColor::Save()
+string SALOMEDSImpl_AttributeTextColor::Save()
{
char *Val = new char[75];
- sprintf(Val, "%f %f %f", (float)myValue->Value(1),
- (float)myValue->Value(2),
- (float)myValue->Value(3));
- TCollection_AsciiString ret(Val);
+ sprintf(Val, "%f %f %f", (float)myValue[0],
+ (float)myValue[1],
+ (float)myValue[2]);
+ string ret(Val);
delete Val;
return ret;
}
-void SALOMEDSImpl_AttributeTextColor::Load(const TCollection_AsciiString& value)
+void SALOMEDSImpl_AttributeTextColor::Load(const string& value)
{
float r, g, b;
- sscanf(value.ToCString(), "%f %f %f", &r, &g, &b);
- myValue->SetValue(1, r);
- myValue->SetValue(2, g);
- myValue->SetValue(3, b);
+ sscanf(value.c_str(), "%f %f %f", &r, &g, &b);
+ myValue[0] = r;
+ myValue[1] = g;
+ myValue[2] = b;
}
#ifndef _SALOMEDSImpl_AttributeTextColor_HeaderFile
#define _SALOMEDSImpl_AttributeTextColor_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TColStd_HArray1OfReal.hxx>
-#include <TDF_Label.hxx>
-#include <TCollection_AsciiString.hxx>
+#include "DF_Attribute.hxx"
+#include "DF_Label.hxx"
+#include <string>
+#include <vector>
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Standard_GUID;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeTextColor, SALOMEDSImpl_GenericAttribute )
-
class SALOMEDSImpl_AttributeTextColor : public SALOMEDSImpl_GenericAttribute
{
private:
- Handle(TColStd_HArray1OfReal) myValue;
+ std::vector<double> myValue;
public:
-Standard_EXPORT virtual TCollection_AsciiString Save();
-Standard_EXPORT virtual void Load(const TCollection_AsciiString&);
-Standard_EXPORT static const Standard_GUID& GetID() ;
+Standard_EXPORT virtual std::string Save();
+Standard_EXPORT virtual void Load(const std::string&);
+Standard_EXPORT static const std::string& GetID() ;
Standard_EXPORT SALOMEDSImpl_AttributeTextColor();
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void SetTextColor(const Standard_Real R, const Standard_Real G, const Standard_Real B);
-Standard_EXPORT Handle(TColStd_HArray1OfReal) TextColor();
-Standard_EXPORT void ChangeArray(const Handle(TColStd_HArray1OfReal)& newArray);
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+Standard_EXPORT const std::string& ID() const;
+Standard_EXPORT void SetTextColor(const double& R, const double& G, const double& B);
+Standard_EXPORT std::vector<double> TextColor();
+Standard_EXPORT void ChangeArray(const std::vector<double>& newArray);
+Standard_EXPORT void Restore(DF_Attribute* with) ;
+Standard_EXPORT DF_Attribute* NewEmpty() const;
+Standard_EXPORT void Paste( DF_Attribute* into);
Standard_EXPORT ~SALOMEDSImpl_AttributeTextColor() {}
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeTextColor )
};
#endif
#include "SALOMEDSImpl_AttributeTextHighlightColor.hxx"
-#include <Standard_GUID.hxx>
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeTextHighlightColor, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeTextHighlightColor, SALOMEDSImpl_GenericAttribute )
-
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeTextHighlightColor::GetID ()
+const std::string& SALOMEDSImpl_AttributeTextHighlightColor::GetID ()
{
- static Standard_GUID SALOMEDSImpl_AttributeTextHighlightColorID ("12837190-8F52-11d6-A8A3-0001021E8C7F");
+ static std::string SALOMEDSImpl_AttributeTextHighlightColorID ("12837190-8F52-11d6-A8A3-0001021E8C7F");
return SALOMEDSImpl_AttributeTextHighlightColorID;
}
SALOMEDSImpl_AttributeTextHighlightColor::SALOMEDSImpl_AttributeTextHighlightColor()
:SALOMEDSImpl_GenericAttribute("AttributeTextHighlightColor")
{
- myValue = new TColStd_HArray1OfReal(1, 3, 0.);
+ myValue.clear();
+ myValue.push_back(0.0);
+ myValue.push_back(0.0);
+ myValue.push_back(0.0);
}
//=======================================================================
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeTextHighlightColor::ID () const { return GetID(); }
+const std::string& SALOMEDSImpl_AttributeTextHighlightColor::ID () const { return GetID(); }
//=======================================================================
//function : SetTextHighlightColor
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeTextHighlightColor::SetTextHighlightColor(const Standard_Real R,
- const Standard_Real G,
- const Standard_Real B)
+void SALOMEDSImpl_AttributeTextHighlightColor::SetTextHighlightColor(const double& R,
+ const double& G,
+ const double& B)
{
CheckLocked();
- if(myValue.IsNull()) return;
Backup();
- myValue->SetValue(1, R);
- myValue->SetValue(2, G);
- myValue->SetValue(3, B);
+ myValue[0] = R;
+ myValue[1] = G;
+ myValue[2] = B;
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
//function : TextHighlightColor
//purpose :
//=======================================================================
-Handle(TColStd_HArray1OfReal) SALOMEDSImpl_AttributeTextHighlightColor::TextHighlightColor()
+vector<double> SALOMEDSImpl_AttributeTextHighlightColor::TextHighlightColor()
{
return myValue;
}
//function : ChangeArray
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeTextHighlightColor::ChangeArray(const Handle(TColStd_HArray1OfReal)& newArray)
+void SALOMEDSImpl_AttributeTextHighlightColor::ChangeArray(const vector<double>& newArray)
{
Backup();
- for(int i = 1; i <= 3; i++)
- myValue->SetValue(i, newArray->Value(i));
+ for(int i = 0; i < 3; i++)
+ myValue[i] = newArray[i];
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
//purpose :
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeTextHighlightColor::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_AttributeTextHighlightColor::NewEmpty () const
{
return new SALOMEDSImpl_AttributeTextHighlightColor();
}
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeTextHighlightColor::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributeTextHighlightColor::Restore(DF_Attribute* with)
{
- Handle(TColStd_HArray1OfReal) s = Handle(SALOMEDSImpl_AttributeTextHighlightColor)::DownCast (with)->TextHighlightColor ();
- ChangeArray(s);
+ ChangeArray(dynamic_cast<SALOMEDSImpl_AttributeTextHighlightColor*>(with)->TextHighlightColor());;
return;
}
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeTextHighlightColor::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& ) const
+void SALOMEDSImpl_AttributeTextHighlightColor::Paste (DF_Attribute* into)
{
- Handle(SALOMEDSImpl_AttributeTextHighlightColor)::DownCast (into)->ChangeArray (myValue);
+ dynamic_cast<SALOMEDSImpl_AttributeTextHighlightColor*>(into)->ChangeArray (myValue);
}
-TCollection_AsciiString SALOMEDSImpl_AttributeTextHighlightColor::Save()
+string SALOMEDSImpl_AttributeTextHighlightColor::Save()
{
char *Val = new char[75];
- sprintf(Val, "%f %f %f", (float)myValue->Value(1),
- (float)myValue->Value(2),
- (float)myValue->Value(3));
- TCollection_AsciiString ret(Val);
+ sprintf(Val, "%f %f %f", (float)myValue[0],
+ (float)myValue[1],
+ (float)myValue[2]);
+ string ret(Val);
delete Val;
return ret;
}
-void SALOMEDSImpl_AttributeTextHighlightColor::Load(const TCollection_AsciiString& value)
+void SALOMEDSImpl_AttributeTextHighlightColor::Load(const string& value)
{
float r, g, b;
- sscanf(value.ToCString(), "%f %f %f", &r, &g, &b);
- myValue->SetValue(1, r);
- myValue->SetValue(2, g);
- myValue->SetValue(3, b);
+ sscanf(value.c_str(), "%f %f %f", &r, &g, &b);
+ myValue[0] = r;
+ myValue[1] = g;
+ myValue[2] = b;
}
#ifndef _SALOMEDSImpl_AttributeTextHighlightColor_HeaderFile
#define _SALOMEDSImpl_AttributeTextHighlightColor_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TColStd_HArray1OfReal.hxx>
-#include <TDF_Label.hxx>
-#include <TCollection_AsciiString.hxx>
+#include "DF_Attribute.hxx"
+#include "DF_Label.hxx"
+#include <string>
+#include <vector>
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Standard_GUID;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeTextHighlightColor, SALOMEDSImpl_GenericAttribute )
class SALOMEDSImpl_AttributeTextHighlightColor : public SALOMEDSImpl_GenericAttribute
{
private:
- Handle(TColStd_HArray1OfReal) myValue;
+ std::vector<double> myValue;
public:
-Standard_EXPORT virtual TCollection_AsciiString Save();
-Standard_EXPORT virtual void Load(const TCollection_AsciiString&);
-Standard_EXPORT static const Standard_GUID& GetID() ;
+Standard_EXPORT virtual std::string Save();
+Standard_EXPORT virtual void Load(const std::string&);
+Standard_EXPORT static const std::string& GetID() ;
Standard_EXPORT SALOMEDSImpl_AttributeTextHighlightColor();
-Standard_EXPORT void SetTextHighlightColor(const Standard_Real R, const Standard_Real G, const Standard_Real B);
-Standard_EXPORT Handle(TColStd_HArray1OfReal) TextHighlightColor();
-Standard_EXPORT void ChangeArray(const Handle(TColStd_HArray1OfReal)& newArray);
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+Standard_EXPORT void SetTextHighlightColor(const double& R, const double& G, const double& B);
+Standard_EXPORT std::vector<double> TextHighlightColor();
+Standard_EXPORT void ChangeArray(const std::vector<double>& newArray);
+Standard_EXPORT const std::string& ID() const;
+Standard_EXPORT void Restore(DF_Attribute* with) ;
+Standard_EXPORT DF_Attribute* NewEmpty() const;
+Standard_EXPORT void Paste(DF_Attribute* into);
Standard_EXPORT ~SALOMEDSImpl_AttributeTextHighlightColor() {}
-
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeTextHighlightColor )
};
#endif
#include "SALOMEDSImpl_AttributeTreeNode.hxx"
-#include <Standard_DomainError.hxx>
-#include <TDF_Tool.hxx>
-#include <TDF_Data.hxx>
-#include <TDF_DataSet.hxx>
-#include <TDF_RelocationTable.hxx>
-#include <TCollection_AsciiString.hxx>
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeTreeNode, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeTreeNode, SALOMEDSImpl_GenericAttribute )
-
-static char* Entry(const TDF_Label& theLabel)
+const std::string& SALOMEDSImpl_AttributeTreeNode::GetDefaultTreeID()
{
- TCollection_AsciiString anEntry;
- TDF_Tool::Entry(theLabel, anEntry);
- return anEntry.ToCString();
-}
-
-const Standard_GUID& SALOMEDSImpl_AttributeTreeNode::GetDefaultTreeID()
-{
- static Standard_GUID TreeNodeID ("0E1C36E6-379B-4d90-AC37-17A14310E648");
+ static std::string TreeNodeID ("0E1C36E6-379B-4d90-AC37-17A14310E648");
return TreeNodeID;
}
{}
-Handle(SALOMEDSImpl_AttributeTreeNode) SALOMEDSImpl_AttributeTreeNode::Set (const TDF_Label& L, const Standard_GUID& ID)
+SALOMEDSImpl_AttributeTreeNode* SALOMEDSImpl_AttributeTreeNode::Set (const DF_Label& L, const std::string& ID)
{
- Handle(SALOMEDSImpl_AttributeTreeNode) TN;
+ SALOMEDSImpl_AttributeTreeNode* TN = NULL;
- if (!L.FindAttribute(ID,TN)) {
+ if (!(TN=(SALOMEDSImpl_AttributeTreeNode*)L.FindAttribute(ID))) {
TN = new SALOMEDSImpl_AttributeTreeNode ();
TN->SetTreeID(ID);
L.AddAttribute(TN);
//TreeNode : ID
//purpose : Returns GUID of the TreeNode
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeTreeNode::ID() const
+const std::string& SALOMEDSImpl_AttributeTreeNode::ID() const
{
return myTreeID;
}
//function : Append
//purpose : Add <TN> as last child of me
//=======================================================================
-Standard_Boolean SALOMEDSImpl_AttributeTreeNode::Append (const Handle(SALOMEDSImpl_AttributeTreeNode)& TN)
+bool SALOMEDSImpl_AttributeTreeNode::Append (SALOMEDSImpl_AttributeTreeNode* TN)
{
CheckLocked();
- if (!(TN->ID() == myTreeID) )
- Standard_DomainError::Raise("SALOMEDSImpl_AttributeTreeNode::Append : uncompatible GUID");
+ if (!(TN->ID() == myTreeID)) throw DFexception("SALOMEDSImpl_AttributeTreeNode::Append : uncompatible GUID");
- if(TN->Label() == Label())
- Standard_Failure::Raise("Attempt of self linking");
+ if(TN->Label() == Label()) throw DFexception("Attempt of self linking");
- Handle(SALOMEDSImpl_AttributeTreeNode) bid;
- TN->SetNext(bid); // Deconnects from next.
+ TN->SetNext(NULL); // Deconnects from next.
// Find the last
if (!HasFirst()) {
SetFirst(TN);
- TN->SetPrevious(bid); // Deconnects from previous.
+ TN->SetPrevious(NULL); // Deconnects from previous.
}
else {
- Handle(SALOMEDSImpl_AttributeTreeNode) Last = GetFirst();
- while (Last->HasNext()) {
+ SALOMEDSImpl_AttributeTreeNode* Last = GetFirst();
+ while (Last && Last->HasNext()) {
Last = Last->GetNext();
}
Last->SetNext(TN);
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
- return !TN.IsNull();
+ return (TN);
}
//=======================================================================
//function : Prepend
//purpose : Add <TN> as first child of me
//=======================================================================
-Standard_Boolean SALOMEDSImpl_AttributeTreeNode::Prepend (const Handle(SALOMEDSImpl_AttributeTreeNode)& TN)
+bool SALOMEDSImpl_AttributeTreeNode::Prepend (SALOMEDSImpl_AttributeTreeNode* TN)
{
CheckLocked();
- if (!(TN->ID() == myTreeID) )
- Standard_DomainError::Raise("SALOMEDSImpl_AttributeTreeNode::Prepend : uncompatible GUID");
+ if (!(TN->ID() == myTreeID) ) throw DFexception("SALOMEDSImpl_AttributeTreeNode::Prepend : uncompatible GUID");
- if(TN->Label() == Label())
- Standard_Failure::Raise("Attempt of self linking");
+ if(TN->Label() == Label()) throw DFexception("Attempt of self linking");
- Handle(SALOMEDSImpl_AttributeTreeNode) bid;
- TN->SetPrevious(bid);
+ TN->SetPrevious(NULL);
if (HasFirst()) {
TN->SetNext(GetFirst());
GetFirst()->SetPrevious(TN);
}
else {
- TN->SetNext(bid);
+ TN->SetNext(NULL);
}
TN->SetFather(this);
SetFirst(TN);
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
- return !TN.IsNull();
+ return (TN);
}
//function : InsertBefore
//purpose : Inserts the TreeNode <TN> before me
//=======================================================================
-Standard_Boolean SALOMEDSImpl_AttributeTreeNode::InsertBefore (const Handle(SALOMEDSImpl_AttributeTreeNode)& TN)
+bool SALOMEDSImpl_AttributeTreeNode::InsertBefore (SALOMEDSImpl_AttributeTreeNode* TN)
{
CheckLocked();
- if (!(TN->ID() == myTreeID) )
- Standard_DomainError::Raise("SALOMEDSImpl_AttributeTreeNode::InsertBefore : uncompatible GUID");
+ if (!(TN->ID() == myTreeID) ) throw DFexception("SALOMEDSImpl_AttributeTreeNode::InsertBefore : uncompatible GUID");
- if(TN->Label() == Label())
- Standard_Failure::Raise("Attempt of self linking");
+ if(TN->Label() == Label()) throw DFexception("Attempt of self linking");
TN->SetFather(GetFather());
TN->SetPrevious(GetPrevious());
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
- return !TN.IsNull();
+ return (TN);
}
//=======================================================================
//function : InsertAfter
//purpose : Inserts the TreeNode <TN> after me
//=======================================================================
-Standard_Boolean SALOMEDSImpl_AttributeTreeNode::InsertAfter (const Handle(SALOMEDSImpl_AttributeTreeNode)& TN)
+bool SALOMEDSImpl_AttributeTreeNode::InsertAfter (SALOMEDSImpl_AttributeTreeNode* TN)
{
CheckLocked();
- if(TN->Label() == Label())
- Standard_Failure::Raise("Attempt of self linking");
+ if(TN->Label() == Label()) throw DFexception("Attempt of self linking");
- if (!(TN->ID() == myTreeID) )
- Standard_DomainError::Raise("SALOMEDSImpl_AttributeTreeNode::InsertAfter : uncompatible GUID");
+ if (!(TN->ID() == myTreeID) ) throw DFexception("SALOMEDSImpl_AttributeTreeNode::InsertAfter : uncompatible GUID");
TN->SetFather(GetFather());
TN->SetPrevious(this);
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
- return !TN.IsNull();
+ return (TN);
}
//=======================================================================
//function : Remove
//purpose : Removees the function from the function tree
//=======================================================================
-Standard_Boolean SALOMEDSImpl_AttributeTreeNode::Remove ()
+bool SALOMEDSImpl_AttributeTreeNode::Remove ()
{
CheckLocked();
- if (IsRoot()) return Standard_True;
+ if (IsRoot()) return true;
- Handle(SALOMEDSImpl_AttributeTreeNode) bid;
if (!HasPrevious())
GetFather()->SetFirst(GetNext());
else
if (HasNext()) {
if (HasPrevious()) GetNext()->SetPrevious(GetPrevious());
- else GetNext()->SetPrevious(bid);
+ else GetNext()->SetPrevious(NULL);
}
else {
- if (HasPrevious()) GetPrevious()->SetNext(bid);
+ if (HasPrevious()) GetPrevious()->SetNext(NULL);
}
if (GetFather()->HasFirst()) {
- if (Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(this) == GetFather()->GetFirst()) {
+ if (this == GetFather()->GetFirst()) {
if (HasNext()) {
GetFather()->SetFirst(GetNext());
}
- else GetFather()->SetFirst(bid);
+ else GetFather()->SetFirst(NULL);
}
}
- SetFather(bid);
- SetNext(bid);
- SetPrevious(bid);
+ SetFather(NULL);
+ SetNext(NULL);
+ SetPrevious(NULL);
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
- return Standard_True;
+ return true;
}
//=======================================================================
//function : Depth
//purpose :
//=======================================================================
-Standard_Integer SALOMEDSImpl_AttributeTreeNode::Depth () const
+int SALOMEDSImpl_AttributeTreeNode::Depth () const
{
- Standard_Integer depth = 0;
- Handle(SALOMEDSImpl_AttributeTreeNode) current = this;
- while (current->HasFather()) {
+ int depth = 0;
+ SALOMEDSImpl_AttributeTreeNode* current = (SALOMEDSImpl_AttributeTreeNode*)this;
+ while (current) {
depth++;
current = current->GetFather();
}
//purpose : Finds or creates a TreeNode attribute with explicit ID
// : a driver for it
//=======================================================================
-void SALOMEDSImpl_AttributeTreeNode::SetTreeID (const Standard_GUID& explicitID)
+void SALOMEDSImpl_AttributeTreeNode::SetTreeID (const std::string& explicitID)
{
myTreeID = explicitID;
//function : IsAscendant
//purpose :
//=======================================================================
-Standard_Boolean SALOMEDSImpl_AttributeTreeNode::IsAscendant (const Handle(SALOMEDSImpl_AttributeTreeNode)& ofTN) const
+bool SALOMEDSImpl_AttributeTreeNode::IsAscendant (const SALOMEDSImpl_AttributeTreeNode* ofTN) const
{
return ofTN->IsDescendant(this);
}
//purpose :
//=======================================================================
-Standard_Boolean SALOMEDSImpl_AttributeTreeNode::IsDescendant (const Handle(SALOMEDSImpl_AttributeTreeNode)& ofTN) const
+bool SALOMEDSImpl_AttributeTreeNode::IsDescendant (const SALOMEDSImpl_AttributeTreeNode* ofTN) const
{
- Handle(SALOMEDSImpl_AttributeTreeNode) current = this;
- while (current->HasFather()) {
- if (current->GetFather() == ofTN) return Standard_True;
+ SALOMEDSImpl_AttributeTreeNode* current = (SALOMEDSImpl_AttributeTreeNode*)this;
+ while (current) {
+ if (current->GetFather() == ofTN) return true;
current = current->GetFather();
}
- return Standard_False;
+ return false;
}
//=======================================================================
//purpose :
//=======================================================================
-Standard_Boolean SALOMEDSImpl_AttributeTreeNode::IsFather (const Handle(SALOMEDSImpl_AttributeTreeNode)& ofTN) const
+bool SALOMEDSImpl_AttributeTreeNode::IsFather (const SALOMEDSImpl_AttributeTreeNode* ofTN) const
{
return (ofTN->GetFather() == this);
}
//purpose :
//=======================================================================
-Standard_Boolean SALOMEDSImpl_AttributeTreeNode::IsChild (const Handle(SALOMEDSImpl_AttributeTreeNode)& ofTN) const
+bool SALOMEDSImpl_AttributeTreeNode::IsChild (const SALOMEDSImpl_AttributeTreeNode* ofTN) const
{
return (myFather == ofTN);
}
//purpose : Returns Standard_True if the TreeNode is not attached to a
// TreeNode tree or hasn't an Father.
//=======================================================================
-Standard_Boolean SALOMEDSImpl_AttributeTreeNode::IsRoot() const
+bool SALOMEDSImpl_AttributeTreeNode::IsRoot() const
{
- if (myFather.IsNull() &&
- myPrevious.IsNull() &&
- myNext.IsNull())
- return Standard_True;
- return Standard_False;
+ if (!myFather && !myPrevious && !myNext)
+ return true;
+ return false;
}
//=======================================================================
//TreeNode : Root
//purpose : Returns the TreeNode which has no Father
//=======================================================================
-Handle(SALOMEDSImpl_AttributeTreeNode) SALOMEDSImpl_AttributeTreeNode::Root() const
+SALOMEDSImpl_AttributeTreeNode* SALOMEDSImpl_AttributeTreeNode::Root() const
{
- Handle(SALOMEDSImpl_AttributeTreeNode) O = this;
- while (O->HasFather())
+ SALOMEDSImpl_AttributeTreeNode* O = (SALOMEDSImpl_AttributeTreeNode*)this;
+ while (O && O->HasFather())
O = O->GetFather();
return O;
}
//TreeNode : SetFather
//purpose : Sets the TreeNode F as Father of me
//=======================================================================
-void SALOMEDSImpl_AttributeTreeNode::SetFather(const Handle(SALOMEDSImpl_AttributeTreeNode)& F)
+void SALOMEDSImpl_AttributeTreeNode::SetFather(const SALOMEDSImpl_AttributeTreeNode* F)
{
CheckLocked();
Backup();
- myFather = F;
+ myFather = (SALOMEDSImpl_AttributeTreeNode*)F;
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
//TreeNode : SetNext
//purpose : Sets the TreeNode F next to me
//=======================================================================
-void SALOMEDSImpl_AttributeTreeNode::SetNext(const Handle(SALOMEDSImpl_AttributeTreeNode)& F)
+void SALOMEDSImpl_AttributeTreeNode::SetNext(const SALOMEDSImpl_AttributeTreeNode* F)
{
CheckLocked();
Backup();
- myNext = F;
+ myNext = (SALOMEDSImpl_AttributeTreeNode*)F;
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
//TreeNode : SetPrevious
//purpose : Sets the TreeNode F previous to me
//=======================================================================
-void SALOMEDSImpl_AttributeTreeNode::SetPrevious(const Handle(SALOMEDSImpl_AttributeTreeNode)& F)
+void SALOMEDSImpl_AttributeTreeNode::SetPrevious(const SALOMEDSImpl_AttributeTreeNode* F)
{
CheckLocked();
Backup();
- myPrevious = F;
+ myPrevious = (SALOMEDSImpl_AttributeTreeNode*)F;
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
//TreeNode : SetFirst
//purpose : Sets the TreeNode F as first in the TreeNode tree
//=======================================================================
-void SALOMEDSImpl_AttributeTreeNode::SetFirst(const Handle(SALOMEDSImpl_AttributeTreeNode)& F)
+void SALOMEDSImpl_AttributeTreeNode::SetFirst(const SALOMEDSImpl_AttributeTreeNode* F)
{
CheckLocked();
Backup();
- myFirst = F;
+ myFirst = (SALOMEDSImpl_AttributeTreeNode*)F;
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
//=======================================================================
//TreeNode : AfterAddition
//purpose : Connects the TreeNode to the tree.
-// Backuped attribute must stay disconnected
//=======================================================================
void SALOMEDSImpl_AttributeTreeNode::AfterAddition()
{
- if (!IsBackuped()) {
- if (!myPrevious.IsNull()) {
- myPrevious->SetNext(this);
- }
- else if (!myFather.IsNull()) {
- myFather->SetFirst(this);
- }
- if (!myNext.IsNull())
- myNext->SetPrevious(this);
+ if (myPrevious) {
+ myPrevious->SetNext(this);
+ }
+ else if (myFather) {
+ myFather->SetFirst(this);
+ }
+ if (myNext) {
+ myNext->SetPrevious(this);
}
}
//=======================================================================
//TreeNode : BeforeForget
//purpose : Disconnect the TreeNode from the tree.
-// Backuped attribute is normaly not concerned by such an operation
//=======================================================================
void SALOMEDSImpl_AttributeTreeNode::BeforeForget()
{
- if (!IsBackuped()) {
Remove();
while (HasFirst()) GetFirst()->Remove();
- }
-}
-
-//=======================================================================
-//TreeNode : AfterResume
-//purpose : Connects the TreeNode to the tree
-//=======================================================================
-void SALOMEDSImpl_AttributeTreeNode::AfterResume()
-{
- AfterAddition();
-}
-
-//=======================================================================
-//TreeNode : BeforeUndo
-//purpose : Disconnect the TreeNode from the tree.
-//=======================================================================
-Standard_Boolean SALOMEDSImpl_AttributeTreeNode::BeforeUndo(const Handle(TDF_AttributeDelta)& anAttDelta,
- const Standard_Boolean forceIt)
-{
- if (anAttDelta->IsKind(STANDARD_TYPE(TDF_DeltaOnAddition))) BeforeForget(); // Disconnect.
- return Standard_True;
-}
-
-//=======================================================================
-//TreeNode : AfterUndo
-//purpose : Connect the TreeNode from the tree.
-//=======================================================================
-Standard_Boolean SALOMEDSImpl_AttributeTreeNode::AfterUndo(const Handle(TDF_AttributeDelta)& anAttDelta,
- const Standard_Boolean forceIt)
-{
- if (anAttDelta->IsKind(STANDARD_TYPE(TDF_DeltaOnRemoval))) AfterAddition(); // Reconnect.
- return Standard_True;
}
//=======================================================================
//TreeNode : Restore
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeTreeNode::Restore(const Handle(TDF_Attribute)& other)
+void SALOMEDSImpl_AttributeTreeNode::Restore(DF_Attribute* other)
{
- Handle(SALOMEDSImpl_AttributeTreeNode) F = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(other);
+ SALOMEDSImpl_AttributeTreeNode* F = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(other);
myFather = F->myFather;
myPrevious = F->myPrevious;
myNext = F->myNext;
//purpose : Method for Copy mechanism
//=======================================================================
-void SALOMEDSImpl_AttributeTreeNode::Paste(const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT) const
+void SALOMEDSImpl_AttributeTreeNode::Paste(DF_Attribute* into)
{
- Handle(SALOMEDSImpl_AttributeTreeNode) intof = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(into);
- Handle(SALOMEDSImpl_AttributeTreeNode) func;
- if (!RT->HasRelocation(myFather, func) && RT->AfterRelocate()) {
- func.Nullify();
- }
- intof->SetFather(func);
- if (!RT->HasRelocation(myNext, func) && RT->AfterRelocate()) {
- func.Nullify();
- }
- intof->SetNext(func);
- if (!RT->HasRelocation(myPrevious, func) && RT->AfterRelocate()) {
- func.Nullify();
- }
- intof->SetPrevious(func);
- if (!RT->HasRelocation(myFirst, func) && RT->AfterRelocate()) {
- func.Nullify();
- }
-
- intof->SetFirst(func);
+ SALOMEDSImpl_AttributeTreeNode* intof = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(into);
+ intof->SetFather(myFather);
+ intof->SetNext(myNext);
+ intof->SetPrevious(myPrevious);
+ intof->SetFirst(myFirst);
intof->SetTreeID(myTreeID);
}
//purpose : Returns new empty TreeNode attribute
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeTreeNode::NewEmpty() const
+DF_Attribute* SALOMEDSImpl_AttributeTreeNode::NewEmpty() const
{
- Handle(SALOMEDSImpl_AttributeTreeNode) T = new SALOMEDSImpl_AttributeTreeNode();
+ SALOMEDSImpl_AttributeTreeNode* T = new SALOMEDSImpl_AttributeTreeNode();
T->SetTreeID(myTreeID);
return T;
}
-//=======================================================================
-//TreeNode : References
-//purpose : Collects the references
-//=======================================================================
-void SALOMEDSImpl_AttributeTreeNode::References(const Handle(TDF_DataSet)& aDataSet) const
-{
- Handle(SALOMEDSImpl_AttributeTreeNode) fct = myFirst;
- while (!fct.IsNull()) {
- aDataSet->AddAttribute(fct);
- fct = fct->myNext;
- }
-}
-
-TCollection_AsciiString SALOMEDSImpl_AttributeTreeNode::Type()
+string SALOMEDSImpl_AttributeTreeNode::Type()
{
char* aNodeName = new char[60];
- char aGUID[40];
- ID().ToCString(aGUID);
- sprintf(aNodeName, "AttributeTreeNodeGUID%s",aGUID);
- TCollection_AsciiString ret(aNodeName);
+ sprintf(aNodeName, "AttributeTreeNodeGUID%s", ID().c_str());
+ string ret(aNodeName);
delete aNodeName;
return ret;
}
-TCollection_AsciiString SALOMEDSImpl_AttributeTreeNode::Save()
+string SALOMEDSImpl_AttributeTreeNode::Save()
{
- TCollection_AsciiString aFather, aPrevious, aNext, aFirst;
+ string aFather, aPrevious, aNext, aFirst;
- if (HasFather()) aFather = Entry(GetFather()->Label()); else aFather = "!";
- if (HasPrevious()) aPrevious = Entry(GetPrevious()->Label()); else aPrevious = "!";
- if (HasNext()) aNext = Entry(GetNext()->Label()); else aNext = "!";
- if (HasFirst()) aFirst = Entry(GetFirst()->Label()); else aFirst = "!";
+ if (HasFather()) aFather = GetFather()->Label().Entry(); else aFather = "!";
+ if (HasPrevious()) aPrevious = GetPrevious()->Label().Entry(); else aPrevious = "!";
+ if (HasNext()) aNext = GetNext()->Label().Entry(); else aNext = "!";
+ if (HasFirst()) aFirst = GetFirst()->Label().Entry(); else aFirst = "!";
int aLength = 4;
- aLength += aFather.Length() + aPrevious.Length() + aNext.Length() + aFirst.Length();
+ aLength += aFather.size() + aPrevious.size() + aNext.size() + aFirst.size();
char* aResult = new char[aLength];
- sprintf(aResult, "%s %s %s %s", aFather.ToCString(), aPrevious.ToCString(), aNext.ToCString(), aFirst.ToCString());
- TCollection_AsciiString ret(aResult);
+ sprintf(aResult, "%s %s %s %s", aFather.c_str(), aPrevious.c_str(), aNext.c_str(), aFirst.c_str());
+ string ret(aResult);
delete aResult;
return ret;
}
-void SALOMEDSImpl_AttributeTreeNode::Load(const TCollection_AsciiString& value)
+void SALOMEDSImpl_AttributeTreeNode::Load(const string& value)
{
- Handle(TDF_Data) DF = Label().Data();
-
- char* aCopy = (char*)value.ToCString();
+ char* aCopy = (char*)value.c_str();
char* adr = strtok(aCopy, " ");
- TDF_Label aLabel;
- Handle(SALOMEDSImpl_AttributeTreeNode) aDepNode;
+ DF_Label aLabel;
+ SALOMEDSImpl_AttributeTreeNode* aDepNode = NULL;
if (adr && adr[0] != '!') {
- TDF_Tool::Label(DF, adr, aLabel, 1);
- if (!aLabel.FindAttribute(ID(), aDepNode))
+ aLabel = DF_Label::Label(Label(), adr, true);
+ if (!(aDepNode=(SALOMEDSImpl_AttributeTreeNode*)aLabel.FindAttribute(ID())))
aDepNode = SALOMEDSImpl_AttributeTreeNode::Set(aLabel, ID());
SetFather(aDepNode);
adr = strtok(NULL, " ");
if (adr && adr[0] != '!') {
- TDF_Tool::Label(DF, adr, aLabel, 1);
- if (!aLabel.FindAttribute(ID(), aDepNode))
+ aLabel = DF_Label::Label(Label(), adr, true);
+ if (!(aDepNode=(SALOMEDSImpl_AttributeTreeNode*)aLabel.FindAttribute(ID())))
aDepNode = SALOMEDSImpl_AttributeTreeNode::Set(aLabel, ID());
SetPrevious(aDepNode);
}
adr = strtok(NULL, " ");
if (adr && adr[0] != '!') {
- TDF_Tool::Label(DF, adr, aLabel, 1);
- if (!aLabel.FindAttribute(ID(), aDepNode))
+ aLabel = DF_Label::Label(Label(), adr, true);
+ if (!(aDepNode=(SALOMEDSImpl_AttributeTreeNode*)aLabel.FindAttribute(ID())))
aDepNode = SALOMEDSImpl_AttributeTreeNode::Set(aLabel, ID());
SetNext(aDepNode);
}
adr = strtok(NULL, " ");
if (adr && adr[0] != '!') {
- TDF_Tool::Label(DF, adr, aLabel, 1);
- if (!aLabel.FindAttribute(ID(), aDepNode))
+ aLabel = DF_Label::Label(Label(), adr, true);
+ if (!(aDepNode=(SALOMEDSImpl_AttributeTreeNode*)aLabel.FindAttribute(ID())))
aDepNode = SALOMEDSImpl_AttributeTreeNode::Set(aLabel, ID());
SetFirst(aDepNode);
}
#ifndef _SALOMEDSImpl_AttributeTreeNode_HeaderFile
#define _SALOMEDSImpl_AttributeTreeNode_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <Standard_GUID.hxx>
-#include <TDF_Label.hxx>
-#include <TDF_AttributeDelta.hxx>
-#include <TCollection_AsciiString.hxx>
+#include "DF_Attribute.hxx"
+#include "DF_Label.hxx"
+#include <string>
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Handle_TDF_DataSet;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-class SALOMEDSImpl_ChildNodeIterator;
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeTreeNode, SALOMEDSImpl_GenericAttribute )
-
class SALOMEDSImpl_AttributeTreeNode : public SALOMEDSImpl_GenericAttribute
{
public:
-Standard_EXPORT const static Standard_GUID& GetDefaultTreeID();
-Standard_EXPORT static Handle_SALOMEDSImpl_AttributeTreeNode Set(const TDF_Label& L, const Standard_GUID& ID);
+Standard_EXPORT const static std::string& GetDefaultTreeID();
+Standard_EXPORT static SALOMEDSImpl_AttributeTreeNode* Set(const DF_Label& L, const std::string& ID);
Standard_EXPORT SALOMEDSImpl_AttributeTreeNode();
-Standard_EXPORT void SetFather(const Handle(SALOMEDSImpl_AttributeTreeNode)& value);
-Standard_EXPORT void SetPrevious(const Handle(SALOMEDSImpl_AttributeTreeNode)& value);
-Standard_EXPORT void SetNext(const Handle(SALOMEDSImpl_AttributeTreeNode)& value);
-Standard_EXPORT void SetFirst(const Handle(SALOMEDSImpl_AttributeTreeNode)& value);
-Standard_EXPORT void SetTreeID(const Standard_GUID& value);
-
-Standard_EXPORT Standard_Boolean Append(const Handle(SALOMEDSImpl_AttributeTreeNode)& value);
-Standard_EXPORT Standard_Boolean Prepend(const Handle(SALOMEDSImpl_AttributeTreeNode)& value);
-Standard_EXPORT Standard_Boolean Remove();
-Standard_EXPORT Standard_Boolean InsertBefore(const Handle(SALOMEDSImpl_AttributeTreeNode)& value);
-Standard_EXPORT Standard_Boolean InsertAfter(const Handle(SALOMEDSImpl_AttributeTreeNode)& value);
-
-Standard_EXPORT Handle(SALOMEDSImpl_AttributeTreeNode) GetFather() { return myFather; }
-Standard_EXPORT Handle(SALOMEDSImpl_AttributeTreeNode) GetPrevious() { return myPrevious; }
-Standard_EXPORT Handle(SALOMEDSImpl_AttributeTreeNode) GetNext() { return myNext; }
-Standard_EXPORT Handle(SALOMEDSImpl_AttributeTreeNode) GetFirst() { return myFirst; }
-
-Standard_EXPORT Standard_Boolean HasFather() { return (!myFather.IsNull()); }
-Standard_EXPORT Standard_Boolean HasPrevious() { return (!myPrevious.IsNull()); }
-Standard_EXPORT Standard_Boolean HasNext() {return (!myNext.IsNull()); }
-Standard_EXPORT Standard_Boolean HasFirst() { return (!myFirst.IsNull()); }
-Standard_EXPORT const Standard_GUID& GetTreeID() { return ID(); }
-Standard_EXPORT Standard_Integer Depth() const;
-Standard_EXPORT Standard_Boolean IsRoot() const ;
-Standard_EXPORT Handle(SALOMEDSImpl_AttributeTreeNode) Root() const;
-Standard_EXPORT Standard_Boolean IsAscendant (const Handle(SALOMEDSImpl_AttributeTreeNode)& ofTN) const;
-Standard_EXPORT Standard_Boolean IsDescendant(const Handle(SALOMEDSImpl_AttributeTreeNode)& value) const;
-Standard_EXPORT Standard_Boolean IsFather(const Handle(SALOMEDSImpl_AttributeTreeNode)& value) const;
-Standard_EXPORT Standard_Boolean IsChild(const Handle(SALOMEDSImpl_AttributeTreeNode)& value) const;
-
-Standard_EXPORT virtual TCollection_AsciiString Save();
-Standard_EXPORT virtual void Load(const TCollection_AsciiString&);
-Standard_EXPORT virtual TCollection_AsciiString Type();
-
-Standard_EXPORT virtual void AfterAddition() ;
-Standard_EXPORT virtual void BeforeForget() ;
-Standard_EXPORT virtual void AfterResume() ;
-Standard_EXPORT virtual Standard_Boolean BeforeUndo(const Handle(TDF_AttributeDelta)& anAttDelta,
- const Standard_Boolean forceIt = Standard_False) ;
-Standard_EXPORT virtual Standard_Boolean AfterUndo(const Handle(TDF_AttributeDelta)& anAttDelta,
- const Standard_Boolean forceIt = Standard_False) ;
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
-Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const;
-Standard_EXPORT void References(const Handle(TDF_DataSet)& aDataSet) const;
-Standard_EXPORT ~SALOMEDSImpl_AttributeTreeNode() {}
-
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeTreeNode )
+Standard_EXPORT void SetFather(const SALOMEDSImpl_AttributeTreeNode* value);
+Standard_EXPORT void SetPrevious(const SALOMEDSImpl_AttributeTreeNode* value);
+Standard_EXPORT void SetNext(const SALOMEDSImpl_AttributeTreeNode* value);
+Standard_EXPORT void SetFirst(const SALOMEDSImpl_AttributeTreeNode* value);
+Standard_EXPORT void SetTreeID(const std::string& value);
+
+Standard_EXPORT bool Append(SALOMEDSImpl_AttributeTreeNode* value);
+Standard_EXPORT bool Prepend(SALOMEDSImpl_AttributeTreeNode* value);
+Standard_EXPORT bool Remove();
+Standard_EXPORT bool InsertBefore(SALOMEDSImpl_AttributeTreeNode* value);
+Standard_EXPORT bool InsertAfter(SALOMEDSImpl_AttributeTreeNode* value);
+
+Standard_EXPORT SALOMEDSImpl_AttributeTreeNode* GetFather() const { return myFather; }
+Standard_EXPORT SALOMEDSImpl_AttributeTreeNode* GetPrevious() const { return myPrevious; }
+Standard_EXPORT SALOMEDSImpl_AttributeTreeNode* GetNext() const { return myNext; }
+Standard_EXPORT SALOMEDSImpl_AttributeTreeNode* GetFirst() const { return myFirst; }
+
+Standard_EXPORT bool HasFather() { return (myFather); }
+Standard_EXPORT bool HasPrevious() { return (myPrevious); }
+Standard_EXPORT bool HasNext() {return (myNext); }
+Standard_EXPORT bool HasFirst() { return (myFirst); }
+Standard_EXPORT const std::string& GetTreeID() { return ID(); }
+Standard_EXPORT int Depth() const;
+Standard_EXPORT bool IsRoot() const ;
+Standard_EXPORT SALOMEDSImpl_AttributeTreeNode* Root() const;
+Standard_EXPORT bool IsAscendant (const SALOMEDSImpl_AttributeTreeNode* ofTN) const;
+Standard_EXPORT bool IsDescendant(const SALOMEDSImpl_AttributeTreeNode* value) const;
+Standard_EXPORT bool IsFather(const SALOMEDSImpl_AttributeTreeNode* value) const;
+Standard_EXPORT bool IsChild(const SALOMEDSImpl_AttributeTreeNode* value) const;
+
+Standard_EXPORT virtual std::string Save();
+Standard_EXPORT virtual void Load(const std::string&);
+Standard_EXPORT virtual std::string Type();
+
+Standard_EXPORT const std::string& ID() const;
+Standard_EXPORT void Restore(DF_Attribute* with) ;
+Standard_EXPORT void Paste(DF_Attribute* into);
+Standard_EXPORT DF_Attribute* NewEmpty() const;
+Standard_EXPORT ~SALOMEDSImpl_AttributeTreeNode() {;}
+
+Standard_EXPORT virtual void AfterAddition();
+Standard_EXPORT virtual void BeforeForget();
private:
-Standard_GUID myTreeID;
-Handle(SALOMEDSImpl_AttributeTreeNode) myFather;
-Handle(SALOMEDSImpl_AttributeTreeNode) myPrevious;
-Handle(SALOMEDSImpl_AttributeTreeNode) myNext;
-Handle(SALOMEDSImpl_AttributeTreeNode) myFirst;
+std::string myTreeID;
+SALOMEDSImpl_AttributeTreeNode* myFather;
+SALOMEDSImpl_AttributeTreeNode* myPrevious;
+SALOMEDSImpl_AttributeTreeNode* myNext;
+SALOMEDSImpl_AttributeTreeNode* myFirst;
friend class SALOMEDSImpl_ChildNodeIterator;
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeUserID, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeUserID, SALOMEDSImpl_GenericAttribute )
-
-Handle(SALOMEDSImpl_AttributeUserID) SALOMEDSImpl_AttributeUserID::Set (const TDF_Label& L, const Standard_GUID& ID)
+SALOMEDSImpl_AttributeUserID* SALOMEDSImpl_AttributeUserID::Set (const DF_Label& L, const std::string& ID)
{
- Handle(SALOMEDSImpl_AttributeUserID) A;
- if (!L.FindAttribute(ID, A)) {
+ SALOMEDSImpl_AttributeUserID* A = NULL;
+ if (!(A=(SALOMEDSImpl_AttributeUserID*)L.FindAttribute(ID))) {
A = new SALOMEDSImpl_AttributeUserID();
A->SetValue(ID);
L.AddAttribute(A);
//function : ID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeUserID::ID() const
+const std::string& SALOMEDSImpl_AttributeUserID::ID() const
{ return myID; }
//function : SetValue
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeUserID::SetValue( const Standard_GUID& guid)
+void SALOMEDSImpl_AttributeUserID::SetValue( const std::string& guid)
{
CheckLocked();
if(myID == guid) return;
//function : NewEmpty
//purpose :
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeUserID::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_AttributeUserID::NewEmpty () const
{
- Handle(SALOMEDSImpl_AttributeUserID) A = new SALOMEDSImpl_AttributeUserID();
+ SALOMEDSImpl_AttributeUserID* A = new SALOMEDSImpl_AttributeUserID();
A->SetValue(myID);
return A;
}
//function : Restore
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeUserID::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributeUserID::Restore(DF_Attribute* with)
{
- Handle(SALOMEDSImpl_AttributeUserID) A = Handle(SALOMEDSImpl_AttributeUserID)::DownCast(with);
+ SALOMEDSImpl_AttributeUserID* A = dynamic_cast<SALOMEDSImpl_AttributeUserID*>(with);
SetValue( A->ID() );
}
//function : Paste
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeUserID::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT) const
+void SALOMEDSImpl_AttributeUserID::Paste (DF_Attribute* into)
{
- Handle(SALOMEDSImpl_AttributeUserID) A = Handle(SALOMEDSImpl_AttributeUserID)::DownCast(into);
+ SALOMEDSImpl_AttributeUserID* A = dynamic_cast<SALOMEDSImpl_AttributeUserID*>(into);
A->SetValue( myID );
}
-TCollection_AsciiString SALOMEDSImpl_AttributeUserID::Type()
+string SALOMEDSImpl_AttributeUserID::Type()
{
char* aUAttrName = new char[60];
- char aGUID[40];
- ID().ToCString(aGUID);
- sprintf(aUAttrName, "AttributeUserID_%s",aGUID);
+ sprintf(aUAttrName, "AttributeUserID_%s",ID().c_str());
- TCollection_AsciiString ret(aUAttrName);
+ string ret(aUAttrName);
delete aUAttrName;
return ret;
#ifndef _SALOMEDSImpl_AttributeUserID_HeaderFile
#define _SALOMEDSImpl_AttributeUserID_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <Standard_GUID.hxx>
-#include <TDF_Label.hxx>
-#include <TCollection_AsciiString.hxx>
+#include "DF_Attribute.hxx"
+#include "DF_Label.hxx"
+#include <string>
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeUserID, SALOMEDSImpl_GenericAttribute )
class SALOMEDSImpl_AttributeUserID : public SALOMEDSImpl_GenericAttribute
{
private:
-Standard_GUID myID;
+std::string myID;
public:
SALOMEDSImpl_AttributeUserID():SALOMEDSImpl_GenericAttribute("AttributeUserID") {}
-static Handle(SALOMEDSImpl_AttributeUserID) Set (const TDF_Label& L, const Standard_GUID& ID);
-static const Standard_GUID& DefaultID()
+static SALOMEDSImpl_AttributeUserID* Set (const DF_Label& L, const std::string& ID);
+static const std::string& DefaultID()
{
- static Standard_GUID SALOMEDSImpl_DefaultUserAttributeID ("FFFFFFFF-D9CD-11d6-945D-1050DA506788");
+ static std::string SALOMEDSImpl_DefaultUserAttributeID ("FFFFFFFF-D9CD-11d6-945D-1050DA506788");
return SALOMEDSImpl_DefaultUserAttributeID;
}
-Standard_EXPORT const Standard_GUID& Value() const { return ID(); }
-Standard_EXPORT void SetValue(const Standard_GUID& value);
+Standard_EXPORT const std::string& Value() const { return ID(); }
+Standard_EXPORT void SetValue(const std::string& value);
-Standard_EXPORT virtual TCollection_AsciiString Type();
+Standard_EXPORT virtual std::string Type();
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+Standard_EXPORT const std::string& ID() const;
+Standard_EXPORT void Restore(DF_Attribute* with) ;
+Standard_EXPORT DF_Attribute* NewEmpty() const;
+Standard_EXPORT void Paste(DF_Attribute* into);
Standard_EXPORT ~SALOMEDSImpl_AttributeUserID() {}
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeUserID )
-
};
#endif
if(theType == "AttributeTableOfString") return SALOMEDSImpl_AttributeTableOfString::GetID(); \
if(theType == "AttributeStudyProperties") return SALOMEDSImpl_AttributeStudyProperties::GetID(); \
if(theType == "AttributePythonObject") return SALOMEDSImpl_AttributePythonObject::GetID(); \
- if(theType == "AttributeUserID") return Standard_GUID("FFFFFFFF-D9CD-11d6-945D-1050DA506788"); \
+ if(theType == "AttributeUserID") return std::string("FFFFFFFF-D9CD-11d6-945D-1050DA506788"); \
if(theType == "AttributeExternalFileDef") return SALOMEDSImpl_AttributeExternalFileDef::GetID(); \
if(theType == "AttributeFileType") return SALOMEDSImpl_AttributeFileType::GetID(); \
if(theType == "AttributeFlags") return SALOMEDSImpl_AttributeFlags::GetID(); \
if(theType == "AttributeString") return SALOMEDSImpl_AttributeString::GetID();
-#define __FindOrCreateAttributeLocked(ClassName) if (strcmp(aTypeOfAttribute.ToCString(), #ClassName) == 0) { \
- Handle(SALOMEDSImpl_##ClassName) anAttr; \
- if (!Lab.FindAttribute(SALOMEDSImpl_##ClassName::GetID(), anAttr)) { \
+#define __FindOrCreateAttributeLocked(ClassName) if (strcmp(aTypeOfAttribute.c_str(), #ClassName) == 0) { \
+ SALOMEDSImpl_##ClassName* anAttr; \
+ if (!(anAttr=(SALOMEDSImpl_##ClassName*)Lab.FindAttribute(SALOMEDSImpl_##ClassName::GetID()))) { \
CheckLocked(); \
anAttr = new SALOMEDSImpl_##ClassName; \
Lab.AddAttribute(anAttr); \
return anAttr; \
}
-#define __FindOrCreateAttribute(ClassName) if (strcmp(aTypeOfAttribute.ToCString(), #ClassName) == 0) { \
- Handle(SALOMEDSImpl_##ClassName) anAttr; \
- if (!Lab.FindAttribute(SALOMEDSImpl_##ClassName::GetID(), anAttr)) { \
+#define __FindOrCreateAttribute(ClassName) if (strcmp(aTypeOfAttribute.c_str(), #ClassName) == 0) { \
+ SALOMEDSImpl_##ClassName* anAttr; \
+ if (!(anAttr=(SALOMEDSImpl_##ClassName*)Lab.FindAttribute(SALOMEDSImpl_##ClassName::GetID()))) { \
anAttr = new SALOMEDSImpl_##ClassName; \
Lab.AddAttribute(anAttr); \
} \
#include "SALOMEDSImpl_Callback.hxx"
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_Callback, MMgt_TShared )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_Callback, MMgt_TShared )
#ifndef __SALOMEDSIMPL_CALLBACK_H__
#define __SALOMEDSIMPL_CALLBACK_H__
-//Handle definition
-#include <Handle_MMgt_TShared.hxx>
-#include <Standard_DefineHandle.hxx>
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_Callback, MMgt_TShared )
#include "SALOMEDSImpl_UseCaseBuilder.hxx"
-class SALOMEDSImpl_Callback : public MMgt_TShared
+class SALOMEDSImpl_Callback
{
private:
- Handle(SALOMEDSImpl_UseCaseBuilder) _builder;
+ SALOMEDSImpl_UseCaseBuilder* _builder;
public:
- SALOMEDSImpl_Callback(const Handle(SALOMEDSImpl_UseCaseBuilder)& builder)
+ SALOMEDSImpl_Callback(SALOMEDSImpl_UseCaseBuilder* builder)
{
_builder = builder;
}
- virtual void OnAddSObject(Handle(SALOMEDSImpl_SObject) theObject)
+ virtual void OnAddSObject(const SALOMEDSImpl_SObject& theObject)
{
- if(_builder != NULL && theObject != NULL) _builder->Append(theObject);
+ if(_builder != NULL && theObject) _builder->Append(theObject);
}
- virtual void OnRemoveSObject(Handle(SALOMEDSImpl_SObject) theObject)
+ virtual void OnRemoveSObject(const SALOMEDSImpl_SObject& theObject)
{
- if(_builder != NULL && theObject != NULL) _builder->Remove(theObject);
+ if(_builder != NULL && theObject) _builder->Remove(theObject);
}
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_Callback )
-
};
#endif
// Author : Sergey RUIN
// Module : SALOME
-
#include "SALOMEDSImpl_ChildIterator.hxx"
#include "SALOMEDSImpl_Study.hxx"
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_ChildIterator, MMgt_TShared )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_ChildIterator, MMgt_TShared )
-
-SALOMEDSImpl_ChildIterator::SALOMEDSImpl_ChildIterator(const Handle(SALOMEDSImpl_SObject)& theSO)
+SALOMEDSImpl_ChildIterator::SALOMEDSImpl_ChildIterator(const SALOMEDSImpl_SObject& theSO)
{
_so = theSO;
- _it = TDF_ChildIterator(_so->GetLabel());
+ _it = DF_ChildIterator(_so.GetLabel());
}
-SALOMEDSImpl_ChildIterator::SALOMEDSImpl_ChildIterator(const TDF_Label& theLabel)
+SALOMEDSImpl_ChildIterator::SALOMEDSImpl_ChildIterator(const DF_Label& theLabel)
{
_so = SALOMEDSImpl_Study::SObject(theLabel);
- _it = TDF_ChildIterator(theLabel);
+ _it = DF_ChildIterator(theLabel);
}
void SALOMEDSImpl_ChildIterator::Init()
{
- _it.Initialize(_so->GetLabel(), Standard_False);
+ if(_so) _it.Init(_so.GetLabel(), false);
}
-void SALOMEDSImpl_ChildIterator::Init(const TDF_Label& theLabel)
+void SALOMEDSImpl_ChildIterator::Init(const DF_Label& theLabel)
{
- _it.Initialize(theLabel, Standard_False);
+ _it.Init(theLabel, false);
}
void SALOMEDSImpl_ChildIterator::InitEx(bool theAllLevels)
{
- _it.Initialize(_so->GetLabel(), theAllLevels);
+ if(_so) _it.Init(_so.GetLabel(), theAllLevels);
}
-void SALOMEDSImpl_ChildIterator::InitEx(const TDF_Label& theLabel, bool theAllLevels)
+void SALOMEDSImpl_ChildIterator::InitEx(const DF_Label& theLabel, bool theAllLevels)
{
- _it.Initialize(theLabel, theAllLevels);
+ _it.Init(theLabel, theAllLevels);
}
bool SALOMEDSImpl_ChildIterator::More()
_it.Next();
}
-Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_ChildIterator::Value()
+SALOMEDSImpl_SObject SALOMEDSImpl_ChildIterator::Value()
{
+ if(!_so) return SALOMEDSImpl_SObject();
return SALOMEDSImpl_Study::SObject(_it.Value());
}
-TDF_Label SALOMEDSImpl_ChildIterator::Label()
+DF_Label SALOMEDSImpl_ChildIterator::Label()
{
return _it.Value();
}
+
+SALOMEDSImpl_ChildIterator* SALOMEDSImpl_ChildIterator::GetPersistentCopy() const
+{
+ SALOMEDSImpl_ChildIterator* itr = new SALOMEDSImpl_ChildIterator();
+ itr->_it = _it;
+ itr->_so = _so;
+ return itr;
+}
+
#ifndef __SALOMEDSImpl_CHILDITERATOR_H__
#define __SALOMEDSImpl_CHILDITERATOR_H__
-//Handle definition
-#include <Handle_MMgt_TShared.hxx>
-#include <Standard_DefineHandle.hxx>
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_ChildIterator, MMgt_TShared )
#include "SALOMEDSImpl_SObject.hxx"
-#include "TDF_ChildIterator.hxx"
-#include "TDF_Label.hxx"
+#include "DF_ChildIterator.hxx"
+#include "DF_Label.hxx"
-class SALOMEDSImpl_ChildIterator: public MMgt_TShared
+class SALOMEDSImpl_ChildIterator
{
private:
- TDF_ChildIterator _it;
- Handle(SALOMEDSImpl_SObject) _so;
+ DF_ChildIterator _it;
+ SALOMEDSImpl_SObject _so;
public:
- Standard_EXPORT SALOMEDSImpl_ChildIterator(const Handle(SALOMEDSImpl_SObject)& theSO);
- Standard_EXPORT SALOMEDSImpl_ChildIterator(const TDF_Label& theLabel);
+ Standard_EXPORT SALOMEDSImpl_ChildIterator() {}
+ Standard_EXPORT SALOMEDSImpl_ChildIterator(const SALOMEDSImpl_SObject& theSO);
+ Standard_EXPORT SALOMEDSImpl_ChildIterator(const DF_Label& theLabel);
Standard_EXPORT ~SALOMEDSImpl_ChildIterator() {};
Standard_EXPORT virtual void Init();
- Standard_EXPORT virtual void Init(const TDF_Label& theLabel);
+ Standard_EXPORT virtual void Init(const DF_Label& theLabel);
Standard_EXPORT virtual void InitEx(bool theAllLevels);
- Standard_EXPORT virtual void InitEx(const TDF_Label& theLabel, bool theAllLevels);
+ Standard_EXPORT virtual void InitEx(const DF_Label& theLabel, bool theAllLevels);
Standard_EXPORT virtual bool More();
Standard_EXPORT virtual void Next();
- Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) Value();
- Standard_EXPORT virtual TDF_Label Label();
+ Standard_EXPORT virtual SALOMEDSImpl_SObject Value();
+ Standard_EXPORT virtual DF_Label Label();
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_SObject )
+ Standard_EXPORT SALOMEDSImpl_ChildIterator* GetPersistentCopy() const;
};
#endif
#define ChildNodeIterator_UpToBrother \
{ \
- while (!myNode.IsNull() && (myNode->Depth() > myFirstLevel) && myNode->myNext == NULL) \
+ while (myNode && (myNode->Depth() > myFirstLevel) && myNode->myNext == NULL) \
myNode = myNode->myFather; \
- if (!myNode.IsNull() && (myNode->Depth() > myFirstLevel) && myNode->myFather != NULL) \
+ if (myNode && (myNode->Depth() > myFirstLevel) && myNode->myFather != NULL) \
myNode = myNode->myNext; \
else \
myNode = NULL; \
//purpose :
//=======================================================================
-SALOMEDSImpl_ChildNodeIterator::SALOMEDSImpl_ChildNodeIterator (const Handle(SALOMEDSImpl_AttributeTreeNode)& aNode,
- const Standard_Boolean allLevels)
+SALOMEDSImpl_ChildNodeIterator::SALOMEDSImpl_ChildNodeIterator (const SALOMEDSImpl_AttributeTreeNode* aNode,
+ const bool allLevels)
: myNode(aNode->myFirst),
myFirstLevel(allLevels ? aNode->Depth() : -1)
{}
//purpose :
//=======================================================================
-void SALOMEDSImpl_ChildNodeIterator::Initialize(const Handle(SALOMEDSImpl_AttributeTreeNode)& aNode,
- const Standard_Boolean allLevels)
+void SALOMEDSImpl_ChildNodeIterator::Initialize(const SALOMEDSImpl_AttributeTreeNode* aNode,
+ const bool allLevels)
{
myNode = aNode->myFirst;
myFirstLevel = allLevels ? aNode->Depth() : -1;
#ifndef _SALOMEDSImpl_ChildNodeIterator_HeaderFile
#define _SALOMEDSImpl_ChildNodeIterator_HeaderFile
-#ifndef _Standard_Integer_HeaderFile
-#include <Standard_Integer.hxx>
-#endif
-#ifndef _Standard_Boolean_HeaderFile
-#include <Standard_Boolean.hxx>
-#endif
-
#include "SALOMEDSImpl_AttributeTreeNode.hxx"
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-
class SALOMEDSImpl_ChildNodeIterator
{
public:
Standard_EXPORT SALOMEDSImpl_ChildNodeIterator();
-Standard_EXPORT SALOMEDSImpl_ChildNodeIterator(const Handle(SALOMEDSImpl_AttributeTreeNode)& aTreeNode,
- const Standard_Boolean allLevels = Standard_False);
-Standard_EXPORT void Initialize(const Handle(SALOMEDSImpl_AttributeTreeNode)& aTreeNode,
- const Standard_Boolean allLevels = Standard_False) ;
-Standard_EXPORT Standard_Boolean More() const { return !myNode.IsNull(); }
+Standard_EXPORT SALOMEDSImpl_ChildNodeIterator(const SALOMEDSImpl_AttributeTreeNode* aTreeNode,
+ const bool allLevels = false);
+Standard_EXPORT void Initialize(const SALOMEDSImpl_AttributeTreeNode* aTreeNode,
+ const bool allLevels = false) ;
+Standard_EXPORT bool More() const { return (myNode); }
Standard_EXPORT void Next() ;
Standard_EXPORT void NextBrother() ;
-Standard_EXPORT Handle_SALOMEDSImpl_AttributeTreeNode Value() const { return myNode; }
+Standard_EXPORT SALOMEDSImpl_AttributeTreeNode* Value() const { return myNode; }
private:
-Handle_SALOMEDSImpl_AttributeTreeNode myNode;
-Standard_Integer myFirstLevel;
+SALOMEDSImpl_AttributeTreeNode* myNode;
+int myFirstLevel;
};
#ifndef __SALOMEDSIMPL_DRIVER_H__
#define __SALOMEDSIMPL_DRIVER_H__
-#include <TCollection_AsciiString.hxx>
+#include <string>
#include <SALOMEDSImpl_SComponent.hxx>
#include <SALOMEDSImpl_SObject.hxx>
#include <SALOMEDSImpl_TMPFile.hxx>
{
public:
- virtual TCollection_AsciiString GetIOR() = 0;
+ virtual std::string GetIOR() = 0;
- virtual Handle(SALOMEDSImpl_TMPFile) Save(const Handle(SALOMEDSImpl_SComponent)& theComponent,
- const TCollection_AsciiString& theURL,
- long& theStreamLength,
- bool isMultiFile) = 0;
+ virtual SALOMEDSImpl_TMPFile* Save(const SALOMEDSImpl_SComponent& theComponent,
+ const std::string& theURL,
+ long& theStreamLength,
+ bool isMultiFile) = 0;
- virtual Handle(SALOMEDSImpl_TMPFile) SaveASCII(const Handle(SALOMEDSImpl_SComponent)& theComponent,
- const TCollection_AsciiString& theURL,
- long& theStreamLength,
- bool isMultiFile) = 0;
+ virtual SALOMEDSImpl_TMPFile* SaveASCII(const SALOMEDSImpl_SComponent& theComponent,
+ const std::string& theURL,
+ long& theStreamLength,
+ bool isMultiFile) = 0;
- virtual bool Load(const Handle(SALOMEDSImpl_SComponent)& theComponent,
+ virtual bool Load(const SALOMEDSImpl_SComponent& theComponent,
const unsigned char* theStream,
const long theStreamLength,
- const TCollection_AsciiString& theURL,
+ const std::string& theURL,
bool isMultiFile) = 0;
- virtual bool LoadASCII(const Handle(SALOMEDSImpl_SComponent)& theComponent,
+ virtual bool LoadASCII(const SALOMEDSImpl_SComponent& theComponent,
const unsigned char* theStream,
const long theStreamLength,
- const TCollection_AsciiString& theURL,
+ const std::string& theURL,
bool isMultiFile) = 0;
- virtual void Close(const Handle(SALOMEDSImpl_SComponent)& theComponent) = 0;
+ virtual void Close(const SALOMEDSImpl_SComponent& theComponent) = 0;
- virtual TCollection_AsciiString ComponentDataType() = 0;
+ virtual std::string ComponentDataType() = 0;
- virtual TCollection_AsciiString IORToLocalPersistentID(const Handle(SALOMEDSImpl_SObject)& theSObject,
- const TCollection_AsciiString& IORString,
+ virtual std::string IORToLocalPersistentID(const SALOMEDSImpl_SObject& theSObject,
+ const std::string& IORString,
bool isMultiFile,
bool isASCII) = 0;
- virtual TCollection_AsciiString LocalPersistentIDToIOR(const Handle(SALOMEDSImpl_SObject)& theSObject,
- const TCollection_AsciiString& aLocalPersistentID,
+ virtual std::string LocalPersistentIDToIOR(const SALOMEDSImpl_SObject& theSObject,
+ const std::string& aLocalPersistentID,
bool isMultiFile,
bool isASCII) = 0;
- virtual bool CanCopy(const Handle(SALOMEDSImpl_SObject)& theObject) = 0;
+ virtual bool CanCopy(const SALOMEDSImpl_SObject& theObject) = 0;
- virtual Handle(SALOMEDSImpl_TMPFile) CopyFrom(const Handle(SALOMEDSImpl_SObject)& theObject,
- int& theObjectID,
- long& theStreamLength) = 0;
+ virtual SALOMEDSImpl_TMPFile* CopyFrom(const SALOMEDSImpl_SObject& theObject,
+ int& theObjectID,
+ long& theStreamLength) = 0;
- virtual bool CanPaste(const TCollection_AsciiString& theComponentName, int theObjectID) = 0;
+ virtual bool CanPaste(const std::string& theComponentName, int theObjectID) = 0;
- virtual TCollection_AsciiString PasteInto(const unsigned char* theStream,
+ virtual std::string PasteInto(const unsigned char* theStream,
const long theStreamLength,
int theObjectID,
- const Handle(SALOMEDSImpl_SObject)& theObject) = 0;
+ const SALOMEDSImpl_SObject& theObject) = 0;
- virtual Handle(SALOMEDSImpl_TMPFile) DumpPython(const Handle(SALOMEDSImpl_Study)& theStudy,
- bool isPublished,
- bool& isValidScript,
- long& theStreamLength) = 0;
+ virtual SALOMEDSImpl_TMPFile* DumpPython(SALOMEDSImpl_Study* theStudy,
+ bool isPublished,
+ bool& isValidScript,
+ long& theStreamLength) = 0;
};
class SALOMEDSImpl_DriverFactory
{
public:
- virtual SALOMEDSImpl_Driver* GetDriverByType(const TCollection_AsciiString& theComponentType) = 0;
+ virtual SALOMEDSImpl_Driver* GetDriverByType(const std::string& theComponentType) = 0;
- virtual SALOMEDSImpl_Driver* GetDriverByIOR(const TCollection_AsciiString& theIOR) = 0;
+ virtual SALOMEDSImpl_Driver* GetDriverByIOR(const std::string& theIOR) = 0;
};
#endif
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_GenericAttribute, TDF_Attribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_GenericAttribute, TDF_Attribute )
-
-char* SALOMEDSImpl_GenericAttribute::Impl_GetType(const Handle(TDF_Attribute)& theAttr)
+char* SALOMEDSImpl_GenericAttribute::Impl_GetType(DF_Attribute* theAttr)
{
- Handle(SALOMEDSImpl_GenericAttribute) ga = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(theAttr);
- return ga->Type().ToCString();
+ SALOMEDSImpl_GenericAttribute* ga = dynamic_cast<SALOMEDSImpl_GenericAttribute*>(theAttr);
+ return (char*)ga->Type().c_str();
}
-char* SALOMEDSImpl_GenericAttribute::Impl_GetClassType(const Handle(TDF_Attribute)& theAttr)
+char* SALOMEDSImpl_GenericAttribute::Impl_GetClassType(DF_Attribute* theAttr)
{
- Handle(SALOMEDSImpl_GenericAttribute) ga = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(theAttr);
- return ga->GetClassType().ToCString();
+ SALOMEDSImpl_GenericAttribute* ga = dynamic_cast<SALOMEDSImpl_GenericAttribute*>(theAttr);
+ return (char*)ga->GetClassType().c_str();
}
-void SALOMEDSImpl_GenericAttribute::Impl_CheckLocked(const Handle(TDF_Attribute)& theAttr)
+void SALOMEDSImpl_GenericAttribute::Impl_CheckLocked(DF_Attribute* theAttr)
{
- Handle(SALOMEDSImpl_GenericAttribute) ga = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(theAttr);
+ SALOMEDSImpl_GenericAttribute* ga = dynamic_cast<SALOMEDSImpl_GenericAttribute*>(theAttr);
ga->CheckLocked();
}
-TCollection_AsciiString SALOMEDSImpl_GenericAttribute::Type()
+string SALOMEDSImpl_GenericAttribute::Type()
{
return _type;
}
void SALOMEDSImpl_GenericAttribute::CheckLocked()
{
- TDF_Label aLabel = Label();
+ DF_Label aLabel = Label();
if(aLabel.IsNull()) return;
- Handle(SALOMEDSImpl_Study) aStudy = SALOMEDSImpl_Study::GetStudy(aLabel);
- if(aStudy.IsNull() || aStudy->NewBuilder()->HasOpenCommand()) return;
+ SALOMEDSImpl_Study* aStudy = SALOMEDSImpl_Study::GetStudy(aLabel);
+ if(!aStudy) return;
if(aStudy->IsLocked()) {
aStudy->_errorCode = "LockProtection";
throw LockProtection("LockProtection");
}
}
-Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_GenericAttribute::GetSObject()
+SALOMEDSImpl_SObject SALOMEDSImpl_GenericAttribute::GetSObject()
{
- TDF_Label aLabel = Label();
- if(aLabel.IsNull()) return NULL;
+ SALOMEDSImpl_SObject so;
+ DF_Label aLabel = Label();
+ if(aLabel.IsNull()) return so;
return SALOMEDSImpl_Study::SObject(aLabel);
}
void SALOMEDSImpl_GenericAttribute::SetModifyFlag()
{
- TDF_Label aLabel = Label();
+ DF_Label aLabel = Label();
if(aLabel.IsNull()) return;
- Handle(SALOMEDSImpl_Study) aStudy = SALOMEDSImpl_Study::GetStudy(aLabel);
- if(!aStudy.IsNull()) aStudy->Modify();
+ SALOMEDSImpl_Study* aStudy = SALOMEDSImpl_Study::GetStudy(aLabel);
+ if(aStudy) aStudy->Modify();
}
#ifndef _GENERICIMPL_ATTRIBUTE_HXX_
#define _GENERICIMPL_ATTRIBUTE_HXX_
-#include <TDF_Label.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <Standard_GUID.hxx>
+#include "DF_Label.hxx"
+#include "DF_Attribute.hxx"
+#include <string>
#include "SALOMEDSImpl_SObject.hxx"
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_GenericAttribute, TDF_Attribute )
-
-class SALOMEDSImpl_GenericAttribute: public TDF_Attribute
+class SALOMEDSImpl_GenericAttribute: public DF_Attribute
{
protected:
- TCollection_AsciiString _type; //This field must be filled in each attribute that inherits from this class.
+ std::string _type; //This field must be filled in each attribute that inherits from this class.
public:
-Standard_EXPORT SALOMEDSImpl_GenericAttribute(const TCollection_AsciiString& theType)
+Standard_EXPORT SALOMEDSImpl_GenericAttribute(const std::string& theType)
:_type(theType)
{}
-Standard_EXPORT virtual TCollection_AsciiString Save() { return ""; }
-Standard_EXPORT virtual void Load(const TCollection_AsciiString&) {}
-Standard_EXPORT virtual TCollection_AsciiString Type();
+Standard_EXPORT virtual std::string Type();
Standard_EXPORT virtual void CheckLocked();
-Standard_EXPORT TCollection_AsciiString GetClassType() { return _type; }
-Standard_EXPORT Handle(SALOMEDSImpl_SObject) GetSObject();
+Standard_EXPORT std::string GetClassType() { return _type; }
+Standard_EXPORT SALOMEDSImpl_SObject GetSObject();
Standard_EXPORT void SetModifyFlag();
-Standard_EXPORT static char* Impl_GetType(const Handle(TDF_Attribute)& theAttr);
-Standard_EXPORT static char* Impl_GetClassType(const Handle(TDF_Attribute)& theAttr);
-Standard_EXPORT static void Impl_CheckLocked(const Handle(TDF_Attribute)& theAttr);
-
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_GenericAttribute )
+Standard_EXPORT static char* Impl_GetType(DF_Attribute* theAttr);
+Standard_EXPORT static char* Impl_GetClassType(DF_Attribute* theAttr);
+Standard_EXPORT static void Impl_CheckLocked(DF_Attribute* theAttr);
};
#include "SALOMEDSImpl_IParameters.hxx"
#include <utilities.h>
-#include <TCollection_AsciiString.hxx>
-
#include "SALOMEDSImpl_SObject.hxx"
#include "SALOMEDSImpl_ChildIterator.hxx"
/*!
Constructor
*/
-SALOMEDSImpl_IParameters::SALOMEDSImpl_IParameters(const Handle(SALOMEDSImpl_AttributeParameter)& ap)
+SALOMEDSImpl_IParameters::SALOMEDSImpl_IParameters(SALOMEDSImpl_AttributeParameter* ap)
{
- if(ap.IsNull()) return;
+ if(!ap) return;
_ap = ap;
- Handle(SALOMEDSImpl_SObject) so = _ap->GetSObject();
- _study = so->GetStudy();
+ SALOMEDSImpl_SObject so = _ap->GetSObject();
+ _study = so.GetStudy();
}
SALOMEDSImpl_IParameters::~SALOMEDSImpl_IParameters()
int SALOMEDSImpl_IParameters::append(const string& listName, const string& value)
{
- if(_ap.IsNull()) return -1;
+ if(!_ap) return -1;
vector<string> v;
if(!_ap->IsSet(listName, PT_STRARRAY)) {
if(!_ap->IsSet(_AP_LISTS_LIST_, PT_STRARRAY)) _ap->SetStrArray(_AP_LISTS_LIST_, v);
int SALOMEDSImpl_IParameters::nbValues(const string& listName)
{
- if(_ap.IsNull()) return -1;
+ if(!_ap) return -1;
if(!_ap->IsSet(listName, PT_STRARRAY)) return 0;
vector<string> v = _ap->GetStrArray(listName);
return v.size();
vector<string> SALOMEDSImpl_IParameters::getValues(const string& listName)
{
vector<string> v;
- if(_ap.IsNull()) return v;
+ if(!_ap) return v;
if(!_ap->IsSet(listName, PT_STRARRAY)) return v;
return _ap->GetStrArray(listName);
}
string SALOMEDSImpl_IParameters::getValue(const string& listName, int index)
{
- if(_ap.IsNull()) return "";
+ if(!_ap) return "";
if(!_ap->IsSet(listName, PT_STRARRAY)) return "";
vector<string> v = _ap->GetStrArray(listName);
if(index >= v.size()) return "";
void SALOMEDSImpl_IParameters::setParameter(const string& entry, const string& parameterName, const string& value)
{
- if(_ap.IsNull()) return;
+ if(!_ap) return;
vector<string> v;
if(!_ap->IsSet(entry, PT_STRARRAY)) {
append(_AP_ENTRIES_LIST_, entry); //Add the entry to the internal list of entries
string SALOMEDSImpl_IParameters::getParameter(const string& entry, const string& parameterName)
{
- if(_ap.IsNull()) return "";
+ if(!_ap) return "";
if(!_ap->IsSet(entry, PT_STRARRAY)) return "";
vector<string> v = _ap->GetStrArray(entry);
int length = v.size();
vector<string> SALOMEDSImpl_IParameters::getAllParameterNames(const string& entry)
{
vector<string> v, names;
- if(_ap.IsNull()) return v;
+ if(!_ap) return v;
if(!_ap->IsSet(entry, PT_STRARRAY)) return v;
v = _ap->GetStrArray(entry);
int length = v.size();
vector<string> SALOMEDSImpl_IParameters::getAllParameterValues(const string& entry)
{
vector<string> v, values;
- if(_ap.IsNull()) return v;
+ if(!_ap) return v;
if(!_ap->IsSet(entry, PT_STRARRAY)) return v;
v = _ap->GetStrArray(entry);
int length = v.size();
int SALOMEDSImpl_IParameters::getNbParameters(const string& entry)
{
- if(_ap.IsNull()) return -1;
+ if(!_ap) return -1;
if(!_ap->IsSet(entry, PT_STRARRAY)) return -1;
return _ap->GetStrArray(entry).size()/2;
}
vector<string> SALOMEDSImpl_IParameters::getEntries()
{
vector<string> v;
- if(_ap.IsNull()) return v;
+ if(!_ap) return v;
if(!_ap->IsSet(_AP_ENTRIES_LIST_, PT_STRARRAY)) return v;
return _ap->GetStrArray(_AP_ENTRIES_LIST_);
}
void SALOMEDSImpl_IParameters::setProperty(const string& name, const std::string& value)
{
- if(_ap.IsNull()) return;
+ if(!_ap) return;
if(!_ap->IsSet(name, PT_STRING)) {
append(_AP_PROPERTIES_LIST_, name); //Add the property to the internal list of properties
}
string SALOMEDSImpl_IParameters::getProperty(const string& name)
{
- if(_ap.IsNull()) return "";
+ if(!_ap) return "";
if(!_ap->IsSet(name, PT_STRING)) return "";
return _ap->GetString(name);
}
vector<string> SALOMEDSImpl_IParameters::getProperties()
{
vector<string> v;
- if(_ap.IsNull()) return v;
+ if(!_ap) return v;
if(!_ap->IsSet(_AP_PROPERTIES_LIST_, PT_STRARRAY)) return v;
return _ap->GetStrArray(_AP_PROPERTIES_LIST_);
}
{
if(!_study) return entry;
int pos = entry.rfind("_");
- if(pos < 0 || pos >= entry.length()) return entry;
+ if(pos < 0 || pos >= entry.size()) return entry;
string compName(entry, 0, pos), compID, tail(entry, pos+1, entry.length()-1);
if(_compNames.find(compName) == _compNames.end()) {
- Handle(SALOMEDSImpl_SObject) so = _study->FindComponent((char*)compName.c_str());
- if(so.IsNull()) return entry;
- compID = so->GetID().ToCString();
+ SALOMEDSImpl_SObject so = _study->FindComponent(compName);
+ if(!so) return entry;
+ compID = so.GetID();
_compNames[compName] = compID;
}
else compID = _compNames[compName];
}
-bool SALOMEDSImpl_IParameters::isDumpPython(const Handle(SALOMEDSImpl_Study)& study, const string& theID)
+bool SALOMEDSImpl_IParameters::isDumpPython(SALOMEDSImpl_Study* study, const string& theID)
{
string anID;
if(theID == "") anID = getDefaultVisualComponent();
else anID = theID;
- Handle(SALOMEDSImpl_AttributeParameter) ap = study->GetCommonParameters((char*)anID.c_str(), 0);
- if(ap.IsNull()) return false;
+ SALOMEDSImpl_AttributeParameter* ap = study->GetCommonParameters((char*)anID.c_str(), 0);
+ if(!ap) return false;
if(!ap->IsSet(_AP_DUMP_PYTHON_, PT_BOOLEAN)) return false;
return (bool)ap->GetBool(_AP_DUMP_PYTHON_);
}
-int SALOMEDSImpl_IParameters::getLastSavePoint(const Handle(SALOMEDSImpl_Study)& study, const string& theID)
+int SALOMEDSImpl_IParameters::getLastSavePoint(SALOMEDSImpl_Study* study, const string& theID)
{
string anID;
if(theID == "") anID = getDefaultVisualComponent();
else anID = theID;
- Handle(SALOMEDSImpl_SObject) so = study->FindComponent((char*)anID.c_str());
- if(so.IsNull()) return -1;
+ SALOMEDSImpl_SObject so = study->FindComponent(anID);
+ if(!so) return -1;
- Handle(SALOMEDSImpl_StudyBuilder) builder = study->NewBuilder();
- Handle(SALOMEDSImpl_ChildIterator) anIter ( study->NewChildIterator( so ) );
+ SALOMEDSImpl_StudyBuilder* builder = study->NewBuilder();
+ SALOMEDSImpl_ChildIterator anIter = study->NewChildIterator( so );
int tag = -1;
- for(; anIter->More(); anIter->Next())
+ for(; anIter.More(); anIter.Next())
{
- Handle(SALOMEDSImpl_SObject) val( anIter->Value() );
- Handle(SALOMEDSImpl_GenericAttribute) genAttr;
- if(builder->FindAttribute(val, genAttr, "AttributeParameter")) tag = val->Tag();
+ SALOMEDSImpl_SObject val( anIter.Value() );
+ DF_Attribute* genAttr;
+ if(builder->FindAttribute(val, genAttr, "AttributeParameter")) tag = val.Tag();
}
return tag;
-string SALOMEDSImpl_IParameters::getStudyScript(const Handle(SALOMEDSImpl_Study)& study, int savePoint, const std::string& theID)
+string SALOMEDSImpl_IParameters::getStudyScript(SALOMEDSImpl_Study* study, int savePoint, const std::string& theID)
{
string anID;
if(theID == "") anID = getDefaultVisualComponent();
else anID = theID;
- Handle(SALOMEDSImpl_AttributeParameter) ap = study->GetCommonParameters((char*)anID.c_str(), savePoint);
+ SALOMEDSImpl_AttributeParameter* ap = study->GetCommonParameters((char*)anID.c_str(), savePoint);
SALOMEDSImpl_IParameters ip(ap);
string dump("");
return dump;
}
-string SALOMEDSImpl_IParameters::getDefaultScript(const Handle(SALOMEDSImpl_Study)& study,
- const string& moduleName,
- const string& shift,
- const string& theID)
+string SALOMEDSImpl_IParameters::getDefaultScript(SALOMEDSImpl_Study* study,
+ const string& moduleName,
+ const string& shift,
+ const string& theID)
{
string anID;
if(theID == "") anID = getDefaultVisualComponent();
SALOMEDSImpl_IParameters ip = SALOMEDSImpl_IParameters(study->GetCommonParameters(anID.c_str(), savePoint));
if(!isDumpPython(study)) return dump;
- Handle(SALOMEDSImpl_AttributeParameter) ap = study->GetModuleParameters(anID.c_str(), moduleName.c_str(), savePoint);
+ SALOMEDSImpl_AttributeParameter* ap = study->GetModuleParameters(anID.c_str(), moduleName.c_str(), savePoint);
ip = SALOMEDSImpl_IParameters(ap);
vector<string> names = ip.getAllParameterNames(v[i]);
vector<string> values = ip.getAllParameterValues(v[i]);
string decodedEntry = ip.decodeEntry(v[i]);
- Handle(SALOMEDSImpl_SObject) so = study->FindObjectID((char*)decodedEntry.c_str());
+ SALOMEDSImpl_SObject so = study->FindObjectID(decodedEntry);
string so_name("");
- if(!so.IsNull()) so_name = so->GetName().ToCString();
+ if(so) so_name = so.GetName();
dump += shift + "# set up entry " + v[i] +" ("+so_name+")" + " parameters" + "\n";
for(int j = 0; j < names.size() && j < values.size(); j++)
dump += shift + "ipar.setParameter(\"" + v[i] + "\", \"" + names[j] + "\", \"" + values[j] + "\")\n";
class Standard_EXPORT SALOMEDSImpl_IParameters
{
public:
- SALOMEDSImpl_IParameters(const Handle(SALOMEDSImpl_AttributeParameter)& ap);
+ SALOMEDSImpl_IParameters(SALOMEDSImpl_AttributeParameter* ap);
virtual ~SALOMEDSImpl_IParameters();
/*!
Returns whether there is the dumping visual parameters
*/
- static bool isDumpPython(const Handle(SALOMEDSImpl_Study)& study, const string& theID = "");
+ static bool isDumpPython(SALOMEDSImpl_Study* study, const std::string& theID = "");
/*!
Returns an ID of the last save point
*/
- static int getLastSavePoint(const Handle(SALOMEDSImpl_Study)& study, const std::string& theID = "");
+ static int getLastSavePoint(SALOMEDSImpl_Study* study, const std::string& theID = "");
/*!
Returns a Python script for the study, which sets up visual parameters
*/
- static std::string getStudyScript(const Handle(SALOMEDSImpl_Study)& study, int savePoint, const std::string& theID = "");
+ static std::string getStudyScript(SALOMEDSImpl_Study* study, int savePoint, const std::string& theID = "");
/*!
Returns a default Python script that set ups visual parameters for the given module
shift is a string that contain spaces to make valid Python script indentaion
*/
- static std::string getDefaultScript(const Handle(SALOMEDSImpl_Study)& study,
+ static std::string getDefaultScript(SALOMEDSImpl_Study* study,
const std::string& moduleName,
const std::string& shift,
const std::string& theID = "");
static std::string getDefaultVisualComponent();
private:
- Handle(SALOMEDSImpl_AttributeParameter) _ap;
- Handle(SALOMEDSImpl_Study) _study;
+ SALOMEDSImpl_AttributeParameter* _ap;
+ SALOMEDSImpl_Study* _study;
std::map<std::string, std::string> _compNames;
};
+++ /dev/null
-// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// File : SALOMEDSImpl_OCAFApplication.cxx
-// Author : Sergey RUIN
-// Module : SALOME
-
-#include "SALOMEDSImpl_OCAFApplication.hxx"
-
-using namespace std;
-
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_OCAFApplication, TDocStd_Application )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_OCAFApplication, TDocStd_Application )
-
-//=======================================================================
-//function : SALOMEDSImpl_OCAFApplication
-//purpose :
-//=======================================================================
-
-SALOMEDSImpl_OCAFApplication::SALOMEDSImpl_OCAFApplication()
-{
-}
-
-
-//=======================================================================
-//function : Formats
-//purpose :
-//=======================================================================
-
-void SALOMEDSImpl_OCAFApplication::Formats(TColStd_SequenceOfExtendedString& Formats)
-{
- Formats.Append(TCollection_ExtendedString ("SALOME_STUDY"));
-}
-
-
-//=======================================================================
-//function : ResourcesName
-//purpose :
-//=======================================================================
-
-Standard_CString SALOMEDSImpl_OCAFApplication::ResourcesName()
-{
- return Standard_CString ("SALOMEDSImpl_Resources");
-}
-
-
-
-
-
+++ /dev/null
-// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// File : SALOMEDSImpl_OCAFApplication.hxx
-// Author : Sergey RUIN
-// Module : SALOME
-
-#ifndef _SALOMEDSImpl_OCAFApplication_HeaderFile
-#define _SALOMEDSImpl_OCAFApplication_HeaderFile
-
-
-//Handle definition
-#include <TDocStd_Application.hxx>
-#include <Standard_DefineHandle.hxx>
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_OCAFApplication, TDocStd_Application)
-
-#include <Standard_CString.hxx>
-#include <TColStd_SequenceOfExtendedString.hxx>
-
-
-class SALOMEDSImpl_OCAFApplication : public TDocStd_Application {
-
-public:
-
-Standard_EXPORT SALOMEDSImpl_OCAFApplication();
-Standard_EXPORT virtual void Formats(TColStd_SequenceOfExtendedString& Formats) ;
-Standard_EXPORT Standard_CString ResourcesName() ;
-Standard_EXPORT ~SALOMEDSImpl_OCAFApplication() {}
-
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_OCAFApplication )
-
-};
-
-#endif
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_SComponent, SALOMEDSImpl_SObject )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_SComponent, SALOMEDSImpl_SObject )
+//============================================================================
+/*! Function : Empty constructor
+ * Purpose :
+ */
+//============================================================================
+SALOMEDSImpl_SComponent::SALOMEDSImpl_SComponent()
+{
+}
+
+//============================================================================
+/*! Function : Copy constructor
+ * Purpose :
+ */
+//============================================================================
+SALOMEDSImpl_SComponent::SALOMEDSImpl_SComponent(const SALOMEDSImpl_SComponent& theSCO)
+{
+ _lab = theSCO._lab;
+ _value = theSCO._value;
+ _type = theSCO._type;
+ _name = theSCO._name;
+}
//============================================================================
/*! Function : constructor
* Purpose :
*/
//============================================================================
-SALOMEDSImpl_SComponent::SALOMEDSImpl_SComponent(const TDF_Label& theLabel)
+SALOMEDSImpl_SComponent::SALOMEDSImpl_SComponent(const DF_Label& theLabel)
:SALOMEDSImpl_SObject(theLabel)
{
}
*/
//============================================================================
SALOMEDSImpl_SComponent::~SALOMEDSImpl_SComponent()
-{}
+{
+}
//============================================================================
* Purpose :
*/
//============================================================================
-TCollection_AsciiString SALOMEDSImpl_SComponent::ComponentDataType()
+string SALOMEDSImpl_SComponent::ComponentDataType()
{
- TCollection_AsciiString res = "";
- Handle(SALOMEDSImpl_AttributeComment) type;
- if ( _lab.FindAttribute(SALOMEDSImpl_AttributeComment::GetID(),type) ) {
+ string res = "";
+ SALOMEDSImpl_AttributeComment* type;
+ if ( (type = (SALOMEDSImpl_AttributeComment*)_lab.FindAttribute(SALOMEDSImpl_AttributeComment::GetID())) ) {
res = type->Value();
}
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_SComponent::ComponentIOR(TCollection_AsciiString& IOR)
+bool SALOMEDSImpl_SComponent::ComponentIOR(string& IOR)
{
- Handle(SALOMEDSImpl_AttributeIOR) ior;
- if (!_lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(),ior) )
+ SALOMEDSImpl_AttributeIOR* ior;
+ if (!(ior = (SALOMEDSImpl_AttributeIOR*)_lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID())) )
return false;
IOR = ior->Value();
return true;
}
-
+
//============================================================================
/*! Function : IsA
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_SComponent::IsA(const TDF_Label& theLabel)
+bool SALOMEDSImpl_SComponent::IsA(const DF_Label& theLabel)
{
// scomponent must contain comment and belong to the 2th depth label
if ( theLabel.IsAttribute(SALOMEDSImpl_AttributeComment::GetID()) && theLabel.Depth() == 2) {
}
return false;
}
+
+//============================================================================
+/*! Function : GetPersistentCopy
+ * Purpose :
+ */
+//============================================================================
+SALOMEDSImpl_SComponent* SALOMEDSImpl_SComponent::GetPersistentCopy() const
+{
+ SALOMEDSImpl_SComponent* sco = new SALOMEDSImpl_SComponent;
+ sco->_lab = _lab;
+ sco->_name = _name;
+ sco->_type = _type;
+ sco->_value = _value;
+ return sco;
+}
//SALOMEDSImpl headers
#include "SALOMEDSImpl_SObject.hxx"
-//Handle definition
-#include <Standard_DefineHandle.hxx>
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_SComponent, SALOMEDSImpl_SObject )
-
// std C++ headers
#include <iostream>
+#include <string>
// Cascade headers
-#include <TDF_Label.hxx>
-#include <SALOMEDSImpl_SObject.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TDF_Tool.hxx>
+#include "DF_Label.hxx"
+#include "SALOMEDSImpl_SObject.hxx"
#include <stdio.h>
-class SALOMEDSImpl_SComponent : public SALOMEDSImpl_SObject
+class SALOMEDSImpl_SComponent : public virtual SALOMEDSImpl_SObject
{
public:
- SALOMEDSImpl_SComponent(const TDF_Label& lab);
+ Standard_EXPORT SALOMEDSImpl_SComponent();
+ Standard_EXPORT SALOMEDSImpl_SComponent(const SALOMEDSImpl_SComponent& theSCO);
+ Standard_EXPORT SALOMEDSImpl_SComponent(const DF_Label& lab);
- ~SALOMEDSImpl_SComponent();
+ Standard_EXPORT ~SALOMEDSImpl_SComponent();
- virtual TCollection_AsciiString ComponentDataType();
- virtual bool ComponentIOR(TCollection_AsciiString& theID);
- static bool IsA(const TDF_Label& theLabel);
+ Standard_EXPORT virtual std::string ComponentDataType();
+ Standard_EXPORT virtual bool ComponentIOR(std::string& theID);
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_SComponent )
+ Standard_EXPORT static bool IsA(const DF_Label& theLabel);
+
+ Standard_EXPORT SALOMEDSImpl_SComponent* GetPersistentCopy() const;
};
#endif
*/
//============================================================================
-SALOMEDSImpl_SComponentIterator::SALOMEDSImpl_SComponentIterator(const Handle(TDocStd_Document)& theDocument)
+SALOMEDSImpl_SComponentIterator::SALOMEDSImpl_SComponentIterator(DF_Document* theDocument)
{
_lab = theDocument->Main();
- _it.Initialize (_lab);
+ _it.Init (_lab);
}
//============================================================================
//============================================================================
void SALOMEDSImpl_SComponentIterator::Init()
{
- _it.Initialize (_lab);
+ _it.Init (_lab);
}
//============================================================================
{
if (!_it.More())
return false;
- TDF_Label L = _it.Value();
- if (SALOMEDSImpl_SComponent::IsA(L))
- return true;
-
- return _it.More();
+ DF_Label L = _it.Value();
+ return SALOMEDSImpl_SComponent::IsA(L);
}
- //============================================================================
+//============================================================================
/*! Function : Next
*/
//============================================================================
*
*/
//============================================================================
-Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_SComponentIterator::Value()
+SALOMEDSImpl_SComponent SALOMEDSImpl_SComponentIterator::Value()
{
return SALOMEDSImpl_Study::SComponent(_it.Value());
}
+//============================================================================
+/*! Function : GetPersistentCopy
+ */
+//============================================================================
+SALOMEDSImpl_SComponentIterator* SALOMEDSImpl_SComponentIterator::GetPersistentCopy() const
+{
+ SALOMEDSImpl_SComponentIterator* itr = new SALOMEDSImpl_SComponentIterator();
+ itr->_lab = _lab;
+ itr->_it = _it;
+
+ return itr;
+}
#include "SALOMEDSImpl_SComponent.hxx"
// Cascade headers
-#include <TDocStd_Document.hxx>
-#include <TDF_ChildIterator.hxx>
-#include <TDF_Label.hxx>
+#include "DF_ChildIterator.hxx"
+#include "DF_Label.hxx"
+#include "DF_Document.hxx"
#include <stdio.h>
class Standard_EXPORT SALOMEDSImpl_SComponentIterator
{
private:
- TDF_ChildIterator _it;
- TDF_Label _lab;
+ DF_ChildIterator _it;
+ DF_Label _lab;
public:
SALOMEDSImpl_SComponentIterator() {};
- SALOMEDSImpl_SComponentIterator(const Handle(TDocStd_Document)& theDocument);
+ SALOMEDSImpl_SComponentIterator(DF_Document* theDocument);
~SALOMEDSImpl_SComponentIterator() {};
virtual void Init();
virtual bool More();
virtual void Next();
- virtual Handle(SALOMEDSImpl_SComponent) Value();
+ virtual SALOMEDSImpl_SComponent Value();
+
+ SALOMEDSImpl_SComponentIterator* GetPersistentCopy() const;
};
#endif
using namespace std;
-#include <TDF_AttributeIterator.hxx>
#include <map>
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_SObject, MMgt_TShared )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_SObject, MMgt_TShared )
+//============================================================================
+/*! Function : empty constructor
+ * Purpose :
+ */
+//============================================================================
+SALOMEDSImpl_SObject::SALOMEDSImpl_SObject()
+{
+}
+
+//============================================================================
+/*! Function : copy constructor
+ * Purpose :
+ */
+//============================================================================
+SALOMEDSImpl_SObject::SALOMEDSImpl_SObject(const SALOMEDSImpl_SObject& theSObject)
+{
+ _lab = theSObject._lab;
+ _value = theSObject._value;
+ _type = theSObject._type;
+ _name = theSObject._name;
+
+}
+
//============================================================================
/*! Function : constructor
* Purpose :
*/
//============================================================================
-SALOMEDSImpl_SObject::SALOMEDSImpl_SObject(const TDF_Label& theLabel)
+SALOMEDSImpl_SObject::SALOMEDSImpl_SObject(const DF_Label& theLabel)
:_lab(theLabel)
{
_value = "";
*/
//============================================================================
SALOMEDSImpl_SObject::~SALOMEDSImpl_SObject()
-{}
+{
+}
//============================================================================
/*! Function : GetID
* Purpose :
*/
//============================================================================
-TCollection_AsciiString SALOMEDSImpl_SObject::GetID()
+string SALOMEDSImpl_SObject::GetID() const
{
- TCollection_AsciiString anEntry;
- TDF_Tool::Entry (_lab,anEntry);
- return anEntry;
+ return _lab.Entry();
}
//============================================================================
* Purpose :
*/
//============================================================================
-Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_SObject::GetFatherComponent()
+SALOMEDSImpl_SComponent SALOMEDSImpl_SObject::GetFatherComponent() const
{
- TDF_Label LF = _lab;
+ SALOMEDSImpl_SComponent sco;
+ DF_Label LF = _lab;
while (!SALOMEDSImpl_SComponent::IsA(LF) && !LF.IsRoot()) {
LF = LF.Father();
}
- if(LF.IsRoot()) return NULL;
+ if(LF.IsRoot()) return sco;
return GetStudy()->GetSComponent(LF);
}
* Purpose :
*/
//============================================================================
-Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_SObject::GetFather()
+SALOMEDSImpl_SObject SALOMEDSImpl_SObject::GetFather() const
{
return GetStudy()->GetSObject(_lab.Father());
}
* Purpose :
*/
//============================================================================
-Handle(SALOMEDSImpl_Study) SALOMEDSImpl_SObject::GetStudy()
+SALOMEDSImpl_Study* SALOMEDSImpl_SObject::GetStudy() const
{
return SALOMEDSImpl_Study::GetStudy(_lab);
}
* Purpose : Find attribute of given type on this SObject
*/
//============================================================================
-bool SALOMEDSImpl_SObject::FindAttribute(Handle(TDF_Attribute)& theAttribute,
- const TCollection_AsciiString& theTypeOfAttribute)
+bool SALOMEDSImpl_SObject::FindAttribute(DF_Attribute*& theAttribute,
+ const string& theTypeOfAttribute) const
{
- if(_lab.IsNull()) return Standard_False;
- Standard_GUID aGUID = GetGUID(theTypeOfAttribute);
- if (_lab.FindAttribute(aGUID, theAttribute)) return Standard_True;
- return Standard_False;
+ if(_lab.IsNull()) return false;
+ std::string aGUID = GetGUID(theTypeOfAttribute);
+ if ((theAttribute = _lab.FindAttribute(aGUID))) return true;
+ return false;
}
* Purpose : Returns list of all attributes for this sobject
*/
//============================================================================
-Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_SObject::GetAllAttributes()
+vector<DF_Attribute*> SALOMEDSImpl_SObject::GetAllAttributes() const
{
- Standard_Integer NumAttr = _lab.NbAttributes();
- Handle(TColStd_HSequenceOfTransient) SeqOfAttr = new TColStd_HSequenceOfTransient();
- Handle(SALOMEDSImpl_GenericAttribute) anAttr;
- if (NumAttr != 0) {
- for(TDF_AttributeIterator iter(_lab);iter.More();iter.Next()) {
- anAttr = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(iter.Value());
- if(!anAttr.IsNull() && anAttr->Type() != "AttributeReference")
- SeqOfAttr->Append(anAttr);
- }
+ vector<DF_Attribute*> va1, va = _lab.GetAttributes();
+ for(int i = 0, len = va.size(); i<len; i++) {
+ SALOMEDSImpl_GenericAttribute* ga = dynamic_cast<SALOMEDSImpl_GenericAttribute*>(va[i]);
+ if(ga && ga->Type() != string("AttributeReference"))
+ va1.push_back(va[i]);
}
- return SeqOfAttr;
+
+ return va1;
}
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_SObject::ReferencedObject(Handle(SALOMEDSImpl_SObject)& theObject)
+bool SALOMEDSImpl_SObject::ReferencedObject(SALOMEDSImpl_SObject& theObject) const
{
- Handle(SALOMEDSImpl_AttributeReference) Ref;
- if (!_lab.FindAttribute(SALOMEDSImpl_AttributeReference::GetID(),Ref))
+ SALOMEDSImpl_AttributeReference* Ref;
+ if (!(Ref=(SALOMEDSImpl_AttributeReference*)_lab.FindAttribute(SALOMEDSImpl_AttributeReference::GetID())))
return false;
theObject = GetStudy()->GetSObject(Ref->Get());
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_SObject::FindSubObject(int theTag, Handle(SALOMEDSImpl_SObject)& theObject)
+bool SALOMEDSImpl_SObject::FindSubObject(int theTag, SALOMEDSImpl_SObject& theObject)
{
- TDF_Label L = _lab.FindChild(theTag, false);
+ DF_Label L = _lab.FindChild(theTag, false);
if (L.IsNull()) return false;
theObject = GetStudy()->GetSObject(L);
* Purpose :
*/
//============================================================================
-TCollection_AsciiString SALOMEDSImpl_SObject::GetName()
+string SALOMEDSImpl_SObject::GetName() const
{
- TCollection_AsciiString aStr = "";
- Handle(SALOMEDSImpl_AttributeName) aName;
- if (_lab.FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aName)) {
- aStr = aName->Value();
+ string aStr = "";
+ SALOMEDSImpl_AttributeName* aName;
+ if ((aName=(SALOMEDSImpl_AttributeName*)_lab.FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) {
+ aStr =aName->Value();
}
return aStr;
}
* Purpose :
*/
//============================================================================
-TCollection_AsciiString SALOMEDSImpl_SObject::GetComment()
+string SALOMEDSImpl_SObject::GetComment() const
{
- TCollection_AsciiString aStr = "";
- Handle(SALOMEDSImpl_AttributeComment) aComment;
- if (_lab.FindAttribute(SALOMEDSImpl_AttributeComment::GetID(), aComment)) {
+ string aStr = "";
+ SALOMEDSImpl_AttributeComment* aComment;
+ if ((aComment=(SALOMEDSImpl_AttributeComment*)_lab.FindAttribute(SALOMEDSImpl_AttributeComment::GetID()))) {
aStr = aComment->Value();
}
return aStr;
* Purpose :
*/
//============================================================================
-TCollection_AsciiString SALOMEDSImpl_SObject::GetIOR()
+string SALOMEDSImpl_SObject::GetIOR() const
{
- TCollection_AsciiString aStr = "";
- Handle(SALOMEDSImpl_AttributeIOR) anIOR;
- if (_lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(), anIOR)) {
- aStr = anIOR->Value();
+ string aStr = "";
+ SALOMEDSImpl_AttributeIOR* anIOR;
+ if ((anIOR=(SALOMEDSImpl_AttributeIOR*)_lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) {
+ aStr = dynamic_cast<SALOMEDSImpl_AttributeIOR*>(anIOR)->Value();
}
return aStr;
}
-Standard_GUID SALOMEDSImpl_SObject::GetGUID(const TCollection_AsciiString& theType)
+std::string SALOMEDSImpl_SObject::GetGUID(const string& theType)
{
__AttributeTypeToGUIDForSObject
- if (strncmp(theType.ToCString(), "AttributeTreeNodeGUID",21) == 0) {
- const char* aCType = theType.ToCString();
- char* aGUIDString = new char[40];
- sprintf(aGUIDString, &(aCType[21]));
- Standard_GUID aGUID = Standard_GUID(aGUIDString); // create tree node GUID by name
- delete(aGUIDString);
- return aGUID;
+ if (strncmp(theType.c_str(), "AttributeTreeNodeGUID",21) == 0) {
+ return theType.substr(21, theType.size());
}
- return Standard_GUID();
+ return "";
}
+//============================================================================
+/*! Function : SALOMEDSImpl_SComponent
+ * Purpose :
+ */
+//============================================================================
+SALOMEDSImpl_SObject::operator SALOMEDSImpl_SComponent() const
+{
+ SALOMEDSImpl_SComponent sco;
+ sco._lab = _lab;
+ sco._name = _name;
+ sco._type = _type;
+ sco._value = _value;
+ return sco;
+}
+
+//============================================================================
+/*! Function : GetPersistentCopy
+ * Purpose :
+ */
+//============================================================================
+SALOMEDSImpl_SObject* SALOMEDSImpl_SObject::GetPersistentCopy() const
+{
+ SALOMEDSImpl_SObject* so = new SALOMEDSImpl_SObject;
+ so->_lab = _lab;
+ so->_name = _name;
+ so->_type = _type;
+ so->_value = _value;
+ return so;
+}
+
+//============================================================================
+/*! Function : IsComponent
+ * Purpose :
+ */
+//============================================================================
+bool SALOMEDSImpl_SObject::IsComponent() const
+{
+ return SALOMEDSImpl_SComponent::IsA(_lab);
+}
#ifndef __SALOMEDSIMPL_SOBJECT_H__
#define __SALOMEDSIMPL_SOBJECT_H__
-//Handle definition
-#include <Handle_MMgt_TShared.hxx>
-#include <Standard_DefineHandle.hxx>
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_SObject, MMgt_TShared )
+#include "DF_Label.hxx"
+#include "DF_Attribute.hxx"
+#include <string>
+#include <vector>
class SALOMEDSImpl_SComponent;
-class Handle_SALOMEDSImpl_SComponent;
class SALOMEDSImpl_Study;
-class Handle_SALOMEDSImpl_Study;
-// Cascade headers
-#include <TDF_Label.hxx>
-#include <TDF_Tool.hxx>
-#include <TDF_Attribute.hxx>
-#include <Standard_GUID.hxx>
-#include <Standard_NoSuchObject.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TColStd_HSequenceOfTransient.hxx>
-
-class SALOMEDSImpl_SObject : public MMgt_TShared
+class SALOMEDSImpl_SObject
{
protected:
- TDF_Label _lab;
- TCollection_AsciiString _name;
- TCollection_AsciiString _value;
- TCollection_AsciiString _type;
+ DF_Label _lab;
+ std::string _name;
+ std::string _value;
+ std::string _type;
public:
- Standard_EXPORT SALOMEDSImpl_SObject(const TDF_Label& theLabel);
- Standard_EXPORT ~SALOMEDSImpl_SObject();
+ Standard_EXPORT SALOMEDSImpl_SObject();
+ Standard_EXPORT SALOMEDSImpl_SObject(const DF_Label& theLabel);
+ Standard_EXPORT SALOMEDSImpl_SObject(const SALOMEDSImpl_SObject& theSObject);
+ Standard_EXPORT virtual ~SALOMEDSImpl_SObject();
- Standard_EXPORT virtual TCollection_AsciiString GetID();
- Standard_EXPORT virtual Handle(SALOMEDSImpl_SComponent) GetFatherComponent();
- Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) GetFather() ;
- Standard_EXPORT virtual bool FindAttribute(Handle(TDF_Attribute)& theAttribute, const TCollection_AsciiString& theTypeOfAttribute);
- Standard_EXPORT virtual bool ReferencedObject(Handle(SALOMEDSImpl_SObject)& theObject) ;
- Standard_EXPORT virtual bool FindSubObject(int theTag, Handle(SALOMEDSImpl_SObject)& theObject);
+ Standard_EXPORT virtual std::string GetID() const;
+ Standard_EXPORT virtual SALOMEDSImpl_SComponent GetFatherComponent() const;
+ Standard_EXPORT virtual SALOMEDSImpl_SObject GetFather() const ;
+ Standard_EXPORT virtual bool FindAttribute(DF_Attribute*& theAttribute, const std::string& theTypeOfAttribute) const;
+ Standard_EXPORT virtual bool ReferencedObject(SALOMEDSImpl_SObject& theObject) const ;
+ Standard_EXPORT virtual bool FindSubObject(int theTag, SALOMEDSImpl_SObject& theObject);
- Standard_EXPORT virtual Handle(SALOMEDSImpl_Study) GetStudy() ;
- Standard_EXPORT virtual TCollection_AsciiString Name() { return _name; }
- Standard_EXPORT virtual void Name(const TCollection_AsciiString& theName) { _name = theName; }
- Standard_EXPORT virtual Handle(TColStd_HSequenceOfTransient) GetAllAttributes();
+ Standard_EXPORT virtual SALOMEDSImpl_Study* GetStudy() const;
+ Standard_EXPORT virtual std::string Name() const { return _name; }
+ Standard_EXPORT virtual void Name(const std::string& theName) { _name = theName; }
+ Standard_EXPORT virtual std::vector<DF_Attribute*> GetAllAttributes() const;
- Standard_EXPORT virtual TCollection_AsciiString GetName();
- Standard_EXPORT virtual TCollection_AsciiString GetComment();
- Standard_EXPORT virtual TCollection_AsciiString GetIOR();
+ Standard_EXPORT virtual std::string GetName() const ;
+ Standard_EXPORT virtual std::string GetComment() const;
+ Standard_EXPORT virtual std::string GetIOR() const;
- Standard_EXPORT virtual int Tag() { return _lab.Tag(); }
- Standard_EXPORT virtual int Depth() { return _lab.Depth(); }
+ Standard_EXPORT virtual int Tag() const { return _lab.Tag(); }
+ Standard_EXPORT virtual int Depth() const { return _lab.Depth(); }
- Standard_EXPORT virtual TDF_Label GetLabel() { return _lab; }
+ Standard_EXPORT virtual DF_Label GetLabel() const { return _lab; }
- Standard_EXPORT static Standard_GUID GetGUID(const TCollection_AsciiString& theTypeOfAttribute);
+ Standard_EXPORT bool IsNull() const { return _lab.IsNull(); }
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_SObject )
+ Standard_EXPORT bool IsComponent() const;
+
+ Standard_EXPORT operator SALOMEDSImpl_SComponent() const;
+
+ Standard_EXPORT operator bool () const { return !IsNull(); }
+
+ Standard_EXPORT SALOMEDSImpl_SObject* GetPersistentCopy() const;
+
+ Standard_EXPORT static std::string GetGUID(const std::string& theTypeOfAttribute);
+
+
};
#endif
using namespace std;
-#include <TColStd_SequenceOfExtendedString.hxx>
-#include <TCollection_ExtendedString.hxx>
-
-#include <TColStd_HSequenceOfAsciiString.hxx>
-#include <TDocStd_Application.hxx>
-#include <TDocStd_Owner.hxx>
-#include <TDF_LabelList.hxx>
-#include <TDF_ListIteratorOfLabelList.hxx>
-#include <CDM_Document.hxx>
-#include <CDM_Application.hxx>
-#include <TDF_ChildIDIterator.hxx>
-#include <TDF_ChildIterator.hxx>
-#include <TDF_AttributeIterator.hxx>
+#include "DF_Application.hxx"
+#include "DF_ChildIterator.hxx"
#include "SALOMEDSImpl_ChildNodeIterator.hxx"
#include "SALOMEDSImpl_Attributes.hxx"
#include "SALOMEDSImpl_Tool.hxx"
#include "SALOMEDSImpl_IParameters.hxx"
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_Study, MMgt_TShared )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_Study, MMgt_TShared )
+#include <fstream>
#define DIRECTORYID 16661
#define FILELOCALID 26662
#define FILEID "FILE: "
+
//============================================================================
/*! Function : SALOMEDSImpl_Study
* Purpose : SALOMEDSImpl_Study constructor
*/
//============================================================================
-SALOMEDSImpl_Study::SALOMEDSImpl_Study(const Handle(TDocStd_Document)& doc,
- const TCollection_AsciiString& study_name)
+SALOMEDSImpl_Study::SALOMEDSImpl_Study(const DF_Document* doc,
+ const string& study_name)
{
- doc->SetUndoLimit(1); // mpv (IPAL9237): if there is no undo limit, operations mechanism couldn't work
_name = study_name;
- _doc = doc;
+ _doc = (DF_Document*)doc;
_Saved = false ;
_URL = "";
_StudyId = -1;
_autoFill = true;
- myNbPostponed.Append(0);
- myNbUndos = 0;
_errorCode = "";
_useCaseBuilder = new SALOMEDSImpl_UseCaseBuilder(_doc);
_builder = new SALOMEDSImpl_StudyBuilder(this);
_cb = new SALOMEDSImpl_Callback(_useCaseBuilder);
//Put on the root label a StudyHandle attribute to store the address of this object
- //It will be used to retrieve the study object by TDF_Label that belongs to the study
+ //It will be used to retrieve the study object by DF_Label that belongs to the study
SALOMEDSImpl_StudyHandle::Set(_doc->Main().Root(), this);
- _lockers = new TColStd_HSequenceOfAsciiString();
}
* Purpose : Get persistent reference of study (idem URL())
*/
//============================================================================
-TCollection_AsciiString SALOMEDSImpl_Study::GetPersistentReference()
+string SALOMEDSImpl_Study::GetPersistentReference()
{
_errorCode = "";
return URL();
}
//============================================================================
/*! Function : GetTransientReference
- * Purpose : Get IOR of the Study (registred in OCAF document in doc->Root)
+ * Purpose : Get IOR of the Study (registred in Document in doc->Root)
*/
//============================================================================
-TCollection_AsciiString SALOMEDSImpl_Study::GetTransientReference()
+string SALOMEDSImpl_Study::GetTransientReference()
{
_errorCode = "";
- TCollection_AsciiString IOR = "";
+ string IOR = "";
- Handle(SALOMEDSImpl_AttributeIOR) Att;
- TDF_Label _lab = _doc->GetData()->Root();
- if (_lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(),Att)) {
+ SALOMEDSImpl_AttributeIOR* Att;
+ DF_Label _lab = _doc->Root();
+ if ((Att=(SALOMEDSImpl_AttributeIOR*)_lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) {
IOR = Att->Value();
}
else {
return IOR;
}
-void SALOMEDSImpl_Study::SetTransientReference(const TCollection_AsciiString& theIOR)
+void SALOMEDSImpl_Study::SetTransientReference(const string& theIOR)
{
_errorCode = "";
- Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = GetProperties();
+ SALOMEDSImpl_AttributeStudyProperties* aProp = GetProperties();
int aLocked = aProp->IsLocked();
- if (aLocked) aProp->SetLocked(Standard_False);
+ if (aLocked) aProp->SetLocked(false);
// Assign the value of the IOR in the study->root
SALOMEDSImpl_AttributeIOR::Set(_doc->Main().Root(), theIOR);
- if (aLocked) aProp->SetLocked(Standard_True);
+ if (aLocked) aProp->SetLocked(true);
}
//============================================================================
bool SALOMEDSImpl_Study::IsEmpty()
{
_errorCode = "";
- if (_doc.IsNull()) return true;
+ if (!_doc) return true;
return _doc->IsEmpty();
}
* Purpose : Find a Component with ComponentDataType = aComponentName
*/
//============================================================================
-Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::FindComponent (const TCollection_AsciiString& aComponentName)
+SALOMEDSImpl_SComponent SALOMEDSImpl_Study::FindComponent (const string& aComponentName)
{
_errorCode = "";
bool _find = false;
- TCollection_AsciiString name;
+ string name;
SALOMEDSImpl_SComponentIterator itcomp = NewComponentIterator();
- Handle(SALOMEDSImpl_SComponent) compo;
+ SALOMEDSImpl_SComponent compo;
for (; itcomp.More(); itcomp.Next()) {
- Handle(SALOMEDSImpl_SComponent) SC = itcomp.Value();
- name = SC->ComponentDataType();
+ SALOMEDSImpl_SComponent SC = itcomp.Value();
+ name = SC.ComponentDataType();
if(aComponentName == name) {
_find = true;
return SC;
if(!_find)
{
_errorCode = "No component was found";
- return NULL;
+ return compo;
}
return compo;
}
* Purpose : Find a Component from it's ID
*/
//============================================================================
-Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::FindComponentID(const TCollection_AsciiString& aComponentID)
+SALOMEDSImpl_SComponent SALOMEDSImpl_Study::FindComponentID(const string& aComponentID)
{
_errorCode = "";
// Iterate on each components defined in the study
// Get the component ID and compare with aComponentID
bool _find = false;
- TCollection_AsciiString ID;
- Handle(SALOMEDSImpl_SComponent) compo;
+ string ID;
+ SALOMEDSImpl_SComponent compo;
SALOMEDSImpl_SComponentIterator itcomp = NewComponentIterator();
for (; itcomp.More(); itcomp.Next()) {
- Handle(SALOMEDSImpl_SComponent) SC = itcomp.Value();
- ID = SC->GetID();
+ SALOMEDSImpl_SComponent SC = itcomp.Value();
+ ID = SC.GetID();
if(aComponentID == ID)
{
// ComponentID found
if(!_find)
{
_errorCode = "No component was found";
- compo = NULL;
+ compo = compo;
}
return compo;
* Purpose : Find an Object with SALOMEDSImpl_Name = anObjectName
*/
//============================================================================
-Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::FindObject(const TCollection_AsciiString& anObjectName)
+SALOMEDSImpl_SObject SALOMEDSImpl_Study::FindObject(const string& anObjectName)
{
_errorCode = "";
// After testing the component name, iterate in all objects defined under
// components (function _FindObject)
bool _find = false;
- Handle(SALOMEDSImpl_SObject) RefSO = NULL;
+ SALOMEDSImpl_SObject RefSO;
SALOMEDSImpl_SComponentIterator it = NewComponentIterator();
for (; it.More();it.Next()){
if(!_find)
{
- Handle(SALOMEDSImpl_SComponent) SC = it.Value();
- if (SC->GetName() == anObjectName)
+ SALOMEDSImpl_SComponent SC = it.Value();
+ if (SC.GetName() == anObjectName)
{
_find = true;
RefSO = SC;
if (!_find) RefSO = _FindObject(SC, anObjectName, _find);
}
}
- if(RefSO.IsNull()) _errorCode = "No object was found";
+ if(!RefSO) _errorCode = "No object was found";
return RefSO;
}
* Purpose : Find an Object with ID = anObjectID
*/
//============================================================================
-Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::FindObjectID(const TCollection_AsciiString& anObjectID)
+SALOMEDSImpl_SObject SALOMEDSImpl_Study::FindObjectID(const string& anObjectID)
{
_errorCode = "";
-
- // Convert aSO->GetID in TDF_Label.
- TDF_Label Lab;
- TDF_Tool::Label(_doc->Main().Data(), anObjectID, Lab);
+ SALOMEDSImpl_SObject so;
+
+ // Convert aSO->GetID in DF_Label.
+ DF_Label Lab = DF_Label::Label(_doc->Main(), anObjectID, false);
if (Lab.IsNull()) {
_errorCode = "No label was found by ID";
- return NULL;
+ return so;
}
return GetSObject(Lab);
* Purpose : Creates an Object with ID = anObjectID
*/
//============================================================================
-Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::CreateObjectID(const TCollection_AsciiString& anObjectID)
+SALOMEDSImpl_SObject SALOMEDSImpl_Study::CreateObjectID(const string& anObjectID)
{
_errorCode = "";
+ SALOMEDSImpl_SObject so;
- // Convert aSO->GetID in TDF_Label.
- TDF_Label Lab;
- TDF_Tool::Label(_doc->Main().Data(), anObjectID, Lab, Standard_True);
+ // Convert aSO->GetID in DF_Label.
+ DF_Label Lab = DF_Label::Label(_doc->Main(), anObjectID, true);
if (Lab.IsNull()) {
_errorCode = "Can not create a label";
- return NULL;
+ return so;
}
return GetSObject(Lab);
* : with ComponentDataType = aComponentName
*/
//============================================================================
-Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_Study::FindObjectByName(const TCollection_AsciiString& anObjectName,
- const TCollection_AsciiString& aComponentName)
+vector<SALOMEDSImpl_SObject> SALOMEDSImpl_Study::FindObjectByName(const string& anObjectName,
+ const string& aComponentName)
{
_errorCode = "";
- Handle(TColStd_HSequenceOfTransient) listSO = new TColStd_HSequenceOfTransient();
+ vector<SALOMEDSImpl_SObject> listSO;
- Handle(SALOMEDSImpl_SComponent) compo = FindComponent(aComponentName) ;
- if ( compo.IsNull() ) {
+ SALOMEDSImpl_SComponent compo = FindComponent(aComponentName) ;
+ if ( !compo ) {
_errorCode = "Can not find the component";
return listSO;
}
// Iterate on each object and subobject of the component
// If objectName is found add it to the list of SObjects
- TCollection_AsciiString childName ;
+ string childName ;
- TCollection_AsciiString compoId = compo->GetID();
- Handle(SALOMEDSImpl_ChildIterator) it = NewChildIterator(compo);
- for ( ; it->More(); it->Next() ) {
+ string compoId = compo.GetID();
+ SALOMEDSImpl_ChildIterator it = NewChildIterator(compo);
+ for ( ; it.More(); it.Next() ) {
- Handle(SALOMEDSImpl_SObject) CSO = it->Value();
- if ( CSO->GetName() == anObjectName ) {
+ SALOMEDSImpl_SObject CSO = it.Value();
+ if ( CSO.GetName() == anObjectName ) {
/* add to list */
- listSO->Append(CSO) ;
+ listSO.push_back(CSO) ;
}
/* looks also for eventual children */
bool found = false ;
CSO = _FindObject( CSO, anObjectName, found ) ;
if( found) {
- listSO->Append(CSO) ;
+ listSO.push_back(CSO) ;
}
}
* Purpose : Find an Object with IOR = anObjectIOR
*/
//============================================================================
-Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::FindObjectIOR(const TCollection_AsciiString& anObjectIOR)
+SALOMEDSImpl_SObject SALOMEDSImpl_Study::FindObjectIOR(const string& anObjectIOR)
{
_errorCode = "";
-
- Handle(SALOMEDSImpl_SObject) aResult = NULL;
-
+
+ SALOMEDSImpl_SObject aResult ;
+
// searching in the datamap for optimization
- if (myIORLabels.IsBound(anObjectIOR)) {
- aResult = GetSObject(myIORLabels.Find(anObjectIOR));
+ if (myIORLabels.find(anObjectIOR) != myIORLabels.end()) {
+ aResult = GetSObject(myIORLabels[anObjectIOR]);
// 11 oct 2002: forbidden attributes must be checked here
- if (!aResult->GetLabel().IsAttribute(SALOMEDSImpl_AttributeIOR::GetID())) {
- myIORLabels.UnBind(anObjectIOR);
- aResult = NULL;
- }
+ if (!aResult.GetLabel().IsAttribute(SALOMEDSImpl_AttributeIOR::GetID())) {
+ myIORLabels.erase(anObjectIOR);
+ aResult = SALOMEDSImpl_SObject();
+ }
}
-
- if (aResult.IsNull()) _errorCode = "No object was found";
+
+ if(!aResult) _errorCode = "No object was found";
return aResult;
}
* Purpose : Find an Object by its path = thePath
*/
//============================================================================
-Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::FindObjectByPath(const TCollection_AsciiString& thePath)
+SALOMEDSImpl_SObject SALOMEDSImpl_Study::FindObjectByPath(const string& thePath)
{
_errorCode = "";
- TCollection_AsciiString aPath(thePath), aToken;
- Handle(SALOMEDSImpl_SObject) aSO = NULL;
- int i = 1, aLength = aPath.Length();
+ string aPath(thePath), aToken;
+ SALOMEDSImpl_SObject aSO;
+ int aLength = aPath.size();
bool isRelative = false;
if(aLength == 0) { //Empty path - return the current context
return GetSObject(_current);
}
- if(aPath.Value(1) != '/') //Relative path
+ if(aPath[0] != '/') //Relative path
isRelative = true;
- TDF_ChildIterator anIterator;
- TDF_Label aLabel;
- Handle(SALOMEDSImpl_AttributeName) anAttr;
+ DF_ChildIterator anIterator;
+ DF_Label aLabel;
+ SALOMEDSImpl_AttributeName* anAttr;
if(isRelative) {
- if(_current.IsNull()) return NULL;
- anIterator.Initialize(_current, Standard_False);
+ if(_current.IsNull()) return aSO;
+ anIterator.Init(_current, false);
}
else {
- if(aPath.Length() == 1 && aPath.Value(1) == '/') { //Root
+ if(aPath.size() == 1 && aPath[0] == '/') { //Root
return GetSObject(_doc->Main());
}
- anIterator.Initialize(_doc->Main(), Standard_False);
+ anIterator.Init(_doc->Main(), false);
}
- while(i <= aLength) {
+ vector<string> vs = SALOMEDSImpl_Tool::splitString(aPath, '/');
+ for(int i = 0, len = vs.size(); i<len; i++) {
- aToken = aPath.Token("/", i);
- if(aToken.Length() == 0) break;
+ aToken = vs[i];
+ if(aToken.size() == 0) break;
for ( ; anIterator.More(); anIterator.Next() ) {
aLabel = anIterator.Value();
- if(aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID(), anAttr)) {
+ if((anAttr=(SALOMEDSImpl_AttributeName*)aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) {
if(anAttr->Value() == 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)
+ if(i == (len-1)) { //The searched label is found (no part of the path is left)
return GetSObject(aLabel);
}
- anIterator.Initialize(aLabel, Standard_False);
+ anIterator.Init(aLabel, false);
break;
}
}
}
- i++;
}
- if(aSO.IsNull()) _errorCode = "No object was found";
+ if(!aSO) _errorCode = "No object was found";
return aSO;
}
* Purpose :
*/
//============================================================================
-TCollection_AsciiString SALOMEDSImpl_Study::GetObjectPath(const Handle(SALOMEDSImpl_SObject)& theObject)
+string SALOMEDSImpl_Study::GetObjectPath(const SALOMEDSImpl_SObject& theObject)
{
_errorCode = "";
- TCollection_AsciiString aPath("");
- if(theObject.IsNull()) {
+ string aPath("");
+ if(!theObject) {
_errorCode = "Null object";
- return aPath.ToCString();
+ return aPath;
}
- TCollection_AsciiString aName = theObject->GetName();
- if(!aName.IsEmpty() && aName != "" ) {
- TCollection_AsciiString aValue((char*)aName.ToCString());
- aValue.Prepend("/");
+ string aName = theObject.GetName();
+ if(!aName.empty() && aName != "" ) {
+ string aValue("/");
+ aValue+=aName;
aValue += aPath;
aPath = aValue;
- Handle(SALOMEDSImpl_SObject) aFather = theObject->GetFather();
- if(!aFather.IsNull()) {
- aName = aFather->GetName();
- if(!aName.IsEmpty() && aName != "") {
- aValue = (char*)GetObjectPath(aFather).ToCString();
+ SALOMEDSImpl_SObject aFather = theObject.GetFather();
+ if(aFather) {
+ aName = aFather.GetName();
+ if(!aName.empty() && aName != "") {
+ aValue = GetObjectPath(aFather);
aPath = aValue + aPath;
}
}
* Purpose :
*/
//============================================================================
-TCollection_AsciiString SALOMEDSImpl_Study::GetObjectPathByIOR(const TCollection_AsciiString& theIOR)
+string SALOMEDSImpl_Study::GetObjectPathByIOR(const string& theIOR)
{
_errorCode = "";
- TCollection_AsciiString aPath;
- Handle(SALOMEDSImpl_SObject) so = FindObjectIOR(theIOR);
- if(so.IsNull()) {
+ string aPath;
+ SALOMEDSImpl_SObject so = FindObjectIOR(theIOR);
+ if(!so) {
_errorCode = "No SObject was found by IOR";
return aPath;
}
* Purpose : Sets the current context
*/
//============================================================================
-bool SALOMEDSImpl_Study::SetContext(const TCollection_AsciiString& thePath)
+bool SALOMEDSImpl_Study::SetContext(const string& thePath)
{
_errorCode = "";
- if(thePath.IsEmpty()) {
+ if(thePath.empty()) {
_errorCode = "InvalidPath";
return false;
}
- TCollection_AsciiString aPath(thePath), aContext("");
+ string aPath(thePath), aContext("");
bool isInvalid = false;
- Handle(SALOMEDSImpl_SObject) aSO;
+ SALOMEDSImpl_SObject aSO;
- if(aPath.Value(1) != '/') { //Relative path
+ if(aPath[0] != '/') { //Relative path
aContext = GetContext();
aContext += '/';
aContext += aPath;
aContext = aPath;
try {
- aSO = FindObjectByPath(aContext.ToCString());
+ aSO = FindObjectByPath(aContext);
}
catch( ... ) {
isInvalid = true;
}
- if(isInvalid || aSO.IsNull()) {
+ if(isInvalid || !aSO) {
_errorCode = "InvalidContext";
return false;
}
- TDF_Label aLabel = aSO->GetLabel();
+ DF_Label aLabel = aSO.GetLabel();
if(aLabel.IsNull()) {
_errorCode = "InvalidContext";
return false;
* Purpose : Gets the current context
*/
//============================================================================
-TCollection_AsciiString SALOMEDSImpl_Study::GetContext()
+string SALOMEDSImpl_Study::GetContext()
{
_errorCode = "";
_errorCode = "InvaidContext";
return "";
}
- Handle(SALOMEDSImpl_SObject) so = GetSObject(_current);
+ SALOMEDSImpl_SObject so = GetSObject(_current);
return GetObjectPath(so);
}
* Purpose : method to get all object names in the given context (or in the current context, if 'theContext' is empty)
*/
//============================================================================
-Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetObjectNames(const TCollection_AsciiString& theContext)
+vector<string> SALOMEDSImpl_Study::GetObjectNames(const string& theContext)
{
_errorCode = "";
- Handle(TColStd_HSequenceOfAsciiString) aResultSeq = new TColStd_HSequenceOfAsciiString;
- TDF_Label aLabel;
- if (theContext.IsEmpty()) {
+ vector<string> aResultSeq;
+ DF_Label aLabel;
+ if (theContext.empty()) {
aLabel = _current;
} else {
- TDF_Label aTmp = _current;
+ DF_Label aTmp = _current;
SetContext(theContext);
aLabel = _current;
_current = aTmp;
return aResultSeq;
}
- TDF_ChildIterator anIter (aLabel, Standard_True); // iterate all subchildren at all sublevels
+ DF_ChildIterator anIter (aLabel, true); // iterate all subchildren at all sublevels
for (; anIter.More(); anIter.Next()) {
- TDF_Label aLabel = anIter.Value();
- Handle(SALOMEDSImpl_AttributeName) aName;
- if (aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aName)) aResultSeq->Append(aName->Value());
+ DF_Label aLabel = anIter.Value();
+ SALOMEDSImpl_AttributeName* aName;
+ if ((aName=(SALOMEDSImpl_AttributeName*)aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID())))
+ aResultSeq.push_back(aName->Value());
}
return aResultSeq;
* Purpose : method to get all directory names in the given context (or in the current context, if 'theContext' is empty)
*/
//============================================================================
-Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetDirectoryNames(const TCollection_AsciiString& theContext)
+vector<string> SALOMEDSImpl_Study::GetDirectoryNames(const string& theContext)
{
_errorCode = "";
- Handle(TColStd_HSequenceOfAsciiString) aResultSeq = new TColStd_HSequenceOfAsciiString;
- TDF_Label aLabel;
- if (theContext.IsEmpty()) {
+ vector<string> aResultSeq;
+ DF_Label aLabel;
+ if (theContext.empty()) {
aLabel = _current;
} else {
- TDF_Label aTmp = _current;
+ DF_Label aTmp = _current;
SetContext(theContext);
aLabel = _current;
_current = aTmp;
return aResultSeq;
}
- TDF_ChildIterator anIter (aLabel, Standard_True); // iterate first-level children at all sublevels
+ DF_ChildIterator anIter (aLabel, true); // iterate first-level children at all sublevels
for (; anIter.More(); anIter.Next()) {
- TDF_Label aLabel = anIter.Value();
- Handle(SALOMEDSImpl_AttributeLocalID) anID;
- if (aLabel.FindAttribute(SALOMEDSImpl_AttributeLocalID::GetID(), anID)) {
+ DF_Label aLabel = anIter.Value();
+ SALOMEDSImpl_AttributeLocalID* anID;
+ if ((anID=(SALOMEDSImpl_AttributeLocalID*)aLabel.FindAttribute(SALOMEDSImpl_AttributeLocalID::GetID()))) {
if (anID->Value() == DIRECTORYID) {
- Handle(SALOMEDSImpl_AttributeName) aName;
- if (aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aName)) {
- aResultSeq->Append(aName->Value());
+ SALOMEDSImpl_AttributeName* aName;
+ if ((aName=(SALOMEDSImpl_AttributeName*)aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) {
+ aResultSeq.push_back(aName->Value());
}
}
}
* Purpose : method to get all file names in the given context (or in the current context, if 'theContext' is empty)
*/
//============================================================================
-Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetFileNames(const TCollection_AsciiString& theContext)
+vector<string> SALOMEDSImpl_Study::GetFileNames(const string& theContext)
{
_errorCode = "";
- Handle(TColStd_HSequenceOfAsciiString) aResultSeq = new TColStd_HSequenceOfAsciiString;
- TDF_Label aLabel;
- if (theContext.IsEmpty()) {
+ vector<string> aResultSeq;
+ DF_Label aLabel;
+ if (theContext.empty()) {
aLabel = _current;
} else {
- TDF_Label aTmp = _current;
+ DF_Label aTmp = _current;
SetContext(theContext);
aLabel = _current;
_current = aTmp;
return aResultSeq;
}
- TDF_ChildIterator anIter (aLabel, Standard_True); // iterate all subchildren at all sublevels
+ DF_ChildIterator anIter (aLabel, true); // iterate all subchildren at all sublevels
for (; anIter.More(); anIter.Next()) {
- TDF_Label aLabel = anIter.Value();
- Handle(SALOMEDSImpl_AttributeLocalID) anID;
- if (aLabel.FindAttribute(SALOMEDSImpl_AttributeLocalID::GetID(), anID)) {
+ DF_Label aLabel = anIter.Value();
+ SALOMEDSImpl_AttributeLocalID* anID;
+ if ((anID=(SALOMEDSImpl_AttributeLocalID*)aLabel.FindAttribute(SALOMEDSImpl_AttributeLocalID::GetID()))) {
if (anID->Value() == FILELOCALID) {
- Handle(SALOMEDSImpl_AttributePersistentRef) aName;
- if (aLabel.FindAttribute(SALOMEDSImpl_AttributePersistentRef::GetID(), aName)) {
- TCollection_ExtendedString aFileName = aName->Value();
- if (aFileName.Length() > 0)
- aResultSeq->Append(aFileName.Split(strlen(FILEID)));
+ SALOMEDSImpl_AttributePersistentRef* aName;
+ if ((aName=(SALOMEDSImpl_AttributePersistentRef*)aLabel.FindAttribute(SALOMEDSImpl_AttributePersistentRef::GetID()))) {
+ std::string aFileName = aName->Value();
+ if (aFileName.size() > 0)
+ aResultSeq.push_back(aFileName.substr(strlen(FILEID), aFileName.size()));
}
}
}
* Purpose : method to get all components names
*/
//============================================================================
-Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetComponentNames(const TCollection_AsciiString& theContext)
+vector<string> SALOMEDSImpl_Study::GetComponentNames(const string& theContext)
{
_errorCode = "";
- Handle(TColStd_HSequenceOfAsciiString) aResultSeq = new TColStd_HSequenceOfAsciiString;
- TDF_ChildIterator anIter(_doc->Main(), Standard_False); // iterate all subchildren at first level
+ vector<string> aResultSeq;
+ DF_ChildIterator anIter(_doc->Main(), false); // iterate all subchildren at first level
for(; anIter.More(); anIter.Next()) {
- TDF_Label aLabel = anIter.Value();
- Handle(SALOMEDSImpl_AttributeName) aName;
- if (aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aName)) aResultSeq->Append(aName->Value());
+ DF_Label aLabel = anIter.Value();
+ SALOMEDSImpl_AttributeName* aName;
+ if ((aName=(SALOMEDSImpl_AttributeName*)aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID())))
+ aResultSeq.push_back(aName->Value());
}
return aResultSeq;
* Purpose : Create a ChildIterator from an SObject
*/
//============================================================================
-Handle(SALOMEDSImpl_ChildIterator) SALOMEDSImpl_Study::NewChildIterator(const Handle(SALOMEDSImpl_SObject)& aSO)
+SALOMEDSImpl_ChildIterator SALOMEDSImpl_Study::NewChildIterator(const SALOMEDSImpl_SObject& aSO)
{
_errorCode = "";
- return new SALOMEDSImpl_ChildIterator(aSO);
+ return SALOMEDSImpl_ChildIterator(aSO);
}
* Purpose : Create a StudyBuilder
*/
//============================================================================
-Handle(SALOMEDSImpl_StudyBuilder) SALOMEDSImpl_Study::NewBuilder()
+SALOMEDSImpl_StudyBuilder* SALOMEDSImpl_Study::NewBuilder()
{
_errorCode = "";
if(_autoFill) {
* Purpose : get study name
*/
//============================================================================
-TCollection_AsciiString SALOMEDSImpl_Study::Name()
+string SALOMEDSImpl_Study::Name()
{
_errorCode = "";
return _name;
* Purpose : set study name
*/
//============================================================================
-void SALOMEDSImpl_Study::Name(const TCollection_AsciiString& name)
+void SALOMEDSImpl_Study::Name(const string& name)
{
_errorCode = "";
_name = name;
{
_errorCode = "";
_Saved = save;
- if(save) _doc->UnModify();
+ if(save) _doc->SetModified(false);
}
//============================================================================
* Purpose : get URL of the study (persistent reference of the study)
*/
//============================================================================
-TCollection_AsciiString SALOMEDSImpl_Study::URL()
+string SALOMEDSImpl_Study::URL()
{
_errorCode = "";
return _URL;
* Purpose : set URL of the study (persistent reference of the study)
*/
//============================================================================
-void SALOMEDSImpl_Study::URL(const TCollection_AsciiString& url)
+void SALOMEDSImpl_Study::URL(const string& url)
{
_errorCode = "";
_URL = url;
/*jfa: Now name of SALOMEDS study will correspond to name of SalomeApp study
- TCollection_AsciiString tmp(_URL);
+ string tmp(_URL);
char *aName = (char*)tmp.ToCString();
char *adr = strtok(aName, "/");
* Purpose : Find an Object with SALOMEDSImpl_Name = anObjectName
*/
//============================================================================
-Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::_FindObject(const Handle(SALOMEDSImpl_SObject)& SO,
- const TCollection_AsciiString& theObjectName,
+SALOMEDSImpl_SObject SALOMEDSImpl_Study::_FindObject(const SALOMEDSImpl_SObject& SO,
+ const string& theObjectName,
bool& _find)
{
- if(SO.IsNull()) return NULL;
+ SALOMEDSImpl_SObject RefSO;
+ if(!SO) return RefSO;
// Iterate on each objects and subobjects of the component
// If objectName find, stop the loop and get the object reference
- Handle(SALOMEDSImpl_SObject) RefSO;
- Handle(SALOMEDSImpl_AttributeName) anAttr;
+ SALOMEDSImpl_AttributeName* anAttr;
- TCollection_AsciiString soid = SO->GetID();
- TDF_ChildIterator it(SO->GetLabel());
+ string soid = SO.GetID();
+ DF_ChildIterator it(SO.GetLabel());
for (; it.More(); it.Next()){
if(!_find)
{
- if (it.Value().FindAttribute(SALOMEDSImpl_AttributeName::GetID(), anAttr))
+ if ((anAttr=(SALOMEDSImpl_AttributeName*)it.Value().FindAttribute(SALOMEDSImpl_AttributeName::GetID())))
{
- TCollection_AsciiString Val(anAttr->Value());
+ string Val(anAttr->Value());
if (Val == theObjectName)
{
RefSO = GetSObject(it.Value());
* Purpose : Find an Object with SALOMEDSImpl_IOR = anObjectIOR
*/
//============================================================================
-Handle(SALOMEDSImpl_SObject)
-SALOMEDSImpl_Study::_FindObjectIOR(const Handle(SALOMEDSImpl_SObject)& SO,
- const TCollection_AsciiString& theObjectIOR,
+SALOMEDSImpl_SObject
+SALOMEDSImpl_Study::_FindObjectIOR(const SALOMEDSImpl_SObject& SO,
+ const string& theObjectIOR,
bool& _find)
{
- if(SO.IsNull()) return NULL;
+ SALOMEDSImpl_SObject RefSO, aSO;
+ if(!SO) return RefSO;
// Iterate on each objects and subobjects of the component
// If objectName find, stop the loop and get the object reference
- Handle(SALOMEDSImpl_SObject) RefSO, aSO;
- Handle(SALOMEDSImpl_AttributeIOR) anAttr;
+ SALOMEDSImpl_AttributeIOR* anAttr;
- TDF_ChildIterator it(SO->GetLabel());
+ DF_ChildIterator it(SO.GetLabel());
for (; it.More();it.Next()){
if(!_find)
{
- if (it.Value().FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(), anAttr))
+ if ((anAttr=(SALOMEDSImpl_AttributeIOR*)it.Value().FindAttribute(SALOMEDSImpl_AttributeIOR::GetID())))
{
- TCollection_AsciiString Val(anAttr->Value());
+ string Val(anAttr->Value());
if (Val == theObjectIOR)
{
RefSO = GetSObject(it.Value());
_StudyId = id;
}
-void SALOMEDSImpl_Study::UpdateIORLabelMap(const TCollection_AsciiString& anIOR,const TCollection_AsciiString& anEntry)
+void SALOMEDSImpl_Study::UpdateIORLabelMap(const string& anIOR,const string& anEntry)
{
_errorCode = "";
- TDF_Label aLabel;
- char* anEn = (char*)anEntry.ToCString();
- char* IOR = (char*)anIOR.ToCString();
- TDF_Tool::Label(_doc->GetData(),anEn, aLabel, Standard_True);
- if (myIORLabels.IsBound(TCollection_ExtendedString(IOR))) myIORLabels.UnBind(TCollection_ExtendedString(IOR));
- myIORLabels.Bind(TCollection_ExtendedString(IOR), aLabel);
+ DF_Label aLabel = DF_Label::Label(_doc->Main(), anEntry, true);
+ if (myIORLabels.find(anIOR) != myIORLabels.end()) myIORLabels.erase(anIOR);
+ myIORLabels[anIOR] = aLabel;
}
-Handle(SALOMEDSImpl_Study) SALOMEDSImpl_Study::GetStudy(const TDF_Label& theLabel)
+SALOMEDSImpl_Study* SALOMEDSImpl_Study::GetStudy(const DF_Label& theLabel)
{
- Handle(SALOMEDSImpl_StudyHandle) Att;
- if (theLabel.Root().FindAttribute(SALOMEDSImpl_StudyHandle::GetID(),Att)) {
- return Att->GetHandle();
+ SALOMEDSImpl_StudyHandle* Att;
+ if ((Att=(SALOMEDSImpl_StudyHandle*)theLabel.Root().FindAttribute(SALOMEDSImpl_StudyHandle::GetID()))) {
+ return Att->Get();
}
return NULL;
}
-Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::SObject(const TDF_Label& theLabel)
+SALOMEDSImpl_SObject SALOMEDSImpl_Study::SObject(const DF_Label& theLabel)
{
return GetStudy(theLabel)->GetSObject(theLabel);
}
-Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::SComponent(const TDF_Label& theLabel)
+SALOMEDSImpl_SComponent SALOMEDSImpl_Study::SComponent(const DF_Label& theLabel)
{
return GetStudy(theLabel)->GetSComponent(theLabel);
}
-void SALOMEDSImpl_Study::IORUpdated(const Handle(SALOMEDSImpl_AttributeIOR)& theAttribute)
+void SALOMEDSImpl_Study::IORUpdated(const SALOMEDSImpl_AttributeIOR* theAttribute)
{
- TCollection_AsciiString aString;
- TDF_Tool::Entry(theAttribute->Label(), aString);
+ string aString = theAttribute->Label().Entry();
GetStudy(theAttribute->Label())->UpdateIORLabelMap(theAttribute->Value(), aString);
}
-Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_Study::FindDependances(const Handle(SALOMEDSImpl_SObject)& anObject)
+vector<SALOMEDSImpl_SObject> SALOMEDSImpl_Study::FindDependances(const SALOMEDSImpl_SObject& anObject)
{
_errorCode = "";
- Handle(TColStd_HSequenceOfTransient) aSeq;
+ vector<SALOMEDSImpl_SObject> aSeq;
- Handle(SALOMEDSImpl_AttributeTarget) aTarget;
- if (anObject->GetLabel().FindAttribute(SALOMEDSImpl_AttributeTarget::GetID(), aTarget)) {
+ SALOMEDSImpl_AttributeTarget* aTarget;
+ if ((aTarget=(SALOMEDSImpl_AttributeTarget*)anObject.GetLabel().FindAttribute(SALOMEDSImpl_AttributeTarget::GetID()))) {
return aTarget->Get();
}
}
-Handle(SALOMEDSImpl_AttributeStudyProperties) SALOMEDSImpl_Study::GetProperties()
+SALOMEDSImpl_AttributeStudyProperties* SALOMEDSImpl_Study::GetProperties()
{
_errorCode = "";
return SALOMEDSImpl_AttributeStudyProperties::Set(_doc->Main());
}
-TCollection_AsciiString SALOMEDSImpl_Study::GetLastModificationDate()
+string SALOMEDSImpl_Study::GetLastModificationDate()
{
_errorCode = "";
- Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = GetProperties();
+ SALOMEDSImpl_AttributeStudyProperties* aProp = GetProperties();
- Handle(TColStd_HSequenceOfExtendedString) aNames;
- Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears;
+ vector<string> aNames;
+ vector<int> aMinutes, aHours, aDays, aMonths, aYears;
aProp->GetModifications(aNames, aMinutes, aHours, aDays, aMonths, aYears);
- int aLastIndex = aNames->Length();
+ int aLastIndex = aNames.size()-1;
char aResult[20];
sprintf(aResult, "%2.2d/%2.2d/%4.4d %2.2d:%2.2d",
- (int)(aDays->Value(aLastIndex)),(int)(aMonths->Value(aLastIndex)), (int)(aYears->Value(aLastIndex)),
- (int)(aHours->Value(aLastIndex)), (int)(aMinutes->Value(aLastIndex)));
- TCollection_AsciiString aResStr (aResult);
+ (int)(aDays[aLastIndex]),(int)(aMonths[aLastIndex]), (int)(aYears[aLastIndex]),
+ (int)(aHours[aLastIndex]), (int)(aMinutes[aLastIndex]));
+ string aResStr (aResult);
return aResStr;
}
-Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetModificationsDate()
+vector<string> SALOMEDSImpl_Study::GetModificationsDate()
{
_errorCode = "";
- Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = GetProperties();
+ SALOMEDSImpl_AttributeStudyProperties* aProp = GetProperties();
- Handle(TColStd_HSequenceOfExtendedString) aNames;
- Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears;
+ vector<string> aNames;
+ vector<int> aMinutes, aHours, aDays, aMonths, aYears;
aProp->GetModifications(aNames, aMinutes, aHours, aDays, aMonths, aYears);
- int anIndex, aLength = aNames->Length();
- Handle(TColStd_HSequenceOfAsciiString) aDates = new TColStd_HSequenceOfAsciiString;
+ int anIndex, aLength = aNames.size();
+ vector<string> aDates;
- for (anIndex = 2; anIndex <= aLength; anIndex++) {
+ for (anIndex = 1; anIndex < aLength; anIndex++) {
char aDate[20];
sprintf(aDate, "%2.2d/%2.2d/%4.4d %2.2d:%2.2d",
- (int)(aDays->Value(anIndex)), (int)(aMonths->Value(anIndex)), (int)(aYears->Value(anIndex)),
- (int)(aHours->Value(anIndex)), (int)(aMinutes->Value(anIndex)));
- aDates->Append(aDate);
+ (int)(aDays[anIndex]), (int)(aMonths[anIndex]), (int)(aYears[anIndex]),
+ (int)(aHours[anIndex]), (int)(aMinutes[anIndex]));
+ aDates.push_back(aDate);
}
return aDates;
}
* Purpose : Returns a UseCase builder
*/
//============================================================================
-Handle(SALOMEDSImpl_UseCaseBuilder) SALOMEDSImpl_Study::GetUseCaseBuilder()
+SALOMEDSImpl_UseCaseBuilder* SALOMEDSImpl_Study::GetUseCaseBuilder()
{
_errorCode = "";
return _useCaseBuilder;
void SALOMEDSImpl_Study::Close()
{
_errorCode = "";
- Handle(TDocStd_Application) anApp = Handle(TDocStd_Application)::DownCast(_doc->Application());
- if(!anApp.IsNull()) anApp->Close(_doc);
- _doc.Nullify();
- _mapOfSO.Clear();
- _mapOfSCO.Clear();
-}
-
-//============================================================================
-/*! Function : AddPostponed
- * Purpose :
- */
- //============================================================================
-void SALOMEDSImpl_Study::AddPostponed(const TCollection_AsciiString& theIOR)
-{
- _errorCode = "";
- if (!NewBuilder()->HasOpenCommand()) return;
- TCollection_AsciiString anIOR(theIOR);
- anIOR.Prepend("d");
- myPostponedIORs.Append(anIOR); // add prefix: deleted
- myNbPostponed.SetValue(myNbPostponed.Length(), myNbPostponed.Last() + 1);
-}
-
-//============================================================================
-/*! Function : AddCreatedPostponed
- * Purpose :
- */
- //============================================================================
-void SALOMEDSImpl_Study::AddCreatedPostponed(const TCollection_AsciiString& theIOR)
-{
- _errorCode = "";
- if (!NewBuilder()->HasOpenCommand()) return;
- TCollection_AsciiString anIOR(theIOR);
- anIOR.Prepend("c");
- myPostponedIORs.Append(anIOR); // add prefix: created
- myNbPostponed.SetValue(myNbPostponed.Length(), myNbPostponed.Last() + 1);
-}
-
-//============================================================================
-/*! Function : RemovePostponed
- * Purpose :
- */
-//============================================================================
-Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::RemovePostponed(const int theUndoLimit)
-{
- _errorCode = "";
-
- int anIndex;
- int anOld;
-
- int aUndoLimit = theUndoLimit;
- if (theUndoLimit < 0) aUndoLimit = 0;
-
- Handle(TColStd_HSequenceOfAsciiString) aSeq = new TColStd_HSequenceOfAsciiString;
-
- if (myNbUndos > 0) { // remove undone
- anOld = 0;
- for(anIndex = 1; anIndex < myNbPostponed.Length() - myNbUndos; anIndex++)
- anOld += myNbPostponed(anIndex);
- int aNew = myPostponedIORs.Length() - myNbPostponed.Last();
-
- for(anIndex = anOld + 1; anIndex <= aNew; anIndex++) {
- TCollection_AsciiString anIOR = myPostponedIORs(anIndex);
- if (anIOR.Value(1) == 'c') {
- aSeq->Append(anIOR.Split(1).ToCString());
- }
- }
- if (anOld < aNew) myPostponedIORs.Remove(anOld + 1, aNew);
- if (myNbPostponed.Length() > 0) myNbPostponed.Remove(myNbPostponed.Length() - myNbUndos, myNbPostponed.Length() - 1);
-
- myNbUndos = 0;
- }
-
- if (myNbPostponed.Length() > aUndoLimit) { // remove objects, that can not be undone
- anOld = 0;
- for(anIndex = myNbPostponed.Length() - aUndoLimit; anIndex >= 1; anIndex--)
- anOld += myNbPostponed(anIndex);
- for(anIndex = 1; anIndex <= anOld; anIndex++) {
- TCollection_AsciiString anIOR = myPostponedIORs(anIndex);
- if (anIOR.Value(1) == 'd') {
- aSeq->Append(anIOR.Split(1).ToCString());
- }
- }
- if (anOld > 0) myPostponedIORs.Remove(1, anOld);
- myNbPostponed.Remove(1, myNbPostponed.Length() - aUndoLimit);
- }
-
- if (theUndoLimit == -1) { // remove all IORs from the study on the study close
- TDF_ChildIDIterator anIter(_doc->GetData()->Root(), SALOMEDSImpl_AttributeIOR::GetID(), Standard_True);
- for(; anIter.More(); anIter.Next()) {
- Handle(SALOMEDSImpl_AttributeIOR) anAttr = Handle(SALOMEDSImpl_AttributeIOR)::DownCast(anIter.Value());
- aSeq->Append(anAttr->Value());
- }
- } else myNbPostponed.Append(0);
-
- return aSeq;
-}
-
-//============================================================================
-/*! Function : UndoPostponed
- * Purpose :
- */
-//============================================================================
-void SALOMEDSImpl_Study::UndoPostponed(const int theWay)
-{
- _errorCode = "";
-
- myNbUndos += theWay;
- // remove current postponed
- if (myNbPostponed.Last() > 0)
- myPostponedIORs.Remove(myPostponedIORs.Length() - myNbPostponed.Last() + 1, myPostponedIORs.Length());
- myNbPostponed(myNbPostponed.Length()) = 0;
+ _doc->GetApplication()->Close(_doc);
+ _doc = NULL;
+ _mapOfSO.clear();
+ _mapOfSCO.clear();
}
* Purpose :
*/
//============================================================================
-Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::GetSComponent(const TCollection_AsciiString& theEntry)
+SALOMEDSImpl_SComponent SALOMEDSImpl_Study::GetSComponent(const string& theEntry)
{
- Handle(SALOMEDSImpl_SComponent) aSCO;
- if(_mapOfSCO.IsBound(theEntry))
- aSCO = Handle(SALOMEDSImpl_SComponent)::DownCast(_mapOfSCO.Find(theEntry));
+ SALOMEDSImpl_SComponent aSCO;
+ if(_mapOfSCO.find(theEntry) != _mapOfSCO.end())
+ aSCO = _mapOfSCO[theEntry];
else {
- TDF_Label aLabel;
- TDF_Tool::Label(_doc->GetData(), theEntry, aLabel);
- aSCO = new SALOMEDSImpl_SComponent(aLabel);
- _mapOfSCO.Bind(theEntry, aSCO);
+ DF_Label aLabel = DF_Label::Label(_doc->Main(), theEntry);
+ aSCO = SALOMEDSImpl_SComponent(aLabel);
+ _mapOfSCO[theEntry] = aSCO;
}
return aSCO;
* Purpose :
*/
//============================================================================
-Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::GetSComponent(const TDF_Label& theLabel)
+SALOMEDSImpl_SComponent SALOMEDSImpl_Study::GetSComponent(const DF_Label& theLabel)
{
- TCollection_AsciiString anEntry;
- TDF_Tool::Entry(theLabel, anEntry);
- return GetSComponent(anEntry);
+ return GetSComponent(theLabel.Entry());
}
//============================================================================
* Purpose :
*/
//============================================================================
-Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::GetSObject(const TCollection_AsciiString& theEntry)
+SALOMEDSImpl_SObject SALOMEDSImpl_Study::GetSObject(const string& theEntry)
{
- Handle(SALOMEDSImpl_SObject) aSO;
- if(_mapOfSO.IsBound(theEntry))
- aSO = Handle(SALOMEDSImpl_SObject)::DownCast(_mapOfSO.Find(theEntry));
+ SALOMEDSImpl_SObject aSO;
+ if(_mapOfSO.find(theEntry) != _mapOfSO.end())
+ aSO = _mapOfSO[theEntry];
else {
- TDF_Label aLabel;
- TDF_Tool::Label(_doc->GetData(), theEntry, aLabel);
- aSO = new SALOMEDSImpl_SObject(aLabel);
- _mapOfSO.Bind(theEntry, aSO);
+ DF_Label aLabel = DF_Label::Label(_doc->Main(), theEntry);
+ aSO = SALOMEDSImpl_SObject(aLabel);
+ _mapOfSO[theEntry] = aSO;
}
return aSO;
* Purpose :
*/
//============================================================================
-Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::GetSObject(const TDF_Label& theLabel)
+SALOMEDSImpl_SObject SALOMEDSImpl_Study::GetSObject(const DF_Label& theLabel)
{
- TCollection_AsciiString anEntry;
- TDF_Tool::Entry(theLabel, anEntry);
- return GetSObject(anEntry);
+ return GetSObject(theLabel.Entry());
}
//============================================================================
* Purpose :
*/
//============================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_Study::GetAttribute(const TCollection_AsciiString& theEntry,
- const TCollection_AsciiString& theType)
+DF_Attribute* SALOMEDSImpl_Study::GetAttribute(const string& theEntry,
+ const string& theType)
{
- Handle(SALOMEDSImpl_SObject) aSO = GetSObject(theEntry);
- Handle(TDF_Attribute) anAttr;
- aSO->FindAttribute(anAttr, theType);
+ SALOMEDSImpl_SObject aSO = GetSObject(theEntry);
+ DF_Attribute* anAttr;
+ aSO.FindAttribute(anAttr, theType);
return anAttr;
}
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_Study::DumpStudy(const TCollection_AsciiString& thePath,
- const TCollection_AsciiString& theBaseName,
+bool SALOMEDSImpl_Study::DumpStudy(const string& thePath,
+ const string& theBaseName,
bool isPublished,
SALOMEDSImpl_DriverFactory* theFactory)
{
return false;
}
- TColStd_SequenceOfExtendedString aSeq;
- TCollection_AsciiString aCompType, aFactoryType;
+ vector<string> aSeq;
+ string aCompType, aFactoryType;
//Build a list of all components in the Study
SALOMEDSImpl_SComponentIterator itcomponent = NewComponentIterator();
for (; itcomponent.More(); itcomponent.Next()) {
- Handle(SALOMEDSImpl_SComponent) sco = itcomponent.Value();
- aCompType = sco->ComponentDataType();
+ SALOMEDSImpl_SComponent sco = itcomponent.Value();
+ aCompType = sco.ComponentDataType();
//GEOM and MED are independent components
if (aCompType == "GEOM" || aCompType == "MED")
- aSeq.Prepend(TCollection_ExtendedString(aCompType));
+ aSeq.insert(aSeq.begin(), aCompType);
else
- aSeq.Append(TCollection_ExtendedString(aCompType));
+ aSeq.push_back(aCompType);
}
#ifdef WIN32
- TCollection_AsciiString aFileName =
- thePath + TCollection_AsciiString("\\") + theBaseName + TCollection_AsciiString(".py");
+ string aFileName =
+ thePath + string("\\") + theBaseName + string(".py");
#else
- TCollection_AsciiString aFileName =
- thePath + TCollection_AsciiString("/") + theBaseName + TCollection_AsciiString(".py");
+ string aFileName =
+ thePath + string("/") + theBaseName + string(".py");
#endif
//Create a file that will contain a main Study script
fstream fp;
- fp.open(aFileName.ToCString(), ios::out);
+ fp.open(aFileName.c_str(), ios::out);
#ifdef WIN32
bool isOpened = fp.is_open();
#endif
if(!isOpened) {
- _errorCode = TCollection_AsciiString("Can't create a file ")+aFileName;
+ _errorCode = string("Can't create a file ")+aFileName;
return false;
}
- TCollection_AsciiString aBatchModeScript = "salome";
+ string aBatchModeScript = "salome";
//Output to the main Study script required Python modules import,
//set sys.path and add a creation of the study.
- fp << GetDumpStudyComment().ToCString() << endl << endl;
+ fp << GetDumpStudyComment() << endl << endl;
fp << "import sys" << endl;
fp << "import " << aBatchModeScript << endl << endl;
}
- Handle(TColStd_HSequenceOfAsciiString) aSeqOfFileNames = new TColStd_HSequenceOfAsciiString;
+ vector<string> aSeqOfFileNames;
//Iterate all components and create the componponents specific scripts.
bool isOk = true;
- int aLength = aSeq.Length();
+ int aLength = aSeq.size();
for(int i = 1; i <= aLength; i++) {
- aCompType = aSeq.Value(i);
- Handle(SALOMEDSImpl_SComponent) sco = FindComponent(aCompType);
+ aCompType = aSeq[i-1];
+ SALOMEDSImpl_SComponent sco = FindComponent(aCompType);
SALOMEDSImpl_Driver* aDriver = NULL;
// if there is an associated Engine call its method for saving
- TCollection_AsciiString IOREngine;
+ string IOREngine;
try {
- if (!sco->ComponentIOR(IOREngine)) {
- if (!aCompType.IsEmpty()) {
+ if (!sco.ComponentIOR(IOREngine)) {
+ if (!aCompType.empty()) {
aDriver = theFactory->GetDriverByType(aCompType);
if (aDriver != NULL) {
- Handle(SALOMEDSImpl_StudyBuilder) SB = NewBuilder();
+ SALOMEDSImpl_StudyBuilder* SB = NewBuilder();
if(!SB->LoadWith(sco, aDriver)) {
_errorCode = SB->GetErrorCode();
return false;
bool isValidScript;
long aStreamLength = 0;
- Handle(SALOMEDSImpl_TMPFile) aStream = aDriver->DumpPython(this, isPublished, isValidScript, aStreamLength);
+ SALOMEDSImpl_TMPFile* aStream = aDriver->DumpPython(this, isPublished, isValidScript, aStreamLength);
if ( !isValidScript )
isOk = false;
//Create a file that will contain the component specific script
fstream fp2;
#ifdef WIN32
- aFileName=thePath+TCollection_AsciiString("\\");
+ aFileName=thePath+string("\\");
#else
- aFileName=thePath+TCollection_AsciiString("/");
+ aFileName=thePath+string("/");
#endif
- TCollection_AsciiString aScriptName;
+ string aScriptName;
aScriptName += theBaseName;
aScriptName += "_";
aScriptName += aCompType;
- aFileName += aScriptName+ TCollection_AsciiString(".py");
- aSeqOfFileNames->Append(aFileName);
+ aFileName += aScriptName+ string(".py");
+ aSeqOfFileNames.push_back(aFileName);
- fp2.open(aFileName.ToCString(), ios::out);
+ fp2.open(aFileName.c_str(), ios::out);
#ifdef WIN32
isOpened = fp2.is_open();
#endif
if(!isOpened) {
- _errorCode = TCollection_AsciiString("Can't create a file ")+aFileName;
+ _errorCode = string("Can't create a file ")+aFileName;
SALOMEDSImpl_Tool::RemoveTemporaryFiles(thePath, aSeqOfFileNames, false);
return false;
}
fp2 << aStream->Data();
fp2.close();
+ if(aStream) delete aStream;
+
//Add to the main script a call to RebuildData of the generated by the component the Python script
fp << "import " << aScriptName << endl;
fp << aScriptName << ".RebuildData(" << aBatchModeScript << ".myStudy)" << endl;
//purpose : return a header comment for a DumpStudy script
//=======================================================================
-TCollection_AsciiString SALOMEDSImpl_Study::GetDumpStudyComment(const char* theComponentName)
+string SALOMEDSImpl_Study::GetDumpStudyComment(const char* theComponentName)
{
- TCollection_AsciiString txt
+ string txt
("### This file is generated by SALOME automatically by dump python functionality");
if ( theComponentName )
- txt += TCollection_AsciiString(" of ") + (char*) theComponentName + " component";
+ txt += string(" of ") + (char*) theComponentName + " component";
return txt;
}
-void dumpSO(const Handle(SALOMEDSImpl_SObject)& theSO,
+void dumpSO(const SALOMEDSImpl_SObject& theSO,
fstream& fp,
- const TCollection_AsciiString& Tab,
- const Handle(SALOMEDSImpl_Study) theStudy);
+ const string& Tab,
+ SALOMEDSImpl_Study* theStudy);
+
//============================================================================
/*! Function : dump
* Purpose :
*/
//============================================================================
-void SALOMEDSImpl_Study::dump(const TCollection_AsciiString& theFileName)
+void SALOMEDSImpl_Study::dump(const string& theFileName)
{
//Create a file that will contain a main Study script
fstream fp;
- fp.open(theFileName.ToCString(), ios::out);
+ fp.open(theFileName.c_str(), ios::out);
#ifdef WIN32
bool isOpened = fp.is_open();
#endif
if(!isOpened) {
- _errorCode = TCollection_AsciiString("Can't create a file ")+theFileName;
+ _errorCode = string("Can't create a file ")+theFileName;
cout << "### SALOMEDSImpl_Study::dump Error: " << _errorCode << endl;
return;
}
- Handle(SALOMEDSImpl_SObject) aSO = FindObjectID("0:1");
+ SALOMEDSImpl_SObject aSO = FindObjectID("0:1");
fp << "0:1" << endl;
- Handle(SALOMEDSImpl_ChildIterator) Itr = NewChildIterator(aSO);
- TCollection_AsciiString aTab(" ");
- for(; Itr->More(); Itr->Next()) {
- dumpSO(Itr->Value(), fp, aTab, this);
+ SALOMEDSImpl_ChildIterator Itr = NewChildIterator(aSO);
+ string aTab(" ");
+ for(; Itr.More(); Itr.Next()) {
+ dumpSO(Itr.Value(), fp, aTab, this);
}
fp.close();
}
-void dumpSO(const Handle(SALOMEDSImpl_SObject)& theSO,
+void dumpSO(const SALOMEDSImpl_SObject& theSO,
fstream& fp,
- const TCollection_AsciiString& Tab,
- const Handle(SALOMEDSImpl_Study) theStudy)
+ const string& Tab,
+ SALOMEDSImpl_Study* theStudy)
{
- TCollection_AsciiString aTab(Tab), anID(theSO->GetID());
+ string aTab(Tab), anID(theSO.GetID());
fp << aTab << anID << endl;
- TDF_AttributeIterator anItr(theSO->GetLabel());
- for(; anItr.More(); anItr.Next()) {
- Handle(SALOMEDSImpl_GenericAttribute) anAttr = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(anItr.Value());
+ vector<DF_Attribute*> attribs = theSO.GetLabel().GetAttributes();
+ for(int i = 0; i<attribs.size(); i++) {
+ SALOMEDSImpl_GenericAttribute* anAttr = dynamic_cast<SALOMEDSImpl_GenericAttribute*>(attribs[i]);
- if(anAttr.IsNull()) {
- fp << Tab << " -- " << anItr.Value()->DynamicType();
+ if(!anAttr) {
continue;
}
- TCollection_AsciiString aType = anAttr->GetClassType();
+ string aType = anAttr->GetClassType();
fp << Tab << " -- " << aType;
- if(aType == "AttributeReal") {
- fp << " : " << Handle(SALOMEDSImpl_AttributeReal)::DownCast(anAttr)->Value();
+ if(aType == string("AttributeReal")) {
+ fp << " : " << dynamic_cast<SALOMEDSImpl_AttributeReal*>(anAttr)->Value();
}
- else if(aType == "AttributeInteger") {
- fp << " : " << Handle(SALOMEDSImpl_AttributeInteger)::DownCast(anAttr)->Value();
+ else if(aType == string("AttributeInteger")) {
+ fp << " : " << dynamic_cast<SALOMEDSImpl_AttributeInteger*>(anAttr)->Value();
}
- else if(aType == "AttributeName") {
- fp << " : " << Handle(SALOMEDSImpl_AttributeName)::DownCast(anAttr)->Value();
+ else if(aType == string("AttributeName")) {
+ fp << " : " << dynamic_cast<SALOMEDSImpl_AttributeName*>(anAttr)->Value();
}
- else if(aType == "AttributeComment") {
- fp << " : " << Handle(SALOMEDSImpl_AttributeComment)::DownCast(anAttr)->Value();
+ else if(aType == string("AttributeComment")) {
+ fp << " : " << dynamic_cast<SALOMEDSImpl_AttributeComment*>(anAttr)->Value();
}
- else if(aType == "AttributeReference") {
- fp << " : " << Handle(SALOMEDSImpl_AttributeReference)::DownCast(anAttr)->Save();
+ else if(aType == string("AttributeReference")) {
+ fp << " : " << dynamic_cast<SALOMEDSImpl_AttributeReference*>(anAttr)->Save();
}
fp << endl;
}
- Handle(SALOMEDSImpl_ChildIterator) Itr = theStudy->NewChildIterator(theSO);
- TCollection_AsciiString aNewTab(" ");
+ SALOMEDSImpl_ChildIterator Itr = theStudy->NewChildIterator(theSO);
+ string aNewTab(" ");
aNewTab+=aTab;
- for(; Itr->More(); Itr->Next()) {
- dumpSO(Itr->Value(), fp, aNewTab, theStudy);
+ for(; Itr.More(); Itr.Next()) {
+ dumpSO(Itr.Value(), fp, aNewTab, theStudy);
}
return;
void SALOMEDSImpl_Study::Modify()
{
_errorCode = "";
- _doc->Modify();
+ _doc->SetModified(true);
}
//============================================================================
* Purpose :
*/
//============================================================================
-Handle(SALOMEDSImpl_AttributeParameter) SALOMEDSImpl_Study::GetCommonParameters(const char* theID, int theSavePoint)
+SALOMEDSImpl_AttributeParameter* SALOMEDSImpl_Study::GetCommonParameters(const char* theID, int theSavePoint)
{
if (theSavePoint < 0) return NULL;
- Handle(SALOMEDSImpl_StudyBuilder) builder = NewBuilder();
- Handle(SALOMEDSImpl_SObject) so = FindComponent((char*)theID);
- if (so.IsNull()) so = builder->NewComponent((char*)theID);
- Handle(SALOMEDSImpl_AttributeParameter) attParam;
+ SALOMEDSImpl_StudyBuilder* builder = NewBuilder();
+ SALOMEDSImpl_SObject so = FindComponent((char*)theID);
+ if (!so) so = builder->NewComponent((char*)theID);
+ SALOMEDSImpl_AttributeParameter* attParam = NULL;
if (theSavePoint > 0) { // Try to find SObject that contains attribute parameter ...
- TDF_Label savePointLabel = so->GetLabel().FindChild( theSavePoint, /*create=*/0 );
+ DF_Label savePointLabel = so.GetLabel().FindChild( theSavePoint, /*create=*/0 );
if ( !savePointLabel.IsNull() )
so = GetSObject( savePointLabel );
else // ... if it does not exist - create a new one
so = builder->NewObjectToTag( so, theSavePoint );
}
- if (!so.IsNull()) {
- builder->FindAttribute(so, attParam, "AttributeParameter");
- if ( attParam.IsNull() ) { // first call of GetCommonParameters on "Interface Applicative" component
- Handle(TDF_Attribute) att = builder->FindOrCreateAttribute(so, "AttributeParameter");
- attParam = Handle(SALOMEDSImpl_AttributeParameter)::DownCast( att );
+ DF_Attribute* A;
+ if (so) {
+ builder->FindAttribute(so, A, "AttributeParameter");
+ if ( !A ) { // first call of GetCommonParameters on "Interface Applicative" component
+ A = builder->FindOrCreateAttribute(so, "AttributeParameter");
}
+ attParam = dynamic_cast<SALOMEDSImpl_AttributeParameter*>( A );
}
return attParam;
}
* Purpose :
*/
//============================================================================
-Handle(SALOMEDSImpl_AttributeParameter) SALOMEDSImpl_Study::GetModuleParameters(const char* theID,
- const char* theModuleName,
- int theSavePoint)
+SALOMEDSImpl_AttributeParameter* SALOMEDSImpl_Study::GetModuleParameters(const char* theID,
+ const char* theModuleName,
+ int theSavePoint)
{
if(theSavePoint <= 0) return NULL;
- Handle(SALOMEDSImpl_AttributeParameter) main_ap = GetCommonParameters(theID, theSavePoint);
- Handle(SALOMEDSImpl_SObject) main_so = main_ap->GetSObject();
- Handle(SALOMEDSImpl_AttributeParameter) par;
+ SALOMEDSImpl_AttributeParameter* main_ap = GetCommonParameters(theID, theSavePoint);
+ SALOMEDSImpl_SObject main_so = main_ap->GetSObject();
+ SALOMEDSImpl_AttributeParameter* par = NULL;
- Handle(SALOMEDSImpl_ChildIterator) it = NewChildIterator(main_so);
+ SALOMEDSImpl_ChildIterator it = NewChildIterator(main_so);
string moduleName(theModuleName);
- for(; it->More(); it->Next()) {
- Handle(SALOMEDSImpl_SObject) so(it->Value());
- Handle(SALOMEDSImpl_GenericAttribute) ga;
- if(so->FindAttribute(ga, "AttributeParameter")) {
- par = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(ga);
+ for(; it.More(); it.Next()) {
+ SALOMEDSImpl_SObject so(it.Value());
+ if((par=(SALOMEDSImpl_AttributeParameter*)so.GetLabel().FindAttribute(SALOMEDSImpl_AttributeParameter::GetID()))) {
if(!par->IsSet("AP_MODULE_NAME", (Parameter_Types)3)) continue; //3 -> PT_STRING
if(par->GetString("AP_MODULE_NAME") == moduleName) return par;
}
}
- Handle(SALOMEDSImpl_StudyBuilder) builder = NewBuilder();
- Handle(SALOMEDSImpl_SObject) so = builder->NewObject(main_so);
- par = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(builder->FindOrCreateAttribute(so, "AttributeParameter"));
+ SALOMEDSImpl_StudyBuilder* builder = NewBuilder();
+ SALOMEDSImpl_SObject so = builder->NewObject(main_so);
+ par = dynamic_cast<SALOMEDSImpl_AttributeParameter*>(builder->FindOrCreateAttribute(so, "AttributeParameter"));
par->SetString("AP_MODULE_NAME", moduleName);
return par;
}
//============================================================================
void SALOMEDSImpl_Study::SetStudyLock(const char* theLockerID)
{
- _lockers->Append(TCollection_AsciiString((char*)theLockerID));
+ _lockers.push_back(theLockerID);
}
//============================================================================
//============================================================================
bool SALOMEDSImpl_Study::IsStudyLocked()
{
- return (_lockers->Length() > 0);
+ return (_lockers.size() > 0);
}
//============================================================================
//============================================================================
void SALOMEDSImpl_Study::UnLockStudy(const char* theLockerID)
{
- int length = _lockers->Length(), pos = -1;
- TCollection_AsciiString id((char*)theLockerID);
- for(int i = 1; i<=length; i++) {
- if(id == _lockers->Value(i)) {
- pos = i;
+ vector<string>::iterator vsI = _lockers.begin();
+ int length = _lockers.size();
+ bool isFound = false;
+ string id(theLockerID);
+ for(int i = 0; i<length; i++, vsI++) {
+ if(id == _lockers[i]) {
+ isFound = true;;
break;
}
}
- if(pos > 0) _lockers->Remove(pos);
+ if(isFound) _lockers.erase(vsI);
}
//============================================================================
* Purpose :
*/
//============================================================================
-Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetLockerID()
+vector<string> SALOMEDSImpl_Study::GetLockerID()
{
return _lockers;
}
_builder->SetOnRemoveSObject(NULL);
}
}
+
+//============================================================================
+/*! Function : GetIORs
+ * Purpose :
+ */
+//============================================================================
+vector<string> SALOMEDSImpl_Study::GetIORs()
+{
+ vector<string> anIORs;
+ map<string, DF_Label>::const_iterator MI;
+ for(MI = myIORLabels.begin(); MI!=myIORLabels.end(); MI++)
+ anIORs.push_back(MI->first);
+
+ return anIORs;
+}
#ifndef __SALOMEDSIMPL_STUDY_I_H__
#define __SALOMEDSIMPL_STUDY_I_H__
-//Handle definition
-#include <Handle_MMgt_TShared.hxx>
-#include <Standard_DefineHandle.hxx>
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_Study, MMgt_TShared )
-
// std C++ headers
#include <iostream>
+#include <string>
+#include <vector>
+#include <map>
// Cascade headers
-#include <TDocStd_Document.hxx>
-#include <TDF_Tool.hxx>
-#include <TDF_Data.hxx>
-#include <TDF_Label.hxx>
+#include "DF_Document.hxx"
+#include "DF_Label.hxx"
#include <stdio.h>
-#include <TCollection_AsciiString.hxx>
-#include <TColStd_SequenceOfInteger.hxx>
-#include <TColStd_SequenceOfAsciiString.hxx>
-#include <TColStd_HSequenceOfAsciiString.hxx>
-#include <TColStd_HSequenceOfTransient.hxx>
-#include <NCollection_DataMap.hxx>
//SALOMEDSImpl headers
#include "SALOMEDSImpl_SComponentIterator.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
+class SALOMEDSImpl_Study
{
private:
- TCollection_AsciiString _name;
- Handle(TDocStd_Document) _doc; // OCAF Document
+ std::string _name;
+ DF_Document* _doc; // Document
bool _Saved; // True if the Study is saved
- TCollection_AsciiString _URL; //URL of the persistent reference of the study
+ std::string _URL; //URL of the persistent reference of the study
int _StudyId;
- TDF_Label _current;
+ DF_Label _current;
bool _autoFill;
- TCollection_AsciiString _errorCode;
- Handle(TColStd_HSequenceOfAsciiString) _lockers;
- Handle(SALOMEDSImpl_Callback) _cb;
- 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
- DataMapAsciiStringLabel myIORLabels;
+ std::string _errorCode;
+ std::vector<std::string> _lockers;
+ SALOMEDSImpl_Callback* _cb;
+ SALOMEDSImpl_StudyBuilder* _builder;
+ SALOMEDSImpl_UseCaseBuilder* _useCaseBuilder;
+
+ std::map<std::string, SALOMEDSImpl_SObject> _mapOfSO;
+ std::map<std::string, SALOMEDSImpl_SComponent> _mapOfSCO;
+ std::map<std::string, DF_Label> myIORLabels;
- Handle(SALOMEDSImpl_SObject) _FindObject(const Handle(SALOMEDSImpl_SObject)& SO,
- const TCollection_AsciiString& anObjectName,
- bool& _find);
+ SALOMEDSImpl_SObject _FindObject(const SALOMEDSImpl_SObject& SO,
+ const std::string& anObjectName,
+ bool& _find);
- Handle(SALOMEDSImpl_SObject) _FindObjectIOR(const Handle(SALOMEDSImpl_SObject)& SO,
- const TCollection_AsciiString& anObjectIOR,
- bool& _find);
+ SALOMEDSImpl_SObject _FindObjectIOR(const SALOMEDSImpl_SObject& SO,
+ const std::string& anObjectIOR,
+ bool& _find);
public:
- Standard_EXPORT static Handle(SALOMEDSImpl_Study) GetStudy(const TDF_Label& theLabel);
- Standard_EXPORT static Handle(SALOMEDSImpl_SObject) SObject(const TDF_Label& theLabel);
- Standard_EXPORT static Handle(SALOMEDSImpl_SComponent) SComponent(const TDF_Label& theLabel);
- Standard_EXPORT static void IORUpdated(const Handle(SALOMEDSImpl_AttributeIOR)& theAttribute);
+ Standard_EXPORT static SALOMEDSImpl_Study* GetStudy(const DF_Label& theLabel);
+ Standard_EXPORT static SALOMEDSImpl_SObject SObject(const DF_Label& theLabel);
+ Standard_EXPORT static SALOMEDSImpl_SComponent SComponent(const DF_Label& theLabel);
+ Standard_EXPORT static void IORUpdated(const SALOMEDSImpl_AttributeIOR* theAttribute);
//! standard constructor
- Standard_EXPORT SALOMEDSImpl_Study(const Handle(TDocStd_Document)&, const TCollection_AsciiString& study_name);
+ Standard_EXPORT SALOMEDSImpl_Study(const DF_Document*, const std::string& study_name);
//! standard destructor
Standard_EXPORT virtual ~SALOMEDSImpl_Study();
//! method to Get persistent reference of study (idem URL())
- Standard_EXPORT virtual TCollection_AsciiString GetPersistentReference();
+ Standard_EXPORT virtual std::string GetPersistentReference();
//! method to Get transient reference of study
- Standard_EXPORT virtual TCollection_AsciiString GetTransientReference();
+ Standard_EXPORT virtual std::string GetTransientReference();
- Standard_EXPORT virtual void SetTransientReference(const TCollection_AsciiString& theIOR);
+ Standard_EXPORT virtual void SetTransientReference(const std::string& theIOR);
//! method to detect if a study is empty
Standard_EXPORT virtual bool IsEmpty();
//! method to Find a Component with ComponentDataType = aComponentName
- Standard_EXPORT virtual Handle(SALOMEDSImpl_SComponent) FindComponent (const TCollection_AsciiString& aComponentName);
+ Standard_EXPORT virtual SALOMEDSImpl_SComponent FindComponent (const std::string& aComponentName);
//! method to Find a Component Find a Component from it's ID
- Standard_EXPORT virtual Handle(SALOMEDSImpl_SComponent) FindComponentID(const TCollection_AsciiString& aComponentID);
+ Standard_EXPORT virtual SALOMEDSImpl_SComponent FindComponentID(const std::string& aComponentID);
//! method to Find an Object with SALOMEDSImpl::Name = anObjectName
- Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) FindObject(const TCollection_AsciiString& anObjectName);
+ Standard_EXPORT virtual SALOMEDSImpl_SObject FindObject(const std::string& anObjectName);
//! method to Find Object(s) with SALOMEDSImpl::Name=anObjectName in a component with ComponentDataType = aComponentName
- Standard_EXPORT virtual Handle(TColStd_HSequenceOfTransient) FindObjectByName( const TCollection_AsciiString& anObjectName,
- const TCollection_AsciiString& aComponentName ) ;
+ Standard_EXPORT virtual std::vector<SALOMEDSImpl_SObject> FindObjectByName( const std::string& anObjectName,
+ const std::string& aComponentName ) ;
//! method to Find an Object with ID = anObjectID
- Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) FindObjectID(const TCollection_AsciiString& anObjectID);
+ Standard_EXPORT virtual SALOMEDSImpl_SObject FindObjectID(const std::string& anObjectID);
//! method to Create an Object with ID = anObjectID
- Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) CreateObjectID(const TCollection_AsciiString& anObjectID);
+ Standard_EXPORT virtual SALOMEDSImpl_SObject CreateObjectID(const std::string& anObjectID);
//! method to Find an Object with ID = anObjectIOR
- Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) FindObjectIOR(const TCollection_AsciiString& anObjectIOR);
+ Standard_EXPORT virtual SALOMEDSImpl_SObject FindObjectIOR(const std::string& anObjectIOR);
//! method to Find an Object by its path
- Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) FindObjectByPath(const TCollection_AsciiString& thePath);
+ Standard_EXPORT virtual SALOMEDSImpl_SObject FindObjectByPath(const std::string& thePath);
//! method to get a path of SObject
- Standard_EXPORT virtual TCollection_AsciiString GetObjectPath(const Handle(SALOMEDSImpl_SObject)& theObject);
+ Standard_EXPORT virtual std::string GetObjectPath(const SALOMEDSImpl_SObject& theObject);
- Standard_EXPORT TCollection_AsciiString GetObjectPathByIOR(const TCollection_AsciiString& theIOR);
+ Standard_EXPORT std::string GetObjectPathByIOR(const std::string& theIOR);
//! method to set a context: root ('/') is UserData component
- Standard_EXPORT virtual bool SetContext(const TCollection_AsciiString& thePath);
+ Standard_EXPORT virtual bool SetContext(const std::string& thePath);
//! method to get a context
- Standard_EXPORT virtual TCollection_AsciiString GetContext();
+ Standard_EXPORT virtual std::string GetContext();
//! method to get all object names in the given context (or in the current context, if 'theContext' is empty)
- Standard_EXPORT virtual Handle(TColStd_HSequenceOfAsciiString) GetObjectNames(const TCollection_AsciiString& theContext);
+ Standard_EXPORT virtual std::vector<std::string> GetObjectNames(const std::string& theContext);
//! method to get all directory names in the given context (or in the current context, if 'theContext' is empty)
- Standard_EXPORT virtual Handle(TColStd_HSequenceOfAsciiString) GetDirectoryNames(const TCollection_AsciiString& theContext);
+ Standard_EXPORT virtual std::vector<std::string> GetDirectoryNames(const std::string& theContext);
//! method to get all file names in the given context (or in the current context, if 'theContext' is empty)
- Standard_EXPORT virtual Handle(TColStd_HSequenceOfAsciiString) GetFileNames(const TCollection_AsciiString& theContext);
+ Standard_EXPORT virtual std::vector<std::string> GetFileNames(const std::string& theContext);
//! method to get all components names
- Standard_EXPORT virtual Handle(TColStd_HSequenceOfAsciiString) GetComponentNames(const TCollection_AsciiString& theContext);
+ Standard_EXPORT virtual std::vector<std::string> GetComponentNames(const std::string& theContext);
//! method to Create a ChildIterator from an SObject
- Standard_EXPORT virtual Handle(SALOMEDSImpl_ChildIterator) NewChildIterator(const Handle(SALOMEDSImpl_SObject)& aSO);
+ Standard_EXPORT virtual SALOMEDSImpl_ChildIterator NewChildIterator(const SALOMEDSImpl_SObject& aSO);
//! method to Create a SComponentIterator
Standard_EXPORT virtual SALOMEDSImpl_SComponentIterator NewComponentIterator();
//! method to Create a StudyBuilder
- Standard_EXPORT virtual Handle(SALOMEDSImpl_StudyBuilder) NewBuilder();
+ Standard_EXPORT virtual SALOMEDSImpl_StudyBuilder* NewBuilder();
//! method to get study name
- Standard_EXPORT virtual TCollection_AsciiString Name();
+ Standard_EXPORT virtual std::string Name();
//! method to set study name
- Standard_EXPORT virtual void Name(const TCollection_AsciiString& name);
+ Standard_EXPORT virtual void Name(const std::string& name);
//! method to get if study has been saved
Standard_EXPORT virtual bool IsSaved();
Standard_EXPORT virtual bool IsModified();
//! method to get URL of the study (idem GetPersistentReference)
- Standard_EXPORT virtual TCollection_AsciiString URL();
+ Standard_EXPORT virtual std::string URL();
//! method to set URL of the study
- Standard_EXPORT virtual void URL(const TCollection_AsciiString& url);
+ Standard_EXPORT virtual void URL(const std::string& url);
Standard_EXPORT virtual bool IsLocked();
Standard_EXPORT virtual void StudyId(int id);
- Standard_EXPORT virtual void UpdateIORLabelMap(const TCollection_AsciiString& anIOR, const TCollection_AsciiString& aLabel);
+ Standard_EXPORT virtual void UpdateIORLabelMap(const std::string& anIOR, const std::string& aLabel);
- Standard_EXPORT virtual Handle(TColStd_HSequenceOfTransient) FindDependances(const Handle(SALOMEDSImpl_SObject)& anObject);
+ Standard_EXPORT virtual std::vector<SALOMEDSImpl_SObject> FindDependances(const SALOMEDSImpl_SObject& anObject);
- Standard_EXPORT virtual Handle(SALOMEDSImpl_AttributeStudyProperties) GetProperties();
+ Standard_EXPORT virtual SALOMEDSImpl_AttributeStudyProperties* GetProperties();
- Standard_EXPORT virtual TCollection_AsciiString GetLastModificationDate();
+ Standard_EXPORT virtual std::string GetLastModificationDate();
- Standard_EXPORT virtual Handle(TColStd_HSequenceOfAsciiString) GetModificationsDate();
+ Standard_EXPORT virtual std::vector<std::string> GetModificationsDate();
- Standard_EXPORT virtual Handle(SALOMEDSImpl_UseCaseBuilder) GetUseCaseBuilder();
+ Standard_EXPORT virtual SALOMEDSImpl_UseCaseBuilder* GetUseCaseBuilder();
Standard_EXPORT virtual void Close();
Standard_EXPORT void EnableUseCaseAutoFilling(bool isEnabled);
- // postponed destroying of object functionality
- Standard_EXPORT virtual void AddPostponed(const TCollection_AsciiString& theIOR);
-
- Standard_EXPORT virtual void AddCreatedPostponed(const TCollection_AsciiString& theIOR);
-
- Standard_EXPORT virtual Handle(TColStd_HSequenceOfAsciiString) RemovePostponed(const int theUndoLimit);
- // removes postponed IORs of old transaction
- // if theUndoLimit==0, removes all
- Standard_EXPORT virtual void UndoPostponed(const int theWay); // theWay = 1: resurrect objects,
- // theWay = -1: get back to the list of postponed
-
-
- Standard_EXPORT virtual TCollection_AsciiString GetErrorCode() { return _errorCode; }
+ Standard_EXPORT virtual std::string GetErrorCode() { return _errorCode; }
Standard_EXPORT virtual bool IsError() { return _errorCode != ""; }
- Standard_EXPORT virtual Handle(SALOMEDSImpl_SComponent) GetSComponent(const TCollection_AsciiString& theEntry);
- Standard_EXPORT virtual Handle(SALOMEDSImpl_SComponent) GetSComponent(const TDF_Label& theLabel);
- Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) GetSObject(const TCollection_AsciiString& theEntry);
- Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) GetSObject(const TDF_Label& theEntryLabel);
- Standard_EXPORT virtual Handle(TDF_Attribute) GetAttribute(const TCollection_AsciiString& theEntry,
- const TCollection_AsciiString& theType);
+ Standard_EXPORT virtual SALOMEDSImpl_SComponent GetSComponent(const std::string& theEntry);
+ Standard_EXPORT virtual SALOMEDSImpl_SComponent GetSComponent(const DF_Label& theLabel);
+ Standard_EXPORT virtual SALOMEDSImpl_SObject GetSObject(const std::string& theEntry);
+ Standard_EXPORT virtual SALOMEDSImpl_SObject GetSObject(const DF_Label& theEntryLabel);
+ Standard_EXPORT virtual DF_Attribute* GetAttribute(const std::string& theEntry,
+ const std::string& theType);
Standard_EXPORT virtual bool HasCurrentContext() { return !_current.IsNull(); }
- Standard_EXPORT virtual bool DumpStudy(const TCollection_AsciiString& thePath,
- const TCollection_AsciiString& theBaseName,
+ Standard_EXPORT virtual bool DumpStudy(const std::string& thePath,
+ const std::string& theBaseName,
bool isPublished,
SALOMEDSImpl_DriverFactory* theFactory);
- Standard_EXPORT static TCollection_AsciiString GetDumpStudyComment(const char* theComponentName = 0);
+ Standard_EXPORT static std::string GetDumpStudyComment(const char* theComponentName = 0);
- Standard_EXPORT virtual Handle(TDocStd_Document) GetDocument() { return _doc; }
+ Standard_EXPORT virtual DF_Document* GetDocument() { return _doc; }
//The method dump creates a txt file that contain a dump of the study, for debug use
- Standard_EXPORT void dump(const TCollection_AsciiString& theFileName);
+ Standard_EXPORT void dump(const std::string& theFileName);
//This method marks the study as being modified
Standard_EXPORT void Modify();
- Standard_EXPORT Handle(SALOMEDSImpl_AttributeParameter) GetCommonParameters(const char* theID, int theSavePoint);
+ Standard_EXPORT SALOMEDSImpl_AttributeParameter* GetCommonParameters(const char* theID, int theSavePoint);
- Standard_EXPORT Handle(SALOMEDSImpl_AttributeParameter) GetModuleParameters(const char* theID,
+ Standard_EXPORT SALOMEDSImpl_AttributeParameter* GetModuleParameters(const char* theID,
const char* theModuleName,
int theSavePoint);
Standard_EXPORT void UnLockStudy(const char* theLockerID);
//Returns an ID of the study locker
- Standard_EXPORT Handle(TColStd_HSequenceOfAsciiString) GetLockerID();
+ Standard_EXPORT std::vector<std::string> GetLockerID();
//Returns a callback
- Standard_EXPORT Handle(SALOMEDSImpl_Callback) GetCallback() { return _cb; }
+ Standard_EXPORT SALOMEDSImpl_Callback* GetCallback() { return _cb; }
+ //Returns a list of IOR's stored in the study
+ Standard_EXPORT std::vector<std::string> GetIORs();
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_Study )
friend class SALOMEDSImpl_StudyManager;
friend class SALOMEDSImpl_GenericAttribute;
#include "SALOMEDSImpl_Attributes.hxx"
-
-using namespace std;
-
#include "SALOMEDSImpl_Study.hxx"
#include "SALOMEDSImpl_StudyBuilder.hxx"
#include "SALOMEDSImpl_SObject.hxx"
#include "SALOMEDSImpl_SComponent.hxx"
#include "SALOMEDSImpl_Tool.hxx"
+#include "SALOMEDSImpl_ChildNodeIterator.hxx"
-#include <SALOMEDSImpl_ChildNodeIterator.hxx>
-
-#include <TDF_ChildIterator.hxx>
-#include <TDF_Label.hxx>
-#include <TDF_Tool.hxx>
-#include <TDF_Data.hxx>
-#include <TDF_ListIteratorOfAttributeList.hxx>
-
-#include <OSD_Path.hxx>
+#include "DF_ChildIterator.hxx"
+#include "DF_Label.hxx"
#include <HDFOI.hxx>
#include <stdlib.h>
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_StudyBuilder, MMgt_TShared )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_StudyBuilder, MMgt_TShared )
+using namespace std;
#define USE_CASE_LABEL_TAG 2
#define DIRECTORYID 16661
#define FILELOCALID 26662
-static void Translate_persistentID_to_IOR(TDF_Label& Lab, SALOMEDSImpl_Driver* driver, bool isMultiFile, bool isASCII);
+static void Translate_persistentID_to_IOR(DF_Label& Lab, SALOMEDSImpl_Driver* driver, bool isMultiFile, bool isASCII);
//============================================================================
/*! Function : constructor
* Purpose :
*/
//============================================================================
-SALOMEDSImpl_StudyBuilder::SALOMEDSImpl_StudyBuilder(const Handle(Standard_Transient)& theOwner)
+SALOMEDSImpl_StudyBuilder::SALOMEDSImpl_StudyBuilder(const SALOMEDSImpl_Study* theOwner)
{
_errorCode = "";
- _study = theOwner;
- _doc = Handle(SALOMEDSImpl_Study)::DownCast(theOwner)->GetDocument();
+ _study = (SALOMEDSImpl_Study*)theOwner;
+ _doc = _study->GetDocument();
}
//============================================================================
* Purpose : Create a new component (Scomponent)
*/
//============================================================================
-Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_StudyBuilder::NewComponent(const TCollection_AsciiString& DataType)
+SALOMEDSImpl_SComponent SALOMEDSImpl_StudyBuilder::NewComponent(const string& DataType)
{
_errorCode = "";
CheckLocked();
- if(DataType.Length() == 0) return 0;
+ SALOMEDSImpl_SComponent sco;
+
+ if(DataType.size() == 0) return sco;
//Always create component under main label.
- TDF_Label L = _doc->Main();
+ DF_Label L = _doc->Main();
int imax = 0;
- for (TDF_ChildIterator it(L); it.More(); it.Next()) {
+ for (DF_ChildIterator it(L); it.More(); it.Next()) {
if (it.Value().Tag() > imax)
imax = it.Value().Tag();
}
imax++;
- TDF_Label NL = L.FindChild(imax);
+ DF_Label NL = L.FindChild(imax);
SALOMEDSImpl_AttributeComment::Set(NL, DataType);
- Handle(SALOMEDSImpl_SComponent) so = Handle(SALOMEDSImpl_Study)::DownCast(_study)->GetSComponent (NL);
+ SALOMEDSImpl_SComponent so = _study->GetSComponent (NL);
- if(!_callbackOnAdd.IsNull()) _callbackOnAdd->OnAddSObject(so);
+ if(_callbackOnAdd) _callbackOnAdd->OnAddSObject(so);
- _doc->Modify();
+ _doc->SetModified(true);
return so;
}
* Purpose : Add IOR attribute of a Scomponent
*/
//============================================================================
-bool SALOMEDSImpl_StudyBuilder::DefineComponentInstance(const Handle(SALOMEDSImpl_SComponent)& aComponent,
- const TCollection_AsciiString& IOR)
+bool SALOMEDSImpl_StudyBuilder::DefineComponentInstance(const SALOMEDSImpl_SComponent& aComponent,
+ const string& IOR)
{
_errorCode = "";
CheckLocked();
- if(aComponent.IsNull() || IOR.IsEmpty()) {
+ if(!aComponent || IOR.empty()) {
_errorCode = "Invalid arguments";
return false;
}
//add IOR definition
- SALOMEDSImpl_AttributeIOR::Set(aComponent->GetLabel(), IOR);
-
- //_doc->Modify();
+ SALOMEDSImpl_AttributeIOR::Set(aComponent.GetLabel(), IOR);
return true;
}
* Purpose : Delete a Scomponent
*/
//============================================================================
-bool SALOMEDSImpl_StudyBuilder::RemoveComponent(const Handle(SALOMEDSImpl_SComponent)& aComponent)
+bool SALOMEDSImpl_StudyBuilder::RemoveComponent(const SALOMEDSImpl_SComponent& aComponent)
{
_errorCode = "";
CheckLocked();
* Purpose : Create a new SObject
*/
//============================================================================
-Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_StudyBuilder::NewObject(const Handle(SALOMEDSImpl_SObject)& theFatherObject)
+SALOMEDSImpl_SObject SALOMEDSImpl_StudyBuilder::NewObject(const SALOMEDSImpl_SObject& theFatherObject)
{
_errorCode = "";
CheckLocked();
//Find label of father
- TDF_Label Lab = theFatherObject->GetLabel();
+ DF_Label Lab = theFatherObject.GetLabel();
//Create a new label
int imax = 0;
- for (TDF_ChildIterator it(Lab); it.More(); it.Next()) {
+ for (DF_ChildIterator it(Lab); it.More(); it.Next()) {
if (it.Value().Tag() > imax)
imax = it.Value().Tag();
}
imax++;
- TDF_Label NewLab = Lab.FindChild(imax);
+ DF_Label NewLab = Lab.FindChild(imax);
- Handle(SALOMEDSImpl_SObject) so = Handle(SALOMEDSImpl_Study)::DownCast(_study)->GetSObject(NewLab);
- if(!_callbackOnAdd.IsNull()) _callbackOnAdd->OnAddSObject(so);
+ SALOMEDSImpl_SObject so = _study->GetSObject(NewLab);
+ if(_callbackOnAdd) _callbackOnAdd->OnAddSObject(so);
- _doc->Modify();
+ _doc->SetModified(true);
return so;
}
* Purpose :
*/
//============================================================================
-Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_StudyBuilder::NewObjectToTag(const Handle(SALOMEDSImpl_SObject)& theFatherObject,
- const int theTag)
+SALOMEDSImpl_SObject SALOMEDSImpl_StudyBuilder::NewObjectToTag(const SALOMEDSImpl_SObject& theFatherObject,
+ const int theTag)
{
_errorCode = "";
CheckLocked();
//Find label of father
- TDF_Label Lab = theFatherObject->GetLabel();
+ DF_Label Lab = theFatherObject.GetLabel();
//Create or find label
- TDF_Label NewLab = Lab.FindChild(theTag, 1);
+ DF_Label NewLab = Lab.FindChild(theTag, 1);
- Handle(SALOMEDSImpl_SObject) so = Handle(SALOMEDSImpl_Study)::DownCast(_study)->GetSObject(NewLab);
+ SALOMEDSImpl_SObject so = _study->GetSObject(NewLab);
- if(!_callbackOnAdd.IsNull()) _callbackOnAdd->OnAddSObject(so);
+ if(_callbackOnAdd) _callbackOnAdd->OnAddSObject(so);
- _doc->Modify();
+ _doc->SetModified(true);
return so;
}
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_StudyBuilder::RemoveObject(const Handle(SALOMEDSImpl_SObject)& anObject)
+bool SALOMEDSImpl_StudyBuilder::RemoveObject(const SALOMEDSImpl_SObject& anObject)
{
_errorCode = "";
CheckLocked();
- if(anObject.IsNull()) {
+ if(!anObject) {
_errorCode = "Null object";
return false;
}
- if(!_callbackOnRemove.IsNull()) _callbackOnRemove->OnRemoveSObject(anObject);
+ if(_callbackOnRemove) _callbackOnRemove->OnRemoveSObject(anObject);
- TDF_Label Lab = anObject->GetLabel();
+ DF_Label Lab = anObject.GetLabel();
- Handle(SALOMEDSImpl_AttributeReference) aReference;
- if (Lab.FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), aReference)) {
- Handle(SALOMEDSImpl_AttributeTarget) aTarget;
- if (aReference->Get().FindAttribute(SALOMEDSImpl_AttributeTarget::GetID(),aTarget))
+ SALOMEDSImpl_AttributeReference* aReference = NULL;
+ if ((aReference=(SALOMEDSImpl_AttributeReference*)Lab.FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) {
+ SALOMEDSImpl_AttributeTarget* aTarget = NULL;
+ if ((aTarget=(SALOMEDSImpl_AttributeTarget*)aReference->Get().FindAttribute(SALOMEDSImpl_AttributeTarget::GetID())))
aTarget->Remove(SALOMEDSImpl_Study::SObject(Lab));
}
- Handle(SALOMEDSImpl_AttributeIOR) anAttr; // postponed removing of CORBA objects
- if (Lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(), anAttr))
- SALOMEDSImpl_Study::GetStudy(_doc->Main())->AddPostponed(TCollection_AsciiString(anAttr->Value()).ToCString());
+ SALOMEDSImpl_AttributeIOR* anAttr = NULL; //Remove from IORLabel map
+ if ((anAttr=(SALOMEDSImpl_AttributeIOR*)Lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) {
+ }
Lab.ForgetAllAttributes();
- _doc->Modify();
+ _doc->SetModified(true);
return true;
}
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_StudyBuilder::RemoveObjectWithChildren(const Handle(SALOMEDSImpl_SObject)& anObject)
+bool SALOMEDSImpl_StudyBuilder::RemoveObjectWithChildren(const SALOMEDSImpl_SObject& anObject)
{
_errorCode = "";
CheckLocked();
- if(anObject.IsNull()) {
+ if(!anObject) {
_errorCode = "Null object";
return false;
}
- if(!_callbackOnRemove.IsNull()) _callbackOnRemove->OnRemoveSObject(anObject);
+ if(_callbackOnRemove) _callbackOnRemove->OnRemoveSObject(anObject);
- TDF_Label Lab = anObject->GetLabel();
+ DF_Label Lab = anObject.GetLabel();
- Handle(SALOMEDSImpl_AttributeReference) aReference;
- if (Lab.FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), aReference)) {
- Handle(SALOMEDSImpl_AttributeTarget) aTarget;
- if (aReference->Get().FindAttribute(SALOMEDSImpl_AttributeTarget::GetID(),aTarget))
+ SALOMEDSImpl_AttributeReference* aReference = NULL;
+ if ((aReference=(SALOMEDSImpl_AttributeReference*)Lab.FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) {
+ SALOMEDSImpl_AttributeTarget* aTarget = NULL;
+ if ((aTarget=(SALOMEDSImpl_AttributeTarget*)aReference->Get().FindAttribute(SALOMEDSImpl_AttributeTarget::GetID())))
aTarget->Remove(SALOMEDSImpl_Study::SObject(Lab));
}
- Handle(SALOMEDSImpl_AttributeIOR) anAttr; // postponed removing of CORBA objects
- if (Lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(), anAttr))
- SALOMEDSImpl_Study::GetStudy(_doc->Main())->AddPostponed(TCollection_AsciiString(anAttr->Value()).ToCString());
+ SALOMEDSImpl_AttributeIOR* anAttr = NULL; //Remove from IORLabel map
+ if ((anAttr=(SALOMEDSImpl_AttributeIOR*)Lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) {
+ }
- TDF_ChildIterator it(Lab, Standard_True);
+ DF_ChildIterator it(Lab, true);
for(;it.More();it.Next()) {
- TDF_Label aLabel = it.Value();
- if (aLabel.FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), aReference)) {
- Handle(SALOMEDSImpl_AttributeTarget) aTarget;
- if (aReference->Get().FindAttribute(SALOMEDSImpl_AttributeTarget::GetID(),aTarget))
+ DF_Label aLabel = it.Value();
+ if ((aReference=(SALOMEDSImpl_AttributeReference*)aLabel.FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) {
+ SALOMEDSImpl_AttributeTarget* aTarget = NULL;
+ if ((aTarget=(SALOMEDSImpl_AttributeTarget*)aReference->Get().FindAttribute(SALOMEDSImpl_AttributeTarget::GetID())))
aTarget->Remove(SALOMEDSImpl_Study::SObject(aLabel));
}
- Handle(SALOMEDSImpl_AttributeIOR) anAttr; // postponed removing of CORBA objects
- if (aLabel.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(), anAttr))
- SALOMEDSImpl_Study::GetStudy(_doc->Main())->AddPostponed(TCollection_AsciiString(anAttr->Value()).ToCString());
+ SALOMEDSImpl_AttributeIOR* anAttr = NULL; //Remove from IORLabel map
+ if ((anAttr=(SALOMEDSImpl_AttributeIOR*)aLabel.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) {
+ }
}
- Lab.ForgetAllAttributes(Standard_True);
+ Lab.ForgetAllAttributes(true);
- _doc->Modify();
+ _doc->SetModified(true);
return true;
}
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_StudyBuilder::LoadWith(const Handle(SALOMEDSImpl_SComponent)& anSCO,
+bool SALOMEDSImpl_StudyBuilder::LoadWith(const SALOMEDSImpl_SComponent& anSCO,
SALOMEDSImpl_Driver* aDriver)
{
_errorCode = "";
- TDF_Label Lab = anSCO->GetLabel();
- Handle(SALOMEDSImpl_AttributePersistentRef) Att;
+ DF_Label Lab = anSCO.GetLabel();
+ SALOMEDSImpl_AttributePersistentRef* Att = NULL;
//Find the current Url of the study
- if (_doc->Main().FindAttribute(SALOMEDSImpl_AttributePersistentRef::GetID(),Att)) {
- int aLocked = anSCO->GetStudy()->GetProperties()->IsLocked();
- if (aLocked) anSCO->GetStudy()->GetProperties()->SetLocked(false);
+ if ((Att=(SALOMEDSImpl_AttributePersistentRef*)_doc->Main().FindAttribute(SALOMEDSImpl_AttributePersistentRef::GetID()))) {
+ int aLocked = _study->GetProperties()->IsLocked();
+ if (aLocked) _study->GetProperties()->SetLocked(false);
- TCollection_ExtendedString Res(Att->Value());
- TCollection_AsciiString aHDFPath(Res);
+ std::string Res(Att->Value());
+ string aHDFPath(Res);
- Handle(SALOMEDSImpl_AttributeComment) type;
- TCollection_ExtendedString DataType;
- if (Lab.FindAttribute(SALOMEDSImpl_AttributeComment::GetID(),type))
+ SALOMEDSImpl_AttributeComment* type = NULL;
+ std::string DataType;
+ if ((type=(SALOMEDSImpl_AttributeComment*)Lab.FindAttribute(SALOMEDSImpl_AttributeComment::GetID())))
DataType = type->Value();
// associate the driver to the SComponent
}
// mpv 06.03.2003: SAL1927 - if component data if already loaded, it is not necessary to do it again
- Handle(SALOMEDSImpl_AttributeIOR) attrIOR;
- if (Lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(), attrIOR)) {
- if (aLocked) anSCO->GetStudy()->GetProperties()->SetLocked(true);
+ SALOMEDSImpl_AttributeIOR* attrIOR = NULL;
+ if ((attrIOR=(SALOMEDSImpl_AttributeIOR*)Lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) {
+ if (aLocked) _study->GetProperties()->SetLocked(true);
return true;
}
DefineComponentInstance (anSCO, aDriver->GetIOR());
- TCollection_AsciiString aHDFUrl;
+ string aHDFUrl;
bool isASCII = false;
- if (HDFascii::isASCII(aHDFPath.ToCString())) {
+ if (HDFascii::isASCII(aHDFPath.c_str())) {
isASCII = true;
- aHDFUrl = HDFascii::ConvertFromASCIIToHDF(aHDFPath.ToCString());
+ aHDFUrl = HDFascii::ConvertFromASCIIToHDF(aHDFPath.c_str());
aHDFUrl += "hdf_from_ascii.hdf";
} else {
aHDFUrl = aHDFPath;
}
//Open the Study HDF file
- HDFfile *hdf_file = new HDFfile(aHDFUrl.ToCString());
+ HDFfile *hdf_file = new HDFfile((char*)aHDFUrl.c_str());
- char aMultifileState[2] = "S"; // default: single
- char ASCIIfileState[2] = "B"; // default: binary
+ char aMultifileState[2];
+ char ASCIIfileState[2];
try {
- TCollection_AsciiString scoid = anSCO->GetID();
+ string scoid = anSCO.GetID();
hdf_file->OpenOnDisk(HDF_RDONLY);
HDFgroup *hdf_group = new HDFgroup("DATACOMPONENT",hdf_file);
hdf_group->OpenOnDisk();
- HDFgroup *hdf_sco_group = new HDFgroup(scoid.ToCString(), hdf_group);
+ HDFgroup *hdf_sco_group = new HDFgroup((char*)scoid.c_str(), hdf_group);
hdf_sco_group->OpenOnDisk();
unsigned char* aStreamFile = NULL;
hdf_dataset->ReadFromDisk(aStreamFile);
hdf_dataset->CloseOnDisk();
hdf_dataset = 0;
- }
- else
+ } else
aStreamFile = NULL;
- if (hdf_sco_group->ExistInternalObject("MULTIFILE_STATE")) {
- HDFdataset *multifile_hdf_dataset = new HDFdataset("MULTIFILE_STATE", hdf_sco_group);
- multifile_hdf_dataset->OpenOnDisk();
- multifile_hdf_dataset->ReadFromDisk(aMultifileState);
+ HDFdataset *multifile_hdf_dataset = new HDFdataset("MULTIFILE_STATE", hdf_sco_group);
+ multifile_hdf_dataset->OpenOnDisk();
+ multifile_hdf_dataset->ReadFromDisk(aMultifileState);
- multifile_hdf_dataset->CloseOnDisk();
- multifile_hdf_dataset = 0;
- }
+ HDFdataset *ascii_hdf_dataset = new HDFdataset("ASCII_STATE", hdf_sco_group);
+ ascii_hdf_dataset->OpenOnDisk();
+ ascii_hdf_dataset->ReadFromDisk(ASCIIfileState);
- if (hdf_sco_group->ExistInternalObject("ASCII_STATE")) {
- HDFdataset *ascii_hdf_dataset = new HDFdataset("ASCII_STATE", hdf_sco_group);
- ascii_hdf_dataset->OpenOnDisk();
- ascii_hdf_dataset->ReadFromDisk(ASCIIfileState);
-
- ascii_hdf_dataset->CloseOnDisk();
- ascii_hdf_dataset = 0;
- }
-
- // set path without file name from URL
- //int aFileNameSize = Res.Length();
- //char* aDir = new char[aFileNameSize];
- //memcpy(aDir, TCollection_AsciiString(Res).ToCString(), aFileNameSize);
- //for(int aCounter = aFileNameSize-1; aCounter>=0; aCounter--)
- //if (aDir[aCounter] == '/') {
- // aDir[aCounter+1] = 0;
- // break;
- //}
- // Above code was working wrong for paths without '/' inside.
- TCollection_AsciiString aDir = SALOMEDSImpl_Tool::GetDirFromPath(Res);
+ string aDir = SALOMEDSImpl_Tool::GetDirFromPath(Res);
bool aResult = (ASCIIfileState[0]=='A')?
- aDriver->LoadASCII(anSCO, aStreamFile, aStreamSize, aDir.ToCString(), aMultifileState[0]=='M'):
- aDriver->Load(anSCO, aStreamFile, aStreamSize, aDir.ToCString(), aMultifileState[0]=='M');
+ aDriver->LoadASCII(anSCO, aStreamFile, aStreamSize, aDir.c_str(), aMultifileState[0]=='M'):
+ aDriver->Load(anSCO, aStreamFile, aStreamSize, aDir.c_str(), aMultifileState[0]=='M');
if(aStreamFile != NULL) delete []aStreamFile;
//if(aDir != NULL) delete []aDir;
+ multifile_hdf_dataset->CloseOnDisk();
+ multifile_hdf_dataset = 0;
+ ascii_hdf_dataset->CloseOnDisk();
+ ascii_hdf_dataset = 0;
+
hdf_sco_group->CloseOnDisk();
hdf_sco_group = 0;
hdf_group->CloseOnDisk();
delete hdf_file;
if (isASCII) {
- Handle(TColStd_HSequenceOfAsciiString) aFilesToRemove = new TColStd_HSequenceOfAsciiString;
- aFilesToRemove->Append("hdf_from_ascii.hdf");
+ vector<string> aFilesToRemove;
+ aFilesToRemove.push_back("hdf_from_ascii.hdf");
SALOMEDSImpl_Tool::RemoveTemporaryFiles(SALOMEDSImpl_Tool::GetDirFromPath(aHDFUrl),
aFilesToRemove, true);
}
delete hdf_file;
if (isASCII) {
- Handle(TColStd_HSequenceOfAsciiString) aFilesToRemove = new TColStd_HSequenceOfAsciiString;
- aFilesToRemove->Append(aHDFUrl);
- SALOMEDSImpl_Tool::RemoveTemporaryFiles(SALOMEDSImpl_Tool::GetDirFromPath(aHDFUrl),
- aFilesToRemove, true);
+ vector<string> aFilesToRemove;
+ aFilesToRemove.push_back(aHDFUrl);
+ SALOMEDSImpl_Tool::RemoveTemporaryFiles(SALOMEDSImpl_Tool::GetDirFromPath(aHDFUrl), aFilesToRemove, true);
}
- if (aLocked) anSCO->GetStudy()->GetProperties()->SetLocked(true);
+ if (aLocked) _study->GetProperties()->SetLocked(true);
_errorCode = "No persistent file";
return false;
}
return false;
}
- if (aLocked) anSCO->GetStudy()->GetProperties()->SetLocked(true);
+ if (aLocked) _study->GetProperties()->SetLocked(true);
} else {
_errorCode = "No persistent file";
}
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_StudyBuilder::Load(const Handle(SALOMEDSImpl_SObject)& sco)
+bool SALOMEDSImpl_StudyBuilder::Load(const SALOMEDSImpl_SObject& sco)
{
_errorCode = "Not implemented";
return false;
* existing one
*/
//============================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_StudyBuilder::FindOrCreateAttribute(const Handle(SALOMEDSImpl_SObject)& anObject,
- const TCollection_AsciiString& aTypeOfAttribute)
+DF_Attribute* SALOMEDSImpl_StudyBuilder::FindOrCreateAttribute(const SALOMEDSImpl_SObject& anObject,
+ const string& aTypeOfAttribute)
{
_errorCode = "";
- if(anObject.IsNull()) {
+ if(!anObject) {
_errorCode = "Invalid arguments";
return NULL;
}
- TDF_Label Lab = anObject->GetLabel();
+ DF_Label Lab = anObject.GetLabel();
if(Lab.IsNull()) {
_errorCode = "Null label";
return NULL;
}
- _doc->Modify();
+ _doc->SetModified(true);
//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 ) {
+ if (strncmp(aTypeOfAttribute.c_str(), "AttributeTreeNode",17) == 0 ) {
- Standard_GUID aTreeNodeGUID;
- if (strcmp(aTypeOfAttribute.ToCString(), "AttributeTreeNode") == 0) {
+ string aTreeNodeGUID;
+ if (strcmp(aTypeOfAttribute.c_str(), "AttributeTreeNode") == 0) {
aTreeNodeGUID = SALOMEDSImpl_AttributeTreeNode::GetDefaultTreeID();
} else {
- char* aGUIDString = new char[41];
- char* aType = (char*)aTypeOfAttribute.ToCString();
- sprintf(aGUIDString, &(aType[17]));
- if(!Standard_GUID::CheckGUIDFormat(aGUIDString)) {
- delete(aGUIDString);
- return NULL;
- }
- aTreeNodeGUID = Standard_GUID(aGUIDString); // create tree node GUID by name
- delete(aGUIDString);
+ aTreeNodeGUID = aTypeOfAttribute.substr(21, aTypeOfAttribute.size()); // create tree node GUID by name
}
- Handle(SALOMEDSImpl_AttributeTreeNode) anAttr;
- if (!Lab.FindAttribute(aTreeNodeGUID, anAttr)) {
+ SALOMEDSImpl_AttributeTreeNode* anAttr = NULL;
+ if (!(anAttr=(SALOMEDSImpl_AttributeTreeNode*)Lab.FindAttribute(aTreeNodeGUID))) {
CheckLocked();
anAttr = SALOMEDSImpl_AttributeTreeNode::Set(Lab, aTreeNodeGUID);
}
return anAttr;
}
- if (strncmp(aTypeOfAttribute.ToCString(), "AttributeUserID",15) == 0 ) {
- Standard_GUID aUserGUID;
- if (strcmp(aTypeOfAttribute.ToCString(), "AttributeUserID") == 0) {
+ if (strncmp(aTypeOfAttribute.c_str(), "AttributeUserID",15) == 0 ) {
+ std::string aUserGUID;
+ if (strcmp(aTypeOfAttribute.c_str(), "AttributeUserID") == 0) {
aUserGUID = SALOMEDSImpl_AttributeUserID::DefaultID();
} else {
- char* aGUIDString = new char[41];
- char* aType = (char*)aTypeOfAttribute.ToCString();
- sprintf(aGUIDString, &(aType[15]));
- if(!Standard_GUID::CheckGUIDFormat(aGUIDString)) {
- delete(aGUIDString);
- return NULL;
- }
- aUserGUID = Standard_GUID(aGUIDString); // create tree node GUID by name
- delete(aGUIDString);
+ aUserGUID = aTypeOfAttribute.substr(15, aTypeOfAttribute.size()); // create tree node GUID by name
}
- Handle(SALOMEDSImpl_AttributeUserID) anAttr;
- if (!Lab.FindAttribute(SALOMEDSImpl_AttributeUserID::DefaultID(), anAttr)) {
+ SALOMEDSImpl_AttributeUserID* anAttr = NULL;
+ if (!(anAttr=(SALOMEDSImpl_AttributeUserID*)Lab.FindAttribute(aUserGUID))) {
CheckLocked();
anAttr = SALOMEDSImpl_AttributeUserID::Set(Lab, aUserGUID);
}
*/
//============================================================================
-bool SALOMEDSImpl_StudyBuilder::FindAttribute(const Handle(SALOMEDSImpl_SObject)& anObject,
- Handle(TDF_Attribute)& anAttribute,
- const TCollection_AsciiString& aTypeOfAttribute)
+bool SALOMEDSImpl_StudyBuilder::FindAttribute(const SALOMEDSImpl_SObject& anObject,
+ DF_Attribute*& anAttribute,
+ const string& aTypeOfAttribute)
{
_errorCode = "";
- if(anObject.IsNull()) {
+ if(!anObject) {
_errorCode = "Invalid arguments";
return false;
}
- TDF_Label Lab = anObject->GetLabel();
- if (Lab.FindAttribute(SALOMEDSImpl_SObject::GetGUID(aTypeOfAttribute), anAttribute)) {
+ DF_Label Lab = anObject.GetLabel();
+ if ((anAttribute=Lab.FindAttribute(SALOMEDSImpl_SObject::GetGUID(aTypeOfAttribute)))) {
// commented out because NO MODIFICATION is done to attributes when calling FindAttribute()
// _doc->Modify();
- return Standard_True;
+ return true;
}
- return Standard_False;
+ return false;
}
//============================================================================
*/
//============================================================================
-bool SALOMEDSImpl_StudyBuilder::RemoveAttribute(const Handle(SALOMEDSImpl_SObject)& anObject,
- const TCollection_AsciiString& aTypeOfAttribute)
+bool SALOMEDSImpl_StudyBuilder::RemoveAttribute(const SALOMEDSImpl_SObject& anObject,
+ const string& aTypeOfAttribute)
{
_errorCode = "";
CheckLocked();
- if(anObject.IsNull()) {
+ if(!anObject) {
_errorCode = "Invalid arguments";
return false;
}
- TDF_Label Lab = anObject->GetLabel();
+ DF_Label Lab = anObject.GetLabel();
- if (aTypeOfAttribute == "AttributeIOR") { // postponed removing of CORBA objects
- Handle(SALOMEDSImpl_AttributeIOR) anAttr;
- if (Lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(), anAttr))
- SALOMEDSImpl_Study::GetStudy(_doc->Main())->AddPostponed(anAttr->Value());
+ if (aTypeOfAttribute == string("AttributeIOR")) { // Remove from IORLabel map
+ SALOMEDSImpl_AttributeIOR* anAttr = NULL;
+ if ((anAttr=(SALOMEDSImpl_AttributeIOR*)Lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) {
+ }
}
Lab.ForgetAttribute (SALOMEDSImpl_SObject::GetGUID(aTypeOfAttribute));
- _doc->Modify();
+ _doc->SetModified(true);
return true;
}
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_StudyBuilder::Addreference(const Handle(SALOMEDSImpl_SObject)& me,
- const Handle(SALOMEDSImpl_SObject)& theReferencedObject)
+bool SALOMEDSImpl_StudyBuilder::Addreference(const SALOMEDSImpl_SObject& me,
+ const SALOMEDSImpl_SObject& theReferencedObject)
{
_errorCode = "";
- if(me.IsNull() || theReferencedObject.IsNull()) {
+ if(!me || !theReferencedObject) {
_errorCode = "Invalid arguments";
return false;
}
CheckLocked();
- TDF_Label Lab = me->GetLabel();
- TDF_Label RefLab = theReferencedObject->GetLabel();
+ DF_Label Lab = me.GetLabel();
+ DF_Label RefLab = theReferencedObject.GetLabel();
SALOMEDSImpl_AttributeReference::Set(Lab,RefLab);
SALOMEDSImpl_AttributeTarget::Set(RefLab)->Add(SALOMEDSImpl_Study::SObject(Lab));
- if(!_callbackOnRemove.IsNull() && Lab.IsDescendant(_doc->Main())) _callbackOnRemove->OnRemoveSObject(me);
+ if(_callbackOnRemove && Lab.IsDescendant(_doc->Main())) _callbackOnRemove->OnRemoveSObject(me);
return true;
}
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_StudyBuilder::RemoveReference(const Handle(SALOMEDSImpl_SObject)& me)
+bool SALOMEDSImpl_StudyBuilder::RemoveReference(const SALOMEDSImpl_SObject& me)
{
_errorCode = "";
- Handle(SALOMEDSImpl_SObject) theReferencedObject;
- if(!me->ReferencedObject(theReferencedObject)) return false; //No reference is found
-
+ SALOMEDSImpl_SObject theReferencedObject;
+
+ if(!me.ReferencedObject(theReferencedObject)) return false; //No reference is found
+
CheckLocked();
- TDF_Label Lab = me->GetLabel();
-
- Lab.ForgetAttribute(SALOMEDSImpl_AttributeReference::GetID());
+ DF_Label Lab = me.GetLabel();
//SRN: 30 Aug, 2004 : fix from Ecole l'ete version
- TDF_Label RefLab = theReferencedObject->GetLabel();
+ DF_Label RefLab = theReferencedObject.GetLabel();
- Handle(SALOMEDSImpl_AttributeTarget) aTarget;
- if(RefLab.FindAttribute(SALOMEDSImpl_AttributeTarget::GetID(), aTarget))
+ SALOMEDSImpl_AttributeTarget* aTarget = NULL;
+ if((aTarget=(SALOMEDSImpl_AttributeTarget*)RefLab.FindAttribute(SALOMEDSImpl_AttributeTarget::GetID()))) {
aTarget->Remove(SALOMEDSImpl_Study::SObject(Lab));
+ }
- _doc->Modify();
+ Lab.ForgetAttribute(SALOMEDSImpl_AttributeReference::GetID());
+
+ _doc->SetModified(true);
return true;
}
* Purpose : adds a new directory with a path = thePath
*/
//============================================================================
-bool SALOMEDSImpl_StudyBuilder::AddDirectory(const TCollection_AsciiString& thePath)
+bool SALOMEDSImpl_StudyBuilder::AddDirectory(const string& thePath)
{
_errorCode = "";
CheckLocked();
- if(thePath.IsEmpty() || thePath == "") {
+ if(thePath.empty()) {
_errorCode = "Invalid path";
return false;
}
- TCollection_AsciiString aPath(thePath), aContext(""), aFatherPath;
- TDF_Label aLabel;
- Handle(SALOMEDSImpl_Study) aStudy = SALOMEDSImpl_Study::GetStudy(_doc->Main());
- Handle(SALOMEDSImpl_SObject) anObject;
+ string aPath(thePath), aContext(""), aFatherPath;
+ DF_Label aLabel;
+ SALOMEDSImpl_SObject anObject;
try {
- anObject = aStudy->FindObjectByPath(thePath); //Check if the directory already exists
+ anObject = _study->FindObjectByPath(thePath); //Check if the directory already exists
}
catch(...) { }
- if(!anObject.IsNull()) {
+ if(anObject) {
_errorCode = "StudyNameAlreadyUsed";
return false;
}
- if(aPath.Value(1) != '/') { //Relative path
- aPath.Prepend('/');
- aPath = aStudy->GetContext() + aPath;
+ if(aPath[0] != '/') { //Relative path
+ aPath.insert(aPath.begin(), '/');
+ aPath = _study->GetContext() + aPath;
}
- TCollection_AsciiString aToken = aPath.Token("/", 1);
- if(aToken.Length() == 0) aFatherPath = "/";
-
- int i = 1;
- while(aToken.Length() != 0) {
- if(aPath.Token("/", i+1).Length() > 0) {
+ vector<string> vs = SALOMEDSImpl_Tool::splitString(aPath, '/');
+ if(vs.size() == 1)
+ aFatherPath = "/";
+ else {
+ for(int i = 0, len = vs.size()-1; i<len; i++) {
aFatherPath += "/";
- aFatherPath += aToken;
+ aFatherPath += vs[i];
}
- aToken = aPath.Token("/", ++i);
}
- anObject.Nullify();
try {
- anObject = aStudy->FindObjectByPath(aFatherPath); //Check if the father directory exists
+ anObject = _study->FindObjectByPath(aFatherPath); //Check if the father directory exists
}
catch(...) { ; }
- if(anObject.IsNull()) {
+ if(!anObject) {
_errorCode = "StudyInvalidDirectory";
return false;
}
- Handle(SALOMEDSImpl_SObject) aNewObject = NewObject(anObject);
- aLabel = aNewObject->GetLabel();
+ SALOMEDSImpl_SObject aNewObject = NewObject(anObject);
+ aLabel = aNewObject.GetLabel();
if(aLabel.IsNull()) {
_errorCode = "StudyInvalidComponent";
return false;
}
- SALOMEDSImpl_AttributeName::Set(aLabel, aPath.Token("/", i-1));
+ SALOMEDSImpl_AttributeName::Set(aLabel, vs.back());
//Set LocalID attribute to identify the directory object
- Handle(SALOMEDSImpl_AttributeLocalID) aLocalID = SALOMEDSImpl_AttributeLocalID::Set(aLabel, DIRECTORYID);
+ SALOMEDSImpl_AttributeLocalID::Set(aLabel, DIRECTORYID);
- _doc->Modify();
+ _doc->SetModified(true);
return true;
}
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_StudyBuilder::SetGUID(const Handle(SALOMEDSImpl_SObject)& anObject,
- const TCollection_AsciiString& theGUID)
+bool SALOMEDSImpl_StudyBuilder::SetGUID(const SALOMEDSImpl_SObject& anObject,
+ const string& theGUID)
{
_errorCode = "";
CheckLocked();
- if(anObject.IsNull()) {
+ if(!anObject) {
_errorCode = "Invalid arguments";
return false;
}
- TDF_Label aLabel = anObject->GetLabel();
- SALOMEDSImpl_AttributeUserID::Set(aLabel, theGUID.ToCString());
+ DF_Label aLabel = anObject.GetLabel();
+ SALOMEDSImpl_AttributeUserID::Set(aLabel, theGUID);
- _doc->Modify();
+ _doc->SetModified(true);
return true;
}
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_StudyBuilder::IsGUID(const Handle(SALOMEDSImpl_SObject)& anObject,
- const TCollection_AsciiString& theGUID)
+bool SALOMEDSImpl_StudyBuilder::IsGUID(const SALOMEDSImpl_SObject& anObject,
+ const string& theGUID)
{
_errorCode = "";
- if(anObject.IsNull()) {
+ if(!anObject) {
_errorCode = "Invalid arguments";
return false;
}
- TDF_Label aLabel = anObject->GetLabel();
- return aLabel.IsAttribute(theGUID.ToCString());
+ DF_Label aLabel = anObject.GetLabel();
+ return aLabel.IsAttribute(theGUID);
}
void SALOMEDSImpl_StudyBuilder::NewCommand()
{
_errorCode = "";
+
// mpv: for SAL2114 - unset "lock changed" flag at the operation start
- Handle(SALOMEDSImpl_AttributeStudyProperties) anAttr;
- if (!_doc->Main().FindAttribute(SALOMEDSImpl_AttributeStudyProperties::GetID(), anAttr)) {
- anAttr = new SALOMEDSImpl_AttributeStudyProperties;
- _doc->Main().AddAttribute(anAttr);
- }
- anAttr->IsLockChanged(true);
-
- _doc->NewCommand();
+ _study->GetProperties()->IsLockChanged(true);
+
+ //Not implemented
}
//============================================================================
void SALOMEDSImpl_StudyBuilder::CommitCommand()
{
_errorCode = "";
- Handle(SALOMEDSImpl_AttributeStudyProperties) anAttr;
- if (!_doc->Main().FindAttribute(SALOMEDSImpl_AttributeStudyProperties::GetID(), anAttr)) {
- anAttr = new SALOMEDSImpl_AttributeStudyProperties;
- _doc->Main().AddAttribute(anAttr);
- }
+ SALOMEDSImpl_AttributeStudyProperties* anAttr = _study->GetProperties();
if (anAttr->IsLocked() && !anAttr->IsLockChanged(true)) {
- AbortCommand();
_errorCode = "LockProtection";
throw LockProtection("LockProtection");
} else {
- SALOMEDSImpl_Study::GetStudy(_doc->Main())->RemovePostponed(_doc->GetUndoLimit());
-
int aModif = anAttr->GetModified();
if (aModif < 0) aModif = 1000; // if user make undo and then - new transaction "modify" will never be zero
anAttr->SetModified(aModif+1);
- _doc->CommitCommand();
}
- _doc->Modify();
+
+ //Not implemented
+ _doc->SetModified(true);
}
//============================================================================
bool SALOMEDSImpl_StudyBuilder::HasOpenCommand()
{
_errorCode = "";
- return _doc->HasOpenCommand();
+
+ //Not implememnted
+ return false;
}
//============================================================================
void SALOMEDSImpl_StudyBuilder::AbortCommand()
{
_errorCode = "";
- SALOMEDSImpl_Study::GetStudy(_doc->Main())->UndoPostponed(0);
-
- _doc->AbortCommand();
+ //Not implemented
}
//============================================================================
//============================================================================
void SALOMEDSImpl_StudyBuilder::Undo()
{
+ //Not implemented
_errorCode = "";
- Handle(SALOMEDSImpl_AttributeStudyProperties) anAttr;
- if (!_doc->Main().FindAttribute(SALOMEDSImpl_AttributeStudyProperties::GetID(), anAttr)) {
- anAttr = new SALOMEDSImpl_AttributeStudyProperties;
- _doc->Main().AddAttribute(anAttr);
- }
+ SALOMEDSImpl_AttributeStudyProperties* anAttr = _study->GetProperties();
if (anAttr->IsLocked()) {
_errorCode = "LockProtection";
throw LockProtection("LockProtection");
} else {
- SALOMEDSImpl_Study::GetStudy(_doc->Main())->UndoPostponed(1);
- _doc->Undo();
anAttr->SetModified(anAttr->GetModified()-1);
}
- _doc->Modify();
+ _doc->SetModified(true);
}
//============================================================================
void SALOMEDSImpl_StudyBuilder::Redo()
{
_errorCode = "";
- Handle(SALOMEDSImpl_AttributeStudyProperties) anAttr;
- if (!_doc->Main().FindAttribute(SALOMEDSImpl_AttributeStudyProperties::GetID(), anAttr)) {
- anAttr = new SALOMEDSImpl_AttributeStudyProperties;
- _doc->Main().AddAttribute(anAttr);
- }
-
+ SALOMEDSImpl_AttributeStudyProperties* anAttr = _study->GetProperties();
if (anAttr->IsLocked()) {
_errorCode = "LockProtection";
throw LockProtection("LockProtection");
} else {
- _doc->Redo();
- SALOMEDSImpl_Study::GetStudy(_doc->Main())->UndoPostponed(-1);
anAttr->SetModified(anAttr->GetModified()+1);
}
-
- _doc->Modify();
+
+ //Not implemented
+
+ _doc->SetModified(true);
}
//============================================================================
bool SALOMEDSImpl_StudyBuilder::GetAvailableUndos()
{
_errorCode = "";
- return _doc->GetAvailableUndos();
+ return false;
}
//============================================================================
bool SALOMEDSImpl_StudyBuilder::GetAvailableRedos()
{
_errorCode = "";
- return _doc->GetAvailableRedos();
+ return false;
}
//============================================================================
int SALOMEDSImpl_StudyBuilder::UndoLimit()
{
_errorCode = "";
- return _doc->GetUndoLimit();
+ return 1;
}
//============================================================================
{
_errorCode = "";
CheckLocked();
- _doc->SetUndoLimit (n);
+ //Not implemented
}
//============================================================================
* Purpose :
*/
//============================================================================
-Handle(SALOMEDSImpl_Callback)
-SALOMEDSImpl_StudyBuilder::SetOnAddSObject(const Handle(SALOMEDSImpl_Callback)& theCallback)
+SALOMEDSImpl_Callback*
+SALOMEDSImpl_StudyBuilder::SetOnAddSObject(const SALOMEDSImpl_Callback* theCallback)
{
_errorCode = "";
- Handle(SALOMEDSImpl_Callback) aRet = _callbackOnAdd;
- _callbackOnAdd = theCallback;
+ SALOMEDSImpl_Callback* aRet = _callbackOnAdd;
+ _callbackOnAdd = (SALOMEDSImpl_Callback*)theCallback;
return aRet;
}
* Purpose :
*/
//============================================================================
-Handle(SALOMEDSImpl_Callback)
-SALOMEDSImpl_StudyBuilder::SetOnRemoveSObject(const Handle(SALOMEDSImpl_Callback)& theCallback)
+SALOMEDSImpl_Callback*
+SALOMEDSImpl_StudyBuilder::SetOnRemoveSObject(const SALOMEDSImpl_Callback* theCallback)
{
_errorCode = "";
- Handle(SALOMEDSImpl_Callback) aRet = _callbackOnRemove;
- _callbackOnRemove = theCallback;
+ SALOMEDSImpl_Callback* aRet = _callbackOnRemove;
+ _callbackOnRemove = (SALOMEDSImpl_Callback*)theCallback;
return aRet;
}
void SALOMEDSImpl_StudyBuilder::CheckLocked()
{
_errorCode = "";
- if (_doc->HasOpenCommand()) return;
- Handle(SALOMEDSImpl_AttributeStudyProperties) anAttr;
- if (!_doc->Main().FindAttribute(SALOMEDSImpl_AttributeStudyProperties::GetID(), anAttr)) {
- anAttr = new SALOMEDSImpl_AttributeStudyProperties;
- _doc->Main().AddAttribute(anAttr);
- }
+ if (HasOpenCommand()) return;
+ SALOMEDSImpl_AttributeStudyProperties* anAttr = _study->GetProperties();
if (anAttr->IsLocked()) {
_errorCode = "LockProtection";
throw LockProtection("LockProtection");
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_StudyBuilder::SetName(const Handle(SALOMEDSImpl_SObject)& theSO,
- const TCollection_AsciiString& theValue)
+bool SALOMEDSImpl_StudyBuilder::SetName(const SALOMEDSImpl_SObject& theSO,
+ const string& theValue)
{
_errorCode = "";
CheckLocked();
- if(theSO.IsNull()) {
+ if(!theSO) {
_errorCode = "Invalid arguments";
return false;
}
- SALOMEDSImpl_AttributeName::Set(theSO->GetLabel(), theValue);
+ SALOMEDSImpl_AttributeName::Set(theSO.GetLabel(), theValue);
- _doc->Modify();
+ _doc->SetModified(true);
return true;
}
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_StudyBuilder::SetComment(const Handle(SALOMEDSImpl_SObject)& theSO,
- const TCollection_AsciiString& theValue)
+bool SALOMEDSImpl_StudyBuilder::SetComment(const SALOMEDSImpl_SObject& theSO,
+ const string& theValue)
{
_errorCode = "";
CheckLocked();
- if(theSO.IsNull()) {
+ if(!theSO) {
_errorCode = "Invalid arguments";
return false;
}
- SALOMEDSImpl_AttributeComment::Set(theSO->GetLabel(), theValue);
+ SALOMEDSImpl_AttributeComment::Set(theSO.GetLabel(), theValue);
- _doc->Modify();
+ _doc->SetModified(true);
return true;
}
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_StudyBuilder::SetIOR(const Handle(SALOMEDSImpl_SObject)& theSO,
- const TCollection_AsciiString& theValue)
+bool SALOMEDSImpl_StudyBuilder::SetIOR(const SALOMEDSImpl_SObject& theSO,
+ const string& theValue)
{
_errorCode = "";
CheckLocked();
- if(theSO.IsNull()) {
+ if(!theSO) {
_errorCode = "Invalid arguments";
return false;
}
- SALOMEDSImpl_AttributeIOR::Set(theSO->GetLabel(), theValue);
+ SALOMEDSImpl_AttributeIOR::Set(theSO.GetLabel(), theValue);
- _doc->Modify();
+ _doc->SetModified(true);
return true;
}
* Purpose :
*/
//============================================================================
-static void Translate_persistentID_to_IOR(TDF_Label& Lab, SALOMEDSImpl_Driver* driver, bool isMultiFile, bool isASCII)
+static void Translate_persistentID_to_IOR(DF_Label& Lab, SALOMEDSImpl_Driver* driver, bool isMultiFile, bool isASCII)
{
if(driver == NULL) return;
- TDF_ChildIterator itchild (Lab);
+ DF_ChildIterator itchild (Lab);
for (; itchild.More(); itchild.Next()) {
- TDF_Label current = itchild.Value();
- Handle(SALOMEDSImpl_AttributePersistentRef) Att;
- if (current.FindAttribute(SALOMEDSImpl_AttributePersistentRef::GetID(),Att)) {
-
- Handle(SALOMEDSImpl_AttributeLocalID) anID;
- if (current.FindAttribute(SALOMEDSImpl_AttributeLocalID::GetID(), anID))
- if (anID->Value() == FILELOCALID) continue; //SRN: This attribute store a file name, skip it
-
- TCollection_AsciiString persist_ref(Att->Value());
- Handle(SALOMEDSImpl_SObject) so = SALOMEDSImpl_Study::SObject(current);
- TCollection_AsciiString ior_string = driver->LocalPersistentIDToIOR(so,
- persist_ref,
- isMultiFile,
- isASCII);
+ DF_Label current = itchild.Value();
+ SALOMEDSImpl_AttributePersistentRef* Att = NULL;
+ if ((Att=(SALOMEDSImpl_AttributePersistentRef*)current.FindAttribute(SALOMEDSImpl_AttributePersistentRef::GetID()))) {
+
+ SALOMEDSImpl_AttributeLocalID* anID = NULL;
+ if ((anID=(SALOMEDSImpl_AttributeLocalID*)current.FindAttribute(SALOMEDSImpl_AttributeLocalID::GetID())))
+ if (anID->Value() == FILELOCALID) continue; //SRN: This attribute store a file name, skip it
+
+ string persist_ref = Att->Value();
+ SALOMEDSImpl_SObject so = SALOMEDSImpl_Study::SObject(current);
+ string ior_string = driver->LocalPersistentIDToIOR(so,
+ persist_ref,
+ isMultiFile,
+ isASCII);
SALOMEDSImpl_AttributeIOR::Set (current, ior_string);
}
#ifndef __SALOMEDSImpl_STUDYBUILDER_H__
#define __SALOMEDSImpl_STUDYBUILDER_H__
-//Handle definition
-#include <Handle_MMgt_TShared.hxx>
-#include <Standard_DefineHandle.hxx>
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_StudyBuilder, MMgt_TShared )
-
// std C++ headers
#include <iostream>
-
-// Cascade header
-#include <TCollection_AsciiString.hxx>
-#include <TDocStd_Document.hxx>
+#include <string>
+#include <vector>
#include "SALOMEDSImpl_Callback.hxx"
#include "SALOMEDSImpl_Driver.hxx"
-class SALOMEDSImpl_StudyBuilder : public MMgt_TShared
+class SALOMEDSImpl_Study;
+
+class SALOMEDSImpl_StudyBuilder
{
private:
- Handle(TDocStd_Document) _doc;
- Handle(Standard_Transient) _study;
- Handle(SALOMEDSImpl_Callback) _callbackOnAdd;
- Handle(SALOMEDSImpl_Callback) _callbackOnRemove;
- TCollection_AsciiString _errorCode;
+ DF_Document* _doc;
+ SALOMEDSImpl_Study* _study;
+ SALOMEDSImpl_Callback* _callbackOnAdd;
+ SALOMEDSImpl_Callback* _callbackOnRemove;
+ std::string _errorCode;
public:
- Standard_EXPORT SALOMEDSImpl_StudyBuilder(const Handle(Standard_Transient)& theOwner);
+ Standard_EXPORT SALOMEDSImpl_StudyBuilder(const SALOMEDSImpl_Study* theOwner);
Standard_EXPORT ~SALOMEDSImpl_StudyBuilder();
- Standard_EXPORT virtual Handle(SALOMEDSImpl_SComponent) NewComponent(const TCollection_AsciiString& ComponentDataType);
+ Standard_EXPORT virtual SALOMEDSImpl_SComponent NewComponent(const std::string& ComponentDataType);
- Standard_EXPORT virtual bool DefineComponentInstance (const Handle(SALOMEDSImpl_SComponent)&, const TCollection_AsciiString& ComponentIOR);
+ Standard_EXPORT virtual bool DefineComponentInstance (const SALOMEDSImpl_SComponent&, const std::string& ComponentIOR);
- Standard_EXPORT virtual bool RemoveComponent(const Handle(SALOMEDSImpl_SComponent)& aComponent);
+ Standard_EXPORT virtual bool RemoveComponent(const SALOMEDSImpl_SComponent& aComponent);
- Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) NewObject(const Handle(SALOMEDSImpl_SObject)& theFatherObject);
+ Standard_EXPORT virtual SALOMEDSImpl_SObject NewObject(const SALOMEDSImpl_SObject& theFatherObject);
- Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) NewObjectToTag(const Handle(SALOMEDSImpl_SObject)& theFatherObject,
- const int theTag);
+ Standard_EXPORT virtual SALOMEDSImpl_SObject NewObjectToTag(const SALOMEDSImpl_SObject& theFatherObject,
+ const int theTag);
//! The methods adds a new subdirectory, the path can be absolute or relative (then the current context is used)
- Standard_EXPORT virtual bool AddDirectory(const TCollection_AsciiString& thePath);
+ Standard_EXPORT virtual bool AddDirectory(const std::string& thePath);
- Standard_EXPORT virtual bool LoadWith(const Handle(SALOMEDSImpl_SComponent)& sco, SALOMEDSImpl_Driver* Engine);
- Standard_EXPORT virtual bool Load(const Handle(SALOMEDSImpl_SObject)& sco);
+ Standard_EXPORT virtual bool LoadWith(const SALOMEDSImpl_SComponent& sco, SALOMEDSImpl_Driver* Engine);
+ Standard_EXPORT virtual bool Load(const SALOMEDSImpl_SObject& sco);
- Standard_EXPORT virtual bool RemoveObject(const Handle(SALOMEDSImpl_SObject)& anObject);
- Standard_EXPORT virtual bool RemoveObjectWithChildren(const Handle(SALOMEDSImpl_SObject)& anObject);
+ Standard_EXPORT virtual bool RemoveObject(const SALOMEDSImpl_SObject& anObject);
+ Standard_EXPORT virtual bool RemoveObjectWithChildren(const SALOMEDSImpl_SObject& anObject);
- Standard_EXPORT virtual Handle(TDF_Attribute) FindOrCreateAttribute(const Handle(SALOMEDSImpl_SObject)& anObject,
- const TCollection_AsciiString& aTypeOfAttribute);
- Standard_EXPORT virtual bool FindAttribute(const Handle(SALOMEDSImpl_SObject)& anObject,
- Handle(TDF_Attribute)& anAttribute,
- const TCollection_AsciiString& aTypeOfAttribute);
+ Standard_EXPORT virtual DF_Attribute* FindOrCreateAttribute(const SALOMEDSImpl_SObject& anObject,
+ const std::string& aTypeOfAttribute);
+ Standard_EXPORT virtual bool FindAttribute(const SALOMEDSImpl_SObject& anObject,
+ DF_Attribute*& anAttribute,
+ const std::string& aTypeOfAttribute);
- Standard_EXPORT virtual bool RemoveAttribute(const Handle(SALOMEDSImpl_SObject)& anObject, const TCollection_AsciiString& aTypeOfAttribute);
+ Standard_EXPORT virtual bool RemoveAttribute(const SALOMEDSImpl_SObject& anObject, const std::string& aTypeOfAttribute);
- Standard_EXPORT virtual bool Addreference(const Handle(SALOMEDSImpl_SObject)& me,
- const Handle(SALOMEDSImpl_SObject)& thereferencedObject);
+ Standard_EXPORT virtual bool Addreference(const SALOMEDSImpl_SObject& me,
+ const SALOMEDSImpl_SObject& thereferencedObject);
- Standard_EXPORT virtual bool RemoveReference(const Handle(SALOMEDSImpl_SObject)& me);
+ Standard_EXPORT virtual bool RemoveReference(const SALOMEDSImpl_SObject& me);
- Standard_EXPORT virtual bool SetGUID(const Handle(SALOMEDSImpl_SObject)& anObject, const TCollection_AsciiString& theGUID);
- Standard_EXPORT virtual bool IsGUID(const Handle(SALOMEDSImpl_SObject)& anObject, const TCollection_AsciiString& theGUID);
+ Standard_EXPORT virtual bool SetGUID(const SALOMEDSImpl_SObject& anObject, const std::string& theGUID);
+ Standard_EXPORT virtual bool IsGUID(const SALOMEDSImpl_SObject& anObject, const std::string& theGUID);
Standard_EXPORT virtual void NewCommand();
Standard_EXPORT virtual void CommitCommand();
Standard_EXPORT void CheckLocked();
- Standard_EXPORT virtual Handle(SALOMEDSImpl_Callback) SetOnAddSObject(const Handle(SALOMEDSImpl_Callback)& theCallback);
- Standard_EXPORT virtual Handle(SALOMEDSImpl_Callback) SetOnRemoveSObject(const Handle(SALOMEDSImpl_Callback)& theCallback);
+ Standard_EXPORT virtual SALOMEDSImpl_Callback* SetOnAddSObject(const SALOMEDSImpl_Callback* theCallback);
+ Standard_EXPORT virtual SALOMEDSImpl_Callback* SetOnRemoveSObject(const SALOMEDSImpl_Callback* theCallback);
- Standard_EXPORT virtual bool SetName(const Handle(SALOMEDSImpl_SObject)& theSO, const TCollection_AsciiString& theValue);
+ Standard_EXPORT virtual bool SetName(const SALOMEDSImpl_SObject& theSO, const std::string& theValue);
- Standard_EXPORT virtual bool SetComment(const Handle(SALOMEDSImpl_SObject)& theSO, const TCollection_AsciiString& theValue);
+ Standard_EXPORT virtual bool SetComment(const SALOMEDSImpl_SObject& theSO, const std::string& theValue);
- Standard_EXPORT virtual bool SetIOR(const Handle(SALOMEDSImpl_SObject)& theSO, const TCollection_AsciiString& theValue);
+ Standard_EXPORT virtual bool SetIOR(const SALOMEDSImpl_SObject& theSO, const std::string& theValue);
- Standard_EXPORT virtual TCollection_AsciiString GetErrorCode() { return _errorCode; }
+ Standard_EXPORT virtual std::string GetErrorCode() { return _errorCode; }
Standard_EXPORT virtual bool IsError() { return _errorCode != ""; }
- Standard_EXPORT virtual Handle(Standard_Transient) GetOwner() { return _study; }
-
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_StudyBuilder )
+ Standard_EXPORT virtual SALOMEDSImpl_Study* GetOwner() { return _study; }
};
#endif
// Module : SALOME
#include "SALOMEDSImpl_StudyHandle.hxx"
-#include <TDF_Attribute.hxx>
-#include <Standard_GUID.hxx>
/*
Class : SALOMEDSImpl_StudyHandle
graphic representation of objects in dirrent views
*/
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_StudyHandle, TDF_Attribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_StudyHandle, TDF_Attribute )
//=======================================================================
//function : GetID
//purpose : Get GUID of this attribute
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_StudyHandle::GetID()
+const std::string& SALOMEDSImpl_StudyHandle::GetID()
{
- static Standard_GUID SALOMEDSImpl_StudyHandleID( "050C9555-4BA8-49bf-8F1C-086F0469A40B" );
+ static std::string SALOMEDSImpl_StudyHandleID( "050C9555-4BA8-49bf-8F1C-086F0469A40B" );
return SALOMEDSImpl_StudyHandleID;
}
//=======================================================================
SALOMEDSImpl_StudyHandle::SALOMEDSImpl_StudyHandle()
{
- myHandle.Nullify();
+ myHandle = NULL;
}
//=======================================================================
//function : Set
//purpose :
//=======================================================================
-Handle(SALOMEDSImpl_StudyHandle) SALOMEDSImpl_StudyHandle::Set(const TDF_Label& theLabel,
- const Handle(SALOMEDSImpl_Study)& theStudy)
+SALOMEDSImpl_StudyHandle* SALOMEDSImpl_StudyHandle::Set(const DF_Label& theLabel,
+ SALOMEDSImpl_Study* theStudy)
{
- Handle(SALOMEDSImpl_StudyHandle) A;
- if (!theLabel.FindAttribute(GetID(), A)) {
- A = new SALOMEDSImpl_StudyHandle();
+ SALOMEDSImpl_StudyHandle* A = NULL;
+ if (!(A=(SALOMEDSImpl_StudyHandle*)theLabel.FindAttribute(GetID()))) {
+ A = new SALOMEDSImpl_StudyHandle;
theLabel.AddAttribute(A);
}
- A->SetHandle(theStudy);
+ A->Set(theStudy);
return A;
}
//function : ID
//purpose : Get GUID of this attribute
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_StudyHandle::ID () const
+const std::string& SALOMEDSImpl_StudyHandle::ID () const
{
return GetID();
}
//function : NewEmpty
//purpose : Create new empty attribute
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_StudyHandle::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_StudyHandle::NewEmpty () const
{
return new SALOMEDSImpl_StudyHandle ();
}
//function : Restore
//purpose : Restore value of attribute with value of theWith one
//=======================================================================
-void SALOMEDSImpl_StudyHandle::Restore( const Handle(TDF_Attribute)& theWith )
+void SALOMEDSImpl_StudyHandle::Restore( DF_Attribute* theWith )
{
- Handle(SALOMEDSImpl_StudyHandle) anAttr = Handle(SALOMEDSImpl_StudyHandle)::DownCast( theWith );
- if ( !anAttr.IsNull() ) SetHandle( anAttr->GetHandle() );
+ SALOMEDSImpl_StudyHandle* anAttr = dynamic_cast<SALOMEDSImpl_StudyHandle*>( theWith );
+ if ( anAttr ) Set ( anAttr->Get() );
}
//=======================================================================
//function : Paste
//purpose : Paste value of current attribute to the value of entry one
//=======================================================================
-void SALOMEDSImpl_StudyHandle::Paste( const Handle(TDF_Attribute)& theInto,
- const Handle(TDF_RelocationTable)& ) const
+void SALOMEDSImpl_StudyHandle::Paste( DF_Attribute* theInto)
{
- Handle(SALOMEDSImpl_StudyHandle) anAttr = Handle(SALOMEDSImpl_StudyHandle)::DownCast( theInto );
- if ( !anAttr.IsNull() ) anAttr->SetHandle( myHandle );
+ SALOMEDSImpl_StudyHandle* anAttr = dynamic_cast<SALOMEDSImpl_StudyHandle*>( theInto );
+ if ( anAttr ) anAttr->Set ( myHandle );
}
#ifndef SALOMEDSImpl_StudyHandle_HeaderFile
#define SALOMEDSImpl_StudyHandle_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TDF_Label.hxx>
-
-class Standard_GUID;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
+#include "DF_Attribute.hxx"
+#include "DF_Label.hxx"
/*
Class : SALOMEDSImpl_StudyHandle
Description : PRIVATE: This class is intended for storing of the study handle
*/
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_StudyHandle, TDF_Attribute )
-
#include "SALOMEDSImpl_Study.hxx"
#ifndef WNT
-class Standard_EXPORT SALOMEDSImpl_StudyHandle : public TDF_Attribute
+class Standard_EXPORT SALOMEDSImpl_StudyHandle : public DF_Attribute
#else
-class SALOMEDSImpl_StudyHandle : public TDF_Attribute
+class SALOMEDSImpl_StudyHandle : public DF_Attribute
#endif
{
public:
Standard_EXPORT SALOMEDSImpl_StudyHandle();
-Standard_EXPORT ~SALOMEDSImpl_StudyHandle() { myHandle.Nullify(); }
+Standard_EXPORT ~SALOMEDSImpl_StudyHandle() {; }
-Standard_EXPORT static Handle(SALOMEDSImpl_StudyHandle) Set(const TDF_Label& theLabel, const Handle(SALOMEDSImpl_Study)& theStudy);
-Standard_EXPORT static const Standard_GUID& GetID() ;
+Standard_EXPORT static SALOMEDSImpl_StudyHandle* Set(const DF_Label& theLabel, SALOMEDSImpl_Study* theStudy);
+Standard_EXPORT static const std::string& GetID() ;
-Standard_EXPORT void SetHandle(const Handle(SALOMEDSImpl_Study)& theStudy) { myHandle = theStudy; }
-Standard_EXPORT Handle(SALOMEDSImpl_Study) GetHandle() { return myHandle; }
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore( const Handle(TDF_Attribute)& theWith );
-Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const;
-Standard_EXPORT void Paste( const Handle(TDF_Attribute)& theInto,
- const Handle(TDF_RelocationTable)& ) const;
+Standard_EXPORT void Set(SALOMEDSImpl_Study* theStudy) { myHandle = theStudy; }
+Standard_EXPORT SALOMEDSImpl_Study* Get() { return myHandle; }
+Standard_EXPORT const std::string& ID() const;
+Standard_EXPORT void Restore( DF_Attribute* theWith );
+Standard_EXPORT DF_Attribute* NewEmpty() const;
+Standard_EXPORT void Paste( DF_Attribute* theInto);
private:
- Handle(SALOMEDSImpl_Study) myHandle;
+ SALOMEDSImpl_Study* myHandle;
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_StudyHandle )
};
#endif
#include "SALOMEDSImpl_StudyManager.hxx"
-#include <CDF_Session.hxx>
-#include <CDF_DirectoryIterator.hxx>
-#include <TDF_Label.hxx>
-#include <TDF_Tool.hxx>
-#include <TDF_Data.hxx>
-#include <TDF_RelocationTable.hxx>
-#include <TDF_ChildIterator.hxx>
-#include <TDF_AttributeIterator.hxx>
-#include <TColStd_HSequenceOfReal.hxx>
-#include <TColStd_HSequenceOfInteger.hxx>
-#include <TColStd_HArray1OfCharacter.hxx>
-#include <TColStd_HSequenceOfAsciiString.hxx>
-#include <TColStd_HSequenceOfExtendedString.hxx>
-#include <TCollection_ExtendedString.hxx>
-#include <OSD_Process.hxx>
-#include <Quantity_Date.hxx>
+#include "DF_ChildIterator.hxx"
#include "HDFexplorer.hxx"
#include "SALOMEDSImpl_Attributes.hxx"
#include "SALOMEDSImpl_Tool.hxx"
#include "SALOMEDSImpl_SComponent.hxx"
+#include "SALOMEDSImpl_GenericAttribute.hxx"
#include <map>
#include "HDFOI.hxx"
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_StudyManager, MMgt_TShared )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_StudyManager, MMgt_TShared )
-
#define USE_CASE_LABEL_ID "0:2"
-static void SaveAttributes(Handle(SALOMEDSImpl_SObject) SO, HDFgroup *hdf_group_sobject);
-static void ReadAttributes(const Handle(SALOMEDSImpl_Study)&, const Handle(SALOMEDSImpl_SObject)&, HDFdataset* );
-static void BuildTree (const Handle(SALOMEDSImpl_Study)&, HDFgroup*);
-static void Translate_IOR_to_persistentID (const Handle(SALOMEDSImpl_SObject)&,
+static void SaveAttributes(const SALOMEDSImpl_SObject& SO, HDFgroup *hdf_group_sobject);
+static void ReadAttributes(SALOMEDSImpl_Study*, const SALOMEDSImpl_SObject&, HDFdataset* );
+static void BuildTree (SALOMEDSImpl_Study*, HDFgroup*);
+static void Translate_IOR_to_persistentID (const SALOMEDSImpl_SObject&,
SALOMEDSImpl_Driver*, bool isMultiFile, bool isASCII);
//============================================================================
SALOMEDSImpl_StudyManager::SALOMEDSImpl_StudyManager()
{
_errorCode = "";
- _OCAFApp = new SALOMEDSImpl_OCAFApplication();
+ _appli = new DF_Application();
_IDcounter = 0;
- _OCAFApp->NewDocument("SALOME_STUDY", _clipboard);
+ _clipboard = _appli->NewDocument("SALOME_STUDY");
}
//============================================================================
//============================================================================
SALOMEDSImpl_StudyManager::~SALOMEDSImpl_StudyManager()
{
- // Destroy OCAF application
- _OCAFApp.Nullify();
+ // Destroy application
+ delete _appli;
}
* Purpose : Create a New Study of name study_name
*/
//==================================================T==========================
-Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::NewStudy(const TCollection_AsciiString& study_name)
+SALOMEDSImpl_Study* SALOMEDSImpl_StudyManager::NewStudy(const string& study_name)
{
_errorCode = "";
- Handle(TDocStd_Document) Doc;
- _OCAFApp->NewDocument("SALOME_STUDY",Doc);
+ DF_Document* Doc = _appli->NewDocument("SALOME_STUDY");
- Handle(SALOMEDSImpl_Study) Study = new SALOMEDSImpl_Study(Doc, study_name);
+ SALOMEDSImpl_Study* Study = new SALOMEDSImpl_Study(Doc, study_name);
_IDcounter++;
Study->StudyId( _IDcounter );
// set Study properties
- Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = Study->GetProperties();
- OSD_Process aProcess;
- Quantity_Date aDate = aProcess.SystemDate();
- aProp->SetModification(aProcess.UserName().ToCString(),
- aDate.Minute(), aDate.Hour(), aDate.Day(), aDate.Month(), aDate.Year());
+ SALOMEDSImpl_AttributeStudyProperties* aProp = Study->GetProperties();
+
+ int month=0,day=0,year=0,hh=0,mn=0,ss=0;
+ SALOMEDSImpl_Tool::GetSystemDate(year, month, day, hh, mn, ss);
+ aProp->SetModification(SALOMEDSImpl_Tool::GetUserName(),
+ mn, hh, day, month, year);
aProp->SetCreationMode(1); //"from scratch"
return Study;
* Purpose : Open a Study from it's persistent reference
*/
//============================================================================
-Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::Open(const TCollection_AsciiString& aUrl)
+SALOMEDSImpl_Study* SALOMEDSImpl_StudyManager::Open(const string& aUrl)
{
_errorCode = "";
HDFgroup *hdf_group_study_structure =0;
char* aC_HDFUrl;
- TCollection_AsciiString aHDFUrl;
+ string aHDFUrl;
bool isASCII = false;
- if (HDFascii::isASCII(aUrl.ToCString())) {
+ if (HDFascii::isASCII(aUrl.c_str())) {
isASCII = true;
- char* aResultPath = HDFascii::ConvertFromASCIIToHDF(aUrl.ToCString());
+ char* aResultPath = HDFascii::ConvertFromASCIIToHDF(aUrl.c_str());
aC_HDFUrl = new char[strlen(aResultPath) + 19];
sprintf(aC_HDFUrl, "%shdf_from_ascii.hdf", aResultPath);
delete(aResultPath);
aHDFUrl = aUrl;
}
- hdf_file = new HDFfile((char*)aHDFUrl.ToCString());
+
+ hdf_file = new HDFfile((char*)aHDFUrl.c_str());
try {
hdf_file->OpenOnDisk(HDF_RDONLY);// mpv: was RDWR, but opened file can be write-protected too
}
// char eStr[strlen(aUrl.ToCString())+17];
//#else
char *eStr;
- eStr = new char[strlen(aUrl.ToCString())+17];
+ eStr = new char[strlen(aUrl.c_str())+17];
//#endif
- sprintf(eStr,"Can't open file %s",aUrl.ToCString());
+ sprintf(eStr,"Can't open file %s",aUrl.c_str());
//#ifdef WNT
delete [] eStr;
//#endif
- _errorCode = TCollection_AsciiString(eStr);
+ _errorCode = string(eStr);
return NULL;
}
// Temporary aStudyUrl in place of study name
- Handle(TDocStd_Document) Doc;
- _OCAFApp->NewDocument("SALOME_STUDY",Doc);
+ DF_Document* Doc = _appli->NewDocument("SALOME_STUDY");
- Handle(SALOMEDSImpl_Study) Study = new SALOMEDSImpl_Study(Doc, aUrl);
+ SALOMEDSImpl_Study* Study = new SALOMEDSImpl_Study(Doc, aUrl);
_IDcounter++;
Study->StudyId( _IDcounter );
return Study;
}
- //Create the Structure of the OCAF Document
+ //Create the Structure of the Document
hdf_group_study_structure = new HDFgroup("STUDY_STRUCTURE",hdf_file);
- Handle(TDF_Data) DF = Doc->GetData();
try {
BuildTree (Study, hdf_group_study_structure);
}
//#ifndef WNT
// char eStr[strlen(aUrl.ToCString())+17];
//#else
- char *eStr = new char [strlen(aUrl.ToCString())+17];
+ char *eStr = new char [strlen(aUrl.c_str())+17];
//#endif
- sprintf(eStr,"Can't open file %s", aUrl.ToCString());
- _errorCode = TCollection_AsciiString(eStr);
+ sprintf(eStr,"Can't open file %s", aUrl.c_str());
+ _errorCode = string(eStr);
return NULL;
}
hdf_file->CloseOnDisk();
if (isASCII) {
- Handle(TColStd_HSequenceOfAsciiString) aFilesToRemove = new TColStd_HSequenceOfAsciiString;
- aFilesToRemove->Append("hdf_from_ascii.hdf");
+ vector<string> aFilesToRemove;
+ aFilesToRemove.push_back("hdf_from_ascii.hdf");
SALOMEDSImpl_Tool::RemoveTemporaryFiles(SALOMEDSImpl_Tool::GetDirFromPath(aHDFUrl), aFilesToRemove, true);
}
*/
//============================================================================
-void SALOMEDSImpl_StudyManager::Close(const Handle(SALOMEDSImpl_Study)& aStudy)
+void SALOMEDSImpl_StudyManager::Close(SALOMEDSImpl_Study* aStudy)
{
_errorCode = "";
- if(aStudy.IsNull()) {
+ if(!aStudy) {
_errorCode = "Study is null";
return;
}
* Purpose : Save a Study to it's persistent reference
*/
//============================================================================
-bool SALOMEDSImpl_StudyManager::Save(const Handle(SALOMEDSImpl_Study)& aStudy,
+bool SALOMEDSImpl_StudyManager::Save(SALOMEDSImpl_Study* aStudy,
SALOMEDSImpl_DriverFactory* aFactory,
bool theMultiFile)
{
_errorCode = "";
- TCollection_AsciiString url = aStudy->URL();
- if (url.IsEmpty()) {
+ string url = aStudy->URL();
+ if (url.empty()) {
_errorCode = "No path specified to save the study. Nothing done";
return false;
}
return false;
}
-bool SALOMEDSImpl_StudyManager::SaveASCII(const Handle(SALOMEDSImpl_Study)& aStudy,
+bool SALOMEDSImpl_StudyManager::SaveASCII(SALOMEDSImpl_Study* aStudy,
SALOMEDSImpl_DriverFactory* aFactory,
bool theMultiFile)
{
_errorCode = "";
- TCollection_AsciiString url = aStudy->URL();
- if (url.IsEmpty()) {
+ string url = aStudy->URL();
+ if (url.empty()) {
_errorCode = "No path specified to save the study. Nothing done";
return false;
}
* Purpose : Save a study to the persistent reference aUrl
*/
//============================================================================
-bool SALOMEDSImpl_StudyManager::SaveAs(const TCollection_AsciiString& aUrl,
- const Handle(SALOMEDSImpl_Study)& aStudy,
+bool SALOMEDSImpl_StudyManager::SaveAs(const string& aUrl,
+ SALOMEDSImpl_Study* aStudy,
SALOMEDSImpl_DriverFactory* aFactory,
bool theMultiFile)
{
return Impl_SaveAs(aUrl,aStudy, aFactory, theMultiFile, false);
}
-bool SALOMEDSImpl_StudyManager::SaveAsASCII(const TCollection_AsciiString& aUrl,
- const Handle(SALOMEDSImpl_Study)& aStudy,
+bool SALOMEDSImpl_StudyManager::SaveAsASCII(const string& aUrl,
+ SALOMEDSImpl_Study* aStudy,
SALOMEDSImpl_DriverFactory* aFactory,
bool theMultiFile)
{
* Purpose : Get name list of open studies in the session
*/
//============================================================================
-Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_StudyManager::GetOpenStudies()
+vector<SALOMEDSImpl_Study*> SALOMEDSImpl_StudyManager::GetOpenStudies()
{
_errorCode = "";
- Handle(TColStd_HSequenceOfTransient) aList = new TColStd_HSequenceOfTransient;
+ vector<SALOMEDSImpl_Study*> aList;
- int nbDocs = _OCAFApp->NbDocuments();
+ int nbDocs = _appli->NbDocuments();
if(nbDocs == 0) {
_errorCode = "No active study in this session";
return aList;
}
else {
- Handle(SALOMEDSImpl_Study) aStudy;
- Handle(CDF_Session) S = CDF_Session::CurrentSession();
- CDF_DirectoryIterator it (S->Directory());
- for (;it.MoreDocument();it.NextDocument()) {
- Handle(TDocStd_Document) D = Handle(TDocStd_Document)::DownCast(it.Document());
+ SALOMEDSImpl_Study* aStudy;
+ vector<int> ids = _appli->GetDocumentIDs();
+ for (int i = 0, len = ids.size(); i<len; i++) {
+ DF_Document* D = _appli->GetDocument(ids[i]);
if(D == _clipboard) continue;
aStudy = SALOMEDSImpl_Study::GetStudy(D->Main());
- if(aStudy.IsNull()) continue;
- aList->Append(aStudy);
+ if(!aStudy) continue;
+ aList.push_back(aStudy);
}
}
* Purpose : Get a study from its name
*/
//============================================================================
-Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::GetStudyByName
- (const TCollection_AsciiString& aStudyName)
+SALOMEDSImpl_Study* SALOMEDSImpl_StudyManager::GetStudyByName
+ (const string& aStudyName)
{
_errorCode = "";
- int nbDocs = _OCAFApp->NbDocuments();
+ int nbDocs = _appli->NbDocuments();
if (nbDocs == 0) {
_errorCode = "No active study in this session";
return NULL;
}
else {
- Handle(SALOMEDSImpl_Study) aStudy;
- Handle(CDF_Session) S = CDF_Session::CurrentSession();
- CDF_DirectoryIterator it (S->Directory());
- for (; it.MoreDocument(); it.NextDocument()) {
- Handle(TDocStd_Document) D = Handle(TDocStd_Document)::DownCast(it.Document());
- if (D == _clipboard) continue;
- aStudy = SALOMEDSImpl_Study::GetStudy(D->Main());
- if (aStudy.IsNull()) continue;
- if (aStudy->Name() == aStudyName) return aStudy;
+ vector<SALOMEDSImpl_Study*> studies = GetOpenStudies();
+ for (int i = 0, len = studies.size(); i<len; i++) {
+ if (studies[i]->Name() == aStudyName) return studies[i];
}
}
- _errorCode = TCollection_AsciiString("Found no study with the name ") + aStudyName;
+ _errorCode = string("Found no study with the name ") + aStudyName;
return NULL;
}
* Purpose : Get a study from its ID
*/
//============================================================================
-Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::GetStudyByID(int aStudyID)
+SALOMEDSImpl_Study* SALOMEDSImpl_StudyManager::GetStudyByID(int aStudyID)
{
_errorCode = "";
- int nbDocs = _OCAFApp->NbDocuments();
+ int nbDocs = _appli->NbDocuments();
if (nbDocs == 0) {
_errorCode = "No active study in this session";
return NULL;
}
else {
- Handle(SALOMEDSImpl_Study) aStudy;
- Handle(CDF_Session) S = CDF_Session::CurrentSession();
- CDF_DirectoryIterator it (S->Directory());
- for (; it.MoreDocument(); it.NextDocument()) {
- Handle(TDocStd_Document) D = Handle(TDocStd_Document)::DownCast(it.Document());
- if (D == _clipboard) continue;
- aStudy = SALOMEDSImpl_Study::GetStudy(D->Main());
- if (aStudy.IsNull()) continue;
- if (aStudy->StudyId() == aStudyID) return aStudy;
+ vector<SALOMEDSImpl_Study*> studies = GetOpenStudies();
+ for (int i = 0, len = studies.size(); i<len; i++) {
+ if (studies[i]->StudyId() == aStudyID) return studies[i];
}
}
* Purpose : save the study properties in HDF file
*/
//============================================================================
-bool SALOMEDSImpl_StudyManager::Impl_SaveProperties(const Handle(SALOMEDSImpl_Study)& aStudy,
+bool SALOMEDSImpl_StudyManager::Impl_SaveProperties(SALOMEDSImpl_Study* aStudy,
HDFgroup *hdf_group)
{
_errorCode = "";
hdf_int32 name_len;
// add modifications list (user and date of save)
- Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = aStudy->GetProperties();
- Handle(SALOMEDSImpl_StudyBuilder) SB= aStudy->NewBuilder();
+ SALOMEDSImpl_AttributeStudyProperties* aProp = aStudy->GetProperties();
int aLocked = aProp->IsLocked();
- if (aLocked) aProp->SetLocked(Standard_False);
+ if (aLocked) aProp->SetLocked(false);
- OSD_Process aProcess;
- Quantity_Date aDate = aProcess.SystemDate();
- aProp->SetModification(aProcess.UserName().ToCString(),
- aDate.Minute(), aDate.Hour(), aDate.Day(), aDate.Month(), aDate.Year());
+ int month=0,day=0,year=0,hh=0,mn=0,ss=0;
+ SALOMEDSImpl_Tool::GetSystemDate(year, month, day, hh, mn, ss);
+ aProp->SetModification(SALOMEDSImpl_Tool::GetUserName(),
+ mn, hh, day, month, year);
- if (aLocked) aProp->SetLocked(Standard_True);
+ if (aLocked) aProp->SetLocked(true);
- Handle(TColStd_HSequenceOfExtendedString) aNames;
- Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears;
+ vector<string> aNames;
+ vector<int> aMinutes, aHours, aDays, aMonths, aYears;
aProp->GetModifications(aNames, aMinutes, aHours, aDays, aMonths, aYears);
int aLength = 0, anIndex, i;
- for(i=1; i<=aNames->Length(); i++)
- aLength += aNames->Value(i).Length() + 1;
+ for(i=1; i<=aNames.size(); i++)
+ aLength += aNames[i-1].size() + 1;
//string length: 1 byte = locked flag, 1 byte = modified flag, (12 + name length + 1) for each name and date, "zero" byte
- char* aProperty = new char[3 + aLength + 12 * aNames->Length()];
+ char* aProperty = new char[3 + aLength + 12 * aNames.size()];
sprintf(aProperty,"%c%c", (char)aProp->GetCreationMode(), (aProp->IsLocked())?'l':'u');
- aLength = aNames->Length();
+ aLength = aNames.size();
int a = 2;
- for(anIndex = 1; anIndex <= aLength; anIndex++) {
+ for(anIndex = 0; anIndex<aLength; anIndex++) {
sprintf(&(aProperty[a]),"%2d%2d%2d%2d%4d%s",
- (int)(aMinutes->Value(anIndex)),
- (int)(aHours->Value(anIndex)),
- (int)(aDays->Value(anIndex)),
- (int)(aMonths->Value(anIndex)),
- (int)(aYears->Value(anIndex)),
- TCollection_AsciiString(aNames->Value(anIndex)).ToCString());
+ (int)(aMinutes[anIndex]),
+ (int)(aHours[anIndex]),
+ (int)(aDays[anIndex]),
+ (int)(aMonths[anIndex]),
+ (int)(aYears[anIndex]),
+ aNames[anIndex].c_str());
a = strlen(aProperty);
aProperty[a++] = 1;
}
* Purpose : save the study in HDF file
*/
//============================================================================
-bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const TCollection_AsciiString& aUrl,
- const Handle(SALOMEDSImpl_Study)& aStudy,
+bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const string& aUrl,
+ SALOMEDSImpl_Study* aStudy,
SALOMEDSImpl_DriverFactory* aFactory,
bool theMultiFile,
bool theASCII)
// HDF File will be composed of differents part :
// * For each ComponentDataType, all data created by the component
// Informations in data group hdf_group_datacomponent
- // * Study Structure -> Exactly what is contained in OCAF document
+ // * Study Structure -> Exactly what is contained in Document
// Informations in data group hdf_group_study_structure
_errorCode = "";
hdf_int32 name_len = 0;
char *component_name = 0;
+ if(!aStudy) {
+ _errorCode = "Study is null";
+ return false;
+ }
+
int aLocked = aStudy->GetProperties()->IsLocked();
if (aLocked) aStudy->GetProperties()->SetLocked(false);
- Handle(SALOMEDSImpl_StudyBuilder) SB= aStudy->NewBuilder();
+ SALOMEDSImpl_StudyBuilder* SB= aStudy->NewBuilder();
map<string, SALOMEDSImpl_Driver*> aMapTypeDriver;
- if(aStudy.IsNull()) {
- _errorCode = "Study is null";
- return false;
- }
-
try
{
// mpv 15.12.2003: for saving components we have to load all data from all modules
SALOMEDSImpl_SComponentIterator itcomponent1 = aStudy->NewComponentIterator();
for (; itcomponent1.More(); itcomponent1.Next())
{
- Handle(SALOMEDSImpl_SComponent) sco = itcomponent1.Value();
-
+ SALOMEDSImpl_SComponent sco = itcomponent1.Value();
// if there is an associated Engine call its method for saving
- TCollection_AsciiString IOREngine;
+ string IOREngine;
try {
- if (!sco->ComponentIOR(IOREngine)) {
- TCollection_AsciiString aCompType = sco->GetComment();
- if (!aCompType.IsEmpty()) {
+ if (!sco.ComponentIOR(IOREngine)) {
+ string aCompType = sco.GetComment();
+ if (!aCompType.empty()) {
SALOMEDSImpl_Driver* aDriver = aFactory->GetDriverByType(aCompType);
- aMapTypeDriver[aCompType.ToCString()] = aDriver;
+ aMapTypeDriver[aCompType] = aDriver;
if (aDriver != NULL) {
if(!SB->LoadWith(sco, aDriver)) {
}
}
- TCollection_AsciiString anOldName = aStudy->Name();
+ string anOldName = aStudy->Name();
aStudy->URL(aUrl);
// To change for Save
// Do not have to do a new file but just a Open??? Rewrite all informations after erasing evrything??
- hdf_file = new HDFfile(aUrl.ToCString());
+ hdf_file = new HDFfile((char*)aUrl.c_str());
hdf_file->CreateOnDisk();
//-----------------------------------------------------------------------
for (; itcomponent.More(); itcomponent.Next())
{
- Handle(SALOMEDSImpl_SComponent) sco = itcomponent.Value();
+ SALOMEDSImpl_SComponent sco = itcomponent.Value();
- TCollection_AsciiString scoid = sco->GetID();
- hdf_sco_group = new HDFgroup(scoid.ToCString(), hdf_group_datacomponent);
+ string scoid = sco.GetID();
+ hdf_sco_group = new HDFgroup((char*)scoid.c_str(), hdf_group_datacomponent);
hdf_sco_group->CreateOnDisk();
- TCollection_AsciiString componentDataType = sco->ComponentDataType();
- TCollection_AsciiString IOREngine;
- if (sco->ComponentIOR(IOREngine))
+ string componentDataType = sco.ComponentDataType();
+ string IOREngine;
+ if (sco.ComponentIOR(IOREngine))
{
SALOMEDSImpl_Driver* Engine = NULL;
- if(aMapTypeDriver.find(componentDataType.ToCString()) != aMapTypeDriver.end()) {
+ if(aMapTypeDriver.find(componentDataType) != aMapTypeDriver.end()) {
// we have found the associated engine to write the data
- Engine = aMapTypeDriver[componentDataType.ToCString()];
+ Engine = aMapTypeDriver[componentDataType];
}
else {
Engine = aFactory->GetDriverByIOR(IOREngine);
if (Engine != NULL)
{
- Handle(SALOMEDSImpl_TMPFile) aStream;
- long length;
+ SALOMEDSImpl_TMPFile* aStream = NULL;
+ long length = 0;
if (theASCII) aStream = Engine->SaveASCII(sco,
SALOMEDSImpl_Tool::GetDirFromPath(aUrl),
hdf_dataset->CloseOnDisk();
}
+ if(aStream) delete aStream;
+
// store multifile state
aHDFSize[0] = 2;
hdf_dataset = new HDFdataset("MULTIFILE_STATE", hdf_sco_group, HDF_STRING, aHDFSize, 1);
SALOMEDSImpl_SComponentIterator itcomp = aStudy->NewComponentIterator();
for (; itcomp.More(); itcomp.Next())
{
- Handle(SALOMEDSImpl_SComponent) SC = itcomp.Value();
- TCollection_AsciiString scid = SC->GetID();
- hdf_sco_group2 = new HDFgroup(scid.ToCString(), hdf_group_study_structure);
+ SALOMEDSImpl_SComponent SC = itcomp.Value();
+ string scid = SC.GetID();
+ hdf_sco_group2 = new HDFgroup((char*)scid.c_str(), hdf_group_study_structure);
hdf_sco_group2->CreateOnDisk();
SaveAttributes(SC, hdf_sco_group2);
// ComponentDataType treatment
- component_name = SC->ComponentDataType().ToCString();
+ component_name = (char*)SC.ComponentDataType().c_str();
name_len = (hdf_int32)strlen(component_name);
size[0] = name_len +1 ;
hdf_dataset = new HDFdataset("COMPONENTDATATYPE",hdf_sco_group2,HDF_STRING,size,1);
hdf_sco_group2->CloseOnDisk();
hdf_sco_group2=0; // will be deleted by hdf_group_study_structure destructor
}
-
//-----------------------------------------------------------------------
//4 - Write the Study UseCases Structure
//-----------------------------------------------------------------------
- Handle(SALOMEDSImpl_SObject) aSO = aStudy->FindObjectID(USE_CASE_LABEL_ID);
- if (!aSO.IsNull()) {
+ SALOMEDSImpl_SObject aSO = aStudy->FindObjectID(USE_CASE_LABEL_ID);
+ if (aSO) {
HDFgroup *hdf_soo_group = new HDFgroup(USE_CASE_LABEL_ID,hdf_group_study_structure);
hdf_soo_group->CreateOnDisk();
SaveAttributes(aSO, hdf_soo_group);
//-----------------------------------------------------------------------
//5 - Write the Study Properties
//-----------------------------------------------------------------------
- name_len = (hdf_int32) aStudy->Name().Length();
+ name_len = (hdf_int32) aStudy->Name().size();
size[0] = name_len +1 ;
hdf_dataset = new HDFdataset("STUDY_NAME",hdf_group_study_structure,HDF_STRING,size,1);
hdf_dataset->CreateOnDisk();
- char* studid = aStudy->Name().ToCString();
+ char* studid = (char*)aStudy->Name().c_str();
hdf_dataset->WriteOnDisk(studid);
hdf_dataset->CloseOnDisk();
hdf_dataset=0; // will be deleted by hdf_group_study_structure destructor
Impl_SaveProperties(aStudy, hdf_group_study_structure);
-
hdf_group_study_structure->CloseOnDisk();
hdf_file->CloseOnDisk();
return false;
}
if (theASCII) { // save file in ASCII format
- HDFascii::ConvertFromHDFToASCII(aUrl.ToCString(), true);
+ HDFascii::ConvertFromHDFToASCII(aUrl.c_str(), true);
}
return true;
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_StudyManager::Impl_SaveObject(const Handle(SALOMEDSImpl_SObject)& SC,
+bool SALOMEDSImpl_StudyManager::Impl_SaveObject(const SALOMEDSImpl_SObject& SC,
HDFgroup *hdf_group_datatype)
{
_errorCode = "";
HDFgroup *hdf_group_sobject = 0;
- TDF_ChildIterator itchild(SC->GetLabel());
+ DF_ChildIterator itchild(SC.GetLabel());
for (; itchild.More(); itchild.Next())
{
// mpv: don't save empty labels
- TDF_AttributeIterator AI1(itchild.Value());
- if (!AI1.More()) { //No attributes on the label
- TDF_ChildIterator subchild(SC->GetLabel());
+ vector<DF_Attribute*> attr = itchild.Value().GetAttributes();
+ if (attr.size() == 0) { //No attributes on the label
+ DF_ChildIterator subchild(itchild.Value());
if (!subchild.More()) {
continue;
}
- subchild.Initialize(SC->GetLabel(), true);
+ subchild.Init(itchild.Value(), true);
bool anEmpty = true;
for (; subchild.More() && anEmpty; subchild.Next()) {
- TDF_AttributeIterator AI2(subchild.Value());
- if (AI2.More()) anEmpty = false; //There are attributes on the child label
+ vector<DF_Attribute*> attr2 = subchild.Value().GetAttributes();
+ if (attr2.size()) {
+ anEmpty = false; //There are attributes on the child label
+ break;
+ }
}
if (anEmpty) continue;
}
- Handle(SALOMEDSImpl_SObject) SO = SALOMEDSImpl_Study::SObject(itchild.Value());
+ SALOMEDSImpl_SObject SO = SALOMEDSImpl_Study::SObject(itchild.Value());
- char* scoid = (char*) SO->GetID().ToCString();
+ char* scoid = (char*) SO.GetID().c_str();
hdf_group_sobject = new HDFgroup(scoid, hdf_group_datatype);
hdf_group_sobject->CreateOnDisk();
SaveAttributes(SO, hdf_group_sobject);
* Purpose :
*/
//============================================================================
-TCollection_AsciiString SALOMEDSImpl_StudyManager::Impl_SubstituteSlash(const TCollection_AsciiString& aUrl)
+string SALOMEDSImpl_StudyManager::Impl_SubstituteSlash(const string& aUrl)
{
_errorCode = "";
- TCollection_ExtendedString theUrl(aUrl);
- Standard_ExtCharacter val1 = ToExtCharacter('/');
- Standard_ExtCharacter val2 = ToExtCharacter(':');
- theUrl.ChangeAll(val1,val2);
+ std::string theUrl(aUrl);
+ for(int i = 0; i<theUrl.size(); i++)
+ if(theUrl[i] == '/') theUrl[i] = ':';
return theUrl;
}
* Purpose :
*/
//============================================================================
-Handle(TDocStd_Document) SALOMEDSImpl_StudyManager::GetDocumentOfStudy(const Handle(SALOMEDSImpl_Study)& theStudy)
+DF_Document* SALOMEDSImpl_StudyManager::GetDocumentOfStudy(SALOMEDSImpl_Study* theStudy)
{
_errorCode = "";
return theStudy->_doc;
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_StudyManager::CanCopy(const Handle(SALOMEDSImpl_SObject)& theObject,
+bool SALOMEDSImpl_StudyManager::CanCopy(const SALOMEDSImpl_SObject& theObject,
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;
+ SALOMEDSImpl_SComponent aComponent = theObject.GetFatherComponent();
+ if (!aComponent) return false;
+ if (aComponent.GetLabel() == theObject.GetLabel()) return false;
+ string IOREngine;
+ if (!aComponent.ComponentIOR(IOREngine)) return false;
if (theEngine == NULL) return false;
return theEngine->CanCopy(theObject);
}
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_StudyManager::CopyLabel(const Handle(SALOMEDSImpl_Study)& theSourceStudy,
+bool SALOMEDSImpl_StudyManager::CopyLabel(SALOMEDSImpl_Study* theSourceStudy,
SALOMEDSImpl_Driver* theEngine,
- const Standard_Integer theSourceStartDepth,
- const TDF_Label& theSource,
- const TDF_Label& theDestinationMain)
+ const int theSourceStartDepth,
+ const DF_Label& theSource,
+ const DF_Label& theDestinationMain)
{
_errorCode = "";
int a;
- TDF_Label aTargetLabel = theDestinationMain;
- TDF_Label aAuxTargetLabel = theDestinationMain.Father().FindChild(2);
+ DF_Label aTargetLabel = theDestinationMain;
+ DF_Label aAuxTargetLabel = theDestinationMain.Father().FindChild(2);
for(a = theSource.Depth() - theSourceStartDepth; a > 0 ; a--) {
- TDF_Label aSourceLabel = theSource;
+ DF_Label aSourceLabel = theSource;
for(int aNbFather = 1; aNbFather < a; aNbFather++) aSourceLabel = aSourceLabel.Father();
aTargetLabel = aTargetLabel.FindChild(aSourceLabel.Tag());
aAuxTargetLabel = aAuxTargetLabel.FindChild(aSourceLabel.Tag());
}
// iterate attributes
- TDF_AttributeIterator anAttrIterator(theSource);
- Handle(TDF_RelocationTable) aRT = new TDF_RelocationTable();
- for(; anAttrIterator.More(); anAttrIterator.Next()) {
- Handle(TDF_Attribute) anAttr = anAttrIterator.Value();
- if (!Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(anAttr).IsNull()) continue; // never copy tree node attribute
- if (!Handle(SALOMEDSImpl_AttributeTarget)::DownCast(anAttr).IsNull()) continue; // and target attribute
-
- if (!Handle(SALOMEDSImpl_AttributeReference)::DownCast(anAttr).IsNull()) { // reference copied as Comment in aux tree
- TDF_Label aReferenced = Handle(SALOMEDSImpl_AttributeReference)::DownCast(anAttr)->Get();
- TCollection_AsciiString anEntry;
- TDF_Tool::Entry(aReferenced, anEntry);
+ vector<DF_Attribute*> attrList = theSource.GetAttributes();
+ for(int i = 0, len = attrList.size(); i<len; i++) {
+ DF_Attribute* anAttr = attrList[i];
+ string type = SALOMEDSImpl_GenericAttribute::Impl_GetType(anAttr);
+ if (type.substr(0, 17) == string("AttributeTreeNode")) continue; // never copy tree node attribute
+ if (type == string("AttributeTarget")) continue; // and target attribute
+
+ if (type == string("AttributeReference")) { // reference copied as Comment in aux tree
+ DF_Label aReferenced = dynamic_cast<SALOMEDSImpl_AttributeReference*>(anAttr)->Get();
+ string anEntry = aReferenced.Entry();
// store the value of name attribute of referenced label
- Handle(SALOMEDSImpl_AttributeName) aNameAttribute;
- if (aReferenced.FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aNameAttribute)) {
+ SALOMEDSImpl_AttributeName* aNameAttribute;
+ if ((aNameAttribute=(SALOMEDSImpl_AttributeName*)aReferenced.FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) {
anEntry += " ";
anEntry += aNameAttribute->Value();
}
- SALOMEDSImpl_AttributeComment::Set(aAuxTargetLabel, TCollection_ExtendedString(anEntry));
+ SALOMEDSImpl_AttributeComment::Set(aAuxTargetLabel, anEntry);
continue;
}
- if (!Handle(SALOMEDSImpl_AttributeIOR)::DownCast(anAttr).IsNull()) { // IOR => ID and TMPFile of Engine
- TCollection_AsciiString anEntry;
- TDF_Tool::Entry(theSource, anEntry);
- Handle(SALOMEDSImpl_SObject) aSO = theSourceStudy->FindObjectID(anEntry.ToCString());
+ if (type == string("AttributeIOR")) { // IOR => ID and TMPFile of Engine
+ string anEntry = theSource.Entry();
+ SALOMEDSImpl_SObject aSO = theSourceStudy->FindObjectID(anEntry);
int anObjID;
long aLen;
- Handle(SALOMEDSImpl_TMPFile) aStream = theEngine->CopyFrom(aSO, anObjID, aLen);
- TCollection_ExtendedString aResStr("");
+ SALOMEDSImpl_TMPFile* aStream = theEngine->CopyFrom(aSO, anObjID, aLen);
+ string aResStr("");
for(a = 0; a < aLen; a++) {
- aResStr += TCollection_ExtendedString(ToExtCharacter(Standard_Character(aStream->Get(a))));
+ aResStr += (char)(aStream->Get(a));
}
+
+ if(aStream) delete aStream;
+
SALOMEDSImpl_AttributeInteger::Set(aAuxTargetLabel, anObjID);
SALOMEDSImpl_AttributeName::Set(aAuxTargetLabel, aResStr);
continue;
}
- Handle(TDF_Attribute) aNewAttribute = anAttr->NewEmpty();
+ DF_Attribute* aNewAttribute = anAttr->NewEmpty();
aTargetLabel.AddAttribute(aNewAttribute);
- anAttr->Paste(aNewAttribute, aRT);
+ anAttr->Paste(aNewAttribute);
}
return true;
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_StudyManager::Copy(const Handle(SALOMEDSImpl_SObject)& theObject,
+bool SALOMEDSImpl_StudyManager::Copy(const SALOMEDSImpl_SObject& theObject,
SALOMEDSImpl_Driver* theEngine)
{
_errorCode = "";
// adoptation for alliances datamodel copy: without IOR attributes !!!
bool aStructureOnly; // copy only SObjects and attributes without component help
- aStructureOnly = !theObject->GetLabel().IsAttribute(SALOMEDSImpl_AttributeIOR::GetID());
+ aStructureOnly = !theObject.GetLabel().IsAttribute(SALOMEDSImpl_AttributeIOR::GetID());
// get component-engine
- Handle(SALOMEDSImpl_Study) aStudy = theObject->GetStudy();
+ SALOMEDSImpl_Study* aStudy = theObject.GetStudy();
// CAF document of current study usage
- Handle(TDocStd_Document) aDocument = GetDocumentOfStudy(aStudy);
- if (aDocument.IsNull()) {
- _errorCode = "OCAF document is null";
+ DF_Document* aDocument = GetDocumentOfStudy(aStudy);
+ if (!aDocument) {
+ _errorCode = "Document is null";
return false;
}
//Clear the clipboard
- _clipboard->Main().Root().ForgetAllAttributes(Standard_True);
- _OCAFApp->Close(_clipboard);
- Handle(TDocStd_Document) aDoc;
- _OCAFApp->NewDocument("SALOME_STUDY", aDoc);
- _clipboard = aDoc;
+ _clipboard->Main().Root().ForgetAllAttributes(true);
+ _appli->Close(_clipboard);
+ _clipboard = _appli->NewDocument("SALOME_STUDY");
// set component data type to the name attribute of root label
if (!aStructureOnly) {
SALOMEDSImpl_AttributeComment::Set(_clipboard->Main().Root(),
- TCollection_ExtendedString(theEngine->ComponentDataType()));
+ theEngine->ComponentDataType());
}
// set to the Root label integer attribute: study id
SALOMEDSImpl_AttributeInteger::Set(_clipboard->Main().Root(), aStudy->StudyId());
// iterate all theObject's label children
- TDF_Label aStartLabel = theObject->GetLabel();
- Standard_Integer aSourceStartDepth = aStartLabel.Depth();
+ DF_Label aStartLabel = theObject.GetLabel();
+ int aSourceStartDepth = aStartLabel.Depth();
// copy main source label
CopyLabel(aStudy, theEngine, aSourceStartDepth, aStartLabel, _clipboard->Main());
// copy all subchildren of the main source label (all levels)
- TDF_ChildIterator anIterator(aStartLabel, Standard_True);
+ DF_ChildIterator anIterator(aStartLabel, true);
for(; anIterator.More(); anIterator.Next()) {
CopyLabel(aStudy, theEngine, aSourceStartDepth, anIterator.Value(), _clipboard->Main());
}
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_StudyManager::CanPaste(const Handle(SALOMEDSImpl_SObject)& theObject,
+bool SALOMEDSImpl_StudyManager::CanPaste(const SALOMEDSImpl_SObject& theObject,
SALOMEDSImpl_Driver* theEngine)
{
_errorCode = "";
- if (_clipboard.IsNull()) {
+ if (!_clipboard) {
_errorCode = "Clipboard is null";
return false;
}
- Handle(SALOMEDSImpl_AttributeComment) aCompName;
- if (!_clipboard->Main().Root().FindAttribute(SALOMEDSImpl_AttributeComment::GetID(), aCompName)) {
+ SALOMEDSImpl_AttributeComment* aCompName = NULL;
+ if (!(aCompName=(SALOMEDSImpl_AttributeComment*)_clipboard->Main().Root().FindAttribute(SALOMEDSImpl_AttributeComment::GetID()))) {
_errorCode = "Clipboard has no component type";
return false;
}
- Handle(SALOMEDSImpl_AttributeInteger) anObjID;
- if (!_clipboard->Main().Father().FindChild(2).FindAttribute(SALOMEDSImpl_AttributeInteger::GetID(), anObjID)) {
+ SALOMEDSImpl_AttributeInteger* anObjID;
+ if (!(anObjID=(SALOMEDSImpl_AttributeInteger*)_clipboard->Main().Father().FindChild(2).FindAttribute(SALOMEDSImpl_AttributeInteger::GetID()))) {
_errorCode = "Clipboard has no object id";
return false;
}
- Handle(SALOMEDSImpl_SComponent) aComponent = theObject->GetFatherComponent();
- if (aComponent.IsNull()) {
+ SALOMEDSImpl_SComponent aComponent = theObject.GetFatherComponent();
+ if (!aComponent) {
_errorCode = "Object doesn't belong to component";
return false;
}
- TCollection_AsciiString IOREngine;
- if (!aComponent->ComponentIOR(IOREngine)) {
+ string IOREngine;
+ if (!aComponent.ComponentIOR(IOREngine)) {
_errorCode = "component has no IOR";
return false;
}
* Purpose :
*/
//============================================================================
-TDF_Label SALOMEDSImpl_StudyManager::PasteLabel(const Handle(SALOMEDSImpl_Study)& theDestinationStudy,
- SALOMEDSImpl_Driver* theEngine,
- const TDF_Label& theSource,
- const TDF_Label& theDestinationStart,
- const int theCopiedStudyID,
- const bool isFirstElement)
+DF_Label SALOMEDSImpl_StudyManager::PasteLabel(SALOMEDSImpl_Study* theDestinationStudy,
+ SALOMEDSImpl_Driver* theEngine,
+ const DF_Label& theSource,
+ const DF_Label& theDestinationStart,
+ const int theCopiedStudyID,
+ const bool isFirstElement)
{
_errorCode = "";
// get corresponding source, target and auxiliary labels
- TDF_Label aTargetLabel = theDestinationStart;
+ DF_Label aTargetLabel = theDestinationStart;
- TDF_Label aAuxSourceLabel = theSource.Root().FindChild(2);
+ DF_Label aAuxSourceLabel = theSource.Root().FindChild(2);
int a;
if (!isFirstElement) {
for(a = theSource.Depth() - 1; a > 0 ; a--) {
- TDF_Label aSourceLabel = theSource;
+ DF_Label aSourceLabel = theSource;
for(int aNbFather = 1; aNbFather < a; aNbFather++) aSourceLabel = aSourceLabel.Father();
aTargetLabel = aTargetLabel.FindChild(aSourceLabel.Tag());
aAuxSourceLabel = aAuxSourceLabel.FindChild(aSourceLabel.Tag());
}
// check auxiliary label for TMPFile => IOR
- Handle(SALOMEDSImpl_AttributeName) aNameAttribute;
- if (aAuxSourceLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aNameAttribute)) {
- Handle(SALOMEDSImpl_AttributeInteger) anObjID;
-
- aAuxSourceLabel.FindAttribute(SALOMEDSImpl_AttributeInteger::GetID(), anObjID);
- Handle(SALOMEDSImpl_AttributeComment) aComponentName;
- theSource.Root().FindAttribute(SALOMEDSImpl_AttributeComment::GetID(), aComponentName);
- TCollection_AsciiString aCompName = aComponentName->Value();
+ SALOMEDSImpl_AttributeName* aNameAttribute = NULL;
+ if ((aNameAttribute=(SALOMEDSImpl_AttributeName*)aAuxSourceLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) {
+ SALOMEDSImpl_AttributeInteger* anObjID = (SALOMEDSImpl_AttributeInteger*)aAuxSourceLabel.FindAttribute(SALOMEDSImpl_AttributeInteger::GetID());
+ SALOMEDSImpl_AttributeComment* aComponentName = (SALOMEDSImpl_AttributeComment*)theSource.Root().FindAttribute(SALOMEDSImpl_AttributeComment::GetID());
+ string aCompName = aComponentName->Value();
if (theEngine->CanPaste(aCompName, anObjID->Value())) {
- TCollection_ExtendedString aTMPStr = aNameAttribute->Value();
- int aLen = aTMPStr.Length();
+ std::string aTMPStr = aNameAttribute->Value();
+ int aLen = aTMPStr.size();
unsigned char* aStream = NULL;
if(aLen > 0) {
aStream = new unsigned char[aLen+10];
for(a = 0; a < aLen; a++) {
- aStream[a] = ToCharacter(aTMPStr.Value(a+1));
+ aStream[a] = aTMPStr[a];
}
}
- TCollection_AsciiString anEntry;
- TDF_Tool::Entry(aTargetLabel, anEntry);
- Handle(SALOMEDSImpl_SObject) aPastedSO = theDestinationStudy->FindObjectID(anEntry);
+ string anEntry = aTargetLabel.Entry();
+ SALOMEDSImpl_SObject aPastedSO = theDestinationStudy->FindObjectID(anEntry);
if (isFirstElement) {
- TCollection_AsciiString aDestEntry = theEngine->PasteInto(aStream,
- aLen,
- anObjID->Value(),
- aPastedSO->GetFatherComponent());
- TDF_Tool::Label(theDestinationStart.Data(), aDestEntry, aTargetLabel);
+ string aDestEntry = theEngine->PasteInto(aStream,
+ aLen,
+ anObjID->Value(),
+ aPastedSO.GetFatherComponent());
+ aTargetLabel = DF_Label::Label(theDestinationStart, aDestEntry);
} else
theEngine->PasteInto(aStream, aLen, anObjID->Value(), aPastedSO);
}
// iterate attributes
- TDF_AttributeIterator anAttrIterator(theSource);
- Handle(TDF_RelocationTable) aRT = new TDF_RelocationTable();
- for(; anAttrIterator.More(); anAttrIterator.Next()) {
- Handle(TDF_Attribute) anAttr = anAttrIterator.Value();
- if (aTargetLabel.FindAttribute(anAttr->ID(), anAttr)) {
+ vector<DF_Attribute*> attrList = theSource.GetAttributes();
+ for(int i = 0, len = attrList.size(); i<len; i++) {
+ DF_Attribute* anAttr = attrList[i];
+ if (aTargetLabel.FindAttribute(anAttr->ID())) {
aTargetLabel.ForgetAttribute(anAttr->ID());
- anAttr = anAttrIterator.Value();
}
- Handle(TDF_Attribute) aNewAttribute = anAttr->NewEmpty();
+ DF_Attribute* aNewAttribute = anAttr->NewEmpty();
aTargetLabel.AddAttribute(aNewAttribute);
- anAttr->Paste(aNewAttribute, aRT);
+ anAttr->Paste(aNewAttribute);
}
// check auxiliary label for Comment => reference or name attribute of the referenced object
- Handle(SALOMEDSImpl_AttributeComment) aCommentAttribute;
- if (aAuxSourceLabel.FindAttribute(SALOMEDSImpl_AttributeComment::GetID(), aCommentAttribute)) {
- char * anEntry = new char[aCommentAttribute->Value().Length() + 1];
- strcpy(anEntry, TCollection_AsciiString(aCommentAttribute->Value()).ToCString());
+ SALOMEDSImpl_AttributeComment* aCommentAttribute = NULL;
+ if ((aCommentAttribute=(SALOMEDSImpl_AttributeComment*)aAuxSourceLabel.FindAttribute(SALOMEDSImpl_AttributeComment::GetID()))) {
+ char * anEntry = new char[aCommentAttribute->Value().size() + 1];
+ strcpy(anEntry, string(aCommentAttribute->Value()).c_str());
char* aNameStart = strchr(anEntry, ' ');
if (aNameStart) {
*aNameStart = '\0';
aNameStart++;
}
if (theCopiedStudyID == theDestinationStudy->StudyId()) { // if copy to the same study, reanimate reference
- TDF_Label aRefLabel;
- TDF_Tool::Label(aTargetLabel.Data(), anEntry, aRefLabel);
+ DF_Label aRefLabel = DF_Label::Label(aTargetLabel, anEntry);
SALOMEDSImpl_AttributeReference::Set(aTargetLabel, aRefLabel);
// target attributes structure support
SALOMEDSImpl_AttributeTarget::Set(aRefLabel)->Add(SALOMEDSImpl_Study::SObject(aTargetLabel));
} else {
if (aNameStart) SALOMEDSImpl_AttributeName::Set(aTargetLabel, aNameStart);
- else SALOMEDSImpl_AttributeName::Set(aTargetLabel, TCollection_ExtendedString("Reference to:")+anEntry);
+ else SALOMEDSImpl_AttributeName::Set(aTargetLabel, std::string("Reference to:")+anEntry);
}
delete [] anEntry;
}
* Purpose :
*/
//============================================================================
-Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_StudyManager::Paste(const Handle(SALOMEDSImpl_SObject)& theObject,
- SALOMEDSImpl_Driver* theEngine)
+SALOMEDSImpl_SObject SALOMEDSImpl_StudyManager::Paste(const SALOMEDSImpl_SObject& theObject,
+ SALOMEDSImpl_Driver* theEngine)
{
_errorCode = "";
- Handle(SALOMEDSImpl_Study) aStudy = theObject->GetStudy();
+ SALOMEDSImpl_SObject so;
+ SALOMEDSImpl_Study* aStudy = theObject.GetStudy();
// if study is locked, then paste can't be done
if (aStudy->GetProperties()->IsLocked()) {
}
// if there is no component name, then paste only SObjects and attributes: without component help
- Handle(SALOMEDSImpl_AttributeComment) aComponentName;
- bool aStructureOnly = !_clipboard->Main().Root().FindAttribute(SALOMEDSImpl_AttributeComment::GetID(), aComponentName);
+ SALOMEDSImpl_AttributeComment* aComponentName = NULL;
+ bool aStructureOnly = !(aComponentName=(SALOMEDSImpl_AttributeComment*)_clipboard->Main().Root().FindAttribute(SALOMEDSImpl_AttributeComment::GetID()));
// get copied study ID
- Handle(SALOMEDSImpl_AttributeInteger) aStudyIDAttribute;
- if (!_clipboard->Main().Root().FindAttribute(SALOMEDSImpl_AttributeInteger::GetID(), aStudyIDAttribute)) {
+ SALOMEDSImpl_AttributeInteger* aStudyIDAttribute = NULL;
+ if (!(aStudyIDAttribute=(SALOMEDSImpl_AttributeInteger*)_clipboard->Main().Root().FindAttribute(SALOMEDSImpl_AttributeInteger::GetID()))) {
_errorCode = "No study ID was found";
- return NULL;
+ return so;
}
int aCStudyID = aStudyIDAttribute->Value();
// CAF document of current study usage
- Handle(TDocStd_Document) aDocument = GetDocumentOfStudy(aStudy);
- if (aDocument.IsNull()) {
- _errorCode = "OCAF document is null";
- return NULL;
+ DF_Document* aDocument = GetDocumentOfStudy(aStudy);
+ if (!aDocument) {
+ _errorCode = "Document is null";
+ return so;
}
- Handle(SALOMEDSImpl_SComponent) aComponent = theObject->GetFatherComponent();
+ SALOMEDSImpl_SComponent aComponent = theObject.GetFatherComponent();
// fill root inserted SObject
- TDF_Label aStartLabel;
+ DF_Label aStartLabel;
if (aStructureOnly) {
- TDF_Label anObjectLabel;
- TDF_Tool::Label(aDocument->GetData(), theObject->GetID(), anObjectLabel);
+ DF_Label anObjectLabel = DF_Label::Label(aDocument->Main(), theObject.GetID());
aStartLabel = PasteLabel(aStudy, theEngine, _clipboard->Main(), anObjectLabel, aCStudyID, false);
} else {
- TDF_Label aComponentLabel;
- TDF_Tool::Label(aDocument->GetData(), aComponent->GetID(), aComponentLabel);
+ DF_Label aComponentLabel = DF_Label::Label(aDocument->Main(), aComponent.GetID());
aStartLabel = PasteLabel(aStudy, theEngine, _clipboard->Main(), aComponentLabel, aCStudyID, true);
}
// paste all sublebels
- TDF_ChildIterator anIterator(_clipboard->Main(), Standard_True);
+ DF_ChildIterator anIterator(_clipboard->Main(), true);
for(; anIterator.More(); anIterator.Next()) {
PasteLabel(aStudy, theEngine, anIterator.Value(), aStartLabel, aCStudyID, false);
}
* Purpose : Save attributes for object
*/
//============================================================================
-static void SaveAttributes(Handle(SALOMEDSImpl_SObject) aSO, HDFgroup *hdf_group_sobject)
+static void SaveAttributes(const SALOMEDSImpl_SObject& aSO, HDFgroup *hdf_group_sobject)
{
hdf_size size[1];
- TDF_AttributeIterator Itr(aSO->GetLabel());
- Handle(TDF_Attribute) anAttr;
- for(; Itr.More(); Itr.Next()) {
- anAttr = Itr.Value();
+ vector<DF_Attribute*> attrList = aSO.GetLabel().GetAttributes();
+ DF_Attribute* anAttr = NULL;
+ for(int i = 0, len = attrList.size(); i<len; i++) {
+ anAttr = attrList[i];
//The following attributes are not supposed to be written to the file
- if(anAttr->DynamicType() == STANDARD_TYPE(SALOMEDSImpl_AttributeIOR)) continue; //IOR attribute is not saved
- Handle(SALOMEDSImpl_GenericAttribute) ga = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(anAttr);
- TCollection_AsciiString aSaveStr = ga->Save();
- //cout << "Saving: " << aSO->GetID() << " "<< ga->Type() << " value: " << aSaveStr << endl;
- size[0] = (hdf_int32) strlen(aSaveStr.ToCString()) + 1;
- HDFdataset *hdf_dataset = new HDFdataset((char*)ga->Type().ToCString(), hdf_group_sobject,HDF_STRING,size,1);
+ string type = SALOMEDSImpl_GenericAttribute::Impl_GetType(anAttr);
+ if(type == string("AttributeIOR")) continue; //IOR attribute is not saved
+ string aSaveStr =anAttr->Save();
+ //cout << "Saving: " << aSO.GetID() << " type: "<< type<<"|" << endl;
+ size[0] = (hdf_int32) strlen(aSaveStr.c_str()) + 1;
+ HDFdataset *hdf_dataset = new HDFdataset((char*)type.c_str(), hdf_group_sobject, HDF_STRING,size, 1);
hdf_dataset->CreateOnDisk();
- hdf_dataset->WriteOnDisk((char*)aSaveStr.ToCString());
+ hdf_dataset->WriteOnDisk((char*)aSaveStr.c_str());
hdf_dataset->CloseOnDisk();
hdf_dataset=0; //will be deleted by hdf_sco_group destructor
}
//===========================================================================
//Function : ReadAttributes
//===========================================================================
-static void ReadAttributes(const Handle(SALOMEDSImpl_Study)& theStudy,
- const Handle(SALOMEDSImpl_SObject)& aSO,
+static void ReadAttributes(SALOMEDSImpl_Study* theStudy,
+ const SALOMEDSImpl_SObject& aSO,
HDFdataset* hdf_dataset)
{
hdf_dataset->OpenOnDisk();
- Handle(TDF_Attribute) anAttr;
-
+ DF_Attribute* anAttr = NULL;
char* current_string = new char[hdf_dataset->GetSize()+1];
hdf_dataset->ReadFromDisk(current_string);
-
+ //cout << "Reading attr type = " << hdf_dataset->GetName() << " SO = " << aSO.GetID() << endl;
if (!strcmp(hdf_dataset->GetName(),"COMPONENTDATATYPE")) {
anAttr = theStudy->NewBuilder()->FindOrCreateAttribute(aSO, "AttributeComment");
} else if (!strcmp(hdf_dataset->GetName(),"AttributeReference") ||
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;
+ if (anAttr) {
+ anAttr->Load(current_string);
}
delete(current_string);
//============================================================================
//Function : BuildlTree
//============================================================================
-static void BuildTree (const Handle(SALOMEDSImpl_Study)& theStudy, HDFgroup* hdf_current_group)
+static void BuildTree (SALOMEDSImpl_Study* theStudy, HDFgroup* hdf_current_group)
{
hdf_current_group->OpenOnDisk();
- Handle(SALOMEDSImpl_SObject) aSO;
+ SALOMEDSImpl_SObject aSO;
char* Entry = hdf_current_group->GetName();
if (strcmp(Entry,"STUDY_STRUCTURE") == 0) {
aSO = theStudy->CreateObjectID("0:1");
}
char name[HDF_NAME_MAX_LEN+1];
- Standard_Integer nbsons = hdf_current_group->nInternalObjects();
- for (Standard_Integer i=0; i<nbsons; i++) {
+ int nbsons = hdf_current_group->nInternalObjects();
+ for (int i=0; i<nbsons; i++) {
hdf_current_group->InternalObjectIndentify(i,name);
if (strncmp(name, "INTERNAL_COMPLEX",16) == 0) continue;
hdf_object_type type = hdf_current_group->InternalObjectType(name);
//============================================================================
//Function : Translate_IOR_to_persistentID
//============================================================================
-static void Translate_IOR_to_persistentID (const Handle(SALOMEDSImpl_SObject)& so,
+static void Translate_IOR_to_persistentID (const SALOMEDSImpl_SObject& so,
SALOMEDSImpl_Driver* engine,
bool isMultiFile,
bool isASCII)
{
- TDF_ChildIterator itchild(so->GetLabel());
- TCollection_AsciiString ior_string, persistent_string, curid;
+ DF_ChildIterator itchild(so.GetLabel());
+ string ior_string, persistent_string, curid;
for (; itchild.More(); itchild.Next()) {
- Handle(SALOMEDSImpl_SObject) current = SALOMEDSImpl_Study::SObject(itchild.Value());
- Handle(SALOMEDSImpl_AttributeIOR) IOR;
- if (current->GetLabel().FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(), IOR)) {
+ SALOMEDSImpl_SObject current = SALOMEDSImpl_Study::SObject(itchild.Value());
+ SALOMEDSImpl_AttributeIOR* IOR = NULL;
+ if ((IOR=(SALOMEDSImpl_AttributeIOR*)current.GetLabel().FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) {
ior_string = IOR->Value();
persistent_string = engine->IORToLocalPersistentID (current, ior_string, isMultiFile, isASCII);
- SALOMEDSImpl_AttributePersistentRef::Set(current->GetLabel(), persistent_string);
+ SALOMEDSImpl_AttributePersistentRef::Set(current.GetLabel(), persistent_string);
}
Translate_IOR_to_persistentID (current, engine, isMultiFile, isASCII);
}
}
+
#ifndef __SALOMEDSImpl_STUDYMANAGER_I_H__
#define __SALOMEDSImpl_STUDYMANAGER_I_H__
-//Handle definition
-#include <Handle_MMgt_TShared.hxx>
-#include <Standard_DefineHandle.hxx>
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_StudyManager, MMgt_TShared )
-
// std C++ headers
#include <strstream>
+#include <string>
+#include <vector>
-// Cascade headers
-#include "SALOMEDSImpl_OCAFApplication.hxx"
+#include "DF_Application.hxx"
#include "SALOMEDSImpl_Study.hxx"
#include "SALOMEDSImpl_SObject.hxx"
#include "SALOMEDSImpl_Driver.hxx"
-#include <TCollection_AsciiString.hxx>
-#include <TDF_Attribute.hxx>
-#include <TDF_Label.hxx>
-#include <TDocStd_Document.hxx>
-#include <TColStd_HSequenceOfTransient.hxx>
+#include "DF_Attribute.hxx"
+#include "DF_Label.hxx"
+#include "DF_Document.hxx"
class HDFgroup;
-class SALOMEDSImpl_StudyManager : public MMgt_TShared
+class SALOMEDSImpl_StudyManager
{
private:
- Handle (SALOMEDSImpl_OCAFApplication) _OCAFApp;
- int _IDcounter;
- Handle(TDocStd_Document) _clipboard;
- TCollection_AsciiString _errorCode;
+ DF_Application* _appli;
+ int _IDcounter;
+ DF_Document* _clipboard;
+ std::string _errorCode;
public:
Standard_EXPORT virtual ~SALOMEDSImpl_StudyManager();
//! method to Create a New Study of name study_name
- Standard_EXPORT virtual Handle(SALOMEDSImpl_Study) NewStudy(const TCollection_AsciiString& study_name);
+ Standard_EXPORT virtual SALOMEDSImpl_Study* NewStudy(const std::string& study_name);
//! method to Open a Study from it's persistent reference
- Standard_EXPORT virtual Handle(SALOMEDSImpl_Study) Open(const TCollection_AsciiString& aStudyUrl);
+ Standard_EXPORT virtual SALOMEDSImpl_Study* Open(const std::string& aStudyUrl);
//! method to close a Study
- Standard_EXPORT virtual void Close(const Handle(SALOMEDSImpl_Study)& aStudy);
+ Standard_EXPORT virtual void Close(SALOMEDSImpl_Study* aStudy);
//! method to save a Study
- Standard_EXPORT virtual bool Save(const Handle(SALOMEDSImpl_Study)& aStudy, SALOMEDSImpl_DriverFactory* aFactory, bool theMultiFile);
+ Standard_EXPORT virtual bool Save(SALOMEDSImpl_Study* aStudy, SALOMEDSImpl_DriverFactory* aFactory, bool theMultiFile);
- Standard_EXPORT virtual bool SaveASCII(const Handle(SALOMEDSImpl_Study)& aStudy,
- SALOMEDSImpl_DriverFactory* aFactory,
- bool theMultiFile);
+ Standard_EXPORT virtual bool SaveASCII(SALOMEDSImpl_Study* aStudy,
+ SALOMEDSImpl_DriverFactory* aFactory,
+ bool theMultiFile);
//! method to save a Study to the persistent reference aUrl
- Standard_EXPORT virtual bool SaveAs(const TCollection_AsciiString& aUrl,
- const Handle(SALOMEDSImpl_Study)& aStudy,
- SALOMEDSImpl_DriverFactory* aFactory,
- bool theMultiFile);
+ Standard_EXPORT virtual bool SaveAs(const std::string& aUrl,
+ SALOMEDSImpl_Study* aStudy,
+ SALOMEDSImpl_DriverFactory* aFactory,
+ bool theMultiFile);
- Standard_EXPORT virtual bool SaveAsASCII(const TCollection_AsciiString& aUrl,
- const Handle(SALOMEDSImpl_Study)& aStudy,
- SALOMEDSImpl_DriverFactory* aFactory,
- bool theMultiFile);
+ Standard_EXPORT virtual bool SaveAsASCII(const std::string& aUrl,
+ SALOMEDSImpl_Study* aStudy,
+ SALOMEDSImpl_DriverFactory* aFactory,
+ bool theMultiFile);
//! method to Get name list of open studies in the session
- Standard_EXPORT virtual Handle(TColStd_HSequenceOfTransient) GetOpenStudies();
+ Standard_EXPORT virtual std::vector<SALOMEDSImpl_Study*> GetOpenStudies();
//! method to get a Study from it's name
- Standard_EXPORT virtual Handle(SALOMEDSImpl_Study) GetStudyByName(const TCollection_AsciiString& aStudyName) ;
+ Standard_EXPORT virtual SALOMEDSImpl_Study* GetStudyByName(const std::string& aStudyName) ;
//! method to get a Study from it's ID
- Standard_EXPORT virtual Handle(SALOMEDSImpl_Study) GetStudyByID(int aStudyID) ;
+ Standard_EXPORT virtual SALOMEDSImpl_Study* GetStudyByID(int aStudyID) ;
- Standard_EXPORT Handle(TDocStd_Document) GetDocumentOfStudy(const Handle(SALOMEDSImpl_Study)& theStudy);
+ Standard_EXPORT DF_Document* GetDocumentOfStudy(SALOMEDSImpl_Study* theStudy);
- Standard_EXPORT Handle(TDocStd_Document) GetClipboard() { return _clipboard; }
+ Standard_EXPORT DF_Document* GetClipboard() { return _clipboard; }
- Standard_EXPORT bool CopyLabel(const Handle(SALOMEDSImpl_Study)& theSourceStudy,
- SALOMEDSImpl_Driver* theEngine,
- const int theSourceStartDepth,
- const TDF_Label& theSource,
- const TDF_Label& theDestinationMain);
-
- Standard_EXPORT TDF_Label PasteLabel(const Handle(SALOMEDSImpl_Study)& theDestinationStudy,
- SALOMEDSImpl_Driver* theEngine,
- const TDF_Label& theSource,
- const TDF_Label& theDestinationStart,
- const int theCopiedStudyID,
- const bool isFirstElement);
+ Standard_EXPORT bool CopyLabel(SALOMEDSImpl_Study* theSourceStudy,
+ SALOMEDSImpl_Driver* theEngine,
+ const int theSourceStartDepth,
+ const DF_Label& theSource,
+ const DF_Label& theDestinationMain);
+
+ Standard_EXPORT DF_Label PasteLabel(SALOMEDSImpl_Study* theDestinationStudy,
+ SALOMEDSImpl_Driver* theEngine,
+ const DF_Label& theSource,
+ const DF_Label& theDestinationStart,
+ const int theCopiedStudyID,
+ const bool isFirstElement);
- Standard_EXPORT virtual bool CanCopy(const Handle(SALOMEDSImpl_SObject)& theObject, SALOMEDSImpl_Driver* Engine);
- Standard_EXPORT virtual bool Copy(const Handle(SALOMEDSImpl_SObject)& theObject, SALOMEDSImpl_Driver* Engine);
- Standard_EXPORT virtual bool CanPaste(const Handle(SALOMEDSImpl_SObject)& theObject, SALOMEDSImpl_Driver* Engine);
- Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) Paste(const Handle(SALOMEDSImpl_SObject)& theObject, SALOMEDSImpl_Driver* Engine);
+ Standard_EXPORT virtual bool CanCopy(const SALOMEDSImpl_SObject& theObject, SALOMEDSImpl_Driver* Engine);
+ Standard_EXPORT virtual bool Copy(const SALOMEDSImpl_SObject& theObject, SALOMEDSImpl_Driver* Engine);
+ Standard_EXPORT virtual bool CanPaste(const SALOMEDSImpl_SObject& theObject, SALOMEDSImpl_Driver* Engine);
+ Standard_EXPORT virtual SALOMEDSImpl_SObject Paste(const SALOMEDSImpl_SObject& theObject, SALOMEDSImpl_Driver* Engine);
// _SaveAs private function called by Save and SaveAs
- Standard_EXPORT virtual bool Impl_SaveAs(const TCollection_AsciiString& aUrl,
- const Handle(SALOMEDSImpl_Study)& aStudy,
- SALOMEDSImpl_DriverFactory* aFactory,
- bool theMultiFile,
- bool theASCII);
+ Standard_EXPORT virtual bool Impl_SaveAs(const std::string& aUrl,
+ SALOMEDSImpl_Study* aStudy,
+ SALOMEDSImpl_DriverFactory* aFactory,
+ bool theMultiFile,
+ bool theASCII);
// _SaveObject private function called by _SaveAs
- Standard_EXPORT virtual bool Impl_SaveObject(const Handle(SALOMEDSImpl_SObject)& SC, HDFgroup *hdf_group_datatype);
+ Standard_EXPORT virtual bool Impl_SaveObject(const SALOMEDSImpl_SObject& SC, HDFgroup *hdf_group_datatype);
// _SubstituteSlash function called by Open and GetStudyByName
- Standard_EXPORT virtual TCollection_AsciiString Impl_SubstituteSlash(const TCollection_AsciiString& aUrl);
+ Standard_EXPORT virtual std::string Impl_SubstituteSlash(const std::string& aUrl);
- Standard_EXPORT virtual bool Impl_SaveProperties(const Handle(SALOMEDSImpl_Study)& aStudy, HDFgroup *hdf_group);
+ Standard_EXPORT virtual bool Impl_SaveProperties(SALOMEDSImpl_Study* aStudy, HDFgroup *hdf_group);
- Standard_EXPORT TCollection_AsciiString GetErrorCode() { return _errorCode; }
+ Standard_EXPORT std::string GetErrorCode() { return _errorCode; }
Standard_EXPORT virtual bool IsError() { return _errorCode != ""; }
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_StudyManager )
-
};
#endif
#include "SALOMEDSImpl_TMPFile.hxx"
-#include <Handle_Standard_Type.hxx>
-#include <Standard_Transient.hxx>
-
-
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_TMPFile, MMgt_TShared )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_TMPFile, MMgt_TShared )
-
SALOMEDSImpl_TMPFile::TOctet*
SALOMEDSImpl_TMPFile
::Data()
#ifndef __SALOMEDSIMPL_TMPFILE_H__
#define __SALOMEDSIMPL_TMPFILE_H__
-//Handle definition
-#include <MMgt_TShared.hxx>
-#include <Handle_MMgt_TShared.hxx>
-#include <Standard_DefineHandle.hxx>
+#include "DF_definitions.hxx"
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_TMPFile, MMgt_TShared );
-
-
-struct SALOMEDSImpl_TMPFile : public MMgt_TShared
+struct SALOMEDSImpl_TMPFile
{
typedef unsigned char TOctet;
+ //typedef unsigned int size_t;
Standard_EXPORT virtual size_t Size() = 0;
Standard_EXPORT virtual TOctet* Data();
Standard_EXPORT virtual TOctet& Get(size_t) = 0;
-
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_TMPFile );
};
#include <stdio.h>
#include <iostream>
#include <fstream>
-#include <OSD_Path.hxx>
-#include <OSD_File.hxx>
-#include <OSD_Directory.hxx>
-#include <OSD_Process.hxx>
-#include <OSD_Directory.hxx>
-#include <OSD_Protection.hxx>
-#include <OSD_SingleProtection.hxx>
-#include <OSD_FileIterator.hxx>
+
#ifndef WNT
#include <sys/time.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <pwd.h>
#else
#include <time.h>
+#include <lmcons.h>
#endif
+
#include <stdlib.h>
using namespace std;
+
+bool Exists(const string thePath)
+{
+#ifdef WNT
+ if ( GetFileAttributes ( thePath.c_str() ) == 0xFFFFFFFF ) {
+ if ( GetLastError () != ERROR_FILE_NOT_FOUND ) {
+ return false;
+ }
+ }
+#else
+ int status = access ( thePath.c_str() , F_OK );
+ if (status != 0) return false;
+#endif
+ return true;
+}
+
+
+
+
//============================================================================
// function : GetTempDir
// purpose : Return a temp directory to store created files like "/tmp/sub_dir/"
//============================================================================
-TCollection_AsciiString SALOMEDSImpl_Tool::GetTmpDir()
+string SALOMEDSImpl_Tool::GetTmpDir()
{
//Find a temporary directory to store a file
- TCollection_AsciiString aTmpDir;
+ string aTmpDir;
char *Tmp_dir = getenv("SALOME_TMP_DIR");
if(Tmp_dir != NULL) {
- aTmpDir = TCollection_AsciiString(Tmp_dir);
+ aTmpDir = string(Tmp_dir);
#ifdef WIN32
- if(aTmpDir.Value(aTmpDir.Length()) != '\\') aTmpDir+='\\';
+ if(aTmpDir[aTmpDir.size()-1] != '\\') aTmpDir+='\\';
#else
- if(aTmpDir.Value(aTmpDir.Length()) != '/') aTmpDir+='/';
+ if(aTmpDir[aTmpDir.size()-1] != '/') aTmpDir+='/';
#endif
}
else {
#ifdef WIN32
- aTmpDir = TCollection_AsciiString("C:\\");
+ aTmpDir = string("C:\\");
#else
- aTmpDir = TCollection_AsciiString("/tmp/");
+ aTmpDir = string("/tmp/");
#endif
}
srand((unsigned int)time(NULL));
int aRND = 999 + (int)(100000.0*rand()/(RAND_MAX+1.0)); //Get a random number to present a name of a sub directory
- TCollection_AsciiString aSubDir(aRND);
- if(aSubDir.Length() <= 1) aSubDir = TCollection_AsciiString("123409876");
+ char buffer[127];
+ sprintf(buffer, "%d", aRND);
+ string aSubDir(buffer);
+ if(aSubDir.size() <= 1) aSubDir = string("123409876");
aTmpDir += aSubDir; //Get RND sub directory
+ string aDir = aTmpDir;
+
+ if(Exists(aDir)) {
+ for(aRND = 0; Exists(aDir); aRND++) {
+ sprintf(buffer, "%d", aRND);
+ aDir = aTmpDir+buffer; //Build a unique directory name
+ }
+ }
+
#ifdef WIN32
- if(aTmpDir.Value(aTmpDir.Length()) != '\\') aTmpDir+='\\';
+ if(aDir[aTmpDir.size()-1] != '\\') aDir+='\\';
#else
- if(aTmpDir.Value(aTmpDir.Length()) != '/') aTmpDir+='/';
+ if(aDir[aTmpDir.size()-1] != '/') aDir+='/';
#endif
- OSD_Path aPath(aTmpDir);
- OSD_Directory aDir(aPath);
-
- for(aRND = 0; aDir.Exists(); aRND++) {
- aTmpDir.Insert((aTmpDir.Length() - 1), TCollection_AsciiString(aRND)); //Build a unique directory name
- aPath = OSD_Path(aTmpDir);
- aDir = OSD_Directory(aPath);
- }
- OSD_Protection aProtection(OSD_RW, OSD_RWX, OSD_RX, OSD_RX);
- aDir.Build(aProtection);
+#ifdef WNT
+ CreateDirectory(aDir.c_str(), NULL);
+#else
+ mkdir(aDir.c_str(), 0x1ff);
+#endif
- return aTmpDir;
+ return aDir;
}
//============================================================================
// function : RemoveTemporaryFiles
// purpose : Removes files listed in theFileList
//============================================================================
-void SALOMEDSImpl_Tool::RemoveTemporaryFiles(const TCollection_AsciiString& theDirectory,
- const Handle(TColStd_HSequenceOfAsciiString)& theFiles,
+void SALOMEDSImpl_Tool::RemoveTemporaryFiles(const string& theDirectory,
+ const vector<string>& theFiles,
const bool IsDirDeleted)
{
- TCollection_AsciiString aDirName = theDirectory;
+ string aDirName = theDirectory;
- int i, aLength = theFiles->Length();
+ int i, aLength = theFiles.size();
for(i=1; i<=aLength; i++) {
- TCollection_AsciiString aFile(aDirName);
- aFile += theFiles->Value(i);
- OSD_Path anOSDPath(aFile);
- OSD_File anOSDFile(anOSDPath);
- if(!anOSDFile.Exists()) continue;
-
- OSD_Protection aProtection = anOSDFile.Protection();
- aProtection.SetUser(OSD_RW);
- anOSDFile.SetProtection(aProtection);
-
- anOSDFile.Remove();
+ string aFile(aDirName);
+ aFile += theFiles[i-1];
+ if(!Exists(aFile)) continue;
+
+#ifdef WNT
+ DeleteFile(aFile.c_str());
+#else
+ unlink(aFile.c_str());
+#endif
}
if(IsDirDeleted) {
- OSD_Path aPath(aDirName);
- OSD_Directory aDir(aPath);
- OSD_FileIterator anIterator(aPath, '*');
-
- if(aDir.Exists() && !anIterator.More()) aDir.Remove();
+ if(Exists(aDirName)) {
+#ifdef WNT
+ RemoveDirectory(aDireName.c_str());
+#else
+ rmdir(aDirName.c_str());
+#endif
+ }
}
}
// function : GetNameFromPath
// purpose : Returns the name by the path
//============================================================================
-TCollection_AsciiString SALOMEDSImpl_Tool::GetNameFromPath(const TCollection_AsciiString& thePath) {
- if (thePath.IsEmpty()) return "";
- OSD_Path aPath = OSD_Path(thePath);
- TCollection_AsciiString aNameString(aPath.Name());
- return aNameString;
+string SALOMEDSImpl_Tool::GetNameFromPath(const string& thePath) {
+ if (thePath.empty()) return "";
+ int pos = thePath.rfind('/');
+ if(pos > 0) return thePath.substr(pos+1, thePath.size());
+ pos = thePath.rfind('\\');
+ if(pos > 0) return thePath.substr(pos+1, thePath.size());
+ pos = thePath.rfind('|');
+ if(pos > 0) return thePath.substr(pos+1, thePath.size());
+ return thePath;
}
//============================================================================
// function : GetDirFromPath
// purpose : Returns the dir by the path
//============================================================================
-TCollection_AsciiString SALOMEDSImpl_Tool::GetDirFromPath(const TCollection_AsciiString& thePath) {
- if (thePath.IsEmpty()) return "";
- OSD_Path aPath = OSD_Path(thePath);
- TCollection_AsciiString aDirString;
- /*Unix platform don't use <disk> assignment in <path> string
- but we must to add it for WNT case*/
- TCollection_AsciiString disk = aPath.Disk();
- if(disk.Length()) aDirString.AssignCat(disk);
- aDirString.AssignCat(aPath.Trek());
- aDirString.ChangeAll('|','/');
- return aDirString;
+string SALOMEDSImpl_Tool::GetDirFromPath(const string& thePath) {
+ if (thePath.empty()) return "";
+
+ int pos = thePath.rfind('/');
+ string path;
+ if(pos > 0) {
+ path = thePath.substr(0, pos+1);
+ }
+ if(path.empty()) {
+ pos = thePath.rfind('\\');
+ if(pos > 0) path = thePath.substr(0, pos+1);
+ }
+ if(path.empty()) {
+ pos = thePath.rfind('|');
+ if(pos > 0) path = thePath.substr(0, pos+1);
+ }
+ if(path.empty()) {
+ path = thePath+"/";
+ }
+
+#ifdef WNT //Check if the only disk letter is given as path
+ if(path.size() == 2 && path[1] == ":") path +='\\';
+#endif
+
+ for(int i = 0, len = path.size(); i<len; i++)
+ if(path[i] == '|') path[i] = '/';
+ return path;
+}
+
+//============================================================================
+// function :
+// purpose : The functions returns a list of substring of initial string
+// divided by given separator
+//============================================================================
+vector<string> SALOMEDSImpl_Tool::splitString(const string& theValue, char separator)
+{
+ vector<string> vs;
+ if(theValue[0] == separator && theValue.size() == 1) return vs;
+ int pos = theValue.find(separator);
+ if(pos < 0) {
+ vs.push_back(theValue);
+ return vs;
+ }
+
+ string s = theValue;
+ if(s[0] == separator) s = s.substr(1, s.size());
+ while((pos = s.find(separator)) >= 0) {
+ vs.push_back(s.substr(0, pos));
+ s = s.substr(pos+1, s.size());
+ }
+
+ if(!s.empty() && s[0] != separator) vs.push_back(s);
+ return vs;
}
+void SALOMEDSImpl_Tool::GetSystemDate(int& year, int& month, int& day, int& hours, int& minutes, int& seconds)
+{
+#ifdef WNT
+ SYSTEMTIME st;
+ GetLocalTime ( &st );
+ month = st.wMonth;
+ day = st.wDay;
+ year = st.wYear;
+ hours = st.wHour;
+ minutes = st.wMinute;
+ seconds = st.wSecond;
+#else
+ struct tm transfert;
+ struct timeval tval;
+ struct timezone tzone;
+ int status;
+
+ status = gettimeofday( &tval, &tzone );
+ memcpy(&transfert, localtime((time_t *)&tval.tv_sec), sizeof(tm));
+
+ month = transfert.tm_mon + 1;
+ day = transfert.tm_mday;
+ year = transfert.tm_year + 1900;
+ hours = transfert.tm_hour;
+ minutes = transfert.tm_min ;
+ seconds = transfert.tm_sec ;
+#endif
+}
+string SALOMEDSImpl_Tool::GetUserName()
+{
+#ifdef WNT
+ char* pBuff = new char[UNLEN + 1];
+ DWORD dwSize = UNLEN + 1;
+ string retVal;
+ GetUserName ( pBuff, &dwSize );
+ string theTmpUserName(pBuff,(int)dwSize -1 );
+ retVal = theTmpUserName;
+ delete [] pBuff;
+ return retVal;
+#else
+ struct passwd *infos;
+ infos = getpwuid(getuid());
+ return string(infos->pw_name);
+#endif
+}
#ifndef __SALOMEDSIMPL_TOOL_H__
#define __SALOMEDSIMPL_TOOL_H__
-#include <TCollection_AsciiString.hxx>
-#include <TDF_Label.hxx>
-#include <TColStd_HSequenceOfAsciiString.hxx>
+#include <string>
+#include <vector>
+#include "DF_Label.hxx"
class SALOMEDSImpl_Tool
{
// Returns the unique temporary directory, that is defined in SALOME_TMP_DIR if this variable is set
// otherwise return /tmp/something/ for Unix or c:\something\ for WNT
- static TCollection_AsciiString GetTmpDir();
+ static std::string GetTmpDir();
// Removes files which are in <theDirectory>, the files for deletion are listed in <theFiles>
// if <IsDirDeleted> is true <theDirectory> is also deleted if it is empty
- static void RemoveTemporaryFiles(const TCollection_AsciiString& theDirectory,
- const Handle(TColStd_HSequenceOfAsciiString)& theFiles,
+ static void RemoveTemporaryFiles(const std::string& theDirectory,
+ const std::vector<std::string>& theFiles,
const bool IsDirDeleted);
// Returns the name by the path
// for an example: if thePath = "/tmp/aaa/doc1.hdf" the function returns "doc1"
- static TCollection_AsciiString GetNameFromPath(const TCollection_AsciiString& thePath);
+ static std::string GetNameFromPath(const std::string& thePath);
// Returns the directory by the path
// for an example: if thePath = "/tmp/aaa/doc1.hdf" the function returns "/tmp/aaa"
- static TCollection_AsciiString GetDirFromPath(const TCollection_AsciiString& thePath);
+ static std::string GetDirFromPath(const std::string& thePath);
+
+ //The functions returns a list of substring of initial string divided by given separator
+ static std::vector<std::string> splitString(const std::string& theValue, char separator);
+
+ //Returns a system date
+ static void GetSystemDate(int& year, int& month, int& day, int& hours, int& minutes, int& seconds);
+
+ //Returns a name of the user
+ static std::string GetUserName();
};
#endif
#include "SALOMEDSImpl_Study.hxx"
#include "SALOMEDSImpl_Attributes.hxx"
-#include <TDF_Label.hxx>
-#include <TDF_Tool.hxx>
-#include <TDF_Data.hxx>
-#include <TDF_AttributeList.hxx>
-#include <TDF_ListIteratorOfAttributeList.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TDF_ChildIterator.hxx>
+#include "DF_ChildIterator.hxx"
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_UseCaseBuilder, MMgt_TShared )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_UseCaseBuilder, MMgt_TShared )
-
-
#define USE_CASE_LABEL_TAG 2
#define USE_CASE_GUID "AA43BB12-D9CD-11d6-945D-0050DA506788"
* Purpose :
*/
//============================================================================
-SALOMEDSImpl_UseCaseBuilder::SALOMEDSImpl_UseCaseBuilder(const Handle(TDocStd_Document)& theDocument)
+SALOMEDSImpl_UseCaseBuilder::SALOMEDSImpl_UseCaseBuilder(DF_Document* theDocument)
:_doc(theDocument)
{
- if(_doc.IsNull()) return;
+ if(!_doc) return;
- TDF_Label aLabel = _doc->Main().Root().FindChild(USE_CASE_LABEL_TAG); //Iterate all use cases
- if(!aLabel.FindAttribute(Standard_GUID(USE_CASE_GUID), _root)) {
- _root = SALOMEDSImpl_AttributeTreeNode::Set(aLabel, Standard_GUID(USE_CASE_GUID));
+ DF_Label aLabel = _doc->Main().Root().FindChild(USE_CASE_LABEL_TAG); //Iterate all use cases
+ if(!(_root = (SALOMEDSImpl_AttributeTreeNode*)aLabel.FindAttribute(std::string(USE_CASE_GUID)))) {
+ _root = SALOMEDSImpl_AttributeTreeNode::Set(aLabel, std::string(USE_CASE_GUID));
}
- Handle(SALOMEDSImpl_AttributeReference) aRef;
- if(!_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), aRef)) {
+ SALOMEDSImpl_AttributeReference* aRef = NULL;
+ if(!(aRef=(SALOMEDSImpl_AttributeReference*)_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) {
aRef = SALOMEDSImpl_AttributeReference::Set(_root->Label(), _root->Label());
}
- Handle(SALOMEDSImpl_AttributeName) aNameAttr;
- if(!aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aNameAttr)) {
- aNameAttr = SALOMEDSImpl_AttributeName::Set(aLabel, "Use cases");
+ if(!aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID())) {
+ SALOMEDSImpl_AttributeName::Set(aLabel, "Use cases");
}
}
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_UseCaseBuilder::Append(const Handle(SALOMEDSImpl_SObject)& theObject)
+bool SALOMEDSImpl_UseCaseBuilder::Append(const SALOMEDSImpl_SObject& theObject)
{
- if(_root.IsNull() || theObject.IsNull()) return false;
+ if(!_root || !theObject) return false;
- TDF_Label aLabel = theObject->GetLabel();
+ DF_Label aLabel = theObject.GetLabel();
if(aLabel.IsNull()) return false;
- Handle(SALOMEDSImpl_AttributeTreeNode) aNode, aCurrentNode;
+ SALOMEDSImpl_AttributeTreeNode* aNode = NULL;
+ SALOMEDSImpl_AttributeTreeNode* aCurrentNode = NULL;
aNode = SALOMEDSImpl_AttributeTreeNode::Set(aLabel, _root->ID());
aNode->Remove();
- Handle(SALOMEDSImpl_AttributeReference) aRef;
- if(!_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), aRef)) {
+ SALOMEDSImpl_AttributeReference* aRef;
+ if(!(aRef=(SALOMEDSImpl_AttributeReference*)_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) {
aRef = SALOMEDSImpl_AttributeReference::Set(_root->Label(), _root->Label());
}
- TDF_Label aCurrent = aRef->Get();
- if(aCurrent.IsNull() || !aCurrent.FindAttribute(_root->ID(), aCurrentNode))
+ DF_Label aCurrent = aRef->Get();
+ if(aCurrent.IsNull() || !(aCurrentNode=(SALOMEDSImpl_AttributeTreeNode*)aCurrent.FindAttribute(_root->ID())))
aCurrentNode = _root;
aCurrentNode->Append(aNode);
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_UseCaseBuilder::Remove(const Handle(SALOMEDSImpl_SObject)& theObject)
+bool SALOMEDSImpl_UseCaseBuilder::Remove(const SALOMEDSImpl_SObject& theObject)
{
- if(_root.IsNull() || theObject.IsNull()) return false;
+ if(!_root || !theObject) return false;
- TDF_Label aLabel = theObject->GetLabel();
+ DF_Label aLabel = theObject.GetLabel();
if(aLabel.IsNull()) return false;
- Handle(SALOMEDSImpl_AttributeTreeNode) aNode;
- if(!aLabel.FindAttribute(_root->ID(), aNode)) return false;
+ SALOMEDSImpl_AttributeTreeNode* aNode = NULL;
+ if(!(aNode=(SALOMEDSImpl_AttributeTreeNode*)aLabel.FindAttribute(_root->ID()))) return false;
aNode->Remove();
- TDF_AttributeList aList;
- aList.Append(aNode);
+ vector<DF_Attribute*> aList;
+ aList.push_back(aNode);
- Handle(SALOMEDSImpl_AttributeReference) aRef;
- if(!_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), aRef)) {
+ SALOMEDSImpl_AttributeReference* aRef = NULL;
+ if(!(aRef=(SALOMEDSImpl_AttributeReference*)_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) {
aRef = SALOMEDSImpl_AttributeReference::Set(_root->Label(), _root->Label());
}
- TDF_Label aCurrent = aRef->Get();
- SALOMEDSImpl_ChildNodeIterator aChildItr(aNode, Standard_True);
+ DF_Label aCurrent = aRef->Get();
+
+ SALOMEDSImpl_ChildNodeIterator aChildItr(aNode, true);
for(; aChildItr.More(); aChildItr.Next())
- aList.Append(aChildItr.Value());
+ aList.push_back(aChildItr.Value());
- TDF_ListIteratorOfAttributeList anIterator(aList);
- for(; anIterator.More(); anIterator.Next()) {
- if(anIterator.Value()->Label() == aCurrent) { //The current node is removed
+ for(int i = 0, len = aList.size(); i<len; i++) {
+ if(aList[i]->Label() == aCurrent) { //The current node is removed
aRef->Set(_root->Label()); //Reset the current node to the root
}
- anIterator.Value()->Label().ForgetAttribute(_root->ID());
+ aList[i]->Label().ForgetAttribute(_root->ID());
}
return true;
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_UseCaseBuilder::AppendTo(const Handle(SALOMEDSImpl_SObject)& theFather,
- const Handle(SALOMEDSImpl_SObject)& theObject)
+bool SALOMEDSImpl_UseCaseBuilder::AppendTo(const SALOMEDSImpl_SObject& theFather,
+ const SALOMEDSImpl_SObject& theObject)
{
- if(_root.IsNull() || theFather.IsNull() || theObject.IsNull()) return false;
+ if(!_root || !theFather || !theObject) return false;
- TDF_Label aFatherLabel = theFather->GetLabel(), aLabel = theObject->GetLabel();
+ DF_Label aFatherLabel = theFather.GetLabel(), aLabel = theObject.GetLabel();
if(aFatherLabel == aLabel) return false;
- Handle(SALOMEDSImpl_AttributeTreeNode) aFather, aNode;
+ SALOMEDSImpl_AttributeTreeNode *aFather = false, *aNode = false;
if(aFatherLabel.IsNull()) return false;
- if(!aFatherLabel.FindAttribute(_root->ID(), aFather)) return false;
+ if(!(aFather=(SALOMEDSImpl_AttributeTreeNode*)aFatherLabel.FindAttribute(_root->ID()))) return false;
if(aLabel.IsNull()) return false;
- if(!aLabel.FindAttribute(_root->ID(), aNode)) {
+ if(!(aNode=(SALOMEDSImpl_AttributeTreeNode*)aLabel.FindAttribute(_root->ID()))) {
aNode = SALOMEDSImpl_AttributeTreeNode::Set(aLabel, _root->ID());
}
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_UseCaseBuilder::InsertBefore(const Handle(SALOMEDSImpl_SObject)& theFirst,
- const Handle(SALOMEDSImpl_SObject)& theNext)
+bool SALOMEDSImpl_UseCaseBuilder::InsertBefore(const SALOMEDSImpl_SObject& theFirst,
+ const SALOMEDSImpl_SObject& theNext)
{
- if(_root.IsNull() || theFirst.IsNull() || theNext.IsNull()) return false;
+ if(!_root || !theFirst || !theNext) return false;
- TDF_Label aFirstLabel = theFirst->GetLabel(), aLabel= theNext->GetLabel();
+ DF_Label aFirstLabel = theFirst.GetLabel(), aLabel= theNext.GetLabel();
if(aFirstLabel == aLabel) return false;
- Handle(SALOMEDSImpl_AttributeTreeNode) aFirstNode, aNode;
+ SALOMEDSImpl_AttributeTreeNode *aFirstNode = NULL, *aNode = NULL;
if(aFirstLabel.IsNull()) return false;
- if(aFirstLabel.FindAttribute(_root->ID(), aFirstNode)) {
+ if((aFirstNode=(SALOMEDSImpl_AttributeTreeNode*)aFirstLabel.FindAttribute(_root->ID()))) {
aFirstNode->Remove();
aFirstLabel.ForgetAttribute(aFirstNode->ID());
}
aFirstNode = SALOMEDSImpl_AttributeTreeNode::Set(aFirstLabel, _root->ID());
if(aLabel.IsNull()) return false;
- if(!aLabel.FindAttribute(_root->ID(), aNode)) return false;
+ if(!(aNode=(SALOMEDSImpl_AttributeTreeNode*)aLabel.FindAttribute(_root->ID()))) return false;
aFirstNode->Remove();
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_UseCaseBuilder::SetCurrentObject(const Handle(SALOMEDSImpl_SObject)& theObject)
+bool SALOMEDSImpl_UseCaseBuilder::SetCurrentObject(const SALOMEDSImpl_SObject& theObject)
{
- if(_root.IsNull() || theObject.IsNull()) return false;
+ if(!_root || !theObject) return false;
- TDF_Label aLabel = theObject->GetLabel();
- Handle(SALOMEDSImpl_AttributeTreeNode) aNode;
+ DF_Label aLabel = theObject.GetLabel();
+ SALOMEDSImpl_AttributeTreeNode* aNode = NULL;
if(aLabel.IsNull()) return false;
- if(!aLabel.FindAttribute(_root->ID(), aNode)) return false;
-
+ if(!(aNode=(SALOMEDSImpl_AttributeTreeNode*)aLabel.FindAttribute(_root->ID()))) return false;
- Handle(SALOMEDSImpl_AttributeReference) aRef;
- if(!_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), aRef)) {
+ SALOMEDSImpl_AttributeReference* aRef = NULL;
+ if(!(aRef=(SALOMEDSImpl_AttributeReference*)_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) {
aRef = SALOMEDSImpl_AttributeReference::Set(_root->Label(), aNode->Label());
}
//============================================================================
bool SALOMEDSImpl_UseCaseBuilder::SetRootCurrent()
{
- if(_root.IsNull()) return false;
+ if(!_root) return false;
- Handle(SALOMEDSImpl_AttributeReference) aRef;
- if(!_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), aRef))
+ SALOMEDSImpl_AttributeReference* aRef = NULL;
+ if(!(aRef=(SALOMEDSImpl_AttributeReference*)_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID())))
aRef = SALOMEDSImpl_AttributeReference::Set(_root->Label(), _root->Label());
aRef->Set(_root->Label());
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_UseCaseBuilder::HasChildren(const Handle(SALOMEDSImpl_SObject)& theObject)
+bool SALOMEDSImpl_UseCaseBuilder::HasChildren(const SALOMEDSImpl_SObject& theObject)
{
- if(_root.IsNull()) return false;
+ if(!_root) return false;
- TDF_Label aLabel;
- if (theObject.IsNull()) aLabel = _root->Label();
+ DF_Label aLabel;
+ if (!theObject) aLabel = _root->Label();
else
- aLabel = theObject->GetLabel();
+ aLabel = theObject.GetLabel();
if(aLabel.IsNull()) return false;
- Handle(SALOMEDSImpl_AttributeTreeNode) aNode;
- if(!aLabel.FindAttribute(_root->ID(), aNode)) return false;
-
- return !(aNode->GetFirst().IsNull());
+ SALOMEDSImpl_AttributeTreeNode* aNode = NULL;
+ if(!(aNode=(SALOMEDSImpl_AttributeTreeNode*)aLabel.FindAttribute(_root->ID()))) return false;
+
+ return (aNode->GetFirst());
}
//============================================================================
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_UseCaseBuilder::SetName(const TCollection_AsciiString& theName) {
- if(_root.IsNull()) return false;
+bool SALOMEDSImpl_UseCaseBuilder::SetName(const string& theName) {
+ if(!_root) return false;
- Handle(SALOMEDSImpl_AttributeName) aNameAttrib;
+ SALOMEDSImpl_AttributeName* aNameAttrib = NULL;
- if (!_root->FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aNameAttrib))
+ if (!(aNameAttrib=(SALOMEDSImpl_AttributeName*)_root->FindAttribute(SALOMEDSImpl_AttributeName::GetID())))
aNameAttrib = SALOMEDSImpl_AttributeName::Set(_root->Label(), theName);
- else
- aNameAttrib->SetValue(theName);
+
+ aNameAttrib->SetValue(theName);
return true;
}
* Purpose :
*/
//============================================================================
-Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_UseCaseBuilder::GetCurrentObject()
+SALOMEDSImpl_SObject SALOMEDSImpl_UseCaseBuilder::GetCurrentObject()
{
- if(_root.IsNull()) return NULL;
+ SALOMEDSImpl_SObject so;
+ if(!_root) return so;
- Handle(SALOMEDSImpl_AttributeReference) aRef;
- if(!_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), aRef)) {
+ SALOMEDSImpl_AttributeReference* aRef = NULL;
+ if(!(aRef=(SALOMEDSImpl_AttributeReference*)_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) {
aRef = SALOMEDSImpl_AttributeReference::Set(_root->Label(), _root->Label());
}
- TDF_Label aCurrent = aRef->Get();
- if(aCurrent.IsNull()) return NULL;
+
+ DF_Label aCurrent = aRef->Get();
+ if(aCurrent.IsNull()) return so;
return SALOMEDSImpl_Study::SObject(aCurrent);
}
* Purpose :
*/
//============================================================================
-TCollection_AsciiString SALOMEDSImpl_UseCaseBuilder::GetName()
+string SALOMEDSImpl_UseCaseBuilder::GetName()
{
- TCollection_AsciiString aString;
- if(_root.IsNull()) return aString;
+ string aString;
+ if(!_root) return aString;
- Handle(SALOMEDSImpl_AttributeName) aName;
- if (!_root->FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aName)) return aString;
- aString = TCollection_AsciiString(aName->Value());
- return aString;
+ SALOMEDSImpl_AttributeName* aName = NULL;
+ if (!(aName=(SALOMEDSImpl_AttributeName*)_root->FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) return aString;
+ return aName->Value();
}
//============================================================================
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_UseCaseBuilder::IsUseCase(const Handle(SALOMEDSImpl_SObject)& theObject)
+bool SALOMEDSImpl_UseCaseBuilder::IsUseCase(const SALOMEDSImpl_SObject& theObject)
{
- if(theObject.IsNull()) return false;
- TDF_Label aFather, aLabel = theObject->GetLabel();
+ if(!theObject) return false;
+ DF_Label aFather, aLabel = theObject.GetLabel();
aFather = _doc->Main().Root().FindChild(USE_CASE_LABEL_TAG);
if(aLabel.Father() == aFather) return true;
return false;
* Purpose :
*/
//============================================================================
-Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_UseCaseBuilder::AddUseCase(const TCollection_AsciiString& theName)
+SALOMEDSImpl_SObject SALOMEDSImpl_UseCaseBuilder::AddUseCase(const string& theName)
{
- Standard_GUID aBasicGUID(USE_CASE_GUID);
+ string aBasicGUID(USE_CASE_GUID);
//Create a use cases structure if it not exists
- Handle(SALOMEDSImpl_AttributeTreeNode) aFatherNode, aNode;
- Handle(SALOMEDSImpl_AttributeInteger) anInteger;
- Handle(SALOMEDSImpl_AttributeReference) aRef;
+ SALOMEDSImpl_AttributeTreeNode *aFatherNode = NULL, *aNode = NULL;
+ SALOMEDSImpl_AttributeInteger* anInteger = NULL;
+ SALOMEDSImpl_AttributeReference* aRef = NULL;
- TDF_Label aLabel = _doc->Main().Root().FindChild(USE_CASE_LABEL_TAG);
+ DF_Label aLabel = _doc->Main().Root().FindChild(USE_CASE_LABEL_TAG);
- if(!_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), aRef)) {
+ if(!(aRef=(SALOMEDSImpl_AttributeReference*)_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) {
aRef = SALOMEDSImpl_AttributeReference::Set(aLabel, aLabel);
}
- if(!aRef->Get().FindAttribute(aBasicGUID, aFatherNode)) {
+ if(!(aFatherNode=(SALOMEDSImpl_AttributeTreeNode*)aRef->Get().FindAttribute(aBasicGUID))) {
aFatherNode = SALOMEDSImpl_AttributeTreeNode::Set(aRef->Get(), aBasicGUID);
}
- if(!_root->FindAttribute(SALOMEDSImpl_AttributeInteger::GetID(), anInteger)) {
+ if(!(anInteger=(SALOMEDSImpl_AttributeInteger*)_root->FindAttribute(SALOMEDSImpl_AttributeInteger::GetID()))) {
anInteger = SALOMEDSImpl_AttributeInteger::Set(aLabel, 0);
- }
+ }
//Create a new use case
anInteger->SetValue(anInteger->Value()+1);
- TDF_Label aChild = aLabel.FindChild(anInteger->Value());
+ DF_Label aChild = aLabel.FindChild(anInteger->Value());
aNode = SALOMEDSImpl_AttributeTreeNode::Set(aChild, aBasicGUID);
aNode->Remove();
aFatherNode->Append(aNode);
* Purpose : Creates a new UseCase iterator, if anObject is null all use cases are iterated
*/
//============================================================================
-Handle(SALOMEDSImpl_UseCaseIterator)
-SALOMEDSImpl_UseCaseBuilder::GetUseCaseIterator(const Handle(SALOMEDSImpl_SObject)& theObject)
+SALOMEDSImpl_UseCaseIterator
+SALOMEDSImpl_UseCaseBuilder::GetUseCaseIterator(const SALOMEDSImpl_SObject& theObject)
{
- TDF_Label aLabel;
+ DF_Label aLabel;
- if(!theObject.IsNull()) {
- aLabel = theObject->GetLabel(); //Iterate only sub tree in the use case
+ if(theObject) {
+ aLabel = theObject.GetLabel(); //Iterate only sub tree in the use case
}
else {
aLabel = _doc->Main().Root().FindChild(USE_CASE_LABEL_TAG); //Iterate all use cases
}
- return new SALOMEDSImpl_UseCaseIterator(aLabel, USE_CASE_GUID, false);
+ return SALOMEDSImpl_UseCaseIterator(aLabel, USE_CASE_GUID, false);
}
-Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_UseCaseBuilder::GetSObject(const TCollection_AsciiString& theEntry)
+SALOMEDSImpl_SObject SALOMEDSImpl_UseCaseBuilder::GetSObject(const string& theEntry)
{
- TDF_Label aLabel;
- TDF_Tool::Label(_doc->GetData(), theEntry, aLabel);
- return SALOMEDSImpl_Study::SObject(aLabel);
+ DF_Label L = DF_Label::Label(_root->Label(), theEntry);
+ return SALOMEDSImpl_Study::SObject(L);
}
#ifndef __SALOMEDSIMPL_USECaseBuilder_H__
#define __SALOMEDSIMPL_USECaseBuilder_H__
-//Handle definition
-#include <Handle_MMgt_TShared.hxx>
-#include <Standard_DefineHandle.hxx>
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_UseCaseBuilder, MMgt_TShared )
-
-// Cascade headers
-#include <SALOMEDSImpl_AttributeTreeNode.hxx>
-#include <TDocStd_Document.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <Standard_GUID.hxx>
+#include <string>
+#include "DF_Document.hxx"
+#include "DF_Label.hxx"
+#include "SALOMEDSImpl_AttributeTreeNode.hxx"
#include "SALOMEDSImpl_UseCaseIterator.hxx"
-class SALOMEDSImpl_UseCaseBuilder : public MMgt_TShared
+class SALOMEDSImpl_UseCaseBuilder
{
private:
- Handle(SALOMEDSImpl_AttributeTreeNode) _root;
- Handle(TDocStd_Document) _doc;
+ SALOMEDSImpl_AttributeTreeNode* _root;
+ DF_Document* _doc;
public:
//! standard constructor
- Standard_EXPORT SALOMEDSImpl_UseCaseBuilder(const Handle(TDocStd_Document)& theDocument);
+ Standard_EXPORT SALOMEDSImpl_UseCaseBuilder(DF_Document* theDocument);
//! standard destructor
Standard_EXPORT ~SALOMEDSImpl_UseCaseBuilder();
- Standard_EXPORT virtual bool Append(const Handle(SALOMEDSImpl_SObject)& theObject);
+ Standard_EXPORT virtual bool Append(const SALOMEDSImpl_SObject& theObject);
- Standard_EXPORT virtual bool Remove(const Handle(SALOMEDSImpl_SObject)& theObject);
+ Standard_EXPORT virtual bool Remove(const SALOMEDSImpl_SObject& theObject);
- Standard_EXPORT virtual bool AppendTo(const Handle(SALOMEDSImpl_SObject)& theFather, const Handle(SALOMEDSImpl_SObject)& theObject);
+ Standard_EXPORT virtual bool AppendTo(const SALOMEDSImpl_SObject& theFather, const SALOMEDSImpl_SObject& theObject);
- Standard_EXPORT virtual bool InsertBefore(const Handle(SALOMEDSImpl_SObject)& theFirst, const Handle(SALOMEDSImpl_SObject)& theNext);
+ Standard_EXPORT virtual bool InsertBefore(const SALOMEDSImpl_SObject& theFirst, const SALOMEDSImpl_SObject& theNext);
- Standard_EXPORT virtual bool SetCurrentObject(const Handle(SALOMEDSImpl_SObject)& theObject);
+ Standard_EXPORT virtual bool SetCurrentObject(const SALOMEDSImpl_SObject& theObject);
Standard_EXPORT virtual bool SetRootCurrent();
- Standard_EXPORT virtual bool HasChildren(const Handle(SALOMEDSImpl_SObject)& theObject);
+ Standard_EXPORT virtual bool HasChildren(const SALOMEDSImpl_SObject& theObject);
- Standard_EXPORT virtual bool IsUseCase(const Handle(SALOMEDSImpl_SObject)& theObject);
+ Standard_EXPORT virtual bool IsUseCase(const SALOMEDSImpl_SObject& theObject);
- Standard_EXPORT virtual bool SetName(const TCollection_AsciiString& theName);
+ Standard_EXPORT virtual bool SetName(const std::string& theName);
- Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) GetCurrentObject();
+ Standard_EXPORT virtual SALOMEDSImpl_SObject GetCurrentObject();
- Standard_EXPORT virtual TCollection_AsciiString GetName();
+ Standard_EXPORT virtual std::string GetName();
- Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) AddUseCase(const TCollection_AsciiString& theName);
+ Standard_EXPORT virtual SALOMEDSImpl_SObject AddUseCase(const std::string& theName);
- Standard_EXPORT virtual Handle(SALOMEDSImpl_UseCaseIterator) GetUseCaseIterator(const Handle(SALOMEDSImpl_SObject)& anObject);
+ Standard_EXPORT virtual SALOMEDSImpl_UseCaseIterator GetUseCaseIterator(const SALOMEDSImpl_SObject& anObject);
- Standard_EXPORT Handle(SALOMEDSImpl_SObject) GetSObject(const TCollection_AsciiString& theEntry);
+ Standard_EXPORT SALOMEDSImpl_SObject GetSObject(const std::string& theEntry);
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_UseCaseBuilder )
};
#endif
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_UseCaseIterator, MMgt_TShared )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_UseCaseIterator, MMgt_TShared )
+//============================================================================
+/*! Function : empty constructor
+ * Purpose :
+ */
+//============================================================================
+SALOMEDSImpl_UseCaseIterator::SALOMEDSImpl_UseCaseIterator()
+{
+ _node = NULL;
+}
+
//============================================================================
/*! Function : constructor
* Purpose :
*/
//============================================================================
-SALOMEDSImpl_UseCaseIterator::SALOMEDSImpl_UseCaseIterator(const TDF_Label& theLabel,
- const Standard_GUID& theGUID,
+SALOMEDSImpl_UseCaseIterator::SALOMEDSImpl_UseCaseIterator(const DF_Label& theLabel,
+ const string& theGUID,
const bool allLevels)
:_guid(theGUID), _levels(allLevels)
{
- if(theLabel.FindAttribute(_guid, _node)) {
+ if((_node = (SALOMEDSImpl_AttributeTreeNode*)theLabel.FindAttribute(_guid))) {
_it.Initialize (_node, _levels);
}
}
return _it.More();
}
- //============================================================================
+//============================================================================
/*! Function : Next
*
*/
*/
//============================================================================
-Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_UseCaseIterator::Value()
+SALOMEDSImpl_SObject SALOMEDSImpl_UseCaseIterator::Value()
{
- TDF_Label L = _it.Value()->Label();
+ DF_Label L = _it.Value()->Label();
return SALOMEDSImpl_Study::SObject(L);
}
+//============================================================================
+/*! Function : GetPersistentCopy
+ *
+ */
+//============================================================================
+SALOMEDSImpl_UseCaseIterator* SALOMEDSImpl_UseCaseIterator::GetPersistentCopy() const
+{
+ SALOMEDSImpl_UseCaseIterator* itr = new SALOMEDSImpl_UseCaseIterator();
+ itr->_it = _it;
+ itr->_node = _node;
+ itr->_guid = _guid;
+ itr->_levels = _levels;
+
+ return itr;
+}
#ifndef __SALOMEDSIMPL_USECASEITERATOR_H__
#define __SALOMEDSIMPL_USECASEITERATOR_H__
-//Handle definition
-#include <Handle_MMgt_TShared.hxx>
-#include <Standard_DefineHandle.hxx>
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_UseCaseIterator, MMgt_TShared )
-
#include "SALOMEDSImpl_SObject.hxx"
+#include "DF_ChildIterator.hxx"
+#include "SALOMEDSImpl_ChildNodeIterator.hxx"
-// Cascade headers
-#include <TDF_ChildIterator.hxx>
-#include <SALOMEDSImpl_ChildNodeIterator.hxx>
-#include <Standard_GUID.hxx>
+#include <string>
-class SALOMEDSImpl_UseCaseIterator : public MMgt_TShared
+class Standard_EXPORT SALOMEDSImpl_UseCaseIterator
{
private:
- Standard_GUID _guid;
+ std::string _guid;
bool _levels;
- Handle(SALOMEDSImpl_AttributeTreeNode) _node;
+ SALOMEDSImpl_AttributeTreeNode* _node;
SALOMEDSImpl_ChildNodeIterator _it;
public:
+ SALOMEDSImpl_UseCaseIterator();
+
//! standard constructor
- SALOMEDSImpl_UseCaseIterator(const TDF_Label& theLabel,
- const Standard_GUID& theGUID,
+ SALOMEDSImpl_UseCaseIterator(const DF_Label& theLabel,
+ const std::string& theGUID,
const bool allLevels);
//! standard destructor
virtual void Init(bool);
virtual bool More();
virtual void Next();
- virtual Handle(SALOMEDSImpl_SObject) Value();
+ virtual SALOMEDSImpl_SObject Value();
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_UseCaseIterator )
+ SALOMEDSImpl_UseCaseIterator* GetPersistentCopy() const;
};
#endif
-I$(srcdir)/$(RPATH)/Utils -I$(srcdir)/$(RPATH)/Utils/Test \
-I$(srcdir)/$(RPATH)/ResourcesManager \
-I$(srcdir)/$(RPATH)/LifeCycleCORBA \
+ -I$(srcdir)/$(RPATH)/DF \
-I$(srcdir)/$(RPATH)/SALOMEDSImpl \
-I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
$(RPATH)/SALOMELocalTrace/Test/libSALOMELocalTraceTest.la \
$(RPATH)/SALOMELocalTrace/libSALOMELocalTrace.la \
$(RPATH)/SALOMETraceCollector/Test/libSALOMETraceCollectorTest.la \
+ $(RPATH)/DF/libDF.la \
$(RPATH)/SALOMEDSImpl/libSalomeDSImpl.la \
$(top_builddir)/idl/libSalomeIDLKernel.la
#include "SALOMEDSImpl_StudyBuilder.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
-#include <TCollection_AsciiString.hxx>
-
using namespace std;
// ============================================================================
void SALOMEDSImplTest::setUp()
{
- TCollection_AsciiString kernel(getenv("KERNEL_ROOT_DIR"));
- TCollection_AsciiString subPath("/share/salome/resources/kernel");
- TCollection_AsciiString csf_var = (kernel+subPath);
- setenv("CSF_PluginDefaults", csf_var.ToCString(), 0);
- setenv("CSF_SALOMEDS_ResourcesDefaults", csf_var.ToCString(), 0);
}
// ============================================================================
// ============================================================================
void SALOMEDSImplTest::testAttributeParameter()
{
- Handle(SALOMEDSImpl_StudyManager) sm = new SALOMEDSImpl_StudyManager();
- Handle(SALOMEDSImpl_Study) study = sm->NewStudy("Test");
- Handle(SALOMEDSImpl_AttributeParameter) _ap = study->GetCommonParameters("TestComp", 0);
+ SALOMEDSImpl_StudyManager* sm = new SALOMEDSImpl_StudyManager();
+ SALOMEDSImpl_Study* study = sm->NewStudy("Test");
+ SALOMEDSImpl_AttributeParameter* _ap = study->GetCommonParameters("TestComp", 0);
- CPPUNIT_ASSERT(!_ap.IsNull());
+ CPPUNIT_ASSERT(_ap);
_ap->SetInt("IntValue", 1);
CPPUNIT_ASSERT(_ap->IsSet("IntValue", PT_INTEGER));
#include <stdio.h>
#include <iostream>
#include <vector>
+#include <string>
-#include <TColStd_HSequenceOfTransient.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TDocStd_Document.hxx>
-#include <TDF_Attribute.hxx>
-#include <TDF_Label.hxx>
-#include <TDF_Data.hxx>
-#include <TDF_Tool.hxx>
+#include "DF_Document.hxx"
+#include "DF_Attribute.hxx"
+#include "DF_Label.hxx"
+#include "DF_ChildIterator.hxx"
#include "SALOMEDSImpl_Attributes.hxx"
#include "SALOMEDSImpl_StudyManager.hxx"
#include "SALOMEDSImpl_SObject.hxx"
#include "SALOMEDSImpl_SComponent.hxx"
#include "SALOMEDSImpl_AttributeParameter.hxx"
+#include "SALOMEDSImpl_UseCaseBuilder.hxx"
+#include "SALOMEDSImpl_UseCaseIterator.hxx"
//#include "SALOMEDSImpl_.hxx"
+using namespace std;
+
int main (int argc, char * argv[])
{
cout << "Test started " << endl;
- Handle(SALOMEDSImpl_StudyManager) aSM = new SALOMEDSImpl_StudyManager();
+ SALOMEDSImpl_StudyManager* aSM = new SALOMEDSImpl_StudyManager();
cout << "Manager is created " << endl;
- Handle(SALOMEDSImpl_Study) aStudy = aSM->NewStudy("SRN");
+ SALOMEDSImpl_Study* aStudy = aSM->NewStudy("SRN");
cout << "Study with id = " << aStudy->StudyId() << " is created " << endl;
cout << "Check the study lock, locking" << endl;
aStudy->SetStudyLock("SRN");
cout << "Is study locked = " << aStudy->IsStudyLocked() << endl;
- cout << "Get study locker : " << aStudy->GetLockerID() << endl;
+ vector<string> ids = aStudy->GetLockerID();
+ for(int i = 0; i<ids.size(); i++)
+ cout << "Get study locker : " << ids[i] << endl;
aStudy->UnLockStudy("SRN");
cout << "Is study locked = " << aStudy->IsStudyLocked() << endl;
- Handle(SALOMEDSImpl_StudyBuilder) aBuilder = aStudy->NewBuilder();
+ SALOMEDSImpl_StudyBuilder* aBuilder = aStudy->NewBuilder();
cout << "StudyBuilder is created " << endl;
- Handle(SALOMEDSImpl_SComponent) aSC = aBuilder->NewComponent("TEST");
- cout << "New component with type " << aSC->ComponentDataType() << " is created " << endl;
- Handle(SALOMEDSImpl_SObject) aSO = aBuilder->NewObject(aSC);
- cout << "New SObject with ID = " << aSO->GetID() << " is created" << endl;
- TCollection_AsciiString anEntry;
- TDF_Tool::Entry(aSO->GetLabel(), anEntry);
- cout << "An entry of newly created SO is " << anEntry << endl;
- Handle(SALOMEDSImpl_AttributeIOR) aIORA = SALOMEDSImpl_AttributeIOR::Set(aSO->GetLabel(), "ior1234");
- cout << "New AttributeIOR is created, it contains " << aIORA->Value() << endl;
- Handle(SALOMEDSImpl_GenericAttribute) ga = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(aIORA);
- cout << "Attribute has type: " << ga->Type() << " and value: " << ga->Save() << endl;
+ SALOMEDSImpl_SComponent aSC = aBuilder->NewComponent("TEST");
+ cout << "New component with type " << aSC.ComponentDataType() << " is created " << endl;
+ SALOMEDSImpl_SObject aSO = aBuilder->NewObject(aSC);
+ cout << "New SObject with ID = " << aSO.GetID() << " is created" << endl;
+ cout << "An entry of newly created SO is " << aSO.GetLabel().Entry() << endl;
+ SALOMEDSImpl_AttributeIOR* aIORA = SALOMEDSImpl_AttributeIOR::Set(aSO.GetLabel(), "ior1234");
+ cout << "New AttributeIOR is created, it contains " << dynamic_cast<SALOMEDSImpl_AttributeIOR*>(aIORA)->Value() << endl;
+ cout << "Attribute has type: " << aIORA->Type() << " and value: " << aIORA->Save() << endl;
cout << "Just another way to create an attribute: official one :) " << endl;
- Handle(TDF_Attribute) aTDFAttr = aBuilder->FindOrCreateAttribute(aSO, "AttributeName");
- Handle(SALOMEDSImpl_AttributeName) aRN = Handle(SALOMEDSImpl_AttributeName)::DownCast(aTDFAttr);
+ cout << "Is SO null : " << aSO.IsNull()<< endl;
+ DF_Attribute* aTDFAttr = aBuilder->FindOrCreateAttribute(aSO, "AttributeName");
+ SALOMEDSImpl_AttributeName* aRN = dynamic_cast<SALOMEDSImpl_AttributeName*>(aTDFAttr);
aRN->SetValue("name_attribute");
cout << " The type = " << aRN->Type() << endl;
- ga = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(aRN);
- cout << "Attribute has type: " << ga->Type() << " and value: " << ga->Save() << endl;
+ cout << "Attribute has type: " << aRN->Type() << " and value: " << aRN->Save() << endl;
cout << "Check GetObjectPath: " << aStudy->GetObjectPath(aSO) << endl;
- Handle(SALOMEDSImpl_SObject) aSubSO = aBuilder->NewObject(aSO);
+ SALOMEDSImpl_SObject aSubSO = aBuilder->NewObject(aSO);
aTDFAttr = aBuilder->FindOrCreateAttribute(aSubSO, "AttributeIOR");
- Handle(SALOMEDSImpl_AttributeIOR) aIOR2 = Handle(SALOMEDSImpl_AttributeIOR)::DownCast(aTDFAttr);
+ SALOMEDSImpl_AttributeIOR* aIOR2 = dynamic_cast<SALOMEDSImpl_AttributeIOR*>(aTDFAttr);
aIOR2->SetValue("some ior");
aBuilder->Addreference(aSubSO, aSO);
- Handle(SALOMEDSImpl_SObject) aRefObject;
- aSubSO->ReferencedObject(aRefObject);
- cout << "Check reference : ReferencedObject is " << aRefObject->GetID() << endl;
+ SALOMEDSImpl_SObject aRefObject;
+ aSubSO.ReferencedObject(aRefObject);
+ cout << "Check reference : ReferencedObject is " << aRefObject.GetID() << endl;
cout << "Check : Remove object: " << endl;
aBuilder->RemoveObject(aSubSO);
cout << "Remove: done" << endl;
+ cout << "Try invalid attribute creation" << endl;
+ aTDFAttr = aBuilder->FindOrCreateAttribute(aSubSO, "invalid type");
+ cout << "Address of created attribute : " << aTDFAttr << endl;
+
+ cout << "Check AttributeUserID" << endl;
+
+ aTDFAttr = aBuilder->FindOrCreateAttribute(aSubSO, "AttributeUserID");
+ if(aTDFAttr) {
+ cout << "Attribute UserID was created succesfully : id = " << dynamic_cast<SALOMEDSImpl_AttributeUserID*>(aTDFAttr)->Value() << endl;
+ }
+ else cout << "Can't create AttributeUserID" << endl;
+
+ string id = "0e1c36e6-379b-4d90-ab3b-17a14310e648";
+ dynamic_cast<SALOMEDSImpl_AttributeUserID*>(aTDFAttr)->SetValue(id);
+ cout << "SetValue id = " << dynamic_cast<SALOMEDSImpl_AttributeUserID*>(aTDFAttr)->Value() << endl;
+
+ string id2 = "0e1c36e6-379b-4d90-ab3b-18a14310e648";
+ aTDFAttr = aBuilder->FindOrCreateAttribute(aSubSO, "AttributeUserID"+id2);
+ if(aTDFAttr) {
+ cout << "Attribute UserID was created succesfully : id = " << dynamic_cast<SALOMEDSImpl_AttributeUserID*>(aTDFAttr)->Value() << endl;
+ }
+ else cout << "Can't create AttributeUserID" << endl;
+
cout << "Check AttributeTreeNode " << endl;
aTDFAttr = aBuilder->FindOrCreateAttribute(aSO, "AttributeTreeNode");
- cout << Handle(SALOMEDSImpl_GenericAttribute)::DownCast(aTDFAttr)->Type() << endl;
+ cout << dynamic_cast<SALOMEDSImpl_GenericAttribute*>(aTDFAttr)->Type() << endl;
cout << "Check AttributeTreeNode : done " << endl;
aTDFAttr = aBuilder->FindOrCreateAttribute(aSO, "AttributeParameter");
- cout << Handle(SALOMEDSImpl_GenericAttribute)::DownCast(aTDFAttr)->Type() << endl;
+ cout << dynamic_cast<SALOMEDSImpl_GenericAttribute*>(aTDFAttr)->Type() << endl;
cout << "Check the attributes on SObject" << endl;
- Handle(TColStd_HSequenceOfTransient) aSeq = aSO->GetAllAttributes();
- for(int i = 1; i <= aSeq->Length(); i++)
- cout << "Found: " << Handle(SALOMEDSImpl_GenericAttribute)::DownCast(aSeq->Value(i))->Type() << endl;
+ vector<DF_Attribute*> aSeq = aSO.GetAllAttributes();
+ for(int i = 0; i < aSeq.size(); i++)
+ cout << "Found: " << dynamic_cast<SALOMEDSImpl_GenericAttribute*>(aSeq[i])->Type() << endl;
+ cout << "Check UseCase" << endl;
+ SALOMEDSImpl_UseCaseBuilder* ucb = aStudy->GetUseCaseBuilder();
+ ucb->AddUseCase("use_case1");
+ ucb->AddUseCase("use_case2");
+ SALOMEDSImpl_UseCaseIterator ucitr = ucb->GetUseCaseIterator(SALOMEDSImpl_SObject());
+ ucitr.Init(false);
+ cout << "More? : " << ucitr.More() << endl;
cout << "Check AttributeParameter " << endl;
- Handle(SALOMEDSImpl_AttributeParameter) AP = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(aTDFAttr);
+ SALOMEDSImpl_AttributeParameter* AP = dynamic_cast<SALOMEDSImpl_AttributeParameter*>(aTDFAttr);
cout << "AttributeParameter with type : " << AP->Type() << endl;
cout << "IsSet for string: " << AP->IsSet("1", PT_STRING) << " value : " << AP->GetString("1") << endl;
/*
for(int i = 2; i < 5; i++) {
- TCollection_AsciiString s((double)(1.0/i));
+ string s((double)(1.0/i));
cout << "Setting for " << i << " value : " << s << endl;
AP->SetString(i, s);
}
vs.push_back("world!");
AP->SetStrArray("3", vs);
- TCollection_AsciiString as = AP->Save();
+ string as = AP->Save();
cout << "AS = " << as << endl;
AP->Load(as);
cout << "Check AttributeParameter : done" << endl;
+
+ SALOMEDSImpl_SComponent tst = aBuilder->NewComponent("TEST2");
+ aSO = aBuilder->NewObject(tst);
+ SALOMEDSImpl_SObject ss = aBuilder->NewObjectToTag(aSO, 3);
+ aBuilder->NewObjectToTag(ss, 1);
+ aBuilder->NewObjectToTag(ss, 3);
+ SALOMEDSImpl_SObject ss2 = aBuilder->NewObjectToTag(aSO, 2);
+ aBuilder->NewObjectToTag(ss, 2);
+
+ SALOMEDSImpl_ChildIterator ci=aStudy->NewChildIterator(tst);
+ for(ci.InitEx(true); ci.More(); ci.Next())
+ cout << "######## " << ci.Value().GetID() << endl;
+
+ DF_ChildIterator dci(tst.GetLabel(), true);
+ for(; dci.More(); dci.Next())
+ cout << "###### DF: " << dci.Value().Entry() << endl;
+
cout << "Test finished " << endl;
return 0;
}