95 lines
2.3 KiB
C++
95 lines
2.3 KiB
C++
/*
|
|
* File: InvitationID.h
|
|
* Author: jgaebler
|
|
*
|
|
* Created on February 10, 2014, 8:10 PM
|
|
*/
|
|
#pragma once
|
|
|
|
#ifndef INVITATIONID_H
|
|
#define INVITATIONID_H
|
|
|
|
#include "common/Reference.h"
|
|
|
|
namespace ubeeme {
|
|
namespace moversight {
|
|
|
|
/**
|
|
* @brief Identifies a invitation uniquely
|
|
* @class InvitationID
|
|
* @ingroup Moversight
|
|
* @author Jan Gäbler
|
|
*/
|
|
class InvitationID : public Reference<unsigned int> {
|
|
public:
|
|
|
|
/**
|
|
* @brief Constructor
|
|
*/
|
|
InvitationID() : Reference<unsigned int>(0) {
|
|
}
|
|
|
|
/**
|
|
* @brief Constructor
|
|
* @param id The initial id
|
|
*/
|
|
InvitationID(unsigned int id) : Reference<unsigned int>(id) {
|
|
}
|
|
|
|
/**
|
|
* @brief Copy constructor
|
|
* @param orig The instance to copy
|
|
*/
|
|
InvitationID(const InvitationID & orig): Reference<unsigned int>(orig){
|
|
operator=(orig);
|
|
}
|
|
|
|
/**
|
|
* @brief Assignment operator
|
|
* @param other The instance to assign
|
|
* @return A reference to the local instance.
|
|
*/
|
|
InvitationID &
|
|
operator=(const InvitationID & other){
|
|
|
|
if(this != &other){
|
|
Reference<unsigned int>::operator =(other);
|
|
}
|
|
|
|
return *this;
|
|
}
|
|
|
|
/**
|
|
* @brief Prefix-incrementation
|
|
* @return A reference to the local instance.
|
|
*/
|
|
InvitationID & operator++(){ //++a
|
|
return static_cast<InvitationID&>(Reference<unsigned int>::operator ++());
|
|
}
|
|
|
|
/**
|
|
* @brief Postfix-incrementation
|
|
* @param Pseudo-param
|
|
* @return The value of the local instance before the incrementation
|
|
*/
|
|
InvitationID operator++(int){ //a++
|
|
InvitationID result(*this);
|
|
++(*this);
|
|
return result;
|
|
}
|
|
};
|
|
|
|
/**
|
|
* @brief The constant undefined invitation ID
|
|
*/
|
|
static const InvitationID UNDEFINED_INVITATION_ID = 0;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif /* INVITATIONID_H */
|
|
|