This file is indexed.

/usr/include/dcmtk/dcmnet/dcmsmap.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
/*
 *
 *  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:  dcmnet
 *
 *  Author:  Marco Eichelberg
 *
 *  Purpose: 
 *    template <class T> class DcmKeyValuePair
 *    template <class T> class DcmSimpleMap
 *    these template classes implement a simple map of key-value pairs.
 *    The template type must be copy constructable.
 *
 *  Last Update:      $Author: joergr $
 *  Update Date:      $Date: 2010-10-14 13:17:22 $
 *  CVS/RCS Revision: $Revision: 1.7 $
 *  Status:           $State: Exp $
 *
 *  CVS/RCS Log at end of file
 *
 */

#ifndef DCMSMAP_H
#define DCMSMAP_H

#include "dcmtk/config/osconfig.h"
#include "dcmtk/ofstd/oflist.h"   /* for class OFList<> */
#include "dcmtk/ofstd/ofstring.h" /* for class OFString */


/** this template class implements a simple key - value pair map
 *  that is used in template class DcmSimpleMap. Template type must be
 *  copy constructable.
 */
template <class T> class DcmKeyValuePair
{
public:
  /** constructor
   *  @param k key
   *  @param v value
   */
  DcmKeyValuePair(const OFString& k, const T& v)
  : key_(k)
  , value_(v)
  {
  }

  /// copy constructor
  DcmKeyValuePair(const DcmKeyValuePair& arg)
  : key_(arg.key_)
  , value_(arg.value_)
  {
  }

  /// destructor
  ~DcmKeyValuePair()
  {
  }

  /** return value of key-value pair
   *  @return value as const reference
   */
  const T& value() const
  {
    return value_;
  }

  /** return value of key-value pair
   *  @return value as non-const reference
   */
  T& value()
  {
    return value_;
  }

  /** checks if this entry matches the given key
   *  @return true if key matches, false otherwise
   */
  OFBool matches(const OFString &key) const
  {
    return (key_ == key);
  }

  /** comparison operator.
   *  @param arg object to compare with
   *  @return true if equal
   */
  OFBool operator==(const DcmKeyValuePair& arg) const
  {
    return (key_ == arg.key_) && (value_ == arg.value_); 
  }

private:
  /// private undefined copy assignment operator
  DcmKeyValuePair& operator=(const DcmKeyValuePair& arg);

  /// the key
  OFString key_;

  /// the value
  T value_;
};


/** this class implements a simple map of key-value pairs.
 *  No double keys are permitted, the second attempt to insert
 *  an element with a key already present will fail.
 *  Template type must be copy constructable.
 */
template <class T> class DcmSimpleMap
{
public:
  /// default constructor
  DcmSimpleMap()
  : list_()
  {
  }

  /// destructor
  ~DcmSimpleMap()
  {
    OFLIST_TYPENAME OFListIterator(DcmKeyValuePair<T> *) first(list_.begin());
    OFLIST_TYPENAME OFListIterator(DcmKeyValuePair<T> *) last(list_.end());
    while (first != last)
    {
      delete (*first);
      first = list_.erase(first);
    }
  }

  /** inserts a new key-value pair into the map
   *  by means of copy construction.
   *  @param key key
   *  @param value value
   *  @return true if successful, false if failed because key already present
   */
  OFBool add(const OFString& key, const T& value)
  {
    OFBool result = OFFalse;
    if (! lookup(key))
    {
      list_.push_back(new DcmKeyValuePair<T>(key, value));
      result = OFTrue;
    }
    return result;
  }

  /** looks up the given key in the map.
   *  @param key key
   *  @return pointer to value if found, NULL otherwise.
   */
  const T *lookup(const OFString& key) const
  {
    OFLIST_TYPENAME OFListConstIterator(DcmKeyValuePair<T> *) first(list_.begin());
    OFLIST_TYPENAME OFListConstIterator(DcmKeyValuePair<T> *) last(list_.end());
    while (first != last)
    {
      if ((*first)->matches(key)) return &((*first)->value());
      ++first;
    }
    return NULL;
  }

  /** return iterator to first element in list
   */
  OFLIST_TYPENAME OFListIterator( DcmKeyValuePair<T> * ) begin()
  {
    return list_.begin();
  }

  /** return iterator to end of list
   */
  OFLIST_TYPENAME OFListIterator( DcmKeyValuePair<T> * ) end()
  {
    return list_.end();
  }

private:
  /// private undefined copy constructor
  DcmSimpleMap(const DcmSimpleMap& arg);

  /// private undefined copy assignment operator
  DcmSimpleMap& operator=(const DcmSimpleMap& arg);

  /// the list of key-value pairs
  OFList<DcmKeyValuePair<T> *> list_;

};

#endif

/*
 * CVS/RCS Log
 * $Log: dcmsmap.h,v $
 * Revision 1.7  2010-10-14 13:17:22  joergr
 * Updated copyright header. Added reference to COPYRIGHT file.
 *
 * Revision 1.6  2005/12/08 16:02:17  meichel
 * Changed include path schema for all DCMTK header files
 *
 * Revision 1.5  2004/05/05 12:57:56  meichel
 * Simplified template class DcmSimpleMap<T>, needed for Sun CC 2.0.1
 *
 * Revision 1.4  2003/07/11 13:42:17  joergr
 * Added workaround to get rid of "implicit typename" warnings on gcc 3.x
 * (introduced macro OFLIST_TYPENAME).
 *
 * Revision 1.3  2003/07/03 15:56:19  meichel
 * Introduced workaround for "implicit typename" warning on gcc 3.x when
 *   compiling with HAVE_STL.
 *
 * Revision 1.2  2003/06/18 08:16:17  meichel
 * Added comparison operators to keep MSVC5 compiler happy
 *
 * Revision 1.1  2003/06/10 14:27:33  meichel
 * Initial release of class DcmAssociationConfiguration and support
 *   classes. This class maintains a list of association negotiation
 *   profiles that can be addressed by symbolic keys. The profiles may
 *   be read from a configuration file.
 *
 *
 */