/* * File: VieWID.h * Author: jgaebler * * Created on February 10, 2014, 8:19 PM */ #pragma once #ifndef VIEWID_H #define VIEWID_H #include "common/Reference.h" namespace ubeeme { namespace moversight { /** * @brief Identifies a view uniquely * @class ViewID * @ingroup Moversight * @author Jan Gäbler */ class ViewID : public Reference { public: /** * @brief Constructor */ ViewID() : Reference(0) { } /** * @brief Constructor * @param id The initial id */ ViewID(unsigned int id) : Reference(id) { } /** * @brief Copy constructor * @param orig The instance to copy */ ViewID(const ViewID & orig): Reference(orig){ operator=(orig); } /** * @brief Assignment operator * @param other The instance to assign * @return A reference to the local instance. */ ViewID & operator=(const ViewID & other){ if(this != &other){ Reference::operator =(other); } return *this; } /** * @brief Prefix-incrementation * @return A reference to the local instance. */ ViewID & operator++(){ //++a return static_cast(Reference::operator ++()); } /** * @brief Postfix-incrementation * @param Pseudo-param * @return The value of the local instance before the incrementation */ ViewID operator++(int){ //a++ ViewID result(*this); ++(*this); return result; } /** * @brief Less as operator * @param other The instance to compare to. * @return True, is the local instance less as the given, false otherwise. */ bool operator<(const ViewID & other) const { return value < other.value; } /** * @brief Less equal as operator * @param other The instance to compare to. * @return True, is the local instance less as or equal to the given, false otherwise. */ bool operator<=(const ViewID & other) const { return value <= other.value; } /** * @brief Greater as operator * @param other The instance to compare to. * @return True, is the local instance greater as the given, false otherwise. */ bool operator>(const ViewID & other) const { return value > other.value; } /** * @brief Greater equal as operator * @param other The instance to compare to. * @return True, is the local instance less as or equal to the given, false otherwise. */ bool operator>=(const ViewID & other) const { return value >= other.value; } }; /** * @brief The constant undefined view ID */ static const ViewID UNDEFINED_VIEW_ID = 0; /** * @brief The constant initial view ID */ static const ViewID INITIAL_VIEW_ID = UNDEFINED_VIEW_ID; } } #endif /* VIEWID_H */