Android-cuttlefish cvd tool
command_source.h
Go to the documentation of this file.
1//
2// Copyright (C) 2019 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_view>
20#include <utility>
21#include <vector>
22
23#include "fruit/fruit.h"
24
28
29namespace cuttlefish {
30
31enum class ProcessCategory {
34 kVmm,
35};
36
37inline constexpr std::string_view format_as(ProcessCategory category) {
38 switch (category) {
40 return "vmm";
42 return "critical support";
44 return "non-critical support";
45 }
46}
47
48inline std::ostream& operator<<(std::ostream& out, ProcessCategory category) {
49 return out << format_as(category);
50}
51
56
58 : command(std::move(command)),
62
64 : command(std::move(command)),
67};
68
69class CommandSource : public virtual SetupFeature {
70 public:
71 virtual ~CommandSource() = default;
73};
74
76 public:
78};
79
80} // namespace cuttlefish
Definition: command_source.h:69
virtual ~CommandSource()=default
virtual Result< std::vector< MonitorCommand > > Commands()=0
Definition: command.h:38
Definition: feature.h:48
Definition: command_source.h:75
virtual Result< void > WaitForAvailability()=0
Definition: alloc_driver.h:21
ProcessCategory
Definition: command_source.h:31
std::ostream & operator<<(std::ostream &out, DeviceType device_type)
Definition: device_type.cpp:73
tl::expected< T, StackTraceError< E > > Result
Definition: result_type.h:30
std::string_view format_as(DeviceType device_type)
Definition: device_type.cpp:77
Definition: command_source.h:52
ProcessCategory category
Definition: command_source.h:55
Command command
Definition: command_source.h:53
bool is_critical
Definition: command_source.h:54
MonitorCommand(Command command, ProcessCategory category)
Definition: command_source.h:63
MonitorCommand(Command command, bool is_critical=true)
Definition: command_source.h:57