souffle
2.0.2-371-g6315b36
|
Go to the documentation of this file.
26 #include <unordered_map>
39 std::size_t
operator()(std::vector<RamDomain> record)
const {
41 std::hash<RamDomain> domainHash;
43 seed ^= domainHash(value) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
64 #pragma omp critical(record_pack)
70 #pragma omp critical(record_unpack)
72 assert(
indexToRecord.size() <= std::numeric_limits<RamUnsigned>::max());
91 std::vector<RamDomain> tmp(
arity);
95 return pack(std::move(tmp));
101 #pragma omp critical(record_unpack)
118 std::unordered_map<size_t, RecordMap>::const_iterator iter;
119 #pragma omp critical(RecordTableGetForArity)
122 iter =
maps.find(arity);
124 assert(iter !=
maps.end() &&
"Attempting to unpack record for non-existing arity");
125 return (iter->second).unpack(ref);
131 std::unordered_map<size_t, RecordMap>::iterator mapsIterator;
132 #pragma omp critical(RecordTableGetForArity)
135 mapsIterator =
maps.emplace(arity, arity).first;
137 return mapsIterator->second;
141 std::unordered_map<size_t, RecordMap>
maps;
145 template <std::
size_t Arity>
146 RamDomain pack(RecordTable& recordTab, Tuple<RamDomain, Arity>
const& tuple) {
147 return recordTab.pack(tuple.data(), Arity);
151 template <std::
size_t Arity>
hash function for unordered record map
const RamDomain * unpack(RamDomain index) const
convert record reference to a record pointer
virtual ~RecordTable()=default
const RamDomain * unpack(RamDomain ref, size_t arity) const
convert record reference to a record
RamDomain pack(std::vector< RamDomain > vector)
converts record to a record reference
const RamDomain * data
Allows printing using WriteStream.
Bidirectional mappping between records and record references.
RamDomain pack(RecordTable &recordTab, Tuple< RamDomain, Arity > const &tuple)
helper to convert tuple to record reference for the synthesiser
RamDomain pack(const RamDomain *tuple, size_t arity)
convert record to record reference
std::unordered_map< size_t, RecordMap > maps
Arity/RecordMap association.
std::vector< std::vector< RamDomain > > indexToRecord
array of records; index represents record reference
std::unordered_map< std::vector< RamDomain >, RamDomain, RecordHash > recordToIndex
map from records to references
std::size_t operator()(std::vector< RamDomain > record) const
const size_t arity
arity of record
RecordMap & lookupArity(size_t arity)
lookup RecordMap for a given arity; if it does not exist, create new RecordMap
To ramBitCast(From source)
In C++20 there will be a new way to cast between types by reinterpreting bits (std::bit_cast),...
Defines a tuple for the OO interface such that relations with varying columns can be accessed.