This file is indexed.

/usr/include/terralib/kernel/TeDecoderVirtualMemory.h is in libterralib-dev 4.3.0+dfsg.2-11.

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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
/************************************************************************************
TerraLib - a library for developing GIS applications.
Copyright © 2001-2007 INPE and Tecgraf/PUC-Rio.

This code is part of the TerraLib library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

You should have received a copy of the GNU Lesser General Public
License along with this library.

The authors reassure the license terms regarding the warranties.
They specifically disclaim any warranties, including, but not limited to,
the implied warranties of merchantability and fitness for a particular purpose.
The library provided hereunder is on an "as is" basis, and the authors have no
obligation to provide maintenance, support, updates, enhancements, or modifications.
In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
indirect, special, incidental, or consequential damages arising out of the use
of this library and its documentation.
*************************************************************************************/
/*! \file TeDecoderVirtualMemory.h
    \brief This file supports a virtual memory strategy to deal whith raster structures
*/
#ifndef  __TERRALIB_INTERNAL_DECODERVIRTUALMEMORY_H
#define  __TERRALIB_INTERNAL_DECODERVIRTUALMEMORY_H

#include "TeDefines.h"
#include "TeDecoder.h"

#include <queue>
#include <vector>

using namespace std;

//! A page of memory
class TL_DLL TeMemoryPage
{
public:
	void*   data_;			//<! Pointer to the data in memory
	bool	used_;			//<! Flag that indicate if the page was modified in memory
	unsigned long size_;	//<! Page number of elements

	int ulLin_;				//<! Line index of the upper-left corner
	int ulCol_;				//<! Column index of the upper-left corner
	double   defValue_;		//<! Default value (fo initially fill the page)
	TeDataType dataType_;	//<! Pixel data type

	//! Constructor
	TeMemoryPage(unsigned long size, double defValue, TeDataType dataType = TeDOUBLE);
	
	//! Destructor
	~TeMemoryPage();

	//! Copy constructor
	TeMemoryPage(const TeMemoryPage& rhs);
	
	//! Operator =
	TeMemoryPage& operator=(const TeMemoryPage& rhs);

	//! Returns the value of on position within the block
	/*
		\par col column identifier of the position
		\par lin line identifier of the position
		\par nCols number of columns per line of the block
		\returns the value of the position indicated by (col x lin)
	*/
	double getVal(int col,int lin, int nCols);

	//! Sets the value of a position within the block
	/*
		\par col column identifier of the position
		\par lin line identifier of the position
		\par nCols number of columns per line of the block
		\par val the value to be put in the position
	*/
	void setVal(int col,int lin,int nCols, double val);

	//! Set all positions of the page to the default value;
	void clear();

	//! Returns the physical size of a memory page
	long pageSize();
};

class TL_DLL TeBlockIndex{
public:
	TeBlockIndex()
	{
		col_ = 0;
		lin_ = 0;
		band_ = -1;
	}

	int col_;
	int lin_;
	int band_;

	int column()  const
	{
		return col_;
	}

	int line() const
	{
		return lin_;
	}

	int band() const
	{
		return band_;
	}

	int operator==(const TeBlockIndex& idx2) const
	{
		if(col_ != idx2.col_)
			return 0;

		if(lin_ != idx2.lin_)
			return 0;

		return (band_ == idx2.band_);
	}
};

//! Implements a virtual memory strategy to decode raster in blocks
/*
	It should be used as a parent class of decoder that access raster
	blocks from a physical storage
*/
class TL_DLL TeDecoderVirtualMemory: public TeDecoder
{
public:

	//! Empty constructor
	TeDecoderVirtualMemory() {};
	
	//! Constructor from parameters
	TeDecoderVirtualMemory( const TeRasterParams par);

	//! Destructor
	virtual ~TeDecoderVirtualMemory();

	//! Sets the value of a specific raster pixel 
	/*!
		\param col pixel column identifier
		\param lin pixel line identifier
		\param val pixel value being inserted
		\param band pixel band identifier
	*/
	bool getElement(int col,int lin, double &val,int band);

	//! Gets an specific element (col, lin, band) of a raster data
	/*!
		\param col pixel column identifier
		\param lin pixel line identifier
		\param val pixel value being retrieved
		\param band pixel band identifier
	*/
	bool setElement(int col, int lin, double val,int band);

	//! Initializes the internal structures of the decoder, from its raster parameters structure.
	void init();

	//! Clears  the decoder internal structures
	bool clear();

	//! Defines the physical size of the cache
	void setCacheSize(int size);  

	//! Returns the physical size of the cache
	int getCacheSize();

	//! Defines the number of tiles in the cache
	void setCacheNTiles(int n);

	//! Returns the number of tiles in the cache
	int getCacheNTiles();

protected:
	struct TeBlockIndexMapFunc
	{
		bool operator()(const TeBlockIndex& idx1, const TeBlockIndex& idx2) const;
	};

	//! Saves a raster tile from a virtual memory to permanent storage
	/*! 
	    \param index block index
		\param buf pointer to a raster tile in memory
		\param bsize block size
	*/	
	virtual bool putRasterBlock(const TeBlockIndex& index, void *buf, long bsize) = 0; /******/

	//! Gets the raster block with index identifier
	/*!
		\param index block index
		\param buf pointer to a raster tile in memory
	*/
	virtual bool getRasterBlock(const TeBlockIndex& index, void *buf) = 0; /******/

	//! Codifies the unique identifier of the raster block that contains a certain pixel
	/*!
		\param col column number
		\param lin  pixel line number
		\param band pixel band 
		\return block index
	*/
	virtual TeBlockIndex blockIndex(int col, int lin, int band); 

	//! Returns the parameters of a tile from its indexs
	virtual void blockIndexPos( const TeBlockIndex& index, int& ulCol, int& ulLin, int& band); /******/

	//! Retrieve a block of the cache that contains an element
	TeMemoryPage* loadBlock(int col,int lin, int band);

private:

	//! A map of string identifiers to pointer to memory pages 
	typedef map<TeBlockIndex, TeMemoryPage*, TeBlockIndexMapFunc> MapMemoryPage; 

	//! A const iterator to a map of pages
	typedef MapMemoryPage::const_iterator MapMemoryPageIterator;

	MapMemoryPage virtualMemory_;
	queue<TeBlockIndex> pagesQueue_; 
	vector<TeBlockIndex> indexCache_; 
	vector<TeMemoryPage*> pageCache_;
};

inline bool TeDecoderVirtualMemory::TeBlockIndexMapFunc::operator()(const TeBlockIndex& idx1, const TeBlockIndex& idx2) const
{
  if(idx1.band_ != idx2.band_)
    return (idx1.band_ < idx2.band_);

  if(idx1.lin_ != idx2.lin_)
    return idx1.lin_ < idx2.lin_;

  return (idx1.col_ < idx2.col_);
}
#endif