This file is indexed.

/usr/include/sc/util/misc/compute.h is in libsc-dev 2.3.1-16.

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
//
// compute.h
//
// Copyright (C) 1996 Limit Point Systems, Inc.
//
// Author: Curtis Janssen <cljanss@limitpt.com>
// Maintainer: LPS
//
// This file is part of the SC Toolkit.
//
// The SC Toolkit is free software; you can redistribute it and/or modify
// it under the terms of the GNU Library General Public License as published by
// the Free Software Foundation; either version 2, or (at your option)
// any later version.
//
// The SC Toolkit is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public License
// along with the SC Toolkit; see the file COPYING.LIB.  If not, write to
// the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
//
// The U.S. Government is granted a limited license as per AL 91-7.
//

#ifdef __GNUC__
#pragma interface
#endif

#ifndef _util_misc_compute_h
#define _util_misc_compute_h

#include <set>

#include <util/state/state.h>
#include <util/state/stateio.h>

namespace sc {

class ResultInfo;
class StateIn;
class StateOut;

typedef ResultInfo* ResultInfoP;

/** The Compute class provides a means of keeping results up
    to date.  Derived classes can have member data which is
    registered with the compute class.  When this member data
    is accessed and it is not available, the compute member
    function is called.  The compute member must be implemented
    in derived classes and is responsible for computed the
    requested result. */
class Compute
{
   friend class ResultInfo;
   friend class AccResultInfo;
  private:
    std::set<ResultInfoP> _results;
    void add(ResultInfo*);

    // Prohibit copy
    Compute(const Compute&) {};

  protected:
    /** Recompute at least the results that have compute true
        and are not already computed.  This should only be called
        by Result's members. */
    virtual void compute() = 0;
  public:
    Compute();
    virtual ~Compute();

    /** Marks all results as being out of date.  Any subsequent access
        to results will cause Compute::compute() to be called. */
    virtual void obsolete();
};

/** This is a base class for all of Compute's result types.  Usually
 Result<Type> will be used to create a result that has a particular datum
 associated with it, however a ResultInfo can also be declared to keep
 track of datum's for which it is awkward to use Result_dec. */
class ResultInfo
{
  protected:
    int _compute;
    int _computed;
    Compute* _c;
    // This make sure that the datum is up to date.  If it is not then
    // Compute::compute() will be called.
    virtual void update();
  protected:
    ResultInfo(StateIn&,Compute*);
    ResultInfo(const ResultInfo&,Compute*);
    virtual void save_data_state(StateOut&);
    virtual void restore_state(StateIn&);
    ResultInfo& operator=(const ResultInfo&);
  public:
    ResultInfo(Compute*c);
    virtual ~ResultInfo();
    int& compute() { return _compute; }
    const int& compute() const { return _compute; }
    int compute(int c) { int r = _compute; _compute = c; return r; }
    int& computed() { return _computed; }
    const int& computed() const { return _computed; }
    virtual int needed() const;
};

/** This is like ResultInfo but the accuracy with which a result was
 computed as well as the desired accuracy are stored. */
class AccResultInfo: public ResultInfo
{
  private:
    double _actual_accuracy;
    double _desired_accuracy;
  protected:
    AccResultInfo(StateIn&,Compute*);
    AccResultInfo(const AccResultInfo&,Compute*);
    virtual void save_data_state(StateOut&);
    virtual void restore_state(StateIn&);
    AccResultInfo& operator=(const AccResultInfo&);
    void update();
  public:
    AccResultInfo(Compute*c);
    ~AccResultInfo();
    double actual_accuracy() const;
    double desired_accuracy() const;
    void set_desired_accuracy(double);
    void set_actual_accuracy(double);
    int computed_to_desired_accuracy() const
        { return computed() && _actual_accuracy <= _desired_accuracy; }
    int needed() const;
};

}

#include <util/misc/comptmpl.h>

namespace sc {

typedef NCResult<int> Resultint;
typedef NCResult<double> Resultdouble;
typedef NCAccResult<double> AccResultdouble;

}

#endif

// Local Variables:
// mode: c++
// c-file-style: "CLJ"
// End: