38#ifndef LUMIERA_QUERY_DEFS_REGISTRY_H
39#define LUMIERA_QUERY_DEFS_REGISTRY_H
81 using Table = std::vector< P<TableEntry> >;
112 return storedObj and (storedObj ==
obj_);
119 return one.queryKey < two.queryKey;
144 or
index > table.size()
145 or not table[
index-1])
160 if (
index > table.size())
161 table.resize (
index);
203 :
p(from),
i(from),
e(to)
210 :
p(match),
i(from),
e(to)
221 next =
p->objRef.lock();
258 auto pos = registry.find (entry);
259 auto end = registry.end();
262 return Iter<TAR> (registry.begin(), end);
264 return Iter<TAR> (pos, registry.begin(), end);
281 using RIter = Registry::iterator;
284 RIter pos = registry.lower_bound (entry);
285 if (pos!=registry.end() and
286 pos->queryKey == query)
288 P<TAR> storedObj (pos->objRef.lock());
290 return (storedObj == obj);
293 registry.erase(pos++);
296 registry.insert(pos, entry);
297 ENSURE (registry.find (entry) != registry.end());
328 res += string(entry);
339 using impl::DefsRegistry;
A synchronisation protection guard employing a lock scoped to the parameter type as a whole,...
Customised refcounting smart pointer template, built upon std::shared_ptr, but forwarding type relati...
Wrapper for indexing and ordering.
Generic interface to express a query for specifically typed result elements exposing some capabilitie...
used for enumerating solutions
Iter(II match, II from, II to)
Slot< TAR >::Registry::iterator II
string dump()
helper for diagnostics.
Iter< TAR > candidates(Query< TAR > const &query)
find a sequence of "default" objects possibly matching the query.
bool put(P< TAR > const &obj, Query< TAR > const &query)
register the object as being "default" when searching something similar as designated by the given qu...
bool forget(P< TAR > const &obj)
if this object is registered as "default" in some way, drop the registration.
Any copy and copy construction prohibited.
A front-end for using printf-style formatting.
_Fmt dumpRecord("%2i| %64s --> %s\n")
uint maxSlots(0)
number of different registered Types
std::vector< P< TableEntry > > Table
we maintain an independent defaults registry for every participating kind of object.
Lumiera public interface.
bool remove_if(SET &set, FUN test)
remove all elements fulfilling a given predicate from a (sorted) set.
disable_if< can_IterForEach< Container >, FUN > for_each(Container const &coll, FUN doIt)
operate on all elements of a STL container.
Mix-Ins to allow or prohibit various degrees of copying and cloning.
Customised refcounting smart pointer.
Utilities to support working with predicate queries.
Basic and generic representation of an internal query.
< Functor searching for a specific object
bool operator()(Record const &rec)
Search(P< TAR > const &obj)
holding a single "default object" entry
friend bool operator<(Record one, Record two)
Record(Query< TAR > const &q, P< TAR > const &obj)
every new kind of object (Type) creates a new slot in the main Table holding all registered default o...
static void createSlot(Table &table)
static size_t index
where to find this Slot in every Table
static Registry & access(Table &table)
std::set< Record< TAR > > Registry
A special implementation of lib::Sync, where the storage of the object monitor is associated directly...
Perform operations "for each element" of a collection.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...