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:

Inheritance graph
[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:

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]

~TreeNamedAndHandledSet (  )  [inline]


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]

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]

named_const_iterator end (  )  const [inline]

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

bool isRootSet [protected]

std::string setName [protected]


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

Generated on Thu Apr 30 15:58:48 2009 for CERTIDeveloperDocumentation by doxygen 1.5.5