Home | History | Annotate | Download | only in vintf
      1 /*
      2  * Copyright (C) 2017 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 
     17 #ifndef ANDROID_VINTF_ASSEMBLE_VINTF_H
     18 #define ANDROID_VINTF_ASSEMBLE_VINTF_H
     19 
     20 #include <fstream>
     21 #include <iostream>
     22 #include <memory>
     23 #include <string>
     24 #include <vector>
     25 
     26 #include <vintf/Version.h>
     27 
     28 namespace android {
     29 namespace vintf {
     30 
     31 class AssembleVintf {
     32    public:
     33     using Ostream = std::unique_ptr<std::ostream>;
     34     using Istream = std::unique_ptr<std::istream>;
     35 
     36     static std::unique_ptr<AssembleVintf> newInstance();
     37 
     38     virtual ~AssembleVintf() = default;
     39     virtual bool setHalsOnly() = 0;
     40     virtual bool setNoHals() = 0;
     41     virtual void setOutputMatrix() = 0;
     42     virtual bool assemble() = 0;
     43 
     44     bool openOutFile(const std::string& path);
     45     bool openInFile(const std::string& path);
     46     bool openCheckFile(const std::string& path);
     47     bool addKernel(const std::string& kernelArg);
     48 
     49     virtual std::ostream& setOutputStream(Ostream&&) = 0;
     50     virtual std::istream& addInputStream(const std::string& name, Istream&&) = 0;
     51     virtual std::istream& setCheckInputStream(Istream&&) = 0;
     52     virtual std::istream& addKernelConfigInputStream(const KernelVersion& kernelVer,
     53                                                      const std::string& name, Istream&& in) = 0;
     54     virtual void setFakeEnv(const std::string& key, const std::string& value) = 0;
     55 
     56    protected:
     57     virtual bool hasKernelVersion(const KernelVersion&) const = 0;
     58     virtual std::string getEnv(const std::string& key) const = 0;
     59 };
     60 
     61 }  // namespace vintf
     62 }  // namespace android
     63 #endif  // ANDROID_VINTF_ASSEMBLE_VINTF_H
     64