-
-//================================================================
-// Function : isModified
-/*! Purpose : default implementation, always returns false so as not to mask study's isModified()*/
-//================================================================
-bool SalomeApp_DataModel::isModified() const
-{
- return false;
-}
-
-//================================================================
-// Function : isSaved
-/*! Purpose : default implementation, always returns true so as not to mask study's isSaved()*/
-//================================================================
-bool SalomeApp_DataModel::isSaved() const
-{
- return true;
-}
-
-// BEGIN: methods to be used by CORBAless modules
-
-//================================================================
-// Function : GetListOfFiles
-/*! Purpose : to be used by CORBAless modules*/
-//================================================================
-std::vector<std::string> SalomeApp_DataModel::GetListOfFiles() const
- //(const int theStudyId, const char* theComponentName) const
-{
- SUIT_Study* anActiveStudy = getModule()->getApp()->activeStudy();
- if (anActiveStudy) {
- int aStudyId = anActiveStudy->id();
- SalomeApp_Engine_i* aDefaultEngine = SalomeApp_Engine_i::GetInstance();
- if (aDefaultEngine) {
- return aDefaultEngine->GetListOfFiles(aStudyId, module()->name());
- }
- }
-
- std::vector<std::string> aListOfFiles;
- return aListOfFiles;
-}
-
-//================================================================
-// Function : SetListOfFiles
-/*! Purpose : to be used by CORBAless modules*/
-//================================================================
-void SalomeApp_DataModel::SetListOfFiles (const std::vector<std::string> theListOfFiles)
- //(const std::vector<std::string> theListOfFiles,
- // const int theStudyId,
- // const char* theComponentName)
-{
- SUIT_Study* anActiveStudy = getModule()->getApp()->activeStudy();
- if (anActiveStudy) {
- int aStudyId = anActiveStudy->id();
- SalomeApp_Engine_i* aDefaultEngine = SalomeApp_Engine_i::GetInstance();
- if (aDefaultEngine) {
- aDefaultEngine->SetListOfFiles(theListOfFiles, aStudyId, module()->name());
- }
- }
-}
-
-//================================================================
-// Function : GetTmpDir
-/*! Purpose : Static method. To be used by CORBAless modules*/
-//================================================================
-std::string SalomeApp_DataModel::GetTmpDir (const char* theURL,
- const bool isMultiFile)
-{
- std::string anURLDir = SALOMEDS_Tool::GetDirFromPath(theURL);
- std::string aTmpDir = isMultiFile ? anURLDir : SALOMEDS_Tool::GetTmpDir();
- return aTmpDir;
-}
-
-//================================================================
-// Function : RemoveTemporaryFiles
-/*! Purpose : to be used by CORBAless modules*/
-//================================================================
-void SalomeApp_DataModel::RemoveTemporaryFiles (const bool isMultiFile) const
-{
- if (isMultiFile)
- return;
-
- std::vector<std::string> aListOfFiles = GetListOfFiles();
- if (aListOfFiles.size() > 0) {
- std::string aTmpDir = aListOfFiles[0];
-
- const int n = aListOfFiles.size() - 1;
- SALOMEDS::ListOfFileNames_var aSeq = new SALOMEDS::ListOfFileNames;
- aSeq->length(n);
- for (int i = 0; i < n; i++)
- aSeq[i] = CORBA::string_dup(aListOfFiles[i + 1].c_str());
-
- SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir.c_str(), aSeq.in(), true);
- }
-}
-
-// END: methods to be used by CORBAless modules