aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2020-03-03 16:07:42 -0800
committerAaron Rossetto <aaron.rossetto@ni.com>2020-04-02 11:55:17 -0500
commit1e016e49e82c430197a90a018fbc7613cc654088 (patch)
tree2aae42ec09f5df11dec664cd6142f8eb254585c0 /host
parentb47b1a467ee5796dbce359ff34c9d55a6acebc82 (diff)
downloaduhd-1e016e49e82c430197a90a018fbc7613cc654088.tar.gz
uhd-1e016e49e82c430197a90a018fbc7613cc654088.tar.bz2
uhd-1e016e49e82c430197a90a018fbc7613cc654088.zip
uhd: Add calibration container class
This adds uhd::usrp::cal::container, which serves as a base class for calibration data. It also provides the interp_mode enum class which can be useful for future calibration classes.
Diffstat (limited to 'host')
-rw-r--r--host/include/uhd/cal/CMakeLists.txt2
-rw-r--r--host/include/uhd/cal/container.hpp50
-rw-r--r--host/include/uhd/cal/interpolation.hpp16
3 files changed, 68 insertions, 0 deletions
diff --git a/host/include/uhd/cal/CMakeLists.txt b/host/include/uhd/cal/CMakeLists.txt
index 6c8355fec..b3f724d2e 100644
--- a/host/include/uhd/cal/CMakeLists.txt
+++ b/host/include/uhd/cal/CMakeLists.txt
@@ -6,6 +6,8 @@
UHD_INSTALL(FILES
database.hpp
+ container.hpp
+ interpolation.hpp
DESTINATION ${INCLUDE_DIR}/uhd/cal
COMPONENT headers
)
diff --git a/host/include/uhd/cal/container.hpp b/host/include/uhd/cal/container.hpp
new file mode 100644
index 000000000..c3035c610
--- /dev/null
+++ b/host/include/uhd/cal/container.hpp
@@ -0,0 +1,50 @@
+//
+// Copyright 2020 Ettus Research, a National Instruments Brand
+//
+// SPDX-License-Identifier: GPL-3.0-or-later
+//
+
+#ifndef INCLUDED_LIBUHD_CAL_CONTAINER_HPP
+#define INCLUDED_LIBUHD_CAL_CONTAINER_HPP
+
+#include <uhd/config.hpp>
+#include <stdint.h>
+#include <memory>
+#include <vector>
+#include <string>
+
+namespace uhd { namespace usrp { namespace cal {
+
+/*! Generic parent class for calibration data
+ *
+ * Derive any class that stores cal data which needs to be stored/retrieved from
+ * this parent class.
+ */
+class UHD_API container
+{
+public:
+ virtual ~container() = default;
+
+ //! Return a serialized version of this container
+ virtual std::vector<uint8_t> serialize() = 0;
+
+ //! Populate this class from the serialized data
+ virtual void deserialize(const std::vector<uint8_t>& data) = 0;
+
+ //! Generic factory for cal data from serialized data
+ //
+ // \tparam container_type The class type of cal data which should be
+ // generated from \p data
+ // \param data The serialized data to be turned into the cal class
+ template <typename container_type>
+ static std::shared_ptr<container_type> make(const std::vector<uint8_t>& data)
+ {
+ auto cal_data = container_type::make();
+ cal_data->deserialize(data);
+ return cal_data;
+ }
+};
+
+}}} // namespace uhd::usrp::cal
+
+#endif /* INCLUDED_LIBUHD_CAL_CONTAINER_HPP */
diff --git a/host/include/uhd/cal/interpolation.hpp b/host/include/uhd/cal/interpolation.hpp
new file mode 100644
index 000000000..5cdbcfa54
--- /dev/null
+++ b/host/include/uhd/cal/interpolation.hpp
@@ -0,0 +1,16 @@
+//
+// Copyright 2020 Ettus Research, a National Instruments Brand
+//
+// SPDX-License-Identifier: GPL-3.0-or-later
+//
+
+#ifndef INCLUDED_LIBUHD_CAL_INTERP_HPP
+#define INCLUDED_LIBUHD_CAL_INTERP_HPP
+
+namespace uhd { namespace usrp { namespace cal {
+
+enum class interp_mode { NEAREST_NEIGHBOR, LINEAR };
+
+}}} // namespace uhd::usrp::cal
+
+#endif /* INCLUDED_LIBUHD_CAL_INTERP_HPP */