This file is indexed.

/usr/include/aff4/aff4_registry.h is in libaff4-dev 0.24.post1-3.

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
/*
  Defines a library wide registration system for classes.
*/
#ifndef SRC_AFF4_REGISTRY_H_
#define SRC_AFF4_REGISTRY_H_

#include <glog/logging.h>

#include <unordered_map>
#include <memory>
#include <string>
#include <iostream>
#include <functional>

using std::string;
using std::unique_ptr;
using std::unordered_map;
using std::function;

class DataStore;
class URN;

template<class T>
class ClassFactory {
 public:
  unordered_map<
    string, function<T* (DataStore *, const URN *)> > factoryFunctionRegistry;

  unique_ptr<T> CreateInstance(char *name, DataStore *resolver,
                               const URN *urn = nullptr) {
    return CreateInstance(string(name), resolver, urn);
  }

  unique_ptr<T> CreateInstance(string name, DataStore *data,
                               const URN *urn = nullptr) {
    T* instance = nullptr;

    // find name in the registry and call factory method.
    auto it = factoryFunctionRegistry.find(name);
    if (it != factoryFunctionRegistry.end()) {
      instance = it->second(data, urn);
    }

    return unique_ptr<T>(instance);
  }

  void RegisterFactoryFunction(
      string name, function<
        T*(DataStore *, const URN *)> classFactoryFunction) {
    // register the class factory function
    factoryFunctionRegistry[name] = classFactoryFunction;
  }
};

#endif  // SRC_AFF4_REGISTRY_H_