/*
* Copyright (C) 2015 by Multi-Tech Systems
*
* This file is part of libmts.
*
* libmts is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* libmts is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libmts. If not, see .
*
*/
/*! \file MTS_Subscriber.h
\brief An abstract subscriber
\date 28MAR12
\author Sean Godinez
A subscriber.
*/
#ifndef _MTS_SUBSCRIBER_H_
#define _MTS_SUBSCRIBER_H_
#include
#include
namespace MTS {
//! An abstract subscriber
/*!
A template abstract subscriber class
\sa Publisher
*/
template class Subscriber: NonCopyable {
public:
virtual ~Subscriber(); //!< Destructs subscriber
const std::string& getName() const; //!< Returns name
virtual void update(const T& object) = 0; //!< Updates subscriber
protected:
explicit Subscriber(const std::string& name = ""); //!< Protected Constructor
private:
const std::string m_sName; //!< Name of subscriber
};
template Subscriber::Subscriber(const std::string& name)
: m_sName(name) {
}
template Subscriber::~Subscriber() {
}
template const std::string& Subscriber::getName() const {
return m_sName;
}
}
#endif