ALMaSS Partridge ODdox
1.1
The partridge model description following ODdox protocol
lowqueue.h
Go to the documentation of this file.
1
/*
2
*******************************************************************************************************
3
Copyright (c) 2011, Christopher John Topping, University of Aarhus
4
All rights reserved.
5
6
Redistribution and use in source and binary forms, with or without modification, are permitted provided
7
that the following conditions are met:
8
9
Redistributions of source code must retain the above copyright notice, this list of conditions and the
10
following disclaimer.
11
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
12
the following disclaimer in the documentation and/or other materials provided with the distribution.
13
14
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
15
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
16
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
17
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
18
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
19
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
20
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
21
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22
********************************************************************************************************
23
*/
36
//
37
// lowqueue.h
38
//
39
/*
40
41
Copyright (c) 2003, National Environmental Research Institute, Denmark (NERI)
42
43
All rights reserved.
44
45
46
Redistribution and use in source and binary forms, with or without
47
modification, are permitted provided that the following conditions are met:
48
49
*) Redistributions of source code must retain the above copyright notice, this
50
list of conditions and the following disclaimer.
51
*) Redistributions in binary form must reproduce the above copyright notice,
52
this list of conditions and the following disclaimer in the documentation
53
and/or other materials provided with the distribution.
54
*) Neither the name of the NERI nor the names of its contributors
55
may be used to endorse or promote products derived from this software without
56
specific prior written permission.
57
58
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
59
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
60
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
61
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
62
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
63
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
64
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
65
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
66
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
67
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
68
POSSIBILITY OF SUCH DAMAGE.
69
70
*/
71
72
#ifndef LOWQUEUE_H
73
#define LOWQUEUE_H
74
75
#include <queue>
76
using namespace
std;
77
82
template
<
class
ELEMTYPE>
83
struct
LowPriPair
84
{
85
typedef
LowPriPair
value_type
;
86
typedef
LowPriPair
size_type
;
87
88
ELEMTYPE
m_element
;
89
long
m_pri
;
90
91
LowPriPair
()
92
{
93
}
94
95
LowPriPair
(
const
ELEMTYPE& a_element,
long
a_priority )
96
{
97
m_element = a_element;
98
m_pri = a_priority;
99
}
100
101
bool
operator< (
const
LowPriPair
& a_another_pri_pair)
const
102
{
103
return
m_pri > a_another_pri_pair.
m_pri
;
104
}
105
};
106
107
112
template
<
class
ELEMTYPE >
113
class
LowPriority
:
public
priority_queue< LowPriPair< ELEMTYPE > >
114
{
115
public
:
116
LowPriority
() : priority_queue <
LowPriPair
< ELEMTYPE> >()
117
{}
118
119
void
Push
( ELEMTYPE a_element,
long
a_priority )
120
{
121
this->push(
LowPriPair<ELEMTYPE>
( a_element, a_priority ));
122
}
123
124
void
Pop
()
125
{
126
this->pop();
127
}
128
129
bool
Empty
(
void
)
130
{
131
return
this->empty();
132
}
133
134
LowPriPair<ELEMTYPE>
Bottom
(
void
)
135
{
136
return
this->top();
137
}
138
};
139
140
#endif // LOWQUEUE_H
LowPriPair::LowPriPair
LowPriPair(const ELEMTYPE &a_element, long a_priority)
Definition:
lowqueue.h:95
LowPriority::Bottom
LowPriPair< ELEMTYPE > Bottom(void)
Definition:
lowqueue.h:134
LowPriority::Push
void Push(ELEMTYPE a_element, long a_priority)
Definition:
lowqueue.h:119
LowPriPair::LowPriPair
LowPriPair()
Definition:
lowqueue.h:91
LowPriPair::value_type
LowPriPair value_type
Definition:
lowqueue.h:85
LowPriPair
Used in event handling.
Definition:
lowqueue.h:83
LowPriPair::size_type
LowPriPair size_type
Definition:
lowqueue.h:86
LowPriority::Empty
bool Empty(void)
Definition:
lowqueue.h:129
LowPriPair::m_pri
long m_pri
Definition:
lowqueue.h:89
LowPriPair::m_element
ELEMTYPE m_element
Definition:
lowqueue.h:88
LowPriority::Pop
void Pop()
Definition:
lowqueue.h:124
LowPriority
Used in event handling.
Definition:
lowqueue.h:113
LowPriority::LowPriority
LowPriority()
Definition:
lowqueue.h:116
ALMaSS_all
Landscape
lowqueue.h
Generated on Wed Oct 2 2019 11:12:08 for ALMaSS Partridge ODdox by
1.8.16