75 lines
2.1 KiB
C++
75 lines
2.1 KiB
C++
/*
|
|
* File: DeliverableObject.h
|
|
* Author: noackrob
|
|
*
|
|
* Created on October 2, 2013, 3:52 PM
|
|
*/
|
|
#pragma once
|
|
|
|
#ifndef DELIVERABLEOBJECT_H
|
|
#define DELIVERABLEOBJECT_H
|
|
|
|
#include "common/container/GroupList.h"
|
|
#include "common/container/SubscriberSet.h"
|
|
|
|
namespace ubeeme {
|
|
namespace moversight {
|
|
|
|
/**
|
|
* @brief Base class for all deliverable objects.
|
|
*
|
|
* @class DeliverableObject
|
|
* @author Robert Noack
|
|
* @ingroup Moversight
|
|
*
|
|
* A deliverable object can be processed by the dispatcher and eventually
|
|
* delivered to moversight services which subscribed to that type of object.
|
|
* Such objects can come in the form of internal events or message payload objects.
|
|
*/
|
|
class DeliverableObject {
|
|
public:
|
|
DeliverableObject();
|
|
virtual ~DeliverableObject();
|
|
|
|
std::string getName() const;
|
|
const GroupList& getGroups() const;
|
|
|
|
/**
|
|
* @brief Deliver this object to a set of subscribers.
|
|
* @param subs Subscribers for this object.
|
|
* @param type Actual type of this object.
|
|
*/
|
|
virtual void sendTo( const SubscriberSet& subs, const std::string& type) = 0;
|
|
virtual std::string toString() const;
|
|
|
|
void deliverOnlyTo( ObjectListener* ol);
|
|
bool hasRecipient() const;
|
|
|
|
ObjectListener* removeRecipient();
|
|
ObjectListener* getRecipient();
|
|
const ObjectListener* const getRecipient() const;
|
|
|
|
protected:
|
|
|
|
DeliverableObject( const DeliverableObject& other);
|
|
DeliverableObject& operator=( const DeliverableObject& other);
|
|
|
|
void setName( const std::string& s);
|
|
void addToGroup( const std::string& g);
|
|
|
|
private:
|
|
|
|
std::string name;
|
|
ObjectListener* recipient;
|
|
GroupList groups;
|
|
};
|
|
|
|
std::ostream& operator<<(std::ostream& out, const DeliverableObject& e);
|
|
std::ostream& operator<<(std::ostream& out, const DeliverableObject* e);
|
|
|
|
}
|
|
}
|
|
|
|
#endif /* DELIVERABLEOBJECT_H */
|
|
|