|
| 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 "ParallaxNameBase.h" |
| 12 | +#include "eckit/exception/Exceptions.h" |
| 13 | +#include "eckit/filesystem/PathName.h" |
| 14 | +#include "eckit/io/Buffer.h" |
| 15 | +#include "eckit/io/FileHandle.h" |
| 16 | +#include "eckit/io/MemoryHandle.h" |
| 17 | +#include "eckit/utils/Tokenizer.h" |
| 18 | +#include <atomic> |
| 19 | +#include <iomanip> |
| 20 | + |
| 21 | +#include "fdb5/parallax/ParallaxArrayPartHandle.h" |
| 22 | + |
| 23 | +namespace fdb5 |
| 24 | +{ |
| 25 | +//===----------------------------------------------------------------------===// |
| 26 | +// ParallaxNameBase |
| 27 | +//===----------------------------------------------------------------------===// |
| 28 | + |
| 29 | +ParallaxNameBase::ParallaxNameBase(const eckit::URI &uri) |
| 30 | + : uri_(uri) |
| 31 | +{ |
| 32 | + ASSERT(uri.scheme() == "parallax"); |
| 33 | + ASSERT(uri.query() == std::string()); |
| 34 | + ASSERT(uri.fragment() == std::string()); |
| 35 | + |
| 36 | + eckit::Tokenizer parse("/"); |
| 37 | + std::vector<std::string> bits; |
| 38 | + parse(uri.name(), bits); |
| 39 | + |
| 40 | + ASSERT(bits.size() > 0); |
| 41 | + ASSERT(bits.size() < 4); |
| 42 | + |
| 43 | + key_ = bits[0]; |
| 44 | +} |
| 45 | + |
| 46 | +std::string ParallaxNameBase::asString() const |
| 47 | +{ |
| 48 | + return key_; |
| 49 | +} |
| 50 | + |
| 51 | +//===----------------------------------------------------------------------===// |
| 52 | +// ParallaxArrayName |
| 53 | +//===----------------------------------------------------------------------===// |
| 54 | + |
| 55 | +ParallaxArrayName::ParallaxArrayName(const eckit::URI &uri) |
| 56 | + : ParallaxNameBase(uri) |
| 57 | +{ |
| 58 | +} |
| 59 | + |
| 60 | +eckit::DataHandle *ParallaxArrayName::dataHandle(const eckit::Offset &offset, const eckit::Length &length) const |
| 61 | +{ |
| 62 | + return new fdb5::ParallaxArrayPartHandle(*this, offset, length); |
| 63 | +} |
| 64 | + |
| 65 | +} |
0 commit comments