# Interaction Class Reference

OMT Interaction class. More...

`#include <Interaction.hh>`

Inheritance diagram for Interaction:

[legend]

List of all members.

## Public Types
typedef InteractionClassHandle | handle_t
| The type of the handle of this class.
typedef InteractionClassNotDefined | ObjectNotDefinedException
| The type of the exception to when such object is not found.
## Public Member Functions
| Interaction (const std::string &theName, InteractionClassHandle theHandle, TransportType theTransport, OrderType theOrder)
| Build an interaction class object.
| ~Interaction ()
| Destructor.
void | setSpace (SpaceHandle)
SpaceHandle | getSpace ()
void | setHandle (InteractionClassHandle h)
InteractionClassHandle | getHandle () const
InteractionClassHandle | getSuperclass () const
| Get the super class handle.
void | addSubClass (Interaction *child)
| Add a subclass to this interaction class.
Interaction * | getSubClassByName (const std::string subClassName)
| Retrieve a sub class by its name.
InteractionSet * | getSubClasses ()
| Get the whole set of subclasses.
ParameterHandle | addParameter (Parameter *the_parameter, bool is_inherited=false)
| Used only by CRead, return the new parameter's handle.
void | display () const
| Print the Interaction to the standard output.
void | checkFederateAccess (FederateHandle the_federate, const char *reason) const throw (SecurityError)
SecurityLevelID | getSecurityLevelId () const
void | setSecurityLevelId (SecurityLevelID NewLevelID)
| Change the level ID.
void | publish (FederateHandle) throw (FederateNotPublishing, RTIinternalError, SecurityError)
| publish
void | unpublish (FederateHandle) throw (FederateNotPublishing, RTIinternalError, SecurityError)
| publish
ParameterHandle | getParameterHandle (const char *) const throw (NameNotFound, RTIinternalError)
| Returns the parameter handle obtained by its name.
const std::string & | getParameterName (ParameterHandle the_handle) const throw (InteractionParameterNotDefined, RTIinternalError)
| Get interaction parameter name from its handle.
void | killFederate (FederateHandle theFederate) throw ()
| killFederate.
void | changeTransportationType (TransportType new_type, FederateHandle the_handle) throw (FederateNotPublishing, InvalidTransportationHandle, RTIinternalError)
| changeTransportationType.
void | changeOrderType (OrderType new_order, FederateHandle the_handle) throw (FederateNotPublishing, InvalidOrderingHandle, RTIinternalError)
| changeOrderType.
void | isReady (FederateHandle federate_handle, std::vector< ParameterHandle > &parameter_list, UShort list_size) throw (FederateNotPublishing, InteractionParameterNotDefined, RTIinternalError)
InteractionBroadcastList * | sendInteraction (FederateHandle federate_handle, std::vector< ParameterHandle > &parameter_list, std::vector< ParameterValue_t > &value_list, UShort list_size, FederationTime the_time, const RTIRegion *, const char *the_tag) throw (FederateNotPublishing, InteractionClassNotDefined, InteractionParameterNotDefined, RTIinternalError)
InteractionBroadcastList * | sendInteraction (FederateHandle federate_handle, std::vector< ParameterHandle > &parameter_list, std::vector< ParameterValue_t > &value_list, UShort list_size, const RTIRegion *, const char *the_tag) throw (FederateNotPublishing, InteractionClassNotDefined, InteractionParameterNotDefined, RTIinternalError)
void | broadcastInteractionMessage (InteractionBroadcastList *, const RTIRegion *)
## Public Attributes
SecurityServer * | server
| This Object helps to find a TCPLink given a Federate Handle.
InteractionClassHandle | parent
| The super class handle.
UShort | depth
TransportType | transport
OrderType | order
| Interaction message Ordering Type(TSO, FIFO), currently not used.
## Private Types
typedef std::set< FederateHandle > | PublishersList
## Private Member Functions
| Interaction ()
void | addInheritedClassParameter (Interaction *new_child)
Parameter * | getParameterByHandle (ParameterHandle the_handle) const throw (InteractionParameterNotDefined, RTIinternalError)
| Returns the parameter by its handle.
void | deletePublisher (FederateHandle)
| Delete a publisher with rank.
bool | isPublishing (FederateHandle)
| Return true if federate is publishing the attribute.
## Private Attributes
InteractionClassHandle | handle
| Interaction class handle.
InteractionClassHandle | superClass
| The super class handle.
InteractionSet * | subClasses
| The set of interaction classes sub classes.
SecurityLevelID | id
| The default Security Level for new parameters.
SpaceHandle | space
std::list< Parameter * > | parameterSet
| List of this Interaction Class' Parameters.
PublishersList | publishers

