From: prascle Date: Tue, 11 Oct 2005 09:26:53 +0000 (+0000) Subject: PR: manual merge with V3_1_0a1 X-Git-Tag: BR_UnitTests_20051011~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=340d0096aba307c24bea496552c13988e6c21322;p=modules%2Fkernel.git PR: manual merge with V3_1_0a1 --- diff --git a/bin/launchConfigureParser.py b/bin/launchConfigureParser.py index 1f754194e..f1bd606db 100755 --- a/bin/launchConfigureParser.py +++ b/bin/launchConfigureParser.py @@ -171,20 +171,21 @@ for dir in dirs: filename = dir+'/'+appname+'.xml' try: p = xml_parser(filename, _opts) + _opts = p.opts except: print 'Can not read launch configuration file ', filename continue - _opts = p.opts # SalomeApprc file in user's catalogue filename = os.environ['HOME']+'/.'+appname+'rc.'+version() try: p = xml_parser(filename, _opts) + _opts = p.opts except: print 'Can not read launch configuration file ', filename -args = p.opts +args = _opts # --- setting default values of keys if they were NOT set in config files --- for aKey in listKeys: @@ -261,27 +262,27 @@ def options_parser(line): # ----------------------------------------------------------------------------- ### read command-line options : each arg given in command line supersedes arg from xml config file - +cmd_opts = {} try: - opts = options_parser(sys.argv[1:]) - #print "opts=",opts + cmd_opts = options_parser(sys.argv[1:]) + #print "opts=",cmd_opts kernel_root_dir=os.environ["KERNEL_ROOT_DIR"] except: - opts["h"] = 1 + cmd_opts["h"] = 1 pass ### check all options are right opterror=0 -for opt in opts: +for opt in cmd_opts: if not opt in ("h","g","l","f","x","m","e","s","c","p","k","t","i"): print "command line error: -", opt opterror=1 if opterror == 1: - opts["h"] = 1 + cmd_opts["h"] = 1 -if opts.has_key("h"): +if cmd_opts.has_key("h"): print """USAGE: runSalome.py [options] [command line options] : --help or -h : print this help @@ -314,7 +315,7 @@ if opts.has_key("h"): pass ### apply command-line options to the arguments -for opt in opts: +for opt in cmd_opts: if opt == 'g': args[gui_nam] = 1 elif opt == 'z': @@ -322,19 +323,19 @@ for opt in opts: elif opt == 'l': args[logger_nam] = 1 elif opt == 'f': - args[file_nam] = opts['f'] + args[file_nam] = cmd_opts['f'] elif opt == 'x': args[xterm_nam] = 1 elif opt == 'i': - args[interp_nam] = opts['i'] + args[interp_nam] = cmd_opts['i'] elif opt == 'm': - args[modules_nam] = opts['m'] + args[modules_nam] = cmd_opts['m'] elif opt == 'e': - args[embedded_nam] = opts['e'] + args[embedded_nam] = cmd_opts['e'] elif opt == 's': - args[standalone_nam] = opts['s'] + args[standalone_nam] = cmd_opts['s'] elif opt == 'c': - args[containers_nam] = opts['c'] + args[containers_nam] = cmd_opts['c'] elif opt == 'p': args[portkill_nam] = 1 elif opt == 'k': @@ -343,7 +344,7 @@ for opt in opts: pass # 'terminal' must be processed in the end: to deny any 'gui' options -if 't' in opts: +if 't' in cmd_opts: args[gui_nam] = 0 pass diff --git a/bin/runSalome.py b/bin/runSalome.py index 5a0917b8f..0827efa50 100755 --- a/bin/runSalome.py +++ b/bin/runSalome.py @@ -171,7 +171,11 @@ def set_env(args, modules_list, modules_root_dir): # set environment for SUPERV module os.environ["ENABLE_MACRO_NODE"]="1" - + # set resources variables if not yet set + if os.getenv("GUI_ROOT_DIR"): + if not os.getenv("SUITRoot"): os.environ["SUITRoot"] = os.getenv("GUI_ROOT_DIR") + "/share/salome" + if not os.getenv("SalomeAppConfig"): os.environ["SalomeAppConfig"] = os.getenv("GUI_ROOT_DIR") + "/share/salome/resources" + pass os.environ["CSF_PluginDefaults"] \ = os.path.join(modules_root_dir["KERNEL"],"share", diff --git a/salome_adm/unix/make_conclude.in b/salome_adm/unix/make_conclude.in index 338fed0cf..d5d4a5d14 100644 --- a/salome_adm/unix/make_conclude.in +++ b/salome_adm/unix/make_conclude.in @@ -152,8 +152,10 @@ $(DEST_HEADERS): $(inc_builddir)/%: % cp -f $< $@ # build resources file (icons and messages) : .qm file from .po file -RESOURCES_FILES_ALL = $(notdir $(wildcard $(srcdir)/resources/*)) -RESOURCES_FILES ?= $(RESOURCES_FILES_All) +RESOURCES_FILES_ALL := $(notdir $(wildcard $(srcdir)/resources/*)) +RESOURCES_FILES_ALL := $(filter-out CVS, $(RESOURCES_FILES_ALL)) +RESOURCES_FILES_ALL := $(filter-out %.po, $(RESOURCES_FILES_ALL)) +RESOURCES_FILES ?= $(RESOURCES_FILES_ALL) resources: resources-po resources-cp @@ -162,9 +164,7 @@ resources-po: $(PO_FILES:%.po=$(top_builddir)/share/salome/resources/%.qm) resources-cp: $(RESOURCES_FILES:%=$(top_builddir)/share/salome/resources/%) $(RESOURCES_FILES:%=$(top_builddir)/share/salome/resources/%): $(top_builddir)/share/salome/resources/% : % - if [ $(notdir $<) != "CVS" ] ; then \ - cp -fr $< $@; \ - fi + cp -fr $< $@; # Make installation directories if they don't exist. $(libdir) $(includedir) $(bindir) $(datadir) $(idldir) $(sharedpydir): diff --git a/salome_adm/unix/make_module.in b/salome_adm/unix/make_module.in index bfbb3036e..cb1312023 100644 --- a/salome_adm/unix/make_module.in +++ b/salome_adm/unix/make_module.in @@ -45,8 +45,10 @@ depend: done # copy all resources files in common directory -RESOURCES_FILES_ALL = $(notdir $(wildcard $(srcdir)/resources/*)) -RESOURCES_FILES ?= $(RESOURCES_FILES_All) +RESOURCES_FILES_ALL := $(notdir $(wildcard $(srcdir)/resources/*)) +RESOURCES_FILES_ALL := $(filter-out CVS, $(RESOURCES_FILES_ALL)) +RESOURCES_FILES_ALL := $(filter-out %.po, $(RESOURCES_FILES_ALL)) +RESOURCES_FILES ?= $(RESOURCES_FILES_ALL) resources: $(RESOURCES_FILES:%=$(top_builddir)/share/salome/resources/%) @@SETX@; for d in $(SUBDIRS); do \ @@ -54,9 +56,7 @@ resources: $(RESOURCES_FILES:%=$(top_builddir)/share/salome/resources/%) done $(RESOURCES_FILES:%=$(top_builddir)/share/salome/resources/%): $(top_builddir)/share/salome/resources/% : % - if [ $(notdir $<) != "CVS" ] ; then \ - cp -fr $< $@; \ - fi + cp -fr $< $@; data: @if test "X$(top_builddir)" = "X."; then \ diff --git a/src/Communication/MultiCommException.hxx b/src/Communication/MultiCommException.hxx index fe029fc4a..6313ab5e4 100644 --- a/src/Communication/MultiCommException.hxx +++ b/src/Communication/MultiCommException.hxx @@ -3,8 +3,13 @@ #include +#if defined WNT && defined COMMUNICATION_EXPORTS +#define COMMUNICATION_EXPORT __declspec( dllexport ) +#else +#define COMMUNICATION_EXPORT +#endif -class MultiCommException { +class COMMUNICATION_EXPORT MultiCommException { private: std::string _message; public: diff --git a/src/Communication/SALOMEMultiComm.hxx b/src/Communication/SALOMEMultiComm.hxx index 2537dc042..8c46251af 100644 --- a/src/Communication/SALOMEMultiComm.hxx +++ b/src/Communication/SALOMEMultiComm.hxx @@ -4,11 +4,17 @@ #include #include CORBA_SERVER_HEADER(SALOME_Comm) +#if defined WNT && defined COMMUNICATION_EXPORTS +#define COMMUNICATION_EXPORT __declspec( dllexport ) +#else +#define COMMUNICATION_EXPORT +#endif + /*! Class is designed to ease the use of multi communication.\n Simply inherite from it your servant class you want to emit data with senders. */ -class SALOMEMultiComm : public virtual POA_SALOME::MultiCommClass { +class COMMUNICATION_EXPORT SALOMEMultiComm : public virtual POA_SALOME::MultiCommClass { protected: SALOME::TypeOfCommunication _type; public: diff --git a/src/Communication/SenderFactory.hxx b/src/Communication/SenderFactory.hxx index ce3a0ad91..39edaa3a1 100644 --- a/src/Communication/SenderFactory.hxx +++ b/src/Communication/SenderFactory.hxx @@ -5,6 +5,12 @@ #include #include CORBA_SERVER_HEADER(SALOME_Comm) +#if defined WNT && defined COMMUNICATION_EXPORTS +#define COMMUNICATION_EXPORT __declspec( dllexport ) +#else +#define COMMUNICATION_EXPORT +#endif + class SALOMEMultiComm; class SALOME_SenderDouble_i; @@ -13,7 +19,7 @@ class SALOME_SenderInt_i; /*! This class implements the factory pattern of GoF by making a sender by giving an array and a communicator.It completely hides the type of sender from the user. */ -class SenderFactory +class COMMUNICATION_EXPORT SenderFactory { public: static SALOME::SenderDouble_ptr buildSender(SALOMEMultiComm &multiCommunicator,const double *tab,long lgr,bool ownTab=false) throw(MultiCommException); diff --git a/src/Container/SALOME_Container.cxx b/src/Container/SALOME_Container.cxx index 840bb2a3a..04459555f 100644 --- a/src/Container/SALOME_Container.cxx +++ b/src/Container/SALOME_Container.cxx @@ -105,9 +105,11 @@ int main(int argc, char* argv[]) PortableServer::POAManager_var pman = root_poa->the_POAManager(); // add new container to the kill list +#ifndef WNT char aCommand[40]; sprintf(aCommand, "addToKillList.py %d SALOME_Container", getpid()); system(aCommand); +#endif Engines_Container_i * myContainer = new Engines_Container_i(orb, root_poa, containerName , argc , argv ); diff --git a/src/HDFPersist/HDFascii.cc b/src/HDFPersist/HDFascii.cc index 186d2bcd0..54577e068 100644 --- a/src/HDFPersist/HDFascii.cc +++ b/src/HDFPersist/HDFascii.cc @@ -516,8 +516,10 @@ bool CreateDatasetFromASCII(HDFcontainerObject *father, FILE *fp) fscanf(fp, "%i\n", &nbDim); hdf_size* sizeArray = new hdf_size[nbDim]; + int dim = 0; for(i = 0; iValue(); + if(_isLocal) aValue = Handle(SALOMEDSImpl_AttributeReal)::DownCast(_local_impl)->Value(); else aValue = SALOMEDS::AttributeReal::_narrow(_corba_impl)->Value(); return aValue; } diff --git a/src/SALOMEDS/SALOMEDS_AttributeStudyProperties.cxx b/src/SALOMEDS/SALOMEDS_AttributeStudyProperties.cxx index 09bb75f94..8ba288b42 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeStudyProperties.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeStudyProperties.cxx @@ -5,36 +5,42 @@ #include "SALOMEDS_AttributeStudyProperties.hxx" #include -#include +#include #include #include #include -SALOMEDS_AttributeStudyProperties -::SALOMEDS_AttributeStudyProperties(const Handle(SALOMEDSImpl_AttributeStudyProperties)& theAttr) +SALOMEDS_AttributeStudyProperties::SALOMEDS_AttributeStudyProperties + (const Handle(SALOMEDSImpl_AttributeStudyProperties)& theAttr) :SALOMEDS_GenericAttribute(theAttr) {} -SALOMEDS_AttributeStudyProperties::SALOMEDS_AttributeStudyProperties(SALOMEDS::AttributeStudyProperties_ptr theAttr) +SALOMEDS_AttributeStudyProperties::SALOMEDS_AttributeStudyProperties + (SALOMEDS::AttributeStudyProperties_ptr theAttr) :SALOMEDS_GenericAttribute(theAttr) {} SALOMEDS_AttributeStudyProperties::~SALOMEDS_AttributeStudyProperties() { } - + void SALOMEDS_AttributeStudyProperties::SetUserName(const std::string& theName) { - if(_isLocal) Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetUserName((char*)theName.c_str()); - else SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetUserName(theName.c_str()); + if (_isLocal) { + Handle(SALOMEDSImpl_AttributeStudyProperties) anImpl = + Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl); + anImpl->ChangeCreatorName((char*)theName.c_str()); + } else + SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetUserName(theName.c_str()); } std::string SALOMEDS_AttributeStudyProperties::GetUserName() { std::string aName; - if(_isLocal) { - TCollection_AsciiString N = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->GetCreatorName(); - aName = N.ToCString(); + if (_isLocal) { + TCollection_ExtendedString S = + Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->GetCreatorName(); + aName = TCollection_AsciiString(S).ToCString(); } #ifndef WNT else aName = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetUserName(); @@ -44,108 +50,123 @@ std::string SALOMEDS_AttributeStudyProperties::GetUserName() return aName; } -void SALOMEDS_AttributeStudyProperties::SetCreationDate(int theMinute, int theHour, int theDay, int theMonth, int theYear) +void SALOMEDS_AttributeStudyProperties::SetCreationDate + (int theMinute, int theHour, int theDay, int theMonth, int theYear) { - if(_isLocal) - Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetModificationDate(theMinute, - theHour, - theDay, - theMonth, - theYear); - else - SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetCreationDate(theMinute, - theHour, - theDay, - theMonth, + if (_isLocal) { + Handle(SALOMEDSImpl_AttributeStudyProperties) anImpl = + Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl); + int aTmp; + if (anImpl->GetCreationDate(aTmp, aTmp, aTmp, aTmp, aTmp)) return; + TCollection_ExtendedString S; + anImpl->SetModification(S, theMinute, theHour, theDay, theMonth, theYear); + } else { + SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetCreationDate(theMinute, + theHour, + theDay, + theMonth, theYear); + } } -bool SALOMEDS_AttributeStudyProperties::GetCreationDate(int& theMinute, - int& theHour, - int& theDay, - int& theMonth, +bool SALOMEDS_AttributeStudyProperties::GetCreationDate(int& theMinute, + int& theHour, + int& theDay, + int& theMonth, int& theYear) { bool ret; - if(_isLocal) - ret = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->GetCreationDate(theMinute, - theHour, - theDay, - theMonth, - theYear); - else { + if (_isLocal) { + ret = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast + (_local_impl)->GetCreationDate(theMinute, theHour, theDay, theMonth, theYear); + } else { CORBA::Long aMinute, anHour, aDay, aMonth, anYear; - ret = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetCreationDate(aMinute, - anHour, - aDay, - aMonth, + ret = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetCreationDate(aMinute, + anHour, + aDay, + aMonth, anYear); - theMinute = (int)aMinute; theHour = (int)anHour; theDay = (int)aDay; theMonth = (int)aMonth; theYear = (int)anYear; + theMinute = (int)aMinute; + theHour = (int)anHour; + theDay = (int)aDay; + theMonth = (int)aMonth; + theYear = (int)anYear; } return ret; } - + void SALOMEDS_AttributeStudyProperties::SetCreationMode(const std::string& theMode) { - if(_isLocal) { - if(theMode == "from scratch") + if (_isLocal) { + if (theMode == "from scratch") Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetCreationMode(1); - else if(theMode == "copy from") + else if (theMode == "copy from") Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetCreationMode(2); else //Not defined Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetCreationMode(0); } else SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetCreationMode(theMode.c_str()); } - + std::string SALOMEDS_AttributeStudyProperties::GetCreationMode() { std::string aMode; - if(_isLocal) { + if (_isLocal) { int mode = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->GetCreationMode(); - if(mode == 1) aMode = "from scratch"; - if(mode == 2) aMode = "copy from"; + if (mode == 1) aMode = "from scratch"; + if (mode == 2) aMode = "copy from"; } - else aMode = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetCreationMode(); - return aMode; + else + aMode = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetCreationMode(); + return aMode; } void SALOMEDS_AttributeStudyProperties::SetModified(int theModified) { - if(_isLocal) Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetModified(theModified); - else SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetModified(theModified); + if (_isLocal) + Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetModified(theModified); + else + SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetModified(theModified); } - + bool SALOMEDS_AttributeStudyProperties::IsModified() { bool ret; - if(_isLocal) ret = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->IsModified(); - else ret = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->IsModified(); + if (_isLocal) + ret = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->IsModified(); + else + ret = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->IsModified(); return ret; } int SALOMEDS_AttributeStudyProperties::GetModified() { int isModified; - if(_isLocal) isModified = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->GetModified(); - else isModified = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetModified(); + if (_isLocal) + isModified = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->GetModified(); + else + isModified = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetModified(); return isModified; } void SALOMEDS_AttributeStudyProperties::SetLocked(bool theLocked) { - if(_isLocal) Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetLocked(theLocked); - else SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetLocked(theLocked); + if (_isLocal) + Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetLocked(theLocked); + else + SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetLocked(theLocked); } - + bool SALOMEDS_AttributeStudyProperties::IsLocked() { bool ret; - if(_isLocal) ret = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->IsLocked(); - else ret = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->IsLocked(); + if (_isLocal) + ret = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->IsLocked(); + else + ret = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->IsLocked(); return ret; } - + void SALOMEDS_AttributeStudyProperties::SetModification(const std::string& theName, int theMinute, int theHour, @@ -153,20 +174,17 @@ void SALOMEDS_AttributeStudyProperties::SetModification(const std::string& theNa int theMonth, int theYear) { - if(_isLocal) { - Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetUserName((char*)theName.c_str()); - Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetModificationDate(theMinute, - theHour, - theDay, - theMonth, - theYear); - } - else SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetModification(theName.c_str(), - theMinute, - theHour, - theDay, - theMonth, - theYear); + if (_isLocal) { + Handle(SALOMEDSImpl_AttributeStudyProperties) anImpl = + Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl); + anImpl->SetModification((char*)theName.c_str(), theMinute, theHour, theDay, theMonth, theYear); + } else + SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetModification(theName.c_str(), + theMinute, + theHour, + theDay, + theMonth, + theYear); } void SALOMEDS_AttributeStudyProperties::GetModificationsList(std::vector& theNames, @@ -177,41 +195,36 @@ void SALOMEDS_AttributeStudyProperties::GetModificationsList(std::vector& theYears, bool theWithCreator) { - int i, aLength; - - if(_isLocal) { + + if (_isLocal) { Handle(TColStd_HSequenceOfExtendedString) aNames; Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears; - aNames = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->GetUserNames(); - Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->GetModificationDates(aMinutes, - aHours, - aDays, - aMonths, - aYears); - aLength = aNames->Length()-((theWithCreator)?0:1); - for(i = 0; i < aLength; i++) - { - theNames.push_back(TCollection_AsciiString(aNames->Value(i + 1 + ((theWithCreator)?0:1))).ToCString()); - theMinutes.push_back(aMinutes->Value(i + 1 + ((theWithCreator)?0:1))); - theHours.push_back(aHours->Value(i + 1 + ((theWithCreator)?0:1))); - theDays.push_back(aDays->Value(i + 1 + ((theWithCreator)?0:1))); - theMonths.push_back(aMonths->Value(i + 1 + ((theWithCreator)?0:1))); - theYears.push_back(aYears->Value(i + 1 + ((theWithCreator)?0:1))); - } - } - else { + Handle(SALOMEDSImpl_AttributeStudyProperties) anImpl = + Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl); + anImpl->GetModifications(aNames, aMinutes, aHours, aDays, aMonths, aYears); + aLength = aNames->Length(); + i = ((theWithCreator) ? 1 : 2); + for (; i <= aLength; i++) { + theNames.push_back(TCollection_AsciiString(aNames->Value(i)).ToCString()); + theMinutes.push_back(aMinutes->Value(i)); + theHours.push_back(aHours->Value(i)); + theDays.push_back(aDays->Value(i)); + theMonths.push_back(aMonths->Value(i)); + theYears.push_back(aYears->Value(i)); + } + } else { SALOMEDS::StringSeq_var aNames; SALOMEDS::LongSeq_var aMinutes, aHours, aDays, aMonths, aYears; - SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetModificationsList(aNames.out(), - aMinutes.out(), - aHours.out(), - aDays.out(), - aMonths.out(), + SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetModificationsList(aNames.out(), + aMinutes.out(), + aHours.out(), + aDays.out(), + aMonths.out(), aYears.out(), theWithCreator); aLength = aNames->length(); - for(i = 0; iSetFirstName((char*)theName); + Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->ChangeCreatorName((char*)theName); } -char* SALOMEDS_AttributeStudyProperties_i::GetUserName() +char* SALOMEDS_AttributeStudyProperties_i::GetUserName() { SALOMEDS::Locker lock; - TCollection_ExtendedString S = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->GetCreatorName(); + TCollection_ExtendedString S = + Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->GetCreatorName(); CORBA::String_var c_s = CORBA::string_dup(TCollection_AsciiString(S).ToCString()); return c_s._retn(); } @@ -34,21 +35,23 @@ void SALOMEDS_AttributeStudyProperties_i::SetCreationDate(CORBA::Long theMinute, CORBA::Long theHour, CORBA::Long theDay, CORBA::Long theMonth, - CORBA::Long theYear) + CORBA::Long theYear) { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl); + Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = + Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl); int aTmp; if (aProp->GetCreationDate(aTmp, aTmp, aTmp, aTmp, aTmp)) return; - aProp->SetModificationDate(theMinute, theHour, theDay, theMonth, theYear); + TCollection_ExtendedString S; + aProp->SetModification(S, theMinute, theHour, theDay, theMonth, theYear); } CORBA::Boolean SALOMEDS_AttributeStudyProperties_i::GetCreationDate(CORBA::Long& theMinute, CORBA::Long& theHour, CORBA::Long& theDay, CORBA::Long& theMonth, - CORBA::Long& theYear) + CORBA::Long& theYear) { SALOMEDS::Locker lock; Standard_Integer aMinute; @@ -56,30 +59,30 @@ CORBA::Boolean SALOMEDS_AttributeStudyProperties_i::GetCreationDate(CORBA::Long& Standard_Integer aDay; Standard_Integer aMonth; Standard_Integer aYear; - if (Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->GetCreationDate(aMinute, aHour, aDay, - aMonth, aYear)) - { - theMinute = aMinute; - theHour = aHour; - theDay = aDay; - theMonth = aMonth; - theYear = aYear; - return Standard_True; - } + if (Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast + (_impl)->GetCreationDate(aMinute, aHour, aDay, aMonth, aYear)) { + theMinute = aMinute; + theHour = aHour; + theDay = aDay; + theMonth = aMonth; + theYear = aYear; + return Standard_True; + } return Standard_False; } -void SALOMEDS_AttributeStudyProperties_i::SetCreationMode(const char* theMode) +void SALOMEDS_AttributeStudyProperties_i::SetCreationMode(const char* theMode) { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl); + Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = + Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl); if (strcmp(theMode,"from scratch")==0) aProp->SetCreationMode(CREATION_MODE_SCRATCH); else if (strcmp(theMode,"copy from")==0) aProp->SetCreationMode(CREATION_MODE_COPY); else aProp->SetCreationMode(CREATION_MODE_NOTDEFINED); } -char* SALOMEDS_AttributeStudyProperties_i::GetCreationMode() +char* SALOMEDS_AttributeStudyProperties_i::GetCreationMode() { SALOMEDS::Locker lock; CORBA::String_var c_s; @@ -91,25 +94,25 @@ char* SALOMEDS_AttributeStudyProperties_i::GetCreationMode() return c_s._retn(); } -void SALOMEDS_AttributeStudyProperties_i::SetModified(CORBA::Long theModified) +void SALOMEDS_AttributeStudyProperties_i::SetModified(CORBA::Long theModified) { SALOMEDS::Locker lock; Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->SetModified(theModified); } -CORBA::Boolean SALOMEDS_AttributeStudyProperties_i::IsModified() +CORBA::Boolean SALOMEDS_AttributeStudyProperties_i::IsModified() { SALOMEDS::Locker lock; return Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->IsModified(); } -CORBA::Long SALOMEDS_AttributeStudyProperties_i::GetModified() +CORBA::Long SALOMEDS_AttributeStudyProperties_i::GetModified() { SALOMEDS::Locker lock; return Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->GetModified(); } -void SALOMEDS_AttributeStudyProperties_i::SetLocked(CORBA::Boolean theLocked) +void SALOMEDS_AttributeStudyProperties_i::SetLocked(CORBA::Boolean theLocked) { SALOMEDS::Locker lock; Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->SetLocked(theLocked); @@ -126,50 +129,51 @@ void SALOMEDS_AttributeStudyProperties_i::SetModification(const char* theName, CORBA::Long theHour, CORBA::Long theDay, CORBA::Long theMonth, - CORBA::Long theYear) + CORBA::Long theYear) { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl); - aProp->SetUserName((char*)theName); - aProp->SetModificationDate((int)theMinute, (int)theHour, (int)theDay, (int)theMonth, (int)theYear); + Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = + Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl); + aProp->SetModification((char*)theName, (int)theMinute, (int)theHour, + (int)theDay, (int)theMonth, (int)theYear); } + void SALOMEDS_AttributeStudyProperties_i::GetModificationsList(SALOMEDS::StringSeq_out theNames, SALOMEDS::LongSeq_out theMinutes, SALOMEDS::LongSeq_out theHours, SALOMEDS::LongSeq_out theDays, SALOMEDS::LongSeq_out theMonths, SALOMEDS::LongSeq_out theYears, - CORBA::Boolean theWithCreator) + CORBA::Boolean theWithCreator) { SALOMEDS::Locker lock; Handle(TColStd_HSequenceOfExtendedString) aNames; Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears; - Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl); - aNames = aProp->GetUserNames(); - aProp->GetModificationDates(aMinutes, aHours, aDays, aMonths, aYears); - int aLength = aNames->Length()-((theWithCreator)?0:1); + Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = + Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl); + aProp->GetModifications(aNames, aMinutes, aHours, aDays, aMonths, aYears); + int aLength = aNames->Length(); + int aRetLength = aLength - ((theWithCreator) ? 0 : 1); theNames = new SALOMEDS::StringSeq; theMinutes = new SALOMEDS::LongSeq; theHours = new SALOMEDS::LongSeq; theDays = new SALOMEDS::LongSeq; theMonths = new SALOMEDS::LongSeq; theYears = new SALOMEDS::LongSeq; - theNames->length(aLength); - theMinutes->length(aLength); - theHours->length(aLength); - theDays->length(aLength); - theMonths->length(aLength); - theYears->length(aLength); - int a; - for(a = 0; a < aLength; a++) - { - (*theNames)[a]=CORBA::string_dup(TCollection_AsciiString(aNames->Value(a + 1 + ((theWithCreator)?0:1))).ToCString()); - (*theMinutes)[a] = aMinutes->Value(a + 1 + ((theWithCreator)?0:1)); - (*theHours)[a] = aHours->Value(a + 1 + ((theWithCreator)?0:1)); - (*theDays)[a] = aDays->Value(a + 1 + ((theWithCreator)?0:1)); - (*theMonths)[a] = aMonths->Value(a + 1 + ((theWithCreator)?0:1)); - (*theYears)[a] = aYears->Value(a + 1 + ((theWithCreator)?0:1)); - } + theNames->length(aRetLength); + theMinutes->length(aRetLength); + theHours->length(aRetLength); + theDays->length(aRetLength); + theMonths->length(aRetLength); + theYears->length(aRetLength); + int a = 0, ind = ((theWithCreator) ? 1 : 2); + for (; ind <= aLength; a++, ind++) { + (*theNames)[a] = CORBA::string_dup(TCollection_AsciiString(aNames->Value(ind)).ToCString()); + (*theMinutes)[a] = aMinutes->Value(ind); + (*theHours)[a] = aHours->Value(ind); + (*theDays)[a] = aDays->Value(ind); + (*theMonths)[a] = aMonths->Value(ind); + (*theYears)[a] = aYears->Value(ind); + } } - diff --git a/src/SALOMEDS/SALOMEDS_SObject.cxx b/src/SALOMEDS/SALOMEDS_SObject.cxx index c99fd51c7..1960ddcf8 100644 --- a/src/SALOMEDS/SALOMEDS_SObject.cxx +++ b/src/SALOMEDS/SALOMEDS_SObject.cxx @@ -234,7 +234,8 @@ CORBA::Object_ptr SALOMEDS_SObject::GetObject() CORBA::Object_var obj; if(_isLocal) { std::string anIOR = GetIOR(); - obj = _orb->string_to_object(anIOR.c_str()); + if (!anIOR.empty()) + obj = _orb->string_to_object(anIOR.c_str()); return obj._retn(); } else { diff --git a/src/SALOMEDS/SALOMEDS_SObject_i.cxx b/src/SALOMEDS/SALOMEDS_SObject_i.cxx index f7aa6b736..184a0af06 100644 --- a/src/SALOMEDS/SALOMEDS_SObject_i.cxx +++ b/src/SALOMEDS/SALOMEDS_SObject_i.cxx @@ -35,15 +35,15 @@ using namespace std; SALOMEDS::SObject_ptr SALOMEDS_SObject_i::New(const Handle(SALOMEDSImpl_SObject)& theImpl, CORBA::ORB_ptr theORB) { SALOMEDS_SObject_i* so_servant = new SALOMEDS_SObject_i(theImpl, theORB); - SALOMEDS::SObject_var so = SALOMEDS::SObject::_narrow(so_servant->_this()); + SALOMEDS::SObject_var so = SALOMEDS::SObject::_narrow(so_servant->_this()); - return so; -} + return so._retn(); +} //============================================================================ /*! Function : constructor - * Purpose : + * Purpose : */ //============================================================================ SALOMEDS_SObject_i::SALOMEDS_SObject_i(const Handle(SALOMEDSImpl_SObject)& impl, CORBA::ORB_ptr orb) @@ -52,20 +52,20 @@ SALOMEDS_SObject_i::SALOMEDS_SObject_i(const Handle(SALOMEDSImpl_SObject)& impl, _orb = CORBA::ORB::_duplicate(orb); //SALOME::GenericObj_i::myPOA = SALOMEDS_StudyManager_i::GetPOA(GetStudy()); } - + //============================================================================ /*! Function : destructor - * Purpose : + * Purpose : */ //============================================================================ SALOMEDS_SObject_i::~SALOMEDS_SObject_i() {} - - + + //============================================================================ /*! Function :GetID - * Purpose : + * Purpose : */ //============================================================================ char* SALOMEDS_SObject_i::GetID() @@ -73,10 +73,10 @@ char* SALOMEDS_SObject_i::GetID() SALOMEDS::Locker lock; return CORBA::string_dup(_impl->GetID().ToCString()); } - + //============================================================================ /*! Function : GetFatherComponent - * Purpose : + * Purpose : */ //============================================================================ SALOMEDS::SComponent_ptr SALOMEDS_SObject_i::GetFatherComponent() @@ -85,10 +85,10 @@ SALOMEDS::SComponent_ptr SALOMEDS_SObject_i::GetFatherComponent() SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (_impl->GetFatherComponent(), _orb); return sco._retn(); } - + //============================================================================ /*! Function : GetFather - * Purpose : + * Purpose : */ //============================================================================ SALOMEDS::SObject_ptr SALOMEDS_SObject_i::GetFather() @@ -100,7 +100,7 @@ SALOMEDS::SObject_ptr SALOMEDS_SObject_i::GetFather() //============================================================================ /*! Function : - * Purpose : + * Purpose : */ //============================================================================ SALOMEDS::Study_ptr SALOMEDS_SObject_i::GetStudy() @@ -111,12 +111,12 @@ SALOMEDS::Study_ptr SALOMEDS_SObject_i::GetStudy() MESSAGE("Problem GetStudy"); return SALOMEDS::Study::_nil(); } - + TCollection_AsciiString IOR = aStudy->GetTransientReference(); CORBA::Object_var obj = _orb->string_to_object(IOR.ToCString()); SALOMEDS::Study_var Study = SALOMEDS::Study::_narrow(obj) ; ASSERT(!CORBA::is_nil(Study)); - return SALOMEDS::Study::_duplicate(Study); + return SALOMEDS::Study::_duplicate(Study); } //============================================================================ @@ -124,7 +124,7 @@ SALOMEDS::Study_ptr SALOMEDS_SObject_i::GetStudy() * Purpose : Find attribute of given type on this SObject */ //============================================================================ -CORBA::Boolean SALOMEDS_SObject_i::FindAttribute (SALOMEDS::GenericAttribute_out anAttribute, +CORBA::Boolean SALOMEDS_SObject_i::FindAttribute (SALOMEDS::GenericAttribute_out anAttribute, const char* aTypeOfAttribute) { SALOMEDS::Locker lock; @@ -168,7 +168,7 @@ SALOMEDS::ListOfAttributes* SALOMEDS_SObject_i::GetAllAttributes() //============================================================================ /*! Function : ReferencedObject - * Purpose : + * Purpose : */ //============================================================================ CORBA::Boolean SALOMEDS_SObject_i::ReferencedObject(SALOMEDS::SObject_out obj) @@ -183,7 +183,7 @@ CORBA::Boolean SALOMEDS_SObject_i::ReferencedObject(SALOMEDS::SObject_out obj) //============================================================================ /*! Function : FindSubObject - * Purpose : + * Purpose : */ //============================================================================ CORBA::Boolean SALOMEDS_SObject_i::FindSubObject(long atag, SALOMEDS::SObject_out obj) @@ -194,8 +194,8 @@ CORBA::Boolean SALOMEDS_SObject_i::FindSubObject(long atag, SALOMEDS::SObject_ou obj = SALOMEDS_SObject_i::New (aSubObj, _orb); return true; - -} + +} //============================================================================ /*! Function : Name @@ -207,7 +207,7 @@ char* SALOMEDS_SObject_i::Name() SALOMEDS::Locker lock; return CORBA::string_dup(_impl->Name().ToCString()); } - + //============================================================================ /*! Function : Name * Purpose : sets a name @@ -219,10 +219,10 @@ void SALOMEDS_SObject_i::Name(const char* name) TCollection_AsciiString aName((char*)name); _impl->Name(aName); } - + //============================================================================ /*! Function : Tag - * Purpose : + * Purpose : */ //============================================================================ CORBA::Short SALOMEDS_SObject_i::Tag() @@ -233,7 +233,7 @@ CORBA::Short SALOMEDS_SObject_i::Tag() //============================================================================ /*! Function : Depth - * Purpose : + * Purpose : */ //============================================================================ CORBA::Short SALOMEDS_SObject_i::Depth() @@ -244,7 +244,7 @@ CORBA::Short SALOMEDS_SObject_i::Depth() //============================================================================ /*! Function : GetObject - * Purpose : + * Purpose : */ //============================================================================ CORBA::Object_ptr SALOMEDS_SObject_i::GetObject() @@ -262,10 +262,10 @@ CORBA::Object_ptr SALOMEDS_SObject_i::GetObject() //============================================================================ /*! Function : GetName - * Purpose : + * Purpose : */ //============================================================================ -char* SALOMEDS_SObject_i::GetName() +char* SALOMEDS_SObject_i::GetName() { SALOMEDS::Locker lock; CORBA::String_var aStr = CORBA::string_dup(_impl->GetName().ToCString()); @@ -274,10 +274,10 @@ char* SALOMEDS_SObject_i::GetName() //============================================================================ /*! Function : GetComment - * Purpose : + * Purpose : */ //============================================================================ -char* SALOMEDS_SObject_i::GetComment() +char* SALOMEDS_SObject_i::GetComment() { SALOMEDS::Locker lock; CORBA::String_var aStr = CORBA::string_dup(_impl->GetComment().ToCString()); @@ -286,10 +286,10 @@ char* SALOMEDS_SObject_i::GetComment() //============================================================================ /*! Function : GetIOR - * Purpose : + * Purpose : */ //============================================================================ -char* SALOMEDS_SObject_i::GetIOR() +char* SALOMEDS_SObject_i::GetIOR() { SALOMEDS::Locker lock; CORBA::String_var aStr = CORBA::string_dup(_impl->GetIOR().ToCString()); @@ -305,7 +305,7 @@ long SALOMEDS_SObject_i::GetLocalImpl(const char* theHostname, CORBA::Long thePI long pid = (long)_getpid(); #else long pid = (long)getpid(); -#endif +#endif isLocal = (strcmp(theHostname, GetHostname().c_str()) == 0 && pid == thePID)?1:0; SALOMEDSImpl_SObject* local_impl = _impl.operator->(); return ((long)local_impl); diff --git a/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx b/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx index 8894e77a1..872c753c9 100644 --- a/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx +++ b/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx @@ -47,19 +47,19 @@ static std::map _mapOfPOA; //============================================================================ /*! Function : SALOMEDS_StudyManager_i - * Purpose : SALOMEDS_StudyManager_i constructor + * Purpose : SALOMEDS_StudyManager_i constructor */ //============================================================================ -SALOMEDS_StudyManager_i::SALOMEDS_StudyManager_i(CORBA::ORB_ptr orb, PortableServer::POA_ptr thePOA) -{ +SALOMEDS_StudyManager_i::SALOMEDS_StudyManager_i(CORBA::ORB_ptr orb, PortableServer::POA_ptr thePOA) +{ _orb = CORBA::ORB::_duplicate(orb); _poa = PortableServer::POA::_duplicate(thePOA); _name_service = new SALOME_NamingService(_orb); // Study directory creation in the naming service : to register all // open studies in the session _name_service->Create_Directory("/Study"); - _impl = new SALOMEDSImpl_StudyManager; - _factory = new SALOMEDS_DriverFactory_i(_orb); + _impl = new SALOMEDSImpl_StudyManager; + _factory = new SALOMEDS_DriverFactory_i(_orb); } //============================================================================ @@ -76,11 +76,11 @@ SALOMEDS_StudyManager_i::~SALOMEDS_StudyManager_i() //============================================================================ /*! Function : register_name - * Purpose : Register the study Manager in the naming service under the + * Purpose : Register the study Manager in the naming service under the * context name */ //============================================================================ -void SALOMEDS_StudyManager_i::register_name(char * name) +void SALOMEDS_StudyManager_i::register_name(char * name) { SALOMEDS::StudyManager_var aManager(_this()); _name_service->Register(aManager.in(), name); @@ -92,7 +92,7 @@ void SALOMEDS_StudyManager_i::register_name(char * name) * Purpose : Create a New Study of name study_name */ //============================================================================ -SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::NewStudy(const char* study_name) +SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::NewStudy(const char* study_name) { SALOMEDS::Locker lock; @@ -104,12 +104,12 @@ SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::NewStudy(const char* study_name) MESSAGE("NewStudy : Creating the CORBA servant holding it... "); - SALOMEDS_Study_i *Study_servant = new SALOMEDS_Study_i(aStudyImpl, _orb); + SALOMEDS_Study_i *Study_servant = new SALOMEDS_Study_i(aStudyImpl, _orb); SALOMEDS::Study_var Study = SALOMEDS::Study::_narrow(Study_servant->_this()); // Register study in the naming service // Path to acces the study - if(!_name_service->Change_Directory("/Study")) + if(!_name_service->Change_Directory("/Study")) MESSAGE( "Unable to access the study directory" ) else _name_service->Register(Study, study_name); @@ -133,7 +133,7 @@ SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::Open(const char* aUrl) throw(SALOME::SALOME_Exception) { SALOMEDS::Locker lock; - + Unexpect aCatch(SalomeException); MESSAGE("Begin of SALOMEDS_StudyManager_i::Open"); @@ -142,13 +142,13 @@ SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::Open(const char* aUrl) MESSAGE("Open : Creating the CORBA servant holding it... "); // Temporary aStudyUrl in place of study name - SALOMEDS_Study_i * Study_servant = new SALOMEDS_Study_i(aStudyImpl, _orb); - SALOMEDS::Study_var Study = SALOMEDS::Study::_narrow(Study_servant->_this()); + SALOMEDS_Study_i * Study_servant = new SALOMEDS_Study_i(aStudyImpl, _orb); + SALOMEDS::Study_var Study = SALOMEDS::Study::_narrow(Study_servant->_this()); // Assign the value of the IOR in the study->root CORBA::String_var IORStudy = _orb->object_to_string(Study); aStudyImpl->SetTransientReference((char*)IORStudy); - + // Register study in the naming service // Path to acces the study if(!_name_service->Change_Directory("/Study")) MESSAGE( "Unable to access the study directory" ) @@ -163,7 +163,7 @@ SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::Open(const char* aUrl) /*! Function : Close * Purpose : Close a study. * If the study hasn't been saved, ask the user to confirm the - * close action without saving + * close action without saving */ //============================================================================ void SALOMEDS_StudyManager_i::Close(SALOMEDS::Study_ptr aStudy) @@ -171,12 +171,12 @@ void SALOMEDS_StudyManager_i::Close(SALOMEDS::Study_ptr aStudy) SALOMEDS::Locker lock; if(aStudy->_is_nil()) return; - + // Destroy study name in the naming service if(_name_service->Change_Directory("/Study")){ CORBA::String_var aString(aStudy->Name()); _name_service->Destroy_Name(aString.in()); - } + } SALOMEDS::unlock(); aStudy->Close(); @@ -253,7 +253,7 @@ void SALOMEDS_StudyManager_i::SaveAsASCII(const char* aUrl, SALOMEDS::Study_ptr SALOMEDS::ListOfOpenStudies* SALOMEDS_StudyManager_i::GetOpenStudies() { SALOMEDS::Locker lock; - + Handle(TColStd_HSequenceOfTransient) anOpened = _impl->GetOpenStudies(); int aLength = anOpened->Length(); @@ -281,22 +281,23 @@ SALOMEDS::ListOfOpenStudies* SALOMEDS_StudyManager_i::GetOpenStudies() * Purpose : Get a study from its name */ //============================================================================ -SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::GetStudyByName(const char* aStudyName) +SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::GetStudyByName(const char* aStudyName) { SALOMEDS::Locker lock; - - Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByName(TCollection_AsciiString((char*)aStudyName)); - if(aStudyImpl.IsNull()) - { - MESSAGE("No active study in this session"); - ASSERT(false); // Stop here... - } - - SALOMEDS_Study_i * Study_servant = new SALOMEDS_Study_i(aStudyImpl, _orb); - SALOMEDS::Study_var Study = SALOMEDS::Study::_narrow(Study_servant->_this()); - - return Study; + Handle(SALOMEDSImpl_Study) aStudyImpl = + _impl->GetStudyByName(TCollection_AsciiString((char*)aStudyName)); + + if (aStudyImpl.IsNull()) + { + MESSAGE(_impl->GetErrorCode().ToCString()); + return SALOMEDS::Study::_nil(); + } + + SALOMEDS_Study_i* aStudy_servant = new SALOMEDS_Study_i(aStudyImpl, _orb); + SALOMEDS::Study_var aStudy = SALOMEDS::Study::_narrow(aStudy_servant->_this()); + + return aStudy._retn(); } //============================================================================ @@ -304,31 +305,31 @@ SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::GetStudyByName(const char* aStudyNa * Purpose : Get a study from its ID */ //============================================================================ -SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::GetStudyByID(CORBA::Short aStudyID) +SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::GetStudyByID(CORBA::Short aStudyID) { SALOMEDS::Locker lock; - + Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByID(aStudyID); - if(aStudyImpl.IsNull()) - { - MESSAGE("No active study in this session"); - ASSERT(false); // Stop here... - } - - SALOMEDS_Study_i * Study_servant = new SALOMEDS_Study_i(aStudyImpl, _orb); - SALOMEDS::Study_var Study = SALOMEDS::Study::_narrow(Study_servant->_this()); - - return Study; + if (aStudyImpl.IsNull()) + { + MESSAGE(_impl->GetErrorCode().ToCString()); + return SALOMEDS::Study::_nil(); + } + + SALOMEDS_Study_i* aStudy_servant = new SALOMEDS_Study_i(aStudyImpl, _orb); + SALOMEDS::Study_var aStudy = SALOMEDS::Study::_narrow(aStudy_servant->_this()); + + return aStudy._retn(); } //============================================================================ /*! Function : CanCopy - * Purpose : + * Purpose : */ //============================================================================ -CORBA::Boolean SALOMEDS_StudyManager_i::CanCopy(SALOMEDS::SObject_ptr theObject) +CORBA::Boolean SALOMEDS_StudyManager_i::CanCopy(SALOMEDS::SObject_ptr theObject) { SALOMEDS::Locker lock; @@ -347,7 +348,7 @@ CORBA::Boolean SALOMEDS_StudyManager_i::CanCopy(SALOMEDS::SObject_ptr theObject) * Purpose : */ //============================================================================ -CORBA::Boolean SALOMEDS_StudyManager_i::Copy(SALOMEDS::SObject_ptr theObject) +CORBA::Boolean SALOMEDS_StudyManager_i::Copy(SALOMEDS::SObject_ptr theObject) { SALOMEDS::Locker lock; @@ -366,7 +367,7 @@ CORBA::Boolean SALOMEDS_StudyManager_i::Copy(SALOMEDS::SObject_ptr theObject) * Purpose : */ //============================================================================ -CORBA::Boolean SALOMEDS_StudyManager_i::CanPaste(SALOMEDS::SObject_ptr theObject) +CORBA::Boolean SALOMEDS_StudyManager_i::CanPaste(SALOMEDS::SObject_ptr theObject) { SALOMEDS::Locker lock; @@ -396,7 +397,7 @@ SALOMEDS::SObject_ptr SALOMEDS_StudyManager_i::Paste(SALOMEDS::SObject_ptr theOb Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByID(aStudy->StudyId()); Handle(SALOMEDSImpl_SObject) anObject = aStudyImpl->GetSObject((char*)theObject->GetID()); Handle(SALOMEDSImpl_SObject) aNewSO; - + try { SALOMEDS_Driver_i* aDriver = GetDriver(anObject, _orb); aNewSO = _impl->Paste(anObject, aDriver); @@ -414,7 +415,7 @@ SALOMEDS::SObject_ptr SALOMEDS_StudyManager_i::Paste(SALOMEDS::SObject_ptr theOb SALOMEDS_Driver_i* GetDriver(const Handle(SALOMEDSImpl_SObject)& theObject, CORBA::ORB_ptr orb) { SALOMEDS_Driver_i* driver = NULL; - + Handle(SALOMEDSImpl_SComponent) aSCO = theObject->GetFatherComponent(); if(!aSCO.IsNull()) { TCollection_AsciiString IOREngine = aSCO->GetIOR(); @@ -423,7 +424,7 @@ SALOMEDS_Driver_i* GetDriver(const Handle(SALOMEDSImpl_SObject)& theObject, CORB SALOMEDS::Driver_var Engine = SALOMEDS::Driver::_narrow(obj) ; driver = new SALOMEDS_Driver_i(Engine, orb); } - } + } return driver; } @@ -442,7 +443,7 @@ long SALOMEDS_StudyManager_i::GetLocalImpl(const char* theHostname, CORBA::Long long pid = (long)_getpid(); #else long pid = (long)getpid(); -#endif +#endif isLocal = (strcmp(theHostname, GetHostname().c_str()) == 0 && pid == thePID)?1:0; SALOMEDSImpl_StudyManager* aManager = _impl.operator->(); return ((long)aManager); @@ -479,4 +480,4 @@ namespace SALOMEDS } -//=========================================================================== +//=========================================================================== diff --git a/src/SALOMEDS/SALOME_DriverPy.py b/src/SALOMEDS/SALOME_DriverPy.py new file mode 100644 index 000000000..8728ffae8 --- /dev/null +++ b/src/SALOMEDS/SALOME_DriverPy.py @@ -0,0 +1,44 @@ +import SALOMEDS__POA + +class SALOME_DriverPy_i(SALOMEDS__POA.Driver): + """ + """ + _ComponentDataType = None + + def __init__ (self, componentDataType): + print "SALOME_DriverPy.__init__: ",componentDataType + _ComponentDataType = componentDataType + + def IORToLocalPersistentID(self, theSObject, IORString, isMultiFile, isASCII): + return theSObject.GetID() + + def LocalPersistentIDToIOR(self, theSObject, PersistentID, isMultiFile, isASCII): + return "" + + def ComponentDataType(self): + return _ComponentDataType + + def Save(self, theComponent, theURL, isMultiFile): + return NULL + + def SaveASCII(self, theComponent, theURL, isMultiFile): + return self.Save(theComponent, theURL, isMultiFile) + + def Load(self, theComponent, theStream, theURL, isMultiFile): + return 1 + + def LoadASCII(self, theComponent, theStream, theURL, isMultiFile): + return self.Load(theComponent, theStream, theURL, isMultiFile) + + def Close(self, theComponent): + pass + + def CanPublishInStudy(self, theIOR): + return 1 + + def PublishInStudy(self, theStudy, theSObject, theObject, theName): + return NULL + + def CanCopy(self, theObject): + return 0 + diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx index bf9599366..ab6b6f11c 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx @@ -63,7 +63,7 @@ void SALOMEDSImpl_AttributeIOR::SetValue(const TCollection_ExtendedString& theVa SALOMEDSImpl_Study::IORUpdated(this); - SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved + //SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } //======================================================================= diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeStudyProperties.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeStudyProperties.cxx index 3d7cc3d57..3093a7ae7 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeStudyProperties.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeStudyProperties.cxx @@ -11,13 +11,13 @@ using namespace std; IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeStudyProperties, SALOMEDSImpl_GenericAttribute ) IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeStudyProperties, SALOMEDSImpl_GenericAttribute ) -const Standard_GUID& SALOMEDSImpl_AttributeStudyProperties::GetID() +const Standard_GUID& SALOMEDSImpl_AttributeStudyProperties::GetID() { static Standard_GUID SALOMEDSImpl_AttributeStudyPropertiesID ("128371A2-8F52-11d6-A8A3-0001021E8C7F"); return SALOMEDSImpl_AttributeStudyPropertiesID; } -Handle(SALOMEDSImpl_AttributeStudyProperties) SALOMEDSImpl_AttributeStudyProperties::Set(const TDF_Label& label) +Handle(SALOMEDSImpl_AttributeStudyProperties) SALOMEDSImpl_AttributeStudyProperties::Set(const TDF_Label& label) { Handle(SALOMEDSImpl_AttributeStudyProperties) anAttr; if (!label.FindAttribute(SALOMEDSImpl_AttributeStudyProperties::GetID(),anAttr)) { @@ -47,54 +47,57 @@ void SALOMEDSImpl_AttributeStudyProperties::Init() myMode = 0; // none } -void SALOMEDSImpl_AttributeStudyProperties::SetUserName(const TCollection_ExtendedString& theName) +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) { - CheckLocked(); - Backup(); - myUserName->Append(theName); -} + if (theMinute<0 || theMinute>60 || theHour<0 || theHour>24 || + theDay<0 || theDay>31 || theMonth<0 || theMonth>12) + return; -void SALOMEDSImpl_AttributeStudyProperties::SetFirstName(const TCollection_ExtendedString& theName) -{ - CheckLocked(); + CheckLocked(); Backup(); - if (myUserName->Length() == 0) myUserName->Append(theName); - else myUserName->SetValue(1, theName); -} -TCollection_ExtendedString SALOMEDSImpl_AttributeStudyProperties::GetCreatorName() const -{ - if (myUserName->Length() == 0) return TCollection_ExtendedString(""); - return myUserName->Value(1); + myUserName->Append(theUserName); + myMinute->Append(theMinute); + myHour->Append(theHour); + myDay->Append(theDay); + myMonth->Append(theMonth); + myYear->Append(theYear); } -Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeStudyProperties::GetUserNames() const +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 { - return myUserName; + theUserNames = myUserName; + theMinutes = myMinute; + theHours = myHour; + theDays = myDay; + theMonths = myMonth; + theYears = myYear; } -void SALOMEDSImpl_AttributeStudyProperties::SetModificationDate(const Standard_Integer theMinute, - const Standard_Integer theHour, - const Standard_Integer theDay, - const Standard_Integer theMonth, - const Standard_Integer theYear) +TCollection_ExtendedString SALOMEDSImpl_AttributeStudyProperties::GetCreatorName() const { - CheckLocked(); - Backup(); - if (theMinute<0 || theMinute>60 || theHour<0 || theHour>24 || theDay<0 || theDay>31 || theMonth<0 || theMonth>12) - return; - myMinute->Append(theMinute); - myHour->Append(theHour); - myDay->Append(theDay); - myMonth->Append(theMonth); - myYear->Append(theYear); + if (myUserName->Length() == 0) + return TCollection_ExtendedString(""); + return myUserName->Value(1); } -Standard_Boolean SALOMEDSImpl_AttributeStudyProperties::GetCreationDate(Standard_Integer& theMinute, - Standard_Integer& theHour, - Standard_Integer& theDay, - Standard_Integer& theMonth, - Standard_Integer& theYear) const +Standard_Boolean SALOMEDSImpl_AttributeStudyProperties::GetCreationDate + (Standard_Integer& theMinute, + Standard_Integer& theHour, + Standard_Integer& theDay, + Standard_Integer& theMonth, + Standard_Integer& theYear) const { if (myMinute->Length() != 0) { theMinute = myMinute->Value(1); @@ -107,22 +110,18 @@ Standard_Boolean SALOMEDSImpl_AttributeStudyProperties::GetCreationDate(Standard return Standard_False; } -void SALOMEDSImpl_AttributeStudyProperties::GetModificationDates(Handle(TColStd_HSequenceOfInteger)& theMinutes, - Handle(TColStd_HSequenceOfInteger)& theHours, - Handle(TColStd_HSequenceOfInteger)& theDays, - Handle(TColStd_HSequenceOfInteger)& theMonths, - Handle(TColStd_HSequenceOfInteger)& theYears) const +void SALOMEDSImpl_AttributeStudyProperties::ChangeCreatorName(const TCollection_ExtendedString& theName) { - theMinutes = myMinute; - theHours = myHour; - theDays = myDay; - theMonths = myMonth; - theYears = myYear; + if (myUserName->Length() > 0) { + CheckLocked(); + Backup(); + myUserName->SetValue(1, theName); + } } -void SALOMEDSImpl_AttributeStudyProperties::SetCreationMode(const Standard_Integer theMode) +void SALOMEDSImpl_AttributeStudyProperties::SetCreationMode(const Standard_Integer theMode) { - CheckLocked(); + CheckLocked(); Backup(); myMode = theMode; } @@ -132,7 +131,7 @@ Standard_Integer SALOMEDSImpl_AttributeStudyProperties::GetCreationMode() const return myMode; } -void SALOMEDSImpl_AttributeStudyProperties::SetModified(const Standard_Integer theModified) +void SALOMEDSImpl_AttributeStudyProperties::SetModified(const Standard_Integer theModified) { myModified = theModified; } @@ -147,7 +146,7 @@ Standard_Integer SALOMEDSImpl_AttributeStudyProperties::GetModified() const return myModified; } -void SALOMEDSImpl_AttributeStudyProperties::SetLocked(const Standard_Boolean theLocked) +void SALOMEDSImpl_AttributeStudyProperties::SetLocked(const Standard_Boolean theLocked) { // Backup(); if (myLocked != theLocked) { @@ -172,18 +171,17 @@ const Standard_GUID& SALOMEDSImpl_AttributeStudyProperties::ID() const return GetID(); } -void SALOMEDSImpl_AttributeStudyProperties::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributeStudyProperties::Restore(const Handle(TDF_Attribute)& with) { - Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(with); + Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = + Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(with); Init(); Standard_Integer i; - Handle(TColStd_HSequenceOfExtendedString) aNames = aProp->GetUserNames(); - for(i = aNames->Length(); i > 0; i--) { - myUserName->Prepend(aNames->Value(i)); - } + Handle(TColStd_HSequenceOfExtendedString) aNames; Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears; - aProp->GetModificationDates(aMinutes, aHours, aDays, aMonths, aYears); - for(i = aMinutes->Length(); i > 0; i--) { + 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)); @@ -201,17 +199,17 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributeStudyProperties::NewEmpty() const } void SALOMEDSImpl_AttributeStudyProperties::Paste(const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)&) const + const Handle(TDF_RelocationTable)&) const { - Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(into); + Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = + Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(into); aProp->Init(); Standard_Integer i; for(i = 1; i <= myUserName->Length(); i++) { - aProp->SetUserName(myUserName->Value(i)); - } - for(i = 1; i <= myMinute->Length(); i++) { - aProp->SetModificationDate(myMinute->Value(i), myHour->Value(i), myDay->Value(i), myMonth->Value(i), myYear->Value(i)); + aProp->SetModification(myUserName->Value(i), + myMinute->Value(i), myHour->Value(i), + myDay->Value(i), myMonth->Value(i), myYear->Value(i)); } aProp->SetCreationMode(myMode); @@ -220,15 +218,15 @@ void SALOMEDSImpl_AttributeStudyProperties::Paste(const Handle(TDF_Attribute)& i } -TCollection_AsciiString SALOMEDSImpl_AttributeStudyProperties::Save() +TCollection_AsciiString SALOMEDSImpl_AttributeStudyProperties::Save() { Handle(TColStd_HSequenceOfExtendedString) aNames; Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears; - aNames = GetUserNames(); - GetModificationDates(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->Length(); anIndex > 0; anIndex--) + aLength += aNames->Value(anIndex).Length() + 1; char* aProperty = new char[3 + aLength + 12 * aNames->Length()]; @@ -238,7 +236,7 @@ TCollection_AsciiString SALOMEDSImpl_AttributeStudyProperties::Save() aLength = aNames->Length(); int a = 2; - for(anIndex = 1; anIndex <= aLength; anIndex++) { + for (anIndex = 1; anIndex <= aLength; anIndex++) { sprintf(&(aProperty[a]),"%2d%2d%2d%2d%4d%s", (int)(aMinutes->Value(anIndex)), (int)(aHours->Value(anIndex)), @@ -250,13 +248,13 @@ TCollection_AsciiString SALOMEDSImpl_AttributeStudyProperties::Save() aProperty[a++] = 1; } aProperty[a] = 0; - TCollection_AsciiString prop(aProperty); + TCollection_AsciiString prop(aProperty); delete aProperty; return prop; } -void SALOMEDSImpl_AttributeStudyProperties::Load(const TCollection_AsciiString& value) +void SALOMEDSImpl_AttributeStudyProperties::Load(const TCollection_AsciiString& value) { char* aCopy = value.ToCString(); @@ -264,7 +262,7 @@ void SALOMEDSImpl_AttributeStudyProperties::Load(const TCollection_AsciiString& SetCreationMode(crMode); int anIndex; - for(anIndex = 2; anIndex + 2 < value.Length() ;) { + for (anIndex = 2; anIndex + 2 < value.Length() ;) { char str[10]; Standard_Integer aMinute, aHour, aDay, aMonth, aYear; str[0] = aCopy[anIndex++]; @@ -286,14 +284,13 @@ void SALOMEDSImpl_AttributeStudyProperties::Load(const TCollection_AsciiString& str[3] = aCopy[anIndex++]; str[4] = 0; aYear = atoi(str); - + int aNameSize; for(aNameSize = 0; aCopy[anIndex+aNameSize]!=1; aNameSize++); char *aName = new char[aNameSize+1]; strncpy(aName, &(aCopy[anIndex]), aNameSize); aName[aNameSize] = 0; - SetUserName(aName); - SetModificationDate(aMinute,aHour,aDay,aMonth,aYear); + SetModification(aName,aMinute,aHour,aDay,aMonth,aYear); delete(aName); anIndex += aNameSize + 1; } @@ -302,4 +299,3 @@ void SALOMEDSImpl_AttributeStudyProperties::Load(const TCollection_AsciiString& } SetModified(0); } - diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeStudyProperties.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeStudyProperties.hxx index f9d3c1a16..19fc22d0e 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeStudyProperties.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeStudyProperties.hxx @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include #include "SALOMEDSImpl_GenericAttribute.hxx" @@ -22,50 +22,61 @@ DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeStudyProperties, SALOMEDSImpl_Gene #include #include -class SALOMEDSImpl_AttributeStudyProperties : public SALOMEDSImpl_GenericAttribute +class SALOMEDSImpl_AttributeStudyProperties : 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_AttributeStudyProperties Set(const TDF_Label& label) ; Standard_EXPORT SALOMEDSImpl_AttributeStudyProperties(); -Standard_EXPORT void Init() ; -Standard_EXPORT void SetUserName(const TCollection_ExtendedString& theName) ; -Standard_EXPORT void SetFirstName(const TCollection_ExtendedString& theName) ; +Standard_EXPORT ~SALOMEDSImpl_AttributeStudyProperties() {} + +Standard_EXPORT static const Standard_GUID& GetID(); +Standard_EXPORT const Standard_GUID& ID() const; + +Standard_EXPORT static Handle_SALOMEDSImpl_AttributeStudyProperties Set(const TDF_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 Handle_TColStd_HSequenceOfExtendedString GetUserNames() const; -Standard_EXPORT void SetModificationDate(const Standard_Integer theMinute, - const Standard_Integer theHour, - const Standard_Integer theDay, - const Standard_Integer theMonth, - const Standard_Integer theYear) ; -Standard_EXPORT Standard_Boolean GetCreationDate(Standard_Integer& theMinute, - Standard_Integer& theHour, - Standard_Integer& theDay, - Standard_Integer& theMonth, - Standard_Integer& theYear) const; -Standard_EXPORT void GetModificationDates(Handle(TColStd_HSequenceOfInteger)& theMinutes, - Handle(TColStd_HSequenceOfInteger)& theHours, - Handle(TColStd_HSequenceOfInteger)& theDays, - Handle(TColStd_HSequenceOfInteger)& theMonths, - Handle(TColStd_HSequenceOfInteger)& theYears) const; -Standard_EXPORT void SetCreationMode(const Standard_Integer theMode) ; +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 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 void SetLocked(const Standard_Boolean theLocked); Standard_EXPORT Standard_Boolean IsLocked() const; -Standard_EXPORT Standard_Boolean IsLockChanged(const Standard_Boolean theErase) ; -Standard_EXPORT const Standard_GUID& ID() const; -Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; +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 ~SALOMEDSImpl_AttributeStudyProperties() {} +Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into, + const Handle(TDF_RelocationTable)& RT) const; -private: +private: Handle_TColStd_HSequenceOfExtendedString myUserName; Handle_TColStd_HSequenceOfInteger myMinute; diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx index 00c38c889..82a2cf437 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx @@ -24,7 +24,7 @@ using namespace std; #include "SALOMEDSImpl_ChildNodeIterator.hxx" #include "SALOMEDSImpl_Attributes.hxx" #include "SALOMEDSImpl_UseCaseIterator.hxx" -#include "SALOMEDSImpl_AttributeReference.hxx" +#include "SALOMEDSImpl_AttributeReference.hxx" #include "SALOMEDSImpl_StudyHandle.hxx" #include "SALOMEDSImpl_Tool.hxx" @@ -32,7 +32,7 @@ IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_Study, MMgt_TShared ) IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_Study, MMgt_TShared ) #define DIRECTORYID 16661 -#define FILELOCALID 26662 +#define FILELOCALID 26662 #define FILEID "FILE: " //============================================================================ @@ -56,11 +56,11 @@ SALOMEDSImpl_Study::SALOMEDSImpl_Study(const Handle(TDocStd_Document)& doc, _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 + //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 SALOMEDSImpl_StudyHandle::Set(_doc->Main().Root(), this); } - + //============================================================================ /*! Function : ~SALOMEDSImpl_Study @@ -68,7 +68,7 @@ SALOMEDSImpl_Study::SALOMEDSImpl_Study(const Handle(TDocStd_Document)& doc, */ //============================================================================ SALOMEDSImpl_Study::~SALOMEDSImpl_Study() -{} +{} //============================================================================ /*! Function : GetPersistentReference @@ -99,7 +99,7 @@ TCollection_AsciiString SALOMEDSImpl_Study::GetTransientReference() _errorCode = "IOR is empty"; } - return IOR; + return IOR; } void SALOMEDSImpl_Study::SetTransientReference(const TCollection_AsciiString& theIOR) @@ -146,10 +146,10 @@ Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::FindComponent (const TCollec name = SC->ComponentDataType(); if(aComponentName == name) { _find = true; - return SC; + return SC; } } - + if(!_find) { _errorCode = "No component was found"; @@ -168,7 +168,7 @@ Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::FindComponentID(const TColle _errorCode = ""; // Iterate on each components defined in the study - // Get the component ID and compare with aComponentID + // Get the component ID and compare with aComponentID bool _find = false; TCollection_AsciiString ID; Handle(SALOMEDSImpl_SComponent) compo; @@ -217,7 +217,7 @@ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::FindObject(const TCollection_As { _find = true; RefSO = SC; - + } if (!_find) RefSO = _FindObject(SC, anObjectName, _find); } @@ -238,12 +238,12 @@ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::FindObjectID(const TCollection_ // Convert aSO->GetID in TDF_Label. TDF_Label Lab; TDF_Tool::Label(_doc->Main().Data(), anObjectID, Lab); - + if (Lab.IsNull()) { _errorCode = "No label was found by ID"; return NULL; } - return GetSObject(Lab); + return GetSObject(Lab); } @@ -259,7 +259,7 @@ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::CreateObjectID(const TCollectio // Convert aSO->GetID in TDF_Label. TDF_Label Lab; TDF_Tool::Label(_doc->Main().Data(), anObjectID, Lab, Standard_True); - + if (Lab.IsNull()) { _errorCode = "Can not create a label"; return NULL; @@ -280,7 +280,7 @@ Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_Study::FindObjectByName(const _errorCode = ""; Handle(TColStd_HSequenceOfTransient) listSO = new TColStd_HSequenceOfTransient(); - + Handle(SALOMEDSImpl_SComponent) compo = FindComponent(aComponentName) ; if ( compo.IsNull() ) { _errorCode = "Can not find the component"; @@ -288,19 +288,19 @@ Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_Study::FindObjectByName(const } // Iterate on each object and subobject of the component - // If objectName is found add it to the list of SObjects + // If objectName is found add it to the list of SObjects TCollection_AsciiString childName ; TCollection_AsciiString compoId = compo->GetID(); Handle(SALOMEDSImpl_ChildIterator) it = NewChildIterator(compo); for ( ; it->More(); it->Next() ) { - + Handle(SALOMEDSImpl_SObject) CSO = it->Value(); if ( CSO->GetName() == anObjectName ) { /* add to list */ listSO->Append(CSO) ; } - + /* looks also for eventual children */ bool found = false ; CSO = _FindObject( CSO, anObjectName, found ) ; @@ -308,7 +308,7 @@ Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_Study::FindObjectByName(const listSO->Append(CSO) ; } } - + return listSO; } @@ -329,7 +329,7 @@ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::FindObjectIOR(const TCollection // 11 oct 2002: forbidden attributes must be checked here if (!aResult->GetLabel().IsAttribute(SALOMEDSImpl_AttributeIOR::GetID())) { myIORLabels.UnBind(anObjectIOR); - } else + } else return aResult; } // Iterate to all components defined in the study @@ -345,7 +345,7 @@ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::FindObjectIOR(const TCollection { SC = it.Value(); TCollection_AsciiString ior = SC->GetIOR(); - if (ior != "") + if (ior != "") { if (ior == anObjectIOR) { @@ -353,11 +353,11 @@ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::FindObjectIOR(const TCollection RefSO = SC; } } - if (!_find) + if (!_find) RefSO = _FindObjectIOR(SC, anObjectIOR, _find); } } - + if(RefSO.IsNull()) _errorCode = "No object was found"; return RefSO; } @@ -380,7 +380,7 @@ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::FindObjectByPath(const TCollect return GetSObject(_current); } - if(aPath.Value(1) != '/') //Relative path + if(aPath.Value(1) != '/') //Relative path isRelative = true; TDF_ChildIterator anIterator; @@ -388,7 +388,7 @@ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::FindObjectByPath(const TCollect Handle(SALOMEDSImpl_AttributeName) anAttr; if(isRelative) { - if(_current.IsNull()) return NULL; + if(_current.IsNull()) return NULL; anIterator.Initialize(_current, Standard_False); } else { @@ -427,7 +427,7 @@ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::FindObjectByPath(const TCollect //============================================================================ /*! Function : GetObjectPath - * Purpose : + * Purpose : */ //============================================================================ TCollection_AsciiString SALOMEDSImpl_Study::GetObjectPath(const Handle(SALOMEDSImpl_SObject)& theObject) @@ -439,7 +439,7 @@ TCollection_AsciiString SALOMEDSImpl_Study::GetObjectPath(const Handle(SALOMEDSI _errorCode = "Null object"; return aPath.ToCString(); } - + TCollection_AsciiString aName = theObject->GetName(); if(!aName.IsEmpty() && aName != "" ) { TCollection_AsciiString aValue((char*)aName.ToCString()); @@ -456,7 +456,7 @@ TCollection_AsciiString SALOMEDSImpl_Study::GetObjectPath(const Handle(SALOMEDSI } } - return aPath; + return aPath; } @@ -464,7 +464,7 @@ TCollection_AsciiString SALOMEDSImpl_Study::GetObjectPath(const Handle(SALOMEDSI /*! Function : GetObjectPathByIOR * Purpose : */ -//============================================================================ +//============================================================================ TCollection_AsciiString SALOMEDSImpl_Study::GetObjectPathByIOR(const TCollection_AsciiString& theIOR) { _errorCode = ""; @@ -475,9 +475,9 @@ TCollection_AsciiString SALOMEDSImpl_Study::GetObjectPathByIOR(const TCollection _errorCode = "No SObject was found by IOR"; return aPath; } - + return GetObjectPath(so); -} +} //============================================================================ @@ -485,7 +485,7 @@ TCollection_AsciiString SALOMEDSImpl_Study::GetObjectPathByIOR(const TCollection * Purpose : Sets the current context */ //============================================================================ -bool SALOMEDSImpl_Study::SetContext(const TCollection_AsciiString& thePath) +bool SALOMEDSImpl_Study::SetContext(const TCollection_AsciiString& thePath) { _errorCode = ""; if(thePath.IsEmpty()) { @@ -496,15 +496,15 @@ bool SALOMEDSImpl_Study::SetContext(const TCollection_AsciiString& thePath) TCollection_AsciiString aPath(thePath), aContext(""); bool isInvalid = false; Handle(SALOMEDSImpl_SObject) aSO; - - if(aPath.Value(1) != '/') { //Relative path + + if(aPath.Value(1) != '/') { //Relative path aContext = GetContext(); aContext += '/'; aContext += aPath; } else aContext = aPath; - + try { aSO = FindObjectByPath(aContext.ToCString()); } @@ -533,7 +533,7 @@ bool SALOMEDSImpl_Study::SetContext(const TCollection_AsciiString& thePath) * Purpose : Gets the current context */ //============================================================================ -TCollection_AsciiString SALOMEDSImpl_Study::GetContext() +TCollection_AsciiString SALOMEDSImpl_Study::GetContext() { _errorCode = ""; @@ -542,7 +542,7 @@ TCollection_AsciiString SALOMEDSImpl_Study::GetContext() return ""; } Handle(SALOMEDSImpl_SObject) so = GetSObject(_current); - return GetObjectPath(so); + return GetObjectPath(so); } //============================================================================ @@ -550,7 +550,7 @@ TCollection_AsciiString SALOMEDSImpl_Study::GetContext() * 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) +Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetObjectNames(const TCollection_AsciiString& theContext) { _errorCode = ""; @@ -583,7 +583,7 @@ Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetObjectNames(const * 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) +Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetDirectoryNames(const TCollection_AsciiString& theContext) { _errorCode = ""; @@ -623,7 +623,7 @@ Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetDirectoryNames(con * 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) +Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetFileNames(const TCollection_AsciiString& theContext) { _errorCode = ""; @@ -665,7 +665,7 @@ Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetFileNames(const TC * Purpose : method to get all components names */ //============================================================================ -Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetComponentNames(const TCollection_AsciiString& theContext) +Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetComponentNames(const TCollection_AsciiString& theContext) { _errorCode = ""; @@ -719,7 +719,7 @@ Handle(SALOMEDSImpl_StudyBuilder) SALOMEDSImpl_Study::NewBuilder() return _builder; } - + //============================================================================ /*! Function : Name * Purpose : get study name @@ -801,7 +801,8 @@ void SALOMEDSImpl_Study::URL(const TCollection_AsciiString& url) _errorCode = ""; _URL = url; - TCollection_AsciiString tmp(_URL); + /*jfa: Now name of SALOMEDS study will correspond to name of SalomeApp study + TCollection_AsciiString tmp(_URL); char *aName = (char*)tmp.ToCString(); char *adr = strtok(aName, "/"); @@ -810,7 +811,8 @@ void SALOMEDSImpl_Study::URL(const TCollection_AsciiString& url) aName = adr; adr = strtok(NULL, "/"); } - Name(aName); + Name(aName);*/ + Name(url); } @@ -820,22 +822,22 @@ void SALOMEDSImpl_Study::URL(const TCollection_AsciiString& url) */ //============================================================================ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::_FindObject(const Handle(SALOMEDSImpl_SObject)& SO, - const TCollection_AsciiString& theObjectName, + const TCollection_AsciiString& theObjectName, bool& _find) { - if(SO.IsNull()) return NULL; + if(SO.IsNull()) return NULL; // 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; + Handle(SALOMEDSImpl_AttributeName) anAttr; TCollection_AsciiString soid = SO->GetID(); TDF_ChildIterator it(SO->GetLabel()); for (; it.More(); it.Next()){ if(!_find) { - if (it.Value().FindAttribute(SALOMEDSImpl_AttributeName::GetID(), anAttr)) + if (it.Value().FindAttribute(SALOMEDSImpl_AttributeName::GetID(), anAttr)) { TCollection_AsciiString Val(anAttr->Value()); if (Val == theObjectName) @@ -855,12 +857,12 @@ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::_FindObject(const Handle(SALOME * Purpose : Find an Object with SALOMEDSImpl_IOR = anObjectIOR */ //============================================================================ -Handle(SALOMEDSImpl_SObject) +Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::_FindObjectIOR(const Handle(SALOMEDSImpl_SObject)& SO, - const TCollection_AsciiString& theObjectIOR, + const TCollection_AsciiString& theObjectIOR, bool& _find) { - if(SO.IsNull()) return NULL; + if(SO.IsNull()) return NULL; // Iterate on each objects and subobjects of the component // If objectName find, stop the loop and get the object reference @@ -871,9 +873,9 @@ SALOMEDSImpl_Study::_FindObjectIOR(const Handle(SALOMEDSImpl_SObject)& SO, for (; it.More();it.Next()){ if(!_find) { - if (it.Value().FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(), anAttr)) + if (it.Value().FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(), anAttr)) { - TCollection_AsciiString Val(anAttr->Value()); + TCollection_AsciiString Val(anAttr->Value()); if (Val == theObjectIOR) { RefSO = GetSObject(it.Value()); @@ -905,7 +907,7 @@ void SALOMEDSImpl_Study::StudyId(int id) _StudyId = id; } -void SALOMEDSImpl_Study::UpdateIORLabelMap(const TCollection_AsciiString& anIOR,const TCollection_AsciiString& anEntry) +void SALOMEDSImpl_Study::UpdateIORLabelMap(const TCollection_AsciiString& anIOR,const TCollection_AsciiString& anEntry) { _errorCode = ""; TDF_Label aLabel; @@ -916,12 +918,12 @@ void SALOMEDSImpl_Study::UpdateIORLabelMap(const TCollection_AsciiString& anIOR, myIORLabels.Bind(TCollection_ExtendedString(IOR), aLabel); } -Handle(SALOMEDSImpl_Study) SALOMEDSImpl_Study::GetStudy(const TDF_Label& theLabel) +Handle(SALOMEDSImpl_Study) SALOMEDSImpl_Study::GetStudy(const TDF_Label& theLabel) { Handle(SALOMEDSImpl_StudyHandle) Att; if (theLabel.Root().FindAttribute(SALOMEDSImpl_StudyHandle::GetID(),Att)) { return Att->GetHandle(); - } + } return NULL; } @@ -936,68 +938,68 @@ Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::SComponent(const TDF_Label& } -void SALOMEDSImpl_Study::IORUpdated(const Handle(SALOMEDSImpl_AttributeIOR)& theAttribute) +void SALOMEDSImpl_Study::IORUpdated(const Handle(SALOMEDSImpl_AttributeIOR)& theAttribute) { TCollection_AsciiString aString; TDF_Tool::Entry(theAttribute->Label(), aString); GetStudy(theAttribute->Label())->UpdateIORLabelMap(theAttribute->Value(), aString); } -Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_Study::FindDependances(const Handle(SALOMEDSImpl_SObject)& anObject) +Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_Study::FindDependances(const Handle(SALOMEDSImpl_SObject)& anObject) { _errorCode = ""; Handle(TColStd_HSequenceOfTransient) aSeq; - + Handle(SALOMEDSImpl_AttributeTarget) aTarget; if (anObject->GetLabel().FindAttribute(SALOMEDSImpl_AttributeTarget::GetID(), aTarget)) { return aTarget->Get(); } - + return aSeq; } -Handle(SALOMEDSImpl_AttributeStudyProperties) SALOMEDSImpl_Study::GetProperties() +Handle(SALOMEDSImpl_AttributeStudyProperties) SALOMEDSImpl_Study::GetProperties() { _errorCode = ""; return SALOMEDSImpl_AttributeStudyProperties::Set(_doc->Main()); } -TCollection_AsciiString SALOMEDSImpl_Study::GetLastModificationDate() +TCollection_AsciiString SALOMEDSImpl_Study::GetLastModificationDate() { _errorCode = ""; Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = GetProperties(); Handle(TColStd_HSequenceOfExtendedString) aNames; Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears; - aNames = aProp->GetUserNames(); - aProp->GetModificationDates(aMinutes, aHours, aDays, aMonths, aYears); + aProp->GetModifications(aNames, aMinutes, aHours, aDays, aMonths, aYears); int aLastIndex = aNames->Length(); 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); + 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); return aResStr; } -Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetModificationsDate() +Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetModificationsDate() { _errorCode = ""; Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = GetProperties(); Handle(TColStd_HSequenceOfExtendedString) aNames; Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears; - aNames = aProp->GetUserNames(); - aProp->GetModificationDates(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; - for(anIndex = 2; anIndex <= aLength; anIndex++) { + for (anIndex = 2; 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))); + 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); } return aDates; @@ -1010,7 +1012,7 @@ Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetModificationsDate( * Purpose : Returns a UseCase builder */ //============================================================================ -Handle(SALOMEDSImpl_UseCaseBuilder) SALOMEDSImpl_Study::GetUseCaseBuilder() +Handle(SALOMEDSImpl_UseCaseBuilder) SALOMEDSImpl_Study::GetUseCaseBuilder() { _errorCode = ""; return _useCaseBuilder; @@ -1019,7 +1021,7 @@ Handle(SALOMEDSImpl_UseCaseBuilder) SALOMEDSImpl_Study::GetUseCaseBuilder() //============================================================================ /*! Function : Close - * Purpose : + * Purpose : */ //============================================================================ void SALOMEDSImpl_Study::Close() @@ -1034,40 +1036,40 @@ void SALOMEDSImpl_Study::Close() //============================================================================ /*! Function : AddPostponed - * Purpose : + * Purpose : */ //============================================================================ -void SALOMEDSImpl_Study::AddPostponed(const TCollection_AsciiString& theIOR) +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); + myNbPostponed.SetValue(myNbPostponed.Length(), myNbPostponed.Last() + 1); } //============================================================================ /*! Function : AddCreatedPostponed - * Purpose : + * Purpose : */ //============================================================================ -void SALOMEDSImpl_Study::AddCreatedPostponed(const TCollection_AsciiString& theIOR) +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); + myNbPostponed.SetValue(myNbPostponed.Length(), myNbPostponed.Last() + 1); } //============================================================================ /*! Function : RemovePostponed - * Purpose : + * Purpose : */ //============================================================================ -Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::RemovePostponed(const int theUndoLimit) +Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::RemovePostponed(const int theUndoLimit) { _errorCode = ""; @@ -1124,10 +1126,10 @@ Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::RemovePostponed(const //============================================================================ /*! Function : UndoPostponed - * Purpose : + * Purpose : */ //============================================================================ -void SALOMEDSImpl_Study::UndoPostponed(const int theWay) +void SALOMEDSImpl_Study::UndoPostponed(const int theWay) { _errorCode = ""; @@ -1141,13 +1143,13 @@ void SALOMEDSImpl_Study::UndoPostponed(const int theWay) //============================================================================ /*! Function : GetSComponent - * Purpose : + * Purpose : */ //============================================================================ Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::GetSComponent(const TCollection_AsciiString& theEntry) { Handle(SALOMEDSImpl_SComponent) aSCO; - if(_mapOfSCO.IsBound(theEntry)) + if(_mapOfSCO.IsBound(theEntry)) aSCO = Handle(SALOMEDSImpl_SComponent)::DownCast(_mapOfSCO.Find(theEntry)); else { TDF_Label aLabel; @@ -1161,7 +1163,7 @@ Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::GetSComponent(const TCollect //============================================================================ /*! Function : GetSComponent - * Purpose : + * Purpose : */ //============================================================================ Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::GetSComponent(const TDF_Label& theLabel) @@ -1173,13 +1175,13 @@ Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::GetSComponent(const TDF_Labe //============================================================================ /*! Function : GetSObject - * Purpose : + * Purpose : */ //============================================================================ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::GetSObject(const TCollection_AsciiString& theEntry) { Handle(SALOMEDSImpl_SObject) aSO; - if(_mapOfSO.IsBound(theEntry)) + if(_mapOfSO.IsBound(theEntry)) aSO = Handle(SALOMEDSImpl_SObject)::DownCast(_mapOfSO.Find(theEntry)); else { TDF_Label aLabel; @@ -1193,7 +1195,7 @@ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::GetSObject(const TCollection_As //============================================================================ /*! Function : GetSObject - * Purpose : + * Purpose : */ //============================================================================ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::GetSObject(const TDF_Label& theLabel) @@ -1205,10 +1207,10 @@ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::GetSObject(const TDF_Label& the //============================================================================ /*! Function : GetAttribute - * Purpose : + * Purpose : */ //============================================================================ -Handle(TDF_Attribute) SALOMEDSImpl_Study::GetAttribute(const TCollection_AsciiString& theEntry, +Handle(TDF_Attribute) SALOMEDSImpl_Study::GetAttribute(const TCollection_AsciiString& theEntry, const TCollection_AsciiString& theType) { Handle(SALOMEDSImpl_SObject) aSO = GetSObject(theEntry); @@ -1219,11 +1221,11 @@ Handle(TDF_Attribute) SALOMEDSImpl_Study::GetAttribute(const TCollection_AsciiSt //============================================================================ /*! Function : DumpStudy - * Purpose : + * Purpose : */ //============================================================================ -bool SALOMEDSImpl_Study::DumpStudy(const TCollection_AsciiString& thePath, - const TCollection_AsciiString& theBaseName, +bool SALOMEDSImpl_Study::DumpStudy(const TCollection_AsciiString& thePath, + const TCollection_AsciiString& theBaseName, bool isPublished, SALOMEDSImpl_DriverFactory* theFactory) { @@ -1239,7 +1241,7 @@ bool SALOMEDSImpl_Study::DumpStudy(const TCollection_AsciiString& thePath, //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(); @@ -1252,13 +1254,13 @@ bool SALOMEDSImpl_Study::DumpStudy(const TCollection_AsciiString& thePath, TCollection_AsciiString aFileName=thePath+TCollection_AsciiString("\\")+theBaseName+TCollection_AsciiString(".py"); #else TCollection_AsciiString aFileName=thePath+TCollection_AsciiString("/")+theBaseName+TCollection_AsciiString(".py"); -#endif +#endif //Create a file that will contain a main Study script fstream fp; - fp.open(aFileName.ToCString(), ios::out); + fp.open(aFileName.ToCString(), ios::out); -#ifdef WIN32 +#ifdef WIN32 bool isOpened = fp.is_open(); #else bool isOpened = fp.rdbuf()->is_open(); @@ -1266,7 +1268,7 @@ bool SALOMEDSImpl_Study::DumpStudy(const TCollection_AsciiString& thePath, if(!isOpened) { _errorCode = TCollection_AsciiString("Can't create a file ")+aFileName; - return false; + return false; } TCollection_AsciiString aBatchModeScript = "salome"; @@ -1276,7 +1278,7 @@ bool SALOMEDSImpl_Study::DumpStudy(const TCollection_AsciiString& thePath, fp << "import sys" << endl; fp << "import " << aBatchModeScript << "\n" << endl; fp << "sys.path.insert( 0, \'" << thePath << "\')\n" << endl; - + Handle(TColStd_HSequenceOfAsciiString) aSeqOfFileNames = new TColStd_HSequenceOfAsciiString; //Iterate all components and create the componponents specific scripts. @@ -1292,9 +1294,9 @@ bool SALOMEDSImpl_Study::DumpStudy(const TCollection_AsciiString& thePath, try { if (!sco->ComponentIOR(IOREngine)) { if (!aCompType.IsEmpty()) { - + aDriver = theFactory->GetDriverByType(aCompType); - + if (aDriver != NULL) { Handle(SALOMEDSImpl_StudyBuilder) SB = NewBuilder(); cout << "Before SB" << endl; @@ -1313,7 +1315,7 @@ bool SALOMEDSImpl_Study::DumpStudy(const TCollection_AsciiString& thePath, } catch(...) { _errorCode = "Can not restore information to dump it"; return false; - } + } if(aDriver == NULL) continue; @@ -1329,18 +1331,18 @@ bool SALOMEDSImpl_Study::DumpStudy(const TCollection_AsciiString& thePath, aFileName=thePath+TCollection_AsciiString("\\"); #else aFileName=thePath+TCollection_AsciiString("/"); -#endif +#endif TCollection_AsciiString aScriptName; aScriptName += theBaseName; aScriptName += "_"; aScriptName += aCompType; - + aFileName += aScriptName+ TCollection_AsciiString(".py"); aSeqOfFileNames->Append(aFileName); - + fp2.open(aFileName.ToCString(), ios::out); -#ifdef WIN32 +#ifdef WIN32 isOpened = fp.is_open(); #else isOpened = fp.rdbuf()->is_open(); @@ -1349,8 +1351,8 @@ bool SALOMEDSImpl_Study::DumpStudy(const TCollection_AsciiString& thePath, if(!isOpened) { _errorCode = TCollection_AsciiString("Can't create a file ")+aFileName; SALOMEDSImpl_Tool::RemoveTemporaryFiles(thePath, aSeqOfFileNames, false); - return false; - } + return false; + } //Output the Python script generated by the component in the newly created file. fp2 << aStream; @@ -1375,28 +1377,28 @@ bool SALOMEDSImpl_Study::DumpStudy(const TCollection_AsciiString& thePath, TCollection_AsciiString SALOMEDSImpl_Study::GetDumpStudyComment(const char* theComponentName) { TCollection_AsciiString txt - ("### This file is generated by SALOME automatically by dump python funcitonality"); + ("### This file is generated by SALOME automatically by dump python functionality"); if ( theComponentName ) txt += TCollection_AsciiString(" of ") + (char*) theComponentName + " component"; return txt; } -void dumpSO(const Handle(SALOMEDSImpl_SObject)& theSO, - fstream& fp, +void dumpSO(const Handle(SALOMEDSImpl_SObject)& theSO, + fstream& fp, const TCollection_AsciiString& Tab, const Handle(SALOMEDSImpl_Study) theStudy); //============================================================================ /*! Function : dump - * Purpose : + * Purpose : */ //============================================================================ void SALOMEDSImpl_Study::dump(const TCollection_AsciiString& theFileName) { //Create a file that will contain a main Study script fstream fp; - fp.open(theFileName.ToCString(), ios::out); + fp.open(theFileName.ToCString(), ios::out); -#ifdef WIN32 +#ifdef WIN32 bool isOpened = fp.is_open(); #else bool isOpened = fp.rdbuf()->is_open(); @@ -1405,7 +1407,7 @@ void SALOMEDSImpl_Study::dump(const TCollection_AsciiString& theFileName) if(!isOpened) { _errorCode = TCollection_AsciiString("Can't create a file ")+theFileName; cout << "### SALOMEDSImpl_Study::dump Error: " << _errorCode << endl; - return; + return; } Handle(SALOMEDSImpl_SObject) aSO = FindObjectID("0:1"); @@ -1420,8 +1422,8 @@ void SALOMEDSImpl_Study::dump(const TCollection_AsciiString& theFileName) } -void dumpSO(const Handle(SALOMEDSImpl_SObject)& theSO, - fstream& fp, +void dumpSO(const Handle(SALOMEDSImpl_SObject)& theSO, + fstream& fp, const TCollection_AsciiString& Tab, const Handle(SALOMEDSImpl_Study) theStudy) { @@ -1430,7 +1432,7 @@ void dumpSO(const Handle(SALOMEDSImpl_SObject)& theSO, TDF_AttributeIterator anItr(theSO->GetLabel()); for(; anItr.More(); anItr.Next()) { Handle(SALOMEDSImpl_GenericAttribute) anAttr = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(anItr.Value()); - + if(anAttr.IsNull()) { fp << Tab << " -- " << anItr.Value()->DynamicType(); continue; @@ -1438,7 +1440,7 @@ void dumpSO(const Handle(SALOMEDSImpl_SObject)& theSO, TCollection_AsciiString aType = anAttr->GetClassType(); fp << Tab << " -- " << aType; - + if(aType == "AttributeReal") { fp << " : " << Handle(SALOMEDSImpl_AttributeReal)::DownCast(anAttr)->Value(); } @@ -1469,6 +1471,6 @@ void dumpSO(const Handle(SALOMEDSImpl_SObject)& theSO, void SALOMEDSImpl_Study::Modify() { - _errorCode = ""; + _errorCode = ""; _doc->Modify(); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx index c2f21e3e5..5f782eb33 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx @@ -102,7 +102,7 @@ bool SALOMEDSImpl_StudyBuilder::DefineComponentInstance(const Handle(SALOMEDSImp //add IOR definition SALOMEDSImpl_AttributeIOR::Set(aComponent->GetLabel(), IOR); - _doc->Modify(); + //_doc->Modify(); return true; } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx index fb784bda7..71adc5a50 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx @@ -41,7 +41,7 @@ IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_StudyManager, MMgt_TShared ) #define AUTO_SAVE_TAG "0:8" #define AUTO_SAVE_TIME_OUT_IN_SECONDS 1200 -static void SaveAttributes(Handle(SALOMEDSImpl_SObject) SO, HDFgroup *hdf_group_sobject); +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)&, @@ -49,15 +49,15 @@ static void Translate_IOR_to_persistentID (const Handle(SALOMEDSImpl_SObject)&, //============================================================================ /*! Function : SALOMEDSImpl_StudyManager - * Purpose : SALOMEDSImpl_StudyManager constructor + * Purpose : SALOMEDSImpl_StudyManager constructor */ //============================================================================ -SALOMEDSImpl_StudyManager::SALOMEDSImpl_StudyManager() -{ +SALOMEDSImpl_StudyManager::SALOMEDSImpl_StudyManager() +{ _errorCode = ""; - _OCAFApp = new SALOMEDSImpl_OCAFApplication(); + _OCAFApp = new SALOMEDSImpl_OCAFApplication(); _IDcounter = 0; - _OCAFApp->NewDocument("SALOME_STUDY", _clipboard); + _OCAFApp->NewDocument("SALOME_STUDY", _clipboard); } //============================================================================ @@ -77,14 +77,14 @@ SALOMEDSImpl_StudyManager::~SALOMEDSImpl_StudyManager() * Purpose : Create a New Study of name study_name */ //==================================================T========================== -Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::NewStudy(const TCollection_AsciiString& study_name) +Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::NewStudy(const TCollection_AsciiString& study_name) { _errorCode = ""; Handle(TDocStd_Document) Doc; - _OCAFApp->NewDocument("SALOME_STUDY",Doc); + _OCAFApp->NewDocument("SALOME_STUDY",Doc); - Handle(SALOMEDSImpl_Study) Study = new SALOMEDSImpl_Study(Doc, study_name); + Handle(SALOMEDSImpl_Study) Study = new SALOMEDSImpl_Study(Doc, study_name); _IDcounter++; Study->StudyId( _IDcounter ); @@ -93,9 +93,9 @@ Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::NewStudy(const TCollection Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = Study->GetProperties(); OSD_Process aProcess; Quantity_Date aDate = aProcess.SystemDate(); - aProp->SetModificationDate(aDate.Minute(), aDate.Hour(), aDate.Day(), aDate.Month(), aDate.Year()); + aProp->SetModification(aProcess.UserName().ToCString(), + aDate.Minute(), aDate.Hour(), aDate.Day(), aDate.Month(), aDate.Year()); aProp->SetCreationMode(1); //"from scratch" - aProp->SetUserName(aProcess.UserName().ToCString()); return Study; } @@ -109,8 +109,8 @@ Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::Open(const TCollection_Asc { _errorCode = ""; - // open the HDFFile - HDFfile *hdf_file =0; + // open the HDFFile + HDFfile *hdf_file =0; HDFgroup *hdf_group_study_structure =0; char* aC_HDFUrl; @@ -146,13 +146,13 @@ Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::Open(const TCollection_Asc #endif _errorCode = TCollection_AsciiString(eStr); return NULL; - } + } // Temporary aStudyUrl in place of study name Handle(TDocStd_Document) Doc; - _OCAFApp->NewDocument("SALOME_STUDY",Doc); + _OCAFApp->NewDocument("SALOME_STUDY",Doc); - Handle(SALOMEDSImpl_Study) Study = new SALOMEDSImpl_Study(Doc, aUrl); + Handle(SALOMEDSImpl_Study) Study = new SALOMEDSImpl_Study(Doc, aUrl); _IDcounter++; Study->StudyId( _IDcounter ); @@ -160,7 +160,7 @@ Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::Open(const TCollection_Asc // Assign the value of the URL in the study object Study->URL (aUrl); - SALOMEDSImpl_AttributePersistentRef::Set(Doc->Main(), aUrl); + SALOMEDSImpl_AttributePersistentRef::Set(Doc->Main(), aUrl); if (!hdf_file->ExistInternalObject("STUDY_STRUCTURE")) { _errorCode = "Study is empty"; @@ -184,7 +184,7 @@ Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::Open(const TCollection_Asc sprintf(eStr,"Can't open file %s", aUrl.ToCString()); _errorCode = TCollection_AsciiString(eStr); return NULL; - } + } hdf_file->CloseOnDisk(); @@ -205,7 +205,7 @@ Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::Open(const TCollection_Asc /*! Function : Close * Purpose : Close a study. * If the study hasn't been saved, ask the user to confirm the - * close action without saving + * close action without saving */ //============================================================================ @@ -217,7 +217,7 @@ void SALOMEDSImpl_StudyManager::Close(const Handle(SALOMEDSImpl_Study)& aStudy) _errorCode = "Study is null"; return; } - + aStudy->Close(); } @@ -226,7 +226,7 @@ void SALOMEDSImpl_StudyManager::Close(const Handle(SALOMEDSImpl_Study)& aStudy) * Purpose : Save a Study to it's persistent reference */ //============================================================================ -bool SALOMEDSImpl_StudyManager::Save(const Handle(SALOMEDSImpl_Study)& aStudy, +bool SALOMEDSImpl_StudyManager::Save(const Handle(SALOMEDSImpl_Study)& aStudy, SALOMEDSImpl_DriverFactory* aFactory, bool theMultiFile) { @@ -244,7 +244,7 @@ bool SALOMEDSImpl_StudyManager::Save(const Handle(SALOMEDSImpl_Study)& aStudy, return false; } -bool SALOMEDSImpl_StudyManager::SaveASCII(const Handle(SALOMEDSImpl_Study)& aStudy, +bool SALOMEDSImpl_StudyManager::SaveASCII(const Handle(SALOMEDSImpl_Study)& aStudy, SALOMEDSImpl_DriverFactory* aFactory, bool theMultiFile) { @@ -267,8 +267,8 @@ bool SALOMEDSImpl_StudyManager::SaveASCII(const Handle(SALOMEDSImpl_Study)& aStu * 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 TCollection_AsciiString& aUrl, + const Handle(SALOMEDSImpl_Study)& aStudy, SALOMEDSImpl_DriverFactory* aFactory, bool theMultiFile) { @@ -276,8 +276,8 @@ bool SALOMEDSImpl_StudyManager::SaveAs(const TCollection_AsciiString& aUrl, 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 TCollection_AsciiString& aUrl, + const Handle(SALOMEDSImpl_Study)& aStudy, SALOMEDSImpl_DriverFactory* aFactory, bool theMultiFile) { @@ -293,7 +293,7 @@ bool SALOMEDSImpl_StudyManager::SaveAsASCII(const TCollection_AsciiString& aUrl, Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_StudyManager::GetOpenStudies() { _errorCode = ""; - Handle(TColStd_HSequenceOfTransient) aList = new TColStd_HSequenceOfTransient; + Handle(TColStd_HSequenceOfTransient) aList = new TColStd_HSequenceOfTransient; int nbDocs = _OCAFApp->NbDocuments(); @@ -322,31 +322,31 @@ Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_StudyManager::GetOpenStudies() * Purpose : Get a study from its name */ //============================================================================ -Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::GetStudyByName(const TCollection_AsciiString& aStudyName) +Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::GetStudyByName + (const TCollection_AsciiString& aStudyName) { _errorCode = ""; - - Handle(SALOMEDSImpl_Study) aStudy; int nbDocs = _OCAFApp->NbDocuments(); - if(nbDocs == 0) { + if (nbDocs == 0) { _errorCode = "No active study in this session"; - return aStudy; + return NULL; } else { + Handle(SALOMEDSImpl_Study) aStudy; Handle(CDF_Session) S = CDF_Session::CurrentSession(); CDF_DirectoryIterator it (S->Directory()); - for (;it.MoreDocument();it.NextDocument()) { + for (; it.MoreDocument(); it.NextDocument()) { Handle(TDocStd_Document) D = Handle(TDocStd_Document)::DownCast(it.Document()); - if(D == _clipboard) continue; + if (D == _clipboard) continue; aStudy = SALOMEDSImpl_Study::GetStudy(D->Main()); - if(aStudy.IsNull()) continue; - if(aStudy->Name() == aStudyName) return aStudy; + if (aStudy.IsNull()) continue; + if (aStudy->Name() == aStudyName) return aStudy; } } - - _errorCode = TCollection_AsciiString("Found no study with the name ")+aStudyName; - return aStudy; + + _errorCode = TCollection_AsciiString("Found no study with the name ") + aStudyName; + return NULL; } //============================================================================ @@ -354,30 +354,30 @@ Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::GetStudyByName(const TColl * Purpose : Get a study from its ID */ //============================================================================ -Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::GetStudyByID(int aStudyID) +Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::GetStudyByID(int aStudyID) { _errorCode = ""; - Handle(SALOMEDSImpl_Study) aStudy; int nbDocs = _OCAFApp->NbDocuments(); - if(nbDocs == 0) { + if (nbDocs == 0) { _errorCode = "No active study in this session"; - return aStudy; + return NULL; } else { + Handle(SALOMEDSImpl_Study) aStudy; Handle(CDF_Session) S = CDF_Session::CurrentSession(); CDF_DirectoryIterator it (S->Directory()); - for (;it.MoreDocument();it.NextDocument()) { + for (; it.MoreDocument(); it.NextDocument()) { Handle(TDocStd_Document) D = Handle(TDocStd_Document)::DownCast(it.Document()); - if(D == _clipboard) continue; + if (D == _clipboard) continue; aStudy = SALOMEDSImpl_Study::GetStudy(D->Main()); - if(aStudy.IsNull()) continue; - if(aStudy->StudyId() == aStudyID) return aStudy; + if (aStudy.IsNull()) continue; + if (aStudy->StudyId() == aStudyID) return aStudy; } } - + _errorCode = "Found no study with the given ID"; - return aStudy; + return NULL; } //============================================================================= @@ -385,7 +385,8 @@ Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::GetStudyByID(int aStudyID) * Purpose : save the study properties in HDF file */ //============================================================================ -bool SALOMEDSImpl_StudyManager::Impl_SaveProperties(const Handle(SALOMEDSImpl_Study)& aStudy, HDFgroup *hdf_group) +bool SALOMEDSImpl_StudyManager::Impl_SaveProperties(const Handle(SALOMEDSImpl_Study)& aStudy, + HDFgroup *hdf_group) { _errorCode = ""; @@ -401,25 +402,24 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveProperties(const Handle(SALOMEDSImpl_St OSD_Process aProcess; Quantity_Date aDate = aProcess.SystemDate(); - aProp->SetUserName(aProcess.UserName().ToCString()); - aProp->SetModificationDate(aDate.Minute(), aDate.Hour(), aDate.Day(), aDate.Month(), aDate.Year()); + aProp->SetModification(aProcess.UserName().ToCString(), + aDate.Minute(), aDate.Hour(), aDate.Day(), aDate.Month(), aDate.Year()); if (aLocked) aProp->SetLocked(Standard_True); Handle(TColStd_HSequenceOfExtendedString) aNames; Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears; - aNames = aProp->GetUserNames(); - aProp->GetModificationDates(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++) + for(i=1; i<=aNames->Length(); i++) aLength += aNames->Value(i).Length() + 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()]; - + sprintf(aProperty,"%c%c", (char)aProp->GetCreationMode(), (aProp->IsLocked())?'l':'u'); aLength = aNames->Length(); @@ -438,7 +438,7 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveProperties(const Handle(SALOMEDSImpl_St aProperty[a] = 0; name_len = (hdf_int32) a; - size[0] = name_len + 1 ; + size[0] = name_len + 1 ; hdf_dataset = new HDFdataset("AttributeStudyProperties",hdf_group,HDF_STRING,size,1); hdf_dataset->CreateOnDisk(); hdf_dataset->WriteOnDisk(aProperty); @@ -455,7 +455,7 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveProperties(const Handle(SALOMEDSImpl_St * Purpose : save the study in HDF file */ //============================================================================ -bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const TCollection_AsciiString& aUrl, +bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const TCollection_AsciiString& aUrl, const Handle(SALOMEDSImpl_Study)& aStudy, SALOMEDSImpl_DriverFactory* aFactory, bool theMultiFile, @@ -469,7 +469,7 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const TCollection_AsciiString& aUrl, _errorCode = ""; - HDFfile *hdf_file=0; + HDFfile *hdf_file=0; HDFgroup *hdf_group_study_structure =0; HDFgroup *hdf_sco_group =0; HDFgroup *hdf_sco_group2 =0; @@ -526,7 +526,7 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const TCollection_AsciiString& aUrl, TCollection_AsciiString anOldName = aStudy->Name(); aStudy->URL(aUrl); - // To change for Save + // 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->CreateOnDisk(); @@ -538,31 +538,31 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const TCollection_AsciiString& aUrl, hdf_group_datacomponent->CreateOnDisk(); SALOMEDSImpl_SComponentIterator itcomponent = aStudy->NewComponentIterator(); - + //SRN: Added 17 Nov, 2003 Handle(SALOMEDSImpl_SObject) anAutoSaveSO = aStudy->FindObjectID(AUTO_SAVE_TAG); //SRN: End for (; itcomponent.More(); itcomponent.Next()) { Handle(SALOMEDSImpl_SComponent) sco = itcomponent.Value(); - + TCollection_AsciiString scoid = sco->GetID(); hdf_sco_group = new HDFgroup(scoid.ToCString(), hdf_group_datacomponent); hdf_sco_group->CreateOnDisk(); TCollection_AsciiString componentDataType = sco->ComponentDataType(); - //SRN: Added 17 Nov 2003: If there is a specified attribute, the component peforms a special save - if(!anAutoSaveSO.IsNull() && SB->IsGUID(sco, AUTO_SAVE_GUID)) { - + //SRN: Added 17 Nov 2003: If there is a specified attribute, the component peforms a special save + if(!anAutoSaveSO.IsNull() && SB->IsGUID(sco, AUTO_SAVE_GUID)) { + Handle(SALOMEDSImpl_AttributeTableOfString) aTable; if(anAutoSaveSO->GetLabel().FindAttribute(SALOMEDSImpl_AttributeTableOfString::GetID(), aTable)) { Standard_Integer nbRows = aTable->GetNbRows(), k, aTimeOut = 0; - if(nbRows > 0 && aTable->GetNbColumns() > 1) { + if(nbRows > 0 && aTable->GetNbColumns() > 1) { - Handle(TColStd_HSequenceOfExtendedString) aRow; + Handle(TColStd_HSequenceOfExtendedString) aRow; for(k=1; k<=nbRows; k++) { - aRow = aTable->GetRowData(k); + aRow = aTable->GetRowData(k); if (aRow->Value(1) == componentDataType) { TCollection_AsciiString anEntry = TCollection_AsciiString(aRow->Value(2)); Handle(SALOMEDSImpl_SObject) aCompSpecificSO = aStudy->FindObjectID(anEntry); @@ -570,17 +570,17 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const TCollection_AsciiString& aUrl, Handle(SALOMEDSImpl_AttributeInteger) anInteger; if(aCompSpecificSO->GetLabel().FindAttribute(SALOMEDSImpl_AttributeInteger::GetID(), anInteger)) { anInteger->SetValue(-1); - while(anInteger->Value() < 0) { + while(anInteger->Value() < 0) { #ifndef WNT - sleep(2); + sleep(2); #else Sleep(2); #endif - if(++aTimeOut > AUTO_SAVE_TIME_OUT_IN_SECONDS) - break; + if(++aTimeOut > AUTO_SAVE_TIME_OUT_IN_SECONDS) + break; } } // if(aCompSpecificSO->FindAttribute(anInteger, "AttributeInteger")) - } // if(!CORBA::is_nil(aCompSpecificSO)) + } // if(!CORBA::is_nil(aCompSpecificSO)) } // if (strcmp(aRow[0], componentDataType) == 0) } // for @@ -596,7 +596,7 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const TCollection_AsciiString& aUrl, { SALOMEDSImpl_Driver* Engine = NULL; if(aMapTypeDriver.find(componentDataType.ToCString()) != aMapTypeDriver.end()) { - // we have found the associated engine to write the data + // we have found the associated engine to write the data Engine = aMapTypeDriver[componentDataType.ToCString()]; } else { @@ -608,20 +608,20 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const TCollection_AsciiString& aUrl, unsigned char* aStream; long length; - if (theASCII) aStream = Engine->SaveASCII(sco, - SALOMEDSImpl_Tool::GetDirFromPath(aUrl), + if (theASCII) aStream = Engine->SaveASCII(sco, + SALOMEDSImpl_Tool::GetDirFromPath(aUrl), length, theMultiFile); else aStream = Engine->Save(sco, - SALOMEDSImpl_Tool::GetDirFromPath(aUrl), + SALOMEDSImpl_Tool::GetDirFromPath(aUrl), length, theMultiFile); HDFdataset *hdf_dataset; hdf_size aHDFSize[1]; - if(length > 0) { //The component saved some auxiliary files, then put them into HDF file + if(length > 0) { //The component saved some auxiliary files, then put them into HDF file aHDFSize[0] = length; - + HDFdataset *hdf_dataset = new HDFdataset("FILE_STREAM", hdf_sco_group, HDF_STRING, aHDFSize, 1); hdf_dataset->CreateOnDisk(); hdf_dataset->WriteOnDisk(aStream); //Save the stream in the HDF file @@ -634,14 +634,14 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const TCollection_AsciiString& aUrl, hdf_dataset->CreateOnDisk(); hdf_dataset->WriteOnDisk((void*)(theMultiFile?"M":"S")); // save: multi or single hdf_dataset->CloseOnDisk(); - hdf_dataset=0; //will be deleted by hdf_sco_AuxFiles destructor + hdf_dataset=0; //will be deleted by hdf_sco_AuxFiles destructor // store ASCII state aHDFSize[0] = 2; hdf_dataset = new HDFdataset("ASCII_STATE", hdf_sco_group, HDF_STRING, aHDFSize, 1); hdf_dataset->CreateOnDisk(); hdf_dataset->WriteOnDisk((void*)(theASCII?"A":"B")); // save: ASCII or BINARY hdf_dataset->CloseOnDisk(); - hdf_dataset=0; //will be deleted by hdf_sco_AuxFiles destructor + hdf_dataset=0; //will be deleted by hdf_sco_AuxFiles destructor // Creation of the persistance reference attribute Translate_IOR_to_persistentID (sco, Engine, theMultiFile, theASCII); @@ -661,7 +661,7 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const TCollection_AsciiString& aUrl, hdf_group_study_structure->CreateOnDisk(); // save component attributes SALOMEDSImpl_SComponentIterator itcomp = aStudy->NewComponentIterator(); - for (; itcomp.More(); itcomp.Next()) + for (; itcomp.More(); itcomp.Next()) { Handle(SALOMEDSImpl_SComponent) SC = itcomp.Value(); TCollection_AsciiString scid = SC->GetID(); @@ -671,7 +671,7 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const TCollection_AsciiString& aUrl, // ComponentDataType treatment component_name = SC->ComponentDataType().ToCString(); name_len = (hdf_int32)strlen(component_name); - size[0] = name_len +1 ; + size[0] = name_len +1 ; hdf_dataset = new HDFdataset("COMPONENTDATATYPE",hdf_sco_group2,HDF_STRING,size,1); hdf_dataset->CreateOnDisk(); hdf_dataset->WriteOnDisk(component_name); @@ -700,7 +700,7 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const TCollection_AsciiString& aUrl, //5 - Write the Study Properties //----------------------------------------------------------------------- name_len = (hdf_int32) aStudy->Name().Length(); - size[0] = name_len +1 ; + 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(); @@ -734,18 +734,18 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const TCollection_AsciiString& aUrl, * Purpose : */ //============================================================================ -bool SALOMEDSImpl_StudyManager::Impl_SaveObject(const Handle(SALOMEDSImpl_SObject)& SC, +bool SALOMEDSImpl_StudyManager::Impl_SaveObject(const Handle(SALOMEDSImpl_SObject)& SC, HDFgroup *hdf_group_datatype) { _errorCode = ""; // Write in group hdf_group_datatype all informations of SObject SC // Iterative function to parse all SObjects under a SComponent - + HDFgroup *hdf_group_sobject = 0; TDF_ChildIterator itchild(SC->GetLabel()); - for (; itchild.More(); itchild.Next()) + for (; itchild.More(); itchild.Next()) { // mpv: don't save empty labels @@ -796,10 +796,10 @@ TCollection_AsciiString SALOMEDSImpl_StudyManager::Impl_SubstituteSlash(const TC //============================================================================ /*! Function : GetDocumentOfStudy - * Purpose : + * Purpose : */ //============================================================================ -Handle(TDocStd_Document) SALOMEDSImpl_StudyManager::GetDocumentOfStudy(const Handle(SALOMEDSImpl_Study)& theStudy) +Handle(TDocStd_Document) SALOMEDSImpl_StudyManager::GetDocumentOfStudy(const Handle(SALOMEDSImpl_Study)& theStudy) { _errorCode = ""; return theStudy->_doc; @@ -807,11 +807,11 @@ Handle(TDocStd_Document) SALOMEDSImpl_StudyManager::GetDocumentOfStudy(const Han //============================================================================ /*! Function : CanCopy - * Purpose : + * Purpose : */ //============================================================================ bool SALOMEDSImpl_StudyManager::CanCopy(const Handle(SALOMEDSImpl_SObject)& theObject, - SALOMEDSImpl_Driver* theEngine) + SALOMEDSImpl_Driver* theEngine) { _errorCode = ""; Handle(SALOMEDSImpl_SComponent) aComponent = theObject->GetFatherComponent(); @@ -825,14 +825,14 @@ bool SALOMEDSImpl_StudyManager::CanCopy(const Handle(SALOMEDSImpl_SObject)& theO //============================================================================ /*! Function : CopyLabel - * Purpose : + * Purpose : */ //============================================================================ bool SALOMEDSImpl_StudyManager::CopyLabel(const Handle(SALOMEDSImpl_Study)& theSourceStudy, SALOMEDSImpl_Driver* theEngine, const Standard_Integer theSourceStartDepth, const TDF_Label& theSource, - const TDF_Label& theDestinationMain) + const TDF_Label& theDestinationMain) { _errorCode = ""; @@ -852,7 +852,7 @@ bool SALOMEDSImpl_StudyManager::CopyLabel(const Handle(SALOMEDSImpl_Study)& theS 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; @@ -866,7 +866,7 @@ bool SALOMEDSImpl_StudyManager::CopyLabel(const Handle(SALOMEDSImpl_Study)& theS SALOMEDSImpl_AttributeComment::Set(aAuxTargetLabel, TCollection_ExtendedString(anEntry)); continue; } - + if (!Handle(SALOMEDSImpl_AttributeIOR)::DownCast(anAttr).IsNull()) { // IOR => ID and TMPFile of Engine TCollection_AsciiString anEntry; TDF_Tool::Entry(theSource, anEntry); @@ -897,7 +897,7 @@ bool SALOMEDSImpl_StudyManager::CopyLabel(const Handle(SALOMEDSImpl_Study)& theS */ //============================================================================ bool SALOMEDSImpl_StudyManager::Copy(const Handle(SALOMEDSImpl_SObject)& theObject, - SALOMEDSImpl_Driver* theEngine) + SALOMEDSImpl_Driver* theEngine) { _errorCode = ""; @@ -919,7 +919,7 @@ bool SALOMEDSImpl_StudyManager::Copy(const Handle(SALOMEDSImpl_SObject)& theObje _clipboard->Main().Root().ForgetAllAttributes(Standard_True); _OCAFApp->Close(_clipboard); Handle(TDocStd_Document) aDoc; - _OCAFApp->NewDocument("SALOME_STUDY", aDoc); + _OCAFApp->NewDocument("SALOME_STUDY", aDoc); _clipboard = aDoc; // set component data type to the name attribute of root label @@ -932,7 +932,7 @@ bool SALOMEDSImpl_StudyManager::Copy(const Handle(SALOMEDSImpl_SObject)& theObje // iterate all theObject's label children TDF_Label aStartLabel = theObject->GetLabel(); Standard_Integer aSourceStartDepth = aStartLabel.Depth(); - + // copy main source label CopyLabel(aStudy, theEngine, aSourceStartDepth, aStartLabel, _clipboard->Main()); @@ -949,8 +949,8 @@ bool SALOMEDSImpl_StudyManager::Copy(const Handle(SALOMEDSImpl_SObject)& theObje * Purpose : */ //============================================================================ -bool SALOMEDSImpl_StudyManager::CanPaste(const Handle(SALOMEDSImpl_SObject)& theObject, - SALOMEDSImpl_Driver* theEngine) +bool SALOMEDSImpl_StudyManager::CanPaste(const Handle(SALOMEDSImpl_SObject)& theObject, + SALOMEDSImpl_Driver* theEngine) { _errorCode = ""; @@ -974,7 +974,7 @@ bool SALOMEDSImpl_StudyManager::CanPaste(const Handle(SALOMEDSImpl_SObject)& the _errorCode = "Object doesn't belong to component"; return false; } - + TCollection_AsciiString IOREngine; if (!aComponent->ComponentIOR(IOREngine)) { _errorCode = "component has no IOR"; @@ -993,7 +993,7 @@ TDF_Label SALOMEDSImpl_StudyManager::PasteLabel(const Handle(SALOMEDSImpl_Study) const TDF_Label& theSource, const TDF_Label& theDestinationStart, const int theCopiedStudyID, - const bool isFirstElement) + const bool isFirstElement) { _errorCode = ""; @@ -1039,10 +1039,10 @@ TDF_Label SALOMEDSImpl_StudyManager::PasteLabel(const Handle(SALOMEDSImpl_Study) if (isFirstElement) { TCollection_AsciiString aDestEntry = theEngine->PasteInto(aStream, aLen, - anObjID->Value(), + anObjID->Value(), aPastedSO->GetFatherComponent()); TDF_Tool::Label(theDestinationStart.Data(), aDestEntry, aTargetLabel); - } else + } else theEngine->PasteInto(aStream, aLen, anObjID->Value(), aPastedSO); if(aStream != NULL) delete []aStream; @@ -1078,7 +1078,7 @@ TDF_Label SALOMEDSImpl_StudyManager::PasteLabel(const Handle(SALOMEDSImpl_Study) TDF_Tool::Label(aTargetLabel.Data(), anEntry, aRefLabel); SALOMEDSImpl_AttributeReference::Set(aTargetLabel, aRefLabel); // target attributes structure support - SALOMEDSImpl_AttributeTarget::Set(aRefLabel)->Add(SALOMEDSImpl_Study::SObject(aTargetLabel)); + 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); @@ -1114,7 +1114,7 @@ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_StudyManager::Paste(const Handle(SALOM // get copied study ID Handle(SALOMEDSImpl_AttributeInteger) aStudyIDAttribute; if (!_clipboard->Main().Root().FindAttribute(SALOMEDSImpl_AttributeInteger::GetID(), aStudyIDAttribute)) { - _errorCode = "No study ID was found"; + _errorCode = "No study ID was found"; return NULL; } int aCStudyID = aStudyIDAttribute->Value(); @@ -1131,7 +1131,7 @@ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_StudyManager::Paste(const Handle(SALOM // fill root inserted SObject TDF_Label aStartLabel; if (aStructureOnly) { - TDF_Label anObjectLabel; + TDF_Label anObjectLabel; TDF_Tool::Label(aDocument->GetData(), theObject->GetID(), anObjectLabel); aStartLabel = PasteLabel(aStudy, theEngine, _clipboard->Main(), anObjectLabel, aCStudyID, false); } else { @@ -1158,7 +1158,7 @@ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_StudyManager::Paste(const Handle(SALOM * Purpose : Save attributes for object */ //============================================================================ -static void SaveAttributes(Handle(SALOMEDSImpl_SObject) aSO, HDFgroup *hdf_group_sobject) +static void SaveAttributes(Handle(SALOMEDSImpl_SObject) aSO, HDFgroup *hdf_group_sobject) { hdf_size size[1]; TDF_AttributeIterator Itr(aSO->GetLabel()); @@ -1166,7 +1166,7 @@ static void SaveAttributes(Handle(SALOMEDSImpl_SObject) aSO, HDFgroup *hdf_group for(; Itr.More(); Itr.Next()) { anAttr = Itr.Value(); //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 + 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; @@ -1209,7 +1209,7 @@ static void ReadAttributes(const Handle(SALOMEDSImpl_Study)& theStudy, Handle(SALOMEDSImpl_GenericAttribute) ga = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(anAttr); ga->Load(current_string); //cout << "Reading: " << aSO->GetID() << " "<< ga->Type() << " value: " << current_string << endl; - } + } delete(current_string); hdf_dataset->CloseOnDisk(); @@ -1231,7 +1231,7 @@ static void BuildTree (const Handle(SALOMEDSImpl_Study)& theStudy, HDFgroup* hdf } char name[HDF_NAME_MAX_LEN+1]; - Standard_Integer nbsons = hdf_current_group->nInternalObjects(); + Standard_Integer nbsons = hdf_current_group->nInternalObjects(); for (Standard_Integer i=0; iInternalObjectIndentify(i,name); if (strncmp(name, "INTERNAL_COMPLEX",16) == 0) continue; @@ -1239,7 +1239,7 @@ static void BuildTree (const Handle(SALOMEDSImpl_Study)& theStudy, HDFgroup* hdf if (type == HDF_DATASET) { HDFdataset* new_dataset = new HDFdataset(name,hdf_current_group); - ReadAttributes(theStudy,aSO,new_dataset); + ReadAttributes(theStudy,aSO,new_dataset); new_dataset = 0; // will be deleted by father destructor } @@ -1269,7 +1269,7 @@ static void Translate_IOR_to_persistentID (const Handle(SALOMEDSImpl_SObject)& s Handle(SALOMEDSImpl_AttributeIOR) IOR; if (current->GetLabel().FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(), IOR)) { ior_string = IOR->Value(); - + persistent_string = engine->IORToLocalPersistentID (current, ior_string, isMultiFile, isASCII); SALOMEDSImpl_AttributePersistentRef::Set(current->GetLabel(), persistent_string); }