trick/trick_source/sim_services/Message/include/MessageSubscriber.hh
Alex Lin 14a75508a3 Cleaning up once include variables and copyright cleanup.
Changed all header file once include variables to follow the same naming
convention and not start with any underscores.  Also deleted old
incorrect copyright notices.  Also removed $Id: tags from all files.

Fixes #14.  Fixes #22.
2015-03-23 16:03:14 -05:00

62 lines
1.8 KiB
C++

#ifndef MESSAGESUBSCRIBER_HH
#define MESSAGESUBSCRIBER_HH
#include <streambuf>
#include <iostream>
#include <string>
namespace Trick {
/**
* This class defines a message subscriber that can subscribe to a MessagePublisher.
*/
class MessageSubscriber {
public:
MessageSubscriber() ;
/** Toggle to enable/disable this message subscriber.\n */
bool enabled ; /**< trick_units(--) */
/** Toggle to enable/disable adding color to message.\n */
bool color ; /**< trick_units(--) */
/** Name of the subscriber\n */
std::string name ; /**< trick_units(--) */
/**
@brief Enable (default) or disable this message subscriber, so that it outputs the messages it receives.
@param yes_no - true to enable, false to disable
@return always 0
*/
int set_enabled(bool yes_no) ;
/**
@brief Enable/disable adding color to messages.
@param yes_no - true to enable, false to disable
@return always 0
*/
int set_color(bool yes_no) ;
/**
@brief The destructor.
*/
virtual ~MessageSubscriber() {} ;
/**
@brief Get a message and send to output. This gets called every time when the message publisher
that this subscriber subscribes to publishes a message. Actual output done in the derived class.
@param level - received message level
@param header - received message header
@param message - received message text
*/
virtual void update( unsigned int level , std::string header, std::string message ) = 0 ;
} ;
}
#endif