## Detailed Description

OMT Interaction class.

It also contains:

- the set of subclasses.
- the instance list from this class.

Definition at line 54 of file Interaction.hh.

## Member Typedef Documentation

typedef InteractionClassHandle handle_t

The type of the handle of this class.

Definition at line 61 of file Interaction.hh.

typedef InteractionClassNotDefined ObjectNotDefinedException

The type of the exception to when such object is not found.

Definition at line 65 of file Interaction.hh.

typedef std::set<FederateHandle> PublishersList`[private]`

Definition at line 241 of file Interaction.hh.

## Constructor & Destructor Documentation

Interaction | ( | const std::string & | theName,
|  | InteractionClassHandle | theHandle,
|  | TransportType | theTransport,
|  | OrderType | theOrder |
| ) |  |  |

Build an interaction class object.

Parameters:

  `[in]` | name | the name of the interaction class
  `[in]` | handle | the handle of this class
  `[in]` | transport | the transport type
  `[in]` | order | the receive order type

Definition at line 46 of file Interaction.cc.

References Named::setName(), and Interaction::subClasses.

Here is the call graph for this function:

~Interaction | ( |  | ) |

Destructor.

Definition at line 57 of file Interaction.cc.

References certi::D, Interaction::handle, PrettyDebug::Out(), Interaction::parameterSet, pdError, Interaction::publishers, and Interaction::subClasses.

Here is the call graph for this function:

Interaction | ( |  | ) | `[private]`

## Member Function Documentation

void setSpace | ( | SpaceHandle | h | ) |

Definition at line 535 of file Interaction.cc.

References Interaction::space.

SpaceHandle getSpace | ( |  | ) |

Definition at line 543 of file Interaction.cc.

References Interaction::space.

void setHandle | ( | InteractionClassHandle | h | ) | `[inline]`

Definition at line 82 of file Interaction.hh.

InteractionClassHandle getHandle | ( |  | ) | const`[inline, virtual]`

Implements Subscribable.

Definition at line 83 of file Interaction.hh.

Referenced by InteractionSet::addClass(), and certi::fedparser::startInteraction().

InteractionClassHandle getSuperclass | ( |  | ) | const`[inline]`

Get the super class handle.

Returns:
  the super class handle

Definition at line 89 of file Interaction.hh.

void addSubClass | ( | Interaction * | child | ) |

Add a subclass to this interaction class.

Parameters:

  `[in]` | child | the interaction to add as a sub class

Definition at line 73 of file Interaction.cc.

References InteractionSet::addClass(), Interaction::addInheritedClassParameter(), Interaction::handle, Interaction::server, Interaction::setSecurityLevelId(), Interaction::subClasses, and Interaction::superClass.

Here is the call graph for this function:

Interaction* getSubClassByName | ( | const std::string | subClassName | ) |

Retrieve a sub class by its name.

Parameters:

  `[in]` | subClassName | the name of the subclass

Returns:
  the sub class object class.

InteractionSet* getSubClasses | ( |  | ) | `[inline]`

Get the whole set of subclasses.

Definition at line 106 of file Interaction.hh.

ParameterHandle addParameter | ( | Parameter * | the_parameter,
|  | bool | is_inherited = `false` |
| ) |  |  |

Used only by CRead, return the new parameter's handle.

Definition at line 91 of file Interaction.cc.

References certi::D, Parameter::getHandle(), Named::getName(), Interaction::handle, Interaction::id, Parameter::LevelID, Named::name, Interaction::parameterSet, and pdRegister.

Referenced by Interaction::addInheritedClassParameter().

Here is the call graph for this function:

void display | ( |  | ) | const

