dol: initial dol commit
[jump.git] / dol / src / dol / visitor / hdsd / scd / fsm / scd_sts_init.cpp
1 #include "fsm/scd_sts_init.h"
2
3 #include "scd_logging.h"
4 #include "scd_exception.h"
5 #include "scd_cont_man_slave.h"
6
7
8 void scd_sts_init::set_failed()
9 {
10     _fsm.set_state(_st_failed);
11 }
12
13
14 void scd_sts_init::set_idle(const sc_core::sc_time& time)
15 {
16     scd_error("init: illegal call to set_idle()");
17     throw scd_exception("illegal call");
18 }
19
20
21 void scd_sts_init::set_busy()
22 {
23     scd_error("init: illegal call to set_busy()");
24     throw scd_exception("illegal call");
25 }
26
27
28 void scd_sts_init::set_done()
29 {
30     scd_error("init: illegal call to set_done()");
31     throw scd_exception("illegal call");
32 }
33
34
35 void scd_sts_init::set_fail()
36 {
37     _fsm.set_state(_st_failed);
38 }
39
40
41 void scd_sts_init::process()
42 {
43     _connector.process();
44
45     if (!_connector.is_connecting() && !_connector.has_connection())
46     {
47         // unable to connect to master
48         scd_error("connecting to master failed");
49         _fsm.set_state(_st_failed);
50     }
51     else if (!_connector.is_connecting() && _connector.has_connection())
52     {
53         // successfully connected to master
54         scd_info("connected to master");
55         _fsm.set_socket();
56         _sim.get_poller().register_handler(_fsm, SOCK_EV_READ | SOCK_EV_CLOSE);
57         _fsm.set_state(_st_busy);
58     }
59
60 } // process()
61
62
63 bool scd_sts_init::active() const { return false; }
64
65
66 bool scd_sts_init::advance_time() const
67 {
68     scd_error("illegal call to advance_time()");
69     throw scd_exception("illegal call");
70 }