TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Entree_Fichier_base.h
1/****************************************************************************
2* Copyright (c) 2022, CEA
3* All rights reserved.
4*
5* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
9*
10* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
11* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
12* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
13*
14*****************************************************************************/
15
16#ifndef Entree_Fichier_base_included
17#define Entree_Fichier_base_included
18
19
20#include <Entree.h>
21#include <Objet_U.h>
22#include <fstream>
23using std::ifstream;
24using std::ofstream;
25using std::streampos;
26
27/*! @brief Fichier en lecture Cette classe est a la classe C++ ifstream ce que la classe Entree est a la
28 *
29 * classe C++ istream. Elle redefinit de facon virtuelle les operateurs de lecture dans un fichier.
30 *
31 */
32
33class Entree_Fichier_base : public Entree, public Objet_U
34{
35 Declare_base_sans_constructeur(Entree_Fichier_base);
36public:
39 Entree_Fichier_base(const char* name,IOS_OPEN_MODE mode=ios::in);
40 ifstream& get_ifstream();
41 void close();
42 int eof() override;
43 int fail() override;
44 int good() override;
45 void precision(int pre);
46 void setf(IOS_FORMAT code);
47
48 virtual int ouvrir(const char* name, IOS_OPEN_MODE mode=ios::in);
49
50 static bool Can_be_read(const char * name);
51
52protected:
53 ifstream* ifstream_;
54
55private:
56 Entree_Fichier_base& operator=(const Entree_Fichier_base&); // copy is forbidden
57};
58
59#endif
static bool Can_be_read(const char *name)
Return True if the file can be opened for reading, false otherwise.
Entree_Fichier_base(const Entree_Fichier_base &)=default
void setf(IOS_FORMAT code)
virtual int ouvrir(const char *name, IOS_OPEN_MODE mode=ios::in)
friend class Entree
Definition Objet_U.h:76
Objet_U()
Constructeur par defaut : attribue un numero d'identifiant unique a l'objet (object_id_),...
Definition Objet_U.cpp:55