atlas
Metadata.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 <iosfwd>
14 
15 #include "atlas/io/Stream.h"
16 #include "atlas/io/detail/Checksum.h"
17 #include "atlas/io/detail/DataInfo.h"
18 #include "atlas/io/detail/Endian.h"
19 #include "atlas/io/detail/Link.h"
20 #include "atlas/io/detail/RecordInfo.h"
21 #include "atlas/io/detail/Type.h"
22 #include "atlas/util/Config.h"
23 
24 namespace atlas {
25 namespace io {
26 
27 class Metadata;
28 class Stream;
29 
30 //---------------------------------------------------------------------------------------------------------------------
31 
32 size_t uncompressed_size( const atlas::io::Metadata& m );
33 
34 //---------------------------------------------------------------------------------------------------------------------
35 
36 class Metadata : public util::Config {
37 public:
38  using util::Config::Config;
39 
40  Link link() const { return Link{getString( "link", "" )}; }
41 
42  Type type() const { return Type{getString( "type", "" )}; }
43 
44  void link( atlas::io::Metadata&& );
45 
46  std::string json() const;
47 
48  DataInfo data;
49  RecordInfo record;
50 };
51 
52 //---------------------------------------------------------------------------------------------------------------------
53 
54 void write( const atlas::io::Metadata&, std::ostream& out );
55 
56 void write( const atlas::io::Metadata&, atlas::io::Stream& out );
57 
58 //---------------------------------------------------------------------------------------------------------------------
59 
60 } // namespace io
61 } // namespace atlas
Definition: Type.h:18
Definition: Metadata.h:36
Handle to a shared eckit::DataHandle.
Definition: Stream.h:31
Definition: RecordInfo.h:19
Definition: DataInfo.h:23
Contains all atlas classes and methods.
Definition: atlas-grids.cc:33
Configuration class used to construct various atlas components.
Definition: Config.h:27