Subversion Repositories programming

Rev

Rev 329 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 329 Rev 331
Line 1... Line 1...
1
#include <cstdio>
1
#include <cstdio>
2
#include <unistd.h>
2
#include <unistd.h>
3
using namespace std;
3
using namespace std;
4
 
4
 
5
#include <boost/thread/thread.hpp>
-
 
6
#include <boost/bind.hpp>
-
 
7
 
-
 
8
#include "controller.h"
5
#include "controller.h"
9
#include "elevator.h"
6
#include "elevator.h"
10
 
7
 
11
int main (int argc, char *argv[])
8
int main (int argc, char *argv[])
12
{
9
{
13
    int i = 0;
10
    int i = 0;
14
    //Elevator e1 (10);
-
 
15
    Controller c (10, 5);
11
    Controller c (10, 5);
16
 
12
 
17
    vector<Elevator> elevators (5, Elevator (10));
-
 
18
 
-
 
19
    elevators[1].thread_start ();
13
    c.start_all_elevators ();
20
    //elevators[2].thread_start ();
-
 
21
 
-
 
22
    // do some useful stuff here
-
 
23
    sleep (2);
14
    sleep (2);
24
    elevators[1].push_button (4);
15
    c.request_elevator (4, MOVE_UP);
-
 
16
    sleep (1);
25
    //elevators[2].push_button (8);
17
    c.request_elevator (4, MOVE_UP);
-
 
18
    sleep (1);
26
    //elevators[2].push_button (2);
19
    c.request_elevator (4, MOVE_UP);
27
    sleep (24);
20
    sleep (10);
28
 
-
 
29
    elevators[1].thread_exit ();
21
    c.request_elevator (2, MOVE_DOWN);
-
 
22
    sleep (20);
30
    //elevators[2].thread_exit ();
23
    c.stop_all_elevators ();
31
 
-
 
32
 
24
 
33
    return 0;
25
    return 0;
34
}
26
}
35
 
27