diff --git a/src/metkit/CMakeLists.txt b/src/metkit/CMakeLists.txt index 3252f404..0178649b 100644 --- a/src/metkit/CMakeLists.txt +++ b/src/metkit/CMakeLists.txt @@ -133,10 +133,6 @@ if ( HAVE_GRIB ) codes/CodesContent.h codes/BufrContent.cc codes/BufrContent.h - codes/UserDataContent.cc - codes/UserDataContent.h - codes/DataContent.cc - codes/DataContent.h codes/MallocCodesContent.cc codes/MallocCodesContent.h codes/CodesSplitter.cc diff --git a/src/metkit/codes/DataContent.cc b/src/metkit/codes/DataContent.cc deleted file mode 100644 index 4a449040..00000000 --- a/src/metkit/codes/DataContent.cc +++ /dev/null @@ -1,62 +0,0 @@ -/* - * (C) Copyright 2017- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * In applying this licence, ECMWF does not waive the privileges and immunities - * granted to it by virtue of its status as an intergovernmental organisation nor - * does it submit to any jurisdiction. - */ - -/// @author Baudouin Raoult -/// @date Jun 2020 - -#include - -#include "metkit/codes/DataContent.h" - -#include "eckit/exception/Exceptions.h" -#include "eckit/io/MemoryHandle.h" - -namespace metkit { -namespace codes { - -DataContent::DataContent(const void* data, size_t size) : data_(data), size_(size), handle_(nullptr) {} - -DataContent::~DataContent() { - if (handle_) { - codes_handle_delete(handle_); - } -} - -eckit::DataHandle* DataContent::readHandle() const { - return new eckit::MemoryHandle(data_, size_); -} - -size_t DataContent::length() const { - return size_; -} - -const void* DataContent::data() const { - return data_; -} - -void DataContent::write(eckit::DataHandle& handle) const { - if (handle.write(data_, size_) != size_) { - std::ostringstream oss; - oss << "Write error to data handle " << handle; - throw eckit::WriteError(oss.str(), Here()); - } -} - -const codes_handle* DataContent::codesHandle() const { - if (!handle_) { - handle_ = codes_handle_new_from_message(nullptr, data_, size_); - ASSERT(handle_); - } - return handle_; -} - - -} // namespace codes -} // namespace metkit diff --git a/src/metkit/codes/DataContent.h b/src/metkit/codes/DataContent.h deleted file mode 100644 index 3e31f502..00000000 --- a/src/metkit/codes/DataContent.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * (C) Copyright 2017- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * In applying this licence, ECMWF does not waive the privileges and immunities - * granted to it by virtue of its status as an intergovernmental organisation nor - * does it submit to any jurisdiction. - */ - -/// @author Baudouin Raoult -/// @date Jun 2020 - -#pragma once - -#include "eccodes.h" - -#include "eckit/message/MessageContent.h" - -namespace metkit { -namespace codes { - -class DataContent : public eckit::message::MessageContent { -public: - - DataContent(const void* data, size_t size); - ~DataContent(); - -protected: - - const void* data_; - const size_t size_; - mutable codes_handle* handle_; - - eckit::DataHandle* readHandle() const override; - size_t length() const override; - const void* data() const override; - void write(eckit::DataHandle& handle) const override; - - virtual const codes_handle* codesHandle() const; -}; - -} // namespace codes -} // namespace metkit diff --git a/src/metkit/codes/UserDataContent.cc b/src/metkit/codes/UserDataContent.cc deleted file mode 100644 index a5fefa89..00000000 --- a/src/metkit/codes/UserDataContent.cc +++ /dev/null @@ -1,31 +0,0 @@ -/* - * (C) Copyright 2017- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * In applying this licence, ECMWF does not waive the privileges and immunities - * granted to it by virtue of its status as an intergovernmental organisation nor - * does it submit to any jurisdiction. - */ - -/// @author Baudouin Raoult -/// @date Jun 2020 - -#include - -#include "metkit/codes/UserDataContent.h" - - -namespace metkit { -namespace codes { - -UserDataContent::UserDataContent(const void* data, size_t size) : DataContent(data, size) {} - -UserDataContent::~UserDataContent() {} - -void UserDataContent::print(std::ostream& s) const { - s << "UserDataContent[]"; -} - -} // namespace codes -} // namespace metkit diff --git a/src/metkit/codes/UserDataContent.h b/src/metkit/codes/UserDataContent.h deleted file mode 100644 index 77ab3f2b..00000000 --- a/src/metkit/codes/UserDataContent.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * (C) Copyright 2017- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * In applying this licence, ECMWF does not waive the privileges and immunities - * granted to it by virtue of its status as an intergovernmental organisation nor - * does it submit to any jurisdiction. - */ - -/// @author Baudouin Raoult -/// @date Jun 2020 - - -#pragma once -#include "metkit/codes/DataContent.h" - - -namespace metkit { -namespace codes { - -class UserDataContent : public DataContent { -public: - - UserDataContent(const void* data, size_t size); - ~UserDataContent(); - -private: - - void print(std::ostream& s) const override; -}; - - -} // namespace codes -} // namespace metkit