NIVissimTL Class Reference

#include <NIVissimTL.h>


Detailed Description

Definition at line 52 of file NIVissimTL.h.


Public Types

typedef std::map< int,
SGroupDictType
GroupDictType
typedef std::map< int,
NIVissimTLSignalGroup * > 
SGroupDictType
typedef std::map< int,
SSignalDictType
SignalDictType
typedef std::map< int,
NIVissimTLSignal * > 
SSignalDictType

Public Member Functions

int getID () const
std::string getType () const
 NIVissimTL (int id, const std::string &type, const std::string &name, SUMOTime absdur, SUMOTime offset)
 ~NIVissimTL ()

Static Public Member Functions

static void clearDict ()
static bool dict_SetSignals (NBTrafficLightLogicCont &tlc, NBEdgeCont &ec)
static NIVissimTLdictionary (int id)
static bool dictionary (int id, NIVissimTL *o)
static bool dictionary (int id, const std::string &type, const std::string &name, SUMOTime absdur, SUMOTime offset)

Protected Attributes

SUMOTime myAbsDuration
NIVissimTLSignalGroupmyCurrentGroup
int myID
std::string myName
SUMOTime myOffset
std::string myType

Private Types

typedef std::map< int,
NIVissimTL * > 
DictType

Static Private Attributes

static DictType myDict

Data Structures

class  NIVissimTLSignal
class  NIVissimTLSignalGroup

Member Typedef Documentation

typedef std::map<int, NIVissimTL*> NIVissimTL::DictType [private]

Definition at line 141 of file NIVissimTL.h.

typedef std::map<int, SGroupDictType> NIVissimTL::GroupDictType

Definition at line 77 of file NIVissimTL.h.

Definition at line 75 of file NIVissimTL.h.

Definition at line 76 of file NIVissimTL.h.

Definition at line 73 of file NIVissimTL.h.


Constructor & Destructor Documentation

NIVissimTL::NIVissimTL ( int  id,
const std::string &  type,
const std::string &  name,
SUMOTime  absdur,
SUMOTime  offset 
)

Definition at line 316 of file NIVissimTL.cpp.

Referenced by dictionary().

00319         : myID(id), myName(name), myAbsDuration(absdur), myOffset(offset),
00320         myCurrentGroup(0), myType(type)
00321 
00322 {}

NIVissimTL::~NIVissimTL (  ) 

Definition at line 325 of file NIVissimTL.cpp.

00325 {}


Member Function Documentation

void NIVissimTL::clearDict (  )  [static]

Definition at line 365 of file NIVissimTL.cpp.

References myDict.

Referenced by NIImporter_Vissim::~NIImporter_Vissim().

00365                       {
00366     for (DictType::iterator i=myDict.begin(); i!=myDict.end(); i++) {
00367         delete(*i).second;
00368     }
00369     myDict.clear();
00370 }

bool NIVissimTL::dict_SetSignals ( NBTrafficLightLogicCont tlc,
NBEdgeCont ec 
) [static]

Definition at line 377 of file NIVissimTL.cpp.

References MsgHandler::getErrorInstance(), NIVissimTL::NIVissimTLSignalGroup::getGroupsFor(), getID(), NIVissimTL::NIVissimTLSignal::getSignalsFor(), MsgHandler::inform(), NBTrafficLightLogicCont::insert(), myAbsDuration, myDict, myID, and WRITE_WARNING.

Referenced by NIImporter_Vissim::postLoadBuild().

