2
// Copyright (c) 2009 Mikko Mononen memon@inside.org
4
// This software is provided 'as-is', without any express or implied
5
// warranty. In no event will the authors be held liable for any damages
6
// arising from the use of this software.
7
// Permission is granted to anyone to use this software for any purpose,
8
// including commercial applications, and to alter it and redistribute it
9
// freely, subject to the following restrictions:
10
// 1. The origin of this software must not be misrepresented; you must not
11
// claim that you wrote the original software. If you use this software
12
// in a product, an acknowledgment in the product documentation would be
13
// appreciated but is not required.
14
// 2. Altered source versions must be plainly marked as such, and must not be
15
// misrepresented as being the original software.
16
// 3. This notice may not be removed or altered from any source distribution.
25
DT_NODE_CLOSED = 0x02,
33
unsigned int pidx : 30;
34
unsigned int flags : 2;
40
dtNodePool(int maxNodes, int hashSize);
42
inline void operator=(const dtNodePool&) {}
44
dtNode* getNode(unsigned int id);
45
const dtNode* findNode(unsigned int id) const;
47
inline unsigned int getNodeIdx(const dtNode* node) const
50
return (unsigned int)(node - m_nodes)+1;
53
inline dtNode* getNodeAtIdx(unsigned int idx)
56
return &m_nodes[idx-1];
59
inline int getMemUsed() const
61
return sizeof(*this) +
62
sizeof(dtNode)*m_maxNodes +
63
sizeof(unsigned short)*m_maxNodes +
64
sizeof(unsigned short)*m_hashSize;
68
inline unsigned int hashint(unsigned int a) const
80
unsigned short* m_first;
81
unsigned short* m_next;
92
inline void operator=(dtNodeQueue&) {}
106
dtNode* result = m_heap[0];
108
trickleDown(0, m_heap[m_size]);
112
inline void push(dtNode* node)
115
bubbleUp(m_size-1, node);
118
inline void modify(dtNode* node)
120
for (int i = 0; i < m_size; ++i)
122
if (m_heap[i] == node)
130
inline bool empty() const { return m_size == 0; }
132
inline int getMemUsed() const
134
return sizeof(*this) +
135
sizeof(dtNode*)*(m_capacity+1);
140
void bubbleUp(int i, dtNode* node);
141
void trickleDown(int i, dtNode* node);
144
const int m_capacity;
149
#endif // DETOURNODE_H
b'\\ No newline at end of file'