forked from rubinius/rubinius
-
Notifications
You must be signed in to change notification settings - Fork 0
/
agent_components.hpp
57 lines (45 loc) · 1.03 KB
/
agent_components.hpp
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
#ifndef RBX_WINDOWS
#include <sys/utsname.h>
#endif
#include "vm.hpp"
#include "configuration.hpp"
#include "call_frame.hpp"
#include "util/bert.hpp"
namespace rubinius {
namespace agent {
class Tree;
class Output {
bert::IOWriter& writer_;
bert::Encoder<bert::IOWriter> encoder_;
public:
Output(bert::IOWriter& writer_)
: writer_(writer_)
, encoder_(writer_)
{}
bert::Encoder<bert::IOWriter>& e() {
return encoder_;
}
void error(const char* reason) {
e().write_tuple(2);
e().write_atom("error");
e().write_binary(reason);
}
void ok(const char* kind) {
e().write_tuple(3);
e().write_atom("ok");
e().write_atom(kind);
}
};
class VariableAccess {
Tree* root_;
Tree* system_;
public:
VariableAccess(STATE, SharedState& ss);
~VariableAccess();
Tree* root() {
return root_;
}
bool read_path(Output& output, const char* ipath);
bool set_path(Output& output, const char* ipath, bert::Value* val);
};
}}