| http://www.sim.no/ http://www.coin3d.org/

- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List
- File Members

SbDict.h
1 #ifndef COIN_SBDICT_H
2 #define COIN_SBDICT_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 // *************************************************************************
28
29 // Internally, we should use the SbHash template class, since it
30 // provides a better interface than SbDict, and since the interface of
31 // SbDict has issues on 64-bit platforms when keeping strict
32 // compatibility with the original SbDict of SGI Inventor.
33
34 #if defined(COIN_INTERNAL) && !defined(COIN_ALLOW_SBDICT)
35 #error prefer SbHash over SbDict for internal code
36 #endif // COIN_INTERNAL
37
38 // *************************************************************************
39
40 #include <stddef.h>
41 #include <Inventor/SbBasic.h>
42
43 class SbPList;
44
45 // *************************************************************************
46
47 extern "C" {
48 typedef uintptr_t SbDictKeyType;
49 typedef void SbDictApplyFunc(SbDictKeyType key, void * value);
50 typedef void SbDictApplyDataFunc(SbDictKeyType key, void * value, void * data);
51 typedef SbDictKeyType SbDictHashingFunc(const SbDictKeyType key);
52 }
53
54 class COIN_DLL_API SbDict {
55 public:
56 SbDict(const int entries = 251);
57 SbDict(const SbDict & from);
58 ~SbDict();
59
60 SbDict & operator=(const SbDict & from);
61
62 typedef uintptr_t Key;
63
64 void applyToAll(SbDictApplyFunc * rtn) const;
65 void applyToAll(SbDictApplyDataFunc * rtn, void * data) const;
66 void clear(void);
67
68 SbBool enter(const Key key, void * const value);
69 SbBool find(const Key key, void *& value) const;
70 void makePList(SbPList & keys, SbPList & values);
71 SbBool remove(const Key key);
72
73 void setHashingFunction(SbDictHashingFunc * func);
74
75 private:
76 struct cc_hash * hashtable;
77
78 };
79
80 // *************************************************************************
81
82 #endif // !COIN_SBDICT_H

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