1 /* 2 * Copyright (c) 2021 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 #pragma once 16 #include <string> 17 #include <memory> 18 #include <vector> 19 20 namespace STtools { 21 using std::string; 22 class StOperator; 23 std::vector<string> SerializationStOperatorToVector(StOperator &ParentOperator); 24 void DeserializationStOperatorFromVector(StOperator &ParentOperator, std::vector<string> &vectorOperator); 25 class StOperator { 26 private: 27 std::vector<std::shared_ptr<StOperator>> g_childOperator; 28 std::shared_ptr<StOperator> g_parentOperator; 29 string g_abilityType; 30 string g_bundleName; 31 string g_abilityName; 32 string g_operatorName; // data ability 33 string g_message; 34 /* data */ 35 static int countChild; 36 37 public: 38 StOperator(); 39 StOperator(const string &type, const string &bundle, const string &ability, const string &operatorName = "", 40 const string &message = ""); 41 ~StOperator(); 42 static int GetCountChild(); 43 string GetAbilityType(); 44 StOperator &SetAbilityType(const string &type); 45 string GetBundleName(); 46 StOperator &SetBundleName(const string &bundleName); 47 string GetAbilityName(); 48 StOperator &SetAbilityName(const string &abilityName); 49 string GetOperatorName(); 50 StOperator &SetOperatorName(const string &operatorName); 51 string GetMessage(); 52 StOperator &SetMessage(const string &message); 53 StOperator &AddChildOperator(std::shared_ptr<StOperator> childOperator); 54 std::vector<std::shared_ptr<StOperator>> GetChildOperator(); 55 std::vector<std::shared_ptr<StOperator>> PopChildOperator(); 56 }; 57 } // namespace STtools 58