1 /**
2  * Copyright 2019 The Android Open Source Project
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 #ifndef ANDROID_AUTOMOTIVE_COMPUTEPIPE_ROUTER_V1_0_ROUTERSVC
17 #define ANDROID_AUTOMOTIVE_COMPUTEPIPE_ROUTER_V1_0_ROUTERSVC
18 
19 #include "PipeQuery.h"
20 #include "PipeRegistration.h"
21 
22 namespace android {
23 namespace automotive {
24 namespace computepipe {
25 namespace router {
26 namespace V1_0 {
27 namespace implementation {
28 
29 namespace router = android::automotive::computepipe::router;
30 
31 class RouterRegistry : public router::PipeRegistry<PipeRunner> {
getDebuggerPipeHandle(const std::string & name)32     std ::unique_ptr<PipeHandle<PipeRunner>> getDebuggerPipeHandle(const std::string& name) {
33         return getPipeHandle(name, nullptr);
34     }
RemoveEntry(const std::string & name)35     Error RemoveEntry(const std::string& name) {
36         return DeletePipeHandle(name);
37     }
38 };
39 
40 class RouterSvc {
41   public:
42     router::Error initSvc();
43     router::Error parseArgs(int argc, char** argv);
getSvcName()44     std::string getSvcName() {
45         return mSvcName;
46     }
47 
48   private:
49     router::Error initQueryEngine();
50     router::Error initRegistrationEngine();
51 
52     std::string mSvcName = "ComputePipeRouter";
53     std::shared_ptr<PipeQuery> mQueryEngine;
54     std::shared_ptr<PipeRegistration> mRegisterEngine;
55     std::shared_ptr<RouterRegistry> mRegistry;
56 };
57 }  // namespace implementation
58 }  // namespace V1_0
59 }  // namespace router
60 }  // namespace computepipe
61 }  // namespace automotive
62 }  // namespace android
63 #endif
64