~louis/ubuntu/trusty/clamav/lp799623_fix_logrotate

« back to all changes in this revision

Viewing changes to libclamav/c++/llvm/include/llvm/ADT/DenseSet.h

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2010-03-12 11:30:04 UTC
  • mfrom: (0.41.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20100312113004-b0fop4bkycszdd0z
Tags: 0.96~rc1+dfsg-0ubuntu1
* New upstream RC - FFE (LP: #537636):
  - Add OfficialDatabaseOnly option to clamav-base.postinst.in
  - Add LocalSocketGroup option to clamav-base.postinst.in
  - Add LocalSocketMode option to clamav-base.postinst.in
  - Add CrossFilesystems option to clamav-base.postinst.in
  - Add ClamukoScannerCount option to clamav-base.postinst.in
  - Add BytecodeSecurity opiton to clamav-base.postinst.in
  - Add DetectionStatsHostID option to clamav-freshclam.postinst.in
  - Add Bytecode option to clamav-freshclam.postinst.in
  - Add MilterSocketGroup option to clamav-milter.postinst.in
  - Add MilterSocketMode option to clamav-milter.postinst.in
  - Add ReportHostname option to clamav-milter.postinst.in
  - Bump libclamav SO version to 6.1.0 in libclamav6.install
  - Drop clamdmon from clamav.examples (no longer shipped by upstream)
  - Drop libclamav.a from libclamav-dev.install (not built by upstream)
  - Update SO version for lintian override for libclamav6
  - Add new Bytecode Testing Tool, usr/bin/clambc, to clamav.install
  - Add build-depends on python and python-setuptools for new test suite
  - Update debian/copyright for the embedded copy of llvm (using the system
    llvm is not currently feasible)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//===- llvm/ADT/DenseSet.h - Dense probed hash table ------------*- C++ -*-===//
 
2
//
 
3
//                     The LLVM Compiler Infrastructure
 
4
//
 
5
// This file is distributed under the University of Illinois Open Source
 
6
// License. See LICENSE.TXT for details.
 
7
//
 
8
//===----------------------------------------------------------------------===//
 
9
//
 
10
// This file defines the DenseSet class.
 
11
//
 
12
//===----------------------------------------------------------------------===//
 
13
 
 
14
#ifndef LLVM_ADT_DENSESET_H
 
15
#define LLVM_ADT_DENSESET_H
 
16
 
 
17
#include "llvm/ADT/DenseMap.h"
 
18
 
 
19
namespace llvm {
 
20
 
 
21
/// DenseSet - This implements a dense probed hash-table based set.
 
22
///
 
23
/// FIXME: This is currently implemented directly in terms of DenseMap, this
 
24
/// should be optimized later if there is a need.
 
25
template<typename ValueT, typename ValueInfoT = DenseMapInfo<ValueT> >
 
26
class DenseSet {
 
27
  typedef DenseMap<ValueT, char, ValueInfoT> MapTy;
 
28
  MapTy TheMap;
 
29
public:
 
30
  DenseSet(const DenseSet &Other) : TheMap(Other.TheMap) {}
 
31
  explicit DenseSet(unsigned NumInitBuckets = 64) : TheMap(NumInitBuckets) {}
 
32
 
 
33
  bool empty() const { return TheMap.empty(); }
 
34
  unsigned size() const { return TheMap.size(); }
 
35
 
 
36
  void clear() {
 
37
    TheMap.clear();
 
38
  }
 
39
 
 
40
  bool count(const ValueT &V) const {
 
41
    return TheMap.count(V);
 
42
  }
 
43
 
 
44
  bool erase(const ValueT &V) {
 
45
    return TheMap.erase(V);
 
46
  }
 
47
 
 
48
  DenseSet &operator=(const DenseSet &RHS) {
 
49
    TheMap = RHS.TheMap;
 
50
    return *this;
 
51
  }
 
52
 
 
53
  // Iterators.
 
54
 
 
55
  class Iterator {
 
56
    typename MapTy::iterator I;
 
57
  public:
 
58
    Iterator(const typename MapTy::iterator &i) : I(i) {}
 
59
 
 
60
    ValueT& operator*() { return I->first; }
 
61
    ValueT* operator->() { return &I->first; }
 
62
 
 
63
    Iterator& operator++() { ++I; return *this; }
 
64
    bool operator==(const Iterator& X) const { return I == X.I; }
 
65
    bool operator!=(const Iterator& X) const { return I != X.I; }
 
66
  };
 
67
 
 
68
  class ConstIterator {
 
69
    typename MapTy::const_iterator I;
 
70
  public:
 
71
    ConstIterator(const typename MapTy::const_iterator &i) : I(i) {}
 
72
 
 
73
    const ValueT& operator*() { return I->first; }
 
74
    const ValueT* operator->() { return &I->first; }
 
75
 
 
76
    ConstIterator& operator++() { ++I; return *this; }
 
77
    bool operator==(const ConstIterator& X) const { return I == X.I; }
 
78
    bool operator!=(const ConstIterator& X) const { return I != X.I; }
 
79
  };
 
80
 
 
81
  typedef Iterator      iterator;
 
82
  typedef ConstIterator const_iterator;
 
83
 
 
84
  iterator begin() { return Iterator(TheMap.begin()); }
 
85
  iterator end() { return Iterator(TheMap.end()); }
 
86
 
 
87
  const_iterator begin() const { return ConstIterator(TheMap.begin()); }
 
88
  const_iterator end() const { return ConstIterator(TheMap.end()); }
 
89
 
 
90
  std::pair<iterator, bool> insert(const ValueT &V) {
 
91
    return TheMap.insert(std::make_pair(V, 0));
 
92
  }
 
93
  
 
94
  // Range insertion of values.
 
95
  template<typename InputIt>
 
96
  void insert(InputIt I, InputIt E) {
 
97
    for (; I != E; ++I)
 
98
      insert(*I);
 
99
  }
 
100
};
 
101
 
 
102
} // end namespace llvm
 
103
 
 
104
#endif