// Put buffer to aListOfFiles and set to myMap
ListOfFiles aListOfFiles = PutStreamToFiles(aBuffer, aBufferSize, isMultiFile);
SetListOfFiles(aModuleName, aListOfFiles);
+ SetSaveTypeStudy(aModuleName, isMultiFile);
delete[] aModuleName;
delete[] aBuffer;
myMap[aName] = theListOfFiles;
}
+/*!
+ \return (single or multi file) type for save by module with name 'theModuleName'
+*/
+bool LightApp_Driver::GetSaveTypeStudy( const char* theModuleName )
+{
+ bool isMultiFile = false;
+ std::string aName(theModuleName);
+ if (mySaveTypeMap.count(aName))
+ isMultiFile = mySaveTypeMap[aName];
+ return isMultiFile;
+}
+
+/*!
+ Sets (single or multi file) type for save by module with name 'theModuleName'
+*/
+void LightApp_Driver::SetSaveTypeStudy( const char* theModuleName, const bool isMultiFile )
+{
+ std::string aName (theModuleName);
+ mySaveTypeMap[aName] = isMultiFile;
+}
+
/*!
Converts files which was created from module <theModuleName> into a byte sequence unsigned char
*/
RemoveTemporaryFiles( aModuleName, IsTemporary() );
}
myMap.clear();
+ mySaveTypeMap.clear();
// Reset the "temporary" flag
SetIsTemporary( false );
}
ListOfFiles GetListOfFiles (const char* theModuleName);
virtual void SetListOfFiles (const char* theModuleName, const ListOfFiles theListOfFiles);
+ bool GetSaveTypeStudy ( const char* theModuleName );
+ virtual void SetSaveTypeStudy ( const char* theModuleName,
+ const bool isMultiFile);
virtual void RemoveTemporaryFiles(const char* theModuleName, const bool IsDirDeleted);
void RemoveFiles( const ListOfFiles& theFiles, const bool IsDirDeleted);
protected:
typedef std::map<std::string, ListOfFiles> MapOfListOfFiles;
+ typedef std::map<std::string, bool> MapOfSaveTypeStudy;
MapOfListOfFiles myMap;
+ MapOfSaveTypeStudy mySaveTypeMap;
std::string myTmpDir;
private:
ListOfFiles aListOfFiles = PutStreamToFiles(aStreamFile, aStreamSize, isMultiFile);
char* aCompDataType = (char*)(mapEntryName[name].c_str());
SetListOfFiles(aCompDataType, aListOfFiles);
+ SetSaveTypeStudy(aCompDataType, isMultiFile);
delete [] aStreamFile;
}
anIndex++;
}
myDriver->SetListOfFiles(theModuleName.toLatin1().constData(), aListOfFiles);
+
+ SUIT_ResourceMgr* resMgr = application()->resourceMgr();
+ if( !resMgr )
+ return;
+ bool isMultiFile = resMgr->booleanValue( "Study", "multi_file", false );
+ myDriver->SetSaveTypeStudy(theModuleName.toLatin1().constData(), isMultiFile);
}
/*!
myDriver->SetListOfFiles(theModuleName, theListOfFiles);
}
+/*!
+ \return (single or multi file) type for save study used by module: to be used by CORBAless modules.
+ \param theModuleName - name of module
+*/
+bool LightApp_Study::GetSaveTypeStudy(const char* theModuleName) const
+{
+ bool isMultiFile = false;
+ isMultiFile = myDriver->GetSaveTypeStudy(theModuleName);
+ return isMultiFile;
+}
+
+/*!
+ Sets (single or multi file) type for save study used by module: to be used by CORBAless modules.
+ \param theModuleName - name of module
+ \param isMultiFile - type for save study
+*/
+void LightApp_Study::SetSaveTypeStudy (const char* theModuleName, const bool isMultiFile)
+{
+ myDriver->SetSaveTypeStudy(theModuleName, isMultiFile);
+}
+
/*!
Removes temporary files
*/
virtual void SetListOfFiles ( const char* theModuleName,
const std::vector<std::string> theListOfFiles );
+ virtual bool GetSaveTypeStudy ( const char* theModuleName ) const;
+ virtual void SetSaveTypeStudy ( const char* theModuleName,
+ const bool isMultiFile);
+
virtual void RemoveTemporaryFiles ( const char* theModuleName, const bool isMultiFile ) const;
protected:
listOfFiles[i] = std::string(aSeq[i - 1]);
SetListOfFiles(listOfFiles, studyId);
+ SetSaveTypeStudy(isMultiFile, studyId);
return true;
}
myMap[theStudyId] = theListOfFiles;
}
+bool SalomeApp_Engine_i::GetSaveTypeStudy (const int theStudyId)
+{
+ bool aSaveTypeStudy;
+
+ if (mySaveTypeMap.find(theStudyId) != mySaveTypeMap.end())
+ {
+ aSaveTypeStudy = mySaveTypeMap[theStudyId];
+ }
+
+ return aSaveTypeStudy;
+}
+
+void SalomeApp_Engine_i::SetSaveTypeStudy (const bool isMultiFile,
+ const int theStudyId)
+{
+ mySaveTypeMap[theStudyId] = isMultiFile;
+}
/*!
* DumpPython implementation for light modules
*/
void SetListOfFiles (const ListOfFiles& theListOfFiles,
const int theStudyId);
+ bool GetSaveTypeStudy (const int theStudyId);
+ void SetSaveTypeStudy (const bool isMultiFile,
+ const int theStudyId);
+
static std::string EngineIORForComponent( const char* theComponentName,
bool toCreate );
static SalomeApp_Engine_i* GetInstance ( const char* theComponentName,
static SALOME_NamingService* namingService();
private:
typedef std::map<int, ListOfFiles> MapOfListOfFiles;
+ typedef std::map<int, bool> MapOfSaveTypeStudy;
MapOfListOfFiles myMap;
+ MapOfSaveTypeStudy mySaveTypeMap;
std::string myComponentName;
};
anIndex++;
}
SetListOfFiles(theModuleName.toStdString().c_str(), aListOfFiles);
+
+ SUIT_ResourceMgr* resMgr = application()->resourceMgr();
+ if( !resMgr )
+ return;
+ bool isMultiFile = resMgr->booleanValue( "Study", "multi_file", false );
+ SetSaveTypeStudy(theModuleName.toStdString().c_str(), isMultiFile);
}
/*!
ModelList list; dataModels( list );
QListIterator<CAM_DataModel*> it( list );
std::vector<std::string> listOfFiles(0);
+ SUIT_ResourceMgr* resMgr = application()->resourceMgr();
+ if( !resMgr )
+ return false;
+ bool isMultiFile = resMgr->booleanValue( "Study", "multi_file", false );
while ( it.hasNext() ){
LightApp_DataModel* aLModel =
dynamic_cast<LightApp_DataModel*>( it.next() );
// It is safe to call SetListOfFiles() for any kind of module
// because SetListOfFiles() does nothing for full modules :)
- if ( aLModel )
+ if ( aLModel ) {
SetListOfFiles(aLModel->module()->name().toStdString().c_str(), listOfFiles);
+ SetSaveTypeStudy(aLModel->module()->name().toStdString().c_str(), isMultiFile);
+ }
}
return true;
}
if (dm && dm->open(studyName, this, listOfFiles)) {
// Remove the files and temporary directory, created
// for this module by LightApp_Engine_i::Load()
- bool isMultiFile = false; // TODO: decide, how to access this parameter
+ bool isMultiFile = GetSaveTypeStudy( dm->module()->name().toStdString().c_str() );
RemoveTemporaryFiles( dm->module()->name().toStdString().c_str(), isMultiFile );
// Something has been read -> create data model tree
\return list of files used by module: to be used by CORBAless modules
\param theModuleName - name of module
*/
-std::vector<std::string> SalomeApp_Study::GetListOfFiles( const char* theModuleName ) const
+std::vector<std::string> SalomeApp_Study::GetListOfFiles( const char* theModuleName ) const
{
// Issue 21377 - using separate engine for each type of light module
SalomeApp_Engine_i* aDefaultEngine = SalomeApp_Engine_i::GetInstance( theModuleName, false );
aDefaultEngine->SetListOfFiles(theListOfFiles, id());
}
+/*!
+ \return (single or multi file) type for save study used by module: to be used by CORBAless modules.
+ \param theModuleName - name of module
+*/
+bool SalomeApp_Study::GetSaveTypeStudy( const char* theModuleName ) const
+{
+ SalomeApp_Engine_i* aDefaultEngine = SalomeApp_Engine_i::GetInstance( theModuleName, false );
+ if (aDefaultEngine)
+ return aDefaultEngine->GetSaveTypeStudy(id());
+
+ return false;
+}
+
+/*!
+ Sets (single or multi file) type for save study used by module: to be used by CORBAless modules.
+ \param theModuleName - name of module
+ \param isMultiFile - save type study
+*/
+void SalomeApp_Study::SetSaveTypeStudy ( const char* theModuleName,
+ const bool isMultiFile )
+{
+ SalomeApp_Engine_i* aDefaultEngine = SalomeApp_Engine_i::GetInstance( theModuleName, false );
+ if (aDefaultEngine)
+ aDefaultEngine->SetSaveTypeStudy(isMultiFile, id());
+}
/*!
\return temporary directory for saving files of modules
*/
virtual std::vector<std::string> GetListOfFiles ( const char* theModuleName ) const;
virtual void SetListOfFiles ( const char* theModuleName,
const std::vector<std::string> theListOfFiles);
+ virtual bool GetSaveTypeStudy ( const char* theModuleName ) const;
+ virtual void SetSaveTypeStudy ( const char* theModuleName,
+ const bool isMultiFile);
virtual void RemoveTemporaryFiles ( const char* theModuleName, const bool isMultiFile) const;
protected: