Imported Upstream version 1.7.0
[platform/core/ml/nnfw.git] / compiler / souschef / include / souschef / DataChef.h
1 /*
2  * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *    http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef __SOUSCHEF_DATA_CHEF_H__
18 #define __SOUSCHEF_DATA_CHEF_H__
19
20 #include "Arguments.h"
21
22 #include <cstdint>
23 #include <memory>
24 #include <vector>
25
26 namespace souschef
27 {
28
29 using Data = std::vector<uint8_t>;
30
31 /**
32  * @brief Data Generator
33  */
34 struct DataChef
35 {
36   virtual ~DataChef() = default;
37
38   // TODO Allow users to query the type of elements that this DataChef generates
39
40   /**
41    * @brief Generate a sequence of 'count' elements as a byte sequence
42    *
43    * Let D be the return value of generate(N).
44    * Then, D.size() == N * sizeof(T) where T is the element type.
45    */
46   virtual Data generate(int32_t count) const = 0;
47 };
48
49 /**
50  * @brief Data Generator Factory
51  */
52 struct DataChefFactory
53 {
54   virtual ~DataChefFactory() = default;
55
56   virtual std::unique_ptr<DataChef> create(const Arguments &args) const = 0;
57 };
58
59 } // namespace souschef
60
61 #endif // __SOUSCHEF_DATA_CHEF_H__