/* * This file is part of the Owl Positioning System (OwlPS). * OwlPS is a project of the University of Franche-Comté * (Université de Franche-Comté), France. */ #ifndef _OWLPS_POSITIONING_DIRECTION_HH_ #define _OWLPS_POSITIONING_DIRECTION_HH_ #include /// \brief Represents a direction in which a mobile is when it sends a /// CalibrationRequest class Direction { protected: char direction ; void assert_valid(void) const ; bool is_valid(void) const ; public: enum {north = 1, east, south, west} ; Direction(void): direction(0) {} Direction(const char source) ; Direction(const Direction &source): direction(source.direction) {} /** @name Accessors */ //@{ void clear(void) ; //@} /** @name Operators */ //@{ Direction& operator=(const Direction &source) ; Direction& operator=(const char source) ; bool operator==(const Direction &source) const ; bool operator!=(const Direction &source) const ; operator bool(void) const ; operator int(void) const ; operator std::string(void) const ; //@} // Hashes a Direction friend size_t hash_value(const Direction &source) ; } ; /* *** Accessors *** */ inline void Direction::clear() { direction = 0 ; } /* *** Operators *** */ inline bool Direction::operator==(const Direction &source) const { return direction == source.direction ; } inline bool Direction::operator!=(const Direction &source) const { return !(*this == source) ; } inline Direction::operator bool() const { return is_valid() ; } inline Direction::operator int() const { return static_cast(direction) ; } #endif // _OWLPS_POSITIONING_DIRECTION_HH_