22 #ifndef DBA_MEMDB_RESULTS_H 23 #define DBA_MEMDB_RESULTS_H 25 #include <dballe/core/stlutils.h> 26 #include <dballe/memdb/valuestorage.h> 27 #include <dballe/memdb/index.h> 28 #include <dballe/memdb/match.h> 38 template<
typename T>
struct ValueStorage;
41 #define IF_TRACE_QUERY if (1) 42 void trace_query(
const char* fmt, ...);
44 #define IF_TRACE_QUERY if (0) 45 #define trace_query(...) do {} while(0) 88 void add_set(
const std::set<size_t>& p);
91 void add_set(std::unique_ptr< std::set<size_t> > p);
110 bool add(
const Index<K>& index,
const K& val);
113 bool add(
const Index<K>& index,
const K& min,
const K& max);
116 bool add_since(
const Index<K>& index,
const typename Index<K>::const_iterator begin)
119 for (
typename Index<K>::const_iterator i = begin; i != index.end(); ++i)
121 this->add(i->second);
129 bool add_until(
const Index<K>& index,
const typename Index<K>::const_iterator end)
132 for (
typename Index<K>::const_iterator i = index.begin(); i != end; ++i)
134 this->add(i->second);
152 template<
typename OUTITER>
153 void copy_valptrs_to(OUTITER res);
160 template<
typename OUTITER>
161 void copy_indices_to(OUTITER res);
183 if (sequences)
delete sequences;
186 bool found_items_in_index()
const {
return found; }
188 std::unique_ptr< stl::Sequences<size_t> > release_sequences()
190 std::unique_ptr< stl::Sequences<size_t> > res(sequences);
195 void insert(
const T* val)
197 const std::set<size_t>* s = index.
search(val);
198 if (!s || s->empty())
return;
bool empty
True if it has been determined that there are no results.
Definition: results.h:67
bool is_empty() const
Check if we just select all elements.
Definition: results.h:78
void set_to_empty()
Disregard everything and just return no items.
Definition: results.h:81
Definition: mem/cursor.h:14
match::FilterBuilder< T > filter
Filters to apply to each candidate result.
Definition: results.h:104
bool all
True if all elements are selected.
Definition: results.h:64
std::vector< std::set< size_t > * > transient_sets
Keep track of transient sets here, for memory management purpose.
Definition: results.h:55
bool is_select_all() const
Check if we just select all elements.
Definition: results.h:75
Copyright (C) 2008–2010 ARPA-SIM urpsim@smr.arpa.emr.it
Definition: cmdline.h:17
const std::set< size_t > * search(const T &el) const
Lookup all positions for a value.
Build an And of filters step by step.
Definition: match.h:68
stl::SetIntersection< size_t > * indices
Sets of possible results, to be intersected.
Definition: results.h:61
Base class for match functors.
Definition: match.h:36
void add_singleton(size_t singleton)
Add a set of one single element to intersect with the rest.
Definition: results.h:171
Non-template part of Results, split here for faster compilation.
Definition: results.h:51
Index element positions based by one value.
Definition: index.h:41
stl::Sequences< size_t > * others_to_intersect
Sequences of possible results to be intersected.
Definition: results.h:58
Definition: memdb/levtr.h:16