ie_ivariable_state_internal.hpp
1 // Copyright (C) 2018-2021 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4 
5 #pragma once
6 
7 #include <ie_blob.h>
9 
10 #include <memory>
11 #include <string>
12 
13 namespace InferenceEngine {
14 
15 /**
16  * @interface IVariableStateInternal
17  * @brief Minimal interface for variable state implementation
18  * @ingroup ie_dev_api_variable_state_api
19  */
20 class INFERENCE_ENGINE_API_CLASS(IVariableStateInternal) : public std::enable_shared_from_this<IVariableStateInternal> {
21 public:
22  /**
23  * @brief A shared pointer to a IVariableStateInternal interface
24  */
25  using Ptr = std::shared_ptr<IVariableStateInternal>;
26 
27  explicit IVariableStateInternal(const std::string& name);
28 
29  /**
30  * @brief Gets a variable state name
31  * @return A string representing variable state name
32  */
33  virtual std::string GetName() const;
34 
35  /**
36  * @brief Reset internal variable state for relevant infer request, to a value specified as
37  * default for according `ReadValue` node
38  */
39  virtual void Reset();
40 
41  /**
42  * @brief Sets the new state for the next inference
43  * @param newState A new state
44  */
45  virtual void SetState(const Blob::Ptr& newState);
46 
47  /**
48  * @brief Returns the value of the variable state.
49  * @return The value of the variable state
50  */
51  virtual Blob::CPtr GetState() const;
52 
53  /**
54  * @deprecated Use IVariableStateInternal::GetState method instead
55  * @brief Returns the value of the variable state.
56  * @return The value of the variable state
57  */
58  INFERENCE_ENGINE_DEPRECATED("Use IVariableStateInternal::GetState method instead")
59  virtual Blob::CPtr GetLastState() const;
60 
61 protected:
62  /**
63  * @brief A default dtor
64  */
65  ~IVariableStateInternal() = default;
66 
67  std::string name;
68  Blob::Ptr state;
69 };
70 
71 /**
72  * @brief For compatibility reasons.
73  */
75 
76 /**
77  * @brief SOPointer to IVariableStateInternal.
78  */
80 
81 /**
82  * @brief For compatibility reasons.
83  */
85 
86 } // namespace InferenceEngine
std::shared_ptr< const Blob > CPtr
std::shared_ptr< Blob > Ptr
Minimal interface for variable state implementation.
Definition: ie_ivariable_state_internal.hpp:20
virtual void Reset()
Reset internal variable state for relevant infer request, to a value specified as default for accordi...
virtual std::string GetName() const
Gets a variable state name.
std::shared_ptr< IVariableStateInternal > Ptr
A shared pointer to a IVariableStateInternal interface.
Definition: ie_ivariable_state_internal.hpp:25
virtual Blob::CPtr GetState() const
Returns the value of the variable state.
virtual void SetState(const Blob::Ptr &newState)
Sets the new state for the next inference.
Inference Engine Plugin API namespace.
details::SOPointer< IVariableStateInternal > SoIVariableStateInternal
SOPointer to IVariableStateInternal.
Definition: ie_ivariable_state_internal.hpp:79
Serializes a std::vector to a std::ostream
Definition: debug.h:35