From: vsr Date: Wed, 27 Jan 2010 08:25:19 +0000 (+0000) Subject: Improve AttributeUserID management: implement the GUIDs repository X-Git-Tag: PARAVIS_29012010~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=25ac8ce2439073ed6039a004a646abe2db5b3d31;p=modules%2Fkernel.git Improve AttributeUserID management: implement the GUIDs repository --- diff --git a/src/Basics/Basics_Utils.cxx b/src/Basics/Basics_Utils.cxx index 3be1e68c2..8d05d65e5 100644 --- a/src/Basics/Basics_Utils.cxx +++ b/src/Basics/Basics_Utils.cxx @@ -92,4 +92,19 @@ namespace Kernel_Utils { setlocale(LC_NUMERIC, myCurLocale.c_str()); } + + std::string GetGUID( GUIDtype type ) + { + std::string guid; + + switch ( type ) { + case DefUserID: + guid = "FFFFFFFF-D9CD-11d6-945D-1050DA506788"; break; + case ObjectdID: + guid = "C08F3C95-F112-4023-8776-78F1427D0B6D"; break; + } + + return guid; + } + } diff --git a/src/Basics/Basics_Utils.hxx b/src/Basics/Basics_Utils.hxx index 7ca83964a..d0e793817 100644 --- a/src/Basics/Basics_Utils.hxx +++ b/src/Basics/Basics_Utils.hxx @@ -43,6 +43,15 @@ namespace Kernel_Utils private: std::string myCurLocale; }; + + //! GUID type + enum GUIDtype { + DefUserID = 1, //!< Default user attribute ID + ObjectdID //!< Global usage object identifier ID + }; + + //! Get predefined GUID + BASICS_EXPORT std::string GetGUID( GUIDtype ); } #endif //_Basics_UTILS_HXX_ diff --git a/src/SALOMEDSImpl/Makefile.am b/src/SALOMEDSImpl/Makefile.am index 731cf625a..f0cc66340 100644 --- a/src/SALOMEDSImpl/Makefile.am +++ b/src/SALOMEDSImpl/Makefile.am @@ -102,6 +102,7 @@ COMMON_CPPFLAGS=\ # This local variable defines the list of dependant libraries common to all target in this package. COMMON_LIBS =\ + ../Basics/libSALOMEBasics.la \ ../HDFPersist/libSalomeHDFPersist.la \ ../DF/libDF.la \ ../GenericObj/libSalomeGenericObj.la \ diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeUserID.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeUserID.cxx index 7087c5e4d..96cdbbc4f 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeUserID.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeUserID.cxx @@ -24,9 +24,15 @@ // Module : SALOME // #include "SALOMEDSImpl_AttributeUserID.hxx" +#include "Basics_Utils.hxx" using namespace std; +std::string SALOMEDSImpl_AttributeUserID::DefaultID() +{ + return Kernel_Utils::GetGUID(Kernel_Utils::DefUserID); +} + SALOMEDSImpl_AttributeUserID* SALOMEDSImpl_AttributeUserID::Set (const DF_Label& L, const std::string& ID) { SALOMEDSImpl_AttributeUserID* A = NULL; diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeUserID.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeUserID.hxx index 4a768fe80..3eece5637 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeUserID.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeUserID.hxx @@ -42,11 +42,7 @@ private: public: SALOMEDSImpl_AttributeUserID():SALOMEDSImpl_GenericAttribute("AttributeUserID") {} static SALOMEDSImpl_AttributeUserID* Set (const DF_Label& L, const std::string& ID); - static const std::string& DefaultID() - { - static std::string SALOMEDSImpl_DefaultUserAttributeID ("FFFFFFFF-D9CD-11d6-945D-1050DA506788"); - return SALOMEDSImpl_DefaultUserAttributeID; - } + static std::string DefaultID(); const std::string& Value() const { return ID(); } void SetValue(const std::string& value); diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_SObject.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_SObject.cxx index 68fa75f94..4ec2311a3 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_SObject.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_SObject.cxx @@ -247,6 +247,9 @@ std::string SALOMEDSImpl_SObject::GetGUID(const string& theType) if (strncmp(theType.c_str(), "AttributeTreeNodeGUID",21) == 0) { return theType.substr(21, theType.size()); } + if (strncmp(theType.c_str(), "AttributeUserID",15) == 0) { + return theType.substr(15, theType.size()); + } return ""; }