Android-cuttlefish cvd tool
parse.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2023 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#pragma once
18
19#include <iostream>
20#include <optional>
21#include <string>
22#include <vector>
23
26
27namespace cuttlefish {
28
29enum class SnapshotCmd : int {
30 kUnknown = 0,
31 kSuspend = 1,
32 kResume = 2,
33 kSnapshotTake = 3,
34};
35
36std::ostream& operator<<(std::ostream& out, const SnapshotCmd& cmd);
37
38struct Parsed {
40 std::vector<int> instance_nums;
42 std::string snapshot_path;
44 // Delete snapshot_path if already present.
45 bool force = false;
46 // Suspend/resume before/after taking the snapshot.
47 //
48 // Ideally we'd detect the suspended state of CF and do this automatically by
49 // default.
50 bool auto_suspend = false;
51 std::optional<LogSeverity> verbosity_level;
52};
53Result<Parsed> Parse(int argc, char** argv);
54Result<Parsed> Parse(std::vector<std::string>& args);
55
56} // namespace cuttlefish
Definition: alloc_driver.h:20
SnapshotCmd
Definition: parse.h:29
tl::expected< T, StackTraceError > Result
Definition: result_type.h:30
std::ostream & operator<<(std::ostream &out, DeviceType device_type)
Definition: device_type.cpp:72
Result< Parsed > Parse(int argc, char **argv)
Definition: parse.cc:74
@ kSuspend
Definition: suspend_resume_handler.h:50
@ kResume
Definition: suspend_resume_handler.h:52
Definition: parse.h:38
SnapshotCmd cmd
Definition: parse.h:39
bool force
Definition: parse.h:45
int wait_for_launcher
Definition: parse.h:41
std::string snapshot_path
Definition: parse.h:42
std::vector< int > instance_nums
Definition: parse.h:40
bool auto_suspend
Definition: parse.h:50
bool cleanup_snapshot_path
Definition: parse.h:43
std::optional< LogSeverity > verbosity_level
Definition: parse.h:51