SUMO - Simulation of Urban MObility
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
MSBitSetLogic.h
Go to the documentation of this file.
1
/****************************************************************************/
10
// »missingDescription«
11
/****************************************************************************/
12
// SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
13
// Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
14
/****************************************************************************/
15
//
16
// This file is part of SUMO.
17
// SUMO is free software: you can redistribute it and/or modify
18
// it under the terms of the GNU General Public License as published by
19
// the Free Software Foundation, either version 3 of the License, or
20
// (at your option) any later version.
21
//
22
/****************************************************************************/
23
#ifndef MSBitSetLogic_h
24
#define MSBitSetLogic_h
25
26
27
// ===========================================================================
28
// included modules
29
// ===========================================================================
30
#ifdef _MSC_VER
31
#include <
windows_config.h
>
32
#else
33
#include <
config.h
>
34
#endif
35
36
#include <bitset>
37
#include <vector>
38
#include <cassert>
39
#include "
MSJunctionLogic.h
"
40
#include "
MSLogicJunction.h
"
41
42
43
// ===========================================================================
44
// class definitions
45
// ===========================================================================
51
template
<
size_t
N >
52
class
MSBitSetLogic
:
public
MSJunctionLogic
{
53
public
:
60
typedef
std::vector< std::bitset< N > >
Logic
;
61
64
typedef
std::vector< std::bitset< N > >
Foes
;
65
66
67
public
:
69
MSBitSetLogic
(
unsigned
int
nLinks
,
70
Logic
* logic,
71
Foes
* foes,
72
std::bitset<64> conts)
73
:
MSJunctionLogic
(nLinks),
myLogic
(logic),
74
myInternalLinksFoes
(foes),
myConts
(conts) {}
75
76
78
~MSBitSetLogic
() {
79
delete
myLogic
;
80
delete
myInternalLinksFoes
;
81
}
82
83
85
const
MSLogicJunction::LinkFoes
&
getFoesFor
(
unsigned
int
linkIndex)
const
{
86
return
(*
myLogic
)[linkIndex];
87
}
88
89
const
std::bitset<64> &
getInternalFoesFor
(
unsigned
int
linkIndex)
const
{
90
return
(*
myInternalLinksFoes
)[linkIndex];
91
}
92
93
bool
getIsCont
(
unsigned
int
linkIndex)
const
{
94
return
myConts
.test(linkIndex);
95
}
96
97
virtual
bool
isCrossing
()
const
{
98
for
(
typename
Logic::const_iterator i =
myLogic
->begin(); i !=
myLogic
->end(); ++i) {
99
if
((*i).any()) {
100
return
true
;
101
}
102
}
103
return
false
;
104
}
105
106
private
:
108
Logic
*
myLogic
;
109
111
Foes
*
myInternalLinksFoes
;
112
113
std::bitset<64>
myConts
;
114
115
private
:
117
MSBitSetLogic
(
const
MSBitSetLogic
&);
118
120
MSBitSetLogic
&
operator=
(
const
MSBitSetLogic
&);
121
122
};
123
124
128
typedef
MSBitSetLogic< 64 >
MSBitsetLogic
;
129
130
131
#endif
132
133
/****************************************************************************/
134
build
buildd
sumo-0.15.0~dfsg
src
microsim
MSBitSetLogic.h
Generated on Wed Jul 18 2012 22:58:32 for SUMO - Simulation of Urban MObility by
1.8.1.1