ie_layer_decorator.hpp
1 // Copyright (C) 2018-2019 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4 
5 #pragma once
6 
7 #include <builders/ie_layer_builder.hpp>
8 #include <string>
9 #include <vector>
10 
11 namespace InferenceEngine {
12 
13 /**
14  * @brief Neural network builder API
15  */
16 namespace Builder {
17 
18 /**
19  * @brief This class defines the basic functional for layer builders
20  */
21 class INFERENCE_ENGINE_API_CLASS(LayerDecorator) {
22 public:
23  /**
24  * @brief The constructor creates layer builders with layer type and layer name
25  * @param type Layer type
26  * @param name Layer name
27  */
28  LayerDecorator(const std::string& type, const std::string& name);
29  /**
30  * @brief The constructor creates layer builders from reference to generic layer builder
31  * @param layer pointer to generic layer builder
32  */
33  explicit LayerDecorator(const Layer::Ptr& layer);
34  /**
35  * @brief The constructor creates layer builders from reference to generic layer builder
36  * @param layer constant pointer to generic layer builder
37  */
38  explicit LayerDecorator(const Layer::CPtr& layer);
39  /**
40  * @brief The copy constructor
41  * @param rval Source builder
42  */
43  LayerDecorator(const LayerDecorator& rval);
44 
45  /**
46  * @brief Copy operator for LayerDecorator
47  * @param rval
48  * @return Layer builder
49  */
50  LayerDecorator& operator=(const LayerDecorator& rval);
51 
52  /**
53  * @brief Virtual destructor
54  */
55  virtual ~LayerDecorator() = default;
56 
57  /**
58  * @brief The operator creates generic builder
59  * @return Generic builder
60  */
61  virtual operator Layer() const;
62 
63  /**
64  * @brief The operator creates generic builder
65  * @return Pointer to generic builder
66  */
67  virtual operator Layer::Ptr();
68 
69  /**
70  * @brief The operator creates generic builder
71  * @return Constant pointer to generic builder
72  */
73  virtual operator Layer::CPtr() const;
74 
75  /**
76  * @brief Returns layer type
77  * @return Layer type
78  */
79  const std::string& getType() const;
80  /**
81  * @brief Returns layer name
82  * @return Layer name
83  */
84  const std::string& getName() const;
85 
86 protected:
87  Layer::Ptr& getLayer();
88  const Layer::CPtr getLayer() const;
89  void checkType(const std::string& type) const;
90 
91  Layer::CPtr cLayer;
92 
93 private:
94  Layer::Ptr layer;
95 };
96 
97 } // namespace Builder
98 
99 } // namespace InferenceEngine
This class implements a builder for IE Layer.
Definition: ie_layer_builder.hpp:34
Inference Engine API.
Definition: ie_argmax_layer.hpp:11
std::shared_ptr< const Layer > CPtr
A shared pointer to the constant Layer builder.
Definition: ie_layer_builder.hpp:44
This class defines the basic functional for layer builders.
Definition: ie_layer_decorator.hpp:21
std::shared_ptr< Layer > Ptr
A shared pointer to the Layer builder.
Definition: ie_layer_builder.hpp:40