Print the Interaction to the standard output.

Definition at line 254 of file Interaction.cc.

References Interaction::handle, Named::name, Interaction::parameterSet, Interaction::parent, TreeNamedAndHandledSet::size(), and Interaction::subClasses.

Here is the call graph for this function:

void checkFederateAccess | ( | FederateHandle | the_federate,
|  | const char * | reason |
| ) |  |  | const throw (SecurityError)`[virtual]`

Throw SecurityError is the Federate is not allowed to access the Interaction Class, and print an Audit message containing Reason.

Implements Subscribable.

Definition at line 223 of file Interaction.cc.

References SecurityServer::canFederateAccessData(), Interaction::handle, and Interaction::server.

Referenced by Interaction::publish().

Here is the call graph for this function:

SecurityLevelID getSecurityLevelId | ( |  | ) | const`[inline]`

Definition at line 119 of file Interaction.hh.

void setSecurityLevelId | ( | SecurityLevelID | new_levelID | ) |

Change the level ID.

A class' LevelID can only be increased.

Definition at line 524 of file Interaction.cc.

References SecurityServer::dominates(), and Interaction::server.

Referenced by Interaction::addSubClass().

Here is the call graph for this function:

void publish | ( | FederateHandle | the_handle | ) | throw (FederateNotPublishing, RTIinternalError, SecurityError)

publish

Definition at line 368 of file Interaction.cc.

References Interaction::checkFederateAccess(), certi::D, Interaction::handle, Interaction::isPublishing(), PrettyDebug::Out(), pdError, pdInit, and Interaction::publishers.

Referenced by InteractionSet::publish().

Here is the call graph for this function:

void unpublish | ( | FederateHandle | the_handle | ) | throw (FederateNotPublishing, RTIinternalError, SecurityError)

publish

Definition at line 384 of file Interaction.cc.

References certi::D, Interaction::deletePublisher(), Interaction::handle, Interaction::isPublishing(), PrettyDebug::Out(), and pdTerm.

Referenced by Interaction::killFederate(), and InteractionSet::publish().

Here is the call graph for this function:

ParameterHandle getParameterHandle | ( | const char * | the_name | ) | const throw (NameNotFound, RTIinternalError)

Returns the parameter handle obtained by its name.

Definition at line 296 of file Interaction.cc.

References Interaction::parameterSet.

Referenced by InteractionSet::getParameterHandle().

const std::string & getParameterName | ( | ParameterHandle | the_handle | ) | const throw (InteractionParameterNotDefined, RTIinternalError)

Get interaction parameter name from its handle.

Parameters:

  `[in]` | the_handle | the parameter handle

Returns:
  the name of the parameter

Definition at line 311 of file Interaction.cc.

References Named::getName(), and Interaction::getParameterByHandle().

Referenced by InteractionSet::getParameterName().

Here is the call graph for this function:

void killFederate | ( | FederateHandle | theFederate | ) | throw ()

killFederate.

Definition at line 350 of file Interaction.cc.

References Interaction::isPublishing(), Subscribable::isSubscribed(), Interaction::unpublish(), and Subscribable::unsubscribe().

Here is the call graph for this function:

void changeTransportationType | ( | TransportType | new_type,
|  | FederateHandle | the_handle |
| ) |  |  | throw (FederateNotPublishing, InvalidTransportationHandle, RTIinternalError)

changeTransportationType.

Definition at line 183 of file Interaction.cc.

References certi::BEST_EFFORT, certi::D, Interaction::handle, Interaction::isPublishing(), PrettyDebug::Out(), pdInit, certi::RELIABLE, and Interaction::transport.

Here is the call graph for this function:

void changeOrderType | ( | OrderType | new_order,
|  | FederateHandle | the_handle |
| ) |  |  | throw (FederateNotPublishing, InvalidOrderingHandle, RTIinternalError)

changeOrderType.

Definition at line 204 of file Interaction.cc.

References certi::D, Interaction::handle, Interaction::isPublishing(), Interaction::order, PrettyDebug::Out(), pdInit, certi::RECEIVE, and certi::TIMESTAMP.

Here is the call graph for this function:

