• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef AA_STOPERATOR_H
17 #define AA_STOPERATOR_H
18 
19 #include <vector>
20 
21 namespace STtools {
22 using std::string;
23 class StOperator;
24 
25 std::vector<string> SerializationStOperatorToVector(StOperator &ParentOperator);
26 
27 void DeserializationStOperatorFromVector(StOperator &ParentOperator, std::vector<string> &vectorOperator);
28 
29 class StOperator {
30 public:
31     StOperator();
32     StOperator(const string &type, const string &bundle, const string &ability, const string &operatorName = "",
33         const string &message = "");
34     ~StOperator();
35     static int GetCountChild();
36     string GetAbilityType();
37     StOperator &SetAbilityType(const string &type);
38     string GetBundleName();
39     StOperator &SetBundleName(const string &bundleName);
40     string GetAbilityName();
41     StOperator &SetAbilityName(const string &abilityName);
42     string GetOperatorName();
43     StOperator &SetOperatorName(const string &operatorName);
44     string GetMessage();
45     StOperator &SetMessage(const string &message);
46     StOperator &AddChildOperator(std::shared_ptr<StOperator> childOperator);
47     std::vector<std::shared_ptr<StOperator>> GetChildOperator();
48     std::vector<std::shared_ptr<StOperator>> PopChildOperator();
49 
50 private:
51     std::vector<std::shared_ptr<StOperator>> g_childOperator;
52     std::shared_ptr<StOperator> g_parentOperator;
53     string g_abilityType;
54     string g_bundleName;
55     string g_abilityName;
56     string g_operatorName;  // data ability
57     string g_message;
58     /* data */
59     static int countChild;
60 };
61 } // namespace STtools
62 #endif // AA_STOPERATOR_H