Subversion Repositories programming

Rev

Rev 321 | Rev 329 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 321 Rev 328
Line 19... Line 19...
19
    this->terminate = false;
19
    this->terminate = false;
20
    this->pause = false;
20
    this->pause = false;
21
    this->direction = IDLE;
21
    this->direction = IDLE;
22
    this->current_floor = 1.0;
22
    this->current_floor = 1.0;
23
 
23
 
24
    this->stop_at_floors = vector<bool> (num_floors+1, false);
24
    this->stop_at_floors = std::vector<bool> (num_floors+1, false);
25
}
25
}
26
 
26
 
27
Elevator::~Elevator ()
27
Elevator::~Elevator ()
28
{
28
{
29
    this->pause = false;
29
    this->pause = false;
Line 97... Line 97...
97
            usleep (ELEVATOR_TIME_PAUSE_USEC);
97
            usleep (ELEVATOR_TIME_PAUSE_USEC);
98
        }
98
        }
99
 
99
 
100
        pthis->run_elevator_logic ();
100
        pthis->run_elevator_logic ();
101
 
101
 
102
        cout << "Current Elevator Position: " << pthis->current_floor << endl;
102
        std::cout << "Current Elevator Position: " << pthis->current_floor << std::endl;
103
        usleep (ELEVATOR_TIME_DELAY_USEC);
103
        usleep (ELEVATOR_TIME_DELAY_USEC);
104
    }
104
    }
105
}
105
}
106
 
106
 
107
void Elevator::run_elevator_logic ()
107
void Elevator::run_elevator_logic ()
Line 277... Line 277...
277
            return true;
277
            return true;
278
 
278
 
279
    return false;
279
    return false;
280
}
280
}
281
 
281
 
-
 
282
bool Elevator::button_is_pushed (int floor)
-
 
283
{
-
 
284
    assert (floor <= num_floors);
-
 
285
    assert (floor > 0);
-
 
286
 
-
 
287
    return stop_at_floors[floor];
-
 
288
}
-
 
289
 
-
 
290
float Elevator::get_current_floor ()
-
 
291
{
-
 
292
    return current_floor;
-
 
293
}
-
 
294