DistributionCont Class Reference

#include <DistributionCont.h>


Detailed Description

A container for distributions of different type.

Definition at line 44 of file DistributionCont.h.


Static Public Member Functions

static Distributiondictionary (const std::string &type, const std::string &id)
 retrieves the distribution described by a type and a name from the container
static bool dictionary (const std::string &type, const std::string &id, Distribution *d)
 Adds a distribution of the given type and name to the container.

Private Types

typedef std::map< std::string,
Distribution * > 
DistDict
 Definition of a map from distribution ids to distributions.
typedef std::map< std::string,
DistDict
TypedDistDict
 Definition of a map from distribution types to distribution ids to distributions.

Static Private Attributes

static TypedDistDict myDict
 Map from distribution types to distribution ids to distributions.

Member Typedef Documentation

typedef std::map<std::string, Distribution*> DistributionCont::DistDict [private]

Definition of a map from distribution ids to distributions.

Definition at line 56 of file DistributionCont.h.

typedef std::map<std::string, DistDict> DistributionCont::TypedDistDict [private]

Definition of a map from distribution types to distribution ids to distributions.

Definition at line 59 of file DistributionCont.h.


Member Function Documentation

Distribution * DistributionCont::dictionary ( const std::string &  type,
const std::string &  id 
) [static]

retrieves the distribution described by a type and a name from the container

Definition at line 64 of file DistributionCont.cpp.

References myDict.

00065                                                   {
00066     TypedDistDict::iterator i=myDict.find(type);
00067     if (i==myDict.end()) {
00068         return 0;
00069     }
00070     DistDict &dict = (*i).second;
00071     DistDict::iterator j=dict.find(id);
00072     if (j==dict.end()) {
00073         return 0;
00074     }
00075     return (*j).second;
00076 }

bool DistributionCont::dictionary ( const std::string &  type,
const std::string &  id,
Distribution d 
) [static]

Adds a distribution of the given type and name to the container.

Definition at line 45 of file DistributionCont.cpp.

References myDict.

00046                                               {
00047     TypedDistDict::iterator i=myDict.find(type);
00048 
00049     if (i==myDict.end()) {
00050         myDict[type][id] = d;
00051         return true;
00052     }
00053     DistDict &dict = (*i).second;
00054     DistDict::iterator j=dict.find(id);
00055     if (j==dict.end()) {
00056         myDict[type][id] = d;
00057         return true;
00058     }
00059     return false;
00060 }


Field Documentation

Map from distribution types to distribution ids to distributions.

Definition at line 62 of file DistributionCont.h.

Referenced by dictionary().


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

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