Experimental Changes
[cs356-p1-elevator.git] / position.hpp
1 /*
2  * CS356 Project 01 -- Elevator Simulator
3  *
4  * Position Class Specification
5  */
6
7 #ifndef POSITION_HPP
8 #define POSITION_HPP
9
10 #include <iostream>
11
12 class Position
13 {
14         public:
15                 /*
16                  * PURPOSE: Construct a new Position object
17                  *
18                  * REQUIRE: Nothing
19                  *
20                  * PROMISE: A new Position object will be created, that
21                  * PROMISE: starts at position 0.
22                  */
23                 Position ();
24
25                 /*
26                  * PURPOSE: Construct a new Position object
27                  *
28                  * REQUIRE: Nothing
29                  *
30                  * PROMISE: A new Position object will be created, and will
31                  * PROMISE: start at position initial_position
32                  */
33                 Position (int initial_position);
34
35                 /*
36                  * PURPOSE: Compare two position objects
37                  *
38                  * REQUIRE: rhs is a valid Position object
39                  *
40                  * PROMISE: True if rhs is at the same position, false otherwise
41                  */
42                 bool operator== (const Position& rhs);
43
44                 /*
45                  * PURPOSE: Compare a Position and a float
46                  *
47                  * REQUIRE: Nothing
48                  *
49                  * PROMISE: True if rhs is within 0.05 of this Position
50                  */
51                 bool operator== (const int rhs);
52
53                 /*
54                  * PURPOSE: Add to this Position
55                  *
56                  * REQUIRE: Nothing
57                  *
58                  * PROMISE: This Position will have the rhs added to it
59                  */
60                 Position& operator+= (const float rhs);
61
62                 /*
63                  * PURPOSE: Subtract from this Position
64                  *
65                  * REQUIRE: Nothing
66                  *
67                  * PROMISE: This Position will have the rhs added to it
68                  */
69                 Position& operator-= (const float rhs);
70
71                 bool operator< (const Position& rhs);
72                 bool operator> (const Position& rhs);
73
74                 friend std::ostream& operator<< (std::ostream& os, Position& rhs);
75
76         protected:
77                 int _major;
78                 int _minor;
79
80         private:
81 };
82
83 #endif /* POSITION_HPP */
84
85 /* vim: set ts=4 sts=4 sw=4 noexpandtab textwidth=112: */