# TreeNamedAndHandledSet Class Template Reference

This templated class represents a set of objects whose type is template ObjectType. More...

`#include <TreeNamedAndHandledSet.hh>`

Inheritance diagram for TreeNamedAndHandledSet:

[legend]

List of all members.

## Public Types
typedef ObjectType::handle_t | HandleType
| The handle type should be defined embedded in the ObjectType itself.
typedef ObjectType::ObjectNotDefinedException | ObjectNotDefinedException
| In the same way the exception which may be thrown by most of the method should be defined embedded in the ObjectType itself.
typedef std::map< HandleType, ObjectType *, std::less < HandleType > > | Handle2ObjectMap_t
| Map from ObjectType::handle_t to ObjectType.
typedef Handle2ObjectMap_t::const_iterator | handled_const_iterator
typedef Handle2ObjectMap_t::iterator | handled_iterator
typedef std::map< std::string, ObjectType *, std::less < std::string > > | Name2ObjectMap_t
| Map from name to ObjectType::handle_t.
typedef Name2ObjectMap_t::const_iterator | named_const_iterator
typedef Name2ObjectMap_t::const_iterator | const_iterator
typedef Name2ObjectMap_t::iterator | iterator
## Public Member Functions
| TreeNamedAndHandledSet (std::string setName, bool isRootSet=false)
| ~TreeNamedAndHandledSet ()
std::string | getSetName () const
void | add (ObjectType *child, ObjectType *parent=NULL) throw (RTIinternalError)
| Add an object to the set and build parent <--> child relationship.
HandleType | getHandleFromName (const std::string name) const throw (NameNotFound)
| Get the handle corresponding to the name.
std::string | getNameFromHandle (HandleType handle) const throw (ObjectNotDefinedException)
| Get the name corresponding to the handle.
ObjectType * | getObjectFromHandle (HandleType handle) const throw (ObjectNotDefinedException)
| Get the object corresponding to the handle.
handled_const_iterator | handled_begin () const
handled_const_iterator | handled_end () const
named_const_iterator | begin () const
named_const_iterator | end () const
const size_t | size ()
| Return the size of the set, i.e.
## Protected Attributes
Handle2ObjectMap_t | fromHandle
Name2ObjectMap_t | fromName
bool | isRootSet
std::string | setName

## Detailed Description

### template<typename ObjectType>
class certi::TreeNamedAndHandledSet< ObjectType >

This templated class represents a set of objects whose type is template ObjectType.

The ObjectType type must have the the following characteristics:

- object of this type must have a name which may be obtained with a "std::string ObjectType::getName() const" method,
- it must have an associated handle whose type is ObjectType::handle_t which may be retrieved by a "ObjectType::handle_t ObjectType::getHandle() const" method,
- the set of name should follow a "tree-like" structure for which the object named "Parent.Child" is the "Child" of object "Parent".

The TreeNamedAndHandledSet then build a two-way map from handle to name and name to handle.

Definition at line 63 of file TreeNamedAndHandledSet.hh.

## Member Typedef Documentation

typedef ObjectType::handle_t HandleType

The handle type should be defined embedded in the ObjectType itself.

Definition at line 70 of file TreeNamedAndHandledSet.hh.

typedef ObjectType::ObjectNotDefinedException ObjectNotDefinedException

In the same way the exception which may be thrown by most of the method should be defined embedded in the ObjectType itself.

Definition at line 76 of file TreeNamedAndHandledSet.hh.

typedef std::map<HandleType,ObjectType*,std::less<HandleType> > Handle2ObjectMap_t

Map from ObjectType::handle_t to ObjectType.

Definition at line 125 of file TreeNamedAndHandledSet.hh.

typedef Handle2ObjectMap_t::const_iterator handled_const_iterator

Definition at line 126 of file TreeNamedAndHandledSet.hh.

typedef Handle2ObjectMap_t::iterator handled_iterator

