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"
40 class CONTAINER_EXPORT Salome_file_i:
41 public virtual POA_Engines::Salome_file
45 virtual ~Salome_file_i();
47 // Import and export methods
48 virtual void load(const char* hdf5_file);
49 virtual void save(const char* hdf5_file);
50 virtual void save_all(const char* hdf5_file);
53 virtual void setLocalFile(const char* comp_file_name);
54 virtual void setDistributedFile(const char* comp_file_name);
56 // Configure DistributedFile
57 virtual void connect(Engines::Salome_file_ptr source_Salome_file);
58 virtual void connectDistributedFile(const char * file_name,
59 Engines::Salome_file_ptr source_Salome_file);
60 virtual void setDistributedSourceFile(const char* file_name,
61 const char * source_file_name);
63 // Recv and check files
64 virtual void recvFiles();
66 // Removing or deleting files
67 virtual void removeFile(const char* file_name);
68 virtual void removeFiles();
70 // Informations methods:
71 virtual void setContainer(Engines::Container_ptr container);
72 virtual Engines::files* getFilesInfos();
73 virtual Engines::file* getFileInfos(const char* file_name);
74 virtual Engines::SfState* getSalome_fileState();
76 // ---------------- fileTransfert Methods -----------------------
77 virtual CORBA::Long open(const char* file_name);
78 virtual void close(CORBA::Long fileId);
79 virtual Engines::fileBlock* getBlock(CORBA::Long fileId);
82 // ---------------- local C++ methods ---------------------------
83 virtual bool checkLocalFile(std::string file_name);
84 virtual bool getDistributedFile(std::string file_name);
88 // Contains a relation between a file ID (int) with
89 // a fd descriptor (FILE*) open on the file.
90 typedef std::map<int, FILE*> _t_fileAccess;
92 // Contains the informations of the files managed by the Salome_file.
93 typedef std::map<std::string, Engines::file> _t_fileManaged;
95 // Contains the CORBA reference for each distributed file managed.
96 typedef std::map<std::string, Engines::Salome_file_var> _t_fileDistributedSource;
100 _t_fileAccess _fileAccess;
101 _t_fileManaged _fileManaged;
102 _t_fileDistributedSource _fileDistributedSource;
103 Engines::SfState _state;
104 Engines::Container_ptr _container;
105 Engines::Salome_file_var _default_source_Salome_file;