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
25
27
28namespace cuttlefish {
29
30enum class SnapshotCmd : int {
31 kUnknown = 0,
32 kSuspend = 1,
33 kResume = 2,
34 kSnapshotTake = 3,
35};
36
37std::ostream& operator<<(std::ostream& out, const SnapshotCmd& cmd);
38
39struct Parsed {
41 std::vector<int> instance_nums;
43 std::string snapshot_path;
45 // Delete snapshot_path if already present.
46 bool force = false;
47 // Suspend/resume before/after taking the snapshot.
48 //
49 // Ideally we'd detect the suspended state of CF and do this automatically by
50 // default.
51 bool auto_suspend = false;
52 std::optional<android::base::LogSeverity> verbosity_level;
53};
54Result<Parsed> Parse(int argc, char** argv);
55Result<Parsed> Parse(std::vector<std::string>& args);
56
57} // namespace cuttlefish
Definition: expected.h:86
Definition: alloc_utils.cpp:23
SnapshotCmd
Definition: parse.h:30
std::ostream & operator<<(std::ostream &out, Arch arch)
Definition: architecture.cpp:67
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:39
std::optional< android::base::LogSeverity > verbosity_level
Definition: parse.h:52
SnapshotCmd cmd
Definition: parse.h:40
bool force
Definition: parse.h:46
int wait_for_launcher
Definition: parse.h:42
std::string snapshot_path
Definition: parse.h:43
std::vector< int > instance_nums
Definition: parse.h:41
bool auto_suspend
Definition: parse.h:51
bool cleanup_snapshot_path
Definition: parse.h:44