Definition at line 127 of file TreeNamedAndHandledSet.hh.

typedef std::map<std::string,ObjectType*,std::less<std::string> > Name2ObjectMap_t

Map from name to ObjectType::handle_t.

Definition at line 139 of file TreeNamedAndHandledSet.hh.

typedef Name2ObjectMap_t::const_iterator named_const_iterator

Definition at line 140 of file TreeNamedAndHandledSet.hh.

typedef Name2ObjectMap_t::const_iterator const_iterator

Definition at line 141 of file TreeNamedAndHandledSet.hh.

typedef Name2ObjectMap_t::iterator iterator

Definition at line 142 of file TreeNamedAndHandledSet.hh.

## Constructor & Destructor Documentation

TreeNamedAndHandledSet | ( | std::string | setName,
|  | bool | isRootSet = `false` |
| ) |  |  | `[inline]`

Definition at line 178 of file TreeNamedAndHandledSet.hh.

References TreeNamedAndHandledSet::isRootSet, and TreeNamedAndHandledSet::setName.

~TreeNamedAndHandledSet | ( |  | ) | `[inline]`

Definition at line 184 of file TreeNamedAndHandledSet.hh.

References TreeNamedAndHandledSet::fromHandle, TreeNamedAndHandledSet::fromName, and TreeNamedAndHandledSet::isRootSet.

## Member Function Documentation

std::string getSetName | ( |  | ) | const`[inline]`

Definition at line 81 of file TreeNamedAndHandledSet.hh.

void add | ( | ObjectType * | child,
|  | ObjectType * | parent = `NULL` |
| ) |  |  | throw (RTIinternalError)`[inline]`

Add an object to the set and build parent <--> child relationship.

Parameters:

  `[in,out]` | child | the object to be added the child will be linked to his parent.
  `[in,out]` | parent | the parent object of the child the parent will get updated with a link to the new child.

Exceptions:

  | RTIinternalError | the object cannot be stored in the set may be because of a name collision

Definition at line 207 of file TreeNamedAndHandledSet.hh.

References TreeNamedAndHandledSet::fromHandle, and TreeNamedAndHandledSet::fromName.

TreeNamedAndHandledSet< ObjectType >::HandleType getHandleFromName | ( | const std::string | name | ) | const throw (NameNotFound)`[inline]`

Get the handle corresponding to the name.

Parameters:

  `[in]` | name | the name of the object

Returns:
  the handle corresponding to the given name

Exceptions:

  | NameNotFound | the name was not found in the set

Definition at line 256 of file TreeNamedAndHandledSet.hh.

References TreeNamedAndHandledSet::fromName, Named::getLeafClassName(), Named::getNextClassName(), and Named::isQualifiedClassName().

Referenced by InteractionSet::getInteractionClassHandle(), and ObjectClassSet::getObjectClassHandle().

Here is the call graph for this function:

std::string getNameFromHandle | ( | HandleType | handle | ) | const throw (ObjectNotDefinedException)`[inline]`

Get the name corresponding to the handle.

Parameters:

  `[in]` | handle | the handle of the object

Returns:
  the name corresponding to the given handle

Exceptions:

  | NameNotFound | the handle was not found in the set

Definition at line 311 of file TreeNamedAndHandledSet.hh.

References TreeNamedAndHandledSet::getObjectFromHandle().

Referenced by InteractionSet::getInteractionClassName(), and ObjectClassSet::getObjectClassName().

Here is the call graph for this function:

ObjectType * getObjectFromHandle | ( | HandleType | handle | ) | const throw (ObjectNotDefinedException)`[inline]`

Get the object corresponding to the handle.

Parameters:

  `[in]` | handle | the handle of the object

Returns:
  the pointer to object corresponding to the given handle

Exceptions:

  | NameNotFound | the handle was not found in the set

Definition at line 319 of file TreeNamedAndHandledSet.hh.

References TreeNamedAndHandledSet::fromHandle.

