ie_irelease.hpp
Go to the documentation of this file.
1 // Copyright (C) 2018-2019 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4 
5 /**
6  * @brief A header file for the Inference Engine plugins destruction mechanism
7  * @file ie_irelease.hpp
8  */
9 #pragma once
10 
11 #include <memory>
12 
13 #include "ie_api.h"
14 #include "ie_no_copy.hpp"
15 
16 namespace InferenceEngine {
17 namespace details {
18 /**
19  * @brief This class is used for objects allocated by a shared module (in *.so)
20  */
21 class IRelease : public no_copy {
22 public:
23  /**
24  * @brief Releases current allocated object and all related resources.
25  * Once this method is called, the pointer to this interface is no longer valid
26  */
27  virtual void Release() noexcept = 0;
28 
29 protected:
30  /**
31  * @brief Default destructor
32  */
33  ~IRelease() override = default;
34 };
35 
36 IE_SUPPRESS_DEPRECATED_START
37 
38 template <class T>
39 inline std::shared_ptr<T> shared_from_irelease(T* ptr) {
40  IE_SUPPRESS_DEPRECATED_START
41  std::shared_ptr<T> pointer(ptr, [](IRelease* p) {
42  p->Release();
43  });
44  IE_SUPPRESS_DEPRECATED_END
45  return pointer;
46 }
47 
48 IE_SUPPRESS_DEPRECATED_END
49 
50 } // namespace details
51 } // namespace InferenceEngine
Inference Engine API.
Definition: ie_argmax_layer.hpp:11
The macro defines a symbol import/export mechanism essential for Microsoft Windows(R) OS...
header file for no_copy class