This file is indexed.

/usr/include/dcmtk/dcmdata/dchashdi.h is in libdcmtk2-dev 3.6.0-9.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
/*
 *
 *  Copyright (C) 1994-2010, OFFIS e.V.
 *  All rights reserved.  See COPYRIGHT file for details.
 *
 *  This software and supporting documentation were developed by
 *
 *    OFFIS e.V.
 *    R&D Division Health
 *    Escherweg 2
 *    D-26121 Oldenburg, Germany
 *
 *
 *  Module:  dcmdata
 *
 *  Author:  Andrew Hewett
 *
 *  Purpose: Hash table interface for DICOM data dictionary
 *
 *  Last Update:      $Author: uli $
 *  Update Date:      $Date: 2010-11-10 12:04:06 $
 *  CVS/RCS Revision: $Revision: 1.22 $
 *  Status:           $State: Exp $
 *
 *  CVS/RCS Log at end of file
 *
 */

#ifndef DCHASHDI_H
#define DCHASHDI_H

#include "dcmtk/config/osconfig.h"    /* make sure OS specific configuration is included first */
#include "dcmtk/ofstd/oflist.h"
#include "dcmtk/ofstd/ofstream.h"

class DcmDictEntry;
class DcmTagKey;
class DcmHashDict;

/** the default size for a data dictionary hash table */
const int DCMHASHDICT_DEFAULT_HASHSIZE = 2047;

/// typedefs needed for MSVC5
typedef OFListIterator(DcmDictEntry *) OFListIteratorPDcmDictEntry;
typedef OFListConstIterator(DcmDictEntry *) OFListConstIteratorPDcmDictEntry;


/** iterator class for traversing a DcmDictEntryList
 */
class DcmDictEntryListIterator: public OFListIteratorPDcmDictEntry
{
public:

    /// default constructor
    DcmDictEntryListIterator() {}

    /** constructor
     *  @param iter reference to an object of the base class
     */
    DcmDictEntryListIterator(const OFListIterator(DcmDictEntry*)& iter) 
    : OFListIterator(DcmDictEntry*)(iter) {}

    /// copy assignment operator
    DcmDictEntryListIterator& operator=(const DcmDictEntryListIterator& i)
    {
      OFListIteratorPDcmDictEntry::operator=(i);
      return *this;
    }
};

/** const_iterator class for traversing a DcmDictEntryList
 */
class DcmDictEntryListConstIterator: public OFListConstIteratorPDcmDictEntry
{
public:

    /// default constructor
    DcmDictEntryListConstIterator() {}

    /** constructor
     *  @param iter reference to an object of the base class
     */
    DcmDictEntryListConstIterator(const OFListConstIterator(DcmDictEntry*)& iter) 
    : OFListConstIterator(DcmDictEntry*)(iter) {}

    /// copy assignment operator
    DcmDictEntryListConstIterator& operator=(const DcmDictEntryListConstIterator& i)
    {
      OFListConstIteratorPDcmDictEntry::operator=(i);
      return *this;
    }
};


/** an ordered list of pointers to DcmDictEntry objects
 */
class DcmDictEntryList : public OFList<DcmDictEntry *>
{
public:

    /// constructor
    DcmDictEntryList() {}

    /// destructor
    ~DcmDictEntryList();

    /// clears list and deletes all entries
    void clear();

    /** inserts an entry into the list and returns any replaced entry
     *  @param e new list entry
     *  @return replaced list entry or NULL
     */
    DcmDictEntry* insertAndReplace(DcmDictEntry* e);

    /* find an entry in the set */
    DcmDictEntry *find(const DcmTagKey& k, const char *privCreator);

private:

    /// private undefined copy constructor
    DcmDictEntryList(const DcmDictEntryList&);
  
    /// private undefined copy assignment operator
    DcmDictEntryList& operator=(const DcmDictEntryList&);
};


/** iterator class for traversing a DcmHashDict
 */
class DcmHashDictIterator
{
public:

    /// default constructor
    DcmHashDictIterator()
      : dict(NULL), hindex(0), iterating(OFFalse), iter()
        { init(NULL); }

    /** constructor, creates iterator to existing hash dictionary
     *  @param d pointer to dictionary 
     *  @param atEnd if true, iterator points after last element
     *   of hash dictionary, otherwise iterator points to first element.
     */
    DcmHashDictIterator(const DcmHashDict* d, OFBool atEnd = OFFalse)
      : dict(NULL), hindex(0), iterating(OFFalse), iter()
        { init(d, atEnd); }

