/* * Copyright 2019 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_AUTOMOTIVE_COMPUTEPIPE_ROUTER_PIPE_HANDLE #define ANDROID_AUTOMOTIVE_COMPUTEPIPE_ROUTER_PIPE_HANDLE #include #include #include namespace android { namespace automotive { namespace computepipe { namespace router { /** * This abstracts the runner interface object and hides its * details from the inner routing logic. */ template class PipeHandle { public: explicit PipeHandle(std::unique_ptr intf) : mInterface(std::move(intf)) { } // Check if runner process is still alive virtual bool isAlive() = 0; // Start the monitor for the pipe virtual bool startPipeMonitor() = 0; // Any successful client lookup, clones this handle // The implementation must handle refcounting of remote objects // accordingly. virtual PipeHandle* clone() const = 0; // Retrieve the underlying remote IPC object std::shared_ptr getInterface() { return mInterface; } virtual ~PipeHandle() = default; protected: explicit PipeHandle(std::shared_ptr intf) : mInterface(intf){}; // Interface object std::shared_ptr mInterface; }; } // namespace router } // namespace computepipe } // namespace automotive } // namespace android #endif