1
1
2
- #include " AtlasIO .h"
2
+ #include " EckitCodecIO .h"
3
3
4
4
#include < cstdio>
5
5
#include < cstring>
6
6
#include < iomanip>
7
7
8
- #include " atlas_io/atlas-io.h"
9
-
8
+ #include " eckit/codec/codec.h"
10
9
#include " eckit/exception/Exceptions.h"
11
10
#include " eckit/filesystem/PathName.h"
12
11
@@ -35,13 +34,13 @@ class SubVector {
35
34
};
36
35
37
36
template <typename T>
38
- void interprete (const SubVector<T>& in, atlas::io ::ArrayReference& out) {
39
- out = atlas::io ::ArrayReference (in.data (), atlas::io ::make_datatype<T>(), atlas::io ::ArrayShape{in.size ()});
37
+ void interprete (const SubVector<T>& in, eckit::codec ::ArrayReference& out) {
38
+ out = eckit::codec ::ArrayReference (in.data (), eckit::codec ::make_datatype<T>(), eckit::codec ::ArrayShape{in.size ()});
40
39
}
41
40
42
41
template <typename T>
43
- void decode (const atlas::io ::Metadata& metadata, const atlas::io ::Data& data, SubVector<T>& out) {
44
- atlas::io ::ArrayMetadata array (metadata);
42
+ void decode (const eckit::codec ::Metadata& metadata, const eckit::codec ::Data& data, SubVector<T>& out) {
43
+ eckit::codec ::ArrayMetadata array (metadata);
45
44
if (out.checkSize (array.shape (0 ))) {
46
45
::memcpy (out.data(), data, data.size());
47
46
}
@@ -51,38 +50,38 @@ void decode(const atlas::io::Metadata& metadata, const atlas::io::Data& data, Su
51
50
}
52
51
} // namespace
53
52
54
- AtlasIO::AtlasIO (const std::string& path, const std::string& prefix) : StatisticsIO{path, prefix, " atlasIO" } {};
53
+ EckitCodecIO::EckitCodecIO (const std::string& path, const std::string& prefix) : StatisticsIO{path, prefix, " atlasIO" } {};
55
54
56
- void AtlasIO ::write (const std::string& name, std::size_t fieldSize, std::size_t writeSize) {
55
+ void EckitCodecIO ::write (const std::string& name, std::size_t fieldSize, std::size_t writeSize) {
57
56
LOG_DEBUG_LIB (LibMultio) << " - The name of the window write file is :: " << generateCurrFileName (name)
58
57
<< std::endl;
59
58
const std::string fname = generateCurrFileName (name);
60
- atlas::io ::RecordWriter record;
59
+ eckit::codec ::RecordWriter record;
61
60
SubVector<std::uint64_t > dat{buffer_.data (), writeSize};
62
61
record.set (" size" , fieldSize, no_compression);
63
- record.set (name, atlas::io ::ref (dat), no_compression);
62
+ record.set (name, eckit::codec ::ref (dat), no_compression);
64
63
record.write (fname);
65
64
return ;
66
65
};
67
66
68
- void AtlasIO ::readSize (const std::string& name, std::size_t & readSize) {
67
+ void EckitCodecIO ::readSize (const std::string& name, std::size_t & readSize) {
69
68
LOG_DEBUG_LIB (LibMultio) << " - The name of the operation read file is :: " << generateCurrFileName (name)
70
69
<< std::endl;
71
70
const std::string fname = generateCurrFileName (name);
72
71
checkFileExist (fname);
73
72
std::uint64_t sz;
74
- atlas::io ::RecordReader record (fname);
73
+ eckit::codec ::RecordReader record (fname);
75
74
record.read (" size" , sz).wait ();
76
75
readSize = static_cast <std::size_t >(sz);
77
76
return ;
78
77
};
79
78
80
- void AtlasIO ::read (const std::string& name, std::size_t readSize) {
79
+ void EckitCodecIO ::read (const std::string& name, std::size_t readSize) {
81
80
LOG_DEBUG_LIB (LibMultio) << " - The name of the operation read file is :: " << generateCurrFileName (name)
82
81
<< std::endl;
83
82
const std::string fname = generateCurrFileName (name);
84
83
checkFileExist (fname);
85
- atlas::io ::RecordReader record (fname);
84
+ eckit::codec ::RecordReader record (fname);
86
85
SubVector<std::uint64_t > dat{buffer_.data (), readSize};
87
86
record.read (name, dat).wait ();
88
87
if (!dat.good ()) {
@@ -93,13 +92,13 @@ void AtlasIO::read(const std::string& name, std::size_t readSize) {
93
92
return ;
94
93
};
95
94
96
- void AtlasIO ::flush () {
95
+ void EckitCodecIO ::flush () {
97
96
// TODO: Decide what to do when flush is called. Flush partial statistics when the Tag::Flush is received is
98
97
// probably okay
99
98
return ;
100
99
};
101
100
102
- void AtlasIO ::checkFileExist (const std::string& name) const {
101
+ void EckitCodecIO ::checkFileExist (const std::string& name) const {
103
102
eckit::PathName file{name};
104
103
if (!file.exists ()) {
105
104
std::ostringstream os;
@@ -109,6 +108,7 @@ void AtlasIO::checkFileExist(const std::string& name) const {
109
108
return ;
110
109
};
111
110
112
- StatisticsIOBuilder<AtlasIO> AtalsIOBuilder (" atlas_io" );
111
+ StatisticsIOBuilder<EckitCodecIO> EckitCodecIOBuilder (" eckit_codec" );
112
+ StatisticsIOBuilder<EckitCodecIO> AtlasIOBuilder (" atlas_io" ); // Legacy name
113
113
114
114
} // namespace multio::action
0 commit comments