-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathclient.cpp
More file actions
67 lines (58 loc) · 1.25 KB
/
Copy pathclient.cpp
File metadata and controls
67 lines (58 loc) · 1.25 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
/*!
* define user init parameters
*/
#include <iostream>
#include "solver_run.h"
#include MPT_INCLUDE(client.h)
#include MPT_INCLUDE(config.h)
#include MPT_INCLUDE(event.h)
#include MPT_INCLUDE(solver.h)
class client : public mpt::client
{
public:
client()
{ }
virtual ~client()
{ }
int convert(mpt::type_t type, void *ptr) __MPT_OVERRIDE
{
std::cout << __func__ << " " << type << std::endl;
if (type == mpt::type_properties<mpt::config *>::id(true)) {
return mpt::BadType;
}
return client::convert(type, ptr);
}
void unref() __MPT_OVERRIDE
{
std::cout << __func__ << std::endl;
delete this;
}
client *clone() const __MPT_OVERRIDE
{
return nullptr;
}
int dispatch(mpt::event *ev) __MPT_OVERRIDE
{
if (!ev) {
std::cout << __func__ << " (term)" << std::endl;
return mpt::event::Terminate;
}
std::cout << __func__ << " (solver)" << std::endl;
return mpt::solver::mpt_solver_dispatch(this, ev);
}
int process(uintptr_t id, mpt::iterator *) __MPT_OVERRIDE
{
std::cout << __func__ << " " << id << std::endl;
if (!id) {
return mpt::event::Default;
}
return mpt::event::None;
}
};
int main(int argc, char * const argv[])
{
if (mpt::mpt_init(argc, argv) < 0) {
return 1;
}
return mpt::solver_run(new client);
}