1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File : Salome_file_i.hxx
23 // Author : André RIBES, EDF
27 #ifndef _SALOME_FILE_I_HXX_
28 #define _SALOME_FILE_I_HXX_
30 #include <SALOMEconfig.h>
32 #include CORBA_SERVER_HEADER(SALOME_Component)
33 #include CORBA_SERVER_HEADER(SALOME_Exception)
35 #include "SALOME_Container.hxx"
36 #include "SALOME_FileTransfer_i.hxx"
42 class CONTAINER_EXPORT Salome_file_i:
43 public virtual POA_Engines::Salome_file,public virtual fileTransfer_i
47 virtual ~Salome_file_i();
49 // Import and export methods
50 virtual void load(const char* hdf5_file);
51 virtual void save(const char* hdf5_file);
52 virtual void save_all(const char* hdf5_file);
55 virtual void setLocalFile(const char* comp_file_name);
56 virtual void setDistributedFile(const char* comp_file_name);
58 // Configure DistributedFile
59 virtual void connect(Engines::Salome_file_ptr source_Salome_file);
60 virtual void connectDistributedFile(const char * file_name,
61 Engines::Salome_file_ptr source_Salome_file);
62 virtual void setDistributedSourceFile(const char* file_name,
63 const char * source_file_name);
65 // Recv and check files
66 virtual void recvFiles();
68 // Removing or deleting files
69 virtual void removeFile(const char* file_name);
70 virtual void removeFiles();
72 // Informations methods:
73 virtual void setContainer(Engines::Container_ptr container);
74 virtual Engines::files* getFilesInfos();
75 virtual Engines::file* getFileInfos(const char* file_name);
76 virtual Engines::SfState* getSalome_fileState();
78 // ---------------- fileTransfert Methods -----------------------
79 virtual CORBA::Long open(const char* file_name);
80 virtual void close(CORBA::Long fileId);
81 virtual Engines::fileBlock* getBlock(CORBA::Long fileId);
84 // ---------------- local C++ methods ---------------------------
85 virtual bool checkLocalFile(std::string file_name);
86 virtual bool getDistributedFile(std::string file_name);
90 // Contains a relation between a file ID (int) with
91 // a fd descriptor (FILE*) open on the file.
92 typedef std::map<int, FILE*> _t_fileAccess;
94 // Contains the informations of the files managed by the Salome_file.
95 typedef std::map<std::string, Engines::file> _t_fileManaged;
97 // Contains the CORBA reference for each distributed file managed.
98 typedef std::map<std::string, Engines::Salome_file_var> _t_fileDistributedSource;
102 _t_fileAccess _fileAccess;
103 _t_fileManaged _fileManaged;
104 _t_fileDistributedSource _fileDistributedSource;
105 Engines::SfState _state;
106 Engines::Container_ptr _container;
107 Engines::Salome_file_var _default_source_Salome_file;