Android-cuttlefish cvd tool
android_builds.h
Go to the documentation of this file.
1//
2// Copyright (C) 2025 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#pragma once
17
18#include <map>
19#include <memory>
20#include <string>
21#include <vector>
22
28
29namespace cuttlefish {
30
32 public:
33 static Result<AndroidBuilds> Identify(std::vector<AndroidBuildKey>);
34
35 AndroidBuild& ForIndex(size_t index);
36 const AndroidBuild& ForIndex(size_t index) const;
37
38 size_t Size() const;
39
40 // For libfmt
41 friend std::string format_as(const AndroidBuilds&);
42
44
45 private:
46 AndroidBuilds() = default;
47
48 std::vector<AndroidBuildKey> keys_;
49 std::map<AndroidBuildKey, std::unique_ptr<AndroidBuild>> builds_;
50};
51
52std::ostream& operator<<(std::ostream&, const AndroidBuilds&);
53
56
57} // namespace cuttlefish
Definition: android_build.h:48
Definition: android_builds.h:31
static Result< AndroidBuilds > Identify(std::vector< AndroidBuildKey >)
Definition: android_builds.cc:41
friend PrettyStruct Pretty(AndroidBuilds &, PrettyAdlPlaceholder)
Definition: android_builds.cc:92
std::map< AndroidBuildKey, std::unique_ptr< AndroidBuild > > builds_
Definition: android_builds.h:49
AndroidBuild & ForIndex(size_t index)
Definition: android_builds.cc:64
std::vector< AndroidBuildKey > keys_
Definition: android_builds.h:48
size_t Size() const
Definition: android_builds.cc:81
friend std::string format_as(const AndroidBuilds &)
Definition: android_builds.cc:87
Definition: struct.h:60
Definition: alloc_driver.h:20
PrettyStruct Pretty(AndroidBuild &build, PrettyAdlPlaceholder)
Definition: android_build.cc:72
tl::expected< T, StackTraceError > Result
Definition: result_type.h:30
std::ostream & operator<<(std::ostream &out, DeviceType device_type)
Definition: device_type.cpp:72
Definition: pretty.h:20