00378                                             {
00379     size_t ref = 0;
00380     size_t ref_groups = 0;
00381     size_t ref_signals = 0;
00382     size_t no_signals = 0;
00383     size_t no_groups = 0;
00384     for (DictType::iterator i=myDict.begin(); i!=myDict.end(); i++) {
00385         NIVissimTL *tl = (*i).second;
00386         /*      if(tl->myType!="festzeit") {
00387                     cout << " Warning: The traffic light '" << tl->myID
00388                         << "' could not be assigned to a node." << endl;
00389                     ref++;
00390                     continue;
00391                 }*/
00392         std::string id = toString<int>(tl->myID);
00393         NBLoadedTLDef *def = new NBLoadedTLDef(id);
00394         if (!tlc.insert(def)) {
00395             MsgHandler::getErrorInstance()->inform("Error on adding a traffic light\n Must be a multiple id ('" + id + "')");
00396             continue;
00397         }
00398         def->setCycleDuration((unsigned int) tl->myAbsDuration);
00399         // add each group to the node's container
00400         SGroupDictType sgs = NIVissimTLSignalGroup::getGroupsFor(tl->getID());
00401         for (SGroupDictType::const_iterator j=sgs.begin(); j!=sgs.end(); j++) {
00402             if (!(*j).second->addTo(def)) {
00403                 WRITE_WARNING("The signal group '" + toString<int>((*j).first)+ "' could not be assigned to tl '"+ toString<int>(tl->myID) + "'.");
00404                 ref_groups++;
00405             }
00406             no_groups++;
00407         }
00408         // add the signal group signals to the node
00409         SSignalDictType signals = NIVissimTLSignal::getSignalsFor(tl->getID());
00410         for (SSignalDictType::const_iterator k=signals.begin(); k!=signals.end(); k++) {
00411             if (!(*k).second->addTo(ec, def)) {
00412                 WRITE_WARNING("The signal '" + toString<int>((*k).first)+ "' could not be assigned to tl '" + toString<int>(tl->myID) + "'.");
00413                 ref_signals++;
00414             }
00415             no_signals++;
00416         }
00417     }
00418     if (ref!=0) {
00419         WRITE_WARNING("Could not set " + toString<size_t>(ref)+ " of " + toString<size_t>(myDict.size())+ " traffic lights.");
00420     }
00421     if (ref_groups!=0) {
00422         WRITE_WARNING("Could not set " + toString<size_t>(ref_groups)+ " of " + toString<size_t>(no_groups)+ " groups.");
00423     }
00424     if (ref_signals!=0) {
00425         WRITE_WARNING("Could not set " + toString<size_t>(ref_signals)+ " of " + toString<size_t>(no_signals)+ " signals.");
00426     }
00427     return true;
00428 
00429 }

NIVissimTL * NIVissimTL::dictionary ( int  id  )  [static]

Definition at line 355 of file NIVissimTL.cpp.

References myDict.

00355                              {
00356     DictType::iterator i=myDict.find(id);
00357     if (i==myDict.end()) {
00358         return 0;
00359     }
00360     return (*i).second;
00361 }

bool NIVissimTL::dictionary ( int  id,
NIVissimTL o 
) [static]

Definition at line 344 of file NIVissimTL.cpp.

References myDict.

00344                                             {
00345     DictType::iterator i=myDict.find(id);
00346     if (i==myDict.end()) {
00347         myDict[id] = o;
00348         return true;
00349     }
00350     return false;
00351 }

bool NIVissimTL::dictionary ( int  id,
const std::string &  type,
const std::string &  name,
SUMOTime  absdur,
SUMOTime  offset 
) [static]

int NIVissimTL::getID (  )  const

Definition at line 439 of file NIVissimTL.cpp.

References myID.

Referenced by dict_SetSignals().

00439                         {
00440     return myID;
00441 }

std::string NIVissimTL::getType (  )  const

Definition at line 433 of file NIVissimTL.cpp.

References myType.

Referenced by NIVissimSingleTypeParser_Signalgruppendefinition::parse().

00433                           {
00434     return myType;
00435 }


Field Documentation

Definition at line 136 of file NIVissimTL.h.

Referenced by dict_SetSignals().

Definition at line 138 of file NIVissimTL.h.

Definition at line 142 of file NIVissimTL.h.

Referenced by clearDict(), dict_SetSignals(), and dictionary().

int NIVissimTL::myID [protected]

Definition at line 134 of file NIVissimTL.h.

Referenced by dict_SetSignals(), and getID().

std::string NIVissimTL::myName [protected]

Definition at line 135 of file NIVissimTL.h.

Definition at line 137 of file NIVissimTL.h.

std::string NIVissimTL::myType [protected]

Definition at line 139 of file NIVissimTL.h.

Referenced by getType().


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

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