This file is indexed.

/usr/include/ThePEG/Utilities/Rebinder.h is in libthepeg-dev 1.8.0-3build1.

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
// -*- C++ -*-
//
// Rebinder.h is a part of ThePEG - Toolkit for HEP Event Generation
// Copyright (C) 1999-2011 Leif Lonnblad
//
// ThePEG is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
#ifndef ThePEG_Rebinder_H
#define ThePEG_Rebinder_H

#include "ThePEG/Config/ThePEG.h"
#include "Rebinder.fh"
#include <stdexcept>

namespace ThePEG {

/**
 * Rebinder is a class associating pairs of pointers to objects. It is
 * typically used when cloning a set of objects which have pointers to
 * eachother. The Rebinder is then set up so that a cloned object can
 * easily be retrieved given a pointer to the original one. The cloned
 * objects can then use the Rebinder to change their pointers so that
 * they henceforth points to the cloned copies.
 */
template <typename T>
class Rebinder {

public:
  
  /** Default constructor. */
  Rebinder() {}

public:

  ThePEG_DECLARE_TEMPLATE_POINTERS(T,TPtr);

  /** Map associating pairs of objects. */
  typedef std::map<cTPtr,TPtr> MapType;

  /** The iterator of the underlying map. */
  typedef typename MapType::const_iterator const_iterator;

public:

  /**
   * Return a pointer to the object associated with the argument.
   */
  TPtr & operator[](tcTPtr t) { return theMap[t]; }

  /**
   * Return a pointer to the object associated with the argument. If
   * no corresponding object is found a null pointer given by R() is
   * returned.
   * @param r a pointer to an object of a type which is derived from T.
   */
  template <typename R>
  R translate(const R & r) const {
    const_iterator it = theMap.find(r);
    return it == theMap.end()? R(): dynamic_ptr_cast<R>(it->second);
  }

  /**
   * Insert pointers to objects into the output iterator, pointers to
   * objects corresponding to the ones given by the range of input
   * iterators. If a given object in the input iterator range does not
   * exists, a null pointer will be inserted in the output iterator.
   */
  template <typename OutputIterator, typename InputIterator>
  void translate(OutputIterator r,
		 InputIterator first, InputIterator last) const {
    while ( first != last ) *r++ = translate(*first++);
  }

  /**
   * Return a pointer to the object associated with the argument. If
   * no corresponding object is found an exception is thrown.
   * @param r a pointer to an object of a type which is derived from T.
   */
  template <typename R>
  R alwaysTranslate(const R & r) const throw(std::runtime_error) {
    R ret;
    if ( !r ) return ret;
    const_iterator it = theMap.find(r);
    ret = (it == theMap.end()? R(): dynamic_ptr_cast<R>(it->second));
    if ( !ret ) throw std::runtime_error("Rebinder exception");
    return ret;
  }

  /**
   * Insert pointers to objects into the output iterator, pointers to
   * objects corresponding to the ones given by the range of input
   * iterators. If a given object in the input iterator range does not
   * exists, an exception will be thrown.
   */
  template <typename OutputIterator, typename InputIterator>
  void alwaysTranslate(OutputIterator r, InputIterator first, InputIterator last)
    const throw(std::runtime_error) {
    while ( first != last ) *r++ = alwaysTranslate(*first++);
  }

  /**
   * Acces the underlying map representation.
   */
  const MapType & map() const { return theMap; }

private:


  /**
   * The underlying map representation.
   */
  MapType theMap;

private:

  /** The copy constructor is private and not implemented */
  Rebinder(const Rebinder &);

  /** The assignment operator is private and not implemented */
  Rebinder & operator=(const Rebinder &);

};


}

#endif /* ThePEG_Rebinder_H */