/***************************** LICENSE START ***********************************

 Copyright 2012 ECMWF and INPE. This software is distributed under the terms
 of the Apache License version 2.0. In applying this license, ECMWF does not
 waive the privileges and immunities granted to it by virtue of its status as
 an Intergovernmental Organization or submit itself to any jurisdiction.

 ***************************** LICENSE END *************************************/

// File MessageObserver.h
// Baudouin Raoult - ECMWF Aug 99

#ifndef MessageObserver_H
#define MessageObserver_H

// Headers
// #ifndef   machine_H
// #include <machine.h>
// #endif

// Forward declarations

// class ostream;
// typedef class _Pvts os_typespec; // Remove if not persistant

// 

#ifndef Counted_H
#include "Counted.h"
#endif


class Request;

class MessageObserver : public virtual Counted  {
public:

// -- Exceptions
	// None

// -- Contructors

	MessageObserver();

// -- Destructor

	virtual ~MessageObserver(); // Change to virtual if base class

// -- Convertors
	// None

// -- Operators
	// None

// -- Methods

	virtual void message(const Request&) = 0;
	void observe();
	void stop();

// -- Overridden methods
	// None

// -- Class members
	// None

// -- Class methods
	// None
	static void broadcast(const Request&);

	// Uncomment for persistent, remove otherwise
	// static os_typespec* get_os_typespec();

protected:

// -- Members
	// None

// -- Methods
	
// -- Overridden methods
	// None

// -- Class members
	// None

// -- Class methods
	// None

private:

// No copy allowed

	MessageObserver(const MessageObserver&);
	MessageObserver& operator=(const MessageObserver&);

// -- Members
	// None

// -- Methods
	// None

// -- Overridden methods
	// None

// -- Class members
	// None

// -- Class methods
	// None

// -- Friends

	//friend ostream& operator<<(ostream& s,const MessageObserver& p)
	//	{ p.print(s); return s; }

};


class MessageObserverH : public Handle<MessageObserver> {
public:
	MessageObserverH(MessageObserver* o) : Handle<MessageObserver>(o) {}
};

#endif
