Lumiera  0.pre.03
»edityourfreedom«
StateMapGroupingStorage Class Reference

#include "gui/ctrl/state-map-grouping-storage.hpp"

Description

Map storage for captured presentation state information.

The master table is an association of model::Tangible element IDs to StateData records, which are a set of property data elements. The key of the stored elements acts as propertyKey and was chosen by the originating UI element. It is assumed that the entry last seen represents the current state of this property, so previous records are overwritten. Access to unknown data is marked by returning diff::Ref::NO rsp. Storage::end() (when searching)

Todo:
reinvestigate with GCC-5 //////////////////////////////////TICKET #991
See also
StateMapGroupingStorage_test

Definition at line 74 of file state-map-grouping-storage.hpp.

Public Types

using iterator = Storage::const_iterator
 
using Record = Storage::value_type
 

Public Member Functions

iterator begin () const
 
void clear ()
 
void clearProperty (BareEntryID const &elementID, string propertyKey)
 clear previously recorded state for a given element and specific property More...
 
void clearState (BareEntryID const &elementID)
 clear any previously recorded state for a given element More...
 
bool empty () const
 
iterator end () const
 
iterator find (BareEntryID const &elementID) const
 
void record (BareEntryID const &elementID, GenNode const &stateMark)
 remember the state mark for the denoted element More...
 
GenNode const & retrieve (BareEntryID const &elementID, string propertyKey) const
 retrieve captured state More...
 
size_t size () const
 

Static Public Member Functions

static BareEntryID const & getID (Record const &entry)
 
static StateData const & getState (Record const &entry)
 
static GenNode const & getState (Record const &entry, string propertyKey)
 Access the recorded state mark, if any. More...
 

Private Types

using StateData = std::set< GenNode, GenNode::IDComparator >
 
using Storage = std::unordered_map< BareEntryID, StateData, BareEntryID::UseEmbeddedHash >
 

Static Private Member Functions

static StateData::const_iterator findProperty (StateData const &stateSet, string propertyKey)
 

Private Attributes

Storage elmTable_
 

Additional Inherited Members

- Private Member Functions inherited from NonCopyable
 NonCopyable ()=default
 
 NonCopyable (NonCopyable const &)=delete
 
 ~NonCopyable ()=default
 
NonCopyableoperator= (NonCopyable const &)=delete
 

Member Typedef Documentation

◆ StateData

using StateData = std::set<GenNode, GenNode::IDComparator>
private

Definition at line 77 of file state-map-grouping-storage.hpp.

◆ Storage

using Storage = std::unordered_map<BareEntryID, StateData, BareEntryID::UseEmbeddedHash>
private

Definition at line 78 of file state-map-grouping-storage.hpp.

◆ Record

using Record = Storage::value_type

Definition at line 84 of file state-map-grouping-storage.hpp.

◆ iterator

using iterator = Storage::const_iterator

Definition at line 160 of file state-map-grouping-storage.hpp.

Member Function Documentation

◆ empty()

bool empty ( ) const
inline

Definition at line 87 of file state-map-grouping-storage.hpp.

◆ size()

size_t size ( ) const
inline

Definition at line 93 of file state-map-grouping-storage.hpp.

Referenced by StateMapGroupingStorage_test::run().

+ Here is the caller graph for this function:

◆ clear()

void clear ( )
inline

Definition at line 102 of file state-map-grouping-storage.hpp.

Referenced by StateRecorder::clearState(), and StateMapGroupingStorage_test::run().

+ Here is the caller graph for this function:

◆ retrieve()

GenNode const& retrieve ( BareEntryID const &  elementID,
string  propertyKey 
) const
inline

retrieve captured state

Returns
reference to the state mark last seen for the denoted property or reference to a generic "no" marker (Ref::NO)

Definition at line 113 of file state-map-grouping-storage.hpp.

References StateMapGroupingStorage::find(), StateMapGroupingStorage::getState(), and Ref::NO.

Referenced by StateRecorder::currentState(), StateRecorder::replayState(), and StateMapGroupingStorage_test::run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ record()

