12110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie/*
22110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie * Copyright (C) 2015 The Android Open Source Project
32110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie *
42110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie * Licensed under the Apache License, Version 2.0 (the "License");
52110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie * you may not use this file except in compliance with the License.
62110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie * You may obtain a copy of the License at
72110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie *
82110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie *      http://www.apache.org/licenses/LICENSE-2.0
92110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie *
102110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie * Unless required by applicable law or agreed to in writing, software
112110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie * distributed under the License is distributed on an "AS IS" BASIS,
122110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
132110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie * See the License for the specific language governing permissions and
142110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie * limitations under the License.
152110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie */
162110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie
172110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie#pragma once
182110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie
192110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffieclass AudioPolicyManagerInterface;
202110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie
212110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffienamespace android
222110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie{
232110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffienamespace audio_policy
242110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie{
252110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie
262110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffieclass Engine;
272110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie
282110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffieclass EngineInstance
292110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie{
302110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffieprotected:
312110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie    EngineInstance();
322110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie
332110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffiepublic:
342110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie    virtual ~EngineInstance();
352110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie
362110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie    /**
372110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie     * Get Audio Policy Engine instance.
382110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie     *
392110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie     * @return pointer to Route Manager Instance object.
402110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie     */
412110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie    static EngineInstance *getInstance();
422110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie
432110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie    /**
442110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie     * Interface query.
452110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie     * The first client of an interface of the policy engine will start the singleton.
462110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie     *
472110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie     * @tparam RequestedInterface: interface that the client is wishing to retrieve.
482110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie     *
492110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie     * @return interface handle.
502110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie     */
512110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie    template <class RequestedInterface>
522110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie    RequestedInterface *queryInterface() const;
532110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie
542110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffieprotected:
552110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie    /**
562110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie     * Get Audio Policy Engine instance.
572110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie     *
582110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie     * @return Audio Policy Engine singleton.
592110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie     */
602110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie    Engine *getEngine() const;
612110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie
622110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffieprivate:
632110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie    /* Copy facilities are put private to disable copy. */
642110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie    EngineInstance(const EngineInstance &object);
652110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie    EngineInstance &operator=(const EngineInstance &object);
662110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie};
672110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie
682110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie/**
692110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie * Limit template instantation to supported type interfaces.
702110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie * Compile time error will claim if invalid interface is requested.
712110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie */
722110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffietemplate <>
732110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois GaffieAudioPolicyManagerInterface *EngineInstance::queryInterface() const;
742110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie
752110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie} // namespace audio_policy
762110e04cdfbf9ad85ce154ce5f778ee5ccfc95ebFrançois Gaffie} // namespace android
77