This file is indexed.

/usr/include/wreport/dtable.h is in libwreport-dev 2.14-1.

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
/*
 * Copyright (C) 2005--2010  ARPA-SIM <urpsim@smr.arpa.emr.it>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License.
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 *
 * Author: Enrico Zini <enrico@enricozini.com>
 */

#ifndef WREPORT_DTABLE_H
#define WREPORT_DTABLE_H

#include <wreport/opcode.h>
#include <string>
#include <vector>

namespace wreport {

/** @file
 * @ingroup bufrex
 * Implement fast access to information about WMO expansion tables D.
 */

namespace dtable {
/**
 * D-table entry
 */
struct Entry
{
	/// Varcode to be expanded
	Varcode code;
	/// Position in the main table where the expansion begins
	unsigned begin;
	/// Position in the main table one past where the expansion ends
	unsigned end;

protected:
    /// Constructor used internally by DTable::load
    Entry(Varcode code, unsigned begin, unsigned end)
        : code(code), begin(begin), end(end) {}

    friend class wreport::DTable;
};
}

/**
 * D-table with Dxxyyy aggregate code expansions
 */
struct DTable
{
protected:
	/// Table ID
	std::string m_id;

public:
	/**
	 * One single table with the concatenation of all the expansion
	 * varcodes
	 */
	std::vector<Varcode> varcodes;

	/**
	 * Expansion entries with pointers inside \a varcodes
	 */
	std::vector<dtable::Entry> entries;

	DTable();
	~DTable();

	/// Table ID
	const std::string& id() const throw () { return m_id; }

	/// True if the table has been loaded
	bool loaded() const throw () { return !m_id.empty(); }

	/**
	 * Load a table
	 *
	 * @param idfile
	 *   pair of (table id, pathname of the table on disk)
	 */
	void load(const std::pair<std::string, std::string>& idfile);

	/**
	 * Query the DTable
	 *
	 * @param var
	 *   entry code (i.e. DXXYYY as a wreport::Varcode WR_VAR(3, xx, yyy).
	 * @return
	 *   the bufrex_opcode chain that contains the expansion elements
	 *   (must be deallocated by the caller using bufrex_opcode_delete)
	 */
	Opcodes query(Varcode var) const;

	/**
	 * Return a DTable by id, loading it if necessary
	 *
	 * Once loaded, the table will be cached in memory for reuse, and
	 * further calls to get() will return the cached version.
	 *
	 * The cached tables are never deallocated, so the returned pointer is
	 * valid through the whole lifetime of the program.
	 *
	 * @param id
	 *   ID of the DTable data to access
	 */
	static const DTable* get(const char* id);

	/**
	 * Same as get(), but explicitly specifies the pathname.
	 *
	 * @param idfile
	 *   pair of (table id, pathname of the table on disk)
	 */
	static const DTable* get(const std::pair<std::string, std::string>& idfile);
};

}

#endif
/* vim:set ts=4 sw=4: */