ie_imemory_state.hpp
Go to the documentation of this file.
1 // Copyright (C) 2018-2020 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4 
5 /**
6  * @brief a header file for IVariableState interface
7  *
8  * @file ie_imemory_state.hpp
9  */
10 
11 #pragma once
12 
13 #include <memory>
14 
15 #include "ie_blob.h"
16 #include "ie_common.h"
17 #include "details/ie_no_copy.hpp"
18 
19 namespace InferenceEngine {
20 
21 /**
22  * @deprecated Use VariableState C++ wrapper instead
23  * @interface IVariableState
24  * @brief Manages data for reset operations
25  */
26 class IVariableState : public details::no_copy {
27 public:
28  IE_SUPPRESS_DEPRECATED_START
29  /**
30  * @brief A shared pointer to the IVariableState interface
31  */
32  using Ptr = std::shared_ptr<IVariableState>;
33  IE_SUPPRESS_DEPRECATED_END
34 
35  /**
36  * @brief Gets name of current variable state, if length of array is not enough name is truncated by len, null
37  * terminator is inserted as well. As variable state name `variable_id` from according `ReadValue` used.
38  *
39  * @param name preallocated buffer for receiving name
40  * @param len Length of the buffer
41  * @param resp Optional: pointer to an already allocated object to contain information in case of failure
42  * @return Status code of the operation: InferenceEngine::OK (0) for success
43  */
44  virtual StatusCode GetName(char* name, size_t len, ResponseDesc* resp) const noexcept = 0;
45 
46  /**
47  * @brief Reset internal variable state for relevant infer request, to a value specified as default for according ReadValue node
48  *
49  * @param resp Optional: pointer to an already allocated object to contain information in case of failure
50  * @return Status code of the operation: InferenceEngine::OK (0) for success*
51  */
52  virtual StatusCode Reset(ResponseDesc* resp) noexcept = 0;
53 
54  /**
55  * @brief Sets the new state for the next inference.
56  *
57  * This method can fail if Blob size does not match the internal state size or precision
58  *
59  * @param newState The data to use as new state
60  * @param resp Optional: pointer to an already allocated object to contain information in case of failure
61  * @return Status code of the operation: InferenceEngine::OK (0) for success
62  */
63  virtual StatusCode SetState(Blob::Ptr newState, ResponseDesc* resp) noexcept = 0;
64 
65  /**
66  * @brief Returns the value of the variable state.
67  *
68  * @param state A reference to a blob containing a variable state
69  * @param resp Optional: pointer to an already allocated object to contain information in case of failure
70  * @return Status code of the operation: InferenceEngine::OK (0) for success
71  */
72  INFERENCE_ENGINE_DEPRECATED("Use GetState function instead")
73  virtual StatusCode GetLastState(Blob::CPtr& state, ResponseDesc* resp) const noexcept {
74  return GetState(state, resp);
75  }
76 
77  /**
78  * @brief Returns the value of the variable state.
79  *
80  * @param state A reference to a blob containing a variable state
81  * @param resp Optional: pointer to an already allocated object to contain information in case of failure
82  * @return Status code of the operation: InferenceEngine::OK (0) for success
83  */
84  virtual StatusCode GetState(Blob::CPtr& state, ResponseDesc* resp) const noexcept = 0;
85 };
86 
87 IE_SUPPRESS_DEPRECATED_START
88 
89 /**
90  * @brief For compatibility reasons.
91  */
93 
94 IE_SUPPRESS_DEPRECATED_END
95 
96 } // namespace InferenceEngine
This class represents a universal container in the Inference Engine.
Definition: ie_blob.h:38
std::shared_ptr< const Blob > CPtr
A smart pointer to the const Blob object.
Definition: ie_blob.h:48
std::shared_ptr< Blob > Ptr
A smart pointer containing Blob object.
Definition: ie_blob.h:43
Manages data for reset operations.
Definition: ie_imemory_state.hpp:26
virtual StatusCode GetLastState(Blob::CPtr &state, ResponseDesc *resp) const noexcept
Returns the value of the variable state.
Definition: ie_imemory_state.hpp:73
virtual StatusCode GetState(Blob::CPtr &state, ResponseDesc *resp) const noexcept=0
Returns the value of the variable state.
virtual StatusCode GetName(char *name, size_t len, ResponseDesc *resp) const noexcept=0
Gets name of current variable state, if length of array is not enough name is truncated by len,...
std::shared_ptr< IVariableState > Ptr
A shared pointer to the IVariableState interface.
Definition: ie_imemory_state.hpp:32
virtual StatusCode SetState(Blob::Ptr newState, ResponseDesc *resp) noexcept=0
Sets the new state for the next inference.
virtual StatusCode Reset(ResponseDesc *resp) noexcept=0
Reset internal variable state for relevant infer request, to a value specified as default for accordi...
A header file for Blob and generic TBlob<>
This is a header file with common inference engine definitions.
header file for no_copy class
Inference Engine C++ API.
Definition: cldnn_config.hpp:15
StatusCode
This enum contains codes for all possible return values of the interface functions.
Definition: ie_common.h:224
Represents detailed information for an error.
Definition: ie_common.h:248