void isReady | ( | FederateHandle | federate_handle,
|  | std::vector< ParameterHandle > & | parameter_list,
|  | UShort | list_size |
| ) |  |  | throw (FederateNotPublishing, InteractionParameterNotDefined, RTIinternalError)

Check a SendInteractionOrder to see if it's OK for sending, but without sending it(to be called on the RTIA only).

Definition at line 331 of file Interaction.cc.

References Interaction::getParameterByHandle(), and Interaction::isPublishing().

Referenced by InteractionSet::isReady().

Here is the call graph for this function:

InteractionBroadcastList * sendInteraction | ( | FederateHandle | federate_handle,
|  | std::vector< ParameterHandle > & | parameter_list,
|  | std::vector< ParameterValue_t > & | value_list,
|  | UShort | list_size,
|  | FederationTime | time,
|  | const RTIRegion * | region,
|  | const char * | the_tag |
| ) |  |  | throw (FederateNotPublishing, InteractionClassNotDefined, InteractionParameterNotDefined, RTIinternalError)

Called by RTIG in order to start the broadcasting of an Interaction Message(to all federates who subscribed to this Interaction Class). with time

Definition at line 404 of file Interaction.cc.

References Interaction::broadcastInteractionMessage(), NM_Factory::create(), certi::D, certi::e_NO_EXCEPTION, NetworkMessage::federate, SecurityServer::federation(), NetworkMessage::federation, certi::G, Interaction::handle, NetworkMessage::handleArray, NetworkMessage::handleArraySize, NetworkMessage::interactionClass, Interaction::isPublishing(), PrettyDebug::Out(), pdGendoc, pdProtocol, NetworkMessage::RECEIVE_INTERACTION, Interaction::server, NetworkMessage::setDate(), NetworkMessage::setLabel(), NetworkMessage::sizeValueArray(), and NetworkMessage::valueArray.

Referenced by InteractionSet::broadcastInteraction().

Here is the call graph for this function:

InteractionBroadcastList * sendInteraction | ( | FederateHandle | federate_handle,
|  | std::vector< ParameterHandle > & | parameter_list,
|  | std::vector< ParameterValue_t > & | value_list,
|  | UShort | list_size,
|  | const RTIRegion * | region,
|  | const char * | the_tag |
| ) |  |  | throw (FederateNotPublishing, InteractionClassNotDefined, InteractionParameterNotDefined, RTIinternalError)

Called by RTIG in order to start the broadcasting of an Interaction Message(to all federates who subscribed to this Interaction Class). without time

Definition at line 465 of file Interaction.cc.

References Interaction::broadcastInteractionMessage(), NM_Factory::create(), certi::D, certi::e_NO_EXCEPTION, NetworkMessage::federate, SecurityServer::federation(), NetworkMessage::federation, certi::G, Interaction::handle, NetworkMessage::handleArray, NetworkMessage::handleArraySize, NetworkMessage::interactionClass, Interaction::isPublishing(), PrettyDebug::Out(), pdGendoc, pdProtocol, NetworkMessage::RECEIVE_INTERACTION, Interaction::server, NetworkMessage::setLabel(), NetworkMessage::sizeValueArray(), and NetworkMessage::valueArray.

Here is the call graph for this function:

void broadcastInteractionMessage | ( | InteractionBroadcastList * | ibList,
|  | const RTIRegion * | region |
| ) |  |  |

Called by the InteractionSet on Parent Classes whose Childrens initiated a SendInteraction, to allow them to broadcast the Interaction Message of their child to their own subscribers. See InteractionSet::SendInteraction.

Definition at line 148 of file Interaction.cc.

References Subscribable::addFederatesIfOverlap(), certi::D, certi::G, Interaction::getParameterByHandle(), Interaction::handle, NetworkMessage::handleArray, NetworkMessage::handleArraySize, NetworkMessage::interactionClass, InteractionBroadcastList::message, PrettyDebug::Out(), pdDebug, pdGendoc, NetworkMessage::removeParameter(), InteractionBroadcastList::sendPendingMessage(), and Interaction::server.

Referenced by Interaction::sendInteraction().

Here is the call graph for this function:

void addInheritedClassParameter | ( | Interaction * | new_child | ) | `[private]`

