36 #ifndef STAGE_CTRL_STATE_MAP_GROUPING_STORAGE_H 37 #define STAGE_CTRL_STATE_MAP_GROUPING_STORAGE_H 46 #include <unordered_map> 57 using ::util::unConst;
77 using StateData = std::set<GenNode, GenNode::IDComparator>;
78 using Storage = std::unordered_map<BareEntryID, StateData, BareEntryID::UseEmbeddedHash>;
84 using Record = Storage::value_type;
89 return elmTable_.empty();
96 for (Record
const&
entry : elmTable_)
97 siz +=
entry.second.size();
115 iterator
entry = find (elementID);
116 if (entry == elmTable_.end())
119 return getState (*entry, propertyKey);
130 auto res = elmTable_[elementID].emplace (stateMark);
132 unConst(*res.first) = stateMark;
139 iterator
entry = find (elementID);
140 if (entry != elmTable_.end())
142 StateData
const& stateSet = entry->second;
143 auto propertyRecord = findProperty(stateSet, propertyKey);
145 if (propertyRecord != stateSet.end())
146 unConst(stateSet).erase (propertyRecord);
154 iterator
entry = find (elementID);
155 if (entry != elmTable_.end())
156 elmTable_.erase (entry);
160 using iterator = Storage::const_iterator;
162 iterator begin()
const {
return elmTable_.begin(); }
163 iterator end()
const {
return elmTable_.end(); }
168 return elmTable_.find (elementID);
172 getID (Record
const&
entry)
177 static StateData
const&
178 getState (Record
const& entry)
201 StateData
const& stateSet = entry.second;
202 StateData::const_iterator propertyRecord = findProperty (stateSet, propertyKey);
204 if (propertyRecord == stateSet.end())
207 return *propertyRecord;
211 static StateData::const_iterator
212 findProperty (StateData
const& stateSet,
string propertyKey)
214 return std::find_if (stateSet.begin()
218 return propertyKey == stateMark.idi.getSym();
type erased baseclass for building a combined hash and symbolic ID.
Constructor for a specially crafted 'ref GenNode'.
void record(BareEntryID const &elementID, GenNode const &stateMark)
remember the state mark for the denoted element
AnyPair entry(Query< TY > const &query, typename WrapReturn< TY >::Wrapper &obj)
helper to simplify creating mock table entries, wrapped correctly
Any copy and copy construction prohibited.
void clearProperty(BareEntryID const &elementID, string propertyKey)
clear previously recorded state for a given element and specific property
void clearState(BareEntryID const &elementID)
clear any previously recorded state for a given element
Mix-Ins to allow or prohibit various degrees of copying and cloning.
Map storage for captured presentation state information.
Lumiera GTK UI implementation root.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
Generic building block for tree shaped (meta)data structures.
static const Ref NO
symbolic ID ref "_NO_"
GenNode const & retrieve(BareEntryID const &elementID, string propertyKey) const
retrieve captured state
Lumiera error handling (C++ interface).
Bare symbolic and hash ID used for accounting of asset like entries.
generic data element node within a tree
static GenNode const & getState(Record const &entry, string propertyKey)
Access the recorded state mark, if any.