Android-cuttlefish cvd tool
host_info.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2018 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 <ostream>
19#include <string>
20
21namespace cuttlefish {
22
23enum class Arch {
24 Arm,
25 Arm64,
26 RiscV64,
27 X86,
28 X86_64,
29};
30
31std::string_view ArchToStringView(Arch);
32std::ostream& operator<<(std::ostream&, Arch);
33
34template <typename Sink>
35void AbslStringify(Sink& sink, Arch arch) {
36 sink.Append(ArchToStringView(arch));
37}
38
39// For libfmt
40std::string_view format_as(Arch);
41
42enum class Os {
43 Linux,
44 Unknown,
45};
46
47struct HostInfo {
50 std::string release;
51};
52
53const std::string& HostArchStr();
55bool IsHostCompatible(Arch arch);
57
58std::ostream& operator<<(std::ostream&, Os);
59
60} // namespace cuttlefish
#define X86_64
Definition: ffi.h:18
Definition: alloc_driver.h:20
void AbslStringify(Sink &sink, DeviceType device_type)
Definition: device_type.h:42
Os
Definition: host_info.h:42
Arch
Definition: host_info.h:23
std::string_view ArchToStringView(Arch arch)
Definition: host_info.cpp:79
const std::string & HostArchStr()
Definition: host_info.cpp:101
Arch HostArch()
Definition: host_info.cpp:107
std::ostream & operator<<(std::ostream &out, DeviceType device_type)
Definition: device_type.cpp:72
HostInfo GetHostInfo()
Definition: host_info.cpp:109
std::string_view format_as(DeviceType device_type)
Definition: device_type.cpp:76
bool IsHostCompatible(Arch arch)
Definition: host_info.cpp:118
Definition: host_info.h:47
Os os
Definition: host_info.h:49
std::string release
Definition: host_info.h:50
Arch arch
Definition: host_info.h:48