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-sim.org/
13
// Copyright (C) 2001-2014 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 "
MSJunctionLogic.h
"
39
#include "
MSLogicJunction.h
"
40
41
42
// ===========================================================================
43
// class definitions
44
// ===========================================================================
50
template
<
size_t
N >
51
class
MSBitSetLogic
:
public
MSJunctionLogic
{
52
public
:
59
typedef
std::vector< std::bitset< N > >
Logic
;
60
63
typedef
std::vector< std::bitset< N > >
Foes
;
64
65
66
public
:
68
MSBitSetLogic
(
unsigned
int
nLinks
,
69
Logic
* logic,
70
Foes
* foes,
71
std::bitset<64> conts)
72
:
MSJunctionLogic
(nLinks),
myLogic
(logic),
73
myInternalLinksFoes
(foes),
myConts
(conts) {}
74
75
77
~MSBitSetLogic
() {
78
delete
myLogic
;
79
delete
myInternalLinksFoes
;
80
}
81
82
84
const
MSLogicJunction::LinkFoes
&
getFoesFor
(
unsigned
int
linkIndex)
const
{
85
return
(*
myLogic
)[linkIndex];
86
}
87
88
const
std::bitset<64>&
getInternalFoesFor
(
unsigned
int
linkIndex)
const
{
89
return
(*
myInternalLinksFoes
)[linkIndex];
90
}
91
92
bool
getIsCont
(
unsigned
int
linkIndex)
const
{
93
return
myConts
.test(linkIndex);
94
}
95
96
virtual
bool
hasFoes
()
const
{
97
for
(
typename
Logic::const_iterator i =
myLogic
->begin(); i !=
myLogic
->end(); ++i) {
98
if
((*i).any()) {
99
return
true
;
100
}
101
}
102
return
false
;
103
}
104
105
private
:
107
Logic
*
myLogic
;
108
110
Foes
*
myInternalLinksFoes
;
111
112
std::bitset<64>
myConts
;
113
114
private
:
116
MSBitSetLogic
(
const
MSBitSetLogic
&);
117
119
MSBitSetLogic
&
operator=
(
const
MSBitSetLogic
&);
120
121
};
122
123
127
typedef
MSBitSetLogic< 64 >
MSBitsetLogic
;
128
129
130
#endif
131
132
/****************************************************************************/
133
tmp
buildd
sumo-0.21.0+dfsg
src
microsim
MSBitSetLogic.h
Generated on Thu Nov 20 2014 19:49:54 for SUMO - Simulation of Urban MObility by
1.8.1.2