Clio develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
MigratiorStatus.hpp
1//------------------------------------------------------------------------------
2/*
3 This file is part of clio: https://github.com/XRPLF/clio
4 Copyright (c) 2024, the clio developers.
5
6 Permission to use, copy, modify, and distribute this software for any
7 purpose with or without fee is hereby granted, provided that the above
8 copyright notice and this permission notice appear in all copies.
9
10 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17*/
18//==============================================================================
19
20#pragma once
21
22#include <array>
23#include <cstddef>
24#include <string>
25
26namespace migration {
27
32public:
36 enum Status { Migrated, NotMigrated, NotKnown, NumStatuses };
37
43 MigratorStatus(Status status) : status_(status)
44 {
45 }
46
53 bool
54 operator==(MigratorStatus const& other) const;
55
61 bool
62 operator==(Status const& other) const;
63
69 std::string
70 toString() const;
71
78 static MigratorStatus
79 fromString(std::string const& statusStr);
80
81private:
82 static constexpr std::array<char const*, static_cast<size_t>(NumStatuses)> kSTATUS_STR_MAP = {
83 "Migrated",
84 "NotMigrated",
85 "NotKnown"
86 };
87
88 Status status_;
89};
90} // namespace migration
The status of a migrator, it provides the helper functions to convert the status to string and vice v...
Definition MigratiorStatus.hpp:31
std::string toString() const
Convert the status to string.
Definition MigratorStatus.cpp:40
static MigratorStatus fromString(std::string const &statusStr)
Convert the string to status.
Definition MigratorStatus.cpp:46
Status
The status of a migrator.
Definition MigratiorStatus.hpp:36
MigratorStatus(Status status)
Construct a new Migrator Status object with the given status.
Definition MigratiorStatus.hpp:43
bool operator==(MigratorStatus const &other) const
Compare the status with another MigratorStatus.
Definition MigratorStatus.cpp:28