• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2 * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 #ifndef EXAM_H
16 #define EXAM_H
17 
18 #include <mutex>
19 #include <thread>
20 #include <unordered_map>
21 #include <string>
22 
23 using std::string;
24 
25 namespace OHOS {
26 namespace Example {
27 class Basic {
28 public:
29     std::string basicName;
30 
getBasicId()31     int getBasicId()
32     {
33         return this->basicId;
34     }
setBasicId(int id)35     void setBasicId (int id)
36     {
37         this->basicId = id;
38     }
39 
40 private:
41     int basicId;
42 };
43 
44 class Human : public Basic {
45 public:
getOpFlag()46     bool getOpFlag()
47     {
48         return this->opFlag;
49     };
setOpFlag(bool flag)50     void setOpFlag (bool flag)
51     {
52         this->opFlag = flag;
53     };
getOpDesc()54     std::string getOpDesc()
55     {
56         return this->opDesc;
57     };
setOpDesc(std::string desc)58     void setOpDesc(std::string desc)
59     {
60         this->opDesc = desc;
61     };
getOpSeqId()62     int getOpSeqId()
63     {
64         return this->opSeqId;
65     };
setOpSeqId(int id)66     void setOpSeqId(int id)
67     {
68         opSeqId = id;
69     };
70 
71     std::string opName;
72     int age = 0;
73 private:
74     bool opFlag;
75     std::string opDesc;
76     int opSeqId;
77 }
78 
79 struct Book {
getCcBook80     int getCc()
81     {
82         return this->cc;
83     };
setCcBook84     void setCc(int cc)
85     {
86         this->cc = cc;
87     };
getBasicObjBook88     Basic getBasicObj()
89     {
90         return this->basicObj;
91     };
setBasicObjBook92     void setBasicObj(Basic obj)
93     {
94         this->basicObj = obj;
95     };
96 public:
97     int aa;
98     bool bb;
99     Basic direcObj;
100 private:
101     int cc;
102     Basic basicObj;
103 }
104 
105 /**
106  * @brief service服务,提供IPC调用接口
107  * @ServiceClass
108  */
109 class Exam2 {
110 public:
111     Book getBook(Basic& basic);
112     int fun1 (Book v1);
113     int fun2 (Basic& basic, Human& human);
114 };
115 }  // namespace Example
116 }  // namespace OHOS
117 #endif  // EXAM_H
118