# Subscribable Class Reference

This class is a base class for "subscribable" classes. More...

`#include <Subscribable.hh>`

Inheritance diagram for Subscribable:

[legend]

List of all members.

## Public Member Functions
virtual | ~Subscribable ()
virtual void | checkFederateAccess (FederateHandle, const char *) const =0
virtual Handle | getHandle () const =0
bool | isSubscribed (FederateHandle, const RTIRegion *) const
| Indicates whether a federate is subscribed with a particular region.
bool | isSubscribed (FederateHandle) const
| Indicates whether a federate is subscribed with any region.
void | subscribe (FederateHandle, const RTIRegion *)
| Subscribe a federate with a region.
void | unsubscribe (FederateHandle)
| Removes a subscribed federate.
void | unsubscribe (FederateHandle, const RTIRegion *)
| Unsubscribe a federate with a region.
void | addFederatesIfOverlap (ObjectClassBroadcastList &, const RTIRegion *, Handle) const
| Add federates and associated attribute to a broadcast list.
void | addFederatesIfOverlap (InteractionBroadcastList &, const RTIRegion *) const
| Add federates to a broadcast list.
## Private Attributes
std::list< Subscriber > | subscribers

## Detailed Description

This class is a base class for "subscribable" classes.

That is ObjectClassAttribute and Interaction.

Definition at line 61 of file Subscribable.hh.

## Constructor & Destructor Documentation

~Subscribable | ( |  | ) | `[virtual]`

Definition at line 97 of file Subscribable.cc.

References certi::D, pdError, and Subscribable::subscribers.

## Member Function Documentation

virtual void checkFederateAccess | ( | FederateHandle | ,
|  | const char * |  |
| ) |  |  | const`[pure virtual]`

Implemented in Interaction, and ObjectClassAttribute.

Referenced by Subscribable::subscribe().

virtual Handle getHandle | ( |  | ) | const`[pure virtual]`

Implemented in Interaction, and ObjectClassAttribute.

bool isSubscribed | ( | FederateHandle | fed,
|  | const RTIRegion * | region |
| ) |  |  | const

Indicates whether a federate is subscribed with a particular region.

Parameters:

  | fed | federate
  | region | region

Returns:
  true if the federate/region pair is subscriber

Definition at line 133 of file Subscribable.cc.

References Subscribable::subscribers.

Referenced by Interaction::killFederate(), and Subscribable::subscribe().

bool isSubscribed | ( | FederateHandle | fed | ) | const

Indicates whether a federate is subscribed with any region.

Parameters:

  | fed | federate

Returns:
  true if the federate is subscribed

Definition at line 147 of file Subscribable.cc.

References Subscribable::subscribers.

void subscribe | ( | FederateHandle | fed,
|  | const RTIRegion * | region |
| ) |  |  |

Subscribe a federate with a region.

Parameters:

  | fed | Federate to subscribe
  | region | Region to use for subscription (0 for default region)

Definition at line 160 of file Subscribable.cc.

References Subscribable::checkFederateAccess(), certi::D, Subscribable::isSubscribed(), pdError, and Subscribable::subscribers.

Referenced by ObjectClass::subscribe(), InteractionSet::subscribe(), and Federation::subscribeInteractionWR().

Here is the call graph for this function:

void unsubscribe | ( | FederateHandle | fed | ) |

Removes a subscribed federate.

All subscription regions are concerned.

Parameters:

  | fed | Federate to unsubscribe

Definition at line 108 of file Subscribable.cc.

References Subscribable::subscribers.

Referenced by Interaction::killFederate(), InteractionSet::subscribe(), and Federation::unsubscribeInteractionWR().

void unsubscribe | ( | FederateHandle | fed,
|  | const RTIRegion * | region |
| ) |  |  |

Unsubscribe a federate with a region.

Parameters:

  | fed | Federate to unsubscribe
  | region | Region for unsubscription (other subscriptions may remain)

Definition at line 121 of file Subscribable.cc.

References Subscribable::subscribers.

void addFederatesIfOverlap | ( | ObjectClassBroadcastList & | lst,
|  | const RTIRegion * | region,
|  | Handle | handle |
| ) |  |  | const

Add federates and associated attribute to a broadcast list.

Parameters:

  | lst | Broadcast list where federates/handles should be added
  | region | Region to check for overlap
  | handle | Handle of this object (Subscribable subclass)

Definition at line 178 of file Subscribable.cc.

References ObjectClassBroadcastList::addFederate(), and Subscribable::subscribers.

Referenced by Interaction::broadcastInteractionMessage(), and ObjectClassAttribute::updateBroadcastList().

Here is the call graph for this function:

void addFederatesIfOverlap | ( | InteractionBroadcastList & | lst,
|  | const RTIRegion * | region |
| ) |  |  | const

Add federates to a broadcast list.

Parameters:

  | lst | Broadcast list where federates/handles should be added
  | region | Region to check for overlap

Definition at line 193 of file Subscribable.cc.

References InteractionBroadcastList::addFederate(), and Subscribable::subscribers.

Here is the call graph for this function:

## Member Data Documentation

std::list<Subscriber> subscribers`[private]`

Definition at line 81 of file Subscribable.hh.

Referenced by Subscribable::addFederatesIfOverlap(), Subscribable::isSubscribed(), Subscribable::subscribe(), Subscribable::unsubscribe(), and Subscribable::~Subscribable().

The documentation for this class was generated from the following files:

- Subscribable.hh
- Subscribable.cc