27 #ifndef STAGE_CTRL_STATE_MAP_GROUPING_STORAGE_H 28 #define STAGE_CTRL_STATE_MAP_GROUPING_STORAGE_H 37 #include <unordered_map> 48 using ::util::unConst;
68 using StateData = std::set<GenNode, GenNode::IDComparator>;
69 using Storage = std::unordered_map<BareEntryID, StateData, BareEntryID::UseEmbeddedHash>;
75 using Record = Storage::value_type;
80 return elmTable_.empty();
87 for (Record
const&
entry : elmTable_)
88 siz +=
entry.second.size();
106 iterator
entry = find (elementID);
107 if (entry == elmTable_.end())
110 return getState (*entry, propertyKey);
121 auto res = elmTable_[elementID].emplace (stateMark);
123 unConst(*res.first) = stateMark;
130 iterator
entry = find (elementID);
131 if (entry != elmTable_.end())
133 StateData
const& stateSet = entry->second;
134 auto propertyRecord = findProperty(stateSet, propertyKey);
136 if (propertyRecord != stateSet.end())
137 unConst(stateSet).erase (propertyRecord);
145 iterator
entry = find (elementID);
146 if (entry != elmTable_.end())
147 elmTable_.erase (entry);
151 using iterator = Storage::const_iterator;
153 iterator begin()
const {
return elmTable_.begin(); }
154 iterator end()
const {
return elmTable_.end(); }
159 return elmTable_.find (elementID);
163 getID (Record
const&
entry)
168 static StateData
const&
169 getState (Record
const& entry)
192 StateData
const& stateSet = entry.second;
193 StateData::const_iterator propertyRecord = findProperty (stateSet, propertyKey);
195 if (propertyRecord == stateSet.end())
198 return *propertyRecord;
202 static StateData::const_iterator
203 findProperty (StateData
const& stateSet,
string propertyKey)
205 return std::find_if (stateSet.begin()
209 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.