class GestureArena

Defined at line 43 of file ../../src/ui/scenic/lib/input/gesture_arena.h

Class for deciding Gesture Disambiguation contests.

On construction the arena takes a list of all the clients contending, in priority order, for the

stream. The arena then receives responses for the every contender, and uses these in

combination with priority to decide the owner ("winner") of the stream.

If there's only a single contender then the contest is immediately decided in favor of that

contender.

Intended use:

InputSystem creates one GestureArena every time a new stream begins, designating contenders

for that stream at construction.

Each time a new set of events arrives for the stream InputSystem should call UpdateStream() with

the number of new events as well a bool telling the arena whether there will be any more events.

RecordResponses() should be called once for each event for every contender (until the contender

has been designated either a winner or a loser). With every call the arena makes an attempt at

determining a winner, returning a ContestResults struct containing any new results from

the contest.

After the contest ends the arena can be kept around to track stream and winner state, but no more

calls to RecordResponses() should be made.

Public Members

static const Priority kInvalidPriority

Public Methods

void ~GestureArena ()

Defined at line 56 of file ../../src/ui/scenic/lib/input/gesture_arena.h

bool stream_has_ended ()

Defined at line 72 of file ../../src/ui/scenic/lib/input/gesture_arena.h

bool contest_has_ended ()

Defined at line 73 of file ../../src/ui/scenic/lib/input/gesture_arena.h

bool contains (ContenderId contender_id)

Defined at line 74 of file ../../src/ui/scenic/lib/input/gesture_arena.h

void GestureArena (std::vector<ContenderId> contenders)

|contenders| should have no duplicates and be in priority order from highest to lowest.

Defined at line 145 of file ../../src/ui/scenic/lib/input/gesture_arena.cc

void UpdateStream (uint64_t new_message_count, bool is_last_message)

Update the stream with new messages. |new_message_count| denotes how many new messages were

added to the stream (and therefore how many messages we expect responses for), while

|is_last_message| denotes whether they were the last messages of the stream.

Defined at line 168 of file ../../src/ui/scenic/lib/input/gesture_arena.cc

ContestResults RecordResponses (ContenderId contender_id, const std::vector<GestureResponse> & responses)

To be called whenever a contender has a new set of responses. The responses should be

chronologically ordered, with the earliest response first.

To remove a contender, pass in a NO response.

Defined at line 174 of file ../../src/ui/scenic/lib/input/gesture_arena.cc

std::vector<ContenderId> contenders ()

Returns a vector of all remaining contenders.

Defined at line 291 of file ../../src/ui/scenic/lib/input/gesture_arena.cc

Records