    /// copy constructor
    DcmHashDictIterator(const DcmHashDictIterator& i) 
      : dict(i.dict), hindex(i.hindex), iterating(i.iterating), iter(i.iter)
        { }

    /// copy assignment operator
    DcmHashDictIterator& operator=(const DcmHashDictIterator& i) 
        { dict = i.dict; hindex = i.hindex; 
          iterating = i.iterating; iter = i.iter; return *this; }

    /// comparison equality
    OFBool operator==(const DcmHashDictIterator& x) const 
        { return (hindex == x.hindex) && (iter == x.iter); }

    /// comparison non-equality
    OFBool operator!=(const DcmHashDictIterator& x) const
        { return !(*this == x); }

    /// dereferencing of iterator
    const DcmDictEntry* operator*() const
        { return (*iter); }

    /// pre-increment operator
    DcmHashDictIterator& operator++()
        { stepUp(); return *this; }

    /// post-increment operator
    DcmHashDictIterator operator++(int)
        { DcmHashDictIterator tmp(*this); stepUp(); return tmp; }

private:

    /** initializes the iterator
     *  @param d pointer to hash dictionary, may be NULL
     *  @param atEnd if true, iterator points after last element
     *   of hash dictionary, otherwise iterator points to first element.
     */
    void init(const DcmHashDict *d, OFBool atEnd = OFFalse);

    /** implements increment operator on hash dictionary 
     */
    void stepUp();

    /// pointer to the hash dictionary this iterator traverses
    const DcmHashDict* dict;

    /// index of current bucket
    int hindex;

    /// flag indicating if iter is currently valid
    OFBool iterating;

    /// iterator for traversing a bucket in the hash table
    DcmDictEntryListIterator iter;    
};


/** a hash table of pointers to DcmDictEntry objects
 */
class DcmHashDict
{

public:
    /** constructor
     *  @param hashTabLen number of buckets in hash table
     */
    DcmHashDict(int hashTabLen = DCMHASHDICT_DEFAULT_HASHSIZE)
     : hashTab(NULL), hashTabLength(0), lowestBucket(0), highestBucket(0), entryCount(0)
        { _init(hashTabLen); }

    /// destructor
    ~DcmHashDict();

    /// counts total number of entries
    int size() const { return entryCount; }

    /// clears the hash table of all entries
    void clear();

    /** inserts an entry into hash table (deletes old entry if present)
     *  @param e pointer to new entry
     */
    void put(DcmDictEntry* e);

    /** hash table lookup for the given tag key and private creator name.
     *  @param key tag key
     *  @param privCreator private creator name, may be NULL
     */
    const DcmDictEntry* get(const DcmTagKey& key, const char *privCreator) const;

    /** deletes the entry for the given tag and private creator
     *  @param k tag key
     *  @param privCreator private creator name, may be NULL
     */
    void del(const DcmTagKey& k, const char *privCreator);

    // iterator over the contents of the hash table
    friend class DcmHashDictIterator;

    /// returns iterator to start of hash table
    DcmHashDictIterator begin() const
        { DcmHashDictIterator iter(this); return iter; }

    /// returns iterator to end of hash table
    DcmHashDictIterator end() const
        { DcmHashDictIterator iter(this, OFTrue); return iter; }

    /// prints some information about hash table bucket utilization
    STD_NAMESPACE ostream& loadSummary(STD_NAMESPACE ostream& out);

private:

    /// private unimplemented copy constructor
    DcmHashDict(const DcmHashDict &);

    /// private unimplemented copy assignment operator
    DcmHashDict &operator=(const DcmHashDict &);

    /// performs initialization for given hash table size, called from constructor
    void _init(int hashSize);

    /** compute hash value for given tag key
     *  @param k pointer to tag key
     *  @return hash value
     */    
    int hash(const DcmTagKey* k) const;
    
    /** inserts new entry into given list
     *  @param lst list to add to
     *  @param e new element to add, will be deleted upon destruction of the hash table
     *  @return pointer to replaced element, if any
     */
    DcmDictEntry* insertInList(DcmDictEntryList& lst, DcmDictEntry* e);