Definition at line 114 of file Interaction.cc.

References Interaction::addParameter(), certi::D, Parameter::getHandle(), Interaction::handle, PrettyDebug::Out(), Interaction::parameterSet, and pdProtocol.

Referenced by Interaction::addSubClass().

Here is the call graph for this function:

Parameter * getParameterByHandle | ( | ParameterHandle | the_handle | ) | const throw (InteractionParameterNotDefined, RTIinternalError)`[private]`

Returns the parameter by its handle.

Definition at line 281 of file Interaction.cc.

References Interaction::parameterSet.

Referenced by Interaction::broadcastInteractionMessage(), Interaction::getParameterName(), and Interaction::isReady().

void deletePublisher | ( | FederateHandle | fed | ) | `[private]`

Delete a publisher with rank.

Definition at line 244 of file Interaction.cc.

References Interaction::publishers.

Referenced by Interaction::unpublish().

bool isPublishing | ( | FederateHandle | fed | ) | `[private]`

Return true if federate is publishing the attribute.

Definition at line 321 of file Interaction.cc.

References Interaction::publishers.

Referenced by Interaction::changeOrderType(), Interaction::changeTransportationType(), Interaction::isReady(), Interaction::killFederate(), Interaction::publish(), Interaction::sendInteraction(), and Interaction::unpublish().

## Member Data Documentation

SecurityServer* server

This Object helps to find a TCPLink given a Federate Handle.

Definition at line 188 of file Interaction.hh.

Referenced by InteractionSet::addClass(), Interaction::addSubClass(), Interaction::broadcastInteractionMessage(), Interaction::checkFederateAccess(), Interaction::sendInteraction(), and Interaction::setSecurityLevelId().

InteractionClassHandle parent

The super class handle.

0 if they aren't any.

Definition at line 193 of file Interaction.hh.

Referenced by Interaction::display().

UShort depth

Definition at line 197 of file Interaction.hh.

TransportType transport

Interaction messages' Transport Type(Reliable, Best Effort), Currently not used.

Definition at line 202 of file Interaction.hh.

Referenced by Interaction::changeTransportationType().

OrderType order

Interaction message Ordering Type(TSO, FIFO), currently not used.

Definition at line 205 of file Interaction.hh.

Referenced by Interaction::changeOrderType().

InteractionClassHandle handle`[private]`

Interaction class handle.

Definition at line 216 of file Interaction.hh.

Referenced by Interaction::addInheritedClassParameter(), Interaction::addParameter(), Interaction::addSubClass(), Interaction::broadcastInteractionMessage(), Interaction::changeOrderType(), Interaction::changeTransportationType(), Interaction::checkFederateAccess(), Interaction::display(), Interaction::publish(), Interaction::sendInteraction(), Interaction::unpublish(), and Interaction::~Interaction().

InteractionClassHandle superClass`[private]`

The super class handle.

0 if they aren't any.

Definition at line 222 of file Interaction.hh.

Referenced by Interaction::addSubClass().

InteractionSet* subClasses`[private]`

The set of interaction classes sub classes.

Definition at line 226 of file Interaction.hh.

Referenced by Interaction::addSubClass(), Interaction::display(), Interaction::Interaction(), and Interaction::~Interaction().

SecurityLevelID id`[private]`

The default Security Level for new parameters.

Definition at line 235 of file Interaction.hh.

Referenced by Interaction::addParameter().

SpaceHandle space`[private]`

Definition at line 236 of file Interaction.hh.

Referenced by Interaction::getSpace(), and Interaction::setSpace().

std::list<Parameter *> parameterSet`[private]`

List of this Interaction Class' Parameters.

Definition at line 239 of file Interaction.hh.

Referenced by Interaction::addInheritedClassParameter(), Interaction::addParameter(), Interaction::display(), Interaction::getParameterByHandle(), Interaction::getParameterHandle(), and Interaction::~Interaction().

PublishersList publishers`[private]`

Definition at line 242 of file Interaction.hh.

Referenced by Interaction::deletePublisher(), Interaction::isPublishing(), Interaction::publish(), and Interaction::~Interaction().

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

- Interaction.hh
- Interaction.cc