Publishing 2019 R1 content
[platform/upstream/dldt.git] / inference-engine / include / ie_imemory_state.hpp
1 // Copyright (C) 2018-2019 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4
5 /**
6  * @brief a header file for IMemoryState interface
7  * @file ie_imemory_state.hpp
8  */
9
10 #pragma once
11 #include <memory>
12 #include "details/ie_no_copy.hpp"
13 #include "ie_common.h"
14 #include "ie_blob.h"
15
16 namespace InferenceEngine {
17
18 /**
19  * @brief manages data for reset operations
20  */
21 class IMemoryState : public details::no_copy {
22  public:
23     using Ptr = std::shared_ptr<IMemoryState>;
24
25     /**
26      * @brief Gets name of current memory state, if length of array is not enough name is truncated by len, null terminator is inserted as well.
27      * @param name preallocated buffer for receiving name
28      * @param len Length of the buffer
29      * @param  resp Optional: pointer to an already allocated object to contain information in case of failure
30      * @return Status code of the operation: OK (0) for success
31      */
32     virtual StatusCode GetName(char *name, size_t len, ResponseDesc *resp) const noexcept = 0;
33
34     /**
35      * @brief reset internal memory state for relevant iexecutable network, to a value specified in SetState
36      * @param  resp Optional: pointer to an already allocated object to contain information in case of failure
37      * @return Status code of the operation: OK (0) for success*
38      */
39     virtual StatusCode Reset(ResponseDesc *resp) noexcept = 0;
40
41     /**
42      * @brief  Sets the new state that is used for all future Reset() operations as a base.
43      * This method can fail if Blob size does not match the internal state size or precision
44      * @param  newState is the data to use as base state
45      * @param  resp Optional: pointer to an already allocated object to contain information in case of failure
46      * @return Status code of the operation: OK (0) for success
47     */
48     virtual StatusCode SetState(Blob::Ptr newState, ResponseDesc *resp) noexcept = 0;
49
50     /**
51      * @brief returns the value of the last memory state.
52      * @details Since we roll memory after each infer, we can query the input state always and still get the last state.
53      * @param lastState
54      * @param  resp Optional: pointer to an already allocated object to contain information in case of failure
55      * @return Status code of the operation: OK (0) for success
56      * */
57     virtual StatusCode GetLastState(Blob::CPtr & lastState, ResponseDesc *resp) const noexcept = 0;
58 };
59
60 }  // namespace InferenceEngine