Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

OSCAR::ModelingObjectMap Class Reference
[ObstacleAvoidance]

Contains an STL map which indexes the name of ModelingObjects (Nodes and Primitives) with their address. Useful for finding the address of a modeling Node or Primitive just by knowing its name. The key to the STL map is an OSCAR::String, the data type being stored is ModelingObject*. More...

#include <ModelingObjectMap.h>

Inheritance diagram for OSCAR::ModelingObjectMap:

Inheritance graph
[legend]
List of all members.

Public Methods

 ModelingObjectMap ()
 ModelingObjectMap (const ModelingObjectMap &arg)
virtual ~ModelingObjectMap ()
ModelingObjectMap & operator= (const ModelingObjectMap &rhs)
bool AddObject (ModelingObject *toAdd)
bool RemoveObject (const ModelingObject *toRemove)
bool RemoveObject (const String toRemove)
ModelingObjectGet (const String toGet)
bool Set (ModelingObject *toSet)
bool ClearMap ()

Protected Attributes

std::map< String, ModelingObject * > objectMap

Detailed Description

Author:
Andrew Spencer


Constructor & Destructor Documentation

OSCAR::ModelingObjectMap::ModelingObjectMap  
 

Default constructor, creates an empty modeling object map.

OSCAR::ModelingObjectMap::ModelingObjectMap const ModelingObjectMap &    arg
 

Copy constructor.

virtual OSCAR::ModelingObjectMap::~ModelingObjectMap   [virtual]
 

Destructor.


Member Function Documentation

bool OSCAR::ModelingObjectMap::AddObject ModelingObject   toAdd
 

AddObject Adds the object given in the argument to the map, using the objects internaly set name as the key.

Parameters:
toAdd The object which will be added
Returns:
true upon completion, false if the operation fails, for example if an object with the same key (name) already exists

bool OSCAR::ModelingObjectMap::ClearMap  
 

Clears map. After this function is invoked, the map will be empty.

Returns:
Returns true upon completion

ModelingObject* OSCAR::ModelingObjectMap::Get const String    toGet
 

Get Get the ModelingObject pointer which corresponds to the inputted String toGet.

Parameters:
toGet The name of the ModelingObject whose pointer will be returned
Returns:
A pointer to the requested ModelingObject. Pointer will be NULL if the String toGet was not found in the map

ModelingObjectMap& OSCAR::ModelingObjectMap::operator= const ModelingObjectMap &    rhs
 

operator =

bool OSCAR::ModelingObjectMap::RemoveObject const String    toRemove
 

RemoveObject Removes from the map the object who's key (name) is given in the argument.

Parameters:
toRemove a String representing the name of the object to be removed
Returns:
true upon completion, false if the operation fails (if the toRemove param is not contained within the map)

bool OSCAR::ModelingObjectMap::RemoveObject const ModelingObject   toRemove
 

RemoveObject Removes the object given in the argument from the map.

Parameters:
toRemove A pointer to the object which will be removed from the map. Note: the modeling object which toRemove points to MUST still have the same name it had when it was added to the map, or this method will not work correctly.
Returns:
true upon completion, false if the operation fails (if the toRemove param is not contained within the map)

bool OSCAR::ModelingObjectMap::Set ModelingObject   toSet
 

Re-set the specified ModelingObjects address in the map. In order for this function to work correctly the specified ModelingObject must have already been added to the map, and the name of the ModelingObject must not have changed, and the name of the ModelingObject must not be a duplicate of another object. Any of these situations will cause the function to work incorrectly.

Parameters:
toUpdate A pointer to the ModelingObject which should be updated.
Returns:
true if the name of toUpdate is found and the operation is successful, false if toUpdate is not found


Member Data Documentation

std::map<String, ModelingObject*> OSCAR::ModelingObjectMap::objectMap [protected]
 


The documentation for this class was generated from the following file:
RRG Homepage OSCAR Overview OSCAR Tutorials Simulations