input = new ByPass();
output = new ByPass();
((ByPass *)output)->set_control(this);
+ updated = false;
}
Exclusa::~Exclusa()
void Exclusa::simulate()
{
- std::list<IConector *>::iterator i = in_list.begin();
- if (i != in_list.end()) {
- PlantItem *o = (PlantItem *)(*i);
- set_color( o->get_color() );
- }
#ifdef DEBUG
std::cout << name << ": " << ((is_open)?"Abierta":"Cerrada") << std::endl;
#endif
+
+ updated = false;
+ color_updated = false;
}
void Exclusa::recieve_msg(int msg, IConector *who, void *data)
{
switch (msg) {
case MSG_QUERY_MAX_FLOW_OUT:
+ if (updated) {
+ who->recieve_msg(MSG_RESPONSE_MAX_FLOW, this, &temp);
+ }
temp = *((float *)data);
if (!is_open) temp = 0;
send_msg(OUT, MSG_QUERY_MAX_FLOW_OUT, &temp);