SUMO - Simulation of Urban MObility
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
MFXEventQue.h
Go to the documentation of this file.
1
/****************************************************************************/
7
// missing_desc
8
/****************************************************************************/
9
// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
10
// Copyright (C) 2004-2015 DLR (http://www.dlr.de/) and contributors
11
/****************************************************************************/
12
//
13
// This file is part of SUMO.
14
// SUMO is free software: you can redistribute it and/or modify
15
// it under the terms of the GNU General Public License as published by
16
// the Free Software Foundation, either version 3 of the License, or
17
// (at your option) any later version.
18
//
19
/****************************************************************************/
20
#ifndef MFXEventQue_h
21
#define MFXEventQue_h
22
23
24
// ===========================================================================
25
// included modules
26
// ===========================================================================
27
#ifdef _MSC_VER
28
#include <
windows_config.h
>
29
#else
30
#include <
config.h
>
31
#endif
32
33
#include <fx.h>
34
#include <list>
35
#include <cassert>
36
#include <
utils/foxtools/MFXMutex.h
>
37
38
template
<
class
T>
39
class
MFXEventQue
{
40
public
:
41
MFXEventQue
() { }
42
~MFXEventQue
() { }
43
44
T
top
() {
45
assert(
size
() != 0);
46
myMutex
.
lock
();
47
T ret =
myItems
.front();
48
myMutex
.
unlock
();
49
return
ret;
50
}
51
52
53
void
pop
() {
54
myMutex
.
lock
();
55
myItems
.erase(
myItems
.begin());
56
myMutex
.
unlock
();
57
}
58
59
void
add
(T what) {
60
myMutex
.
lock
();
61
myItems
.push_back(what);
62
myMutex
.
unlock
();
63
}
64
65
size_t
size
() {
66
myMutex
.
lock
();
67
const
size_t
ret =
myItems
.size();
68
myMutex
.
unlock
();
69
return
ret;
70
}
71
72
bool
empty
() {
73
myMutex
.
lock
();
74
const
bool
ret =
myItems
.size() == 0;
75
myMutex
.
unlock
();
76
return
ret;
77
}
78
79
private
:
80
MFXMutex
myMutex
;
81
std::list<T>
myItems
;
82
};
83
84
85
#endif
86
87
/****************************************************************************/
88
MFXEventQue::pop
void pop()
Definition:
MFXEventQue.h:53
MFXEventQue::empty
bool empty()
Definition:
MFXEventQue.h:72
windows_config.h
MFXEventQue::add
void add(T what)
Definition:
MFXEventQue.h:59
config.h
MFXEventQue
Definition:
MFXEventQue.h:39
MFXEventQue::~MFXEventQue
~MFXEventQue()
Definition:
MFXEventQue.h:42
MFXEventQue::top
T top()
Definition:
MFXEventQue.h:44
MFXEventQue::myItems
std::list< T > myItems
Definition:
MFXEventQue.h:81
MFXMutex::unlock
void unlock()
release mutex lock
Definition:
MFXMutex.cpp:96
MFXMutex.h
MFXMutex
Definition:
MFXMutex.h:56
MFXMutex::lock
void lock()
lock mutex
Definition:
MFXMutex.cpp:86
MFXEventQue::myMutex
MFXMutex myMutex
Definition:
MFXEventQue.h:80
MFXEventQue::size
size_t size()
Definition:
MFXEventQue.h:65
MFXEventQue::MFXEventQue
MFXEventQue()
Definition:
MFXEventQue.h:41
src
utils
foxtools
MFXEventQue.h
Generated on Thu Apr 7 2016 21:35:27 for SUMO - Simulation of Urban MObility by
1.8.11