Files
scandocs/uni/masterarbeit/source/moversight/app/PeerDescription.cc
2014-06-30 13:58:10 +02:00

87 lines
2.2 KiB
C++

/*
* File: PeerDescription.cc
* Author: jgaebler
*
* Created on July 23, 2013, 4:00 PM
*/
#include "PeerDescription.h"
namespace ubeeme {
namespace moversight {
/**
* @brief Output operator
* @param s The stream to output
* @param pDesc The description to add to the output.
* @return The resulting output stream.
*/
std::ostream & operator<<(std::ostream & s, const PeerDescription & pDesc) {
s << pDesc.getDescription();
return s;
}
/**
* @brief Default Constructor
*/
PeerDescription::PeerDescription() : desc("dummy@moversight.org") {
}
/**
* @brief Constructor. Creates a new instance using the given string as description for the peer.
* @param d The string to use as peer description.
*/
PeerDescription::PeerDescription(const std::string & d) : desc(d) {
}
/**
* @brief Copy constructor
* @param other The instance to copy
*/
PeerDescription::PeerDescription(const PeerDescription & other) {
operator=(other);
}
/**
* @brief Destructor
*/
PeerDescription::~PeerDescription() {
}
/**
* @brief Returns a description of the given peer as string representation
* @returns A textual representation of the current peer description.
*/
std::string
PeerDescription::getDescription() const {
return desc;
}
/**
* @brief Serialization method
* @param archive the source and destination respectively of the serialization process.
*/
void
PeerDescription::set(Archive & archive) {
archive(desc);
}
/**
* @brief Assignment operator
* @param other The instance to assign
* @return A reference to the local object
*/
PeerDescription &
PeerDescription::operator=(const PeerDescription & other) {
if (this != &other) {
desc = other.desc;
}
return *this;
}
}
}