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

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) 1998-2007 by Systems in Motion. All rights reserved.
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 Systems in Motion about acquiring
18  * a Coin Professional Edition License.
19  *
20  * See http://www.coin3d.org/ for more information.
21  *
22  * Systems in Motion, Postboks 1283, Pirsenteret, 7462 Trondheim, 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 class COIN_DLL_API SbDict {
48 public:
49  SbDict(const int entries = 251);
50  SbDict(const SbDict & from);
51  ~SbDict();
52 
53  SbDict & operator=(const SbDict & from);
54 
55  typedef unsigned long Key;
56 
57  void applyToAll(void (* rtn)(Key key, void * value)) const;
58  void applyToAll(void (* rtn)(Key key, void * value, void * data),
59  void * data) const;
60  void clear(void);
61 
62  SbBool enter(const Key key, void * const value);
63  SbBool find(const Key key, void *& value) const;
64  void makePList(SbPList & keys, SbPList & values);
65  SbBool remove(const Key key);
66 
67  void setHashingFunction(Key (*func)(const Key key));
68 
69 private:
70  struct cc_hash * hashtable;
71  static void copyval(Key key, void * value, void * data);
72 };
73 
74 // *************************************************************************
75 
76 #endif // !COIN_SBDICT_H
The SbPList class is a container class for void pointers.
Definition: SbPList.h:31
The SbDict class organizes a dictionary of keys and values.It uses hashing to quickly insert and find...
Definition: SbDict.h:47

Copyright © 1998-2007 by Systems in Motion AS. All rights reserved.

Generated on Fri Jul 20 2018 for Coin by Doxygen. 1.8.14