-
Notifications
You must be signed in to change notification settings - Fork 0
/
service_panel.cpp
46 lines (36 loc) · 994 Bytes
/
service_panel.cpp
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
/*atomic model service_panel*/
#include "service_panel.h"
#include "message.h"
#include "mainsimu.h"
#include "strutil.h"
ServicePanel::ServicePanel (const string &name)
: Atomic (name)
, service_in( addInputPort("service_in") )
, service_message_out ( addOutputPort("service_message_out") )
, preparationTime (0, 0, 5, 0)
{
string time(MainSimulator::Instance().getParameter(description(), "preparation"));
if (time!=" ")
preparationTime = time;
}
Model &ServicePanel::initFunction()
{
this->passivate();
return *this;
}
Model &ServicePanel::externalFunction( const ExternalMessage &msg)
{
message = msg.value();
this->holdIn (active, preparationTime);
return *this;
}
Model &ServicePanel::internalFunction ( const InternalMessage &)
{
this->passivate();
return *this;
}
Model &ServicePanel::outputFunction( const InternalMessage &msg)
{
this->sendOutput ( msg.time(), service_message_out, message );
return *this;
}