atlas
FileStream.h
1 /*
2  * (C) Copyright 2020 ECMWF.
3  *
4  * This software is licensed under the terms of the Apache Licence Version 2.0
5  * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6  * In applying this licence, ECMWF does not waive the privileges and immunities
7  * granted to it by virtue of its status as an intergovernmental organisation
8  * nor does it submit to any jurisdiction.
9  */
10 
11 #pragma once
12 
13 #include <string>
14 
15 #include "eckit/filesystem/PathName.h"
16 
17 #include "atlas/io/Stream.h"
18 
19 namespace eckit {
20 class DataHandle;
21 }
22 
23 namespace atlas {
24 namespace io {
25 
26 //---------------------------------------------------------------------------------------------------------------------
27 
28 enum class Mode
29 {
30  read,
31  append,
32  write,
33 };
34 
35 //---------------------------------------------------------------------------------------------------------------------
36 
37 class FileStream : public Stream {
38 public:
39  FileStream( const eckit::PathName& path, Mode openmode );
40  FileStream( const eckit::PathName& path, char openmode );
41  FileStream( const eckit::PathName& path, const std::string& openmode );
42 };
43 
44 //---------------------------------------------------------------------------------------------------------------------
45 
46 class InputFileStream : public FileStream {
47 public:
48  InputFileStream( const eckit::PathName& path );
49 };
50 
51 //---------------------------------------------------------------------------------------------------------------------
52 
53 class OutputFileStream : public FileStream {
54 public:
55  OutputFileStream( const eckit::PathName& path, Mode openmode = Mode::write );
56  OutputFileStream( const eckit::PathName& path, const std::string& openmode );
57  OutputFileStream( const eckit::PathName& path, char openmode );
58  void close();
59 };
60 
61 //---------------------------------------------------------------------------------------------------------------------
62 
63 } // namespace io
64 } // namespace atlas
Handle to a shared eckit::DataHandle.
Definition: Stream.h:31
Definition: FileStream.h:53
Definition: Domain.h:19
Definition: FileStream.h:46
Contains all atlas classes and methods.
Definition: atlas-grids.cc:33
Definition: FileStream.h:37