PCTypeMap Class Reference

#include <PCTypeMap.h>


Detailed Description

A storage for type mappings.

This class holds the mappings between names of read polygon/poi types and the values (color, new type name etc.) that shall be assigned to them.

Definition at line 46 of file PCTypeMap.h.


Public Member Functions

bool add (const std::string &id, const std::string &newid, const std::string &color, const std::string &prefix, int layer, bool discard, bool allowFill) throw ()
 Adds a type definition.
const TypeDefget (const std::string &id) throw ()
 Returns a type definition.
bool has (const std::string &id) throw ()
 Returns the information whether the named type is known.
 PCTypeMap () throw ()
 Constructor.
 ~PCTypeMap () throw ()
 Destructor.

Protected Attributes

std::map< std::string, TypeDefmyTypes
 A map of type names to type definitions.

Data Structures

struct  TypeDef
 A single definition of values that shall be used for a given type. More...

Constructor & Destructor Documentation

PCTypeMap::PCTypeMap (  )  throw ()

Constructor.

Definition at line 42 of file PCTypeMap.cpp.

00042 {}

PCTypeMap::~PCTypeMap (  )  throw ()

Destructor.

Definition at line 45 of file PCTypeMap.cpp.

00045 {}


Member Function Documentation

bool PCTypeMap::add ( const std::string &  id,
const std::string &  newid,
const std::string &  color,
const std::string &  prefix,
int  layer,
bool  discard,
bool  allowFill 
) throw ()

Adds a type definition.

Parameters:
[in] id The original id of the type
[in] newid The new id (name) of the type
[in] color The color to set for imported objects of this type
[in] prefix The prefix to prepend to the read names of this type's objects
[in] layer The layer number to set for this type's objects
[in] discard Whether objects of this type shall be discarded
[in] allowFill Whether objects of this type may be filled
Returns:
Whether the type could been added (was not known before)

Definition at line 49 of file PCTypeMap.cpp.

References PCTypeMap::TypeDef::allowFill, PCTypeMap::TypeDef::color, PCTypeMap::TypeDef::discard, has(), PCTypeMap::TypeDef::id, PCTypeMap::TypeDef::layer, myTypes, and PCTypeMap::TypeDef::prefix.

Referenced by PCTypeDefHandler::myStartElement().

00051                                                                 {
00052     if (has(id)) {
00053         return false;
00054     }
00055     TypeDef td;
00056     td.id = newid;
00057     td.color = color;
00058     td.layer = layer;
00059     td.discard = discard;
00060     td.allowFill = allowFill;
00061     td.prefix = prefix;
00062     myTypes[id] = td;
00063     return true;
00064 }

const PCTypeMap::TypeDef & PCTypeMap::get ( const std::string &  id  )  throw ()

Returns a type definition.

This type definition MUST have been added otherwise the further process is undefined.

Parameters:
[in] id The id of the type to get the definitions of
Returns:
Definition of the named type

Definition at line 68 of file PCTypeMap.cpp.

References myTypes.

Referenced by PCLoaderXML::myStartElement().

00068                                           {
00069     return myTypes.find(id)->second;
00070 }

bool PCTypeMap::has ( const std::string &  id  )  throw ()

Returns the information whether the named type is known.

Parameters:
[in] id The id of the type
Returns:
Whether a definition of the named type was added before

Definition at line 74 of file PCTypeMap.cpp.

References myTypes.

Referenced by add(), and PCLoaderXML::myStartElement().

00074                                           {
00075     return myTypes.find(id)!=myTypes.end();
00076 }


Field Documentation

std::map<std::string, TypeDef> PCTypeMap::myTypes [protected]

A map of type names to type definitions.

Definition at line 111 of file PCTypeMap.h.

Referenced by add(), get(), and has().


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

Generated on Wed May 5 00:06:58 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6