ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
Loading...
Searching...
No Matches
FormulaRegions.h
Go to the documentation of this file.
1/**
2 * @file FormulaRegions.h
3 * @brief The parts of a circuit @c sr_formula_rows renders a few rows from.
4 *
5 * @c sr_formula_rows writes the formula of a token as rows of bounded size,
6 * a gate whose formula is too large being named and given a row of its own
7 * (see @c FormulaRows in @c provenance_evaluate_compiled.cpp). A row only
8 * reads the gates below its own down to the named ones, so the circuit is
9 * not loaded whole: the store answers, for a few rows at a time, the
10 * @em region of each, the named gates in it left out as @em stubs.
11 *
12 * The size of a formula is counted in symbols, a gate for one, written out
13 * at each use; a named descendant counts for one, its name. A gate whose
14 * size exceeds the @c cap of the request is named. The store decides it,
15 * from the circuit alone, stopping the count of a gate once past the cap.
16 */
17#ifndef FORMULA_REGIONS_H
18#define FORMULA_REGIONS_H
19
20#include <string>
21#include <vector>
22
23#include <boost/serialization/string.hpp>
24#include <boost/serialization/vector.hpp>
25
26#include "GenericCircuit.h"
27
28/** @brief What a region is asked for. */
30 pg_uuid_t gate; ///< The gate
31 unsigned long from; ///< First child of the range asked for
32 /** Number of children asked for, from @c from; 0 for the region of the
33 * gate itself */
34 unsigned long count;
35};
36
37/** @brief A gate left out of a region: a named one. */
39 std::string uuid; ///< The gate
40 gate_type type; ///< Its type
41 unsigned info1; ///< Its first integer annotation
42 unsigned info2; ///< Its second integer annotation
43 unsigned long nb_children; ///< Its number of children
44
45 /** @brief Boost serialisation. */
46 template<class Archive> void serialize(Archive &ar, const unsigned int)
47 {
48 ar & uuid & type & info1 & info2 & nb_children;
49 }
50};
51
52/**
53 * @brief The regions of a few requests, in one circuit.
54 *
55 * The region of a gate (a request of @c count 0) is the gate and the gates
56 * below it down to the named ones, which are stubs: in @c circuit as
57 * variable leaves, so that the load-time folds keep them as they are, and
58 * listed in @c stubs. A gate whose own row would still exceed the wide cap
59 * of the request, with its named children read as their names, is itself
60 * a stub, its children to be asked for by ranges. The region of a range
61 * of children is that of each of them, a named one being a stub; the
62 * children, in order, are listed in @c children.
63 */
65 GenericCircuit circuit; ///< The gates of the regions
66 std::vector<FormulaStub> stubs; ///< The gates left out
67 std::vector<std::string> children; ///< The children asked for, in order
68
69 /** @brief Boost serialisation. */
70 template<class Archive> void serialize(Archive &ar, const unsigned int)
71 {
72 ar & circuit & stubs & children;
73 }
74};
75
76#endif /* FORMULA_REGIONS_H */
Semiring-agnostic in-memory provenance circuit.
The regions of a few requests, in one circuit.
std::vector< std::string > children
The children asked for, in order.
GenericCircuit circuit
The gates of the regions.
std::vector< FormulaStub > stubs
The gates left out.
void serialize(Archive &ar, const unsigned int)
Boost serialisation.
What a region is asked for.
unsigned long from
First child of the range asked for.
pg_uuid_t gate
The gate.
unsigned long count
Number of children asked for, from from; 0 for the region of the gate itself.
A gate left out of a region: a named one.
std::string uuid
The gate.
unsigned long nb_children
Its number of children.
unsigned info2
Its second integer annotation.
gate_type type
Its type.
unsigned info1
Its first integer annotation.
void serialize(Archive &ar, const unsigned int)
Boost serialisation.