Coin Logo http://www.sim.no/
http://www.coin3d.org/

SbHeap.h
1#ifndef COIN_SBHEAP_H
2#define COIN_SBHEAP_H
3
4/**************************************************************************\
5 *
6 * This file is part of the Coin 3D visualization library.
7 * Copyright (C) by Kongsberg Oil & Gas Technologies.
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * ("GPL") version 2 as published by the Free Software Foundation.
12 * See the file LICENSE.GPL at the root directory of this source
13 * distribution for additional information about the GNU GPL.
14 *
15 * For using Coin with software that can not be combined with the GNU
16 * GPL, and for taking advantage of the additional benefits of our
17 * support services, please contact Kongsberg Oil & Gas Technologies
18 * about acquiring a Coin Professional Edition License.
19 *
20 * See http://www.coin3d.org/ for more information.
21 *
22 * Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY.
23 * http://www.sim.no/ sales@sim.no coin-support@coin3d.org
24 *
25\**************************************************************************/
26
27#include <Inventor/SbBasic.h>
28#include <Inventor/lists/SbList.h>
29#include <stddef.h>
30
31typedef struct
32{
33 float (*eval_func)(void*);
34 int (*get_index_func)(void*);
35 void (*set_index_func)(void*, int);
37
38class COIN_DLL_API SbHeap {
39public:
41 const int initsize = 1024);
42 ~SbHeap();
43
44 void emptyHeap(void);
45 int size(void) const;
46 int add(void *obj);
47 void remove(const int pos);
48 void remove(void *obj);
49 void *extractMin();
50 void *getMin();
51 void *operator[](const int idx);
52
53 void newWeight(void *obj, int hpos = -1);
54 SbBool buildHeap(SbBool (*progresscb)(float percentage, void *data) = NULL,
55 void *data = NULL);
56 SbBool traverseHeap(SbBool (*func)(void *, void *), void *userdata) const;
57
58private:
59 SbHeapFuncs funcs;
60 SbList <void*> heap;
61
62 int heapInsert(void *obj);
63 void *heapExtractMin(void);
64 void heapReserve(const int newsize);
65 void heapify(const int idx);
66};
67
68#endif // !COIN_SBHEAP_H
The SbHeap class is a generic heap class.
Definition SbHeap.h:38
The SbHeapFuncs struct is used to specify functions on heap elements.
Definition SbHeap.h:32

Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.

Generated on Wed Jul 17 2024 for Coin by Doxygen 1.12.0.