This file is indexed.

/usr/include/magics/BinningObject.h is in libmagics++-dev 2.18.15-5.

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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
/*! \file BinningObject.h
    \brief Definition of the Template class BinningObject.
    
    Magics Team - ECMWF 2011
    
    Started: Thu 7-Apr-2011
    
    Changes:
    
*/

#ifndef BinningObject_H
#define BinningObject_H

#include "magics.h"
#include "Matrix.h"
#include "BinningObjectAttributes.h"
#include "BasePointsHandler.h"
#include "IntervalMap.h"
#include "Factory.h"
#include "MagTranslator.h"

namespace magics {

  
class BinningObject: public BinningObjectAttributes {

public:
	BinningObject();
	~BinningObject();

	virtual BinningObject* clone() const { return new BinningObject(); }

	Matrix* operator()(PointsList& points)
	{

		Matrix* matrix = new Matrix();

			double minx = points.minX();
			double maxx = points.maxX();
			double miny = points.minY();
			double maxy = points.maxY();
			double max = points.min();
			double min = points.max();

		IntervalMap<int> xbinns;
		IntervalMap<int> ybinns;

		map<string, binner>::iterator binner = binners_x_.find(x_);

		if ( binner != binners_x_.end() ) {
		   	 (this->*binner->second)(matrix->columnsAxis(), minx, maxx);
		   	 if ( matrix->columnsAxis().empty() ) {
		   		MagLog::warning() << " could not find any binns: return to count method" << endl;
		   		countx(matrix->columnsAxis(), minx, maxx);
		   	 }
		}
		else {
			MagLog::warning() << " could not find the method " << x_ << " for binning: return to count method" << endl;
			countx(matrix->columnsAxis(), minx, maxx);
		}
		build(matrix->columnsAxis(), xbinns);
		binner = binners_y_.find(y_);

		if ( binner != binners_y_.end() ) {
			(this->*binner->second)(matrix->rowsAxis(), miny, maxy);
			 if ( matrix->rowsAxis().empty() ) {
				   		MagLog::warning() << " could not find any binns: return to count method" << endl;
				   		county(matrix->columnsAxis(), minx, maxx);
				   	 }
		}
		else {
			MagLog::warning() << " could not find the method " << y_ << " for binning: return to count method" << endl;
			county(matrix->rowsAxis(), miny, maxy);
		}
		build(matrix->rowsAxis(), ybinns);


		matrix->setMapsAxis();
//		double val = 0;
		vector<double> total;

		for ( int j = 0; j < matrix->columns(); j++)
			for ( int i = 0; i <  matrix->rows(); i++) {
				matrix->push_back(0);
				total.push_back(0);
			}

		double columns = matrix->columns();
		points.setToFirst();
		while ( points.more() ) {
			const UserPoint& point = points.current();
			int x = xbinns.find(point.x_, -1);
			int y = ybinns.find(point.y_, -1);
			if ( x!= -1 && x!=-1) {
				(*matrix)[ y * columns + x] = (*matrix)[ y * columns + x]+1;
				total[ y * columns + x] = total[y * columns + x]+point.value();
			}
			points.advance();
		}

		if ( min != max ) {
			for (unsigned int i = 0; i < matrix->size(); ++i) {

				if ( (*matrix)[i] != 0 )
					(*matrix)[i] = total[i]/(*matrix)[i];
			}
		}
		return matrix;
	}


protected:
     //! Method to print string about this class on to a stream of type ostream (virtual).
	 void print(ostream&) const;
	 typedef void (BinningObject::*binner)(vector<double>&, double, double);
	 		 map<string,  binner> binners_x_;
	 		 map<string,  binner> binners_y_;

	 	void build(vector<double>& vals, IntervalMap<int>& binns);
	 	 void countx(vector<double>&, double, double);
	 	 void listx(vector<double>&, double, double);
	 	 void intervalx(vector<double>&, double, double);

	 	 void county(vector<double>&, double, double);
	 	 void listy(vector<double>&, double, double);
	 	 void intervaly(vector<double>&, double, double);
private:
    //! Copy constructor - No copy allowed
	BinningObject(const BinningObject&);
    //! Overloaded << operator to copy - No copy allowed
	BinningObject& operator=(const BinningObject&);

// -- Friends
    //! Overloaded << operator to call print().
	friend ostream& operator<<(ostream& s,const BinningObject& p)
		{ p.print(s); return s; }

};


class NoBinningObject: public BinningObject {

public:
	NoBinningObject() {}
	~NoBinningObject() {}
	BinningObject* clone() const { return new NoBinningObject(); }
};


template <>
class MagTranslator<string, BinningObject> {
public:
	BinningObject* operator()(const string& val )
	{
		return SimpleObjectMaker<BinningObject>::create(val);
	}

	BinningObject* magics(const string& param)
	{
		string val;
		ParameterManager::get(param, val);
		return (*this)(val);
	}

};
} // namespace magics
#endif