    /** removes the entry for the given tag and private creator
     *  @param lst list to remove from
     *  @param k tag key
     *  @param privCreator private creator name, may be NULL
     *  @return pointer to removed element, if any
     */
    DcmDictEntry* removeInList(DcmDictEntryList& lst, const DcmTagKey& k, const char *privCreator);

    /** searcjes entry for the given tag and private creator
     *  @param lst list to search in
     *  @param k tag key
     *  @param privCreator private creator name, may be NULL
     *  @return pointer to found element, NULL if not found
     */
    DcmDictEntry* findInList(DcmDictEntryList& lst, const DcmTagKey& k, const char *privCreator) const;

    /** array of (hash table size) pointers to DcmDictEntryList elements 
     *  implementing the different buckets of the hash table
     */
    DcmDictEntryList** hashTab;

    /// number of buckets in hash table
    int hashTabLength;

    /// index of lowest bucket for which the DcmDictEntryList has been initialized
    int lowestBucket;

    /// index of highest bucket for which the DcmDictEntryList has been initialized
    int highestBucket;

    /// number of entries in hash table
    int entryCount;

};

#endif /* DCHASHDI_H */


/*
** CVS/RCS Log:
** $Log: dchashdi.h,v $
** Revision 1.22  2010-11-10 12:04:06  uli
** Corrected DcmHashDictIterator::operator!=. Previously it ignored hindex.
**
** Revision 1.21  2010-10-14 13:15:41  joergr
** Updated copyright header. Added reference to COPYRIGHT file.
**
** Revision 1.20  2009-01-05 14:14:14  joergr
** Fixed bug in DcmHashDictIterator::operator!=() introduced with last commit.
** Reverted to old implementation.
**
** Revision 1.19  2008-12-19 14:57:59  joergr
** Fixed bug in DcmHashDictIterator::operator!=() - wrong comparison operand.
**
** Revision 1.18  2006/08/15 15:49:56  meichel
** Updated all code in module dcmdata to correctly compile when
**   all standard C++ classes remain in namespace std.
**
** Revision 1.17  2005/12/08 16:28:14  meichel
** Changed include path schema for all DCMTK header files
**
** Revision 1.16  2003/07/03 15:38:10  meichel
** Introduced DcmDictEntryListConstIterator, needed for compiling with HAVE_STL.
**
** Revision 1.15  2003/06/12 13:35:04  joergr
** Fixed inconsistent API documentation reported by Doxygen.
**
** Revision 1.14  2003/06/03 10:26:17  meichel
** Renamed local variables to avoid name clashes with STL
**
** Revision 1.13  2003/06/02 17:03:58  meichel
** Added typedef needed by MSVC5 when compiling with STL support
**
** Revision 1.12  2003/03/21 13:06:46  meichel
** Minor code purifications for warnings reported by MSVC in Level 4
**
** Revision 1.11  2002/07/23 14:21:26  meichel
** Added support for private tag data dictionaries to dcmdata
**
** Revision 1.10  2001/06/01 15:48:40  meichel
** Updated copyright header
**
** Revision 1.9  2000/05/03 14:19:08  meichel
** Added new class GlobalDcmDataDictionary which implements read/write lock
**   semantics for safe access to the DICOM dictionary from multiple threads
**   in parallel. The global dcmDataDict now uses this class.
**
** Revision 1.8  2000/03/08 16:26:15  meichel
** Updated copyright header.
**
** Revision 1.7  1999/03/31 09:24:39  meichel
** Updated copyright header in module dcmdata
**
** Revision 1.6  1998/07/15 15:48:48  joergr
** Removed several compiler warnings reported by gcc 2.8.1 with
** additional options, e.g. missing copy constructors and assignment
** operators, initialization of member variables in the body of a
** constructor instead of the member initialization list, hiding of
** methods by use of identical names, uninitialized member variables,
** missing const declaration of char pointers. Replaced tabs by spaces.
**
** Revision 1.5  1997/09/18 11:41:13  meichel
** Corrected forward and friend declarations (needed for DEC cxx).
**
** Revision 1.4  1997/09/18 07:24:07  meichel
** Missing operator= added to class DcmDictEntryListIterator
**
** Revision 1.3  1997/08/29 13:11:09  andreas
** Corrected copy constructor for DcmHashDictIterator
**
** Revision 1.2  1997/08/26 13:41:11  hewett
** Corrected a couple of minor spelling errors.
**
** Revision 1.1  1997/08/26 13:30:29  hewett
** Initial Version - Interface for hash table data structure for data dictionary.
**
*/