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:
# -----------------------------------------------------------------------------
### 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
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':
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':
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
# 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",
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
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):
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 \
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 \
#include <string>
+#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:
#include <SALOMEconfig.h>
#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:
#include <SALOMEconfig.h>
#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;
/*!
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);
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 );
fscanf(fp, "%i\n", &nbDim);
hdf_size* sizeArray = new hdf_size[nbDim];
+ int dim = 0;
for(i = 0; i<nbDim; i++) {
- fscanf(fp, "%i\n", &(sizeArray[i]));
+ fscanf(fp, "%i\n", &dim);
+ sizeArray[i] = dim;
}
HDFdataset* hdf_dataset = new HDFdataset(new_name, father,type, sizeArray, nbDim);
@COMMENCE@
+EXPORT_PYSCRIPTS = SALOME_DriverPy.py
+
EXPORT_HEADERS= \
SALOMEDS_StudyManager_i.hxx \
SALOMEDS_Driver_i.hxx \
double SALOMEDS_AttributeReal::Value()
{
double aValue;
- if(_isLocal) aValue = (bool)Handle(SALOMEDSImpl_AttributeReal)::DownCast(_local_impl)->Value();
+ if(_isLocal) aValue = Handle(SALOMEDSImpl_AttributeReal)::DownCast(_local_impl)->Value();
else aValue = SALOMEDS::AttributeReal::_narrow(_corba_impl)->Value();
return aValue;
}
#include "SALOMEDS_AttributeStudyProperties.hxx"
#include <string>
-#include <TCollection_AsciiString.hxx>
+#include <TCollection_AsciiString.hxx>
#include <TCollection_ExtendedString.hxx>
#include <TColStd_HSequenceOfExtendedString.hxx>
#include <TColStd_HSequenceOfInteger.hxx>
-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();
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,
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<std::string>& theNames,
std::vector<int>& 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; i<aLength; i++) {
+ for (i = 0; i<aLength; i++) {
theNames.push_back(aNames[i].in());
theMinutes.push_back(aMinutes[i]);
theHours.push_back(aHours[i]);
}
}
}
-
#define CREATION_MODE_SCRATCH 1
#define CREATION_MODE_COPY 2
-void SALOMEDS_AttributeStudyProperties_i::SetUserName(const char* theName)
+void SALOMEDS_AttributeStudyProperties_i::SetUserName(const char* theName)
{
SALOMEDS::Locker lock;
CheckLocked();
- Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->SetFirstName((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();
}
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;
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;
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);
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);
+ }
}
-
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 {
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)
_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()
SALOMEDS::Locker lock;
return CORBA::string_dup(_impl->GetID().ToCString());
}
-
+
//============================================================================
/*! Function : GetFatherComponent
- * Purpose :
+ * Purpose :
*/
//============================================================================
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()
//============================================================================
/*! Function :
- * Purpose :
+ * Purpose :
*/
//============================================================================
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);
}
//============================================================================
* 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;
//============================================================================
/*! Function : ReferencedObject
- * Purpose :
+ * Purpose :
*/
//============================================================================
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)
obj = SALOMEDS_SObject_i::New (aSubObj, _orb);
return true;
-
-}
+
+}
//============================================================================
/*! Function : Name
SALOMEDS::Locker lock;
return CORBA::string_dup(_impl->Name().ToCString());
}
-
+
//============================================================================
/*! Function : Name
* Purpose : sets a name
TCollection_AsciiString aName((char*)name);
_impl->Name(aName);
}
-
+
//============================================================================
/*! Function : Tag
- * Purpose :
+ * Purpose :
*/
//============================================================================
CORBA::Short SALOMEDS_SObject_i::Tag()
//============================================================================
/*! Function : Depth
- * Purpose :
+ * Purpose :
*/
//============================================================================
CORBA::Short SALOMEDS_SObject_i::Depth()
//============================================================================
/*! Function : GetObject
- * Purpose :
+ * Purpose :
*/
//============================================================================
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());
//============================================================================
/*! 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());
//============================================================================
/*! 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());
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);
//============================================================================
/*! 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);
}
//============================================================================
//============================================================================
/*! 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);
* 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;
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);
throw(SALOME::SALOME_Exception)
{
SALOMEDS::Locker lock;
-
+
Unexpect aCatch(SalomeException);
MESSAGE("Begin of SALOMEDS_StudyManager_i::Open");
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" )
/*! 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)
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();
SALOMEDS::ListOfOpenStudies* SALOMEDS_StudyManager_i::GetOpenStudies()
{
SALOMEDS::Locker lock;
-
+
Handle(TColStd_HSequenceOfTransient) anOpened = _impl->GetOpenStudies();
int aLength = anOpened->Length();
* 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();
}
//============================================================================
* 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;
* Purpose :
*/
//============================================================================
-CORBA::Boolean SALOMEDS_StudyManager_i::Copy(SALOMEDS::SObject_ptr theObject)
+CORBA::Boolean SALOMEDS_StudyManager_i::Copy(SALOMEDS::SObject_ptr theObject)
{
SALOMEDS::Locker lock;
* Purpose :
*/
//============================================================================
-CORBA::Boolean SALOMEDS_StudyManager_i::CanPaste(SALOMEDS::SObject_ptr theObject)
+CORBA::Boolean SALOMEDS_StudyManager_i::CanPaste(SALOMEDS::SObject_ptr theObject)
{
SALOMEDS::Locker lock;
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);
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();
SALOMEDS::Driver_var Engine = SALOMEDS::Driver::_narrow(obj) ;
driver = new SALOMEDS_Driver_i(Engine, orb);
}
- }
+ }
return driver;
}
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);
}
-//===========================================================================
+//===========================================================================
--- /dev/null
+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
+
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
}
//=======================================================================
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)) {
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);
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;
}
return myMode;
}
-void SALOMEDSImpl_AttributeStudyProperties::SetModified(const Standard_Integer theModified)
+void SALOMEDSImpl_AttributeStudyProperties::SetModified(const Standard_Integer theModified)
{
myModified = theModified;
}
return myModified;
}
-void SALOMEDSImpl_AttributeStudyProperties::SetLocked(const Standard_Boolean theLocked)
+void SALOMEDSImpl_AttributeStudyProperties::SetLocked(const Standard_Boolean theLocked)
{
// Backup();
if (myLocked != theLocked) {
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));
}
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);
}
-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()];
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)),
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();
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++];
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;
}
}
SetModified(0);
}
-
#include <Standard_DefineHandle.hxx>
#include <Standard.hxx>
#include <TDF_Attribute.hxx>
-#include <TDF_Label.hxx>
+#include <TDF_Label.hxx>
#include <TCollection_AsciiString.hxx>
#include "SALOMEDSImpl_GenericAttribute.hxx"
#include <TColStd_HSequenceOfExtendedString.hxx>
#include <TColStd_HSequenceOfInteger.hxx>
-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;
#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"
IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_Study, MMgt_TShared )
#define DIRECTORYID 16661
-#define FILELOCALID 26662
+#define FILELOCALID 26662
#define FILEID "FILE: "
//============================================================================
_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
*/
//============================================================================
SALOMEDSImpl_Study::~SALOMEDSImpl_Study()
-{}
+{}
//============================================================================
/*! Function : GetPersistentReference
_errorCode = "IOR is empty";
}
- return IOR;
+ return IOR;
}
void SALOMEDSImpl_Study::SetTransientReference(const TCollection_AsciiString& theIOR)
name = SC->ComponentDataType();
if(aComponentName == name) {
_find = true;
- return SC;
+ return SC;
}
}
-
+
if(!_find)
{
_errorCode = "No component was found";
_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;
{
_find = true;
RefSO = SC;
-
+
}
if (!_find) RefSO = _FindObject(SC, anObjectName, _find);
}
// 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);
}
// 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;
_errorCode = "";
Handle(TColStd_HSequenceOfTransient) listSO = new TColStd_HSequenceOfTransient();
-
+
Handle(SALOMEDSImpl_SComponent) compo = FindComponent(aComponentName) ;
if ( compo.IsNull() ) {
_errorCode = "Can not find the component";
}
// 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 ) ;
listSO->Append(CSO) ;
}
}
-
+
return listSO;
}
// 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
{
SC = it.Value();
TCollection_AsciiString ior = SC->GetIOR();
- if (ior != "")
+ if (ior != "")
{
if (ior == anObjectIOR)
{
RefSO = SC;
}
}
- if (!_find)
+ if (!_find)
RefSO = _FindObjectIOR(SC, anObjectIOR, _find);
}
}
-
+
if(RefSO.IsNull()) _errorCode = "No object was found";
return RefSO;
}
return GetSObject(_current);
}
- if(aPath.Value(1) != '/') //Relative path
+ if(aPath.Value(1) != '/') //Relative path
isRelative = true;
TDF_ChildIterator anIterator;
Handle(SALOMEDSImpl_AttributeName) anAttr;
if(isRelative) {
- if(_current.IsNull()) return NULL;
+ if(_current.IsNull()) return NULL;
anIterator.Initialize(_current, Standard_False);
}
else {
//============================================================================
/*! Function : GetObjectPath
- * Purpose :
+ * Purpose :
*/
//============================================================================
TCollection_AsciiString SALOMEDSImpl_Study::GetObjectPath(const Handle(SALOMEDSImpl_SObject)& theObject)
_errorCode = "Null object";
return aPath.ToCString();
}
-
+
TCollection_AsciiString aName = theObject->GetName();
if(!aName.IsEmpty() && aName != "" ) {
TCollection_AsciiString aValue((char*)aName.ToCString());
}
}
- return aPath;
+ return aPath;
}
/*! Function : GetObjectPathByIOR
* Purpose :
*/
-//============================================================================
+//============================================================================
TCollection_AsciiString SALOMEDSImpl_Study::GetObjectPathByIOR(const TCollection_AsciiString& theIOR)
{
_errorCode = "";
_errorCode = "No SObject was found by IOR";
return aPath;
}
-
+
return GetObjectPath(so);
-}
+}
//============================================================================
* 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()) {
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());
}
* Purpose : Gets the current context
*/
//============================================================================
-TCollection_AsciiString SALOMEDSImpl_Study::GetContext()
+TCollection_AsciiString SALOMEDSImpl_Study::GetContext()
{
_errorCode = "";
return "";
}
Handle(SALOMEDSImpl_SObject) so = GetSObject(_current);
- return GetObjectPath(so);
+ return GetObjectPath(so);
}
//============================================================================
* Purpose : method to get all object names in the given context (or in the current context, if 'theContext' is empty)
*/
//============================================================================
-Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetObjectNames(const TCollection_AsciiString& theContext)
+Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetObjectNames(const TCollection_AsciiString& theContext)
{
_errorCode = "";
* 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 = "";
* 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 = "";
* 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 = "";
return _builder;
}
-
+
//============================================================================
/*! Function : Name
* Purpose : get study name
_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, "/");
aName = adr;
adr = strtok(NULL, "/");
}
- Name(aName);
+ Name(aName);*/
+ Name(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)
* 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
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());
_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;
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;
}
}
-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;
* Purpose : Returns a UseCase builder
*/
//============================================================================
-Handle(SALOMEDSImpl_UseCaseBuilder) SALOMEDSImpl_Study::GetUseCaseBuilder()
+Handle(SALOMEDSImpl_UseCaseBuilder) SALOMEDSImpl_Study::GetUseCaseBuilder()
{
_errorCode = "";
return _useCaseBuilder;
//============================================================================
/*! Function : Close
- * Purpose :
+ * Purpose :
*/
//============================================================================
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 = "";
//============================================================================
/*! Function : UndoPostponed
- * Purpose :
+ * Purpose :
*/
//============================================================================
-void SALOMEDSImpl_Study::UndoPostponed(const int theWay)
+void SALOMEDSImpl_Study::UndoPostponed(const int theWay)
{
_errorCode = "";
//============================================================================
/*! 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;
//============================================================================
/*! Function : GetSComponent
- * Purpose :
+ * Purpose :
*/
//============================================================================
Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::GetSComponent(const TDF_Label& theLabel)
//============================================================================
/*! 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;
//============================================================================
/*! Function : GetSObject
- * Purpose :
+ * Purpose :
*/
//============================================================================
Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::GetSObject(const TDF_Label& theLabel)
//============================================================================
/*! 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);
//============================================================================
/*! 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)
{
//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();
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();
if(!isOpened) {
_errorCode = TCollection_AsciiString("Can't create a file ")+aFileName;
- return false;
+ return false;
}
TCollection_AsciiString aBatchModeScript = "salome";
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.
try {
if (!sco->ComponentIOR(IOREngine)) {
if (!aCompType.IsEmpty()) {
-
+
aDriver = theFactory->GetDriverByType(aCompType);
-
+
if (aDriver != NULL) {
Handle(SALOMEDSImpl_StudyBuilder) SB = NewBuilder();
cout << "Before SB" << endl;
} catch(...) {
_errorCode = "Can not restore information to dump it";
return false;
- }
+ }
if(aDriver == NULL) continue;
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();
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;
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();
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");
}
-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)
{
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;
TCollection_AsciiString aType = anAttr->GetClassType();
fp << Tab << " -- " << aType;
-
+
if(aType == "AttributeReal") {
fp << " : " << Handle(SALOMEDSImpl_AttributeReal)::DownCast(anAttr)->Value();
}
void SALOMEDSImpl_Study::Modify()
{
- _errorCode = "";
+ _errorCode = "";
_doc->Modify();
}
//add IOR definition
SALOMEDSImpl_AttributeIOR::Set(aComponent->GetLabel(), IOR);
- _doc->Modify();
+ //_doc->Modify();
return true;
}
#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)&,
//============================================================================
/*! 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);
}
//============================================================================
* 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 );
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;
}
{
_errorCode = "";
- // open the HDFFile
- HDFfile *hdf_file =0;
+ // open the HDFFile
+ HDFfile *hdf_file =0;
HDFgroup *hdf_group_study_structure =0;
char* aC_HDFUrl;
#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 );
// 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";
sprintf(eStr,"Can't open file %s", aUrl.ToCString());
_errorCode = TCollection_AsciiString(eStr);
return NULL;
- }
+ }
hdf_file->CloseOnDisk();
/*! 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
*/
//============================================================================
_errorCode = "Study is null";
return;
}
-
+
aStudy->Close();
}
* 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)
{
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)
{
* 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)
{
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)
{
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();
* 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;
}
//============================================================================
* 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;
}
//=============================================================================
* 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 = "";
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();
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);
* 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,
_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;
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();
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);
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
{
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 {
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
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);
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();
// 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);
//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();
* 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
//============================================================================
/*! 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;
//============================================================================
/*! 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();
//============================================================================
/*! 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 = "";
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;
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);
*/
//============================================================================
bool SALOMEDSImpl_StudyManager::Copy(const Handle(SALOMEDSImpl_SObject)& theObject,
- SALOMEDSImpl_Driver* theEngine)
+ SALOMEDSImpl_Driver* theEngine)
{
_errorCode = "";
_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
// 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());
* 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 = "";
_errorCode = "Object doesn't belong to component";
return false;
}
-
+
TCollection_AsciiString IOREngine;
if (!aComponent->ComponentIOR(IOREngine)) {
_errorCode = "component has no IOR";
const TDF_Label& theSource,
const TDF_Label& theDestinationStart,
const int theCopiedStudyID,
- const bool isFirstElement)
+ const bool isFirstElement)
{
_errorCode = "";
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;
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);
// 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();
// 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 {
* 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());
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;
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();
}
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; i<nbsons; i++) {
hdf_current_group->InternalObjectIndentify(i,name);
if (strncmp(name, "INTERNAL_COMPLEX",16) == 0) continue;
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
}
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);
}