metkitlib 1.16.0.9__cp312-cp312-manylinux_2_28_aarch64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- metkitlib/__init__.py +3 -0
- metkitlib/bin/bufr-sanity-check +0 -0
- metkitlib/bin/compare-mars-requests.py +265 -0
- metkitlib/bin/mars-archive-script +0 -0
- metkitlib/bin/parse-mars-request +0 -0
- metkitlib/include/metkit/api/metkit_c.h +255 -0
- metkitlib/include/metkit/codes/BUFRDecoder.h +47 -0
- metkitlib/include/metkit/codes/BufrContent.h +43 -0
- metkitlib/include/metkit/codes/CodesContent.h +67 -0
- metkitlib/include/metkit/codes/CodesHandleDeleter.h +41 -0
- metkitlib/include/metkit/codes/CodesSplitter.h +40 -0
- metkitlib/include/metkit/codes/GRIBDecoder.h +42 -0
- metkitlib/include/metkit/codes/GribAccessor.h +75 -0
- metkitlib/include/metkit/codes/GribHandle.h +121 -0
- metkitlib/include/metkit/codes/GribIterator.h +48 -0
- metkitlib/include/metkit/codes/LibEccodes.h +38 -0
- metkitlib/include/metkit/codes/MallocCodesContent.h +46 -0
- metkitlib/include/metkit/codes/api/CodesAPI.h +365 -0
- metkitlib/include/metkit/codes/api/CodesTypes.h +93 -0
- metkitlib/include/metkit/codes/api/GeoIterator.h +104 -0
- metkitlib/include/metkit/codes/api/KeyIterator.h +187 -0
- metkitlib/include/metkit/config/LibMetkit.h +56 -0
- metkitlib/include/metkit/fields/FieldIndex.h +58 -0
- metkitlib/include/metkit/fields/FieldIndexList.h +40 -0
- metkitlib/include/metkit/fields/SimpleFieldIndex.h +41 -0
- metkitlib/include/metkit/hypercube/HyperCube.h +105 -0
- metkitlib/include/metkit/hypercube/HyperCubePayloaded.h +88 -0
- metkitlib/include/metkit/mars/BaseProtocol.h +95 -0
- metkitlib/include/metkit/mars/ClientTask.h +206 -0
- metkitlib/include/metkit/mars/DHSProtocol.h +106 -0
- metkitlib/include/metkit/mars/MarsExpandContext.h +42 -0
- metkitlib/include/metkit/mars/MarsExpansion.h +83 -0
- metkitlib/include/metkit/mars/MarsExpension.h +28 -0
- metkitlib/include/metkit/mars/MarsHandle.h +83 -0
- metkitlib/include/metkit/mars/MarsLanguage.h +106 -0
- metkitlib/include/metkit/mars/MarsLocation.h +100 -0
- metkitlib/include/metkit/mars/MarsParsedRequest.h +44 -0
- metkitlib/include/metkit/mars/MarsParser.h +70 -0
- metkitlib/include/metkit/mars/MarsRequest.h +198 -0
- metkitlib/include/metkit/mars/MarsRequestHandle.h +79 -0
- metkitlib/include/metkit/mars/Matcher.h +88 -0
- metkitlib/include/metkit/mars/Param.b +43 -0
- metkitlib/include/metkit/mars/Param.h +84 -0
- metkitlib/include/metkit/mars/ParamID.h +306 -0
- metkitlib/include/metkit/mars/Parameter.h +87 -0
- metkitlib/include/metkit/mars/Quantile.h +73 -0
- metkitlib/include/metkit/mars/RequestEnvironment.h +58 -0
- metkitlib/include/metkit/mars/StepRange.b +43 -0
- metkitlib/include/metkit/mars/StepRange.h +164 -0
- metkitlib/include/metkit/mars/StepRangeNormalise.h +95 -0
- metkitlib/include/metkit/mars/Type.h +265 -0
- metkitlib/include/metkit/mars/TypeAny.h +39 -0
- metkitlib/include/metkit/mars/TypeDate.h +42 -0
- metkitlib/include/metkit/mars/TypeEnum.h +67 -0
- metkitlib/include/metkit/mars/TypeExpver.h +40 -0
- metkitlib/include/metkit/mars/TypeFloat.h +41 -0
- metkitlib/include/metkit/mars/TypeInteger.h +55 -0
- metkitlib/include/metkit/mars/TypeLowercase.h +38 -0
- metkitlib/include/metkit/mars/TypeMixed.h +47 -0
- metkitlib/include/metkit/mars/TypeParam.h +45 -0
- metkitlib/include/metkit/mars/TypeRange.h +41 -0
- metkitlib/include/metkit/mars/TypeRegex.h +49 -0
- metkitlib/include/metkit/mars/TypeTime.h +44 -0
- metkitlib/include/metkit/mars/TypeToByList.h +137 -0
- metkitlib/include/metkit/mars/TypeToByListQuantile.h +41 -0
- metkitlib/include/metkit/mars/TypesFactory.h +92 -0
- metkitlib/include/metkit/metkit_config.h +26 -0
- metkitlib/include/metkit/metkit_ecbuild_config.h +72 -0
- metkitlib/include/metkit/metkit_version.h +30 -0
- metkitlib/include/metkit/pointdb/DataSource.h +91 -0
- metkitlib/include/metkit/pointdb/FieldIndexer.h +128 -0
- metkitlib/include/metkit/pointdb/GribDataSource.h +47 -0
- metkitlib/include/metkit/pointdb/GribFieldInfo.h +76 -0
- metkitlib/include/metkit/pointdb/GribHandleDataSource.h +58 -0
- metkitlib/include/metkit/pointdb/PointIndex.h +121 -0
- metkitlib/include/metkit/pointdb/bits.h +1834 -0
- metkitlib/include/metkit/pointdb/masks.h +22 -0
- metkitlib/include/metkit/tool/MetkitTool.h +79 -0
- metkitlib/lib64/cmake/metkit/metkit-config-version.cmake +43 -0
- metkitlib/lib64/cmake/metkit/metkit-config.cmake +112 -0
- metkitlib/lib64/cmake/metkit/metkit-import.cmake +14 -0
- metkitlib/lib64/cmake/metkit/metkit-targets-relwithdebinfo.cmake +46 -0
- metkitlib/lib64/cmake/metkit/metkit-targets.cmake +116 -0
- metkitlib/lib64/libmetkit.so +0 -0
- metkitlib/lib64/pkgconfig/metkit.pc +33 -0
- metkitlib/share/metkit/axis.yaml +63 -0
- metkitlib/share/metkit/bufr-subtypes.yaml +140 -0
- metkitlib/share/metkit/chemids.yaml +209 -0
- metkitlib/share/metkit/language.yaml +1707 -0
- metkitlib/share/metkit/modifiers.yaml +341 -0
- metkitlib/share/metkit/obstype.yaml +182 -0
- metkitlib/share/metkit/odb/marsrequest.yaml +9 -0
- metkitlib/share/metkit/param-matching.yaml +16 -0
- metkitlib/share/metkit/paramids.yaml +24034 -0
- metkitlib/share/metkit/params-static.yaml +212 -0
- metkitlib/share/metkit/params.yaml +9833 -0
- metkitlib/share/metkit/reportype.yaml +525 -0
- metkitlib/share/metkit/shortname-context.yaml +192 -0
- metkitlib-1.16.0.9.dist-info/METADATA +75 -0
- metkitlib-1.16.0.9.dist-info/RECORD +104 -0
- metkitlib-1.16.0.9.dist-info/WHEEL +5 -0
- metkitlib-1.16.0.9.dist-info/licenses/AUTHORS +12 -0
- metkitlib-1.16.0.9.dist-info/licenses/LICENSE +190 -0
- metkitlib-1.16.0.9.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* (C) Copyright 1996- 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 nor
|
|
8
|
+
* does it submit to any jurisdiction.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
// File ClientTask.h
|
|
12
|
+
// Baudouin Raoult - ECMWF Oct 96
|
|
13
|
+
|
|
14
|
+
#ifndef metkit_ClientTask_H
|
|
15
|
+
#define metkit_ClientTask_H
|
|
16
|
+
|
|
17
|
+
#include <memory>
|
|
18
|
+
|
|
19
|
+
// #include "eckit/bases/Watcher.h"
|
|
20
|
+
#include "eckit/exception/Exceptions.h"
|
|
21
|
+
#include "eckit/io/DataHandle.h"
|
|
22
|
+
// #include "eckit/log/UserChannel.h"
|
|
23
|
+
#include "eckit/transaction/TxnEvent.h"
|
|
24
|
+
|
|
25
|
+
#include "metkit/mars/MarsRequest.h"
|
|
26
|
+
|
|
27
|
+
namespace metkit {
|
|
28
|
+
namespace mars {
|
|
29
|
+
|
|
30
|
+
class ClientTask {
|
|
31
|
+
public:
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
// -- Contructors
|
|
35
|
+
|
|
36
|
+
ClientTask(const MarsRequest&, const MarsRequest&, const std::string& name, int port, unsigned long long id = 0);
|
|
37
|
+
|
|
38
|
+
// ClientTask(eckit::Stream&);
|
|
39
|
+
|
|
40
|
+
// -- Destructor
|
|
41
|
+
|
|
42
|
+
~ClientTask();
|
|
43
|
+
|
|
44
|
+
// -- Convertors
|
|
45
|
+
// None
|
|
46
|
+
|
|
47
|
+
// -- Operators
|
|
48
|
+
// None
|
|
49
|
+
|
|
50
|
+
// -- Methods
|
|
51
|
+
|
|
52
|
+
// void dump(std::ostream&) const;
|
|
53
|
+
// void json(eckit::JSON&) const;
|
|
54
|
+
|
|
55
|
+
// MarsInfo info() const;
|
|
56
|
+
// const MarsID& id() const { return transactionID(); }
|
|
57
|
+
// const MarsRequest& request() const { return request_; }
|
|
58
|
+
// const MarsRequest& environ() const { return environ_; }
|
|
59
|
+
|
|
60
|
+
// eckit::Length transferData(const eckit::PathName&);
|
|
61
|
+
// eckit::PathName transferData();
|
|
62
|
+
|
|
63
|
+
// /// @returns eckit::DataHandle with the data that will be received, but does not give ownership of the
|
|
64
|
+
// eckit::DataHandle eckit::DataHandle& getDataHandle();
|
|
65
|
+
|
|
66
|
+
// void sendData(eckit::DataHandle&);
|
|
67
|
+
// void sendHandle(eckit::DataHandle&);
|
|
68
|
+
|
|
69
|
+
// void acknowledge(eckit::Stream& s) { send(s,'a'); }
|
|
70
|
+
// void patch();
|
|
71
|
+
// bool authenticated() const;
|
|
72
|
+
|
|
73
|
+
// eckit::DataHandle& dataHandle() { return *handle_; }
|
|
74
|
+
|
|
75
|
+
// // Report
|
|
76
|
+
|
|
77
|
+
// void success();
|
|
78
|
+
// void failure(const std::string&);
|
|
79
|
+
// void retry(const std::string&);
|
|
80
|
+
|
|
81
|
+
// void infoMsg(const std::string&);
|
|
82
|
+
// void warningMsg(const std::string&);
|
|
83
|
+
// void errorMsg(const std::string&);
|
|
84
|
+
// void notifyClient(const std::string&);
|
|
85
|
+
// void notifyStart();
|
|
86
|
+
|
|
87
|
+
// void queueTime();
|
|
88
|
+
|
|
89
|
+
// void ping();
|
|
90
|
+
// void sendCost();
|
|
91
|
+
|
|
92
|
+
// void sendChecksum(const std::string&);
|
|
93
|
+
|
|
94
|
+
// // Queuing
|
|
95
|
+
|
|
96
|
+
// double startingPriority() const { return startingPriority_;}
|
|
97
|
+
// void startingPriority(double p) { startingPriority_ = p;}
|
|
98
|
+
|
|
99
|
+
// // Cost
|
|
100
|
+
|
|
101
|
+
// Cost& cost() { return cost_; }
|
|
102
|
+
// const Cost& cost() const { return cost_; }
|
|
103
|
+
// void costChanged();
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
// // Called by PipeProcess
|
|
107
|
+
|
|
108
|
+
// void send(eckit::Stream&);
|
|
109
|
+
// void reply(eckit::Stream&);
|
|
110
|
+
// bool error(std::exception&,int);
|
|
111
|
+
// void done();
|
|
112
|
+
|
|
113
|
+
// Logging
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
// Mars tree
|
|
117
|
+
|
|
118
|
+
// void push(const std::string&,const std::string&);
|
|
119
|
+
// void pop();
|
|
120
|
+
// void reset();
|
|
121
|
+
|
|
122
|
+
// const eckit::StringList& treeNames() const { return treeNames_; }
|
|
123
|
+
// const eckit::StringList& treeValues() const { return treeValues_; }
|
|
124
|
+
|
|
125
|
+
// // For the metkit
|
|
126
|
+
void send(eckit::Stream&) const;
|
|
127
|
+
char receive(eckit::Stream&) const;
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
// -- Overridden methods
|
|
131
|
+
|
|
132
|
+
// From Streamble
|
|
133
|
+
|
|
134
|
+
// virtual void encode(eckit::Stream&) const override;
|
|
135
|
+
// virtual const eckit::ReanimatorBase& reanimator() const { return reanimator_; }
|
|
136
|
+
|
|
137
|
+
// From watcher
|
|
138
|
+
|
|
139
|
+
// virtual void watch();
|
|
140
|
+
|
|
141
|
+
// -- Class methods
|
|
142
|
+
|
|
143
|
+
// static const eckit::ClassSpec& classSpec() { return classSpec_;}
|
|
144
|
+
// static void recover(TxnRecoverer<ClientTask>&);
|
|
145
|
+
// static void find(TxnFinder<ClientTask>&);
|
|
146
|
+
// static std::string commandName();
|
|
147
|
+
|
|
148
|
+
// None
|
|
149
|
+
|
|
150
|
+
protected:
|
|
151
|
+
|
|
152
|
+
// -- Members
|
|
153
|
+
|
|
154
|
+
MarsRequest request_;
|
|
155
|
+
MarsRequest environ_;
|
|
156
|
+
|
|
157
|
+
private:
|
|
158
|
+
|
|
159
|
+
// -- Members
|
|
160
|
+
|
|
161
|
+
// unsigned long long txnID_; // unused
|
|
162
|
+
unsigned long long metkitID_;
|
|
163
|
+
int port_;
|
|
164
|
+
std::string host_;
|
|
165
|
+
std::unique_ptr<eckit::DataHandle> handle_;
|
|
166
|
+
std::string checksum_;
|
|
167
|
+
|
|
168
|
+
// Not sent over streams
|
|
169
|
+
|
|
170
|
+
// double startingPriority_;
|
|
171
|
+
// Cost cost_;
|
|
172
|
+
// time_t lastPing_;
|
|
173
|
+
// time_t queueTime_;
|
|
174
|
+
|
|
175
|
+
// eckit::StringList treeValues_;
|
|
176
|
+
// eckit::StringList treeNames_;
|
|
177
|
+
|
|
178
|
+
// bool authenticated_;
|
|
179
|
+
|
|
180
|
+
// -- Methods
|
|
181
|
+
|
|
182
|
+
// void print(std::ostream&) const;
|
|
183
|
+
// void send(eckit::Stream&,char) const;
|
|
184
|
+
|
|
185
|
+
// -- Overridden methods
|
|
186
|
+
// None
|
|
187
|
+
|
|
188
|
+
// -- Class members
|
|
189
|
+
|
|
190
|
+
// static eckit::ClassSpec classSpec_;
|
|
191
|
+
// static eckit::Reanimator<ClientTask> reanimator_;
|
|
192
|
+
|
|
193
|
+
// -- Class methods
|
|
194
|
+
// None
|
|
195
|
+
|
|
196
|
+
// friend std::ostream& operator<<(std::ostream& s, const ClientTask& r)
|
|
197
|
+
// { r.print(s); return s; }
|
|
198
|
+
|
|
199
|
+
// friend eckit::JSON& operator<<(eckit::JSON& s, const ClientTask& r)
|
|
200
|
+
// { r.json(s); return s; }
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
} // namespace mars
|
|
204
|
+
} // namespace metkit
|
|
205
|
+
|
|
206
|
+
#endif
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* (C) Copyright 1996- 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 nor
|
|
8
|
+
* does it submit to any jurisdiction.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
// File DHSProtocol.h
|
|
12
|
+
// Baudouin Raoult - (c) ECMWF Feb 12
|
|
13
|
+
|
|
14
|
+
#ifndef DHSProtocol_H
|
|
15
|
+
#define DHSProtocol_H
|
|
16
|
+
|
|
17
|
+
#include <memory>
|
|
18
|
+
|
|
19
|
+
#include "eckit/net/Endpoint.h"
|
|
20
|
+
#include "eckit/net/TCPServer.h"
|
|
21
|
+
#include "eckit/net/TCPSocket.h"
|
|
22
|
+
|
|
23
|
+
#include "metkit/mars/BaseProtocol.h"
|
|
24
|
+
#include "metkit/mars/ClientTask.h"
|
|
25
|
+
#include "metkit/mars/MarsRequest.h"
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
namespace metkit {
|
|
29
|
+
namespace mars {
|
|
30
|
+
|
|
31
|
+
// ---------------------------------------------------------------------------------------------------------------------
|
|
32
|
+
|
|
33
|
+
class BaseCallbackConnection : public eckit::Streamable {
|
|
34
|
+
public:
|
|
35
|
+
|
|
36
|
+
BaseCallbackConnection() {}
|
|
37
|
+
virtual ~BaseCallbackConnection() {}
|
|
38
|
+
|
|
39
|
+
static BaseCallbackConnection* build(const eckit::Configuration& config, const std::string& host = "");
|
|
40
|
+
|
|
41
|
+
virtual const eckit::net::Endpoint& endpoint() const = 0;
|
|
42
|
+
|
|
43
|
+
virtual eckit::net::TCPSocket& connect() = 0;
|
|
44
|
+
|
|
45
|
+
virtual void encode(eckit::Stream&) const override = 0;
|
|
46
|
+
static const eckit::ClassSpec& classSpec();
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
// ---------------------------------------------------------------------------------------------------------------------
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class DHSProtocol : public BaseProtocol {
|
|
53
|
+
|
|
54
|
+
public:
|
|
55
|
+
|
|
56
|
+
DHSProtocol(const eckit::Configuration&);
|
|
57
|
+
|
|
58
|
+
DHSProtocol(const eckit::Configuration&, const std::map<std::string, std::string>& env);
|
|
59
|
+
|
|
60
|
+
DHSProtocol(const std::string& name, const std::string& host, int port, bool forewardMessages = false);
|
|
61
|
+
|
|
62
|
+
DHSProtocol(eckit::Stream&);
|
|
63
|
+
~DHSProtocol();
|
|
64
|
+
|
|
65
|
+
// -- Overridden methods (from Streamable)
|
|
66
|
+
|
|
67
|
+
virtual std::string className() const override { return "DHSProtocol"; }
|
|
68
|
+
virtual const eckit::ReanimatorBase& reanimator() const override;
|
|
69
|
+
static const eckit::ClassSpec& classSpec();
|
|
70
|
+
|
|
71
|
+
private:
|
|
72
|
+
|
|
73
|
+
// -- Members
|
|
74
|
+
std::unique_ptr<BaseCallbackConnection> callback_;
|
|
75
|
+
eckit::net::TCPSocket socket_;
|
|
76
|
+
std::string name_;
|
|
77
|
+
std::string host_;
|
|
78
|
+
int port_;
|
|
79
|
+
std::string msg_;
|
|
80
|
+
std::unique_ptr<ClientTask> task_;
|
|
81
|
+
bool done_;
|
|
82
|
+
bool error_;
|
|
83
|
+
bool sending_;
|
|
84
|
+
bool forward_;
|
|
85
|
+
MarsRequest env_;
|
|
86
|
+
|
|
87
|
+
// -- Methods
|
|
88
|
+
bool wait(eckit::Length&);
|
|
89
|
+
|
|
90
|
+
// -- Overridden methods
|
|
91
|
+
// From BaseProtocol
|
|
92
|
+
virtual eckit::Length retrieve(const MarsRequest& request) override;
|
|
93
|
+
virtual void archive(const MarsRequest& request, const eckit::Length&) override;
|
|
94
|
+
virtual long read(void* buffer, long len) override;
|
|
95
|
+
virtual long write(const void* buffer, long len) override;
|
|
96
|
+
virtual void cleanup() override;
|
|
97
|
+
virtual void print(std::ostream&) const override;
|
|
98
|
+
virtual void encode(eckit::Stream&) const override;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
// ---------------------------------------------------------------------------------------------------------------------
|
|
102
|
+
|
|
103
|
+
} // namespace mars
|
|
104
|
+
} // namespace metkit
|
|
105
|
+
|
|
106
|
+
#endif
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* (C) Copyright 1996- 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 nor
|
|
8
|
+
* does it submit to any jurisdiction.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/// @author Manuel Fuentes
|
|
12
|
+
/// @author Baudouin Raoult
|
|
13
|
+
/// @author Tiago Quintino
|
|
14
|
+
|
|
15
|
+
/// @date Sep 96
|
|
16
|
+
|
|
17
|
+
#pragma once
|
|
18
|
+
|
|
19
|
+
#include <iosfwd>
|
|
20
|
+
|
|
21
|
+
namespace metkit::mars {
|
|
22
|
+
|
|
23
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
24
|
+
|
|
25
|
+
class [[deprecated]] MarsExpandContext {
|
|
26
|
+
|
|
27
|
+
void info(std::ostream&) const {}
|
|
28
|
+
|
|
29
|
+
public:
|
|
30
|
+
|
|
31
|
+
friend std::ostream& operator<<(std::ostream& s, const MarsExpandContext& r) { return s; }
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
35
|
+
|
|
36
|
+
class [[deprecated]] DummyContext : public MarsExpandContext {
|
|
37
|
+
using MarsExpandContext::MarsExpandContext;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
41
|
+
|
|
42
|
+
} // namespace metkit::mars
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* (C) Copyright 1996- 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 nor
|
|
8
|
+
* does it submit to any jurisdiction.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/// @author Manuel Fuentes
|
|
12
|
+
/// @author Baudouin Raoult
|
|
13
|
+
/// @author Tiago Quintino
|
|
14
|
+
|
|
15
|
+
/// @date Sep 96
|
|
16
|
+
|
|
17
|
+
#ifndef metkit_MarsExpansion_H
|
|
18
|
+
#define metkit_MarsExpansion_H
|
|
19
|
+
|
|
20
|
+
#include "eckit/memory/NonCopyable.h"
|
|
21
|
+
|
|
22
|
+
#include <map>
|
|
23
|
+
#include <string>
|
|
24
|
+
#include <vector>
|
|
25
|
+
|
|
26
|
+
#include "metkit/mars/MarsExpandContext.h"
|
|
27
|
+
#include "metkit/mars/MarsParsedRequest.h"
|
|
28
|
+
#include "metkit/mars/MarsRequest.h"
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
namespace metkit::mars {
|
|
32
|
+
|
|
33
|
+
class MarsLanguage;
|
|
34
|
+
|
|
35
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
36
|
+
|
|
37
|
+
class FlattenCallback {
|
|
38
|
+
public:
|
|
39
|
+
|
|
40
|
+
virtual ~FlattenCallback();
|
|
41
|
+
virtual void operator()(const MarsRequest&) = 0;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
class ExpandCallback {
|
|
45
|
+
public:
|
|
46
|
+
|
|
47
|
+
virtual ~ExpandCallback();
|
|
48
|
+
virtual void operator()(const MarsRequest& request) { this->operator()(DummyContext{}, request); }
|
|
49
|
+
virtual void operator()(const MarsExpandContext&, const MarsRequest&) = 0;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
53
|
+
|
|
54
|
+
class MarsExpansion : public eckit::NonCopyable {
|
|
55
|
+
public:
|
|
56
|
+
|
|
57
|
+
MarsExpansion(bool inherit, bool strict = false);
|
|
58
|
+
~MarsExpansion();
|
|
59
|
+
|
|
60
|
+
void reset();
|
|
61
|
+
|
|
62
|
+
MarsRequest expand(const MarsRequest&);
|
|
63
|
+
std::vector<MarsRequest> expand(const std::vector<MarsParsedRequest>&);
|
|
64
|
+
|
|
65
|
+
void expand(const MarsRequest&, ExpandCallback&);
|
|
66
|
+
void expand(const MarsExpandContext&, const MarsRequest&, ExpandCallback&);
|
|
67
|
+
void flatten(const MarsRequest&, FlattenCallback&);
|
|
68
|
+
void flatten(const MarsExpandContext&, const MarsRequest&, FlattenCallback&);
|
|
69
|
+
|
|
70
|
+
private:
|
|
71
|
+
|
|
72
|
+
MarsLanguage& language(const std::string& verb);
|
|
73
|
+
|
|
74
|
+
std::map<std::string, MarsLanguage*> languages_;
|
|
75
|
+
bool inherit_;
|
|
76
|
+
bool strict_;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
80
|
+
|
|
81
|
+
} // namespace metkit::mars
|
|
82
|
+
|
|
83
|
+
#endif
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* (C) Copyright 1996- 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 nor
|
|
8
|
+
* does it submit to any jurisdiction.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#ifndef metkit_MarsExpension_H
|
|
12
|
+
#define metkit_MarsExpension_H
|
|
13
|
+
|
|
14
|
+
#include "metkit/mars/MarsExpansion.h"
|
|
15
|
+
|
|
16
|
+
namespace metkit::mars {
|
|
17
|
+
|
|
18
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
19
|
+
|
|
20
|
+
struct [[deprecated("Use MarsExpansion instead")]] MarsExpension : MarsExpansion {
|
|
21
|
+
using MarsExpansion::MarsExpansion;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
25
|
+
|
|
26
|
+
} // namespace metkit::mars
|
|
27
|
+
|
|
28
|
+
#endif
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* (C) Copyright 1996- 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 nor
|
|
8
|
+
* does it submit to any jurisdiction.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
// File MarsHandle.h
|
|
12
|
+
// Baudouin Raoult - ECMWF Oct 96
|
|
13
|
+
|
|
14
|
+
#ifndef MarsHandle_H
|
|
15
|
+
#define MarsHandle_H
|
|
16
|
+
|
|
17
|
+
#include "eckit/io/Length.h"
|
|
18
|
+
#include "eckit/io/TCPHandle.h"
|
|
19
|
+
#include "eckit/serialisation/Stream.h"
|
|
20
|
+
|
|
21
|
+
class MarsHandle : public eckit::TCPHandle {
|
|
22
|
+
public:
|
|
23
|
+
|
|
24
|
+
// -- Contructors
|
|
25
|
+
|
|
26
|
+
MarsHandle(const std::string& host, int port, unsigned long long);
|
|
27
|
+
MarsHandle(eckit::Stream&);
|
|
28
|
+
|
|
29
|
+
// -- Destructor
|
|
30
|
+
|
|
31
|
+
~MarsHandle();
|
|
32
|
+
|
|
33
|
+
// -- Overridden methods
|
|
34
|
+
|
|
35
|
+
// From eckit::DataHandle
|
|
36
|
+
|
|
37
|
+
virtual eckit::Length openForRead() override;
|
|
38
|
+
virtual void openForWrite(const eckit::Length&) override;
|
|
39
|
+
virtual void openForAppend(const eckit::Length&) override;
|
|
40
|
+
|
|
41
|
+
virtual void close() override;
|
|
42
|
+
virtual long read(void*, long) override;
|
|
43
|
+
virtual long write(const void*, long) override;
|
|
44
|
+
|
|
45
|
+
virtual eckit::Length estimate() override;
|
|
46
|
+
virtual std::string title() const override;
|
|
47
|
+
virtual std::string metricsTag() const override;
|
|
48
|
+
|
|
49
|
+
virtual bool moveable() const override { return true; }
|
|
50
|
+
|
|
51
|
+
// From Streamable
|
|
52
|
+
|
|
53
|
+
virtual void encode(eckit::Stream&) const override;
|
|
54
|
+
virtual const eckit::ReanimatorBase& reanimator() const override { return reanimator_; }
|
|
55
|
+
|
|
56
|
+
// -- Class methods
|
|
57
|
+
|
|
58
|
+
static const eckit::ClassSpec& classSpec();
|
|
59
|
+
|
|
60
|
+
private:
|
|
61
|
+
|
|
62
|
+
// -- Members
|
|
63
|
+
|
|
64
|
+
unsigned long long clientID_;
|
|
65
|
+
eckit::Length length_;
|
|
66
|
+
eckit::Length total_;
|
|
67
|
+
bool receiving_;
|
|
68
|
+
bool streamMode_;
|
|
69
|
+
bool doCRC_;
|
|
70
|
+
unsigned long crc_;
|
|
71
|
+
|
|
72
|
+
// -- Methods
|
|
73
|
+
|
|
74
|
+
void updateCRC(void*, long);
|
|
75
|
+
|
|
76
|
+
// -- Class members
|
|
77
|
+
|
|
78
|
+
static eckit::Reanimator<MarsHandle> reanimator_;
|
|
79
|
+
|
|
80
|
+
friend class MarsHandleStream;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
#endif
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* (C) Copyright 1996- 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 nor
|
|
8
|
+
* does it submit to any jurisdiction.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/// @author Manuel Fuentes
|
|
12
|
+
/// @author Baudouin Raoult
|
|
13
|
+
/// @author Tiago Quintino
|
|
14
|
+
|
|
15
|
+
/// @date Sep 96
|
|
16
|
+
|
|
17
|
+
#pragma once
|
|
18
|
+
|
|
19
|
+
#include <map>
|
|
20
|
+
#include <memory>
|
|
21
|
+
#include <set>
|
|
22
|
+
#include <string>
|
|
23
|
+
#include <vector>
|
|
24
|
+
|
|
25
|
+
#include "eckit/memory/NonCopyable.h"
|
|
26
|
+
|
|
27
|
+
#include "metkit/mars/MarsRequest.h"
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
namespace metkit::mars {
|
|
31
|
+
|
|
32
|
+
class Context;
|
|
33
|
+
class FlattenCallback;
|
|
34
|
+
class Type;
|
|
35
|
+
|
|
36
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
37
|
+
|
|
38
|
+
enum class ModifierType {
|
|
39
|
+
DEFAULT,
|
|
40
|
+
SET,
|
|
41
|
+
UNSET
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
45
|
+
|
|
46
|
+
class MarsLanguage : private eckit::NonCopyable {
|
|
47
|
+
|
|
48
|
+
public: // methods
|
|
49
|
+
|
|
50
|
+
MarsLanguage(const std::string& verb);
|
|
51
|
+
|
|
52
|
+
~MarsLanguage();
|
|
53
|
+
|
|
54
|
+
MarsRequest expand(const MarsRequest& r, bool inherit, bool strict);
|
|
55
|
+
|
|
56
|
+
void reset();
|
|
57
|
+
|
|
58
|
+
const std::string& verb() const;
|
|
59
|
+
|
|
60
|
+
void flatten(const MarsRequest& request, FlattenCallback& callback);
|
|
61
|
+
|
|
62
|
+
static eckit::PathName languageYamlFile();
|
|
63
|
+
|
|
64
|
+
Type* type(const std::string& name) const;
|
|
65
|
+
|
|
66
|
+
bool isData(const std::string& keyword) const;
|
|
67
|
+
|
|
68
|
+
bool isPostProc(const std::string& keyword) const;
|
|
69
|
+
|
|
70
|
+
bool isSink(const std::string& keyword) const;
|
|
71
|
+
const std::set<std::string>& sinkKeywords() const;
|
|
72
|
+
|
|
73
|
+
public: // class methods
|
|
74
|
+
|
|
75
|
+
static std::string expandVerb(const std::string& verb);
|
|
76
|
+
|
|
77
|
+
static std::string bestMatch(const std::string& name, const std::vector<std::string>& values, bool fail, bool quiet,
|
|
78
|
+
bool fullMatch, const std::map<std::string, std::string>& aliases = {});
|
|
79
|
+
|
|
80
|
+
static eckit::Value jsonFile(const std::string& name);
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
private: // methods
|
|
84
|
+
|
|
85
|
+
void flatten(const MarsRequest& request, const std::vector<std::string>& params, size_t i, MarsRequest& result,
|
|
86
|
+
FlattenCallback& callback);
|
|
87
|
+
void parseModifier(ModifierType typ, std::shared_ptr<Context> ctx, size_t maxIndex, const eckit::Value& mod);
|
|
88
|
+
|
|
89
|
+
private: // members
|
|
90
|
+
|
|
91
|
+
std::string verb_;
|
|
92
|
+
std::map<std::string, Type*> types_;
|
|
93
|
+
std::set<std::string> dataKeywords_;
|
|
94
|
+
std::set<std::string> sinkKeywords_;
|
|
95
|
+
std::set<std::string> postProcKeywords_;
|
|
96
|
+
std::vector<std::pair<std::string, Type*>> typesByAxisOrder_;
|
|
97
|
+
std::vector<std::string> keywords_;
|
|
98
|
+
|
|
99
|
+
std::map<std::string, std::string> aliases_;
|
|
100
|
+
|
|
101
|
+
mutable std::map<std::string, std::string> cache_;
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
105
|
+
|
|
106
|
+
} // namespace metkit::mars
|