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 bool setNoKernelRequirements() = 0; 42 virtual void setOutputMatrix() = 0; 43 virtual bool assemble() = 0; 44 45 bool openOutFile(const std::string& path); 46 bool openInFile(const std::string& path); 47 bool openCheckFile(const std::string& path); 48 bool addKernel(const std::string& kernelArg); 49 50 virtual std::ostream& setOutputStream(Ostream&&) = 0; 51 virtual std::istream& addInputStream(const std::string& name, Istream&&) = 0; 52 virtual std::istream& setCheckInputStream(Istream&&) = 0; 53 virtual std::istream& addKernelConfigInputStream(const KernelVersion& kernelVer, 54 const std::string& name, Istream&& in) = 0; 55 virtual void setFakeEnv(const std::string& key, const std::string& value) = 0; 56 57 protected: 58 virtual bool hasKernelVersion(const KernelVersion&) const = 0; 59 virtual std::string getEnv(const std::string& key) const = 0; 60 }; 61 62 } // namespace vintf 63 } // namespace android 64 #endif // ANDROID_VINTF_ASSEMBLE_VINTF_H 65