Referenced by InteractionSet::broadcastInteraction(), ObjectClassSet::deleteObject(), ObjectClassSet::getAttributeHandle(), ObjectClassSet::getAttributeName(), DataDistribution::getAttributeSpace(), RootObject::getInteractionClass(), DataDistribution::getInteractionSpace(), TreeNamedAndHandledSet::getNameFromHandle(), RootObject::getObjectClass(), InteractionSet::getParameterHandle(), InteractionSet::getParameterName(), InteractionSet::isReady(), ObjectClassSet::killFederate(), ObjectClassSet::negotiatedAttributeOwnershipDivestiture(), RTIA::processNetworkMessage(), ObjectClassSet::publish(), InteractionSet::publish(), ObjectClassSet::registerObjectInstance(), ObjectClassSet::subscribe(), InteractionSet::subscribe(), Federation::subscribeObject(), ObjectClassSet::unconditionalAttributeOwnershipDivestiture(), and ObjectClassSet::updateAttributeValues().

handled_const_iterator handled_begin | ( |  | ) | const`[inline]`

Definition at line 129 of file TreeNamedAndHandledSet.hh.

Referenced by InteractionSet::killFederate().

handled_const_iterator handled_end | ( |  | ) | const`[inline]`

Definition at line 133 of file TreeNamedAndHandledSet.hh.

Referenced by InteractionSet::killFederate().

named_const_iterator begin | ( |  | ) | const`[inline]`

Definition at line 144 of file TreeNamedAndHandledSet.hh.

Referenced by ObjectClass::display(), certi::operator<<(), and ObjectClass::recursiveDiscovering().

named_const_iterator end | ( |  | ) | const`[inline]`

Definition at line 148 of file TreeNamedAndHandledSet.hh.

Referenced by ObjectClass::display(), certi::operator<<(), and ObjectClass::recursiveDiscovering().

const size_t size | ( |  | ) | `[inline]`

Return the size of the set, i.e.

the number of object in the set.

Returns:
  the size of the set

Definition at line 157 of file TreeNamedAndHandledSet.hh.

Referenced by ObjectClass::display(), and Interaction::display().

## Member Data Documentation

Handle2ObjectMap_t fromHandle`[protected]`

Definition at line 160 of file TreeNamedAndHandledSet.hh.

Referenced by TreeNamedAndHandledSet::add(), ObjectClassSet::getInstanceClass(), ObjectClassSet::getObject(), TreeNamedAndHandledSet::getObjectFromHandle(), TreeNamedAndHandledSet< certi::ObjectClass >::handled_begin(), TreeNamedAndHandledSet< certi::ObjectClass >::handled_end(), ObjectClassSet::killFederate(), and TreeNamedAndHandledSet::~TreeNamedAndHandledSet().

Name2ObjectMap_t fromName`[protected]`

Definition at line 161 of file TreeNamedAndHandledSet.hh.

Referenced by TreeNamedAndHandledSet::add(), TreeNamedAndHandledSet< certi::ObjectClass >::begin(), TreeNamedAndHandledSet< certi::ObjectClass >::end(), TreeNamedAndHandledSet::getHandleFromName(), TreeNamedAndHandledSet< certi::ObjectClass >::size(), and TreeNamedAndHandledSet::~TreeNamedAndHandledSet().

bool isRootSet`[protected]`

Definition at line 167 of file TreeNamedAndHandledSet.hh.

Referenced by TreeNamedAndHandledSet::TreeNamedAndHandledSet(), and TreeNamedAndHandledSet::~TreeNamedAndHandledSet().

std::string setName`[protected]`

Definition at line 172 of file TreeNamedAndHandledSet.hh.

Referenced by TreeNamedAndHandledSet< certi::ObjectClass >::getSetName(), and TreeNamedAndHandledSet::TreeNamedAndHandledSet().

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

- TreeNamedAndHandledSet.hh