shared_buffer.hpp
1 // Copyright (C) 2018-2021 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4 
5 #pragma once
6 
7 #include <cstddef>
8 
9 #include "ngraph/runtime/aligned_buffer.hpp"
10 
11 namespace ngraph
12 {
13  namespace runtime
14  {
15  /// \brief SharedBuffer class to store pointer to pre-acclocated buffer.
16  template <typename T>
18  {
19  public:
20  SharedBuffer(char* data, size_t size, T& shared_object)
21  : _shared_object(shared_object)
22  {
23  m_allocated_buffer = data;
24  m_aligned_buffer = data;
25  m_byte_size = size;
26  }
27 
28  virtual ~SharedBuffer()
29  {
30  m_aligned_buffer = nullptr;
31  m_allocated_buffer = nullptr;
32  m_byte_size = 0;
33  }
34 
35  private:
36  T _shared_object;
37  };
38  } // namespace runtime
39 } // namespace ngraph
Allocates a block of memory on the specified alignment. The actual size of the allocated memory is la...
Definition: aligned_buffer.hpp:20
SharedBuffer class to store pointer to pre-acclocated buffer.
Definition: shared_buffer.hpp:18
The Intel nGraph C++ API.
Definition: attribute_adapter.hpp:16