summaryrefslogtreecommitdiff
path: root/python/openvino/runtime/common/format_reader/format_reader_ptr.h
diff options
context:
space:
mode:
Diffstat (limited to 'python/openvino/runtime/common/format_reader/format_reader_ptr.h')
-rw-r--r--python/openvino/runtime/common/format_reader/format_reader_ptr.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/python/openvino/runtime/common/format_reader/format_reader_ptr.h b/python/openvino/runtime/common/format_reader/format_reader_ptr.h
new file mode 100644
index 0000000..eb9bf8e
--- /dev/null
+++ b/python/openvino/runtime/common/format_reader/format_reader_ptr.h
@@ -0,0 +1,43 @@
+// Copyright (C) 2018-2022 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+/**
+ * \brief Implementation of smart pointer for Reader class
+ * \file format_reader_ptr.h
+ */
+#pragma once
+
+#include <functional>
+#include <memory>
+
+#include "format_reader.h"
+
+namespace FormatReader {
+class ReaderPtr {
+public:
+ explicit ReaderPtr(const char* imageName) : reader(CreateFormatReader(imageName)) {}
+ /**
+ * @brief dereference operator overload
+ * @return Reader
+ */
+ Reader* operator->() const noexcept {
+ return reader.get();
+ }
+
+ /**
+ * @brief dereference operator overload
+ * @return Reader
+ */
+ Reader* operator*() const noexcept {
+ return reader.get();
+ }
+
+ Reader* get() {
+ return reader.get();
+ }
+
+protected:
+ std::unique_ptr<Reader> reader;
+};
+} // namespace FormatReader