1 // Copyright (C) 2007 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 // File : Salome_file_i.hxx
22 // Author : André RIBES, EDF
26 #ifndef _SALOME_FILE_I_HXX_
27 #define _SALOME_FILE_I_HXX_
29 #include <SALOMEconfig.h>
31 #include CORBA_SERVER_HEADER(SALOME_Component)
32 #include CORBA_SERVER_HEADER(SALOME_Exception)
34 #include <SALOME_Container.hxx>
38 class CONTAINER_EXPORT Salome_file_i:
39 public virtual POA_Engines::Salome_file
43 virtual ~Salome_file_i();
45 // Import and export methods
46 virtual void load(const char* hdf5_file);
47 virtual void save(const char* hdf5_file);
48 virtual void save_all(const char* hdf5_file);
51 virtual void setLocalFile(const char* comp_file_name);
52 virtual void setDistributedFile(const char* comp_file_name);
54 // Configure DistributedFile
55 virtual void connect(Engines::Salome_file_ptr source_Salome_file);
56 virtual void connectDistributedFile(const char * file_name,
57 Engines::Salome_file_ptr source_Salome_file);
58 virtual void setDistributedSourceFile(const char* file_name,
59 const char * source_file_name);
61 // Recv and check files
62 virtual void recvFiles();
64 // Removing or deleting files
65 virtual void removeFile(const char* file_name);
66 virtual void removeFiles();
68 // Informations methods:
69 virtual void setContainer(Engines::Container_ptr container);
70 virtual Engines::files* getFilesInfos();
71 virtual Engines::file* getFileInfos(const char* file_name);
72 virtual Engines::SfState* getSalome_fileState();
74 // ---------------- fileTransfert Methods -----------------------
75 virtual CORBA::Long open(const char* file_name);
76 virtual void close(CORBA::Long fileId);
77 virtual Engines::fileBlock* getBlock(CORBA::Long fileId);
80 // ---------------- local C++ methods ---------------------------
81 virtual bool checkLocalFile(std::string file_name);
82 virtual bool getDistributedFile(std::string file_name);
86 // Contains a relation between a file ID (int) with
87 // a fd descriptor (FILE*) open on the file.
88 typedef std::map<int, FILE*> _t_fileAccess;
90 // Contains the informations of the files managed by the Salome_file.
91 typedef std::map<std::string, Engines::file> _t_fileManaged;
93 // Contains the CORBA reference for each distributed file managed.
94 typedef std::map<std::string, Engines::Salome_file_var> _t_fileDistributedSource;
98 _t_fileAccess _fileAccess;
99 _t_fileManaged _fileManaged;
100 _t_fileDistributedSource _fileDistributedSource;
101 Engines::SfState _state;
102 Engines::Container_ptr _container;
103 Engines::Salome_file_ptr _default_source_Salome_file;