Skip to content

Commit 18c7181

Browse files
[feat] Implement ParallaxFieldLocation for archive storage and data retrieval
1 parent a2c9fb4 commit 18c7181

File tree

2 files changed

+111
-0
lines changed

2 files changed

+111
-0
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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+
#include "fdb5/parallax/ParallaxFieldLocation.h"
12+
#include "eckit/filesystem/URIManager.h"
13+
#include "fdb5/LibFdb5.h"
14+
#include "fdb5/parallax/ParallaxArray.h"
15+
16+
namespace fdb5
17+
{
18+
::eckit::ClassSpec ParallaxFieldLocation::classSpec_ = {
19+
&FieldLocation::classSpec(),
20+
"ParallaxFieldLocation",
21+
};
22+
::eckit::Reanimator<ParallaxFieldLocation> ParallaxFieldLocation::reanimator_;
23+
24+
ParallaxFieldLocation::ParallaxFieldLocation(const ParallaxFieldLocation &rhs)
25+
: FieldLocation(rhs.uri_, rhs.offset_, rhs.length_, rhs.remapKey_)
26+
{
27+
}
28+
29+
ParallaxFieldLocation::ParallaxFieldLocation(const eckit::URI &uri, eckit::Offset offset, eckit::Length length,
30+
const Key &remapKey)
31+
: FieldLocation(uri, offset, length, remapKey)
32+
{
33+
}
34+
35+
ParallaxFieldLocation::ParallaxFieldLocation(eckit::Stream &s)
36+
: FieldLocation(s)
37+
{
38+
}
39+
40+
std::shared_ptr<FieldLocation> ParallaxFieldLocation::make_shared() const
41+
{
42+
return std::make_shared<ParallaxFieldLocation>(std::move(*this));
43+
}
44+
45+
eckit::DataHandle *ParallaxFieldLocation::dataHandle() const
46+
{
47+
return fdb5::ParallaxArrayName(uri_).dataHandle(offset(), length());
48+
}
49+
50+
void ParallaxFieldLocation::print(std::ostream &out) const
51+
{
52+
out << "ParallaxFieldLocation[uri=" << uri_ << "]";
53+
}
54+
55+
void ParallaxFieldLocation::visit(FieldLocationVisitor &visitor) const
56+
{
57+
visitor(*this);
58+
}
59+
60+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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+
#pragma once
12+
13+
#include "eckit/io/Length.h"
14+
#include "eckit/io/Offset.h"
15+
16+
#include "fdb5/database/FieldLocation.h"
17+
18+
namespace fdb5
19+
{
20+
class ParallaxFieldLocation : public FieldLocation {
21+
public:
22+
ParallaxFieldLocation(const ParallaxFieldLocation &rhs);
23+
ParallaxFieldLocation(const eckit::URI &uri, eckit::Offset offset, eckit::Length length, const Key &remapKey);
24+
ParallaxFieldLocation(eckit::Stream &);
25+
26+
eckit::DataHandle *dataHandle() const override;
27+
28+
virtual std::shared_ptr<FieldLocation> make_shared() const override;
29+
30+
virtual void visit(FieldLocationVisitor &visitor) const override;
31+
32+
public:
33+
static const eckit::ClassSpec &classSpec()
34+
{
35+
return classSpec_;
36+
}
37+
38+
protected:
39+
virtual const eckit::ReanimatorBase &reanimator() const override
40+
{
41+
return reanimator_;
42+
}
43+
44+
static eckit::ClassSpec classSpec_;
45+
static eckit::Reanimator<ParallaxFieldLocation> reanimator_;
46+
47+
private:
48+
void print(std::ostream &out) const override;
49+
};
50+
51+
}

0 commit comments

Comments
 (0)