This file is indexed.

/usr/include/vtk-7.1/vtkdiy/collection.hpp is in libvtk7-dev 7.1.1+dfsg1-2.

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
#ifndef DIY_COLLECTION_HPP
#define DIY_COLLECTION_HPP

#include <vector>

#include "serialization.hpp"
#include "storage.hpp"
#include "thread.hpp"


namespace diy
{
  class Collection
  {
    public:
      typedef       void*                                       Element;
      typedef       std::vector<Element>                        Elements;
      typedef       critical_resource<int, recursive_mutex>     CInt;

      typedef       void* (*Create)();
      typedef       void  (*Destroy)(void*);
      typedef       detail::Save                                Save;
      typedef       detail::Load                                Load;

    public:
                    Collection(Create               create,
                               Destroy              destroy,
                               ExternalStorage*     storage,
                               Save                 save,
                               Load                 load):
                        create_(create),
                        destroy_(destroy),
                        storage_(storage),
                        save_(save),
                        load_(load),
                        in_memory_(0)               {}

      size_t        size() const                    { return elements_.size(); }
      const CInt&   in_memory() const               { return in_memory_; }
      inline void   clear();

      int           add(Element e)                  { elements_.push_back(e); external_.push_back(-1); ++(*in_memory_.access()); return elements_.size() - 1; }
      void*         release(int i)                  { void* e = get(i); elements_[i] = 0; return e; }

      void*         find(int i) const               { return elements_[i]; }                        // possibly returns 0, if the element is unloaded
      void*         get(int i)                      { if (!find(i)) load(i); return find(i); }      // loads the element first, and then returns its address

      int           available() const               { int i = 0; for (; i < (int)size(); ++i) if (find(i) != 0) break; return i; }

      inline void   load(int i);
      inline void   unload(int i);

      Create        creator() const                 { return create_; }
      Destroy       destroyer() const               { return destroy_; }
      Load          loader() const                  { return load_; }
      Save          saver() const                   { return save_; }

      void*         create() const                  { return create_(); }
      void          destroy(int i)                  { if (find(i)) { destroy_(find(i)); elements_[i] = 0; } else if (external_[i] != -1) storage_->destroy(external_[i]); }

      bool          own() const                     { return destroy_ != 0; }

      ExternalStorage*      storage() const         { return storage_; }

    private:
      Create                create_;
      Destroy               destroy_;
      ExternalStorage*      storage_;
      Save                  save_;
      Load                  load_;

      Elements              elements_;
      std::vector<int>      external_;
      CInt                  in_memory_;
  };
}

void
diy::Collection::
clear()
{
  if (own())
    for (size_t i = 0; i < size(); ++i)
      destroy(i);
  elements_.clear();
  external_.clear();
  *in_memory_.access() = 0;
}

void
diy::Collection::
unload(int i)
{
  //BinaryBuffer bb;
  void* e = find(i);
  //save_(e, bb);
  //external_[i] = storage_->put(bb);
  external_[i] = storage_->put(e, save_);

  destroy_(e);
  elements_[i] = 0;

  --(*in_memory_.access());
}

void
diy::Collection::
load(int i)
{
  //BinaryBuffer bb;
  //storage_->get(external_[i], bb);
  void* e = create_();
  //load_(e, bb);
  storage_->get(external_[i], e, load_);
  elements_[i] = e;
  external_[i] = -1;

  ++(*in_memory_.access());
}

#endif