void record ( BareEntryID const &  elementID,
GenNode const &  stateMark 
)
inline

remember the state mark for the denoted element

Note
stateMark value is assigned to a previously existing entry with the same ID-symbol. If no such entry exists, a (heap allocated) copy of the state mark is stored.

Definition at line 128 of file state-map-grouping-storage.hpp.

References util::unConst().

Referenced by StateRecorder::recordState(), and StateMapGroupingStorage_test::run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clearProperty()

void clearProperty ( BareEntryID const &  elementID,
string  propertyKey 
)
inline

clear previously recorded state for a given element and specific property

Definition at line 137 of file state-map-grouping-storage.hpp.

References StateMapGroupingStorage::find(), StateMapGroupingStorage::findProperty(), and util::unConst().

Referenced by StateRecorder::recordState(), and StateMapGroupingStorage_test::run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clearState()

void clearState ( BareEntryID const &  elementID)
inline

clear any previously recorded state for a given element

Definition at line 152 of file state-map-grouping-storage.hpp.

References StateMapGroupingStorage::find().

Referenced by StateRecorder::recordState().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ begin()

iterator begin ( ) const
inline

Definition at line 162 of file state-map-grouping-storage.hpp.

◆ end()

iterator end ( ) const
inline

Definition at line 163 of file state-map-grouping-storage.hpp.

Referenced by StateRecorder::replayAllProperties(), and StateMapGroupingStorage_test::run().

+ Here is the caller graph for this function:

◆ find()

iterator find ( BareEntryID const &  elementID) const
inline

Definition at line 166 of file state-map-grouping-storage.hpp.

Referenced by StateMapGroupingStorage::clearProperty(), StateMapGroupingStorage::clearState(), StateRecorder::replayAllProperties(), StateMapGroupingStorage::retrieve(), and StateMapGroupingStorage_test::run().

+ Here is the caller graph for this function:

◆ getID()

static BareEntryID const& getID ( Record const &  entry)
inlinestatic

Definition at line 172 of file state-map-grouping-storage.hpp.

Referenced by StateRecorder::replayAllState(), StateRecorder::replayPropertiesOf(), and StateMapGroupingStorage_test::run().

+ Here is the caller graph for this function:

◆ getState() [1/2]

static StateData const& getState ( Record const &  entry)
inlinestatic

Definition at line 178 of file state-map-grouping-storage.hpp.

Referenced by StateRecorder::replayAllState(), StateRecorder::replayPropertiesOf(), StateMapGroupingStorage::retrieve(), and StateMapGroupingStorage_test::run().

+ Here is the caller graph for this function:

◆ getState() [2/2]

static GenNode const& getState ( Record const &  entry,
string  propertyKey 
)
inlinestatic

Access the recorded state mark, if any.

Warning
we can't search logarithmically, since this would require to construct another GenNode to represent the key.
Todo:
seemingly GCC-4.9 doesn't yet support the "transparent search" feature of C++14, where std::set would support an additional overload of the find() function, templated to accept a value convertible to some key equivalent, which needs to be understood by the comparator of the set. To trigger using this overload, the comparator has to define a suitable operator() and in addition a marker type is_transparent. See transparent-cmp and the [reference][cind-cpp14] for explanation. //////////////////////////////////TICKET #991

Definition at line 199 of file state-map-grouping-storage.hpp.

References StateMapGroupingStorage::findProperty(), and Ref::NO.

+ Here is the call graph for this function:

◆ findProperty()

static StateData::const_iterator findProperty ( StateData const &  stateSet,
string  propertyKey 
)
inlinestaticprivate

Definition at line 212 of file state-map-grouping-storage.hpp.

Referenced by StateMapGroupingStorage::clearProperty(), and StateMapGroupingStorage::getState().

+ Here is the caller graph for this function:

Member Data Documentation

◆ elmTable_

Storage elmTable_
private

Definition at line 81 of file state-map-grouping-storage.hpp.

+ Inheritance diagram for StateMapGroupingStorage:
+ Collaboration diagram for StateMapGroupingStorage:

The documentation for this class was generated from the following file: