-
Notifications
You must be signed in to change notification settings - Fork 116
Expand file tree
/
Copy pathComputerProgram.cpp
More file actions
78 lines (63 loc) · 1.93 KB
/
Copy pathComputerProgram.cpp
File metadata and controls
78 lines (63 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/* Runnable Computer Program
*
* From: https://github.com/PokemonAutomation/
*
*/
#include "Common/Cpp/Json/JsonValue.h"
#include "ComputerProgram.h"
#include "ComputerPrograms/Framework/ComputerProgramSession.h"
namespace PokemonAutomation{
ComputerProgramDescriptor::ComputerProgramDescriptor(
std::string identifier,
std::string category, std::string display_name,
std::string doc_link,
std::string description
)
: ProgramDescriptor(
COLOR_DARKCYAN,
std::move(identifier),
std::move(category), std::move(display_name),
std::move(doc_link),
std::move(description)
)
{}
std::unique_ptr<PanelSession> ComputerProgramDescriptor::make_panel() const{
return std::unique_ptr<PanelSession>(new ComputerProgramSession(*this));
}
ComputerProgramInstance::ComputerProgramInstance()
: m_options(LockMode::LOCK_WHILE_RUNNING)
, NOTIFICATION_PROGRAM_FINISH(
"Program Finished",
true, true,
ImageAttachmentMode::JPG,
{"Notifs"}
)
, NOTIFICATION_ERROR_RECOVERABLE(
"Program Error (Recoverable)",
true, false,
ImageAttachmentMode::PNG,
{"Notifs"}
)
, NOTIFICATION_ERROR_FATAL(
"Program Error (Fatal)",
true, true,
ImageAttachmentMode::PNG,
{"Notifs"}
)
{}
void ComputerProgramInstance::add_option(ConfigOption& option, std::string serialization_string){
m_options.add_option(option, std::move(serialization_string));
}
JsonValue ComputerProgramInstance::to_json() const{
return m_options.to_json();
}
void ComputerProgramInstance::load_json(const JsonValue& json){
m_options.load_json(json);
}
std::string ComputerProgramInstance::check_validity() const{
return m_options.check_validity();
}
void ComputerProgramInstance::restore_defaults(){
return m_options.restore_defaults();
}
}