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#include <string_view>
21
22#include "absl/strings/string_view.h"
23
24namespace cuttlefish {
25
26enum class Arch {
27 Arm,
28 Arm64,
29 RiscV64,
30 X86,
31 X86_64,
32};
33
34absl::string_view ArchToStringView(Arch);
35std::ostream& operator<<(std::ostream&, Arch);
36
37template <typename Sink>
38void AbslStringify(Sink& sink, Arch arch) {
39 sink.Append(ArchToStringView(arch));
40}
41
42// For libfmt
43std::string_view format_as(Arch);
44
45enum class Os {
46 Linux,
47 Unknown,
48};
49
50struct HostInfo {
53 std::string release;
54};
55
56const std::string& HostArchStr();
58bool IsHostCompatible(Arch arch);
60
61std::ostream& operator<<(std::ostream&, Os);
62
63} // namespace cuttlefish
#define X86_64
Definition: ffi.h:18
Definition: alloc_driver.h:21
void AbslStringify(Sink &sink, DeviceType device_type)
Definition: device_type.h:44
Os
Definition: host_info.h:45
Arch
Definition: host_info.h:26
const std::string & HostArchStr()
Definition: host_info.cpp:102
absl::string_view ArchToStringView(Arch arch)
Definition: host_info.cpp:80
Arch HostArch()
Definition: host_info.cpp:108
std::ostream & operator<<(std::ostream &out, DeviceType device_type)
Definition: device_type.cpp:73
HostInfo GetHostInfo()
Definition: host_info.cpp:110
std::string_view format_as(DeviceType device_type)
Definition: device_type.cpp:77
bool IsHostCompatible(Arch arch)
Definition: host_info.cpp:119
Definition: host_info.h:50
Os os
Definition: host_info.h:52
std::string release
Definition: host_info.h:53
Arch arch
Definition: host_info.h:51